Changeset 7588
- Timestamp:
- 2004-06-11T11:41:29+12:00 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/bin/script/unbuildv2.pl
r3324 r7588 3 3 ########################################################################### 4 4 # 5 # un index.pl --5 # unbuildv2.pl -- 6 6 # A component of the Greenstone digital library software 7 7 # from the New Zealand Digital Library Project at the … … 33 33 # updated. It probably needs some work done before using. 34 34 35 # Katherine updated this but apparently it still doesn't work. 36 35 37 BEGIN { 36 38 die "GSDLHOME not set\n" unless defined $ENV{'GSDLHOME'}; … … 40 42 } 41 43 44 use unbuildutil; 42 45 use doc; 43 46 use docsave; … … 127 130 &get_toplevel_OID ($gdbmfile); # puts a list of the top level document OIDs into $toplevelinfo 128 131 129 tie (%infodb, "GDBM_File", $gdbmfile, 1, 0); 132 #tie (%infodb, "GDBM_File", $gdbmfile, 1, 0); 133 134 #read ldb file into %infodb 135 &unbuildutil::read_gdbm($gdbmfile, \%infodb); 130 136 131 137 #this makes the files specifying the hierarchy of subjects, titles etc 132 138 foreach $classify (@$classifyinfo) { 133 139 134 &make_info_file($classify); 135 136 } 137 138 140 &make_info_file($classify); 141 142 } 143 139 144 140 145 #write out the collect.cfg … … 237 242 next if ($key =~ /^CL/); #ignore classification entries 238 243 next if ($value =~ /<section>/); #ignore docnum->OID entries 244 next if ($value =~ /<docoid>/); #ignore strange s133->OID entries 239 245 next if ($key !~ /\d/); #ignore collection, browse entries 240 246 … … 245 251 $/ = "\n"; 246 252 #print STDERR "toplevel sections are: ", join ("\n", @$toplevelinfo); 253 #print STDERR "\n"; 247 254 } 248 255 … … 251 258 252 259 my ($gdb_str_ref, $hashref) = @_; 253 254 260 my @entries = split(/\n/, $gdb_str_ref); 255 261 foreach $entry (@entries) { … … 257 263 $$hashref{$key} .= '@' if defined $$hashref{$key}; 258 264 $$hashref{$key} .= $value; 259 #print STDERR "key: $key, value: $value\n";265 260 266 } 261 267 … … 295 301 if (defined ($childs)) { 296 302 $childs =~ s/\@$//; #remove trailing @ 297 if ($childs =~ s/^\"//) { #remove initial " if there 298 @items = split /\;\"/, $childs; #split into .1 .2 .3 etc 299 foreach $item (@items) { 300 push (@$children, "$parentoid$item"); 301 } 302 } 303 else { # whole id is already present. split on ; and dont put parentoid in front 304 @items = split /\;/, $childs; 305 foreach $item (@items) { 306 push (@$children, "$item"); 307 } 308 } 309 #print STDERR "children are: ", join ("\n", @$children); 310 303 @items = split /\;/, $childs; #split on ; 304 foreach $item (@items) { 305 $item =~ s/^\"/$parentoid/; # replace " with parentoid 306 push (@$children, "$item"); 307 } 311 308 } 312 309 else { 313 310 $children = []; 314 311 } 315 316 317 }312 } 313 314 318 315 sub recurse_sections { 319 316 my ($doc_obj, $children, $parentoid, $parentsection, $olddir) = @_; … … 482 479 &mgcommand('.set query docnums'); 483 480 &mgcommand('.set term_freq off'); 481 &mgcommand('.set briefstats off'); 482 &mgcommand('.set memstats off'); 483 &mgcommand('.set sizestats off'); 484 &mgcommand('.set timestats off'); 484 485 } 485 486 … … 567 568 568 569 $/ = "\n"; 569 print STDERR "classifications are: ", join(", ", @$classifyinfo); 570 #print STDERR "classifications are: ", join(", ", @$classifyinfo); 571 #print STDERR "\n"; 572 570 573 } 571 574 … … 577 580 my ($classifier) = @_; 578 581 my $info_file = ""; 579 580 582 my $entry = $infodb{$classifier}; 581 #print STDERR "entry = $entry\n"; 583 582 584 my $hashref = {}; 583 585 &get_metadata($entry, $hashref); … … 586 588 $classifier_name =~ s/\@$//; #remove trailing @ 587 589 588 # check children - if all are documents at this level, dont need a589 # hierarchy so just put a AZList into config file590 # check children - if there is a classifier node at this level, 591 # use a hierarchy, otherwise use an AZList. 590 592 591 593 my $children=[]; 592 &get_whole_children($classifier, $hashref, $children); 593 if (&is_document($$children[0])) { 594 my $hierarchy = 0; 595 &get_whole_children($classifier, $hashref, $children); #returns a list of the child ids 596 foreach $child(@$children) { 597 if(not &is_document($child)) { 598 $hierarchy = 1; 599 last; 600 } 601 } 602 603 if (!$hierarchy) { 594 604 &add_classify_cfg_list($classifier_name); 595 596 605 }else { #there is a hierarchy so create a file 597 598 606 $info_file = "./etc/$classifier_name.txt"; 599 607 … … 615 623 sub process_entry { 616 624 my ($handle, $classifier_name, $classify_id) = @_; 617 618 625 my $value = $infodb{$classify_id}; 619 626 620 627 my $hashref={}; 621 622 628 &get_metadata($value, $hashref); 623 629 my $title = $hashref->{'Title'}; … … 631 637 &add_doc_metadata($child, $classifier_name, $title); 632 638 }else { 633 process_entry($handle, $classifier_name, $child);639 &process_entry($handle, $classifier_name, $child); 634 640 } 635 641 } … … 660 666 my ($handle, $classify_id, $title) = @_; 661 667 #print STDERR "classify id= $classify_id, title= $title\n"; 662 $title = &unicode::ascii2utf8($title); 663 668 $title = &unicode::ascii2utf8(\$title); 664 669 my ($num) = $classify_id =~ /^CL\d\.(.*)$/; #remove the CL1. from the front 665 670 … … 687 692 $collect_cfg->{'creator'}="$username\@cs.waikato.ac.nz"; 688 693 $collect_cfg->{'maintainer'}="$username\@cs.waikato.ac.nz"; 689 $collect_cfg->{'public'}=" false";694 $collect_cfg->{'public'}="true"; 690 695 $collect_cfg->{'beta'}="true"; 691 696 692 697 $collect_cfg->{'plugin'}=[]; 693 push (@{$collect_cfg->{'plugin'}}, ["G MLPlug"]);698 push (@{$collect_cfg->{'plugin'}}, ["GAPlug"]); 694 699 push (@{$collect_cfg->{'plugin'}}, ["ArcPlug"]); 695 700 push (@{$collect_cfg->{'plugin'}}, ["RecPlug"]); … … 704 709 $collect_cfg->{'collectionmeta'}={}; 705 710 $collect_cfg->{'collectionmeta'}->{'collectionname'}="\"$collection\""; 706 $collect_cfg->{'collectionmeta'}->{'iconcollection'}="\" http://www.nzdl.org/gsdl/collect/$collection/images/$collection.gif\"";707 $collect_cfg->{'collectionmeta'}->{'iconcollectionsmall'}="\" http://www.nzdl.org/gsdl/collect/$collection/images/${collection}sm.gif\"";711 $collect_cfg->{'collectionmeta'}->{'iconcollection'}="\"_httpprefix_/collect/$collection/images/$collection.gif\""; 712 $collect_cfg->{'collectionmeta'}->{'iconcollectionsmall'}="\"_httpprefix_/collect/$collection/images/${collection}sm.gif\""; 708 713 $collect_cfg->{'collectionmeta'}->{'collectionextra'} = "\"This is a collection rebuilt from CDROM.\""; 709 710 711 712 714 713 715 } … … 751 753 my ($title) = $classifier_name =~ /^CL(.*)$/; 752 754 my ($filename) = $file =~ /\/([^\/]*)$/; 753 my $entry = "Hierarchy hfile=$filename metadata=$classifier_name title=$title sort=Title";755 my $entry = "Hierarchy -hfile $filename -metadata $classifier_name -buttonname $title -sort Title"; 754 756 push (@{$collect_cfg->{'classify'}},[$entry]); 755 757 … … 762 764 $collect_cfg->{'classify'} = [] unless defined $collect_cfg->{'classify'}; 763 765 my ($title) = $classifier =~ /^CL(.*)$/; 764 my $entry = "AZList metadata=$classifier title=$title";766 my $entry = "AZList -metadata $classifier -buttonname $title"; 765 767 push (@{$collect_cfg->{'classify'}},[$entry]); 766 768 }
Note:
See TracChangeset
for help on using the changeset viewer.