source: trunk/gsdl/perllib/plugouts/GAPlugout.pm@ 12697

Last change on this file since 12697 was 12363, checked in by kjdon, 18 years ago

sort_metadata renamed to store_output_info_reference, and modified the sortmeta stuff to use a comma separated list

  • Property svn:keywords set to Author Date Id Revision
File size: 2.9 KB
Line 
1###########################################################################
2#
3# GAPlugout.pm -- the plugout module for Greenstone Archives
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) 2006 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
26package GAPlugout;
27
28use strict;
29no strict 'refs';
30
31eval {require bytes};
32use util;
33use BasPlugout;
34
35sub BEGIN {
36 @GAPlugout::ISA = ('BasPlugout');
37}
38
39my $arguments = [];
40
41my $options = { 'name' => "GAPlugout",
42 'desc' => "{GAPlugout.desc}",
43 'abstract' => "no",
44 'inherits' => "yes" };
45
46sub new {
47 my ($class) = shift (@_);
48 my ($plugoutlist, $inputargs,$hashArgOptLists) = @_;
49 push(@$plugoutlist, $class);
50
51 if(defined $arguments){ push(@{$hashArgOptLists->{"ArgList"}},@{$arguments});}
52 if(defined $options) { push(@{$hashArgOptLists->{"OptList"}},$options)};
53
54 my $self = (defined $hashArgOptLists)? new BasPlugout($plugoutlist,$inputargs,$hashArgOptLists): new BasPlugout($plugoutlist,$inputargs);
55
56 return bless $self, $class;
57}
58
59sub saveas {
60 my $self = shift (@_);
61 my ($doc_obj,$doc_dir) = @_;
62
63 my $output_dir = $self->get_output_dir();
64 &util::mk_all_dir ($output_dir) unless -e $output_dir;
65
66 my $working_dir = &util::filename_cat ($output_dir, $doc_dir);
67 &util::mk_all_dir ($working_dir) unless -e $working_dir;
68
69 $self->process_assoc_files ($doc_obj, $doc_dir, '');
70
71 my $output_file = util::filename_cat ($working_dir, "doc.xml");
72
73 $self->open_xslt_pipe($output_file, $self->{'xslt_file'});
74
75 my $outhandler;
76
77 if (defined $self->{'xslt_writer'}){
78 $outhandler = $self->{'xslt_writer'};
79 }
80 else{
81 $outhandler = $self->get_output_handler($output_file);
82 }
83
84 $self->output_xml_header($outhandler,"Archive");
85 $doc_obj->output_section($outhandler,$doc_obj->get_top_section());
86 $self->output_xml_footer($outhandler,"Archive");
87
88 if (defined $self->{'xslt_writer'}){
89 $self->close_xslt_pipe();
90 }
91 else{
92 close($outhandler);
93 }
94
95 $self->{'short_doc_file'} = util::filename_cat ($doc_dir, "doc.xml");
96
97 $self->store_output_info_reference($doc_obj);
98}
99
1001;
101
Note: See TracBrowser for help on using the repository browser.