View | Details | Raw Unified | Return to bug 7804
Collapse All | Expand All

(-)a/C4/Auth.pm (+2 lines)
Lines 202-207 sub get_template_and_user { Link Here
202
            $template->param( CAN_user_serials          => 1 );
202
            $template->param( CAN_user_serials          => 1 );
203
            $template->param( CAN_user_reports          => 1 );
203
            $template->param( CAN_user_reports          => 1 );
204
            $template->param( CAN_user_staffaccess      => 1 );
204
            $template->param( CAN_user_staffaccess      => 1 );
205
            $template->param( CAN_user_plugins          => 1 );
205
            foreach my $module (keys %$all_perms) {
206
            foreach my $module (keys %$all_perms) {
206
                foreach my $subperm (keys %{ $all_perms->{$module} }) {
207
                foreach my $subperm (keys %{ $all_perms->{$module} }) {
207
                    $template->param( "CAN_user_${module}_${subperm}" => 1 );
208
                    $template->param( "CAN_user_${module}_${subperm}" => 1 );
Lines 366-371 sub get_template_and_user { Link Here
366
            OPACLocalCoverImages        => C4::Context->preference('OPACLocalCoverImages'),
367
            OPACLocalCoverImages        => C4::Context->preference('OPACLocalCoverImages'),
367
            AllowMultipleCovers         => C4::Context->preference('AllowMultipleCovers'),
368
            AllowMultipleCovers         => C4::Context->preference('AllowMultipleCovers'),
368
            EnableBorrowerFiles         => C4::Context->preference('EnableBorrowerFiles'),
369
            EnableBorrowerFiles         => C4::Context->preference('EnableBorrowerFiles'),
370
            UseKohaPlugins              => C4::Context->preference('UseKohaPlugins'),
369
        );
371
        );
370
    }
372
    }
371
    else {
373
    else {
(-)a/C4/Installer/PerlDependencies.pm (-1 / +40 lines)
Lines 578-584 our $PERL_DEPS = { Link Here
578
        'usage'    => 'Core',
578
        'usage'    => 'Core',
579
        'required' => '0',
579
        'required' => '0',
580
        'min_ver'  => '0.14',
580
        'min_ver'  => '0.14',
581
582
    },
581
    },
583
    'Text::Unaccent' => {
582
    'Text::Unaccent' => {
584
        'usage'    => 'Core',
583
        'usage'    => 'Core',
Lines 590-595 our $PERL_DEPS = { Link Here
590
        'required' => '1',
589
        'required' => '1',
591
        'min_ver'  => '1.23',
590
        'min_ver'  => '1.23',
592
    },
591
    },
592
    'File::Temp' => {
593
        'usage'    => 'Plugins',
594
        'required' => '0',
595
        'min_ver'  => '0.22',
596
    },
597
    'File::Copy' => {
598
        'usage'    => 'Plugins',
599
        'required' => '0',
600
        'min_ver'  => '2.08',
601
    },
602
    'Archive::Extract' => {
603
        'usage'    => 'Plugins',
604
        'required' => '0',
605
        'min_ver'  => '0.60',
606
    },
607
    'Archive::Zip' => {
608
        'usage'    => 'Plugins',
609
        'required' => '0',
610
        'min_ver'  => '1.30',
611
    },
612
    'Module::Load::Conditional' => {
613
        'usage'    => 'Plugins',
614
        'required' => '0',
615
        'min_ver'  => '0.38',
616
    },
617
    'File::Find::Rule' => {
618
        'usage'    => 'Plugins',
619
        'required' => '0',
620
        'min_ver'  => '0.32',
621
    },
622
    'Config::General' => {
623
        'usage'    => 'Plugins',
624
        'required' => '0',
625
        'min_ver'  => '2.48',
626
    },
627
    'File::Spec' => {
628
        'usage'    => 'Plugins',
629
        'required' => '0',
630
        'min_ver'  => '3.30',
631
    },
593
};
632
};
594
633
595
1;
634
1;
(-)a/Koha/Plugins.pm (+189 lines)
Line 0 Link Here
1
package Koha::Plugins;
2
3
# Copyright 2012 Kyle Hall
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 2 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use Modern::Perl;
21
22
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
23
24
use File::Find::Rule;
25
use Config::General qw(ParseConfig);
26
27
use C4::Context;
28
use C4::Output;
29
30
BEGIN {
31
32
    # set the version for version checking
33
    $VERSION = 0.01;
34
    require Exporter;
35
    @ISA    = qw(Exporter);
36
    @EXPORT = qw(
37
      GetPlugins
38
      GetPluginsDir
39
    );
40
41
    push @INC, C4::Context->config("pluginsdir");
42
43
    my $debug = C4::Context->preference("DebugLevel");
44
}
45
46
=head1 NAME
47
48
Koha::Plugins - Module for loading and managing plugins.
49
50
=head1 SYNOPSIS
51
52
  use C4::Plugins;
53
54
=over 2
55
56
=cut
57
58
sub new {
59
    my ( $class, %args ) = @_;
60
    my $self = bless( {}, $class );
61
62
    $self->{'pluginsdir'} = C4::Context->config("pluginsdir");
63
64
    return $self;
65
}
66
67
=item GetPlugins()
68
69
This will return a list of all the available plugins of the passed type.
70
71
Usage: my ( $plugins_hasref, $plugins_count ) = C4::Plugins::GetPlugins( $type );
72
73
At the moment, the available types are 'report' and 'tool'.
74
=cut
75
76
sub GetPlugins {
77
    my $self = shift;
78
79
    my $type         = shift;
80
    my @plugins_conf = $self->_GetPluginConfFiles();
81
    my $version      = C4::Context->preference("Version");
82
83
    my @plugins;
84
    foreach my $plugin_conf (@plugins_conf) {
85
        my $conf = $self->_ParsePluginConf($plugin_conf);
86
87
        $conf->{'base_class'} =
88
          $self->GetBaseClass( conf_path => $plugin_conf );
89
90
        if ( ( defined $type && $conf->{'type'} eq $type )
91
            || !defined $type )
92
        {
93
            if ( $conf->{'minimum_version'} > $version ) {
94
                $conf->{'db_version_too_old'} = 1;
95
            }
96
            if (   $conf->{'maximum_version'}
97
                && $conf->{'maximum_version'} < $version )
98
            {
99
                $conf->{'db_version_too_new'} = 1;
100
            }
101
            push( @plugins, $conf );
102
        }
103
    }
104
105
    @plugins = sort { $a->{name} cmp $b->{name} } @plugins;
106
107
    return @plugins;
108
}
109
110
=item GetPluginsDir()
111
112
Returns the path of the plugins directory.
113
114
=cut
115
116
sub GetPluginsDir {
117
    my $self = shift;
118
    return $self->{'pluginsdir'};
119
}
120
121
=item _GetPluginConfFiles()
122
123
This will return an array of all the conf files for the custom plugins.
124
125
=cut
126
127
sub _GetPluginConfFiles {
128
    my $self = shift;
129
130
    my $plugins_dir = $self->{'pluginsdir'};
131
132
    my @plugins =
133
      File::Find::Rule->file()->name('plugin.conf')->in($plugins_dir);
134
135
    return @plugins;
136
}
137
138
=item _ParsePluginConf( $conf_path )
139
140
This will return a hashref of key/value pairs found in the conf file
141
142
=cut
143
144
sub _ParsePluginConf {
145
    my $self = shift;
146
147
    my $conf_path = shift;
148
149
    my %conf = ParseConfig($conf_path);
150
151
    return \%conf;
152
}
153
154
=item GetBaseClass( $conf_path )
155
156
This will return a base class for the given conf path
157
158
For example, given 
159
160
Koha/Plugins/Org/CCFLS/ExamplePlugin/plugin.conf
161
162
the sub will return
163
164
Koha::Plugins::Org::CCFLS::ExamplePlugin
165
166
=cut
167
168
sub GetBaseClass {
169
    my ( $self, %args ) = @_;
170
    my $conf_path = $args{conf_path};
171
    my ( $volume, $dir, $file ) = File::Spec->splitpath($conf_path);
172
173
    ( undef, $dir ) = split( $self->{'pluginsdir'} . '/', $dir );
174
    my @parts = split( '/', $dir );
175
    my $base = join( '::', @parts );
176
177
    return $base;
178
}
179
180
1;
181
__END__
182
183
=back
184
185
=head1 AUTHOR
186
187
Kyle M Hall <kyle.m.hall@gmail.com>
188
189
=cut
(-)a/Koha/Plugins/Base.pm (+93 lines)
Line 0 Link Here
1
package Koha::Plugins::Base;
2
3
# Copyright 2012 Kyle Hall
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 2 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use Modern::Perl;
21
22
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
23
24
use Module::Load::Conditional qw(can_load);
25
26
use C4::Context;
27
28
BEGIN {
29
30
    # set the version for version checking
31
    $VERSION = 0.01;
32
    require Exporter;
33
    @ISA    = qw(Exporter);
34
    @EXPORT = qw(
35
36
    );
37
38
    push @INC, C4::Context->config("pluginsdir");
39
40
    my $debug = C4::Context->preference("DebugLevel");
41
}
42
43
=head1 NAME
44
45
C4::Plugins::Base - Base Module for running plugins
46
47
=head1 SYNOPSIS
48
49
  use Koha::Plugins::Base;
50
  my $p = Koha::Plugins::Base->new( class => $class );
51
  $p->run();
52
53
=over 2
54
55
=cut
56
57
sub new {
58
    my ( $class, %args ) = @_;
59
    my $self = bless( {}, $class );
60
61
    $self->{'pluginsdir'} = C4::Context->config("pluginsdir");
62
    $self->{'class'} = $args{'class'};
63
64
    return $self;
65
}
66
67
=item run()
68
69
Runs a plugin
70
71
=cut
72
73
sub run {
74
    my ( $self, %args ) = @_;
75
76
    my $class = $self->{'class'};
77
78
    if ( can_load ( modules => { $class } ) ) {
79
        my $plugin = new $class;
80
        $plugin->main();
81
    }
82
}
83
84
1;
85
__END__
86
87
=back
88
89
=head1 AUTHOR
90
91
Kyle M Hall <kyle.m.hall@gmail.com>
92
93
=cut
(-)a/Makefile.PL (-1 / +9 lines)
Lines 230-235 Directory for Apache and Zebra logs produced by Koha. Link Here
230
230
231
Directory for backup files produced by Koha.
231
Directory for backup files produced by Koha.
232
232
233
=item PLUGINS_DIR
234
235
Directory for external Koha plugins.
236
233
=item PAZPAR2_CONF_DIR
237
=item PAZPAR2_CONF_DIR
234
238
235
Directory for PazPar2 configuration files.
239
Directory for PazPar2 configuration files.
Lines 309-314 my $target_map = { Link Here
309
  './skel/var/lib/koha/zebradb/biblios/register'  => { target => 'ZEBRA_DATA_DIR', trimdir => 6 },
313
  './skel/var/lib/koha/zebradb/biblios/register'  => { target => 'ZEBRA_DATA_DIR', trimdir => 6 },
310
  './skel/var/lib/koha/zebradb/biblios/shadow'  => { target => 'ZEBRA_DATA_DIR', trimdir => 6 },
314
  './skel/var/lib/koha/zebradb/biblios/shadow'  => { target => 'ZEBRA_DATA_DIR', trimdir => 6 },
311
  './skel/var/lib/koha/zebradb/biblios/tmp'  => { target => 'ZEBRA_DATA_DIR', trimdir => 6 },
315
  './skel/var/lib/koha/zebradb/biblios/tmp'  => { target => 'ZEBRA_DATA_DIR', trimdir => 6 },
316
  './skel/var/lib/koha/plugins' => { target => 'PLUGINS_DIR', trimdir => 6 },
312
  './sms'                       => 'INTRANET_CGI_DIR',
317
  './sms'                       => 'INTRANET_CGI_DIR',
313
  './suggestion'                => 'INTRANET_CGI_DIR',
318
  './suggestion'                => 'INTRANET_CGI_DIR',
314
  './svc'                       => 'INTRANET_CGI_DIR',
319
  './svc'                       => 'INTRANET_CGI_DIR',
Lines 1234-1239 sub get_target_directories { Link Here
1234
        $dirmap{'ZEBRA_LOCK_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'lock', 'zebradb');
1239
        $dirmap{'ZEBRA_LOCK_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'lock', 'zebradb');
1235
        $dirmap{'LOG_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'log');
1240
        $dirmap{'LOG_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'log');
1236
        $dirmap{'BACKUP_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'spool');
1241
        $dirmap{'BACKUP_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'spool');
1242
        $dirmap{'PLUGINS_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'lib', 'koha', 'plugins');
1237
        $dirmap{'ZEBRA_DATA_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'lib', 'zebradb');
1243
        $dirmap{'ZEBRA_DATA_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'lib', 'zebradb');
1238
        $dirmap{'ZEBRA_RUN_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'run', 'zebradb');
1244
        $dirmap{'ZEBRA_RUN_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'run', 'zebradb');
1239
    } elsif ($mode eq 'dev') {
1245
    } elsif ($mode eq 'dev') {
Lines 1264-1269 sub get_target_directories { Link Here
1264
        $dirmap{'ZEBRA_LOCK_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'lock', 'zebradb');
1270
        $dirmap{'ZEBRA_LOCK_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'lock', 'zebradb');
1265
        $dirmap{'LOG_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'log');
1271
        $dirmap{'LOG_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'log');
1266
        $dirmap{'BACKUP_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'spool');
1272
        $dirmap{'BACKUP_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'spool');
1273
        $dirmap{'PLUGINS_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'lib', 'plugins');
1267
        $dirmap{'ZEBRA_DATA_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'lib', 'zebradb');
1274
        $dirmap{'ZEBRA_DATA_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'lib', 'zebradb');
1268
        $dirmap{'ZEBRA_RUN_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'run', 'zebradb');
1275
        $dirmap{'ZEBRA_RUN_DIR'} =  File::Spec->catdir(@basedir, $package, 'var', 'run', 'zebradb');
1269
    } else {
1276
    } else {
Lines 1286-1291 sub get_target_directories { Link Here
1286
        $dirmap{'ZEBRA_LOCK_DIR'} = File::Spec->catdir(File::Spec->rootdir(), 'var', 'lock', $package, 'zebradb');
1293
        $dirmap{'ZEBRA_LOCK_DIR'} = File::Spec->catdir(File::Spec->rootdir(), 'var', 'lock', $package, 'zebradb');
1287
        $dirmap{'LOG_DIR'} =  File::Spec->catdir(File::Spec->rootdir(), 'var', 'log', $package);
1294
        $dirmap{'LOG_DIR'} =  File::Spec->catdir(File::Spec->rootdir(), 'var', 'log', $package);
1288
        $dirmap{'BACKUP_DIR'} =  File::Spec->catdir(File::Spec->rootdir(), 'var', 'spool', $package);
1295
        $dirmap{'BACKUP_DIR'} =  File::Spec->catdir(File::Spec->rootdir(), 'var', 'spool', $package);
1296
        $dirmap{'PLUGINS_DIR'} =  File::Spec->catdir(File::Spec->rootdir(), 'var', 'lib', $package, 'plugins');
1289
        $dirmap{'ZEBRA_DATA_DIR'} =  File::Spec->catdir(File::Spec->rootdir(), 'var', 'lib', $package, 'zebradb');
1297
        $dirmap{'ZEBRA_DATA_DIR'} =  File::Spec->catdir(File::Spec->rootdir(), 'var', 'lib', $package, 'zebradb');
1290
        $dirmap{'ZEBRA_RUN_DIR'} =  File::Spec->catdir(File::Spec->rootdir(), 'var', 'run', $package, 'zebradb');
1298
        $dirmap{'ZEBRA_RUN_DIR'} =  File::Spec->catdir(File::Spec->rootdir(), 'var', 'run', $package, 'zebradb');
1291
    }
1299
    }
Lines 1557-1563 make_upgrade_backup :: Link Here
1557
\t\$(NOECHO) umask 022; \$(MOD_BACKUP) \\
1565
\t\$(NOECHO) umask 022; \$(MOD_BACKUP) \\
1558
/;
1566
/;
1559
    foreach my $key (qw/KOHA_CONF_DIR INTRANET_TMPL_DIR INTRANET_WWW_DIR OPAC_TMPL_DIR OPAC_WWW_DIR
1567
    foreach my $key (qw/KOHA_CONF_DIR INTRANET_TMPL_DIR INTRANET_WWW_DIR OPAC_TMPL_DIR OPAC_WWW_DIR
1560
                     PAZPAR2_CONF_DIR ZEBRA_CONF_DIR/) {
1568
                     PAZPAR2_CONF_DIR ZEBRA_CONF_DIR PLUGINS_DIR/) {
1561
    	$upgrade .= "\t\t\$(KOHA_INST_$key) \$(KOHA_DEST_$key) \\\n"
1569
    	$upgrade .= "\t\t\$(KOHA_INST_$key) \$(KOHA_DEST_$key) \\\n"
1562
            unless ($config{'INSTALL_ZEBRA'} ne "yes" and $key =~ /ZEBRA/) or
1570
            unless ($config{'INSTALL_ZEBRA'} ne "yes" and $key =~ /ZEBRA/) or
1563
                   exists $skip_directories->{$key} or
1571
                   exists $skip_directories->{$key} or
(-)a/debian/templates/koha-conf-site.xml.in (+1 lines)
Lines 257-262 Link Here
257
 <biblioservershadow>1</biblioservershadow>
257
 <biblioservershadow>1</biblioservershadow>
258
 <authorityserver>authorities</authorityserver>
258
 <authorityserver>authorities</authorityserver>
259
 <authorityservershadow>1</authorityservershadow>
259
 <authorityservershadow>1</authorityservershadow>
260
 <pluginsdir>__PLUGINS_DIR__</pluginsdir>
260
 <intranetdir>/usr/share/koha/intranet/cgi-bin</intranetdir>
261
 <intranetdir>/usr/share/koha/intranet/cgi-bin</intranetdir>
261
 <opacdir>/usr/share/koha/opac/cgi-bin/opac</opacdir>
262
 <opacdir>/usr/share/koha/opac/cgi-bin/opac</opacdir>
262
 <opachtdocs>/usr/share/koha/opac/htdocs/opac-tmpl</opachtdocs>
263
 <opachtdocs>/usr/share/koha/opac/htdocs/opac-tmpl</opachtdocs>
(-)a/etc/koha-conf.xml (+1 lines)
Lines 276-281 __PAZPAR2_TOGGLE_XML_POST__ Link Here
276
 <biblioservershadow>1</biblioservershadow>
276
 <biblioservershadow>1</biblioservershadow>
277
 <authorityserver>authorities</authorityserver>
277
 <authorityserver>authorities</authorityserver>
278
 <authorityservershadow>1</authorityservershadow>
278
 <authorityservershadow>1</authorityservershadow>
279
 <pluginsdir>__PLUGINS_DIR__</pluginsdir>
279
 <intranetdir>__INTRANET_CGI_DIR__</intranetdir>
280
 <intranetdir>__INTRANET_CGI_DIR__</intranetdir>
280
 <opacdir>__OPAC_CGI_DIR__/opac</opacdir>
281
 <opacdir>__OPAC_CGI_DIR__/opac</opacdir>
281
 <opachtdocs>__OPAC_TMPL_DIR__</opachtdocs>
282
 <opachtdocs>__OPAC_TMPL_DIR__</opachtdocs>
(-)a/install_misc/debian.packages (+1 lines)
Lines 115-117 make install Link Here
115
mysql-server install
115
mysql-server install
116
yaz-doc	install
116
yaz-doc	install
117
yaz	install
117
yaz	install
118
libconfig-simple-perl install
(-)a/install_misc/ubuntu.packages (+1 lines)
Lines 132-134 libxml-simple-perl install Link Here
132
libxml-xslt-perl			install
132
libxml-xslt-perl			install
133
libyaml-perl				install
133
libyaml-perl				install
134
libyaml-syck-perl			install
134
libyaml-syck-perl			install
135
libconfig-simple-perl                   install
(-)a/install_misc/ubuntu_maverick.packages (+1 lines)
Lines 127-129 libxml-simple-perl install Link Here
127
libxml-xslt-perl			install
127
libxml-xslt-perl			install
128
libyaml-perl				install
128
libyaml-perl				install
129
libyaml-syck-perl			install
129
libyaml-syck-perl			install
130
libconfig-simple-perl                   install
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 374-376 INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ( Link Here
374
INSERT INTO systempreferences (variable,value,explanation,type) VALUES('EnableBorrowerFiles','0','If enabled, allows librarians to upload and attach arbitrary files to a borrower record.','YesNo');
374
INSERT INTO systempreferences (variable,value,explanation,type) VALUES('EnableBorrowerFiles','0','If enabled, allows librarians to upload and attach arbitrary files to a borrower record.','YesNo');
375
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UpdateTotalIssuesOnCirc','0','Whether to update the totalissues field in the biblio on each circ.',NULL,'YesNo');
375
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UpdateTotalIssuesOnCirc','0','Whether to update the totalissues field in the biblio on each circ.',NULL,'YesNo');
376
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('IntranetSlipPrinterJS','','Use this JavaScript for printing slips. Define at least function printThenClose(). For use e.g. with Firefox PlugIn jsPrintSetup, see http://jsprintsetup.mozdev.org/','','Free');
376
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('IntranetSlipPrinterJS','','Use this JavaScript for printing slips. Define at least function printThenClose(). For use e.g. with Firefox PlugIn jsPrintSetup, see http://jsprintsetup.mozdev.org/','','Free');
377
INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UseKohaPlugins','1','Enable or disable the ability to use Koha Plugins.','','YesNo');
(-)a/installer/data/mysql/updatedatabase.pl (+10 lines)
Lines 5635-5640 if(C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
5635
    SetVersion($DBversion);
5635
    SetVersion($DBversion);
5636
}
5636
}
5637
5637
5638
$DBversion = "3.09.00.XXX";
5639
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
5640
    $dbh->do("INSERT INTO userflags (bit, flag, flagdesc, defaulton) VALUES ('19', 'plugins', 'Koha Plugins', '0')");
5641
    $dbh->do("INSERT INTO permissions (module_bit, code, description) VALUES ('19', 'manage', 'Manage Plugins'), ('19', 'tools', 'Use Tool Plugins'), ('19', 'reports', 'Use Report Plugins')");
5642
    $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UseKohaPlugins','1','Enable or disable the ability to use Koha Plugins.','','YesNo')");
5643
5644
    print "Upgrade to $DBversion done (Added plugin system.)\n";
5645
    SetVersion($DBversion);
5646
}
5647
5638
=head1 FUNCTIONS
5648
=head1 FUNCTIONS
5639
5649
5640
=head2 TableExists($table)
5650
=head2 TableExists($table)
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc (+3 lines)
Lines 34-39 Link Here
34
                            [% IF ( CAN_user_tools ) %]
34
                            [% IF ( CAN_user_tools ) %]
35
                            <li><a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a></li>
35
                            <li><a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a></li>
36
                            [% END %]
36
                            [% END %]
37
                            [% IF ( UseKohaPlugins && CAN_user_plugins ) %]
38
                            <li><a href="/cgi-bin/koha/plugins/plugins-home.pl">Plugins</a></li>
39
                            [% END %]
37
                            [% IF ( CAN_user_parameters ) %]
40
                            [% IF ( CAN_user_parameters ) %]
38
                            <li><a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a></li>
41
                            <li><a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a></li>
39
                            [% END %]
42
                            [% END %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref (+7 lines)
Lines 336-338 Enhanced Content: Link Here
336
                  yes: Allow
336
                  yes: Allow
337
                  no: "Don't allow"
337
                  no: "Don't allow"
338
            - multiple images to be attached to each bibliographic record.
338
            - multiple images to be attached to each bibliographic record.
339
    Plugins:
340
        -
341
            - pref: UseKohaPlugins
342
              choices:
343
                  yes: Enable
344
                  no: "Don't enable"
345
            - the ability to use Koha Plugins.
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/plugins/plugins-home.tt (+77 lines)
Line 0 Link Here
1
[% USE KohaDates %]
2
[% INCLUDE 'doc-head-open.inc' %]
3
<title>Koha &rsaquo; Tools &rsaquo; Plugins </title>
4
[% INCLUDE 'doc-head-close.inc' %]
5
[% INCLUDE 'calendar.inc' %]
6
</head>
7
8
<body>
9
[% INCLUDE 'header.inc' %]
10
[% INCLUDE 'circ-search.inc' %]
11
12
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a>
13
&rsaquo; Plugins
14
</div>
15
16
<div id="doc3" class="yui-t1">
17
        <div id="bd">
18
                <div id="yui-main">
19
                        <div class="yui-b">
20
                                <div class="details">
21
                                        <h1>Plugins</h1>
22
23
                                        [% IF ( ERROR_NO_PLUGINS ) %]
24
                                                <h2>No Plugins Exist.</h2>
25
                                                <p>Please upload one or more Koha Plugin files (.kpz) before using.</p>
26
                                        [% ELSE %]
27
                                                <table>
28
                                                        <tr>
29
                                                                <th>Name</th>
30
                                                                <th>Type</th>
31
                                                                <th>Description</th>
32
                                                                <th>Author</th>
33
                                                                <th>Plugin Version</th>
34
                                                                <th>Minimum Koha Version</th>
35
                                                                <th>Maximum Koha Version</th>
36
                                                                <th>Last Updated</th>
37
                                                        </tr>
38
39
                                                        [% FOREACH plugin IN plugins %]
40
                                                                <tr>
41
                                                                        <td><a href="/cgi-bin/koha/plugins/run.pl?base_class=[% plugin.base_class %]">[% plugin.name %]</a></td>
42
                                                                        <td>[% plugin.type %]</td>
43
                                                                        <td>
44
                                                                                [% plugin.description %]
45
46
                                                                                [% IF ( plugin.db_version_too_old ) %]
47
                                                                                        <div class="error">Warning: This report was written for a newer version of Koha. Run at your own risk.</div>
48
                                                                                [% END %]
49
50
                                                                                [% IF ( plugin.db_version_too_new ) %]
51
                                                                                        <div class="error">Warning: This report was written for an older version of Koha. Run at your own risk.</div>
52
                                                                                [% END %]
53
                                                                        </td>
54
                                                                        <td>[% plugin.author %]</td>
55
                                                                        <td>[% plugin.version %]</td>
56
                                                                        <td>[% plugin.minimum_version %]</td>
57
                                                                        <td>[% plugin.maximum_version %]</td>
58
                                                                        <td>[% plugin.date_updated | $KohaDates %]</td>
59
                                                        [% END %]
60
                                                </table>
61
                                        [% END %]
62
                                </div>
63
                        </div>
64
                </div>
65
66
                <div class="yui-b noprint">
67
                        <div id="navmenu">
68
                                <ul id="navmenulist">
69
                                        <li><a href="plugins-upload.pl">Upload A Plugin</a></li>
70
                                </ul>
71
                        </div>
72
                </div>
73
        </div>
74
</div>
75
76
77
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/plugins/plugins-upload.tt (+55 lines)
Line 0 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Tools &rsaquo; Plugins &rsaquo; Upload Plugin
3
 </title>
4
[% INCLUDE 'doc-head-close.inc' %]
5
[% INCLUDE 'calendar.inc' %]
6
</head>
7
8
<body>
9
[% INCLUDE 'header.inc' %]
10
[% INCLUDE 'circ-search.inc' %]
11
12
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a>
13
&rsaquo; <a href="/cgi-bin/koha/plugins/plugins-home.pl">Plugins</a>
14
&rsaquo; Upload Plugins
15
</div>
16
17
<div id="doc3" class="yui-t2">
18
    <div id="bd">
19
        <div id="yui-main">
20
    <div class="yui-b">
21
        <div class="yui-g">
22
            <div class="yui-u first">
23
                <h1>Upload Koha Plugin</h1>
24
                [% IF ( ERRORS ) %]
25
                <div class="dialog alert">
26
                    [% FOREACH ERROR IN ERRORS %]
27
                        [% IF ( ERROR.NOTKPZ ) %]<li><b>The upload file does not appear to be a kpz file.  The extention is not '.kpz'.</b></li>
28
                        [% ELSIF ( ERROR.NOWRITETEMP ) %]<li><b>This script is not able to create/write to the necessary temporary directory.</b></li>
29
                        [% ELSIF ( ERROR.EMPTYUPLOAD ) %]<li><b>The upload file appears to be empty.</b></li>
30
                        [% ELSIF ( ERROR.UZIPFAIL ) %]<li><b>[% ERROR.UZIPFAIL %] failed to unpack.<br />Please verify the integrity of the zip file and retry.</b></li>
31
                        [% ELSIF ( ERROR.NOWRITEPLUGINS ) %]<li><b>Cannot unpack file to the plugins directory.<br />Please verify that the Apache user can write to the plugins directory.</b></li>
32
                        [% ELSE %]<li><b>[% ERROR.CORERR %] An unknown error has occurred.<br />Please review the error log for more details.</b></li>[% END %]
33
                    [% END %]
34
                </div>
35
                [% END %]
36
                <form method="post" action="/cgi-bin/koha/plugins/plugins-upload.pl" enctype="multipart/form-data">
37
                    <fieldset class="brief">
38
                         <div class="hint"><b>NOTE:</b> Only KPZ file format is supported.</div>
39
                        <ol>
40
                            <li>
41
                                <label for="uploadfile">Select the file to upload: </label><input type="file" id="uploadfile" name="uploadfile" />
42
                            </li>
43
                        </ol>
44
                    </fieldset>
45
                    <fieldset class="action">
46
                        <input type="hidden" name="op" value="Upload" />
47
                        <input type="submit" value="Upload" class="submit" />
48
                    </fieldset>
49
                </form>
50
51
            </div>
52
        </div>
53
    </div>
54
</div>
55
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/report-plugins.tt (+54 lines)
Line 0 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Reports &rsaquo; Report Plugins </title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'calendar.inc' %]
5
</head>
6
7
<body>
8
[% INCLUDE 'header.inc' %]
9
[% INCLUDE 'circ-search.inc' %]
10
11
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a>
12
&rsaquo; <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a>
13
&rsaquo; Plugins
14
</div>
15
16
<div id="doc3" class="yui-t1">
17
        <div id="bd">
18
                <div id="yui-main">
19
                        <div class="details">
20
                                <h1>Report Plugins</h1>
21
22
                                [% IF ( ERROR_NO_REPORTS ) %]
23
                                        <h2>No Report Plugins Exist.</h2>
24
                                [% ELSE %]
25
                                        <table>
26
                                                <tr>
27
                                                        <th>Name</th>
28
                                                        <th>Description</th>
29
                                                        <th>Author</th>
30
                                                        <th>Last Update</th>
31
                                                </tr>
32
33
                                                [% FOREACH REPORTS_LOO IN REPORTS_LOOP %]
34
                                                        <tr>
35
                                                                <td><a href="/cgi-bin/koha/plugins/run/[% REPORTS_LOO.start %]">[% REPORTS_LOO.name %]</a></td>
36
                                                                <td>
37
                                                                        [% REPORTS_LOO.description %]
38
                                                                        [% IF ( REPORTS_LOO.db_version_too_old ) %]
39
                                                                                <div class="error">Warning: This report was written for a newer version of Koha. Run at your own risk.</div>
40
                                                                        [% END %]
41
                                                                </td>
42
                                                                <td>[% REPORTS_LOO.author %]</td>
43
                                                                <td>[% REPORTS_LOO.date_updated %]</td>
44
                                                [% END %]
45
                                        </table>
46
                                [% END %]
47
                        </div>
48
                </div>
49
        </div>
50
</div>
51
52
53
54
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reports-home.tt (-1 / +10 lines)
Lines 35-41 Link Here
35
		<li><a href="/cgi-bin/koha/reports/issues_stats.pl">Circulation</a></li>
35
		<li><a href="/cgi-bin/koha/reports/issues_stats.pl">Circulation</a></li>
36
		<li><a href="/cgi-bin/koha/reports/serials_stats.pl">Serials</a></li>
36
		<li><a href="/cgi-bin/koha/reports/serials_stats.pl">Serials</a></li>
37
		<li><a href="/cgi-bin/koha/reports/reserves_stats.pl">Holds</a></li>
37
		<li><a href="/cgi-bin/koha/reports/reserves_stats.pl">Holds</a></li>
38
	</ul></div>
38
	</ul>
39
40
        [% IF UseKohaPlugins %]
41
        <h2>Report Plugins</h2>
42
        <ul>
43
                <li><a href="/cgi-bin/koha/reports/report-plugins.pl">View Report Plugins</a></li>
44
        </ul>
45
        [% END %]
46
47
    </div>
39
48
40
    <div class="yui-u"><h2>Top lists</h2>
49
    <div class="yui-u"><h2>Top lists</h2>
41
	<ul>
50
	<ul>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tool-plugins.tt (+54 lines)
Line 0 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Koha &rsaquo; Tools &rsaquo; Tool Plugins </title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
[% INCLUDE 'calendar.inc' %]
5
</head>
6
7
<body>
8
[% INCLUDE 'header.inc' %]
9
[% INCLUDE 'circ-search.inc' %]
10
11
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a>
12
&rsaquo; <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a>
13
&rsaquo; Plugins
14
</div>
15
16
<div id="doc3" class="yui-t1">
17
        <div id="bd">
18
                <div id="yui-main">
19
                        <div class="details">
20
                                <h1>Tool Plugins</h1>
21
22
                                [% IF ( ERROR_NO_TOOLS ) %]
23
                                        <h2>No Tool Plugins Exist.</h2>
24
                                [% ELSE %]
25
                                        <table>
26
                                                <tr>
27
                                                        <th>Name</th>
28
                                                        <th>Description</th>
29
                                                        <th>Author</th>
30
                                                        <th>Last Update</th>
31
                                                </tr>
32
33
                                                [% FOREACH TOOLS_LOO IN TOOLS_LOOP %]
34
                                                        <tr>
35
                                                                <td><a href="/cgi-bin/koha/plugins/run/[% TOOLS_LOO.start %]">[% TOOLS_LOO.name %]</a></td>
36
                                                                <td>
37
                                                                        [% TOOLS_LOO.description %]
38
                                                                        [% IF ( TOOLS_LOO.db_version_too_old ) %]
39
                                                                                <div class="error">Warning: This report was written for a newer version of Koha. Run at your own risk.</div>
40
                                                                        [% END %]
41
                                                                </td>
42
                                                                <td>[% TOOLS_LOO.author %]</td>
43
                                                                <td>[% TOOLS_LOO.date_updated %]</td>
44
                                                [% END %]
45
                                        </table>
46
                                [% END %]
47
                        </div>
48
                </div>
49
        </div>
50
</div>
51
52
53
54
[% INCLUDE 'intranet-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt (+4 lines)
Lines 95-100 Link Here
95
    [% IF ( CAN_user_tools_edit_quotes ) %]
95
    [% IF ( CAN_user_tools_edit_quotes ) %]
96
    <dt><a href="/cgi-bin/koha/tools/quotes.pl">Edit quotes for QOTD feature</a></dt>
96
    <dt><a href="/cgi-bin/koha/tools/quotes.pl">Edit quotes for QOTD feature</a></dt>
97
    <dd>Quote editor for Quote-of-the-day feature in OPAC</dd>
97
    <dd>Quote editor for Quote-of-the-day feature in OPAC</dd>
98
99
    [% IF ( UseKohaPlugins && CAN_user_plugins_tools ) %]
100
    <dt><a href="/cgi-bin/koha/tools/tool-plugins.pl">Tool Plugins</a></dt>
101
    <dd>Schedule tasks to run</dd>
98
    [% END %]
102
    [% END %]
99
103
100
</dl>
104
</dl>
(-)a/plugins/plugins-home.pl (+56 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# Copyright 2010 Kyle M Hall <kyle.m.hall@gmail.com>
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 2 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use strict;
21
use warnings;
22
23
use CGI;
24
25
use Koha::Plugins;
26
use C4::Auth;
27
use C4::Output;
28
use C4::Dates;
29
use C4::Debug;
30
use C4::Context;
31
32
die("Koha plugins are disabled!")
33
  unless C4::Context->preference('UseKohaPlugins');
34
35
my $input = new CGI;
36
37
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
38
    {
39
        template_name   => "plugins/plugins-home.tmpl",
40
        query           => $input,
41
        type            => "intranet",
42
        authnotrequired => 0,
43
        flagsrequired   => { plugins => "manage" },
44
        debug           => 1,
45
    }
46
);
47
48
my @plugins = Koha::Plugins->new()->GetPlugins();
49
50
$template->param( plugins => \@plugins );
51
52
unless ( @plugins ) {
53
    $template->param( ERROR_NO_PLUGINS => 1 );
54
}
55
56
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/plugins/plugins-upload.pl (+102 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
#
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it under the
6
# terms of the GNU General Public License as published by the Free Software
7
# Foundation; either version 2 of the License, or (at your option) any later
8
# version.
9
#
10
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
11
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13
#
14
# You should have received a copy of the GNU General Public License along
15
# with Koha; if not, write to the Free Software Foundation, Inc.,
16
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17
18
use strict;
19
use warnings;
20
21
use Archive::Extract;
22
use File::Temp;
23
use File::Copy;
24
use CGI;
25
26
use C4::Context;
27
use C4::Auth;
28
use C4::Output;
29
use C4::Members;
30
use C4::Debug;
31
use Koha::Plugins;
32
33
die("Koha plugins are disabled!")
34
  unless C4::Context->preference('UseKohaPlugins');
35
36
my $input = new CGI;
37
38
my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
39
    {
40
        template_name   => "plugins/plugins-upload.tmpl",
41
        query           => $input,
42
        type            => "intranet",
43
        authnotrequired => 0,
44
        flagsrequired   => { plugins => 'manage' },
45
        debug           => 1,
46
    }
47
);
48
49
my $uploadfilename = $input->param('uploadfile');
50
my $uploadfile     = $input->upload('uploadfile');
51
my $op             = $input->param('op');
52
53
my ( $total, $handled, @counts, $tempfile, $tfh );
54
55
my %errors;
56
57
if ( ( $op eq 'Upload' ) && $uploadfile ) {
58
    my $plugins_dir = Koha::Plugins->new()->GetPluginsDir();
59
60
    my $dirname = File::Temp::tempdir( CLEANUP => 1 );
61
    $debug and warn "dirname = $dirname";
62
63
    my $filesuffix = $1 if $uploadfilename =~ m/(\..+)$/i;
64
    ( $tfh, $tempfile ) =
65
      File::Temp::tempfile( SUFFIX => $filesuffix, UNLINK => 1 );
66
67
    $debug and warn "tempfile = $tempfile";
68
69
    $errors{'NOTKPZ'} = 1 if ( $uploadfilename !~ /\.kpz$/i );
70
    $errors{'NOWRITETEMP'}    = 1 unless ( -w $dirname );
71
    $errors{'NOWRITEPLUGINS'} = 1 unless ( -w $plugins_dir );
72
    $errors{'EMPTYUPLOAD'}    = 1 unless ( length($uploadfile) > 0 );
73
74
    if (%errors) {
75
        $template->param( ERRORS => [ \%errors ] );
76
    }
77
    else {
78
        while (<$uploadfile>) {
79
            print $tfh $_;
80
        }
81
        close $tfh;
82
83
        my $ae = Archive::Extract->new( archive => $tempfile, type => 'zip' );
84
        unless ( $ae->extract( to => $plugins_dir ) ) {
85
            warn "ERROR: " . $ae->error;
86
            $errors{'UZIPFAIL'} = $uploadfilename;
87
            $template->param( ERRORS => [ \%errors ] );
88
            output_html_with_http_headers $input, $cookie, $template->output;
89
            exit;
90
        }
91
    }
92
}
93
elsif ( ( $op eq 'Upload' ) && !$uploadfile ) {
94
    warn "Problem uploading file or no file uploaded.";
95
}
96
97
if ( $uploadfile && !%errors && !$template->param('ERRORS') ) {
98
    print $input->redirect("/cgi-bin/koha/plugins/plugins-home.pl");
99
}
100
else {
101
    output_html_with_http_headers $input, $cookie, $template->output;
102
}
(-)a/plugins/run.pl (+50 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# Copyright 2010 Kyle M Hall <kyle.m.hall@gmail.com>
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 2 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use strict;
21
use warnings;
22
23
use CGI;
24
25
use Koha::Plugins::Base;
26
use C4::Auth;
27
use C4::Output;
28
use C4::Dates;
29
use C4::Debug;
30
use C4::Context;
31
32
die("Koha plugins are disabled!")
33
  unless C4::Context->preference('UseKohaPlugins');
34
35
my $cgi = new CGI;
36
37
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
38
    {
39
        template_name   => "plugins/plugins-home.tmpl",
40
        query           => $cgi,
41
        type            => "intranet",
42
        authnotrequired => 0,
43
        flagsrequired   => { plugins => "reports" },
44
        debug           => 1,
45
    }
46
);
47
48
my $plugin_class = $cgi->param('base_class') . "::Start";
49
my $plugin = Koha::Plugins::Base->new( class => $plugin_class );
50
$plugin->run();
(-)a/reports/report-plugins.pl (+52 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# Copyright 2010 Kyle M Hall <kyle.m.hall@gmail.com>
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 2 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use strict;
21
use warnings;
22
23
use CGI;
24
25
use C4::Plugins;
26
use C4::Auth;
27
use C4::Output;
28
use C4::Dates;
29
use C4::Debug;
30
31
my $input = new CGI;
32
33
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
34
    {
35
        template_name   => "reports/report-plugins.tmpl",
36
        query           => $input,
37
        type            => "intranet",
38
        authnotrequired => 0,
39
        flagsrequired   => { plugins => "reports" },
40
        debug           => 1,
41
    }
42
);
43
44
my ( $reports_loop, $reports_count ) = GetPlugins('report');
45
46
$template->param( REPORTS_LOOP => $reports_loop );
47
48
unless ($reports_count) {
49
    $template->param( ERROR_NO_REPORTS => 1 );
50
}
51
52
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/rewrite-config.PL (-1 / +2 lines)
Lines 43-49 guesses worked out by the script. Link Here
43
The following configuration keywords are available:
43
The following configuration keywords are available:
44
44
45
PREFIX,
45
PREFIX,
46
BASE_DIR, CGI_DIR, LOG_DIR, INSTALL_BASE,
46
BASE_DIR, CGI_DIR, LOG_DIR, PLUGINS_DIR, INSTALL_BASE,
47
DB_TYPE, DB_HOST, DB_PORT, DB_NAME, DB_PASS, DB_USER, WEBMASTER_EMAIL, WEBSERVER_DOMAIN,
47
DB_TYPE, DB_HOST, DB_PORT, DB_NAME, DB_PASS, DB_USER, WEBMASTER_EMAIL, WEBSERVER_DOMAIN,
48
WEBSERVER_HOST, WEBSERVER_IP, WEBSERVER_PORT, WEBSERVER_PORT_LIBRARIAN, ZEBRA_PASS, ZEBRA_USER
48
WEBSERVER_HOST, WEBSERVER_IP, WEBSERVER_PORT, WEBSERVER_PORT_LIBRARIAN, ZEBRA_PASS, ZEBRA_USER
49
49
Lines 82-87 $prefix = $ENV{'INSTALL_BASE'} || "/usr"; Link Here
82
%configuration = (
82
%configuration = (
83
  "__KOHA_INSTALLED_VERSION__" => "no_version_found",
83
  "__KOHA_INSTALLED_VERSION__" => "no_version_found",
84
  "__LOG_DIR__" => "/var/log",
84
  "__LOG_DIR__" => "/var/log",
85
  "__PLUGINS_DIR__" => "/var/lib/koha/plugins",
85
  "__DB_TYPE__" => "mysql",
86
  "__DB_TYPE__" => "mysql",
86
  "__DB_NAME__" => "koha",
87
  "__DB_NAME__" => "koha",
87
  "__DB_HOST__" => $myhost,
88
  "__DB_HOST__" => $myhost,
(-)a/skel/var/lib/koha/plugins/.htaccess (+2 lines)
Line 0 Link Here
1
AddHandler cgi-script .pl
2
AddHandler send-as-is .css .js .gif .jpg
(-)a/skel/var/lib/koha/plugins/README (+1 lines)
Line 0 Link Here
1
plugins dir
(-)a/tools/tool-plugins.pl (-1 / +52 lines)
Line 0 Link Here
0
- 
1
#!/usr/bin/perl
2
3
# Copyright 2010 Kyle M Hall <kyle.m.hall@gmail.com>
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it under the
8
# terms of the GNU General Public License as published by the Free Software
9
# Foundation; either version 2 of the License, or (at your option) any later
10
# version.
11
#
12
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14
# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License along
17
# with Koha; if not, write to the Free Software Foundation, Inc.,
18
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20
use strict;
21
use warnings;
22
23
use CGI;
24
25
use C4::Plugins;
26
use C4::Auth;
27
use C4::Output;
28
use C4::Dates;
29
use C4::Debug;
30
31
my $input = new CGI;
32
33
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
34
    {
35
        template_name   => "tools/tool-plugins.tmpl",
36
        query           => $input,
37
        type            => "intranet",
38
        authnotrequired => 0,
39
        flagsrequired   => { plugins => "tools" },
40
        debug           => 1,
41
    }
42
);
43
44
my ( $reports_loop, $reports_count ) = GetPlugins('tool');
45
46
$template->param( TOOLS_LOOP => $reports_loop );
47
48
unless ($reports_count) {
49
    $template->param( ERROR_NO_TOOLS => 1 );
50
}
51
52
output_html_with_http_headers $input, $cookie, $template->output;

Return to bug 7804