source: trunk/gsdl/perllib/classify/HTML.pm@ 717

Last change on this file since 717 was 717, checked in by sjboddie, 25 years ago

caught HTML classifier up with new browsing structure

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 2.2 KB
Line 
1###########################################################################
2#
3# HTML.pm --
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# html classifier plugin - creates an empty classification
27# that's simply a link to a web page
28# options are:
29# title=Title -- (optional) the title field for this classification.
30# if not included title field 'Browse'
31# url=url -- the url of the web page to link to
32
33package HTML;
34
35sub new {
36 my ($class, @options) = @_;
37
38 my ($title, $url);
39
40 foreach $option (@options) {
41 if ($option =~ /^url=(.*)$/i) {
42 $url = $1;
43 } elsif ($option =~ /^title=(.*)$/i) {
44 $title = $1;
45 }
46 }
47
48 die "Error: HTML classifier contains no 'url' option\n"
49 unless defined $url;
50
51 $title = 'Browse' unless defined $title;
52
53 return bless {
54 'url' => $url,
55 'title' => $title
56 }, $class;
57}
58
59sub init {
60 my $self = shift (@_);
61}
62
63sub classify {
64 my $self = shift (@_);
65 my ($doc_obj) = @_;
66
67 # we don't do anything for individual documents
68}
69
70sub get_classify_info {
71 my $self = shift (@_);
72
73 my %classifyinfo = ('thistype'=>'Invisible',
74 'childtype'=>'HTML',
75 'Title'=>$self->{'title'},
76 'contains'=>[]);
77
78 push (@{$classifyinfo{'contains'}}, {'OID'=>$self->{'url'}});
79
80 return \%classifyinfo;
81}
82
83
841;
Note: See TracBrowser for help on using the repository browser.