diff --git a/plugins/dynamix/Eth0.page b/plugins/dynamix/Eth0.page index 5a64a8ae7..b9d4f8fe3 100644 --- a/plugins/dynamix/Eth0.page +++ b/plugins/dynamix/Eth0.page @@ -20,28 +20,23 @@ $template = '/usr/local/emhttp/webGui/EthX.page'; $ini = '/var/local/emhttp/network.ini'; $validIP = '(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)'; -function normalize($name) { - return ucfirst(trim($name)); -} - // get available ethernet ports (excluding eth0) exec("ip -br addr|grep -Po '^eth[1-9]+\s'",$ports); -$ports = array_map('normalize', $ports); +$ports = array_map('trim', $ports); // remove non-existing ethernet ports foreach (glob('/usr/local/emhttp/webGui/Eth[1-9]*.page',GLOB_NOSORT) as $port) { - if (!in_array(basename($port,'.page'), $ports)) { + if (!in_array(basename(strtolower($port),'.page'), $ports)) { @unlink($port); $build = true; } } // add new ethernet ports foreach ($ports as $port) { - $file = "/usr/local/emhttp/webGui/$port.page"; + $file = "/usr/local/emhttp/webGui/".ucfirst($port).".page"; if (!file_exists($file)) { copy($template, $file); - $eth = strtolower($port); - exec("sed -i 's/x-settings/NetworkSettings/;s/ethX/$eth/g' $file"); + exec("sed -i 's/x-settings/NetworkSettings/;s/ethX/$port/g' $file"); $build = true; } } @@ -55,7 +50,8 @@ if (isset($eth0)) foreach ($eth0 as $key => $val) if (substr($key,0,6)=='VLANID' ?> @@ -202,8 +198,9 @@ function removeVLAN(element,disabled) { $(element).remove(); $('#index-'+id[1]+'-0').find('select').first().trigger('change'); } -function disableForm(form) { +function disableForm(form,member) { $(form).find('input,select').not('input[value="Done"]').prop('disabled',true); + if (member) $(form).find('input[name^="DESCRIPTION"],input[name^="#"]').prop('disabled',false); } var stopEvent = false; function exitCode(form,key) { @@ -216,10 +213,11 @@ function exitCode(form,key) { stopEvent = true; } } -function checkPort() { +function portcheck_eth0() { $.post('/webGui/include/CheckPort.php',{port:'eth0'},function(text) { - showNotice(text); - setTimeout(checkPort,15000); + var html = $('#user-notice').html(); + if (!html || html.indexOf('eth0')>0) showNotice(text); + setTimeout(portcheck_eth0,10000); }); } $(function() { @@ -249,7 +247,7 @@ $(function() { $('div[id=title]').append(ctrl); - checkPort(); + portcheck_eth0(); });