Changeset 13271


Ignore:
Timestamp:
2006-11-15T13:28:14+13:00 (17 years ago)
Author:
mdewsnip
Message:

Now sets "offset" values so the correct metadata value is displayed when multiple values are assigned to one document.

File:
1 edited

Legend:

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

    r12896 r13271  
    259259                'childtype' => $self->{$first_metadata_group . ".list_type"},
    260260                'Title' => $self->{'buttonname'},
    261                 'contains' => [] );
     261                'contains' => [],
     262                'mdtype' => $first_metadata_group );
    262263
    263264    # Recursively create the classification hierarchy, one level for each metadata group
     
    448449    # If there is only one item and 'always_bookshelf' is false, add the item to the list
    449450    if (@OIDs == 1 && $self->{$metadata_group . ".always_bookshelf"} eq "f") {
    450         push(@{$classifier_node->{'contains'}}, { 'OID' => $OIDs[0] });
     451        my $OID = $OIDs[0];
     452
     453        # Find the offset of this metadata value
     454        my $offset = 0;
     455        my %OIDtometavaluehash = %{$self->{$metadata_group . ".list"}};
     456        my @metavalues = @{$OIDtometavaluehash{$OID}};
     457        for (my $i = 0; $i < scalar(@metavalues); $i++) {
     458        if ($metavalue eq $metavalues[$i]) {
     459            $offset = $i;
     460            last;
     461        }
     462        }
     463        push(@{$classifier_node->{'contains'}}, { 'OID' => $OID, 'offset' => $offset });
    451464    }
    452465
Note: See TracChangeset for help on using the changeset viewer.