Ignore:
Timestamp:
1999-12-07T10:45:27+13:00 (24 years ago)
Author:
sjboddie
Message:

plugins now take options, files are associated at build time as
well as import time

File:
1 edited

Legend:

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

    r780 r810  
    5151    $self->{'classifiers'} = [];
    5252    $self->{'mode'} = "text";
     53    $self->{'assocdir'} = $build_dir;
    5354    $self->{'dontgdbm'} = {};
    5455    $self->{'index'} = "section:text";
     
    102103
    103104    $self->{'mode'} = $mode;
     105}
     106
     107sub set_assocdir {
     108    my $self = shift (@_);
     109    my ($assocdir) = @_;
     110
     111    $self->{'assocdir'} = $assocdir;
    104112}
    105113
     
    177185}
    178186
     187sub assoc_files {
     188    my $self = shift (@_);
     189    my ($doc_obj) = @_;
     190   
     191    foreach $assoc_file (@{$doc_obj->get_assoc_files()}) {
     192    $afile = &util::filename_cat($self->{'assocdir'}, $assoc_file->[1]);
     193    &util::hard_link ($assoc_file->[0], $afile);
     194    }
     195}
     196
    179197sub infodb {
    180198    my $self = shift (@_);
     
    183201#    $handle = "main::STDOUT";
    184202
     203    $self->assoc_files ($doc_obj);
     204
    185205    my $doctype = $doc_obj->get_doc_type();
    186206
     
    197217    my $doc_OID = $doc_obj->get_OID();
    198218    my $first = 1;
     219    my $url = "";
    199220    while (defined $section) {
    200221    # update a few statistics
     
    222243
    223244        if ($field ne "Identifier" && $field !~ /^gsdl/ &&
    224         defined $value && $value ne "" &&
    225         !defined $self->{'dontgdbm'}->{$field}) {
     245        defined $value && $value ne "") {
     246
    226247        # escape problematic stuff
    227248        $value =~ s/\\/\\\\/g;
    228249        $value =~ s/\n/\\n/g;
    229250        $value =~ s/\r/\\r/g;
    230        
    231         print $handle "<$field>$value\n";
    232         }
    233     }
    234 
     251
     252        # special case for URL metadata
     253        if ($field =~ /^URL$/i) {
     254                    $url .= "[$value]\n";
     255                    if ($section eq "") {$url .= "<section>$doc_OID\n";}
     256                    else {$url .= "<section>$doc_OID.$section\n";}
     257                    $url .= '-' x 70 . "\n";
     258        }
     259
     260        if (!defined $self->{'dontgdbm'}->{$field}) {
     261            print $handle "<$field>$value\n";
     262        }
     263        }
     264    }
     265   
    235266    # output archivedir if at top level
    236267    if ($section eq $doc_obj->get_top_section()) {
     
    242273        print $handle "<archivedir>$archivedir\n";
    243274    }
    244 
     275   
    245276    # output document display type
    246277    if ($first) {
     
    280311    else { print $handle "<section>$doc_OID.$section\n"; }
    281312    print $handle '-' x 70, "\n";
     313   
     314        # output entry for url
     315        if ($url ne "") {
     316            print $handle $url;
     317        }
    282318
    283319    $first = 0;
Note: See TracChangeset for help on using the changeset viewer.