tazpanel diff hardware.cgi @ rev 426

Code cleaning; add icons for packages and "toggle" to tazpanel.ttf; merge checkbox.js with tazpanel.js.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Fri Mar 27 14:28:32 2015 +0200 (2015-03-27)
parents d6586247420a
children f377f6c7e32e
line diff
     1.1 --- a/hardware.cgi	Wed Mar 25 18:48:01 2015 +0100
     1.2 +++ b/hardware.cgi	Fri Mar 27 14:28:32 2015 +0200
     1.3 @@ -13,19 +13,24 @@
     1.4  TITLE=$(gettext 'TazPanel - Hardware')
     1.5  
     1.6  # Call an optional module
     1.7 -lib()
     1.8 -{
     1.9 +lib() {
    1.10  	module=lib/$1
    1.11  	shift
    1.12  	[ -s $module ] && . $module "$@"
    1.13  }
    1.14  
    1.15  
    1.16 -lsusb_table()
    1.17 -{
    1.18 +lsusb_table() {
    1.19  	cat <<EOT
    1.20  <table class="wide zebra">
    1.21 -<thead><tr><td>Bus</td><td>Device</td><td>ID</td><td>Name</td></thead>
    1.22 +	<thead>
    1.23 +		<tr>
    1.24 +			<td>$(gettext 'Bus')</td>
    1.25 +			<td>$(gettext 'Device')</td>
    1.26 +			<td>$(gettext 'ID')</td>
    1.27 +			<td>$(gettext 'Name')</td>
    1.28 +		</tr>
    1.29 +	</thead>
    1.30  <tbody>
    1.31  EOT
    1.32  	lsusb | sed 's|^Bus \([0-9]*\)|<tr><td>\1</td>|;
    1.33 @@ -37,8 +42,7 @@
    1.34  }
    1.35  
    1.36  
    1.37 -lspci_table()
    1.38 -{
    1.39 +lspci_table() {
    1.40  	cat <<EOT
    1.41  <table class="wide zebra">
    1.42  <thead><tr><td>Slot</td><td>Device</td><td>Name</td></thead>
    1.43 @@ -51,6 +55,7 @@
    1.44  	echo "</tbody></table>"
    1.45  }
    1.46  
    1.47 +
    1.48  #
    1.49  # Commands
    1.50  #
    1.51 @@ -79,10 +84,8 @@
    1.52  <p>$(gettext 'Detect PCI and USB hardware')</p>
    1.53  
    1.54  <section>
    1.55 -	<div>
    1.56 -		<pre>$(tazhw detect-pci | sed 's|^>|\&gt;|g')</pre>
    1.57 -		<pre>$(tazhw detect-usb | sed 's|^>|\&gt;|g')</pre>
    1.58 -	</div>
    1.59 +	<pre>$(tazhw detect-pci | sed 's|^>|\&gt;|g')</pre>
    1.60 +	<pre>$(tazhw detect-usb | sed 's|^>|\&gt;|g')</pre>
    1.61  </section>
    1.62  EOT
    1.63  		;;
    1.64 @@ -137,7 +140,7 @@
    1.65  		fi
    1.66  		cat <<EOT
    1.67  <section>
    1.68 -	<table class="zebra borders hborders">
    1.69 +	<table class="zebra">
    1.70  		<thead>
    1.71  			<tr>
    1.72  				<td>$(gettext 'Module')</td>
    1.73 @@ -173,11 +176,10 @@
    1.74  <p>$(gettext 'Detailed information about specified device.')</p>
    1.75  
    1.76  <section>$(lsusb_table)</section>
    1.77 -
    1.78 +EOT
    1.79 +		[ "$vidpid" != 'lsusb' ] && cat <<EOT
    1.80  <section>
    1.81 -	<div>
    1.82 -		<pre style="white-space: pre-wrap">$(lsusb -vd $vidpid | syntax_highlighter lsusb)</pre>
    1.83 -	</div>
    1.84 +	<pre style="white-space: pre-wrap">$(lsusb -vd $vidpid | syntax_highlighter lsusb)</pre>
    1.85  </section>
    1.86  EOT
    1.87  		;;
    1.88 @@ -192,11 +194,10 @@
    1.89  <p>$(gettext 'Detailed information about specified device.')</p>
    1.90  
    1.91  <section>$(lspci_table)</section>
    1.92 -
    1.93 +EOT
    1.94 +		[ "$slot" != 'lspci' ] && cat <<EOT
    1.95  <section>
    1.96 -	<div>
    1.97 -		<pre style="white-space: pre-wrap">$(lspci -vs $slot | syntax_highlighter lspci)</pre>
    1.98 -	</div>
    1.99 +	<pre style="white-space: pre-wrap">$(lspci -vs $slot | syntax_highlighter lspci)</pre>
   1.100  </section>
   1.101  EOT
   1.102  		;;
   1.103 @@ -204,7 +205,7 @@
   1.104  
   1.105  	*)
   1.106  		[ -n "$(GET brightness)" ] &&
   1.107 -		echo -n $(GET brightness) > /sys/devices/virtual/backlight/$(GET dev)/brightness
   1.108 +			echo -n $(GET brightness) > /sys/devices/virtual/backlight/$(GET dev)/brightness
   1.109  
   1.110  		#
   1.111  		# Default to summary with mounted filesystem, loaded modules
   1.112 @@ -360,8 +361,7 @@
   1.113  EOT
   1.114  		df_thead
   1.115  		echo '<tbody>'
   1.116 -		for fs in $(blkid | sort | sed 's/:.*//')
   1.117 -		do
   1.118 +		for fs in $(blkid | sort | sed 's/:.*//'); do
   1.119  			set -- $(df -h | grep "^$fs ")
   1.120  			size=$2
   1.121  			used=$3
   1.122 @@ -448,7 +448,13 @@
   1.123  		#
   1.124  		cat <<EOT
   1.125  <section>
   1.126 -	<header>$(gettext 'Filesystems table')</header>
   1.127 +	<header>
   1.128 +		$(gettext 'Filesystems table')
   1.129 +		<form action="index.cgi">
   1.130 +			<input type="hidden" name="file" value="/etc/fstab"/>
   1.131 +			<button name="action" value="edit" data-icon="edit">$(gettext 'Edit')</button>
   1.132 +		</form>
   1.133 +	</header>
   1.134  	<table class="wide zebra center">
   1.135  		<thead>
   1.136  			<tr>
   1.137 @@ -470,12 +476,6 @@
   1.138  	END{print "</tbody></table>"}'
   1.139  
   1.140  		cat <<EOT
   1.141 -	<footer>
   1.142 -		<form action="index.cgi">
   1.143 -			<input type="hidden" name="file" value="/etc/fstab"/>
   1.144 -			<button name="action" value="edit" data-icon="edit">$(gettext 'Edit')</button>
   1.145 -		</form>
   1.146 -	</footer>
   1.147  </section>
   1.148  EOT
   1.149