From 03424ad19ac1bb42635a3d6653565aa0dc6ccf5a Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 25 Mar 2019 11:46:50 +0100 Subject: Introduce JS helper for bootstrap confirm dialogs on button-submit --- modules-available/adduser/lang/de/messages.json | 2 +- .../adduser/templates/page-userlist.html | 54 ++------- .../dnbd3/templates/page-serverlist.html | 5 +- .../dozmod/templates/ldapfilters.html | 104 +++++++--------- .../dozmod/templates/networkrules.html | 100 ++++++--------- .../dozmod/templates/networkshares.html | 48 ++------ .../dozmod/templates/runscripts-list.html | 118 ++++++++---------- modules-available/exams/templates/page-exams.html | 22 ++-- modules-available/locationinfo/page.inc.php | 24 ++-- .../locationinfo/templates/page-panels.html | 37 ++---- .../locationinfo/templates/page-servers.html | 45 ++----- .../locations/templates/location-subnets.html | 4 +- .../locations/templates/locations.html | 4 - modules-available/news/templates/page-news.html | 11 +- .../permissionmanager/templates/rolestable.html | 35 ++---- .../runmode/templates/module-machine-list.html | 8 +- .../templates/bootentry-list.html | 135 +++++++++------------ .../serversetup-bwlp-ipxe/templates/menu-list.html | 45 ++----- .../statistics/lang/de/template-tags.json | 2 +- .../statistics/templates/clientlist.html | 120 +++++------------- .../statistics/templates/page-replace.html | 24 +--- modules-available/sysconfig/templates/js.html | 6 +- .../sysconfig/templates/list-configs.html | 5 +- .../sysconfig/templates/list-modules.html | 5 +- .../systemstatus/templates/_page.html | 25 +--- script/slx-fixes.js | 38 +++++- 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}}} -
- - + + + @@ -25,12 +25,12 @@
{{phone}} {{email}} - + {{^hide_delete}} - {{/hide_delete}} @@ -46,42 +46,4 @@ - - - - \ No newline at end of file + \ 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 @@ {{/machineuuid}} {{^self}} - {{/self}} @@ -162,6 +162,7 @@
+
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}}

- - - - - - - {{#hasEditPermission}} - - - {{/hasEditPermission}} - - - - {{#ldapfilters}} - - - - - {{#hasEditPermission}} - - - {{/hasEditPermission}} - - {{/ldapfilters}} - -
{{lang_ldapFilterName}}{{lang_ldapFilterAttribute}}{{lang_ldapFilterValue}}{{lang_edit}}{{lang_delete}}
{{filtername}}{{filterkey}}{{filtervalue}} - - - - - -
+
+ + + + + + + + + {{#hasEditPermission}} + + + {{/hasEditPermission}} + + + + {{#ldapfilters}} + + + + + {{#hasEditPermission}} + + + {{/hasEditPermission}} + + {{/ldapfilters}} + +
{{lang_ldapFilterName}}{{lang_ldapFilterAttribute}}{{lang_ldapFilterValue}}{{lang_edit}}{{lang_delete}}
{{filtername}}{{filterkey}}{{filtervalue}} + + + + + +
+
+ {{#hasEditPermission}} {{/hasEditPermission}} - -
- - - -
- - 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}}

- - - - - {{#hasEditPermissions}} - - - {{/hasEditPermissions}} - - - - {{#networkrules}} - - - {{#hasEditPermissions}} - - - {{/hasEditPermissions}} - - {{/networkrules}} - -
{{lang_name}}{{lang_edit}}{{lang_delete}}
{{rulename}} - - - - - -
+
+ + + + + + + + {{#hasEditPermissions}} + + + {{/hasEditPermissions}} + + + + {{#networkrules}} + + + {{#hasEditPermissions}} + + + {{/hasEditPermissions}} + + {{/networkrules}} + +
{{lang_name}}{{lang_edit}}{{lang_delete}}
{{rulename}} + + + + + +
+
+ + {{#hasEditPermissions}} {{/hasEditPermissions}} - - -
- - - -
- - \ 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 @@ - +
+ + + + +
{{/hasEditPermissions}} @@ -76,38 +82,4 @@
{{/hasEditPermissions}} - -
- - - -
- - \ No newline at end of file + 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}}

- - - - - - - - - {{#hasEditPermission}} - - - {{/hasEditPermission}} - - - - {{#list}} + + + +
{{lang_name}}{{lang_scriptExtensionHead}}{{lang_scriptVisibilityHead}}{{lang_scriptPassCredentialsHead}}{{lang_scriptIsGlobalHead}}{{lang_edit}}{{lang_delete}}
+ - - - - - + + + + + {{#hasEditPermission}} - - + + {{/hasEditPermission}} - {{/list}} - -
{{scriptname}}.{{extension}} - {{#passcreds}} - - {{/passcreds}} - - {{#isglobal}} - - {{/isglobal}} - {{lang_name}}{{lang_scriptExtensionHead}}{{lang_scriptVisibilityHead}}{{lang_scriptPassCredentialsHead}}{{lang_scriptIsGlobalHead}} - - - - - - {{lang_edit}}{{lang_delete}}
+ + + {{#list}} + + {{scriptname}} + .{{extension}} + + + {{#passcreds}} + + {{/passcreds}} + + + {{#isglobal}} + + {{/isglobal}} + + {{#hasEditPermission}} + + + + + + + + + {{/hasEditPermission}} + + {{/list}} + + + + {{#hasEditPermission}}
@@ -59,31 +65,3 @@
{{/hasEditPermission}} - -
- - - -
- - 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 @@
+
+ @@ -39,20 +41,24 @@ {{/exams}}
{{starttime_s}} {{endtime_s}} - - {{^liesInPast}} - - {{/liesInPast}} - - - - + {{^liesInPast}} + + {{/liesInPast}} + + + +
+
+
{{lang_addExam}} 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 @@

{{lang_panelsTableHints}}

+
+ + @@ -45,7 +48,8 @@ @@ -53,6 +57,7 @@ {{/panels}}
-
+
- -
- - - -
- - \ No newline at end of file + 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}}
- {{typename}} {{servername}} @@ -29,8 +28,8 @@ - @@ -40,8 +39,8 @@ - @@ -50,31 +49,15 @@ {{/serverlist}} + - - +
- @@ -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 @@
+ \ 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 @@
+
@@ -33,9 +34,14 @@ - + {{/roles}} @@ -43,28 +49,6 @@
- - - -
@@ -72,11 +56,6 @@
\ 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 @@ {{#allowEdit}} - +
+ + + +
{{/allowEdit}} @@ -64,37 +69,5 @@
+
- - - -
- - -
- - \ 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 @@

{{lang_clientList}} ({{rowCount}})

-
+ @@ -115,116 +115,56 @@ {{#rebootcontrol}} {{#canShutdown}} - {{/canShutdown}} {{#canReboot}} - {{/canReboot}} {{/rebootcontrol}} {{#canDelete}} - + {{/canDelete}} - - -