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 | |
---|
1 | package Greenstone::Interface;
|
---|
2 |
|
---|
3 | use strict;
|
---|
4 | use warnings;
|
---|
5 | use utf8;
|
---|
6 | use Greenstone::Directory;
|
---|
7 | use Greenstone::XML::Tidy;
|
---|
8 | use Hash::Ordered;
|
---|
9 | use parent 'Greenstone::Directory';
|
---|
10 |
|
---|
11 | my $dir = "interfaces";
|
---|
12 |
|
---|
13 | sub new {
|
---|
14 | return Greenstone::Directory::new ($dir, @_);
|
---|
15 | }
|
---|
16 |
|
---|
17 | sub list {
|
---|
18 | return Greenstone::Directory::list $dir;
|
---|
19 | }
|
---|
20 |
|
---|
21 | my $configTemplate;
|
---|
22 |
|
---|
23 | sub 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 |
|
---|
37 | 1;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.