# HG changeset patch # User Christophe Lincoln # Date 1301758509 -7200 # Node ID dfcc3f32288502f110e93a12351844768bcf5673 # Parent ab6120f11be40f94fa650b3f3348b27ee1bc2551 improve tazpkg.cgi and fix some CSS issues diff -r ab6120f11be4 -r dfcc3f322885 styles/default/style.css --- a/styles/default/style.css Sat Apr 02 13:55:29 2011 +0200 +++ b/styles/default/style.css Sat Apr 02 17:35:09 2011 +0200 @@ -3,9 +3,9 @@ */ html { min-height: 102%; } -body { padding: 40px 80px; font: 13px sans; } -h1 { color: #4d4d4d; border-bottom: 1px dotted #ddd; } -h2 { color: #444; } +body { padding: 20px 80px; font: 13px sans; } +h1 { color: #d66018; border-bottom: 1px dotted #ddd; } +h2 { color: #444; margin: 0 0 60px; } h3 { color: #666; font-size: 140%; } h4 { color: #888; font-size: 120%; } img { border: 0pt none; vertical-align: middle; padding: 0 6px 0 0;} @@ -19,9 +19,11 @@ background-color: #f8f8f8; border: 1px solid #ddd; padding: 10px; + margin: 10px 0; overflow: auto; } + input[type=submit] { padding: 2px 4px; background-color: #f1f1f1; @@ -36,33 +38,31 @@ input[type=text] { height: 16px; } -table { - background-color: #f8f8f8; - border: 1px solid #ddd; - margin: 10px 0 0; - padding: 10px 10px 10px 0; - width: 100%; -} - -.search { float: right; } -.search p { margin: -1px; } +/* Blocks */ #list { margin: 20px 0 0; } -td.pkg { max-width: 160px; } -td.desc { max-width: 300px; } +#block { float: left; } -#thead, thead { - height: 10px; - font-weight: bold; -} - -#block { float: left; } +#sub_block { margin: 50px 0 20px; } /* Content */ -#content { margin: 60px 0 0 } +#content { margin: 0; } +.search { + position: absolute; + right: 87px; + top: 214px; +} + +#actions { + position: absolute; + left: 86px; + top: 212px; +} + +#actions p { padding: 0; } .box { margin: 10px 0; padding: 12px; @@ -76,6 +76,22 @@ border: 1px solid #ddd; } +table { + background-color: #f8f8f8; + border: 1px solid #ddd; + margin: 0; + padding: 10px 10px 10px 0; + width: 100%; +} + +td.pkg { max-width: 160px; } +td.desc { max-width: 300px; } + +#thead, thead { + height: 10px; + font-weight: bold; +} + /* Round corner */ table, pre, input[type=submit], .debug, .box { -moz-border-radius: 4px; diff -r ab6120f11be4 -r dfcc3f322885 tazpkg.cgi --- a/tazpkg.cgi Sat Apr 02 13:55:29 2011 +0200 +++ b/tazpkg.cgi Sat Apr 02 17:35:09 2011 +0200 @@ -22,14 +22,6 @@ # xHTML 5 header cat $HEADER | sed s'/%TITLE%/Tazpkg/' -cat << EOT - -EOT # DEBUG mode [ $DEBUG == "1" ] && echo "

$REQUEST_METHOD ${QUERY_STRING}

" @@ -43,8 +35,7 @@ vers=$(echo $line | cut -d "|" -f 2) desc=$(echo $line | cut -d "|" -f 3) web=$(echo $line | cut -d "|" -f 5) - imgs=styles/$STYLE/images - if [ -d installed/$pkg ]; then + if [ -d $INSTALLED/$pkg ]; then echo -e "\n $pkg" else @@ -83,6 +74,19 @@ # xHTML functions # +search_form() { + cat << EOT + +EOT +} + table_start() { cat << EOT @@ -103,35 +107,48 @@ EOT } - -list_actions() { +sub_block() { cat << EOT -

- `gettext "Selection:"` - - `gettext "List:"` - `gettext "All packages"` | - `gettext "Recharge"` -

+
+ `gettext "List:"` + `gettext "My packages"` | + `gettext "All packages"` | + `gettext "Recharge"` | + `gettext "Upgradeable"` +
EOT } -list_all_actions() { +# For my packages list +list_actions() { cat << EOT -

- `gettext "Selection:"` - - - `gettext "List:"` - `gettext "My packages"` | - `gettext "Recharge"` | -

+

+ `gettext "Selection:"` + +

EOT } -js_checkbox_all() { -cat << EOT +# For list-all +list_all_actions() { + cat << EOT +

+ `gettext "Selection:"` + + +

+EOT +} +# For search and upgrade with JS function to toogle all pkgs +list_full_actions() { + cat << EOT +

+ `gettext "Selection:"` + + + `gettext "Toogle all"` +

EOT } @@ -143,9 +160,16 @@ list) # List installed packages. This is the default because parsing # the full packages.desc can be long and take some resources - cd /var/lib/tazpkg/installed - echo "" + cd $INSTALLED + search_form + sub_block + cat << EOT +

`gettext "My packages"`

+ +
+EOT list_actions + echo '
' table_start for pkg in * do @@ -156,7 +180,7 @@ echo "" + src='$IMAGES/tazpkg-installed.png'/>$pkg" echo "" echo "" echo "" @@ -167,9 +191,16 @@ echo '' ;; list-all) # List all available packages on mirror - cd /var/lib/tazpkg - echo "" + cd $LOCALSTATE + search_form + sub_block + cat << EOT +

`gettext "All packages"`

+ +
+EOT list_all_actions + echo '
' table_start cat packages.desc | parse_packages_desc table_end @@ -178,31 +209,30 @@ search=*) # Search for packages pkg=${QUERY_STRING#*=} - cd /var/lib/tazpkg + cd $LOCALSTATE + search_form + sub_block cat << EOT +

`gettext "All packages"`

-

- `gettext "Selection:"` - - - `gettext "List:"` - `gettext "My packages"` | - `gettext "All packages"` | - `gettext "Recharge"` | - `gettext "Toogle all"` -

+
EOT + list_full_actions + echo '
' table_start grep $pkg packages.desc | parse_packages_desc table_end echo '' ;; recharge) # Let recharge the packages list + search_form + sub_block cat << EOT -

- `gettext "List:"` - `gettext "My packages"` -

+

`gettext "Recharge"`

+ +
+

`gettext "Recharge lists will check for new or updated packages"`

+
 EOT
 		gettext "Recharging the packages list... please wait"; echo
@@ -212,20 +242,19 @@
 		gettext "Packages lists are up-to-date"
 		echo '

' ;; upgradeable) + cd $LOCALSTATE + search_form + sub_block cat << EOT +

`gettext "Upgradeable packages"`

-

- `gettext "Selection:"` - - `gettext "List:"` - `gettext "My packages"` | - `gettext "Upgradeable packages list"` - `gettext "Toogle all"` -

+
EOT + list_full_actions + tazpkg upgradeable + echo '
' table_start - tazpkg upgradeable - for pkg in `cat $LOCALSTATE/upgradeable-packages.list` + for pkg in `cat upgradeable-packages.list` do grep "^$pkg |" $LOCALSTATE/packages.desc | parse_packages_desc done @@ -236,24 +265,34 @@ cmdline=`echo ${QUERY_STRING#do=} | sed s'/&/ /g'` cmd=`echo ${cmdline} | awk '{print $1}'` pkgs=`echo $cmdline | sed -e s'/+/ /g' -e s'/pkg=//g' -e s/$cmd//` - [ $cmd == install ] && cmd=get-install + [ $cmd == install ] && cmd=get-install opt=--forced + search_form + sub_block + cat << EOT +

Tazpkg: $cmd

+ +
+

+EOT + gettext "Performing task on packages" [ $DEBUG == "1" ] && echo "

cmd: $cmd

pkgs: $pkgs

" + echo '

' for pkg in $pkgs do - echo '

' - gettext "Executing: tazpkg $cmd $pkg" - echo '

'
-			echo 'y' | tazpkg $cmd $pkg --forced 2>/dev/null | filter_tazpkg_msgs
+			echo '
'
+			echo 'y' | tazpkg $cmd $pkg $opt 2>/dev/null | filter_tazpkg_msgs
 			echo '
' done ;; info=*) pkg=${QUERY_STRING#*=} + search_form + sub_block . $INSTALLED/$pkg/receipt cat << EOT -

- `gettext "List:"` - `gettext "My packages"` -

+

`gettext "Upgradeable packages"`

+
+

`gettext "Detailled information on:" $PACKAGE`

+
 Name        : $PACKAGE
 Version     : $VERSION
@@ -273,11 +312,14 @@
 		;;
 	*)
 		# Default to summary
+		
+		sub_block
+		search_form
 		cat << EOT
-`gettext "List:"`
-`gettext "My packages"` |
-`gettext "Recharge"` |
-`gettext "Upgradeable"`
+

`gettext "Summary"`

+
+

`gettext "Overview of all installed and mirrored packages"`

+
 `packages_summary`
 
$pkg$VERSION$SHORT_DESCweb