# HG changeset patch # User Aleksej Bobylev # Date 1429363503 -10800 # Node ID c389814e4f9a2a4e13935860e2fbd8694d1bb556 # Parent 0fc40a0f873fb5af138fa1155764be0c4b66d37b pkgs.cgi: info: show receipt, show package icon, add tool to improving packages by the community effort (unfinished). diff -r 0fc40a0f873f -r c389814e4f9a modules/tazpkg-find-depends --- a/modules/tazpkg-find-depends Mon Apr 13 11:53:19 2015 +0300 +++ b/modules/tazpkg-find-depends Sat Apr 18 16:25:03 2015 +0300 @@ -11,7 +11,7 @@ is_elf() { - [ "$(dd if=$1 bs=1 skip=1 count=3 2> /dev/null)" = "ELF" ] + [ `dd if=$1 bs=1 skip=1 count=3 2>/dev/null` == 'ELF' ] } @@ -19,7 +19,7 @@ ldd() { - LD_TRACE_LOADED_OBJECTS=1 /lib/ld*.so $1 2> /dev/null + LD_TRACE_LOADED_OBJECTS=1 /lib/ld*.so $1 2>/dev/null } @@ -30,7 +30,7 @@ DEFAULT_DEPENDS="glibc-base gcc-lib-base" [ -n "$TMPLOCALSTATE" ] || TMPLOCALSTATE=$PKGS_DB - [ -f $TMPLOCALSTATE/files.list.lzma ] || tazpkg recharge > /dev/null + [ -f $TMPLOCALSTATE/files.list.lzma ] || tazpkg recharge >/dev/null for i in $TMPLOCALSTATE/files.list.lzma \ $TMPLOCALSTATE/undigest/*/files.list.lzma ; do [ -f $i ] && lzma d $i -so >> $TMP_DIR/files.list @@ -47,7 +47,7 @@ for lib in $(ldd $chkfile | sed '/=>/!d;s/ =>.*//') ; do case " $libs_found " in - *\ $lib\ *) continue + *\ $lib\ *) continue esac libs_found="$libs_found $lib" case "$lib" in @@ -74,7 +74,7 @@ spc="" [ -s $TMP_DIR/depends ] && - sort < $TMP_DIR/depends 2> /dev/null | uniq | \ + sort < $TMP_DIR/depends 2>/dev/null | uniq | \ while read file; do echo -n "$spc$file" spc=" " diff -r 0fc40a0f873f -r c389814e4f9a tazpanel/pkgs.cgi --- a/tazpanel/pkgs.cgi Mon Apr 13 11:53:19 2015 +0300 +++ b/tazpanel/pkgs.cgi Sat Apr 18 16:25:03 2015 +0300 @@ -9,7 +9,6 @@ # (C) 2011-2015 SliTaz GNU/Linux - BSD License # -. /lib/libtaz.sh . lib/libtazpanel . /etc/slitaz/slitaz.conf @@ -52,10 +51,10 @@ esac -header - +# # AJAX commands +# case " $(GET) " in @@ -65,6 +64,7 @@ pkg=$(GET pkg) cd $PKGS_DB + header if [ -d $INSTALLED/$pkg ]; then files="$(wc -l < $INSTALLED/$pkg/files.list)" cat <$pkg" exit 0 ;; + *\ app_img\ * ) + # Show application image + pkg=$(GET app_img) + current_user="$(who | cut -d' ' -f1)" + if [ -n "$current_user" ]; then + current_user_home="$(awk -F: -vu=$current_user '{if($1==u) print $6}' /etc/passwd)" + current_icon_theme="/usr/share/icons/$(grep gtk-icon-theme-name $current_user_home/.gtkrc-2.0 | cut -d'"' -f2)" + default_pkg_icon="$(find -L $current_icon_theme -type f -path '*48*' -name 'package-x-generic.png' | head -n1)" + pkg_icon="$(find -L $current_icon_theme -type f -path '*48*' -name "$pkg.png" | head -n1)" + if [ -z "$pkg_icon" ]; then + pkg_icon="$(find -L /usr/share/pixmaps -type f -name "$pkg.png" | head -n1)" + fi + + header "Content-Type: image/png" + cat "${pkg_icon:-$default_pkg_icon}" + else + default_pkg_icon="$(find -L /usr/share/icons -type f -name 'package-x-generic.png' | sort | tail -n1)" + fi + exit 0 ;; + + *\ show_receipt\ * ) + # Show package receipt + pkg=$(GET show_receipt) + if [ -d "$INSTALLED/$pkg" ]; then + # Redirects to the receipt view + header "HTTP/1.1 301 Moved Permanently" "Location: index.cgi?file=$INSTALLED/$pkg/receipt" + exit 0 + else + temp_receipt=$(mktemp -d) + wget -O $temp_receipt/receipt -T 5 http://hg.slitaz.org/wok/raw-file/tip/$pkg/receipt + if [ -e "$temp_receipt" ]; then + # Redirects to the receipt view + header "HTTP/1.1 301 Moved Permanently" "Location: index.cgi?file=$temp_receipt/receipt" + exit 0 + else + header; xhtml_header + msg err "$(_ 'Receipt for package %s unavailable' $pkg)" + xhtml_footer + exit 0 + fi + fi + ;; + esac +header + + # xHTML 5 header with special side bar for categories. TITLE=$(TEXTDOMAIN='tazpkg'; _ 'TazPanel - Packages') xhtml_header | sed 's/id="content"/id="content-sidebar"/' @@ -854,6 +901,8 @@ + +
@@ -869,6 +918,12 @@ $(show_info_links "$SUGGESTED" "$(_ 'Suggested')" 'info')
$(_ 'Name')$PACKAGE
+
+ + @@ -1335,7 +1390,156 @@ ;; - *) + *\ improve\ *) + # + # Improving packages by the community effort + # + search_form; sidebar + msg warn 'Under construction!
It is only imitation of working' + + pkg=$(GET improve) + user=$(POST user); type=$(POST type); text="$(POST text)" + login=$(POST login); password=$(POST password) + + login_c=$(COOKIE login); password_c=$(COOKIE password) + mail_hash=$(COOKIE mail_hash); user_name=$(COOKIE user_name) + + n=$'\n' + + if [ -n "$login" ]; then + # Get mail hash and user Name from bugs.slitaz.org + page="$(busybox wget --post-data "auth=${login}&pass=${password}&id=" \ + -O- "http://bugs.slitaz.org/bugs.cgi?user=${login}")" + # Parse page and get: + mail_hash="$(echo "$page" | fgrep '

' | cut -d/ -f5 | cut -c 1-32)" + user_name="$(echo "$page" | fgrep '

' | cut -d'>' -f3 | cut -d'<' -f1)" + + # Put variables to the session Cookies (they clean in browser close) + cat < + document.cookie = "login=$login"; + document.cookie = "password=$password"; + document.cookie = "mail_hash=$mail_hash"; + document.cookie = "user_name=$user_name"; + +EOT + login_c="$login"; password_c="$password" + fi + + if [ -z "$login_c" ]; then + cat < +
$(_ 'Please log in using your TazBug account.')
+
+ + + + + + + +
$(_ 'Login:')
$(_ 'Password:')
+
+
+ + +EOT + xhtml_footer; exit 0 + fi + + + # Get receipt variables, show Install/Remove buttons + if [ -d $INSTALLED/$pkg ]; then + . $INSTALLED/$pkg/receipt + else + cd $PKGS_DB + eval "$(awk -F$'\t' -vp=$pkg ' + $1==p{ + printf "VERSION=\"%s\"; SHORT_DESC=\"%s\"; TAGS=\"%s\"; ", $2, $4, $6 + }' packages.info undigest/*/packages.info)" + fi + + RECEIPT="$(wget -O - http://hg.slitaz.org/wok/raw-file/tip/$pkg/receipt | htmlize)" + DESCRIPTION="$(wget -O - http://hg.slitaz.org/wok/raw-file/tip/$pkg/description.txt | htmlize)" + DESCRIPTION="$(separator)$n${DESCRIPTION:-(empty)}$n$(separator)" + + if [ -z "$type" ]; then + cat < +
+ $(_ 'Improve package "%s"' $pkg) +
+
+ +
+ Current version: $VERSION${n}New version: $VERSION${n}Link to announce: http:// + Short description (English):$n$SHORT_DESC + Short description (English):$n$SHORT_DESC$n${n}Language: $LANG${n}Short description:$n$SHORT_DESC + Description (English):$n$DESCRIPTION + Language: $LANG${n}Description:$n$DESCRIPTION + Old category: $CATEGORY${n}New category: $CATEGORY + Tags: $TAGS + Link to application icon (48x48px): http:// + Link to application screenshot: http:// + $RECEIPT + +
+ +
+ + + + +
+ + +  $(_ 'How can you help:')
+ +
$user_name + +
+ + + +
+ +EOT + else + cat < +
+ $(_ 'Thank you!') +
+
+
The following information was sent to SliTaz developers:
+
User: $user
+Type: $type
+Package: $pkg
+Message:
+$(echo "$text" | htmlize)
+ +EOT + fi + ;; + + + *) # # Default to summary # diff -r 0fc40a0f873f -r c389814e4f9a tazpanel/pkgs.css --- a/tazpanel/pkgs.css Mon Apr 13 11:53:19 2015 +0300 +++ b/tazpanel/pkgs.css Sat Apr 18 16:25:03 2015 +0300 @@ -160,3 +160,19 @@ /* Disable too much borders */ section .hborders thead tr { border-top: none; border-bottom: 1pt solid #DDD; } + + +#appImg { vertical-align: top; width: 48px; padding: 0; margin: 0; } +#appImg img { height: 48px !important; width: 48px !important; } + + +#user_info { + float: right; + padding: 0.2rem; margin: 0.2rem; + font-size: 1rem; + vertical-align: bottom; +} +#user_info img { + padding: 0; margin: 0; + vertical-align: bottom; +}