tazpanel diff index.cgi @ rev 42

Add settings.cgi and split user config from index.cgi, add need CSS stuff and up POT
author Christophe Lincoln <pankso@slitaz.org>
date Thu Apr 07 01:22:07 2011 +0200 (2011-04-07)
parents 1a80f769f6e1
children af4b1f0b3110
line diff
     1.1 --- a/index.cgi	Wed Apr 06 06:17:23 2011 +0200
     1.2 +++ b/index.cgi	Thu Apr 07 01:22:07 2011 +0200
     1.3 @@ -4,6 +4,8 @@
     1.4  # command so we are faster and dont load unneeded function. If nececarry
     1.5  # you can use the lib/ dir to handle external resources.
     1.6  #
     1.7 +# Copyright (C) 2011 SliTaz GNU/Linux - GNU gpl v3
     1.8 +#
     1.9  echo "Content-Type: text/html"
    1.10  echo ""
    1.11  
    1.12 @@ -43,95 +45,6 @@
    1.13  </pre>
    1.14  EOT
    1.15  		;;
    1.16 -	users|user=*)
    1.17 -		#
    1.18 -		# Manage system user accounts
    1.19 -		#
    1.20 -		TITLE="- Users"
    1.21 -		xhtml_header
    1.22 -		cmdline=`echo ${QUERY_STRING#user*=} | sed s'/&/ /g'`		
    1.23 -		# Parse cmdline
    1.24 -		for opt in $cmdline
    1.25 -		do
    1.26 -			case $opt in
    1.27 -				adduser=*)
    1.28 -					user=${opt#adduser=}
    1.29 -					cmd=adduser ;;
    1.30 -				deluser=*)
    1.31 -					user=${opt#deluser=}
    1.32 -					deluser $user ;;
    1.33 -				passwd=*)
    1.34 -					pass=${opt#passwd=} ;;
    1.35 -			esac
    1.36 -		done
    1.37 -		case "$cmd" in
    1.38 -			adduser)
    1.39 -				echo "$user"
    1.40 -				echo $pass
    1.41 -				adduser -D $user
    1.42 -				echo "$pass" | chpasswd
    1.43 -				for g in audio cdrom floppy video
    1.44 -				do
    1.45 -					addgroup $user $g
    1.46 -				done ;;
    1.47 -			*) continue ;;
    1.48 -		esac
    1.49 -		cat << EOT
    1.50 -<div id="wrapper">
    1.51 -	<h2>`gettext "Manage users"`</h2>
    1.52 -	<p>`gettext "Manage human users on your SliTaz system"`</p>
    1.53 -</div>
    1.54 -<form method="get" action="$SCRIPT_NAME">
    1.55 -EOT
    1.56 -		table_start
    1.57 -		cat << EOT
    1.58 -<tr id="thead">
    1.59 -	<td>`gettext "Login"`</td>
    1.60 -	<td>`gettext "User ID"`</td>
    1.61 -	<td>`gettext "Name"`</td>
    1.62 -	<td>`gettext "Home"`</td>
    1.63 -	<td>`gettext "SHell"`</td>
    1.64 -</tr>
    1.65 -EOT
    1.66 -		for i in `cat /etc/passwd | cut -d ":" -f 1`
    1.67 -		do
    1.68 -			if [ -d /home/$i ]; then
    1.69 -				login=$i
    1.70 -				uid=`cat /etc/passwd | grep $i | cut -d ":" -f 3`
    1.71 -				gid=`cat /etc/passwd | grep $i | cut -d ":" -f 4`
    1.72 -				name=`cat /etc/passwd | grep $i | cut -d ":" -f 5 | \
    1.73 -					sed s/,,,//`
    1.74 -				home=`cat /etc/passwd | grep $i | cut -d ":" -f 6`
    1.75 -				shell=`cat /etc/passwd | grep $i | cut -d ":" -f 7`
    1.76 -				echo '<tr>'
    1.77 -				echo "<td><input type='hidden' name='user' />
    1.78 -					<input type='checkbox' name='deluser' value='$login' />
    1.79 -					<img src='$IMAGES/user.png' />$login</td>"
    1.80 -				echo "<td>$uid:$gid</td>"
    1.81 -				echo "<td>$name</td>"
    1.82 -				echo "<td>$home</td>"
    1.83 -				echo "<td>$shell</td>"
    1.84 -				echo '</tr>'
    1.85 -			fi
    1.86 -		done
    1.87 -		table_end
    1.88 -		cat << EOT
    1.89 -	<div>
    1.90 -		<input type="submit" value="`gettext "Delete selected user"`" />
    1.91 -	</div>
    1.92 -</form>
    1.93 -
    1.94 -<h3>`gettext "Add a new user"`</h3>
    1.95 -<form method="get" action="$SCRIPT_NAME">
    1.96 -	<input type="hidden" name="user" />
    1.97 -	<p>`gettext "User login:"`</p>
    1.98 -	<p><input type="text" name="adduser" size="30" /></p>
    1.99 -	<p>`gettext "User password:"`</p>
   1.100 -	<p><input type="password" name="passwd" size="30" /></p>
   1.101 -	<input type="submit" value="`gettext "Create user"`" />
   1.102 -</form>
   1.103 -EOT
   1.104 -		;;
   1.105  	hardware)
   1.106  		#
   1.107  		# Hardware drivers, devices, filesystem, screen
   1.108 @@ -159,6 +72,12 @@
   1.109  		# Default xHTML content
   1.110  		#
   1.111  		xhtml_header
   1.112 +		case "$QUERY_STRING" in
   1.113 +			gen-locale=*)
   1.114 +				new_locale=${QUERY_STRING#gen-locale=} ;;
   1.115 +			rdate)
   1.116 +				echo "" ;;
   1.117 +		esac
   1.118  		cat << EOT
   1.119  <div id="wrapper">
   1.120  	<h2>`gettext "Host:"` `hostname`</h2>