From 4c892103415ea53150033f897f95cfad8a73beef Mon Sep 17 00:00:00 2001 From: bergware Date: Thu, 12 Mar 2020 16:26:04 +0100 Subject: [PATCH] Multi-language support --- .../DockerSettings.page | 22 +++++++++---------- .../include/DockerContainers.php | 17 +++++++++----- .../javascript/docker.js | 22 +++++++++++-------- .../javascript/vmmanager.js | 13 +++++++---- plugins/dynamix/ArrayOperation.page | 11 +++++----- plugins/dynamix/CPUvms.page | 4 ++-- plugins/dynamix/DashStats.page | 10 ++++----- plugins/dynamix/DisplaySettings.page | 8 +++---- plugins/dynamix/Eth0.page | 4 ++-- plugins/dynamix/FlashInfo.page | 2 +- plugins/dynamix/Language.page | 6 ++--- plugins/dynamix/ManagementAccess.page | 10 ++++----- plugins/dynamix/NetworkRules.page | 2 +- plugins/dynamix/NewPerms.page | 2 +- plugins/dynamix/NotificationsArchive.page | 2 +- plugins/dynamix/RoutingTable.page | 2 +- plugins/dynamix/ShareEdit.page | 6 ++--- plugins/dynamix/SmtpSettings.page | 2 +- plugins/dynamix/TerminalButton.page | 2 +- plugins/dynamix/UserAdd.page | 14 ++++++------ plugins/dynamix/UserEdit.page | 10 ++++----- plugins/dynamix/include/DefaultPageLayout.php | 2 +- plugins/dynamix/include/Translations.php | 9 ++++++-- plugins/dynamix/include/TrialRequest.php | 2 +- 24 files changed, 103 insertions(+), 81 deletions(-) diff --git a/plugins/dynamix.docker.manager/DockerSettings.page b/plugins/dynamix.docker.manager/DockerSettings.page index 7e793a07c..b1a3bc3b1 100644 --- a/plugins/dynamix.docker.manager/DockerSettings.page +++ b/plugins/dynamix.docker.manager/DockerSettings.page @@ -823,15 +823,15 @@ function checkDHCP() { var id = $(this).attr('name'); var pool = $(this).val().split('/'); var base = $('#'+id).text().split('/'); - if (good && typeof(pool[1])=='undefined') {good = false; swal('_(Missing subnet size)_','_(Pool subnet size is not defined)_','error');} - if (good && pool[1]<=base[1]) {good = false; swal('_(Invalid subnet size)_','_(Pool subnet size is too large)_','error');} + if (good && typeof(pool[1])=='undefined') {good = false; swal({title:'_(Missing subnet size)_',text:'_(Pool subnet size is not defined)_',type:'error',confirmButtonText:'_(Ok)_'});} + if (good && pool[1]<=base[1]) {good = false; swal({title:'_(Invalid subnet size)_',text:'_(Pool subnet size is too large)_',type:'error',confirmButtonText:'_(Ok)_'});} if (typeof(pool[1])=='undefined') pool[1] = 0; if (typeof(base[1])=='undefined') base[1] = 32; var toppool = ip2int(pool[0]); var topbase = ip2int(base[0]); var endpool = toppool+Math.pow(2,32-pool[1]); var endbase = topbase+Math.pow(2,32-base[1]); - if (good && (toppool < topbase || endpool > endbase)) {good = false; swal('_(Invalid pool address)_','_(Pool address is out of range)_','error');} + if (good && (toppool < topbase || endpool > endbase)) {good = false; swal({title:'_(Invalid pool address)_',text:'_(Pool address is out of range)_',type:'error',confirmButtonText:'_(Ok)_'});} } }); if (good) $('#settingsForm').find('input[name^="DOCKER_DHCP6_"]').each(function(){ @@ -839,8 +839,8 @@ function checkDHCP() { var id = $(this).attr('name'); var pool = $(this).val().split('/'); var base = $('#'+id).text().split('/'); - if (good && typeof(pool[1])=='undefined') {good = false; swal('_(Missing subnet size)_','_(Pool subnet size is not defined)_','error');} - if (good && pool[1]<=base[1]) {good = false; swal('_(Invalid subnet size)_','_(Pool subnet size is too large)_','error');} + if (good && typeof(pool[1])=='undefined') {good = false; swal({title:'_(Missing subnet size)_',text:'_(Pool subnet size is not defined)_',type:'error',confirmButtonText:'_(Ok)_'});} + if (good && pool[1]<=base[1]) {good = false; swal({title:'_(Invalid subnet size)_',text:'_(Pool subnet size is too large)_',type:'error',confirmButtonText:'_(Ok)_'});} } }); return good; @@ -852,27 +852,27 @@ function checkIP() { $('#settingsForm').find('input[name^="DOCKER_SUBNET_"]').each(function(){ if ($(this).val() && !validIP4.test($(this).val())) error = true; }); - if (error) {swal('_(Invalid IPv4 subnet)_','_(Please enter a valid subnet)_','error'); return false;} + if (error) {swal({title:'_(Invalid IPv4 subnet)_',text:'_(Please enter a valid subnet)_',type:'error',confirmButtonText:'_(Ok)_'}); return false;} $('#settingsForm').find('input[name^="DOCKER_GATEWAY_"]').each(function(){ if ($(this).val() && !validIP4.test($(this).val())) error = true; }); - if (error) {swal('_(Invalid IPv4 gateway)_','_(Please enter a valid gateway)_','error'); return false;} + if (error) {swal({title:'_(Invalid IPv4 gateway)_',text:'_(Please enter a valid gateway)_',type:'error',confirmButtonText:'_(Ok)_'}); return false;} $('#settingsForm').find('input[name^="DOCKER_RANGE_"]').each(function(){ if ($(this).val() && !validIP4.test($(this).val())) error = true; }); - if (error) {swal('_(Invalid IPv4 range)_','_(Please enter a valid range)_','error'); return false;} + if (error) {swal({title:'_(Invalid IPv4 range)_',text:'_(Please enter a valid range)_',type:'error',confirmButtonText:'_(Ok)_'}); return false;} $('#settingsForm').find('input[name^="DOCKER_SUBNET6_"]').each(function(){ if ($(this).val() && !validIP6.test($(this).val())) error = true; }); - if (error) {swal('_(Invalid IPv6 subnet)_','_(Please enter a valid subnet)_','error'); return false;} + if (error) {swal({title:'_(Invalid IPv6 subnet)_',text:'_(Please enter a valid subnet)_',type:'error',confirmButtonText:'_(Ok)_'}); return false;} $('#settingsForm').find('input[name^="DOCKER_GATEWAY6_"]').each(function(){ if ($(this).val() && !validIP6.test($(this).val())) error = true; }); - if (error) {swal('_(Invalid IPv6 gateway)_','_(Please enter a valid gateway)_','error'); return false;} + if (error) {swal({title:'_(Invalid IPv6 gateway)_',text:'_(Please enter a valid gateway)_',type:'error',confirmButtonText:'_(Ok)_'}); return false;} $('#settingsForm').find('input[name^="DOCKER_RANGE6_"]').each(function(){ if ($(this).val() && !validIP6.test($(this).val())) error = true; }); - if (error) {swal('_(Invalid IPv6 range)_','_(Please enter a valid range)_','error'); return false;} + if (error) {swal({title:'_(Invalid IPv6 range)_',text:'_(Please enter a valid range)_',type:'error',confirmButtonText:'_(Ok)_'}); return false;} return true; } function showLogOptions(log) { diff --git a/plugins/dynamix.docker.manager/include/DockerContainers.php b/plugins/dynamix.docker.manager/include/DockerContainers.php index 3e8ae3c1f..6bc73ed9e 100644 --- a/plugins/dynamix.docker.manager/include/DockerContainers.php +++ b/plugins/dynamix.docker.manager/include/DockerContainers.php @@ -48,6 +48,13 @@ $menu = []; $autostart = @file($autostart_file, FILE_IGNORE_NEW_LINES) ?: []; $names = array_map('var_split', $autostart); +function my_lang_log($text) { + global $language; + if (isset($language['healthy'])) $text = str_replace('healthy',$language['healthy'],$text); + if (isset($language['Exited'])) $text = str_replace('Exited',$language['Exited'],$text); + return my_lang(my_lang(_($text),2)); +} + foreach ($containers as $ct) { $name = $ct['Name']; $id = $ct['Id']; @@ -126,19 +133,19 @@ foreach ($containers as $ct) { echo "0%
"; echo "
0 / 0"; echo ""; - echo ""; + echo ""; echo "
"; - echo htmlspecialchars(str_replace('Up','Uptime',$ct['Status']))."
Created ".htmlspecialchars($ct['Created'])."
"; + echo htmlspecialchars(str_replace('Up',_('Uptime'),my_lang_log($ct['Status'])))."
"._('Created')." ".htmlspecialchars(my_lang($ct['Created']))."
"; } foreach ($images as $image) { if (count($image['usedBy'])) continue; $id = $image['Id']; $menu[] = sprintf("addDockerImageContext('%s','%s');", $id, implode(',',$image['Tags'])); echo ""; - echo "(orphan image)
stopped
"; - echo "Image ID: $id
"; + echo "("._('orphan image').")
"._('stopped')."
"; + echo ""._('Image ID').": $id
"; echo implode(', ',array_map('htmlspecialchars',$image['Tags'])); - echo "Created ".htmlspecialchars($image['Created']).""; + echo ""._('Created')." ".htmlspecialchars(my_lang($image['Created'])).""; } echo "\0".implode($menu).implode($docker)."\0".(pgrep('rc.docker')!==false ? 1:0); ?> diff --git a/plugins/dynamix.docker.manager/javascript/docker.js b/plugins/dynamix.docker.manager/javascript/docker.js index 7dbf079be..88860957e 100644 --- a/plugins/dynamix.docker.manager/javascript/docker.js +++ b/plugins/dynamix.docker.manager/javascript/docker.js @@ -85,7 +85,7 @@ function popupWithIframe(title, cmd, reload, func) { $('.ui-dialog .ui-dialog-content').css('padding', '12'); } function execUpContainer(container) { - var title = 'Updating the container: '+container; + var title = _('Updating the container')+': '+container; var cmd = '/plugins/dynamix.docker.manager/include/CreateDocker.php?updateContainer=true&ct[]='+encodeURIComponent(container); popupWithIframe(title, cmd, true, 'loadlist'); } @@ -108,13 +108,14 @@ function updateContainer(container) { text:body, type:'warning', showCancelButton:true, - confirmButtonText:'Yes, update it!' + confirmButtonText:_('Yes, update it!'), + cancelButtonText:_('Cancel') },function(){ execUpContainer(container); }); } function rmContainer(container, image, id) { - var body = _('Remove container')+': '+container+'

'; + var body = _('Remove container')+': '+container+'

'; $('input[type=button]').prop('disabled',true); swal({ title:_('Are you sure?'), @@ -122,7 +123,8 @@ function rmContainer(container, image, id) { type:'warning', html:true, showCancelButton:true, - confirmButtonText:'Yes, delete it!', + confirmButtonText:_('Yes, delete it!'), + cancelButtonText:_('Cancel'), showLoaderOnConfirm:true },function(c){ if (!c) {setTimeout(loadlist,0); return;} @@ -142,7 +144,8 @@ function rmImage(image, imageName) { text:body, type:'warning', showCancelButton:true, - confirmButtonText:'Yes, delete it!', + confirmButtonText:_('Yes, delete it!'), + cancelButtonText:_('Cancel'), showLoaderOnConfirm:true },function(c){ if (!c) {setTimeout(loadlist,0); return;} @@ -158,7 +161,8 @@ function eventControl(params, spin) { } else { swal({ title:_('Execution error'), html:true, - text:data.success, type:'error' + text:data.success, type:'error', + confirmButtonText:_('Ok'), },function(){ if (spin) setTimeout(spin+'()',500); else location=window.location.href; }); @@ -187,7 +191,7 @@ function resumeAll() { } function checkAll() { $('input[type=button]').prop('disabled',true); - $('.updatecolumn').html(' checking...'); + $('.updatecolumn').html(' '+_('checking')+'...'); $.post('/plugins/dynamix.docker.manager/include/DockerUpdate.php',{},function(){loadlist();}); } function updateAll() { @@ -207,9 +211,9 @@ function rebuildAll() { function containerLogs(container, id) { var height = 600; var width = 900; - var run = eventURL+'?action=log&container='+id+'&title=Log for: '+container; + var run = eventURL+'?action=log&container='+id+'&title='+_('Log for:')+' '+container; var top = (screen.height-height) / 2; var left = (screen.width-width) / 2; var options = 'resizeable=yes,scrollbars=yes,height='+height+',width='+width+',top='+top+',left='+left; - window.open(run, 'log', options); + window.open(run, _('log'), options); } diff --git a/plugins/dynamix.vm.manager/javascript/vmmanager.js b/plugins/dynamix.vm.manager/javascript/vmmanager.js index 801f935b9..728248178 100644 --- a/plugins/dynamix.vm.manager/javascript/vmmanager.js +++ b/plugins/dynamix.vm.manager/javascript/vmmanager.js @@ -4,7 +4,8 @@ function ajaxVMDispatch(params, spin){ if (data.error) { swal({ title:_("Execution error"), html:true, - text:data.error, type:"error" + text:data.error, type:"error", + confirmButtonText:_('Ok') },function(){ if (spin) setTimeout(spin+'()',500); else location=window.location.href; }); @@ -72,7 +73,7 @@ function addVMContext(name, uuid, template, state, vncurl, log){ } opts.push({divider:true}); if (log !== "") { - opts.push({text:_("Logs"), icon:"fa-navicon", action:function(e){e.preventDefault(); openWindow('/webGui/scripts/tail_log&arg1='+log, 'Log for:'+name, 600, 900);}}); + opts.push({text:_("Logs"), icon:"fa-navicon", action:function(e){e.preventDefault(); openWindow('/webGui/scripts/tail_log&arg1='+log, _('Log for:')+name, 600, 900);}}); } opts.push({text:_("Edit"), icon:"fa-pencil", href:path+'/UpdateVM?uuid='+uuid}); if (state == "shutoff") { @@ -83,7 +84,9 @@ function addVMContext(name, uuid, template, state, vncurl, log){ title:_("Are you sure?"), text:_("Remove definition:")+name, type:"warning", - showCancelButton:true + showCancelButton:true, + confirmButtonText:_('Proceed'), + cancelButtonText:_('Cancel') },function(){ $('#vm-'+uuid).find('i').removeClass('fa-play fa-square fa-pause').addClass('fa-refresh fa-spin'); ajaxVMDispatch({action:"domain-undefine",uuid:uuid}, "loadlist"); @@ -96,7 +99,9 @@ function addVMContext(name, uuid, template, state, vncurl, log){ title:_("Are you sure?"), text:_("Completely REMOVE")+" "+name+" "+_("disk image and definition"), type:"warning", - showCancelButton:true + showCancelButton:true, + confirmButtonText:_('Proceed'), + cancelButtonText:_('Cancel') },function(){ $('#vm-'+uuid).find('i').removeClass('fa-play fa-square fa-pause').addClass('fa-refresh fa-spin'); ajaxVMDispatch({action:"domain-delete",uuid:uuid}, "loadlist"); diff --git a/plugins/dynamix/ArrayOperation.page b/plugins/dynamix/ArrayOperation.page index 320eb1831..06edcb8b4 100644 --- a/plugins/dynamix/ArrayOperation.page +++ b/plugins/dynamix/ArrayOperation.page @@ -147,7 +147,7 @@ function prepareInput(form) { form.file.disabled = false; form.text.disabled = false; form.copy.disabled = false; - swal({title:'_(Printable Characters Only)_',text:'_(Use ASCII characters from space " " to tilde "~")_
_(Otherwise use the keyfile method for UTF8 input)_',html:true,type:'error'}); + swal({title:'_(Printable Characters Only)_',text:'_(Use ASCII characters from space " " to tilde "~")_
_(Otherwise use the **keyfile** method for UTF8 input)_',html:true,type:'error',confirmButtonText:'_(Ok)_'}); } return; } @@ -167,7 +167,7 @@ function parityWarning(form) { } else { var text = '_(Parity disk(s) content will be overwritten)_'; } - swal({title:'_(Proceed to start)_',text:text,html:true,type:'warning',confirmButtonText:'_(Proceed)_',showCancelButton:true},function(){prepareInput(form);}); + swal({title:'_(Proceed to start)_',text:text,html:true,type:'warning',showCancelButton:true,confirmButtonText:'_(Proceed)_',cancelButtonText:'_(Cancel)_'},function(){prepareInput(form);}); } function tab0() { $.removeCookie('one',{path:'/'}); @@ -187,7 +187,7 @@ function parityStatus() { function stopArray(form) { $(form).append(''); - swal({title:'_(Proceed)_?',text:'_(This will stop the array)_',type:'warning',showCancelButton:true},function(p){if (p) form.submit(); else $('input[name="cmdStop"]').remove();}); + swal({title:'_(Proceed)_?',text:'_(This will stop the array)_',type:'warning',showCancelButton:true,confirmButtonText:'_(Proceed)_',cancelButtonText:'_(Cancel)_'},function(p){if (p) form.submit(); else $('input[name="cmdStop"]').remove();}); form.submit(); @@ -195,7 +195,7 @@ function stopArray(form) { function stopParity(form,text) { $(form).append(''); - swal({title:'_(Proceed)_?',text:'_(This will stop the running operation)_: '+text,type:'warning',showCancelButton:true},function(p){if (p) form.submit(); else $('input[name="cmdNoCheck"]').remove();}); + swal({title:'_(Proceed)_?',text:'_(This will stop the running operation)_: '+text,type:'warning',showCancelButton:true,confirmButtonText:'_(Proceed)_',cancelButtonText:'_(Cancel)_'},function(p){if (p) form.submit(); else $('input[name="cmdNoCheck"]').remove();}); form.submit(); @@ -217,7 +217,7 @@ function shutdown_now(form,cmd) { case 'reboot': var text = '_(This will reboot the system)_'; break; case 'shutdown': var text = '_(This will shutdown the system)_'; break; } - swal({title:'_(Proceed)_?',text:text,type:'warning',showCancelButton:true},function(p){if (p) form.submit(); else $('input[name="cmd"]').remove();}); + swal({title:'_(Proceed)_?',text:text,type:'warning',showCancelButton:true,confirmButtonText:'_(Proceed)_',cancelButtonText:'_(Cancel)_'},function(p){if (p) form.submit(); else $('input[name="cmd"]').remove();}); form.submit(); @@ -272,6 +272,7 @@ function formatWarning(val) { + '


_(WARNING)_' + '

_(A format is NEVER part of a data recovery or disk rebuild process and if done in such circumstances will normally lead to loss of all data on the disks being formatted)_.', type: "warning", + confirmButtonText:'_(Ok)_', html: true }); } diff --git a/plugins/dynamix/CPUvms.page b/plugins/dynamix/CPUvms.page index 1dc142078..8871dd042 100644 --- a/plugins/dynamix/CPUvms.page +++ b/plugins/dynamix/CPUvms.page @@ -72,7 +72,7 @@ function apply(form) { // step 1: prepare the update and report back the changes $.post('/webGui/include/UpdateOne.php',args,function(reply){ if (reply.error) { - swal({type:'error', title:'_(Assignment error)_', text:reply.error},function(){ + swal({type:'error',title:'_(Assignment error)_',text:reply.error,confirmButtonText:'_(Ok)_'},function(){ $('#wait-'+id).hide(); $(form).find('input[value="_(Done)_"]').val('_(Reset)_').prop('disabled',false).prop('onclick',null).off('click').click(function(){reset($('form[name="'+id+'"]'));}); }); @@ -86,7 +86,7 @@ function apply(form) { $.post('/webGui/include/UpdateTwo.php',{id:id,name:encodeURI(name)},function(reply){ if (reply.error) { // report error and reload table - swal({type:'error', title:'_(Execution error)_', text:reply.error},function(){ + swal({type:'error',title:'_(Execution error)_',text:reply.error,confirmButtonText:'_(Ok)_'},function(){ $('#wait-'+id).hide(); $('input[value="_(Done)_"]').prop('disabled',false); reset($('form[name="'+id+'"]')); diff --git a/plugins/dynamix/DashStats.page b/plugins/dynamix/DashStats.page index 39bd763fc..8ddab6426 100644 --- a/plugins/dynamix/DashStats.page +++ b/plugins/dynamix/DashStats.page @@ -939,7 +939,7 @@ function toggleView(field,init,view) { } function StopArray() { - swal({title:'_(Proceed)_?',text:'_(This will stop the array)_',type:'warning',showCancelButton:true},function(){StopArrayNow();}); + swal({title:'_(Proceed)_?',text:'_(This will stop the array)_',type:'warning',showCancelButton:true,confirmButtonText:'_(Proceed)_',cancelButtonText:'_(Cancel)_'},function(){StopArrayNow();}); StopArrayNow(); @@ -950,7 +950,7 @@ function StopArrayNow() { } function StartArray() { - swal({title:'_(Proceed)_?',text:'_(This will start the array)_',type:'warning',showCancelButton:true},function(){StartArrayNow();}); + swal({title:'_(Proceed)_?',text:'_(This will start the array)_',type:'warning',showCancelButton:true,confirmButtonText:'_(Proceed)_',cancelButtonText:'_(Cancel)_'},function(){StartArrayNow();}); StartArrayNow(); @@ -961,7 +961,7 @@ function StartArrayNow() { } function Reboot() { - swal({title:'_(Proceed)_?',text:'_(This will reboot the system)_',type:'warning',showCancelButton:true},function(){RebootNow();}); + swal({title:'_(Proceed)_?',text:'_(This will reboot the system)_',type:'warning',showCancelButton:true,confirmButtonText:'_(Proceed)_',cancelButtonText:'_(Cancel)_'},function(){RebootNow();}); RebootNow(); @@ -972,7 +972,7 @@ function RebootNow() { } function Shutdown() { - swal({title:'_(Proceed)_?',text:'_(This will shutdown the system)_',type:'warning',showCancelButton:true},function(){ShutdownNow();}); + swal({title:'_(Proceed)_?',text:'_(This will shutdown the system)_',type:'warning',showCancelButton:true,confirmButtonText:'_(Proceed)_',cancelButtonText:'_(Cancel)_'},function(){ShutdownNow();}); ShutdownNow(); @@ -985,7 +985,7 @@ function ShutdownNow() { function Sleep() { - swal({title:'_(Proceed)_?',text:'_(This will put the system to sleep)_',type:'warning',showCancelButton:true},function(){SleepNow();}); + swal({title:'_(Proceed)_?',text:'_(This will put the system to sleep)_',type:'warning',showCancelButton:true,confirmButtonText:'_(Proceed)_',cancelButtonText:'_(Cancel)_'},function(){SleepNow();}); SleepNow(); diff --git a/plugins/dynamix/DisplaySettings.page b/plugins/dynamix/DisplaySettings.page index 3d0574d8c..c61dcee81 100644 --- a/plugins/dynamix/DisplaySettings.page +++ b/plugins/dynamix/DisplaySettings.page @@ -73,20 +73,20 @@ $(function() { url:'/webGui/include/FileUpload.php', beforeEach:function(file) { if (!file.type.match(/^image\/png/)) { - swal({title:"_(Warning)_",text:"_(Only PNG images are allowed)_!",type:"warning"}); + swal({title:"_(Warning)_",text:"_(Only PNG images are allowed)_!",type:"warning",confirmButtonText:'_(Ok)_'}); return false; } }, error: function(err, file, i) { switch (err) { case 'BrowserNotSupported': - swal({title:"_(Browser error)_",text:"_(Your browser does not support HTML5 file uploads)_!",type:"error"}); + swal({title:"_(Browser error)_",text:"_(Your browser does not support HTML5 file uploads)_!",type:"error",confirmButtonText:'_(Ok)_'}); break; case 'TooManyFiles': swal({title:"_(Too many files)_",text:"_(Please select one file only)_!",type:"error"}); break; case 'FileTooLarge': - swal({title:"_(File too large)_",text:"_(Maximum file upload size is 512 kB)_ (524,288 _(bytes)_)",type:"error"}); + swal({title:"_(File too large)_",text:"_(Maximum file upload size is 512 kB)_ (524,288 _(bytes)_)",type:"error",confirmButtonText:'_(Ok)_'}); break; } }, @@ -104,7 +104,7 @@ $(function() { $('select[name="banner"]').trigger('change'); filename = file.name; } else { - swal({title:"_(Upload error)_",text:response,type:"error"}); + swal({title:"_(Upload error)_",text:response,type:"error",confirmButtonText:'_(Ok)_'}); } } }); diff --git a/plugins/dynamix/Eth0.page b/plugins/dynamix/Eth0.page index 1482623de..354486cb3 100644 --- a/plugins/dynamix/Eth0.page +++ b/plugins/dynamix/Eth0.page @@ -97,7 +97,7 @@ function prepareSettings(form) { $(form).find('input[name^="METRIC:"]').each(function(){metrics.push($(this).val());}); $(form).find('input[name^="METRIC6:"]').each(function(){metrics6.push($(this).val());}); if (metrics.same() || metrics6.same()) { - swal('Duplicate metrics','List of default gateways contains duplicate metric values','error'); + swal({title:'Duplicate metrics',text:'List of default gateways contains duplicate metric values',type:'error',confirmButtonText:'_(Ok)_'}); return false; } if (form.TYPE.value == 'access') { @@ -118,7 +118,7 @@ function prepareSettings(form) { var vlans = []; $(form).find('input[name^="VLANID:"]').each(function(){vlans.push($(this).val());}); if (vlans.same()) { - swal('_(VLAN assignment mismatch)_','_(List of VLANs contains duplicate VLAN numbers)_','error'); + swal({title:'_(VLAN assignment mismatch)_',text:'_(List of VLANs contains duplicate VLAN numbers)_',type:'error',confirmButtonText:'_(Ok)_'}); return false; } } diff --git a/plugins/dynamix/FlashInfo.page b/plugins/dynamix/FlashInfo.page index 41efaf701..c6c051c35 100644 --- a/plugins/dynamix/FlashInfo.page +++ b/plugins/dynamix/FlashInfo.page @@ -37,7 +37,7 @@ function backup() { $('input[value="_(Creating Flash backup)_..."]').val('_(Flash backup)_'); $('div.spinner').hide('slow'); $('#pleaseWait').hide('slow'); - swal('_(Creation error)_','_(Insufficient free disk space available)_','error'); + swal({title:'_(Creation error)_',text:'_(Insufficient free disk space available)_',type:'error',confirmButtonText:'_(Ok)_'}); } }); } diff --git a/plugins/dynamix/Language.page b/plugins/dynamix/Language.page index df4ef9bad..dcb55ccaf 100644 --- a/plugins/dynamix/Language.page +++ b/plugins/dynamix/Language.page @@ -31,7 +31,7 @@ var keys = {}; function upload(form) { var language = form.language.value; if (!language) { - swal('_(Missing Language)_','_(Please select a language before proceeding)_!','error'); + swal({title:'_(Missing Language)_',text:'_(Please select a language before proceeding)_!',type:'error',confirmButtonText:'_(Ok)_'}); return; } var cmd = form.check.checked ? 'rm' :'add'; @@ -42,7 +42,7 @@ function upload(form) { var name = list.split(','); for (var i=0; i < name.length; i++) installed.push(keys[name[i]]); $('#installed').text(installed.join(', ')); - swal({title:title,text:'_(See)_ _(Display Settings)_ _(to select your language)_',type:'success',html:true}); + swal({title:title,text:'_(See)_ _(Display Settings)_ _(to select your language)_',type:'success',html:true,confirmButtonText:'_(Ok)_'}); $('#uploadbutton').prop('disabled',true); } }); @@ -56,7 +56,7 @@ function getZIPfile(event,form) { form.file.value = reader.result; $('#uploadbutton').prop('disabled',false); } else { - swal('_(Wrong File Extension)_','_(Only ZIP files are allowed)_','warning'); + swal({title:'_(Wrong File Extension)_',text:'_(Only ZIP files are allowed)_',type:'warning',confirmButtonText:'_(Ok)_'}); } }; reader.readAsDataURL(input.files[0]); diff --git a/plugins/dynamix/ManagementAccess.page b/plugins/dynamix/ManagementAccess.page index b06a4b4e0..5e3e8591b 100644 --- a/plugins/dynamix/ManagementAccess.page +++ b/plugins/dynamix/ManagementAccess.page @@ -58,7 +58,7 @@ function provisionSSL(button) { var obj = data.responseJSON; var msg = "_(Sorry, an error occurred in processing your SSL certificate)_. _(The error is)_: "+obj.error+"."; $(button).prop("disabled", false).html(oldlabel); - swal("_(Oops)_",msg,"error"); + swal({title:"_(Oops)_",text:msg,type:"error",confirmButtonText:'_(Ok)_'}); }; var success_provision = function(data) { if (data.bundle) { @@ -78,7 +78,7 @@ function provisionSSL(button) { }; var success_rebind_check = function(data) { $.post("/webGui/include/CertUpload.php",{text:data.bundle,csrf_token:""},function(data2) { - swal({title:"",text:msg,type:"success",allowEscapeKey:false},function(){button.form.submit();}); + swal({title:"",text:msg,type:"success",allowEscapeKey:false,confirmButtonText:'_(Ok)_'},function(){button.form.submit();}); }).fail(failure); }; $.post("/webGui/include/ProvisionCert.php",success_provision).fail(failure); @@ -90,11 +90,11 @@ function updateDNS(button) { var obj = data.responseJSON; var msg = "_(Sorry, an error occurred updating unraid.net DNS records)_. _(The error is)_: "+obj.error+"."; $(button).prop("disabled", false).html('_(Update DNS)_'); - swal("_(Oops)_",msg,"error"); + swal({title:"_(Oops)_",text:msg,type:"error",confirmButtonText:'_(Ok)_'}); }; var success = function(data) { $(button).prop("disabled", false).html('_(Update DNS)_'); - swal("","_(Your local IP address)_ _(has been updated for unraid.net)_.","success"); + swal({title:"",text:"_(Your local IP address)_ _(has been updated for unraid.net)_.",type:"success",confirmButtonText:'_(Ok)_'}); }; $.post("/webGui/include/UpdateDNS.php",success).fail(failure); } @@ -111,7 +111,7 @@ function checkPorts(form) { item.prop('disabled',false); } if (list.length > 0) { - swal({title:'_(Non-recommended port)_'+(list.length>1?'s':''),text:list.join(', ')+'
_(may conflict with well-known services)_',html:true,type:'warning',showCancelButton:true},function(){form.submit();}); + swal({title:'_(Non-recommended port)_'+(list.length>1?'s':''),text:list.join(', ')+'
_(may conflict with well-known services)_',html:true,type:'warning',showCancelButton:true,confirmButtonText:'_(Proceed)_',cancelButtonText:'_(Cancel)_'},function(){form.submit();}); } else { form.submit(); } diff --git a/plugins/dynamix/NetworkRules.page b/plugins/dynamix/NetworkRules.page index 7481976a5..6273f42e3 100644 --- a/plugins/dynamix/NetworkRules.page +++ b/plugins/dynamix/NetworkRules.page @@ -50,7 +50,7 @@ function check_rules(form) { var mac = []; $(form).find('select[name^="eth"]').each(function(){mac.push($(this).val());}); if (mac.same()) { - swal('_(MAC address mismatch)_','_(Rules contain duplicate MAC address assignments)_','error'); + swal({title:'_(MAC address mismatch)_',text:'_(Rules contain duplicate MAC address assignments)_',type:'error',confirmButtonText:'_(Ok)_'}); return false; } else { return true; diff --git a/plugins/dynamix/NewPerms.page b/plugins/dynamix/NewPerms.page index 83ec09634..c17bbc169 100644 --- a/plugins/dynamix/NewPerms.page +++ b/plugins/dynamix/NewPerms.page @@ -44,7 +44,7 @@ function setNewPerms(form) { dirs += item.value; } } - if (dirs) swal({title:'_(Proceed)_?',text:'_(This will update folder & file permissions)_',type:'warning',showCancelButton:true},function(){openBox('/webGui/scripts/newperms&arg1='+dirs,'_(New Permissions)_',490,430,true);}); + if (dirs) swal({title:'_(Proceed)_?',text:'_(This will update folder & file permissions)_',type:'warning',showCancelButton:true,confirmButtonText:'_(Proceed)_',cancelButtonText:'_(Cancel)_'},function(){openBox('/webGui/scripts/newperms&arg1='+dirs,'_(New Permissions)_',490,430,true);}); } $(function() { $('#s1').dropdownchecklist({emptyText:'_(None)_', width:, firstItemChecksAll:true, explicitClose:'..._(close)_'}); diff --git a/plugins/dynamix/NotificationsArchive.page b/plugins/dynamix/NotificationsArchive.page index 23f71e7c2..aaa749f42 100644 --- a/plugins/dynamix/NotificationsArchive.page +++ b/plugins/dynamix/NotificationsArchive.page @@ -62,7 +62,7 @@ function archiveList(init) { }); } function askConfirmation() { - swal({title:"_(Are you sure)_?",text:"_(This will delete all notification files)_!",type:"warning",showCancelButton:true},function(){$.post('/webGui/include/DeleteLogFile.php',{log:'*.notify'},function(){archiveList();});}); + swal({title:"_(Are you sure)_?",text:"_(This will delete all notification files)_!",type:"warning",showCancelButton:true,confirmButtonText:'_(Proceed)_',cancelButtonText:'_(Cancel)_'},function(){$.post('/webGui/include/DeleteLogFile.php',{log:'*.notify'},function(){archiveList();});}); } function openClose(row) { var extra = '#archive_list .tablesorter-childRow.row'+row+' td'; diff --git a/plugins/dynamix/RoutingTable.page b/plugins/dynamix/RoutingTable.page index 76272da28..62fe16176 100644 --- a/plugins/dynamix/RoutingTable.page +++ b/plugins/dynamix/RoutingTable.page @@ -37,7 +37,7 @@ span.status.vhshift{margin-right:-10px!important}