Bugzilla – Attachment 31069 Details for
Bug 12780
Addition of plugins-menu.inc for adding a nav menu for Koha Plugins
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch to add plugins-menu.inc nav menu
0002-Bug-12780-ENH-Addition-of-plugins-menu.inc-for-a-nav.patch (text/plain), 4.40 KB, created by
Indranil Das Gupta
on 2014-08-22 03:12:24 UTC
(
hide
)
Description:
Patch to add plugins-menu.inc nav menu
Filename:
MIME Type:
Creator:
Indranil Das Gupta
Created:
2014-08-22 03:12:24 UTC
Size:
4.40 KB
patch
obsolete
>From ff38a9063eec41164ec72bab6a6d9ad521e8d3c7 Mon Sep 17 00:00:00 2001 >From: Indranil Das Gupta <indradg@gmail.com> >Date: Fri, 22 Aug 2014 02:47:45 +0000 >Subject: [PATCH 2/2] Bug 12780 [ENH] Addition of plugins-menu.inc for a nav > menu for Koha Plugins > >Koha plugins system (http://manual.koha-community.org/3.16/en/pluginsystem.html) >does not provide a ready method to show an auto-populated nav menu for the >plugins installed in the system. This patch adds that capability and allows >plugin authors to add this .inc file in the plugin's template file > >Test Plan: > >1) Apply this patch > >2) Upload a copy of "Kitchen Sink Example" plugin from ByWater Solutions's >website http://git.bywatersolutions.com/koha-plugins.git/snapshot/tags/kitchen_sink_v1.01 > >3) Edit >"<pluginsdir>/Koha/Plugin/Com/ByWaterSolutions/KitchenSink/tool-step1.tt" > Replace the line "<div id="doc3">" with : > > <div id="doc3" class="yui-t2"> > <div id="bd"> > <div id="yui-main"> > <div class="yui-b"> > > Also, just before the line "[% INCLUDE 'intranet-bottom.inc' %]" at the end > of the file, insert the following lines : > > </div> > </div> > <div class="yui-b noprint"> > [% INCLUDE 'plugins-menu.inc' %] > </div> > </div> > </div> > > Note: <pluginsdir> as defined in your koha-conf.xml > >4) Edit "<pluginsdir>/Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm" by adding: > > use Koha::Plugins; > > after the line : use base qw(Koha::Plugins::Base); > > Also, just after the line : > > my $template = $self->get_template({ file => 'tool-step1.tt' }); > > Insert the following : > > my @reports = Koha::Plugins->new()->GetPlugins("report"); > $template->param( reports => \@reports, ); > my @tools = Koha::Plugins->new()->GetPlugins("tool"); > $template->param( tools => \@tools, ); > >5) Go to http://<intranet_hostname>/cgi-bin/koha/plugins/plugins-home.pl > and click on "Run tool" link. > >6) The page should now show the menu on the left, with the KitchenSink plugin > under the "Plugin Tools" sub-menu being highlighted. >--- > .../prog/en/includes/plugins-menu.inc | 68 ++++++++++++++++++++++ > 1 file changed, 68 insertions(+) > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/plugins-menu.inc > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/plugins-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/plugins-menu.inc >new file mode 100644 >index 0000000..2d36107 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/plugins-menu.inc >@@ -0,0 +1,68 @@ >+<script type="text/javascript">//<![CDATA[ >+ $(document).ready(function() { >+ var path = location.pathname.substring(1); >+ var url = window.location.toString(); >+ var params = ''; >+ if ( url.match(/\?(.+)$/) ) { >+ params = RegExp.$1; >+ >+ console.log(params); >+ >+ var outstring = "?"; >+ >+ var qstr = params.split("&"); >+ >+ for (i=0; i < qstr.length; i++) { >+ var qstrkey = qstr[i].split("="); >+ for (j=0; j < qstrkey.length; j++) { >+ if (qstrkey[j] == "class" || qstrkey[j] == "method" ) { >+ if (i > 0) { >+ outstring = outstring + "&" + qstrkey[0] + "=" + qstrkey[1]; >+ } else { >+ outstring = outstring + qstrkey[0] + "=" + qstrkey[1]; >+ } >+ } >+ } >+ } >+ } >+ $('#navmenulist a[href$="/' + path + outstring + '"]').css('font-weight','bold'); >+ console.log("/" + path + outstring); >+ }); >+//]]> >+</script> >+<div id="navmenu"> >+<div id="navmenulist"> >+<h5>Koha Plug-ins >+</h5> >+<ul> >+ <li><a href="/cgi-bin/koha/plugins/plugins-home.pl">Plugins home</a></li> >+ <li><a href="/cgi-bin/koha/plugins/plugins-upload.pl">Upload plugins</a></li> >+</ul> >+ >+[% IF ( reports ) %] >+ <h5>Plugin Reports</h5> >+ [% FOREACH report IN reports %] >+ <ul> >+ [% IF ( CAN_user_plugins_report ) %] >+ [% IF report.can('report') %] >+ <li><a href="/cgi-bin/koha/plugins/run.pl?class=[% report.class %]&method=report">[% report.metadata.name %]</a></li> >+ [% END %] >+ [% END %] >+ </ul> >+ [% END %] >+[% END %] >+ >+[% IF ( tools ) %] >+ <h5>Plugin Tools</h5> >+ [% FOREACH tool IN tools %] >+ <ul> >+ [% IF ( CAN_user_plugins_report ) %] >+ [% IF tool.can('tool') %] >+ <li><a href="/cgi-bin/koha/plugins/run.pl?class=[% tool.class %]&method=tool">[% tool.metadata.name %]</a></li> >+ [% END %] >+ [% END %] >+ </ul> >+ [% END %] >+[% END %] >+ >+</div></div> >-- >1.8.1.2 >
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 12780
:
30973
|
30974
|
30976
| 31069