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 | # buttonname=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 |
|
---|
33 | package HTML;
|
---|
34 |
|
---|
35 | use BasClas;
|
---|
36 |
|
---|
37 | sub BEGIN {
|
---|
38 | @ISA = ('BasClas');
|
---|
39 | }
|
---|
40 |
|
---|
41 | sub print_usage {
|
---|
42 | print STDERR "
|
---|
43 | usage: classify AZList [options]
|
---|
44 | options:
|
---|
45 | -url X The url of the web page to link to.
|
---|
46 | -buttonname X (optional) the title field for this classification.
|
---|
47 | The default is 'Browse'
|
---|
48 |
|
---|
49 | HTML classifier plugin - creates classifier that is a link to a web page
|
---|
50 |
|
---|
51 | ";
|
---|
52 | }
|
---|
53 |
|
---|
54 | sub new {
|
---|
55 | my $class = shift (@_);
|
---|
56 | my $self = new BasClas($class, @_);
|
---|
57 |
|
---|
58 | my ($title, $url);
|
---|
59 |
|
---|
60 | if (!parsargv::parse(\@_,
|
---|
61 | q^url/.*/^, \$url,
|
---|
62 | q^buttonname/.*/Browse^, \$title,
|
---|
63 | "allow_extra_options")) {
|
---|
64 |
|
---|
65 | print STDERR "\nIncorrect options passed to $class, check your collect.cfg file\n";
|
---|
66 | &print_usage();
|
---|
67 | die "\n";
|
---|
68 | }
|
---|
69 |
|
---|
70 | if (!defined $url) {
|
---|
71 | my $outhandle = $self->{'outhandle'};
|
---|
72 | print $outhandle "Error: HTML classifier contains no 'url' option\n";
|
---|
73 | die "\n";
|
---|
74 | }
|
---|
75 |
|
---|
76 | $self->{'url'} = $url;
|
---|
77 | $self->{'title'} = $title;
|
---|
78 |
|
---|
79 | return bless $self, $class;
|
---|
80 | }
|
---|
81 |
|
---|
82 | sub init {
|
---|
83 | my $self = shift (@_);
|
---|
84 | }
|
---|
85 |
|
---|
86 | sub classify {
|
---|
87 | my $self = shift (@_);
|
---|
88 | my ($doc_obj) = @_;
|
---|
89 |
|
---|
90 | # we don't do anything for individual documents
|
---|
91 | }
|
---|
92 |
|
---|
93 | sub get_classify_info {
|
---|
94 | my $self = shift (@_);
|
---|
95 |
|
---|
96 | my %classifyinfo = ('thistype'=>'Invisible',
|
---|
97 | 'childtype'=>'HTML',
|
---|
98 | 'Title'=>$self->{'title'},
|
---|
99 | 'contains'=>[]);
|
---|
100 |
|
---|
101 | push (@{$classifyinfo{'contains'}}, {'OID'=>$self->{'url'}});
|
---|
102 |
|
---|
103 | return \%classifyinfo;
|
---|
104 | }
|
---|
105 |
|
---|
106 |
|
---|
107 | 1;
|
---|