Koha/koha-tmpl/intranet-tmpl/prog/en/includes/auth-finder-search.inc
Owen Leonard ef0cf7b9a6 Bug 7747 - Replace YUI autocomplete with jQueryUI
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>
2012-05-31 18:07:55 +02:00

165 lines
6.9 KiB
HTML

<script type="text/javascript">
//<![CDATA[
$(document).ready(function(){
// marclist
$( "#value_any" ).autocomplete({
source: function(request, response) {
$.ajax({
url: "/cgi-bin/koha/authorities/ysearch.pl",
dataType: "json",
data: {
term: request.term,
op: "do_search",
type: "intranet",
and_or: "and",
operator: "contains",
orderby: "HeadingAsc",
querytype: "marclist"
},
success: function(data) {
response( $.map( data, function( item ) {
return {
label: item.summary,
value: item.summary
}
}));
}
});
},
minLength: 3,
});
// mainentry
$( "#value_main" ).autocomplete({
source: function(request, response) {
$.ajax({
url: "/cgi-bin/koha/authorities/ysearch.pl",
dataType: "json",
data: {
term: request.term,
op: "do_search",
type: "intranet",
and_or: "and",
operator: "contains",
orderby: "HeadingAsc",
querytype: "mainentry"
},
success: function(data) {
response( $.map( data, function( item ) {
return {
label: item.summary,
value: item.summary
}
}));
}
});
},
minLength: 3,
});
// mainmainentry
$( "#value_mainstr" ).autocomplete({
source: function(request, response) {
$.ajax({
url: "/cgi-bin/koha/authorities/ysearch.pl",
dataType: "json",
data: {
term: request.term,
op: "do_search",
type: "intranet",
and_or: "and",
operator: "contains",
orderby: "HeadingAsc",
querytype: "mainmainentry"
},
success: function(data) {
response( $.map( data, function( item ) {
return {
label: item.summary,
value: item.summary
}
}));
}
});
},
minLength: 3,
});
});
//]]>
</script>
<span id="header_search">
<form name="f" method="get" action="auth_finder.pl">
<input type="hidden" name="op" value="do_search" />
<input type="hidden" name="type" value="intranet" />
<input type="hidden" name="index" value="[% index %]" />
<fieldset class="rows"><ol><li>
<span class="label">Authority type</span>
[% authtypecode %]
<input type="hidden" name="authtypecode" value="[% authtypecode %]" />
</li>
<li>
<label for="mainmainentry">Main entry ($a only)</label>
<input type="hidden" name="marclist" value="mainmainentry" />
<input type="hidden" name="and_or" value="and" />
<input type="hidden" name="excluding" value="" />
<select name="operator" id="mainmainentry">
<option value="contains">contains</option>
<option value="start">starts with</option>
<option value="is">is exactly</option>
</select>
<input id="value_mainstr" style="width:400px;" type="text" name="value_mainstr" value="[% value_mainstr |html %]" />
<div id="yvaluecontainermainmainentry"></div>
</li>
<li>
<label for="mainentry">Main entry</label>
<input type="hidden" name="marclist" value="mainentry" />
<input type="hidden" name="and_or" value="and" />
<input type="hidden" name="excluding" value="" />
<select name="operator" id="mainentry">
<option value="contains">contains</option>
<option value="start">starts with</option>
<option value="is">is exactly</option>
</select>
<input id="value_main" style="width:400px;" type="text" name="value_main" value="[% value_main |html %]" />
<div id="yvaluecontainermainentry"></div>
</li>
<li>
<label for="marclist">Anywhere</label>
<input type="hidden" name="marclist" value="any" />
<input type="hidden" name="and_or" value="and" />
<input type="hidden" name="excluding" value="" />
<select name="operator" id="marclist">
<option value="contains">contains</option>
<option value="start">starts with</option>
<option value="is">is exactly</option>
</select>
<input id="value_any" style="width:400px;" type="text" name="value_any" value="[% value_any |html %]" />
<div id="yvaluecontainermarclist"></div>
</li>
<li>
<label for="marclist">Heading match</label>
<input type="hidden" name="marclist" value="match" />
<input type="hidden" name="and_or" value="and" />
<input type="hidden" name="excluding" value="" />
<select name="operator" id="marclist">
<option value="contains">contains</option>
<option value="start">starts with</option>
<option value="is">is exactly</option>
</select>
<input type="text" name="value_match" value="[% value_match |html %]" />
</li>
<li>
<label for="orderby">Sort by </label>
<select name="orderby" id="orderby">
<option value="">No order</option>
<option value="HeadingAsc" selected="selected">Heading ascendant</option>
<option value="HeadingDsc">Heading descendant</option>
</select>
</li></ol></fieldset>
<fieldset class="action"> <input type="submit" value="Start search" class="submit" /> <a class="cancel close" href="#">Cancel</a></fieldset>
</form>
</span>