Merge branch 'master' of github.com:ZoneMinder/zoneminder

This commit is contained in:
Isaac Connor 2020-10-15 17:20:10 -04:00
commit 4f56f9d82b
17 changed files with 135 additions and 214 deletions

View File

@ -14,21 +14,6 @@ if ( $error ) {
return;
}
$output_str = '';
if ( isset($output) ) {
$output_str = '<p>'.implode('<br/>', $output).'</p>'.PHP_EOL;
}
$cancel_str = '';
if ( isset($_POST['when']) and ($_POST['when'] != 'NOW') and ($action != 'cancel') ) {
$cancel_str = '<p>You may cancel this shutdown by clicking '.translate('Cancel').'</p>'.PHP_EOL;
}
$cancel_btn = '';
if ( isset($_POST['when']) and ($_POST['when'] != 'NOW') and ($action != 'cancel') ) {
$cancel_btn = '<button type="submit" class="btn btn-primary" name="action" value="cancel">' .translate('Cancel'). '</button>'.PHP_EOL;
}
?>
<div class="modal" id="shutdownModal" tabindex="-1">
<div class="modal-dialog">
@ -40,14 +25,6 @@ if ( isset($_POST['when']) and ($_POST['when'] != 'NOW') and ($action != 'cancel
</button>
</div>
<div class="modal-body">
<form name="contentForm" id="shutdownForm" method="post" action="?">
<?php
// We have to manually insert the csrf key into the form when using a modal generated via ajax call
echo getCSRFinputHTML();
?>
<input type="hidden" name="view" value="shutdown"/>
<?php echo $output_str ?>
<?php echo $cancel_str ?>
<p class="warning"><h2>Warning</h2>
This command will either shutdown or restart all ZoneMinder Servers<br/>
</p>
@ -55,11 +32,13 @@ if ( isset($_POST['when']) and ($_POST['when'] != 'NOW') and ($action != 'cancel
<input type="radio" name="when" value="now" id="whennow"/><label for="whennow">Now</label>
<input type="radio" name="when" value="1min" id="when1min" checked="checked"/><label for="when1min">1 Minute</label>
</p>
<p id="respText" class="invisible">
</p>
</div>
<div class="modal-footer">
<?php echo $cancel_btn ?>
<button type="submit" id="restartBtn" class="btn btn-primary" name="action" value="restart"><?php echo translate('Restart') ?></button>
<button type="submit" id="shutdownBtn" class="btn btn-primary" name="action" value="shutdown"><?php echo translate('Shutdown') ?></button>
<button type="button" class="btn btn-primary" data-command="cancel" data-on-click-this="manageShutdownBtns" id="cancelBtn" disabled><?php echo translate('Cancel') ?></button>
<button type="button" class="btn btn-primary" data-command="restart" data-on-click-this="manageShutdownBtns"><?php echo translate('Restart') ?></button>
<button type="button" class="btn btn-primary" data-command="shutdown" data-on-click-this="manageShutdownBtns"><?php echo translate('Shutdown') ?></button>
<button type="button" class="btn btn-secondary" data-dismiss="modal"><?php echo translate('Close') ?></button>
</div>
</form>

58
web/ajax/shutdown.php Normal file
View File

@ -0,0 +1,58 @@
<?php
//
// ZoneMinder web action file
// Copyright (C) 2019 ZoneMinder LLC
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
$message = '';
if ( !canEdit('System') ) {
$message = 'Need System permissions to shutdown server';
} else if ( !isset($_REQUEST['command']) ) {
$message = 'A command is required. Cannot continue';
}
if ( $message ) {
ZM\Warning($message);
ajaxError($message);
return;
}
$data = array();
$when = isset($_REQUEST['when']) and $_REQUEST['when'] == 'now' ? 'now' : '+1';
$command = $_REQUEST['command'];
if ( $command == 'shutdown' ) {
exec('sudo -n '.ZM_PATH_SHUTDOWN." -P $when 2>&1", $data['output'], $data['rc']);
#exec('sudo -n /bin/systemctl poweroff -i 2>&1', $data['output'], $data['rc']);
ZM\Debug('Shutdown output ' .$data['rc'].' '.implode("\n",$data['output']));
#ZM\Debug("Shutdown output " . shell_exec('/bin/systemctl poweroff -i 2>&1'));
} else if ( $command == 'restart' ) {
$data['output'] = array();
exec('sudo -n '.ZM_PATH_SHUTDOWN." -r $when 2>&1", $data['output'], $data['rc']);
#exec('sudo -n /bin/systemctl reboot -i 2>&1', $data['output'], $data['rc']);
ZM\Debug("Shutdown output " . implode("\n",$data['output']));
} else if ( $command == 'cancel' ) {
$data['output'] = array();
exec('sudo '.ZM_PATH_SHUTDOWN.' -c 2>&1', $data['output'], $data['rc']);
} else {
ajaxError('Unknwn command:'.$command);
return;
}
ajaxResponse($data);
return;
?>

View File

@ -1,44 +0,0 @@
<?php
//
// ZoneMinder web action file
// Copyright (C) 2019 ZoneMinder LLC
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
if ( !canEdit('System') ) {
ZM\Warning('Need System permissions to shutdown server');
return;
}
if ( $action ) {
$when = isset($_POST['when']) and $_POST['when'] == 'now' ? 'now' : '+1';
if ( $action == 'shutdown' ) {
$output = array();
$rc = 0;
exec('sudo -n '.ZM_PATH_SHUTDOWN." -P $when 2>&1", $output, $rc);
#exec('sudo -n /bin/systemctl poweroff -i 2>&1', $output, $rc);
ZM\Debug("Shutdown output $rc " . implode("\n",$output));
#ZM\Debug("Shutdown output " . shell_exec('/bin/systemctl poweroff -i 2>&1'));
} else if ( $action == 'restart' ) {
$output = array();
exec('sudo -n '.ZM_PATH_SHUTDOWN." -r $when 2>&1", $output);
#exec('sudo -n /bin/systemctl reboot -i 2>&1', $output);
ZM\Debug("Shutdown output " . implode("\n",$output));
} else if ( $action == 'cancel' ) {
$output = array();
exec('sudo '.ZM_PATH_SHUTDOWN.' -c 2>&1', $output);
}
} # end if action
?>

View File

@ -324,13 +324,20 @@ if ( currentView != 'none' && currentView != 'login' ) {
});
});
// After retieving modal html via Ajax, this will insert it into the DOM
function insertModalHtml(name, html) {
var modal = $j('#' + name);
if ( modal.length ) {
modal.replaceWith(html);
} else {
$j("body").append(html);
}
}
// Manage the modal html we received after user clicks help link
function optionhelpModal(data) {
if ( $j('#optionhelp').length ) {
$j('#optionhelp').replaceWith(data.html);
} else {
$j("body").append(data.html);
}
insertModalHtml('optionhelp', data.html);
$j('#optionhelp').modal('show');
// Manage the CLOSE optionhelp modal button
@ -643,11 +650,7 @@ function reminderClickFunction() {
function enoperm() {
$j.getJSON(thisUrl + '?request=modal&modal=enoperm')
.done(function(data) {
if ( $j('#ENoPerm').length ) {
$j('#ENoPerm').replaceWith(data.html);
} else {
$j("body").append(data.html);
}
insertModalHtml('ENoPerm', data.html);
$j('#ENoPerm').modal('show');
// Manage the CLOSE optionhelp modal button
@ -661,11 +664,7 @@ function enoperm() {
function getLogoutModal() {
$j.getJSON(thisUrl + '?request=modal&modal=logout')
.done(function(data) {
if ( $j('#modalLogout').length ) {
$j('#modalLogout').replaceWith(data.html);
} else {
$j("body").append(data.html);
}
insertModalHtml('modalLogout', data.html);
})
.fail(logAjaxFail);
}
@ -673,11 +672,7 @@ function getLogoutModal() {
function getStateModal() {
$j.getJSON(thisUrl + '?request=modal&modal=state')
.done(function(data) {
if ( $j('#modalState').length ) {
$j('#modalState').replaceWith(data.html);
} else {
$j("body").append(data.html);
}
insertModalHtml('modalState', data.html);
$j('#modalState').modal('show');
manageStateModalBtns();
})
@ -762,11 +757,7 @@ function getModal(id) {
return;
}
if ( $j('#'+id).length ) {
$j('#'+id).replaceWith(data.html);
} else {
$j('body').append(data.html);
}
insertModalHtml(id, data.html);
manageModalBtns(id);
modal = $j('#'+id+'Modal');
if ( ! modal.length ) {
@ -841,27 +832,35 @@ function exportEvent() {
$j('#exportProgress').removeClass( 'invisible' );
}
// Load the Function modal on page load
// Loads the shutdown modal
function getShutdownModal() {
$j.getJSON(thisUrl + '?request=modal&modal=shutdown')
.done(function(data) {
if ( $j('#shutdownModal').length ) {
$j('#shutdownModal').replaceWith(data.html);
} else {
$j("body").append(data.html);
}
// Manage the Shutdown modal
insertModalHtml('shutdownModal', data.html);
dataOnClickThis();
$j('#shutdownModal').modal('show');
// Redirect to the current view after the form is submitted - avoids a blank screen
$j('#shutdownForm').append('<input type="hidden" name="redirect" value="'+ currentView +'" />');
$j('#restartBtn').click(function(evt) {
evt.preventDefault();
$j('#shutdownForm').submit();
});
$j('#shutdownBtn').click(function(evt) {
evt.preventDefault();
$j('#shutdownForm').submit();
});
})
.fail(logAjaxFail);
}
function manageShutdownBtns(element) {
var cmd = element.getAttribute('data-command');
var when = $j('#when1min').is(':checked') ? '1min' : 'now';
var respText = $j('#respText');
$j.getJSON(thisUrl + '?request=shutdown&when=' + when + '&command=' + cmd)
.done(function(data) {
respText.removeClass('invisible');
if ( data.rc ) {
respText.html('<h2>Error</h2>' + data.output);
} else {
$j('#cancelBtn').prop('disabled', false);
if ( cmd == 'cancel' ) {
respText.html('<h2>Success</h2>Event has been cancelled');
} else {
respText.html('<h2>Success</h2>You may cancel this shutdown by clicking ' + cancelString);
}
}
})
.fail(logAjaxFail);
}

View File

@ -31,6 +31,7 @@ var currentView = '<?php echo $view ?>';
var exportProgressString = '<?php echo addslashes(translate('Exporting')) ?>';
var exportFailedString = '<?php echo translate('ExportFailed') ?>';
var exportSucceededString = '<?php echo translate('ExportSucceeded') ?>';
var cancelString = '<?php echo translate('Cancel') ?>';
<?php
/* We can't trust PHP_SELF on a path like /index.php/"%3E%3Cimg src=x onerror=prompt('1');%3E which
will still load index.php but will include the arbitrary payload after `.php/`. To mitigate this,

View File

@ -121,7 +121,7 @@ getBodyTopHTML();
<button id="backBtn" class="btn btn-normal" data-toggle="tooltip" data-placement="top" title="<?php echo translate('Back') ?>" disabled><i class="fa fa-arrow-left"></i></button>
<button id="refreshBtn" class="btn btn-normal" data-toggle="tooltip" data-placement="top" title="<?php echo translate('Refresh') ?>" ><i class="fa fa-refresh"></i></button>
<button id="tlineBtn" class="btn btn-normal" data-toggle="tooltip" data-placement="top" title="<?php echo translate('ShowTimeline') ?>" ><i class="fa fa-history"></i></button>
<a class="btn btn-normal" href="?view=filter<?php echo $filterQuery ?>"><?php echo translate('Filter') ?></a>
<button id="filterBtn" class="btn btn-normal" data-toggle="tooltip" data-placement="top" title="<?php echo translate('Filter') ?>"><i class="fa fa-filter"></i></button>
<button id="viewBtn" class="btn btn-normal" data-toggle="tooltip" data-placement="top" title="<?php echo translate('View') ?>" disabled><i class="fa fa-binoculars"></i></button>
<button id="archiveBtn" class="btn btn-normal" data-toggle="tooltip" data-placement="top" title="<?php echo translate('Archive') ?>" disabled><i class="fa fa-archive"></i></button>
<button id="unarchiveBtn" class="btn btn-normal" data-toggle="tooltip" data-placement="top" title="<?php echo translate('Unarchive') ?>" disabled><i class="fa fa-file-archive-o"></i></button>

View File

@ -173,11 +173,7 @@ function initPage() {
if ( showDonatePopup ) {
$j.getJSON(thisUrl + '?request=modal&modal=donate')
.done(function(data) {
if ( $j('#donate').length ) {
$j('#donate').replaceWith(data.html);
} else {
$j("body").append(data.html);
}
insertModalHtml('donate', data.html);
$j('#donate').modal('show');
// Manage the Apply button
$j('#donateApplyBtn').click(function(evt) {
@ -203,11 +199,7 @@ function initPage() {
// Load the Function modal on page load
$j.getJSON(thisUrl + '?request=modal&modal=function')
.done(function(data) {
if ( $j('#modalFunction').length ) {
$j('#modalFunction').replaceWith(data.html);
} else {
$j("body").append(data.html);
}
insertModalHtml('modalFunction', data.html);
// Manage the Function modal
manageFunctionModal();
})

View File

@ -34,11 +34,7 @@ function getIdSelections() {
function getDelConfirmModal(key) {
$j.getJSON(thisUrl + '?request=modal&modal=delconfirm&key=' + key)
.done(function(data) {
if ( $j('#deleteConfirm').length ) {
$j('#deleteConfirm').replaceWith(data.html);
} else {
$j("body").append(data.html);
}
insertModalHtml('deleteConfirm', data.html);
manageDelConfirmModalBtns();
})
.fail(logAjaxFail);

View File

@ -6,11 +6,7 @@ var deleteBtn = $j('#deleteBtn');
function getDeviceModal(did) {
$j.getJSON(thisUrl + '?request=modal&modal=device&did=' + did)
.done(function(data) {
if ( $j('#deviceModal').length ) {
$j('#deviceModal').replaceWith(data.html);
} else {
$j("body").append(data.html);
}
insertModalHtml('deviceModal', data.html);
$j('#deviceModal').modal('show');
// Manage the Save button
$j('#deviceSaveBtn').click(function(evt) {
@ -37,11 +33,7 @@ function enableDeviceModal() {
function getDelConfirmModal(key) {
$j.getJSON(thisUrl + '?request=modal&modal=delconfirm&key=' + key)
.done(function(data) {
if ( $j('#deleteConfirm').length ) {
$j('#deleteConfirm').replaceWith(data.html);
} else {
$j("body").append(data.html);
}
insertModalHtml('deleteConfirm', data.html);
manageDelConfirmModalBtns();
})
.fail(logAjaxFail);

View File

@ -438,14 +438,14 @@ function streamFastRev( action ) {
function streamPrev(action) {
if ( action ) {
$j(".vjsMessage").remove();
location.replace(thisUrl + '?view=event&eid=' + prevEventId + filterQuery + sortQuery + '&popup='+popup);
location.replace(thisUrl + '?view=event&eid=' + prevEventId + filterQuery + sortQuery);
return;
if ( vid && PrevEventDefVideoPath.indexOf("view_video") > 0 ) {
CurEventDefVideoPath = PrevEventDefVideoPath;
eventQuery(prevEventId);
} else if (zmsBroke || (vid && PrevEventDefVideoPath.indexOf("view_video") < 0) || $j("#vjsMessage").length || PrevEventDefVideoPath.indexOf("view_video") > 0) {//zms broke, leaving videojs, last event, moving to videojs
location.replace(thisUrl + '?view=event&eid=' + prevEventId + filterQuery + sortQuery + '&popup='+popup);
location.replace(thisUrl + '?view=event&eid=' + prevEventId + filterQuery + sortQuery);
} else {
streamReq.send(streamParms+"&command="+CMD_PREV);
streamPlay();
@ -467,13 +467,13 @@ function streamNext(action) {
// We used to try to dynamically update all the bits in the page, which is really complex
// How about we just reload the page?
//
location.replace(thisUrl + '?view=event&eid=' + nextEventId + filterQuery + sortQuery + '&popup='+popup);
location.replace(thisUrl + '?view=event&eid=' + nextEventId + filterQuery + sortQuery);
return;
if ( vid && ( NextEventDefVideoPath.indexOf("view_video") > 0 ) ) { //on and staying with videojs
CurEventDefVideoPath = NextEventDefVideoPath;
eventQuery(nextEventId);
} else if ( zmsBroke || (vid && NextEventDefVideoPath.indexOf("view_video") < 0) || NextEventDefVideoPath.indexOf("view_video") > 0) {//reload zms, leaving vjs, moving to vjs
location.replace(thisUrl + '?view=event&eid=' + nextEventId + filterQuery + sortQuery + '&popup='+popup);
location.replace(thisUrl + '?view=event&eid=' + nextEventId + filterQuery + sortQuery);
} else {
streamReq.send(streamParms+"&command="+CMD_NEXT);
streamPlay();
@ -961,11 +961,7 @@ function renameEvent() {
function editEvent() {
$j.getJSON(thisUrl + '?request=modal&modal=eventdetail&eid='+eventData.Id)
.done(function(data) {
if ( $j('#eventDetailModal').length ) {
$j('#eventDetailModal').replaceWith(data.html);
} else {
$j("body").append(data.html);
}
insertModalHtml('eventDetailModal', data.html);
$j('#eventDetailModal').modal('show');
// Manage the Save button
$j('#eventDetailSaveBtn').click(function(evt) {

View File

@ -39,11 +39,7 @@ function getArchivedSelections() {
function getDelConfirmModal() {
$j.getJSON(thisUrl + '?request=modal&modal=delconfirm')
.done(function(data) {
if ( $j('#deleteConfirm').length ) {
$j('#deleteConfirm').replaceWith(data.html);
} else {
$j("body").append(data.html);
}
insertModalHtml('deleteConfirm', data.html);
manageDelConfirmModalBtns();
})
.fail(logAjaxFail);
@ -77,11 +73,7 @@ function manageDelConfirmModalBtns() {
function getEventDetailModal(eid) {
$j.getJSON(thisUrl + '?request=modal&modal=eventdetail&eids[]=' + eid)
.done(function(data) {
if ( $j('#eventDetailModal').length ) {
$j('#eventDetailModal').replaceWith(data.html);
} else {
$j("body").append(data.html);
}
insertModalHtml('eventDetailModal', data.html);
$j('#eventDetailModal').modal('show');
// Manage the Save button
$j('#eventDetailSaveBtn').click(function(evt) {
@ -157,6 +149,12 @@ function initPage() {
window.location.assign('?view=timeline'+filterQuery);
});
// Manage the FILTER Button
document.getElementById("filterBtn").addEventListener("click", function onFilterClick(evt) {
evt.preventDefault();
window.location.assign('?view=filter'+filterQuery);
});
// Manage the VIEW button
document.getElementById("viewBtn").addEventListener("click", function onViewClick(evt) {
var selections = getIdSelections();
@ -212,11 +210,7 @@ function initPage() {
evt.preventDefault();
$j.getJSON(thisUrl + '?request=modal&modal=eventdetail&eids[]='+selections.join('&eids[]='))
.done(function(data) {
if ( $j('#eventDetailModal').length ) {
$j('#eventDetailModal').replaceWith(data.html);
} else {
$j("body").append(data.html);
}
insertModalHtml('eventDetailModal', data.html);
$j('#eventDetailModal').modal('show');
// Manage the Save button
$j('#eventDetailSaveBtn').click(function(evt) {
@ -242,11 +236,7 @@ function initPage() {
evt.preventDefault();
$j.getJSON(thisUrl + '?request=modal&modal=download&eids[]='+selections.join('&eids[]='))
.done(function(data) {
if ( $j('#downloadModal').length ) {
$j('#downloadModal').replaceWith(data.html);
} else {
$j("body").append(data.html);
}
insertModalHtml('downloadModal', data.html);
$j('#downloadModal').modal('show');
// Manage the GENERATE DOWNLOAD button
$j('#exportButton').click(exportEvent);

View File

@ -83,11 +83,7 @@ function exportEvents( ) {
function getEventDetailModal(eid) {
$j.getJSON(thisUrl + '?request=modal&modal=eventdetail&eids[]=' + eid)
.done(function(data) {
if ( $j('#eventDetailModal').length ) {
$j('#eventDetailModal').replaceWith(data.html);
} else {
$j("body").append(data.html);
}
insertModalHtml('eventDetailModal', data.html);
$j('#eventDetailModal').modal('show');
// Manage the Save button
$j('#eventDetailSaveBtn').click(function(evt) {

View File

@ -410,13 +410,7 @@ function getModal(id) {
return;
}
if ( $j('#'+id).length ) {
console.log("replacing");
$j('#'+id).replaceWith(data.html);
} else {
console.log("Adding to body"+data.html);
$j('body').append(data.html);
}
insertModalHtml(id, data.html);
manageModalBtns(id);
modal = $j('#'+id+'Modal');
if ( ! modal.length ) {

View File

@ -2,11 +2,7 @@
function newGroup() {
$j.getJSON(thisUrl + '?request=modal&modal=group')
.done(function(data) {
if ( $j('#groupModal').length ) {
$j('#groupModal').replaceWith(data.html);
} else {
$j("body").append(data.html);
}
insertModalHtml('groupdModal', data.html);
$j('#groupModal').modal('show');
$j('.chosen').chosen("destroy");
$j('.chosen').chosen();
@ -32,11 +28,7 @@ function editGroup( element ) {
} else {
$j.getJSON(thisUrl + '?request=modal&modal=group&gid=' + gid)
.done(function(data) {
if ( $j('#groupModal').length ) {
$j('#groupModal').replaceWith(data.html);
} else {
$j("body").append(data.html);
}
insertModalHtml('groupModal', data.html);
$j('#groupModal').modal('show');
$j('.chosen').chosen("destroy");
$j('.chosen').chosen();

View File

@ -739,11 +739,7 @@ function click_panright() {
function click_download() {
$j.getJSON(thisUrl + '?request=modal&modal=download')
.done(function(data) {
if ( $j('#downloadModal').length ) {
$j('#downloadModal').replaceWith(data.html);
} else {
$j("body").append(data.html);
}
insertModalHtml('downloadModal', data.html);
$j('#downloadModal').modal('show');
// Manage the GENERATE DOWNLOAD button
$j('#exportButton').click(exportEvent);

View File

@ -2,11 +2,7 @@
function getServerModal(sid) {
$j.getJSON(thisUrl + '?request=modal&modal=server&id=' + sid)
.done(function(data) {
if ( $j('#ServerModal').length ) {
$j('#ServerModal').replaceWith(data.html);
} else {
$j("body").append(data.html);
}
insertModalHtml('ServerModal', data.html);
$j('#ServerModal').modal('show');
// Manage the Save button
$j('#serverSubmitBtn').click(function(evt) {
@ -33,11 +29,7 @@ function enableServerModal() {
function getStorageModal(sid) {
$j.getJSON(thisUrl + '?request=modal&modal=storage&id=' + sid)
.done(function(data) {
if ( $j('#storageModal').length ) {
$j('#storageModal').replaceWith(data.html);
} else {
$j("body").append(data.html);
}
insertModalHtml('storageModal', data.html);
$j('#storageModal').modal('show');
// Manage the Save button
$j('#storageSubmitBtn').click(function(evt) {

View File

@ -826,11 +826,7 @@ function updatePresetLabels() {
function getCtrlPresetModal() {
$j.getJSON(thisUrl + '?request=modal&modal=controlpreset&mid=' + monitorId)
.done(function(data) {
if ( $j('#ctrlPresetModal').length ) {
$j('#ctrlPresetModal').replaceWith(data.html);
} else {
$j("body").append(data.html);
}
insertModalHtml('ctrlPresetModal', data.html);
updatePresetLabels();
// Manage the Preset Select box
$j('#preset').change(updatePresetLabels);
@ -846,11 +842,7 @@ function getCtrlPresetModal() {
function getSettingsModal() {
$j.getJSON(thisUrl + '?request=modal&modal=settings&mid=' + monitorId)
.done(function(data) {
if ( $j('#settingsModal').length ) {
$j('#settingsModal').replaceWith(data.html);
} else {
$j("body").append(data.html);
}
insertModalHtml('settingsModal', data.html);
// Manage the Save button
$j('#settingsSubmitModal').click(function(evt) {
evt.preventDefault();