source: main/tags/2.37-cdrom/gsdl/perllib/colcfg.pm

Last change on this file was 2772, checked in by kjm18, 23 years ago

changes to enable language specific collectionmeta in collect.cfg
collectionmeta now specified as eg
collectionmeta collectionname [l=en] "greenstone demo"
any entries without language parameter are used as a default

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 4.0 KB
Line 
1###########################################################################
2#
3# colcfg.pm --
4# A component of the Greenstone digital library software
5# from the New Zealand Digital Library Project at the
6# University of Waikato, New Zealand.
7#
8# Copyright (C) 1999 New Zealand Digital Library Project
9#
10# This program is free software; you can redistribute it and/or modify
11# it under the terms of the GNU General Public License as published by
12# the Free Software Foundation; either version 2 of the License, or
13# (at your option) any later version.
14#
15# This program is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18# GNU General Public License for more details.
19#
20# You should have received a copy of the GNU General Public License
21# along with this program; if not, write to the Free Software
22# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23#
24###########################################################################
25
26# reads in a collection configuration file
27
28package colcfg;
29
30use cfgread;
31
32
33# the collection configuration file data is stored in the form
34#
35# {'creator'}->string
36# {'public'}->string
37# {'defaultindex'}->string
38# {'importdir'}->string
39# {'archivedir'}->string
40# {'cachedir'}->string
41# {'builddir'}->string
42# {'removeold'}->string
43# {'textcompress'}->string
44# {'buildtype'}->string
45
46# {'maintainer'}->array of strings
47# {'languages'}->array of strings
48# {'indexsubcollections'}->array of strings
49# {'indexes'}->array of strings
50# {'dontbuild'}->array of strings
51# {'dontgdbm'}->array of strings
52# {'mirror'}->array of strings
53# {'phind'}->array of strings
54# {'levels'}->array of strings (for mgpp eg Section, Paragraph)
55
56# {'subcollection'}->hash of key-value pairs
57
58# {'plugin'}->array of arrays of strings
59# {'classify'}->array of arrays of strings
60
61# {'collectionmeta'}->hash of key->hash of param-value -used
62# for language specification
63# for example, collectionmeta->collectionname->default->demo
64# ->mi->maori demo
65
66sub read_collect_cfg {
67 my ($filename) = @_;
68
69 return &cfgread::read_cfg_file ($filename,
70 q/^(creator|public|defaultindex|importdir|/ .
71 q/archivedir|cachedir|builddir|removeold|/ .
72 q/textcompress|buildtype|no_text|keepold|gzip/ .
73 q/verbosity|allclassifications|OIDtype|maxdocs|/ .
74 q/groupsize|sortmeta|debug|mode|create_images)$/,
75 q/(maintainer|languages|indexsubcollections|/ .
76 q/indexes|dontbuild|dontgdbm|mirror|phind|levels)$/,
77 q/^(subcollection)$/,
78 q/^(plugin|classify)$/,
79 q/^(collectionmeta)$/);
80}
81
82sub write_collect_cfg {
83 my ($filename, $data) = @_;
84
85 &cfgread::write_cfg_file($filename, $data,
86 q/^(creator|public|defaultindex|importdir|/ .
87 q/archivedir|cachedir|builddir|removeold|/ .
88 q/textcompress|buildtype|collectdir|no_text|allclassifications)$/,
89 q/^(maintainer|languages|indexsubcollections|/ .
90 q/indexes|dontbuild|dontgdbm|levels)$/,
91 q/^(subcollection)$/,
92 q/^(plugin|classify)$/,
93 q/^(collectionmeta)$/);
94}
95
96
97# the build configuration file data is stored in the form
98#
99# {'builddate'}->string
100# {'buildtype'}->string
101# {'metadata'}->array of strings
102# {'languages'}->array of strings
103# {'numdocs'}->string
104# {'numwords'}->string
105# {'numbytes'}->string
106# {'indexfields'}->array of strings
107# {'indexfieldmap'}->array of strings in the form "field->FI"
108# {'indexmap'} -> array of strings
109
110sub read_build_cfg {
111 my ($filename) = @_;
112
113 return &cfgread::read_cfg_file ($filename,
114 q/^(builddate|buildtype|numdocs|numwords|numbytes)$/,
115 q/^(metadata|languages|indexfields|indexfieldmap|indexmap)$/);
116}
117
118sub write_build_cfg {
119 my ($filename, $data) = @_;
120
121 &cfgread::write_cfg_file($filename, $data,
122 q/^(builddate|buildtype|numdocs|numwords|numbytes)$/,
123 q/^(metadata|languages|indexfieldsindexfieldmap|indexmap)$/);
124}
125
126
1271;
128
Note: See TracBrowser for help on using the repository browser.