tazpanel rev 191

Add a small terminal emulator (wih wget support to upload file on remote machine)
author Christophe Lincoln <pankso@slitaz.org>
date Fri Jun 10 21:40:07 2011 +0200 (2011-06-10)
parents dbb91ac456b7
children c5bce38bdb32
files index.cgi styles/default/images/terminal.png styles/default/style.css
line diff
     1.1 --- a/index.cgi	Fri Jun 10 20:58:58 2011 +0200
     1.2 +++ b/index.cgi	Fri Jun 10 21:40:07 2011 +0200
     1.3 @@ -102,6 +102,38 @@
     1.4  			esac < $file
     1.5  			echo '</pre>'
     1.6  		fi ;;
     1.7 +	*\ terminal\ *|*\ cmd\ *)
     1.8 +		# Cmdline terminal.
     1.9 +		commands='du help ls ping pwd who wget'
    1.10 +		cmd=$(GET cmd)
    1.11 +		TITLE="- $(gettext "Terminal")"
    1.12 +		xhtml_header
    1.13 +		cat << EOT
    1.14 +<form method="get" action="$SCRIPT_NAME">
    1.15 +	<div class="box">
    1.16 +		root@$(hostname):~# <input type="text" name="cmd" style="width: 80%;" />
    1.17 +	</div>
    1.18 +</form>
    1.19 +EOT
    1.20 +	echo '<pre id="terminal">'
    1.21 +	# Allow only a few commands for the moment.
    1.22 +	case "$cmd" in
    1.23 +		usage|help)
    1.24 +			gettext -e "Small terminal emulator, commands options are supported.\n"
    1.25 +			gettext "Commands:"; echo " $commands" ;;
    1.26 +		wget*)
    1.27 +			dl=/var/cache/downloads
    1.28 +			[ ! -d "$dl" ] && mkdir -p $dl
    1.29 +			gettext "Downloading to:"; echo " $dl"
    1.30 +			cd $dl && $cmd ;;
    1.31 +		du*|ls*|ping*|pwd|who)
    1.32 +			$cmd ;;
    1.33 +		*)
    1.34 +			[ "$cmd" == "" ] || \
    1.35 +				gettext "Unknow command: $cmd"
    1.36 +			gettext "Commands:"; echo " $commands" ;;
    1.37 +	esac
    1.38 +	echo '</pre>' ;;
    1.39  	*\ top\ *)
    1.40  		TITLE="- $(gettext "Process activity")"
    1.41  		xhtml_header
    1.42 @@ -254,6 +286,8 @@
    1.43  	<p>$(gettext "SliTaz administration and configuration Panel")<p>
    1.44  </div>
    1.45  <div id="actions">
    1.46 +	<a class="button" href="$SCRIPT_NAME?terminal">
    1.47 +		<img src="$IMAGES/terminal.png" />$(gettext "Terminal")</a>
    1.48  	<a class="button" href="$SCRIPT_NAME?top">
    1.49  		<img src="$IMAGES/monitor.png" />$(gettext "Process activity")</a>
    1.50  	<a class="button" href="$SCRIPT_NAME?report">
     2.1 Binary file styles/default/images/terminal.png has changed
     3.1 --- a/styles/default/style.css	Fri Jun 10 20:58:58 2011 +0200
     3.2 +++ b/styles/default/style.css	Fri Jun 10 21:40:07 2011 +0200
     3.3 @@ -56,16 +56,16 @@
     3.4  #icons img { padding: 0; }
     3.5  
     3.6  #loading {
     3.7 -  /* font-weight: bold; */
     3.8 -  background-color: #f8f8f8;
     3.9 -  border: 1px solid #ddd;
    3.10 -  color: #666;
    3.11 -  cursor: progress;
    3.12 -  position: fixed;
    3.13 -  top: 92px;
    3.14 -  right: 120px;
    3.15 -  width: 248px;
    3.16 -  padding: 4px 4px 2px;
    3.17 +	/* font-weight: bold; */
    3.18 +	background-color: #f8f8f8;
    3.19 +	border: 1px solid #ddd;
    3.20 +	color: #666;
    3.21 +	cursor: progress;
    3.22 +	position: fixed;
    3.23 +	top: 92px;
    3.24 +	right: 120px;
    3.25 +	width: 248px;
    3.26 +	padding: 4px 4px 2px;
    3.27  }
    3.28  
    3.29  /* Blocks */
    3.30 @@ -236,6 +236,14 @@
    3.31  	border: 1px solid #ddd; }
    3.32  div.scroll table { border: 0px solid #fff; }
    3.33  
    3.34 +#terminal {
    3.35 +	background: #000;
    3.36 +	color: #fff;
    3.37 +	border: 1px solid #444;
    3.38 +	min-height: 180px;
    3.39 +	opacity: 0.8;
    3.40 +}
    3.41 +
    3.42  /* Round corner */
    3.43  
    3.44  #loading, table, pre, input[type=submit], .debug, .box,