Changeset 10218


Ignore:
Timestamp:
2005-07-06T15:27:45+12:00 (19 years ago)
Author:
kjdon
Message:

Jeffrey's new parsing modifications, committed approx 6 July, 15.16

Location:
trunk/gsdl/perllib
Files:
63 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/perllib/classify.pm

    r9790 r10218  
    5858    my ($classobj);
    5959    my $options = "-gsdlinfo";
    60 
    61     eval ("\$classobj = new \$classifier($options)");
     60    eval ("\$classobj = new \$classifier([],[$options])");
    6261    die "$@" if $@;
    6362
     
    112111    my $options .= join (",", @newoptions);
    113112
    114     eval ("\$classobj = new \$classname($options)");
     113
     114    eval ("\$classobj = new \$classname([],[$options])");
    115115    die "$@" if $@;
    116116
  • trunk/gsdl/perllib/classify/AZCompactList.pm

    r10113 r10218  
    6262    'desc' => "{AZCompactList.sort}",
    6363    'type' => "string",
    64     'deft' => "Title",
     64#   'deft' => "Title",
    6565    'reqd' => "no" },
    6666      { 'name' => "removeprefix",
     
    121121
    122122sub new {
    123     my $class = shift (@_);
    124     my $self = new BasClas($class, @_);
    125 
    126     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    127     my $option_list = $self->{'option_list'};
    128     push( @{$option_list}, $options );
    129 
    130     if ($self->{'info_only'}) {
    131     # created from classinfo.pl - don't need to parse the arguments
    132     return bless $self, $class;
    133     }
    134 
    135     my ($metaname, $title, $removeprefix, $removesuffix);
    136     my $sortname = "Title";
    137     my $mingroup = 2;
    138     my $minnesting = 20;
    139     my $mincompact = 10;
    140     my $maxcompact = 30;
    141     my $doclevel = "top";
    142     my $firstvalueonly = 0;
    143     my $allvalues = 0;
    144     my $freqsort = 0;
    145     my $recopt   = undef;
    146 
    147     if (!parsargv::parse(\@_,
    148              q^metadata/.*/^, \$metaname,
    149              q^buttonname/.*/^, \$title,
    150              q^sort/.*/^, \$sortname,
    151              q^removeprefix/.*/^, \$removeprefix,
    152              q^removesuffix/.*/^, \$removesuffix,
    153              q^mingroup/.*/2^, \$mingroup,
    154              q^minnesting/.*/20^, \$minnesting,
    155              q^mincompact/.*/10^, \$mincompact,
    156              q^maxcompact/.*/30^, \$maxcompact,
    157              q^doclevel/.*/top^, \$doclevel,
    158              q^firstvalueonly^, \$firstvalueonly,
    159              q^allvalues^, \$allvalues,
    160              q^freqsort/.*/0^, \$freqsort,
    161              q^recopt/.*/-1^, \$recopt,  # Used in nested metadata such as -metadata Year/Organisation
    162 
    163              "allow_extra_options")) {
    164    
    165     print STDERR "\nIncorrect options passed to $class, check your collect.cfg file\n";
    166     $self->print_txt_usage("");  # Use default resource bundle
    167     die "\n";
    168     }
    169 
    170     if (!defined($metaname)) {
     123    my ($class) = shift (@_);
     124    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
     125    push(@$pluginlist, $class);
     126
     127    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     128    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     129
     130    my $self = (defined $hashArgOptLists)? new BasClas($pluginlist,$inputargs,$hashArgOptLists): new BasClas($pluginlist,$inputargs);
     131
     132    if (!$self->{"metadata"}) {
    171133    my $outhandle = $self->{'outhandle'};
    172134    print $outhandle "AZCompactList Error: required option -metadata not supplied\n";
     
    175137    }
    176138
    177     $title = $self->generate_title_from_metadata($metaname) unless ($title);
    178     #$title = $metaname unless ($title);
    179 
     139    # Manually set $self parameters.
    180140    $self->{'list'} = {};
    181141    $self->{'listmetavalue'} = {};
     
    183143    $self->{'reclassify'} = {};
    184144    $self->{'reclassifylist'} = {};
    185     $self->{'metaname'} = $metaname;
    186     $self->{'title'} = "$title";     # title for the titlebar.
    187     $self->{'sortname'} = $sortname;
    188 
    189     if (defined($removeprefix) && $removeprefix) {
    190     $removeprefix =~ s/^\^//; # don't need a leading ^
    191     $self->{'removeprefix'} = $removeprefix;
    192     }
    193     if (defined($removesuffix) && $removesuffix) {
    194     $removesuffix =~ s/\$$//; # don't need a trailing $
    195     $self->{'removesuffix'} = $removesuffix;
    196     }
    197     $self->{'mingroup'} = $mingroup;
    198     $self->{'minnesting'} = $minnesting;
    199     $self->{'mincompact'} = $mincompact;
    200     $self->{'maxcompact'} = $maxcompact;
    201     $self->{'doclevel'} = $doclevel;
    202 
    203     if ($firstvalueonly != 0) {
    204     $firstvalueonly = 1;
    205     }
    206     $self->{'firstvalueonly'} = $firstvalueonly;
    207  
    208     if ($allvalues != 0) {
    209     $allvalues = 1;
    210     }
    211     $self->{'allvalues'} = $allvalues;
    212     if ($freqsort != 0) {
    213     $freqsort = 1;
    214     }
    215     $self->{'freqsort'} = $freqsort;
    216 
    217     if ($recopt == -1) {
    218     $recopt = undef;
    219     } else {
    220     $recopt = "on";
    221     }
    222     $self->{'recopt'} = $recopt;
     145
     146    $self->{'buttonname'} = $self->generate_title_from_metadata($self->{'metadata'}) unless ($self->{'buttonname'});
     147   
     148    if (defined($self->{"removeprefix"}) && $self->{"removeprefix"}) {
     149    $self->{"removeprefix"} =~ s/^\^//; # don't need a leading ^
     150    }
     151    if (defined($self->{"removesuffix"}) && $self->{"removesuffix"}) {
     152    $self->{"removesuffix"} =~ s/\$$//; # don't need a trailing $
     153    }
     154   
     155    $self->{'recopt'} = ($self->{'recopt'} == 0) ? undef : "on";
     156
     157    # Clean out the unused keys
     158    if($self->{"removeprefix"} eq "") {delete $self->{"removeprefix"};}
     159    if($self->{"removesuffix"} eq "") {delete $self->{"removesuffix"};}
    223160
    224161    return bless $self, $class;
     
    247184    my @sectionlist = ();
    248185    my $topsection = $doc_obj->get_top_section();
    249     my $metaname = $self->{'metaname'};
     186    my $metaname = $self->{'metadata'};
    250187    my $outhandle = $self->{'outhandle'};
    251188
     
    317254
    318255        my $formatted_metavalue =
    319           sorttools::format_metadata_for_sorting($self->{'metaname'},
     256          sorttools::format_metadata_for_sorting($self->{'metadata'},
    320257                             $metavalue, $doc_obj);
    321258       
     
    338275
    339276    # This is used in reclassify below for AZCompactSectionList
    340     my $sortmeta = $doc_obj->get_metadata_element($thissection, $self->{'sortname'});
     277    my $sortmeta = $doc_obj->get_metadata_element($thissection, $self->{'sort'});
    341278    $self->{'reclassify'}->{$full_doc_OID} = [$doc_obj,$sortmeta];
    342279    }
     
    413350    my $doclevel = $self->{'doclevel'};
    414351    my $mingroup = $self->{'mingroup'};
    415     my @metaname_list = split(/\/|\|/,$self->{'metaname'});
     352    my @metaname_list = split(/\/|\|/,$self->{'metadata'});
    416353    my $metaname = shift(@metaname_list);
    417354    my $hierarchical = 0;
     
    433370        # buttonname is also used for the node's title
    434371        push @args, ("-buttonname", "$metavalue");
    435         push @args, ("-sort", $self->{'sortname'});
    436 
     372        push @args, ("-sort", $self->{'sort'});
     373
     374        my $ptArgs = \@args;
    437375        if ($doclevel =~ m/^top(level)?/i)
    438376        {
    439             eval ("\$listclassobj = new List(\@args)");
    440             warn $@ if $@;
     377            eval ("\$listclassobj = new List([],\$ptArgs)");
    441378        }
    442379        else
    443380        {
    444             eval ("\$listclassobj = new SectionList(\@args)");
    445             warn $@ if $@;
     381            eval ("\$listclassobj = new SectionList([],\$ptArgs)");
    446382        }
    447383        }
     
    453389        # buttonname is also used for the node's title
    454390        push @args, ("-buttonname", "$metavalue");
    455         push @args, ("-sort", $self->{'sortname'});
     391        push @args, ("-sort", $self->{'sort'});
    456392
    457393        if (defined $self->{'removeprefix'}) {
     
    466402        push @args, "-recopt ";
    467403
    468         eval ("\$listclassobj = new AZCompactList(\@args)");
    469         warn $@ if $@;
    470         }
     404        my $ptArgs = \@args;
     405        eval ("\$listclassobj = new AZCompactList([],\$ptArgs)");
     406        }
     407       
    471408        if ($@) {
    472409        print $outhandle "$@";
     
    493430        }
    494431
    495         $formatted_node = &sorttools::format_metadata_for_sorting($self->{'metaname'}, $formatted_node);
     432        $formatted_node = &sorttools::format_metadata_for_sorting($self->{'metadata'}, $formatted_node);
    496433
    497434        # In case our formatted string is empty...
     
    671608    my $self = shift (@_);
    672609    my ($title, $childtype, $metaname, $thistype) = @_;
    673 
    674610    # organise into classification structure
    675611    my %classifyinfo = ('childtype'=>$childtype,
     
    694630
    695631    # top level
    696     my @metanames = split(/\/|\|/,$self->{'metaname'});
     632    my @metanames = split(/\/|\|/,$self->{'metadata'});
    697633    my $metaname = shift(@metanames);
    698634
     
    700636    $childtype = "VList" if (scalar (@$classlistref) <= $self->{'minnesting'});
    701637
     638    my $title = $self->{'buttonname'}; # should always be defined by now.
    702639    my $classifyinfo;
    703640    if (!defined($self->{'recopt'}))
    704641    {
    705     my $title = $self->{'title'}; # should always be defined by now....
    706     $title = $metaname unless defined $title;
    707642    $classifyinfo
    708643        = $self->get_entry ($title, $childtype, $metaname, "Invisible");
     
    710645    else
    711646    {
    712     my $title = $self->{'title'};
    713647    $classifyinfo
    714648        = $self->get_entry ($title, $childtype, $metaname, "VList");
  • trunk/gsdl/perllib/classify/AZCompactSectionList.pm

    r9578 r10218  
    2323
    2424sub new {
    25     my $class = shift (@_);
    26     my $self = new AZCompactList($class, @_);
    27 
    28     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    29     my $option_list = $self->{'option_list'};
    30     push( @{$option_list}, $options );
    31 
    32     #if ($self->{'info_only'}) {
    33     # created from classinfo.pl - don't need to parse the arguments
    34     #return bless $self, $class;
    35     #}
     25    my ($class) = shift (@_);
     26    my ($classifierslist,$inputargs,$hashArgOptLists) = @_;
     27    push(@$classifierslist, $class);
     28
     29    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     30    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     31
     32    my $self = (defined $hashArgOptLists)? new AZCompactList($classifierslist,$inputargs,$hashArgOptLists): new AZCompactList($classifierslist,$inputargs);
    3633
    3734    return bless $self, $class;
     
    117114# buttonname is also used for the node's title
    118115        push @args, ("-buttonname", "$metavalue");
    119         push @args, ("-sort", $self->{'sortname'});
    120 
     116        push @args, ("-sort", $self->{'sort'});
     117
     118        my $ptArgs = \@args;
    121119        if ($doclevel =~ m/^top(level)?/i)
    122120        {
    123             eval ("\$listclassobj = new List(\@args)"); warn $@ if $@;
     121            eval ("\$listclassobj = new List([],\$ptArgs)"); warn $@ if $@;
    124122        }
    125123        else
     
    127125            # SECTIONFIX?
    128126            #eval ("\$listclassobj = new SectionList($args)");
    129             eval ("\$listclassobj = new SectionList(\@args)");
     127            eval ("\$listclassobj = new SectionList([],\$ptArgs)");
    130128        }
    131129        }
     
    143141        # SECTIONFIX?
    144142        #eval ("\$listclassobj = new AZCompactList($args)");
    145         eval ("\$listclassobj = new AZCompactList(\@args)");
     143        my $ptArgs = \@args;
     144        eval ("\$listclassobj = new AZCompactList([],\$ptArgs)");
    146145        }
    147146        if ($@) {
  • trunk/gsdl/perllib/classify/AZList.pm

    r9322 r10218  
    6767
    6868sub new {
    69     my $class = shift (@_);
    70     my $self = new BasClas($class, @_);
    71    
    72     my $option_list = $self->{'option_list'};
    73     push( @{$option_list}, $options );
    74    
    75     if ($self->{'info_only'}) {
    76     # created from classinfo.pl - don't need to parse the arguments
    77     return bless $self, $class;
    78     }
    79     my ($metadata, $title, $removeprefix, $removesuffix);
    80    
    81     if (!parsargv::parse(\@_,
    82              q^metadata/.*/^, \$metadata,
    83              q^buttonname/.*/^, \$title,
    84              q^removeprefix/.*/^, \$removeprefix,
    85              q^removesuffix/.*/^, \$removesuffix,
    86              "allow_extra_options")) {
    87    
    88     print STDERR "\nIncorrect options passed to $class, check your collect.cfg file\n";
    89     $self->print_txt_usage("");  # Use default resource bundle
    90     die "\n";
    91     }
    92 
    93     if (!$metadata) {
     69    my ($class) = shift (@_);
     70    my ($classifierslist,$inputargs,$hashArgOptLists) = @_;
     71    push(@$classifierslist, $class);
     72
     73    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     74    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     75
     76    my $self = (defined $hashArgOptLists)? new BasClas($classifierslist,$inputargs,$hashArgOptLists): new BasClas($classifierslist,$inputargs);
     77
     78    if (!$self->{"metadata"}) {
    9479    print STDERR "AZList Error: required option -metadata not supplied \n";
    9580    $self->print_txt_usage("");  # Use default resource bundle
     
    9782    die "AZList Error: required option -metadata not supplied\n";
    9883    }
    99    
    100     my @meta_list = split(/,/, $metadata);
    101     #my $meta1 = $meta_list[0];
    102 
    103     #$title = $meta1 unless ($title);
    104     $title = $self->generate_title_from_metadata($metadata) unless ($title);
     84       
     85    # Manually set $self parameters.
    10586    $self->{'list'} = {};
     87
     88    # Transfer value from Auto Parsing to the variavle name that used in previous GreenStone.
     89    my @meta_list = split(/,/, $self->{"metadata"});
    10690    $self->{'meta_list'} = \@meta_list;
    107     $self->{'title'} = $title;
    108    
    109     if (defined($removeprefix) && $removeprefix) {
    110     $removeprefix =~ s/^\^//; # don't need a leading ^
    111     $self->{'removeprefix'} = $removeprefix;
    112     }
    113     if (defined($removesuffix) && $removesuffix) {
    114     $removesuffix =~ s/\$$//; # don't need a trailing $
    115     $self->{'removesuffix'} = $removesuffix;
    116     }
     91
     92    $self->{'buttonname'} = $self->generate_title_from_metadata($self->{'metadata'}) unless ($self->{'buttonname'});
     93
     94    # Further setup
     95    if (defined($self->{"removeprefix"}) && $self->{"removeprefix"}) {
     96    $self->{"removeprefix"} =~ s/^\^//; # don't need a leading ^
     97    }
     98    if (defined($self->{"removesuffix"}) && $self->{"removesuffix"}) {
     99    $self->{"removesuffix"} =~ s/\$$//; # don't need a trailing $
     100    }
     101
     102    # Clean out the unused keys
     103    delete $self->{"metadata"}; # Delete this key
     104
     105    if($self->{"removeprefix"} eq "") {delete $self->{"removeprefix"};}
     106    if($self->{"removesuffix"} eq "") {delete $self->{"removesuffix"};}
    117107
    118108    return bless $self, $class;
     
    233223    my $childtype = "HList";
    234224    if (scalar (@$classlistref) <= 39) {$childtype = "VList";}
    235     my $classifyinfo = $self->get_entry ($self->{'title'}, $childtype, "Invisible");
     225    my $classifyinfo = $self->get_entry ($self->{'buttonname'}, $childtype, "Invisible");
    236226
    237227    # don't need to do any splitting if there are less than 39 (max + min -1) classifications
  • trunk/gsdl/perllib/classify/AZSectionList.pm

    r8852 r10218  
    5252
    5353sub new {
    54     my $class = shift (@_);
    55     my $self = new AZList($class, @_);
     54    my ($class) = shift (@_);
     55    my ($classifierslist,$inputargs,$hashArgOptLists) = @_;
     56    push(@$classifierslist, $class);
    5657
    57     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    58     my $option_list = $self->{'option_list'};
    59     push( @{$option_list}, $options );
    60    
    61     #if ($self->{'info_only'}) {
    62     # created from classinfo.pl - don't need to parse the arguments
    63     #   return bless $self, $class;
    64     #}
     58    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     59    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     60
     61    my $self = (defined $hashArgOptLists)? new AZList($classifierslist,$inputargs,$hashArgOptLists): new AZList($classifierslist,$inputargs);
    6562
    6663    return bless $self, $class;
  • trunk/gsdl/perllib/classify/AllList.pm

    r8716 r10218  
    1515
    1616sub new {
    17     my $class = shift (@_);
    18     my $self  = new BasClas($class, @_);
     17    my ($class) = shift (@_);
     18    my ($classifierslist,$inputargs,$hashArgOptLists) = @_;
     19    push(@$classifierslist, $class);
    1920
     21    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     22    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     23
     24    my $self = (defined $hashArgOptLists)? new BasClas($classifierslist,$inputargs,$hashArgOptLists): new BasClas($classifierslist,$inputargs);
     25
     26    # Manually set $self parameters.
    2027    $self->{'list'} = [];
    21     $self->{'title'} = "All Documents";
     28    $self->{'buttonname'} = "All Documents";
    2229
    2330    return bless $self, $class;
     
    4451
    4552    my %classifyinfo = ('childtype'   =>'VList',
    46             'Title'       =>$self->{'title'},
     53            'Title'       =>$self->{'buttonname'},
    4754            'contains'    =>[],
    4855            'classifyOID' =>"oai");
     
    5663       
    5764    my %tempinfo=('childtype'=>'VList',
    58               'Title'=>$self->{'title'},
     65              'Title'=>$self->{'buttonname'},
    5966              'classifyOID' =>"oai.$seqNo",
    6067              'contains'    =>[]);
  • trunk/gsdl/perllib/classify/BasClas.pm

    r8852 r10218  
    5656use gsprintf;
    5757use printusage;
    58 
     58use parse2;
    5959
    6060my $arguments =
     
    6767    'type' => "string",
    6868    'deft' => "STDERR" },
    69 #      { 'name' => "verbosity",
    70 #   'desc' => "{BasClas.verbosity}",
     69      { 'name' => "verbosity",
     70    'desc' => "{BasClas.verbosity}",
    7171#   'type' => "enum",
    72 #   'deft' => "2",
    73 #   'reqd' => "no" } ];
     72    'type' => "int",
     73    'deft' => "2",
     74    'reqd' => "no" },
    7475#      { 'name' => "ignore_namespace",
    7576#   'desc' => "{BasClas.ignore_namespace}",
     
    214215
    215216sub new {
    216     my $class = shift (@_);
    217     my $name = shift (@_);
    218 
     217    my ($class) = shift (@_);
     218    my ($classifierslist,$args,,$hashArgOptLists) = @_;
     219    push(@$classifierslist, $class);
     220    my $classifier_name = (defined $classifierslist->[0]) ? $classifierslist->[0] : $class;
     221    print STDERR "new $classifier_name\n";
     222    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     223    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     224
     225
     226    # Manually set $self parameters.
    219227    my $self = {};
    220 
    221228    $self->{'outhandle'} = STDERR;
    222229    $self->{'idnum'} = -1;
    223    
    224     $self->{'option_list'} = [ $options ];
    225     my $gsdlinfo;
    226 
    227     # general options available to all classifiers
    228     if (!parsargv::parse(\@_,
    229              q^builddir/.*/^, \$self->{'builddir'},
    230              q^outhandle/.*/STDERR^, \$self->{'outhandle'},
    231              q^verbosity/\d/2^, \$self->{'verbosity'},
    232              q^ignore_namespace^, \$self->{'ignore_namespace'},
    233              q^gsdlinfo^, \$gsdlinfo,
    234              "allow_extra_options")) {
    235 
    236     &gsprintf(STDERR, "\n{BasClas.bad_general_option}\n", $name);
    237     $self->print_txt_usage("");  # Use default resource bundle
    238     die "\n";
    239     }
    240 
    241     if ($gsdlinfo) {
    242     # created from classinfo.pl - set this so subclasses don't need to
    243     # parse the arguments
    244     $self->{'info_only'} = 1;
    245     }
    246     return bless $self, $class;
     230    $self->{'option_list'} = $hashArgOptLists->{"OptList"};
     231    $self->{"info_only"} = 0;
     232
     233    # Check if gsdlinfo is in the argument list or not. 
     234    foreach $strArg (@{$args})
     235    {
     236    if($strArg eq "gsdlinfo")
     237    {
     238        $self->{"info_only"} = 1;
     239        last;
     240    }
     241    }
     242
     243    # If gsdlinfo is not in the argument list, process the argument normally.
     244    if($self->{"info_only"} == 0)
     245    {
     246    my $blnParseFailed = "false";
     247    # general options available to all plugins
     248    if(!parse2::parse($args,$hashArgOptLists->{"ArgList"},$self))
     249    {
     250        $blnParseFailed = "true";
     251    }
     252   
     253    # If the parsing wasn't successful, then print out the text usage of this classifier.
     254    my $classTempClass = bless $self, $class;
     255    if($blnParseFailed eq "true")
     256    {
     257        &gsprintf(STDERR, "\n{BasClas.bad_general_option}\n", $classifier_name);
     258        $classTempClass->print_txt_usage("");  # Use default resource bundle
     259        die "\n";
     260    }
     261    else
     262    {
     263        delete $self->{"info_only"};
     264        return $classTempClass;
     265    }
     266    }
     267
     268    # If gsdlinfo is in the argument list, do not perform any parsing.
     269    else
     270    {   
     271    delete $self->{"info_only"};
     272    return bless $self, $class;
     273    }
    247274}
    248275
  • trunk/gsdl/perllib/classify/Browse.pm

    r6968 r10218  
    4242
    4343sub new {
    44     my $class = shift (@_);
    45     my $self = new BasClas($class, @_);
    46  
    47     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    48     my $option_list = $self->{'option_list'};
    49     push( @{$option_list}, $options ); 
     44    my ($class) = shift (@_);
     45    my ($classifierslist,$inputargs,$hashArgOptLists) = @_;
     46    push(@$classifierslist, $class);
    5047
    51     if ($self->{'info_only'}) {
    52     # created from classinfo.pl - don't need to parse the arguments
    53     return bless $self, $class;
    54     }
     48    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     49    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
    5550
    56     # classifier information
    57     $self->{'collection'} = $ENV{'GSDLCOLLECTION'};
     51    my $self = (defined $hashArgOptLists)? new BasClas($classifierslist,$inputargs,$hashArgOptLists): new BasClas($classifierslist,$inputargs);
    5852
    59     $self->{'title'} = "Browse";
     53    # Manually set $self parameters.
     54    $self->{'collection'} = $ENV{'GSDLCOLLECTION'}; # classifier information
     55    $self->{'buttonname'} = "Browse";
    6056
    6157    return bless $self, $class;
     
    8076    # use to create macros when the Phind classifier document is displayed.
    8177    my %classifyinfo = ('thistype'=>'Invisible',
    82                         'Title'=>$self->{'title'},
     78                        'Title'=>$self->{'buttonname'},
    8379            'contains'=>[]);
    8480   
  • trunk/gsdl/perllib/classify/Collage.pm

    r9142 r10218  
    106106
    107107sub new {
    108     my $class = shift (@_);
    109     my $self = new BasClas($class, @_);
    110 
    111     my $option_list = $self->{'option_list'};
    112     push( @{$option_list}, $options );
    113 
    114     if ($self->{'info_only'}) {
    115     # created from classinfo.pl - don't need to parse the arguments
    116     return bless $self, $class;
    117     }   
    118 
    119     my ($title, $geometry, $verbosity, $maxDepth, $imageType, $bgcolor, $refreshDelay, $isJava2, $caption, $maxDisplay, $maxDownloads, $list);
    120 
    121     if (!parsargv::parse(\@_,
    122              q^buttonname/.*/Collage^, \$title,
    123              q^geometry/.*/600x300^, \$geometry,
    124              q^verbosity/.*/3^, \$verbosity,
    125              q^maxDepth/.*/500^, \$maxDepth,
    126 #            q^maxDownloads/.*/^, \$maxDownloads,
    127              q^maxDisplay/.*/25^, \$maxDisplay,
    128              q^imageType/.*/.jpg%.png^, \$imageType,
    129              q^bgcolor/.*/\#96c29a^, \$bgcolor,
    130              q^refreshDelay/.*/1200^, \$refreshDelay,
    131              q^isJava2/.*/auto^, \$isJava2,
    132              q^imageMustNotHave/.*/hl=\%x=\%gt=\%gc=\%.pr^, \$imageMustNotHave,
    133              q^caption/.*/ ^, \$caption,
    134              "allow_extra_options")) {
    135    
    136     print STDERR "\nIncorrect options passed to $class, check your collect.cfg file\n";
    137     $self->print_txt_usage("");  # Use default resource bundle
    138     die "\n";
    139     }
    140 
    141     if (!$title) {
    142     $title = 'Collage';
    143     }
    144 
    145     $self->{'list'} = $list;
    146     $self->{'title'} = $title;
    147     $self->{'geometry'} = $geometry;
    148     $self->{'verbosity'} = $verbosity;
    149     $self->{'maxDepth'} = $maxDepth;
    150     $self->{'maxDownloads'} = $maxDownloads;
    151     $self->{'maxDisplay'} = $maxDisplay;
    152     $self->{'imageType'} = $imageType;
    153     $self->{'bgcolor'} = $bgcolor;
    154     $self->{'refreshDelay'} = $refreshDelay;
    155     $self->{'isJava2'} = $isJava2;
    156 #    $self->{'imageMustNotHave'} = $imageMustNotHave;
    157     $self->{'caption'} = $caption;
     108    my ($class) = shift (@_);
     109    my ($classifierslist,$inputargs,$hashArgOptLists) = @_;
     110    push(@$classifierslist, $class);
     111
     112    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     113    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     114
     115    my $self = (defined $hashArgOptLists)? new BasClas($classifierslist,$inputargs,$hashArgOptLists): new BasClas($classifierslist,$inputargs);
     116
     117    # Manually set $self parameters.
     118    $self->{'list'} = {};
     119    print STDERR "buttonnmae = $buttonname\n";
     120    $self->{'buttonname'} = 'Collage' unless ($self->{'buttonname'});
     121
    158122    return bless $self, $class;
    159123}
     
    206170
    207171    if ($verbosity>1) {
    208     print $outhandle ("$self->{'title'}\n");
    209     }
    210 
    211     my $collage_head = $self->get_entry ($self->{'title'}, "Collage", "Invisible");
     172    print $outhandle ("$self->{'buttonname'}\n");
     173    }
     174
     175    my $collage_head = $self->get_entry ($self->{'buttonname'}, "Collage", "Invisible");
    212176    my $collage_curr = $self->get_entry("Collage","VList");
    213177    push (@{$collage_head->{'contains'}},$collage_curr);
  • trunk/gsdl/perllib/classify/DateList.pm

    r10199 r10218  
    7979
    8080sub new {
    81     my $class = shift (@_);
    82     my $self = new BasClas($class, @_);
    83 
    84     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    85     my $option_list = $self->{'option_list'};
    86     push( @{$option_list}, $options );
    87 
    88     if ($self->{'info_only'}) {
    89     # created from classinfo.pl - don't need to parse the arguments
    90     return bless $self, $class;
    91     }
    92 
     81    my ($class) = shift (@_);
     82    my ($classifierslist,$inputargs,$hashArgOptLists) = @_;
     83    push(@$classifierslist, $class);
     84
     85    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     86    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     87
     88    my $self = (defined $hashArgOptLists)? new BasClas($classifierslist,$inputargs,$hashArgOptLists): new BasClas($classifierslist,$inputargs);
     89
     90    # Manually set $self parameters.
    9391    $self->{'list'} = {};
    9492
    95     my ($datemeta, $sortmeta);
    96     $self->{'nogroup'}=0;
    97     if (!parsargv::parse(\@_,
    98                          q^bymonth^, \$self->{'bymonth'},
    99              q^nogroup^, \$self->{'nogroup'},
    100              q^metadata/.*/^, \$datemeta,
    101              q^sort/.*/^, \$sortmeta,
    102              q^reverse_sort^, \$self->{'reverse_sort'},
    103                          "allow_extra_options")) {
    104     $self->print_txt_usage("");  # Use default resource bundle
    105     die "\n";
    106     }
    107 
    108     if (!defined $datemeta || $datemeta eq "") {
    109     $datemeta = "Date";
    110     }
    111     $self->{'datemeta'} = $datemeta;
    112 
    113     if (defined $sortmeta && $sortmeta ne "") {
    114     $self->{'sortmeta'} = $sortmeta;
    115     }
     93    if (!defined $self->{"metadata"} || $self->{"metadata"} eq "") {
     94    $self->{'metadata'} = "Date";
     95    }
     96   
    11697    return bless $self, $class;
    11798}
     
    128109
    129110    my $doc_OID = $doc_obj->get_OID();
    130     my $date = $doc_obj->get_metadata_element ($doc_obj->get_top_section(), $self->{'datemeta'});
     111    my $date = $doc_obj->get_metadata_element ($doc_obj->get_top_section(), $self->{'metadata'});
    131112   
    132113    my $sort_other = "";
    133     if (defined $self->{'sortmeta'} && $self->{'sortmeta'} ne "") {
    134     $sort_other = $doc_obj->get_metadata_element ($doc_obj->get_top_section(), $self->{'sortmeta'});
    135     $sort_other = &sorttools::format_metadata_for_sorting($self->{'sortmeta'}, $sort_other, $doc_obj);
     114    if (defined $self->{'sort'} && $self->{'sort'} ne "") {
     115    $sort_other = $doc_obj->get_metadata_element ($doc_obj->get_top_section(), $self->{'sort'});
     116    $sort_other = &sorttools::format_metadata_for_sorting($self->{'sort'}, $sort_other, $doc_obj);
    136117    }
    137118    # if this document doesn't contain Date element we won't
     
    143124    }
    144125
    145    
    146126    $self->{'list'}->{$doc_OID} = "$date$sort_other";
    147127    }
     
    169149            'Title'=>$title,
    170150            'contains'=>[],
    171             'mdtype'=>$self->{'datemeta'});
     151            'mdtype'=>$self->{'metadata'});
    172152    $classifyinfo{'thistype'} = $thistype
    173153    if defined $thistype && $thistype =~ /\w/;
  • trunk/gsdl/perllib/classify/HFileHierarchy.pm

    r9206 r10218  
    5151    'type' => "flag",
    5252    'reqd' => "no" },
    53       { 'name' => "sort",
    54     'desc' => "{Hierarchy.sort}",
    55     'type' => "string",
    56     'deft' => "{BasClas.metadata.deft}",
    57     'reqd' => "no" },
    5853      { 'name' => "hfile",
    5954    'desc' => "{Hierarchy.hfile}",
     
    6964    'desc' => "{Hierarchy.sort}",
    7065    'type' => "string",
    71     'deft' => "{BasClas.metadata.deft}",
     66#   'deft' => "{BasClas.metadata.deft}",
    7267    'reqd' => "no" },
    7368      { 'name' => "reverse_sort",
     
    8277my $options =
    8378{   'name'     => "HFileHierarchy",
    84     'desc'     => "{Hierarchy.desc}",
     79    'desc'     => "{HFileHierarchy.desc}",
    8580    'abstract' => "yes",
    8681    'inherits' => "yes",
     
    8984
    9085sub new {
    91     my $class = shift (@_);
    92     my $self = new BasClas($class, @_);
    93  
    94     my $option_list = $self->{'option_list'};
    95     push( @{$option_list}, $options );
    96  
    97     if ($self->{'info_only'}) {
    98     # created from classinfo.pl - don't need to parse the arguments
    99     return bless $self, $class;
    100     }
    101  
    102     my ($hfile, $metadata, $buttonname, $sortname, $reverse_sort, $title,
    103     $hlist_at_top);
    104     my $firstvalueonly = 0;
    105     my $allvalues = 0;
    106    
    107     if (!parsargv::parse(\@_,
    108              q^metadata/.*/^, \$metadata,
    109              q^buttonname/.*/^, \$buttonname,
    110              q^firstvalueonly^, \$firstvalueonly,
    111              q^allvalues^, \$allvalues,
    112              q^sort/.*/^, \$sortname,
    113              q^reverse_sort^, \$reverse_sort,
    114              q^hfile/.*/^, \$hfile,
    115              q^hlist_at_top^, \$hlist_at_top,
    116              "allow_extra_options")) {
    117    
    118     print STDERR "\nIncorrect options passed to $class, check your collect.cfg file\n";
    119     $self->print_txt_usage("");  # Use default resource bundle
    120     die "\n";
    121 
    122     }
    123 
     86    my ($class) = shift (@_);
     87    my ($classifierslist,$inputargs,$hashArgOptLists) = @_;
     88    push(@$classifierslist, $class);
     89
     90    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     91    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     92
     93    my $self = (defined $hashArgOptLists)? new BasClas($classifierslist,$inputargs,$hashArgOptLists): new BasClas($classifierslist,$inputargs);
     94
     95    my $metadata = $self->{'metadata'};
    12496    if (!$metadata) {
    12597    print STDERR "$class Error: required option -metadata not supplied\n";
     
    129101    }
    130102   
    131     $buttonname = $self->generate_title_from_metadata($metadata) unless ($buttonname);
    132     $title = $buttonname;
    133     $self->{'title'} = $title;
    134 
    135     $self->{'metaname'} = $metadata;
     103    $self->{'buttonname'} = $self->generate_title_from_metadata($metadata) unless ($self->{'buttonname'});
     104
     105    #$self->{'metaname'} = $metadata;
    136106    my @meta_list = split(/,/, $metadata);
    137107    $self->{'meta_list'} = \@meta_list;
     108
     109    print STDERR "sort = $self->{'sort'}\n";
     110    # sort = undef in this case is the same as sort=nosort
     111    if ($self->{'sort'} eq "nosort") {
     112    $self->{'sort'} = undef;
     113    }
    138114
    139115    # sortname is handled a bit differently - kjdon
     
    142118    # we have a list of possible metadata.
    143119    # To get no sorting, set sortname = 'nosort'
    144     if (!$sortname) {
    145     if (defined ($metadata)) {
    146         $sortname = undef;
    147     } else {
    148         $sortname = "nosort";
    149     }
    150     }
    151     $self->{'sortname'} = $sortname;
    152 
    153     if (defined $sortname && $reverse_sort) {
    154     $self->{'reverse_sort'} = 1;
    155     }
     120    # we don't need to set it to undef if its not defined do we???
     121
     122#    if (!$self->{'sort'}) {
     123#   if (defined ($metadata)) {
     124#       $sortname = undef;
     125#   } else {
     126#       $sortname = "nosort";
     127#   }
     128#    }
     129 #   $self->{'sortname'} = $sortname;
     130
     131    #if (defined $self->{'sort'} && $reverse_sort) {
     132#   $self->{'reverse_sort'} = 1;
     133 #   }
    156134   
    157     if ($hfile) {
     135    if ($self->{'hfile'}) {
     136    my $hfile = $self->{'hfile'};
    158137    my $subjectfile;
    159138    $subjectfile = &util::filename_cat($ENV{'GSDLCOLLECTDIR'},"etc", $hfile);
     
    177156   
    178157
    179     $self->{'firstvalueonly'} = $firstvalueonly;
    180     $self->{'allvalues'} = $allvalues;
    181 
    182     $self->{'hlist_at_top'} = $hlist_at_top;
    183 
     158   # $self->{'firstvalueonly'} = $firstvalueonly;
     159   # $self->{'allvalues'} = $allvalues;
     160
     161    #$self->{'hlist_at_top'} = $hlist_at_top;
     162
     163    # Clean out the unused keys
     164    delete $self->{'metadata'};
     165    delete $self->{'hfile'};
    184166   
    185167    return bless $self, $class;
     
    240222    my $tempinfo = $self->get_OID_entry ($OID, $classifyinfo, $list->{$OID}->{'title'}, "VList");
    241223   
    242     if (defined $self->{'sortname'}) {
     224    if (defined $self->{'sort'}) {
    243225        if ($self->{'reverse_sort'}) {
    244226        foreach $subOID (sort {$b->[1] cmp $a->[1];} @{$list->{$OID}->{'contents'}}) {
  • trunk/gsdl/perllib/classify/HTML.pm

    r6983 r10218  
    5454
    5555sub new {
    56     my $class = shift (@_);
    57     my $self = new BasClas($class, @_);
     56    my ($class) = shift (@_);
     57    my ($classifierslist,$inputargs,$hashArgOptLists) = @_;
     58    push(@$classifierslist, $class);
    5859
    59     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    60     my $option_list = $self->{'option_list'};
    61     push( @{$option_list}, $options );
     60    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     61    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
    6262
    63     if ($self->{'info_only'}) {
    64     # created from classinfo.pl - don't need to parse the arguments
    65     return bless $self, $class;
    66     }
     63    my $self = (defined $hashArgOptLists)? new BasClas($classifierslist,$inputargs,$hashArgOptLists): new BasClas($classifierslist,$inputargs);
    6764
    68     my ($title, $url);
    69    
    70     if (!parsargv::parse(\@_,
    71              q^url/.*/^, \$url,
    72              q^buttonname/.*/Browse^, \$title,
    73              "allow_extra_options")) {
    74    
    75     print STDERR "\nIncorrect options passed to $class, check your collect.cfg file\n";
    76     $self->print_txt_usage("");  # Use default resource bundle
    77     die "\n";
    78     }
    79 
    80     if (!$url) {
     65    if (!$self->{'url'}) {
    8166    my $outhandle = $self->{'outhandle'};
    8267    print $outhandle "HTML Error: required option -url not supplied\n";
     
    8469    die "HTML Error: required option -url not supplied\n";
    8570    }
    86 
    87     $self->{'url'} = $url;
    88     $self->{'title'} = $title;
    89 
    9071    return bless $self, $class;
    9172}
     
    10788    my %classifyinfo = ('thistype'=>'Invisible',
    10889            'childtype'=>'HTML',
    109             'Title'=>$self->{'title'},
     90            'Title'=>$self->{'buttonname'},
    11091            'contains'=>[]);
    11192
  • trunk/gsdl/perllib/classify/Hierarchy.pm

    r9206 r10218  
    4343my $arguments =
    4444    [ { 'name' => "separator",
    45     'desc' => "{AutoHierarchy.separator}",
     45    'desc' => "{Hierarchy.separator}",
    4646    'type' => "regexp",
    4747    'deft' => "[\\\\\\\/|\\\\\\\|]",
    4848    'reqd' => "no" },
    4949      { 'name' => "suppresslastlevel",
    50     'desc' => "{AutoHierarchy.suppresslastlevel}",
     50    'desc' => "{Hierarchy.suppresslastlevel}",
    5151    'type' => "flag",
    5252    'reqd' => "no" } ];
    5353
    5454my $options = { 'name'     => "Hierarchy",
    55         'desc'     => "{AutoHierarchy.desc}",
     55        'desc'     => "{Hierarchy.desc}",
    5656        'abstract' => "no",
    5757        'inherits' => "yes",
     
    6060
    6161sub new {
    62     my $class = shift (@_);
    63     my $self = new HFileHierarchy($class, @_);
    64 
    65     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    66     my $option_list = $self->{'option_list'};
    67     push( @{$option_list}, $options );
    68 
    69     if ($self->{'info_only'}) {
    70     # created from classinfo.pl - don't need to parse the arguments
    71     return bless $self, $class;
    72     }
    73 
    74     my $separator;
    75     my $suppresslastlevel = 0;
    76 
    77     if (!parsargv::parse(\@_,
    78              q^separator/.*/^, \$separator,
    79              q^suppresslastlevel^, \$suppresslastlevel,
    80              "allow_extra_options")) {
    81    
    82     print STDERR "\nIncorrect options passed to $class, check your collect.cfg file\n";
    83     $self->print_txt_usage("");  # Use default resource bundle
    84     die "\n";
    85     }
    86 
    87    
    88     if (!$separator) {
    89     $separator = "[\\\/|\\\|]";
    90     }
    91     $self->{'separator'} = $separator;
    92     $self->{'suppresslastlevel'} = $suppresslastlevel;
     62    my ($class) = shift (@_);
     63    my ($classifierslist,$inputargs,$hashArgOptLists) = @_;
     64    push(@$classifierslist, $class);
     65
     66    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     67    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     68
     69    my $self = (defined $hashArgOptLists)? new HFileHierarchy($classifierslist,$inputargs,$hashArgOptLists): new HFileHierarchy($classifierslist,$inputargs);
    9370   
    9471    # the hash that we use to build up the hierarchy
     
    127104        push(@{$current_pos->{'docs'}}, $doc_OID);
    128105    } else {
    129         if (defined $sortmeta) {
    130         # can you ever get the same doc twice in one classification??
    131         $current_pos->{'docs'}->{$doc_OID} = $sortmeta;
    132         } else {
    133         $current_pos->{'docs'}->{$doc_OID} = $metavalue;
    134         }
     106        $current_pos->{'docs'}->{$doc_OID} = $sortmeta;
     107       
     108        #if (defined $sortmeta) {
     109    #   # can you ever get the same doc twice in one classification??
     110    #   $current_pos->{'docs'}->{$doc_OID} = $sortmeta;
     111    #    } else {
     112    #   $current_pos->{'docs'}->{$doc_OID} = $metavalue;
     113    #    }
    135114    }
    136115    } # foreach metadata
     
    146125    # are we sorting the list??
    147126    my $nosort = 0;
    148     if (defined $self->{'sortname'} && $self->{'sortname'} eq "nosort") {
     127    if (!defined $self->{'sort'}) {
    149128    $nosort = 1;
    150129    }
    151 
     130   
    152131    my $metavalues = [];
    153132    # find all the metadata values
     
    155134    my $mvalues = $doc_obj->get_metadata($doc_obj->get_top_section(), $m);
    156135    next unless (@{$mvalues});
    157     if ($self->{'onlyfirst'}) {
     136    if ($self->{'firstvalueonly'}) {
    158137        # we only want the first metadata value
    159138        push (@$metavalues, $mvalues[0]);
     
    169148    #check for a sort element other than our metadata
    170149    my $sortmeta = undef;
    171     if (!$nosort && defined $self->{'sortname'}) {
    172        
    173     if ($self->{'sortname'} =~ /^filename$/i) {
     150    if (!$nosort) {
     151    if ($self->{'sort'} =~ /^filename$/i) {
    174152        $sortmeta = $doc_obj->get_source_filename();
    175153    } else {
    176         $sortmeta = $doc_obj->get_metadata_element($doc_obj->get_top_section(), $self->{'sortname'});
     154        $sortmeta = $doc_obj->get_metadata_element($doc_obj->get_top_section(), $self->{'sort'});
    177155        if (defined $sortmeta) {
    178         $sortmeta = &sorttools::format_metadata_for_sorting($self->{'sortname'}, $sortmeta, $doc_obj);
     156        $sortmeta = &sorttools::format_metadata_for_sorting($self->{'sort'}, $sortmeta, $doc_obj);
    179157        }
    180158    }
     
    252230    my @doc_list;
    253231    # generate a sorted list of doc ids
    254     if ($nosort && scalar(@{$top_hash->{$key}->{'docs'}})) {
     232    if (not (defined ($self->{'sort'})) && scalar(@{$top_hash->{$key}->{'docs'}})) {
    255233        @doc_list = @{$top_hash->{$key}->{'docs'}};
    256     } elsif (!$nosort && (keys %{$top_hash->{$key}->{'docs'}})) {
     234    } elsif (defined ($self->{'sort'}) && (keys %{$top_hash->{$key}->{'docs'}})) {
    257235        @doc_list = sort {$top_hash->{$key}->{'docs'}->{$a}
    258236                  cmp $top_hash->{$key}->{'docs'}->{$b};} keys %{$top_hash->{$key}->{'docs'}};
     
    289267    if ($self->{'path_hash'}) {
    290268    if ($self->{'hlist_at_top'}) {
    291         $classification = $self->get_entry ($self->{'title'}, "HList", "Invisible");
     269        $classification = $self->get_entry ($self->{'buttonname'}, "HList", "Invisible");
    292270    }
    293271    else {
    294         $classification = $self->get_entry ($self->{'title'}, "VList", "Invisible");
     272        $classification = $self->get_entry ($self->{'buttonname'}, "VList", "Invisible");
    295273    }
    296274    }
     
    319297
    320298    if ($self->{'hlist_at_top'}) {
    321     $classifyinfo = $self->get_entry ($self->{'title'}, "HList", "Invisible");
     299    $classifyinfo = $self->get_entry ($self->{'buttonname'}, "HList", "Invisible");
    322300    }
    323301    else {
    324     $classifyinfo = $self->get_entry ($self->{'title'}, "VList", "Invisible");
     302    $classifyinfo = $self->get_entry ($self->{'buttonname'}, "VList", "Invisible");
    325303    }
    326304
  • trunk/gsdl/perllib/classify/List.pm

    r8852 r10218  
    4444    'desc' => "{BasClas.buttonname}",
    4545    'type' => "string",
    46     'deft' => "{BasClas.metadata.deft}",
     46#   'deft' => "{BasClas.metadata.deft}",
    4747    'reqd' => "no" },
    4848      { 'name' => "sort",
    4949    'desc' => "{List.sort}",
    5050    'type' => "string",
    51     'deft' => "{BasClas.metadata.deft}",
     51#   'deft' => "{BasClas.metadata.deft}",
    5252    'reqd' => "no" } ];
    5353
     
    6060
    6161sub new {
    62     my $class = shift (@_);
    63     my $self = new BasClas($class, @_);
    64 
    65     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    66     my $option_list = $self->{'option_list'};
    67     push( @{$option_list}, $options );
    68 
    69     if ($self->{'info_only'}) {
    70     # created from classinfo.pl - don't need to parse the arguments
    71     return bless $self, $class;
    72     }
    73 
    74     my ($metadata, $title, $sortname, $list);
    75 
    76     if (!parsargv::parse(\@_,
    77              q^metadata/.*/^, \$metadata,
    78              q^buttonname/.*/^, \$title,
    79              q^sort/.*/^, \$sortname,
    80              "allow_extra_options")) {
    81    
    82     print STDERR "\nIncorrect options passed to $class, check your collect.cfg file\n";
    83     $self->print_txt_usage("");  # Use default resource bundle
    84     die "\n";
    85     }
    86     my @meta_list;
    87     my $meta1;
    88    
    89     if ($metadata) {
    90     @meta_list = split(/,/, $metadata);
     62    my ($class) = shift (@_);
     63
     64    my ($classifierslist,$inputargs,$hashArgOptLists) = @_;
     65    push(@$classifierslist, $class);
     66
     67    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     68    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     69
     70    my $self = (defined $hashArgOptLists)? new BasClas($classifierslist,$inputargs,$hashArgOptLists): new BasClas($classifierslist,$inputargs);
     71
     72    # Transfer value from Auto Parsing to the variable name that used in previous GreenStone.
     73    my (@meta_list,$meta1);
     74    print STDERR "new List\n";
     75    if ($self->{"metadata"}) {
     76    print STDERR "List: splitting metadata, ".$self->{"metadata"}."\n";
     77    @meta_list = split(/,/, $self->{"metadata"});
    9178    $meta1 = $meta_list[0];
    92     } else {
    93     $metadata = undef;
     79    $self->{'meta_list'} = \@meta_list;
     80    } else {
    9481    $meta1=undef;
    9582    @meta_list = undef;
    9683    }
    9784
    98     if (!$title) {
    99     if (defined ($meta1)) {
    100         $title = $meta1;
    101     } else {
    102         $title = 'List';
    103     }
    104     }
    105 
    106     # sortname is handled a bit differently - kjdon
     85    if (!$self->{"buttonname"}) {
     86    if (defined ($self->{'metadata'})) {
     87        $self->{"buttonname"} = $self->generate_title_from_metadata($self->{'metadata'});
     88    } else {
     89        $self->{"buttonname"} = 'List';
     90    }
     91    }
     92
     93    # Further setup
     94    # $self->{"sort"} is handled a bit differently - kjdon
    10795    # undef means to sort, but use the metadata value from -metadata
    10896    # because there is no one metadata value to get for sorting when
    10997    # we have a list of possible metadata
    110     # to get no sorting, set sortname = 'nosort'
    111     if (!$sortname) {
    112     if (defined ($metadata)) {
    113         $sortname = undef;
    114     } else {
    115         $sortname = "nosort";
    116     }
    117     }
     98    # to get no sorting, set $self->{"sort"} = 'nosort'
     99    if (!$self->{"sort"}) {
     100    print STDERR "no sorting\n";
     101    if (defined ($self->{"metadata"})) {
     102        $self->{"sort"} = undef;
     103        print STDERR "setting no meta\n";
     104    } else {
     105        $self->{"sort"} = "nosort";
     106    }
     107    }   
     108    if (defined  $self->{"sort"} &&  $self->{"sort"} eq "nosort") {
     109    $self->{'list'} = [];
     110    } else {
     111    $self->{'list'} = {};
     112    }
     113       
     114    # Clean out the unused keys
     115    delete $self->{"metadata"}; # Delete this key
    118116   
    119     if (defined $sortname && $sortname eq "nosort") {
    120     $list = [];
    121     } else {
    122     $list = {};
    123     }
    124    
    125     $self->{'list'} = $list;
    126     if (defined $metadata) {
    127     $self->{'meta_list'} = \@meta_list;
    128     }
    129     $self->{'title'} = $title;
    130     $self->{'sortname'} = $sortname;
    131 
    132117    return bless $self, $class;
    133118}
     
    146131    # are we sorting the list??
    147132    my $nosort = 0;
    148     if (defined $self->{'sortname'} && $self->{'sortname'} eq "nosort") {
     133    if (defined $self->{'sort'} && $self->{'sort'} eq "nosort") {
    149134    $nosort = 1;
    150135    }
     
    195180
    196181    #check for a sort element other than our metadata
    197     if (defined $self->{'sortname'}) {
     182    if (defined $self->{'sort'}) {
    198183    my $sortmeta;
    199     if ($self->{'sortname'} =~ /^filename$/i) {
     184    if ($self->{'sort'} =~ /^filename$/i) {
    200185        $sortmeta = $doc_obj->get_source_filename();
    201186    } else {
    202         $sortmeta = $doc_obj->get_metadata_element($doc_obj->get_top_section(), $self->{'sortname'});
     187        $sortmeta = $doc_obj->get_metadata_element($doc_obj->get_top_section(), $self->{'sort'});
    203188        if (defined $sortmeta) {
    204         $sortmeta = &sorttools::format_metadata_for_sorting($self->{'sortname'}, $sortmeta, $doc_obj);
     189        $sortmeta = &sorttools::format_metadata_for_sorting($self->{'sort'}, $sortmeta, $doc_obj);
    205190        }
    206191    }
     
    225210
    226211    my @list = ();
    227     if (defined $self->{'sortname'} && $self->{'sortname'} eq "nosort") {
     212    if (defined $self->{'sort'} && $self->{'sort'} eq "nosort") {
    228213    @list = @{$self->{'list'}};
    229214    } else {
     
    233218    }   
    234219    }
    235 
    236220    # organise into classification structure
    237221    my %classifyinfo = ('childtype'=>'VList',
    238             'Title'=>$self->{'title'},
     222            'Title'=>$self->{'buttonname'},
    239223            'contains'=>[]);
    240224    $classifyinfo{'thistype'} = 'Invisible' unless $no_thistype;
  • trunk/gsdl/perllib/classify/Phind.pm

    r8362 r10218  
    150150
    151151sub new {
    152     my $class = shift (@_);
    153     my $self = new BasClas($class, @_);
    154 
    155     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    156     my $option_list = $self->{'option_list'};
    157     push( @{$option_list}, $options );
    158 
    159     if ($self->{'info_only'}) {
    160     # created from classinfo.pl - don't need to parse the arguments
    161     return bless $self, $class;
    162     }
    163 
    164     my $out = $self->{'outhandle'};
     152    my ($class) = shift (@_);
     153    my ($classifierslist,$inputargs,$hashArgOptLists) = @_;
     154    push(@$classifierslist, $class);
     155
     156    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     157    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     158
     159    my $self = (defined $hashArgOptLists)? new BasClas($classifierslist,$inputargs,$hashArgOptLists): new BasClas($classifierslist,$inputargs);
    165160
    166161    # Ensure the Phind generate scripts are in place
     
    168163    $file1 .= ".exe" if $ENV{'GSDLOS'} =~ /^windows$/;
    169164    my $src = &util::filename_cat($ENV{'GSDLHOME'}, "src", "phind", "generate");
    170 
    171165    if (!(-e $file1)) {
    172166    print STDERR "Phind.pm: ERROR: The Phind \"suffix\" program is not installed.\n\n";
    173167    exit(1);
    174168    }
    175 
    176     # Parse classifier arguments
    177     my $builddir = "";
    178     if (!parsargv::parse(\@_,
    179              q^text/.*/section:Title,section:text^, \$self->{'indexes'},
    180              q^title/.*/Title^, \$self->{'titlefield'},
    181              q^buttonname/.*/Phrase^, \$self->{'buttonname'},
    182              q^language/.*/en^, \$language,
    183              q^savephrases/.*/^, \$self->{'savephrases'},
    184              q^suffixmode/\d/1^, \$self->{'suffixmode'},
    185              q^min_occurs/\d/2^, \$self->{'min_occurs'},
    186              q^thesaurus/.*/^, \$self->{'thesaurus'},
    187              q^untidy^, \$self->{'untidy'},
    188              "allow_extra_options")) {
    189    
    190     print STDERR "\nIncorrect options passed to $class, check your collect.cfg file\n";
    191     $self->print_txt_usage("");  # Use default resource bundle
    192     die "\n";
    193     }
    194    
    195     # classifier information
    196     $self->{'collection'} = $ENV{'GSDLCOLLECTION'};
    197 
    198     # limit languages
    199     $self->{'language_exp'} = $language;
    200    
    201     # collection directories
    202     $self->{'collectiondir'} = $ENV{'GSDLCOLLECTDIR'};
    203 
     169   
     170    # Transfer value from Auto Parsing to the variable name that used in previous GreenStone.
     171    $self->{"indexes"} = $self->{"text"};
     172
     173    # Further setup
     174    $self->{'collection'} = $ENV{'GSDLCOLLECTION'}; # classifier information
     175    $self->{'collectiondir'} = $ENV{'GSDLCOLLECTDIR'}; # collection directories
    204176    if (! defined $self->{'builddir'}) {
    205177    $self->{'builddir'} = &util::filename_cat($ENV{'GSDLCOLLECTDIR'}, "building");
    206178    }
    207 
    208179    $self->{'total'} = 0;
    209    
     180   
     181    # Clean out the unused keys
     182    delete $self->{"text"};
     183
    210184    return bless $self, $class;
    211185}
     
    265239    my $top_section = $doc_obj->get_top_section();
    266240
    267     my $titlefield = $self->{'titlefield'};
     241    my $titlefield = $self->{'title'};
    268242   
    269243    my $title = $doc_obj->get_metadata_element ($top_section, $titlefield);
     
    276250    # Only consider the file if it is in the correct language
    277251    my $doclanguage = $doc_obj->get_metadata_element ($top_section, "Language");
    278     my $phrlanguage = $self->{'language_exp'};
     252    my $phrlanguage = $self->{'language'};
    279253    return if ($doclanguage && ($doclanguage !~ /$phrlanguage/i));
    280254   
     
    282256    $self->{'total'} ++;
    283257    print "file $self->{'total'}: $file\n" if ($self->{'$verbosity'});
    284    
    285258
    286259    # Store document details
     
    698671    my $phinddir = $self->{'phinddir'};
    699672
    700     my $language_exp = $self->{'language_exp'};
     673    my $language_exp = $self->{'language'};
    701674
    702675    my ($w, $l, $line, $word);
  • trunk/gsdl/perllib/classify/SectionList.pm

    r8852 r10218  
    4545
    4646
    47 sub new {
    48     my $class = shift (@_);
    49     my $self = new List($class, @_);
     47sub new {
     48    my ($class) = shift (@_);
     49    my ($classifierslist,$inputargs,$hashArgOptLists) = @_;
     50    push(@$classifierslist, $class);
    5051
    51     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    52     my $option_list = $self->{'option_list'};
    53     push( @{$option_list}, $options );
     52    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     53    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
    5454
    55     #if ($self->{'info_only'}) {
    56     # created from classinfo.pl - don't need to parse the arguments
    57     #   return bless $self, $class;
    58     #}
     55    my $self = (defined $hashArgOptLists)? new List($classifierslist,$inputargs,$hashArgOptLists): new List($classifierslist,$inputargs);
     56
    5957    return bless $self, $class;
    6058}
     
    6765    # are we sorting the list??
    6866    my $nosort = 0;
    69     if (defined $self->{'sortname'} && $self->{'sortname'} eq "nosort") {
     67    if (defined $self->{'sort'} && $self->{'sort'} eq "nosort") {
    7068    $nosort = 1;
    7169    }
     
    8381
    8482    my $sortmeta = "";
    85     if (!$nosort && defined $self->{'sortname'}) {
    86     if ($self->{'sortname'} =~ /^filename$/i) {
     83    if (!$nosort && defined $self->{'sort'}) {
     84    if ($self->{'sort'} =~ /^filename$/i) {
    8785        $sortmeta = $doc_obj->get_source_filename();
    8886    } else {
    89         $sortmeta = $doc_obj->get_metadata_element($doc_obj->get_top_section(), $self->{'sortname'});
     87        $sortmeta = $doc_obj->get_metadata_element($doc_obj->get_top_section(), $self->{'sort'});
    9088        if (defined $sortmeta) {
    91         $sortmeta = &sorttools::format_metadata_for_sorting($self->{'sortname'}, $sortmeta, $doc_obj);
     89        $sortmeta = &sorttools::format_metadata_for_sorting($self->{'sort'}, $sortmeta, $doc_obj);
    9290        }
    9391    }
     
    140138    }
    141139
    142     if (defined $self->{'sortname'}) {
     140    if (defined $self->{'sort'}) {
    143141    # sorting on alternative metadata
    144142    $self->{'list'}->{"$doc_OID.$section"} = $sortmeta;
    145143    } else {
    146     # sortingon the classification metadata
     144    # sorting on the classification metadata
    147145    # do the same formatting on the meta value as for sort meta
    148146    $metavalue = &sorttools::format_metadata_for_sorting($metaname, $metavalue, $doc_obj);
  • trunk/gsdl/perllib/plugin.pm

    r10155 r10218  
    8484    $options =~ s/\$/\\\$/g;
    8585
    86     eval ("\$plugobj = new \$pluginname($options)");
     86    eval ("\$plugobj = new \$pluginname([],[$options])");
    8787    die "$@" if $@;
    8888   
  • trunk/gsdl/perllib/plugins/ArcPlug.pm

    r10156 r10218  
    5353
    5454sub new {
    55     my ($class) = @_;
    56     my $self = new BasPlug ("ArcPlug", @_);
    57      
    58     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    59      my $option_list = $self->{'option_list'};
    60      push( @{$option_list}, $options );
     55    my ($class) = shift (@_);
     56    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
     57    push(@$pluginlist, $class);
     58
     59    if(defined $arguments){print "SETSEGE\n"; push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     60    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     61
     62    my $self = (defined $hashArgOptLists)? new BasPlug($pluginlist,$inputargs,$hashArgOptLists): new BasPlug($pluginlist,$inputargs);
    6163
    6264    return bless $self, $class;
  • trunk/gsdl/perllib/plugins/BNContentePlug.pm

    r9853 r10218  
    3939
    4040sub BEGIN {
    41     @ISA = ('BasPlug');
     41    @BNContentePlug::ISA = ('BasPlug');
    4242    unshift (@INC, "$ENV{'GSDLHOME'}/perllib/cpan");
    4343}
     
    9393
    9494sub new {
    95     my $class = shift (@_);
    96     #my $plugin_name = shift (@_);
    97 
    98     $self = new BasPlug ($class, @_);
    99     $self->{'plugin_type'} = "BNContentePlug";
    100 
    101     my $option_list = $self->{'option_list'};
    102     push( @{$option_list}, $options );
    103  
    104     if (!parsargv::parse(\@_,
    105              "allow_extra_options")) {
    106     print STDERR "\nBNContentePlug uses an incorrect option.\n";
    107     print STDERR "Check your collect.cfg configuration file.\n\n";
    108     $self->print_txt_usage("");  # Use default resource bundle
    109     die "\n";
    110     }
     95    my ($class) = shift (@_);
     96    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
     97    push(@$pluginlist, $class);
     98
     99    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     100    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     101
     102    $self = (defined $hashArgOptLists)? new BasPlug($pluginlist,$inputargs,$hashArgOptLists): new BasPlug($pluginlist,$inputargs);
    111103   
    112104    #create XML::Parser object for parsing metsHTML.xml, NCB_???.xml files
  • trunk/gsdl/perllib/plugins/BasPlug.pm

    r10155 r10218  
    5353use gsprintf 'gsprintf';
    5454use printusage;
     55#$%^
     56use parse2;
     57
    5558
    5659use GISBasPlug;
     
    5962
    6063my $unicode_list =
    61     [ { 'name' => "auto",
    62     'desc' => "{BasPlug.input_encoding.auto}" },
    63       { 'name' => "ascii",
     64    [ { 'name' => "ascii",
    6465    'desc' => "{BasPlug.input_encoding.ascii}" },
    6566      { 'name' => "utf8",
     
    6869    'desc' => "{BasPlug.input_encoding.unicode}" } ];
    6970
     71my $auto_unicode_list =
     72    [ { 'name' => "auto",
     73    'desc' => "{BasPlug.input_encoding.auto}" } ];
     74
    7075my $arguments =
    7176    [ { 'name' => "process_exp",
     
    9095    'desc' => "{BasPlug.input_encoding}",
    9196    'type' => "enum",
    92     'list' => $unicode_list,
     97    'list' => $auto_unicode_list,
    9398    'reqd' => "no" ,
    9499    'deft' => "auto" } ,
     
    107112    'type' => "language",
    108113    'deft' => "en",
     114    'char_length' => "2",
    109115    'reqd' => "no" },
    110116      { 'name' => "extract_acronyms",
     
    141147    'type' => "int",
    142148    'deft' => (localtime)[5]+1900,
     149    'char_length' => "4",
     150    #'range' => "2,100",
    143151    'reqd' => "no"},
    144152      { 'name' => "maximum_century",
    145153    'desc' => "{BasPlug.maximum_century}",
    146154    'type' => "string",
    147     'deft' => "",
     155    'deft' => "-1",
    148156    'reqd' => "no" },
    149157      { 'name' => "no_bibliography",
     
    154162    'desc' => "{BasPlug.no_cover_image}",
    155163    'type' => "flag",
    156     'reqd' => "no" } ];
     164    'reqd' => "no" },
     165      { 'name' => "extract_keyphrases",
     166    'desc' => "{BasPlug.extract_keyphrases}",
     167    'type' => "flag",
     168    'reqd' => "no",
     169    'hiddengli' => "yes" },
     170      { 'name' => "extract_keyphrase_options",
     171    'desc' => "{BasPlug.extract_keyphrase_options}",
     172    'type' => "string",
     173    'reqd' => "no",
     174    'hiddengli' => "yes" },
     175      { 'name' => "separate_cjk",
     176    'desc' => "{BasPlug.separate_cjk}",
     177    'type' => "flag",
     178    'reqd' => "no",
     179    'hiddengli' => "yes" },
     180      { 'name' => "smart_block",
     181    'desc' => "{BasPlug.smart_block}",
     182    'type' => "flag",
     183    'reqd' => "no",
     184    'hiddengli' => "yes" },
     185      { 'name' => "new_extract_email",
     186    'desc' => "",
     187    'type' => "flag",
     188    'reqd' => "no",
     189    'hiddengli' => "yes" } ];
    157190
    158191my $gis_arguments =
     
    238271{
    239272    my $self = shift(@_);
    240 
    241273    # Print the usage message for a plugin (recursively)
    242274    my $descoffset = $self->determine_description_offset(0);
     
    317349
    318350sub new {
     351    # Set Encodings to the list!!
     352
     353    my $e = $encodings::encodings;
     354    foreach my $enc (sort {$e->{$a}->{'name'} cmp $e->{$b}->{'name'}} keys (%$e))
     355    {
     356    my $hashEncode =
     357        {'name' => $enc,
     358         'desc' => $e->{$enc}->{'name'}};
     359
     360    push(@{$unicode_list},$hashEncode);
     361    }
     362
     363    push(@{$auto_unicode_list},@{$unicode_list});
     364
     365    # Start the BasPlug Constructor
    319366    my $class = shift (@_);
    320     my $plugin_name = shift (@_);
    321     my $self = {};
    322     $self->{'plugin_type'} = "BasPlug";
     367    my ($pluginlist,$args,$hashArgOptLists) = @_;
     368    push(@$pluginlist, $class);
     369    my $plugin_name = (defined $pluginlist->[0]) ? $pluginlist->[0] : $class;
     370
     371    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     372    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
    323373
    324374    if (GISBasPlug::has_mapdata()) {
    325375    push(@$arguments,@$gis_arguments);
    326376    }
    327 
    328     my $enc = "^(";
    329     map {$enc .= "$_|";} keys %$encodings::encodings;
    330     my $denc = $enc . "ascii|utf8|unicode)\$";
    331     $enc .= "ascii|utf8|unicode|auto)\$";
    332    
     377   
     378    my $self = {};
     379    if(!parse2::parse($args,$hashArgOptLists->{"ArgList"},$self))
     380    {
     381    my $classTempClass = bless $self, $class;
     382    &gsprintf(STDERR, "\n{BasPlug.bad_general_option}\n", $plugin_name);
     383    $classTempClass->print_txt_usage("");  # Use default resource bundle
     384    die "\n";
     385    }
     386
     387    # else parsing was successful.
     388
     389    $self->{'plugin_type'} = $plugin_name;
    333390    $self->{'outhandle'} = STDERR;
    334     my $year = (localtime)[5]+1900;
    335 
    336391    $self->{'textcat'} = new textcat();
    337 
    338392    $self->{'num_processed'} = 0;
    339393    $self->{'num_not_processed'} = 0;
     
    341395    $self->{'num_archives'} = 0;
    342396    $self->{'cover_image'} = 1; # cover image is on by default
    343 
    344     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    345     $self->{'option_list'} = [ $options ];
    346    
    347     my $no_cover_image = 0;
    348     # general options available to all plugins
    349     if (!parsargv::parse(\@_,
    350              q^process_exp/.*/^, \$self->{'process_exp'},
    351              q^block_exp/.*/^, \$self->{'block_exp'},
    352              q^associate_ext/.*/^, \$self->{'associate_ext'},
    353              q^extract_language^, \$self->{'extract_language'},
    354              q^extract_acronyms^, \$self->{'extract_acronyms'},
    355              q^extract_keyphrases^, \$self->{'kea'}, #with extra options (UNDOCUMENTED)
    356              q^extract_keyphrase_options/.*/^, \$self->{'kea_options'}, #no extra options (UNDOCUMENTED)
    357              qq^input_encoding/$enc/auto^, \$self->{'input_encoding'},
    358              qq^default_encoding/$denc/utf8^, \$self->{'default_encoding'},
    359              q^extract_email^, \$self->{'extract_email'},
    360              q^extract_placenames^, \$self->{'extract_placenames'},
    361              q^gazetteer/.*/^, \$self->{'gazetteer'},
    362              q^place_list^, \$self->{'place_list'},
    363              q^markup_acronyms^, \$self->{'markup_acronyms'},
    364              q^default_language/.{2}/en^, \$self->{'default_language'},
    365              q^first/.*/^, \$self->{'first'},
    366              q^extract_historical_years^, \$self->{'date_extract'},
    367              qq^maximum_year/\\d{4}/$year^, \$self->{'max_year'},
    368              q^no_bibliography^, \$self->{'no_biblio'},
    369              qq^maximum_century/-?\\d{1,2}( ?B\\.C\\.E\\.)?/-1^, \$self->{'max_century'},
    370              q^no_cover_image^, \$no_cover_image,
    371              q^separate_cjk^, \$self->{'separate_cjk'},
    372              q^smart_block^, \$self->{'smart_block'},
    373              q^smart_block_BN^, \$self->{'smart_block_BN'},
    374              "allow_extra_options")) {
    375 
    376     gsprintf(STDERR, "\n{BasPlug.bad_general_option}\n", $plugin_name);
    377         bless $self, $class;
    378     $self->print_txt_usage("");  # Use default resource bundle
    379     die "\n";
    380     }
    381 
     397    $self->{'cover_image'} = 0 if ($self->{'no_cover_image'});
     398    $self->{'file_blocks'} = {};
     399    $self->{'option_list'} = $hashArgOptLists->{"OptList"};
     400   
    382401    my $associate_ext = $self->{'associate_ext'};
    383402    if ((defined $associate_ext) && ($associate_ext ne "")) {
     
    395414    $self->{'file_blocks'} = {};
    396415
    397     $self->{'cover_image'} = 0 if ($no_cover_image);
    398 
    399416    if ($self->{'extract_placenames'}) {
    400417
    401418    my $outhandle = $self->{'outhandle'};
    402 
     419   
    403420    my $places_ref
    404421        = GISBasPlug::loadGISDatabase($outhandle,$self->{'gazetteer'});
    405 
     422   
    406423    if (!defined $places_ref) {
    407424        print $outhandle "Warning: Error loading mapdata gazetteer \"$self->{'gazetteer'}\"\n";
     
    414431    }   
    415432    return bless $self, $class;
     433   
    416434}
    417435
     
    11211139    @email = sort @email;
    11221140   
    1123     my @email2 = ();
     1141#    if($self->{"new_extract_email"} == 0)
     1142#    {
     1143#    my @email2 = ();
     1144#    foreach my $address (@email)
     1145#   {
     1146#   if (!(join(" ",@email2) =~ m/(^| )$address( |$)/ ))
     1147#       {
     1148#       push @email2, $address;
     1149#       $doc_obj->add_utf8_metadata ($thissection, "emailAddress", $address);
     1150#       # print $outhandle "  extracting $address\n"
     1151#       &gsprintf($outhandle, "  {BasPlug.extracting} $address\n")
     1152#           if ($self->{'verbosity'} > 3);
     1153#       }
     1154#   }
     1155#    }
     1156#    else
     1157#    {
     1158    my $hashExistMail = {};
    11241159    foreach my $address (@email) {
    1125     if (!(join(" ",@email2) =~ m/$address/ )) {
    1126         push @email2, $address;
     1160    if (!(defined $hashExistMail->{$address}))
     1161    {
     1162        $hashExistMail->{$address} = 1;
    11271163        $doc_obj->add_utf8_metadata ($thissection, "emailAddress", $address);
    11281164        gsprintf($outhandle, "  {BasPlug.extracting} $address\n")
     
    11571193    }
    11581194
    1159     # adding kea keyphrases
    1160     if ($self->{'kea'}) {
     1195    #adding kea keyphrases
     1196    if ($self->{'extract_keyphrases'}) { 
    11611197   
    11621198    my $thissection = $doc_obj->get_top_section();
     
    11711207    }
    11721208       
    1173     if ($self->{'kea_options'}) {
    1174         #if kea options flag is set, call Kea with specified options
    1175         $list = &Kea::extract_KeyPhrases ($text, $self->{'kea_options'});
    1176     } else {
    1177         #otherwise call Kea with no options
     1209    if($self->{'extract_keyphrase_options'}) { #if kea options flag is set, call Kea with specified options
     1210        $list = &Kea::extract_KeyPhrases ($text, $self->{'extract_keyphrase_options'});
     1211    } else { #otherwise call Kea with no options
    11781212        $list = &Kea::extract_KeyPhrases ($text);
    11791213    }
     1214     
    11801215    if ($list){
    11811216        # if a list of kea keyphrases was returned (ie not empty)
     
    12271262    }
    12281263
    1229     if($self->{'date_extract'}) {
     1264    if($self->{'extract_historical_years'}) {
    12301265    my $thissection = $doc_obj->get_top_section();
    12311266    while (defined $thissection) {
    1232        
     1267
    12331268        my $text = $doc_obj->get_text($thissection);
    12341269        &DateExtract::get_date_metadata($text, $doc_obj,
    12351270                        $thissection,
    1236                         $self->{'no_biblio'},
    1237                         $self->{'max_year'},
    1238                         $self->{'max_century'});
     1271                        $self->{'no_bibliography'},
     1272                        $self->{'maximum_year'},
     1273                        $self->{'maximum_century'});
    12391274        $thissection = $doc_obj->get_next_section ($thissection);
    12401275    }
  • trunk/gsdl/perllib/plugins/BibTexPlug.pm

    r9582 r10218  
    8181}
    8282sub new {
    83     my $class = shift (@_);
    84     my $self = new SplitPlug ($class, @_);
    85     $self->{'plugin_type'} = "BibTexPlug";
    86     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    87     my $option_list = $self->{'option_list'};
    88     push( @{$option_list}, $options );
     83    my ($class) = shift (@_);
     84    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
     85    push(@$pluginlist, $class);
     86
     87    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     88    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     89
     90    my $self = (defined $hashArgOptLists)? new SplitPlug($pluginlist,$inputargs,$hashArgOptLists): new SplitPlug($pluginlist,$inputargs);
     91
    8992    return bless $self, $class;
    9093}
  • trunk/gsdl/perllib/plugins/BookPlug.pm

    r8121 r10218  
    7979
    8080sub new {
    81     my ($class) = @_;
    82     my $self = new BasPlug ("BookPlug", @_);
    83     $self->{'plugin_type'} = "BookPlug";
    84     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    85     my $option_list = $self->{'option_list'};
    86     push( @{$option_list}, $options );
    87    
     81    my ($class) = shift (@_);
     82    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
     83    push(@$pluginlist, $class);
     84
     85    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     86    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     87
     88    my $self = (defined $hashArgOptLists)? new BasPlug($pluginlist,$inputargs,$hashArgOptLists): new BasPlug($pluginlist,$inputargs);
     89
    8890    return bless $self, $class;
    8991}
  • trunk/gsdl/perllib/plugins/ConvertToPlug.pm

    r9853 r10218  
    6565    'desc' => "{ConvertToPlug.use_strings}",
    6666    'type' => "flag",
    67     'reqd' => "no" } ];
     67    'reqd' => "no" },
     68      { 'name' => "extract_keyphrases",
     69    'desc' => "{BasPlug.extract_keyphrases}",
     70    'type' => "flag",
     71    'reqd' => "no",
     72    'hiddengli' => "yes" },
     73      { 'name' => "extract_keyphrase_options",
     74    'desc' => "{BasPlug.extract_keyphrase_options}",
     75    'type' => "string",
     76    'reqd' => "no",
     77    'hiddengli' => "yes" } ];
    6878
    6979my $options = { 'name'     => "ConvertToPlug",
     
    7383        'args'     => $arguments };
    7484
    75 sub parse_args
     85
     86sub findType
    7687{
    77     my $class = shift (@_);
    78     my ($args) = @_;
    79 
    80     my $plugin_name = $class;
    81     $plugin_name =~ s/\.pm$//;
    82 
    83     my $newargs = {};
    84 
    85     if (!parsargv::parse($args, 
    86              q^extract_keyphrases^, \$newargs->{'kea'}, #with extra options (undocumented)
    87              q^extract_keyphrase_options/.*/^, \$newargs->{'kea_options'}, #no extra options (undocumented)
    88              q^convert_to/(html|text)/html^, \$newargs->{'generate_format'},
    89              q^use_strings^, \$newargs->{'use_strings'},
    90              "allow_extra_options")) {
    91 
    92     print STDERR "\nIncorrect options passed to $plugin_name, ";
    93     print STDERR "check your collect.cfg configuration file\n";
    94     $self->print_txt_usage("");  # Use default resource bundle
    95     die "\n";
    96     }
    97    
    98     return ($plugin_name, $newargs);
     88    my ($inputargs) = @_;
     89   
     90    for(my $intCounter = 0; $intCounter < scalar(@{$inputargs}) ; $intCounter++)
     91    {
     92    if($inputargs->[$intCounter] eq "-convert_to")
     93    {
     94        if($inputargs->[$intCounter+1] eq "text" || $inputargs->[$intCounter+1] eq "html")
     95        {
     96        return $inputargs->[$intCounter+1];
     97        }
     98        else {return "html";}
     99    }
     100    }
     101    return "html";
    99102}
    100103
    101104sub new {
    102     my $class = shift (@_);
    103     if ($class eq "ConvertToPlug" && defined $_[0]) {$class = shift (@_);}
    104     my $self;
    105     # parsargv::parse might modify the list, so we do this by creating a copy
    106     # of the argument list.
    107     my @arglist = @_;
    108     my ($plugin_name, $args) = $class->parse_args(\@_);
    109 
    110     if ($class eq "PDFPlug" && $args->{'generate_format'} eq "text" &&
     105    my ($class) = shift (@_);
     106    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
     107    push(@$pluginlist, $class);
     108    my $classPluginName = (defined $pluginlist->[0]) ? $pluginlist->[0] : $class;
     109    my $strConvertTo = findType($inputargs);
     110
     111    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     112    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     113
     114    if ($classPluginName eq "PDFPlug" && $strConvertTo eq "text" &&
    111115    $ENV{'GSDLOS'} =~ /^windows$/i) {
    112116    print STDERR "Windows does not support pdf to text. PDFs will be converted to HTML instead\n";
    113     $args->{'generate_format'} = "html";
    114     }
    115 
    116     if ($args->{'generate_format'} eq "text")
     117    $strConvertTo = "html";
     118    }
     119
     120    my $self = {};
     121    if ($strConvertTo eq "text")
    117122    {
    118     $self = new TEXTPlug ($class, @arglist);
     123    $self = (defined $hashArgOptLists)? new TEXTPlug($pluginlist,$inputargs,$hashArgOptLists): new TEXTPlug($pluginlist,$inputargs);
    119124    $self->{'convert_to'} = "TEXT";
    120125    $self->{'convert_to_ext'} = "txt";
     
    122127    else
    123128    {
    124     $self = new HTMLPlug ($class, @arglist);
     129    $self = (defined $hashArgOptLists)? new HTMLPlug($pluginlist,$inputargs,$hashArgOptLists): new HTMLPlug($pluginlist,$inputargs);
    125130    $self->{'convert_to'} = "HTML";
    126131    $self->{'convert_to_ext'} = "html";
     
    130135    }
    131136
    132     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    133     my $option_list = $self->{'option_list'};
    134     push( @{$option_list}, $options );
    135 
    136     foreach my $key (keys %$args) {
    137       $self->{$key} = $args->{$key};
    138     }
    139  
    140137    return bless $self, $class;
    141138}
     
    273270
    274271    my $outhandle = $self->{'outhandle'};
    275 
     272   
    276273    my $filename = $file;
    277274    $filename = &util::filename_cat ($base_dir, $file) if $base_dir =~ /\w/;
     
    296293
    297294    my $output_ext = $self->{'convert_to_ext'};
     295   
    298296    my $conv_filename = $self->tmp_area_convert_file($output_ext, $filename);
    299297
  • trunk/gsdl/perllib/plugins/ConvertToRogPlug.pm

    r9853 r10218  
    6363
    6464sub new {
    65     my $class = shift (@_);
    66     if ($class eq "ConvertToRogPlug" && defined $_[0]) {$class = shift (@_);}
    67     my $self;
    68     # parsargv::parse might modify the list, so we do this by creating a copy
    69     # of the argument list.
    70     my @arglist = @_;
    71     my ($plugin_name) = $class->parse_args(\@_);
    72 
    73     $self = new RogPlug ($class, @arglist);
     65    my ($class) = shift (@_);
     66    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
     67    push(@$pluginlist, $class);
     68
     69    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     70    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     71
     72    my $self = (defined $hashArgOptLists)? new RogPlug($pluginlist,$inputargs,$hashArgOptLists): new RogPlug($pluginlist,$inputargs);
     73
    7474    $self->{'convert_to'} = "Rog";
    7575    $self->{'convert_to_ext'} = "rog";
    76     $self->{'plugin_type'} = "ConvertToRogPlug";
    77     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    78     my $option_list = $self->{'option_list'};
    79     push( @{$option_list}, $options );
    8076
    8177    return bless $self, $class;
  • trunk/gsdl/perllib/plugins/DBPlug.pm

    r9853 r10218  
    6161
    6262sub new {
    63     my ($class) = @_;
    64     my $self = new BasPlug ($class, @_);
    65     $self->{'plugin_type'} = "DBPlug";
    66     my $option_list = $self->{'option_list'};
    67     push( @{$option_list}, $options );
    68 
    69     # no plugin-specific options
    70 #    if (!parsargv::parse(\@_, "allow_extra_options")) {
    71 #   $self->print_txt_usage("");  # Use default resource bundle
    72 #   die "\n";
    73 #    }
    74 
     63    my ($class) = shift (@_);
     64    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
     65    push(@$pluginlist, $class);
     66
     67    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     68    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     69
     70    my $self = (defined $hashArgOptLists)? new BasPlug($pluginlist,$inputargs,$hashArgOptLists): new BasPlug($pluginlist,$inputargs);
    7571
    7672    return bless $self, $class;
  • trunk/gsdl/perllib/plugins/DSpacePlug.pm

    r9853 r10218  
    5454
    5555sub BEGIN {
    56     @ISA = ('BasPlug');
     56    @DSpacePlug::ISA = ('BasPlug');
    5757}
    5858
     
    9696
    9797sub new {
    98     my $class = shift (@_);
    99     #my $plugin_name = shift (@_);
    100 
    101     $self = new BasPlug ($class, @_);
    102     $self->{'plugin_type'} = "DSpacePlug";
    103 
    104     my $option_list = $self->{'option_list'};
    105     push( @{$option_list}, $options );
    106 
    107  
    108     if (!parsargv::parse(\@_,
    109              q^only_first_doc^, \$self->{'only_first_doc'},
    110              q^first_inorder_ext/.*/^, \$self->{'first_inorder_ext'},
    111              q^first_inorder_mime/.*/^, \$self->{'first_inorder_mime'},
    112              "allow_extra_options")) {
    113     print STDERR "\nDSpacePlug uses an incorrect option.\n";
    114     print STDERR "Check your collect.cfg configuration file.\n\n";
    115     $self->print_txt_usage("");  # Use default resource bundle
    116     die "\n";
    117     }
     98    my ($class) = shift (@_);
     99    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
     100    push(@$pluginlist, $class);
     101
     102    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     103    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     104
     105    $self = (defined $hashArgOptLists)? new BasPlug($pluginlist,$inputargs,$hashArgOptLists): new BasPlug($pluginlist,$inputargs);
    118106   
    119107    #create XML::Parser object for parsing dublin_core.xml files
  • trunk/gsdl/perllib/plugins/EMAILPlug.pm

    r9971 r10218  
    113113
    114114sub new {
    115     my ($class) = @_;
    116     my $self = new BasPlug ($class, @_);
    117     $self->{'plugin_type'} = "EMAILPlug";
    118     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    119     my $option_list = $self->{'option_list'};
    120     push( @{$option_list}, $options );
    121 
    122     if (!parsargv::parse(\@_,
    123              q^split_exp/.*/^, \$self->{'split_exp'},
    124              q^no_attachments^, \$self->{'ignore_attachments'},
    125              q^headers^, \$self->{'header_metadata'},
    126              "allow_extra_options")) {
    127     print STDERR "\nIncorrect options passed to $class.";
    128     print STDERR "\nCheck your collect.cfg configuration file\n";
    129     $self->print_txt_usage("");  # Use default resource bundle
    130     die "\n";
    131     }
     115    my ($class) = shift (@_);
     116    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
     117    push(@$pluginlist, $class);
     118
     119    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     120    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     121
     122    my $self = (defined $hashArgOptLists)? new SplitPlug($pluginlist,$inputargs,$hashArgOptLists): new SplitPlug($pluginlist,$inputargs);
     123
    132124    $self->{'assoc_filenames'} = {}; # to save attach names so we don't clobber
    133125
     
    431423
    432424   
    433     if ($self->{'header_metadata'} && $self->{'header_metadata'} == 1) {
     425    if ($self->{'headers'} && $self->{'headers'} == 1) {
    434426    # Add "All headers" metadata
    435427    $Headers = &text_into_html($Headers);
     
    791783   
    792784    # save attachment by default
    793     if (!$self->{'ignore_attachments'}
     785    if (!$self->{'no_attachments'}
    794786        && $filename ne "") { # this part has a file...
    795787        my $encoding="8bit";
  • trunk/gsdl/perllib/plugins/ExcelPlug.pm

    r9465 r10218  
    4949
    5050sub new {
    51     my $class = shift (@_);
     51    my ($class) = shift (@_);
     52    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
     53    push(@$pluginlist, $class);
    5254
    53     my $self = new ConvertToPlug ($class, @_);
    54     $self->{'plugin_type'} = "ExcelPlug";
    55 # I'm not sure what encoding xlhtml produces - I think it puts it
    56 # into the Content-Type meta tag in the header of the HTML file.
     55    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     56    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
    5757
    58 #    if ($self->{'input_encoding'} eq "auto") {
    59 #   $self->{'input_encoding'} = "utf8";
    60 #    }
    61 
    62     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    63     my $option_list = $self->{'option_list'};
    64     push( @{$option_list}, $options );
     58    my $self = (defined $hashArgOptLists)? new ConvertToPlug($pluginlist,$inputargs,$hashArgOptLists): new ConvertToPlug($pluginlist,$inputargs);
    6559
    6660    return bless $self, $class;
  • trunk/gsdl/perllib/plugins/FOXPlug.pm

    r9853 r10218  
    5151
    5252sub new {
    53     my ($class) = @_;
    54     $self = new BasPlug ();
    55     $self->{'plugin_type'} = "FOXPlug";
    56     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    57     my $option_list = $self->{'option_list'};
    58     push( @{$option_list}, $options );
     53    my ($class) = shift (@_);
     54    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
     55    push(@$pluginlist, $class);
     56
     57    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     58    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     59
     60    my $self = (defined $hashArgOptLists)? new BasPlug($pluginlist,$inputargs,$hashArgOptLists): new BasPlug($pluginlist,$inputargs);
    5961
    6062    return bless $self, $class;
  • trunk/gsdl/perllib/plugins/FavouritesPlug.pm

    r9893 r10218  
    3434
    3535sub BEGIN {
    36     @ISA = ('BasPlug');
     36    @FavouritesPlug::ISA = ('BasPlug');
    3737}
    3838
     
    5252
    5353sub new {
    54     my ($class) = @_;
    55     my $self = new BasPlug ($class, @_);
    56     $self->{'plugin_type'} = "FavouritesPlug";
     54    my ($class) = shift(@_);
     55    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
     56    push(@$pluginlist, $class);
    5757
    58     # To allow for proper inheritance of arguments
    59     my $option_list = $self->{'option_list'};
    60     push( @{$option_list}, $options );
     58    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     59    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     60
     61    my $self = (defined $hashArgOptLists)? new BasPlug($pluginlist,$inputargs,$hashArgOptLists): new BasPlug($pluginlist,$inputargs);
    6162
    6263    return bless $self, $class;
  • trunk/gsdl/perllib/plugins/GAPlug.pm

    r9468 r10218  
    3232
    3333use XMLPlug;
     34#$%^
     35use parse2;
    3436
    3537sub BEGIN {
     
    5052
    5153sub new {
    52     my $class = shift (@_);
    53     my $self = new XMLPlug ($class, @_);
     54    my ($class) = shift (@_);
     55    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
     56    push(@$pluginlist, $class);
    5457
    55     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    56     my $option_list = $self->{'option_list'};
    57     push( @{$option_list}, $options );
     58    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     59    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     60
     61    my $self = (defined $hashArgOptLists)? new XMLPlug($pluginlist,$inputargs,$hashArgOptLists): new XMLPlug($pluginlist,$inputargs);
    5862
    5963    $self->{'section'} = "";
  • trunk/gsdl/perllib/plugins/GMLPlug.pm

    r9853 r10218  
    5353
    5454sub new {
    55     my ($class) = @_;
    56     my $self = new BasPlug ("GMLPlug", @_);
    57 
    58     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    59     my $option_list = $self->{'option_list'};
    60     push( @{$option_list}, $options );
    61 
    62     return bless $self, $class;}
     55    my ($class) = shift (@_);
     56    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
     57    push(@$pluginlist, $class);
     58
     59    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     60    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     61
     62    my $self = (defined $hashArgOptLists)? new BasPlug($pluginlist,$inputargs,$hashArgOptLists): new BasPlug($pluginlist,$inputargs);
     63
     64    return bless $self, $class;
     65}
    6366
    6467sub get_default_process_exp {
  • trunk/gsdl/perllib/plugins/HBPlug.pm

    r9853 r10218  
    6868
    6969sub new {
    70     my ($class) = @_;
    71     my $self = new BasPlug ("HBPlug", @_);
    72     $self->{'plugin_type'} = "HBPlug";
    73     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    74     my $option_list = $self->{'option_list'};
    75     push( @{$option_list}, $options );
     70    my ($class) = shift (@_);
     71    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
     72    push(@$pluginlist, $class);
     73
     74    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     75    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     76
     77    my $self = (defined $hashArgOptLists)? new BasPlug($pluginlist,$inputargs,$hashArgOptLists): new BasPlug($pluginlist,$inputargs);
    7678
    7779    return bless $self, $class;
  • trunk/gsdl/perllib/plugins/HTMLPlug.pm

    r10121 r10218  
    9292    'desc' => "{HTMLPlug.description_tags}",
    9393    'type' => "flag" },
     94      # retain this for backward compatibility (w3mir option was replaced by
     95      # file_is_url)
     96      { 'name' => "w3mir",
     97#   'desc' => "{HTMLPlug.w3mir}",
     98    'type' => "flag",
     99    'hiddengli' => "yes"},
    94100      { 'name' => "no_strip_metadata_html",
    95101    'desc' => "{HTMLPlug.no_strip_metadata_html}",
     
    109115
    110116sub new {
    111     my $class = shift (@_);
    112     my $self = new BasPlug ($class, @_);
    113     $self->{'plugin_type'} = "HTMLPlug";
    114     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    115     my $option_list = $self->{'option_list'};
    116     push( @{$option_list}, $options );
    117    
    118     if (!parsargv::parse(\@_,
    119              q^nolinks^, \$self->{'nolinks'},
    120              q^keep_head^, \$self->{'keep_head'},
    121              q^no_metadata^, \$self->{'no_metadata'},
    122              q^metadata_fields/.*/Title^, \$self->{'metadata_fields'},
    123              q^hunt_creator_metadata^, \$self->{'hunt_creator_metadata'},
    124              q^w3mir^, \$self->{'w3mir'},
    125              q^file_is_url^, \$self->{'file_is_url'},
    126              q^assoc_files/.*/(?i)\.(jpe?g|jpe|gif|png|css)$^, \$self->{'assoc_files'},
    127              q^rename_assoc_files^, \$self->{'rename_assoc_files'},
    128              q^title_sub/.*/^, \$self->{'title_sub'},
    129              q^description_tags^, \$self->{'description_tags'},
    130              q^no_strip_metadata_html/.*/^, \$self->{'no_strip_metadata_html'},
    131              q^sectionalise_using_h_tags^, \$self->{'sectionalise_using_h_tags'},
    132              "allow_extra_options")) {
    133 
    134     print STDERR "\nIncorrect options passed to HTMLPlug, check your collect.cfg configuration file\n";
    135     $self->print_txt_usage("");  # Use default resource bundle
    136     die "\n";
    137     }
    138 
    139     # retain this for backward compatibility (w3mir option was replaced by
    140     # file_is_url)
     117    my ($class) = shift (@_);
     118    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
     119    push(@$pluginlist, $class);
     120
     121    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     122    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     123
     124    my $self = (defined $hashArgOptLists)? new BasPlug($pluginlist,$inputargs,$hashArgOptLists): new BasPlug($pluginlist,$inputargs);
     125
    141126    if ($self->{'w3mir'}) {
    142127    $self->{'file_is_url'} = 1;
     
    146131    $self->{'dir_num'} = 0;
    147132    $self->{'file_num'} = 0;
    148 
     133   
    149134    return bless $self, $class;
    150135}
  • trunk/gsdl/perllib/plugins/ISISPlug.pm

    r9998 r10218  
    9696sub new
    9797{
    98     my $class = shift(@_);
    99 
    100     my $self = new SplitPlug($class, @_);
    101     if (!parsargv::parse(\@_,
    102              q^subfield_separator/.*/, ^, \$self->{'subfield_separator'},
    103              q^entry_separator/.*/<br>^, \$self->{'entry_separator'},
    104              "allow_extra_options")) {
    105     print STDERR "\nIncorrect options passed to ISISPlug, check your collect.cfg configuration file\n";
    106     die "\n";
    107     }
    108 
    109     # To allow for proper inheritance of arguments
    110     my $option_list = $self->{'option_list'};
    111     push(@{$option_list}, $options);
    112     $self->{'plugin_type'} = "ISISPlug";
     98    my ($class) = shift (@_);
     99    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
     100    push(@$pluginlist, $class);
     101
     102    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     103    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     104
     105    my $self = (defined $hashArgOptLists)? new SplitPlug($pluginlist,$inputargs,$hashArgOptLists): new SplitPlug($pluginlist,$inputargs);
    113106
    114107    return bless $self, $class;
  • trunk/gsdl/perllib/plugins/ImagePlug.pm

    r9960 r10218  
    4646    'type' => "int",
    4747    'deft' => "100",
     48    'range' => "1,",
    4849    'reqd' => "no" },
    4950      { 'name' => "thumbnailtype",
     
    5657    'type' => "int",
    5758    'deft' => "0",
     59    'range' => "1,",
    5860    'reqd' => "no" },
    5961      { 'name' => "screenviewtype",
     
    7173    'type' => "int",
    7274    'deft' => "100",
     75    'range' => "1,",
    7376    'reqd' => "no" } ];
    7477
     
    8285
    8386sub new {
    84     my ($class) = @_;
    85     my $plugin_name = shift (@_);
    86     my $self = new BasPlug ("ImagePlug", @_);
    87     $self->{'plugin_type'} = "ImagePlug";
    88     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    89     my $option_list = $self->{'option_list'};
    90     push( @{$option_list}, $options );
    91 
    92     if (!parsargv::parse(\@_,
    93              q^noscaleup^, \$self->{'noscaleup'},
    94              q^converttotype/.*/^, \$self->{'converttotype'},
    95              q^minimumsize/[0-9]*/100^, \$self->{'minimumsize'},
    96 
    97              q^thumbnailsize/[0-9]*/100^, \$self->{'thumbnailsize'},
    98              q^thumbnailtype/.*/gif^, \$self->{'thumbnailtype'},
    99              q^screenviewsize/[0-9]*/0^, \$self->{'screenviewsize'},
    100              q^screenviewtype/.*/jpg^, \$self->{'screenviewtype'},
    101              "allow_extra_options")) {
    102    
    103     print STDERR "\nImagePlug uses an incorrect option.\n";
    104     print STDERR "Check your collect.cfg configuration file.\n";
    105     $self->print_txt_usage("");  # Use default resource bundle
    106     die "\n";
    107     }
     87    my ($class) = shift (@_);
     88    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
     89    push(@$pluginlist, $class);
     90
     91    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     92    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     93
     94    my $self = (defined $hashArgOptLists)? new BasPlug($pluginlist,$inputargs,$hashArgOptLists): new BasPlug($pluginlist,$inputargs);
    10895
    10996    # Check that ImageMagick is installed and available on the path (except for Windows 95/98)
  • trunk/gsdl/perllib/plugins/IndexPlug.pm

    r9853 r10218  
    7070
    7171sub new {
    72     my ($class) = @_;
    73     my $self = new BasPlug ("IndexPlug", @_);
    74     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    75     my $option_list = $self->{'option_list'};
    76     push( @{$option_list}, $options );
     72    my ($class) = shift (@_);
     73    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
     74    push(@$pluginlist, $class);
     75
     76    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     77    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     78
     79    my $self = (defined $hashArgOptLists)? new BasPlug($pluginlist,$inputargs,$hashArgOptLists): new BasPlug($pluginlist,$inputargs);
    7780
    7881    return bless $self, $class;
  • trunk/gsdl/perllib/plugins/LaTeXPlug.pm

    r8121 r10218  
    2828package LaTeXPlug;
    2929
    30 use strict;
    31 no strict 'refs'; # so we can print to a handle named by a variable
     30# System complains about $arguments if the strict is set
     31#use strict;
     32#no strict 'refs'; # so we can print to a handle named by a variable
    3233
    3334# greenstone packages
     
    3738use util;
    3839
     40my $options={ 'name' => 'LaTeXPlug',
     41          'desc' => '{LaTeXPlug.desc}',
     42          'abstract' => 'no',
     43          'inherits' => 'yes' };
    3944sub BEGIN {
    4045    @LaTeXPlug::ISA = ('BasPlug');
     
    4651
    4752sub new {
    48     my $class = shift (@_);
    49     my $self = new BasPlug ($class, @_);
    50     $self->{'plugin_type'} = 'LaTeXPlug';
    51     my $option_list = $self->{'option_list'};
    52     my $options={ 'name' => 'LaTeXPlug',
    53           'desc' => '{LaTeXPlug.desc}',
    54           'abstract' => 'no',
    55           'inherits' => 'yes',
    56           'args' => [
    57                  ] # no arguments for now...
    58                  };
    59 
    60     push( @{$option_list}, $options );
    61 
    62     if (!parsargv::parse(\@_,
    63              "allow_extra_options")) {
    64 
    65     print STDERR "\nIncorrect options passed to LaTeXPlug, check your collect.cfg configuration file\n";
    66     $self->print_txt_usage(""); # don't specify which language bundle
    67     die "\n";
    68     }
     53    my ($class) = shift (@_);
     54    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
     55    push(@$pluginlist, $class);
     56
     57    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     58    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     59
     60    my $self = (defined $hashArgOptLists)? new BasPlug($pluginlist,$inputargs,$hashArgOptLists): new BasPlug($pluginlist,$inputargs);
    6961
    7062    $self->{'aux_files'} = {};
  • trunk/gsdl/perllib/plugins/MACROPlug.pm

    r9853 r10218  
    8585
    8686sub new {
    87     my ($class) = @_;
    88     my $self = new BasPlug ($class, @_);
    89 
    90     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    91     my $option_list = $self->{'option_list'};
    92     push( @{$option_list}, $options );
     87    my ($class) = shift (@_);
     88    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
     89    push(@$pluginlist, $class);
     90
     91    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     92    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     93
     94    my $self = (defined $hashArgOptLists)? new BasPlug($pluginlist,$inputargs,$hashArgOptLists): new BasPlug($pluginlist,$inputargs);
    9395
    9496    # $self->{'lang_abbr'} = load_language_table();
  • trunk/gsdl/perllib/plugins/MARCPlug.pm

    r9494 r10218  
    6969
    7070sub new {
    71     my $class = shift (@_);
    72     my $self = new SplitPlug ($class, @_);
    73     $self->{'plugin_type'} = "MARCPlug";
    74     my $metadata_mapping;
    75 
    76     if (!parsargv::parse(\@_,
    77              q^metadata_mapping/.*/marctodc.txt^, \$metadata_mapping,
    78              "allow_extra_options")) {
    79 
    80     print STDERR "\nIncorrect options passed to MARCPlug, check your collect.cfg configuration file\n";
    81     $self->print_txt_usage("");  # Use default resource bundle
    82     die "\n";
    83     }
    84 
    85 
    86     $self->{'mm_file'} = $metadata_mapping; # relative to etc dir
    87 
    88     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    89     my $option_list = $self->{'option_list'};
    90     push( @{$option_list}, $options );
     71    my ($class) = shift (@_);
     72    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
     73    push(@$pluginlist, $class);
     74
     75    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     76    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     77
     78    my $self = (defined $hashArgOptLists)? new SplitPlug($pluginlist,$inputargs,$hashArgOptLists): new SplitPlug($pluginlist,$inputargs);
    9179
    9280    return bless $self, $class;
     
    10189    # read in the metadata mapping file
    10290    my $mm_file =
    103     &util::filename_cat( $ENV{'GSDLHOME'}, "etc", $self->{'mm_file'} );
     91    &util::filename_cat( $ENV{'GSDLHOME'}, "etc", $self->{'metadata_mapping'} );
    10492
    10593    if (!-e $mm_file)
     
    10795
    10896    my $msg = "MARCPlug ERROR: Can't locate mapping file \"" .
    109         $self->{'mm_file'} . "\".\n    This file should be at $mm_file\n" .
     97        $self->{'metadata_mapping'} . "\".\n    This file should be at $mm_file\n" .
    11098        "    No marc files can be processed.\n";
    11199
    112100    print $outhandle $msg;
    113101    print $failhandle $msg;
    114     $self->{'mm_file'} = undef;
     102    $self->{'metadata_mapping'} = undef;
    115103    # We pick up the error in process() if there is no $mm_file
    116104    # If we exit here, then pluginfo.pl will exit too!
     
    222210    my $filename = &util::filename_cat($base_dir, $file);
    223211
    224     if (! defined($self->{'mm_file'}))
     212    if (! defined($self->{'metadata_mapping'}))
    225213    {
    226214    print $outhandle "MARCPlug: no metadata file! Can't process $file\n";
  • trunk/gsdl/perllib/plugins/METSPlug.pm

    r9468 r10218  
    4040
    4141sub BEGIN {
    42     @ISA = ('XMLPlug');
     42    @METSPlug::ISA = ('XMLPlug');
    4343}
    4444
     
    5656
    5757sub new {
    58     my $class = shift (@_);
    59     my $self = new XMLPlug ($class, @_);
    60 
    61     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    62     my $option_list = $self->{'option_list'};
    63     push( @{$option_list}, $options );
     58    my ($class) = shift (@_);
     59    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
     60    push(@$pluginlist, $class);
     61
     62    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     63    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     64
     65    my $self = (defined $hashArgOptLists)? new XMLPlug($pluginlist,$inputargs,$hashArgOptLists): new XMLPlug($pluginlist,$inputargs);
    6466
    6567    $self->{'section'} = "";
  • trunk/gsdl/perllib/plugins/MP3Plug.pm

    r9962 r10218  
    6666
    6767sub new {
    68     my ($class) = @_;
    69     my $self = new UnknownPlug ($class, @_);
    70     $self->{'plugin_type'} = "MP3Plug";
    71     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    72     my $option_list = $self->{'option_list'};
    73     push( @{$option_list}, $options );
    74 
    75     if (!parsargv::parse(\@_,
    76              q^assoc_images^, \$self->{'assoc_images'},
    77              q^applet_metadata^, \$self->{'applet_metadata'},
    78              q^metadata_fields/.*/Title,Artist,Genre^, \$self->{'metadata_fields'},
    79              "allow_extra_options")) {
    80     print STDERR "\nIncorrect options passed to MP3Plug, check your collect.cfg configuration file\n";
    81     $self->print_txt_usage("");  # Use default resource bundle
    82         die "\n";
    83     }
     68    my ($class) = shift (@_);
     69    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
     70    push(@$pluginlist, $class);
     71
     72    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     73    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     74
     75    my $self = (defined $hashArgOptLists)? new UnknownPlug($pluginlist,$inputargs,$hashArgOptLists): new UnknownPlug($pluginlist,$inputargs);
    8476
    8577    return bless $self, $class;
  • trunk/gsdl/perllib/plugins/NULPlug.pm

    r9853 r10218  
    5757
    5858sub new {
    59     my ($class) = @_;
    60     my $self = new BasPlug ($class, @_);
    61     $self->{'plugin_type'} = "NULPlug";
    62     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    63     my $option_list = $self->{'option_list'};
    64     push( @{$option_list}, $options );
     59    my ($class) = shift (@_);
     60    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
     61    push(@$pluginlist, $class);
    6562
    66     if (!parsargv::parse(\@_,
    67              "allow_extra_options")) {
    68     print STDERR "\nIncorrect options passed to NULPlug, check your collect.cfg configuration file\n";
    69     $self->print_txt_usage("");  # Use default resource bundle
    70         die "\n";
    71     }
     63    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     64    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
    7265
    73 
     66    my $self = (defined $hashArgOptLists)? new BasPlug($pluginlist,$inputargs,$hashArgOptLists): new BasPlug($pluginlist,$inputargs);
     67   
    7468    return bless $self, $class;
    7569}
  • trunk/gsdl/perllib/plugins/OAIPlug.pm

    r10111 r10218  
    5454
    5555sub new {
    56     my $class = shift (@_);
    57     my $self = new XMLPlug ($class, @_);
    58     $self->{'plugin_type'} = "OAIPlug";
    59     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    60     my $option_list = $self->{'option_list'};
    61     push( @{$option_list}, $options );
    62 
    63     if (!parsargv::parse(\@_,
    64              "allow_extra_options")) {
    65 
    66     print STDERR "\nIncorrect options passed to OAIPlug, check your collect.cfg configuration file\n";
    67     $self->print_txt_usage("");  # Use default resource bundle
    68     die "\n";
    69     }
     56    my ($class) = shift (@_);
     57    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
     58    push(@$pluginlist, $class);
     59
     60    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     61    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     62
     63    my $self = (defined $hashArgOptLists)? new XMLPlug($pluginlist,$inputargs,$hashArgOptLists): new XMLPlug($pluginlist,$inputargs);
    7064
    7165    return bless $self, $class;
  • trunk/gsdl/perllib/plugins/OggVorbisPlug.pm

    r9853 r10218  
    3535
    3636sub BEGIN {
    37     @ISA = ('UnknownPlug');
     37    @OggVorbisPlug::ISA = ('UnknownPlug');
    3838}
    3939
     
    6565sub new
    6666{
    67     my $class = shift(@_);
    68 
    69     my $self = new UnknownPlug($class, @_);
    70     $self->{'plugin_type'} = "OggVorbisPlug";
    71 
    72     if (!parsargv::parse(\@_,
    73              q^add_technical_metadata^, \$self->{'add_technical_metadata'},
    74              "allow_extra_options")) {
    75     die "\nIncorrect options passed to OggVorbisPlug, check your collect.cfg configuration file\n";
    76     }
    77 
    78     # To allow for proper inheritance of arguments
    79     my $option_list = $self->{'option_list'};
    80     push(@{$option_list}, $options);
    81 
     67    my ($class) = shift(@_);
     68    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
     69    push(@$pluginlist, $class);
     70   
     71    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     72    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     73   
     74    my $self = (defined $hashArgOptLists)? new UnknownPlug($pluginlist,$inputargs,$hashArgOptLists): new UnknownPlug($pluginlist,$inputargs);
     75   
    8276    return bless $self, $class;
    8377}
  • trunk/gsdl/perllib/plugins/PDFPlug.pm

    r9465 r10218  
    7070
    7171sub new {
    72     my $class = shift (@_);
    73 
    74     my ($noimages, $complex, $zoom, $use_sections, $nohidden);
    75 
    76     my @args=@_;
    77 
    78     if (!parsargv::parse(\@_,
    79              q^noimages^, \$noimages,
    80              q^complex^, \$complex,
    81              q^zoom/\d+/2^, \$zoom,
    82              q^nohidden^, \$nohidden,
    83              q^use_sections^, \$use_sections,
    84              "allow_extra_options")) {
    85 
    86     my $self = new ConvertToPlug($class, @_);
    87     my $outhandle=$self->{'outhandle'};
    88     print $outhandle "\nIncorrect options passed to PDFPlug, check your collect.cfg configuration file\n";
    89     $self->print_txt_usage("");  # Use default resource bundle
    90     exit 1;
    91     }
    92 
    93 
    94     if ($use_sections) {
    95     push (@args, "-description_tags");
    96     }
    97 
    98     # following title_sub removes "Page 1" added by pdftohtml, and a leading
    99     # "1", which is often the page number at the top of the page. Bad Luck
    100     # if your document title actually starts with "1 " - is there a better way?
    101 
    102     my $self = new ConvertToPlug ($class, @args, "-title_sub", '^(Page\s+\d+)?(\s*1\s+)?');
    103     $self->{'plugin_type'} = "PDFPlug";
    104     if ($use_sections) {
    105     $self->{'use_sections'}=1;
    106     }
    107 
    108     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    109     my $option_list = $self->{'option_list'};
    110     push( @{$option_list}, $options );
     72    my ($class) = shift (@_);
     73    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
     74    push(@$pluginlist, $class);
     75
     76    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     77    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     78
     79    push(@$inputargs,"-title_sub");
     80    push(@$inputargs,'^(Page\s+\d+)?(\s*1\s+)?');
     81
     82    my $self = (defined $hashArgOptLists)? new ConvertToPlug($pluginlist,$inputargs,$hashArgOptLists): new ConvertToPlug($pluginlist,$inputargs);
     83
     84
     85    if ($self->{"use_sections"}) {
     86    $self->{"description_tags"} = 1;
     87    }
    11188
    11289    # these are passed through to gsConvert.pl by ConvertToPlug.pm
     90    my $zoom = $self->{"zoom"};
    11391    $self->{'convert_options'} = "-pdf_zoom $zoom";
    114     $self->{'convert_options'} .= " -pdf_complex" if $complex;
    115     $self->{'convert_options'} .= " -pdf_nohidden" if $nohidden;
    116     $self->{'convert_options'} .= " -pdf_ignore_images" if $noimages;
     92    $self->{'convert_options'} .= " -pdf_complex" if $self->{"complex"};
     93    $self->{'convert_options'} .= " -pdf_nohidden" if $self->{"nohidden"};
     94    $self->{'convert_options'} .= " -pdf_ignore_images" if $self->{"noimages"};
    11795
    11896    # pdftohtml will always produce html files encoded as utf-8
  • trunk/gsdl/perllib/plugins/PPTPlug.pm

    r9465 r10218  
    4949
    5050sub new {
    51     my $class = shift (@_);
     51    my ($class) = shift (@_);
     52    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
     53    push(@$pluginlist, $class);
    5254
    53     my $self = new ConvertToPlug ($class, @_);
    54     $self->{'plugin_type'} = "PPTPlug";
     55    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     56    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     57
     58    my $self = (defined $hashArgOptLists)? new ConvertToPlug($pluginlist,$inputargs,$hashArgOptLists): new ConvertToPlug($pluginlist,$inputargs);
     59
    5560    # ppthtml outputs utf-8 already.
    5661    if ($self->{'input_encoding'} eq "auto") {
    5762    $self->{'input_encoding'} = "utf8";
    5863    }
    59 
    60     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    61     my $option_list = $self->{'option_list'};
    62     push( @{$option_list}, $options );
    6364
    6465    return bless $self, $class;
  • trunk/gsdl/perllib/plugins/PSPlug.pm

    r9467 r10218  
    6262
    6363sub new {
    64     my $class = shift (@_);
     64    my ($class) = shift (@_);
     65    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
     66    push(@$pluginlist, $class);
    6567
    66     # title_sub removes leading "Page 1" or "1 " from auto-extracted title.
     68    push(@$inputargs,"-convert_to");
     69    push(@$inputargs,"text");
     70    push(@$inputargs,"-title_sub");
     71    push(@$inputargs,'^(Page\s+\d+)?(\s*1\s+)?');
    6772
    68     my $self = new ConvertToPlug ($class, "-convert_to", "text", @_ , "-title_sub", '^(Page\s+\d+)?(\s*1\s+)?');
    69     $self->{'plugin_type'} = "PSPlug";
    70     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    71     my $option_list = $self->{'option_list'};
    72     push( @{$option_list}, $options );
    73    
    74     if (!parsargv::parse(\@_,
    75              q^extract_date^, \$self->{'extract_date'},
    76              q^extract_pages^, \$self->{'extract_pages'},
    77              q^extract_title^, \$self->{'extract_title'},
    78              "allow_extra_options")) {
    79     print STDERR "\nIncorrect options passed to HTMLPlug, check your collect.cfg configuration file\n";
    80     $self->print_txt_usage("");  # Use default resource bundle
    81     die "\n";
    82     }
     73    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     74    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     75
     76    my $self = (defined $hashArgOptLists)? new ConvertToPlug($pluginlist,$inputargs,$hashArgOptLists): new ConvertToPlug($pluginlist,$inputargs);
    8377
    8478    return bless $self, $class;
  • trunk/gsdl/perllib/plugins/PagedImgPlug.pm

    r10168 r10218  
    137137
    138138sub BEGIN {
    139     @ISA = ('XMLPlug');
     139    @PagedImgPlug::ISA = ('XMLPlug');
    140140}
    141141
     
    220220
    221221sub new {
    222     my ($class) = @_;
    223     my $plugin_name = shift (@_);
    224     $self = new XMLPlug ("PagedImgPlug", @_);
    225 
    226     my $option_list = $self->{'option_list'};
    227     push( @{$option_list}, $options );
    228 
    229     if (!parsargv::parse(\@_,
    230              q^noscaleup^, \$self->{'noscaleup'},
    231              q^converttotype/.*/^, \$self->{'converttotype'},
    232              q^minimumsize/[0-9]*/100^, \$self->{'minimumsize'},
    233 
    234              q^thumbnailsize/[0-9]*/100^, \$self->{'thumbnailsize'},
    235              q^thumbnailtype/.*/gif^, \$self->{'thumbnailtype'},
    236              q^screenviewsize/[0-9]*/0^, \$self->{'screenviewsize'},
    237              q^screenviewtype/.*/jpg^, \$self->{'screenviewtype'},
    238              q^thumbnail^, \$self->{'thumbnail'},
    239              q^screenview^, \$self->{'screenview'},
    240              q^headerpage^, \$self->{'headerpage'},
    241              'documenttype/^(paged|hierarchy)$/paged', \$self->{'doctype'},
    242              "allow_extra_options")) {
    243    
    244     print STDERR "\nPagedImgPlug uses an incorrect option.\n";
    245     print STDERR "Check your collect.cfg configuration file.\n";
    246     $self->print_txt_usage("");  # Use default resource bundle
    247     die "\n";
    248     }
     222    my ($class) = shift (@_);
     223    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
     224    push(@$pluginlist, $class);
     225
     226    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     227    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     228
     229    my $self = (defined $hashArgOptLists)? new XMLPlug($pluginlist,$inputargs,$hashArgOptLists): new XMLPlug($pluginlist,$inputargs);
    249230
    250231    return bless $self, $class;
     
    768749    $self->{'num_pages'} = 0;
    769750    my $topsection = $doc_obj->get_top_section();
    770     if ($self->{'doctype'} eq 'paged') {
     751    if ($self->{'documenttype'} eq 'paged') {
    771752    # set the gsdlthistype metadata to Paged - this ensures this document will
    772753    # be treated as a Paged doc, even if Titles are not numeric
     
    806787    my $topsection = $doc_obj->get_top_section();
    807788
    808     if ($self->{'doctype'} eq 'paged') {
     789    if ($self->{'documenttype'} eq 'paged') {
    809790    # set the gsdlthistype metadata to Paged - this ensures this document will
    810791    # be treated as a Paged doc, even if Titles are not numeric
  • trunk/gsdl/perllib/plugins/ProCitePlug.pm

    r9494 r10218  
    7474sub new
    7575{
    76     my $class = shift(@_);
    77 
    78     my $self = new SplitPlug($class, @_);
    79     if (!parsargv::parse(\@_,
    80              "allow_extra_options")) {
    81     die "\nIncorrect options passed to ProCitePlug, check your collect.cfg configuration file\n";
    82     }
    83 
    84     # To allow for proper inheritance of arguments
    85     my $option_list = $self->{'option_list'};
    86     push(@{$option_list}, $options);
    87     $self->{'plugin_type'} = "ProCitePlug";
     76    my ($class) = shift (@_);
     77    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
     78    push(@$pluginlist, $class);
     79
     80    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     81    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     82
     83    my $self = (defined $hashArgOptLists)? new SplitPlug($pluginlist,$inputargs,$hashArgOptLists): new SplitPlug($pluginlist,$inputargs);
    8884
    8985    return bless $self, $class;
  • trunk/gsdl/perllib/plugins/RTFPlug.pm

    r9465 r10218  
    4949
    5050sub new {
    51     my $class = shift (@_);
    52     my $self = new ConvertToPlug ($class, @_);
    53     $self->{'plugin_type'}="RTFPlug";
    54     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    55     my $option_list = $self->{'option_list'};
    56     push( @{$option_list}, $options );
     51    my ($class) = shift (@_);
     52    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
     53    push(@$pluginlist, $class);
     54
     55    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     56    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     57
     58    my $self = (defined $hashArgOptLists)? new ConvertToPlug($pluginlist,$inputargs,$hashArgOptLists): new ConvertToPlug($pluginlist,$inputargs);
    5759
    5860    return bless $self, $class;
  • trunk/gsdl/perllib/plugins/RecPlug.pm

    r10156 r10218  
    131131
    132132my ($self);
     133
    133134sub new {
    134     my $class = shift (@_);
    135    
    136     # $self is global for use within subroutines called by XML::Parser
    137     $self = new BasPlug ($class, @_);
    138    
    139     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    140     my $option_list = $self->{'option_list'};
    141     push( @{$option_list}, $options );
    142 
    143     if (!parsargv::parse(\@_,
    144              q^use_metadata_files^, \$self->{'use_metadata_files'},
    145              q^recheck_directories^, \$self->{'recheck_directories'},
    146              "allow_extra_options")) {
    147     print STDERR "\nRecPlug uses an incorrect option.\n";
    148     print STDERR "Check your collect.cfg configuration file.\n\n";
    149     $self->print_txt_usage("");  # Use default resource bundle
    150     die "\n";
    151     }
    152    
     135    my ($class) = shift (@_);
     136    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
     137    push(@$pluginlist, $class);
     138
     139    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     140    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     141
     142    $self = (defined $hashArgOptLists)? new BasPlug($pluginlist,$inputargs,$hashArgOptLists): new BasPlug($pluginlist,$inputargs);
    153143    if ($self->{'use_metadata_files'}) {
    154144    # create XML::Parser object for parsing metadata.xml files
     
    157147                            'Doctype' => \&Doctype
    158148                            });
     149
    159150    $self->{'parser'} = $parser;
    160151    $self->{'in_filename'} = 0;
    161152    }
    162 
     153   
    163154    $self->{'subdir_extrametakeys'} = {};
    164155
     
    425416    # Next add metadata read in XML files (if it is supplied)
    426417    if ($additionalmetadata == 1) {
     418       
    427419        my ($filespec, $mdref);
    428420        foreach $filespec (@extrametakeys) {
     
    498490sub StartTag {
    499491    my ($expat, $element) = @_;
    500    
     492
    501493    if ($element eq "FileSet") {
    502494    $self->{'saved_targets'} = [];
  • trunk/gsdl/perllib/plugins/ReferPlug.pm

    r8121 r10218  
    102102
    103103sub new {
    104     my $class = shift (@_);
    105     my $self = new SplitPlug ($class, @_);
    106     $self->{'plugin_type'} = "ReferPlug";
    107     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    108     my $option_list = $self->{'option_list'};
    109     push( @{$option_list}, $options );
     104    my ($class) = shift (@_);
     105    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
     106    push(@$pluginlist, $class);
     107
     108    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     109    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     110
     111    my $self = (defined $hashArgOptLists)? new SplitPlug($pluginlist,$inputargs,$hashArgOptLists): new SplitPlug($pluginlist,$inputargs);
    110112
    111113    return bless $self, $class;
  • trunk/gsdl/perllib/plugins/RogPlug.pm

    r9853 r10218  
    5151
    5252sub new {
    53     my ($class) = @_;
    54     $self = new BasPlug ();
    55     $self->{'plugin_type'} = "RogPlug";
    56     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    57     my $option_list = $self->{'option_list'};
    58     push( @{$option_list}, $options );
     53    my ($class) = shift (@_);
     54    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
     55    push(@$pluginlist, $class);
     56
     57    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     58    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     59
     60    my $self = (defined $hashArgOptLists)? new BasPlug($pluginlist,$inputargs,$hashArgOptLists): new BasPlug($pluginlist,$inputargs);
    5961
    6062    return bless $self, $class;
  • trunk/gsdl/perllib/plugins/SRCPlug.pm

    r8121 r10218  
    7171
    7272sub new {
    73     my ($class) = @_;
    74     my $self = new BasPlug ($class, @_);
    75     $self->{'plugin_type'} = "SRCPlug";
    76     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    77     my $option_list = $self->{'option_list'};
    78     push( @{$option_list}, $options );
    79 
    80     if (!parsargv::parse(\@_,
    81              q^remove_prefix/(\S+)/^, \$self->{'remove_prefix'},
    82              "allow_extra_options"
    83              )
    84     ) {
    85         print STDERR "\nIncorrect options passed to SRCPlug, ";
    86         print STDERR "check your collect.cfg configuration file\n";
    87     $self->print_txt_usage("");  # Use default resource bundle
    88         die "\n";
    89     }
     73    my ($class) = shift (@_);
     74    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
     75    push(@$pluginlist, $class);
     76
     77    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     78    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     79
     80    my $self = (defined $hashArgOptLists)? new BasPlug($pluginlist,$inputargs,$hashArgOptLists): new BasPlug($pluginlist,$inputargs);
     81
    9082    return bless $self, $class;
    9183}
  • trunk/gsdl/perllib/plugins/SplitPlug.pm

    r9853 r10218  
    5454    'desc' => "{SplitPlug.split_exp}",
    5555    'type' => "regexp",
    56     'deft' => &get_default_split_exp(),
     56    #'deft' => &get_default_split_exp(),
     57    'deft' => "",
    5758    'reqd' => "no" } ];
    5859
     
    6566
    6667sub new {
    67     my ($class) = @_;
    68     $self = new BasPlug($class, @_);
    69 
    70     $self->{'plugin_type'} = "SplitPlug";
    71    
    72     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    73     my $option_list = $self->{'option_list'};
    74     push( @{$option_list}, $options );
    75    
    76     if (!parsargv::parse(\@_,
    77              q^split_exp/.*/^, \$self->{'split_exp'},
    78              "allow_extra_options")) {
    79     print STDERR "\nIncorrect options passed to $class.";
    80     print STDERR "\nCheck your collect.cfg configuration file\n";
    81     die "\n";
    82     }
     68    my ($class) = shift (@_);
     69    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
     70    push(@$pluginlist, $class);
     71
     72    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     73    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     74
     75    my $self = (defined $hashArgOptLists)? new BasPlug($pluginlist,$inputargs,$hashArgOptLists): new BasPlug($pluginlist,$inputargs);
    8376
    8477    $self->{'textcat_store'} = {};
  • trunk/gsdl/perllib/plugins/TEXTPlug.pm

    r8121 r10218  
    5959
    6060sub new {
    61     my ($class) = @_;
    62     my $self = new BasPlug ($class, @_);
    63     $self->{'plugin_type'} = "TEXTPlug";
    64     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    65     my $option_list = $self->{'option_list'};
    66     push( @{$option_list}, $options );
     61    my ($class) = shift (@_);
     62    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
     63    push(@$pluginlist, $class);
    6764
    68     if (!parsargv::parse(\@_,
    69              q^title_sub/.*/^, \$self->{'title_sub'},
    70              "allow_extra_options")) {
    71     print STDERR "\nIncorrect options passed to TEXTPlug, check your collect.cfg configuration file\n";
    72     $self->print_txt_usage("");  # Use default resource bundle
    73         die "\n";
    74     }
     65    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     66    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
    7567
     68    my $self = (defined $hashArgOptLists)? new BasPlug($pluginlist,$inputargs,$hashArgOptLists): new BasPlug($pluginlist,$inputargs);
    7669
    7770    return bless $self, $class;
  • trunk/gsdl/perllib/plugins/UnknownPlug.pm

    r9853 r10218  
    5858use BasPlug;
    5959use parsargv;
     60#$%^
     61use parse2;
     62
    6063
    6164
     
    9497
    9598sub new {
    96     my ($class) = @_;
    97     my $self = new BasPlug ($class, @_);
    98     $self->{'plugin_type'} = "UnknownPlug";
    99     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    100     my $option_list = $self->{'option_list'};
    101     push( @{$option_list}, $options );
    102 
    103     if (!parsargv::parse(\@_,
    104              q^assoc_field/.*/^, \$self->{'assoc_field'},
    105              q^file_format/.*/^, \$self->{'file_format'},
    106              q^mime_type/.*/^, \$self->{'mime_type'},
    107              q^process_extension/.*/^, \$self->{'process_extension'},
    108              "allow_extra_options")) {
    109     print STDERR "\nIncorrect options passed to UnknownPlug, check your collect.cfg configuration file\n";
    110     $self->print_txt_usage("");  # Use default resource bundle
    111         die "\n";
    112     }
     99    my ($class) = shift (@_);
     100    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
     101    push(@$pluginlist, $class);
     102
     103    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     104    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     105
     106    my $self = (defined $hashArgOptLists)? new BasPlug($pluginlist,$inputargs,$hashArgOptLists): new BasPlug($pluginlist,$inputargs);
    113107
    114108    # "-process_extension" is a simpler alternative to -process_exp for non-regexp people
  • trunk/gsdl/perllib/plugins/W3ImgPlug.pm

    r9853 r10218  
    225225
    226226sub new {
    227     my $class = shift (@_);
    228     my $self = new HTMLPlug ($class, @_);
    229     $self->{'plugin_type'} = "W3ImgPlug";
    230     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    231     my $option_list = $self->{'option_list'};
    232     push( @{$option_list}, $options );
    233 
    234     if (!parsargv::parse(\@_,
    235              q^aggressiveness/\d/3^, \$self->{'aggressiveness'},
    236              q^index_pages^, \$self->{'index_pages'},
    237              q^no_cache_images^, \$self->{'no_cache_images'},
    238              q^min_size/\d*/2000^, \$self->{'min_img_filesize'},
    239              q^min_width/\d*/50^, \$self->{'min_img_width'},
    240              q^min_height/\d*/50^, \$self->{'min_img_height'},
    241              q^thumb_size/\d*/100^, \$self->{'thumbnail_size'},
    242              q^convert_params/.*/ ^, \$self->{'img_convert_param'},
    243              q^max_near_text/\d*/400^, \$self->{'maxtext'},
    244              q^min_near_text/\d*/10^, \$self->{'mintext'},
    245              q^smallpage_threshold/\d*/2048^, \$self->{'smallpage_threshold'},
    246              q^textrefs_threshold/\d*/2^, \$self->{'textref_threshold'},
    247              q^caption_length/\d*/80^, \$self->{'caption_len'},
    248              q^neartext_length/\d*/300^, \$self->{'neartext_len'},
    249              q^document_text^, \$self->{'document_text'},
    250              "allow_extra_options"
    251              )) {
    252 
    253     print STDERR "\nIncorrect options passed to W3ImgPlug, check your collect.cfg configuration file\n";
    254     $self->print_txt_usage("");  # Use default resource bundle
    255     die "\n";
    256     }
    257    
     227    my ($class) = shift (@_);
     228    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
     229    push(@$pluginlist, $class);
     230
     231    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     232    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     233
     234    my $self = (defined $hashArgOptLists)? new HTMLPlug($pluginlist,$inputargs,$hashArgOptLists): new HTMLPlug($pluginlist,$inputargs);
     235
    258236    # init class variables
    259237    $self->{'textref'} = undef; # init by read_file fn
     
    399377    }
    400378
    401     if ( $self->{'neartext_len'} > $self->{'maxtext'} ) {
    402     $self->{'maxtext'} = $self->{'neartext_len'} * 1.33;
    403     print {$self->{'outhandle'}} "W3ImgPlug: Warning: adjusted max_text to $self->{'maxtext'}\n";
     379    if ( $self->{'neartext_length'} > $self->{'max_near_text'} ) {
     380    $self->{'max_near_text'} = $self->{'neartext_length'} * 1.33;
     381    print {$self->{'outhandle'}} "W3ImgPlug: Warning: adjusted max_text to $self->{'max_near_text'}\n";
    404382    }
    405     if ( $self->{'caption_len'} > $self->{'maxtext'} ) {
    406     $self->{'maxtext'} = $self->{'caption_len'} * 1.33;
    407     print {$self->{'outhandle'}} "W3ImgPlug: Warning: adjusted max_text to $self->{'maxtext'}\n";
     383    if ( $self->{'caption_length'} > $self->{'max_near_text'} ) {
     384    $self->{'max_near_text'} = $self->{'caption_length'} * 1.33;
     385    print {$self->{'outhandle'}} "W3ImgPlug: Warning: adjusted max_text to $self->{'max_near_text'}\n";
    408386    }
    409387
     
    492470    } else { ($crcid) = `cksum $filepath` =~ /^(\d+)/; }
    493471    $thumbfp = "$tndir/tn_$crcid.jpg";
    494     `convert -flatten -filter Hanning $self->{'img_convert_param'} -geometry "$self->{'thumbnail_size'}x$self->{'thumbnail_size'}>" $filepath $thumbfp` unless -e $thumbfp;
     472    `convert -flatten -filter Hanning $self->{'convert_params'} -geometry "$self->{'thumb_size'}x$self->{'thumb_size'}>" $filepath $thumbfp` unless -e $thumbfp;
    495473    if ( ! (-e $thumbfp) ) {
    496474    print STDERR "W3ImgPlug: 'convert' failed. Check ImageMagicK binaries are installed and working correctly\n"; return 0;
     
    532510        # textual references
    533511        if ( $aggr  == 5 || $aggr >= 7) {
    534         if ( length($relreltext) > ($self->{'caption_len'} * 2) )  {
     512        if ( length($relreltext) > ($self->{'caption_length'} * 2) )  {
    535513            $reltext .= $self->get_textrefs($relreltext, $textref, $prevpos, $imgs->{$id}{'pos'}, $nextpos); }
    536514        else {
     
    610588
    611589    # extract larger context
    612     $maxtext = $self->{'maxtext'};
     590    $maxtext = $self->{'max_near_text'};
    613591    $startpos = $pos - ($maxtext * 4);
    614592    $context_size = $maxtext*10;
     
    663641    }
    664642    foreach $sentence ( keys %sentences ) {
    665     if ($sentences{$sentence} < $self->{'textref_threshold'}) {
     643    if ($sentences{$sentence} < $self->{'textrefs_threshold'}) {
    666644        delete $sentences{$sentence};
    667645    }
     
    681659    $startpos, $context, $context_size);
    682660   
    683     $mintext = $self->{'mintext'};
    684     $goodlen = $self->{'caption_len'};
     661    $mintext = $self->{'min_near_text'};
     662    $goodlen = $self->{'caption_length'};
    685663
    686664    # extract a context to extract near text from (faster)
    687     $context_size = $self->{'maxtext'}*3;
     665    $context_size = $self->{'max_near_text'}*3;
    688666    $startpos = $pos - ($context_size / 2);
    689667    if ($startpos < $prevpos ) { $startpos = $prevpos }
     
    762740    # if bound_tag too far from the image, then prob not caption
    763741    # (note: have to allow for tags, so multiply by 3
    764     if ( $etag && length($nt[0]) < ($self->{'caption_len'} * 3) ) {
     742    if ( $etag && length($nt[0]) < ($self->{'caption_length'} * 3) ) {
    765743    if ( $nt[0] =~ /<\/$etag>/si ) {
    766744        # the whole caption is above the image: <tag>text</tag><img>
    767745        ($nt[0]) =~ /<(?:$etag)[\s]?.*?>(.*?)<\/$etag>/is;
    768746        $nt[0] = $self->strip_tags($nt[0]);
    769         if ( length($nt[0]) > $self->{'mintext'} ) {
     747        if ( length($nt[0]) > $self->{'min_near_text'} ) {
    770748        $gotcap = 1;
    771749        $nt[1] = "";
     
    776754        ($nt[1]) = $nt[1] =~ /(.*?)<\/$etag>/si;
    777755        $nt[0] = $self->strip_tags($nt[0] . $nt[1]);
    778         if ( length($nt[0]) > $self->{'mintext'} ) {
     756        if ( length($nt[0]) > $self->{'min_near_text'} ) {
    779757        $gotcap = 2;
    780758        $nt[1] = "";
     
    818796    $bestlen[0] = $bestlen[1] = 0; $bestlen[2] = $bdist = 999999;
    819797    $best[0] = $best[1] = $best[2] = "";
    820     $maxtext = $self->{'maxtext'};
    821     $mintext = $self->{'mintext'};
    822     $goodlen = $self->{'neartext_len'};
     798    $maxtext = $self->{'max_near_text'};
     799    $mintext = $self->{'min_near_text'};
     800    $goodlen = $self->{'neartext_length'};
    823801
    824802    # extract a context to extract near text from (faster)
     
    945923    # either side of the tag (by word boundary)
    946924    return "" if ( ! exists $imgs->{$fp}{'rawpos'} );
    947     $startpos = $imgs->{$fp}{'rawpos'} - (($self->{'maxtext'} / 2) + 20);
     925    $startpos = $imgs->{$fp}{'rawpos'} - (($self->{'max_near_text'} / 2) + 20);
    948926    if ( $startpos < 0 ) { $startpos = 0 }
    949     $rawtext = substr $self->{'plaintext'}, $startpos, $self->{'maxtext'} + 20;
     927    $rawtext = substr $self->{'plaintext'}, $startpos, $self->{'max_near_text'} + 20;
    950928    $rawtext =~ s/\s\s/ /g;
    951929
     
    1010988    }
    1011989    $filesize = (-s $abspath);
    1012     if ( $filesize >= $self->{'min_img_filesize'}
    1013         && ( $width >= $self->{'min_img_width'} )
    1014         && ( $height >= $self->{'min_img_height'} ) ) {
     990    if ( $filesize >= $self->{'min_size'}
     991        && ( $width >= $self->{'min_width'} )
     992        && ( $height >= $self->{'min_height'} ) ) {
    1015993       
    1016994       $imgs->{$filepath}{'exists'} = 1;
  • trunk/gsdl/perllib/plugins/WordPlug.pm

    r9465 r10218  
    4848
    4949sub new {
    50     my $class = shift (@_);
    51    
    52     my $self = new ConvertToPlug ($class, @_);
    53     $self->{'plugin_type'} = "WordPlug";
    54     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    55     my $option_list = $self->{'option_list'};
    56     push( @{$option_list}, $options );
     50    my ($class) = shift (@_);
     51    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
     52    push(@$pluginlist, $class);
    5753
    58     # wvWare will always produce html files encoded as utf-8
     54    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     55    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     56
     57    my $self = (defined $hashArgOptLists)? new ConvertToPlug($pluginlist,$inputargs,$hashArgOptLists): new ConvertToPlug($pluginlist,$inputargs);
     58
     59     # wvWare will always produce html files encoded as utf-8
    5960    if ($self->{'input_encoding'} eq "auto") {
    6061    $self->{'input_encoding'} = "utf8";
  • trunk/gsdl/perllib/plugins/XMLPlug.pm

    r10170 r10218  
    2828use BasPlug;
    2929use doc;
     30#$%^
     31use parse2;
    3032
    3133sub BEGIN {
     
    5759our ($self);
    5860sub new {
    59     my $class = shift (@_);
    60 
     61    my ($class) = shift (@_);
     62    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
     63    push(@$pluginlist, $class);
     64
     65    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     66    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     67   
    6168    # $self is global for use within subroutines called by XML::Parser
    62     $self = new BasPlug ($class, @_);
    63     $self->{'plugin_type'} = "XMLPlug";
    64     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    65     my $option_list = $self->{'option_list'};
    66     push( @{$option_list}, $options );
    67    
    68     if (!parsargv::parse(\@_,
    69              q^xslt/.*/^, \$self->{'xslt'},
    70              "allow_extra_options")) {
    71 
    72     print STDERR "\nIncorrect options passed to XSLTPlug, check your collect.cfg configuration file\n";
    73     $self->print_txt_usage("");  # Use default resource bundle
    74     die "\n";
    75     }
    76 
     69    $self = (defined $hashArgOptLists)? new BasPlug($pluginlist,$inputargs,$hashArgOptLists): new BasPlug($pluginlist,$inputargs);
    7770
    7871    my $parser = new XML::Parser('Style' => 'Stream',
     
    8275                        'Doctype' => \&Doctype,
    8376                        'Default' => \&Default
    84                         });
    85 
    86    
    87                
     77                        }); 
    8878    $self->{'parser'} = $parser;
    8979
  • trunk/gsdl/perllib/plugins/ZIPPlug.pm

    r9960 r10218  
    4343# tar (for tar)
    4444
    45 # 12/05/02 Added usage datastructure - John Thompson
    4645
    4746package ZIPPlug;
     
    5150use util;
    5251use Cwd;
     52#$%^
     53use parse2;
    5354
    5455
     
    7172
    7273sub new {
    73     my ($class) = @_;
    74     my $self = new BasPlug ("ZIPPlug", @_);
    75     $self->{'plugin_type'} = "ZIPPlug";
    76 
    77     # 14-05-02 To allow for proper inheritance of arguments - John Thompson
    78     my $option_list = $self->{'option_list'};
    79     push( @{$option_list}, $options );
    80 
    81     if (!parsargv::parse(\@_,
    82              q^process_exp/.*/^, \$self->{'process_exp'},
    83              "allow_extra_options")) {
    84     print STDERR "\nIncorrect options passed to ZIPPlug, check your collect.cfg configuration file\n";
    85     $self->print_txt_usage("");  # Use default resource bundle
    86         die "\n";
    87     }
     74
     75    my ($class) = shift (@_);
     76    my ($pluginlist,$inputargs,$hashArgOptLists) = @_;
     77    push(@$pluginlist, $class);
     78
     79    if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
     80    if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
     81
     82    my $self = (defined $hashArgOptLists)? new BasPlug($pluginlist,$inputargs,$hashArgOptLists): new BasPlug($pluginlist,$inputargs);
    8883
    8984    # BasPlug is explicitly set not to set process_exp if recursive plugin
    9085    # Not sure of this reasoning.  Want it to be set in ZIPPlug, so explicitly
    9186    # pass it in as default value
     87   
     88    ## do we need this???? --kjdon
    9289    if (!$self->{'process_exp'}) {
    9390    $self->{'process_exp'} = get_default_process_exp();
  • trunk/gsdl/perllib/printusage.pm

    r8716 r10218  
    101101    }
    102102
     103    # If the option has a charactor length field, display this
     104    if (defined($option->{'char_length'})) {
     105        &gsprintf(STDERR, "      <Charactor Length>$option->{'char_length'}</Charactor Length>\n");
     106    }
     107
    103108    # If the option has a range field, display this
    104109    if (defined($option->{'range'})) {
     
    125130        }
    126131
    127         # Special case for 'input_encoding'
    128         if ($optionname =~ m/^input_encoding$/i) {
    129         my $e = $encodings::encodings;
    130         foreach my $enc (sort {$e->{$a}->{'name'} cmp $e->{$b}->{'name'}} keys (%$e)) {
    131             &gsprintf(STDERR, "        <Value>\n");
    132             &gsprintf(STDERR, "          <Name>$enc</Name>\n");
    133             &gsprintf(STDERR, "          <Desc>$e->{$enc}->{'name'}</Desc>\n");
    134             &gsprintf(STDERR, "        </Value>\n");
    135         }
    136         }
     132#       # Special case for 'input_encoding'
     133#       if ($optionname =~ m/^input_encoding$/i) {
     134#       my $e = $encodings::encodings;
     135#       foreach my $enc (sort {$e->{$a}->{'name'} cmp $e->{$b}->{'name'}} keys (%$e)) {
     136#           &gsprintf(STDERR, "        <Value>\n");
     137#           &gsprintf(STDERR, "          <Name>$enc</Name>\n");
     138#           &gsprintf(STDERR, "          <Desc>$e->{$enc}->{'name'}</Desc>\n");
     139#           &gsprintf(STDERR, "        </Value>\n");
     140#       }
     141#       }
    137142
    138143        &gsprintf(STDERR, "      </List>\n");
     
    246251    }
    247252
    248     # Special case for 'input_encoding'
    249     if ($optionname =~ m/^input_encoding$/i) {
    250         my $e = $encodings::encodings;
    251         foreach my $enc (sort {$e->{$a}->{'name'} cmp $e->{$b}->{'name'}} keys (%$e)) {
    252         &gsprintf(STDERR, " " x $optiondescoffset);
    253         &gsprintf(STDERR, "$enc:");
    254 
    255         my $encodingdesc = $e->{$enc}->{'name'};
    256         &display_text_in_column($encodingdesc, $optiondescoffset + 2,
    257                     $optiondescoffset + length("$enc:"), 80);
    258         }
    259     }
     253#   # Special case for 'input_encoding'
     254#   if ($optionname =~ m/^input_encoding$/i) {
     255#       my $e = $encodings::encodings;
     256#       foreach my $enc (sort {$e->{$a}->{'name'} cmp $e->{$b}->{'name'}} keys (%$e)) {
     257#       &gsprintf(STDERR, " " x $optiondescoffset);
     258#       &gsprintf(STDERR, "$enc:");
     259#
     260#       my $encodingdesc = $e->{$enc}->{'name'};
     261#       &display_text_in_column($encodingdesc, $optiondescoffset + 2,
     262#                   $optiondescoffset + length("$enc:"), 80);
     263#       }
     264#   }
    260265
    261266    # Add a blank line to separate options
Note: See TracChangeset for help on using the changeset viewer.