tazpanel diff network.cgi @ rev 438

tazpanel: extended usage help; add restart command.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Tue Apr 07 03:50:06 2015 +0300 (2015-04-07)
parents a279382f786f
children 9aeb8fa5beaa
line diff
     1.1 --- a/network.cgi	Wed Mar 25 00:38:04 2015 +0200
     1.2 +++ b/network.cgi	Tue Apr 07 03:50:06 2015 +0300
     1.3 @@ -195,7 +195,8 @@
     1.4  
     1.5  		cat <<EOT
     1.6  <h2>$(gettext 'Ethernet connection')</h2>
     1.7 -
     1.8 +EOT
     1.9 +		[ -w /etc/network.conf ] && cat <<EOT
    1.10  <p>$(gettext "Here you can configure a wired connection using DHCP to \
    1.11  automatically get a random IP or configure a static/fixed IP")</p>
    1.12  
    1.13 @@ -249,14 +250,19 @@
    1.14  document.getElementById('staticip').onchange = static_change;
    1.15  static_change();
    1.16  </script>
    1.17 -
    1.18 +EOT
    1.19 +		cat <<EOT
    1.20  <section>
    1.21  	<header>
    1.22  		$(gettext 'Configuration file')
    1.23 +EOT
    1.24 +		[ -w /etc/network.conf ] && cat <<EOT
    1.25  		<form action="index.cgi">
    1.26  			<input type="hidden" name="file" value="/etc/network.conf"/>
    1.27  			<button name="action" value="edit" data-icon="edit">$(gettext 'Edit')</button>
    1.28  		</form>
    1.29 +EOT
    1.30 +		cat <<EOT
    1.31  	</header>
    1.32  	<div>$(gettext "These values are the ethernet settings in the main /etc/network.conf configuration file")</div>
    1.33  	<pre>$(awk '{if($1 !~ "WIFI" && $1 !~ "#" && $1 != ""){print $0}}' /etc/network.conf | syntax_highlighter conf)</pre>
    1.34 @@ -375,9 +381,6 @@
    1.35  		. /etc/network.conf
    1.36  		cat <<EOT
    1.37  <h2>$(gettext 'Wireless connection')</h2>
    1.38 -
    1.39 -<form>
    1.40 -	<input type="hidden" name="wifi"/>
    1.41  EOT
    1.42  
    1.43  		start_disabled=''; stop_disabled=''
    1.44 @@ -387,13 +390,16 @@
    1.45  			start_disabled='disabled'
    1.46  		fi
    1.47  
    1.48 -		cat <<EOT
    1.49 +		[ -w /etc/network.conf ] && cat <<EOT
    1.50 +<form>
    1.51 +	<input type="hidden" name="wifi"/>
    1.52  	   <button name="start_wifi" data-icon="start"   $start_disabled>$(gettext 'Start')</button><!--
    1.53  	--><button name="stop"       data-icon="stop"    $stop_disabled >$(gettext 'Stop' )</button><!--
    1.54  	--><button type="submit"     data-icon="refresh" $stop_disabled >$(gettext 'Scan' )</button>
    1.55  </form>
    1.56  EOT
    1.57  
    1.58 +		[ -w /etc/network.conf ] &&
    1.59  		if [ -n "$start_disabled" ]; then
    1.60  			cat <<EOT
    1.61  <section id="wifiList">
    1.62 @@ -540,10 +546,14 @@
    1.63  <section>
    1.64  	<header>
    1.65  		$(gettext 'Configuration file')
    1.66 +EOT
    1.67 +		[ -w /etc/network.conf ] && cat <<EOT
    1.68  		<form action="index.cgi">
    1.69  			<input type="hidden" name="file" value="/etc/network.conf"/>
    1.70  			<button name="action" value="edit" data-icon="edit">$(gettext 'Edit')</button>
    1.71  		</form>
    1.72 +EOT
    1.73 +		cat <<EOT
    1.74  	</header>
    1.75  	<div>$(gettext "These values are the wifi settings in the main /etc/network.conf configuration file")</div>
    1.76  	<pre>$(grep ^WIFI /etc/network.conf | sed '/WIFI_KEY=/s|".*"|"********"|' | syntax_highlighter conf)</pre>
    1.77 @@ -575,12 +585,15 @@
    1.78  <p>$(gettext 'Manage network connections and services')</p>
    1.79  
    1.80  <form action="index.cgi" id="indexform"></form>
    1.81 -
    1.82 +EOT
    1.83 +		[ -w /etc/network.conf ] && cat <<EOT
    1.84  <form id="mainform"><!--
    1.85  	--><button name="start"   data-icon="start"   $start_disabled>$(gettext 'Start'  )</button><!--
    1.86  	--><button name="stop"    data-icon="stop"    $stop_disabled >$(gettext 'Stop'   )</button><!--
    1.87  	--><button name="restart" data-icon="restart" $stop_disabled >$(gettext 'Restart')</button>
    1.88  </form>
    1.89 +EOT
    1.90 +		cat <<EOT
    1.91  <div class="float-right"><!--
    1.92  	-->$(gettext 'Configuration:')<!--
    1.93  	--><button form="indexform" name="file" value="/etc/network.conf" data-icon="conf">network.conf</button><!--
    1.94 @@ -598,23 +611,35 @@
    1.95  <section>
    1.96  	<header id="hosts">$(gettext 'Hosts')</header>
    1.97  	<pre>$(cat /etc/hosts)</pre>
    1.98 +EOT
    1.99 +		[ -w /etc/hosts ] && cat <<EOT
   1.100  	<footer>
   1.101  		<form action="index.cgi">
   1.102  			<input type="hidden" name="file" value="/etc/hosts"/>
   1.103  			<button name="action" value="edit" data-icon="edit">$(gettext 'Edit')</button>
   1.104  		</form>
   1.105  	</footer>
   1.106 +EOT
   1.107 +		cat <<EOT
   1.108  </section>
   1.109  
   1.110  
   1.111  <section>
   1.112  	<header>$(gettext 'Hostname')</header>
   1.113  	<footer>
   1.114 +EOT
   1.115 +		if [ -w /etc/hostname ]; then
   1.116 +			cat <<EOT
   1.117  		<form>
   1.118  			<!-- was: name="hostname"; please don't use 'name' in name: unwanted webkit styling -->
   1.119  			<input type="text" name="host" value="$(cat /etc/hostname)"/><!--
   1.120  			--><button type="submit" data-icon="ok">$(gettext 'Change')</button>
   1.121  		</form>
   1.122 +EOT
   1.123 +		else
   1.124 +			cat /etc/hostname
   1.125 +		fi
   1.126 +		cat <<EOT
   1.127  	</footer>
   1.128  </section>
   1.129