#!/usr/local/bin/perl
# Display the current qmail queue

require './qmail-lib.pl';
&header($text{'queue_title'}, "");
print "<hr>\n";

@queue = &list_queue();
if (@queue) {
	print "<form action=delete_queues.cgi>\n";
	print "<table border width=100%>\n";
	print "<tr $tb> <td><br></td> <td><b>$text{'queue_id'}</b></td> ",
	      "<td><b>$text{'queue_date'}</b></td> ",
	      "<td><b>$text{'queue_from'}</b></td> ",
	      "<td><b>$text{'queue_to'}</b></td> </tr>\n";
	foreach $q (@queue) {
		print "<tr $cb>\n";
		print "<td><input type=checkbox name=file value=$q->{'file'}></td>\n";
		print "<td><a href='view_queue.cgi?file=$q->{'file'}'>$q->{'id'}</a></td>\n";
		print "<td>$q->{'date'}</td>\n";
		print "<td>",&html_escape($q->{'from'}),"</td>\n";
		print "<td>",&html_escape($q->{'to'}),"</td>\n";
		print "</tr>\n";
		}
	print "</table>\n";
	print "<a href='' onClick='document.forms[0].file.checked = true; for(i=0; i<document.forms[0].file.length; i++) { document.forms[0].file[i].checked = true; } return false'>$text{'queue_all'}</a>&nbsp;\n";
	print "<a href='' onClick='document.forms[0].file.checked = !document.forms[0].file.checked; for(i=0; i<document.forms[0].file.length; i++) { document.forms[0].file[i].checked = !document.forms[0].file[i].checked; } return false'>$text{'queue_invert'}</a>&nbsp;<p>\n";
	print "<input type=submit value='$text{'queue_delete'}'><p>\n";
	print "</form>\n";
	}
else {
	print "<b>$text{'queue_none'}</b> <p>\n";
	}

print "<hr>\n";
&footer("", $text{'index_return'});

