tazpanel diff settings.cgi @ rev 406

Small improvements: no need HTML "meta charset" (it's done in HTTP headers); no need "$SCRIPT_NAME" in links; use HTML "&" in links; hide Wi-Fi password in the page; fix month selector in the date settings; use HTML5 plain "header" and "footer"; use "printf"'s loop nature; fix "1" message in page loading break.
author Aleksej Bobylev <al.bobylev@gmail.com>
date Sat Jan 03 17:11:14 2015 +0200 (2015-01-03)
parents d9576ab0e512
children 299f204b8f1f
line diff
     1.1 --- a/settings.cgi	Wed Dec 31 02:25:01 2014 +0200
     1.2 +++ b/settings.cgi	Sat Jan 03 17:11:14 2015 +0200
     1.3 @@ -119,7 +119,7 @@
     1.4  		cat <<EOT
     1.5  <h3 id="groups">$(gettext 'Manage groups')</h3>
     1.6  
     1.7 -<form method="get" action="$SCRIPT_NAME">
     1.8 +<form method="get" action="">
     1.9  	<input type="hidden" name="groups" />
    1.10  <div id="actions">
    1.11  	<div class="float-left">
    1.12 @@ -162,7 +162,7 @@
    1.13  <section>
    1.14  <h4>$(gettext 'Add a new group')</h4>
    1.15  
    1.16 -<form method="get" action="$SCRIPT_NAME">
    1.17 +<form method="get" action="">
    1.18  	<input type="hidden" name="groups" />
    1.19  	<table>
    1.20  		<tr><td>$(gettext 'Group name:')</td>
    1.21 @@ -176,7 +176,7 @@
    1.22  <section>
    1.23  <h4>$(gettext 'Manage group membership')</h4>
    1.24  
    1.25 -<form method="get" action="$SCRIPT_NAME">
    1.26 +<form method="get" action="">
    1.27  	<input type="hidden" name="groups" />
    1.28  	<table>
    1.29  		<tr><td>$(gettext 'Group name:')</td>
    1.30 @@ -203,7 +203,7 @@
    1.31  		cat <<EOT
    1.32  <h3 id="users">$(gettext 'Manage users')</h3>
    1.33  
    1.34 -<form method="get" action="$SCRIPT_NAME">
    1.35 +<form method="get" action="">
    1.36  <div id="actions">
    1.37  	<div class="float-left">
    1.38  		$(gettext 'Selection:')
    1.39 @@ -266,7 +266,7 @@
    1.40  <section>
    1.41  <h4>$(gettext 'Add a new user')</h4>
    1.42  
    1.43 -<form method="get" action="$SCRIPT_NAME">
    1.44 +<form method="get" action="">
    1.45  	<input type="hidden" name="user" />
    1.46  	<table>
    1.47  		<tr><td>$(gettext 'User login:')</td>
    1.48 @@ -317,11 +317,11 @@
    1.49  		[ $? = 1 ] &&
    1.50  			msg tip $(gettext \
    1.51  			"Can't see your language?<br/>You can \
    1.52 -<a href='/pkgs.cgi?do=Install&glibc-locale'>install glibc-locale</a> \
    1.53 +<a href='/pkgs.cgi?do=Install&amp;glibc-locale'>install glibc-locale</a> \
    1.54  to see a larger list of available locales.")
    1.55  
    1.56  		cat << EOT
    1.57 -<form method="get" action="$SCRIPT_NAME">
    1.58 +<form method="get" action="">
    1.59  	<div class="outbox">
    1.60  	<table class="zebra fixed">
    1.61  	<thead>
    1.62 @@ -377,16 +377,16 @@
    1.63  	<p>$(gettext 'Manage system time, users or language settings')<p>
    1.64  </div>
    1.65  <div id="actions">
    1.66 -	<a class="button" href="$SCRIPT_NAME?users">
    1.67 +	<a class="button" href="?users">
    1.68  		<img src="$IMAGES/user.png" />$(gettext 'Manage users')</a>
    1.69 -	<a class="button" href="$SCRIPT_NAME?groups">
    1.70 +	<a class="button" href="?groups">
    1.71  		<img src="$IMAGES/users.png" />$(gettext 'Manage groups')</a>
    1.72  </div>
    1.73  
    1.74  <section>
    1.75  <h3>$(gettext 'System time')</h3>
    1.76  
    1.77 -<form method="get" action="$SCRIPT_NAME">
    1.78 +<form method="get" action="">
    1.79  <table>
    1.80  	<tr><td>$(gettext 'Time zone:')</td><td>
    1.81  		<select class="button" name="tz">
    1.82 @@ -403,32 +403,23 @@
    1.83  	<tr><td>$(gettext 'Hardware clock:')</td><td>$(hwclock -r)</tr>
    1.84  </table>
    1.85  </form>
    1.86 -<form method="get" action="$SCRIPT_NAME">
    1.87 -<input type="submit" name="date" value="$(gettext 'Set date')" />
    1.88 -<select class="button" name="day">
    1.89 -$(for i in $(seq 1 31); do echo "<option>$i</option>"; done)
    1.90 -</select>
    1.91 -<select class="button" name="month">
    1.92 -$(for i in 01 02 03 04 05 06 07 08 09 10 11 12; do
    1.93 -  date -d ${i}010101 '+%m %B' | \
    1.94 -  sed 's|\(.*\) \(.*\)|<option value="\1">\2</option>|'
    1.95 -done)
    1.96 -</select>
    1.97 -<select class="button" name="year">
    1.98 -$(for i in $(seq 2010 2030); do echo "<option>$i</option>"; done)
    1.99 -</select>
   1.100 -- <select class="button" name="hour">
   1.101 -$(for i in $(seq 0 23); do printf "<option>%02d</option>" $i; done)
   1.102 -</select>
   1.103 -: <select class="button" name="min">
   1.104 -$(for i in $(seq 0 59); do printf "<option>%02d</option>" $i; done)
   1.105 -</select>
   1.106 -: <select class="button" name="sec">
   1.107 -$(for i in $(seq 0 59); do printf "<option>%02d</option>" $i; done)
   1.108 -</select>
   1.109 +
   1.110 +<form method="get" action="">
   1.111 +	<input type="submit" name="date" value="$(gettext 'Set date')" />
   1.112 +	<select class="button" name="day">$(printf '<option>%d</option>' $(seq 31))</select>
   1.113 +	<select class="button" name="month">
   1.114 +		$(for i in $(seq 12); do
   1.115 +			printf '<option value="%s">%s</option>' $(date -d $i.01-01:01 '+%m %B')
   1.116 +		done)
   1.117 +	</select>
   1.118 +	<select class="button" name="year">$(printf '<option>%d</option>' $(seq 2010 2030))</select>
   1.119 +-	<select class="button" name="hour">$(printf '<option>%02d</option>' $(seq 0 23))</select>
   1.120 +:	<select class="button" name="min">$(printf '<option>%02d</option>' $(seq 0 59))</select>
   1.121 +:	<select class="button" name="sec">$(printf '<option>%02d</option>' $(seq 0 59))</select>
   1.122  </form>
   1.123 -<a class="button" href="$SCRIPT_NAME?rdate">$(gettext 'Sync online')</a>
   1.124 -<a class="button" href="$SCRIPT_NAME?hwclock">$(gettext 'Set hardware clock')</a>
   1.125 +
   1.126 +<a class="button" href="?rdate">$(gettext 'Sync online')</a>
   1.127 +<a class="button" href="?hwclock">$(gettext 'Set hardware clock')</a>
   1.128  </section>
   1.129  EOT
   1.130  		#
   1.131 @@ -454,7 +445,7 @@
   1.132  			locale | grep LANG | cut -d= -f2
   1.133  		fi
   1.134  		cat << EOT
   1.135 -</strong> <a class="button" href="$SCRIPT_NAME?locale">$(gettext 'Change')</a></p>
   1.136 +</strong> <a class="button" href="?locale">$(gettext 'Change')</a></p>
   1.137  </section>
   1.138  
   1.139  <section>
   1.140 @@ -487,7 +478,7 @@
   1.141  			esac
   1.142  			keyboard_config=/etc/X11/xorg.conf.d/40-Keyboard.conf
   1.143  			cat << EOT
   1.144 -<form method="get" action="$SCRIPT_NAME">
   1.145 +<form method="get" action="">
   1.146  	$(gettext 'Suggested keymap for Xorg:')
   1.147  	<input type="submit" name "apply_xorg_kbd" value="$keymap" />
   1.148  	<a class="button" href="index.cgi?file=$keyboard_config">
   1.149 @@ -496,7 +487,7 @@
   1.150  EOT
   1.151  		fi
   1.152  		cat << EOT
   1.153 -<form method="get" action="$SCRIPT_NAME">
   1.154 +<form method="get" action="">
   1.155  	$(gettext 'Available keymaps:')
   1.156  	<select class="button" name="gen_keymap">
   1.157  		$(list_keymaps)
   1.158 @@ -508,7 +499,7 @@
   1.159  <section>
   1.160  <h2>$(gettext 'Panel configuration')</h2>
   1.161  
   1.162 -<form method="get" action="$SCRIPT_NAME">
   1.163 +<form method="get" action="">
   1.164  	<p>
   1.165  		$(gettext 'Style:')
   1.166  		<select class="button" name="style">
   1.167 @@ -517,7 +508,7 @@
   1.168  		<input type="submit" value="$(gettext 'Activate')" />
   1.169  	</p>
   1.170  </form>
   1.171 -<form method="get" action="$SCRIPT_NAME">
   1.172 +<form method="get" action="">
   1.173  	<p>
   1.174  		$(gettext 'Panel password:')
   1.175  		<input type="password" name="panel_pass"/>