tazpanel rev 40

Move network shared function (used by summary) to libtazpanel and include libtazpanel in POT file
author Christophe Lincoln <pankso@slitaz.org>
date Wed Apr 06 06:17:23 2011 +0200 (2011-04-06)
parents 5f2f88618292
children 167a97495e1c
files Makefile README index.cgi lib/libtazpanel po/tazpanel.pot styles/default/header.html
line diff
     1.1 --- a/Makefile	Wed Apr 06 06:09:34 2011 +0200
     1.2 +++ b/Makefile	Wed Apr 06 06:17:23 2011 +0200
     1.3 @@ -14,7 +14,8 @@
     1.4  	xgettext -o po/tazpanel.pot -L Shell \
     1.5  		--package-name="TazPanel" \
     1.6  		--package-version="$(VERSION)" \
     1.7 -		./tazpanel ./index.cgi ./pkgs.cgi ./live.cgi ./network.cgi
     1.8 +		./tazpanel ./index.cgi ./pkgs.cgi ./live.cgi \
     1.9 +		./network.cgi ./lib/libtazpanel
    1.10  
    1.11  msgmerge:
    1.12  	@for l in $(LINGUAS); do \
     2.1 --- a/README	Wed Apr 06 06:09:34 2011 +0200
     2.2 +++ b/README	Wed Apr 06 06:17:23 2011 +0200
     2.3 @@ -11,7 +11,7 @@
     2.4  ----
     2.5  TazPanel have been coded from the beginning with gettext support. Please
     2.6  forget 'echo' and use gettext, but remember that gettext "" is equivalent
     2.7 -to echo -n. Each script have it own TEXTDOMAIN and pot files as well, all
     2.8 +to echo -n. All script use the same TEXTDOMAIN and the same pot files, all
     2.9  translations goes in the po/ folder. To start a new translation please
    2.10  use msginit from the pot file directory. Example for French/France
    2.11  locale (fr_FR):
     3.1 --- a/index.cgi	Wed Apr 06 06:09:34 2011 +0200
     3.2 +++ b/index.cgi	Wed Apr 06 06:17:23 2011 +0200
     3.3 @@ -18,48 +18,6 @@
     3.4  TEXTDOMAIN='tazpanel'
     3.5  export TEXTDOMAIN
     3.6  
     3.7 -# Network interface status
     3.8 -interface_status() {
     3.9 -	if 	ifconfig | grep -A 1 $i | grep -q inet; then
    3.10 -		ip=`ifconfig | grep -A 1 $i | grep inet | \
    3.11 -			awk '{ print $2 }' | cut -d ":" -f 2`
    3.12 -		echo "<td>connected</td><td>$ip</td>"
    3.13 -	else
    3.14 -		echo "<td>----</td><td>----</td>"
    3.15 -	fi
    3.16 -}
    3.17 -
    3.18 -# Catch network interface (network is splited this function and above
    3.19 -# must go in lib/libtazpanel
    3.20 -list_network_interfaces() {
    3.21 -	table_start
    3.22 -	cat << EOT
    3.23 -<tr id="thead">
    3.24 -	<td>`gettext "Interface"`</td>
    3.25 -	<td>`gettext "Name"`</td>
    3.26 -	<td>`gettext "Status"`</td>
    3.27 -	<td>`gettext "IP Address"`</td>
    3.28 -</tr>
    3.29 -EOT
    3.30 -	for i in `ls /sys/class/net`
    3.31 -	do
    3.32 -		case $i in
    3.33 -			eth*)
    3.34 -				echo "<tr><td><img src='$IMAGES/ethernet.png' />$i</td>
    3.35 -					<td>Ethernet</td> `interface_status`</tr>" ;;
    3.36 -			wlan*|ath*|ra*)
    3.37 -				echo "<tr><td><img src='$IMAGES/wireless.png' />$i</td>
    3.38 -					<td>Wireless</td> `interface_status`</tr>" ;;
    3.39 -			lo)
    3.40 -				echo "<tr><td><img src='$IMAGES/loopback.png' />$i</td>
    3.41 -				<td>Loopback</td> `interface_status`</tr>" ;;
    3.42 -			*)
    3.43 -				continue ;;
    3.44 -		esac
    3.45 -	done
    3.46 -	table_end
    3.47 -}
    3.48 -
    3.49  #
    3.50  # Commands
    3.51  #
    3.52 @@ -174,26 +132,6 @@
    3.53  </form>
    3.54  EOT
    3.55  		;;
    3.56 -	network)
    3.57 -		#
    3.58 -		# Network configuration
    3.59 -		#
    3.60 -		TITLE="- Network"
    3.61 -		xhtml_header
    3.62 -		cat << EOT
    3.63 -<div id="wrapper">
    3.64 -	<h2>`gettext "Networking`</h2>
    3.65 -	<p>`gettext "Manage network connection and services`</p>
    3.66 -</div>
    3.67 -
    3.68 -`list_network_interfaces`
    3.69 -
    3.70 -<h3>Output of: ifconfig -a</h3>
    3.71 -<pre>
    3.72 -`ifconfig -a`
    3.73 -</pre>
    3.74 -EOT
    3.75 -		;;
    3.76  	hardware)
    3.77  		#
    3.78  		# Hardware drivers, devices, filesystem, screen
     4.1 --- a/lib/libtazpanel	Wed Apr 06 06:09:34 2011 +0200
     4.2 +++ b/lib/libtazpanel	Wed Apr 06 06:17:23 2011 +0200
     4.3 @@ -3,6 +3,13 @@
     4.4  # Common functions for TazPanel CGI and cmdline interface
     4.5  #
     4.6  
     4.7 +# Include gettext helper script.
     4.8 +. /usr/bin/gettext.sh
     4.9 +
    4.10 +# Export package name for gettext.
    4.11 +TEXTDOMAIN='tazpanel'
    4.12 +export TEXTDOMAIN
    4.13 +
    4.14  # We need a config file first
    4.15  get_config() {
    4.16  	CONFIG="/etc/slitaz/tazpanel.conf"
    4.17 @@ -13,6 +20,47 @@
    4.18  		exit 1
    4.19  }
    4.20  
    4.21 +# Network interface status
    4.22 +interface_status() {
    4.23 +	if 	ifconfig | grep -A 1 $i | grep -q inet; then
    4.24 +		ip=`ifconfig | grep -A 1 $i | grep inet | \
    4.25 +			awk '{ print $2 }' | cut -d ":" -f 2`
    4.26 +		echo "<td>connected</td><td>$ip</td>"
    4.27 +	else
    4.28 +		echo "<td>----</td><td>----</td>"
    4.29 +	fi
    4.30 +}
    4.31 +
    4.32 +# Catch network interface (used in summary and network main page)
    4.33 +list_network_interfaces() {
    4.34 +	table_start
    4.35 +	cat << EOT
    4.36 +<tr id="thead">
    4.37 +	<td>`gettext "Interface"`</td>
    4.38 +	<td>`gettext "Name"`</td>
    4.39 +	<td>`gettext "Status"`</td>
    4.40 +	<td>`gettext "IP Address"`</td>
    4.41 +</tr>
    4.42 +EOT
    4.43 +	for i in `ls /sys/class/net`
    4.44 +	do
    4.45 +		case $i in
    4.46 +			eth*)
    4.47 +				echo "<tr><td><img src='$IMAGES/ethernet.png' />$i</td>
    4.48 +					<td>Ethernet</td> `interface_status`</tr>" ;;
    4.49 +			wlan*|ath*|ra*)
    4.50 +				echo "<tr><td><img src='$IMAGES/wireless.png' />$i</td>
    4.51 +					<td>Wireless</td> `interface_status`</tr>" ;;
    4.52 +			lo)
    4.53 +				echo "<tr><td><img src='$IMAGES/loopback.png' />$i</td>
    4.54 +				<td>Loopback</td> `interface_status`</tr>" ;;
    4.55 +			*)
    4.56 +				continue ;;
    4.57 +		esac
    4.58 +	done
    4.59 +	table_end
    4.60 +}
    4.61 +
    4.62  #
    4.63  # xHTML 5 (header and footer skel are from the style)
    4.64  #
     5.1 --- a/po/tazpanel.pot	Wed Apr 06 06:09:34 2011 +0200
     5.2 +++ b/po/tazpanel.pot	Wed Apr 06 06:17:23 2011 +0200
     5.3 @@ -8,7 +8,7 @@
     5.4  msgstr ""
     5.5  "Project-Id-Version: TazPanel 1.0\n"
     5.6  "Report-Msgid-Bugs-To: \n"
     5.7 -"POT-Creation-Date: 2011-04-06 06:09+0200\n"
     5.8 +"POT-Creation-Date: 2011-04-06 06:15+0200\n"
     5.9  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    5.10  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
    5.11  "Language-Team: LANGUAGE <LL@li.org>\n"
    5.12 @@ -41,119 +41,99 @@
    5.13  msgid "Usage:"
    5.14  msgstr ""
    5.15  
    5.16 -#: index.cgi:38
    5.17 -msgid "Interface"
    5.18 +#: index.cgi:34
    5.19 +msgid "Boot &amp; startup"
    5.20  msgstr ""
    5.21  
    5.22 -#: index.cgi:39 index.cgi:133 pkgs.cgi:117
    5.23 +#: index.cgi:36
    5.24 +msgid "Everything that appends before user login."
    5.25 +msgstr ""
    5.26 +
    5.27 +#: index.cgi:40
    5.28 +msgid "Kernel cmdline"
    5.29 +msgstr ""
    5.30 +
    5.31 +#: index.cgi:81
    5.32 +msgid "Manage users"
    5.33 +msgstr ""
    5.34 +
    5.35 +#: index.cgi:82
    5.36 +msgid "Manage human users on your SliTaz system"
    5.37 +msgstr ""
    5.38 +
    5.39 +#: index.cgi:89
    5.40 +msgid "Login"
    5.41 +msgstr ""
    5.42 +
    5.43 +#: index.cgi:90
    5.44 +msgid "User ID"
    5.45 +msgstr ""
    5.46 +
    5.47 +#: index.cgi:91 pkgs.cgi:117 lib/libtazpanel:40
    5.48  msgid "Name"
    5.49  msgstr ""
    5.50  
    5.51 -#: index.cgi:40
    5.52 -msgid "Status"
    5.53 +#: index.cgi:92
    5.54 +msgid "Home"
    5.55  msgstr ""
    5.56  
    5.57 -#: index.cgi:41
    5.58 -msgid "IP Address"
    5.59 +#: index.cgi:93
    5.60 +msgid "SHell"
    5.61  msgstr ""
    5.62  
    5.63 -#: index.cgi:76
    5.64 -msgid "Boot &amp; startup"
    5.65 -msgstr ""
    5.66 -
    5.67 -#: index.cgi:78
    5.68 -msgid "Everything that appends before user login."
    5.69 -msgstr ""
    5.70 -
    5.71 -#: index.cgi:82
    5.72 -msgid "Kernel cmdline"
    5.73 -msgstr ""
    5.74 -
    5.75 -#: index.cgi:123
    5.76 -msgid "Manage users"
    5.77 +#: index.cgi:120
    5.78 +msgid "Delete selected user"
    5.79  msgstr ""
    5.80  
    5.81  #: index.cgi:124
    5.82 -msgid "Manage human users on your SliTaz system"
    5.83 +msgid "Add a new user"
    5.84 +msgstr ""
    5.85 +
    5.86 +#: index.cgi:127
    5.87 +msgid "User login:"
    5.88 +msgstr ""
    5.89 +
    5.90 +#: index.cgi:129
    5.91 +msgid "User password:"
    5.92  msgstr ""
    5.93  
    5.94  #: index.cgi:131
    5.95 -msgid "Login"
    5.96 +msgid "Create user"
    5.97  msgstr ""
    5.98  
    5.99 -#: index.cgi:132
   5.100 -msgid "User ID"
   5.101 +#: index.cgi:143
   5.102 +msgid "Drivers &amp; Devices"
   5.103  msgstr ""
   5.104  
   5.105 -#: index.cgi:134
   5.106 -msgid "Home"
   5.107 +#: index.cgi:144
   5.108 +msgid "Manage your computer hardware"
   5.109  msgstr ""
   5.110  
   5.111 -#: index.cgi:135
   5.112 -msgid "SHell"
   5.113 +#: index.cgi:164
   5.114 +msgid "Host:"
   5.115  msgstr ""
   5.116  
   5.117 -#: index.cgi:162
   5.118 -msgid "Delete selected user"
   5.119 +#: index.cgi:165
   5.120 +msgid "SliTaz administration et configuration Panel"
   5.121  msgstr ""
   5.122  
   5.123 -#: index.cgi:166
   5.124 -msgid "Add a new user"
   5.125 -msgstr ""
   5.126 -
   5.127 -#: index.cgi:169
   5.128 -msgid "User login:"
   5.129 +#: index.cgi:168 pkgs.cgi:390
   5.130 +msgid "Summary"
   5.131  msgstr ""
   5.132  
   5.133  #: index.cgi:171
   5.134 -msgid "User password:"
   5.135 -msgstr ""
   5.136 -
   5.137 -#: index.cgi:173
   5.138 -msgid "Create user"
   5.139 -msgstr ""
   5.140 -
   5.141 -#: index.cgi:185 network.cgi:32
   5.142 -msgid "Networking"
   5.143 -msgstr ""
   5.144 -
   5.145 -#: index.cgi:186 network.cgi:33
   5.146 -msgid "Manage network connection and services"
   5.147 -msgstr ""
   5.148 -
   5.149 -#: index.cgi:205
   5.150 -msgid "Drivers &amp; Devices"
   5.151 -msgstr ""
   5.152 -
   5.153 -#: index.cgi:206
   5.154 -msgid "Manage your computer hardware"
   5.155 -msgstr ""
   5.156 -
   5.157 -#: index.cgi:226
   5.158 -msgid "Host:"
   5.159 -msgstr ""
   5.160 -
   5.161 -#: index.cgi:227
   5.162 -msgid "SliTaz administration et configuration Panel"
   5.163 -msgstr ""
   5.164 -
   5.165 -#: index.cgi:230 pkgs.cgi:390
   5.166 -msgid "Summary"
   5.167 -msgstr ""
   5.168 -
   5.169 -#: index.cgi:233
   5.170  msgid "Uptime:"
   5.171  msgstr ""
   5.172  
   5.173 -#: index.cgi:236
   5.174 +#: index.cgi:174
   5.175  msgid "Memory in Mb"
   5.176  msgstr ""
   5.177  
   5.178 -#: index.cgi:243
   5.179 +#: index.cgi:181
   5.180  msgid "Network status"
   5.181  msgstr ""
   5.182  
   5.183 -#: index.cgi:246
   5.184 +#: index.cgi:184
   5.185  msgid "Filesystem usage statistics"
   5.186  msgstr ""
   5.187  
   5.188 @@ -337,3 +317,23 @@
   5.189  #: live.cgi:99
   5.190  msgid "generate"
   5.191  msgstr ""
   5.192 +
   5.193 +#: network.cgi:32
   5.194 +msgid "Networking"
   5.195 +msgstr ""
   5.196 +
   5.197 +#: network.cgi:33
   5.198 +msgid "Manage network connection and services"
   5.199 +msgstr ""
   5.200 +
   5.201 +#: lib/libtazpanel:39
   5.202 +msgid "Interface"
   5.203 +msgstr ""
   5.204 +
   5.205 +#: lib/libtazpanel:41
   5.206 +msgid "Status"
   5.207 +msgstr ""
   5.208 +
   5.209 +#: lib/libtazpanel:42
   5.210 +msgid "IP Address"
   5.211 +msgstr ""
     6.1 --- a/styles/default/header.html	Wed Apr 06 06:09:34 2011 +0200
     6.2 +++ b/styles/default/header.html	Wed Apr 06 06:17:23 2011 +0200
     6.3 @@ -15,10 +15,10 @@
     6.4  	<div id="menu">
     6.5  		<a href="/">Panel</a>
     6.6  		<a href="/pkgs.cgi">Packages</a>
     6.7 +		<a href="/network.cgi">Network</a>
     6.8  		<a href="/live.cgi">Live</a>
     6.9  		<a href="/index.cgi?boot">Boot</a>
    6.10  		<a href="/index.cgi?users">Users</a>
    6.11 -		<a href="/index.cgi?network">Network</a>
    6.12  		<a href="/index.cgi?hardware">Hardware</a>
    6.13  	</div>
    6.14  </div>