tazpanel view network.cgi @ rev 100

index.cgi: use $SCRIPT_NAME
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Apr 14 21:27:07 2011 +0200 (2011-04-14)
parents 25602bc63ca7
children 21a86f36336d
line source
1 #!/bin/sh
2 #
3 # Network configuration CGI interface
4 #
6 # Common functions from libtazpanel
7 . lib/libtazpanel
8 get_config
9 header
11 # Include gettext helper script.
12 . /usr/bin/gettext.sh
14 # Export package name for gettext.
15 TEXTDOMAIN='tazpanel'
16 export TEXTDOMAIN
18 TITLE="- Network"
20 # Actions commands before page is displayed
21 case " $(GET) " in
22 *\ start\ *)
23 # Here we sleep a bit to let udhcp get the lease before reloading
24 # page with status
25 /etc/init.d/network.sh start | log
26 sleep 2 ;;
27 *\ stop\ *)
28 /etc/init.d/network.sh stop | log ;;
29 *)
30 continue ;;
31 esac
33 #
34 # Main Commands for pages
35 #
37 case " $(GET) " in
38 *\ eth\ *)
39 # Wired connections settings
40 xhtml_header
42 cat << EOT
43 <h2>`gettext "Ethernet connection`</h2>
44 <pre>
45 `grep ^[A-V] /etc/network.conf`
46 </pre>
47 EOT
48 ;;
49 *\ wifi\ *)
50 # Wireless connections settings
51 xhtml_header
52 cat << EOT
53 <h2>`gettext "Wireless connection`</h2>
55 <h3>$(gettext "Configuration file")</h3>
56 <p>
57 $(gettext "These values are the wifi settings in the main
58 /etc/network.conf configuration file")
59 </p>
60 <pre>
61 $(grep ^WIFI_ /etc/network.conf | syntax_highlighter conf)
62 </pre>
63 <a class="button" href="index.cgi?file=/etc/network.conf&action=edit">
64 <img src="$IMAGES/edit.png" />$(gettext "Manual Edit")</a>
65 EOT
66 ;;
67 *)
68 # Main Network page starting with a summary
69 xhtml_header
71 cat << EOT
72 <h2>`gettext "Networking`</h2>
73 <p>
74 `gettext "Manage network connections and services`
75 </p>
76 <div id="actions">
77 <div class="float-left">
78 `gettext "Connection:"`
79 <a class="button" href="$SCRIPT_NAME?start">`gettext "Start"`</a>
80 <a class="button" href="$SCRIPT_NAME?stop">`gettext "Stop"`</a>
81 </div>
82 <div class="float-right">
83 `gettext "Configuration file:"`
84 <a class="button" href="index.cgi?file=/etc/network.conf">network.conf</a>
85 </div>
86 </div>
88 `list_network_interfaces`
90 <h3>`gettext "Output of ifconfig"`</h3>
91 <pre>
92 `ifconfig`
93 </pre>
95 <h3>`gettext "Routing table"`</h3>
96 <pre>
97 `route -n`
98 </pre>
100 <h3>`gettext "Domain name resolution"`</h3>
101 <pre>
102 `cat /etc/resolv.conf`
103 </pre>
105 <h3>`gettext "ARP table"`</h3>
106 <pre>
107 `arp`
108 </pre>
109 EOT
110 ;;
111 esac
113 xhtml_footer
114 exit 0