Changeset 14084

Show
Ignore:
Timestamp:
21.05.2007 17:40:08 (12 years ago)
Author:
mdewsnip
Message:

Added "partition_name_length" option to GenericList?, many thanks to Jens Wille.

Location:
trunk/gsdl/perllib
Files:
2 modified

Legend:

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

    r13791 r14084  
    6565    'desc' => "{GenericList.partition_size_within_level}", 
    6666    'type' => "string" }, 
     67      { 'name' => "partition_name_length", 
     68    'desc' => "{GenericList.partition_name_length}", 
     69    'type' => "string" }, 
    6770      { 'name' => "sort_leaf_nodes_using", 
    6871    'desc' => "{GenericList.sort_leaf_nodes_using}", 
     
    362365        # Is this the start of a new partition? 
    363366        if ($itemsinpartition == 1) { 
    364             $partitionstart = &generate_partition_start($metavalue, $lastpartitionend); 
     367            $partitionstart = &generate_partition_start($metavalue, $lastpartitionend, $self->{"partition_name_length"}); 
    365368        } 
    366369 
    367370        # Is this the end of the partition? 
    368371        if ($itemsinpartition == $partition_size_within_level || $itemsdone == @sortedmetavalues) { 
    369             my $partitionend = &generate_partition_end($metavalue, $partitionstart); 
     372            my $partitionend = &generate_partition_end($metavalue, $partitionstart, $self->{"partition_name_length"}); 
    370373            my $partitionname = $partitionstart; 
    371374            if ($partitionend ne $partitionstart) { 
     
    419422    my $metavalue = shift(@_); 
    420423    my $lastpartitionend = shift(@_); 
     424    my $partition_name_length = shift(@_); 
     425 
     426    if ($partition_name_length) { 
     427    return substr($metavalue, 0, $partition_name_length); 
     428    } 
    421429 
    422430    my $partitionstart = substr($metavalue, 0, 1); 
     
    437445    my $metavalue = shift(@_); 
    438446    my $partitionstart = shift(@_); 
     447    my $partition_name_length = shift(@_); 
     448 
     449    if ($partition_name_length) { 
     450    return substr($metavalue, 0, $partition_name_length); 
     451    } 
    439452 
    440453    my $partitionend = substr($metavalue, 0, length($partitionstart)); 
  • trunk/gsdl/perllib/strings.properties

    r14012 r14084  
    546546GenericList.desc:A general and flexible list classifier with most of the abilities of AZCompactList, but with better Unicode, metadata and sorting capabilities. 
    547547GenericList.metadata:Metadata fields used for classification. Use '/' to separate the levels in the hierarchy and ';' to separate metadata fields within each level. 
     548GenericList.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'. 
    548549GenericList.partition_size_within_level:The number of items in each partition (only applies when partition_type_within_level is set to 'constant_size'). 
    549550GenericList.partition_type_within_level:The type of partitioning done: either 'per_letter', 'constant_size', or 'none'.