tazpanel rev 318

Add some graphics from Tango project for helpers messages and arrows; libtazpanel: add msg() function for message boxes (tip|warn|err|up); add is_installed function to determine if we need show helper msg or not; index & settings: add a pair of helpers; installer: add arrows on buttons.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Sat Jun 23 01:10:00 2012 +0000 (2012-06-23)
parents e0142e90a498
children bfa31f855b8c
files index.cgi installer.cgi lib/libtazpanel settings.cgi styles/default/images/go-first.png styles/default/images/go-next.png styles/default/images/go-previous.png styles/default/images/msg-err.png styles/default/images/msg-tip.png styles/default/images/msg-up.png styles/default/images/msg-warn.png styles/default/images/msg.png
line diff
     1.1 --- a/index.cgi	Mon Jun 11 07:19:03 2012 +0000
     1.2 +++ b/index.cgi	Sat Jun 23 01:10:00 2012 +0000
     1.3 @@ -323,8 +323,8 @@
     1.4  <p><a class="button" href="$SCRIPT_NAME?file=$output">
     1.5  	<img src="/styles/default/images/browser.png" />
     1.6  	$(gettext 'View report')</a>
     1.7 -	$(gettext 'This report can be attached with a bug report on:')
     1.8 -	<a href="http://bugs.slitaz.org/">bugs.slitaz.org</a></p>
     1.9 +	$(msg tip "$(gettext 'This report can be attached with a bug report on:')
    1.10 +	<a href="http://bugs.slitaz.org/">bugs.slitaz.org</a></p>")
    1.11  EOT
    1.12  		;;
    1.13  
     2.1 --- a/installer.cgi	Mon Jun 11 07:19:03 2012 +0000
     2.2 +++ b/installer.cgi	Sat Jun 23 01:10:00 2012 +0000
     2.3 @@ -164,7 +164,7 @@
     2.4  graphically manage your partitions with Gparted")</p>
     2.5  
     2.6  <a class="button" href="$SCRIPT_NAME?page=partitioning">$(gettext "Install \
     2.7 -SliTaz")</a>
     2.8 +SliTaz") <img src="$IMAGES/go-next.png" /></a>
     2.9  </section>
    2.10  EOT
    2.11  }
    2.12 @@ -181,7 +181,7 @@
    2.13  system will be updated as long you have an active internet connection.")</p>
    2.14  
    2.15  <a class="button" href="$SCRIPT_NAME?page=upgrade">$(gettext "Upgrade \
    2.16 -SliTaz")</a>
    2.17 +SliTaz") <img src="$IMAGES/go-next.png" /></a>
    2.18  </section>
    2.19  EOT
    2.20  }
    2.21 @@ -231,9 +231,9 @@
    2.22  
    2.23  <hr />
    2.24  <a class="button" value="$1" href="$SCRIPT_NAME?page=home" >
    2.25 -	$(gettext 'Back to Installer Start Page')</a>
    2.26 +	<img src="$IMAGES/go-first.png"/> $(gettext 'Back to Installer Start Page')</a>
    2.27  <a class="button" value="$2" href="$SCRIPT_NAME?page=install">
    2.28 -	$(gettext 'Continue Installation')</a>
    2.29 +	$(gettext 'Continue Installation') <img src="$IMAGES/go-next.png" /></a>
    2.30  EOT
    2.31  }
    2.32  
    2.33 @@ -498,33 +498,32 @@
    2.34  {
    2.35  	case $1 in
    2.36  		partitioning)
    2.37 -			title1=$(gettext 'Back to partitioning') ;;
    2.38 +			title1="<img src=\"$IMAGES/go-previous.png\" /> $(gettext 'Back to partitioning')" ;;
    2.39  		*)
    2.40  			page=home
    2.41 -			title1=$(gettext 'Back to Installer Start Page') ;;
    2.42 +			title1="<img src=\"$IMAGES/go-first.png\" /> $(gettext 'Back to Installer Start Page')" ;;
    2.43  	esac
    2.44  	case $2 in
    2.45  		write|run)
    2.46 -			title2=$(gettext 'Proceed to SliTaz installation') ;;
    2.47 +			title2="$(gettext 'Proceed to SliTaz installation') <img src=\"$IMAGES/go-next.png\" />" ;;
    2.48  		reboot)
    2.49  			title2=$(gettext 'Installation complete. You can now restart (reboot)') ;;
    2.50  		failed)
    2.51  			title2=$(gettext 'Installation failed. See log') ;;
    2.52  		*)
    2.53  			page=home
    2.54 -			title2=$(gettext 'Back to Installer Start Page') ;;
    2.55 +			title2="<img src=\"$IMAGES/go-first.png\" /> $(gettext 'Back to Installer Start Page')" ;;
    2.56  	esac
    2.57  	cat <<EOT
    2.58  <hr />
    2.59 -<input type="hidden" name="page" value="$2" />
    2.60  <a class="button" value="$1"  href="$SCRIPT_NAME?page=$1" >$title1</a>
    2.61 -<input type="submit" value="$title2">
    2.62 +<a class="button" value="$2"  href="$SCRIPT_NAME?page=$2" >$title2</a>
    2.63  EOT
    2.64  }
    2.65  
    2.66  page_redirection()
    2.67  {
    2.68 -	cat <<EOT
    2.69 +	cat << EOT
    2.70  <!DOCTYPE html>
    2.71  <html>
    2.72  <head>
    2.73 @@ -548,7 +547,7 @@
    2.74  	local code
    2.75  	code=0
    2.76  	# Check tazinst
    2.77 -	if ! [ -x /usr/sbin/tazinst ] ; then
    2.78 +	if ! [ -x /usr/sbin/tazinst2 ] ; then
    2.79  		cat <<EOT
    2.80  <h3>$(gettext 'Tazinst Error')</h3>
    2.81  <p>$(gettext "<strong>tazinst</strong>, the lightweight SliTaz HDD installer \
     3.1 --- a/lib/libtazpanel	Mon Jun 11 07:19:03 2012 +0000
     3.2 +++ b/lib/libtazpanel	Sat Jun 23 01:10:00 2012 +0000
     3.3 @@ -226,3 +226,24 @@
     3.4  </thead>
     3.5  EOT
     3.6  }
     3.7 +
     3.8 +msg() {
     3.9 +	msgtype="$1"; shift
    3.10 +	case "$msgtype" in
    3.11 +		tip)			MSG_ICON="$IMAGES/msg-tip.png" ;;
    3.12 +		warn|warning)	MSG_ICON="$IMAGES/msg-warn.png" ;;
    3.13 +		err|error)		MSG_ICON="$IMAGES/msg-err.png" ;;
    3.14 +		up)				MSG_ICON="$IMAGES/msg-up.png" ;;
    3.15 +		*)				MSG_ICON="$IMAGES/msg.png" ;;
    3.16 +	esac
    3.17 +	cat << EOT
    3.18 +	<section class="box" style="width:50%;margin:0.5em auto;">
    3.19 +		<image src="$MSG_ICON" alt="$msgtype" class="float-left" />
    3.20 +		$@
    3.21 +	</section>
    3.22 +EOT
    3.23 +}
    3.24 +
    3.25 +is_installed() {
    3.26 +	[ -d "$INSTALLED/$1" ]
    3.27 +}
     4.1 --- a/settings.cgi	Mon Jun 11 07:19:03 2012 +0000
     4.2 +++ b/settings.cgi	Sat Jun 23 01:10:00 2012 +0000
     4.3 @@ -184,7 +184,7 @@
     4.4  		LOADING_MSG="$(gettext 'Please wait...')"
     4.5  		loading_msg
     4.6  		cur_loc=$(locale | grep LANG | cut -d= -f2)
     4.7 -		cat <<EOT
     4.8 +		cat << EOT
     4.9  <h3 id="locale">$(gettext 'Choose locale')</h3>
    4.10  
    4.11  <p>$(gettext 'Current locale settings:')</p>
    4.12 @@ -194,7 +194,16 @@
    4.13  <pre>$(locale -a)</pre>
    4.14  
    4.15  <p>$(gettext 'Available locales:')</p>
    4.16 +EOT
    4.17  
    4.18 +		is_installed "glibc-locale"
    4.19 +		[ $? = 1 ] &&
    4.20 +			msg tip $(gettext \
    4.21 +			"Don't see your language?<br/>You can \
    4.22 +<a href='/pkgs.cgi?do=Install&glibc-locale'>install glibc-locale</a> \
    4.23 +to see huge list of available locales.")
    4.24 +
    4.25 +		cat << EOT
    4.26  <form method="get" action="$SCRIPT_NAME">
    4.27  	<div class="outbox">
    4.28  	<table class="zebra fixed">
    4.29 @@ -284,8 +293,8 @@
    4.30  			# System configuration
    4.31  			echo "LANG=$new_locale" > /etc/locale.conf
    4.32  			echo "LC_ALL=$new_locale" >> /etc/locale.conf
    4.33 -			eval_gettext "You must logout and login again to your current \
    4.34 -session to use \$new_locale locale."
    4.35 +			msg warn "$(eval_gettext \
    4.36 +			'You must logout and login again to your current session to use $new_locale locale.')"
    4.37  		else
    4.38  			gettext 'Current system locale:'; echo -n " <strong>"
    4.39  			locale | grep LANG | cut -d= -f2
     5.1 Binary file styles/default/images/go-first.png has changed
     6.1 Binary file styles/default/images/go-next.png has changed
     7.1 Binary file styles/default/images/go-previous.png has changed
     8.1 Binary file styles/default/images/msg-err.png has changed
     9.1 Binary file styles/default/images/msg-tip.png has changed
    10.1 Binary file styles/default/images/msg-up.png has changed
    11.1 Binary file styles/default/images/msg-warn.png has changed
    12.1 Binary file styles/default/images/msg.png has changed