tazpanel rev 437

(fix) terminal for user, history support; (fix) keymap list (again); (fix) month selected in clock setup; (feauture) add user/root panel indicator and re-login button; (feature) do not hide menu items and buttons (possibly), just disable them (to see all possibilities).
author Aleksej Bobylev <al.bobylev@gmail.com>
date Tue Apr 07 00:27:17 2015 +0300 (2015-04-07)
parents fa8dd339b418
children 3b7af62b1a2e
files hardware.cgi index.cgi lib/libtazpanel lib/tazpanel.js settings.cgi styles/default/base.css styles/default/header.html styles/default/tweaks.css test.cgi
line diff
     1.1 --- a/hardware.cgi	Mon Apr 06 22:36:56 2015 +0200
     1.2 +++ b/hardware.cgi	Tue Apr 07 00:27:17 2015 +0300
     1.3 @@ -223,14 +223,10 @@
     1.4  <p>$(gettext 'Manage your computer hardware')</p>
     1.5  
     1.6  <form><!--
     1.7 -EOT
     1.8 -		[ "$REMOTE_USER" == "root" ] && cat <<EOT
     1.9 -	--><button name="detect"  data-icon="detect" >$(gettext 'Detect PCI/USB')</button><!--
    1.10 -	--><button name="tazx"    data-icon="tazx"   >$(gettext 'Auto-install Xorg video driver')</button><!--
    1.11 -EOT
    1.12 -		cat <<EOT
    1.13 -	--><button name="modules" data-icon="modules">$(gettext 'Kernel modules')</button>
    1.14 -</form>
    1.15 +	--><button name="modules" data-icon="modules">$(gettext 'Kernel modules')</button><!--
    1.16 +	--><button name="detect"  data-icon="detect" data-root>$(gettext 'Detect PCI/USB')</button><!--
    1.17 +	--><button name="tazx"    data-icon="tazx"   data-root>$(gettext 'Auto-install Xorg video driver')</button><!--
    1.18 +--></form>
    1.19  
    1.20  EOT
    1.21  
     2.1 --- a/index.cgi	Mon Apr 06 22:36:56 2015 +0200
     2.2 +++ b/index.cgi	Tue Apr 07 00:27:17 2015 +0300
     2.3 @@ -19,8 +19,7 @@
     2.4  
     2.5  # Check whether a configuration file has been modified after installation
     2.6  
     2.7 -file_is_modified()
     2.8 -{
     2.9 +file_is_modified() {
    2.10  	grep -l "  $1$" $INSTALLED/*/md5sum | while read file; do
    2.11  
    2.12  		# Found, but can we do diff?
    2.13 @@ -35,7 +34,7 @@
    2.14  				diff -abu $tmp$1 $1 | sed "s|$tmp||"
    2.15  				rm -rf $tmp;;
    2.16  			button)
    2.17 -				echo -n '<button name="action" value="diff" data-icon="diff">'$(gettext 'Differences')'</button>';;
    2.18 +				echo -n '<button name="action" value="diff" data-icon="diff">'$(_ 'Differences')'</button>';;
    2.19  		esac
    2.20  		break
    2.21  	done
    2.22 @@ -51,6 +50,20 @@
    2.23  
    2.24  
    2.25  
    2.26 +# Terminal prompt
    2.27 +
    2.28 +term_prompt() {
    2.29 +	if [ "$user" == 'root' ]; then
    2.30 +		local color1='color31' sign='#'
    2.31 +	else
    2.32 +		local color1='color32' sign='$'
    2.33 +	fi
    2.34 +	echo -n "<span class='$color1'>$user@$(hostname)</span>:<span class='color33'>"
    2.35 +	pwd | sed "s|^$HOME|~|" | tr -d '\n'; echo -n "</span>$sign "
    2.36 +}
    2.37 +
    2.38 +
    2.39 +
    2.40  #
    2.41  # Things to do before displaying the page
    2.42  #
    2.43 @@ -202,16 +215,14 @@
    2.44  	*\ terminal\ *|*\ cmd\ *)
    2.45  		# Cmdline terminal
    2.46  
    2.47 -		TITLE=$(gettext 'TazPanel - Terminal'); header; xhtml_header
    2.48 +		header; TITLE=$(gettext 'TazPanel - Terminal'); xhtml_header
    2.49  
    2.50 -		historyfile=/root/.ash_history
    2.51 -		#commands='cat cd date du fdisk help ls ping pwd who wget'
    2.52 +		user="$REMOTE_USER"
    2.53 +		HOME="$(awk -F: -vu=$user '$1==u{print $6}' /etc/passwd)"
    2.54 +		historyfile="$HOME/.ash_history"
    2.55 +
    2.56  		cmd=$(GET cmd)
    2.57 -
    2.58 -		path="$(GET path)"; path="${path:-/tmp}"; cd "${path/~//root}"
    2.59 -		[ "$path" == '/root' ] && path='~'
    2.60 -		user="$REMOTE_USER"
    2.61 -		[ -z "$HOME" ] && HOME=/root  # for apps that modified user settings
    2.62 +		path="$(GET path)"; path="${path:-/tmp}"; cd "$path"
    2.63  
    2.64  		font="${TERM_FONT:-monospace}"
    2.65  		palette=$(echo $TERM_PALETTE | tr A-Z a-z)
    2.66 @@ -265,7 +276,7 @@
    2.67  	<pre class="term $palette" style="font-family: '$font'" onclick="document.getElementById('typeField').focus()">
    2.68  EOT
    2.69  		if [ -n "$cmd" ]; then
    2.70 -			echo -n "<span class='color31'>$user@$(hostname)</span>:<span class='color33'>$path</span># "
    2.71 +			term_prompt
    2.72  			echo "$cmd" | htmlize
    2.73  		fi
    2.74  
    2.75 @@ -280,7 +291,8 @@
    2.76  			eval_gettext 'Downloading to: $dl'; echo
    2.77  			cd $dl; $cmd 2>&1 ;;
    2.78  		cd|cd\ *)
    2.79 -			path="${cmd#cd}"; path="${path:-/root}"; path="$(realpath $path)" ;;
    2.80 +			path="${cmd#cd}"; path="${path:-$HOME}";
    2.81 +			path="$(realpath $path)"; cd "$path" ;;
    2.82  		ls|ls\ *)
    2.83  			$cmd -w80 --color=always 2>&1 | filter_taztools_msgs ;;
    2.84  		cat)
    2.85 @@ -296,11 +308,10 @@
    2.86  			;;
    2.87  	esac
    2.88  
    2.89 -	[ "$path" == '/root' ] && path='~'
    2.90  	cat <<EOT
    2.91  <form id="term">
    2.92 -<div class="cmdline" id="cmdline"><span id="prompt"><span class="color31">$user@$(hostname)</span>:<span class="color33">$path</span># </span><span id="typeField"> </span></div>
    2.93 -<input type="hidden" name="path" value="$path"/>
    2.94 +<div class="cmdline" id="cmdline"><span id="prompt">$(term_prompt)</span><span id="typeField"> </span></div>
    2.95 +<input type="hidden" name="path" value="$(pwd)"/>
    2.96  <input type="hidden" name="cmd" id="cmd"/>
    2.97  </form>
    2.98  </pre>
    2.99 @@ -337,7 +348,9 @@
   2.100  
   2.101  	*\ rmhistory\ *)
   2.102  		# Manage shell commandline history
   2.103 -		historyfile=/root/.ash_history
   2.104 +		user="$REMOTE_USER"
   2.105 +		[ -z "$HOME" ] && HOME="$(awk -F: -vu=$user '$1==u{print $6}' /etc/passwd)"
   2.106 +		historyfile="$HOME/.ash_history"
   2.107  
   2.108  		# Return sed command for removing history lines ('8d12d' to remove 8 and 12 lines)
   2.109  		rms=$(echo $QUERY_STRING | awk 'BEGIN{RS="&";FS="="}{if($1=="rm")printf "%dd", $2}')
   2.110 @@ -609,14 +622,10 @@
   2.111  <p>$(gettext 'SliTaz administration and configuration Panel')<p>
   2.112  
   2.113  <form class="nogap"><!--
   2.114 -EOT
   2.115 -		[ "$REMOTE_USER" == "root" ] && cat <<EOT
   2.116  	--><button name="terminal" data-icon="terminal">$(gettext 'Terminal'        )</button><!--
   2.117 -	--><button name="report"   data-icon="report"  >$(gettext 'Create a report' )</button><!--
   2.118 -EOT
   2.119 -		cat <<EOT
   2.120 -	--><button name="top"      data-icon="proc"    >$(gettext 'Process activity')</button>
   2.121 -</form>
   2.122 +	--><button name="top"      data-icon="proc"    >$(gettext 'Process activity')</button><!--
   2.123 +	--><button name="report"   data-icon="report" data-root>$(gettext 'Create a report' )</button><!--
   2.124 +--></form>
   2.125  
   2.126  <section>
   2.127  	<header>$(gettext 'Summary')</header>
     3.1 --- a/lib/libtazpanel	Mon Apr 06 22:36:56 2015 +0200
     3.2 +++ b/lib/libtazpanel	Tue Apr 07 00:27:17 2015 +0300
     3.3 @@ -5,6 +5,7 @@
     3.4  # Copyright (C) 2011-2015 SliTaz GNU/Linux - BSD License
     3.5  #
     3.6  
     3.7 +. /lib/libtaz.sh
     3.8  
     3.9  [ "$(id -un)" == "${REMOTE_USER:-root}" ] || exec su -c "$(realpath $0) $@" $REMOTE_USER
    3.10  
    3.11 @@ -205,9 +206,9 @@
    3.12  # Get the list of console keymaps
    3.13  
    3.14  list_keymaps() {
    3.15 -	for keymap in $(find /usr/share/k* -type f -name "*.*map*"); do
    3.16 -		basename $keymap
    3.17 -	done | sed "s|\..*||;s|.*|<option value='&'>&</option>|" | sort
    3.18 +	find /usr/share/kbd/keymaps/i386 -type f -name '*.map*' ! -path '*include*' | \
    3.19 +	awk -F/ '{gsub(/.map.gz/, ""); printf "<option value=\"%s\">%s (%s)\n", $8, $8, $7}' | \
    3.20 +	sort
    3.21  }
    3.22  
    3.23  
    3.24 @@ -298,8 +299,7 @@
    3.25  		*)				MSG_ICON="$IMAGES/msg.png" ;;
    3.26  	esac
    3.27  	cat <<EOT
    3.28 -	<section class="box" style="width:50%;margin:0.5em auto;">
    3.29 -		<image src="$MSG_ICON" alt="$msgtype" class="float-left" />
    3.30 +	<section class="box"><img src="$MSG_ICON" alt="$msgtype"/>
    3.31  		$@
    3.32  	</section>
    3.33  EOT
    3.34 @@ -331,7 +331,8 @@
    3.35  	local caption="${2:-$default_caption}" icon="${3:-back}"
    3.36  
    3.37  	if [ -n "$1" ]; then
    3.38 -		printf '<form action="%s" method="post"><button data-icon="%s">%s</button></form>' "$URL" "$icon" "$caption"
    3.39 +		printf '<form action="%s" method="post"><button data-icon="%s">%s</button></form>' \
    3.40 +			"$URL" "$icon" "$caption"
    3.41  	fi
    3.42  }
    3.43  
    3.44 @@ -341,3 +342,11 @@
    3.45  selected() {
    3.46  	[ "$1" == "$2" ] && echo -n 'selected'
    3.47  }
    3.48 +
    3.49 +
    3.50 +check_root_tazpanel() {
    3.51 +	if [ $(id -u) != '0' ]; then
    3.52 +		msg err "$(_ 'You must be root to show this page.')"
    3.53 +		xhtml_footer; exit 0
    3.54 +	fi
    3.55 +}
     4.1 --- a/lib/tazpanel.js	Mon Apr 06 22:36:56 2015 +0200
     4.2 +++ b/lib/tazpanel.js	Tue Apr 07 00:27:17 2015 +0300
     4.3 @@ -63,7 +63,7 @@
     4.4  		var luminance = (min + max) / 2 / 255;
     4.5  
     4.6  		// Set class for body
     4.7 -		body.className = (luminance > 0.5) ? 'dark' : 'light';
     4.8 +		body.classList.add( (luminance > 0.5) ? 'dark' : 'light');
     4.9  	}
    4.10  	// Now we can use cascade styles for any elements lying on light or dark body:
    4.11  	//   .light h2 { color: #222; }
    4.12 @@ -428,6 +428,7 @@
    4.13  //
    4.14  
    4.15  function countSelPkgs(el) {
    4.16 +	countSelectedSpan = document.getElementById('countSelected');
    4.17  	countSelected = countSelectedSpan.innerText;
    4.18  	if (countSelected == '') countSelected = 0;
    4.19  
    4.20 @@ -451,5 +452,4 @@
    4.21  			checkboxes[i].onchange = countSelPkgs;
    4.22  		}
    4.23  	}
    4.24 -	countSelectedSpan = document.getElementById('countSelected');
    4.25  }
     5.1 --- a/settings.cgi	Mon Apr 06 22:36:56 2015 +0200
     5.2 +++ b/settings.cgi	Tue Apr 07 00:27:17 2015 +0300
     5.3 @@ -19,13 +19,11 @@
     5.4  
     5.5  # Get system database. LDAP compatible.
     5.6  
     5.7 -getdb()
     5.8 -{
     5.9 +getdb() {
    5.10  	getent $1 2>/dev/null || cat /etc/$1
    5.11  }
    5.12  
    5.13 -listdb()
    5.14 -{
    5.15 +listdb() {
    5.16  	for item in $(getdb $1 | cut -d ":" -f 1); do
    5.17  		echo "<option>$item</option>\n"
    5.18  	done
    5.19 @@ -257,6 +255,7 @@
    5.20  #
    5.21  
    5.22  xhtml_header
    5.23 +check_root_tazpanel
    5.24  
    5.25  case " $(GET) " in
    5.26  	*\ group*)
    5.27 @@ -557,19 +556,23 @@
    5.28  			</select>
    5.29  			<button name="do" value="settz" data-icon="ok">$(gettext 'Change')</button>
    5.30  		</fieldset>
    5.31 +
    5.32  		<fieldset><legend>$(gettext 'System time:')</legend>
    5.33  			$(date | sed 's|[0-9][0-9]:[0-9:]*|<span id="time">&</span>|')
    5.34  			<button name="do" value="rdate" data-icon="sync">$(gettext 'Sync online')</button>
    5.35  		</fieldset>
    5.36 -		<fieldset><legend>$(gettext 'Hardware clock:')</legend>
    5.37 +
    5.38 +		<fieldset id="hwclock1"><legend>$(gettext 'Hardware clock:')</legend>
    5.39  			$(hwclock -ur | sed 's|0.000000 seconds||')
    5.40 -			<button name="do" value="hwclock" data-icon="clock">$(gettext 'Set hardware clock')</button>
    5.41 +			<button name="do" value="hwclock" id="hwclock" data-icon="clock">$(gettext 'Set hardware clock')</button>
    5.42  		</fieldset>
    5.43 +
    5.44  		<fieldset><legend>$(gettext 'Set date')</legend>
    5.45  			<input type="number" name="day" value="$(date +%d)" min="1" max="31" size="4" required/>
    5.46  			<select name="month" value="$(date +%m)">
    5.47  				$(for i in $(seq 12); do
    5.48 -					printf '<option value="%s">%s</option>' $(date -d $i.01-01:01 '+%m %B')
    5.49 +					sel=''; [ "$i" == "$(date +%-m)" ] && sel=' selected'
    5.50 +					printf "<option value=\"%s\"$sel>%s</option>" $(date -d $i.01-01:01 '+%m %B')
    5.51  				done)
    5.52  			</select>
    5.53  			<input type="number" name="year" value="$(date +%Y)" min="2015" max="2030" size="6" required/>
    5.54 @@ -587,6 +590,8 @@
    5.55  	return ((this.getHours() < 10)?"0":"") + this.getHours() + ":" + ((this.getMinutes() < 10)?"0":"") + this.getMinutes() + ":" + ((this.getSeconds() < 10)?"0":"") + this.getSeconds();
    5.56  }
    5.57  setInterval(function(){document.getElementById('time').innerText = new Date().timeNow()}, 1000);
    5.58 +
    5.59 +//document.getElementById('hwclock').disabled = 'disabled';
    5.60  </script>
    5.61  </section>
    5.62  EOT
     6.1 --- a/styles/default/base.css	Mon Apr 06 22:36:56 2015 +0200
     6.2 +++ b/styles/default/base.css	Tue Apr 07 00:27:17 2015 +0300
     6.3 @@ -54,15 +54,15 @@
     6.4  	display: block;
     6.5  	padding: 0;
     6.6  	color: inherit; background: inherit;
     6.7 -	cursor: pointer;
     6.8  	outline: none;
     6.9  }
    6.10  #toolbarMenu > li > span {
    6.11  	display: inline-block;
    6.12  	padding: 0.2rem;
    6.13 +	cursor: pointer;
    6.14  }
    6.15  
    6.16 -#toolbarMenu menu li {
    6.17 +#toolbarMenu menu li a {
    6.18  	padding: 0.2rem;
    6.19  }
    6.20  
    6.21 @@ -70,7 +70,8 @@
    6.22  #toolbarMenu li:focus span,
    6.23  #toolbarMenu li:hover span,
    6.24  #toolbarMenu menu li:focus,
    6.25 -#toolbarMenu menu li:hover {
    6.26 +.user #toolbarMenu menu li:hover > a:not([data-root]),
    6.27 +.root #toolbarMenu menu li:hover {
    6.28  	background-color: hsla(30, 100%, 50%, 0.5);
    6.29  }
    6.30  
    6.31 @@ -160,6 +161,8 @@
    6.32  section table { margin-bottom: 0.3rem; }
    6.33  .nogap { word-spacing: 0; } /* remove gap between buttons in line */
    6.34  
    6.35 +.scroll { height: 12rem; overflow: auto; border: 1pt solid; }
    6.36 +section .scroll { padding: 0; margin: 0; }
    6.37  
    6.38  
    6.39  
    6.40 @@ -181,7 +184,7 @@
    6.41  
    6.42  
    6.43  fieldset { border: 1pt solid; border-radius: 0.3rem; margin-bottom: 0.2rem; }
    6.44 -
    6.45 +fieldset[disabled] { background-color: hsla(0, 0%, 50%, 0.1);}
    6.46  
    6.47  
    6.48  
    6.49 @@ -248,11 +251,11 @@
    6.50  #wrapper, .wrapper { margin: 20px 0; }
    6.51  
    6.52  .box {
    6.53 -	margin: 10px 0;
    6.54 -	padding: 12px;
    6.55 -	background: #f8f8f8;
    6.56 -	border: 1px solid #ddd;
    6.57 +	display: table;
    6.58 +	padding: 1em;
    6.59 +	width: 50%; margin: 0.5em auto;
    6.60  }
    6.61 +.box img { float: left; }
    6.62  
    6.63  .box ul { list-style-type: none; padding: 0; }
    6.64  
    6.65 @@ -319,7 +322,11 @@
    6.66  
    6.67  
    6.68  
    6.69 -/* Misc */
    6.70 +/**
    6.71 + * Misc
    6.72 + */
    6.73 +
    6.74 +/* Links */
    6.75  
    6.76  a       { text-decoration: none; color: #268bd2; cursor: pointer; }
    6.77  a:not([data-img]):hover { text-decoration: underline; }
    6.78 @@ -331,13 +338,11 @@
    6.79  
    6.80  .pre-main { margin: 16px 0; }
    6.81  
    6.82 -.scroll { height: 12rem; overflow: auto; border: 1px solid; }
    6.83 -.scroll table { border: 0px solid #fff; }
    6.84  
    6.85  
    6.86  /* Round corner */
    6.87  
    6.88 -#loading, .debug, .box, div.scroll, .outbox, section {
    6.89 +#loading, .debug, .box, .outbox, section {
    6.90  	-moz-border-radius: 4px;
    6.91  	-webkit-border-radius: 4px;
    6.92  	border-radius: 4px;
    6.93 @@ -728,3 +733,9 @@
    6.94  	background-image: -webkit-linear-gradient(top, hsla(0, 0%, 100%, 0.25), hsla(0, 0%, 0%, 0.2));
    6.95  	border-radius: 0 0.2rem 0.2rem 0;
    6.96  }
    6.97 +
    6.98 +
    6.99 +
   6.100 +/* Disable some links to root actions */
   6.101 +button:not([disabled]) { cursor: pointer; }
   6.102 +.user [data-root] { pointer-events: none; cursor: default !important; }
     7.1 --- a/styles/default/header.html	Mon Apr 06 22:36:56 2015 +0200
     7.2 +++ b/styles/default/header.html	Tue Apr 07 00:27:17 2015 +0300
     7.3 @@ -1,3 +1,5 @@
     7.4 +rootclass='user'; [ $(id -u) == '0' ] && rootclass='root'
     7.5 +
     7.6  cat << EOT
     7.7  <!DOCTYPE html>
     7.8  <html lang="${LANG%%_*}">
     7.9 @@ -7,11 +9,11 @@
    7.10  $(printf '\t<link rel="stylesheet" type="text/css" href="/%s"/>\n' $(cd /var/www/tazpanel; ls styles/$STYLE/*.css))
    7.11  $(printf '\t<script type="text/javascript" src="/%s"></script>\n' $(cd /var/www/tazpanel; ls lib/*.js))
    7.12  </head>
    7.13 -<body>
    7.14 +<body class="$rootclass">
    7.15  <script type="text/javascript">setColorTheme(); setBaseFont();</script>
    7.16  
    7.17  <header>
    7.18 -	<h1 data-icon="tazpanel">$TITLE</h1>
    7.19 +	<h1 data-icon="tazpanel">$TITLEĀ </h1>
    7.20  </header>
    7.21  
    7.22  <nav id="toolbar">
    7.23 @@ -21,12 +23,8 @@
    7.24     <menu>
    7.25      <li><a data-icon="info"     href="/">$(gettext 'Summary')</a></li>
    7.26      <li><a data-icon="proc"     href="/index.cgi?top">$(gettext 'Processes')</a></li>
    7.27 -EOT
    7.28 -[ "$REMOTE_USER" == "root" ] && cat << EOT
    7.29      <li><a data-icon="terminal" href="/index.cgi?cmd=help">$(gettext 'Terminal')</a></li>
    7.30 -    <li><a data-icon="report"   href="/index.cgi?report">$(gettext 'Create Report')</a></li>
    7.31 -EOT
    7.32 -cat << EOT
    7.33 +    <li><a data-icon="report"   href="/index.cgi?report" data-root>$(gettext 'Create Report')</a></li>
    7.34      $(for i in menu.d/panel/* ; do [ -f $i ] && sh $i menu $i ; done)
    7.35     </menu>
    7.36    </li>
    7.37 @@ -66,23 +64,17 @@
    7.38     <menu>
    7.39      <li><a data-icon="info"    href="/hardware.cgi">$(gettext 'Summary')</a></li>
    7.40      <li><a data-icon="modules" href="/hardware.cgi?modules">$(gettext 'Kernel modules')</a></li>
    7.41 -EOT
    7.42 -[ "$REMOTE_USER" == "root" ] && cat << EOT
    7.43 -    <li><a data-icon="detect"  href="/hardware.cgi?detect">$(gettext 'Detect PCI/USB')</a></li>
    7.44 -EOT
    7.45 -cat << EOT
    7.46 +    <li><a data-icon="detect"  href="/hardware.cgi?detect" data-root>$(gettext 'Detect PCI/USB')</a></li>
    7.47      <li><a data-icon="hdd"     href="/hardware.cgi#disk">$(gettext 'Disks')</a></li>
    7.48      $(for i in menu.d/hardware/* ; do [ -f $i ] && sh $i menu $i ; done)
    7.49     </menu>
    7.50    </li>
    7.51 -EOT
    7.52 -[ "$REMOTE_USER" == "root" ] && cat << EOT
    7.53    <li tabindex="5">
    7.54     <span>$(gettext 'Settings')</span>
    7.55     <menu>
    7.56 -    <li><a data-icon="info"  href="/settings.cgi">$(gettext 'Summary')</a></li>
    7.57 -    <li><a data-icon="user"  href="/settings.cgi?users">$(gettext 'Users')</a></li>
    7.58 -    <li><a data-icon="group" href="/settings.cgi?groups">$(gettext 'Groups')</a></li>
    7.59 +    <li><a data-icon="info"  href="/settings.cgi" data-root>$(gettext 'Summary')</a></li>
    7.60 +    <li><a data-icon="user"  href="/settings.cgi?users" data-root>$(gettext 'Users')</a></li>
    7.61 +    <li><a data-icon="group" href="/settings.cgi?groups" data-root>$(gettext 'Groups')</a></li>
    7.62      $(for i in menu.d/settings/* ; do [ -f $i ] && sh $i menu $i ; done)
    7.63     </menu>
    7.64    </li>
    7.65 @@ -91,8 +83,17 @@
    7.66    $(for i in menu.d/* ; do [ -f $i ] && sh $i menu $i ; done)
    7.67   </menu>
    7.68   <span id="icons">
    7.69 -  <span id="miscinfo2"></span>
    7.70 -  <span id="miscinfo1"></span>
    7.71 +EOT
    7.72 +
    7.73 +username="${REMOTE_USER:-root}"
    7.74 +case "$username" in
    7.75 +	root) icon='slitaz'; warn='';;
    7.76 +	*)    icon='user';   warn="$(_ 'Some features are disabled.')"$'\n';;
    7.77 +esac
    7.78 +
    7.79 +	cat << EOT
    7.80 +  <a data-img="$icon" title="$(_ 'You are logged in to the TazPanel as user $username.')
    7.81 +$warn$(_ 'Click to re-login.')" href="http://$RANDOM:*@tazpanel:82/"></a>
    7.82    <a data-img="help" href="/help.cgi"></a>
    7.83   </span>
    7.84  </nav>
     8.1 --- a/styles/default/tweaks.css	Mon Apr 06 22:36:56 2015 +0200
     8.2 +++ b/styles/default/tweaks.css	Tue Apr 07 00:27:17 2015 +0300
     8.3 @@ -57,11 +57,11 @@
     8.4  
     8.5  
     8.6  
     8.7 -.dark fieldset {
     8.8 +.dark fieldset, .dark .scroll {
     8.9  	border-color: #313131;
    8.10  	box-shadow: inset 1pt 1pt 0 0 #3E3E3E, 1pt 1pt 0 0 #3E3E3E; /*ok*/
    8.11  }
    8.12 -.light fieldset {
    8.13 +.light fieldset, .light .scroll {
    8.14  	border-color: #C1C1C1; }
    8.15  .dark legend { background-color: #454545; }
    8.16  
    8.17 @@ -202,11 +202,13 @@
    8.18  [data-img="off"]::before,     [data-img="remove"]::before,
    8.19  [data-img="stop"]::before,    [data-icon="pkgib"]::before {color:#dc322f} /*red*/
    8.20  
    8.21 -[data-icon="restart"]:not([disabled])::before, [data-img="conf"]::before {color:#cb4b16} /*orange*/
    8.22 +[data-icon="restart"]:not([disabled])::before, [data-img="conf"]::before,
    8.23 +[data-img="slitaz"]::before {color:#cb4b16} /*orange*/
    8.24  
    8.25  [data-icon="ok"]::before,    [data-icon="run"]::before,
    8.26  [data-icon="start"]:not([disabled])::before, [data-img="on"]::before,
    8.27 -[data-img="opt"]::before, [data-img="run"]::before, [data-icon="pkgi"]::before {color:#859900} /*green*/
    8.28 +[data-img="opt"]::before, [data-img="run"]::before, [data-icon="pkgi"]::before,
    8.29 +[data-img="user"]::before {color:#859900} /*green*/
    8.30  
    8.31  [data-img="web"]::before {color:#268bd2}, [data-icon="pkg"]::before /*blue*/
    8.32  
    8.33 @@ -232,3 +234,9 @@
    8.34  .dark  .sysmem { border-color: #2E2E2E; }
    8.35  .light .sysmem { border-color: #A3A3A3; }
    8.36  
    8.37 +
    8.38 +/* Disable some links to root actions */
    8.39 +.light.user [data-root] { color: #999 !important; }
    8.40 +.dark.user  [data-root] { color: #666 !important; }
    8.41 +.dark.user  [data-root]:before {
    8.42 +	color: #666 !important; background: transparent; -webkit-text-fill-color: #666; }
     9.1 --- a/test.cgi	Mon Apr 06 22:36:56 2015 +0200
     9.2 +++ b/test.cgi	Tue Apr 07 00:27:17 2015 +0300
     9.3 @@ -17,7 +17,7 @@
     9.4  cat <<EOT
     9.5  
     9.6  <section>
     9.7 -	<header data-icon="info">Buttons with font icons</header>
     9.8 +	<header><span data-img="info"></span>Buttons with font icons</header>
     9.9  <!--
    9.10  --><button data-icon="add"        >Add        </button><button data-icon="admin"   >Admin   </button><!--
    9.11  --><button data-icon="back"       >Back       </button><button data-icon="battery" >Battery </button><!--
    9.12 @@ -56,7 +56,7 @@
    9.13  
    9.14  
    9.15  <section>
    9.16 -	<header data-icon="link">Links with font icons</header>
    9.17 +	<header><span data-img="link"></span>Links with font icons</header>
    9.18  	<div>
    9.19  <p>
    9.20  <a data-icon="add"        >Add        </a> <a data-icon="admin"     >Admin     </a> <a data-icon="back"     >Back     </a>
    9.21 @@ -87,17 +87,17 @@
    9.22  
    9.23  
    9.24  <section>
    9.25 -	<header data-icon="view">Links with font icons only (small buttons)</header>
    9.26 +	<header><span data-img="view"></span>Links with font icons only (small buttons)</header>
    9.27  	<p>
    9.28  <a data-img="conf"   href="#"></a>Conf   <a data-img="help" href="#"></a>Help <a data-img="man"  href="#"></a>Man
    9.29  <a data-img="off"    href="#"></a>Off    <a data-img="on"   href="#"></a>On   <a data-img="opt"  href="#"></a>Opt
    9.30  <a data-img="remove" href="#"></a>Remove <a data-img="run"  href="#"></a>Run  <a data-img="stop" href="#"></a>Stop
    9.31 -<a data-img="web"    href="#"></a>Web
    9.32 +<a data-img="web"    href="#"></a>Web    <a data-img="slitaz" href="#"></a>SliTaz <a data-img="user" href="#"></a>User
    9.33  </p>
    9.34  </section>
    9.35  
    9.36  <section>
    9.37 -	<header data-icon="check">User input elements</header>
    9.38 +	<header><span data-img="check"></span>User input elements</header>
    9.39  	<div><form>
    9.40  	<table>
    9.41  		<tr><td>Text:</td>