tazpanel rev 46

Add hardware.cgi, tiny fix in pkgs.cgi and add a TODO list
author Christophe Lincoln <pankso@slitaz.org>
date Fri Apr 08 05:59:24 2011 +0200 (2011-04-08)
parents 5b7e9a6565c9
children ed88534077a0
files README TODO hardware.cgi index.cgi lib/libtazpanel pkgs.cgi styles/default/header.html styles/default/style.css
line diff
     1.1 --- a/README	Fri Apr 08 03:26:38 2011 +0200
     1.2 +++ b/README	Fri Apr 08 05:59:24 2011 +0200
     1.3 @@ -12,7 +12,8 @@
     1.4  You can clone the tazpanel repo into /var/www/tazpanel and work on this
     1.5  copy or clone it someweher esle and 'make install'. After, add tazpanel to
     1.6  your /etc/hosts, type './tazpanel start' to start the server and go to the
     1.7 -URL: http://tazpanel:8090
     1.8 +URL: http://tazpanel:8090 Panel user and password is defined in httpd.conf
     1.9 +and default is root:root
    1.10  
    1.11  
    1.12  i18n
    1.13 @@ -51,16 +52,20 @@
    1.14  in an other script you can eventually creat a new CGI page and update all
    1.15  links, but please to talk to the AUTHORS before.
    1.16  
    1.17 -	* index.cgi    Main Tazpanel CGI script (some stuff may be splited
    1.18 -	               into users.cgi, boot.cgi, etc if too big or slow)
    1.19 -	* network.cgi  All related stuff to networking (eth, wifi, servives)
    1.20 -	* pkgs.cgi     Tazpkg packages CGI interface
    1.21 -	* settings.cgi System settings such as time, users accounts, locales
    1.22 -	* live.cgi     All tools related to Live systems (CD, USB, Frugal)
    1.23 +	* index.cgi     Main Tazpanel CGI script (some stuff may be splited
    1.24 +	                into users.cgi, boot.cgi, etc if too big or slow)
    1.25 +	* network.cgi   All related stuff to networking (eth, wifi, servives)
    1.26 +	* pkgs.cgi      Tazpkg packages CGI interface
    1.27 +	* system.cgi    System settings and services such as time, users
    1.28 +	                accounts, locales or daemons management
    1.29 +	* live.cgi      All tools related to Live systems (CD, USB, Frugal)
    1.30 +	* hardware.cgi  Devices drivers, firmware, printing
    1.31  
    1.32  For common function have a look to lib/libtazpanel you may founf functions
    1.33  yoou need already coded such as xhtml_header to get the style header.html
    1.34 -in you CGI script. For the loading message you can use loading_msg
    1.35 +in you CGI script. For the loading message you can use loading_msg. When
    1.36 +cat is used: `gettext "Text to translate"`
    1.37 +
    1.38  
    1.39  Web server
    1.40  ----------
    1.41 @@ -73,11 +78,3 @@
    1.42  Or use tazpanel cmdline:
    1.43  
    1.44  # ./tazpanel start
    1.45 -
    1.46 -
    1.47 -Quick notes
    1.48 ------------
    1.49 -
    1.50 -	Panel password is defined in httpd.conf
    1.51 -	When cat is used: `gettext "Text to translate"`
    1.52 -	Devel can run the web server with root in the src tree
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/TODO	Fri Apr 08 05:59:24 2011 +0200
     2.3 @@ -0,0 +1,13 @@
     2.4 +
     2.5 +
     2.6 +	* Add full support for undigest to pkgs.cgi
     2.7 +	* Add support for geniso2usb in live.cgi
     2.8 +	* Entry to change user password in settings.cgi
     2.9 +	* Create a step-by-step Live system builder (ending with an
    2.10 +	  ISO or USB install)
    2.11 +	* Radically improve hardware.cgi using tazhw capabilities, install
    2.12 +	  drivers and firmware, setup printers and manage devices (mount,
    2.13 +	  umount, format, backup with dd or ?)
    2.14 +	* Improve boot.cgi to handle theming GRUB, fbsplash and Slim and
    2.15 +	  improve rcS.conf.
    2.16 +	* Handle start-stop-restart daemons and check status in system.cgi
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/hardware.cgi	Fri Apr 08 05:59:24 2011 +0200
     3.3 @@ -0,0 +1,92 @@
     3.4 +#!/bin/sh
     3.5 +#
     3.6 +# Hardware part of TazPanel - Devices, drivers, printing
     3.7 +#
     3.8 +# Copyright (C) 2011 SliTaz GNU/Linux - GNU gpl v3
     3.9 +#
    3.10 +echo "Content-Type: text/html"
    3.11 +echo ""
    3.12 +
    3.13 +# Common functions from libtazpanel
    3.14 +. lib/libtazpanel
    3.15 +get_config
    3.16 +
    3.17 +# Include gettext helper script.
    3.18 +. /usr/bin/gettext.sh
    3.19 +
    3.20 +# Export package name for gettext.
    3.21 +TEXTDOMAIN='tazpanel'
    3.22 +export TEXTDOMAIN
    3.23 +
    3.24 +TITLE="- Hardware"
    3.25 +
    3.26 +#
    3.27 +# Commands
    3.28 +#
    3.29 +
    3.30 +case "$QUERY_STRING" in
    3.31 +	print*)
    3.32 +		echo "TODO" ;;
    3.33 +	*)
    3.34 +		#
    3.35 +		# Default to summary with mounted filesystem, loaded modules
    3.36 +		#
    3.37 +		xhtml_header
    3.38 +		cat << EOT
    3.39 +<div id="wrapper">
    3.40 +	<h2>`gettext "Drivers &amp; Devices"`</h2>
    3.41 +	<p>`gettext "Manage your computer hardware`</p>
    3.42 +</div>
    3.43 +EOT
    3.44 +		echo '<pre>'
    3.45 +			fdisk -l | fgrep Disk
    3.46 +		echo '</pre>'
    3.47 +		echo '<h3>Filesystem usage statistics</h3>'
    3.48 +		echo '<pre>'
    3.49 +			df -h | grep ^/dev
    3.50 +		echo '</pre>'
    3.51 +		echo '<h3>Loaded kernel modules</h3>'
    3.52 +		# We may want modinfi output
    3.53 +		
    3.54 +		case "$QUERY_STRING" in
    3.55 +			modinfo=*)
    3.56 +				mod=${QUERY_STRING#modinfo=}
    3.57 +				gettext "Detailled information for module:"; echo " $mod"
    3.58 +				echo '<pre>'
    3.59 +				modinfo $mod
    3.60 +				echo '</pre>' ;;
    3.61 +			rmmod=*)
    3.62 +				mod=${QUERY_STRING#rmmod=}
    3.63 +				modprobe -r $mod ;;
    3.64 +		esac
    3.65 +		cat << EOT
    3.66 +	`table_start`
    3.67 +		<tr class="thead">
    3.68 +			<td>`gettext "Module"`</td>
    3.69 +			<td>`gettext "Size"`</td>
    3.70 +			<td>`gettext "Used"`</td>
    3.71 +			<td>`gettext "by"`</td>
    3.72 +		</tr>
    3.73 +EOT
    3.74 +		# Get the list of modules and link to modinfo
    3.75 +		lsmod | grep ^[a-z] | while read MOD SIZE USED BY
    3.76 +		do
    3.77 +			cat << EOT
    3.78 +		<tr>
    3.79 +			<td><a href="$SCRIPT_NAME?modinfo=$MOD">$MOD</a></td>
    3.80 +			<td>$SIZE</td>
    3.81 +			<td>$USED</td>
    3.82 +			<td>`echo $BY | sed s/","/" "/g`</td>
    3.83 +		</tr>
    3.84 +EOT
    3.85 +		done
    3.86 +		table_end
    3.87 +		echo '<h3>lspci</h3>'
    3.88 +		echo '<pre>'
    3.89 +			lspci
    3.90 +		echo '</pre>'
    3.91 +		;;
    3.92 +esac
    3.93 +
    3.94 +xhtml_footer
    3.95 +exit 0
     4.1 --- a/index.cgi	Fri Apr 08 03:26:38 2011 +0200
     4.2 +++ b/index.cgi	Fri Apr 08 05:59:24 2011 +0200
     4.3 @@ -49,67 +49,8 @@
     4.4  <pre>
     4.5  `cat /etc/init.d/local.sh`
     4.6  </pre>
     4.7 -
     4.8  EOT
     4.9  		;;
    4.10 -	hardware|modinfo=*)
    4.11 -		#
    4.12 -		# Hardware drivers, devices, filesystem, screen
    4.13 -		#
    4.14 -		TITLE="- Hardware"
    4.15 -		xhtml_header
    4.16 -		cat << EOT
    4.17 -<div id="wrapper">
    4.18 -	<h2>`gettext "Drivers &amp; Devices"`</h2>
    4.19 -	<p>`gettext "Manage your computer hardware`</p>
    4.20 -</div>
    4.21 -EOT
    4.22 -		echo '<pre>'
    4.23 -			fdisk -l | fgrep Disk
    4.24 -		echo '</pre>'
    4.25 -		echo '<h3>Filesystem usage statistics</h3>'
    4.26 -		echo '<pre>'
    4.27 -			df -h | grep ^/dev
    4.28 -		echo '</pre>'
    4.29 -		echo '<h3>Loaded kernel modules</h3>'
    4.30 -		# We may want modinfi output
    4.31 -		
    4.32 -		case "$QUERY_STRING" in
    4.33 -			modinfo=*)
    4.34 -				mod=${QUERY_STRING#modinfo=}
    4.35 -				gettext "Detailled information for module:"; echo " $mod"
    4.36 -				echo '<pre>'
    4.37 -				modinfo $mod
    4.38 -				echo '</pre>' ;;
    4.39 -			rmmod=*)
    4.40 -				mod=${QUERY_STRING#rmmod=}
    4.41 -				modprobe -r $mod ;;
    4.42 -		esac
    4.43 -		table_start
    4.44 -		cat << EOT
    4.45 -<tr class="thead">
    4.46 -	<td>`gettext "Module"`</td>
    4.47 -	<td>`gettext "Size"`</td>
    4.48 -	<td>`gettext "Used"`</td>
    4.49 -	<td>`gettext "by"`</td>
    4.50 -</tr>
    4.51 -EOT
    4.52 -		# Get the list of modules and link to modinfo
    4.53 -		lsmod | grep ^[a-z] | while read line
    4.54 -		do
    4.55 -			mod=`echo "$line" | awk '{print $1}'`
    4.56 -			echo '<tr>'
    4.57 -			echo "<td><a href='$SCRIPT_NAME?modinfo=$mod'>$mod</a></td>"
    4.58 -			echo "$line" | awk '{print "<td>", $2, "</td>",
    4.59 -				"<td>", $3, "</td>", "<td>", $4, "</td>"}'
    4.60 -			echo '</tr>'
    4.61 -		done
    4.62 -		table_end
    4.63 -		echo '<h3>lspci</h3>'
    4.64 -		echo '<pre>'
    4.65 -			lspci
    4.66 -		echo '</pre>'
    4.67 -		;;
    4.68  	*)
    4.69  		#
    4.70  		# Default xHTML content
     5.1 --- a/lib/libtazpanel	Fri Apr 08 03:26:38 2011 +0200
     5.2 +++ b/lib/libtazpanel	Fri Apr 08 05:59:24 2011 +0200
     5.3 @@ -94,7 +94,6 @@
     5.4  	cat << EOT
     5.5  	</tbody>
     5.6  </table>
     5.7 -<a href="#header">`gettext "Go up"`</a>
     5.8  EOT
     5.9  	
    5.10  }
     6.1 --- a/pkgs.cgi	Fri Apr 08 03:26:38 2011 +0200
     6.2 +++ b/pkgs.cgi	Fri Apr 08 05:59:24 2011 +0200
     6.3 @@ -36,12 +36,12 @@
     6.4  	cut -f 1,2,3,5 -d "|" | while read PACKAGE VERSION SHORT_DESC WEB_SITE
     6.5  	do
     6.6  		echo '<tr>'
     6.7 -		if [ -d $INSTALLED/$PACKAGE ]; then
     6.8 -			echo -e "<td><input type='checkbox' name='pkg' value=\"$PACKAGE\">\n
     6.9 +		if [ -d $INSTALLED/${PACKAGE% } ]; then
    6.10 +			echo -e "<td><input type='checkbox' name='pkg' value='$PACKAGE'>\n
    6.11  				<a href='$SCRIPT_NAME?info=$PACKAGE'>
    6.12  				<img src='$IMAGES/tazpkg-installed.png'/>$PACKAGE</a></td>"
    6.13  		else
    6.14 -			echo -e "<td><input type='checkbox' name='pkg' value=\"$PACKAGE\">\n
    6.15 +			echo -e "<td><input type='checkbox' name='pkg' value='$PACKAGE'>\n
    6.16  				<img src='$IMAGES/tazpkg.png'/>$PACKAGE</td>"
    6.17  		fi
    6.18  		echo "<td>$VERSION</td>"
    6.19 @@ -162,17 +162,17 @@
    6.20  <h2>`gettext "My packages"`</h2>
    6.21  <form method='get' action='$SCRIPT_NAME'>
    6.22  <div id="actions">
    6.23 -<div class="float-left">
    6.24 -	`gettext "Selection:"`
    6.25 -	<input type="submit" name="do" value="Remove" />
    6.26 -</div>
    6.27 -<div class="float-right">
    6.28 -	`gettext "List:"`
    6.29 -	<input type="submit" name="recharge" value="Recharge" />
    6.30 -	<input type="submit" name="upgradeable" value="Upgrade" />
    6.31 +	<div class="float-left">
    6.32 +		`gettext "Selection:"`
    6.33 +		<input type="submit" name="do" value="Remove" />
    6.34 +	</div>
    6.35 +	<div class="float-right">
    6.36 +		`gettext "List:"`
    6.37 +		<input type="submit" name="recharge" value="Recharge" />
    6.38 +		<input type="submit" name="upgradeable" value="Upgrade" />
    6.39 +	</div>
    6.40  </div>
    6.41  EOT
    6.42 -		echo '</div>'
    6.43  		table_start
    6.44  		table_head
    6.45  		for pkg in *
     7.1 --- a/styles/default/header.html	Fri Apr 08 03:26:38 2011 +0200
     7.2 +++ b/styles/default/header.html	Fri Apr 08 05:59:24 2011 +0200
     7.3 @@ -16,7 +16,8 @@
     7.4  
     7.5  <div id="toolbar">
     7.6  	<div id="icons">
     7.7 -		<a href="/doc/"><img src="/styles/default/images/help.png" /></a>
     7.8 +		<a href="/doc/">
     7.9 +			<img src="/styles/default/images/help.png" /></a>
    7.10  	</div>
    7.11  	<div id="menu">
    7.12  		<a href="/">Panel</a>
    7.13 @@ -25,7 +26,7 @@
    7.14  		<a href="/settings.cgi">Settings</a>
    7.15  		<a href="/live.cgi">Live</a>
    7.16  		<a href="/index.cgi?boot">Boot</a>
    7.17 -		<a href="/index.cgi?hardware">Hardware</a>
    7.18 +		<a href="/hardware.cgi">Hardware</a>
    7.19  	</div>
    7.20  </div>
    7.21  
     8.1 --- a/styles/default/style.css	Fri Apr 08 03:26:38 2011 +0200
     8.2 +++ b/styles/default/style.css	Fri Apr 08 05:59:24 2011 +0200
     8.3 @@ -171,6 +171,7 @@
     8.4  
     8.5  table a { color: #000; }
     8.6  table a:hover { color: #666; }
     8.7 +td.small { min-width: 60px; }
     8.8  td.pkg { max-width: 160px; }
     8.9  td.desc { max-width: 300px; }
    8.10