source: trunk/gsdl/cgi-bin/webpage_buildstatus.pl@ 724

Last change on this file since 724 was 724, checked in by davidb, 25 years ago

Perl CGI scripts to help in webpage based collection building.

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.4 KB
Line 
1#!/usr/local/bin/perl5 -w
2
3###########################################################################
4#
5# webpage_buildstatus.pl --
6# A component of the Greenstone digital library software
7# from the New Zealand Digital Library Project at the
8# University of Waikato, New Zealand.
9#
10# Copyright (C) 1999 New Zealand Digital Library Project
11#
12# This program is free software; you can redistribute it and/or modify
13# it under the terms of the GNU General Public License as published by
14# the Free Software Foundation; either version 2 of the License, or
15# (at your option) any later version.
16#
17# This program is distributed in the hope that it will be useful,
18# but WITHOUT ANY WARRANTY; without even the implied warranty of
19# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20# GNU General Public License for more details.
21#
22# You should have received a copy of the GNU General Public License
23# along with this program; if not, write to the Free Software
24# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25#
26###########################################################################
27
28# This program is a webpage wrapper that checks on the progress of
29# import.pl and buildcol.pl processes
30
31use CGI;
32use GSDLHOME;
33use Fcntl ':flock';
34
35require util;
36require webpageutil;
37
38sub parse_cgiargs
39{
40 # get arguments
41 my $cgi = new CGI;
42 my %args = ();
43
44 foreach $p ($cgi->param())
45 {
46 $args{$p} = $cgi->param($p);
47 }
48
49 return \%args;
50}
51
52
53sub main
54{
55 # get arguments
56 my $args = parse_cgiargs();
57 my $bc1finished = 0;
58
59 my $tmpname = $args->{'bc1tmpname'};
60 if (!defined($tmpname))
61 {
62 my $mess = "Temporary filename for building communication not defined.";
63 $bc1finished = 1;
64 &webpageutil::status_location($args,$mess,$tmpname,$bc1finished);
65 return;
66 }
67
68 my $full_tmpname
69 = &util::filename_cat($ENV{'GSDLHOME'},"tmp",$tmpname);
70
71 if (open(TMPIN,"<$full_tmpname"))
72 {
73 my @tmp_text = ();
74 my $line;
75 while (defined($line=<TMPIN>))
76 {
77 chomp $line;
78 push(@tmp_text,$line);
79 }
80 my $mess = join(" ",@tmp_text);
81 $bc1finished = 1 if ($mess eq "Done");
82 $bc1finished = -1 if ($mess =~ m/^Error:/);
83 &webpageutil::status_location($args,$mess,$tmpname,$bc1finished);
84
85 close(TMPIN);
86 }
87 else
88 {
89 my $mess = "Unable to open for reading temporary file: $full_tmpname.";
90 $bc1finished = 1;
91 &util::rm($full_tmpname);
92 &webpageutil::status_location($args,$mess,$tmpname,$bc1finished);
93 return;
94 }
95}
96
97&main();
98
99
100
101
102
Note: See TracBrowser for help on using the repository browser.