Summary: | Addition of plugins-menu.inc for adding a nav menu for Koha Plugins | ||
---|---|---|---|
Product: | Koha | Reporter: | Indranil Das Gupta <indradg> |
Component: | Tools | Assignee: | 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: | ||
Circulation function: | |||
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
Created attachment 30973 [details]
Screenshot of plugins-menu.inc patch in action
Created attachment 30974 [details] [review] plugins-menu.inc patch (commit msg without test plan) Created attachment 30976 [details] [review] plugins-menu.inc patch (commit msg with test plan) 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. 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. 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. (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 ) |