[Koha-patches] [PATCH 2/2] Bug 12780 [ENH] Adds plugins-menu.inc to support nav mexnu for plugins installed

Indranil Das Gupta indradg at gmail.com
Tue Aug 19 11:21:03 CEST 2014


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.
---
 koha-tmpl/intranet-tmpl/prog/en/includes/plugins-menu.inc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/plugins-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/plugins-menu.inc
index 9bfa681..1f2b012 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/includes/plugins-menu.inc
+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/plugins-menu.inc
@@ -1,3 +1,4 @@
+<!-- http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12780 -->
 <script type="text/javascript">//<![CDATA[
     $(document).ready(function() {
         var path = location.pathname.substring(1);
@@ -27,6 +28,7 @@
     });
 //]]>
 </script>
+<!-- http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=12780 -->
 <div id="navmenu">
 <div id="navmenulist">
 <h5>Custom Plug-ins
@@ -62,4 +64,4 @@
   [% END %]
 [% END %]
 
-</div></div>
\ No newline at end of file
+</div></div>
-- 
1.8.1.2



More information about the Koha-patches mailing list