tazpanel diff hardware.cgi @ rev 81

Use httpd_helper parser (GET)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Wed Apr 13 16:41:02 2011 +0200 (2011-04-13)
parents 26455264ec32
children b898c9887a62
line diff
     1.1 --- a/hardware.cgi	Tue Apr 12 02:42:53 2011 +0200
     1.2 +++ b/hardware.cgi	Wed Apr 13 16:41:02 2011 +0200
     1.3 @@ -4,12 +4,11 @@
     1.4  #
     1.5  # Copyright (C) 2011 SliTaz GNU/Linux - GNU gpl v3
     1.6  #
     1.7 -echo "Content-Type: text/html"
     1.8 -echo ""
     1.9  
    1.10  # Common functions from libtazpanel
    1.11  . lib/libtazpanel
    1.12  get_config
    1.13 +header
    1.14  
    1.15  # Include gettext helper script.
    1.16  . /usr/bin/gettext.sh
    1.17 @@ -24,11 +23,10 @@
    1.18  # Commands
    1.19  #
    1.20  
    1.21 -case "$QUERY_STRING" in
    1.22 -	print*)
    1.23 +case " $(GET) " in
    1.24 +	*\ print\ *)
    1.25  		echo "TODO" ;;
    1.26 -	modules*|modinfo=*)
    1.27 -		query_string_parser
    1.28 +	*\ modules\ *|*\ modinfo\ *)
    1.29  		xhtml_header
    1.30  		cat << EOT
    1.31  <div id="wrapper">
    1.32 @@ -43,33 +41,34 @@
    1.33  </div>
    1.34  EOT
    1.35  		# Request may be modinfo output that we want in the page itself
    1.36 -		case "$QUERY_STRING" in
    1.37 -			modinfo=*)
    1.38 -				echo '<strong>'
    1.39 -				gettext "Detailed information for module: "; echo "$WANT"
    1.40 -				echo '</strong>'
    1.41 -				echo '<pre>'
    1.42 -				modinfo $WANT
    1.43 -				echo '</pre>' ;;
    1.44 -			modprobe=*)
    1.45 -				echo '<pre>'
    1.46 -				modprobe -v $WANT
    1.47 -				echo '</pre>' ;;
    1.48 -			rmmod=*)
    1.49 -				#modprobe -r $WANT
    1.50 -				echo "Removing"
    1.51 -				rmmod -w $WANT ;;
    1.52 -			*search=*)
    1.53 -				gettext "Matching result(s) for: "; echo "$VAR_1"
    1.54 -				echo '<pre>'
    1.55 -				modprobe -l | grep "$VAR_1" | while read line
    1.56 -				do
    1.57 -					name=$(basename $line)
    1.58 -					mod=${name%.ko.gz}
    1.59 -					echo "Module    : <a href='$SCRIPT_NAME?modinfo=$mod'>$mod</a> "
    1.60 -				done
    1.61 -				echo '</pre>' ;;
    1.62 -		esac
    1.63 +		if [ -n "$(GET modinfo)" ]; then
    1.64 +			echo '<strong>'
    1.65 +			gettext "Detailed information for module: "; echo "$(GET modinfo)"
    1.66 +			echo '</strong>'
    1.67 +			echo '<pre>'
    1.68 +			modinfo $(GET modinfo)
    1.69 +			echo '</pre>'
    1.70 +		fi
    1.71 +		if [ -n "$(GET modprobe)" ]; then
    1.72 +			echo '<pre>'
    1.73 +			modprobe -v $(GET modprobe)
    1.74 +			echo '</pre>' 
    1.75 +		fi
    1.76 +		if [ -n "$(GET rmmod)" ]; then
    1.77 +			echo "Removing"
    1.78 +			rmmod -w $(GET rmmod)
    1.79 +		fi
    1.80 +		if [ -n "$(GET search)" ]; then
    1.81 +			gettext "Matching result(s) for: "; echo "$(GET search)"
    1.82 +			echo '<pre>'
    1.83 +			modprobe -l | grep "$(GET search)" | while read line
    1.84 +			do
    1.85 +				name=$(basename $line)
    1.86 +				mod=${name%.ko.gz}
    1.87 +				echo "Module    : <a href='$SCRIPT_NAME?modinfo=$mod'>$mod</a> "
    1.88 +			done
    1.89 +			echo '</pre>'
    1.90 +		fi
    1.91  		cat << EOT
    1.92  	`table_start`
    1.93  		<tr class="thead">