Changeset 8361


Ignore:
Timestamp:
2004-10-18T14:59:51+13:00 (20 years ago)
Author:
kjdon
Message:

renamed build option 'allclassifications' to 'remove_empty_classifications' - this means that empty classifications (classifiers and internal nodes) are displayed by default now. Note, if a collection has been built previously by the GLI, and allclassifications options used, then this will crap out building until that old option is deleted from collname.col file

Location:
trunk/gsdl
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/bin/script/buildcol.pl

    r7950 r8361  
    5757
    5858my $arguments =
    59     [ { 'name' => "allclassifications",
    60     'desc' => "{buildcol.allclassifications}",
    61     'type' => "flag",
    62     'reqd' => "no",
    63     'modegli' => "2" },
     59    [ { 'name' => "remove_empty_classifications",
     60    'desc' => "{buildcol.remove_empty_classifications}",
     61    'type' => "flag",
     62    'reqd' => "no",
     63    'modegli' => "3" },
    6464      { 'name' => "archivedir",
    6565    'desc' => "{buildcol.archivedir}",
     
    164164{
    165165    my ($verbosity, $archivedir, $cachedir, $builddir, $maxdocs,
    166     $debug, $mode, $indexname, $keepold, $allclassifications,
     166    $debug, $mode, $indexname, $keepold, $remove_empty_classifications,
    167167    $create_images, $collectdir, $out, $buildtype, $textindex,
    168168    $no_strip_html, $no_text, $faillog, $gli);
     
    186186             'no_text', \$no_text,
    187187             'keepold', \$keepold,
    188              'allclassifications', \$allclassifications,
     188             'remove_empty_classifications', \$remove_empty_classifications,
    189189             'create_images', \$create_images,
    190190             'collectdir/.*/', \$collectdir,
     
    298298        }
    299299    }
    300     if (defined $collectcfg->{'allclassifications'} && $allclassifications == 0) {
    301         if ($collectcfg->{'allclassifications'} =~ /^true$/i) {
    302         $allclassifications = 1;
     300    if (defined $collectcfg->{'remove_empty_classifications'} && $remove_empty_classifications == 0) {
     301        if ($collectcfg->{'remove_empty_classifications'} =~ /^true$/i) {
     302        $remove_empty_classifications = 1;
    303303        }
    304304    }
     
    397397    eval("\$builder = new $buildertype(\$collection, " .
    398398     "\$realarchivedir, \$realbuilddir, \$verbosity, " .
    399      "\$maxdocs, \$debug, \$keepold, \$allclassifications, " .
     399     "\$maxdocs, \$debug, \$keepold, \$remove_empty_classifications, " .
    400400     "\$out, \$no_text, \$faillog, \$gli)");
    401401    die "$@" if $@;
  • trunk/gsdl/perllib/classify.pm

    r8275 r8361  
    153153# to the gdbm
    154154sub output_classify_info {
    155     my ($classifiers, $handle, $allclassifications, $gli) = @_;
     155    my ($classifiers, $handle, $remove_empty_classifications, $gli) = @_;
    156156#    $handle = "main::STDOUT";
    157157
     
    172172    }
    173173
    174     &print_classify_info ($handle, $classifyinfo, "", $allclassifications);
     174    &print_classify_info ($handle, $classifyinfo, "", $remove_empty_classifications);
    175175}
    176176
    177177sub print_classify_info {
    178     my ($handle, $classifyinfo, $OID, $allclassifications) = @_;
     178    my ($handle, $classifyinfo, $OID, $remove_empty_classifications) = @_;
    179179
    180180    $OID =~ s/^\.+//; # just for good luck
     
    184184 
    185185    # don't want empty classifications
    186     if ($allclassifications || &check_contents ($classifyinfo) > 0) {
     186    return if ($remove_empty_classifications && &check_contents ($classifyinfo) == 0);
    187187   
    188     $OID = $classifyinfo->{'classifyOID'} if defined ($classifyinfo->{'classifyOID'});
     188    $OID = $classifyinfo->{'classifyOID'} if defined ($classifyinfo->{'classifyOID'});
    189189   
    190     my $outputtext = "[$OID]\n";
    191     $outputtext .= "<doctype>classify\n";
    192     $outputtext .= "<hastxt>0\n";
    193     $outputtext .= "<childtype>$classifyinfo->{'childtype'}\n"
    194         if defined $classifyinfo->{'childtype'};
    195     $outputtext .= "<Title>$classifyinfo->{'Title'}\n"
    196         if defined $classifyinfo->{'Title'};
    197     $outputtext .= "<numleafdocs>$classifyinfo->{'numleafdocs'}\n"
    198         if defined $classifyinfo->{'numleafdocs'};
    199     $outputtext .= "<thistype>$classifyinfo->{'thistype'}\n"
    200         if defined $classifyinfo->{'thistype'};
    201     $outputtext .= "<parameters>$classifyinfo->{'parameters'}\n"
    202         if defined $classifyinfo->{'parameters'};
    203     $outputtext .= "<supportsmemberof>$classifyinfo->{'supportsmemberof'}\n"
    204         if defined $classifyinfo->{'supportsmemberof'};
     190    my $outputtext = "[$OID]\n";
     191    $outputtext .= "<doctype>classify\n";
     192    $outputtext .= "<hastxt>0\n";
     193    $outputtext .= "<childtype>$classifyinfo->{'childtype'}\n"
     194    if defined $classifyinfo->{'childtype'};
     195    $outputtext .= "<Title>$classifyinfo->{'Title'}\n"
     196    if defined $classifyinfo->{'Title'};
     197    $outputtext .= "<numleafdocs>$classifyinfo->{'numleafdocs'}\n"
     198    if defined $classifyinfo->{'numleafdocs'};
     199    $outputtext .= "<thistype>$classifyinfo->{'thistype'}\n"
     200    if defined $classifyinfo->{'thistype'};
     201    $outputtext .= "<parameters>$classifyinfo->{'parameters'}\n"
     202    if defined $classifyinfo->{'parameters'};
     203    $outputtext .= "<supportsmemberof>$classifyinfo->{'supportsmemberof'}\n"
     204    if defined $classifyinfo->{'supportsmemberof'};
     205   
     206    my $contains_text = "<contains>";
     207    my $mdoffset_text = "<mdoffset>";
     208   
     209    my $next_subOID = 1;
     210    my $first = 1;
     211    foreach $tempinfo (@{$classifyinfo->{'contains'}}) {
     212    # empty contents were made undefined by clean_contents()
     213    next unless defined $tempinfo;
    205214   
    206     my $contains_text = "<contains>";
    207     my $mdoffset_text = "<mdoffset>";
     215    if (!defined ($tempinfo->{'classifyOID'}) ||
     216        $tempinfo->{'classifyOID'} ne "oai") {
     217        $contains_text .= ";" unless $first;
     218    }
     219    $mdoffset_text .= ";" unless $first;
     220    $first = 0;
    208221   
    209     my $next_subOID = 1;
    210     my $first = 1;
    211     foreach $tempinfo (@{$classifyinfo->{'contains'}}) {
    212         # empty contents were made undefined by clean_contents()
    213         next unless defined $tempinfo;
    214        
    215         if (!defined ($tempinfo->{'classifyOID'}) ||
    216         $tempinfo->{'classifyOID'} ne "oai") {
    217         $contains_text .= ";" unless $first;
     222    if (defined ($tempinfo->{'classifyOID'})) {
     223        if ($tempinfo->{'classifyOID'} ne "oai") {
     224        $contains_text .= $tempinfo->{'classifyOID'};
    218225        }
    219         $mdoffset_text .= ";" unless $first;
    220         $first = 0;
    221        
    222         if (defined ($tempinfo->{'classifyOID'})) {
    223         if ($tempinfo->{'classifyOID'} ne "oai") {
    224             $contains_text .= $tempinfo->{'classifyOID'};
    225         }
    226         &print_classify_info ($handle, $tempinfo, $tempinfo->{'classifyOID'},
    227                       $allclassifications);
    228         } elsif (defined ($tempinfo->{'OID'})) {
    229         $contains_text .= $tempinfo->{'OID'};
    230         $mdoffset_text .= $tempinfo->{'offset'}
    231           if (defined ($tempinfo->{'offset'}))
     226        &print_classify_info ($handle, $tempinfo, $tempinfo->{'classifyOID'},
     227                  $remove_empty_classifications);
     228    } elsif (defined ($tempinfo->{'OID'})) {
     229        $contains_text .= $tempinfo->{'OID'};
     230        $mdoffset_text .= $tempinfo->{'offset'}
     231        if (defined ($tempinfo->{'offset'}))
    232232        # note: we don't want to print the contents of the books
    233233        } else {
     
    236236        # so no bookshelf icon appears, top-level, along with the
    237237        # applet
    238 
     238       
    239239        if (!defined ($tempinfo->{'Title'}) || $tempinfo->{'Title'} ne "Collage") {
    240240            $contains_text .= "\".$next_subOID";
    241241        }
    242 
     242       
    243243        &print_classify_info ($handle, $tempinfo, "$OID.$next_subOID",
    244                       $allclassifications);
     244                      $remove_empty_classifications);
    245245        $next_subOID++;
    246246        }
    247     }
    248    
    249     $outputtext .= "$contains_text\n";
    250     $outputtext .= "<mdtype>$classifyinfo->{'mdtype'}\n"
    251         if defined $classifyinfo->{'mdtype'};
    252     $outputtext .= "$mdoffset_text\n"
    253         if ($mdoffset_text !~ m/^<mdoffset>;+$/);
    254    
    255     $outputtext .= '-' x 70 . "\n";
    256    
    257     print $handle $outputtext;
    258     }
     247    }
     248   
     249    $outputtext .= "$contains_text\n";
     250    $outputtext .= "<mdtype>$classifyinfo->{'mdtype'}\n"
     251    if defined $classifyinfo->{'mdtype'};
     252    $outputtext .= "$mdoffset_text\n"
     253    if ($mdoffset_text !~ m/^<mdoffset>;+$/);
     254   
     255    $outputtext .= '-' x 70 . "\n";
     256   
     257    print $handle $outputtext;
     258
    259259}
    260260
  • trunk/gsdl/perllib/mgbuilder.pm

    r7904 r8361  
    6161sub new {
    6262    my ($class, $collection, $source_dir, $build_dir, $verbosity,
    63     $maxdocs, $debug, $keepold, $allclassifications,
     63    $maxdocs, $debug, $keepold, $remove_empty_classifications,
    6464    $outhandle, $no_text, $failhandle, $gli) = @_;
    6565
     
    7676              'debug'=>$debug,
    7777              'keepold'=>$keepold,
    78               'allclassifications'=>$allclassifications,
     78              'remove_empty_classifications'=>$remove_empty_classifications,
    7979              'outhandle'=>$outhandle,
    8080              'no_text'=>$no_text,
     
    815815    # output classification information
    816816    &classify::output_classify_info ($self->{'classifiers'}, $handle,
    817                      $self->{'allclassifications'},
     817                     $self->{'remove_empty_classifications'},
    818818                     $self->{'gli'});
    819819
  • trunk/gsdl/perllib/mgppbuilder.pm

    r7953 r8361  
    111111
    112112    my ($collection, $source_dir, $build_dir, $verbosity,
    113     $maxdocs, $debug, $keepold, $allclassifications,
     113    $maxdocs, $debug, $keepold, $remove_empty_classifications,
    114114    $outhandle, $no_text, $gli) = @_;
    115115
     
    125125              'debug'=>$debug,
    126126              'keepold'=>$keepold,
    127               'allclassifications'=>$allclassifications,
     127              'remove_empty_classifications'=>$remove_empty_classifications,
    128128              'outhandle'=>$outhandle,
    129129              'no_text'=>$no_text,
     
    938938    # output classification information
    939939    &classify::output_classify_info ($self->{'classifiers'}, $handle,
    940                      $self->{'allclassifications'},
     940                     $self->{'remove_empty_classifications'},
    941941                     $self->{'gli'});
    942942
  • trunk/gsdl/perllib/strings.rb

    r8252 r8361  
    5353
    5454# -- buildcol.pl --
    55 
    56 buildcol.allclassifications:Don't remove empty classifications.
    5755
    5856buildcol.archivedir:Where the archives live.
     
    9997
    10098buildcol.params:[options] collection-name
     99
     100buildcol.remove_empty_classifications:Hide empty classifiers and classification nodes (those that contain no documents).
    101101
    102102buildcol.unlinked_col_images:Collection images may not be linked correctly.
Note: See TracChangeset for help on using the changeset viewer.