Changeset 11433 for trunk/gsdl
- Timestamp:
- 2006-03-21T10:48:46+12:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/perllib/classify/DateList.pm
r10979 r11433 145 145 print $outhandle "WARNING: DateList::classify called multiple times for $doc_OID\n"; 146 146 } 147 147 148 148 149 $self->{'list'}->{$doc_OID} = "$date$sort_other"; 149 150 150 151 } 151 152 … … 155 156 156 157 my @classlist = sort {$self->{'list'}->{$a} cmp $self->{'list'}->{$b};} keys %{$self->{'list'}}; 158 157 159 if ($self->{'reverse_sort'}) { 158 160 @classlist = reverse @classlist; 159 161 } 162 160 163 161 164 return $self->splitlist (\@classlist); … … 190 193 if (scalar (@$classlistref) <= 39 && 191 194 !$self->{'nogroup'}) {$childtype = "DateList";} 195 192 196 my $classifyinfo = $self->get_entry ("Date", $childtype, "Invisible"); 193 197 # don't need to do any splitting if there are less than 39 (max + min -1) … … 228 232 # create subclass if it doesn't already exist 229 233 $classhash->{$year} = () unless defined $classhash->{$year}; 234 230 235 $classhash->{$year}->{$month} = [] 231 236 unless defined $classhash->{$year}->{$month}; 232 237 push (@{$classhash->{$year}->{$month}}, $classification); 238 233 239 } 234 240 # create hlist of years containing hlists of months 235 241 236 foreach my $subclass (sort {$a <=> $b} keys %$classhash) { 237 my $yearclassify = $self->get_entry($subclass, "HList"); 238 foreach my $subsubclass (sort {$a <=> $b} 239 (keys %{$classhash->{$subclass}})) { 240 my $monthname=$subsubclass; 241 if ($monthname >= 1 && $monthname <= 12) { 242 $monthname="_textmonth" . $monthname . "_"; 243 } 244 my $monthclassify=$self->get_entry($monthname, "DateList"); 245 push (@{$yearclassify->{'contains'}}, $monthclassify); 242 243 if ($self->{'reverse_sort'}){ 244 foreach my $subclass (sort {$b <=> $a} 245 (keys %$classhash)){ 246 my $yearclassify = $self->get_entry($subclass, "HList"); 247 foreach my $subsubclass (sort {$b <=> $a} 248 (keys %{$classhash->{$subclass}})) { 249 my $monthname=$subsubclass; 250 if ($monthname >= 1 && $monthname <= 12) { 251 $monthname="_textmonth" . $monthname . "_"; 252 } 253 my $monthclassify=$self->get_entry($monthname, "DateList"); 254 push (@{$yearclassify->{'contains'}}, $monthclassify); 255 256 foreach my $subsubOID 257 (@{$classhash->{$subclass}->{$subsubclass}}) { 258 push (@{$monthclassify->{'contains'}}, 259 {'OID'=>$subsubOID}); 260 } 261 } 262 push (@{$classifyinfo->{'contains'}}, $yearclassify); 263 } 264 } 265 else{ 266 foreach my $subclass (sort {$a <=> $b} 267 (keys %$classhash)){ 268 my $yearclassify = $self->get_entry($subclass, "HList"); 269 foreach my $subsubclass (sort {$a <=> $b} 270 (keys %{$classhash->{$subclass}})) { 271 my $monthname=$subsubclass; 272 if ($monthname >= 1 && $monthname <= 12) { 273 $monthname="_textmonth" . $monthname . "_"; 274 } 275 my $monthclassify=$self->get_entry($monthname, "DateList"); 276 push (@{$yearclassify->{'contains'}}, $monthclassify); 277 278 foreach my $subsubOID 279 (@{$classhash->{$subclass}->{$subsubclass}}) { 280 push (@{$monthclassify->{'contains'}}, 281 {'OID'=>$subsubOID}); 282 } 283 } 284 push (@{$classifyinfo->{'contains'}}, $yearclassify); 285 } 246 286 247 foreach my $subsubOID 248 (@{$classhash->{$subclass}->{$subsubclass}}) { 249 push (@{$monthclassify->{'contains'}}, 250 {'OID'=>$subsubOID}); 251 } 252 } 253 push (@{$classifyinfo->{'contains'}}, $yearclassify); 254 } 287 288 } 289 255 290 return $classifyinfo; 256 291 } # nogroup 257 } 292 }else { 258 293 # not by month 259 294 # first split up the list into separate year classifications … … 264 299 push (@{$classhash->{$date}}, $classification); 265 300 } 301 266 302 } 267 303 … … 270 306 $classhash = $self->compactlist ($classhash); 271 307 } 272 foreach my $subclass (sort keys %$classhash) { 273 my $tempclassify = $self->get_entry($subclass, "DateList"); 274 foreach my $subsubOID (@{$classhash->{$subclass}}) { 275 push (@{$tempclassify->{'contains'}}, {'OID'=>$subsubOID}); 276 } 277 push (@{$classifyinfo->{'contains'}}, $tempclassify); 278 } 279 308 309 if ($self->{'reverse_sort'} && $self->{'nogroup'} ) { 310 foreach my $subclass (reverse sort keys %$classhash) { 311 my $tempclassify = $self->get_entry($subclass, "DateList"); 312 foreach my $subsubOID (@{$classhash->{$subclass}}) { 313 push (@{$tempclassify->{'contains'}}, {'OID'=>$subsubOID}); 314 } 315 push (@{$classifyinfo->{'contains'}}, $tempclassify); 316 } 317 } 318 else{ 319 foreach my $subclass (sort keys %$classhash) { 320 my $tempclassify = $self->get_entry($subclass, "DateList"); 321 foreach my $subsubOID (@{$classhash->{$subclass}}) { 322 push (@{$tempclassify->{'contains'}}, {'OID'=>$subsubOID}); 323 } 324 push (@{$classifyinfo->{'contains'}}, $tempclassify); 325 } 326 327 } 328 329 280 330 return $classifyinfo; 281 331 }
Note:
See TracChangeset
for help on using the changeset viewer.