wok-next annotate xarchiver/stuff/xarchiver.cgi @ rev 18541

Add slitaz-icons-faenza-dark; plus various small fixes
author Aleksej Bobylev <al.bobylev@gmail.com>
date Thu Nov 05 21:30:50 2015 +0200 (2015-11-05)
parents 7893304f1666
children
rev   line source
al@16774 1 #!/bin/sh
al@16774 2 # Web utility to show & install suggested packages for xarchiver
al@16774 3 # Aleksej Bobylev <al.bobylev@gmail.com>, 2014.
al@16774 4
al@16774 5 . /usr/lib/slitaz/httphelper.sh
al@16774 6 . /etc/slitaz/slitaz.conf
al@16774 7 . /lib/libtaz.sh
al@16774 8 . /etc/locale.conf; export LANG LC_ALL
al@16774 9 export TEXTDOMAIN='tazpkg'
al@16774 10
al@16774 11 case "$(GET)" in
al@16774 12 img)
al@16774 13 header "HTTP/1.1 200 OK\nContent-type: image/png"
al@16774 14 case "$(GET img)" in
al@16774 15 yes) cat /usr/share/icons/SliTaz/actions/22/gtk-ok.png ;;
al@16774 16 not) cat /usr/share/icons/SliTaz/actions/22/gtk-remove.png ;;
al@16774 17 fav) cat /usr/share/icons/hicolor/16x16/apps/xarchiver.png ;;
al@16774 18 log) cat /usr/share/icons/hicolor/48x48/apps/xarchiver.png ;;
al@16774 19 esac ;;
al@16774 20 *)
al@16774 21 header
al@16774 22 cat << EOT
al@16774 23 <!DOCTYPE html>
al@16774 24 <html>
al@16774 25 <head>
al@16774 26 <meta charset="utf-8" />
al@16774 27 <title>Xarchiver</title>
al@16774 28 <link rel="shortcut icon" type="image/png" href="?img=fav">
al@16774 29 <style type="text/css">
al@16774 30 *{font-family:sans}
al@16774 31 img{vertical-align:middle;}
al@16774 32 #installer{display:none}
al@16774 33 </style>
al@16774 34 <script type="text/javascript">
al@16774 35 function inst(actpkg) {
al@18541 36 document.getElementById("installer").src = "http://127.0.0.1:82/user/pkgs.cgi?do=" + actpkg
al@16774 37 }
al@16774 38 function on_load(iframe) {
al@16774 39 if (iframe.src !== "http://localhost/cgi-bin/xarchiver.cgi") {location.reload(false)}
al@16774 40 }
al@16774 41 </script>
al@16774 42 </head>
al@16774 43 <body>
al@16774 44 <div style="border:1pt solid gray; border-radius:6pt; margin:6pt; padding:6pt;">
al@16774 45 <table><tr><td style="vertical-align:top"><img src="?img=log" /></td>
al@16774 46 <td>$(cat $INSTALLED/xarchiver/description.txt)</td></table>
al@16774 47 </div>
al@16774 48 <p>Here you can install some SliTaz packages using TazPanel on the background.
al@16774 49 Note that you always have tiny versions of <strong>gzip</strong> and <strong>cpio</strong> (as part of Busybox), so you may not install its "official" versions.</p>
al@16774 50 <table>
al@16774 51 <tbody>
al@16774 52 EOT
al@16774 53 for pkg in ar arj bzip2 cpio gzip lha lzma lzop rar xz zip 7z xdg-utils; do
al@16774 54
al@16774 55 case $pkg in
al@16774 56 ar) pkg2=binutils ;;
al@16774 57 7z) pkg2=p7zip-full ;;
al@16774 58 *) pkg2=$pkg ;;
al@16774 59 esac
al@16774 60
al@16774 61 if [ -d $INSTALLED/$pkg2 ]; then
al@16774 62 img=yes; act=Remove; desc="$(_ Remove)"
al@16774 63 else
al@16774 64 img=not; act=Install; desc="$(_ Install)"
al@16774 65 fi
al@18541 66 echo "<tr><td><img src=\"?img=$img\" /> $pkg</td></td><td><button type=\"submit\" onclick='inst(\"${act}&pkg=${pkg2}\")'>$desc</button></td></tr>"
al@16774 67 done
al@16774 68 cat << EOT
al@16774 69 </tbody>
al@16774 70 </table>
al@16774 71 <iframe id="installer" src="" onload="on_load(this)"></iframe>
al@16774 72 </body>
al@16774 73 </html>
al@16774 74 EOT
al@16774 75 ;;
al@16774 76 esac
al@16774 77 exit 0