3 # Copyright 2012 BibLibre
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.
22 ajax-getauthvaluedropbox.pl - returns an authorised values dropbox
26 this script returns an authorised values dropbox
34 The name of the dropbox.
38 The category of authorised values.
42 Default value for the dropbox.
55 my $name = $input->param('name');
56 my $category = $input->param('category');
57 my $default = $input->param('default');
58 $default = C4::Charset::NormalizeString($default);
60 binmode STDOUT, ':encoding(UTF-8)';
61 print $input->header(-type => 'text/plain', -charset => 'UTF-8');
62 my $avs = GetAuthvalueDropbox($category, $default);
63 my $html = qq|<select id="$name", name="$name">|;
64 for my $av ( @$avs ) {
65 if ( $av->{default} ) {
66 $html .= qq|<option value="$av->{value}" selected="selected">$av->{label}</option>|;
68 $html .= qq|<option value="$av->{value}">$av->{label}</option>|;
71 $html .= qq|</select>|;