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

Last change on this file since 6408 was 6408, checked in by jmt12, 20 years ago

Added two new attributes for script arguments. HiddenGLI controls whether the argument will be visible at all in GLI, while ModeGLI defines the lowest detail mode under which the argument will be visible (only really for import and buildcol). Also ensured that the scripts were reporting their correct default process expressions, and further refined argument types by adding the catagory regexp for any regular expression (which can then be hidden under lower detail modes in GLI)

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