Show
Ignore:
Timestamp:
10.08.2010 14:31:53 (9 years ago)
Author:
kjdon
Message:

code tidy up. rearranged how convertbinaryfile plugins set up their secondary plugins - now only set up the options for the one they are using. all subclass specific code moved out of convertbinaryfile.new into the appropriate plugin file.

Files:
1 modified

Legend:

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

    r20790 r22597  
    4444 
    4545my $convert_to_list = 
    46     [ { 'name' => "auto", 
    47     'desc' => "{ConvertBinaryFile.convert_to.auto}" }, 
    48       { 'name' => "html", 
    49     'desc' => "{ConvertBinaryFile.convert_to.html}" }, 
    50       { 'name' => "text", 
    51     'desc' => "{ConvertBinaryFile.convert_to.text}" }, 
     46    [  
     47#      {    'name' => "auto", 
     48#   'desc' => "{ConvertBinaryFile.convert_to.auto}" }, 
     49#      {    'name' => "html", 
     50#   'desc' => "{ConvertBinaryFile.convert_to.html}" }, 
     51#      {    'name' => "text", 
     52#   'desc' => "{ConvertBinaryFile.convert_to.text}" }, 
    5253      { 'name' => "pagedimg", 
    5354    'desc' => "{ConvertBinaryFile.convert_to.pagedimg}"}, 
     
    124125    $self->{'metadata_value'} = undef; 
    125126 
    126     $self->{'convert_to'} = "PagedImage"; 
     127    # do we only allow one option?? 
     128    $self->{'convert_to'} = "pagedimg"; 
     129    $self->{'convert_to_plugin'} = "PagedImagePlugin"; 
     130    $self->{'convert_to_ext'} = "jpg"; 
     131     
     132    my $secondary_plugin_name = $self->{'convert_to_plugin'}; 
    127133    my $secondary_plugin_options = $self->{'secondary_plugin_options'}; 
    128134 
    129     if (!defined $secondary_plugin_options->{'PagedImagePlugin'}){ 
    130     $secondary_plugin_options->{'PagedImagePlugin'} = []; 
    131     } 
    132     my $pagedimg_options = $secondary_plugin_options->{'PagedImagePlugin'};  
    133     push(@$pagedimg_options, "-title_sub", '^(Page\s+\d+)?(\s*1\s+)?'); 
    134     push(@$pagedimg_options, "-create_thumbnail", "true", "-create_screenview", "true"); 
    135     push(@$pagedimg_options, "-file_rename_method", "none"); 
    136     push(@$pagedimg_options, "-processing_tmp_files"); 
     135    if (!defined $secondary_plugin_options->{$secondary_plugin_name}) { 
     136    $secondary_plugin_options->{$secondary_plugin_name} = []; 
     137    } 
     138    my $specific_options = $secondary_plugin_options->{$secondary_plugin_name}; 
     139 
     140    push(@$specific_options, "-title_sub", '^(Page\s+\d+)?(\s*1\s+)?'); 
     141    push(@$specific_options, "-create_thumbnail", "true", "-create_screenview", "true"); 
     142    push(@$specific_options, "-file_rename_method", "none"); 
     143    push(@$specific_options, "-processing_tmp_files"); 
     144 
     145#    my $secondary_plugin_options = $self->{'secondary_plugin_options'}; 
     146 
     147#    if (!defined $secondary_plugin_options->{'PagedImagePlugin'}){ 
     148#   $secondary_plugin_options->{'PagedImagePlugin'} = []; 
     149#    } 
     150#    my $pagedimg_options = $secondary_plugin_options->{'PagedImagePlugin'};  
     151#    push(@$pagedimg_options, "-title_sub", '^(Page\s+\d+)?(\s*1\s+)?'); 
     152#    push(@$pagedimg_options, "-create_thumbnail", "true", "-create_screenview", "true"); 
     153#    push(@$pagedimg_options, "-file_rename_method", "none"); 
     154#    push(@$pagedimg_options, "-processing_tmp_files"); 
    137155    $self = bless $self, $class; 
    138  
    139 # ***** no longer needed! 
    140 #    # This needs to be done after blss, to $self passed to XML::Parser 
    141 #    # can correctly resolve the right call-back methods during XML parsing 
    142  
    143  
    144156    $self->load_secondary_plugins($class,$secondary_plugin_options,$hashArgOptLists); 
    145157    return $self;