tazpanel rev 477

network.cgi: add ether-wake support (again)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat May 02 10:36:04 2015 +0200 (2015-05-02)
parents 58e332bcef0b
children 23d2f8135d2b
files network.cgi
line diff
     1.1 --- a/network.cgi	Sat May 02 05:20:54 2015 +0300
     1.2 +++ b/network.cgi	Sat May 02 10:36:04 2015 +0200
     1.3 @@ -132,7 +132,7 @@
     1.4  	*\ dowakeup\ *)
     1.5  		mac="$(GET macwakup)"
     1.6  		unset pass
     1.7 -		[ "$(GET pass)" ] && pass="-p $(GET pass)"
     1.8 +		[ "$(GET macpass)" ] && pass="-p $(GET macpass)"
     1.9  		if [ "$mac" ]; then
    1.10  			ether-wake $(GET iface) $mac $pass
    1.11  		else
    1.12 @@ -222,6 +222,7 @@
    1.13  			stop_disabled='disabled'
    1.14  		fi
    1.15  
    1.16 +		[ -s /etc/ethers ] || echo "#01:02:03:04:05:06 mystation" > /etc/ethers
    1.17  		cat <<EOT
    1.18  <h2>$(_ 'Ethernet connection')</h2>
    1.19  EOT
    1.20 @@ -231,6 +232,7 @@
    1.21  
    1.22  <section>
    1.23  	<header>$(_ 'Configuration')</header>
    1.24 +	<form action="index.cgi" id="indexform"></form>
    1.25  	<form id="conf">
    1.26  		<input type="hidden" name="eth"/>
    1.27  		<div>
    1.28 @@ -265,7 +267,12 @@
    1.29  				</tr>
    1.30  				<tr id="wk1"><td>$(_ 'MAC address to wake up')</td>
    1.31  					<td><input type="text" name="macwakup" title="$(_ 'Leave empty for a general wakeup')" $PAR/><!--
    1.32 -					<button name="ethers" value="/etc/ethers" data-icon="view">$(_ 'View')</button -->
    1.33 +					--><button form="indexform" name="file" value="/etc/ethers" data-icon="view">$(_ 'List')</button>
    1.34 +					</td>
    1.35 +				</tr>
    1.36 +				<tr id="wk2"><td>$(_ 'MAC/IP address password')</td>
    1.37 +					<td><input type="text" name="macpass" title="$(_ 'Leave empty for a general wakeup')" $PAR/><!--
    1.38 +					--><button form="indexform" name="exec" value="ether-wake --help" data-icon="help">$(_ 'Help')</button>
    1.39  					</td>
    1.40  				</tr>
    1.41  			</table>
    1.42 @@ -285,7 +292,7 @@
    1.43  		document.getElementById('st' + i).style.display = enabled ? '' : 'none';
    1.44  	}
    1.45  	enabled = document.getElementById('wakeup').checked;
    1.46 -	for (i = 1; i < 2; i++) {
    1.47 +	for (i = 1; i < 3; i++) {
    1.48  		document.getElementById('wk' + i).style.display = enabled ? '' : 'none';
    1.49  	}
    1.50  }