Bug 20968: Add hooks into cat-toolbar.inc to display buttons
This commit adds hooks into cat-toolbar.inc to allow the display of arbitrary buttons as supplied by plugins within the intranet_catalog_biblio_enhancements class that provide the method get_toolbar_button To test: 1) Download the plugin from https://github.com/PTFS-Europe/cla-permissions-check-plugin 2) Follow the installation instructions from: https://github.com/PTFS-Europe/cla-permissions-check-plugin 3) TEST: Observe that the "CLA Check Permissions" button takes the user to the Check Permissions page and a modal displays containing the results of the query 4) Remove the API key from the plugin "Configuration" page 5) TEST: Ensure that the "CLA Check Permissions" button takes the user to the Check Permissions page and message displays informing the user that "Did not receive required request parameters" https://bugs.koha-community.org/show_bug.cgi?id=20968 Signed-off-by: Stephen Graham <s.graham4@herts.ac.uk> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
parent
7a1641cd41
commit
741f17e916
|
|
@ -21,6 +21,7 @@ use Modern::Perl;
|
|||
use CGI qw ( -utf8 );
|
||||
use HTML::Entities;
|
||||
use C4::Auth;
|
||||
use C4::Context;
|
||||
use C4::Koha;
|
||||
use C4::Serials; #uses getsubscriptionfrom biblionumber
|
||||
use C4::Output;
|
||||
|
|
@ -45,6 +46,7 @@ use Koha::Items;
|
|||
use Koha::ItemTypes;
|
||||
use Koha::Patrons;
|
||||
use Koha::Virtualshelves;
|
||||
use Koha::Plugins;
|
||||
|
||||
my $query = CGI->new();
|
||||
|
||||
|
|
@ -60,6 +62,19 @@ my ( $template, $borrowernumber, $cookie, $flags ) = get_template_and_user(
|
|||
}
|
||||
);
|
||||
|
||||
# Determine if we should be offering any enhancement plugin buttons
|
||||
if ( C4::Context->preference('UseKohaPlugins') &&
|
||||
C4::Context->config('enable_plugins') ) {
|
||||
my @plugins = Koha::Plugins->new()->GetPlugins({
|
||||
method => 'intranet_catalog_biblio_enhancements'
|
||||
});
|
||||
# Only pass plugins that can offer a toolbar button
|
||||
@plugins = grep { $_->get_toolbar_button } @plugins;
|
||||
$template->param(
|
||||
plugins => \@plugins
|
||||
);
|
||||
}
|
||||
|
||||
my $biblionumber = $query->param('biblionumber');
|
||||
$biblionumber = HTML::Entities::encode($biblionumber);
|
||||
my $record = GetMarcBiblio({ biblionumber => $biblionumber });
|
||||
|
|
|
|||
|
|
@ -139,6 +139,10 @@ CAN_user_serials_create_subscription ) %]
|
|||
<div class="btn-group"><a id="placehold" class="btn btn-default btn-sm" href="/cgi-bin/koha/circ/request-article.pl?biblionumber=[% biblionumber | html %]"><i class="fa fa-file-text-o"></i> Request article</a></div>
|
||||
[% END %]
|
||||
|
||||
[% FOREACH p IN plugins %]
|
||||
[% p.get_toolbar_button %]
|
||||
[% END %]
|
||||
|
||||
</div>
|
||||
|
||||
<!--Modal for Dublin Core-->
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@
|
|||
<li><a href="/cgi-bin/koha/plugins/plugins-home.pl?method=tool">View tool plugins</a></li>
|
||||
<li><a href="/cgi-bin/koha/plugins/plugins-home.pl?method=to_marc">View MARC conversion plugins</a></li>
|
||||
<li><a href="/cgi-bin/koha/plugins/plugins-home.pl?method=opac_online_payment">View online payment plugins</a></li>
|
||||
<li><a href="/cgi-bin/koha/plugins/plugins-home.pl?method=intranet_catalog_biblio_enhancements">View intranet catalog biblio enhancement plugins</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -52,6 +53,8 @@
|
|||
<div class="dialog message">No plugins that can convert files to MARC records are installed</div>
|
||||
[% ELSIF method == 'opac_online_payment' %]
|
||||
<div class="dialog message">No plugins that can process online payments via the public catalog are installed</div>
|
||||
[% ELSIF method == 'intranet_catalog_biblio_enhancements' %]
|
||||
<div class="dialog message">No plugins that can enhance the intranet catalog biblio records are installed</div>
|
||||
[% ELSE %]
|
||||
<div class="dialog message">Unknown plugin type <i>[% method | html %]</i></div>
|
||||
[% END %]
|
||||
|
|
|
|||
Loading…
Reference in New Issue