Changeset 14962


Ignore:
Timestamp:
2008-02-12T15:18:32+13:00 (16 years ago)
Author:
davidb
Message:

local variable $top_section to tidy up setting metadata code

Location:
gsdl/trunk/perllib/plugins
Files:
2 edited

Legend:

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

    r14117 r14962  
    118118    # create a new document
    119119    my $doc_obj = new doc ($filename, "indexed_doc");
     120    my $top_section = $doc_obj->get_top_section();
     121
    120122    $doc_obj->set_OIDtype ($processor->{'OIDtype'}, $processor->{'OIDmetadata'});   
    121123    #$doc_obj->set_OIDtype ("incremental");
    122     $doc_obj->add_utf8_metadata($doc_obj->get_top_section(), "Plugin", "$self->{'plugin_type'}");
    123     $doc_obj->add_metadata($doc_obj->get_top_section(), "Source", &ghtml::dmsafe($file)); # set the filename as Source metadata to be consistent with other plugins
     124    $doc_obj->add_utf8_metadata($top_section, "Plugin", "$self->{'plugin_type'}");
     125    $doc_obj->add_metadata($top_section, "Source", $file); # set the filename as Source metadata to be consistent with other plugins
    124126
    125     $doc_obj->add_utf8_metadata($doc_obj->get_top_section(), "FileSize", (-s $filename));
     127    $doc_obj->add_utf8_metadata($top_section, "FileSize", (-s $filename));
    126128
    127129    # the metadata NoText is used to suppress the dummy text 'This document has no text.'
    128     $doc_obj->add_metadata ($doc_obj->get_top_section(), "NoText",    "1");
     130    $doc_obj->add_metadata ($top_section, "NoText",    "1");
    129131
    130132    my $assoc_field = $self->{'assoc_field'} || "null_file";
    131     $doc_obj->add_metadata ($doc_obj->get_top_section(), $assoc_field, $file);
     133    $doc_obj->add_metadata ($top_section, $assoc_field, $file);
    132134   
    133135     if ($self->{'cover_image'}) {
  • gsdl/trunk/perllib/plugins/UnknownPlug.pm

    r14117 r14962  
    194194    # create a new document
    195195    my $doc_obj = new doc ($filename, "indexed_doc");
     196    my $top_section = $doc_obj->get_top_section();
     197
    196198    $doc_obj->set_OIDtype ($processor->{'OIDtype'}, $processor->{'OIDmetadata'});   
    197     $doc_obj->add_utf8_metadata($doc_obj->get_top_section(), "Plugin", "$self->{'plugin_type'}");
    198     $doc_obj->add_metadata($doc_obj->get_top_section(), "Source", &ghtml::dmsafe($file)); # set the filename as Source metadata to be consistent with other plugins
    199     $doc_obj->add_utf8_metadata($doc_obj->get_top_section(), "FileSize", (-s $filename));
     199    $doc_obj->add_utf8_metadata($top_section, "Plugin", "$self->{'plugin_type'}");
     200    $doc_obj->add_metadata($top_section, "Source", $file); # set the filename as Source metadata to be consistent with other plugins
     201    $doc_obj->add_utf8_metadata($top_section, "FileSize", (-s $filename));
    200202
    201203    # URL metadata (even invalid ones) are used to support internal
     
    203205
    204206    my $web_url = "http://$file";
    205     $doc_obj->add_metadata($doc_obj->get_top_section(), "URL", $web_url);
     207    $doc_obj->add_metadata($top_section, "URL", $web_url);
    206208
    207209
Note: See TracChangeset for help on using the changeset viewer.