Changeset 23461

Show
Ignore:
Timestamp:
13.12.2010 14:48:20 (9 years ago)
Author:
kjdon
Message:

set_Source_metadata now takes an optional section argument so that we can assign Source and SourceFile? to sections not just top level. Needed for pagedimageplugin.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/plugins/BasePlugin.pm

    r23458 r23461  
    934934sub set_Source_metadata { 
    935935    my $self = shift (@_);   
    936     my ($doc_obj, $raw_filename, $filename_encoding) = @_; 
    937  
     936    my ($doc_obj, $raw_filename, $filename_encoding, $section) = @_; 
     937     
    938938    # 1. Sets the filename (Source) for display encoded as Unicode if possible, 
    939939    #    and (as a fallback) using %xx if not for non-ascii chars 
     
    943943    my ($unused_full_rf, $raw_file) = &util::get_full_filenames("", $raw_filename); 
    944944 
    945     my $top_section = $doc_obj->get_top_section(); 
     945    my $this_section = (defined $section)? $section : $doc_obj->get_top_section(); 
    946946 
    947947    my $octet_file = $raw_file; 
     
    984984     
    985985    # Source is the UTF8 display name - not necessarily the name of the file on the system 
    986     $doc_obj->set_utf8_metadata_element($top_section, "Source", $url_encoded_filename);  
     986    $doc_obj->set_utf8_metadata_element($this_section, "Source", $url_encoded_filename);  
    987987     
    988988    my $renamed_raw_file = &util::rename_file($raw_file, $self->{'file_rename_method'}); 
     
    991991    my $renamed_raw_url = &unicode::filename_to_url($renamed_raw_file); 
    992992 
    993     $doc_obj->set_utf8_metadata_element($top_section, "SourceFile", 
     993    $doc_obj->set_utf8_metadata_element($this_section, "SourceFile", 
    994994                    $renamed_raw_url); 
    995995