diff --git a/src/opnsense/mvc/app/views/OPNsense/CaptivePortal/clients.volt b/src/opnsense/mvc/app/views/OPNsense/CaptivePortal/clients.volt index 3dab7de7d..e5fcf2cb4 100644 --- a/src/opnsense/mvc/app/views/OPNsense/CaptivePortal/clients.volt +++ b/src/opnsense/mvc/app/views/OPNsense/CaptivePortal/clients.volt @@ -95,7 +95,9 @@ POSSIBILITY OF SUCH DAMAGE. grid_clients.on("loaded.rs.jquery.bootgrid", function(){ grid_clients.find(".command-disconnect").on("click", function(e) { var sessionId=$(this).data("row-id"); - stdDialogRemoveItem('{{ lang._('Disconnect selected client?') }}',function() { + stdDialogConfirm('{{ lang._('Confirm disconnect') }}', + '{{ lang._('Do you want to disconnect the selected client?') }}', + '{{ lang._('Yes') }}', '{{ lang._('Cancel') }}', function () { ajaxCall(url="/api/captiveportal/session/disconnect/" + zoneid + '/', sendData={'sessionId': sessionId}, callback=function(data,status){ // reload grid after delete @@ -130,8 +132,8 @@ POSSIBILITY OF SUCH DAMAGE. {{ lang._('Session') }} {{ lang._('userName') }} - {{ lang._('macAddress') }} - {{ lang._('ipAddress') }} + {{ lang._('macAddress') }} + {{ lang._('ipAddress') }} {{ lang._('connected since') }} diff --git a/src/opnsense/mvc/app/views/OPNsense/CaptivePortal/index.volt b/src/opnsense/mvc/app/views/OPNsense/CaptivePortal/index.volt index 54dfa5a7b..edbbe187c 100644 --- a/src/opnsense/mvc/app/views/OPNsense/CaptivePortal/index.volt +++ b/src/opnsense/mvc/app/views/OPNsense/CaptivePortal/index.volt @@ -79,7 +79,9 @@ POSSIBILITY OF SUCH DAMAGE. }); grid_templates.find(".command-delete").on("click", function(e) { var uuid=$(this).data("row-id"); - stdDialogRemoveItem('Remove selected item?',function() { + stdDialogConfirm('{{ lang._('Confirm removal') }}', + '{{ lang._('Do you want to remove the selected item?') }}', + '{{ lang._('Yes') }}', '{{ lang._('Cancel') }}', function () { ajaxCall(url="/api/captiveportal/service/delTemplate/" + uuid, sendData={},callback=function(data,status){ // reload grid after delete @@ -187,10 +189,10 @@ POSSIBILITY OF SUCH DAMAGE. {{ lang._('Enabled') }} - {{ lang._('Zoneid') }} + {{ lang._('Zoneid') }} {{ lang._('Description') }} {{ lang._('Commands') }} - {{ lang._('ID') }} + {{ lang._('ID') }} @@ -211,10 +213,10 @@ POSSIBILITY OF SUCH DAMAGE. - + - + @@ -233,12 +235,11 @@ POSSIBILITY OF SUCH DAMAGE.

- +

- {# include dialogs #} {{ partial("layout_partials/base_dialog",['fields':formDialogZone,'id':'DialogZone','label':'Edit zone'])}} diff --git a/src/opnsense/mvc/app/views/OPNsense/Core/firmware.volt b/src/opnsense/mvc/app/views/OPNsense/Core/firmware.volt index c65ad2527..12e0d096e 100644 --- a/src/opnsense/mvc/app/views/OPNsense/Core/firmware.volt +++ b/src/opnsense/mvc/app/views/OPNsense/Core/firmware.volt @@ -154,17 +154,7 @@ POSSIBILITY OF SUCH DAMAGE. if (data['details'] != undefined) { details = data['details']; } - BootstrapDialog.show({ - type:BootstrapDialog.TYPE_INFO, - title: "{{ lang._('Plugin details') }}", - message: details, - buttons: [{ - label: "{{ lang._('Close') }}", - action: function(dialogRef){ - dialogRef.close(); - } - }] - }); + stdDialogInform("{{ lang._('Plugin details') }}", details, "{{ lang._('Close') }}"); }); } @@ -178,17 +168,7 @@ POSSIBILITY OF SUCH DAMAGE. if (data['license'] != undefined) { license = data['license']; } - BootstrapDialog.show({ - type:BootstrapDialog.TYPE_INFO, - title: "{{ lang._('License details') }}", - message: license, - buttons: [{ - label: "{{ lang._('Close') }}", - action: function(dialogRef){ - dialogRef.close(); - } - }] - }); + stdDialogInform("{{ lang._('License details') }}", license, "{{ lang._('Close') }}"); }); } diff --git a/src/opnsense/www/js/opnsense_bootgrid_plugin.js b/src/opnsense/www/js/opnsense_bootgrid_plugin.js index 651ba3976..6dd43b346 100644 --- a/src/opnsense/www/js/opnsense_bootgrid_plugin.js +++ b/src/opnsense/www/js/opnsense_bootgrid_plugin.js @@ -209,6 +209,7 @@ $.fn.UIBootgrid = function (params) { { if (gridParams['del'] != undefined) { var uuid=$(this).data("row-id"); + // XXX must be replaced, cannot translate stdDialogRemoveItem('Remove selected item?',function() { ajaxCall(url=gridParams['del'] + uuid, sendData={},callback=function(data,status){ @@ -269,6 +270,7 @@ $.fn.UIBootgrid = function (params) { // link delete selected items action $(this).find("*[data-action=deleteSelected]").click(function(){ if ( gridParams['del'] != undefined) { + // XXX must be replaced, cannot translate stdDialogRemoveItem("Remove selected items?",function(){ var rows =$("#"+gridId).bootgrid('getSelectedRows'); if (rows != undefined){ diff --git a/src/opnsense/www/js/opnsense_ui.js b/src/opnsense/www/js/opnsense_ui.js index 0038c171b..e4fbb2fdf 100644 --- a/src/opnsense/www/js/opnsense_ui.js +++ b/src/opnsense/www/js/opnsense_ui.js @@ -270,19 +270,59 @@ function initFormAdvancedUI() { }); } +/** + * standard dialog when information is required, wrapper around BootstrapDialog + */ +function stdDialogInform(title, message, close, callback, type) { + var types = { + "danger": BootstrapDialog.TYPE_DANGER, + "default": BootstrapDialog.TYPE_DEFAULT, + "info": BootstrapDialog.TYPE_INFO, + "primary": BootstrapDialog.TYPE_PRIMARY, + "success": BootstrapDialog.TYPE_SUCCESS, + "warning": BootstrapDialog.TYPE_WARNING + }; + if (!(type in types)) { + type = 'info'; + } + BootstrapDialog.show({ + title: title, + message: message, + type: types[type], + buttons: [{ + label: close, + action: function (dialogRef) { + if (typeof callback !== 'undefined') { + callback(); + } + dialogRef.close(); + } + }] + }); +} + /** * standard dialog when confirmation is required, wrapper around BootstrapDialog */ -function stdDialogConfirmation(title, message, accept, decline, callback) { +function stdDialogConfirm(title, message, accept, decline, callback, type) { + var types = { + // only types that make sense for confirmation + "danger": BootstrapDialog.TYPE_DANGER, + "default": BootstrapDialog.TYPE_DEFAULT, + "warning": BootstrapDialog.TYPE_WARNING + }; + if (!(type in types)) { + type = 'warning'; + } BootstrapDialog.confirm({ title: title, message: message, - type:BootstrapDialog.TYPE_DANGER, + type: types[type], btnCancelLabel: decline, btnOKLabel: accept, - btnOKClass: 'btn-primary', + btnOKClass: 'btn-' + type, callback: function(result) { - if(result) { + if (result) { callback(); } } @@ -290,8 +330,8 @@ function stdDialogConfirmation(title, message, accept, decline, callback) { } /** - * wrapper for backwards compatibility + * wrapper for backwards compatibility (do not use) */ function stdDialogRemoveItem(message, callback) { - stdDialogConfirmation('Remove', message, 'Yes', 'Cancel', callback) + stdDialogConfirm('Remove', message, 'Yes', 'Cancel', callback); }
{{ lang._('Fileid') }}{{ lang._('Fileid') }} {{ lang._('Name') }} {{ lang._('Commands') }}{{ lang._('ID') }}{{ lang._('ID') }}