Changeset 8729


Ignore:
Timestamp:
2004-12-03T12:01:52+13:00 (19 years ago)
Author:
kjdon
Message:

changed List so that when its being used from AZCompactList it does use the list of metadata names rather than assuming it is using the first one

File:
1 edited

Legend:

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

    r8221 r8729  
    157157    # find the correct bit of metadata, if multi-valued metadata field
    158158    if (exists $doc_obj->{'mdoffset'}) { # set by AZCompactList
     159
    159160        my $mdoffset=$doc_obj->{'mdoffset'} - 1;
    160         # if this List is used by AZCompactList, then $metavalue is
    161         # only really needed for sorting.
    162         # assume (!!) there is only one fieldname in the meta_list
    163         $metaname=(@{$self->{'meta_list'}})[0];
    164         # get all metadata values for this field
    165         my $values_listref=
    166         $doc_obj->get_metadata($topsection, $metaname);
    167         # get the correct one (from the offset)
    168         $metavalue=@$values_listref[$mdoffset];
    169         # use a special format for docOID...
    170         $doc_OID .= ".offset$mdoffset";
    171 
     161       
     162        foreach my $m (@{$self->{'meta_list'}}) {
     163        my $values_listref=
     164            $doc_obj->get_metadata($topsection, $m);
     165        $array_size = scalar(@{$values_listref});
     166        if ($array_size==0 || $array_size < $mdoffset+1) {
     167            $mdoffset = $mdoffset - $array_size;
     168        } else {
     169            $metaname = $m;
     170            # get the correct value using the offset
     171            $metavalue=@$values_listref[$mdoffset];
     172                    # use a special format for docOID...
     173            $doc_OID .= ".offset$mdoffset";
     174            last;
     175        }
     176        }
    172177    } else {
    173178        # use the first available metadata
Note: See TracChangeset for help on using the changeset viewer.