Ignore:
Timestamp:
2008-06-23T10:54:24+12:00 (16 years ago)
Author:
davidb
Message:

Some minor adjustments to ingesting documents into a Fedoar repository: it now descends into all the folders generated in archives/export; and it tests for ImagePlugin (rather than the older ImagePlug) name;

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/perllib/plugouts/FedoraMETSPlugout.pm

    r15604 r16102  
    201201
    202202    my $section = $doc_obj->get_top_section();
    203 
    204     my $doc_txt_file = &util::filename_cat ($working_dir,"doctoc.xml");
    205    
    206     $self->open_xslt_pipe($doc_txt_file,$self->{'xslt_txt'});
    207 
    208     my $outhandler;
    209 
    210     if (defined $self->{'xslt_writer'}){
    211     $outhandler = $self->{'xslt_writer'};
    212     }
    213     else{
    214     $outhandler = $self->get_output_handler($doc_txt_file);
    215     }
    216 
    217     print $outhandler $self->buffer_toc($doc_obj, $working_dir, $section, 0);
    218 
    219     if (defined $self->{'xslt_writer'}){     
    220     $self->close_xslt_pipe();
    221     }
    222     else{
    223     close($outhandler);
    224    }
     203    my $section_ptr=$doc_obj->_lookup_section($section);
     204    my $num_subsections = scalar(@{$section_ptr->{'subsection_order'}});
     205
     206    # If num_subsections is 0, then there is no nested TOC
     207
     208    if ($num_subsections>0) {
     209
     210    my $doc_txt_file = &util::filename_cat ($working_dir,"doctoc.xml");
     211   
     212    $self->open_xslt_pipe($doc_txt_file,$self->{'xslt_txt'});
     213   
     214    my $outhandler;
     215   
     216    if (defined $self->{'xslt_writer'}){
     217        $outhandler = $self->{'xslt_writer'};
     218    }
     219    else{
     220        $outhandler = $self->get_output_handler($doc_txt_file);
     221    }
     222    print $outhandler $self->buffer_toc($doc_obj, $working_dir, $section, 0);
     223   
     224    if (defined $self->{'xslt_writer'}){     
     225        $self->close_xslt_pipe();
     226    }
     227    else{
     228        close($outhandler);
     229    }
     230    }
    225231
    226232}
     
    245251    my $plugin_type = $doc_obj->get_metadata_element($top_section,"Plugin");
    246252
    247     if ((defined $plugin_type) && ($plugin_type eq "ImagePlug"))
     253    if ((defined $plugin_type) && ($plugin_type eq "ImagePlugin"))
    248254    {
    249255
     
    284290
    285291    # Generate Filestream for Table of Contents (TOC)
    286     print $handle $self->buffer_mets_fileSection_toc($doc_obj,$section,$working_dir);
     292    my $section_ptr=$doc_obj->_lookup_section($section);
     293    my $num_subsections = scalar(@{$section_ptr->{'subsection_order'}});
     294
     295    # If num_subsections is 0, then there is no nested TOC
     296
     297    if ($num_subsections>0) {
     298    print $handle $self->buffer_mets_fileSection_toc($doc_obj,$section,$working_dir);
     299    }
    287300
    288301    # print out the fileSection by sections
Note: See TracChangeset for help on using the changeset viewer.