#!/mod/bin/jimsh

package require cgi
source /mod/webif/lib/setup
require ts.class queue.class

httpheader

set dir [cgi_get dir]

puts "<div id=deleting class=blood><img src=/img/spin.gif>De-queuing...</div>"
puts "<ul style=\"list-style-type: square\">"

foreach file [cgi_get files] {
	set ts [ts fetch $file]
	if {$ts eq 0} continue

	puts -nonewline "<li>\"$file\"..."

	if {[string first "$dir/" $file] != 0} {
		puts "Error - outside directory."
	} else {
		queue delete $ts
	}

	puts "</li>"
}
puts "</ul>"
