source: main/trunk/package-kits/scripts/perllib/Greenstone/Interface.pm@ 29682

Last change on this file since 29682 was 29682, checked in by Jeremy Symon, 9 years ago

Added gs-mkinterface.pl. Same as mksite, but for interfaces. Currently created interfaces just inherit from the default interface as in the readme, and don't actually implement anything themselves

File size: 783 bytes
Line 
1package Greenstone::Interface;
2
3use strict;
4use warnings;
5use utf8;
6use Greenstone::Directory;
7use Greenstone::XML::Tidy;
8use Hash::Ordered;
9use parent 'Greenstone::Directory';
10
11my $dir = "interfaces";
12
13sub new {
14 return Greenstone::Directory::new ($dir, @_);
15}
16
17sub list {
18 return Greenstone::Directory::list $dir;
19}
20
21my $configTemplate;
22
23sub create {
24 my $self = shift;
25 $self->SUPER::create or return 0;
26 my $dir = $self->dir;
27 my $config = read_xml "$dir/../default/interfaceConfig.xml";
28 my $root = $config->get ('interfaceConfig');
29 unless ($root->exists ('.attr')) {
30 $root->set ('.attr' => Hash::Ordered->new);
31 }
32 $root->get ('.attr')->set ('baseInterface' => "default");
33
34 return write_xml $config, "$dir/interfaceConfig.xml";
35}
36
371;
Note: See TracBrowser for help on using the repository browser.