- Timestamp:
- 2000-07-13T10:21:53+12:00 (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/New_Config_Format-branch/gsdl/bin/script/buildcol.pl
r1031 r1279 54 54 print STDERR " -keepold will not destroy the current contents of the\n"; 55 55 print STDERR " building directory\n"; 56 print STDERR " -allclassifications Don't remove empty classifications\n\n"; 56 print STDERR " -allclassifications Don't remove empty classifications\n"; 57 print STDERR " -create_images Attempt to create default images for new\n"; 58 print STDERR " collection. This relies on the Gimp being\n"; 59 print STDERR " installed along with relevant perl modules\n"; 60 print STDERR " to allow scripting from perl\n\n"; 57 61 } 58 62 … … 61 65 { 62 66 my ($verbosity, $archivedir, $cachedir, $builddir, $maxdocs, 63 $debug, $mode, $indexname, $keepold, $allclassifications); 67 $debug, $mode, $indexname, $keepold, $allclassifications, 68 $create_images); 64 69 if (!parsargv::parse(\@ARGV, 65 70 'verbosity/\d+/2', \$verbosity, … … 72 77 'index/.*/', \$indexname, 73 78 'keepold', \$keepold, 74 'allclassifications', \$allclassifications)) { 79 'allclassifications', \$allclassifications, 80 'create_images', \$create_images)) { 75 81 &print_usage(); 76 82 die "\n"; … … 85 91 # read the configuration file 86 92 $textindex = "section:text"; 87 $configfilename = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "etc /collect.cfg");93 $configfilename = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "etc", "collect.cfg"); 88 94 if (-e $configfilename) { 89 95 $collectcfg = &colcfg::read_collect_cfg ($configfilename); … … 101 107 } 102 108 109 # create default images if required 110 if ($create_images) { 111 my $collection_name = $collection; 112 $collection_name = $collectcfg->{'collectionmeta'}->{'collectionname'} 113 if defined $collectcfg->{'collectionmeta'}->{'collectionname'}; 114 115 &create_images ($collection_name); 116 } 117 103 118 # fill in the default archives and building directories if none 104 119 # were supplied, turn all \ into / and remove trailing / … … 177 192 } 178 193 179 194 sub create_images { 195 my ($collection_name) = @_; 196 197 my $image_script = &util::filename_cat ($ENV{'GSDLHOME'}, "bin", "script", "gimp", "title_icon.pl"); 198 if (!-e $image_script) { 199 print STDERR "WARNING: Image making script ($image_script) could not be found\n"; 200 print STDERR " Default images will not be generated\n\n"; 201 return; 202 } 203 204 my $imagedir = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "images"); 205 206 &util::mk_all_dir ($imagedir); 207 208 # create the images 209 system ("$image_script -size 1.5 -image_dir \"$imagedir\" -filename $collection.gif -text \"$collection_name\""); 210 system ("$image_script -image_dir \"$imagedir\" -filename ${collection}sm.gif -text \"$collection_name\""); 211 212 # update the collect.cfg configuration file (this will need 213 # to be changed when the config file format changes) 214 if (!open (CFGFILE, $configfilename)) { 215 print STDERR "WARNING: Couldn't open config file ($configfilename)\n"; 216 print STDERR " for updating so collection images may not be linked correctly\n"; 217 return; 218 } 219 220 my $line = ""; my $file = ""; 221 my $found = 0; my $foundsm = 0; 222 while (defined ($line = <CFGFILE>)) { 223 if ($line =~ /collectionmeta\s+iconcollection\s+/) { 224 $line = "collectionmeta iconcollection _httprefix_/collect/$collection/images/$collection.gif\n"; 225 $found = 1; 226 } elsif ($line =~ /collectionmeta\s+iconcollectionsmall\s+/) { 227 $line = "collectionmeta iconcollectionsmall _httprefix_/collect/$collection/images/${collection}sm.gif\n"; 228 $foundsm = 1; 229 } 230 $file .= $line; 231 } 232 close CFGFILE; 233 234 $file .= "collectionmeta iconcollection _httprefix_/collect/$collection/images/$collection.gif\n" if !$found; 235 $file .= "collectionmeta iconcollectionsmall _httprefix_/collect/$collection/images/${collection}sm.gif\n" if !$foundsm; 236 237 if (!open (CFGFILE, ">$configfilename")) { 238 print STDERR "WARNING: Couldn't open config file ($configfilename)\n"; 239 print STDERR " for updating so collection images may not be linked correctly\n"; 240 return; 241 } 242 print CFGFILE $file; 243 close CFGFILE; 244 }
Note:
See TracChangeset
for help on using the changeset viewer.