source: tags/gsdl-2_39-distribution/niupepa/perllib/classify/NPDateList.pm@ 3835

Last change on this file since 3835 was 1023, checked in by sjboddie, 24 years ago

Initial revision

  • Property svn:keywords set to Author Date Id Revision
File size: 1.9 KB
Line 
1###########################################################################
2#
3# NPDateList.pm -- classifier plugin for sorting by date
4# A component of the Greenstone digital library software
5# from the New Zealand Digital Library Project at the
6# University of Waikato, New Zealand.
7#
8# Copyright (C) 1999 New Zealand Digital Library Project
9#
10# This program is free software; you can redistribute it and/or modify
11# it under the terms of the GNU General Public License as published by
12# the Free Software Foundation; either version 2 of the License, or
13# (at your option) any later version.
14#
15# This program is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18# GNU General Public License for more details.
19#
20# You should have received a copy of the GNU General Public License
21# along with this program; if not, write to the Free Software
22# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23#
24###########################################################################
25
26# overridden for niupepa as we don't want to include abstracts directly in lists
27
28package NPDateList;
29
30use DateList;
31
32sub BEGIN {
33 @ISA = ('DateList');
34}
35
36sub classify {
37 my $self = shift (@_);
38 my ($doc_obj) = @_;
39
40 # want to ignore abstracts
41 my $doctype = $doc_obj->get_metadata_element($doc_obj->get_top_section(), 'doctype');
42 return if (defined $doctype && $doctype eq 'Description');
43
44 my $doc_OID = $doc_obj->get_OID();
45 my $date = $doc_obj->get_metadata_element ($doc_obj->get_top_section(), 'Date');
46
47 # if this document doesn't contain Date element we won't
48 # include it in this classification
49 if (defined $date && $date =~ /\d/) {
50 if (defined $self->{'list'}->{$doc_OID}) {
51 print STDERR "WARNING: DateList::classify called multiple times for $doc_OID\n";
52 }
53 $self->{'list'}->{$doc_OID} = $date;
54 }
55}
56
571;
Note: See TracBrowser for help on using the repository browser.