Bug 26338: Show tool plugins run in tools home

In tools home there is a link to the table showing tool plugins.
Would be great to be able to run a tool plugin directly from tools home.

Also adds the behavior than if there is no tool plugin, "Tool plugins"
section is not displayed in tools home.
No need of a link that goes to an empty table ;)

Test plan :
1) Enable plugins, dont install any
2) Go to "Tools" module : /cgi-bin/koha/tools/tools-home.pl
3) Check you dont see "Tool plugins"
4) Install a tool plugin like Carrousel https://inlibro.com/instructions-carrousel/
5) Refresh /cgi-bin/koha/tools/tools-home.pl
6) Check you see "Tool plugins" and a link to Carrousel
7) Click on link to Carrousel => You see plugin run
8) Disable Carrousel plugin
9) Refresh /cgi-bin/koha/tools/tools-home.pl
10) Check you dont see "Tool plugins"

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Fridolin Somers 2020-09-01 15:43:19 +02:00 committed by Jonathan Druart
parent d7e9388e4d
commit fb59f3f0f0
3 changed files with 21 additions and 4 deletions

View File

@ -1336,8 +1336,7 @@ dt {
dd {
font-size: 90%;
font-weight: normal;
padding: .2em;
text-indent: 2.5em;
padding: .2em .2em .2em 2.5em;
}
#toolbar,

View File

@ -120,9 +120,20 @@
<dd>Quote editor for Quote-of-the-day feature in OPAC</dd>
[% END %]
[% IF ( Koha.ArePluginsEnabled() && CAN_user_plugins_tool ) %]
[% IF ( Koha.ArePluginsEnabled() && CAN_user_plugins_tool && tool_plugins ) %]
<dt><a href="/cgi-bin/koha/plugins/plugins-home.pl?method=tool">Tool plugins</a></dt>
<dd>Use tool plugins</dd>
<dd>
Use tool plugins
<ul>
[% FOREACH plugin IN tool_plugins %]
<li class="plugin_link">
<a href="/cgi-bin/koha/plugins/run.pl?class=[% plugin.class | uri %]&method=tool">
<span class="plugin_name">[% plugin.metadata.name | html %]</span>
</a>
</li>
[% END %]
</ul>
</dd>
[% END %]
[% IF ( CAN_user_tools_upload_general_files ) %]

View File

@ -42,4 +42,11 @@ $template->param(
pendingtags => $pendingtags
);
if ( C4::Context->config('enable_plugins') ) {
my @tool_plugins = Koha::Plugins->new()->GetPlugins({
method => 'tool',
});
$template->param( tool_plugins => \@tool_plugins );
}
output_html_with_http_headers $query, $cookie, $template->output;