Lines 124-130
function rebuild_target($sources, $target) {
Link Here
|
124 |
var fields = target_record[tag]; |
124 |
var fields = target_record[tag]; |
125 |
for (i in fields) { |
125 |
for (i in fields) { |
126 |
var field = fields[i]; |
126 |
var field = fields[i]; |
127 |
if (field.subfields.length > 0) { |
127 |
if (parseInt(tag) < 10) { |
|
|
128 |
var $field_clone = $('#' + field.id).clone(); |
129 |
$field_clone.find('.fieldpick').remove(); |
130 |
$target.append($field_clone); |
131 |
} else if (field.subfields.length > 0) { |
128 |
var $field_clone = $('#' + field.id).clone(); |
132 |
var $field_clone = $('#' + field.id).clone(); |
129 |
$field_clone.find('ul').empty(); |
133 |
$field_clone.find('ul').empty(); |
130 |
$field_clone.find('.fieldpick').remove(); |
134 |
$field_clone.find('.fieldpick').remove(); |
Lines 137-143
function rebuild_target($sources, $target) {
Link Here
|
137 |
$field_clone.find('ul').append($subfield_clone); |
141 |
$field_clone.find('ul').append($subfield_clone); |
138 |
} |
142 |
} |
139 |
} else { |
143 |
} else { |
140 |
$('#' + field.id).find('input.fieldpick').attr('checked', false); |
144 |
$('#' + field.id).find('input.fieldpick').removeAttr('checked'); |
141 |
} |
145 |
} |
142 |
} |
146 |
} |
143 |
} |
147 |
} |
Lines 149-160
function rebuild_target($sources, $target) {
Link Here
|
149 |
$(document).ready(function(){ |
153 |
$(document).ready(function(){ |
150 |
// When a field is checked / unchecked |
154 |
// When a field is checked / unchecked |
151 |
$('input.fieldpick').click(function() { |
155 |
$('input.fieldpick').click(function() { |
152 |
// (un)check all subfields |
|
|
153 |
var ischecked = this.checked; |
156 |
var ischecked = this.checked; |
154 |
if (ischecked && !field_can_be_added($('#tabs'), $(this).parent())) { |
157 |
if (ischecked) { |
155 |
return false; |
158 |
$(this).removeAttr('checked'); |
|
|
159 |
if (!field_can_be_added($('#tabs'), $(this).parent())) { |
160 |
return false; |
161 |
} |
162 |
$(this).attr('checked', 'checked'); |
156 |
} |
163 |
} |
157 |
|
164 |
|
|
|
165 |
// (un)check all subfields |
158 |
$(this).parent().find("input.subfieldpick").each(function() { |
166 |
$(this).parent().find("input.subfieldpick").each(function() { |
159 |
this.checked = ischecked; |
167 |
this.checked = ischecked; |
160 |
}); |
168 |
}); |
Lines 164-171
$(document).ready(function(){
Link Here
|
164 |
// When a field or subfield is checked / unchecked |
172 |
// When a field or subfield is checked / unchecked |
165 |
$("input.subfieldpick").click(function() { |
173 |
$("input.subfieldpick").click(function() { |
166 |
var ischecked = this.checked; |
174 |
var ischecked = this.checked; |
167 |
if (ischecked && !subfield_can_be_added($('#tabs'), $(this).parent())) { |
175 |
if (ischecked) { |
168 |
return false; |
176 |
$(this).removeAttr('checked'); |
|
|
177 |
if (!subfield_can_be_added($('#tabs'), $(this).parent())) { |
178 |
return false; |
179 |
} |
180 |
$(this).attr('checked', 'checked'); |
169 |
} |
181 |
} |
170 |
rebuild_target($('#tabs'), $('#resultul')); |
182 |
rebuild_target($('#tabs'), $('#resultul')); |
171 |
}); |
183 |
}); |
172 |
- |
|
|