|
Lines 1-16
Link Here
|
| 1 |
/* global __ total_pages */ |
1 |
/* global __ total_pages */ |
| 2 |
//z3950_search.js for Authorities, Bib records and Acquisitions module |
2 |
//z3950_search.js for Authorities, Bib records and Acquisitions module |
| 3 |
function Import(Breeding, recordid, AuthType, FrameworkCode) { |
|
|
| 4 |
|
3 |
|
| 5 |
if ( AuthType == false ) { |
4 |
var last_action, previewed = 0; |
| 6 |
opener.document.location="../cataloguing/addbiblio.pl?biblionumber="+recordid+"&z3950=1&frameworkcode="+FrameworkCode+"&breedingid="+Breeding; |
|
|
| 7 |
} else { |
| 8 |
opener.document.location="../authorities/authorities.pl?breedingid="+Breeding+"&authtypecode="+AuthType+"&authid="+recordid; |
| 9 |
} |
| 10 |
window.close(); |
| 11 |
return false; |
| 12 |
|
| 13 |
} |
| 14 |
|
5 |
|
| 15 |
function validate_goto_page() { |
6 |
function validate_goto_page() { |
| 16 |
var page = $('#goto_page').val(); |
7 |
var page = $('#goto_page').val(); |
|
Lines 70-85
$( document ).ready( function() {
Link Here
|
| 70 |
/* Note: The templates where this is included must have a search results |
61 |
/* Note: The templates where this is included must have a search results |
| 71 |
table with the id "resultst" and "action" table cells with the class "actions" */ |
62 |
table with the id "resultst" and "action" table cells with the class "actions" */ |
| 72 |
$("#resultst").on("click", "td", function(event){ |
63 |
$("#resultst").on("click", "td", function(event){ |
|
|
64 |
event.preventDefault(); |
| 73 |
var tgt = $(event.target); |
65 |
var tgt = $(event.target); |
| 74 |
var row = $(this).parent(); |
66 |
var row = $(this).closest('tr'); |
| 75 |
/* Remove highlight from all rows and add to the clicked row */ |
67 |
/* Remove highlight from all rows and add to the clicked row */ |
| 76 |
$("tr").removeClass("highlighted-row"); |
68 |
$("tr").removeClass("highlighted-row"); |
| 77 |
row.addClass("highlighted-row"); |
69 |
row.addClass("highlighted-row"); |
| 78 |
/* Remove any menus created on the fly for other rows */ |
70 |
/* Remove any menus created on the fly for other rows */ |
| 79 |
$(".btn-wrapper").remove(); |
71 |
$(".btn-wrapper").remove(); |
| 80 |
|
72 |
|
| 81 |
if( tgt.is("a") || tgt.hasClass("actions") ){ |
73 |
if( tgt.hasClass("z3950actions") ) { // direct button click |
| 82 |
/* Don't show inline links for cells containing links of their own. */ |
74 |
var link = $( "a[title='" + tgt.text() + "']", row ); |
|
|
75 |
if( link.length == 1) link.click(); |
| 76 |
row.find('ul.dropdown-menu').hide(); |
| 83 |
} else { |
77 |
} else { |
| 84 |
event.stopPropagation(); |
78 |
event.stopPropagation(); |
| 85 |
/* Remove the "open" class from all dropup menus in case one is open */ |
79 |
/* Remove the "open" class from all dropup menus in case one is open */ |
|
Lines 100-105
$( document ).ready( function() {
Link Here
|
| 100 |
The menu must first be wrapped in a block-level div to clear |
94 |
The menu must first be wrapped in a block-level div to clear |
| 101 |
the table cell's text contents and then a relative-positioned |
95 |
the table cell's text contents and then a relative-positioned |
| 102 |
div to allow the menu to be positioned correctly */ |
96 |
div to allow the menu to be positioned correctly */ |
|
|
97 |
if( tgt.prop('nodeName') != 'TD' ) { |
| 98 |
// handling click on caret to improve menu position |
| 99 |
tgt = tgt.closest('td'); |
| 100 |
} |
| 103 |
tgt.append( |
101 |
tgt.append( |
| 104 |
$('<div/>', {'class': 'btn-wrapper'}).append( |
102 |
$('<div/>', {'class': 'btn-wrapper'}).append( |
| 105 |
$('<div/>', {'class': 'btn-group'}).append( |
103 |
$('<div/>', {'class': 'btn-group'}).append( |
|
Lines 110-152
$( document ).ready( function() {
Link Here
|
| 110 |
} |
108 |
} |
| 111 |
}); |
109 |
}); |
| 112 |
|
110 |
|
| 113 |
$( "#resultst" ).on("click", ".previewMARC", function(e) { |
|
|
| 114 |
e.preventDefault(); |
| 115 |
var ltitle = $( this ).text(); |
| 116 |
var page = $( this ).attr( "href" ); |
| 117 |
$( "#marcPreviewLabel" ).text( ltitle ); |
| 118 |
$( "#marcPreview .modal-body" ).load( page + " pre" ); |
| 119 |
$( '#marcPreview' ).modal( {show:true} ); |
| 120 |
}); |
| 121 |
$( "#marcPreview" ).on( "hidden", function() { |
| 122 |
$( "#marcPreviewLabel" ).html( "" ); |
| 123 |
$( "#marcPreview .modal-body" ).html( "<div id='loading'><img src='" + interface + "/" + theme + "/img/spinner-small.gif' alt='' /> " + __("Loading") + "</div>" ); |
| 124 |
}); |
| 125 |
$( "#resultst" ).on("click", ".previewData", function(e) { |
111 |
$( "#resultst" ).on("click", ".previewData", function(e) { |
| 126 |
e.preventDefault(); |
112 |
e.preventDefault(); |
|
|
113 |
previewed = 1; |
| 114 |
ChangeLastAction( $(this).attr('title'), 1 ); |
| 127 |
var ltitle = $( this ).text(); |
115 |
var ltitle = $( this ).text(); |
| 128 |
var page = $( this ).attr( "href" ); |
116 |
var page = $( this ).attr( "href" ); |
| 129 |
$( "#dataPreviewLabel" ).text( ltitle ); |
117 |
$( "#dataPreviewLabel" ).text( ltitle ); |
| 130 |
$( "#dataPreview .modal-body" ).load( page + " div" ); |
118 |
$( "#dataPreview .modal-body" ).load( page + " div" ); |
| 131 |
$( '#dataPreview' ).modal( {show:true} ); |
119 |
$( '#dataPreview' ).modal( {show:true} ); |
| 132 |
}); |
120 |
}); |
|
|
121 |
|
| 133 |
$( "#dataPreview" ).on( "hidden", function() { |
122 |
$( "#dataPreview" ).on( "hidden", function() { |
| 134 |
$( "#dataPreviewLabel" ).html( "" ); |
123 |
$( "#dataPreviewLabel" ).html( "" ); |
| 135 |
$( "#dataPreview .modal-body" ).html( "<div id='loading'><img src='" + interface + "/" + theme + "/img/spinner-small.gif' alt='' /> " + __("Loading") + "</div>" ); |
124 |
$( "#dataPreview .modal-body" ).html( "<div id='loading'><img src='" + interface + "/" + theme + "/img/spinner-small.gif' alt='' /> " + __("Loading") + "</div>" ); |
| 136 |
}); |
125 |
}); |
| 137 |
$( "#resultst" ).on("click", ".import_record", function(e) { |
126 |
|
|
|
127 |
$( "#resultst" ).on("click", ".chosen", function(e) { |
| 138 |
e.preventDefault(); |
128 |
e.preventDefault(); |
| 139 |
var data_breedingid = $( this ).data( "breedingid" ); |
129 |
var title = $(this).attr('title'); |
| 140 |
var data_headingcode = $( this ).data( "heading_code" ); |
130 |
ChangeLastAction( title, 0 ); |
| 141 |
var data_authid = $( this ).data( "authid" ); |
131 |
if( title == 'Order' ) window.location = $(this).attr('href'); |
| 142 |
var data_biblionumber = $( this ).data( "biblionumber" ); |
132 |
else { |
| 143 |
var data_frameworkcode = $( this ).data( "frameworkcode" ); |
133 |
opener.document.location = $(this).attr('href'); |
| 144 |
if ( data_headingcode == undefined ) { |
134 |
window.close(); |
| 145 |
Import( data_breedingid, data_biblionumber, false , data_frameworkcode ); |
|
|
| 146 |
} else { |
| 147 |
Import( data_breedingid, data_authid, data_headingcode ); |
| 148 |
} |
135 |
} |
| 149 |
return false; |
|
|
| 150 |
}); |
136 |
}); |
| 151 |
|
|
|
| 152 |
}); |
137 |
}); |
| 153 |
- |
138 |
|
|
|
139 |
function InitLastAction() { |
| 140 |
if( $("#resultst").length == 0 ) return; |
| 141 |
try { last_action = localStorage.getItem('z3950search_last_action'); } catch (err) {} |
| 142 |
if( last_action ) { |
| 143 |
var linkcount = $(".z3950actions:eq(0)").siblings(".dropdown-menu").find("a[title='"+last_action+"']").length; |
| 144 |
if( linkcount == 0 ) return; |
| 145 |
if( last_action != 'MARC' ) $( ".z3950actions" ).text( last_action ); |
| 146 |
} |
| 147 |
} |
| 148 |
|
| 149 |
function ChangeLastAction(title, change_text) { |
| 150 |
if( last_action && last_action == title ) return; |
| 151 |
last_action = title; |
| 152 |
if( change_text ) $( ".z3950actions" ).text( last_action ); |
| 153 |
if( previewed == 0 || change_text == 1 ) |
| 154 |
try { localStorage.setItem('z3950search_last_action', last_action); } catch(err) {} |
| 155 |
} |