Koha/koha-tmpl/intranet-tmpl/prog/js/z3950_search.js
Hector Castro f240a91640 Bug 16812: Revise JS script for z3950_search.tts and remove onclick events
Modify JS script to all templates for z3950_search.tt and reduce the
redundant code

This patch propose:
-z3950_auth_search.tt has various onclick events used in links.
 Also fix: acqui/z3950_search.tt and cataloguing/z3950_search.tt
-Trigger onclick events via JQuery .on()
-Make a separate .js and .inc file
-Reduce the number of line and redundant code
-Also add Font Awesome Icons to "Select/Clear all" and "Clear search
 form" links

To test:
1-Apply bug 16600 on top
2-Apply patch
3-Go to Authorities > click New from Z39.50
4-Fill some fields and click in "Clear search form" link
5-Search under "Dalton" or another author that launch too many headings
6-Clic in some heading and notice the dialog open, test: "Preview MARC",
  ISBD (when showed), "Import" and close the dialog "X". Use the
  "Import" from table too.
7-Use the "next/previous page" button, change "Go to page" to number in and
  out of the range presented, also test whit a letter, etc.

Go to Cataloging > New from Z39.50/SRU
Repeat steps 3 to 6. But this time with bib records.

Go to Adquisition > Open or Create a basket and choose to "Add to basket"
button. A modal appear, chose the option "Order from external source"
Repeat steps 3 to 6. But this thime with bib records.

NOTE: The icon trash for "Clear search form" has been selected according
with module "Advanced search" there is an icon trash with link "Clear
fields" that has the same fuctionality.
For some reason the image loading-small.gif does not charge all times
when the code is get out of the template. (Fixed with this new patch)
DataTable it is specific for each template

Sponsored-by: Universidad de El Salvador
Signed-off-by: Owen Leonard <oleonard@myacpl.org>

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

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2016-07-15 15:24:57 +00:00

98 lines
3.9 KiB
JavaScript

//z3950_search.js for Authorities, Bib records and Acquisitions module
function Import(Breeding, recordid, AuthType, FrameworkCode) {
if ( AuthType == false ) {
opener.document.location="../cataloguing/addbiblio.pl?biblionumber="+recordid+"&z3950=1&frameworkcode="+FrameworkCode+"&breedingid="+Breeding;
} else {
opener.document.location="../authorities/authorities.pl?breedingid="+Breeding+"&authtypecode="+AuthType+"&authid="+recordid;
}
window.close();
return false;
}
$( document ).ready( function() {
$( "#CheckAll" ).click( function() {
$( ".checkboxed" ).checkCheckboxes();
return false;
});
$( "#CheckNone" ).click( function() {
$( ".checkboxed" ).unCheckCheckboxes();
return false;
});
$( "#close_menu" ).on( "click", function(e) {
e.preventDefault();
$( ".linktools" ).hide();
$( "tr" ).removeClass( "selected" );
return false;
});
$( ".submit" ).on( "click", function() {
$( "body" ).css( "cursor", "wait" );
});
$( "[name='changepage_prev']" ).on( "click", function() {
var data_current_page_prev = $( this ).data( "currentpage" );
$( '#current_page' ).val( data_current_page_prev - 1 );
$( '#page_form' ).submit();
});
$( "[name='changepage_next']" ).on( "click", function() {
var data_current_page_next = $( this ).data( "currentpage" );
$( '#current_page' ).val( data_current_page_next + 1 );
$( '#page_form' ).submit();
});
$( "[name='changepage_goto']" ).on( "click", function() {
return validate_goto_page();
});
$( "#resetZ3950Search" ).click( function(e) {
e.preventDefault();
$( "form[name='f']" ).find( "input[type=text]" ).val( "" );
});
$( "form[name='f']" ).submit( function() {
if ( $( 'input[type=checkbox]' ).filter( ':checked' ).length == 0 ) {
alert( MSG_CHOOSE_Z3950 );
$( "body" ).css( "cursor", "default" );
return false;
} else {
return true;
}
});
$( ".previewMARC" ).on( "click", function(e) {
e.preventDefault();
var ltitle = $( this ).text();
var page = $( this ).attr( "href" );
$( "#marcPreviewLabel" ).text( ltitle );
$( "#marcPreview .modal-body" ).load( page + " pre" );
$( '#marcPreview' ).modal( {show:true} );
});
$( "#marcPreview" ).on( "hidden", function() {
$( "#marcPreviewLabel" ).html( "" );
$( "#marcPreview .modal-body" ).html( "<div id='loading'><img src='" + interface + "/" + theme + "/img/loading-small.gif' alt='' /> " + MSG_LOADING + "</div>" );
});
$( ".previewData" ).on( "click", function(e) {
e.preventDefault();
var ltitle = $( this ).text();
var page = $( this ).attr( "href" );
$( "#dataPreviewLabel" ).text( ltitle );
$( "#dataPreview .modal-body" ).load( page + " div" );
$( '#dataPreview' ).modal( {show:true} );
});
$( "#dataPreview" ).on( "hidden", function() {
$( "#dataPreviewLabel" ).html( "" );
$( "#dataPreview .modal-body" ).html( "<div id='loading'><img src='" + interface + "/" + theme + "/img/loading-small.gif' alt='' /> " + MSG_LOADING + "</div>" );
});
$( ".import_record" ).on( "click", function(e) {
e.preventDefault();
var data_breedingid = $( this ).data( "breedingid" );
var data_headingcode = $( this ).data( "heading_code" );
var data_authid = $( this ).data( "authid" );
var data_biblionumber = $( this ).data( "biblionumber" );
var data_frameworkcode = $( this ).data( "frameworkcode" );
if ( data_headingcode == undefined ) {
Import( data_breedingid, data_biblionumber, false , data_frameworkcode );
} else {
Import( data_breedingid, data_authid, data_headingcode );
}
return false;
});
});