@@ -, +, @@ plugin upload --- debian/templates/koha-conf-site.xml.in | 1 + etc/koha-conf.xml | 1 + .../prog/en/modules/plugins/plugins-disabled.tt | 6 +++++- .../prog/en/modules/plugins/plugins-home.tt | 2 ++ plugins/plugins-home.pl | 1 + plugins/plugins-upload.pl | 9 +++++++-- 6 files changed, 17 insertions(+), 3 deletions(-) --- a/debian/templates/koha-conf-site.xml.in +++ a/debian/templates/koha-conf-site.xml.in @@ -266,6 +266,7 @@ __END_SRU_PUBLICSERVER__ 1 __PLUGINS_DIR__ 0 + 0 __UPLOAD_PATH__ __TMP_PATH__ /usr/share/koha/intranet/cgi-bin --- a/etc/koha-conf.xml +++ a/etc/koha-conf.xml @@ -79,6 +79,7 @@ 1 __PLUGINS_DIR__ 0 + 0 __INTRANET_CGI_DIR__ --- a/koha-tmpl/intranet-tmpl/prog/en/modules/plugins/plugins-disabled.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/plugins/plugins-disabled.tt @@ -29,9 +29,13 @@
+ [% IF ( browser_upload_enabled.defined ) && ( browser_upload_enabled == 0 ) %] +

Plugin browser upload disabled

+

To enable Koha plugin browser upload, the flag enable_plugin_browser_upload must be set in the Koha configuration file

+ [% ELSE %]

Plugins disabled

-

To enable Koha plugins, the flag enable_plugins must be set in the Koha configuration file

+ [% END %]
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/plugins/plugins-home.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/plugins/plugins-home.tt @@ -46,7 +46,9 @@ [% IF ( CAN_user_plugins_manage ) %]
+ [% IF ( enable_browser_upload ) %] Upload plugin + [% END %]
--- a/plugins/plugins-home.pl +++ a/plugins/plugins-home.pl @@ -59,6 +59,7 @@ if ($plugins_enabled) { ); $template->param( plugins => \@plugins, ); + $template->param( enable_browser_upload => C4::Context->config('enable_plugin_browser_upload') ); $template->param( can_search => C4::Context->config('plugin_repos') ? 1 : 0 ); my @results; --- a/plugins/plugins-upload.pl +++ a/plugins/plugins-upload.pl @@ -31,17 +31,22 @@ use Koha::Logger; use Koha::Plugins; my $plugins_enabled = C4::Context->config("enable_plugins"); +my $browser_upload_enabled = C4::Context->config('enable_plugin_browser_upload'); my $input = CGI->new; my ( $template, $loggedinuser, $cookie ) = get_template_and_user( - { template_name => ($plugins_enabled) ? "plugins/plugins-upload.tt" : "plugins/plugins-disabled.tt", + { template_name => ($plugins_enabled && $browser_upload_enabled) ? "plugins/plugins-upload.tt" : "plugins/plugins-disabled.tt", query => $input, type => "intranet", flagsrequired => { plugins => 'manage' }, } ); +if ($plugins_enabled){ + $template->param( browser_upload_enabled => $browser_upload_enabled ); +} + my $uploadfilename = $input->param('uploadfile'); my $uploadfile = $input->upload('uploadfile'); my $uploadlocation = $input->param('uploadlocation'); @@ -51,7 +56,7 @@ my ( $tempfile, $tfh ); my %errors; -if ($plugins_enabled) { +if ($plugins_enabled && $browser_upload_enabled) { if ( ( $op eq 'Upload' ) && ( $uploadfile || $uploadlocation ) ) { my $plugins_dir = C4::Context->config("pluginsdir"); $plugins_dir = ref($plugins_dir) eq 'ARRAY' ? $plugins_dir->[0] : $plugins_dir; --