@@ -, +, @@ interface https://github.com/bywatersolutions/koha-plugin-kitchen-sink/releases/download/v2.1.19/koha-plugin-kitchen-sink-v2.1.19.kpz This will ensure the plugin takes effect right away, it should be necessary but it won't hurt anything! for your staff intranet is now orange ( assuming you've not customized the staff intranet in any way ) --- Koha/Template/Plugin/KohaPlugins.pm | 56 +++++++++++++++++++ .../prog/en/includes/doc-head-close.inc | 2 + .../prog/en/includes/intranet-bottom.inc | 1 + .../Koha/Template/Plugin/KohaPlugins.t | 6 +- t/db_dependent/Plugins.t | 2 + t/lib/Koha/Plugin/Test.pm | 10 ++++ 6 files changed, 76 insertions(+), 1 deletion(-) --- a/Koha/Template/Plugin/KohaPlugins.pm +++ a/Koha/Template/Plugin/KohaPlugins.pm @@ -93,4 +93,60 @@ sub get_plugins_opac_js { return join( "\n", @data ); } +=head3 get_plugins_intranet_head + +[% KohaPlugins.get_plugins_intranet_head %] + +This method collects the output of all plugins with an intranet_head method +to output to the head section of intranet pages. + +=cut + +sub get_plugins_intranet_head { + return q{} + unless C4::Context->preference('UseKohaPlugins'); + + my $p = Koha::Plugins->new(); + + return q{} unless $p; + + my @plugins = $p->GetPlugins( + { + method => 'intranet_head', + } + ); + + my @data = map { $_->intranet_head || q{} } @plugins; + + return join( "\n", @data ); +} + +=head3 get_plugins_intranet_js + +[% KohaPlugins.get_plugins_intranet_js %] + +This method collects the output of all plugins with an intranet_js method +to output to the javascript section of at the bottom of intranet pages. + +=cut + +sub get_plugins_intranet_js { + return q{} + unless C4::Context->preference('UseKohaPlugins'); + + my $p = Koha::Plugins->new(); + + return q{} unless $p; + + my @plugins = $p->GetPlugins( + { + method => 'intranet_js', + } + ); + + my @data = map { $_->intranet_js || q{} } @plugins; + + return join( "\n", @data ); +} + 1; --- a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc @@ -25,6 +25,8 @@ [% END %] [% IF ( IntranetUserCSS ) %][% END %] +[% KohaPlugins.get_plugins_intranet_head | html %] + [% UNLESS ( footerjs ) %] [% INCLUDE js_includes.inc %] [% END %] --- a/koha-tmpl/intranet-tmpl/prog/en/includes/intranet-bottom.inc +++ a/koha-tmpl/intranet-tmpl/prog/en/includes/intranet-bottom.inc @@ -72,4 +72,5 @@ [% jsinclude | $raw # Parse the page template's JavaScript block if necessary %] [% END %] +[% KohaPlugins.get_plugins_intranet_js | html %] --- a/t/db_dependent/Koha/Template/Plugin/KohaPlugins.t +++ a/t/db_dependent/Koha/Template/Plugin/KohaPlugins.t @@ -2,7 +2,7 @@ use Modern::Perl; -use Test::More tests => 10; +use Test::More tests => 14; use CGI; use File::Basename; use File::Spec; @@ -40,8 +40,12 @@ t::lib::Mocks::mock_preference('UseKohaPlugins',1); t::lib::Mocks::mock_config('enable_plugins',1); ok( index( $plugin->get_plugins_opac_js, 'Koha::Plugin::Test::opac_js' ) != -1, 'Test plugin opac_js return value is part of code returned by get_plugins_opac_js' ); ok( index( $plugin->get_plugins_opac_head, 'Koha::Plugin::Test::opac_head' ) != -1, 'Test plugin opac_head return value is part of code returned by get_plugins_opac_head' ); +ok( index( $plugin->get_plugins_intranet_js, 'Koha::Plugin::Test::intranet_js' ) != -1, 'Test plugin intranet_js return value is part of code returned by get_plugins_intranet_js' ); +ok( index( $plugin->get_plugins_intranet_head, 'Koha::Plugin::Test::intranet_head' ) != -1, 'Test plugin intranet_head return value is part of code returned by get_plugins_intranet_head' ); t::lib::Mocks::mock_preference('UseKohaPlugins',0); t::lib::Mocks::mock_config('enable_plugins',0); is( $plugin->get_plugins_opac_js, q{}, 'Test plugin opac_js return value is empty' ); is( $plugin->get_plugins_opac_head, q{}, 'Test plugin opac_head return value is empty' ); +is( $plugin->get_plugins_intranet_js, q{}, 'Test plugin intranet_js return value is empty' ); +is( $plugin->get_plugins_intranet_head, q{}, 'Test plugin intranet_head return value is empty' ); --- a/t/db_dependent/Plugins.t +++ a/t/db_dependent/Plugins.t @@ -47,6 +47,8 @@ ok( $plugin->can('opac_online_payment_begin'), 'Test plugin can opac_online_paym ok( $plugin->can('opac_online_payment_end'), 'Test plugin can opac_online_payment_end' ); ok( $plugin->can('opac_head'), 'Test plugin can opac_head' ); ok( $plugin->can('opac_js'), 'Test plugin can opac_js' ); +ok( $plugin->can('intranet_head'), 'Test plugin can intranet_head' ); +ok( $plugin->can('intranet_js'), 'Test plugin can intranet_js' ); ok( $plugin->can('configure'), 'Test plugin can configure' ); ok( $plugin->can('install'), 'Test plugin can install' ); ok( $plugin->can('upgrade'), 'Test plugin can upgrade' ); --- a/t/lib/Koha/Plugin/Test.pm +++ a/t/lib/Koha/Plugin/Test.pm @@ -70,6 +70,16 @@ sub opac_js { return "Koha::Plugin::Test::opac_js"; } +sub intranet_head { + my ( $self, $args ) = @_; + return "Koha::Plugin::Test::intranet_head"; +} + +sub intranet_js { + my ( $self, $args ) = @_; + return "Koha::Plugin::Test::intranet_js"; +} + sub configure { my ( $self, $args ) = @_; return "Koha::Plugin::Test::configure";; --