source: main/tags/2.21/gsdl/cgi-bin/webpage_editcol.pl@ 24210

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

got end-user collection building to work (almost) on windows 95.
there's still a problem with the gsdl_system routine, at least when
using the apache webserver. I can't get the server to carry on with
running library.exe (and displaying building update pages) as it waits
until the spawned building process finishes first. It works on NT.

  • 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_editcol.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 for saving an edited config file
29
30use CGI;
31use GSDLHOME;
32use gflock;
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
52
53sub main
54{
55 # get arguments
56 my $args = parse_cgiargs();
57
58 my $dirname = $args->{'bc1dirname'};
59 if (!defined($dirname))
60 {
61 # directory name derived from the collection name missing
62 my $mess = "Directory name for collection missing.";
63 &webpageutil::error_location($args,$mess);
64 return;
65 }
66
67 my $cfg_filename
68 = &util::filename_cat($ENV{'GSDLHOME'},"collect",$dirname,"etc","collect.cfg");
69
70 if (open(CFGOUT,">$cfg_filename"))
71 {
72 if (&gflock::lock (CFGOUT)) {
73 my $cfg_text = $args->{'bc1cfgfile'};
74 print CFGOUT "$cfg_text";
75 &gflock::unlock (CFGOUT);
76 close(CFGOUT);
77 }
78 else
79 {
80 # problem locking file
81 my $mess = "Unable to lock configuration file: $cfg_filename";
82 &webpageutil::error_location($args,$mess);
83 return;
84 }
85 }
86 else
87 {
88 # unable to open configuration file for writing
89 my $mess = "Unable to open for writing configuration file: $cfg_filename";
90 &webpageutil::error_location($args,$mess);
91 return;
92 }
93
94 my $mess_url = "$args->{'httpbuild'}&bca=mess&bc1dirname=$dirname";
95 print "Location: $mess_url&head=_headdone_&mess=_messdoneeditcol_\n\n";
96 return;
97
98}
99
100&main();
101
102
103
104
105
Note: See TracBrowser for help on using the repository browser.