Ignore:
Timestamp:
2002-11-18T17:43:56+13:00 (22 years ago)
Author:
kjdon
Message:

added John T's changes into CVS - added info to enable retrieval of usage info in xml

File:
1 edited

Legend:

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

    r2954 r3540  
    3434# to the classification
    3535
     36# 12/05/02 Added usage datastructure - John Thompson
     37
    3638package AZSectionList;
    3739
     
    4345}
    4446
     47my $arguments =
     48[ {     'name' => "metadata",
     49    'desc' => "Metadata field used for classification. List will be sorted by this element.",
     50    'type' => "metadata",
     51    'reqd' => "yes" } ,
     52{   'name' => "buttonname",
     53    'desc' => "Button name for this classification. Defaults to metadata name.",
     54    'type' => "string",
     55    'reqd' => "no" }
     56];
     57
     58my $options =
     59{   'name'     => "AZSectionList",
     60    'desc'     => "Classifier plugin for sorting alphabetically. This is very similar to AZList except it sorts by section level metadata (excluding the top level) instead of just top level metadata. The only change is to the classify() subroutine which must now iterate through each section, adding each to the classification.",
     61    'inherits' => "Yes",
     62    'args'     => $arguments };
     63
    4564sub print_usage {
    4665    print STDERR "
    47   usage: classify AZSectionList -metadata X [options]
     66  usage: classify AZSectionList [options]
    4867  options:
    4968
    50   -metadata X       (required) Metadata field used for classification.
    51             List will be sorted by this element.
     69  -metadata X    (required) Metadata field used for classification,
     70                  list will be sorted by this element.
    5271
    53   -buttonname X     Button name for this classification.
    54             defaults to metadata name.
     72  -buttonname X  (OPTIONAL) Title field for this classification.
     73                  if not included title field will be Metaname.
    5574
    56   -removeprefix regex   A prefix to ignore in the Metadata values
    57             for the field when sorting.
    58 
     75  -removeprefix regex A prefix to ignore in the Metadata values
     76                      for the field when sorting.
    5977This is very similar to AZList except it sorts by section level metadata
    6078(excluding the top level) instead of just top level metadata.
     
    6583    my $class = shift (@_);
    6684    my $self = new AZList($class, @_);
     85
     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 );
    6789
    6890    return bless $self, $class;
     
    91113    # if this section doesn't contain the metadata element we're
    92114    # sorting by we won't include it in this classification
     115
    93116    if (defined $metavalue && $metavalue ne "") {
    94117    if ($self->{'removeprefix'}) {
    95118        $metavalue =~ s/^$self->{'removeprefix'}//;
    96119    }
    97 
    98120    if ($self->{'metaname'} eq 'Creator') {
    99121        &sorttools::format_string_name_english (\$metavalue);
Note: See TracChangeset for help on using the changeset viewer.