tazpanel rev 475
network.cgi: add ether-wake support
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Fri May 01 23:56:00 2015 +0200 (2015-05-01) |
parents | 84d34ba7dc06 |
children | 58e332bcef0b |
files | boot.cgi index.cgi network.cgi |
line diff
1.1 --- a/boot.cgi Fri May 01 19:30:01 2015 +0300 1.2 +++ b/boot.cgi Fri May 01 23:56:00 2015 +0200 1.3 @@ -179,13 +179,16 @@ 1.4 httpd) 1.5 _ 'Small and fast web server with CGI support' ;; 1.6 ntpd) 1.7 + cfg="man|help|edit::/etc/ntp.conf|options" 1.8 _ 'Network time protocol daemon' ;; 1.9 ftpd) 1.10 cfg="man|help|edit::/etc/inetd.conf" 1.11 _ 'Anonymous FTP server' ;; 1.12 udhcpd) 1.13 + cfg="man|help|edit|options" 1.14 _ 'Busybox DHCP server' ;; 1.15 syslogd|klogd) 1.16 + cfg="man|help|edit::/etc/syslog.conf|options" 1.17 _ 'Linux Kernel log daemon' ;; 1.18 crond) 1.19 # FIXME crontab 1.20 @@ -194,8 +197,11 @@ 1.21 cfg="man|help|edit|options::-d" 1.22 _ 'Small static DNS server daemon' ;; 1.23 tftpd) 1.24 - cfg="man|help|edit::/etc/inetd.conf" 1.25 + cfg="man|help|edit::/etc/inetd.conf|options" 1.26 _ 'Transfer a file on tftp request' ;; 1.27 + lpd) 1.28 + cfg="man|help|options" 1.29 + _ 'Printer daemon' ;; 1.30 inetd) 1.31 _ 'Listen for network connections and launch programs' ;; 1.32 zcip) 1.33 @@ -236,7 +242,7 @@ 1.34 case "$1" in 1.35 edit) 1.36 cat <<EOT 1.37 -<a href="index.cgi?file=${3:-/etc/$name.conf}&action=edit" title="${2:-$name Configuration}" data-img="conf"></a> 1.38 +<a href="index.cgi?file=${3:-/etc/$name.conf}&action=edit" title="${2:-$name Configuration} in ${3:-/etc/$name.conf}" data-img="conf"></a> 1.39 EOT 1.40 ;; 1.41 options)
2.1 --- a/index.cgi Fri May 01 19:30:01 2015 +0300 2.2 +++ b/index.cgi Fri May 01 23:56:00 2015 +0200 2.3 @@ -65,17 +65,6 @@ 2.4 2.5 2.6 # 2.7 -# Things to do before displaying the page 2.8 -# 2.9 - 2.10 -[ -n "$(GET panel_pass)" ] && 2.11 - sed -i s@/:root:.*@/:root:$(GET panel_pass)@ $HTTPD_CONF 2.12 - 2.13 - 2.14 - 2.15 - 2.16 - 2.17 -# 2.18 # Commands 2.19 # 2.20
3.1 --- a/network.cgi Fri May 01 19:30:01 2015 +0300 3.2 +++ b/network.cgi Fri May 01 23:56:00 2015 +0200 3.3 @@ -129,6 +129,16 @@ 3.4 start_wifi ;; 3.5 *\ start_eth\ *) 3.6 start_eth ;; 3.7 + *\ dowakeup\ *) 3.8 + mac="$(GET macwakup)" 3.9 + unset pass 3.10 + [ "$(GET pass)" ] && pass="-p $(GET pass)" 3.11 + if [ "$mac" ]; then 3.12 + ether-wake $(GET iface) $mac $pass 3.13 + else 3.14 + ether-wake -b $(GET iface) $pass 3.15 + fi 3.16 + ;; 3.17 *\ host\ *) 3.18 get_hostname="$(GET host)" 3.19 echo $(_ 'Changed hostname: %s' $get_hostname) | log 3.20 @@ -249,25 +259,40 @@ 3.21 <tr id="st4"><td>$(_ 'DNS server')</td> 3.22 <td><input type="text" name="dns" value="$DNS_SERVER" $PAR/></td> 3.23 </tr> 3.24 + <tr><td>$(_ 'Wake up')</td> 3.25 + <td><label><input type="checkbox" name="wakeup" id="wakeup" /> 3.26 + $(_ 'Wake up machines by network')</td> 3.27 + </tr> 3.28 + <tr id="wk1"><td>$(_ 'MAC address to wake up')</td> 3.29 + <td><input type="text" name="macwakup" title="$(_ 'Leave empty for a general wakeup')" $PAR/><!-- 3.30 + <button name="ethers" value="/etc/ethers" data-icon="view">$(_ 'View')</button --> 3.31 + </td> 3.32 + </tr> 3.33 </table> 3.34 </div> 3.35 </form> 3.36 <footer><!-- 3.37 --><button form="conf" type="submit" name="start_eth" data-icon="start" $start_disabled>$(_ 'Start' )</button><!-- 3.38 --><button form="conf" type="submit" name="stop" data-icon="stop" $stop_disabled >$(_ 'Stop' )</button><!-- 3.39 + --><button form="conf" type="submit" name="dowakeup" data-icon="clock" $stop_disabled >$(_ 'Wake up')</button><!-- 3.40 --></footer> 3.41 </section> 3.42 3.43 <script type="text/javascript"> 3.44 -function static_change() { 3.45 - staticip = document.getElementById('staticip').checked; 3.46 +function check_change() { 3.47 + enabled = document.getElementById('staticip').checked; 3.48 for (i = 1; i < 5; i++) { 3.49 - document.getElementById('st' + i).style.display = staticip ? '' : 'none'; 3.50 + document.getElementById('st' + i).style.display = enabled ? '' : 'none'; 3.51 + } 3.52 + enabled = document.getElementById('wakeup').checked; 3.53 + for (i = 1; i < 2; i++) { 3.54 + document.getElementById('wk' + i).style.display = enabled ? '' : 'none'; 3.55 } 3.56 } 3.57 3.58 -document.getElementById('staticip').onchange = static_change; 3.59 -static_change(); 3.60 +document.getElementById('staticip').onchange = check_change; 3.61 +document.getElementById('wakeup').onchange = check_change; 3.62 +check_change(); 3.63 </script> 3.64 EOT 3.65 cat <<EOT