Koha/koha-tmpl/intranet-tmpl/prog/js/auth-finder-search.js
Aleisha Amohia a9731a2d17
Bug 31132: Add button to clear the cataloguing auth finder form
This enhancement adds a 'Clear form' link to empty all of the input
fields on the authority finder plugin form when cataloguing
bibliographic records.

To test:
1) Search for a bibliographic record in the staff interface
2) Edit a record
3) Go to tabs 1, 6 or 7 to find a tag linked to the authority finder
plugin
4) Launch the authority finder plugin by clicking the Tag editor icon at
the end of the field
5) If the fields are empty, add some text in the text fields
6) Click the 'Clear form' link at the bottom of the form
7) Confirm the text is cleared from the input fields and the form is
empty

Sponsored-by: Education Services Australia SCIS

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: nicolas <nicolas@inlibro.com>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
2023-06-23 11:00:58 -03:00

107 lines
3.5 KiB
JavaScript

/* global index authtypecode */
$(document).ready(function(){
$("#clear").on("click",function(e){
e.preventDefault();
finderjump('blinddetail-biblio-search.pl?authid=0&index=' + index );
});
$("#createnew").on("click",function(e){
e.preventDefault();
finderjump('authorities.pl?index=' + index + '&authtypecode=' + authtypecode, 'full' );
});
// marclist
$( "#value_any" ).autocomplete({
source: function(request, response) {
$.ajax({
url: "/cgi-bin/koha/authorities/ysearch.pl",
dataType: "json",
data: {
authtypecode : authtypecode,
term: request.term,
op: "do_search",
type: "intranet",
and_or: "and",
operator: "start",
orderby: "HeadingAsc",
querytype: "all"
},
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: {
authtypecode : authtypecode,
term: request.term,
op: "do_search",
type: "intranet",
and_or: "and",
operator: "start",
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: {
authtypecode : authtypecode,
term: request.term,
op: "do_search",
type: "intranet",
and_or: "and",
operator: "start",
orderby: "HeadingAsc",
querytype: "mainmainentry"
},
success: function(data) {
response( $.map( data, function( item ) {
return {
label: item.summary,
value: item.summary
};
}));
}
});
},
minLength: 3,
});
$("#clear-form").click(function(){
$(":input[type='text']").val('');
});
});
function finderjump(page, full){
var window_size = '';
if( full != "full"){
window_size = 'width=100,height=100,';
}
window.open(page,'', window_size + 'resizable=yes,toolbar=false,scrollbars=yes,top');
}