[537] | 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 |
|
---|
[449] | 26 | # html classifier plugin - creates an empty classification
|
---|
| 27 | # that's simply a link to a web page
|
---|
| 28 |
|
---|
| 29 | package HTML;
|
---|
| 30 |
|
---|
[1483] | 31 | use BasClas;
|
---|
| 32 |
|
---|
[10253] | 33 | use strict;
|
---|
| 34 | no strict 'refs'; # allow filehandles to be variables and viceversa
|
---|
| 35 |
|
---|
[1483] | 36 | sub BEGIN {
|
---|
[10253] | 37 | @HTML::ISA = ('BasClas');
|
---|
[1483] | 38 | }
|
---|
| 39 |
|
---|
[3540] | 40 | my $arguments =
|
---|
[4759] | 41 | [ { 'name' => "url",
|
---|
[4873] | 42 | 'desc' => "{HTML.url}",
|
---|
[3540] | 43 | 'type' => "string",
|
---|
| 44 | 'reqd' => "yes" } ,
|
---|
[4759] | 45 | { 'name' => "buttonname",
|
---|
[6968] | 46 | 'desc' => "{BasClas.buttonname}",
|
---|
[3540] | 47 | 'type' => "string",
|
---|
[4759] | 48 | 'deft' => "Browse",
|
---|
| 49 | 'reqd' => "no" } ];
|
---|
[3540] | 50 |
|
---|
[4759] | 51 | my $options = { 'name' => "HTML",
|
---|
[5645] | 52 | 'desc' => "{HTML.desc}",
|
---|
[6408] | 53 | 'abstract' => "no",
|
---|
| 54 | 'inherits' => "yes",
|
---|
[4759] | 55 | 'args' => $arguments };
|
---|
[3540] | 56 |
|
---|
[1839] | 57 |
|
---|
[449] | 58 | sub new {
|
---|
[10218] | 59 | my ($class) = shift (@_);
|
---|
| 60 | my ($classifierslist,$inputargs,$hashArgOptLists) = @_;
|
---|
| 61 | push(@$classifierslist, $class);
|
---|
[3540] | 62 |
|
---|
[10218] | 63 | if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
|
---|
| 64 | if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
|
---|
[4759] | 65 |
|
---|
[10218] | 66 | my $self = (defined $hashArgOptLists)? new BasClas($classifierslist,$inputargs,$hashArgOptLists): new BasClas($classifierslist,$inputargs);
|
---|
[6983] | 67 |
|
---|
[10253] | 68 | if ($self->{'info_only'}) {
|
---|
| 69 | # don't worry about any options etc
|
---|
| 70 | return bless $self, $class;
|
---|
| 71 | }
|
---|
| 72 |
|
---|
[10218] | 73 | if (!$self->{'url'}) {
|
---|
[1483] | 74 | my $outhandle = $self->{'outhandle'};
|
---|
[6983] | 75 | print $outhandle "HTML Error: required option -url not supplied\n";
|
---|
| 76 | $self->print_txt_usage("");
|
---|
| 77 | die "HTML Error: required option -url not supplied\n";
|
---|
[1483] | 78 | }
|
---|
| 79 | return bless $self, $class;
|
---|
[449] | 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 |
|
---|
[717] | 96 | my %classifyinfo = ('thistype'=>'Invisible',
|
---|
| 97 | 'childtype'=>'HTML',
|
---|
[10218] | 98 | 'Title'=>$self->{'buttonname'},
|
---|
[449] | 99 | 'contains'=>[]);
|
---|
| 100 |
|
---|
| 101 | push (@{$classifyinfo{'contains'}}, {'OID'=>$self->{'url'}});
|
---|
| 102 |
|
---|
| 103 | return \%classifyinfo;
|
---|
| 104 | }
|
---|
| 105 |
|
---|
| 106 |
|
---|
| 107 | 1;
|
---|