wok-next diff xarchiver/stuff/xarchiver.cgi @ rev 17643

Up: reiserfsprogs 3.6.24
author Alexander Medvedev <devl547@gmail.com>
date Sat Feb 14 21:28:06 2015 +0000 (2015-02-14)
parents
children 61fdfde9104b
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/xarchiver/stuff/xarchiver.cgi	Sat Feb 14 21:28:06 2015 +0000
     1.3 @@ -0,0 +1,77 @@
     1.4 +#!/bin/sh
     1.5 +# Web utility to show & install suggested packages for xarchiver
     1.6 +# Aleksej Bobylev <al.bobylev@gmail.com>, 2014.
     1.7 +
     1.8 +. /usr/lib/slitaz/httphelper.sh
     1.9 +. /etc/slitaz/slitaz.conf
    1.10 +. /lib/libtaz.sh
    1.11 +. /etc/locale.conf; export LANG LC_ALL
    1.12 +export TEXTDOMAIN='tazpkg'
    1.13 +
    1.14 +case "$(GET)" in
    1.15 +	img)
    1.16 +		header "HTTP/1.1 200 OK\nContent-type: image/png"
    1.17 +		case "$(GET img)" in
    1.18 +			yes) cat /usr/share/icons/SliTaz/actions/22/gtk-ok.png ;;
    1.19 +			not) cat /usr/share/icons/SliTaz/actions/22/gtk-remove.png ;;
    1.20 +			fav) cat /usr/share/icons/hicolor/16x16/apps/xarchiver.png ;;
    1.21 +			log) cat /usr/share/icons/hicolor/48x48/apps/xarchiver.png ;;
    1.22 +		esac ;;
    1.23 +	*)
    1.24 +		header
    1.25 +		cat << EOT
    1.26 +<!DOCTYPE html>
    1.27 +<html>
    1.28 +<head>
    1.29 +	<meta charset="utf-8" />
    1.30 +	<title>Xarchiver</title>
    1.31 +	<link rel="shortcut icon" type="image/png" href="?img=fav">
    1.32 +	<style type="text/css">
    1.33 +		*{font-family:sans}
    1.34 +		img{vertical-align:middle;}
    1.35 +		#installer{display:none}
    1.36 +	</style>
    1.37 +	<script type="text/javascript">
    1.38 +	function inst(actpkg) {
    1.39 +		document.getElementById("installer").src = "http://localhost:82/pkgs.cgi?do=" + actpkg
    1.40 +	}
    1.41 +	function on_load(iframe) {
    1.42 +		if (iframe.src !== "http://localhost/cgi-bin/xarchiver.cgi") {location.reload(false)}
    1.43 +	}
    1.44 +	</script>
    1.45 +</head>
    1.46 +<body>
    1.47 +<div style="border:1pt solid gray; border-radius:6pt; margin:6pt; padding:6pt;">
    1.48 +<table><tr><td style="vertical-align:top"><img src="?img=log" /></td>
    1.49 +<td>$(cat $INSTALLED/xarchiver/description.txt)</td></table>
    1.50 +</div>
    1.51 +<p>Here you can install some SliTaz packages using TazPanel on the background.
    1.52 +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>
    1.53 +<table>
    1.54 +	<tbody>
    1.55 +EOT
    1.56 +		for pkg in ar arj bzip2 cpio gzip lha lzma lzop rar xz zip 7z xdg-utils; do
    1.57 +
    1.58 +			case $pkg in
    1.59 +				ar) pkg2=binutils ;;
    1.60 +				7z) pkg2=p7zip-full ;;
    1.61 +				*)  pkg2=$pkg ;;
    1.62 +			esac
    1.63 +
    1.64 +			if [ -d $INSTALLED/$pkg2 ]; then
    1.65 +				img=yes; act=Remove; desc="$(_ Remove)"
    1.66 +			else
    1.67 +				img=not; act=Install; desc="$(_ Install)"
    1.68 +			fi
    1.69 +			echo "<tr><td><img src=\"?img=$img\" /> $pkg</td></td><td><button type=\"submit\" onclick='inst(\"${act}&${pkg2}\")'>$desc</button></td></tr>"
    1.70 +		done
    1.71 +		cat << EOT
    1.72 +	</tbody>
    1.73 +</table>
    1.74 +<iframe id="installer" src="" onload="on_load(this)"></iframe>
    1.75 +</body>
    1.76 +</html>
    1.77 +EOT
    1.78 +		;;
    1.79 +esac
    1.80 +exit 0