|
Lines 253-258
function CloneField(index, hideMarc, advancedMARCEditor) {
Link Here
|
| 253 |
*/ |
253 |
*/ |
| 254 |
function CloneSubfield(index, advancedMARCEditor){ |
254 |
function CloneSubfield(index, advancedMARCEditor){ |
| 255 |
var original = document.getElementById(index); //original <div> |
255 |
var original = document.getElementById(index); //original <div> |
|
|
256 |
var original_selects = original.getElementsByTagName('select'); |
| 257 |
for( var i=0,len=original_selects.length;i<len;i++){ |
| 258 |
$(original_selects[i]).select2('destroy'); |
| 259 |
} |
| 256 |
var clone = original.cloneNode(true); |
260 |
var clone = original.cloneNode(true); |
| 257 |
var new_key = CreateKey(); |
261 |
var new_key = CreateKey(); |
| 258 |
// set the attribute for the new 'div' subfields |
262 |
// set the attribute for the new 'div' subfields |
|
Lines 327-334
function CloneSubfield(index, advancedMARCEditor){
Link Here
|
| 327 |
} |
331 |
} |
| 328 |
// insert this line on the page |
332 |
// insert this line on the page |
| 329 |
original.parentNode.insertBefore(clone,original.nextSibling); |
333 |
original.parentNode.insertBefore(clone,original.nextSibling); |
|
|
334 |
|
| 335 |
//Restablish select2 for the cloned elements. |
| 336 |
for( var i=0,len=selects.length;i<len;i++){ |
| 337 |
$(selects[i]).select2(); |
| 338 |
$(original_selects[i]).select2(); |
| 339 |
} |
| 330 |
// delete data of cloned subfield |
340 |
// delete data of cloned subfield |
| 331 |
document.getElementById(linkid).value = ""; |
341 |
clone.querySelectorAll('input.input_marceditor').value = ""; |
| 332 |
} |
342 |
} |
| 333 |
|
343 |
|
| 334 |
function AddEventHandlers (oldcontrol, newcontrol, newinputid ) { |
344 |
function AddEventHandlers (oldcontrol, newcontrol, newinputid ) { |
|
Lines 414-420
function upSubfield(index) {
Link Here
|
| 414 |
var tag = line.parentNode; // get the dad of this line. (should be "<div id='tag_...'>") |
424 |
var tag = line.parentNode; // get the dad of this line. (should be "<div id='tag_...'>") |
| 415 |
|
425 |
|
| 416 |
// getting all subfields for this tag |
426 |
// getting all subfields for this tag |
| 417 |
var subfields = tag.getElementsByTagName('div'); |
427 |
var subfields = tag.querySelectorAll('div.subfield_line'); |
| 418 |
var subfieldsLength = subfields.length; |
428 |
var subfieldsLength = subfields.length; |
| 419 |
|
429 |
|
| 420 |
if(subfieldsLength<=1) return; // nothing to do if there is just one subfield. |
430 |
if(subfieldsLength<=1) return; // nothing to do if there is just one subfield. |
| 421 |
- |
|
|