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

Last change on this file since 6983 was 6983, checked in by kjdon, 20 years ago

added in the info_only check, and now dies if is not set

  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 3.0 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
29package HTML;
30
31use BasClas;
32
33sub BEGIN {
34 @ISA = ('BasClas');
35}
36
37my $arguments =
38 [ { 'name' => "url",
39 'desc' => "{HTML.url}",
40 'type' => "string",
41 'reqd' => "yes" } ,
42 { 'name' => "buttonname",
43 'desc' => "{BasClas.buttonname}",
44 'type' => "string",
45 'deft' => "Browse",
46 'reqd' => "no" } ];
47
48my $options = { 'name' => "HTML",
49 'desc' => "{HTML.desc}",
50 'abstract' => "no",
51 'inherits' => "yes",
52 'args' => $arguments };
53
54
55sub new {
56 my $class = shift (@_);
57 my $self = new BasClas($class, @_);
58
59 # 14-05-02 To allow for proper inheritance of arguments - John Thompson
60 my $option_list = $self->{'option_list'};
61 push( @{$option_list}, $options );
62
63 if ($self->{'info_only'}) {
64 # created from classinfo.pl - don't need to parse the arguments
65 return bless $self, $class;
66 }
67
68 my ($title, $url);
69
70 if (!parsargv::parse(\@_,
71 q^url/.*/^, \$url,
72 q^buttonname/.*/Browse^, \$title,
73 "allow_extra_options")) {
74
75 print STDERR "\nIncorrect options passed to $class, check your collect.cfg file\n";
76 $self->print_txt_usage(""); # Use default resource bundle
77 die "\n";
78 }
79
80 if (!$url) {
81 my $outhandle = $self->{'outhandle'};
82 print $outhandle "HTML Error: required option -url not supplied\n";
83 $self->print_txt_usage("");
84 die "HTML Error: required option -url not supplied\n";
85 }
86
87 $self->{'url'} = $url;
88 $self->{'title'} = $title;
89
90 return bless $self, $class;
91}
92
93sub init {
94 my $self = shift (@_);
95}
96
97sub classify {
98 my $self = shift (@_);
99 my ($doc_obj) = @_;
100
101 # we don't do anything for individual documents
102}
103
104sub get_classify_info {
105 my $self = shift (@_);
106
107 my %classifyinfo = ('thistype'=>'Invisible',
108 'childtype'=>'HTML',
109 'Title'=>$self->{'title'},
110 'contains'=>[]);
111
112 push (@{$classifyinfo{'contains'}}, {'OID'=>$self->{'url'}});
113
114 return \%classifyinfo;
115}
116
117
1181;
Note: See TracBrowser for help on using the repository browser.