diff options
26 files changed, 360 insertions, 666 deletions
diff --git a/modules-available/adduser/lang/de/messages.json b/modules-available/adduser/lang/de/messages.json index a744ae5f..ee633393 100644 --- a/modules-available/adduser/lang/de/messages.json +++ b/modules-available/adduser/lang/de/messages.json @@ -5,7 +5,7 @@ "password-changed": "Passwort ge\u00e4ndert", "password-mismatch": "Passwort und Passwortbest\u00e4tigung stimmen nicht \u00fcberein", "roles-updated": "Rollen aktualisiert", - "user-deleted": "Benutzer {{0}} (ID={1}}) gel\u00f6scht", + "user-deleted": "Benutzer {{0}} (ID={{1}}) gel\u00f6scht", "user-edited": "Benutzerdaten wurden ge\u00e4ndert", "user-not-found": "Benutzer mit ID {{0}} nicht gefunden" }
\ No newline at end of file diff --git a/modules-available/adduser/templates/page-userlist.html b/modules-available/adduser/templates/page-userlist.html index 262553f6..af26ad8b 100644 --- a/modules-available/adduser/templates/page-userlist.html +++ b/modules-available/adduser/templates/page-userlist.html @@ -2,9 +2,9 @@ {{{pagenav}}} -<form method="get"> - <input type="hidden" name="do" value="adduser"> - <input type="hidden" name="show" value="edituser"> +<form method="post"> + <input type="hidden" name="action" value="deleteuser"> + <input type="hidden" name="token" value="{{token}}"> <table class="table stupidtable"> <thead> <tr> @@ -25,12 +25,12 @@ <td>{{phone}}</td> <td>{{email}}</td> <td class="text-nowrap"> - <button class="btn btn-primary btn-xs" {{perms.user.edit.disabled}} type="submit" name="userid" value="{{userid}}"> + <a class="btn btn-primary btn-xs" {{perms.user.edit.disabled}} href="?do=adduser&show=edituser&userid={{userid}}"> <span class="glyphicon glyphicon-edit"></span> - </button> + </a> {{^hide_delete}} - <button type="button" {{perms.user.remove.disabled}} class="btn btn-danger btn-xs del-user-btn" - data-target="#delete-modal" data-toggle="modal" data-user="{{userid}}"> + <button type="submit" {{perms.user.remove.disabled}} name="userid" value="{{userid}}" class="btn btn-danger btn-xs" + data-confirm="#confirm-delete" data-title="{{fullname}} ({{login}})"> <span class="glyphicon glyphicon-trash"></span> </button> {{/hide_delete}} @@ -46,42 +46,4 @@ </a> </div> </form> -<script> - document.addEventListener('DOMContentLoaded', function() { - $('.del-user-btn').click(function (e) { - var uid = $(this).data('user'); - if (!uid) { - alert('ERROR'); - return false; - } - $('#delete-userid').val(uid); - $('#delete-user-field').text($('#user-' + uid).text()); - }); - }); -</script> - -<!-- Modals --> -<div class ="modal fade" id="delete-modal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> - <div class="modal-dialog" role="document"> - <div class="modal-content"> - <form method="post"> - <div class="modal-header"> - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> - <h4 class="modal-title" id="myModalLabel">{{lang_confirmDelete}}: <span id="delete-user-field"></span></h4> - </div> - <div class="modal-body"> - <p>{{lang_userDeleteConfirm}}</p> - </div> - <div class="modal-footer"> - <input type="hidden" name="action" value="deleteuser"> - <input type="hidden" name="token" value="{{token}}"> - <button type="button" class="btn btn-default" data-dismiss="modal">{{lang_cancel}}</button> - <button type="submit" id="delete-userid" name="userid" value="" class="btn btn-danger"> - <span class="glyphicon glyphicon-trash"></span> - {{lang_delete}} - </button> - </div> - </form> - </div> - </div> -</div>
\ No newline at end of file +<div class="hidden" id="confirm-delete">{{lang_userDeleteConfirm}}</div>
\ No newline at end of file diff --git a/modules-available/dnbd3/templates/page-serverlist.html b/modules-available/dnbd3/templates/page-serverlist.html index 65e4d6ea..c44eef0a 100644 --- a/modules-available/dnbd3/templates/page-serverlist.html +++ b/modules-available/dnbd3/templates/page-serverlist.html @@ -151,8 +151,8 @@ </button> {{/machineuuid}} {{^self}} - <button class="btn btn-danger btn-xs" name="server" value="{{serverid}}" {{edit_disabled}} - onclick="return confirm('{{lang_wantToDelete}}')" title="{{lang_delete}}"> + <button type="submit" class="btn btn-danger btn-xs" name="server" value="{{serverid}}" {{edit_disabled}} + data-confirm="#confirm-delete" data-title="{{fixedip}} {{clientip}}" title="{{lang_delete}}"> <span class="glyphicon glyphicon-trash"></span> </button> {{/self}} @@ -162,6 +162,7 @@ </tbody> </table> </form> +<div class="hidden" id="confirm-delete">{{lang_wantToDelete}}</div> <div class="btn-toolbar pull-right"> <div class="btn-group"> diff --git a/modules-available/dozmod/templates/ldapfilters.html b/modules-available/dozmod/templates/ldapfilters.html index 824ec70b..f12fd049 100644 --- a/modules-available/dozmod/templates/ldapfilters.html +++ b/modules-available/dozmod/templates/ldapfilters.html @@ -4,74 +4,52 @@ {{lang_ldapfiltersIntro}} </p> -<table class="table"> - <thead> - <tr> - <th class="">{{lang_ldapFilterName}}</th> - <th class="">{{lang_ldapFilterAttribute}}</th> - <th class="">{{lang_ldapFilterValue}}</th> - {{#hasEditPermission}} - <th class="slx-smallcol">{{lang_edit}}</th> - <th class="slx-smallcol">{{lang_delete}}</th> - {{/hasEditPermission}} - </tr> - </thead> - <tbody> - {{#ldapfilters}} - <tr> - <td>{{filtername}}</td> - <td>{{filterkey}}</td> - <td>{{filtervalue}}</td> - {{#hasEditPermission}} - <td class="text-center"> - <a class="btn btn-xs btn-primary" href="?do=dozmod§ion=ldapfilters&show=edit&filterid={{filterid}}"> - <span class="glyphicon glyphicon-edit"></span> - </a> - </td> - <td class="text-center"> - <button type="button" class="btn btn-xs btn-danger" data-toggle="modal" data-target="#deleteModal" onclick="setDeleteId('{{filterid}}')"> - <span class="glyphicon glyphicon-trash"></span> - </button> - </td> - {{/hasEditPermission}} - </tr> - {{/ldapfilters}} - </tbody> -</table> +<form method="post" action="?do=dozmod§ion=ldapfilters"> + <input type="hidden" name="token" value="{{token}}"> + <input type="hidden" name="action" value="deleteFilter"> + <table class="table"> + <thead> + <tr> + <th class="">{{lang_ldapFilterName}}</th> + <th class="">{{lang_ldapFilterAttribute}}</th> + <th class="">{{lang_ldapFilterValue}}</th> + {{#hasEditPermission}} + <th class="slx-smallcol">{{lang_edit}}</th> + <th class="slx-smallcol">{{lang_delete}}</th> + {{/hasEditPermission}} + </tr> + </thead> + <tbody> + {{#ldapfilters}} + <tr> + <td>{{filtername}}</td> + <td>{{filterkey}}</td> + <td>{{filtervalue}}</td> + {{#hasEditPermission}} + <td class="text-center"> + <a class="btn btn-xs btn-primary" href="?do=dozmod&section=ldapfilters&show=edit&filterid={{filterid}}"> + <span class="glyphicon glyphicon-edit"></span> + </a> + </td> + <td class="text-center"> + <button type="submit" name="filterid" value="{{filterid}}" class="btn btn-xs btn-danger" + data-confirm="#confirm-delete" data-title="{{filtername}}"> + <span class="glyphicon glyphicon-trash"></span> + </button> + </td> + {{/hasEditPermission}} + </tr> + {{/ldapfilters}} + </tbody> + </table> +</form> +<div class="hidden" id="confirm-delete">{{lang_ldapFilterDeleteConfirmation}}</div> {{#hasEditPermission}} <div class="text-right"> - <a class="btn btn-sm btn-success" href="?do=dozmod§ion=ldapfilters&show=edit"> + <a class="btn btn-sm btn-success" href="?do=dozmod&section=ldapfilters&show=edit"> <span class="glyphicon glyphicon-plus"></span> {{lang_ldapFilterAdd}} </a> </div> {{/hasEditPermission}} - -<form method="post" action="?do=dozmod§ion=ldapfilters"> - <input type="hidden" name="token" value="{{token}}"> - <input type="hidden" id="deleteAction" name="filterid" value=""> - <div class ="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> - <div class="modal-dialog" role="document"> - <div class="modal-content"> - <div class="modal-header"> - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> - <h4 class="modal-title" id="myModalLabel">{{lang_delete}}</h4> - </div> - <div class="modal-body"> - <p>{{lang_ldapFilterDeleteConfirmation}}</p> - </div> - <div class="modal-footer"> - <button type="button" class="btn btn-default" data-dismiss="modal">{{lang_cancel}}</button> - <button type="submit" name="action" value="deleteFilter" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span> {{lang_delete}}</button> - </div> - </div> - </div> - </div> -</form> - -<script type="text/javascript"> -function setDeleteId(id) { - $('#deleteAction').val(id) -} -</script> diff --git a/modules-available/dozmod/templates/networkrules.html b/modules-available/dozmod/templates/networkrules.html index eb16a7ed..a9549aa0 100644 --- a/modules-available/dozmod/templates/networkrules.html +++ b/modules-available/dozmod/templates/networkrules.html @@ -4,36 +4,44 @@ {{lang_networkrulesIntro}} </p> -<table class="table"> - <thead> - <tr> - <th>{{lang_name}}</th> - {{#hasEditPermissions}} - <th class="slx-smallcol">{{lang_edit}}</th> - <th class="slx-smallcol">{{lang_delete}}</th> - {{/hasEditPermissions}} - </tr> - </thead> - <tbody> - {{#networkrules}} - <tr> - <td>{{rulename}}</td> - {{#hasEditPermissions}} - <td align="center"> - <a href="?do=dozmod&section=networkrules&show=edit&ruleid={{ruleid}}" class="btn btn-xs btn-primary"> - <span class="glyphicon glyphicon-edit"></span> - </a> - </td> - <td align="center"> - <button type="button" class="btn btn-xs btn-danger" data-toggle="modal" data-target="#deleteModal" onclick="deleteRule('{{ruleid}}')"> - <span class="glyphicon glyphicon-trash"></span> - </button> - </td> - {{/hasEditPermissions}} - </tr> - {{/networkrules}} - </tbody> -</table> +<form method="post" action="?do=dozmod"> + <input type="hidden" name="token" value="{{token}}"> + <input type="hidden" name="section" value="networkrules"> + <input type="hidden" name="action" value="delete"> + <table class="table"> + <thead> + <tr> + <th>{{lang_name}}</th> + {{#hasEditPermissions}} + <th class="slx-smallcol">{{lang_edit}}</th> + <th class="slx-smallcol">{{lang_delete}}</th> + {{/hasEditPermissions}} + </tr> + </thead> + <tbody> + {{#networkrules}} + <tr> + <td>{{rulename}}</td> + {{#hasEditPermissions}} + <td align="center"> + <a href="?do=dozmod&section=networkrules&show=edit&ruleid={{ruleid}}" class="btn btn-xs btn-primary"> + <span class="glyphicon glyphicon-edit"></span> + </a> + </td> + <td align="center"> + <button type="submit" name="ruleid" value="{{ruleid}}" class="btn btn-xs btn-danger" + data-confirm="#confirm-delete" data-title="{{rulename}}"> + <span class="glyphicon glyphicon-trash"></span> + </button> + </td> + {{/hasEditPermissions}} + </tr> + {{/networkrules}} + </tbody> + </table> +</form> +<div class="hidden" id="confirm-delete">{{lang_ruleDeleteConfirm}}</div> + {{#hasEditPermissions}} <div class="text-right"> <a href="?do=dozmod&section=networkrules&show=edit" class="btn btn-success"> @@ -42,35 +50,3 @@ </a> </div> {{/hasEditPermissions}} - -<!-- Modals --> -<form method="post" action="?do=dozmod"> - <input type="hidden" name="token" value="{{token}}"> - <input type="hidden" name="section" value="networkrules"> - <div class ="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> - <div class="modal-dialog" role="document"> - <div class="modal-content"> - <div class="modal-header"> - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> - <h4 class="modal-title" id="myModalLabel">{{lang_delete}}</h4> - </div> - <div class="modal-body"> - <p>{{lang_ruleDeleteConfirm}}</p> - </div> - <div class="modal-footer"> - <input type="hidden" id="delete-rule-id" name="ruleid" value=""> - <button type="button" class="btn btn-default" data-dismiss="modal">{{lang_cancel}}</button> - <button type="submit" name="action" value="delete" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span> {{lang_delete}}</button> - </div> - </div> - </div> - </div> -</form> - -<script type="text/javascript"> - - function deleteRule(ruleid) { - $("#delete-rule-id").val(ruleid); - } - -</script>
\ No newline at end of file diff --git a/modules-available/dozmod/templates/networkshares.html b/modules-available/dozmod/templates/networkshares.html index aaafa256..0974cc6a 100644 --- a/modules-available/dozmod/templates/networkshares.html +++ b/modules-available/dozmod/templates/networkshares.html @@ -58,9 +58,15 @@ </a> </td> <td align="center"> - <button type="button" class="btn btn-xs btn-danger" data-toggle="modal" data-target="#deleteModal" onclick="deleteShare('{{shareid}}')"> - <span class="glyphicon glyphicon-trash"></span> - </button> + <form method="post" action="?do=dozmod"> + <input type="hidden" name="token" value="{{token}}"> + <input type="hidden" name="section" value="networkshares"> + <input type="hidden" name="shareid" value="{{shareid}}"> + <button type="submit" name="action" value="delete" class="btn btn-xs btn-danger" + data-confirm="#confirm-delete" data-title="{{sharename}}"> + <span class="glyphicon glyphicon-trash"></span> + </button> + </form> </td> {{/hasEditPermissions}} </tr> @@ -76,38 +82,4 @@ </div> {{/hasEditPermissions}} -<!-- Modals --> -<form method="post" action="?do=dozmod"> - <input type="hidden" name="token" value="{{token}}"> - <input type="hidden" name="section" value="networkshares"> - <div class ="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> - <div class="modal-dialog" role="document"> - <div class="modal-content"> - <div class="modal-header"> - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> - <h4 class="modal-title" id="myModalLabel">{{lang_delete}}</h4> - </div> - <div class="modal-body"> - <p>{{lang_shareDeleteConfirm}}</p> - </div> - <div class="modal-footer"> - <input type="hidden" id="delete-share-id" name="shareid" value=""> - <button type="button" class="btn btn-default" data-dismiss="modal">{{lang_cancel}}</button> - <button type="submit" name="action" value="delete" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span> {{lang_delete}}</button> - </div> - </div> - </div> - </div> -</form> - -<script type="text/javascript"> - - function deleteShare(shareid) { - $("#delete-share-id").val(shareid); - } - - document.addEventListener("DOMContentLoaded", function () { - - }) - -</script>
\ No newline at end of file +<div class="hidden" id="confirm-delete">{{lang_shareDeleteConfirm}}</div> diff --git a/modules-available/dozmod/templates/runscripts-list.html b/modules-available/dozmod/templates/runscripts-list.html index 4d519afb..21cb9835 100644 --- a/modules-available/dozmod/templates/runscripts-list.html +++ b/modules-available/dozmod/templates/runscripts-list.html @@ -4,52 +4,58 @@ {{lang_scriptsIntro}} </p> -<table class="table"> - <thead> - <tr> - <th>{{lang_name}}</th> - <th class="slx-smallcol">{{lang_scriptExtensionHead}}</th> - <th class="slx-smallcol">{{lang_scriptVisibilityHead}}</th> - <th class="slx-smallcol">{{lang_scriptPassCredentialsHead}}</th> - <th class="slx-smallcol">{{lang_scriptIsGlobalHead}}</th> - {{#hasEditPermission}} - <th class="slx-smallcol">{{lang_edit}}</th> - <th class="slx-smallcol">{{lang_delete}}</th> - {{/hasEditPermission}} - </tr> - </thead> - <tbody> - {{#list}} +<form method="post" action="?do=dozmod&section=runscripts"> + <input type="hidden" name="token" value="{{token}}"> + <input type="hidden" name="action" value="delete"> + <table class="table"> + <thead> <tr> - <td>{{scriptname}}</td> - <td>.{{extension}}</td> - <td><span class="glyphicon glyphicon-{{visibility}}"></span></td> - <td> - {{#passcreds}} - <span class="glyphicon glyphicon-ok"></span> - {{/passcreds}} - </td> - <td> - {{#isglobal}} - <span class="glyphicon glyphicon-ok"></span> - {{/isglobal}} - </td> + <th>{{lang_name}}</th> + <th class="slx-smallcol">{{lang_scriptExtensionHead}}</th> + <th class="slx-smallcol">{{lang_scriptVisibilityHead}}</th> + <th class="slx-smallcol">{{lang_scriptPassCredentialsHead}}</th> + <th class="slx-smallcol">{{lang_scriptIsGlobalHead}}</th> {{#hasEditPermission}} - <td class="text-center"> - <a class="btn btn-xs btn-primary" href="?do=dozmod&section=runscripts&show=edit&runscriptid={{runscriptid}}"> - <span class="glyphicon glyphicon-edit"></span> - </a> - </td> - <td class="text-center"> - <button type="button" class="btn btn-xs btn-danger" data-toggle="modal" data-target="#deleteModal" onclick="setDeleteId('{{runscriptid}}')"> - <span class="glyphicon glyphicon-trash"></span> - </button> - </td> + <th class="slx-smallcol">{{lang_edit}}</th> + <th class="slx-smallcol">{{lang_delete}}</th> {{/hasEditPermission}} </tr> - {{/list}} - </tbody> -</table> + </thead> + <tbody> + {{#list}} + <tr> + <td>{{scriptname}}</td> + <td>.{{extension}}</td> + <td><span class="glyphicon glyphicon-{{visibility}}"></span></td> + <td> + {{#passcreds}} + <span class="glyphicon glyphicon-ok"></span> + {{/passcreds}} + </td> + <td> + {{#isglobal}} + <span class="glyphicon glyphicon-ok"></span> + {{/isglobal}} + </td> + {{#hasEditPermission}} + <td class="text-center"> + <a class="btn btn-xs btn-primary" href="?do=dozmod&section=runscripts&show=edit&runscriptid={{runscriptid}}"> + <span class="glyphicon glyphicon-edit"></span> + </a> + </td> + <td class="text-center"> + <button type="submit" name="runscriptid" value="{{runscriptid}}" class="btn btn-xs btn-danger" + data-confirm="#confirm-delete" data-title="{{scriptname}}"> + <span class="glyphicon glyphicon-trash"></span> + </button> + </td> + {{/hasEditPermission}} + </tr> + {{/list}} + </tbody> + </table> +</form> +<div class="hidden" id="confirm-delete">{{lang_runScriptDeleteConfirmation}}</div> {{#hasEditPermission}} <div class="text-right"> @@ -59,31 +65,3 @@ </a> </div> {{/hasEditPermission}} - -<form method="post" action="?do=dozmod&section=runscripts"> - <input type="hidden" name="token" value="{{token}}"> - <input type="hidden" id="deleteAction" name="runscriptid" value=""> - <div class ="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> - <div class="modal-dialog" role="document"> - <div class="modal-content"> - <div class="modal-header"> - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> - <h4 class="modal-title" id="myModalLabel">{{lang_delete}}</h4> - </div> - <div class="modal-body"> - <p>{{lang_runScriptDeleteConfirmation}}</p> - </div> - <div class="modal-footer"> - <button type="button" class="btn btn-default" data-dismiss="modal">{{lang_cancel}}</button> - <button type="submit" name="action" value="delete" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span> {{lang_delete}}</button> - </div> - </div> - </div> - </div> -</form> - -<script type="text/javascript"> - function setDeleteId(id) { - $('#deleteAction').val(id) - } -</script> diff --git a/modules-available/exams/templates/page-exams.html b/modules-available/exams/templates/page-exams.html index df6a7dc9..89743c95 100644 --- a/modules-available/exams/templates/page-exams.html +++ b/modules-available/exams/templates/page-exams.html @@ -5,6 +5,8 @@ </div> <div class="panel-body"> <div class="slx-space"> + <form method="POST" action="?do=exams&action=delete"> + <input type="hidden" name="token" value="{{token}}"> <table class="table stupidtable"> <thead> <tr> @@ -39,20 +41,24 @@ <td class="text-nowrap" data-sort-value={{starttime}}>{{starttime_s}}</td> <td class="text-nowrap" data-sort-value={{endtime}}>{{endtime_s}}</td> <td class="text-nowrap text-right"> - <form method="POST" action="?do=exams&action=delete" {{^liesInPast}}onsubmit="return confirm('{{lang_deleteConfirmation}}');"{{/liesInPast}} > - {{^liesInPast}} - <a onclick="slxShow({{starttime}}, {{endtime}})" class="btn btn-default btn-sm"><span class="glyphicon glyphicon-eye-open"></span></a> - {{/liesInPast}} - <a href="?do=exams&action=edit&examid={{examid}}" class="btn btn-default btn-sm {{edit.disabled}}"><span class="glyphicon glyphicon-edit"></span></a> <input type="hidden" name="token" value="{{token}}"> - <input type="hidden" name="examid" value="{{examid}}"> - <button {{edit.disabled}} class="btn {{btnClass}} btn-sm"><span class="glyphicon glyphicon-trash"></span></button> - </form> + {{^liesInPast}} + <a onclick="slxShow({{starttime}}, {{endtime}})" class="btn btn-default btn-sm"><span class="glyphicon glyphicon-eye-open"></span></a> + {{/liesInPast}} + <a href="?do=exams&action=edit&examid={{examid}}" class="btn btn-default btn-sm {{edit.disabled}}"> + <span class="glyphicon glyphicon-edit"></span> + </a> + <button type="submit" {{edit.disabled}} class="btn {{btnClass}} btn-sm" name="examid" value="{{examid}}" + {{^liesInPast}}data-confirm="#confirm-delete" data-title="{{description}}"{{/liesInPast}}> + <span class="glyphicon glyphicon-trash"></span> + </button> </td> </tr> {{/exams}} </tbody> </table> + </form> </div> + <div class="hidden" id="confirm-delete">{{lang_deleteConfirmation}}</div> <div class="text-right"> <div class="btn-group" role="group"> <a href="?do=exams&action=add" class="btn btn-success {{perms.exams.edit.disabled}}"><span class="glyphicon glyphicon-plus-sign"></span> {{lang_addExam}}</a> diff --git a/modules-available/locationinfo/page.inc.php b/modules-available/locationinfo/page.inc.php index 3e17976d..d1644ce1 100644 --- a/modules-available/locationinfo/page.inc.php +++ b/modules-available/locationinfo/page.inc.php @@ -22,21 +22,26 @@ class Page_LocationInfo extends Page $action = Request::post('action'); if ($action === 'writePanelConfig') { $this->writePanelConfig(); + $show = 'panels'; } elseif ($action === 'writeLocationConfig') { $this->writeLocationConfig(); $show = 'locations'; - } elseif ($action === 'deleteServer') { - $this->deleteServer(); } elseif ($action === 'deletePanel') { $this->deletePanel(); - } elseif ($action === 'checkConnection') { - $this->checkConnection(Request::post('serverid', 0, 'int')); - $show = 'backends'; + $show = 'panels'; } elseif ($action === 'updateServerSettings') { $this->updateServerSettings(); $show = 'backends'; - } elseif (Request::isPost()) { - Message::addWarning('main.invalid-action', $action); + } else { + if (($id = Request::post('del-serverid', false, 'int')) !== false) { + $this->deleteServer($id); + $show = 'backends'; + } elseif (($id = Request::post('chk-serverid', false, 'int')) !== false) { + $this->checkConnection($id); + $show = 'backends'; + } elseif (Request::isPost()) { + Message::addWarning('main.invalid-action', $action); + } } if (Request::isPost() || $this->show === false) { if (!empty($show)) { @@ -95,11 +100,10 @@ class Page_LocationInfo extends Page /** * Deletes the server from the db. */ - private function deleteServer() + private function deleteServer($id) { User::assertPermission('backend.edit'); - $id = Request::post('serverid', false, 'int'); - if ($id === false) { + if ($id === 0) { Message::addError('server-id-missing'); return; } diff --git a/modules-available/locationinfo/templates/page-panels.html b/modules-available/locationinfo/templates/page-panels.html index b30e7c87..51acf053 100644 --- a/modules-available/locationinfo/templates/page-panels.html +++ b/modules-available/locationinfo/templates/page-panels.html @@ -2,6 +2,9 @@ <p>{{lang_panelsTableHints}}</p> +<form method="post" action="?do=locationinfo"> + <input type="hidden" name="token" value="{{token}}"> + <input type="hidden" name="action" value="deletePanel"> <table class="table table-hover"> <thead> <tr> @@ -45,7 +48,8 @@ </a> </td> <td class="text-center" style="vertical-align: middle"> - <button type="button" class="btn btn-xs btn-danger" data-toggle="modal" data-target="#deleteModal" onclick="deletePanel('{{paneluuid}}')" {{edit_disabled}}> + <button type="submit" name="uuid" value="{{paneluuid}}" class="btn btn-xs btn-danger" + data-confirm="#confirm-delete" data-title="{{panelname}}" {{edit_disabled}}> <span class="glyphicon glyphicon-trash"></span> </button> </td> @@ -53,6 +57,7 @@ {{/panels}} </tbody> </table> +</form> <div class="buttonbar text-right"> <a class="btn btn-success" href="?do=locationinfo&show=edit-panel&uuid=new-default"> @@ -68,32 +73,4 @@ {{lang_urlPanel}} </a> </div> - -<form method="post" action="?do=locationinfo"> -<input type="hidden" name="token" value="{{token}}"> - -<div class ="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> - <div class="modal-dialog" role="document"> - <div class="modal-content"> - <div class="modal-header"> - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> - <h4 class="modal-title" id="myModalLabel">{{lang_delete}}</h4> - </div> - <div class="modal-body"> - <p>{{lang_deleteConfirmation}}</p> - </div> - <div class="modal-footer"> - <input type="hidden" id="delete-panel-id" name="uuid" value=""> - <button type="button" class="btn btn-default" data-dismiss="modal">{{lang_cancel}}</button> - <button type="submit" name="action" value="deletePanel" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span> {{lang_delete}}</button> - </div> - </div> - </div> -</div> -</form> - -<script> - function deletePanel(panelid) { - $("#delete-panel-id").val(panelid); - } -</script>
\ No newline at end of file +<div class="hidden" id="confirm-delete">{{lang_deleteConfirmation}}</div> diff --git a/modules-available/locationinfo/templates/page-servers.html b/modules-available/locationinfo/templates/page-servers.html index e295c4fd..2f692078 100644 --- a/modules-available/locationinfo/templates/page-servers.html +++ b/modules-available/locationinfo/templates/page-servers.html @@ -17,7 +17,6 @@ {{#serverlist}} <form method="post" action="?do=locationinfo"> <input type="hidden" name="token" value="{{token}}"> - <input type="hidden" name="serverid" value="{{serverid}}"> <tr> <td nowrap>{{typename}}</td> <td nowrap>{{servername}}</td> @@ -29,8 +28,8 @@ </button> </td> <td class="text-center"> - <button class="btn btn-xs btn-primary server-check" {{disabled}} {{perms.backend.check.disabled}} - name="action" value="checkConnection" type="submit"> + <button type="submit" class="btn btn-xs btn-primary server-check" {{disabled}} {{perms.backend.check.disabled}} + name="chk-serverid" value="{{serverid}}"> <span class="glyphicon glyphicon-refresh"></span> </button> </td> @@ -40,8 +39,8 @@ </a> </td> <td class="text-center"> - <button type="button" class="btn btn-xs btn-danger" onclick="$('#del-serverid').val({{serverid}})" - data-toggle="modal" data-target="#deleteModal" {{perms.backend.edit.disabled}}> + <button type="submit" class="btn btn-xs btn-danger" name="del-serverid" value="{{serverid}}" + data-confirm="#confirm-delete" data-title="{{servername}}" {{perms.backend.edit.disabled}}> <span class="glyphicon glyphicon-trash"></span> </button> </td> @@ -50,31 +49,15 @@ {{/serverlist}} </tbody> </table> +<div class="hidden" id="confirm-delete">{{lang_deleteConfirmation}}</div> <form method="post" action="?do=locationinfo"> <input type="hidden" name="token" value="{{token}}"> - <input type="hidden" name="serverid" value="" id="del-serverid"> - <div class ="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> - <div class="modal-dialog" role="document"> - <div class="modal-content"> - <div class="modal-header"> - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> - <h4 class="modal-title" id="myModalLabel">{{lang_delete}}</h4> - </div> - <div class="modal-body"> - <p>{{lang_deleteConfirmation}}</p> - </div> - <div class="modal-footer"> - <button type="button" class="btn btn-default" data-dismiss="modal">{{lang_cancel}}</button> - <button type="submit" name="action" value="deleteServer" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span> {{lang_delete}}</button> - </div> - </div> - </div> - </div> + <input type="hidden" name="action" value="deleteServer" class="btn btn-danger"> </form> <div class="text-right"> - <button class="btn btn-sm btn-success" id="addServerButton" onclick="addServer()"> + <button class="btn btn-success" id="addServerButton" onclick="addServer()"> <span class="glyphicon glyphicon-plus"></span> {{lang_addServer}} </button> @@ -97,19 +80,13 @@ document.addEventListener("DOMContentLoaded", function () { - /** - * Confirm deleting a server. - */ - $('.server-delete').click(function(ev) { - var del = confirm("{{lang_deleteConfirmation}}"); - if (!del) ev.preventDefault(); - }); - - /** + /* * Animate refresh icon while page is loading */ - $('.server-check').click(function() { + var $checkBtn = $('.server-check'); + $checkBtn.click(function() { $(this).find('.glyphicon').addClass('slx-rotation'); + setTimeout(function(){$checkBtn.prop('disabled', true);},1); // Delay to not ignore form value }); $('button[data-server-edit]').click(function() { diff --git a/modules-available/locations/templates/location-subnets.html b/modules-available/locations/templates/location-subnets.html index 69e369c2..897f84b0 100644 --- a/modules-available/locations/templates/location-subnets.html +++ b/modules-available/locations/templates/location-subnets.html @@ -102,8 +102,8 @@ <div class="modal-body"> {{lang_areYouSureNoUndo}} <div class="checkbox"> - <input type="checkbox" name="recursive" value="on"> - <label>{{lang_deleteChildLocations}}</label> + <input type="checkbox" name="recursive" value="on" id="del-rec-{{locationid}}"> + <label for="del-rec-{{locationid}}">{{lang_deleteChildLocations}}</label> </div> </div> <div class="modal-footer"> diff --git a/modules-available/locations/templates/locations.html b/modules-available/locations/templates/locations.html index a2d6cafc..7bdf3038 100644 --- a/modules-available/locations/templates/locations.html +++ b/modules-available/locations/templates/locations.html @@ -223,10 +223,6 @@ function removeNewSubnetRow(r) { $("#row"+r).remove(); } -function slxConfirm() { - return confirm('{{lang_areYouSureNoUndo}}'); -} - function deleteSubnetWarning(locid) { var form = $("#locationForm"+locid); if (form.find("input[type=checkbox]:checked").length > 0) { diff --git a/modules-available/news/templates/page-news.html b/modules-available/news/templates/page-news.html index b22b44f5..43afaf1a 100644 --- a/modules-available/news/templates/page-news.html +++ b/modules-available/news/templates/page-news.html @@ -57,7 +57,10 @@ </td> <td class="text-center"> <input type="hidden" name="news-type" value="news"> - <button {{perms.news.delete.disabled}} class="btn btn-danger btn-xs btn-delete" type="submit" name="newsid" value="{{newsid}}"><span class="glyphicon glyphicon-trash"></span></button> + <button {{perms.news.delete.disabled}} class="btn btn-danger btn-xs btn-delete" type="submit" + name="newsid" value="{{newsid}}" data-confirm="#confirm-delete" data-title="{{title}}"> + <span class="glyphicon glyphicon-trash"></span> + </button> </td> </tr> {{/list}} @@ -121,6 +124,7 @@ </div> </div> </div> +<div class="hidden" id="confirm-delete">{{lang_confirmDelete}}</div> <script type="application/javascript"><!-- document.addEventListener("DOMContentLoaded", function () { $('.sn-btn').click(function (event) { @@ -130,10 +134,5 @@ document.addEventListener("DOMContentLoaded", function () { } }); $('.summernote[readonly]').each(function() { $(this).summernote('disable'); }); - $('.btn-delete').click(function (event) { - if (confirm('{{lang_confirmDelete}}')) - return; - event.preventDefault(); - }); }, false); // --></script>
\ No newline at end of file diff --git a/modules-available/permissionmanager/templates/rolestable.html b/modules-available/permissionmanager/templates/rolestable.html index d520db33..e50dffc7 100644 --- a/modules-available/permissionmanager/templates/rolestable.html +++ b/modules-available/permissionmanager/templates/rolestable.html @@ -1,5 +1,6 @@ <form method="post" action="?do=permissionmanager"> <input type="hidden" name="token" value="{{token}}"> + <input type="hidden" name="action" value="deleteRole"> <div> <input type="text" class="form-control" id="roleNameSearchField" onkeyup="searchFieldFunction()" placeholder="{{lang_searchPlaceholder}}"> @@ -33,9 +34,14 @@ <a class="btn btn-xs btn-primary" href="?do=permissionmanager&show=roleEditor&roleid={{roleid}}"><span class="glyphicon glyphicon-edit"></span></a> </td> <td class="text-center"> - <button type="button" class="btn btn-xs btn-danger" data-toggle="modal" data-target="#deleteModal" onclick="deleteRole('{{roleid}}', '{{users}}')" {{perms.roles.edit.disabled}}> + <button type="submit" name="deleteId" value="{{roleid}}" class="btn btn-xs btn-danger" {{perms.roles.edit.disabled}} + data-confirm="#confirm-role-{{roleid}}" data-title="{{rolename}}"> <span class="glyphicon glyphicon-trash"></span> </button> + <div class="hidden" id="confirm-role-{{roleid}}"> + <p>{{lang_roleDeleteConfirm}}</p> + {{lang_numAssignedUsers}}: {{users}} + </div> </td> </tr> {{/roles}} @@ -43,28 +49,6 @@ </table> </div> </div> - - <!-- Modals --> - <div class ="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> - <div class="modal-dialog" role="document"> - <div class="modal-content"> - <div class="modal-header"> - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> - <h4 class="modal-title" id="myModalLabel">{{lang_delete}}</h4> - </div> - <div class="modal-body"> - <p>{{lang_roleDeleteConfirm}}</p> - {{lang_numAssignedUsers}}: <span id="delete-role-users"></span> - </div> - <div class="modal-footer"> - <input type="hidden" id="delete-role-id" name="deleteId" value=""> - <button type="button" class="btn btn-default" data-dismiss="modal">{{lang_cancel}}</button> - <button type="submit" name="action" value="deleteRole" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span> {{lang_delete}}</button> - </div> - </div> - </div> - </div> - </form> <div class="text-right"> @@ -72,11 +56,6 @@ </div> <script> - function deleteRole(roleid, users) { - $("#delete-role-id").val(roleid); - $("#delete-role-users").text(users); - } - function searchFieldFunction() { var filter = $("#roleNameSearchField").val().toLowerCase(); $(".rolename").each(function() { diff --git a/modules-available/runmode/templates/module-machine-list.html b/modules-available/runmode/templates/module-machine-list.html index 89424922..73ea8a70 100644 --- a/modules-available/runmode/templates/module-machine-list.html +++ b/modules-available/runmode/templates/module-machine-list.html @@ -3,7 +3,7 @@ <a href="?do={{module}}">{{modulename}}</a> </h2> -<form method="post" action="?do=runmode" onsubmit="return confirm('{{lang_confirmDelete}}')"> +<form method="post" action="?do=runmode"> <input type="hidden" name="token" value="{{token}}"> <input type="hidden" name="action" value="delete-machine"> <table class="table"> @@ -36,7 +36,8 @@ </td> <td class="text-center"> {{#canedit}} - <button type="submit" class="btn btn-danger btn-sm" name="machineuuid" value="{{machineuuid}}" {{disabled}}> + <button type="submit" class="btn btn-danger btn-sm" name="machineuuid" value="{{machineuuid}}" {{disabled}} + data-confirm="#confirm-delete" data-title="{{hostname}}"> <span class="glyphicon glyphicon-trash"></span> </button> {{/canedit}} @@ -49,4 +50,5 @@ </tr> {{/list}} </table> -</form>
\ No newline at end of file +</form> +<div class="hidden" id="confirm-delete">{{lang_confirmDelete}}</div>
\ No newline at end of file diff --git a/modules-available/serversetup-bwlp-ipxe/templates/bootentry-list.html b/modules-available/serversetup-bwlp-ipxe/templates/bootentry-list.html index edfc0e5f..96130b14 100644 --- a/modules-available/serversetup-bwlp-ipxe/templates/bootentry-list.html +++ b/modules-available/serversetup-bwlp-ipxe/templates/bootentry-list.html @@ -4,58 +4,64 @@ {{lang_bootentryIntro}} </p> -<table class="table"> - <thead> - <tr> - <th>{{lang_entryId}}</th> - <th>{{lang_bootentryTitle}}</th> - <th>{{lang_hotkey}}</th> - <th class="slx-smallcol">{{lang_refCount}}</th> - <th class="slx-smallcol">{{lang_edit}}</th> - {{#allowEdit}}<th class="slx-smallcol">{{lang_copy}}</th>{{/allowEdit}} - <th class="slx-smallcol">{{lang_delete}}</th> - </tr> - </thead> - <tbody> - {{#bootentryTable}} - <tr> - <td> - {{entryid}} - </td> - <td> - {{title}} - </td> - <td> - {{hotkey}} - </td> - <td align="right"> - {{refs}} - </td> - <td align="center"> - <a href="?do=serversetup&show=editbootentry&id={{entryid}}" class="btn btn-xs btn-default"> - <span class="glyphicon glyphicon-{{#allowEdit}}edit{{/allowEdit}}{{^allowEdit}}eye-open{{/allowEdit}}"></span> - </a> - </td> - {{#allowEdit}} - <td align="center"> - <a href="?do=serversetup&show=editbootentry&id={{entryid}}©=true" class="btn btn-xs btn-default"> - <span class="glyphicon glyphicon-duplicate"></span> - </a> - </td> - {{/allowEdit}} - <td align="center"> +<form method="post" action="?do=serversetup"> + <input type="hidden" name="token" value="{{token}}"> + <input type="hidden" name="action" value="deleteBootentry"> + <table class="table"> + <thead> + <tr> + <th>{{lang_entryId}}</th> + <th>{{lang_bootentryTitle}}</th> + <th>{{lang_hotkey}}</th> + <th class="slx-smallcol">{{lang_refCount}}</th> + <th class="slx-smallcol">{{lang_edit}}</th> + {{#allowEdit}}<th class="slx-smallcol">{{lang_copy}}</th>{{/allowEdit}} + <th class="slx-smallcol">{{lang_delete}}</th> + </tr> + </thead> + <tbody> + {{#bootentryTable}} + <tr> + <td> + {{entryid}} + </td> + <td> + {{title}} + </td> + <td> + {{hotkey}} + </td> + <td align="right"> + {{refs}} + </td> + <td align="center"> + <a href="?do=serversetup&show=editbootentry&id={{entryid}}" class="btn btn-xs btn-default"> + <span class="glyphicon glyphicon-{{#allowEdit}}edit{{/allowEdit}}{{^allowEdit}}eye-open{{/allowEdit}}"></span> + </a> + </td> {{#allowEdit}} - {{^builtin}} - <button type="button" class="btn btn-xs btn-danger" data-toggle="modal" data-target="#deleteModal" onclick="deleteBootentry('{{entryid}}')"> - <span class="glyphicon glyphicon-trash"></span> - </button> - {{/builtin}} + <td align="center"> + <a href="?do=serversetup&show=editbootentry&id={{entryid}}©=true" class="btn btn-xs btn-default"> + <span class="glyphicon glyphicon-duplicate"></span> + </a> + </td> {{/allowEdit}} - </td> - </tr> - {{/bootentryTable}} - </tbody> -</table> + <td align="center"> + {{#allowEdit}} + {{^builtin}} + <button type="submit" name="deleteid" value="{{entryid}}" class="btn btn-xs btn-danger" + data-confirm="#confirm-delete" data-title="{{title}}"> + <span class="glyphicon glyphicon-trash"></span> + </button> + {{/builtin}} + {{/allowEdit}} + </td> + </tr> + {{/bootentryTable}} + </tbody> + </table> +</form> +<div class="hidden" id="confirm-delete">{{lang_bootentryDeleteConfirm}}</div> <div class="pull-right"> {{#allowEdit}} <a href="?do=serversetup&show=editbootentry" class="btn btn-success"> @@ -66,32 +72,3 @@ </div> <div class="clearfix"></div> - -<!-- Modals --> -<form method="post" action="?do=serversetup"> - <input type="hidden" name="token" value="{{token}}"> - <div class ="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> - <div class="modal-dialog" role="document"> - <div class="modal-content"> - <div class="modal-header"> - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> - <h4 class="modal-title" id="myModalLabel">{{lang_delete}}</h4> - </div> - <div class="modal-body"> - <p>{{lang_bootentryDeleteConfirm}}</p> - </div> - <div class="modal-footer"> - <input type="hidden" id="delete-bootentry-id" name="deleteid" value=""> - <button type="button" class="btn btn-default" data-dismiss="modal">{{lang_cancel}}</button> - <button type="submit" name="action" value="deleteBootentry" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span> {{lang_delete}}</button> - </div> - </div> - </div> - </div> -</form> - -<script> - function deleteBootentry(entryid) { - $("#delete-bootentry-id").val(entryid); - } -</script>
\ No newline at end of file diff --git a/modules-available/serversetup-bwlp-ipxe/templates/menu-list.html b/modules-available/serversetup-bwlp-ipxe/templates/menu-list.html index ed12e596..8e67e697 100644 --- a/modules-available/serversetup-bwlp-ipxe/templates/menu-list.html +++ b/modules-available/serversetup-bwlp-ipxe/templates/menu-list.html @@ -48,9 +48,14 @@ </td> <td align="center"> {{#allowEdit}} - <button type="button" class="btn btn-xs btn-danger" data-toggle="modal" data-target="#deleteModal" onclick="deleteMenu('{{menuid}}')"> - <span class="glyphicon glyphicon-trash"></span> - </button> + <form method="post" action="?do=serversetup"> + <input type="hidden" name="token" value="{{token}}"> + <input type="hidden" name="deleteid" value="{{menuid}}"> + <button type="submit" name="action" value="deleteMenu" class="btn btn-xs btn-danger" + data-confirm="#confirm-delete" data-title="{{title}}"> + <span class="glyphicon glyphicon-trash"></span> + </button> + </form> {{/allowEdit}} </td> </tr> @@ -64,37 +69,5 @@ </a> </div> +<div class="hidden" id="confirm-delete">{{lang_menuDeleteConfirm}}</div> <div class="clearfix"></div> - - -<!-- Modals --> -<form method="post" action="?do=serversetup"> - <input type="hidden" name="token" value="{{token}}"> - <div class ="modal fade" id="deleteModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> - <div class="modal-dialog" role="document"> - <div class="modal-content"> - <div class="modal-header"> - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> - <h4 class="modal-title" id="myModalLabel">{{lang_delete}}</h4> - </div> - <div class="modal-body"> - <p>{{lang_menuDeleteConfirm}}</p> - </div> - <div class="modal-footer"> - <input type="hidden" id="delete-menu-id" name="deleteid" value=""> - <button type="button" class="btn btn-default" data-dismiss="modal">{{lang_cancel}}</button> - <button type="submit" name="action" value="deleteMenu" class="btn btn-danger"><span class="glyphicon glyphicon-trash"></span> {{lang_delete}}</button> - </div> - </div> - </div> - </div> -</form> - -<script> - function deleteMenu(menuid) { - $("#delete-menu-id").val(menuid); - } - document.addEventListener('DOMContentLoaded', function() { - $('[data-toggle="tooltip"]').tooltip(); - }); -</script>
\ No newline at end of file diff --git a/modules-available/statistics/lang/de/template-tags.json b/modules-available/statistics/lang/de/template-tags.json index 51d8c4be..7fc90201 100644 --- a/modules-available/statistics/lang/de/template-tags.json +++ b/modules-available/statistics/lang/de/template-tags.json @@ -94,7 +94,7 @@ "lang_sockets": "Sockel", "lang_subnet": "Subnetz", "lang_sureDeletePermanent": "M\u00f6chten Sie diese(n) Rechner wirklich unwiderruflich aus der Datenbank entfernen?\r\n\r\nWichtig: L\u00f6schen verhindert nicht, dass ein Rechner nach erneutem Starten von bwLehrpool wieder in die Datenbank aufgenommen wird.", - "lang_sureReplaceNoUndo": "Wollen Sie die Daten ausgew\u00e4hlten Rechner \u00fcbertragen? Diese Aktion kann nicht r\u00fcckg\u00e4ngig gemacht werden.", + "lang_sureReplaceNoUndo": "Wollen Sie die Daten der ausgew\u00e4hlten Rechner \u00fcbertragen? Diese Aktion kann nicht r\u00fcckg\u00e4ngig gemacht werden.", "lang_swapFree": "swap frei (MB)", "lang_tempPart": "Temp. Partition", "lang_tempPartStats": "Tempor\u00e4re Partition", diff --git a/modules-available/statistics/templates/clientlist.html b/modules-available/statistics/templates/clientlist.html index 6d7c7f36..fdf4c72b 100644 --- a/modules-available/statistics/templates/clientlist.html +++ b/modules-available/statistics/templates/clientlist.html @@ -1,6 +1,6 @@ <h2>{{lang_clientList}} ({{rowCount}})</h2> -<form method="post" action="?do=statistics"> +<form method="post" action="?do=statistics" id="list-form"> <input type="hidden" name="token" value="{{token}}"> <input type="hidden" name="redirect" value="?{{redirect}}"> @@ -115,116 +115,56 @@ </button> {{#rebootcontrol}} {{#canShutdown}} - <button type="button" class="btn btn-danger btn-machine-action" data-toggle="modal" data-target="#shutdown-confirm"> + <button type="submit" name="action" value="shutdownmachines" class="btn btn-danger btn-machine-action" + data-confirm="{{lang_shutdownConfirm}}" data-title="{{lang_shutdown}}"> <span class="glyphicon glyphicon-off"></span> {{lang_shutdown}} </button> {{/canShutdown}} {{#canReboot}} - <button type="button" class="btn btn-warning btn-machine-action" data-toggle="modal" data-target="#reboot-confirm"> + <button type="submit" name="action" value="rebootmachines" class="btn btn-warning btn-machine-action" + data-confirm="#confirm-reboot"> <span class="glyphicon glyphicon-repeat"></span> {{lang_reboot}} </button> {{/canReboot}} {{/rebootcontrol}} {{#canDelete}} - <button type="button" class="btn btn-danger btn-machine-action" data-toggle="modal" data-target="#del-confirm"> - <span class="glyphicon glyphicon-trash"></span> - {{lang_delete}} - </button> + <button type="submit" name="action" value="delmachines" class="btn btn-danger btn-machine-action" + data-confirm="{{lang_sureDeletePermanent}}"> + <span class="glyphicon glyphicon-trash"></span> + {{lang_delete}} + </button> {{/canDelete}} </div> - <div class="modal fade" id="del-confirm" tabindex="-1" role="dialog"> - <div class="modal-dialog" role="document"> - <div class="modal-content"> - <div class="modal-header"> - <button type="button" class="close" data-dismiss="modal">×</button> - <b>{{lang_delete}}</b> - </div> - <div class="modal-body"> - {{lang_sureDeletePermanent}} - </div> - <div class="modal-footer"> - <button type="button" class="btn btn-default" data-dismiss="modal">{{lang_cancel}}</button> - <button type="submit" class="btn btn-danger" name="action" value="delmachines"> - <span class="glyphicon glyphicon-trash"></span> - {{lang_delete}} - </button> - </div> - </div> - </div> - </div> - <div class="modal fade" id="reboot-confirm" tabindex="-1" role="dialog"> - <div class="modal-dialog" role="document"> - <div class="modal-content"> - <div class="modal-header"> - <button type="button" class="close" data-dismiss="modal">×</button> - <b>{{lang_reboot}}</b> - </div> - <div class="modal-body"> - <p>{{lang_rebootConfirm}}</p> - <div class="checkbox"> - <input type="checkbox" name="kexec" value="1" id="kexec-input"> - <label for="kexec-input">{{lang_rebootKexecCheck}}</label> - </div> - </div> - <div class="modal-footer"> - <button type="button" class="btn btn-default" data-dismiss="modal">{{lang_cancel}}</button> - <button type="submit" class="btn btn-danger" name="action" value="rebootmachines"> - <span class="glyphicon glyphicon-repeat"></span> - {{lang_reboot}} - </button> - </div> - </div> - </div> - </div> - <div class="modal fade" id="shutdown-confirm" tabindex="-1" role="dialog"> - <div class="modal-dialog" role="document"> - <div class="modal-content"> - <div class="modal-header"> - <button type="button" class="close" data-dismiss="modal">×</button> - <b>{{lang_shutdown}}</b> - </div> - <div class="modal-body"> - {{lang_shutdownConfirm}} - </div> - <div class="modal-footer"> - <button type="button" class="btn btn-default" data-dismiss="modal">{{lang_cancel}}</button> - <button type="submit" class="btn btn-danger" name="action" value="shutdownmachines"> - <span class="glyphicon glyphicon-off"></span> - {{lang_shutdown}} - </button> - </div> - </div> + <div class="hidden" id="confirm-reboot"> + <p>{{lang_rebootConfirm}}</p> + <div class="checkbox"> + <input type="checkbox" name="kexec" value="1" id="kexec-input" form="list-form"> + <label for="kexec-input">{{lang_rebootKexecCheck}}</label> </div> </div> </form> <script type="application/javascript"><!-- -var selectedMachineCounter = 0; - document.addEventListener("DOMContentLoaded", function () { var $buttons = $('.btn-machine-action'); - $buttons.prop("disabled", true); - $(".machine-checkbox").change(function() { - if ($(this).is(':checked')) { - selectedMachineCounter++; - if (selectedMachineCounter === 1) { - $buttons.prop("disabled", false); - } - } else { - selectedMachineCounter--; - if (selectedMachineCounter === 0) { - $buttons.prop("disabled", true); - } - } - }); - - $("button[type=reset]").click(function() { - selectedMachineCounter = 0; - $buttons.prop("disabled", true); - }); + var $fn = function () { + $buttons.prop("disabled", $('.machine-checkbox:checked').length === 0); + }; + var $boxes = $('.machine-checkbox'); + $boxes.change($fn); + $("button[type=reset]").click(function() { setTimeout($fn, 1); }); + if (window && window.opera && window.opera.version && Number(window.opera.version()) < 13) { + $(document).ready(function () { + setTimeout(function () { + $('div.checkbox > input').click().click(); + }, 1); + }); + } else { + $fn(); + } }); //--></script> diff --git a/modules-available/statistics/templates/page-replace.html b/modules-available/statistics/templates/page-replace.html index d0e9f766..a83774f6 100644 --- a/modules-available/statistics/templates/page-replace.html +++ b/modules-available/statistics/templates/page-replace.html @@ -60,34 +60,14 @@ </table> <div class="text-right"> - <button type="button" class="btn btn-danger" name="action" value="replace" data-toggle="modal" data-target="#confirm-dialog"> + <button type="submit" class="btn btn-danger" name="action" value="replace" data-confirm="#confirm-replace" data-title="{{lang_replace}}"> <span class="glyphicon glyphicon-floppy-disk"></span> {{lang_replace}} (<span id="rep-count">0</span>) </button> </div> - - <div class="modal fade" id="confirm-dialog" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> - <div class="modal-dialog" role="document"> - <div class="modal-content"> - <div class="modal-header"> - <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> - <h4 class="modal-title" id="myModalLabel">{{lang_replace}}</h4> - </div> - <div class="modal-body"> - {{lang_sureReplaceNoUndo}} - </div> - <div class="modal-footer"> - <button type="button" class="btn btn-default" data-dismiss="modal">{{lang_cancel}}</button> - <button type="submit" name="action" value="replace" class="btn btn-danger"> - <span class="glyphicon glyphicon-floppy-disk"></span> - {{lang_replace}} - </button> - </div> - </div> - </div> - </div> </form> +<div class="hidden" id="confirm-replace">{{lang_sureReplaceNoUndo}}</div> <script type="application/javascript"><!-- document.addEventListener('DOMContentLoaded', function () { diff --git a/modules-available/sysconfig/templates/js.html b/modules-available/sysconfig/templates/js.html index 9e5da884..157e8d12 100644 --- a/modules-available/sysconfig/templates/js.html +++ b/modules-available/sysconfig/templates/js.html @@ -1,11 +1,7 @@ +<div class="hidden" id="confirm-delete">{{lang_confirmDeleteQuestion}}</div> <script type="application/javascript"><!-- document.addEventListener("DOMContentLoaded", function () { checkBuildStatus(); $('[data-toggle="tooltip"]').tooltip(); - $('.confirm-delete').click(function (event) { - if (!confirm('{{lang_confirmDeleteQuestion}}')) { - event.preventDefault(); - } - }); }, false); // --></script>
\ No newline at end of file diff --git a/modules-available/sysconfig/templates/list-configs.html b/modules-available/sysconfig/templates/list-configs.html index fe882c43..ea6705da 100644 --- a/modules-available/sysconfig/templates/list-configs.html +++ b/modules-available/sysconfig/templates/list-configs.html @@ -66,8 +66,9 @@ href="?do=SysConfig&action=addconfig&edit={{configid}}" title="{{lang_edit}}"> <span class="glyphicon glyphicon-edit"></span> </a> - <button class="btn btn-danger btn-xs confirm-delete" name="del" value="{{configid}}" - title="{{lang_delete}}" {{perms.config.edit.disabled}}> + <button type="submit" class="btn btn-danger btn-xs" name="del" value="{{configid}}" + title="{{lang_delete}}" {{perms.config.edit.disabled}} data-confirm="#confirm-delete" + data-title="{{config}}"> <span class="glyphicon glyphicon-trash"></span> </button> {{/locationid}} diff --git a/modules-available/sysconfig/templates/list-modules.html b/modules-available/sysconfig/templates/list-modules.html index c9400696..99d535f1 100644 --- a/modules-available/sysconfig/templates/list-modules.html +++ b/modules-available/sysconfig/templates/list-modules.html @@ -40,8 +40,9 @@ title="{{lang_edit}}"> <span class="glyphicon glyphicon-edit"></span> </a> - <button class="btn btn-danger btn-xs confirm-delete" name="del" value="{{id}}" - title="{{lang_delete}}" {{perms.module.edit.disabled}}> + <button type="submit" class="btn btn-danger btn-xs" name="del" value="{{id}}" + title="{{lang_delete}}" {{perms.module.edit.disabled}} data-confirm="#confirm-delete" + data-title="{{title}}"> <span class="glyphicon glyphicon-trash"></span> </button> </td> diff --git a/modules-available/systemstatus/templates/_page.html b/modules-available/systemstatus/templates/_page.html index 64830ea3..9c66ba53 100644 --- a/modules-available/systemstatus/templates/_page.html +++ b/modules-available/systemstatus/templates/_page.html @@ -95,27 +95,10 @@ <form action="?do=SystemStatus" method="post"> <input type="hidden" name="token" value="{{token}}"> <input type="hidden" name="action" value="reboot"> - <button {{perms.serverreboot.disabled}} class="btn btn-warning" type="button" data-toggle="modal" data-target="#rebootServerModal"><span class="glyphicon glyphicon-repeat"></span> {{lang_serverReboot}}</button> - - - <div class ="modal fade" id="rebootServerModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"> - <div class="modal-dialog" style="width: 400px" role="document"> - <div class="modal-content"> - <div class="modal-header"> - <button type="button" class="close" data-dismiss="modal">×</button> - <b>{{lang_serverReboot}}</b> - </div> - <div class="modal-body"> - {{lang_areYouSureReboot}} - </div> - <div class="modal-footer"> - <button type="button" class="btn btn-default" data-dismiss="modal">{{lang_cancel}}</button> - <button type="submit" class="btn btn-warning"><span class="glyphicon glyphicon-repeat"></span> {{lang_serverReboot}}</button> - </div> - </div> - </div> - </div> - + <button type="submit" {{perms.serverreboot.disabled}} class="btn btn-warning" data-confirm="#confirm-reboot"> + <span class="glyphicon glyphicon-repeat"></span> {{lang_serverReboot}} + </button> + <div class="hidden" id="confirm-reboot">{{lang_areYouSureReboot}}</div> </form> <div id="dmsd-users"></div> </div> diff --git a/script/slx-fixes.js b/script/slx-fixes.js index a5864efb..925ac44f 100644 --- a/script/slx-fixes.js +++ b/script/slx-fixes.js @@ -50,4 +50,40 @@ $('a.disabled').each(function() { var $hax = $('<div class="disabled-hack">'); $this.after($hax); $hax.append($this); -});
\ No newline at end of file +}); + +// Modern confirmation dialogs using bootstrap modal +$(document).ready(function() { + var $title, $body, $button, $function, $modal = null, $cache = {}; + $function = function (e) { + e.preventDefault(); + var $this = $(this); + if ($modal === null) { + $modal = $('<div class="modal fade" id="modal-autogen" tabindex="-1" role="dialog"><div class="modal-dialog" role="document"><div class="modal-content"><div class="modal-header"><button type="button" class="close" data-dismiss="modal">×</button>' + + '<b id="modal-autogen-title"></b></div><div id="modal-autogen-body" class="modal-body"></div>' + + '<div class="modal-footer"><button type="submit" id="modal-autogen-button" data-dismiss="modal"></button></div></div></div></div>'); + $('#mainpage').append($modal); + $title = $('#modal-autogen-title'); + $body = $('#modal-autogen-body'); + $button = $('#modal-autogen-button'); + } + $title.text($this.data('title') || $this.text()); + $button.html($this.html()).attr('class', $this.attr('class')).removeClass('btn-xs btn-sm btn-lg').off('click').click(function() { + // Click and reconnect click handler so pressing "back" on the next page works + $this.off('click').click().click($function); + }); + var $wat, str = $this.data('confirm'); + if (str.substr(0, 9) === '#confirm-') { + if ($cache[str]) { + $wat = $cache[str]; + } else { + $cache[str] = $wat = $(str).detach(); // .detach as $wat might contain elements with id attribute + } + $body.empty().append($wat.clone(true).removeClass('hidden collapse invisible')); + } else { + $body.text(str); + } + $modal.modal(); + }; + $('button[data-confirm]').click($function); +}); |