From ea6b3ac66b26b59856557180e897717a0b012931 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 20 Jan 2021 21:01:14 +0100 Subject: [PATCH] Bug 27527: Add new page to integrate the content to Koha correctly Sponsored-by: Orex Digital --- .../tools/additional_plugin_content.tt | 19 +++++++ tools/additional_plugin_content.pl | 53 +++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional_plugin_content.tt create mode 100755 tools/additional_plugin_content.pl diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional_plugin_content.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional_plugin_content.tt new file mode 100644 index 0000000000..48eac2f731 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional_plugin_content.tt @@ -0,0 +1,19 @@ +[% USE raw %] + +[% INCLUDE 'doc-head-open.inc' %] +Koha › Tools › [% content.name | html %] +[% INCLUDE 'doc-head-close.inc' %] + + +[% INCLUDE 'header.inc' %] +[% INCLUDE 'cat-search.inc' %] + + + +
+
+ [% content.content | $raw %] +
+
+ +[% INCLUDE 'intranet-bottom.inc' %] diff --git a/tools/additional_plugin_content.pl b/tools/additional_plugin_content.pl new file mode 100755 index 0000000000..ecb770f684 --- /dev/null +++ b/tools/additional_plugin_content.pl @@ -0,0 +1,53 @@ +#!/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 3 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, see . + +use Modern::Perl; + +use CGI qw ( -utf8 ); +use C4::Auth; +use C4::Output; +use Koha::Plugins::Handler; + +my $query = CGI->new; +my ( $template, $loggedinuser, $cookie ) = get_template_and_user( + { + template_name => "tools/additional_plugin_content.tt", + query => $query, + type => "intranet", + flagsrequired => { catalogue => '*' }, + } +); + +unless ( C4::Context->config('enable_plugins') ) { + print $query->redirect("/cgi-bin/koha/errors/404.pl"); + exit; +} + +my $class_plugin = $query->param('class'); +my $id = $query->param('id'); + +my $content = Koha::Plugins::Handler->run( + { + class => $class_plugin, + method => 'content', + params => { id => $id }, + } +); + +$template->param( content => $content ); + +output_html_with_http_headers $query, $cookie, $template->output; -- 2.20.1