Ignore:
Timestamp:
1999-10-15T12:36:14+13:00 (25 years ago)
Author:
sjboddie
Message:

changes for new browsing support

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/perllib/mgbuildproc.pm

    r544 r677  
    132132}
    133133
     134# use 'Paged' if document has no more than 2 levels
     135# and each section at second level has a number for
     136# Title metadata
     137sub get_document_type {
     138    my $self = shift (@_);
     139    my ($doc_obj) = @_;
     140
     141    my $thistype = "VList";
     142    my $childtype = "VList";
     143    my $title;
     144    my @tmp = ();
     145   
     146    my $section = $doc_obj->get_top_section ();
     147    my $first = 1;
     148    while (defined $section) {
     149    @tmp = split /\./, $section;
     150    if (scalar(@tmp) > 1) {
     151        return ($thistype, $childtype);
     152    }
     153    if (!$first) {
     154        $title = $doc_obj->get_metadata_element ($section, "Title");
     155        if (defined $title && $title !~ /^\d+$/) {
     156        return ($thistype, $childtype);
     157        }
     158    }
     159    $first = 0;
     160    $section = $doc_obj->get_next_section($section);
     161    }
     162    if ($doc_obj->get_text_length ($doc_obj->get_top_section())) {
     163    $thistype = "Paged";
     164    } else {
     165    $thistype = "Invisible";
     166    }
     167    $childtype = "Paged";
     168    return ($thistype, $childtype);
     169}
     170
    134171sub infodb {
    135172    my $self = shift (@_);
     
    146183    $self->{'num_docs'} += 1 unless ($doctype eq "classification");
    147184
     185    # is this a paged or a hierarchical document
     186    my ($thistype, $childtype) = $self->get_document_type ($doc_obj);
     187
    148188    my $section = $doc_obj->get_top_section ();
    149189    my $doc_OID = $doc_obj->get_OID();
     190    my $first = 1;
    150191    while (defined $section) {
    151192    # update a few statistics
     
    192233    }
    193234
     235    # output document display type
     236    if ($first) {
     237        print $handle "<thistype>$thistype\n";
     238    }
     239
    194240    # output a list of children
    195241    my $children = $doc_obj->get_children ($section);
    196242    if (scalar(@$children) > 0) {
     243        print $handle "<childtype>$childtype\n";
    197244        print $handle "<contains>";
    198245        my $firstchild = 1;
     
    224271    print $handle '-' x 70, "\n";
    225272
    226 
     273    $first = 0;
    227274    $section = $doc_obj->get_next_section($section);
    228275    }
Note: See TracChangeset for help on using the changeset viewer.