#!/bin/sh
#
# Gallery Administration / List module
# Seung-young Kim <nobreak@kr.FreeBSD.org>
# 1999/04/17
#

db="gallery.request.db"
echo "Content-type: text/html"
echo ""

if [ ! "$SERVER_NAME" = "www.kr.FreeBSD.org" ]; then
	echo "<p>This script only works on www.kr.FreeBSD.org"
	exit 1
fi

list() {
	echo "<p><h3>$1</h3>"
	echo "<p><ul>"
	grep "^${1}|" "$db" | awk -F \| '{ printf "  <li><input type=\"checkbox\" name=\"%s\" value=\"delete\"> <b>%s</b>: <a href=\"%s\">%s</a><br><font size=\"2\">%s<br><a href=\"mailto:%s\">&lt;%s&gt;</a> -- %s</font><p>\n", $3, $2, $3, $3, $5, $4, $4, $6 }'
	echo "</ul>"
}

echo "<form action=\"/cgi-bin/gallery/gallerymerge.cgi\" method=\"post\">"

if [ "$1" ]; then
	list "$1"
else
	list "COMMERCIAL"
	list "NON-PROFIT"
	list "PERSONAL"
fi

echo "<input type=\"hidden\" name=\"returl\" value=\"/gallery/\">"
echo "<b>PASSWORD:</b> <input type=\"password\" name=\"password\">"
echo "<p><input type=\"submit\" value=\"  Resister all records except checked one  \">"
echo "</form>"

