diff --git a/web/ajax/modal.php b/web/ajax/modal.php index 413cb34f8..49efcb202 100644 --- a/web/ajax/modal.php +++ b/web/ajax/modal.php @@ -35,6 +35,10 @@ switch ( $modal ) { if ( !isset($_REQUEST['id']) ) ajaxError('Storage Id Not Provided'); $data['html'] = getStorageModalHTML($_REQUEST['id']); break; + case 'server' : + if ( !isset($_REQUEST['id']) ) ajaxError('Storage Id Not Provided'); + $data['html'] = getServerModalHTML($_REQUEST['id']); + break; case 'eventdetail' : $eid = isset($_REQUEST['eid']) ? $_REQUEST['eid'] : ''; $eids = isset($_REQUEST['eids']) ? $_REQUEST['eids'] : ''; diff --git a/web/skins/classic/includes/functions.php b/web/skins/classic/includes/functions.php index f9053fab9..90fbb4e2d 100644 --- a/web/skins/classic/includes/functions.php +++ b/web/skins/classic/includes/functions.php @@ -1104,6 +1104,104 @@ function getCSRFinputHTML() { return $result; } +function getServerModalHTML($sid) { + $result = ''; + $checked = ' checked="checked"'; + $null = ''; + + if ( !canEdit('System') ) return; + + $Server = new ZM\Server($sid); + if ( $sid and ! $Server->Id() ) return; + + $result .= '
'.PHP_EOL; + + return $result; +} + function xhtmlFooter() { global $css; global $cspNonce; diff --git a/web/skins/classic/views/js/options.js b/web/skins/classic/views/js/options.js index 330a0e73b..2629f33fe 100644 --- a/web/skins/classic/views/js/options.js +++ b/web/skins/classic/views/js/options.js @@ -1,3 +1,37 @@ +// Load the Server Modal HTML via Ajax call +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); + } + $j('#ServerModal').modal('show'); + // Manage the Save button + $j('#serverSubmitBtn').click(function(evt) { + evt.preventDefault(); + $j('#serverModalForm').submit(); + }); + }) + .fail(function(jqxhr, textStatus, error) { + console.log("Request Failed: " + textStatus + ", " + error); + console.log("Response Text: " + jqxhr.responseText); + }); +} + +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); + }); +} + // Load the Storage Modal HTML via Ajax call function getStorageModal(sid) { $j.getJSON(thisUrl + '?request=modal&modal=storage&id=' + sid) @@ -34,10 +68,13 @@ function enableStorageModal() { function initPage() { var NewStorageBtn = $j('#NewStorageBtn'); + var NewServerBtn = $j('#NewServerBtn'); if ( canEditSystem ) enableStorageModal(); + if ( canEditSystem ) enableServerModal(); NewStorageBtn.prop('disabled', !canEditSystem); + NewServerBtn.prop('disabled', !canEditSystem); } $j(document).ready(function() { diff --git a/web/skins/classic/views/options.php b/web/skins/classic/views/options.php index e1e6f4f78..6dba8a3c9 100644 --- a/web/skins/classic/views/options.php +++ b/web/skins/classic/views/options.php @@ -181,8 +181,9 @@ foreach ( array_map('basename', glob('skins/'.$skin.'/css/*', GLOB_ONLYDIR)) as - + - +