source: main/tags/2.20/gsdl/cgi-bin/webpage_buildstatus.pl@ 25588

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

attempting to get end-user collection building working under windows

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.5 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;
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 = &util::filename_cat($ENV{'GSDLHOME'},"tmp");
69
70 if (!-d $full_tmpname) {
71 mkdir ($full_tmpname, 0777);
72 }
73
74 $full_tmpname = &util::filename_cat($full_tmpname, $tmpname);
75
76 if (open(TMPIN,"<$full_tmpname"))
77 {
78 my @tmp_text = ();
79 my $line;
80 while (defined($line=<TMPIN>))
81 {
82 chomp $line;
83 push(@tmp_text,$line);
84 }
85 my $mess = join(" ",@tmp_text);
86 $bc1finished = 1 if ($mess eq "Done");
87 $bc1finished = -1 if ($mess =~ m/^Error:/);
88 &webpageutil::status_location($args,$mess,$tmpname,$bc1finished);
89
90 close(TMPIN);
91 }
92 else
93 {
94 my $mess = "Unable to open for reading temporary file: $full_tmpname.";
95 $bc1finished = 1;
96 &util::rm($full_tmpname);
97 &webpageutil::status_location($args,$mess,$tmpname,$bc1finished);
98 return;
99 }
100}
101
102&main();
103
104
105
106
107
Note: See TracBrowser for help on using the repository browser.