#! /usr/local/bin/perl # # Replacement reuse repository # # modify fetches the repository entry to be editted, and posts # back to the user as a form for modification. # # $Header: /home1/horton/rds/bin/RCS/delete.pl,v 1.2 1998/10/19 06:14:17 horton Exp horton $ # cgi-bin/reuse/delete.pl $repository="/home/horton/rds/entries"; $librarian="horton"; # close (STDERR); # STDERR = STDOUT; chdir($repository) || die "Content-type: text/html\nCannot access database - " . $repository; #open (STDERR,"> /dev/null"); # RCS installed in /usr/local/bin $ENV{'PATH'} = $ENV{'PATH'} .":/usr/local/bin"; eval &'do_determine_entry; sub send_which_oid { printf("Content-type: text/html\n\n"); printf("Reuse\n"); printf("

Delete Asset number

"); printf("\n"); printf("Enter the asset number that you wish to delete.\n"); printf("Home\n"); printf("\n"); } sub do_determine_entry { do { &'send_which_oid; return; } unless defined @ARGV; local($oid) = $ARGV[0]; if (! -r $oid . ".html") { printf("Content-type: text/html\n\n%s.html cannot be opennedEntry %s cannot be found?\n\n", $oid, $oid) ; die $oid . ".html" . ":cannot open" ; } $user = $ENV{'REMOTE_USER'}; printf("Content-type: text/html\n\n"); printf("\n"); printf("CiTR Repository \n"); printf("\n"); printf("\n"); printf("

Delete Asset no. %s

\n", $oid); printf("
\n"); printf("Your username :

\n"); printf("Reason :

\n"); printf("\n"); printf("\n", $oid); printf("

\n"); printf("
\n");
	open(entry, $oid . ".html") ;
	$ioid = "";
	while() {
		if(($ioid eq "") && /^Object_Id\s*: (\d+)/) {
			$ioid = $1;
		}
# Translate plain text to HTML
#		s/\&/\&\;/g;
#		s/\/\>\;/g;
#		print $_ ;
		# Skip HTML
		print $_ unless /^\s*\n");

	printf("Home\n");
	printf("\n\n");

}

sub mail_error {
	$mess = $_[0];
	open (EM, "| mail $librarian");
	print EM "To: $librarian\n";
	print EM "Subject: error detected in repository entry deletion\n";
	print EM "--------\n";
	print EM "\n";
	print EM "$mess\n";
	close (EM);
	print STDERR "$mess\n";
}