Changeset 22709


Ignore:
Timestamp:
2010-08-23T00:27:23+12:00 (14 years ago)
Author:
davidb
Message:

Fixed up -process_exp so it now dynamically configures itself properly, based on whether OpenOfficeConverter is found or not

Location:
main/trunk/greenstone2/perllib/plugins
Files:
3 edited

Legend:

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

    r22705 r22709  
    22#
    33# ExcelPlugin.pm -- plugin for importing Microsoft Excel files.
    4 #  (currently only versions 95 and 97)
     4#  (basic version supports versions 95 and 97)
     5#  (through OpenOffice extension, supports all contempoary formats)
    56#
    67# A component of the Greenstone digital library software
     
    4344    'type' => "regexp",
    4445    'reqd' => "no",
    45     'deft' => &get_default_process_exp() }
     46    'deft' => "&get_default_process_exp(\$self)"  # delayed (see below)
     47    }
    4648      ];
    4749
     
    6163    push(@{$hashArgOptLists->{"OptList"}},$options);
    6264
    63     my $self = new AutoloadConverterScripting("OpenOfficeConverter",$pluginlist, $inputargs, $hashArgOptLists);
     65    my $self
     66    = new AutoloadConverterScripting("OpenOfficeConverter",$pluginlist,
     67                     $inputargs, $hashArgOptLists);
     68
     69    # plugin's process_exp can only be correctly determined once autoloading
     70    # has taken place
     71    my $plug_options = $self->{'option_list'}->[0];
     72    my $plug_args = $plug_options->{'args'};
     73   
     74    foreach my $a (@$plug_args) {
     75    # consider changing this to search for all values that are
     76    # tagged as 'deft-delayed' = 1 ?!?
     77
     78    if ($a->{'name'} eq "process_exp") {
     79        my $eval_expr = $a->{'deft'};
     80        $a->{'deft'} = eval "$eval_expr";
     81
     82        # Now see if process_exp needs updating
     83        my $process_exp = $self->{'process_exp'};
     84        if (!$self->{'info_only'} && ($process_exp eq $eval_expr)) {
     85        # process_exp is only defined if not 'info_only'
     86        #
     87        # if it does exist and it equals the unevaluated $eval_expr
     88        # then it was set to the default (rather than overriden by
     89        # the collect.cfg file)
     90
     91        $self->{'process_exp'} = $a->{'deft'};
     92        }
     93    }
     94    }
    6495   
    6596    if ($self->{'info_only'}) {
     
    124155sub get_default_process_exp {
    125156    my $self = shift (@_);
     157
     158    if ($self->{'scripting_ext_working'}) {
     159    return q^(?i)\.(xls|xlsx|ods)$^;
     160    }
     161
    126162    return q^(?i)\.xls$^;
    127163}
  • main/trunk/greenstone2/perllib/plugins/PowerPointPlugin.pm

    r22705 r22709  
    22#
    33# PowerPointPlugin.pm -- plugin for importing Microsoft PowerPoint files.
    4 #  (currently only versions 95 and 97)
     4#  (basic version supports versions 95 and 97)
     5#  (through OpenOffice extension, supports all contempoary formats)
    56#
    67# A component of the Greenstone digital library software
     
    5960    'type' => "regexp",
    6061    'reqd' => "no",
    61     'deft' => &get_default_process_exp()}
     62    'deft' => "&get_default_process_exp(\$self)",  # delayed (see below)
     63    }
    6264      ];
    6365
     
    99101                     $pluginlist, $inputargs,
    100102                     $hashArgOptLists);
     103
     104
     105    # plugin's process_exp can only be correctly determined once autoloading
     106    # has taken place
     107    my $plug_options = $self->{'option_list'}->[0];
     108    my $plug_args = $plug_options->{'args'};
     109   
     110    foreach my $a (@$plug_args) {
     111    # consider changing this to search for all values that are
     112    # tagged as 'deft-delayed' = 1 ?!?
     113
     114    if ($a->{'name'} eq "process_exp") {
     115        my $eval_expr = $a->{'deft'};
     116        $a->{'deft'} = eval "$eval_expr";
     117
     118        # Now see if process_exp needs updating
     119        my $process_exp = $self->{'process_exp'};
     120        if (!$self->{'info_only'} && ($process_exp eq $eval_expr)) {
     121        # process_exp is only defined if not 'info_only'
     122        #
     123        # if it does exist and it equals the unevaluated $eval_expr
     124        # then it was set to the default (rather than overriden by
     125        # the collect.cfg file)
     126
     127        $self->{'process_exp'} = $a->{'deft'};
     128        }
     129    }
     130    }
     131
    101132 
    102133    if ($self->{'info_only'}) {
     
    161192sub get_default_process_exp {
    162193    my $self = shift (@_);
     194
     195    if ($self->{'scripting_ext_working'}) {
     196    return q^(?i)\.(ppt|pptx|odp)$^;
     197    }
     198
    163199    return q^(?i)\.ppt$^;
    164200}
  • main/trunk/greenstone2/perllib/plugins/WordPlugin.pm

    r22705 r22709  
    4040    'desc' => "{BasePlugin.process_exp}",
    4141    'type' => "regexp",
    42     'deft' => &get_default_process_exp(),
     42    'deft' => "&get_default_process_exp(\$self)",  # delayed (see below)
    4343    'reqd' => "no" },
    4444      { 'name' => "description_tags",
     
    116116    push(@{$hashArgOptLists->{"OptList"}},$options);
    117117
    118     my $self = new AutoloadConverterScripting("OpenOfficeConverter",$pluginlist, $inputargs, $hashArgOptLists);
     118    my $self
     119    = new AutoloadConverterScripting("OpenOfficeConverter",$pluginlist,
     120                     $inputargs, $hashArgOptLists);
     121
     122    # plugin's process_exp can only be correctly determined once autoloading
     123    # has taken place
     124    my $plug_options = $self->{'option_list'}->[0];
     125    my $plug_args = $plug_options->{'args'};
     126   
     127    foreach my $a (@$plug_args) {
     128    # consider changing this to search for all values that are
     129    # tagged as 'deft-delayed' = 1 ?!?
     130
     131    if ($a->{'name'} eq "process_exp") {
     132        my $eval_expr = $a->{'deft'};
     133        $a->{'deft'} = eval "$eval_expr";
     134
     135        # Now see if process_exp needs updating
     136        my $process_exp = $self->{'process_exp'};
     137        if (!$self->{'info_only'} && ($process_exp eq $eval_expr)) {
     138        # process_exp is only defined if not 'info_only'
     139        #
     140        # if it does exist and it equals the unevaluated $eval_expr
     141        # then it was set to the default (rather than overriden by
     142        # the collect.cfg file)
     143
     144        $self->{'process_exp'} = $a->{'deft'};
     145        }
     146    }
     147    }
     148
    119149
    120150    if ($self->{'info_only'}) {
     
    209239sub get_default_process_exp {
    210240    my $self = shift (@_);
    211     if ($AutoloadConverterScripting::openoffice_ext_working) {
     241    if ($self->{'scripting_ext_working'}) {
    212242    return q^(?i)\.(doc|dot|docx|odt)$^;
    213243    }
Note: See TracChangeset for help on using the changeset viewer.