zoneminder/web/skins/classic/views/js/state.js

45 lines
1022 B
JavaScript
Raw Normal View History

2017-05-19 01:50:56 +08:00
function checkState( element ) {
var form = element.form;
2017-05-19 01:50:56 +08:00
var minIndex = running?2:1;
if ( form.runState.selectedIndex < minIndex ) {
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
2017-05-19 01:50:56 +08:00
if ( form.newState.value != '' )
form.saveBtn.disabled = false;
2015-08-26 23:21:29 +08:00
2017-05-19 01:50:56 +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;
}
}
2017-05-19 01:50:56 +08:00
function saveState( element ) {
var form = element.form;
2015-08-26 23:21:29 +08:00
2017-05-19 01:50:56 +08:00
form.view.value = currentView;
form.action.value = 'save';
form.submit();
}
2017-05-19 01:50:56 +08:00
function deleteState( element ) {
var form = element.form;
form.view.value = currentView;
form.action.value = 'delete';
form.submit();
}
2017-05-19 01:50:56 +08:00
if ( applying ) {
function submitForm() {
$('contentForm').submit();
}
window.addEvent( 'domready', function() { submitForm.delay( 1000 ); } );
}