Lines 11-19
Link Here
|
11 |
} catch(e) { |
11 |
} catch(e) { |
12 |
return; |
12 |
return; |
13 |
} |
13 |
} |
14 |
|
14 |
|
15 |
// browse all its subfields |
15 |
var field_start = whichfield.parentNode.parentNode; |
16 |
var subfields = whichfield.parentNode.parentNode.getElementsByTagName('input'); |
16 |
|
|
|
17 |
// browse all its subfields (clear and $9) |
18 |
var subfields = field_start.getElementsByTagName('input'); |
17 |
var re = /^tag_\d*_code_/; |
19 |
var re = /^tag_\d*_code_/; |
18 |
for(var i=0, len = subfields.length ; i< len ; i++) { // browse all subfields |
20 |
for(var i=0, len = subfields.length ; i< len ; i++) { // browse all subfields |
19 |
if(subfields[i].getAttribute('name').match(re)){ // it s a subfield |
21 |
if(subfields[i].getAttribute('name').match(re)){ // it s a subfield |
Lines 22-39
Link Here
|
22 |
|
24 |
|
23 |
[% IF ( clear ) %] |
25 |
[% IF ( clear ) %] |
24 |
if (subfield){subfield.value="" ;} |
26 |
if (subfield){subfield.value="" ;} |
25 |
[% ELSE %] |
27 |
[% ELSE %] |
26 |
[% FOREACH SUBFIELD_LOO IN SUBFIELD_LOOP %] |
28 |
if(code.value=='9'){ |
27 |
if (code.value == "[% SUBFIELD_LOO.marc_subfield |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]"){ |
29 |
subfield.value = "[% authid |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]"; |
28 |
subfield.value = "[% SUBFIELD_LOO.marc_value |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]"; |
|
|
29 |
} |
30 |
} |
30 |
[% END %] |
|
|
31 |
if(code.value=='9'){ |
32 |
subfield.value = "[% authid |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]"; |
33 |
} |
34 |
[% END %] |
31 |
[% END %] |
35 |
} |
32 |
} |
36 |
} |
33 |
} |
|
|
34 |
|
35 |
// Sets the good number of form fields for the specified subfield |
36 |
function SetSubfieldNumber(subfield_name, nb) { |
37 |
// Nothing to do if we only have one value |
38 |
if(nb <= 1) { |
39 |
return; |
40 |
} |
41 |
|
42 |
// Find the subfield we want to clone |
43 |
var re = new RegExp('^subfield' + subfield_name,'g'); |
44 |
var subfields = $(field_start).children('div').filter( function() { |
45 |
return this.id.match(re); |
46 |
}); |
47 |
|
48 |
// Add as many clones as needed |
49 |
for(var i=0; i<nb-subfields.length; i++) { |
50 |
window.opener.opener.CloneSubfield(subfields[0].getAttribute('id')); |
51 |
} |
52 |
} |
53 |
|
54 |
// Fills the subfield with the values entered in argument |
55 |
function SetSubfieldValues() { |
56 |
// Get the arguments |
57 |
var subfield_name = arguments[0]; |
58 |
var values = new Array(); |
59 |
for(var i=1; i<arguments.length; i++) { |
60 |
values.push(arguments[i]); |
61 |
} |
62 |
|
63 |
// Create the correct number of form fields for all values |
64 |
SetSubfieldNumber(subfield_name, values.length); |
65 |
|
66 |
// Find the subfields where we will add the new values |
67 |
var re = new RegExp('^subfield' + subfield_name,'g'); |
68 |
var subfields = $(field_start).children('div').filter( function() { |
69 |
return this.id.match(re); |
70 |
}); |
71 |
|
72 |
// Add the new values to those subfields, empty the additional fields |
73 |
var i=0; |
74 |
subfields.each(function() { |
75 |
if(i in values) { |
76 |
this.getElementsByTagName('input')[1].value = values[i]; |
77 |
} |
78 |
else { |
79 |
this.getElementsByTagName('input')[1].value = ""; |
80 |
} |
81 |
i++; |
82 |
}); |
83 |
} |
84 |
|
85 |
[% FOREACH SUBFIELD_LOO IN SUBFIELD_LOOP %] |
86 |
SetSubfieldValues( |
87 |
"[% tag_number |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %][% SUBFIELD_LOO.marc_subfield |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]" |
88 |
[% FOREACH marc_value IN SUBFIELD_LOO.marc_values %] |
89 |
,"[% marc_value |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') %]" |
90 |
[% END %] |
91 |
); |
92 |
[% END %] |
93 |
|
37 |
opener.close(); |
94 |
opener.close(); |
38 |
window.close(); |
95 |
window.close(); |
39 |
|
96 |
|
40 |
- |
|
|