Changeset 10339
- Timestamp:
- 2005-07-28T11:52:21+12:00 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/bin/script/exportcol.pl
r10225 r10339 31 31 } 32 32 33 use strict; 34 no strict 'refs'; # allow filehandles to be variables and vice versa 35 no strict 'subs'; # allow barewords (eg STDERR) as function arguments 36 33 37 use util; 34 use pars argv;38 use parse2; 35 39 use printusage; 36 40 … … 39 43 'desc' => "{scripts.language}", 40 44 'type' => "string", 41 'reqd' => "no" },42 { 'name' => "xml",43 'desc' => "{scripts.xml}",44 'type' => "flag",45 45 'reqd' => "no" }, 46 46 { 'name' => "out", … … 62 62 'type' => "string", 63 63 'deft' => "exported_collections", 64 'reqd' => "no" } ]; 64 'reqd' => "no" }, 65 { 'name' => "xml", 66 'desc' => "{scripts.xml}", 67 'type' => "flag", 68 'reqd' => "no", 69 'hiddengli' => "yes" }, 70 { 'name' => "gli", 71 'desc' => "", 72 'type' => "flag", 73 'reqd' => "no", 74 'hiddengli' => "yes" }, 75 76 ]; 65 77 66 78 my $options = { 'name' => "exportcol.pl", … … 77 89 78 90 sub main { 79 my ($language, $out, $cdname, $ gli);91 my ($language, $out, $cdname, $cddir, $gli); 80 92 81 93 my $xml = 0; 82 my $no_netscape = 0; 83 84 if (!parsargv::parse(\@ARGV, 85 'language/.*/', \$language, 86 'out/.*/STDERR', \$out, 87 'cdname/.*/Greenstone Collections', \$cdname, 88 'cddir/.*/exported_collections', \$cddir, 89 'gli', \$gli, 90 'nonetscape', \$no_netscape, 91 q^xml^, \$xml)) { 92 93 &PrintUsage::print_txt_usage($options, "{exportcol.params}"); 94 die "\n"; 95 } 96 97 my $use_netscape = ($no_netscape) ? 0 : 1; 94 my $nonetscape = 0; 95 96 my $hashParsingResult = {}; 97 my $blnParseFailed = "false"; 98 # parse options 99 my $intArgLeftinAfterParsing = parse2::parse(\@ARGV,$arguments,$hashParsingResult,"allow_extra_options"); 100 # don't care how many args are left - can have multiple collection names 101 foreach my $strVariable (keys %$hashParsingResult) 102 { 103 eval "\$$strVariable = \$hashParsingResult->{\"\$strVariable\"}"; 104 } 105 106 # If $language has been specified, load the appropriate resource bundle 107 # (Otherwise, the default resource bundle will be loaded automatically) 108 if ($language && $language =~ /\S/) { 109 &gsprintf::load_language_specific_resource_bundle($language); 110 } 111 112 if ($xml) { 113 &PrintUsage::print_xml_usage($options); 114 print "\n"; 115 return; 116 } 117 118 if ($gli) { # the gli wants strings to be in UTF-8 119 &gsprintf::output_strings_in_UTF8; 120 } 121 122 my $use_netscape = ($nonetscape) ? 0 : 1; 98 123 99 124 # If $language has been specified, load the appropriate resource bundle … … 112 137 } 113 138 114 # No longer needed now -cddir flag also included (with default)115 # my $dirname="";116 # if ($cdname eq "") {117 # $cdname = "Greenstone Collections";118 # $dirname = "exported_collections";119 # } else {120 # $dirname = $cdname;121 # $dirname =~ s/\s//g;122 # $dirname = "exported_".$dirname;123 # }124 125 139 my @coll_list = @ARGV; 126 140 127 141 if (not @coll_list) { # empty list 128 142 &PrintUsage::print_txt_usage($options, "{exportcol.params}"); … … 148 162 # check each collection 149 163 my @valid_coll_list = (); 150 foreach $c (@coll_list) {164 foreach my $c (@coll_list) { 151 165 my $colldir = &util::filename_cat ($ENV{'GSDLHOME'}, "collect", $c); 152 166 if (! -d $colldir) { … … 217 231 print MANIFESTCFG "database:\n"; 218 232 print MANIFESTCFG ' etc '; 219 foreach $c (@valid_coll_list) {233 foreach my $c (@valid_coll_list) { 220 234 print MANIFESTCFG "collect\\$c\\index\\text\\$c.ldb "; 221 235 } … … 296 310 297 311 # copy the collections over 298 foreach $c (@valid_coll_list) {312 foreach my $c (@valid_coll_list) { 299 313 #old directories 300 314 my $colldir = &util::filename_cat ($ENV{'GSDLHOME'}, "collect", $c); … … 316 330 open INFILE, "<$collectcfg"; 317 331 open OUTFILE, ">$collectcfg.tmp"; 332 my $line; 318 333 while ($line = <INFILE>) { 319 334 if ($line =~ /^\s*public\s+false/) { … … 336 351 my $successcolls = ""; 337 352 my $first = 1; 338 foreach $c (@valid_coll_list) {353 foreach my $c (@valid_coll_list) { 339 354 if ($first) { 340 355 $first=0;
Note:
See TracChangeset
for help on using the changeset viewer.