# HG changeset patch # User Christophe Lincoln # Date 1301845412 -7200 # Node ID 2ea20065417a43a08bc11da2c34696c2367ecc9a # Parent 64f564036b883fa9f25035dd379d2e083d22c79a Massive improvement to inedx.cgi, up Makefile, smatter tazpanel cmdline diff -r 64f564036b88 -r 2ea20065417a Makefile --- a/Makefile Sun Apr 03 03:21:00 2011 +0200 +++ b/Makefile Sun Apr 03 17:43:32 2011 +0200 @@ -6,11 +6,17 @@ LINGUAS?=fr PANEL?=/var/www/tazpanel +VERSION:=$(shell grep ^VERSION tazpanel | cut -d '=' -f 2) + # i18n pot: xgettext -o po/tazpkg-cgi/tazpkg-cgi.pot -L Shell \ - --package-name="Tazpkg CGI" ./tazpkg.cgi + --package-name="Tazpkg CGI" \ + --package-version="$(VERSION)" ./tazpkg.cgi + xgettext -o po/tazpanel/tazpanel.pot -L Shell \ + --package-name="TazPanel cmdline" \ + --package-version="$(VERSION)" ./tazpanel msgmerge: @for l in $(LINGUAS); do \ diff -r 64f564036b88 -r 2ea20065417a index.cgi --- a/index.cgi Sun Apr 03 03:21:00 2011 +0200 +++ b/index.cgi Sun Apr 03 17:43:32 2011 +0200 @@ -1,34 +1,15 @@ #!/bin/sh # -# Main CGI interface for TazPanel. In on word: KISS +# Main CGI interface for TazPanel. In on word: KISS. Use the main cas form +# command so we are faster and dont load unneeded function. If nececarry +# you can use the lib/ dir to handle external resources. # echo "Content-Type: text/html" echo "" -# We need a config file first -CONFIG="/etc/slitaz/tazpanel.conf" -[ -f $CONFIG ] && . $CONFIG -[ -f tazpanel.conf ] && . tazpanel.conf -[ -z $PANEL ] && echo "No config file found" && exit 1 - -# xHTML 5 header -xhtml_header() { - cat $HEADER | sed s/'- %TITLE%'/"$TITLE"/ -} - -table_start() { - cat << EOT - - -EOT -} - -table_end () { - cat << EOT - -
-EOT -} +# Common functions from libtazpanel +. lib/libtazpanel +get_config # # Commands @@ -36,34 +17,32 @@ case "$QUERY_STRING" in boot) + # # Everything until user login + # TITLE="- Network" xhtml_header cat << EOT
-

`gettext "Boot & startup"`

-

- `gettext "Everything that appends before user login."` -

+

`gettext "Boot & startup"`

+

+ `gettext "Everything that appends before user login."` +

+

`gettext "Kernel cmdline"`

 `cat /proc/cmdline`
 
EOT - echo '' ;; + ;; users|user=*) + # # Manage system user accounts + # TITLE="- Users" xhtml_header - cmdline=`echo ${QUERY_STRING#user*=} | sed s'/&/ /g'` - #user=`echo ${cmdline} | sed s'/=/ /' | awk '{print $1}'` - #cmd=`echo ${cmdline} | sed s'/=/ /' |awk '{print $2}'` - - [ $DEBUG == "1" ] && echo \ - "

$cmdline

" - #$REQUEST_METHOD $QUERY_STRING # Parse cmdline for opt in $cmdline do @@ -92,8 +71,9 @@ esac cat << EOT
-

`gettext "Manage users"`

-
`gettext "Manage human users on your SliTaz system"`
+

`gettext "Manage users"`

+

`gettext "Manage human users on your SliTaz system"`

+
EOT table_start @@ -128,66 +108,101 @@ fi done table_end - #`gettext "Selection:"` cat << EOT -
- -
- +
+ +
-

`gettext "Add a user"`

- -

- `gettext ""` - -

-

- `gettext ""` - -

- + +

+ `gettext ""` + +

+

+ `gettext ""` + +

+
-

`gettext "Connections`

+

`gettext "Networking`

+

`gettext "Manage network connection and services`

+ + +

Output of: ifconfig -a

+
+`ifconfig -a`
+
EOT - echo '
'
-		ifconfig
-		echo '
' - echo '' ;; + ;; hardware) + # + # Hardware drivers, devices, filesystem, screen + # TITLE="- Hardware" xhtml_header cat << EOT
-

`gettext "Drivers & Devices"`

+

`gettext "Drivers & Devices"`

+

`gettext "Manage your computer hardware`

+
EOT echo '
'
-		lspci
+			fdisk -l | fgrep Disk
 		echo '
' - echo '' ;; + echo '
'
+			df -h | grep ^/dev
+		echo '
' + echo '
'
+			lspci
+		echo '
' + ;; *) + # # Default xHTML content + # xhtml_header cat << EOT
-

`gettext "Host:"` `hostname`

+

`gettext "Host:"` `hostname`

+

`gettext "SliTaz administration et configuration Panel"`

+

+ +

`gettext "Summary"`

+
+

- Uptime: `uptime` + `gettext "Uptime:"` `uptime`

+

+ `gettext "Memory in Mb:"` + `free -m | grep Mem: | awk \ + '{print "| Total:", $2, "| Used:", $3, "| Free:", $4}'` +

+

+ `gettext "Filesystem usage statistics:"` +

+
+`df -h | grep ^/dev`
+
+ + +
EOT - echo '' ;; esac -# xHTML 5 footer -cat $FOOTER +xhtml_footer +exit 0 diff -r 64f564036b88 -r 2ea20065417a po/tazpkg-cgi/tazpkg-cgi.pot --- a/po/tazpkg-cgi/tazpkg-cgi.pot Sun Apr 03 03:21:00 2011 +0200 +++ b/po/tazpkg-cgi/tazpkg-cgi.pot Sun Apr 03 17:43:32 2011 +0200 @@ -6,9 +6,9 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: Tazpkg CGI\n" +"Project-Id-Version: Tazpkg CGI 1.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-04-03 03:19+0200\n" +"POT-Creation-Date: 2011-04-03 17:41+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -61,94 +61,94 @@ msgid "Web" msgstr "" -#: tazpkg.cgi:126 -msgid "List:" -msgstr "" - -#: tazpkg.cgi:127 tazpkg.cgi:181 +#: tazpkg.cgi:126 tazpkg.cgi:180 msgid "My packages" msgstr "" -#: tazpkg.cgi:128 tazpkg.cgi:213 tazpkg.cgi:231 +#: tazpkg.cgi:127 tazpkg.cgi:212 tazpkg.cgi:230 msgid "All packages" msgstr "" -#: tazpkg.cgi:129 tazpkg.cgi:246 +#: tazpkg.cgi:128 +msgid "Recharge list" +msgstr "" + +#: tazpkg.cgi:129 +msgid "Upgrade" +msgstr "" + +#: tazpkg.cgi:130 tazpkg.cgi:348 +msgid "Configuration" +msgstr "" + +#: tazpkg.cgi:139 tazpkg.cgi:149 tazpkg.cgi:160 +msgid "Selection:" +msgstr "" + +#: tazpkg.cgi:163 +msgid "Toogle all" +msgstr "" + +#: tazpkg.cgi:245 msgid "Recharge" msgstr "" -#: tazpkg.cgi:130 -msgid "Upgradeable" -msgstr "" - -#: tazpkg.cgi:131 tazpkg.cgi:349 -msgid "Configuration" -msgstr "" - -#: tazpkg.cgi:140 tazpkg.cgi:150 tazpkg.cgi:161 -msgid "Selection:" -msgstr "" - -#: tazpkg.cgi:164 -msgid "Toogle all" -msgstr "" - -#: tazpkg.cgi:249 +#: tazpkg.cgi:248 msgid "Recharge lists will check for new or updated packages" msgstr "" -#: tazpkg.cgi:253 +#: tazpkg.cgi:252 msgid "Recharging the packages list... please wait" msgstr "" -#: tazpkg.cgi:257 +#: tazpkg.cgi:256 msgid "Packages lists are up-to-date" msgstr "" -#: tazpkg.cgi:264 +#: tazpkg.cgi:263 msgid "Upgradeable packages" msgstr "" -#: tazpkg.cgi:292 +#: tazpkg.cgi:291 msgid "Performing task on packages" msgstr "" -#: tazpkg.cgi:309 +#: tazpkg.cgi:308 msgid "Package info" msgstr "" -#: tazpkg.cgi:311 +#: tazpkg.cgi:310 msgid "Detailled information on:" msgstr "" -#: tazpkg.cgi:325 +#: tazpkg.cgi:324 msgid "Installed files" msgstr "" -#: tazpkg.cgi:351 +#: tazpkg.cgi:350 msgid "Tazpkg configuration and settings" msgstr "" -#: tazpkg.cgi:354 +#: tazpkg.cgi:353 msgid "Package in cache" msgstr "" -#: tazpkg.cgi:357 +#: tazpkg.cgi:356 msgid "Packages in the cache:" msgstr "" -#: tazpkg.cgi:363 +#: tazpkg.cgi:362 msgid "Current mirror list" msgstr "" -#: tazpkg.cgi:383 +#: tazpkg.cgi:384 msgid "Summary" msgstr "" -#: tazpkg.cgi:385 +#: tazpkg.cgi:386 msgid "Overview of all installed and mirrored packages" msgstr "" -#: tazpkg.cgi:390 +#: tazpkg.cgi:391 msgid "Latest log entries" msgstr "" diff -r 64f564036b88 -r 2ea20065417a styles/default/header.html --- a/styles/default/header.html Sun Apr 03 03:21:00 2011 +0200 +++ b/styles/default/header.html Sun Apr 03 17:43:32 2011 +0200 @@ -6,18 +6,19 @@ - + + +

TazPanel - %TITLE%

-
- Panel - | Packages - | Boot - | Users - | Network - | Hardware -
-
diff -r 64f564036b88 -r 2ea20065417a styles/default/style.css --- a/styles/default/style.css Sun Apr 03 03:21:00 2011 +0200 +++ b/styles/default/style.css Sun Apr 03 17:43:32 2011 +0200 @@ -2,10 +2,10 @@ CSS style for TazPanel - (C) 2011 SliTaz GNU/Linux */ -html { min-height: 102%; } -body { padding: 20px 80px; font: 13px sans; } +html { min-height: 102%; min-width: 300px; } +body { padding: 0; font: 13px sans; } h1 { color: #d66018; border-bottom: 1px dotted #ddd; } -h2 { color: #444; margin: -20px 0 10px; } +h2 { color: #444; margin: 10px 0 10px; } h3 { color: #666; font-size: 140%; margin: 0; } h4 { color: #888; font-size: 120%; } img { border: 0pt none; vertical-align: middle; padding: 0 6px 0 0;} @@ -53,13 +53,13 @@ .search { position: absolute; - right: 88px; + right: 48px; top: 200px; } #actions { position: absolute; - left: 88px; + left: 48px; top: 200px; } @@ -74,7 +74,7 @@ .debug { position: fixed; - top: 5px; + top: 20px; left: 5px; padding: 6px 20px; background-color: #f8f8f8; @@ -102,6 +102,31 @@ font-weight: bold; } +/* Desktop gui style */ + +#tazbar { + position: fixed; + top: 0; + left: 0; + height: 22px; + width: 100%; + padding: 0 0 0 0; + background-color: #f1efeb; + border-top: 1px solid #fefefe; + border-bottom: 1px solid #d3cdc3; + z-index: 200; +} +#menu { margin: 2px 8px; } +#tazbar a { padding: 2px 4px; +color: #000; border: 1px solid #ECE9E4; +display: inline; } +#tazbar a:hover { background-color: #fdfcfa ; + border: 1px solid #827a6c; + -moz-border-radius: 2px; + -webkit-border-radius: 2px; + border-radius: 2px;} + + /* Round corner */ table, pre, input[type=submit], .debug, .box { diff -r 64f564036b88 -r 2ea20065417a tazpanel --- a/tazpanel Sun Apr 03 03:21:00 2011 +0200 +++ b/tazpanel Sun Apr 03 17:43:32 2011 +0200 @@ -3,22 +3,49 @@ # Tiny Tazpanel cmdline interface # +VERSION=1.0 + +# Get the configuration file and functions CONFIG="/etc/slitaz/tazpanel.conf" +[ -f $CONFIG ] && . $CONFIG +[ -f $PWD/tazpanel.conf ] && . tazpanel.conf +[ ! -f $PANEL/lib/libtazpanel ] && \ + echo "No config file or libtazpanel found: $CONFIG" && exit 1 +. $PANEL/lib/libtazpanel +. /usr/lib/slitaz/libtaz +source_lib commons -[ -f $CONFIG ] && . $CONFIG -[ -f tazpanel.conf ] && . tazpanel.conf -[ -z $PANEL ] && echo "No config file found" && exit 1 +# Include gettext helper script. +. /usr/bin/gettext.sh + +# Export package name for gettext. +TEXTDOMAIN='tazpanel' +export TEXTDOMAIN + +# +# Commands +# case "$1" in start) - httpd -p $HTTPD_PORT -u root -c $HTTPD_CONF ;; + gettext "Starting TazPanel web server on port $HTTPD_PORT..." + httpd -p $HTTPD_PORT -u root -c $HTTPD_CONF \ + -r "`gettext \"TazPanel Authentication\"`" & + status ;; stop) - killall httpd ;; + gettext "Stopping TazPanel web server..." + killall httpd && status ;; passwd|-p) - echo -e "\nChanging password for TazPanel" - echo -n "New password: " && read pass + echo "" + gettext "Changing password for TazPanel" + gettext "New password: " && read pass sed -i s"/\/:root:.*/\/:root:$pass/" $HTTPD_CONF - echo -e "Password changed succeffuly\n" ;; + gettext "Password changed succeffuly"; echo + echo "" ;; *) - echo "Usage: `basename $0` [start|stop|passwd]" ;; + echo "" + gettext "Usage:" && echo "`basename $0` [start|stop|passwd]"; echo + echo "" ;; esac + +exit 0 diff -r 64f564036b88 -r 2ea20065417a tazpanel.conf --- a/tazpanel.conf Sun Apr 03 03:21:00 2011 +0200 +++ b/tazpanel.conf Sun Apr 03 17:43:32 2011 +0200 @@ -10,10 +10,10 @@ HEADER="styles/$STYLE/header.html" FOOTER="styles/$STYLE/footer.html" -DEBUG="1" +# Display some debug message +DEBUG="0" # Busybox HTTP deamon config -# /etc/slitaz/httpd.conf HTTPD_CONF="/etc/slitaz/httpd.conf" HTTPD_PORT="8080" diff -r 64f564036b88 -r 2ea20065417a tazpkg.cgi --- a/tazpkg.cgi Sun Apr 03 03:21:00 2011 +0200 +++ b/tazpkg.cgi Sun Apr 03 17:43:32 2011 +0200 @@ -123,11 +123,10 @@ sub_block() { cat << EOT EOT @@ -376,7 +375,9 @@ EOT ;; *) + # # Default to summary + # search_form sub_block cat << EOT @@ -398,6 +399,5 @@ esac # xHTML 5 footer -cd $PANEL && cat $FOOTER - +cd $PANEL && xhtml_footer exit 0