3 # Copyright 2011 Athens County Public Libraries
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 2 of the License, or (at your option) any later
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along
17 # with Koha; if not, write to the Free Software Foundation, Inc.,
18 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 use C4::Auth qw(:DEFAULT check_cookie_auth);
27 use C4::Dates qw(format_date);
30 use C4::Tags 0.03 qw(get_tags remove_tag get_tag_rows);
33 my $needed_flags = { tools => 'moderate_tags' }; # FIXME: replace when more specific permission is created.
36 my $op = $query->param('op') || '';
37 my $biblionumber = $query->param('biblionumber');
38 my $tag = $query->param('tag');
39 my $tag_id = $query->param('tag_id');
41 my ($template, $borrowernumber, $cookie) = get_template_and_user({
42 template_name => "tags/list.tmpl",
47 flagsrequired => $needed_flags,
52 print $query->redirect("/cgi-bin/koha/tags/list.pl?tag=$tag");
55 my $marcflavour = C4::Context->preference('marcflavour');
59 my $taglist = get_tag_rows({term=>$tag});
61 my $dat = &GetBiblioData($_->{biblionumber});
62 my $record = &GetMarcBiblio($_->{biblionumber});
63 $dat->{'subtitle'} = GetRecordValue('subtitle', $record, GetFrameworkCode($_->{biblionumber}));
64 my @items = GetItemsInfo( $_->{biblionumber} );
65 $dat->{biblionumber} = $_->{biblionumber};
66 $dat->{tag_id} = $_->{tag_id};
67 $dat->{items} = \@items;
68 $dat->{TagLoop} = get_tags({biblionumber=>$_->{biblionumber}, 'sort'=>'-weight',limit=>10 });
69 push( @results, $dat );
72 my $resultsarray = \@results;
76 titles => $resultsarray,
81 output_html_with_http_headers $query, $cookie, $template->output;