Changeset 6769


Ignore:
Timestamp:
2004-02-10T17:05:50+13:00 (20 years ago)
Author:
kjdon
Message:

added two new options: noheaderpage to supress the empty first section, and documenttype (paged or hierachy) - so you can make it hierarchical instead of paged

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/perllib/plugins/PagedImgPlug.pm

    r6555 r6769  
    128128    'type' => "int",
    129129    'deft' => "100",
     130    'reqd' => "no" },
     131      { 'name' => "noheaderpage",
     132    'desc' => "{PagedImgPlug.noheaderpage}",
     133    'type' => "flag",
     134    'reqd' => "no" },
     135      { 'name' => "documenttype",
     136    'desc' => "{PagedImgPlug.documenttype}",
     137    'type' => "enum",
     138    'list' => $type_list,
     139    'deft' => "paged",
    130140    'reqd' => "no" } ];
     141
     142my $type_list =
     143    [ { 'name' => "paged",
     144        'desc' => "{PagedImgPlug.documenttype.paged}" },
     145      { 'name' => "hierarchy",
     146        'desc' => "{PagedImgPlug.documenttype.hierarchy}" } ];
    131147
    132148my $options = { 'name'     => "PagedImgPlug",
     
    155171             q^thumbnail^, \$self->{'thumbnail'},
    156172             q^screenview^, \$self->{'screenview'},
     173             q^noheaderpage^, \$self->{'noheaderpage'},
     174             'documenttype/^(paged|hierarchy)$/paged', \$self->{'doctype'},
    157175             "allow_extra_options")) {
    158176   
     
    514532    my $topsection = $doc_obj->get_top_section();
    515533
    516     # set the gsdlthistype metadata to Paged - this ensures this document will
    517     # be treated as a Paged doc, even if Titles are not numeric
    518     $doc_obj->set_utf8_metadata_element ($topsection, "gsdlthistype", "Paged");
    519 
     534    if ($self->{'doctype'} eq 'paged') {
     535    # set the gsdlthistype metadata to Paged - this ensures this document will
     536    # be treated as a Paged doc, even if Titles are not numeric
     537   
     538    $doc_obj->set_utf8_metadata_element ($topsection, "gsdlthistype", "Paged");
     539    } else {
     540    $doc_obj->set_utf8_metadata_element ($topsection, "gsdlthistype", "Hierarchy");
     541    }
    520542    open (ITEMFILE, $filename) || die "couldn't open $filename\n";
    521543    my $line = "";
     
    536558       
    537559        # create a new section for each image file
    538         my  $cursection = $doc_obj->insert_section($doc_obj->get_end_child($topsection));
     560        # the first image may go in the top section or in the first child section (if headerpage is true)
     561        my $cursection;
     562        if ($first) {
     563        if ( $self->{'noheaderpage'}) {
     564            $cursection = $topsection;
     565        } else {
     566            $cursection = $doc_obj->insert_section($doc_obj->get_end_child($topsection));
     567        }
     568        $first=0;
     569        } else {
     570        $cursection = $doc_obj->insert_section($doc_obj->get_end_child($topsection));
     571        }
    539572        # the page number becomes the Title
    540573        $doc_obj->set_utf8_metadata_element($cursection, 'Title', $pagenum);
Note: See TracChangeset for help on using the changeset viewer.