Ignore:
Timestamp:
2005-09-29T10:54:06+12:00 (19 years ago)
Author:
kjdon
Message:

added documents_last - display document nodes after classifier nodes in the lists

File:
1 edited

Legend:

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

    r10630 r10663  
    248248       
    249249    }
    250     # if this key has documents, add them
    251     if (@doc_list) {
    252         $has_content = 1;
    253         foreach my $d (@doc_list) {
    254         push (@{$entry->{'contains'}}, {'OID'=>$d});
    255         }   
    256     }
    257     # if this key has nodes, add them
    258     if (scalar(keys %{$top_hash->{$key}->{'nodes'}})) {
    259         $has_content = 1;
    260         $self->process_hash($top_hash->{$key}->{'nodes'}, $entry);
    261     }
     250
     251    if ($self->{'documents_last'}) {
     252        # add nodes, then documents
     253        # if this key has nodes, add them
     254        if (scalar(keys %{$top_hash->{$key}->{'nodes'}})) {
     255        $has_content = 1;
     256        $self->process_hash($top_hash->{$key}->{'nodes'}, $entry);
     257        }
     258
     259        # if this key has documents, add them
     260        if (@doc_list) {
     261        $has_content = 1;
     262        foreach my $d (@doc_list) {
     263            push (@{$entry->{'contains'}}, {'OID'=>$d});
     264        }   
     265        }
     266
     267    } else {
     268        # add documents then nodes
     269        # if this key has documents, add them
     270        if (@doc_list) {
     271        $has_content = 1;
     272        foreach my $d (@doc_list) {
     273            push (@{$entry->{'contains'}}, {'OID'=>$d});
     274        }   
     275        }
     276        # if this key has nodes, add them
     277        if (scalar(keys %{$top_hash->{$key}->{'nodes'}})) {
     278        $has_content = 1;
     279        $self->process_hash($top_hash->{$key}->{'nodes'}, $entry);
     280        }
     281    }
     282   
    262283    # if we have found some content, add the new entry for this key into the parent node
    263284    if ($has_content) {
Note: See TracChangeset for help on using the changeset viewer.