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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

75 lines
1.9 KiB
JavaScript
Raw Normal View History

2020-09-16 21:30:45 +08:00
// Load the Server Modal HTML via Ajax call
function getServerModal(sid) {
$j.getJSON(thisUrl + '?request=modal&modal=server&id=' + sid)
.done(function(data) {
2020-10-15 04:58:39 +08:00
insertModalHtml('ServerModal', data.html);
2020-09-16 21:30:45 +08:00
$j('#ServerModal').modal('show');
// Manage the Save button
$j('#serverSubmitBtn').click(function(evt) {
evt.preventDefault();
$j('#serverModalForm').submit();
});
})
.fail(logAjaxFail);
2020-09-16 21:30:45 +08:00
}
function enableServerModal() {
$j(".serverCol").click(function(evt) {
evt.preventDefault();
var sid = $j(this).data('sid');
getServerModal(sid);
});
$j('#NewServerBtn').click(function(evt) {
evt.preventDefault();
getServerModal(0);
});
}
2020-09-14 22:50:04 +08:00
// Load the Storage Modal HTML via Ajax call
function getStorageModal(sid) {
$j.getJSON(thisUrl + '?request=modal&modal=storage&id=' + sid)
.done(function(data) {
2020-10-15 04:58:39 +08:00
insertModalHtml('storageModal', data.html);
2020-09-14 22:50:04 +08:00
$j('#storageModal').modal('show');
// Manage the Save button
$j('#storageSubmitBtn').click(function(evt) {
evt.preventDefault();
$j('#storageModalForm').submit();
});
})
.fail(logAjaxFail);
2020-09-14 22:50:04 +08:00
}
function enableStorageModal() {
$j(".storageCol").click(function(evt) {
evt.preventDefault();
var sid = $j(this).data('sid');
getStorageModal(sid);
});
$j('#NewStorageBtn').click(function(evt) {
evt.preventDefault();
getStorageModal(0);
});
}
2020-10-04 06:12:44 +08:00
// Manage the Add New User button
function AddNewUser(el) {
url = el.getAttribute('data-url');
window.location.assign(url);
}
2020-09-14 22:50:04 +08:00
function initPage() {
var NewStorageBtn = $j('#NewStorageBtn');
2020-09-16 21:30:45 +08:00
var NewServerBtn = $j('#NewServerBtn');
2020-09-14 23:31:44 +08:00
2020-12-09 04:25:48 +08:00
if ( canEdit.System ) enableStorageModal();
if ( canEdit.System ) enableServerModal();
2020-09-14 23:31:44 +08:00
2020-12-09 04:25:48 +08:00
NewStorageBtn.prop('disabled', !canEdit.System);
NewServerBtn.prop('disabled', !canEdit.System);
2020-09-14 22:50:04 +08:00
}
$j(document).ready(function() {
initPage();
});