# HG changeset patch # User Christophe Lincoln # Date 1302855340 -7200 # Node ID dbdfa16dfdf2aa1180f10869864d398a631ca21a # Parent b898c9887a62f8f4ee3ea73499c2f6f21d08fd72 Move to settings.cgi and improve Panel configuration diff -r b898c9887a62 -r dbdfa16dfdf2 index.cgi --- a/index.cgi Fri Apr 15 09:14:23 2011 +0200 +++ b/index.cgi Fri Apr 15 10:15:40 2011 +0200 @@ -143,19 +143,6 @@ $(cat $LOG_FILE | tail -n 6) -

`gettext "Panel settings"`

-
-
- `gettext "Panel password:"` - - -
-
-

- $(gettext "TazPanel provides a debuging mode and page:") - debug -

- EOT ;; esac diff -r b898c9887a62 -r dbdfa16dfdf2 lib/libtazpanel --- a/lib/libtazpanel Fri Apr 15 09:14:23 2011 +0200 +++ b/lib/libtazpanel Fri Apr 15 10:15:40 2011 +0200 @@ -14,9 +14,9 @@ # We need a config file first get_config() { CONFIG="/etc/slitaz/tazpanel.conf" - [ -f $CONFIG ] && . $CONFIG - [ -f tazpanel.conf ] && . tazpanel.conf - [ ! -f $PANEL/lib/libtazpanel ] && \ + [ -f tazpanel.conf ] && CONFIG="tazpanel.conf" + [ -f "$CONFIG" ] && . $CONFIG + [ ! -f "$PANEL/lib/libtazpanel" ] && \ echo "No config file or libtazpanel found: $CONFIG" && \ exit 1 } diff -r b898c9887a62 -r dbdfa16dfdf2 settings.cgi --- a/settings.cgi Fri Apr 15 09:14:23 2011 +0200 +++ b/settings.cgi Fri Apr 15 10:15:40 2011 +0200 @@ -23,6 +23,15 @@ done } +# Get the list of panle styles +list_styles() { + cd $PANEL/styles + for style in * + do + echo "" + done +} + # # Commands executed before page loading. # @@ -32,9 +41,9 @@ # # Manage system user accounts # - for i in $(seq 1 $(GET deluser count)); do - deluser $(GET deluser $i) - done + if [ "$(GET deluser)" ]; then + deluser $(GET deluser) + fi user=$(GET adduser) if [ -n "$user" ]; then adduser -D $user @@ -50,8 +59,11 @@ rdate -s tick.greyware.com ;; *\ hwclock\ *) hwclock -w ;; - *) - continue ;; + *\ panel_pass*) + sed -i s@/:root:.*@/:root:$(GET panel_pass)@ $HTTPD_CONF ;; + *\ style*) + sed -i s/'^STYLE.*'/"STYLE=\"$(GET style)\""/ $CONFIG + . $CONFIG ;; esac # @@ -59,61 +71,48 @@ # xhtml_header -cat << EOT -
-

`gettext "System settings"`

-

`gettext "Manage system time, users or language settings"`

-

- -
-`gettext "Time zome      :"` `cat /etc/TZ`
-`gettext "System time    :"` `date`
-`gettext "Hardware clock :"` `hwclock -r`
-
-`gettext "Sync online"` -`gettext "Set hardware clock"` +case " $(GET) " in + *\ user*) + # + # Users management + # + cat <`gettext "Manage users"` +
+$(table_start) + + + `gettext "Login"` + `gettext "User ID"` + `gettext "Name"` + `gettext "Home"` + `gettext "SHell"` + + EOT -# -# Users management -# - -cat <`gettext "Users"` - -EOT -table_start -cat << EOT - - `gettext "Login"` - `gettext "User ID"` - `gettext "Name"` - `gettext "Home"` - `gettext "SHell"` - -EOT -for i in `cat /etc/passwd | cut -d ":" -f 1` -do - if [ -d /home/$i ]; then - login=$i - uid=`cat /etc/passwd | grep $i | cut -d ":" -f 3` - gid=`cat /etc/passwd | grep $i | cut -d ":" -f 4` - name=`cat /etc/passwd | grep $i | cut -d ":" -f 5 | \ - sed s/,,,//` - home=`cat /etc/passwd | grep $i | cut -d ":" -f 6` - shell=`cat /etc/passwd | grep $i | cut -d ":" -f 7` - echo '' - echo " - - $login" - echo "$uid:$gid" - echo "$name" - echo "$home" - echo "$shell" - echo '' - fi -done -table_end -cat << EOT + for i in `cat /etc/passwd | cut -d ":" -f 1` + do + if [ -d /home/$i ]; then + login=$i + uid=`cat /etc/passwd | grep $i | cut -d ":" -f 3` + gid=`cat /etc/passwd | grep $i | cut -d ":" -f 4` + name=`cat /etc/passwd | grep $i | cut -d ":" -f 5 | \ + sed s/,,,//` + home=`cat /etc/passwd | grep $i | cut -d ":" -f 6` + shell=`cat /etc/passwd | grep $i | cut -d ":" -f 7` + echo '' + echo " + + $login" + echo "$uid:$gid" + echo "$name" + echo "$home" + echo "$shell" + echo '' + fi + done + table_end + cat << EOT
@@ -129,11 +128,34 @@ EOT + ;; + *) + # + # Defaut system settings page + # + cat << EOT +
+

$(gettext "System settings")

+

$(gettext "Manage system time, users or language settings")

+

+ -# -# Locale settings -# -cat << EOT +

`gettext "System time"`

+
+`gettext "Time zome      :"` `cat /etc/TZ`
+`gettext "System time    :"` `date`
+`gettext "Hardware clock :"` `hwclock -r`
+
+`gettext "Sync online"` +`gettext "Set hardware clock"` +EOT + # + # Locale settings + # + cat << EOT

`gettext "System language"`

@@ -149,20 +171,51 @@ eval_gettext "You must logout and login again to your current session to use \$new_locale locale." else - eval_gettext "Current system locales: " + gettext "Current system locales: " locale -a fi cat << EOT

- `gettext "Available locales:"` + $(gettext "Available locales:") - +
+ +

$(gettext "Panel configuration")

+
+

+ $(gettext "Style:") + + +

+
+
+

+ $(gettext "Panel password:") + + +

+
+

+ $(gettext "Configuration files: ") + + $(gettext "Panel") + + $(gettext "Server") +

+

+ $(gettext "TazPanel provides a debuging mode and page:") + debug +

EOT + ;; +esac xhtml_footer exit 0 diff -r b898c9887a62 -r dbdfa16dfdf2 styles/default/style.css --- a/styles/default/style.css Fri Apr 15 09:14:23 2011 +0200 +++ b/styles/default/style.css Fri Apr 15 10:15:40 2011 +0200 @@ -19,7 +19,7 @@ h3 { color: #666; font-size: 140%; } h4 { color: #888; font-size: 120%; margin: 10px 0 5px; } img { border: 0pt none; vertical-align: middle; padding: 0px 6px 2px 0;} -p { margin: 6px 0; } +p { margin: 10px 0; } ul { list-style-type: square; } li { padding: 4px 0; } a { text-decoration: none; color: #666; }