tazpanel rev 238
network.cgi: Add Wifi connection form
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Tue Feb 28 12:00:50 2012 +0100 (2012-02-28) |
parents | 3398302669f4 |
children | 7f40832df583 |
files | network.cgi |
line diff
1.1 --- a/network.cgi Tue Feb 28 11:59:51 2012 +0100 1.2 +++ b/network.cgi Tue Feb 28 12:00:50 2012 +0100 1.3 @@ -54,7 +54,7 @@ 1.4 status="---" 1.5 fi 1.6 echo '<tr>' 1.7 - echo "<td><img src='$IMAGES/wireless.png' />$ESSID</td>" 1.8 + echo "<td><a href=\"$SCRIPT_NAME?wifi\"><img src='$IMAGES/wireless.png' />$ESSID</a></td>" 1.9 echo "<td>$QUALITY</td><td>$ENCRYPTION</td><td>$status $ip</td>" 1.10 echo '</tr>' 1.11 done 1.12 @@ -183,11 +183,30 @@ 1.13 ;; 1.14 *\ wifi\ *) 1.15 # Wireless connections settings 1.16 + #ifconfig $WIFI_INTERFACE up 1.17 xhtml_header 1.18 LOADING_MSG=$(gettext "Scanning wireless interface...") 1.19 loading_msg 1.20 + if [ "$(GET essid)" ]; then 1.21 + WIFI_KEY="" 1.22 + WIFI_KEY_TYPE=none 1.23 + [ -n "$(GET key)" ] && WIFI_KEY="$(GET key)" 1.24 + [ -n "$(GET keytype)" ] && WIFI_KEY_TYPE="$(GET keytype)" 1.25 + sed -i \ 1.26 + -e s'/^DHCP=.*/DHCP="yes"/' \ 1.27 + -e s'/^STATIC=.*/STATIC="no"/' \ 1.28 + -e s'/^WIFI=.*/WIFI="yes"/' \ 1.29 + -e s"/^WIFI_ESSID=.*/WIFI_ESSID=\"$(GET essid)\""/ \ 1.30 + -e s"/^WIFI_KEY=.*/WIFI_KEY=\"$WIFI_KEY\"/" \ 1.31 + -e s"/^WIFI_KEY_TYPE=.*/WIFI_KEY_TYPE=\"$WIFI_KEY_TYPE\"/" \ 1.32 + /etc/network.conf 1.33 + /etc/init.d/network stop | log 1.34 + sleep 2 1.35 + /etc/init.d/network start | log 1.36 + fi 1.37 + . /etc/network.conf 1.38 cat << EOT 1.39 -<h2>`gettext "Wireless connection"`</h2> 1.40 +<h2>$(gettext "Wireless connection")</h2> 1.41 <div id="actions"> 1.42 <a class="button" href="$SCRIPT_NAME?wifi&start-wifi=start-wifi"> 1.43 <img src="$IMAGES/start.png" />$(gettext "Start")</a> 1.44 @@ -199,6 +218,32 @@ 1.45 $(detect_wifi_networks) 1.46 EOT 1.47 cat << EOT 1.48 +<h3>$(gettext "Connection")</h3> 1.49 +<form method="get" action="$SCRIPT_NAME"> 1.50 + <input type="hidden" name="wifi" /> 1.51 + $(table_start) 1.52 + <thead> 1.53 + <tr> 1.54 + <td>$(gettext "Name")</td> 1.55 + <td>$(gettext "Value")</td> 1.56 + </tr> 1.57 + </thead> 1.58 + <tr> 1.59 + <td>$(gettext "Wifi name (ESSID)")</td> 1.60 + <td><input type="text" name="essid" size="30" value="$WIFI_ESSID" /></td> 1.61 + </tr> 1.62 + <tr> 1.63 + <td>$(gettext "Password (Wifi key)")</td> 1.64 + <td><input type="text" name="key" size="30" value="$WIFI_KEY" /></td> 1.65 + </tr> 1.66 + <tr> 1.67 + <td>$(gettext "Encryption type")</td> 1.68 + <td><input type="text" name="keytype" size="30" value="$WIFI_KEY_TYPE" /></td> 1.69 + </tr> 1.70 + $(table_end) 1.71 + <input type="submit" name="wifi" value="$(gettext "Connect")" /> 1.72 +</form> 1.73 + 1.74 <h3>$(gettext "Configuration file")</h3> 1.75 <p> 1.76 $(gettext "These values are the wifi settings in the main