Changeset 3540 for trunk/gsdl/perllib/classify/AZSectionList.pm
- Timestamp:
- 2002-11-18T17:43:56+13:00 (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/perllib/classify/AZSectionList.pm
r2954 r3540 34 34 # to the classification 35 35 36 # 12/05/02 Added usage datastructure - John Thompson 37 36 38 package AZSectionList; 37 39 … … 43 45 } 44 46 47 my $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 58 my $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 45 64 sub print_usage { 46 65 print STDERR " 47 usage: classify AZSectionList -metadata X[options]66 usage: classify AZSectionList [options] 48 67 options: 49 68 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. 52 71 53 -buttonname X Button namefor this classification.54 defaults to metadataname.72 -buttonname X (OPTIONAL) Title field for this classification. 73 if not included title field will be Metaname. 55 74 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. 59 77 This is very similar to AZList except it sorts by section level metadata 60 78 (excluding the top level) instead of just top level metadata. … … 65 83 my $class = shift (@_); 66 84 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 ); 67 89 68 90 return bless $self, $class; … … 91 113 # if this section doesn't contain the metadata element we're 92 114 # sorting by we won't include it in this classification 115 93 116 if (defined $metavalue && $metavalue ne "") { 94 117 if ($self->{'removeprefix'}) { 95 118 $metavalue =~ s/^$self->{'removeprefix'}//; 96 119 } 97 98 120 if ($self->{'metaname'} eq 'Creator') { 99 121 &sorttools::format_string_name_english (\$metavalue);
Note:
See TracChangeset
for help on using the changeset viewer.