# HG changeset patch # User Christophe Lincoln # Date 1302225998 -7200 # Node ID 5b7e9a6565c9221046cca76653e5ece8511388a1 # Parent 13b1019d68d8189255c3154d739974829372dd54 Better loading integration and clean up code in pkgs.cgi diff -r 13b1019d68d8 -r 5b7e9a6565c9 lib/libtazpanel --- a/lib/libtazpanel Fri Apr 08 01:17:37 2011 +0200 +++ b/lib/libtazpanel Fri Apr 08 03:26:38 2011 +0200 @@ -94,5 +94,7 @@ cat << EOT +`gettext "Go up"` EOT + } diff -r 13b1019d68d8 -r 5b7e9a6565c9 pkgs.cgi --- a/pkgs.cgi Fri Apr 08 01:17:37 2011 +0200 +++ b/pkgs.cgi Fri Apr 08 03:26:38 2011 +0200 @@ -32,26 +32,24 @@ # We need packages information for list and search parse_packages_desc() { -while read line + IFS="|" + cut -f 1,2,3,5 -d "|" | while read PACKAGE VERSION SHORT_DESC WEB_SITE do echo '' - pkg=$(echo $line | cut -d "|" -f 1) - vers=$(echo $line | cut -d "|" -f 2) - desc=$(echo $line | cut -d "|" -f 3) - web=$(echo $line | cut -d "|" -f 5) - if [ -d $INSTALLED/$pkg ]; then - echo -e "\n - - $pkg" + if [ -d $INSTALLED/$PACKAGE ]; then + echo -e "\n + + $PACKAGE" else - echo -e "\n - $pkg" + echo -e "\n + $PACKAGE" fi - echo "$vers" - echo "$desc" - echo "web" + echo "$VERSION" + echo "$SHORT_DESC" + echo "web" echo '' done + unset IFS } # Remove status and ESC char from tazpkg commands output @@ -145,9 +143,25 @@ EOT } -# For my packages list -list_actions() { - cat << EOT +# +# Commands +# + +case "$QUERY_STRING" in + list*) + # + # List installed packages. This is the default because parsing + # the full packages.desc can be long and take some resources + # + cd $INSTALLED + search_form + sidebar + LOADING_MSG="Listing packages..." + loading_msg + cat << EOT +

`gettext "My packages"`

+
+
`gettext "Selection:"` @@ -158,82 +172,6 @@
EOT -} - -# For list-cat -list_cat_action() { - cat << EOT -
- `gettext "Selection:"` - - -
-
- `gettext "List:"` - - - - `gettext "My packages"` -
-EOT -} - -# For search with JS function to toogle all pkgs -list_full_actions() { - cat << EOT -
- `gettext "Selection:"` - - - `gettext "Toogle all"` -
-
- `gettext "List:"` - - - - `gettext "My packages"` -
-EOT -} - -# For upgrade with JS function to toogle all pkgs and no 'Upgrade' button -list_up_actions() { - cat << EOT -
- `gettext "Selection:"` - - - `gettext "Toogle all"` -
-
- `gettext "List:"` - - - `gettext "My packages"` -
-EOT -} - -# -# Commands -# - -case "$QUERY_STRING" in - list*) - # List installed packages. This is the default because parsing - # the full packages.desc can be long and take some resources - cd $INSTALLED - search_form - sidebar - LOADING_MSG="Listing... please wait" - loading_msg - cat << EOT -

`gettext "My packages"`

- -
-EOT - list_actions echo '
' table_start table_head @@ -253,41 +191,70 @@ echo '' done table_end - list_actions echo '' ;; cat*) + # # List all available packages by category on mirror. Listing all # packages is to resource intensive and not usefull. + # cd $LOCALSTATE category=${QUERY_STRING#cat=} [ "${QUERY_STRING}" == "cat" ] && category="base-system" search_form sidebar | sed s/"active_${category}"/"active"/ + LOADING_MSG="Listing packages..." + loading_msg cat << EOT

`gettext "Category:"` $category

+
+ `gettext "Selection:"` + + +
+
+ `gettext "List:"` + + + + `gettext "My packages"` +
EOT - list_cat_action echo '
' table_start table_head grep "| $category |" packages.desc | parse_packages_desc table_end - list_cat_action echo '
' ;; search=*) + # # Search for packages + # pkg=${QUERY_STRING#*=} cd $LOCALSTATE search_form sidebar + LOADING_MSG="Searching packages..." + loading_msg cat << EOT

`gettext "Search packages"`

+
+ `gettext "Selection:"` + + + `gettext "Toogle all"` +
+
+ `gettext "List:"` + + + + `gettext "My packages"` +
EOT - list_full_actions echo '
' table_start table_head @@ -295,21 +262,26 @@ table_end echo '
' ;; recharge*) + # # Let recharge the packages list + # search_form sidebar + LOADING_MSG="Recharging lists..." + loading_msg cat << EOT

`gettext "Recharge"`

- `gettext "Recharge will check for new or updated packages... -please wait"` + `gettext "Recharge checks for new or updated packages"`

+ + `gettext "Check upgrade"` `gettext "My packages"`

@@ -318,20 +290,39 @@
 EOT
 		tazpkg recharge | filter_tazpkg_msgs
-		echo '
' - echo '

' - gettext "Packages lists are up-to-date" - echo '

' ;; + cat << EOT + +

+ `gettext "Packages lists are up-to-date. You should check for upgrade now."` +

+EOT + ;; upgradeable*) + # + # Ugrade packages + # cd $LOCALSTATE search_form sidebar + LOADING_MSG="Checking for upgrade..." + loading_msg cat << EOT

`gettext "Upgradeable packages"`

+
+ `gettext "Selection:"` + + + `gettext "Toogle all"` +
+
+ `gettext "List:"` + + + `gettext "My packages"` +
EOT - list_up_actions tazpkg upgradeable echo '
' table_start @@ -341,10 +332,11 @@ grep "^$pkg |" $LOCALSTATE/packages.desc | parse_packages_desc done table_end - list_up_actions echo '' ;; do=*) + # # Do an action on one or some packages + # 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//` @@ -356,13 +348,15 @@ esac search_form sidebar + LOADING_MSG="${cmd}ing packages..." + loading_msg cat << EOT

Tazpkg: $cmd

- `gettext "Performing task on packages... please wait"` + `gettext "Performing task on packages"`

@@ -373,16 +367,19 @@
EOT - echo '
'
+		echo '
' gettext "Executing $cmd for:$pkgs" - echo '
' + echo '
' for pkg in $pkgs do echo '
'
-			echo 'y' | tazpkg $cmd $pkg $opt 2>/dev/null | filter_tazpkg_msgs
+			echo 'o' | tazpkg $cmd $pkg $opt 2>/dev/null | filter_tazpkg_msgs
 			echo '
' done ;; info=*) + # + # Packages info + # pkg=${QUERY_STRING#*=} search_form sidebar @@ -422,7 +419,9 @@ EOT ;; config*) + # # Tazpkg configuration page + # cmd=${QUERY_STRING#*=} case "$cmd" in clean) @@ -477,23 +476,22 @@ cat << EOT

`gettext "Summary"`

 `packages_summary`
 
- - `gettext "My packages"` - - `gettext "Recharge list"` - - `gettext "Check upgrade"` - - `gettext "Configuration"`

`gettext "Latest log entries"`

-`tail -n 6 /var/log/tazpkg.log | fgrep "-" | \
+`tail -n 5 /var/log/tazpkg.log | fgrep "-" | \
 	awk '{print $1, $2, $3, $4, $5, $6, $7}'`
 
diff -r 13b1019d68d8 -r 5b7e9a6565c9 styles/default/header.html --- a/styles/default/header.html Fri Apr 08 01:17:37 2011 +0200 +++ b/styles/default/header.html Fri Apr 08 03:26:38 2011 +0200 @@ -5,16 +5,10 @@ - + diff -r 13b1019d68d8 -r 5b7e9a6565c9 styles/default/style.css --- a/styles/default/style.css Fri Apr 08 01:17:37 2011 +0200 +++ b/styles/default/style.css Fri Apr 08 03:26:38 2011 +0200 @@ -25,15 +25,6 @@ a { text-decoration: none; color: #666; } a:hover { color: #000; } -#loading { - /* font-weight: bold; */ - color: #666; - position: fixed; - top: 92px; - right: 80px; - width: 200px; -} - /* Header and main title */ #header { @@ -49,7 +40,7 @@ left: 0; height: 24px; width: 100%; - padding: 0 0 0 0; + padding: 0; background-color: #f1efeb; border-bottom: 1px solid #c1baad; z-index: 200; @@ -63,7 +54,18 @@ #icons { margin: 2px 8px; float: right; } #icons img { padding: 0; } -.progress { cursor: progress; } +#loading { + /* font-weight: bold; */ + background-color: #f8f8f8; + border: 1px solid #ddd; + color: #666; + cursor: progress; + position: fixed; + top: 92px; + right: 40px; + width: 248px; + padding: 4px 4px 2px; +} /* Blocks */ @@ -128,6 +130,7 @@ padding: 4px; height: 17px; margin: 0; + width: 190px; border-top-left-radius: 4px; border-bottom-left-radius: 4px; } @@ -146,11 +149,11 @@ .debug { position: fixed; - top: 20px; - left: 5px; + bottom: 0px; + left: 0px; + margin: 10px 20px; padding: 6px 20px; - background-color: #f8f8f8; - border: 1px solid #ddd; + background-color: #e64a00; } .float-left { float: left; } @@ -210,7 +213,7 @@ /* Round corner */ -table, pre, input[type=submit], .debug, .box, +#loading, table, pre, input[type=submit], .debug, .box, .button, div.scroll { /*-moz-border-radius: 4px; -webkit-border-radius: 4px; */ diff -r 13b1019d68d8 -r 5b7e9a6565c9 tazpanel.conf --- a/tazpanel.conf Fri Apr 08 01:17:37 2011 +0200 +++ b/tazpanel.conf Fri Apr 08 03:26:38 2011 +0200 @@ -17,7 +17,7 @@ XTERM_OPTS="-geometry 80x16-0+24 -bg black -fg white" # Generic page loading message -LOADING_MSG="Loading... please wait" +LOADING_MSG="Loading..." # Busybox HTTP deamon config HTTPD_CONF="/etc/slitaz/httpd.conf"