# HG changeset patch
# User Christophe Lincoln
# Date 1301772770 -7200
# Node ID 0ca11f2550ef43710a233497719bffa546789b38
# Parent dfcc3f32288502f110e93a12351844768bcf5673
Add configuration page in tazpkg.cgi
diff -r dfcc3f322885 -r 0ca11f2550ef styles/default/images/clear.png
Binary file styles/default/images/clear.png has changed
diff -r dfcc3f322885 -r 0ca11f2550ef styles/default/style.css
--- a/styles/default/style.css Sat Apr 02 17:35:09 2011 +0200
+++ b/styles/default/style.css Sat Apr 02 21:32:50 2011 +0200
@@ -5,8 +5,8 @@
html { min-height: 102%; }
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%; }
+h2 { color: #444; margin: -20px 0 10px; }
+h3 { color: #666; font-size: 140%; margin: 0; }
h4 { color: #888; font-size: 120%; }
img { border: 0pt none; vertical-align: middle; padding: 0 6px 0 0;}
p { margin: 6px 0; }
@@ -23,9 +23,11 @@
overflow: auto;
}
+.pre_main { margin: 40px 0 10px; }
input[type=submit] {
padding: 2px 4px;
+ margin: 4px 0 0;
background-color: #f1f1f1;
border: 1px solid #ddd;
cursor: pointer;
@@ -36,15 +38,13 @@
border: 1px solid #999;
}
-input[type=text] { height: 16px; }
+input[type=text] { height: 15px; }
/* Blocks */
-#list { margin: 20px 0 0; }
-
#block { float: left; }
-#sub_block { margin: 50px 0 20px; }
+#sub_block { margin: 50px 0; }
/* Content */
@@ -52,17 +52,18 @@
.search {
position: absolute;
- right: 87px;
- top: 214px;
+ right: 88px;
+ top: 200px;
}
#actions {
position: absolute;
- left: 86px;
- top: 212px;
+ left: 88px;
+ top: 200px;
}
#actions p { padding: 0; }
+
.box {
margin: 10px 0;
padding: 12px;
@@ -71,15 +72,20 @@
}
.debug {
+ position: fixed;
+ top: 5px;
+ left: 5px;
padding: 6px 20px;
- background-color: #ADD8E6;
+ background-color: #f8f8f8;
border: 1px solid #ddd;
}
+/* Table */
+
table {
background-color: #f8f8f8;
border: 1px solid #ddd;
- margin: 0;
+ margin: 30px 0 0 0;
padding: 10px 10px 10px 0;
width: 100%;
}
@@ -93,6 +99,7 @@
}
/* Round corner */
+
table, pre, input[type=submit], .debug, .box {
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
diff -r dfcc3f322885 -r 0ca11f2550ef tazpanel.conf
--- a/tazpanel.conf Sat Apr 02 17:35:09 2011 +0200
+++ b/tazpanel.conf Sat Apr 02 21:32:50 2011 +0200
@@ -10,7 +10,7 @@
HEADER="styles/$STYLE/header.html"
FOOTER="styles/$STYLE/footer.html"
-DEBUG="0"
+DEBUG="1"
# Busybox HTTP deamon config
# /etc/slitaz/httpd.conf
diff -r dfcc3f322885 -r 0ca11f2550ef tazpkg.cgi
--- a/tazpkg.cgi Sat Apr 02 17:35:09 2011 +0200
+++ b/tazpkg.cgi Sat Apr 02 21:32:50 2011 +0200
@@ -24,7 +24,9 @@
cat $HEADER | sed s'/%TITLE%/Tazpkg/'
# DEBUG mode
-[ $DEBUG == "1" ] && echo "$REQUEST_METHOD ${QUERY_STRING}
"
+if [ $DEBUG == "1" ]; then
+ echo "$REQUEST_METHOD ${QUERY_STRING}
"
+fi
# We need packages information for list and search
parse_packages_desc() {
@@ -70,6 +72,17 @@
cat $LOCALSTATE/blocked-packages.list | wc -l
}
+# Parse mirrors list to be able to have an icon an remove link
+list_mirrors() {
+ cat $LOCALSTATE/mirrors | while read line
+ do
+ cat << EOT
+
$line
+EOT
+ done
+}
+
#
# xHTML functions
#
@@ -79,8 +92,9 @@
@@ -114,7 +128,8 @@
`gettext "My packages"` |
`gettext "All packages"` |
`gettext "Recharge"` |
- `gettext "Upgradeable"`
+ `gettext "Upgradeable"` |
+ `gettext "Configuration"`
EOT
}
@@ -233,7 +248,7 @@
`gettext "Recharge lists will check for new or updated packages"`
-
+
EOT
gettext "Recharging the packages list... please wait"; echo
tazpkg recharge | filter_tazpkg_msgs
@@ -275,11 +290,13 @@
EOT
gettext "Performing task on packages"
- [ $DEBUG == "1" ] && echo "
cmd: $cmd
pkgs: $pkgs
"
echo '
'
+ echo ''
+ gettext "Executing $cmd for:$pkgs"
+ echo '
'
for pkg in $pkgs
do
- echo ''
+ echo ''
echo 'y' | tazpkg $cmd $pkg $opt 2>/dev/null | filter_tazpkg_msgs
echo '
'
done ;;
@@ -289,14 +306,15 @@
sub_block
. $INSTALLED/$pkg/receipt
cat << EOT
-`gettext "Upgradeable packages"`
+`gettext "Package info"`
-
`gettext "Detailled information on:" $PACKAGE`
+
`gettext "Detailled information on:"` $PACKAGE
-
+
Name : $PACKAGE
Version : $VERSION
Description : $SHORT_DESC
+Maintainer : $MAINTAINER
Depends : `for i in $DEPENDS; do echo -n \
"$i "; done`
Website : $WEB_SITE
@@ -310,21 +328,73 @@
EOT
;;
+ config*)
+ # Tazpkg configuration page
+ cmd=${QUERY_STRING#*=}
+ case "$cmd" in
+ clean)
+ rm -rf /var/cache/tazpkg/* ;;
+ add-mirror*=http*|add-mirror*=ftp*)
+ # Decode url
+ mirror=`httpd -d ${cmd#*=}`
+ echo "$mirror" >> $LOCALSTATE/mirrors ;;
+ rm-mirror=http://*|rm-mirror=ftp://*)
+ mirror=${QUERY_STRING#*=rm-mirror=}
+ sed -i -e "s@$mirror@@" -e '/^$/d' $LOCALSTATE/mirrors ;;
+ esac
+ cache_files=`find /var/cache/tazpkg -name *.tazpkg | wc -l`
+ cache_size=`du -sh /var/cache/tazpkg`
+ sub_block
+ cat << EOT
+`gettext "Configuration"`
+
+
`gettext "Tazpkg configuration and settings"`
+
+
+
`gettext "Package in cache"`
+
+
+`gettext "Current mirror list"`
+
+
+EOT
+ ;;
*)
# Default to summary
-
+ search_form
sub_block
- search_form
cat << EOT
`gettext "Summary"`
`gettext "Overview of all installed and mirrored packages"`
-
+
`packages_summary`
+`gettext "Latest log entries"`
+
+`tail -n 6 /var/log/tazpkg.log | fgrep "-" | \
+ awk '{print $1, $2, $3, $4, $5, $6, $7}'`
+
+
EOT
- echo "" ;;
+ ;;
esac
# xHTML 5 footer