|
Lines 1-15
Link Here
|
| 1 |
//z3950_search.js for Authorities, Bib records and Acquisitions module |
1 |
//z3950_search.js for Authorities, Bib records and Acquisitions module |
| 2 |
function Import(Breeding, recordid, AuthType, FrameworkCode) { |
|
|
| 3 |
|
2 |
|
| 4 |
if ( AuthType == false ) { |
3 |
var last_action, previewed = 0; |
| 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 |
|
4 |
|
| 14 |
$( document ).ready( function() { |
5 |
$( document ).ready( function() { |
| 15 |
|
6 |
|
|
Lines 56-71
$( document ).ready( function() {
Link Here
|
| 56 |
/* Note: The templates where this is included must have a search results |
47 |
/* 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" */ |
48 |
table with the id "resultst" and "action" table cells with the class "actions" */ |
| 58 |
$("#resultst").on("click", "td", function(event){ |
49 |
$("#resultst").on("click", "td", function(event){ |
|
|
50 |
event.preventDefault(); |
| 59 |
var tgt = $(event.target); |
51 |
var tgt = $(event.target); |
| 60 |
var row = $(this).parent(); |
52 |
var row = $(this).closest('tr'); |
| 61 |
/* Remove highlight from all rows and add to the clicked row */ |
53 |
/* Remove highlight from all rows and add to the clicked row */ |
| 62 |
$("tr").removeClass("highlighted-row"); |
54 |
$("tr").removeClass("highlighted-row"); |
| 63 |
row.addClass("highlighted-row"); |
55 |
row.addClass("highlighted-row"); |
| 64 |
/* Remove any menus created on the fly for other rows */ |
56 |
/* Remove any menus created on the fly for other rows */ |
| 65 |
$(".btn-wrapper").remove(); |
57 |
$(".btn-wrapper").remove(); |
| 66 |
|
58 |
|
| 67 |
if( tgt.is("a") || tgt.hasClass("actions") ){ |
59 |
if( tgt.hasClass("z3950actions") ) { // direct button click |
| 68 |
/* Don't show inline links for cells containing links of their own. */ |
60 |
var link = $( "a[title='" + tgt.text() + "']", row ); |
|
|
61 |
if( link.length == 1) link.click(); |
| 62 |
row.find('ul.dropdown-menu').hide(); |
| 69 |
} else { |
63 |
} else { |
| 70 |
event.stopPropagation(); |
64 |
event.stopPropagation(); |
| 71 |
/* Remove the "open" class from all dropup menus in case one is open */ |
65 |
/* Remove the "open" class from all dropup menus in case one is open */ |
|
Lines 86-91
$( document ).ready( function() {
Link Here
|
| 86 |
The menu must first be wrapped in a block-level div to clear |
80 |
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 |
81 |
the table cell's text contents and then a relative-positioned |
| 88 |
div to allow the menu to be positioned correctly */ |
82 |
div to allow the menu to be positioned correctly */ |
|
|
83 |
if( tgt.prop('nodeName') != 'TD' ) { |
| 84 |
// handling click on caret to improve menu position |
| 85 |
tgt = tgt.closest('td'); |
| 86 |
} |
| 89 |
tgt.append( |
87 |
tgt.append( |
| 90 |
$('<div/>', {'class': 'btn-wrapper'}).append( |
88 |
$('<div/>', {'class': 'btn-wrapper'}).append( |
| 91 |
$('<div/>', {'class': 'btn-group'}).append( |
89 |
$('<div/>', {'class': 'btn-group'}).append( |
|
Lines 96-138
$( document ).ready( function() {
Link Here
|
| 96 |
} |
94 |
} |
| 97 |
}); |
95 |
}); |
| 98 |
|
96 |
|
| 99 |
$( "#resultst" ).on("click", ".previewMARC", function(e) { |
|
|
| 100 |
e.preventDefault(); |
| 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} ); |
| 106 |
}); |
| 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>" ); |
| 110 |
}); |
| 111 |
$( "#resultst" ).on("click", ".previewData", function(e) { |
97 |
$( "#resultst" ).on("click", ".previewData", function(e) { |
| 112 |
e.preventDefault(); |
98 |
e.preventDefault(); |
|
|
99 |
previewed = 1; |
| 100 |
ChangeLastAction( $(this).attr('title'), 1 ); |
| 113 |
var ltitle = $( this ).text(); |
101 |
var ltitle = $( this ).text(); |
| 114 |
var page = $( this ).attr( "href" ); |
102 |
var page = $( this ).attr( "href" ); |
| 115 |
$( "#dataPreviewLabel" ).text( ltitle ); |
103 |
$( "#dataPreviewLabel" ).text( ltitle ); |
| 116 |
$( "#dataPreview .modal-body" ).load( page + " div" ); |
104 |
$( "#dataPreview .modal-body" ).load( page + " div" ); |
| 117 |
$( '#dataPreview' ).modal( {show:true} ); |
105 |
$( '#dataPreview' ).modal( {show:true} ); |
| 118 |
}); |
106 |
}); |
|
|
107 |
|
| 119 |
$( "#dataPreview" ).on( "hidden", function() { |
108 |
$( "#dataPreview" ).on( "hidden", function() { |
| 120 |
$( "#dataPreviewLabel" ).html( "" ); |
109 |
$( "#dataPreviewLabel" ).html( "" ); |
| 121 |
$( "#dataPreview .modal-body" ).html( "<div id='loading'><img src='" + interface + "/" + theme + "/img/spinner-small.gif' alt='' /> " + MSG_LOADING + "</div>" ); |
110 |
$( "#dataPreview .modal-body" ).html( "<div id='loading'><img src='" + interface + "/" + theme + "/img/spinner-small.gif' alt='' /> " + MSG_LOADING + "</div>" ); |
| 122 |
}); |
111 |
}); |
| 123 |
$( "#resultst" ).on("click", ".import_record", function(e) { |
112 |
|
|
|
113 |
$( "#resultst" ).on("click", ".chosen", function(e) { |
| 124 |
e.preventDefault(); |
114 |
e.preventDefault(); |
| 125 |
var data_breedingid = $( this ).data( "breedingid" ); |
115 |
var title = $(this).attr('title'); |
| 126 |
var data_headingcode = $( this ).data( "heading_code" ); |
116 |
ChangeLastAction( title, 0 ); |
| 127 |
var data_authid = $( this ).data( "authid" ); |
117 |
if( title == 'Order' ) window.location = $(this).attr('href'); |
| 128 |
var data_biblionumber = $( this ).data( "biblionumber" ); |
118 |
else { |
| 129 |
var data_frameworkcode = $( this ).data( "frameworkcode" ); |
119 |
opener.document.location = $(this).attr('href'); |
| 130 |
if ( data_headingcode == undefined ) { |
120 |
window.close(); |
| 131 |
Import( data_breedingid, data_biblionumber, false , data_frameworkcode ); |
|
|
| 132 |
} else { |
| 133 |
Import( data_breedingid, data_authid, data_headingcode ); |
| 134 |
} |
121 |
} |
| 135 |
return false; |
|
|
| 136 |
}); |
122 |
}); |
| 137 |
|
|
|
| 138 |
}); |
123 |
}); |
| 139 |
- |
124 |
|
|
|
125 |
function InitLastAction() { |
| 126 |
if( $("#resultst").length == 0 ) return; |
| 127 |
try { last_action = localStorage.getItem('z3950search_last_action'); } catch (err) {} |
| 128 |
if( last_action ) { |
| 129 |
var linkcount = $(".z3950actions:eq(0)").siblings(".dropdown-menu").find("a[title='"+last_action+"']").length; |
| 130 |
if( linkcount == 0 ) return; |
| 131 |
if( last_action != 'MARC' ) $( ".z3950actions" ).text( last_action ); |
| 132 |
} |
| 133 |
} |
| 134 |
|
| 135 |
function ChangeLastAction(title, change_text) { |
| 136 |
if( last_action && last_action == title ) return; |
| 137 |
last_action = title; |
| 138 |
if( change_text ) $( ".z3950actions" ).text( last_action ); |
| 139 |
if( previewed == 0 || change_text == 1 ) |
| 140 |
try { localStorage.setItem('z3950search_last_action', last_action); } catch(err) {} |
| 141 |
} |