tazpanel view index.cgi @ rev 49

Update all page with latest functions such as debug, bunch of fixes and adding support for deamons
author Christophe Lincoln <pankso@slitaz.org>
date Sat Apr 09 00:22:23 2011 +0200 (2011-04-09)
parents 56d55a9dcc9c
children 730f8bcacabc
line source
1 #!/bin/sh
2 #
3 # Main CGI interface for TazPanel. In on word: KISS. Use the main cas form
4 # command so we are faster and dont load unneeded function. If nececarry
5 # you can use the lib/ dir to handle external resources.
6 #
7 # Copyright (C) 2011 SliTaz GNU/Linux - GNU gpl v3
8 #
9 echo "Content-Type: text/html"
10 echo ""
12 # Common functions from libtazpanel
13 . lib/libtazpanel
14 get_config
16 # Include gettext helper script.
17 . /usr/bin/gettext.sh
19 # Export package name for gettext.
20 TEXTDOMAIN='tazpanel'
21 export TEXTDOMAIN
23 #
24 # Things to do before displaying the page
25 #
27 case "$QUERY_STRING" in
28 panel-pass=*)
29 new=${QUERY_STRING#*=}
30 sed -i s@/:root:.*@/:root:$new@ $HTTPD_CONF ;;
31 *) continue ;;
32 esac
34 #
35 # Commands
36 #
38 case "$QUERY_STRING" in
39 *)
40 #
41 # Default xHTML content
42 #
43 xhtml_header
44 debug_info
45 case "$QUERY_STRING" in
46 gen-locale=*)
47 new_locale=${QUERY_STRING#gen-locale=} ;;
48 rdate)
49 echo "" ;;
50 esac
51 cat << EOT
52 <div id="wrapper">
53 <h2>`gettext "Host:"` `hostname`</h2>
54 <p>`gettext "SliTaz administration et configuration Panel"`<p>
55 </div>
57 <h3>`gettext "Summary"`</h3>
58 <div id="summary">
59 <p>
60 `gettext "Uptime:"` `uptime`
61 </p>
62 <p>
63 `gettext "Memory in Mb"`
64 `free -m | grep Mem: | awk \
65 '{print "| Total:", $2, "| Used:", $3, "| Free:", $4}'`
66 </p>
67 <!-- Close summary -->
68 </div>
70 <h4>`gettext "Network status"`</h4>
71 `list_network_interfaces`
73 <h4>`gettext "Filesystem usage statistics"`</h4>
74 <pre>
75 `df -h | grep ^/dev`
76 </pre>
78 <h3>`gettext "Panel settings"`</h3>
79 <form method="get" action="$SCRIPT_NAME">
80 <div>
81 <input type="submit" value="`gettext "Change Panel password"`" />
82 <input type="password" name="panel-pass"/>
83 </div>
84 </form>
86 EOT
87 ;;
88 esac
90 xhtml_footer
91 exit 0