#!/usr/pkg/bin/perl

use lib qw(../lib);
use strict;

use CGI::Tools;
use CGI::QueryString;

use TDS;
use TDS::Admin::Comment;
use TDS::Admin::Authorize;

################################################################
TDS::Admin::Authorize->PrintHTTPHeader();

my $command = param('command');
my $comment = new TDS::Admin::Comment;

if ($command eq 'form'){
    print $comment->AsEditForm;
} elsif ($command eq 'delete'){
    my @numbers;
    for (param()){
	next unless /^\d+$/;
	push(@numbers, $_);
    }
    $comment->DeleteComments(@numbers);
} else {
    print $comment->AsHTML(-1);
}

print qq(<hr><a href="./">[admin]</a>);
