Merge branch 'bug_8278' into 3.14-master
This commit is contained in:
commit
a167834144
2 changed files with 45 additions and 58 deletions
|
@ -29,9 +29,10 @@ use CGI;
|
||||||
use C4::Context;
|
use C4::Context;
|
||||||
use C4::Charset;
|
use C4::Charset;
|
||||||
use C4::Auth qw/check_cookie_auth/;
|
use C4::Auth qw/check_cookie_auth/;
|
||||||
|
use JSON qw/ to_json /;
|
||||||
|
|
||||||
my $input = new CGI;
|
my $input = new CGI;
|
||||||
my $query = $input->param('query');
|
my $query = $input->param('term');
|
||||||
my $table = $input->param('table');
|
my $table = $input->param('table');
|
||||||
my $field = $input->param('field');
|
my $field = $input->param('field');
|
||||||
|
|
||||||
|
@ -41,7 +42,7 @@ die() unless ($table eq "biblioitems");
|
||||||
binmode STDOUT, ":encoding(UTF-8)";
|
binmode STDOUT, ":encoding(UTF-8)";
|
||||||
print $input->header( -type => 'text/plain', -charset => 'UTF-8' );
|
print $input->header( -type => 'text/plain', -charset => 'UTF-8' );
|
||||||
|
|
||||||
my ( $auth_status, $sessionID ) = check_cookie_auth( $input->cookie('CGISESSID'), { cataloguing => '*' } );
|
my ( $auth_status, $sessionID ) = check_cookie_auth( $input->cookie('CGISESSID'), { editcatalogue => '*' } );
|
||||||
if ( $auth_status ne "ok" ) {
|
if ( $auth_status ne "ok" ) {
|
||||||
exit 0;
|
exit 0;
|
||||||
}
|
}
|
||||||
|
@ -54,8 +55,9 @@ $sql .= qq( ORDER BY $field);
|
||||||
my $sth = $dbh->prepare($sql);
|
my $sth = $dbh->prepare($sql);
|
||||||
$sth->execute("$query%", "% $query%", "%-$query%");
|
$sth->execute("$query%", "% $query%", "%-$query%");
|
||||||
|
|
||||||
|
my $a = [];
|
||||||
while ( my $rec = $sth->fetchrow_hashref ) {
|
while ( my $rec = $sth->fetchrow_hashref ) {
|
||||||
print nsb_clean($rec->{$field}) . "\n";
|
push @$a, { fieldvalue => nsb_clean($rec->{$field}) };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
print to_json($a);
|
||||||
|
|
|
@ -1,61 +1,47 @@
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD Xhtml 1.0 Transitional//EN"
|
[% INCLUDE 'doc-head-open.inc' %]
|
||||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
<title>Koha › UNIMARC field 210c builder</title>
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
[% INCLUDE 'doc-head-close.inc' %]
|
||||||
<head>
|
<style type="text/css">
|
||||||
<title>UNIMARC field 225a builder</title>
|
#custom-doc { width:37.85em;*width:36.93em;min-width:492px; margin:auto; text-align:left; }
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
</style>
|
||||||
<script type="text/javascript" src="[% yuipath %]/utilities/utilities.js"></script>
|
|
||||||
<script type="text/javascript" src="[% yuipath %]/datasource/datasource.js"></script>
|
|
||||||
<script type="text/javascript" src="[% yuipath %]/autocomplete/autocomplete-min.js"></script>
|
|
||||||
<link rel="stylesheet" type="text/css" href="[% themelang %]/css/staff-global.css" />
|
|
||||||
|
|
||||||
</head>
|
|
||||||
<body id="cat_unimarc_field_210c_bis" class="cat">
|
|
||||||
<div id="header_search">
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
//<![CDATA[
|
//<![CDATA[
|
||||||
YAHOO.util.Event.onContentReady("header_search", function() {
|
$(document).ready(function(){
|
||||||
new function() {
|
$( "#findvalue" ).autocomplete({
|
||||||
// Define a custom formatter function
|
source: "/cgi-bin/koha/cataloguing/ysearch.pl?table=biblioitems&field=publishercode",
|
||||||
this.fnCustomFormatter = function(oResultItem, sQuery) {
|
minLength: 3,
|
||||||
var name = oResultItem[0];
|
select: function( event, ui ) {
|
||||||
var aMarkup = [
|
$( "#findvalue" ).val( ui.item.fieldvalue );
|
||||||
"<div class=\"sample-result\">",
|
return false;
|
||||||
name,
|
}
|
||||||
"<\/div>"];
|
})
|
||||||
return (aMarkup.join(""));
|
.data( "autocomplete" )._renderItem = function( ul, item ) {
|
||||||
|
return $( "<li></li>" )
|
||||||
|
.data( "item.autocomplete", item )
|
||||||
|
.append( "<a>" + item.fieldvalue + "</a>" )
|
||||||
|
.appendTo( ul );
|
||||||
};
|
};
|
||||||
|
|
||||||
// Instantiate one XHR DataSource and define schema as an array:
|
|
||||||
// ["Record Delimiter",
|
|
||||||
// "Field Delimiter"]
|
|
||||||
this.oACDS = new YAHOO.widget.DS_XHR("/cgi-bin/koha/cataloguing/ysearch.pl", ["\n", "\t"]);
|
|
||||||
this.oACDS.scriptQueryAppend = "table=biblioitems&field=publishercode";
|
|
||||||
this.oACDS.responseType = YAHOO.widget.DS_XHR.TYPE_FLAT;
|
|
||||||
this.oACDS.maxCacheEntries = 60;
|
|
||||||
this.oACDS.queryMatchSubset = false;
|
|
||||||
|
|
||||||
// Instantiate first AutoComplete
|
|
||||||
var myInput = document.getElementById('findvalue');
|
|
||||||
var myContainer = document.getElementById('yvaluecontainer');
|
|
||||||
this.oAutoComp = new YAHOO.widget.AutoComplete(myInput,myContainer,this.oACDS);
|
|
||||||
//this.oAutoComp.delimChar = ";";
|
|
||||||
this.oAutoComp.queryDelay = 1;
|
|
||||||
this.oAutoComp.formatResult = this.fnCustomFormatter;
|
|
||||||
this.oAutoComp.maxResultsDisplayed = 1000;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
//]]>
|
//]]>
|
||||||
</script>
|
</script>
|
||||||
<div id="mainbloc">
|
|
||||||
|
|
||||||
<div id="plugin">
|
</head>
|
||||||
|
<body id="cat_unimarc_field_210c_bis" class="cat">
|
||||||
|
|
||||||
|
<div id="custom-doc" class="yui-t7">
|
||||||
|
<div id="bd">
|
||||||
|
|
||||||
|
<h1>UNIMARC field 210c builder</h1>
|
||||||
<div class="autocomplete">
|
<div class="autocomplete">
|
||||||
<form name="f_pop" onsubmit="javascript:report()" action="">
|
<form name="f_pop" onsubmit="javascript:report()" action="">
|
||||||
<div id="borrowerautocomplete" class="autocomplete">
|
<div id="fieldautocomplete" class="autocomplete">
|
||||||
<input autocomplete="off" id="findvalue" name="findvalue" size="40" class="focus" type="text" /><br /><br />
|
<fieldset>
|
||||||
<input id="ysearchsubmit" type="submit" class="submit" value="Submit" />
|
<input autocomplete="off" id="findvalue" name="findvalue" size="40" class="focus" type="text" />
|
||||||
<div id="yvaluecontainer"></div>
|
<fieldset class="action">
|
||||||
|
<input type="submit" class="submit" value="Choose" />
|
||||||
|
</fieldset>
|
||||||
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
@ -71,5 +57,4 @@ YAHOO.util.Event.onContentReady("header_search", function() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
[% INCLUDE 'popup-bottom.inc' %]
|
||||||
</html>
|
|
Loading…
Reference in a new issue