Changeset 22215

Show
Ignore:
Timestamp:
01.06.2010 15:54:17 (10 years ago)
Author:
kjdon
Message:

added store_original_file option, used for eg Text, HTML plugins to store the source file as an associated file so that it can be referred to when serving over OAI

Files:
1 modified

Legend:

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

    r21742 r22215  
    115115    'type' => "regexp", 
    116116    'deft' => "", 
     117    'reqd' => "no" }, 
     118      { 'name' => "store_original_file", 
     119    'desc' => "{BasePlugin.store_original_file}", 
     120    'type' => "flag", 
    117121    'reqd' => "no" }, 
    118122      { 'name' => "associate_ext", 
     
    923927    $self->associate_cover_image($doc_obj, $filename); 
    924928    } 
     929    # store the original (used for eg TextPlugin to store the original for OAI) 
     930    if ($self->{'store_original_file'}) { 
     931    $self->associate_source_file($doc_obj, $filename); 
     932    } 
    925933    
    926934 
     
    11261134 
    11271135} 
     1136sub associate_source_file { 
     1137    my $self = shift(@_); 
     1138     
     1139    my ($doc_obj, $filename) = @_; 
     1140    my $cursection = $doc_obj->get_top_section(); 
     1141    my $assocfilename = $doc_obj->get_assocfile_from_sourcefile(); 
     1142     
     1143    $doc_obj->associate_file($filename, $assocfilename, undef, $cursection); 
     1144    $doc_obj->add_utf8_metadata ($cursection, "srclink_file", "[SourceFile]"); 
     1145} 
    11281146 
    11291147sub associate_cover_image { 
    1130     my $self = shift; 
     1148    my $self = shift(@_); 
    11311149    my ($doc_obj, $filename) = @_; 
    11321150