Lines 36-84
Link Here
|
36 |
}); |
36 |
}); |
37 |
|
37 |
|
38 |
function clear_entry(node) { |
38 |
function clear_entry(node) { |
39 |
var original = node.parentNode.parentNode; |
39 |
var original = node.parentNode; |
40 |
$("input[type=text]", original).attr('value', ''); |
40 |
$("input[type=text]", original).attr('value', ''); |
41 |
$("select", original).attr('value', ''); |
41 |
$("select", original).attr('value', ''); |
42 |
} |
42 |
} |
43 |
|
43 |
|
44 |
function clone_entry(node) { |
44 |
function clone_entry(node) { |
45 |
var original = node.parentNode.parentNode; |
45 |
var original = $(node).parent(); |
46 |
var clone = original.cloneNode(true); |
46 |
var clone = original.clone(); |
|
|
47 |
|
47 |
var newId = 50 + parseInt(Math.random() * 100000); |
48 |
var newId = 50 + parseInt(Math.random() * 100000); |
48 |
$("input", clone).attr('id', function() { |
49 |
$("input,select,textarea", clone).attr('id', function() { |
49 |
return this.id.replace(/patron_attr_\d+/, 'patron_attr_' + newId); |
50 |
return this.id.replace(/patron_attr_\d+/, 'patron_attr_' + newId); |
50 |
}); |
51 |
}); |
51 |
$("input", clone).attr('name', function() { |
52 |
$("input,select,textarea", clone).attr('name', function() { |
52 |
return this.name.replace(/patron_attr_\d+/, 'patron_attr_' + newId); |
53 |
return this.name.replace(/patron_attr_\d+/, 'patron_attr_' + newId); |
53 |
}); |
54 |
}); |
54 |
$("select", clone).attr('id', function() { |
55 |
$("label", clone).attr('for', function() { |
55 |
return this.id.replace(/patron_attr_\d+/, 'patron_attr_' + newId); |
56 |
return $(this).attr("for").replace(/patron_attr_\d+/, 'patron_attr_' + newId); |
56 |
}); |
|
|
57 |
$("select", clone).attr('name', function() { |
58 |
return this.name.replace(/patron_attr_\d+/, 'patron_attr_' + newId); |
59 |
}); |
57 |
}); |
60 |
$("input#patron_attr_" + newId, clone).attr('value',''); |
58 |
$("input#patron_attr_" + newId, clone).attr('value',''); |
61 |
$("select#patron_attr_" + newId, clone).attr('value',''); |
59 |
$("select#patron_attr_" + newId, clone).attr('value',''); |
62 |
original.parentNode.insertBefore(clone, original.nextSibling); |
60 |
$(original).after(clone); |
|
|
61 |
return false; |
63 |
} |
62 |
} |
64 |
|
63 |
|
65 |
function update_category_code(category_code) { |
64 |
function update_category_code(category_code) { |
66 |
if ( $(category_code).is("select") ) { |
65 |
if ( $(category_code).is("select") ) { |
67 |
category_code = $("#categorycode").find("option:selected").val(); |
66 |
category_code = $("#categorycode").find("option:selected").val(); |
68 |
} |
67 |
} |
69 |
var mytables = $(".attributes_table>tbody"); |
68 |
var mytables = $(".attributes_table"); |
70 |
|
69 |
$(mytables).find("li").hide(); |
71 |
mytables.find("tr").each(function(){ |
70 |
$(mytables).find(" li[data-category_code="+category_code+"]").show(); |
72 |
$(this).hide() |
71 |
$(mytables).find(" li[data-category_code='']").show(); |
73 |
}); |
|
|
74 |
|
75 |
mytables.find("tr[data-category_code="+category_code+"]").each(function(){ |
76 |
$(this).show(); |
77 |
}); |
78 |
mytables.find("tr[data-category_code='']").each(function(){ |
79 |
$(this).show(); |
80 |
}); |
81 |
|
82 |
} |
72 |
} |
83 |
|
73 |
|
84 |
var MSG_SEPARATOR = _("Separator must be / in field "); |
74 |
var MSG_SEPARATOR = _("Separator must be / in field "); |
Lines 1345-1368
Link Here
|
1345 |
<legend>Additional attributes and identifiers</legend> |
1335 |
<legend>Additional attributes and identifiers</legend> |
1346 |
[% FOREACH pa_loo IN patron_attributes %] |
1336 |
[% FOREACH pa_loo IN patron_attributes %] |
1347 |
[% IF pa_loo.class %] |
1337 |
[% IF pa_loo.class %] |
1348 |
<table id="aai_[% pa_loo.class %]" class="attributes_table"> |
1338 |
<fieldset id="aai_[% pa_loo.class %]"> |
1349 |
<caption>[% pa_loo.lib %]</caption> |
1339 |
<legend>[% pa_loo.lib %]</legend> |
1350 |
[% ELSE %] |
|
|
1351 |
<table id="aai" class="attributes_table"> |
1352 |
[% END %] |
1340 |
[% END %] |
1353 |
<thead> |
1341 |
<ol class="attributes_table"> |
1354 |
<tr> |
|
|
1355 |
<th>Type</th> |
1356 |
<th colspan="2">Value</th> |
1357 |
</tr> |
1358 |
</thead> |
1359 |
<tbody> |
1360 |
[% FOREACH patron_attribute IN pa_loo.items %] |
1342 |
[% FOREACH patron_attribute IN pa_loo.items %] |
1361 |
<tr data-category_code="[% patron_attribute.category_code %]"> |
1343 |
<li data-category_code="[% patron_attribute.category_code %]"> |
1362 |
<td> |
1344 |
<label for="[% patron_attribute.form_id %]">[% patron_attribute.description %]: </label> |
1363 |
[% patron_attribute.code %] ([% patron_attribute.description %]) |
|
|
1364 |
</td> |
1365 |
<td> |
1366 |
<input type="hidden" id="[% patron_attribute.form_id %]_code" name="[% patron_attribute.form_id %]_code" value="[% patron_attribute.code |html %]" /> |
1345 |
<input type="hidden" id="[% patron_attribute.form_id %]_code" name="[% patron_attribute.form_id %]_code" value="[% patron_attribute.code |html %]" /> |
1367 |
[% IF ( patron_attribute.use_dropdown ) %] |
1346 |
[% IF ( patron_attribute.use_dropdown ) %] |
1368 |
<select id="[% patron_attribute.form_id %]" name="[% patron_attribute.form_id %]"> |
1347 |
<select id="[% patron_attribute.form_id %]" name="[% patron_attribute.form_id %]"> |
Lines 1389-1408
Link Here
|
1389 |
[% END %] |
1368 |
[% END %] |
1390 |
[% END %] |
1369 |
[% END %] |
1391 |
[% IF ( patron_attribute.password_allowed ) %] |
1370 |
[% IF ( patron_attribute.password_allowed ) %] |
1392 |
(Password: <input type="password" maxlength="64" value="[% patron_attribute.password %]" |
1371 |
(<label class="yesno" for="[% patron_attribute.form_id %]_password">Password:</label> <input type="password" maxlength="64" value="[% patron_attribute.password %]" |
1393 |
id="[% patron_attribute.form_id %]_password" name="[% patron_attribute.form_id %]_password" />) |
1372 |
id="[% patron_attribute.form_id %]_password" name="[% patron_attribute.form_id %]_password" />) |
1394 |
[% END %] |
1373 |
[% END %] |
1395 |
</td> |
1374 |
<a href="#" class="clear-field" onclick="clear_entry(this); return false;">Clear</a> |
1396 |
<td> |
|
|
1397 |
<a href="#" onclick="clear_entry(this); return false;">Clear</a> |
1398 |
[% IF ( patron_attribute.repeatable ) %] |
1375 |
[% IF ( patron_attribute.repeatable ) %] |
1399 |
<a href="#" onclick="clone_entry(this); return false;">New</a> |
1376 |
<a href="#" class="clone-field" onclick="clone_entry(this); return false;">New</a> |
1400 |
[% END %] |
1377 |
[% END %] |
1401 |
</td> |
1378 |
</li> |
1402 |
</tr> |
|
|
1403 |
[% END %] |
1379 |
[% END %] |
1404 |
</tbody> |
1380 |
</ol> |
1405 |
</table> |
1381 |
[% IF pa_loo.class %]</fieldset>[% END %] |
1406 |
[% END %] |
1382 |
[% END %] |
1407 |
</fieldset> |
1383 |
</fieldset> |
1408 |
[% END %][% END %][% END %] |
1384 |
[% END %][% END %][% END %] |