View | Details | Raw Unified | Return to bug 27114
Collapse All | Expand All

(-)a/Koha/Template/Plugin/KohaPlugins.pm (+37 lines)
Lines 21-26 use Modern::Perl; Link Here
21
21
22
use base qw( Template::Plugin );
22
use base qw( Template::Plugin );
23
23
24
use Try::Tiny;
25
24
use Koha::Plugins;
26
use Koha::Plugins;
25
27
26
=head1 NAME
28
=head1 NAME
Lines 145-148 sub get_plugins_intranet_js { Link Here
145
    return join( "\n", @data );
147
    return join( "\n", @data );
146
}
148
}
147
149
150
sub get_plugins_intranet_catalog_biblio_tab {
151
152
    my $tabs = [];
153
154
    return $tabs unless C4::Context->config("enable_plugins");
155
156
    my $p = Koha::Plugins->new();
157
    return $tabs unless $p;
158
159
    my @plugins = $p->GetPlugins(
160
        {
161
            method => 'intranet_catalog_biblio_tab',
162
        }
163
    );
164
165
    foreach my $plugin (@plugins) {
166
        try {
167
            my @newtabs = $plugin->intranet_catalog_biblio_tab();
168
            foreach my $newtab (@newtabs) {
169
                # Add a unique HTML id
170
                my $html_id = 'tab-'. $plugin->{class} . '-' . $newtab->title;
171
                # Using characters except ASCII letters, digits, '_', '-' and '.' may cause compatibility problems
172
                $html_id =~ s/[^0-9A-Za-z]+/-/g;
173
                $newtab->id($html_id);
174
            }
175
            push @$tabs, @newtabs;
176
        }
177
        catch {
178
            warn "Error calling 'intranet_catalog_biblio_tab' on the " . $plugin->{class} . "plugin ($_)";
179
        };
180
    }
181
182
    return $tabs;
183
}
184
148
1;
185
1;
(-)a/catalogue/detail.pl (-23 lines)
Lines 70-100 if ( C4::Context->config('enable_plugins') ) { Link Here
70
    my @plugins = Koha::Plugins->new()->GetPlugins({
70
    my @plugins = Koha::Plugins->new()->GetPlugins({
71
        method => 'intranet_catalog_biblio_enhancements_toolbar_button'
71
        method => 'intranet_catalog_biblio_enhancements_toolbar_button'
72
    });
72
    });
73
74
    my @tab_plugins = Koha::Plugins->new()->GetPlugins({
75
        method => 'intranet_catalog_biblio_tab',
76
    });
77
    my @tabs;
78
    foreach my $tab_plugin (@tab_plugins) {
79
        my @biblio_tabs;
80
81
        try {
82
            @biblio_tabs = $tab_plugin->intranet_catalog_biblio_tab();
83
            foreach my $tab (@biblio_tabs) {
84
                my $tab_id = 'tab-' . $tab->title;
85
                $tab_id =~ s/[^0-9A-Za-z]+/-/g;
86
                $tab->id( $tab_id );
87
                push @tabs, $tab,
88
            }
89
        }
90
        catch {
91
            warn "Error calling 'intranet_catalog_biblio_tab' on the " . $tab_plugin->{class} . "plugin ($_)";
92
        };
93
    }
94
95
    $template->param(
73
    $template->param(
96
        plugins => \@plugins,
74
        plugins => \@plugins,
97
        tabs => \@tabs,
98
    );
75
    );
99
}
76
}
100
77
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt (-6 / +8 lines)
Lines 2-7 Link Here
2
[% USE Asset %]
2
[% USE Asset %]
3
[% USE Koha %]
3
[% USE Koha %]
4
[% USE KohaDates %]
4
[% USE KohaDates %]
5
[% USE KohaPlugins %]
5
[% USE AuthorisedValues %]
6
[% USE AuthorisedValues %]
6
[% USE Branches %]
7
[% USE Branches %]
7
[% USE Biblio %]
8
[% USE Biblio %]
Lines 30-35 Link Here
30
    [% END %]
31
    [% END %]
31
[% END %]
32
[% END %]
32
33
34
[% SET plugins_intranet_catalog_biblio_tabs = KohaPlugins.get_plugins_intranet_catalog_biblio_tab %]
35
33
[% SET footerjs = 1 %]
36
[% SET footerjs = 1 %]
34
[% INCLUDE 'doc-head-open.inc' %]
37
[% INCLUDE 'doc-head-open.inc' %]
35
<title>Koha &rsaquo; Catalog &rsaquo;
38
<title>Koha &rsaquo; Catalog &rsaquo;
Lines 257-264 Link Here
257
[% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && Koha.Preference('NovelistSelectStaffView') == 'tab' ) %]
260
[% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && Koha.Preference('NovelistSelectStaffView') == 'tab' ) %]
258
    <li class="NovelistSelect" style="display:none;"><a href="#NovelistSelect">NoveList Select</a></li>
261
    <li class="NovelistSelect" style="display:none;"><a href="#NovelistSelect">NoveList Select</a></li>
259
[% END %]
262
[% END %]
260
[% FOREACH tab IN tabs %]
263
[% FOREACH plugins_intranet_catalog_biblio_tab IN plugins_intranet_catalog_biblio_tabs %]
261
    <li><a href="#[% tab.id | uri %]">[% tab.title | html %]</a></li>
264
    <li><a href="#[% plugins_intranet_catalog_biblio_tab.id | uri %]">[% plugins_intranet_catalog_biblio_tab.title | html %]</a></li>
262
[% END %]
265
[% END %]
263
</ul>
266
</ul>
264
267
Lines 933-941 Note that permanent location is a code, and location may be an authval. Link Here
933
    </div>
936
    </div>
934
[% END %]
937
[% END %]
935
938
936
[% FOREACH tab IN tabs %]
939
[% FOREACH plugins_intranet_catalog_biblio_tab IN plugins_intranet_catalog_biblio_tabs %]
937
    <div id="[% tab.id | html %]">
940
    <div id="[% plugins_intranet_catalog_biblio_tab.id | html %]">
938
        [% tab.content | $raw %]
941
        [% plugins_intranet_catalog_biblio_tab.content | $raw %]
939
    </div>
942
    </div>
940
[% END %]
943
[% END %]
941
944
942
- 

Return to bug 27114