tazpanel view network.cgi @ rev 76

Show Panel activity and log a few more things to test (we need date in log() and reverse output on main page)
author Christophe Lincoln <pankso@slitaz.org>
date Tue Apr 12 04:24:35 2011 +0200 (2011-04-12)
parents e4a7503f7efd
children 25602bc63ca7
line source
1 #!/bin/sh
2 #
3 # Network configuration CGI interface
4 #
5 echo "Content-Type: text/html"
6 echo ""
8 # Common functions from libtazpanel
9 . lib/libtazpanel
10 get_config
12 # Include gettext helper script.
13 . /usr/bin/gettext.sh
15 # Export package name for gettext.
16 TEXTDOMAIN='tazpanel'
17 export TEXTDOMAIN
19 TITLE="- Network"
21 # Actions commands before page is displayed
22 case "$QUERY_STRING" in
23 start)
24 # Here we sleep a bit to let udhcp get the lease before reloading
25 # page with status
26 /etc/init.d/network.sh start | log
27 sleep 2 ;;
28 stop)
29 /etc/init.d/network.sh stop | log ;;
30 *)
31 continue ;;
32 esac
34 #
35 # Main Commands for pages
36 #
38 case "$QUERY_STRING" in
39 eth)
40 # Wired connections settings
41 xhtml_header
43 cat << EOT
44 <h2>`gettext "Ethernet connection`</h2>
45 <pre>
46 `grep ^[A-V] /etc/network.conf`
47 </pre>
48 EOT
49 ;;
50 wifi)
51 # Wireless connections settings
52 xhtml_header
54 cat << EOT
55 <h2>`gettext "Wireless connection`</h2>
56 <pre>
57 `grep ^WIFI_ /etc/network.conf`
58 </pre>
59 EOT
60 ;;
61 *)
62 # Main Network page starting with a summary
63 xhtml_header
65 cat << EOT
66 <h2>`gettext "Networking`</h2>
67 <p>
68 `gettext "Manage network connections and services`
69 </p>
70 <div id="actions">
71 <div class="float-left">
72 `gettext "Connection:"`
73 <a class="button" href="$SCRIPT_NAME?start">`gettext "Start"`</a>
74 <a class="button" href="$SCRIPT_NAME?stop">`gettext "Stop"`</a>
75 </div>
76 <div class="float-right">
77 `gettext "Configuration file:"`
78 <a class="button" href="index.cgi?file=/etc/network.conf">network.conf</a>
79 </div>
80 </div>
82 `list_network_interfaces`
84 <h3>`gettext "Output of ifconfig"`</h3>
85 <pre>
86 `ifconfig`
87 </pre>
89 <h3>`gettext "Routing table"`</h3>
90 <pre>
91 `route -n`
92 </pre>
94 <h3>`gettext "Domain name resolution"`</h3>
95 <pre>
96 `cat /etc/resolv.conf`
97 </pre>
99 <h3>`gettext "ARP table"`</h3>
100 <pre>
101 `arp`
102 </pre>
103 EOT
104 ;;
105 esac
107 xhtml_footer
108 exit 0