Changeset 424 for trunk


Ignore:
Timestamp:
1999-08-02T17:16:10+12:00 (25 years ago)
Author:
sjboddie
Message:

fixed some bugs - made it easier to use as sub-classification of
another classifier

File:
1 edited

Legend:

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

    r409 r424  
    4040
    4141    while (defined $thissection) {
    42 
    43     my $metavalue = $doc_obj->get_metadata_element ($thissection, $self->{'metaname'});
    44 
    45     # if this document doesn't contain the metadata element we're
    46     # sorting by we won't include it in this classification
    47     if (defined $metavalue && $metavalue =~ /\w/) {
    48         if ($self->{'metaname'} eq 'Creator') {
    49         &sorttools::format_string_name_english (\$metavalue);
    50         } else {
    51         &sorttools::format_string_english (\$metavalue);
    52         }
    53         if (defined $self->{'list'}->{"$doc_OID.$thissection"}) {
    54         print STDERR "WARNING: AZSectionList::classify called multiple times for $doc_OID\n";
    55         }
    56         $self->{'list'}->{"$doc_OID.$thissection"} = $metavalue;
    57     }
     42    $self->classify_section ($thissection, $doc_obj);
    5843    $thissection = $doc_obj->get_next_section ($thissection);
    5944    }
    6045}
    6146
     47sub classify_section {
     48    my $self = shift (@_);
     49    my ($section, $doc_obj) = @_;
     50
     51    my $doc_OID = $doc_obj->get_OID();
     52    my $metavalue = $doc_obj->get_metadata_element ($section, $self->{'metaname'});
     53
     54    # if this section doesn't contain the metadata element we're
     55    # sorting by we won't include it in this classification
     56    if (defined $metavalue && $metavalue =~ /\w/) {
     57    if ($self->{'metaname'} eq 'Creator') {
     58        &sorttools::format_string_name_english (\$metavalue);
     59    } else {
     60        &sorttools::format_string_english (\$metavalue);
     61    }
     62    if (defined $self->{'list'}->{"$doc_OID.$section"}) {
     63        print STDERR "WARNING: AZSectionList::classify called multiple times for $doc_OID.$section\n";
     64    }
     65    $self->{'list'}->{"$doc_OID.$section"} = $metavalue;
     66    }
     67}
    6268
    6369sub get_classify_info {
Note: See TracChangeset for help on using the changeset viewer.