#!/usr/bin/perl
# This script is part of the NoonQuilt project:
#
#
#
# © Ali Graham, 1998
#
# (See makeQuilt.pl for the version history.)
#
#
# Start of editPatch.pl ()
# ################################################################
# make sure this is syntactically clear...
use strict; use English;
# ...and running under Perl5...
require 5.001;
# uses a module available from
# CPAN ( http://www.perl.com/CPAN/ ),
# CGI_Lite
# set the include path to recognise it
use lib 'perllib';
# include the external files...
my $path = "";
if ( $OSNAME =~ /^mswin/i ) {
$path = "d:\\Inetpub\\wwwroot\\quilt\\scripts\\";
chdir($path);
}
(I needed to add the above lines to the start of every script, otherwise
the Perl interpreter on Windows NT would not change to the directory the
scripts were running in -- this is inconsistent with the behaviour on Unix,
Amiga & Macintosh Perl, which did.)
(require $path."nq_config.pl") or (die "Can't open \"nq_config.pl\": $!\n");
(require $path."nq_dirstuff.pl") or (die "Can't open \"nq_dirstuff.pl\": $!\n");
# ################################################################
# Start of main()
# check CGI - if pending, do edit for accept/reject, otherwise
# edit and save back. :)
use CGI_Lite;
my $cgi = new CGI_Lite ();
my %cgi_data = $cgi->parse_form_data();
my $params; my $patch_file; my $page_title;
my $source_dir;
my $defaults = &nqco_getScriptDefaults;
if ( $cgi_data{'subm_type'} eq "pending" ) {
$source_dir = $defaults->{'S_PatchInDir'};
$page_title = "processing a submitted patch";
} elsif ( $cgi_data{'subm_type'} eq "accepted" ) {
$source_dir = $defaults->{'S_PatchDir'};
$page_title = "editing an accepted patch";
} else {
$source_dir = $defaults->{'S_PatchRejectDir'};
$page_title = "editing a rejected patch";
}
The code above checks the location of the patch data file to
be edited: this is passed in by the HTML page that call this
script, which is generated by editList.pl.
The rest of the code below reads the data from the file and
generates the form and its contents as HTML which is passed to the
web server. The HTML is actually a trimmed-down version of submit.htm.
$patch_file = $cgi_data{'subm_file'};
$params = &nqco_readParameters("$source_dir$patch_file");
print STDOUT <
$page_title
|
|
$page_title
|
End_Header
if ($patch_file) {
my $status = "file name: $patch_file \n";
$status .= "current status: $cgi_data{'subm_type'}\n";
my $temp = ($params->{'F_AddressPublic'}{'Value'} eq "on");
my $check_address = $temp?" CHECKED":"";
print STDOUT <
End_EditPage
}
# End of editPatch.pl
|