Changeset 12894 for trunk/gsdl/perllib/classify/GenericList.pm
- Timestamp:
- 2006-09-28T12:07:50+12:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/perllib/classify/GenericList.pm
r12893 r12894 89 89 90 90 my $self = new BasClas($classifierslist, $inputargs, $hashArgOptLists); 91 $self->{'OIDs'} = [];92 91 93 92 if ($self->{'info_only'}) { … … 96 95 } 97 96 98 my $metadata = $self->{'metadata'};99 my $buttonname = $self->{'buttonname'};100 my $partition_type_within_level = $self->{'partition_type_within_level'};101 my $partition_size_within_level = $self->{'partition_size_within_level'};102 my $sort_leaf_nodes_using = $self->{'sort_leaf_nodes_using'};103 104 97 # The metadata elements to use (required) 105 # print STDERR "Creating new GenericList for $metadata...\n"; 106 if (!$metadata) { 98 if (!$self->{'metadata'}) { 107 99 die "Error: No metadata fields specified for GenericList.\n"; 108 100 } 109 my @metadata_groups = split(/\//, $ metadata);101 my @metadata_groups = split(/\//, $self->{'metadata'}); 110 102 $self->{'metadata_groups'} = \@metadata_groups; 111 103 112 # The classifier button name 113 if (!$buttonname) { 114 # Default: the first metadata element specified 115 my $firstmetagroupfirstelem = (split(/\;/, $metadata_groups[0]))[0]; 116 $buttonname = $self->generate_title_from_metadata($firstmetagroupfirstelem); 117 } 118 $self->{'title'} = $buttonname; 104 # The classifier button name (default: the first metadata element specified) 105 if (!$self->{'buttonname'}) { 106 my $first_metadata_group = $metadata_groups[0]; 107 my $first_metadata_element = (split(/\;/, $first_metadata_group))[0]; 108 $self->{'buttonname'} = $self->generate_title_from_metadata($first_metadata_element); 109 } 119 110 120 111 # Whether to group single items into a bookshelf (must be true for all metadata fields except the last) … … 123 114 } 124 115 if (!$self->{'always_bookshelf_last_level'}) { 125 # Default: leave leaf nodes ungrouped (equivalent to AZCompactList -mingroup 2)116 # Default: leave leaf nodes ungrouped (equivalent to AZCompactList -mingroup 2) 126 117 my $last_metadata_group = $metadata_groups[$#metadata_groups]; 127 118 $self->{$last_metadata_group . ".always_bookshelf"} = "f"; … … 136 127 } 137 128 138 # How the items are grouped into partitions 139 if (!$partition_type_within_level) { 140 # Default: none 141 $partition_type_within_level = "none"; 142 } 143 $self->{"partition_type_within_level"} = $partition_type_within_level; 129 # How the items are grouped into partitions (default: no partition) 130 if (!$self->{"partition_type_within_level"}) { 131 $self->{"partition_type_within_level"} = "none"; 132 } 144 133 145 134 # The number of items in each partition 146 if (!$ partition_size_within_level) {135 if (!$self->{'partition_size_within_level'}) { 147 136 # Default: 20 148 137 foreach my $metadata_group (@metadata_groups) { … … 151 140 } 152 141 else { 153 my @partition_size_within_levellist = split(/\//, $ partition_size_within_level);142 my @partition_size_within_levellist = split(/\//, $self->{'partition_size_within_level'}); 154 143 155 144 # Assign values based on the partition_size_within_level parameter … … 165 154 } 166 155 167 # The metadata elements to use to sort the leaf nodes 168 my @sort_leaf_nodes_usingmetadata_groups = ( "Title" ); 169 if ($sort_leaf_nodes_using) { 170 @sort_leaf_nodes_usingmetadata_groups = split(/\|/, $sort_leaf_nodes_using); 171 } 172 $self->{'sort_leaf_nodes_usingmetadata_groups'} = \@sort_leaf_nodes_usingmetadata_groups; 156 # The metadata elements to use to sort the leaf nodes (default: Title) 157 my @sort_leaf_nodes_using_metadata_groups = ( "Title" ); 158 if ($self->{'sort_leaf_nodes_using'}) { 159 @sort_leaf_nodes_using_metadata_groups = split(/\|/, $self->{'sort_leaf_nodes_using'}); 160 } 161 $self->{'sort_leaf_nodes_using_metadata_groups'} = \@sort_leaf_nodes_using_metadata_groups; 162 163 # An empty array for the document OIDs 164 $self->{'OIDs'} = []; 173 165 174 166 return bless $self, $class; … … 219 211 # Create a hash for the metadata values of each metadata element we're interested in 220 212 my %metagroupsdone = (); 221 foreach my $metadata_group (@metadata_groups, @{$self->{'sort_leaf_nodes_using metadata_groups'}}) {213 foreach my $metadata_group (@metadata_groups, @{$self->{'sort_leaf_nodes_using_metadata_groups'}}) { 222 214 # Take care not to do a metadata group more than once 223 215 unless ($metagroupsdone{$metadata_group}) { … … 258 250 my %classifier_node = ( 'thistype' => "Invisible", 259 251 'childtype' => $childtype, 260 'Title' => $self->{' title'},252 'Title' => $self->{'buttonname'}, 261 253 'contains' => [] ); 262 254 … … 467 459 else { 468 460 # Sort the leaf nodes by the metadata elements specified with -sort_leaf_nodes_using 469 my @sort_leaf_nodes_usingmetadata_groups = @{$self->{'sort_leaf_nodes_using metadata_groups'}};461 my @sort_leaf_nodes_usingmetadata_groups = @{$self->{'sort_leaf_nodes_using_metadata_groups'}}; 470 462 foreach my $sort_leaf_nodes_usingmetaelem (reverse @sort_leaf_nodes_usingmetadata_groups) { 471 463 my %OIDtometavaluehash = %{$self->{$sort_leaf_nodes_usingmetaelem . ".list"}};
Note:
See TracChangeset
for help on using the changeset viewer.