Bugzilla – Attachment 11606 Details for
Bug 7804
Add Koha Plugin System
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Koha Plugins
Koha-Plugins.patch (text/plain), 47.68 KB, created by
Kyle M Hall (khall)
on 2012-08-14 14:24:38 UTC
(
hide
)
Description:
Koha Plugins
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2012-08-14 14:24:38 UTC
Size:
47.68 KB
patch
obsolete
>From 2c79d43444af5e772dd69fa7582713fe8608e197 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle.m.hall@gmail.com> >Date: Fri, 22 Jan 2010 16:34:52 +0000 >Subject: [PATCH] Koha Plugins > >Adds support for custom plugins. At the moment the Plugins >feature supports two types of plugins, reports and tools. > >Plugins are installed by uploading KPZ ( Koha Plugin Zip ) >packages. A KPZ file is just a zip file containing a >plugin.ini file describing the plugin, as well as the >perl file, template files, and any other files neccessary >to make the plugin work. > >http://bugs.koha-community.org/show_bug.cgi?id=7804 >--- > C4/Auth.pm | 2 + > C4/Installer/PerlDependencies.pm | 41 ++++- > Koha/Plugins.pm | 189 ++++++++++++++++++++ > Koha/Plugins/Base.pm | 93 ++++++++++ > Makefile.PL | 10 +- > debian/templates/koha-conf-site.xml.in | 1 + > etc/koha-conf.xml | 1 + > install_misc/debian.packages | 1 + > install_misc/ubuntu.packages | 1 + > install_misc/ubuntu_maverick.packages | 1 + > installer/data/mysql/sysprefs.sql | 1 + > installer/data/mysql/updatedatabase.pl | 10 + > .../intranet-tmpl/prog/en/includes/header.inc | 3 + > .../admin/preferences/enhanced_content.pref | 7 + > .../prog/en/modules/plugins/plugins-home.tt | 77 ++++++++ > .../prog/en/modules/plugins/plugins-upload.tt | 55 ++++++ > .../prog/en/modules/reports/report-plugins.tt | 54 ++++++ > .../prog/en/modules/reports/reports-home.tt | 11 +- > .../prog/en/modules/tools/tool-plugins.tt | 54 ++++++ > .../prog/en/modules/tools/tools-home.tt | 4 + > plugins/plugins-home.pl | 56 ++++++ > plugins/plugins-upload.pl | 102 +++++++++++ > plugins/run.pl | 50 +++++ > reports/report-plugins.pl | 52 ++++++ > rewrite-config.PL | 3 +- > skel/var/lib/koha/plugins/.htaccess | 2 + > skel/var/lib/koha/plugins/README | 1 + > tools/tool-plugins.pl | 52 ++++++ > 28 files changed, 930 insertions(+), 4 deletions(-) > create mode 100644 Koha/Plugins.pm > create mode 100644 Koha/Plugins/Base.pm > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/plugins/plugins-home.tt > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/plugins/plugins-upload.tt > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/reports/report-plugins.tt > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/tools/tool-plugins.tt > create mode 100755 plugins/plugins-home.pl > create mode 100755 plugins/plugins-upload.pl > create mode 100755 plugins/run.pl > create mode 100755 reports/report-plugins.pl > create mode 100644 skel/var/lib/koha/plugins/.htaccess > create mode 100644 skel/var/lib/koha/plugins/README > create mode 100755 tools/tool-plugins.pl > >diff --git a/C4/Auth.pm b/C4/Auth.pm >index f9b15ef..2e8c251 100644 >--- a/C4/Auth.pm >+++ b/C4/Auth.pm >@@ -202,6 +202,7 @@ sub get_template_and_user { > $template->param( CAN_user_serials => 1 ); > $template->param( CAN_user_reports => 1 ); > $template->param( CAN_user_staffaccess => 1 ); >+ $template->param( CAN_user_plugins => 1 ); > foreach my $module (keys %$all_perms) { > foreach my $subperm (keys %{ $all_perms->{$module} }) { > $template->param( "CAN_user_${module}_${subperm}" => 1 ); >@@ -366,6 +367,7 @@ sub get_template_and_user { > OPACLocalCoverImages => C4::Context->preference('OPACLocalCoverImages'), > AllowMultipleCovers => C4::Context->preference('AllowMultipleCovers'), > EnableBorrowerFiles => C4::Context->preference('EnableBorrowerFiles'), >+ UseKohaPlugins => C4::Context->preference('UseKohaPlugins'), > ); > } > else { >diff --git a/C4/Installer/PerlDependencies.pm b/C4/Installer/PerlDependencies.pm >index a9c68a8..3f738a7 100644 >--- a/C4/Installer/PerlDependencies.pm >+++ b/C4/Installer/PerlDependencies.pm >@@ -578,7 +578,6 @@ our $PERL_DEPS = { > 'usage' => 'Core', > 'required' => '0', > 'min_ver' => '0.14', >- > }, > 'Text::Unaccent' => { > 'usage' => 'Core', >@@ -590,6 +589,46 @@ our $PERL_DEPS = { > 'required' => '1', > 'min_ver' => '1.23', > }, >+ 'File::Temp' => { >+ 'usage' => 'Plugins', >+ 'required' => '0', >+ 'min_ver' => '0.22', >+ }, >+ 'File::Copy' => { >+ 'usage' => 'Plugins', >+ 'required' => '0', >+ 'min_ver' => '2.08', >+ }, >+ 'Archive::Extract' => { >+ 'usage' => 'Plugins', >+ 'required' => '0', >+ 'min_ver' => '0.60', >+ }, >+ 'Archive::Zip' => { >+ 'usage' => 'Plugins', >+ 'required' => '0', >+ 'min_ver' => '1.30', >+ }, >+ 'Module::Load::Conditional' => { >+ 'usage' => 'Plugins', >+ 'required' => '0', >+ 'min_ver' => '0.38', >+ }, >+ 'File::Find::Rule' => { >+ 'usage' => 'Plugins', >+ 'required' => '0', >+ 'min_ver' => '0.32', >+ }, >+ 'Config::General' => { >+ 'usage' => 'Plugins', >+ 'required' => '0', >+ 'min_ver' => '2.48', >+ }, >+ 'File::Spec' => { >+ 'usage' => 'Plugins', >+ 'required' => '0', >+ 'min_ver' => '3.30', >+ }, > }; > > 1; >diff --git a/Koha/Plugins.pm b/Koha/Plugins.pm >new file mode 100644 >index 0000000..794d574 >--- /dev/null >+++ b/Koha/Plugins.pm >@@ -0,0 +1,189 @@ >+package Koha::Plugins; >+ >+# Copyright 2012 Kyle Hall >+# >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it under the >+# terms of the GNU General Public License as published by the Free Software >+# Foundation; either version 2 of the License, or (at your option) any later >+# version. >+# >+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY >+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR >+# A PARTICULAR PURPOSE. See the GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License along >+# with Koha; if not, write to the Free Software Foundation, Inc., >+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+ >+use Modern::Perl; >+ >+use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); >+ >+use File::Find::Rule; >+use Config::General qw(ParseConfig); >+ >+use C4::Context; >+use C4::Output; >+ >+BEGIN { >+ >+ # set the version for version checking >+ $VERSION = 0.01; >+ require Exporter; >+ @ISA = qw(Exporter); >+ @EXPORT = qw( >+ GetPlugins >+ GetPluginsDir >+ ); >+ >+ push @INC, C4::Context->config("pluginsdir"); >+ >+ my $debug = C4::Context->preference("DebugLevel"); >+} >+ >+=head1 NAME >+ >+Koha::Plugins - Module for loading and managing plugins. >+ >+=head1 SYNOPSIS >+ >+ use C4::Plugins; >+ >+=over 2 >+ >+=cut >+ >+sub new { >+ my ( $class, %args ) = @_; >+ my $self = bless( {}, $class ); >+ >+ $self->{'pluginsdir'} = C4::Context->config("pluginsdir"); >+ >+ return $self; >+} >+ >+=item GetPlugins() >+ >+This will return a list of all the available plugins of the passed type. >+ >+Usage: my ( $plugins_hasref, $plugins_count ) = C4::Plugins::GetPlugins( $type ); >+ >+At the moment, the available types are 'report' and 'tool'. >+=cut >+ >+sub GetPlugins { >+ my $self = shift; >+ >+ my $type = shift; >+ my @plugins_conf = $self->_GetPluginConfFiles(); >+ my $version = C4::Context->preference("Version"); >+ >+ my @plugins; >+ foreach my $plugin_conf (@plugins_conf) { >+ my $conf = $self->_ParsePluginConf($plugin_conf); >+ >+ $conf->{'base_class'} = >+ $self->GetBaseClass( conf_path => $plugin_conf ); >+ >+ if ( ( defined $type && $conf->{'type'} eq $type ) >+ || !defined $type ) >+ { >+ if ( $conf->{'minimum_version'} > $version ) { >+ $conf->{'db_version_too_old'} = 1; >+ } >+ if ( $conf->{'maximum_version'} >+ && $conf->{'maximum_version'} < $version ) >+ { >+ $conf->{'db_version_too_new'} = 1; >+ } >+ push( @plugins, $conf ); >+ } >+ } >+ >+ @plugins = sort { $a->{name} cmp $b->{name} } @plugins; >+ >+ return @plugins; >+} >+ >+=item GetPluginsDir() >+ >+Returns the path of the plugins directory. >+ >+=cut >+ >+sub GetPluginsDir { >+ my $self = shift; >+ return $self->{'pluginsdir'}; >+} >+ >+=item _GetPluginConfFiles() >+ >+This will return an array of all the conf files for the custom plugins. >+ >+=cut >+ >+sub _GetPluginConfFiles { >+ my $self = shift; >+ >+ my $plugins_dir = $self->{'pluginsdir'}; >+ >+ my @plugins = >+ File::Find::Rule->file()->name('plugin.conf')->in($plugins_dir); >+ >+ return @plugins; >+} >+ >+=item _ParsePluginConf( $conf_path ) >+ >+This will return a hashref of key/value pairs found in the conf file >+ >+=cut >+ >+sub _ParsePluginConf { >+ my $self = shift; >+ >+ my $conf_path = shift; >+ >+ my %conf = ParseConfig($conf_path); >+ >+ return \%conf; >+} >+ >+=item GetBaseClass( $conf_path ) >+ >+This will return a base class for the given conf path >+ >+For example, given >+ >+Koha/Plugins/Org/CCFLS/ExamplePlugin/plugin.conf >+ >+the sub will return >+ >+Koha::Plugins::Org::CCFLS::ExamplePlugin >+ >+=cut >+ >+sub GetBaseClass { >+ my ( $self, %args ) = @_; >+ my $conf_path = $args{conf_path}; >+ my ( $volume, $dir, $file ) = File::Spec->splitpath($conf_path); >+ >+ ( undef, $dir ) = split( $self->{'pluginsdir'} . '/', $dir ); >+ my @parts = split( '/', $dir ); >+ my $base = join( '::', @parts ); >+ >+ return $base; >+} >+ >+1; >+__END__ >+ >+=back >+ >+=head1 AUTHOR >+ >+Kyle M Hall <kyle.m.hall@gmail.com> >+ >+=cut >diff --git a/Koha/Plugins/Base.pm b/Koha/Plugins/Base.pm >new file mode 100644 >index 0000000..9a1b292 >--- /dev/null >+++ b/Koha/Plugins/Base.pm >@@ -0,0 +1,93 @@ >+package Koha::Plugins::Base; >+ >+# Copyright 2012 Kyle Hall >+# >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it under the >+# terms of the GNU General Public License as published by the Free Software >+# Foundation; either version 2 of the License, or (at your option) any later >+# version. >+# >+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY >+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR >+# A PARTICULAR PURPOSE. See the GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License along >+# with Koha; if not, write to the Free Software Foundation, Inc., >+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+ >+use Modern::Perl; >+ >+use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); >+ >+use Module::Load::Conditional qw(can_load); >+ >+use C4::Context; >+ >+BEGIN { >+ >+ # set the version for version checking >+ $VERSION = 0.01; >+ require Exporter; >+ @ISA = qw(Exporter); >+ @EXPORT = qw( >+ >+ ); >+ >+ push @INC, C4::Context->config("pluginsdir"); >+ >+ my $debug = C4::Context->preference("DebugLevel"); >+} >+ >+=head1 NAME >+ >+C4::Plugins::Base - Base Module for running plugins >+ >+=head1 SYNOPSIS >+ >+ use Koha::Plugins::Base; >+ my $p = Koha::Plugins::Base->new( class => $class ); >+ $p->run(); >+ >+=over 2 >+ >+=cut >+ >+sub new { >+ my ( $class, %args ) = @_; >+ my $self = bless( {}, $class ); >+ >+ $self->{'pluginsdir'} = C4::Context->config("pluginsdir"); >+ $self->{'class'} = $args{'class'}; >+ >+ return $self; >+} >+ >+=item run() >+ >+Runs a plugin >+ >+=cut >+ >+sub run { >+ my ( $self, %args ) = @_; >+ >+ my $class = $self->{'class'}; >+ >+ if ( can_load ( modules => { $class } ) ) { >+ my $plugin = new $class; >+ $plugin->main(); >+ } >+} >+ >+1; >+__END__ >+ >+=back >+ >+=head1 AUTHOR >+ >+Kyle M Hall <kyle.m.hall@gmail.com> >+ >+=cut >diff --git a/Makefile.PL b/Makefile.PL >index 46a3524..73e9a15 100644 >--- a/Makefile.PL >+++ b/Makefile.PL >@@ -230,6 +230,10 @@ Directory for Apache and Zebra logs produced by Koha. > > Directory for backup files produced by Koha. > >+=item PLUGINS_DIR >+ >+Directory for external Koha plugins. >+ > =item PAZPAR2_CONF_DIR > > Directory for PazPar2 configuration files. >@@ -309,6 +313,7 @@ my $target_map = { > './skel/var/lib/koha/zebradb/biblios/register' => { target => 'ZEBRA_DATA_DIR', trimdir => 6 }, > './skel/var/lib/koha/zebradb/biblios/shadow' => { target => 'ZEBRA_DATA_DIR', trimdir => 6 }, > './skel/var/lib/koha/zebradb/biblios/tmp' => { target => 'ZEBRA_DATA_DIR', trimdir => 6 }, >+ './skel/var/lib/koha/plugins' => { target => 'PLUGINS_DIR', trimdir => 6 }, > './sms' => 'INTRANET_CGI_DIR', > './suggestion' => 'INTRANET_CGI_DIR', > './svc' => 'INTRANET_CGI_DIR', >@@ -1234,6 +1239,7 @@ sub get_target_directories { > $dirmap{'ZEBRA_LOCK_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'lock', 'zebradb'); > $dirmap{'LOG_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'log'); > $dirmap{'BACKUP_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'spool'); >+ $dirmap{'PLUGINS_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'lib', 'koha', 'plugins'); > $dirmap{'ZEBRA_DATA_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'lib', 'zebradb'); > $dirmap{'ZEBRA_RUN_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'run', 'zebradb'); > } elsif ($mode eq 'dev') { >@@ -1264,6 +1270,7 @@ sub get_target_directories { > $dirmap{'ZEBRA_LOCK_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'lock', 'zebradb'); > $dirmap{'LOG_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'log'); > $dirmap{'BACKUP_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'spool'); >+ $dirmap{'PLUGINS_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'lib', 'plugins'); > $dirmap{'ZEBRA_DATA_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'lib', 'zebradb'); > $dirmap{'ZEBRA_RUN_DIR'} = File::Spec->catdir(@basedir, $package, 'var', 'run', 'zebradb'); > } else { >@@ -1286,6 +1293,7 @@ sub get_target_directories { > $dirmap{'ZEBRA_LOCK_DIR'} = File::Spec->catdir(File::Spec->rootdir(), 'var', 'lock', $package, 'zebradb'); > $dirmap{'LOG_DIR'} = File::Spec->catdir(File::Spec->rootdir(), 'var', 'log', $package); > $dirmap{'BACKUP_DIR'} = File::Spec->catdir(File::Spec->rootdir(), 'var', 'spool', $package); >+ $dirmap{'PLUGINS_DIR'} = File::Spec->catdir(File::Spec->rootdir(), 'var', 'lib', $package, 'plugins'); > $dirmap{'ZEBRA_DATA_DIR'} = File::Spec->catdir(File::Spec->rootdir(), 'var', 'lib', $package, 'zebradb'); > $dirmap{'ZEBRA_RUN_DIR'} = File::Spec->catdir(File::Spec->rootdir(), 'var', 'run', $package, 'zebradb'); > } >@@ -1557,7 +1565,7 @@ make_upgrade_backup :: > \t\$(NOECHO) umask 022; \$(MOD_BACKUP) \\ > /; > foreach my $key (qw/KOHA_CONF_DIR INTRANET_TMPL_DIR INTRANET_WWW_DIR OPAC_TMPL_DIR OPAC_WWW_DIR >- PAZPAR2_CONF_DIR ZEBRA_CONF_DIR/) { >+ PAZPAR2_CONF_DIR ZEBRA_CONF_DIR PLUGINS_DIR/) { > $upgrade .= "\t\t\$(KOHA_INST_$key) \$(KOHA_DEST_$key) \\\n" > unless ($config{'INSTALL_ZEBRA'} ne "yes" and $key =~ /ZEBRA/) or > exists $skip_directories->{$key} or >diff --git a/debian/templates/koha-conf-site.xml.in b/debian/templates/koha-conf-site.xml.in >index 0858059..167b58f 100644 >--- a/debian/templates/koha-conf-site.xml.in >+++ b/debian/templates/koha-conf-site.xml.in >@@ -257,6 +257,7 @@ > <biblioservershadow>1</biblioservershadow> > <authorityserver>authorities</authorityserver> > <authorityservershadow>1</authorityservershadow> >+ <pluginsdir>__PLUGINS_DIR__</pluginsdir> > <intranetdir>/usr/share/koha/intranet/cgi-bin</intranetdir> > <opacdir>/usr/share/koha/opac/cgi-bin/opac</opacdir> > <opachtdocs>/usr/share/koha/opac/htdocs/opac-tmpl</opachtdocs> >diff --git a/etc/koha-conf.xml b/etc/koha-conf.xml >index bb79355..a61130a 100644 >--- a/etc/koha-conf.xml >+++ b/etc/koha-conf.xml >@@ -276,6 +276,7 @@ __PAZPAR2_TOGGLE_XML_POST__ > <biblioservershadow>1</biblioservershadow> > <authorityserver>authorities</authorityserver> > <authorityservershadow>1</authorityservershadow> >+ <pluginsdir>__PLUGINS_DIR__</pluginsdir> > <intranetdir>__INTRANET_CGI_DIR__</intranetdir> > <opacdir>__OPAC_CGI_DIR__/opac</opacdir> > <opachtdocs>__OPAC_TMPL_DIR__</opachtdocs> >diff --git a/install_misc/debian.packages b/install_misc/debian.packages >index 153bcb7..d10b148 100644 >--- a/install_misc/debian.packages >+++ b/install_misc/debian.packages >@@ -115,3 +115,4 @@ make install > mysql-server install > yaz-doc install > yaz install >+libconfig-simple-perl install >diff --git a/install_misc/ubuntu.packages b/install_misc/ubuntu.packages >index 61fbebf..125d251 100644 >--- a/install_misc/ubuntu.packages >+++ b/install_misc/ubuntu.packages >@@ -132,3 +132,4 @@ libxml-simple-perl install > libxml-xslt-perl install > libyaml-perl install > libyaml-syck-perl install >+libconfig-simple-perl install >diff --git a/install_misc/ubuntu_maverick.packages b/install_misc/ubuntu_maverick.packages >index 9b806bb..1bdabb5 100644 >--- a/install_misc/ubuntu_maverick.packages >+++ b/install_misc/ubuntu_maverick.packages >@@ -127,3 +127,4 @@ libxml-simple-perl install > libxml-xslt-perl install > libyaml-perl install > libyaml-syck-perl install >+libconfig-simple-perl install >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index f5a18b2..d115d8e 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -374,3 +374,4 @@ INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ( > 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'); > 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'); > 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'); >+INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UseKohaPlugins','1','Enable or disable the ability to use Koha Plugins.','','YesNo'); >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index ed0c674..6ff02b8 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -5635,6 +5635,16 @@ if(C4::Context->preference("Version") < TransformToNum($DBversion) ) { > SetVersion($DBversion); > } > >+$DBversion = "3.09.00.XXX"; >+if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { >+ $dbh->do("INSERT INTO userflags (bit, flag, flagdesc, defaulton) VALUES ('19', 'plugins', 'Koha Plugins', '0')"); >+ $dbh->do("INSERT INTO permissions (module_bit, code, description) VALUES ('19', 'manage', 'Manage Plugins'), ('19', 'tools', 'Use Tool Plugins'), ('19', 'reports', 'Use Report Plugins')"); >+ $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('UseKohaPlugins','1','Enable or disable the ability to use Koha Plugins.','','YesNo')"); >+ >+ print "Upgrade to $DBversion done (Added plugin system.)\n"; >+ SetVersion($DBversion); >+} >+ > =head1 FUNCTIONS > > =head2 TableExists($table) >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc >index 3d71d45..f7578cf 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/header.inc >@@ -34,6 +34,9 @@ > [% IF ( CAN_user_tools ) %] > <li><a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a></li> > [% END %] >+ [% IF ( UseKohaPlugins && CAN_user_plugins ) %] >+ <li><a href="/cgi-bin/koha/plugins/plugins-home.pl">Plugins</a></li> >+ [% END %] > [% IF ( CAN_user_parameters ) %] > <li><a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a></li> > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref >index bb3bc2d..9ca69fe 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/enhanced_content.pref >@@ -336,3 +336,10 @@ Enhanced Content: > yes: Allow > no: "Don't allow" > - multiple images to be attached to each bibliographic record. >+ Plugins: >+ - >+ - pref: UseKohaPlugins >+ choices: >+ yes: Enable >+ no: "Don't enable" >+ - the ability to use Koha Plugins. >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/plugins/plugins-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/plugins/plugins-home.tt >new file mode 100644 >index 0000000..51a04a4 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/plugins/plugins-home.tt >@@ -0,0 +1,77 @@ >+[% USE KohaDates %] >+[% INCLUDE 'doc-head-open.inc' %] >+<title>Koha › Tools › Plugins </title> >+[% INCLUDE 'doc-head-close.inc' %] >+[% INCLUDE 'calendar.inc' %] >+</head> >+ >+<body> >+[% INCLUDE 'header.inc' %] >+[% INCLUDE 'circ-search.inc' %] >+ >+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> >+› Plugins >+</div> >+ >+<div id="doc3" class="yui-t1"> >+ <div id="bd"> >+ <div id="yui-main"> >+ <div class="yui-b"> >+ <div class="details"> >+ <h1>Plugins</h1> >+ >+ [% IF ( ERROR_NO_PLUGINS ) %] >+ <h2>No Plugins Exist.</h2> >+ <p>Please upload one or more Koha Plugin files (.kpz) before using.</p> >+ [% ELSE %] >+ <table> >+ <tr> >+ <th>Name</th> >+ <th>Type</th> >+ <th>Description</th> >+ <th>Author</th> >+ <th>Plugin Version</th> >+ <th>Minimum Koha Version</th> >+ <th>Maximum Koha Version</th> >+ <th>Last Updated</th> >+ </tr> >+ >+ [% FOREACH plugin IN plugins %] >+ <tr> >+ <td><a href="/cgi-bin/koha/plugins/run.pl?base_class=[% plugin.base_class %]">[% plugin.name %]</a></td> >+ <td>[% plugin.type %]</td> >+ <td> >+ [% plugin.description %] >+ >+ [% IF ( plugin.db_version_too_old ) %] >+ <div class="error">Warning: This report was written for a newer version of Koha. Run at your own risk.</div> >+ [% END %] >+ >+ [% IF ( plugin.db_version_too_new ) %] >+ <div class="error">Warning: This report was written for an older version of Koha. Run at your own risk.</div> >+ [% END %] >+ </td> >+ <td>[% plugin.author %]</td> >+ <td>[% plugin.version %]</td> >+ <td>[% plugin.minimum_version %]</td> >+ <td>[% plugin.maximum_version %]</td> >+ <td>[% plugin.date_updated | $KohaDates %]</td> >+ [% END %] >+ </table> >+ [% END %] >+ </div> >+ </div> >+ </div> >+ >+ <div class="yui-b noprint"> >+ <div id="navmenu"> >+ <ul id="navmenulist"> >+ <li><a href="plugins-upload.pl">Upload A Plugin</a></li> >+ </ul> >+ </div> >+ </div> >+ </div> >+</div> >+ >+ >+[% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/plugins/plugins-upload.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/plugins/plugins-upload.tt >new file mode 100644 >index 0000000..94d3373 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/plugins/plugins-upload.tt >@@ -0,0 +1,55 @@ >+[% INCLUDE 'doc-head-open.inc' %] >+<title>Koha › Tools › Plugins › Upload Plugin >+ </title> >+[% INCLUDE 'doc-head-close.inc' %] >+[% INCLUDE 'calendar.inc' %] >+</head> >+ >+<body> >+[% INCLUDE 'header.inc' %] >+[% INCLUDE 'circ-search.inc' %] >+ >+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> >+› <a href="/cgi-bin/koha/plugins/plugins-home.pl">Plugins</a> >+› Upload Plugins >+</div> >+ >+<div id="doc3" class="yui-t2"> >+ <div id="bd"> >+ <div id="yui-main"> >+ <div class="yui-b"> >+ <div class="yui-g"> >+ <div class="yui-u first"> >+ <h1>Upload Koha Plugin</h1> >+ [% IF ( ERRORS ) %] >+ <div class="dialog alert"> >+ [% FOREACH ERROR IN ERRORS %] >+ [% IF ( ERROR.NOTKPZ ) %]<li><b>The upload file does not appear to be a kpz file. The extention is not '.kpz'.</b></li> >+ [% ELSIF ( ERROR.NOWRITETEMP ) %]<li><b>This script is not able to create/write to the necessary temporary directory.</b></li> >+ [% ELSIF ( ERROR.EMPTYUPLOAD ) %]<li><b>The upload file appears to be empty.</b></li> >+ [% ELSIF ( ERROR.UZIPFAIL ) %]<li><b>[% ERROR.UZIPFAIL %] failed to unpack.<br />Please verify the integrity of the zip file and retry.</b></li> >+ [% 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> >+ [% ELSE %]<li><b>[% ERROR.CORERR %] An unknown error has occurred.<br />Please review the error log for more details.</b></li>[% END %] >+ [% END %] >+ </div> >+ [% END %] >+ <form method="post" action="/cgi-bin/koha/plugins/plugins-upload.pl" enctype="multipart/form-data"> >+ <fieldset class="brief"> >+ <div class="hint"><b>NOTE:</b> Only KPZ file format is supported.</div> >+ <ol> >+ <li> >+ <label for="uploadfile">Select the file to upload: </label><input type="file" id="uploadfile" name="uploadfile" /> >+ </li> >+ </ol> >+ </fieldset> >+ <fieldset class="action"> >+ <input type="hidden" name="op" value="Upload" /> >+ <input type="submit" value="Upload" class="submit" /> >+ </fieldset> >+ </form> >+ >+ </div> >+ </div> >+ </div> >+</div> >+[% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/report-plugins.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/report-plugins.tt >new file mode 100644 >index 0000000..b7fd215 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/report-plugins.tt >@@ -0,0 +1,54 @@ >+[% INCLUDE 'doc-head-open.inc' %] >+<title>Koha › Reports › Report Plugins </title> >+[% INCLUDE 'doc-head-close.inc' %] >+[% INCLUDE 'calendar.inc' %] >+</head> >+ >+<body> >+[% INCLUDE 'header.inc' %] >+[% INCLUDE 'circ-search.inc' %] >+ >+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> >+› <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a> >+› Plugins >+</div> >+ >+<div id="doc3" class="yui-t1"> >+ <div id="bd"> >+ <div id="yui-main"> >+ <div class="details"> >+ <h1>Report Plugins</h1> >+ >+ [% IF ( ERROR_NO_REPORTS ) %] >+ <h2>No Report Plugins Exist.</h2> >+ [% ELSE %] >+ <table> >+ <tr> >+ <th>Name</th> >+ <th>Description</th> >+ <th>Author</th> >+ <th>Last Update</th> >+ </tr> >+ >+ [% FOREACH REPORTS_LOO IN REPORTS_LOOP %] >+ <tr> >+ <td><a href="/cgi-bin/koha/plugins/run/[% REPORTS_LOO.start %]">[% REPORTS_LOO.name %]</a></td> >+ <td> >+ [% REPORTS_LOO.description %] >+ [% IF ( REPORTS_LOO.db_version_too_old ) %] >+ <div class="error">Warning: This report was written for a newer version of Koha. Run at your own risk.</div> >+ [% END %] >+ </td> >+ <td>[% REPORTS_LOO.author %]</td> >+ <td>[% REPORTS_LOO.date_updated %]</td> >+ [% END %] >+ </table> >+ [% END %] >+ </div> >+ </div> >+ </div> >+</div> >+ >+ >+ >+[% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reports-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reports-home.tt >index 32c1803..efeb23f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reports-home.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/reports-home.tt >@@ -35,7 +35,16 @@ > <li><a href="/cgi-bin/koha/reports/issues_stats.pl">Circulation</a></li> > <li><a href="/cgi-bin/koha/reports/serials_stats.pl">Serials</a></li> > <li><a href="/cgi-bin/koha/reports/reserves_stats.pl">Holds</a></li> >- </ul></div> >+ </ul> >+ >+ [% IF UseKohaPlugins %] >+ <h2>Report Plugins</h2> >+ <ul> >+ <li><a href="/cgi-bin/koha/reports/report-plugins.pl">View Report Plugins</a></li> >+ </ul> >+ [% END %] >+ >+ </div> > > <div class="yui-u"><h2>Top lists</h2> > <ul> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tool-plugins.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tool-plugins.tt >new file mode 100644 >index 0000000..9adf810 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tool-plugins.tt >@@ -0,0 +1,54 @@ >+[% INCLUDE 'doc-head-open.inc' %] >+<title>Koha › Tools › Tool Plugins </title> >+[% INCLUDE 'doc-head-close.inc' %] >+[% INCLUDE 'calendar.inc' %] >+</head> >+ >+<body> >+[% INCLUDE 'header.inc' %] >+[% INCLUDE 'circ-search.inc' %] >+ >+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> >+› <a href="/cgi-bin/koha/tools/tools-home.pl">Tools</a> >+› Plugins >+</div> >+ >+<div id="doc3" class="yui-t1"> >+ <div id="bd"> >+ <div id="yui-main"> >+ <div class="details"> >+ <h1>Tool Plugins</h1> >+ >+ [% IF ( ERROR_NO_TOOLS ) %] >+ <h2>No Tool Plugins Exist.</h2> >+ [% ELSE %] >+ <table> >+ <tr> >+ <th>Name</th> >+ <th>Description</th> >+ <th>Author</th> >+ <th>Last Update</th> >+ </tr> >+ >+ [% FOREACH TOOLS_LOO IN TOOLS_LOOP %] >+ <tr> >+ <td><a href="/cgi-bin/koha/plugins/run/[% TOOLS_LOO.start %]">[% TOOLS_LOO.name %]</a></td> >+ <td> >+ [% TOOLS_LOO.description %] >+ [% IF ( TOOLS_LOO.db_version_too_old ) %] >+ <div class="error">Warning: This report was written for a newer version of Koha. Run at your own risk.</div> >+ [% END %] >+ </td> >+ <td>[% TOOLS_LOO.author %]</td> >+ <td>[% TOOLS_LOO.date_updated %]</td> >+ [% END %] >+ </table> >+ [% END %] >+ </div> >+ </div> >+ </div> >+</div> >+ >+ >+ >+[% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt >index 52cc1e6..4124ce5 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/tools-home.tt >@@ -95,6 +95,10 @@ > [% IF ( CAN_user_tools_edit_quotes ) %] > <dt><a href="/cgi-bin/koha/tools/quotes.pl">Edit quotes for QOTD feature</a></dt> > <dd>Quote editor for Quote-of-the-day feature in OPAC</dd> >+ >+ [% IF ( UseKohaPlugins && CAN_user_plugins_tools ) %] >+ <dt><a href="/cgi-bin/koha/tools/tool-plugins.pl">Tool Plugins</a></dt> >+ <dd>Schedule tasks to run</dd> > [% END %] > > </dl> >diff --git a/plugins/plugins-home.pl b/plugins/plugins-home.pl >new file mode 100755 >index 0000000..6d9a677 >--- /dev/null >+++ b/plugins/plugins-home.pl >@@ -0,0 +1,56 @@ >+#!/usr/bin/perl >+ >+# Copyright 2010 Kyle M Hall <kyle.m.hall@gmail.com> >+# >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it under the >+# terms of the GNU General Public License as published by the Free Software >+# Foundation; either version 2 of the License, or (at your option) any later >+# version. >+# >+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY >+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR >+# A PARTICULAR PURPOSE. See the GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License along >+# with Koha; if not, write to the Free Software Foundation, Inc., >+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+ >+use strict; >+use warnings; >+ >+use CGI; >+ >+use Koha::Plugins; >+use C4::Auth; >+use C4::Output; >+use C4::Dates; >+use C4::Debug; >+use C4::Context; >+ >+die("Koha plugins are disabled!") >+ unless C4::Context->preference('UseKohaPlugins'); >+ >+my $input = new CGI; >+ >+my ( $template, $borrowernumber, $cookie ) = get_template_and_user( >+ { >+ template_name => "plugins/plugins-home.tmpl", >+ query => $input, >+ type => "intranet", >+ authnotrequired => 0, >+ flagsrequired => { plugins => "manage" }, >+ debug => 1, >+ } >+); >+ >+my @plugins = Koha::Plugins->new()->GetPlugins(); >+ >+$template->param( plugins => \@plugins ); >+ >+unless ( @plugins ) { >+ $template->param( ERROR_NO_PLUGINS => 1 ); >+} >+ >+output_html_with_http_headers $input, $cookie, $template->output; >diff --git a/plugins/plugins-upload.pl b/plugins/plugins-upload.pl >new file mode 100755 >index 0000000..794aa2a >--- /dev/null >+++ b/plugins/plugins-upload.pl >@@ -0,0 +1,102 @@ >+#!/usr/bin/perl >+# >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it under the >+# terms of the GNU General Public License as published by the Free Software >+# Foundation; either version 2 of the License, or (at your option) any later >+# version. >+# >+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY >+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR >+# A PARTICULAR PURPOSE. See the GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License along >+# with Koha; if not, write to the Free Software Foundation, Inc., >+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+ >+use strict; >+use warnings; >+ >+use Archive::Extract; >+use File::Temp; >+use File::Copy; >+use CGI; >+ >+use C4::Context; >+use C4::Auth; >+use C4::Output; >+use C4::Members; >+use C4::Debug; >+use Koha::Plugins; >+ >+die("Koha plugins are disabled!") >+ unless C4::Context->preference('UseKohaPlugins'); >+ >+my $input = new CGI; >+ >+my ( $template, $loggedinuser, $cookie ) = get_template_and_user( >+ { >+ template_name => "plugins/plugins-upload.tmpl", >+ query => $input, >+ type => "intranet", >+ authnotrequired => 0, >+ flagsrequired => { plugins => 'manage' }, >+ debug => 1, >+ } >+); >+ >+my $uploadfilename = $input->param('uploadfile'); >+my $uploadfile = $input->upload('uploadfile'); >+my $op = $input->param('op'); >+ >+my ( $total, $handled, @counts, $tempfile, $tfh ); >+ >+my %errors; >+ >+if ( ( $op eq 'Upload' ) && $uploadfile ) { >+ my $plugins_dir = Koha::Plugins->new()->GetPluginsDir(); >+ >+ my $dirname = File::Temp::tempdir( CLEANUP => 1 ); >+ $debug and warn "dirname = $dirname"; >+ >+ my $filesuffix = $1 if $uploadfilename =~ m/(\..+)$/i; >+ ( $tfh, $tempfile ) = >+ File::Temp::tempfile( SUFFIX => $filesuffix, UNLINK => 1 ); >+ >+ $debug and warn "tempfile = $tempfile"; >+ >+ $errors{'NOTKPZ'} = 1 if ( $uploadfilename !~ /\.kpz$/i ); >+ $errors{'NOWRITETEMP'} = 1 unless ( -w $dirname ); >+ $errors{'NOWRITEPLUGINS'} = 1 unless ( -w $plugins_dir ); >+ $errors{'EMPTYUPLOAD'} = 1 unless ( length($uploadfile) > 0 ); >+ >+ if (%errors) { >+ $template->param( ERRORS => [ \%errors ] ); >+ } >+ else { >+ while (<$uploadfile>) { >+ print $tfh $_; >+ } >+ close $tfh; >+ >+ my $ae = Archive::Extract->new( archive => $tempfile, type => 'zip' ); >+ unless ( $ae->extract( to => $plugins_dir ) ) { >+ warn "ERROR: " . $ae->error; >+ $errors{'UZIPFAIL'} = $uploadfilename; >+ $template->param( ERRORS => [ \%errors ] ); >+ output_html_with_http_headers $input, $cookie, $template->output; >+ exit; >+ } >+ } >+} >+elsif ( ( $op eq 'Upload' ) && !$uploadfile ) { >+ warn "Problem uploading file or no file uploaded."; >+} >+ >+if ( $uploadfile && !%errors && !$template->param('ERRORS') ) { >+ print $input->redirect("/cgi-bin/koha/plugins/plugins-home.pl"); >+} >+else { >+ output_html_with_http_headers $input, $cookie, $template->output; >+} >diff --git a/plugins/run.pl b/plugins/run.pl >new file mode 100755 >index 0000000..4f61082 >--- /dev/null >+++ b/plugins/run.pl >@@ -0,0 +1,50 @@ >+#!/usr/bin/perl >+ >+# Copyright 2010 Kyle M Hall <kyle.m.hall@gmail.com> >+# >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it under the >+# terms of the GNU General Public License as published by the Free Software >+# Foundation; either version 2 of the License, or (at your option) any later >+# version. >+# >+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY >+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR >+# A PARTICULAR PURPOSE. See the GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License along >+# with Koha; if not, write to the Free Software Foundation, Inc., >+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+ >+use strict; >+use warnings; >+ >+use CGI; >+ >+use Koha::Plugins::Base; >+use C4::Auth; >+use C4::Output; >+use C4::Dates; >+use C4::Debug; >+use C4::Context; >+ >+die("Koha plugins are disabled!") >+ unless C4::Context->preference('UseKohaPlugins'); >+ >+my $cgi = new CGI; >+ >+my ( $template, $borrowernumber, $cookie ) = get_template_and_user( >+ { >+ template_name => "plugins/plugins-home.tmpl", >+ query => $cgi, >+ type => "intranet", >+ authnotrequired => 0, >+ flagsrequired => { plugins => "reports" }, >+ debug => 1, >+ } >+); >+ >+my $plugin_class = $cgi->param('base_class') . "::Start"; >+my $plugin = Koha::Plugins::Base->new( class => $plugin_class ); >+$plugin->run(); >diff --git a/reports/report-plugins.pl b/reports/report-plugins.pl >new file mode 100755 >index 0000000..4638dd1 >--- /dev/null >+++ b/reports/report-plugins.pl >@@ -0,0 +1,52 @@ >+#!/usr/bin/perl >+ >+# Copyright 2010 Kyle M Hall <kyle.m.hall@gmail.com> >+# >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it under the >+# terms of the GNU General Public License as published by the Free Software >+# Foundation; either version 2 of the License, or (at your option) any later >+# version. >+# >+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY >+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR >+# A PARTICULAR PURPOSE. See the GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License along >+# with Koha; if not, write to the Free Software Foundation, Inc., >+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+ >+use strict; >+use warnings; >+ >+use CGI; >+ >+use C4::Plugins; >+use C4::Auth; >+use C4::Output; >+use C4::Dates; >+use C4::Debug; >+ >+my $input = new CGI; >+ >+my ( $template, $borrowernumber, $cookie ) = get_template_and_user( >+ { >+ template_name => "reports/report-plugins.tmpl", >+ query => $input, >+ type => "intranet", >+ authnotrequired => 0, >+ flagsrequired => { plugins => "reports" }, >+ debug => 1, >+ } >+); >+ >+my ( $reports_loop, $reports_count ) = GetPlugins('report'); >+ >+$template->param( REPORTS_LOOP => $reports_loop ); >+ >+unless ($reports_count) { >+ $template->param( ERROR_NO_REPORTS => 1 ); >+} >+ >+output_html_with_http_headers $input, $cookie, $template->output; >diff --git a/rewrite-config.PL b/rewrite-config.PL >index 083b3a8..479dfce 100644 >--- a/rewrite-config.PL >+++ b/rewrite-config.PL >@@ -43,7 +43,7 @@ guesses worked out by the script. > The following configuration keywords are available: > > PREFIX, >-BASE_DIR, CGI_DIR, LOG_DIR, INSTALL_BASE, >+BASE_DIR, CGI_DIR, LOG_DIR, PLUGINS_DIR, INSTALL_BASE, > DB_TYPE, DB_HOST, DB_PORT, DB_NAME, DB_PASS, DB_USER, WEBMASTER_EMAIL, WEBSERVER_DOMAIN, > WEBSERVER_HOST, WEBSERVER_IP, WEBSERVER_PORT, WEBSERVER_PORT_LIBRARIAN, ZEBRA_PASS, ZEBRA_USER > >@@ -82,6 +82,7 @@ $prefix = $ENV{'INSTALL_BASE'} || "/usr"; > %configuration = ( > "__KOHA_INSTALLED_VERSION__" => "no_version_found", > "__LOG_DIR__" => "/var/log", >+ "__PLUGINS_DIR__" => "/var/lib/koha/plugins", > "__DB_TYPE__" => "mysql", > "__DB_NAME__" => "koha", > "__DB_HOST__" => $myhost, >diff --git a/skel/var/lib/koha/plugins/.htaccess b/skel/var/lib/koha/plugins/.htaccess >new file mode 100644 >index 0000000..4d7523a >--- /dev/null >+++ b/skel/var/lib/koha/plugins/.htaccess >@@ -0,0 +1,2 @@ >+AddHandler cgi-script .pl >+AddHandler send-as-is .css .js .gif .jpg >\ No newline at end of file >diff --git a/skel/var/lib/koha/plugins/README b/skel/var/lib/koha/plugins/README >new file mode 100644 >index 0000000..d4290ea >--- /dev/null >+++ b/skel/var/lib/koha/plugins/README >@@ -0,0 +1 @@ >+plugins dir >\ No newline at end of file >diff --git a/tools/tool-plugins.pl b/tools/tool-plugins.pl >new file mode 100755 >index 0000000..634c939 >--- /dev/null >+++ b/tools/tool-plugins.pl >@@ -0,0 +1,52 @@ >+#!/usr/bin/perl >+ >+# Copyright 2010 Kyle M Hall <kyle.m.hall@gmail.com> >+# >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it under the >+# terms of the GNU General Public License as published by the Free Software >+# Foundation; either version 2 of the License, or (at your option) any later >+# version. >+# >+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY >+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR >+# A PARTICULAR PURPOSE. See the GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License along >+# with Koha; if not, write to the Free Software Foundation, Inc., >+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+ >+use strict; >+use warnings; >+ >+use CGI; >+ >+use C4::Plugins; >+use C4::Auth; >+use C4::Output; >+use C4::Dates; >+use C4::Debug; >+ >+my $input = new CGI; >+ >+my ( $template, $borrowernumber, $cookie ) = get_template_and_user( >+ { >+ template_name => "tools/tool-plugins.tmpl", >+ query => $input, >+ type => "intranet", >+ authnotrequired => 0, >+ flagsrequired => { plugins => "tools" }, >+ debug => 1, >+ } >+); >+ >+my ( $reports_loop, $reports_count ) = GetPlugins('tool'); >+ >+$template->param( TOOLS_LOOP => $reports_loop ); >+ >+unless ($reports_count) { >+ $template->param( ERROR_NO_TOOLS => 1 ); >+} >+ >+output_html_with_http_headers $input, $cookie, $template->output; >-- >1.7.2.5
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 7804
:
8525
|
8528
|
8545
|
8546
|
8591
|
8595
|
8596
|
8597
|
8607
|
8608
|
8609
|
9565
|
9636
|
9637
|
9644
|
9755
|
11606
|
14506
|
14508
|
14509
|
14510
|
14511
|
14512
|
14513
|
14514
|
14530
|
14531
|
14538
|
14539
|
14540
|
14541
|
14542
|
14543
|
14545
|
14562
|
14563
|
14632
|
14633
|
14731
|
15166
|
15167
|
15168
|
15531
|
15532
|
15533
|
15570
|
15571
|
15572
|
15653
|
15654
|
15655
|
15656
|
16220
|
16221
|
16222
|
16223
|
16297
|
16298
|
16299