Bug 14919: (followup) Show accurate status in holds history
[koha.git] / koha-tmpl / intranet-tmpl / prog / js / z3950_search.js
1 //z3950_search.js for Authorities, Bib records and Acquisitions module
2 function Import(Breeding, recordid, AuthType, FrameworkCode) {
3
4     if ( AuthType == false ) {
5         opener.document.location="../cataloguing/addbiblio.pl?biblionumber="+recordid+"&z3950=1&frameworkcode="+FrameworkCode+"&breedingid="+Breeding;
6     } else {
7         opener.document.location="../authorities/authorities.pl?breedingid="+Breeding+"&authtypecode="+AuthType+"&authid="+recordid;
8     }
9     window.close();
10     return false;
11
12 }
13
14 $( document ).ready( function() {
15
16     $( "#CheckAll" ).click( function() {
17         $( ".checkboxed" ).checkCheckboxes();
18         return false;
19     });
20     $( "#CheckNone" ).click( function() {
21         $( ".checkboxed" ).unCheckCheckboxes();
22         return false;
23     });
24     $( "#close_menu" ).on( "click", function(e) {
25         e.preventDefault();
26         $( ".linktools" ).hide();
27         $( "tr" ).removeClass( "selected" );
28         return false;
29     });
30     $( ".submit" ).on( "click", function() {
31         $( "body" ).css( "cursor", "wait" );
32     });
33     $( "[name='changepage_prev']" ).on( "click", function() {
34         var data_current_page_prev = $( this ).data( "currentpage" );
35         $( '#current_page' ).val( data_current_page_prev - 1 );
36         $( '#page_form' ).submit();
37     });
38     $( "[name='changepage_next']" ).on( "click", function() {
39         var data_current_page_next = $( this ).data( "currentpage" );
40         $( '#current_page' ).val( data_current_page_next + 1 );
41         $( '#page_form' ).submit();
42     });
43     $( "[name='changepage_goto']" ).on( "click", function() {
44         return validate_goto_page();
45     });
46     $( "#resetZ3950Search" ).click( function(e) {
47         e.preventDefault();
48         $( "form[name='f']" ).find( "input[type=text]" ).val( "" );
49     });
50     $( "form[name='f']" ).submit( function() {
51         if ( $( 'input[type=checkbox]' ).filter( ':checked' ).length == 0 ) {
52             alert( MSG_CHOOSE_Z3950 );
53             $( "body" ).css( "cursor", "default" );
54             return false;
55         } else {
56             return true;
57         }
58     });
59     $( ".previewMARC" ).on( "click", function(e) {
60         e.preventDefault();
61         var ltitle = $( this ).text();
62         var page = $( this ).attr( "href" );
63         $( "#marcPreviewLabel" ).text( ltitle );
64         $( "#marcPreview .modal-body" ).load( page + " pre" );
65         $( '#marcPreview' ).modal( {show:true} );
66     });
67     $( "#marcPreview" ).on( "hidden", function() {
68         $( "#marcPreviewLabel" ).html( "" );
69         $( "#marcPreview .modal-body" ).html( "<div id='loading'><img src='" + interface + "/" + theme + "/img/spinner-small.gif' alt='' /> " + MSG_LOADING + "</div>" );
70     });
71     $( ".previewData" ).on( "click", function(e) {
72         e.preventDefault();
73         var ltitle = $( this ).text();
74         var page = $( this ).attr( "href" );
75         $( "#dataPreviewLabel" ).text( ltitle );
76         $( "#dataPreview .modal-body" ).load( page + " div" );
77         $( '#dataPreview' ).modal( {show:true} );
78     });
79     $( "#dataPreview" ).on( "hidden", function() {
80         $( "#dataPreviewLabel" ).html( "" );
81         $( "#dataPreview .modal-body" ).html( "<div id='loading'><img src='" + interface + "/" + theme + "/img/spinner-small.gif' alt='' /> " + MSG_LOADING + "</div>" );
82     });
83     $( ".import_record" ).on( "click", function(e) {
84         e.preventDefault();
85         var data_breedingid = $( this ).data( "breedingid" );
86         var data_headingcode = $( this ).data( "heading_code" );
87         var data_authid = $( this ).data( "authid" );
88         var data_biblionumber = $( this ).data( "biblionumber" );
89         var data_frameworkcode = $( this ).data( "frameworkcode" );
90         if ( data_headingcode == undefined ) {
91             Import( data_breedingid, data_biblionumber, false , data_frameworkcode );
92         } else {
93             Import( data_breedingid, data_authid, data_headingcode );
94         }
95         return false;
96     });
97
98 });