Changeset 18398

Show
Ignore:
Timestamp:
15.01.2009 19:25:27 (10 years ago)
Author:
ak19
Message:

1. Added the file_rename_method option Inherited, so that secondary plugins use the same file_rename_method that's set for the primary plugin. 2. New subroutine get_file_rename_method that returns the current stored rename method (to be used in perl scripts, such as explode_metadata_database). 3. Call to unicode::filename_to_url is now passed the file_rename_method so that nothing is done if we're base64 encoding.

Files:
1 modified

Legend:

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

    r18320 r18398  
    5151    'desc' => "{BasePlugin.rename_method.url}" }, 
    5252      { 'name' => "base64", 
    53     'desc' => "{BasePlugin.rename_method.base64}" } ]; 
     53    'desc' => "{BasePlugin.rename_method.base64}" },  
     54      { 'name' => "inherited", 
     55    'desc' => "{BasePlugin.rename_method.inherited}",  
     56    'hiddengli' => "yes" } ]; 
    5457 
    5558our $encoding_list = 
     
    367370} 
    368371 
     372# returns this plugin's active (possibly user-selected) file_rename_method 
     373sub get_file_rename_method() { 
     374    my $self = shift (@_); 
     375    my $rename_method = $self->{'file_rename_method'}; 
     376    if($rename_method) { 
     377    return $rename_method; 
     378    } else {     
     379    return $self->get_default_file_rename_method(); 
     380    } 
     381} 
     382 
    369383# default implementation is to do nothing 
    370384sub store_block_files { 
     
    740754    if ($@) { 
    741755    print $outhandle "$@\n"; 
    742     print $outhandle "Warning: Unable to establish locale.  Will assume filesytem is UTF-8\n"; 
     756    print $outhandle "Warning: Unable to establish locale.  Will assume filesystem is UTF-8\n"; 
    743757     
    744758    } 
     
    10291043        # If the filename is url_encoded, we need to encode the % signs  
    10301044        # in the filename, so that it works in a url 
    1031         my $url_tail_filename = &unicode::filename_to_url($tail_filename); 
     1045        my $url_tail_filename = &unicode::filename_to_url($tail_filename, $self->{'file_rename_method'}); 
    10321046        # work out extended tail extension (i.e. matching tail re) 
    10331047