Lines 130-135
function CloneField(index, hideMarc, advancedMARCEditor) {
Link Here
|
130 |
textaeras[0].setAttribute('name',textaeras[0].getAttribute('name')+new_key); |
130 |
textaeras[0].setAttribute('name',textaeras[0].getAttribute('name')+new_key); |
131 |
} |
131 |
} |
132 |
} |
132 |
} |
|
|
133 |
if( $(inputs[1]).hasClass('framework_plugin') ) { |
134 |
var oldcontrol= original.getElementsByTagName('input')[1]; |
135 |
AddEventHandlers( oldcontrol,inputs[1],id_input ); |
136 |
} |
133 |
|
137 |
|
134 |
if (advancedMARCEditor == '0') { |
138 |
if (advancedMARCEditor == '0') { |
135 |
// when cloning a subfield, re set its label too. |
139 |
// when cloning a subfield, re set its label too. |
Lines 172-184
function CloneField(index, hideMarc, advancedMARCEditor) {
Link Here
|
172 |
if(buttonDot){ |
176 |
if(buttonDot){ |
173 |
// 2 possibilities : |
177 |
// 2 possibilities : |
174 |
try{ |
178 |
try{ |
175 |
var buttonDotOnClick = buttonDot.getAttribute('onclick'); |
179 |
if( $(buttonDot).hasClass('framework_plugin') ) { |
176 |
if(buttonDotOnClick.match('Clictag')){ // -1- It s a plugin |
180 |
var oldcontrol= original.getElementsByTagName('a')[0]; |
177 |
var re = /\('.*'\)/i; |
181 |
AddEventHandlers(oldcontrol,buttonDot,id_input); |
178 |
buttonDotOnClick = buttonDotOnClick.replace(re,"('"+inputs[1].getAttribute('id')+"')"); |
|
|
179 |
if(buttonDotOnClick){ |
180 |
buttonDot.setAttribute('onclick',buttonDotOnClick); |
181 |
} |
182 |
} else { |
182 |
} else { |
183 |
if(buttonDotOnClick.match('Dopop')) { // -2- It's a auth value |
183 |
if(buttonDotOnClick.match('Dopop')) { // -2- It's a auth value |
184 |
var re1 = /&index=.*',/; |
184 |
var re1 = /&index=.*',/; |
Lines 267-272
function CloneSubfield(index, advancedMARCEditor){
Link Here
|
267 |
inputs[i].setAttribute('name',inputs[i].getAttribute('name')+new_key); |
267 |
inputs[i].setAttribute('name',inputs[i].getAttribute('name')+new_key); |
268 |
linkid = id_input; |
268 |
linkid = id_input; |
269 |
} |
269 |
} |
|
|
270 |
// Plugin input |
271 |
if( $(inputs[1]).hasClass('framework_plugin') ) { |
272 |
var oldcontrol= original.getElementsByTagName('input')[1]; |
273 |
AddEventHandlers( oldcontrol, inputs[1], linkid ); |
274 |
} |
270 |
|
275 |
|
271 |
// select |
276 |
// select |
272 |
for(var i=0,len=selects.length; i<len ; i++ ){ |
277 |
for(var i=0,len=selects.length; i<len ; i++ ){ |
Lines 282-297
function CloneSubfield(index, advancedMARCEditor){
Link Here
|
282 |
textareas[i].setAttribute('name',textareas[i].getAttribute('name')+new_key); |
287 |
textareas[i].setAttribute('name',textareas[i].getAttribute('name')+new_key); |
283 |
} |
288 |
} |
284 |
|
289 |
|
285 |
// Changing the "..." link's onclick attribute for plugin callback |
290 |
// Handle click event on buttonDot for plugin |
286 |
var links = clone.getElementsByTagName('a'); |
291 |
var links = clone.getElementsByTagName('a'); |
287 |
var link = links[0]; |
292 |
if( $(links[0]).hasClass('framework_plugin') ) { |
288 |
var buttonDotOnClick = link.getAttribute('onclick'); |
293 |
var oldcontrol= original.getElementsByTagName('a')[0]; |
289 |
if(buttonDotOnClick.match('Clictag')){ // -1- It s a plugin |
294 |
AddEventHandlers( oldcontrol, links[0], linkid ); |
290 |
var re = /\('.*'\)/i; |
|
|
291 |
buttonDotOnClick = buttonDotOnClick.replace(re,"('"+linkid+"')"); |
292 |
if(buttonDotOnClick){ |
293 |
link.setAttribute('onclick',buttonDotOnClick); |
294 |
} |
295 |
} |
295 |
} |
296 |
|
296 |
|
297 |
if(advancedMARCEditor == '0') { |
297 |
if(advancedMARCEditor == '0') { |
Lines 325-330
function CloneSubfield(index, advancedMARCEditor){
Link Here
|
325 |
original.parentNode.insertBefore(clone,original.nextSibling); |
325 |
original.parentNode.insertBefore(clone,original.nextSibling); |
326 |
} |
326 |
} |
327 |
|
327 |
|
|
|
328 |
function AddEventHandlers (oldcontrol, newcontrol, newinputid ) { |
329 |
// This function is a helper for CloneField and CloneSubfield. |
330 |
// It adds the event handlers from oldcontrol to newcontrol. |
331 |
// newinputid is the id attribute of the cloned controlling input field |
332 |
// Note: This code depends on the jQuery data for events; this structure |
333 |
// is moved to _data as of jQuery 1.8. |
334 |
var ev= $(oldcontrol).data('events'); |
335 |
if(typeof ev != 'undefined') { |
336 |
$.each(ev, function(prop,val) { |
337 |
$.each(val, function(prop2,val2) { |
338 |
$(newcontrol).off( val2.type ); |
339 |
$(newcontrol).on( val2.type, {id: newinputid}, val2.handler ); |
340 |
}); |
341 |
}); |
342 |
} |
343 |
} |
344 |
|
328 |
/** |
345 |
/** |
329 |
* This function removes or clears unwanted subfields |
346 |
* This function removes or clears unwanted subfields |
330 |
*/ |
347 |
*/ |