tazpanel diff network.cgi @ rev 309

libtazpanel: fix httpdhelper path
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri May 11 18:03:45 2012 +0200 (2012-05-11)
parents 72e9955ebdff
children 3e9acc16f728
line diff
     1.1 --- a/network.cgi	Wed Apr 11 20:12:41 2012 +0300
     1.2 +++ b/network.cgi	Fri May 11 18:03:45 2012 +0200
     1.3 @@ -16,16 +16,17 @@
     1.4  # networks by Cell and without spaces.
     1.5  detect_wifi_networks()
     1.6  {
     1.7 -	table_start
     1.8  	cat << EOT
     1.9 -<thead>
    1.10 -	<tr>
    1.11 -		<td>$(gettext "Name")</td>
    1.12 -		<td>$(gettext "Quality")</td>
    1.13 -		<td>$(gettext "Encryption")</td>
    1.14 -		<td>$(gettext "Status")</td>
    1.15 -	</tr>
    1.16 -</thead>
    1.17 +<table class="zebra">
    1.18 +	<thead>
    1.19 +		<tr>
    1.20 +			<td>$(gettext 'Name')</td>
    1.21 +			<td>$(gettext 'Quality')</td>
    1.22 +			<td>$(gettext 'Encryption')</td>
    1.23 +			<td>$(gettext 'Status')</td>
    1.24 +		</tr>
    1.25 +	</thead>
    1.26 +	<tbody>
    1.27  EOT
    1.28  	if [ -d /sys/class/net/$WIFI_INTERFACE/wireless ]; then
    1.29  		ifconfig $WIFI_INTERFACE up
    1.30 @@ -49,7 +50,7 @@
    1.31  			if ifconfig | grep -A 1 $WIFI_INTERFACE | \
    1.32  				fgrep -q inet && iwconfig $WIFI_INTERFACE | \
    1.33  				grep ESSID | fgrep -q -w "$ESSID"; then
    1.34 -				status=$(gettext "Connected")
    1.35 +				status=$(gettext 'Connected')
    1.36  			else
    1.37  				status="---"
    1.38  			fi
    1.39 @@ -60,7 +61,10 @@
    1.40  			echo '</tr>'
    1.41  		done
    1.42  	fi
    1.43 -	table_end
    1.44 +	cat << EOT
    1.45 +	</tbody>
    1.46 +</table>
    1.47 +EOT
    1.48  }
    1.49  
    1.50  # Start a wifi connection
    1.51 @@ -88,8 +92,9 @@
    1.52  		/etc/init.d/network.sh restart | log ;;
    1.53  	*\ start-wifi\ *) start_wifi ;;
    1.54  	*\ hostname\ *)
    1.55 -		echo $(gettext "Changed hostname:") $(GET hostname) | log
    1.56 -		echo "$(GET hostname)" > /etc/hostname ;;
    1.57 +		get_hostname="$(GET hostname)"
    1.58 +		echo $(eval_gettext 'Changed hostname: $get_hostname') | log
    1.59 +		echo "$get_hostname" > /etc/hostname ;;
    1.60  esac
    1.61  
    1.62  # Get values only now since they could have been modified by actions.
    1.63 @@ -104,15 +109,15 @@
    1.64  		# Scan open ports
    1.65  		scan=$(GET scan)
    1.66  		xhtml_header
    1.67 -		LOADING_MSG=$(gettext "Scanning open ports...")
    1.68 +		LOADING_MSG=$(gettext 'Scanning open ports...')
    1.69  		loading_msg
    1.70  		cat << EOT
    1.71 -<h2>$(gettext "Port scanning for") $scan</h2>
    1.72 -<pre>
    1.73 -$(pscan -b $scan)
    1.74 -</pre>
    1.75 +<h2>$(eval_gettext 'Port scanning for $scan')</h2>
    1.76 +
    1.77 +<pre>$(pscan -b $scan)</pre>
    1.78  EOT
    1.79  		;;
    1.80 +
    1.81  	*\ eth\ *)
    1.82  		# Wired connections settings
    1.83  		xhtml_header
    1.84 @@ -121,7 +126,7 @@
    1.85  			STATIC=no
    1.86  			[ -n "$(GET dhcp)" ] && DHCP=yes
    1.87  			[ -n "$(GET static)" ] && STATIC=yes
    1.88 -			LOADING_MSG=$(gettext "Setting up IP...")
    1.89 +			LOADING_MSG=$(gettext 'Setting up IP...')
    1.90  			loading_msg
    1.91  			sed -i \
    1.92  				-e s"/^INTERFACE=.*/INTERFACE=\"$(GET iface)\""/ \
    1.93 @@ -137,74 +142,75 @@
    1.94  			. /etc/network.conf
    1.95  		fi
    1.96  		cat << EOT
    1.97 -<h2>$(gettext "Ethernet connection")</h2>
    1.98 -<p>
    1.99 -$(gettext "Here you can configure a wired connection using DHCP to
   1.100 -automatically get a random IP or configure a static/fixed IP")
   1.101 -</p>
   1.102 -<h3>$(gettext "Configuration")</h3>
   1.103 +<h2>$(gettext 'Ethernet connection')</h2>
   1.104 +
   1.105 +<p>$(gettext "Here you can configure a wired connection using DHCP to \
   1.106 +automatically get a random IP or configure a static/fixed IP")</p>
   1.107 +
   1.108 +<h3>$(gettext 'Configuration')</h3>
   1.109  <form method="get" action="$SCRIPT_NAME">
   1.110  	<input type="hidden" name="eth" />
   1.111 -	$(table_start)
   1.112 +	<table>
   1.113  	<thead>
   1.114  		<tr>
   1.115 -			<td>$(gettext "Name")</td>
   1.116 -			<td>$(gettext "Value")</td>
   1.117 +			<td>$(gettext 'Name')</td>
   1.118 +			<td>$(gettext 'Value')</td>
   1.119  		</tr>
   1.120  	</thead>
   1.121 +	<tbody>
   1.122  	<tr>
   1.123 -		<td>$(gettext "Interface")</td>
   1.124 +		<td>$(gettext 'Interface')</td>
   1.125  		<td><input type="text" name="iface" size="20" value="$INTERFACE" /></td>
   1.126  	</tr>
   1.127  	<tr>
   1.128 -		<td>$(gettext "IP address")</td>
   1.129 +		<td>$(gettext 'IP address')</td>
   1.130  		<td><input type="text" name="ip" size="20" value="$IP" /></td>
   1.131  	</tr>
   1.132  	<tr>
   1.133 -		<td>$(gettext "Netmask")</td>
   1.134 +		<td>$(gettext 'Netmask')</td>
   1.135  		<td><input type="text" name="netmask" size="20" value="$NETMASK" /></td>
   1.136  	</tr>
   1.137  	<tr>
   1.138 -		<td>$(gettext "Gateway")</td>
   1.139 +		<td>$(gettext 'Gateway')</td>
   1.140  		<td><input type="text" name="gateway" size="20" value="$GATEWAY" /></td>
   1.141  	</tr>
   1.142  	<tr>
   1.143 -		<td>$(gettext "DNS server")</td>
   1.144 +		<td>$(gettext 'DNS server')</td>
   1.145  		<td><input type="text" name="dns" size="20" value="$DNS_SERVER" /></td>
   1.146  	</tr>
   1.147 -	$(table_end)
   1.148 -		<input type="submit" name="static" value="`gettext "Activate (static)"`">
   1.149 -		<input type="submit" name="dhcp" value="`gettext "Activate (DHCP)"`">
   1.150 -		<input type="submit" name="disable" value="`gettext "Disable"`">
   1.151 +	</tbody>
   1.152 +	</table>
   1.153 +		<input type="submit" name="static" value="$(gettext 'Activate (static)')">
   1.154 +		<input type="submit" name="dhcp" value="$(gettext 'Activate (DHCP)')">
   1.155 +		<input type="submit" name="disable" value="$(gettext 'Disable')">
   1.156  </form>
   1.157  
   1.158 -<h3>$(gettext "Configuration file")</h3>
   1.159 -<p>
   1.160 -$(gettext "These values are the ethernet settings in the main
   1.161 -/etc/network.conf configuration file")
   1.162 -</p>
   1.163 +<h3>$(gettext 'Configuration file')</h3>
   1.164 +
   1.165 +<p>$(gettext "These values are the ethernet settings in the main \
   1.166 +/etc/network.conf configuration file")</p>
   1.167  <pre>
   1.168  $(grep ^[A-V] /etc/network.conf | syntax_highlighter conf)
   1.169  </pre>
   1.170  <a class="button" href="index.cgi?file=/etc/network.conf&action=edit">
   1.171 -	<img src="$IMAGES/edit.png" />$(gettext "Manual Edit")</a>
   1.172 +	<img src="$IMAGES/edit.png" />$(gettext 'Manual Edit')</a>
   1.173  EOT
   1.174  		;;
   1.175  	*\ wifi\ *)
   1.176  		# Wireless connections settings
   1.177  		xhtml_header
   1.178 -		LOADING_MSG=$(gettext "Scanning wireless interface...")
   1.179 +		LOADING_MSG=$(gettext 'Scanning wireless interface...')
   1.180  		loading_msg
   1.181  		. /etc/network.conf
   1.182  		cat << EOT
   1.183 -<h2>$(gettext "Wireless connection")</h2>
   1.184 +<h2>$(gettext 'Wireless connection')</h2>
   1.185  <div id="actions">
   1.186  	<a class="button" href="$SCRIPT_NAME?wifi&start-wifi=start-wifi">
   1.187 -		<img src="$IMAGES/start.png" />$(gettext "Start")</a>
   1.188 +		<img src="$IMAGES/start.png" />$(gettext 'Start')</a>
   1.189  	<a class="button" href="$SCRIPT_NAME?wifi&stop=stop">
   1.190 -		<img src="$IMAGES/stop.png" />$(gettext "Stop")</a>
   1.191 +		<img src="$IMAGES/stop.png" />$(gettext 'Stop')</a>
   1.192  	<a class="button" href="$SCRIPT_NAME?wifi=scan">
   1.193 -		<img src="$IMAGES/recharge.png" />$(gettext "Scan")</a>
   1.194 +		<img src="$IMAGES/recharge.png" />$(gettext 'Scan')</a>
   1.195  </div>
   1.196  $(detect_wifi_networks)
   1.197  EOT
   1.198 @@ -231,47 +237,45 @@
   1.199  			WIFI_KEY_TYPE="$(GET keytype)"
   1.200  		fi
   1.201  	cat << EOT
   1.202 -<h3>$(gettext "Connection")</h3>
   1.203 +<h3>$(gettext 'Connection')</h3>
   1.204  <form method="get" action="$SCRIPT_NAME">
   1.205  	<input type="hidden" name="connect-wifi" />
   1.206  	$(table_start)
   1.207  	<thead>
   1.208  		<tr>
   1.209 -			<td>$(gettext "Name")</td>
   1.210 -			<td>$(gettext "Value")</td>
   1.211 +			<td>$(gettext 'Name')</td>
   1.212 +			<td>$(gettext 'Value')</td>
   1.213  		</tr>
   1.214  	</thead>
   1.215  	<tr>
   1.216 -		<td>$(gettext "Wifi name (ESSID)")</td>
   1.217 +		<td>$(gettext 'Wifi name (ESSID)')</td>
   1.218  		<td><input type="text" name="essid" size="30" value="$WIFI_ESSID" /></td>
   1.219  	</tr>
   1.220  	<tr>
   1.221 -		<td>$(gettext "Password (Wifi key)")</td>
   1.222 +		<td>$(gettext 'Password (Wifi key)')</td>
   1.223  		<td><input type="password" name="key" size="30" value="$WIFI_KEY" /></td>
   1.224  	</tr>
   1.225  	<tr>
   1.226 -		<td>$(gettext "Encryption type")</td>
   1.227 +		<td>$(gettext 'Encryption type')</td>
   1.228  		<td><input type="text" name="keytype" size="30" value="$WIFI_KEY_TYPE" /></td>
   1.229  	</tr>
   1.230  	$(table_end)
   1.231 -		<input type="submit" name="wifi" value="$(gettext "Configure")" />
   1.232 +		<input type="submit" name="wifi" value="$(gettext 'Configure')" />
   1.233  </form>
   1.234  
   1.235 -<h3>$(gettext "Configuration file")</h3>
   1.236 -<p>
   1.237 -$(gettext "These values are the wifi settings in the main
   1.238 -/etc/network.conf configuration file")
   1.239 -</p>
   1.240 -<pre>
   1.241 -$(grep ^WIFI /etc/network.conf | syntax_highlighter conf)
   1.242 -</pre>
   1.243 +<h3>$(gettext 'Configuration file')</h3>
   1.244 +
   1.245 +<p>$(gettext "These values are the wifi settings in the main /etc/network.conf \
   1.246 +configuration file")</p>
   1.247 +
   1.248 +<pre>$(grep ^WIFI /etc/network.conf | syntax_highlighter conf)</pre>
   1.249 +
   1.250  <a class="button" href="index.cgi?file=/etc/network.conf&action=edit">
   1.251 -	<img src="$IMAGES/edit.png" />$(gettext "Manual Edit")</a>
   1.252 +	<img src="$IMAGES/edit.png" />$(gettext 'Manual Edit')</a>
   1.253  
   1.254 -<h3>$(gettext "Output of") iwconfig</h3>
   1.255 -<pre>
   1.256 -$(iwconfig)
   1.257 -</pre>
   1.258 +<h3>$(gettext 'Output of iwconfig')</h3>
   1.259 +
   1.260 +<pre>$(iwconfig)</pre>
   1.261  EOT
   1.262  		;;
   1.263  	*)
   1.264 @@ -279,21 +283,21 @@
   1.265  		xhtml_header
   1.266  		hostname=$(cat /etc/hostname)
   1.267  		cat << EOT
   1.268 -<h2>`gettext "Networking"`</h2>
   1.269 -<p>
   1.270 -	`gettext "Manage network connections and services"`
   1.271 -</p>
   1.272 +<h2>$(gettext 'Networking')</h2>
   1.273 +
   1.274 +<p>$(gettext 'Manage network connections and services')</p>
   1.275 +
   1.276  <div id="actions">
   1.277  	<div class="float-left">
   1.278  		<a class="button" href="$SCRIPT_NAME?start">
   1.279 -			<img src="$IMAGES/start.png" />$(gettext "Start")</a>
   1.280 +			<img src="$IMAGES/start.png" />$(gettext 'Start')</a>
   1.281  		<a class="button" href="$SCRIPT_NAME?stop">
   1.282 -			<img src="$IMAGES/stop.png" />$(gettext "Stop")</a>
   1.283 +			<img src="$IMAGES/stop.png" />$(gettext 'Stop')</a>
   1.284  		<a class="button" href="$SCRIPT_NAME?restart">
   1.285 -			<img src="$IMAGES/recharge.png" />$(gettext "Restart")</a>
   1.286 +			<img src="$IMAGES/recharge.png" />$(gettext 'Restart')</a>
   1.287  	</div>
   1.288  	<div class="float-right">
   1.289 -		`gettext "Configuration:"`
   1.290 +		$(gettext 'Configuration:')
   1.291  		<a class="button" href="index.cgi?file=/etc/network.conf">network.conf</a>
   1.292  		<a class="button" href="$SCRIPT_NAME?eth">Ethernet</a>
   1.293  		<a class="button" href="$SCRIPT_NAME?wifi">Wireless</a>
   1.294 @@ -302,47 +306,39 @@
   1.295  
   1.296  $(list_network_interfaces)
   1.297  
   1.298 -<a name="hosts"></a>
   1.299 -<h3>$(gettext "Hosts")</h3>
   1.300 -<pre>
   1.301 -$(cat /etc/hosts)
   1.302 -</pre>
   1.303 +<h3 id="hosts">$(gettext 'Hosts')</h3>
   1.304 +
   1.305 +<pre>$(cat /etc/hosts)</pre>
   1.306 +
   1.307  <a class="button" href="index.cgi?file=/etc/hosts&action=edit">
   1.308 -	<img src="$IMAGES/edit.png" />$(gettext "Edit hosts")</a>
   1.309 +	<img src="$IMAGES/edit.png" />$(gettext 'Edit hosts')</a>
   1.310  
   1.311 -<h3>$(gettext "Hostname")</h3>
   1.312 -<form method="get" name="$SCRIPT_NAME"
   1.313 +<h3>$(gettext 'Hostname')</h3>
   1.314 +
   1.315 +<form method="get" name="$SCRIPT_NAME">
   1.316  	<input type="text" name="hostname" value="$hostname" />
   1.317 -	<input type="submit" value="$(gettext "Change hostname")"
   1.318 +	<input type="submit" value="$(gettext 'Change hostname')" />
   1.319  </form>
   1.320  
   1.321  
   1.322 -<a name="ifconfig"></a>
   1.323 -<h3>$(gettext "Output of ") ifconfig</h3>
   1.324 -<pre>
   1.325 -$(ifconfig)
   1.326 -</pre>
   1.327 +<h3 id="ifconfig">$(gettext 'Output of ifconfig')</h3>
   1.328  
   1.329 -<a name="routing"></a>
   1.330 -<h3>`gettext "Routing table"`</h3>
   1.331 -<pre>
   1.332 -$(route -n)
   1.333 -</pre>
   1.334 +<pre>$(ifconfig)</pre>
   1.335  
   1.336 -<a name="dns"></a>
   1.337 -<h3>`gettext "Domain name resolution"`</h3>
   1.338 -<pre>
   1.339 -$(cat /etc/resolv.conf)
   1.340 -</pre>
   1.341 +<h3 id="routing">$(gettext 'Routing table')</h3>
   1.342  
   1.343 -<a name="arp"></a>
   1.344 -<h3>`gettext "ARP table"`</h3>
   1.345 -<pre>
   1.346 -$(arp)
   1.347 -</pre>
   1.348 +<pre>$(route -n)</pre>
   1.349  
   1.350 -<a name="connections"></a>
   1.351 -<h3>`gettext "IP Connections"`</h3>
   1.352 +<h3 id="dns">$(gettext 'Domain name resolution')</h3>
   1.353 +
   1.354 +<pre>$(cat /etc/resolv.conf)</pre>
   1.355 +
   1.356 +<h3 id="arp">$(gettext 'ARP table')</h3>
   1.357 +
   1.358 +<pre>$(arp)</pre>
   1.359 +
   1.360 +<h3 id="connections">$(gettext 'IP Connections')</h3>
   1.361 +
   1.362  <pre>
   1.363  $(netstat -anp 2> /dev/null | sed -e '/UNIX domain sockets/,$d' \
   1.364  -e 's#\([0-9]*\)/#<a href="boot.cgi?daemons=pid=\1">\1</a>/#')