Bugzilla – Attachment 79804 Details for
Bug 20968
Plugins: Add hooks to enable plugin integration into catalogue
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20968: Add hooks into cat-toolbar.inc to display buttons
Bug-20968-Add-hooks-into-cat-toolbarinc-to-display.patch (text/plain), 5.03 KB, created by
Martin Renvoize (ashimema)
on 2018-10-02 06:10:09 UTC
(
hide
)
Description:
Bug 20968: Add hooks into cat-toolbar.inc to display buttons
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2018-10-02 06:10:09 UTC
Size:
5.03 KB
patch
obsolete
>From 00af09bba5669c00524054a18aa57e45c1303a28 Mon Sep 17 00:00:00 2001 >From: Andrew Isherwood <andrew.isherwood@ptfs-europe.com> >Date: Wed, 20 Jun 2018 12:47:10 +0100 >Subject: [PATCH] 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 >--- > catalogue/detail.pl | 15 +++++++++++++++ > .../prog/en/includes/cat-toolbar.inc | 4 ++++ > .../prog/en/modules/plugins/plugins-home.tt | 3 +++ > 3 files changed, 22 insertions(+) > >diff --git a/catalogue/detail.pl b/catalogue/detail.pl >index fe59fa12cc..2707a81d36 100755 >--- a/catalogue/detail.pl >+++ b/catalogue/detail.pl >@@ -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 }); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc >index d5191e30fd..935f94feff 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/cat-toolbar.inc >@@ -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--> >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 >index 305f3eb473..73614404bd 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/plugins/plugins-home.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/plugins/plugins-home.tt >@@ -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 %] >-- >2.18.0
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 20968
:
76374
|
76375
|
76530
|
76531
|
76532
|
76540
|
76541
|
76555
|
76564
|
76565
|
76566
|
76567
|
76568
|
77782
|
77783
|
77784
|
77785
|
77786
|
78457
|
78458
|
78459
|
78460
|
78461
|
79804
|
79805
|
79806
|
79807
|
79808
|
80394
|
80395
|
80396
|
80397
|
80398
|
80615
|
80616
|
80617
|
80618
|
80619