Merge branch 'master' of github.com:limetech/dynamix-6.2

This commit is contained in:
Tom Mortensen
2016-06-07 15:45:21 -07:00
3 changed files with 38 additions and 8 deletions

View File

@@ -50,8 +50,9 @@ if (isset($eth0)) foreach ($eth0 as $key => $val) if (substr($key,0,6)=='VLANID'
?>
<style>
span.pin i{font-size:16px;cursor:pointer;}
span.unset{color:#E68A00;}
span.member{color:#00529B;}
span.red{color:#E68A00;}
span.blue{color:#00529B;}
span.green{color:#4F8A10;}
div.shade-white{background-color:#F8F8F8;}
div.shade-black{background-color:#0C0C0C;}
</style>
@@ -220,6 +221,9 @@ function portcheck_eth0() {
setTimeout(portcheck_eth0,10000);
});
}
function portToggle(port,cmd) {
$.post('/webGui/include/PortToggle.php',{port:port,cmd:cmd},function(){refresh();});
}
$(function() {
var ctrl = "<span id='wait_eth0' class='status red' style='display:none;font-size:small;font-style:italic'>Please wait... configuring interfaces</span>";
var form = document.eth0_settings;

View File

@@ -27,18 +27,24 @@ $locked = $bond_ethX || $bridge_ethX ;
$vlan_ethX = [0];
if (!$locked && isset($ethX)) foreach ($ethX as $key => $val) if (substr($key,0,6)=='VLANID') $vlan_ethX[] = substr($key,7);
if ($bond_ethX) {
$cmd = 'Down';
if (strlen(exec("ip link show ethX|grep -om1 ',UP[,>]'"))==0) {
$more = true;
$reason = "Interface is shutdown (inactive)";
$class = 'blue';
$cmd = 'Up';
} elseif ($bond_ethX) {
$more = true;
$reason = "Interface is member of ".$eth0['BONDNAME']." (see interface eth0)";
$class = 'member';
$class = 'green';
} elseif ($bridge_ethX) {
$more = true;
$reason = "Interface is member of ".$eth0['BRNAME']." (see interface eth0)";
$class = 'member';
} elseif (empty($ethX) || strlen(exec("ip link show ethX|grep -om1 ',UP[,>]'"))==0) {
$class = 'green';
} elseif (empty($ethX)) {
$more = true;
$reason = "Interface is not configured";
$class = 'unset';
$class = 'red';
} else {
$more = false;
}
@@ -67,6 +73,9 @@ $(function() {
<?endif;?>
<?if ($locked):?>
disableForm(form,true);
<?endif;?>
<?if (strlen(exec("ip link show eth0|grep -om1 ',UP[,>]'"))==0):?>
$('input[name="#shut"]').prop('disabled',true);
<?endif;?>
setTimeout(portcheck_ethX,Number('ethX'.substr(3))*1000);
});
@@ -254,5 +263,5 @@ Network mask:
</script>
&nbsp;
: <input type="submit" value="Apply" onclick="$(waitid).show()"><input type="button" value="Done" onclick="done()"><?if ($service) echo "$service must be <b>STOPPED</b> to change"?>
: <input type="submit" value="Apply" onclick="$(waitid).show()"><input type="button" value="Done" onclick="done()"><input type="button" name="#shut" value="Port <?=$cmd?>" onclick="portToggle('ethX','<?=$cmd?>')"><?if ($service) echo "$service must be <b>STOPPED</b> to change"?>
</form>

View File

@@ -0,0 +1,17 @@
<?PHP
/* Copyright 2016, Bergware International.
* Copyright 2016, Lime Technology
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License version 2,
* as published by the Free Software Foundation.
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*/
?>
<?
$port = $_POST['port'];
$cmd = strtolower($_POST['cmd']);
if ($port) exec("ip link set $port $cmd");
?>