Changeset 29094 for main/trunk
- Timestamp:
- 2014-06-09T14:40:40+12:00 (10 years ago)
- Location:
- main/trunk/greenstone2/perllib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/classify/List.pm
r27098 r29094 44 44 } 45 45 46 my $meta_select_type_list = 47 [ 48 { 'name' => "firstvalue", 49 'desc' => "{List.metadata_selection.firstvalue}"}, 50 { 'name' => "firstvalidmetadata", 51 'desc' => "{List.metadata_selection.firstvalidmetadata}"}, 52 { 'name' => "allvalues", 53 'desc' => "{List.metadata_selection.allvalues}"} ]; 54 my $valid_meta_select_types = { 'firstvalue' => 1, 55 'firstvalidmetadata' => 1, 56 'allvalues' => 1 }; 46 57 my $partition_type_list = 47 58 [ { 'name' => "per_letter", … … 74 85 'type' => "metadata", 75 86 'reqd' => "yes" }, 76 87 { 'name' => "metadata_selection_mode", 88 'desc' => "{List.metadata_selection_mode}", 89 'type' => "enumstring", # Must be enumstring because multiple values can be specified (separated by '/') 90 'list' => $meta_select_type_list, 91 'deft' => "firstvalidmetadata" }, 77 92 # The interesting options 78 93 { 'name' => "bookshelf_type", … … 162 177 } 163 178 179 # meta selection mode for each level 180 if (!$self->{'metadata_selection_mode'}) { 181 foreach my $metadata_group (@metadata_groups) { 182 $self->{$metadata_group . ".metadata_selection_mode"} = "firstvalidmetadata"; 183 } 184 } else { 185 my @metadata_selection_mode_list = split(/\//, $self->{'metadata_selection_mode'}); 186 foreach my $metadata_group (@metadata_groups) { 187 my $meta_select_mode = shift(@metadata_selection_mode_list); 188 if (defined($meta_select_mode) && defined $valid_meta_select_types->{$meta_select_mode}) { 189 $self->{$metadata_group . ".metadata_selection_mode"} = $meta_select_mode; 190 } else { 191 $self->{$metadata_group . ".metadata_selection_mode"} = "firstvalidmetadata"; 192 } 193 } 194 } 164 195 # Whether to group items into a bookshelf, (must be 'always' for all metadata fields except the last) 165 196 foreach my $metadata_group (@metadata_groups) { … … 276 307 } 277 308 $self->{'sort_leaf_nodes_using_metadata_groups'} = \@sort_leaf_nodes_using_metadata_groups; 278 309 foreach my $sort_group (@sort_leaf_nodes_using_metadata_groups) { 310 # set metadata_select_type, if not already set - might be already set if the same group was used in -metadata 311 if (!defined $self->{$sort_group . ".metadata_selection_mode"}) { 312 $self->{$sort_group . ".metadata_selection_mode"} = "firstvalue"; 313 } 314 } 279 315 # Create an instance of the Unicode::Collate object if better Unicode sorting is desired 280 316 if ($self->{'sort_using_unicode_collation'}) { … … 413 449 414 450 # Add the metadata value into the list for this combination of metadata group and section 415 push(@{$self->{$metadata_group . ".list"}->{$section_OID}}, $lc_metadata_value); 451 # text that we have some non-whitespace chars 452 if ($lc_metadata_value =~ /\S/) { 453 454 push(@{$self->{$metadata_group . ".list"}->{$section_OID}}, $lc_metadata_value); 455 456 416 457 # add the actual value into the stored values so we can remember the case 417 458 if (!$self->{'standardize_capitalization'}) { … … 421 462 $self->{$metadata_group . ".actualvalues"}->{$lc_metadata_value}->{$metadata_value} = 1; 422 463 } 423 } 424 } 425 last if (@metadata_values > 0); 426 } 464 } 465 last if ($self->{$metadata_group . ".metadata_selection_mode"} eq "firstvalue"); 466 } 467 } # foreach metadatavalue 468 last if ((@metadata_values > 0) && $self->{$metadata_group . ".metadata_selection_mode"} =~ /^(firstvalue|firstvalidmetadata)$/ ); 469 } # foreach metadata element 427 470 428 471 $metadata_groups_done{$metadata_group} = 1; -
main/trunk/greenstone2/perllib/strings.properties
r29013 r29094 649 649 List.level_partition.approximate_size:Create a partition per letter, then group or split the letters to get approximately the same sized partitions. 650 650 651 List.metadata:Metadata fields used for classification. Use '/' to separate the levels in the hierarchy and ';' to separate metadata fields within each level. 652 651 List.metadata:Metadata fields used for classification. Use '/' to separate the levels in the hierarchy and ';' or ',' to separate metadata fields within each level. 652 653 List.metadata_selection_mode:Determines how many metadata values the document is classified by, within each level. Use '/' to separate the levels. 654 List.metadata_selection.firstvalue:Only classify by a single metadata value, the first one encountered. 655 List.metadata_selection.firstvalidmetadata:Classify by all the metadata values of the first element in the list that has values. 656 List.metadata_selection.allvalues:Classify by all metadata values found, from all elements in the list. 653 657 List.partition_name_length:The length of the partition name; defaults to a variable length from 1 up to 3 characters, depending on how many are required to distinguish the partition start from its end. This option only applies when partition_type_within_level is set to 'constant_size'. 654 658
Note:
See TracChangeset
for help on using the changeset viewer.