Owen Leonard
ef0cf7b9a6
In order to facilitate a more painless process for converting to jQueryUI I will submit separate patches for various "widgets," starting with Autocomplete. This patch replaces all instances of YUI autocomplete with a jQueryUI version. The patch includes an up-to-date version of jQuery and jQueryUI libraries. The patch also moves some markup in instances where it should have been removed in favor of a different include. To test, find the various autocomplete instances and confirm that they are working: - Circulation search header autocomplete - Overdues patron attribute authorized value filter (must have patron attributes enabled, and a patron attribute defined which uses authorized values. - Authorities search plugin. Edit a MARC record and use an authorities plugin link to do a search for authority records. Incomplete: There is a YUI autocomplete instance in a UNIMARC plugin (unimarc_field_210c_bis.tt) which I couldn't figure out how to test, even on a sandbox set up with UNIMARC. I could use help with a follow-up. http://bugs.koha-community.org/show_bug.cgi?id=7447 Signed-off-by: Liz Rea <wizzyrea@gmail.com> Passes all tests outlined, is quite pretty. Passes t xt Signed-off-by: Ian Walls <koha.sekjal@gmail.com>
59 lines
No EOL
2 KiB
Perl
Executable file
59 lines
No EOL
2 KiB
Perl
Executable file
#!/usr/bin/perl
|
|
|
|
# This software is placed under the gnu General Public License, v2 (http://www.gnu.org/licenses/gpl.html)
|
|
|
|
# Parts copyright 2012 Athens County Public Libraries
|
|
# This file is part of Koha.
|
|
#
|
|
# Koha is free software; you can redistribute it and/or modify it under the
|
|
# terms of the GNU General Public License as published by the Free Software
|
|
# Foundation; either version 2 of the License, or (at your option) any later
|
|
# version.
|
|
#
|
|
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License along with
|
|
# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
|
|
# Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
use strict;
|
|
use warnings;
|
|
use CGI;
|
|
use C4::Context;
|
|
use C4::Auth qw/check_cookie_auth/;
|
|
use C4::Debug;
|
|
|
|
my $input = new CGI;
|
|
my $query = $input->param('term');
|
|
my $attrcode = $input->path_info || '';
|
|
$attrcode =~ s|^/||;
|
|
|
|
my ( $auth_status, $sessionID ) = check_cookie_auth( $input->cookie('CGISESSID'), { circulate => '*' } );
|
|
exit 0 if $auth_status ne "ok";
|
|
|
|
binmode STDOUT, ":encoding(UTF-8)";
|
|
print $input->header( -type => 'text/plain', -charset => 'UTF-8' );
|
|
|
|
print STDERR ">> CALLING $0 (attrcode=$attrcode, query=$query)\n" if $debug;
|
|
|
|
my $dbh = C4::Context->dbh;
|
|
my $sql = qq(SELECT authorised_value, lib description
|
|
FROM borrower_attribute_types b, authorised_values v
|
|
WHERE b.code=?
|
|
AND b.authorised_value_category = v.category
|
|
AND v.lib like ?);
|
|
my $sth = $dbh->prepare($sql);
|
|
$sth->execute( $attrcode, "$query%" );
|
|
|
|
print "[";
|
|
my $i = 0;
|
|
while ( my $rec = $sth->fetchrow_hashref ) {
|
|
print STDERR ">> attrcode=$attrcode match '$query' ==> $rec->{description} ($rec->{authorised_value})\n" if $debug;
|
|
print "{\"description\":\"" . $rec->{description} . "\",\"" .
|
|
"authorised_value\":\"" . $rec->{authorised_value} . "\"" .
|
|
"}";
|
|
$i++;
|
|
}
|
|
print "]"; |