tazpanel diff hardware.cgi @ rev 456

boot.cgi: ISO mine: "table"izing input form.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Mon Apr 13 01:44:08 2015 +0300 (2015-04-13)
parents b0146d791379
children aa42490e9679
line diff
     1.1 --- a/hardware.cgi	Tue Apr 07 00:27:17 2015 +0300
     1.2 +++ b/hardware.cgi	Mon Apr 13 01:44:08 2015 +0300
     1.3 @@ -10,7 +10,7 @@
     1.4  get_config
     1.5  header
     1.6  
     1.7 -TITLE=$(gettext 'TazPanel - Hardware')
     1.8 +TITLE=$(_ 'TazPanel - Hardware')
     1.9  
    1.10  # Call an optional module
    1.11  lib() {
    1.12 @@ -32,10 +32,10 @@
    1.13  <table class="wide zebra">
    1.14  	<thead>
    1.15  		<tr>
    1.16 -			<td>$(gettext 'Bus')</td>
    1.17 -			<td>$(gettext 'Device')</td>
    1.18 -			<td>$(gettext 'ID')</td>
    1.19 -			<td>$(gettext 'Name')</td>
    1.20 +			<td>$(_ 'Bus')</td>
    1.21 +			<td>$(_ 'Device')</td>
    1.22 +			<td>$(_ 'ID')</td>
    1.23 +			<td>$(_ 'Name')</td>
    1.24  		</tr>
    1.25  	</thead>
    1.26  <tbody>
    1.27 @@ -87,8 +87,8 @@
    1.28  		# TODO: Add button to detect webcam, etc. Like in tazhw box.
    1.29  		xhtml_header
    1.30  		cat <<EOT
    1.31 -<h2>$(gettext 'Detect hardware')</h2>
    1.32 -<p>$(gettext 'Detect PCI and USB hardware')</p>
    1.33 +<h2>$(_ 'Detect hardware')</h2>
    1.34 +<p>$(_ 'Detect PCI and USB hardware')</p>
    1.35  
    1.36  <section>
    1.37  	<pre>$(tazhw detect-pci | sed 's|^>|\&gt;|g')</pre>
    1.38 @@ -101,13 +101,12 @@
    1.39  	*\ modules\ *|*\ modinfo\ *)
    1.40  		xhtml_header
    1.41  		cat <<EOT
    1.42 -<h2>$(gettext 'Kernel modules')</h2>
    1.43 +<h2>$(_ 'Kernel modules')</h2>
    1.44 +<p>$(_ 'Manage, search or get information about the Linux kernel modules')</p>
    1.45  
    1.46 -<form id="actions">
    1.47 +<form>
    1.48  	<input type="hidden" name="modules"/>
    1.49 -	$(gettext 'Manage, search or get information about the Linux kernel modules')
    1.50 -
    1.51 -	<input type="search" name="search" class="float-right" placeholder="$(gettext 'Modules search')" results="5" autosave="modsearch" autocomplete="on"/>
    1.52 +	<input type="search" name="search" class="float-right" placeholder="$(_ 'Modules search')" results="5" autosave="modsearch" autocomplete="on"/>
    1.53  </form>
    1.54  EOT
    1.55  		# Request may be modinfo output that we want in the page itself
    1.56 @@ -115,7 +114,7 @@
    1.57  		if [ -n "$get_modinfo" ]; then
    1.58  			cat <<EOT
    1.59  <section>
    1.60 -	<header>$(eval_gettext 'Detailed information for module: $get_modinfo')</header>
    1.61 +	<header>$(_ 'Detailed information for module: %s' $get_modinfo)</header>
    1.62  
    1.63  EOT
    1.64  		modinfo $get_modinfo | awk 'BEGIN{print "<table class=\"wide zebra\">"}
    1.65 @@ -135,13 +134,13 @@
    1.66  		fi
    1.67  		get_search="$(GET search)"
    1.68  		if [ -n "$get_search" ]; then
    1.69 -			eval_gettext 'Matching result(s) for: $get_search'
    1.70 +			_ 'Matching result(s) for: %s' $get_search
    1.71  			echo '<pre>'
    1.72  			modprobe -l | grep "$(GET search)" | while read line
    1.73  			do
    1.74  				name=$(basename $line)
    1.75  				mod=${name%.ko.gz}
    1.76 -				echo "$(gettext 'Module:') <a href='?modinfo=$mod'>$mod</a>"
    1.77 +				echo "$(_ 'Module:') <a href='?modinfo=$mod'>$mod</a>"
    1.78  			done
    1.79  			echo '</pre>'
    1.80  		fi
    1.81 @@ -150,11 +149,11 @@
    1.82  	<table class="zebra">
    1.83  		<thead>
    1.84  			<tr>
    1.85 -				<td>$(gettext 'Module')</td>
    1.86 -				<td>$(gettext 'Description')</td>
    1.87 -				<td>$(gettext 'Size')</td>
    1.88 -				<td>$(gettext 'Used')</td>
    1.89 -				<td>$(gettext 'by')</td>
    1.90 +				<td>$(_ 'Module')</td>
    1.91 +				<td>$(_ 'Description')</td>
    1.92 +				<td>$(_ 'Size')</td>
    1.93 +				<td>$(_ 'Used')</td>
    1.94 +				<td>$(_ 'by')</td>
    1.95  			</tr>
    1.96  		<thead>
    1.97  		<tbody>
    1.98 @@ -178,9 +177,9 @@
    1.99  		xhtml_header
   1.100  		vidpid="$(GET lsusb)"
   1.101  		cat <<EOT
   1.102 -<h2>$(eval_gettext 'Information for USB Device $vidpid')</h2>
   1.103 +<h2>$(_ 'Information for USB Device %s' $vidpid)</h2>
   1.104  
   1.105 -<p>$(gettext 'Detailed information about specified device.')</p>
   1.106 +<p>$(_ 'Detailed information about specified device.')</p>
   1.107  
   1.108  <section>$(lsusb_table)</section>
   1.109  EOT
   1.110 @@ -196,9 +195,9 @@
   1.111  		xhtml_header
   1.112  		slot="$(GET lspci)"
   1.113  		cat <<EOT
   1.114 -<h2>$(eval_gettext 'Information for PCI Device $slot')</h2>
   1.115 +<h2>$(_ 'Information for PCI Device %s' $slot)</h2>
   1.116  
   1.117 -<p>$(gettext 'Detailed information about specified device.')</p>
   1.118 +<p>$(_ 'Detailed information about specified device.')</p>
   1.119  
   1.120  <section>$(lspci_table)</section>
   1.121  EOT
   1.122 @@ -219,13 +218,13 @@
   1.123  		#
   1.124  		xhtml_header
   1.125  		cat <<EOT
   1.126 -<h2>$(gettext 'Drivers &amp; Devices')</h2>
   1.127 -<p>$(gettext 'Manage your computer hardware')</p>
   1.128 +<h2>$(_ 'Drivers &amp; Devices')</h2>
   1.129 +<p>$(_ 'Manage your computer hardware')</p>
   1.130  
   1.131  <form><!--
   1.132 -	--><button name="modules" data-icon="modules">$(gettext 'Kernel modules')</button><!--
   1.133 -	--><button name="detect"  data-icon="detect" data-root>$(gettext 'Detect PCI/USB')</button><!--
   1.134 -	--><button name="tazx"    data-icon="tazx"   data-root>$(gettext 'Auto-install Xorg video driver')</button><!--
   1.135 +	--><button name="modules" data-icon="modules">$(_ 'Kernel modules')</button><!--
   1.136 +	--><button name="detect"  data-icon="detect" data-root>$(_ 'Detect PCI/USB')</button><!--
   1.137 +	--><button name="tazx"    data-icon="tazx"   data-root>$(_ 'Auto-install Xorg video driver')</button><!--
   1.138  --></form>
   1.139  
   1.140  EOT
   1.141 @@ -235,7 +234,7 @@
   1.142  		if [ -n "$(ls /proc/acpi/battery/*/info 2>/dev/null)" ]; then
   1.143  			cat <<EOT
   1.144  <section>
   1.145 -	<header>$(gettext 'Battery')</header>
   1.146 +	<header>$(_ 'Battery')</header>
   1.147  	<div>
   1.148  		<table class="wide">
   1.149  EOT
   1.150 @@ -252,10 +251,10 @@
   1.151  				rempct=$(( $remain * 100 / $full ))
   1.152  				cat <<EOT
   1.153  			<tr>
   1.154 -				<td><span data-icon="battery">$(gettext 'Battery')</span>
   1.155 +				<td><span data-icon="battery">$(_ 'Battery')</span>
   1.156  					$(grep "^battery type" $dev/info | sed 's/.*: *//')
   1.157  					$(grep "^design capacity:" $dev/info | sed 's/.*: *//') </td>
   1.158 -				<td>$(gettext 'health') $(( (100*$full)/$design))%</td>
   1.159 +				<td>$(_ 'health') $(( (100*$full)/$design))%</td>
   1.160  				<td class="meter"><meter min="0" max="$full" value="$remain" low="$low"
   1.161  					high="$warning" optimum="$full"></meter>
   1.162  					<span>
   1.163 @@ -264,13 +263,13 @@
   1.164  				"discharging")
   1.165  					remtime=$(( $remain * 60 / $rate ))
   1.166  					remtimef=$(printf "%d:%02d" $(($remtime/60)) $(($remtime%60)))
   1.167 -					eval_gettext 'Discharging $rempct% - $remtimef' ;;
   1.168 +					_ 'Discharging %d%% - %s' $rempct $remtimef ;;
   1.169  				"charging")
   1.170  					remtime=$(( ($full - $remain) * 60 / $rate ))
   1.171  					remtimef=$(printf "%d:%02d" $(($remtime/60)) $(($remtime%60)))
   1.172 -					eval_gettext 'Charging $rempct% - $remtimef' ;;
   1.173 +					eval_gettext 'Charging %d%% - %s' $rempct $remtimef ;;
   1.174  				"charged")
   1.175 -					gettext 'Charged 100%' ;;
   1.176 +					_ 'Charged 100%' ;;
   1.177  				esac
   1.178  				cat <<EOT
   1.179  
   1.180 @@ -289,7 +288,7 @@
   1.181  
   1.182  		# Thermal sensors
   1.183  		if [ -n "$(ls /sys/devices/virtual/thermal/*/temp 2>/dev/null)" ]; then
   1.184 -			echo "<p><span data-icon=\"temperature\">$(gettext 'Temperature:')</span>"
   1.185 +			echo "<p><span data-icon=\"temperature\">$(_ 'Temperature:')</span>"
   1.186  			for temp in /sys/devices/virtual/thermal/*/temp; do
   1.187  				awk '{ print $1/1000 "℃" }' < $temp
   1.188  			done
   1.189 @@ -304,7 +303,7 @@
   1.190  				name=$(echo $dev | sed 's|.*/backlight/\([^/]*\).*|\1|')
   1.191  				cat <<EOT
   1.192  <input type="hidden" name="dev" value="$name"/>
   1.193 -<span data-icon="brightness">$(gettext 'Brightness')</span> \
   1.194 +<span data-icon="brightness">$(_ 'Brightness')</span> \
   1.195  $(sed 's/.*\.//;s/_*$//' < /sys/devices/virtual/backlight/$name/device/path):
   1.196  <select name="brightness" onchange="submit();">
   1.197  EOT
   1.198 @@ -324,7 +323,7 @@
   1.199  		cat <<EOT
   1.200  <section>
   1.201  	<form action="#mount" class="wide">
   1.202 -		<header id="disk">$(gettext 'Filesystem usage statistics')</header>
   1.203 +		<header id="disk">$(_ 'Filesystem usage statistics')</header>
   1.204  		<div>
   1.205  			<pre>$(disk_info)</pre>
   1.206  		</div>
   1.207 @@ -444,8 +443,8 @@
   1.208  
   1.209  		<footer>
   1.210  			<button type="submit">mount / umount</button> -
   1.211 -			$(gettext 'new mount point:') <input type="text" name="mountpoint" value="/media/usbdisk"/> -
   1.212 -			<input type="checkbox" name="readonly" id="ro"><label for="ro">&thinsp;$(gettext 'read-only')</label>
   1.213 +			$(_ 'new mount point:') <input type="text" name="mountpoint" value="/media/usbdisk"/> -
   1.214 +			<input type="checkbox" name="readonly" id="ro"><label for="ro">&thinsp;$(_ 'read-only')</label>
   1.215  		</footer>
   1.216  EOT
   1.217  		cat <<EOT
   1.218 @@ -460,12 +459,12 @@
   1.219  		cat <<EOT
   1.220  <section>
   1.221  	<header>
   1.222 -		$(gettext 'Filesystems table')
   1.223 +		$(_ 'Filesystems table')
   1.224  EOT
   1.225  		[ -w /etc/fstab ] && cat <<EOT
   1.226  		<form action="index.cgi">
   1.227  			<input type="hidden" name="file" value="/etc/fstab"/>
   1.228 -			<button name="action" value="edit" data-icon="edit">$(gettext 'Edit')</button>
   1.229 +			<button name="action" value="edit" data-icon="edit">$(_ 'Edit')</button>
   1.230  		</form>
   1.231  EOT
   1.232  		cat <<EOT
   1.233 @@ -473,12 +472,12 @@
   1.234  	<table class="wide zebra center">
   1.235  		<thead>
   1.236  			<tr>
   1.237 -				<td>$(gettext 'Disk')</td>
   1.238 -				<td>$(gettext 'Mount point')</td>
   1.239 -				<td>$(gettext 'Type')</td>
   1.240 -				<td>$(gettext 'Options')</td>
   1.241 -				<td>$(gettext 'Freq')</td>
   1.242 -				<td>$(gettext 'Pass')</td>
   1.243 +				<td>$(_ 'Disk')</td>
   1.244 +				<td>$(_ 'Mount point')</td>
   1.245 +				<td>$(_ 'Type')</td>
   1.246 +				<td>$(_ 'Options')</td>
   1.247 +				<td>$(_ 'Freq')</td>
   1.248 +				<td>$(_ 'Pass')</td>
   1.249  			</tr>
   1.250  		</thead>
   1.251  		<tbody>
   1.252 @@ -500,17 +499,17 @@
   1.253  		#
   1.254  		cat <<EOT
   1.255  <section>
   1.256 -	<header>$(gettext 'Loop devices')</header>
   1.257 +	<header>$(_ 'Loop devices')</header>
   1.258  
   1.259  	<form action="#loop" class="wide">
   1.260  	<div class="scroll">
   1.261  		<table id="loop" class="wide zebra scroll">
   1.262  			<thead>
   1.263  				<tr>
   1.264 -					<td>$(gettext 'Device')</td>
   1.265 -					<td>$(gettext 'Backing file')</td>
   1.266 -					<td>$(gettext 'Access')</td>
   1.267 -					<td>$(gettext 'Offset')</td>
   1.268 +					<td>$(_ 'Device')</td>
   1.269 +					<td>$(_ 'Backing file')</td>
   1.270 +					<td>$(_ 'Access')</td>
   1.271 +					<td>$(_ 'Offset')</td>
   1.272  				</tr>
   1.273  			</thead>
   1.274  			<tbody>
   1.275 @@ -518,8 +517,8 @@
   1.276  for devloop in $(ls /dev/*loop[0-9]*); do
   1.277  	loop="${devloop#/dev/}"
   1.278  	case "$(cat /sys/block/$loop/ro 2>/dev/null)" in
   1.279 -	0) ro="$(gettext "read/write")" ;;
   1.280 -	1) ro="$(gettext "read only")" ;;
   1.281 +	0) ro="$(_ "read/write")" ;;
   1.282 +	1) ro="$(_ "read only")" ;;
   1.283  	*) ro="" ;;
   1.284  	esac
   1.285  	set -- $(losetup | grep ^$devloop:) ${ro// /&nbsp;}
   1.286 @@ -538,10 +537,10 @@
   1.287  $(lib crypto input)
   1.288  
   1.289  		<footer>
   1.290 -			<button type="submit" data-icon="ok">$(gettext 'Setup')</button> -
   1.291 -			$(gettext 'new backing file:') <input type="text" name="backingfile"/> -
   1.292 -			$(gettext 'offset in bytes:') <input type="text" name="offset" value="0" size="8"/> -
   1.293 -			<input type="checkbox" name="readonly" id="ro"/><label for="ro">$(gettext 'read only')</label>
   1.294 +			<button type="submit" data-icon="ok">$(_ 'Setup')</button> -
   1.295 +			$(_ 'new backing file:') <input type="text" name="backingfile"/> -
   1.296 +			$(_ 'offset in bytes:') <input type="text" name="offset" value="0" size="8"/> -
   1.297 +			<input type="checkbox" name="readonly" id="ro"/><label for="ro">$(_ 'read only')</label>
   1.298  		</footer>
   1.299  	</form>
   1.300  </section>
   1.301 @@ -558,16 +557,16 @@
   1.302  
   1.303  		cat <<EOT
   1.304  <section>
   1.305 -	<header>$(gettext 'System memory')</header>
   1.306 +	<header>$(_ 'System memory')</header>
   1.307  
   1.308  	<div class="sysmem"><!--
   1.309 -		--><span class="sysmem_used" style="width: ${mem_used}%" title="$(gettext 'Used')"   ><span>${mem_used}%</span></span><!--
   1.310 +		--><span class="sysmem_used" style="width: ${mem_used}%" title="$(_ 'Used')"   ><span>${mem_used}%</span></span><!--
   1.311  EOT
   1.312  		[ $mem_buff != 0 ] && cat <<EOT
   1.313 -		--><span class="sysmem_buff" style="width: ${mem_buff}%" title="$(gettext 'Buffers')"><span>${mem_buff}%</span></span><!--
   1.314 +		--><span class="sysmem_buff" style="width: ${mem_buff}%" title="$(_ 'Buffers')"><span>${mem_buff}%</span></span><!--
   1.315  EOT
   1.316  		cat <<EOT
   1.317 -		--><span class="sysmem_free" style="width: ${mem_free}%" title="$(gettext 'Free')"   ><span>${mem_free}%</span></span><!--
   1.318 +		--><span class="sysmem_free" style="width: ${mem_free}%" title="$(_ 'Free')"   ><span>${mem_free}%</span></span><!--
   1.319  	--></div>
   1.320  
   1.321  	<table class="wide zebra center">