Bug 12780

Summary: Addition of plugins-menu.inc for adding a nav menu for Koha Plugins
Product: Koha Reporter: Indranil Das Gupta <indradg>
Component: ToolsAssignee: Indranil Das Gupta <indradg>
Status: In Discussion --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P3 CC: f.demians, gmcharlt, indradg, kyle
Version: Main   
Hardware: All   
OS: All   
See Also: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10713
Change sponsored?: Sponsored Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Screenshot of plugins-menu.inc patch in action
plugins-menu.inc patch (commit msg without test plan)
plugins-menu.inc patch (commit msg with test plan)
Patch to add plugins-menu.inc nav menu

Description Indranil Das Gupta 2014-08-18 11:20:57 UTC
Unlike other *-menu.inc files in the /intranet-tmpl/prog/en/includes directory, Koha plugin do not include such a file.

This bug/patch is intended to add such sopport.
Comment 1 Indranil Das Gupta 2014-08-19 09:16:03 UTC
Created attachment 30973 [details]
Screenshot of plugins-menu.inc patch in action
Comment 2 Indranil Das Gupta 2014-08-19 09:25:26 UTC Comment hidden (obsolete)
Comment 3 Indranil Das Gupta 2014-08-19 09:27:59 UTC Comment hidden (obsolete)
Comment 4 Indranil Das Gupta 2014-08-22 03:12:24 UTC
Created attachment 31069 [details] [review]
Patch to add plugins-menu.inc nav menu

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.
Comment 5 Frédéric Demians 2014-10-26 08:04:27 UTC
I see one issue with this patch. It may be usefull, but the way it's implemented if included to Koha, all existing plugins in the wild would have to be updated to work properly with it: points 3 & 4 of your test plan. Plugins system author opinion is required.
Comment 6 Kyle M Hall 2016-10-24 14:27:43 UTC
(In reply to Frédéric Demians from comment #5)
> I see one issue with this patch. It may be usefull, but the way it's
> implemented if included to Koha, all existing plugins in the wild would have
> to be updated to work properly with it: points 3 & 4 of your test plan.
> Plugins system author opinion is required.

Considering such an enhancement won't break any existing plugin functionality I'm quite happy with this idea!

That being said, I'm not sure what the adoption rate would be. We'd definitely want to this to the reference plugin ( i.e. KitchenSink )