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 280-287 Link Here
280
[% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && Koha.Preference('NovelistSelectStaffView') == 'tab' ) %]
283
[% IF ( Koha.Preference('NovelistSelectStaffEnabled') && Koha.Preference('NovelistSelectStaffProfile') && Koha.Preference('NovelistSelectStaffView') == 'tab' ) %]
281
    <li class="NovelistSelect" style="display:none;"><a href="#NovelistSelect">NoveList Select</a></li>
284
    <li class="NovelistSelect" style="display:none;"><a href="#NovelistSelect">NoveList Select</a></li>
282
[% END %]
285
[% END %]
283
[% FOREACH tab IN tabs %]
286
[% FOREACH plugins_intranet_catalog_biblio_tab IN plugins_intranet_catalog_biblio_tabs %]
284
    <li><a href="#[% tab.id | uri %]">[% tab.title | html %]</a></li>
287
    <li><a href="#[% plugins_intranet_catalog_biblio_tab.id | uri %]">[% plugins_intranet_catalog_biblio_tab.title | html %]</a></li>
285
[% END %]
288
[% END %]
286
</ul>
289
</ul>
287
290
Lines 951-959 Note that permanent location is a code, and location may be an authval. Link Here
951
    </div>
954
    </div>
952
[% END %]
955
[% END %]
953
956
954
[% FOREACH tab IN tabs %]
957
[% FOREACH plugins_intranet_catalog_biblio_tab IN plugins_intranet_catalog_biblio_tabs %]
955
    <div id="[% tab.id | html %]">
958
    <div id="[% plugins_intranet_catalog_biblio_tab.id | html %]">
956
        [% tab.content | $raw %]
959
        [% plugins_intranet_catalog_biblio_tab.content | $raw %]
957
    </div>
960
    </div>
958
[% END %]
961
[% END %]
959
962
960
- 

Return to bug 27114