source: branches/New_Config_Format-branch/gsdl/cgi-bin/webpage_buildstatus.pl@ 1279

Last change on this file since 1279 was 1279, checked in by sjboddie, 24 years ago

merged changes to trunk into New_Config_Format branch

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.6 KB
Line 
1#!perl -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;
33
34require util;
35require webpageutil;
36
37sub parse_cgiargs
38{
39 # get arguments
40 my $cgi = new CGI;
41 my %args = ();
42
43 foreach $p ($cgi->param())
44 {
45 $args{$p} = $cgi->param($p);
46 }
47
48 return \%args;
49}
50
51
52sub main
53{
54 # get arguments
55 my $args = parse_cgiargs();
56 my $bc1finished = 0;
57
58 my $tmpname = $args->{'bc1tmpname'};
59 if (!defined($tmpname))
60 {
61 my $mess = "Temporary filename for building communication not defined.";
62 $bc1finished = 1;
63 &webpageutil::status_location($args,$mess,$tmpname,$bc1finished);
64 return;
65 }
66
67 my $full_tmpname = &util::filename_cat($ENV{'GSDLHOME'},"tmp");
68
69 if (!-d $full_tmpname) {
70 mkdir ($full_tmpname, 0777);
71 }
72
73 $full_tmpname = &util::filename_cat($full_tmpname, $tmpname);
74
75 if (open(TMPIN,"<$full_tmpname"))
76 {
77 my @tmp_text = ();
78 my $line;
79 while (defined($line=<TMPIN>))
80 {
81 chomp $line;
82 push(@tmp_text,$line);
83 }
84 my $mess = join(" ",@tmp_text);
85 $bc1finished = 1 if ($mess eq "Done");
86 $bc1finished = -1 if ($mess =~ m/^Error:/);
87 # escape backslashes so they don't vanish from printed filenames
88 $mess =~ s/\\/\\\\/g;
89 &webpageutil::status_location($args,$mess,$tmpname,$bc1finished);
90
91 close(TMPIN);
92 }
93 else
94 {
95 my $mess = "Unable to open for reading temporary file: $full_tmpname.";
96 $bc1finished = 1;
97 &util::rm($full_tmpname);
98 &webpageutil::status_location($args,$mess,$tmpname,$bc1finished);
99 return;
100 }
101}
102
103&main();
Note: See TracBrowser for help on using the repository browser.