Changeset 4840
- Timestamp:
- 2003-07-01T11:55:31+12:00 (21 years ago)
- Location:
- trunk/gsdl/perllib/classify
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/perllib/classify/AZCompactList.pm
r4786 r4840 68 68 { 'name' => "removeprefix", 69 69 'desc' => "A prefix to ignore in the Metadata values for the field when sorting.", 70 'type' => "string", 71 'deft' => "", 72 'reqd' => "no" }, 73 { 'name' => "removesuffix", 74 'desc' => "A suffix to ignore in the Metadata values for the field when sorting.", 70 75 'type' => "string", 71 76 'deft' => "", … … 142 147 143 148 144 my ($metaname, $title, $removeprefix );149 my ($metaname, $title, $removeprefix, $removesuffix); 145 150 my $mingroup = 2; 146 151 my $minnesting = 20; … … 156 161 q^buttonname/.*/^, \$title, 157 162 q^removeprefix/.*/^, \$removeprefix, 163 q^removesuffix/.*/^, \$removesuffix, 158 164 q^mingroup/.*/2^, \$mingroup, 159 165 q^minnesting/.*/20^, \$minnesting, … … 187 193 $self->{'title'} = "$title"; # title for the titlebar. 188 194 if (defined($removeprefix) && $removeprefix) { 195 $removeprefix =~ s/^\^//; # don't need a leading ^ 189 196 $self->{'removeprefix'} = $removeprefix; 197 } 198 if (defined($removesuffix) && $removesuffix) { 199 $removesuffix =~ s/\$$//; # don't need a trailing $ 200 $self->{'removesuffix'} = $removesuffix; 190 201 } 191 202 $self->{'mingroup'} = $mingroup; … … 277 288 if (defined $metavalue && $metavalue =~ /\w/) 278 289 { 279 if ($self->{'removeprefix'}) { 290 if (defined($self->{'removeprefix'}) && 291 length($self->{'removeprefix'})) { 280 292 $metavalue =~ s/^$self->{'removeprefix'}//; 293 294 # check that it's not now empty 295 if (!$metavalue) {next;} 296 } 297 298 if (defined($self->{'removesuffix'}) && 299 length($self->{'removesuffix'})) { 300 $metavalue =~ s/$self->{'removesuffix'}$//; 281 301 282 302 # check that it's not now empty … … 423 443 my $formatted_node = $metavalue; 424 444 425 if ($self->{'removeprefix'}) { 445 if (defined($self->{'removeprefix'}) && 446 length($self->{'removeprefix'})) { 426 447 $formatted_node =~ s/^$self->{'removeprefix'}//; 448 # check that it's not now empty 449 if (!$formatted_node) {next;} 450 } 451 if (defined($self->{'removesuffix'}) && 452 length($self->{'removesuffix'})) { 453 $formatted_node =~ s/$self->{'removesuffix'}$//; 427 454 # check that it's not now empty 428 455 if (!$formatted_node) {next;} -
trunk/gsdl/perllib/classify/AZList.pm
r4786 r4840 50 50 'type' => "string", 51 51 'deft' => "", 52 'reqd' => "no" } ]; 52 'reqd' => "no" } , 53 { 'name' => "removesuffix", 54 'desc' => "A suffix to ignore in the Metadata values for the field when sorting.", 55 'type' => "string", 56 'deft' => "", 57 'reqd' => "no" } 58 ]; 53 59 54 60 my $options = { 'name' => "AZList", … … 81 87 push( @{$option_list}, $options ); 82 88 83 my ($metaname, $title, $removeprefix );89 my ($metaname, $title, $removeprefix, $removesuffix); 84 90 85 91 if (!parsargv::parse(\@_, … … 87 93 q^buttonname/.*/^, \$title, 88 94 q^removeprefix/.*/^, \$removeprefix, 95 q^removesuffix/.*/^, \$removesuffix, 89 96 "allow_extra_options")) { 90 97 … … 109 116 $self->{'removeprefix'} = $removeprefix; 110 117 } 118 if (defined($removesuffix) && $removesuffix) { 119 $removesuffix =~ s/\$$//; # don't need a trailing $ 120 $self->{'removesuffix'} = $removesuffix; 121 } 111 122 112 123 return bless $self, $class; … … 133 144 length($self->{'removeprefix'})) { 134 145 $metavalue =~ s/^$self->{'removeprefix'}//; 146 } 147 if (defined($self->{'removesuffix'}) && 148 length($self->{'removesuffix'})) { 149 $metavalue =~ s/$self->{'removesuffix'}$//; 135 150 } 136 151
Note:
See TracChangeset
for help on using the changeset viewer.