tazpanel diff network.cgi @ rev 406

Small improvements: no need HTML "meta charset" (it's done in HTTP headers); no need "$SCRIPT_NAME" in links; use HTML "&" in links; hide Wi-Fi password in the page; fix month selector in the date settings; use HTML5 plain "header" and "footer"; use "printf"'s loop nature; fix "1" message in page loading break.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Sat Jan 03 17:11:14 2015 +0200 (2015-01-03)
parents b3f5245b1e90
children 299f204b8f1f
line diff
     1.1 --- a/network.cgi	Fri Jan 03 18:58:21 2014 +0100
     1.2 +++ b/network.cgi	Sat Jan 03 17:11:14 2015 +0200
     1.3 @@ -45,7 +45,7 @@
     1.4  				ENCRYPTION="WPA"
     1.5  			fi
     1.6  			if echo $SCAN | grep -q 'Mode:Managed'; then
     1.7 -				AP="&ap=$(echo $SCAN | sed 's/.*Address: \([^ ]*\).*/\1/')"
     1.8 +				AP="ap=$(echo $SCAN | sed 's/.*Address: \([^ ]*\).*/\1/')"
     1.9  			else
    1.10  				AP=""
    1.11  			fi
    1.12 @@ -58,7 +58,7 @@
    1.13  				status="---"
    1.14  			fi
    1.15  			echo '<tr>'
    1.16 -			echo "<td><a href=\"$SCRIPT_NAME?wifi&select=$ESSID&keytype=$ENCRYPTION&$AP\">
    1.17 +			echo "<td><a href=\"?wifi&amp;select=$ESSID&amp;keytype=$ENCRYPTION&amp;$AP\">
    1.18  				<img src='$IMAGES/wireless.png' />$ESSID</a></td>"
    1.19  			echo "<td>$QUALITY</td><td>$ENCRYPTION</td><td>$status $ip</td>"
    1.20  			echo '</tr>'
    1.21 @@ -152,7 +152,7 @@
    1.22  
    1.23  <section>
    1.24  <h3>$(gettext 'Configuration')</h3>
    1.25 -<form method="get" action="$SCRIPT_NAME">
    1.26 +<form method="get" action="">
    1.27  	<input type="hidden" name="eth" />
    1.28  	<table>
    1.29  	<thead>
    1.30 @@ -198,7 +198,7 @@
    1.31  <pre>
    1.32  $(grep ^[A-V] /etc/network.conf | syntax_highlighter conf)
    1.33  </pre>
    1.34 -<a class="button" href="index.cgi?file=/etc/network.conf&action=edit">
    1.35 +<a class="button" href="index.cgi?file=/etc/network.conf&amp;action=edit">
    1.36  	<img src="$IMAGES/edit.png" />$(gettext 'Manual Edit')</a>
    1.37  </section>
    1.38  EOT
    1.39 @@ -212,11 +212,11 @@
    1.40  		cat << EOT
    1.41  <h2>$(gettext 'Wireless connection')</h2>
    1.42  <div id="actions">
    1.43 -	<a class="button" href="$SCRIPT_NAME?wifi&start-wifi=start-wifi">
    1.44 +	<a class="button" href="?wifi&amp;start-wifi=start-wifi">
    1.45  		<img src="$IMAGES/start.png" />$(gettext 'Start')</a>
    1.46 -	<a class="button" href="$SCRIPT_NAME?wifi&stop=stop">
    1.47 +	<a class="button" href="?wifi&amp;stop=stop">
    1.48  		<img src="$IMAGES/stop.png" />$(gettext 'Stop')</a>
    1.49 -	<a class="button" href="$SCRIPT_NAME?wifi=scan">
    1.50 +	<a class="button" href="?wifi=scan">
    1.51  		<img src="$IMAGES/recharge.png" />$(gettext 'Scan')</a>
    1.52  </div>
    1.53  $(detect_wifi_networks)
    1.54 @@ -248,7 +248,7 @@
    1.55  	cat << EOT
    1.56  <section>
    1.57  <h3>$(gettext 'Connection')</h3>
    1.58 -<form method="get" action="$SCRIPT_NAME">
    1.59 +<form method="get" action="">
    1.60  	<input type="hidden" name="connect-wifi" />
    1.61  	$(table_start)
    1.62  	<thead>
    1.63 @@ -284,9 +284,10 @@
    1.64  <p>$(gettext "These values are the wifi settings in the main /etc/network.conf \
    1.65  configuration file")</p>
    1.66  
    1.67 -<pre>$(grep ^WIFI /etc/network.conf | syntax_highlighter conf)</pre>
    1.68 +<pre>$(grep ^WIFI /etc/network.conf | sed '/WIFI_KEY=/s|".*"|"********"|' | \
    1.69 +syntax_highlighter conf)</pre>
    1.70  
    1.71 -<a class="button" href="index.cgi?file=/etc/network.conf&action=edit">
    1.72 +<a class="button" href="index.cgi?file=/etc/network.conf&amp;action=edit">
    1.73  	<img src="$IMAGES/edit.png" />$(gettext 'Manual Edit')</a>
    1.74  </section>
    1.75  
    1.76 @@ -309,18 +310,18 @@
    1.77  <section>
    1.78  <div id="actions">
    1.79  	<div class="float-left">
    1.80 -		<a class="button" href="$SCRIPT_NAME?start">
    1.81 +		<a class="button" href="?start">
    1.82  			<img src="$IMAGES/start.png" />$(gettext 'Start')</a>
    1.83 -		<a class="button" href="$SCRIPT_NAME?stop">
    1.84 +		<a class="button" href="?stop">
    1.85  			<img src="$IMAGES/stop.png" />$(gettext 'Stop')</a>
    1.86 -		<a class="button" href="$SCRIPT_NAME?restart">
    1.87 +		<a class="button" href="?restart">
    1.88  			<img src="$IMAGES/recharge.png" />$(gettext 'Restart')</a>
    1.89  	</div>
    1.90  	<div class="float-right">
    1.91  		$(gettext 'Configuration:')
    1.92  		<a class="button" href="index.cgi?file=/etc/network.conf">network.conf</a>
    1.93 -		<a class="button" href="$SCRIPT_NAME?eth">Ethernet</a>
    1.94 -		<a class="button" href="$SCRIPT_NAME?wifi">Wireless</a>
    1.95 +		<a class="button" href="?eth">Ethernet</a>
    1.96 +		<a class="button" href="?wifi">Wireless</a>
    1.97  	</div>
    1.98  </div>
    1.99  
   1.100 @@ -332,14 +333,14 @@
   1.101  
   1.102  <pre>$(cat /etc/hosts)</pre>
   1.103  
   1.104 -<a class="button" href="index.cgi?file=/etc/hosts&action=edit">
   1.105 +<a class="button" href="index.cgi?file=/etc/hosts&amp;action=edit">
   1.106  	<img src="$IMAGES/edit.png" />$(gettext 'Edit hosts')</a>
   1.107  </section>
   1.108  
   1.109  <section>
   1.110  <h3>$(gettext 'Hostname')</h3>
   1.111  
   1.112 -<form method="get" name="$SCRIPT_NAME">
   1.113 +<form method="get" name="">
   1.114  	<input type="text" name="hostname" value="$hostname" />
   1.115  	<input type="submit" value="$(gettext 'Change hostname')" />
   1.116  </form>