Koha/koha-tmpl/intranet-tmpl/prog/js/auth-finder-search.js
Owen Leonard 5e563d81aa Bug 19786: (follow-up) Correct js include path, popup window size
This follow-up adds the required KOHA_VERSION variable to two templates
where it was missing.

This patch also adds a 'window_size' parameter to a popup window
function so that self-closing windows like blinddetail-biblio-search.pl
can appear small and others at a reasonable size.

To test, apply the patch and clear your browser cache if
necessary.

- Confirm that the QA tools do not complain about missing KOHA_VERSION
  in auth_finder.tt and searchresultlist_auth.tt.

- Open a bibliographic record for editing in the basic editor using a
  framework in which a field is linked to authorities.
- Trigger the authority selection window for that field.
- Click the "Clear field" button at the top of the authority search
  pop-up window. Another smaller popup window should briefly appear, and
  then both windows should close.
- Trigger the authority selection window again.
- Click the "Create new authority" button. A new window should appear
  with the MARC authority editor. The window should be a usable size.

Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
2018-03-26 17:31:20 -03:00

104 lines
3.4 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: "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: {
authtypecode : authtypecode,
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: {
authtypecode : authtypecode,
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,
});
});
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');
}