# HG changeset patch # User Aleksej Bobylev # Date 1336125643 -10800 # Node ID fdfc6b49453949948f6c050c1b29197a2d949471 # Parent 5312e3716b0158e904b26879b03797d616785c3f 3 weeks forging ;) Some bugs fixed, maybe all i18n improved (please, recheck 'po's!), couple of new features added... Enjoy! diff -r 5312e3716b01 -r fdfc6b494539 AUTHORS --- a/AUTHORS Fri May 04 12:57:53 2012 +0300 +++ b/AUTHORS Fri May 04 13:00:43 2012 +0300 @@ -3,3 +3,4 @@ Paul Issot Dominique Corbex Christian Mesh +Aleksej Bobylev diff -r 5312e3716b01 -r fdfc6b494539 Makefile --- a/Makefile Fri May 04 12:57:53 2012 +0300 +++ b/Makefile Fri May 04 13:00:43 2012 +0300 @@ -3,7 +3,7 @@ PREFIX?=/usr SYSCONFDIR?=/etc/slitaz DESTDIR?= -LINGUAS?=fr pt_BR +LINGUAS?=es fr pt_BR ru PANEL?=/var/www/tazpanel VERSION:=$(shell grep ^VERSION tazpanel | cut -d '=' -f 2) @@ -16,10 +16,9 @@ xgettext -o po/tazpanel.pot -L Shell \ --package-name="TazPanel" \ --package-version="$(VERSION)" \ - ./tazpanel ./index.cgi ./pkgs.cgi ./live.cgi \ - ./network.cgi ./boot.cgi ./hardware.cgi \ - ./settings.cgi ./lib/libtazpanel ./installer.cgi \ - ./styles/default/header.sh ./styles/default/footer.sh + ./tazpanel ./index.cgi ./pkgs.cgi ./live.cgi ./network.cgi ./boot.cgi \ + ./hardware.cgi ./settings.cgi ./lib/libtazpanel ./installer.cgi \ + ./help.cgi ./styles/default/header.sh ./styles/default/footer.sh msgmerge: @for l in $(LINGUAS); do \ @@ -59,3 +58,9 @@ rm -f po/*.mo rm -f po/*.*~ +help: + @echo "$$ pot - remake pot" + @echo "$$ msgmerge - update *.po from *.pot" + @echo "$$ msgfmt | all - compile *.mo" + @echo "# install - install files to system" + @echo "$$ clean - remove *.mo" diff -r 5312e3716b01 -r fdfc6b494539 README.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README.html Fri May 04 13:00:43 2012 +0300 @@ -0,0 +1,90 @@ +

SliTaz Web Control Panel

+ +

Tazpanel is the SliTaz Control Panel, a web interface which lets you manage the +full system in a radically simple way. The output xHTML code is valid xHTML 5 +and all theming is done with standard CSS 3. TazPanel is published under a +BSD License.

+ + +

Use it!

+ +

You can clone the tazpanel repo into /var/www/tazpanel and work on this +copy or clone it somewhere else and 'make install'. After, add tazpanel to +your /etc/hosts, type './tazpanel start' to start the server and go to the +URL: http://tazpanel:82. Panel user and password are defined in the +httpd.conf and default is root:root

+ + +

i18n

+ +

TazPanel has been coded from the beginning with gettext support. Please +forget 'echo' and use gettext, but remember that gettext "" is equivalent +to echo -n. All scripts use the same TEXTDOMAIN and the same pot files, and +all translations go in the po/ folder. To start a new translation please +use msginit from the pot file directory. Example for French/France +locale (fr_FR):

+ +
$ msginit -l fr_FR -o fr.po -i tazpanel.pot
+ +

To update all translations from a newly updated pot file:

+ +
$ make msgmerge
+ + +

User interface

+ +

If you develop an official SliTaz GUI for TazPanel, please follow the default +style. If you need more CSS markup and you are not a coder, please ask an +official developer for the best way to implement your idea. TazPanel is fully +themable and more than one theme can be installed, this will allow us to make +packages in a TazPanel style! All the GUI is done with xHTML 5 and CSS 3, some +javascript can be used, but with precautions... one more time, it's better +to check with a main contributor before adding too much stuff, the goal is, +as for all the SliTaz projects: KISS

+ + +

CGI template and files

+ +

To start or test a new function with TazPanel you will find a file in +utils/template.cgi that needs to be in the $PANEL root to work, all TazPanel +CGI scripts are in that location. If you think your code is too big to fit +in another script you can eventually create a new CGI page and update all +links, but please to talk to the AUTHORS beforehand.

+ +
+
index.cgi
+
Main Tazpanel CGI script
+
boot.cgi
+
All what happens before login
+
network.cgi
+
All related stuff to networking (eth, wifi, services)
+
pkgs.cgi
+
Tazpkg packages CGI interface
+
settings.cgi
+
System settings and services such as time, users accounts, + locales or daemons management
+
live.cgi
+
All tools related to Live systems (CD, USB, Frugal)
+
hardware.cgi
+
Devices drivers, firmware, printing
+
help.cgi
+
Cat the html doc and this README file
+ + +

For common functions have a look to lib/libtazpanel, you may found functions +you need already coded such as a xhtml_header to get the style header.html +in your CGI script. For the loading message you can use loading_msg. When +cat is used: `gettext "Text to translate"`

+ + +

Web server

+ +

Tazpanel can run with the Busybox httpd applet or LightTPD and probably Apache. +Start the webserver with a custom config to listen only on a local port for +security reasons since we run as root to perform system actions, example:

+ +
# httpd -p 82 u root -c /etc/slitaz/httpd.conf
+ +

Or use a tazpanel cmdline:

+ +
# ./tazpanel start
diff -r 5312e3716b01 -r fdfc6b494539 boot.cgi --- a/boot.cgi Fri May 04 12:57:53 2012 +0300 +++ b/boot.cgi Fri May 04 13:00:43 2012 +0300 @@ -22,29 +22,29 @@ xhtml_header cat << EOT
-

`gettext "Boot log files"`

+

$(gettext 'Boot log files')

- -

$(gettext "Kernel messages")

+ +

$(gettext 'Kernel messages')

+ +
$(cat /var/log/dmesg.log | syntax_highlighter kernel)
+ +

$(gettext 'Boot scripts')

+ +
$(cat /var/log/boot.log | filter_taztools_msgs)
+ +

$(gettext 'X server')

+
-$(cat /var/log/dmesg.log)
-	
- -

$(gettext "Boot scripts")

-
-$(cat /var/log/boot.log | filter_taztools_msgs)
-	
- -

$(gettext "X server")

-
-$(tail -n 40 /var/log/slim.log)
-	
+$(tail -n 40 /var/log/slim.log | htmlize) +
$(gettext 'Show more...') + EOT ;; *\ daemons\ *) @@ -58,10 +58,8 @@ cat << EOT
-

`gettext "Manage daemons"`

-

- `gettext "Check, start and stop daemons on SliTaz"` -

+

$(gettext 'Manage daemons')

+

$(gettext 'Check, start and stop daemons on SliTaz')

EOT daemon=$(GET daemons) @@ -81,11 +79,11 @@ cat << EOT - `gettext "Name"` - `gettext "Description"` - `gettext "Status"` - `gettext "Action"` - `gettext "PID"` + $(gettext 'Name') + $(gettext 'Description') + $(gettext 'Status') + $(gettext 'Action') + $(gettext 'PID') EOT @@ -104,29 +102,30 @@ # First check if daemon is started at bootime [ echo "RUN_DAEMONS" | fgrep $name ] && boot="on boot" # Standard SliTaz busybox daemons and firewall + echo -n "" case "$name" in firewall) - gettext "SliTaz Firewall with iptable rules" ;; + gettext 'SliTaz Firewall with iptable rules' ;; httpd) - gettext "Small and fast web server with CGI support" ;; + gettext 'Small and fast web server with CGI support' ;; ntpd) - gettext "Network time protocol daemon" ;; + gettext 'Network time protocol daemon' ;; ftpd) - gettext "Anonymous FTP server" ;; + gettext 'Anonymous FTP server' ;; udhcpd) - gettext "Busybox DHCP server" ;; + gettext 'Busybox DHCP server' ;; syslogd|klogd) - gettext "Linux Kernel log daemon" ;; + gettext 'Linux Kernel log daemon' ;; crond) - gettext "Execute scheduled commands" ;; + gettext 'Execute scheduled commands' ;; dnsd) - gettext "Small static DNS server daemon" ;; + gettext 'Small static DNS server daemon' ;; tftpd) - gettext "Transfer a file on tftp request" ;; + gettext 'Transfer a file on tftp request' ;; inetd) - gettext "Listen for network connections and launch programs" ;; + gettext 'Listen for network connections and launch programs' ;; zcip) - gettext "Manage a ZeroConf IPv4 link-local address" ;; + gettext 'Manage a ZeroConf IPv4 link-local address' ;; *) # Description from receipt [ -d "$LOCALSTATE/installed/$name" ] && pkg=$name @@ -134,25 +133,26 @@ [ -d "$LOCALSTATE/installed/${name}-pam" ] && pkg=${name}-pam if [ "$pkg" ]; then . $LOCALSTATE/installed/$pkg/receipt - echo "$SHORT_DESC" + echo -n "$SHORT_DESC" else - echo "----" + echo -n "----" fi ;; esac + echo "" # Attempt to get daemon status - pidfile=`find /var/run -name *$name*.pid` - [ "$pidfile" ] && pid=`cat $pidfile` + pidfile=$(find /var/run -name *$name*.pid) + [ "$pidfile" ] && pid=$(cat $pidfile) # dbus - [ -f /var/run/${name}/pid ] && pid=`cat /var/run/${name}/pid` + [ -f /var/run/${name}/pid ] && pid=$(cat /var/run/${name}/pid) # apache - [ "$name" = "apache" ] && pid=`cat /var/run/$name/httpd.pid` + [ "$name" = "apache" ] && pid=$(cat /var/run/$name/httpd.pid) # Pidof works for many daemons - [ "$pid" ] || pid=`pidof $name` + [ "$pid" ] || pid=$(pidof $name) if [ "$pid" ]; then cat << EOT - +Started - + Stop EOT for i in $pid; do @@ -162,67 +162,77 @@ done else cat << EOT -- +Stopped - + Start ----- EOT fi echo '' done table_end ;; + *\ grub\ *) + GRUBMENU="/boot/grub/menu.lst" if [ "$(GET splash)" ]; then default=$(GET default) timeout=$(GET timeout) splash=$(GET splash) sed -i \ - -e s"/default .*/default $default/" \ - -e s"/timeout .*/timeout $timeout/" \ - -e s"#splashimage=.*#splashimage=$splash#" \ - /boot/grub/menu.lst + -e s"|default .*|default $default # new|" \ + -e s"|timeout .*|timeout $timeout|" \ + -e s"|splashimage=.*|splashimage=$splash|" \ + $GRUBMENU fi - default=$(cat /boot/grub/menu.lst | grep ^default | cut -d " " -f 2) - timeout=$(cat /boot/grub/menu.lst | grep ^timeout | cut -d " " -f 2) - splash=$(cat /boot/grub/menu.lst | grep ^splashimage | cut -d "=" -f 2) + default=$(cat $GRUBMENU | grep ^default | cut -d " " -f 2) + timeout=$(cat $GRUBMENU | grep ^timeout | cut -d " " -f 2) + splash=$(cat $GRUBMENU | grep ^splashimage | cut -d "=" -f 2) xhtml_header cat << EOT
-

$(gettext "GRUB Boot loader")

-

- $(gettext "The first application started when the computer powers on") -

+

$(gettext 'GRUB Boot loader')

+ +

$(gettext 'The first application started when the computer powers on')

-
-Default entry : 
-
-Timeout       : 
-
-Splash image  : 
-
- - - View or edit menu.lst + + + + + + + +
$(gettext 'Default entry:')
$(gettext 'Timeout:')
$(gettext 'Splash image:')
+ + + $(gettext 'View or edit menu.lst')
-

$(gettext "Boot entries")

+

$(gettext 'Boot entries')

EOT + + +menu=$(tail -q -n +$(grep -n ^title $GRUBMENU | head -n1 | cut -d: -f1) $GRUBMENU \ + | sed -e "s|^$||g" \ + | sed -e "s|^title|\n

$(gettext 'Entry') #

\n
\0|g" \
+	| sed '/^[ \t]*$/d' \
+	| tail -q -n +2)"
" + entry='-1' - grep ^title /boot/grub/menu.lst | while read title + echo "$menu" | while read line do - entry=$(($entry + 1)) - echo "$(gettext "Entry") $entry" - echo '
'
-		grep -A 2 "$title" /boot/grub/menu.lst
-		echo '
' + if [ -n "$(echo $line | grep '#')" ]; then + entry=$(($entry + 1)) + fi + echo $line | sed "s|#|$entry|" done + # Here we could check if an entry for gpxe is present if not # display a form to add it. [ -f "/boot/gpxe" ] && echo "

gPXE

" && \ - gettext "Web boot is available with gPXE" + gettext 'Web boot is available with gPXE' ;; *) # @@ -232,37 +242,35 @@ xhtml_header cat << EOT
-

$(gettext "Boot & Start services")

-

- $(gettext "Everything that happens before user login") -

+

$(gettext 'Boot & Start services')

+

$(gettext 'Everything that happens before user login')

-

`gettext "Configuration files"`

+

$(gettext 'Configuration files')

    -
  • `gettext "Main configuration file:"` +
  • $(gettext 'Main configuration file:') rcS.conf
  • -
  • `gettext "Login manager settings:"` +
  • $(gettext 'Login manager settings:') slim.conf
-

`gettext "Kernel cmdline"`

-
-`cat /proc/cmdline`
-
-

`gettext "Local startup commands"`

-
-$(cat /etc/init.d/local.sh | syntax_highlighter sh)
-
+

$(gettext 'Kernel cmdline')

+ +
$(cat /proc/cmdline)
+ +

$(gettext 'Local startup commands')

+ +
$(cat /etc/init.d/local.sh | syntax_highlighter sh)
+ -$(gettext "Edit script") +$(gettext 'Edit script') EOT ;; esac diff -r 5312e3716b01 -r fdfc6b494539 data/tazpanel.conf --- a/data/tazpanel.conf Fri May 04 12:57:53 2012 +0300 +++ b/data/tazpanel.conf Fri May 04 13:00:43 2012 +0300 @@ -1,6 +1,6 @@ # tazpanel.conf: SliTaz Web Control Panel configuration # -# Copyright (C) 2011-2012 SliTaz GNU/Linux - BSD License +# Copyright (C) 2011-12 SliTaz GNU/Linux - BSD License # # Panel location and theme @@ -32,3 +32,7 @@ # Shared Tazpkg paths LOCALSTATE="/var/lib/tazpkg" INSTALLED="$LOCALSTATE/installed" + +# Disk usage warnings in percents +DU_WARN="70" +DU_CRIT="90" diff -r 5312e3716b01 -r fdfc6b494539 doc/tazpanel.ru.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/doc/tazpanel.ru.html Fri May 04 13:00:43 2012 +0300 @@ -0,0 +1,62 @@ +
+ +

Русская справка

+ +

TazPanel — это центр управления и настроек, из которого вы можете + контролировать всю систему — управлять пакетами, добавлять и удалять + пользователей, создавать «живые» системы и многое другое. Навигация + осуществляется при помощи панели инструментов в верхней части окна + приложения, а в некоторых случаях, как в интерфейсе пакетного менеджера, — + при помощи меню и боковой панели.

+

В большинстве случаев вы получите описание и полезную информацию по + соответствующему разделу. TazPanel использует новейшие технологии — xHTML 5 + и CSS 3 для того, чтобы предоставить чистый и простой в использовании + интерфейс для всех задач управления, которые можно выполнить на SliTaz. + С самого начала TazPanel создавалась с расчетом на скорость, качество и + полную поддержку интернационализации.

+

TazPanel работает как веб-сервер на порту 82 (по умолчанию), ее можно + использовать только в локальной системе. Если вы хотите управлять вашей + системой с удаленной машины, вы можете изменить файл конфигурации сервера, + чтобы разрешить соединения из локальной сети, или даже из всего интернета, + но в последнем случае убедитесь, что вы установили надежный пароль для + панели. Файл конфигурации сервера — /etc/slitaz/httpd.conf.

+ +

Terminal

+ +

TazPanel содержит небольшой эмулятор терминала, который позволяет выполнять + команды от имени администратора на удаленной или локальной системе. + Использоваться могут не все команды, и в большинстве случаев вы должны + использовать соединение SSH. Тем не менее, несколько команд, имеющиеся в + веб-интерфейсе, могут оказаться полезными, например, Wget поддерживает + загрузку файлов на удаленную машину. Папка загрузки по умолчанию — + /var/www/downloads. Все команды могут использовать параметры, такие как + -R -l и т.д.

+ +

Поддержка

+ +

Вы можете получить поддержку на форуме + SliTaz, в рассылке или на канале IRC. Официальный IRC-канал SliTaz + находится на Freenode; обратите внимание, что вы можете использовать в + SliTaz программы LostIRC, Xchat или Pidgin. Freenode также поддерживает + хороший веб-интерфейс.

+ +

Присоединяйтесь

+ +

Если вы хотите помочь и присоединиться к SliTaz, вы можете заняться TazPanel! + Нам нужна помощь в переводе, дизайне, написании документации и кода. Если + вам нужна дополнительная информация, или вы хотите опубликовать новый + дизайн, заходите в сообщество, а там + оставьте сообщение на форуме Devel, или личное сообщение одному из + разработчиков SliTaz, чтобы мы могли связаться с вами и включить вашу работу + в TazPanel или в дополнительный пакет стилей.

+ +

Баги и особенности

+ +

TazPanel — всё еще молодое приложение, которое со временем будет + совершенствоваться и отшлифовываться. Если вы нашли ошибку, пожалуйста, + сообщите на баг-трекер SliTaz: + bugs.slitaz.org. Tazpanel имеет режим + отладки, который можно включить в файле конфигурации tazpanel.conf; также + имеется отладочная страница.

+ +
diff -r 5312e3716b01 -r fdfc6b494539 hardware.cgi --- a/hardware.cgi Fri May 04 12:57:53 2012 +0300 +++ b/hardware.cgi Fri May 04 13:00:43 2012 +0300 @@ -18,73 +18,72 @@ case " $(GET) " in *\ print\ *) - echo "TODO" ;; + xhtml_header + echo "

TODO

" ;; *\ detect\ *) # Front end for Tazhw # TODO: Add button to detect webcam, etc. Like in tazhw box. xhtml_header - cat << EOT + cat << EOT
-

$(gettext "Detect hardware")

-

$(gettext "Detect PCI and USB hardware")

+

$(gettext 'Detect hardware')

+

$(gettext 'Detect PCI and USB hardware')

+ +
$(tazhw detect-pci | syntax_highlighter sh)
+ +
$(tazhw detect-usb | syntax_highlighter sh)
EOT - echo '
'
-		tazhw detect-pci
-		echo '
' - echo '
'
-		tazhw detect-usb
-		echo '
' ;; + ;; *\ modules\ *|*\ modinfo\ *) xhtml_header cat << EOT
-

`gettext "Kernel modules"`

-
-
- - -
-
-

$(gettext "Manage, search or get information about the Linux kernel modules")

+

$(gettext 'Kernel modules')

+
+
+ + +
+
+

$(gettext 'Manage, search or get information about the Linux kernel modules')

EOT # Request may be modinfo output that we want in the page itself - if [ -n "$(GET modinfo)" ]; then - echo '' - gettext "Detailed information for module: "; echo "$(GET modinfo)" - echo '' - echo '
'
-			modinfo $(GET modinfo)
-			echo '
' + get_modinfo="$(GET modinfo)" + if [ -n "$get_modinfo" ]; then + cat << EOT +$(eval_gettext 'Detailed information for module: $get_modinfo') + +
$(modinfo $get_modinfo)
+EOT fi if [ -n "$(GET modprobe)" ]; then - echo '
'
-			modprobe -v $(GET modprobe)
-			echo '
' + echo "
$(modprobe -v $(GET modprobe))
" fi if [ -n "$(GET rmmod)" ]; then echo "Removing" rmmod -w $(GET rmmod) fi - if [ -n "$(GET search)" ]; then - gettext "Matching result(s) for: "; echo "$(GET search)" + get_search="$(GET search)" + if [ -n "$get_search" ]; then + eval_gettext 'Matching result(s) for: $get_search' echo '
'
 			modprobe -l | grep "$(GET search)" | while read line
 			do
 				name=$(basename $line)
 				mod=${name%.ko.gz}
-				echo "Module    : $mod "
+				echo "$(gettext 'Module:') $mod"
 			done
 			echo '
' fi cat << EOT - `table_start` + $(table_start) - `gettext "Module"` - `gettext "Size"` - `gettext "Used"` - `gettext "by"` + $(gettext 'Module') + $(gettext 'Size') + $(gettext 'Used') + $(gettext 'by') EOT # Get the list of modules and link to modinfo @@ -95,7 +94,7 @@ $MOD $SIZE $USED - `echo $BY | sed s/","/" "/g` + $(echo $BY | sed s/","/" "/g) EOT done @@ -110,14 +109,14 @@ xhtml_header cat << EOT
-

`gettext "Drivers & Devices"`

-

`gettext "Manage your computer hardware`

+

$(gettext 'Drivers & Devices')

+

$(gettext 'Manage your computer hardware')

- Kernel modules + $(gettext 'Kernel modules') - Detect PCI/USB + $(gettext 'Detect PCI/USB')
@@ -130,36 +129,46 @@ remain=$(sed '/remaining capacity/!d;s/[^0-9]*\([0-9]*\).*/\1/' < $dev/state) rate=$(sed '/present rate/!d;s/[^0-9]*\([0-9]*\).*/\1/' < $dev/state) full=$(sed '/last full capacity/!d;s/[^0-9]*\([0-9]*\).*/\1/' < $dev/info) - # FIXME - #remtime=$(( ($remain * 60) / $rate )) - #rempct=$(( ($remain * 100) / $full )) + warning=$(sed '/design capacity warning/!d;s/[^0-9]*\([0-9]*\).*/\1/' < $dev/info) + low=$(sed '/design capacity low/!d;s/[^0-9]*\([0-9]*\).*/\1/' < $dev/info) + state=$(sed '/charging state/!d;s/\([^:]*:[ ]\+\)\([a-z]\+\)/\2/' < $dev/state) + + rempct=$(( $remain * 100 / $full )) cat << EOT - Battery $(grep "^battery type" $dev/info | sed 's/.*: *//') + $(gettext 'Battery') $(grep "^battery type" $dev/info | sed 's/.*: *//') $(grep "^design capacity:" $dev/info | sed 's/.*: *//') - health $(( (100*$full)/$design))% + $(gettext 'health') $(( (100*$full)/$design))% + + EOT - if grep -qis discharging $dev/state; then - cat <
charge $rempct% - $(printf "%d:%02d" $(($remtime/60)) $(($remtime%60)))
-EOT - else - cat <
recharging $rempct%
-EOT - fi + case "$state" in + "discharging") + remtime=$(( $remain * 60 / $rate )) + remtimef=$(printf "%d:%02d" $(($remtime/60)) $(($remtime%60))) + eval_gettext 'Discharging $rempct% - $remtimef' ;; + "charging") + remtime=$(( ($full - $remain) * 60 / $rate )) + remtimef=$(printf "%d:%02d" $(($remtime/60)) $(($remtime%60))) + eval_gettext 'Charging $rempct% - $remtimef' ;; + "charged") + gettext 'Charged 100%' ;; + esac + echo '
' done echo "" fi + if [ -n "$(ls /sys/devices/virtual/thermal/*/temp 2> /dev/null)" ]; then - echo "Temperature: " + echo -n '

'; gettext 'Temperature:' for temp in /sys/devices/virtual/thermal/*/temp; do awk '{ print $1/1000 }' < $temp done + echo '

' fi + if [ -n "$(ls /sys/devices/virtual/backlight/*/brightness 2> /dev/null)" ]; then cat < @@ -168,7 +177,7 @@ name=$(echo $dev | sed 's|.*/backlight/\([^/]*\).*|\1|') cat < -$(gettext "Brightness") \ +$(gettext 'Brightness') \ $(sed 's/.*\.//;s/_*$//' < /sys/devices/virtual/backlight/$name/device/path): - +

@@ -25,7 +25,7 @@ } # Cat translated help content -TITLE=$(gettext 'TazPanel - Help \& Doc') +TITLE=$(gettext 'TazPanel - Help & Doc') xhtml_header search_form @@ -41,10 +41,11 @@ cat /usr/share/doc/tazpanel/tazpanel.html fi - echo '

README

' - echo '
'
-	cat $PANEL/README
-	echo '
' +# cat << EOT +#

README

+#
$(cat $PANEL/README)
+#EOT + cat $PANEL/README.html fi diff -r 5312e3716b01 -r fdfc6b494539 index.cgi --- a/index.cgi Fri May 04 12:57:53 2012 +0300 +++ b/index.cgi Fri May 04 13:00:43 2012 +0300 @@ -35,12 +35,18 @@ button) cat < - `gettext "Differences"` + $(gettext 'Differences') EOT esac break done } +# OK status in table +ok_status_t() { + echo " [ OK ]" +} + + # # Things to do before displaying the page @@ -67,16 +73,17 @@ xhtml_header echo "

$file

" ;; esac + if [ "$(GET action)" == "edit" ]; then cat < - - - - `gettext "Differences"` - + + + + $(gettext 'Differences') + EOT #The space before textarea gets muddled when the form is submitted. @@ -93,10 +100,13 @@ cat < - `gettext "Edit"` + $(gettext 'Edit') EOT file_is_modified $file button - echo -e "\n
"
+			cat << EOT
+
+
+EOT
 			# Handle file type by extension as a Web Server does it.
 			case "$file" in
 				*.conf|*.lst)
@@ -104,10 +114,11 @@
 				*.sh|*.cgi)
 					syntax_highlighter sh ;;
 				*)
-					cat ;;
+					cat | htmlize ;;
 			esac < $file
 			echo '
' fi ;; + *\ terminal\ *|*\ cmd\ *) # Cmdline terminal. commands='cat du help ls ping pwd who wget' @@ -117,7 +128,7 @@ cat << EOT
- root@$(hostname):~# + root@$(hostname):~#
EOT @@ -125,70 +136,84 @@ # Allow only a few commands for the moment. case "$cmd" in usage|help) - gettext "Small terminal emulator, commands options are supported." + gettext 'Small terminal emulator, commands options are supported.' echo "" - gettext "Commands:"; echo " $commands" ;; + eval_gettext 'Commands: $commands' + echo ;; wget*) dl=/var/cache/downloads [ ! -d "$dl" ] && mkdir -p $dl - gettext "Downloading to:"; echo " $dl" + eval_gettext 'Downloading to: $dl' && echo cd $dl && $cmd ;; du*|ls*|ping*|pwd|who) $cmd ;; cat*) # Cmd must be used with an arg. arg=$(echo $cmd | awk '{print $2}') - [ "$arg" == "" ] && echo -n "$cmd " && \ - gettext "needs an argument $arg" && exit 0 + [ "$arg" == "" ] && eval_gettext '$cmd needs an argument' && break $cmd ;; *) [ "$cmd" == "" ] || \ - gettext "Unknown command: $cmd" - gettext "Commands:"; echo " $commands" ;; + eval_gettext 'Unknown command: $cmd' && echo + eval_gettext 'Commands: $commands' ;; esac echo '
' ;; *\ top\ *) TITLE=$(gettext 'TazPanel - Process activity') xhtml_header - echo `gettext "Refresh: "` $(GET refresh) - echo '
+ echo $(gettext 'Refresh:') $(GET refresh) + cat << EOT +
- - - - -
' - [ -n $(GET refresh) ] && - echo '' | sed "s/s //" + + + + + +EOT + if [ -n "$(GET refresh)" ]; then + echo -n '' + fi echo '
'
-		top -n1 -b | sed \
+		top -n1 -b | htmlize | sed \
 			-e s"#^[A-Z].*:\([^']\)#\0#"g \
 			-e s"#PID.*\([^']\)#\0#"g
 		echo '
' ;; + *\ debug\ *) TITLE=$(gettext 'TazPanel - Debug') xhtml_header - echo '

HTTP Environment

' - echo '
'
-		httpinfo
-		echo '
' ;; + cat << EOT +

$(gettext 'HTTP Environment')

+ +
$(httpinfo)
+EOT + ;; + *\ report\ *) TITLE=$(gettext 'TazPanel - System report') [ -d /var/cache/slitaz ] || mkdir -p /var/cache/slitaz output=/var/cache/slitaz/sys-report.html xhtml_header - echo "

$(gettext "Reporting to:") $output

" - echo '
'
-		gettext "Creating report header...  "
+		cat << EOT
+

$(eval_gettext 'Reporting to: $output')

+ + + +EOT cat > $output << EOT - SliTaz system report + + $(gettext 'SliTaz system report')
$(gettext 'Creating report header...')