2008-09-30 16:41:23 +08:00
|
|
|
function checkState( element )
|
2008-07-14 21:54:50 +08:00
|
|
|
{
|
2015-08-26 23:21:29 +08:00
|
|
|
|
2008-07-14 21:54:50 +08:00
|
|
|
var form = element.form;
|
|
|
|
|
|
|
|
var minIndex = running?2:1;
|
2008-10-07 17:02:17 +08:00
|
|
|
if ( form.runState.selectedIndex < minIndex )
|
2008-07-14 21:54:50 +08:00
|
|
|
{
|
|
|
|
form.saveBtn.disabled = true;
|
|
|
|
form.deleteBtn.disabled = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
form.saveBtn.disabled = false;
|
|
|
|
form.deleteBtn.disabled = false;
|
|
|
|
}
|
2015-08-26 23:21:29 +08:00
|
|
|
|
2008-10-07 17:02:17 +08:00
|
|
|
if ( form.newState.value != '' )
|
2008-07-14 21:54:50 +08:00
|
|
|
form.saveBtn.disabled = false;
|
2015-08-26 23:21:29 +08:00
|
|
|
|
|
|
|
// PP if we are in 'default' state, disable delete
|
|
|
|
// you can still save
|
|
|
|
if (element.value.toLowerCase() == 'default' )
|
|
|
|
{
|
|
|
|
form.saveBtn.disabled = false;
|
|
|
|
form.deleteBtn.disabled = true;
|
|
|
|
}
|
|
|
|
|
2008-07-14 21:54:50 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
function saveState( element )
|
|
|
|
{
|
|
|
|
var form = element.form;
|
2015-08-26 23:21:29 +08:00
|
|
|
|
2008-07-14 21:54:50 +08:00
|
|
|
form.view.value = currentView;
|
|
|
|
form.action.value = 'save';
|
|
|
|
form.submit();
|
|
|
|
}
|
|
|
|
|
|
|
|
function deleteState( element )
|
|
|
|
{
|
|
|
|
var form = element.form;
|
|
|
|
form.view.value = currentView;
|
|
|
|
form.action.value = 'delete';
|
|
|
|
form.submit();
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( applying )
|
|
|
|
{
|
|
|
|
function submitForm()
|
|
|
|
{
|
|
|
|
$('contentForm').submit();
|
|
|
|
}
|
|
|
|
window.addEvent( 'domready', function() { submitForm.delay( 1000 ); } );
|
|
|
|
}
|