Changeset 3872
- Timestamp:
- 2003-03-13T12:16:00+13:00 (21 years ago)
- Location:
- trunk/gsdl3/bin/script
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl3/bin/script/convert_coll_from_gs2.pl
r3771 r3872 23 23 print STDOUT "Usage: convert_coll_from_gs2.pl [options] coll-name\n"; 24 24 print STDOUT "options:\n"; 25 26 print STDOUT " -collectdir Directory where collection lives.\n"; 25 27 26 28 } … … 51 53 52 54 } 55 $xmlcollconfigfilename = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "etc", "collectionConfig.xml"); 56 my $xmlcollectcfg; 57 if (-e $collconfigfilename) { 58 $collectcfg = &colcfg::read_collect_cfg ($collconfigfilename); 59 60 } 61 62 53 63 $buildconfigfilename = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "building", "build.cfg"); 54 64 my $buildcfg; … … 75 85 76 86 $writer->startTag('buildConfig'); 77 78 if (defined $collectcfg->{'collectionmeta'}) { 79 my $collmeta = $collectcfg->{'collectionmeta'}; 80 $writer->startTag('metadataList'); 81 #just do collname for now 82 my $collnames = $collmeta->{'collectionname'}; 83 foreach $lang (keys %$collnames) { 84 my $short_lang; 85 if ($lang eq 'default') { 86 $short_lang = 'en'; 87 } else { 88 ($short_lang) = $lang =~ /^\[l=(..)\]/; 89 } 90 $writer->startTag('metadata', 'lang'=>$short_lang, 'name'=>'collName'); 91 $writer->characters($collnames->{$lang}); 92 $writer->endTag('metadata'); 93 } 94 my $collabouts = $collmeta->{'collectionextra'}; 95 foreach $lang (keys %$collabouts) { 96 my $short_lang; 97 if ($lang eq 'default') { 98 $short_lang = 'en'; 99 } else { 100 ($short_lang) = $lang =~ /^\[l=(..)\]/; 101 } 102 $writer->startTag('metadata', 'lang'=>$short_lang, 'name'=>'collDescript'); 103 $writer->characters($collabouts->{$lang}); 104 $writer->endTag('metadata'); 105 } 106 $writer->endTag('metadataList'); 107 } 108 109 87 88 #num docs 89 my $numdocs = $buildcfg->{'numdocs'}; 90 $writer->startTag('metadataList'); 91 $writer->startTag('metadata', 'name'=>'numDocs'); 92 $writer->characters($numdocs); 93 $writer->endTag('metadata'); 94 $writer->endTag('metadataList'); 95 96 110 97 #indexes 111 98 my $indexmap = {}; … … 156 143 157 144 #fieldlist 145 print STDOUT "trying fields\n"; 146 my $fieldmap = {}; 147 if (defined $buildcfg->{'indexfieldmap'}) { 148 print STDOUT "doing fields\n"; 149 $fieldmap_t = $buildcfg->{'indexfieldmap'}; 150 foreach $f (@$fieldmap_t) { 151 my ($k, $v) = $f =~ /^(.*)\-\>(.*)$/; 152 $fieldmap->{$k} = $v; 153 } 154 155 $writer->startTag('fieldList'); 156 foreach $f (keys %$fieldmap) { 157 $field = $fieldmap->{$f}; 158 $writer->emptyTag('field', 'shortname'=>$field, 'name'=>$f); 159 } 160 $writer->endTag('fieldList'); 161 } else { 162 print STDERR "indexfieldmap not defined"; 163 } 158 164 159 165 } elsif ($buildtype eq 'mg') { … … 198 204 $started_classifiers = 1; 199 205 } 200 my $ title = ''; #use buttonname if defined, otherwiseuse metadata206 my $content = ''; #use metadata 201 207 202 208 for ($i=0; $i<scalar(@$cl); $i++) { 203 209 $arg = @$cl[$i]; 204 if ($arg eq "- buttonname") {205 $ title= @$cl[$i+1];210 if ($arg eq "-metadata") { 211 $content = @$cl[$i+1]; 206 212 last; 207 213 } 208 if ($arg eq "-metadata") { 209 $title = @$cl[$i+1]; 210 } 211 } 212 213 $writer->startTag('classifier', 'name'=>$name); 214 $writer->startTag('metadataList'); 215 #title meta 216 $writer->startTag('metadata', 'name'=>'Title'); 217 $writer->characters($title); 218 $writer->endTag('metadata'); 219 $writer->endTag('metadataList'); 220 $writer->endTag('classifier'); 221 214 } 215 216 $writer->emptyTag('classifier', 'name'=>$name, 'content'=>$content); 222 217 223 218 } #foreach classifier -
trunk/gsdl3/bin/script/gs2_mkcol.pl
r3771 r3872 125 125 $line =~ s/\*\*defaultindex\*\*/$defaultindex/g; 126 126 $line =~ s/\*\*indexmeta\*\*/$indexmeta/g; 127 127 $line =~ s/\*\*xmlindexes\*\*/$xmlindexes/g; 128 $line =~ s/\*\*xmlplugins\*\*/$xmlpluginstring/g; 129 128 130 print OUTFILE $line; 129 131 } … … 239 241 # get the strings to include. 240 242 $pluginstring = ""; 243 $xmlpluginstring = ""; 241 244 foreach $plugin (@plugin) { 242 245 if ($plugin eq RecPlug) { 243 246 $pluginstring .= "plugin $plugin -use_metadata_files\n"; 247 $xmlpluginstring .= "<plugin name='$plugin'><option name='use_metadata_files'/></plugin>\n"; 244 248 } else { 245 249 $pluginstring .= "plugin $plugin\n"; 250 $xmlpluginstring .= "<plugin name='$plugin'/>\n"; 246 251 } 247 252 } … … 269 274 270 275 # set up the default indexes - this could be a command line option at some stage 276 # the names are added in here for the xml ones, but they should be added after building once the names are known. 271 277 if ($buildtype eq "mg") { 272 278 $indexes = "document:text document:Title document:Source"; … … 274 280 $indexmeta = "collectionmeta .document:text \"text\"\ncollectionmeta .document:Title \"titles\"\ncollectionmeta .document:Source \"filenames\"\n"; 275 281 282 $xmlindexes = "<index name='dtx' content='text' level='Document'><displayName lang='en'>text</displayName></index>\n<index name='dtt' content='Title' level='Document'><displayName lang='en'>titles</displayName></index>\n<index name='dsr' content='Source' level='Document'><displayName lang='en'>filenames</displayName></index>"; 276 283 } elsif ($buildtype eq "mgpp") { 277 284 $indexes = "text,metadata"; 278 285 $defaultindex = "text,metadata"; 279 286 $indexmeta = "collectionmeta .text,metadata \"text\"\n"; 287 $xmlindexes = "<index name='tm' content='text,metadata' level='Document'><displayName lang='en'>text</displayName></index>"; 280 288 } else { 281 289 print STDOUT "Error: buildtype should be mg or mgpp, but its $buildtype\n";
Note:
See TracChangeset
for help on using the changeset viewer.