1 //z3950_search.js for Authorities, Bib records and Acquisitions module
2 function Import(Breeding, recordid, AuthType, FrameworkCode) {
4 if ( AuthType == false ) {
5 opener.document.location="../cataloguing/addbiblio.pl?biblionumber="+recordid+"&z3950=1&frameworkcode="+FrameworkCode+"&breedingid="+Breeding;
7 opener.document.location="../authorities/authorities.pl?breedingid="+Breeding+"&authtypecode="+AuthType+"&authid="+recordid;
14 $( document ).ready( function() {
16 $( "#CheckAll" ).click( function(e) {
18 $( ".checkboxed input:checkbox" ).prop("checked", true);
20 $( "#CheckNone" ).click( function(e) {
22 $( ".checkboxed input:checkbox" ).prop("checked", false);
25 $( ".submit" ).on( "click", function() {
26 $( "body" ).css( "cursor", "wait" );
28 $( "[name='changepage_prev']" ).on( "click", function() {
29 var data_current_page_prev = $( this ).data( "currentpage" );
30 $( '#current_page' ).val( data_current_page_prev - 1 );
31 $( '#page_form' ).submit();
33 $( "[name='changepage_next']" ).on( "click", function() {
34 var data_current_page_next = $( this ).data( "currentpage" );
35 $( '#current_page' ).val( data_current_page_next + 1 );
36 $( '#page_form' ).submit();
38 $( "[name='changepage_goto']" ).on( "click", function() {
39 return validate_goto_page();
41 $( "#resetZ3950Search" ).click( function(e) {
43 $( "form[name='f']" ).find( "input[type=text]" ).val( "" );
45 $( "form[name='f']" ).submit( function() {
46 if ( $( 'input[type=checkbox]' ).filter( ':checked' ).length == 0 ) {
47 alert( MSG_CHOOSE_Z3950 );
48 $( "body" ).css( "cursor", "default" );
55 /* Display actions menu anywhere the table is clicked */
56 /* Note: The templates where this is included must have a search results
57 table with the id "resultst" and "action" table cells with the class "actions" */
58 $("#resultst").on("click", "td", function(event){
59 var tgt = $(event.target);
60 var row = $(this).parent();
61 /* Remove highlight from all rows and add to the clicked row */
62 $("tr").removeClass("highlighted-row");
63 row.addClass("highlighted-row");
64 /* Remove any menus created on the fly for other rows */
65 $(".btn-wrapper").remove();
67 if( tgt.is("a") || tgt.hasClass("actions") ){
68 /* Don't show inline links for cells containing links of their own. */
70 event.stopPropagation();
71 /* Remove the "open" class from all dropup menus in case one is open */
72 $(".dropup").removeClass("open");
73 /* Create a clone of the Bootstrap dropup menu in the "Actions" column */
74 var menu_clone = $(".dropdown-menu", row)
76 .addClass("menu-clone")
79 "position" : "absolute",
85 /* Append the menu clone to the table cell which was clicked.
86 The menu must first be wrapped in a block-level div to clear
87 the table cell's text contents and then a relative-positioned
88 div to allow the menu to be positioned correctly */
90 $('<div/>', {'class': 'btn-wrapper'}).append(
91 $('<div/>', {'class': 'btn-group'}).append(
99 $( "#resultst" ).on("click", ".previewMARC", function(e) {
101 var ltitle = $( this ).text();
102 var page = $( this ).attr( "href" );
103 $( "#marcPreviewLabel" ).text( ltitle );
104 $( "#marcPreview .modal-body" ).load( page + " pre" );
105 $( '#marcPreview' ).modal( {show:true} );
107 $( "#marcPreview" ).on( "hidden", function() {
108 $( "#marcPreviewLabel" ).html( "" );
109 $( "#marcPreview .modal-body" ).html( "<div id='loading'><img src='" + interface + "/" + theme + "/img/spinner-small.gif' alt='' /> " + MSG_LOADING + "</div>" );
111 $( "#resultst" ).on("click", ".previewData", function(e) {
113 var ltitle = $( this ).text();
114 var page = $( this ).attr( "href" );
115 $( "#dataPreviewLabel" ).text( ltitle );
116 $( "#dataPreview .modal-body" ).load( page + " div" );
117 $( '#dataPreview' ).modal( {show:true} );
119 $( "#dataPreview" ).on( "hidden", function() {
120 $( "#dataPreviewLabel" ).html( "" );
121 $( "#dataPreview .modal-body" ).html( "<div id='loading'><img src='" + interface + "/" + theme + "/img/spinner-small.gif' alt='' /> " + MSG_LOADING + "</div>" );
123 $( "#resultst" ).on("click", ".import_record", function(e) {
125 var data_breedingid = $( this ).data( "breedingid" );
126 var data_headingcode = $( this ).data( "heading_code" );
127 var data_authid = $( this ).data( "authid" );
128 var data_biblionumber = $( this ).data( "biblionumber" );
129 var data_frameworkcode = $( this ).data( "frameworkcode" );
130 if ( data_headingcode == undefined ) {
131 Import( data_breedingid, data_biblionumber, false , data_frameworkcode );
133 Import( data_breedingid, data_authid, data_headingcode );