@@ -, +, @@
- Rework JavaScript clone routines to use jQuery, to take
label "for" into account, to handle incrementing label,
and to properly place cloned blocks at the bottom of the group
- Rework JavaScript delete routines to use jQuery, to take
block label numbers into account, and to show the "add"
link if you have deleted the last block.
- Correcting markup which nests
inside
- Ensuring labels' "for" attribute matches input IDs
- Adding "required" style to required fields
---
.../intranet-tmpl/prog/en/css/staff-global.css | 6 +
.../prog/en/modules/admin/matching-rules.tmpl | 273 ++++++++++----------
2 files changed, 140 insertions(+), 139 deletions(-)
--- a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css
+++ a/koha-tmpl/intranet-tmpl/prog/en/css/staff-global.css
@@ -1914,3 +1914,9 @@ ul.budget_hierarchy li:first-child:after {
.holdcount { font-size : 105%; line-height : 200%; }
.holdcount a { border : 1px solid #a4bedd; background-color : #e4ecf5; font-weight : bold; -moz-border-radius: 4px; padding : .1em .4em; text-decoration : none; }
.holdcount a:hover { background-color : #ebeff7; }
+.container {
+ border : 1px solid #EEE;
+ padding : 1em;
+ margin : 1em 0;
+}
+fieldset.rows+h3 {clear:both;padding-top:.5em;}
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/matching-rules.tmpl
+++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/matching-rules.tmpl
@@ -20,75 +20,91 @@ var maxMatchPoint = ;
var maxMatchCheck = ;
function InsertMatchpoint(loc, index) {
- var original= document.getElementById(index);
- var clone = original.cloneNode(true);
- clone.style.display = 'block';
+ var original= $("#"+index);
+ var clone = original.clone();
+ clone.show();
// update IDs and form names
maxMatchPoint++;
- clone.setAttribute('id', 'mp_' + maxMatchPoint);
- var divs = clone.getElementsByTagName('div');
- for (var i = 0; i < divs.length; i++) {
- var s = divs[i].getAttribute('id');
+ clone.attr('id', 'mp_' + maxMatchPoint);
+ $("span.counter",clone).html(maxMatchPoint);
+ $("label",clone).each(function(){
+ var s = $(this).attr("for");
if (s.match(/mp_num/)) {
- divs[i].setAttribute('id', s.replace(/mp_num/, 'mp_' + maxMatchPoint));
+ $(this).attr("for",s.replace(/mp_num/, 'mp_' + maxMatchPoint));
}
- }
- var inputs = clone.getElementsByTagName('input');
- for (var i = 0; i < inputs.length; i++) {
- var s = inputs[i].getAttribute('id');
+ });
+
+ $("div",clone).each(function(){
+ var s = $(this).attr("id");
if (s.match(/mp_num/)) {
- inputs[i].setAttribute('id', s);
- inputs[i].setAttribute('id', s.replace(/mp_num/, 'mp_' + maxMatchPoint));
+ $(this).attr("id",s.replace(/mp_num/, 'mp_' + maxMatchPoint));
}
- var s = inputs[i].getAttribute('name');
- if (s.match(/mp_num/)) {
- inputs[i].setAttribute('name', s.replace(/mp_num/, 'mp_' + maxMatchPoint));
+ });
+ $("input",clone).each(function(){
+ var s = $(this).attr("id");
+ if(s.match(/mp_num/)){
+ $(this).attr("id",s.replace(/mp_num/, 'mp_' + maxMatchPoint));
}
- }
- loc.parentNode.parentNode.insertBefore(clone, loc.nextSibling);
+ var s = $(this).attr("name");
+ if(s.match(/mp_num/)){
+ $(this).attr("name",s.replace(/mp_num/, 'mp_' + maxMatchPoint));
+ }
+ });
+ $("#match_points").append(clone);
}
function InsertMatchcheck(loc, index) {
- var original= document.getElementById(index);
- var clone = original.cloneNode(true);
- clone.style.display = 'block';
+ var original= $("#"+index);
+ var clone = original.clone();
+ clone.show();
// update IDs and form names
maxMatchCheck++;
- clone.setAttribute('id', 'mc_' + maxMatchCheck);
- var divs = clone.getElementsByTagName('div');
- for (var i = 0; i < divs.length; i++) {
- var s = divs[i].getAttribute('id');
+ clone.attr('id', 'mc_' + maxMatchCheck);
+ $("span.counter",clone).html(maxMatchCheck);
+ $("label",clone).each(function(){
+ var s = $(this).attr("for");
if (s.match(/mc_num/)) {
- divs[i].setAttribute('id', s.replace(/mc_num/, 'mc_' + maxMatchCheck));
+ $(this).attr("for",s.replace(/mc_num/, 'mc_' + maxMatchCheck));
}
- }
- var inputs = clone.getElementsByTagName('input');
- for (var i = 0; i < inputs.length; i++) {
- var s = inputs[i].getAttribute('id');
+ });
+
+ $("div",clone).each(function(){
+ var s = $(this).attr("id");
if (s.match(/mc_num/)) {
- inputs[i].setAttribute('id', s);
- inputs[i].setAttribute('id', s.replace(/mc_num/, 'mc_' + maxMatchCheck));
+ $(this).attr("id",s.replace(/mc_num/, 'mc_' + maxMatchCheck));
}
- var s = inputs[i].getAttribute('name');
- if (s.match(/mc_num/)) {
- inputs[i].setAttribute('name', s.replace(/mc_num/, 'mc_' + maxMatchCheck));
+ });
+ $("input",clone).each(function(){
+ var s = $(this).attr("id");
+ if(s.match(/mc_num/)){
+ $(this).attr("id",s.replace(/mc_num/, 'mc_' + maxMatchCheck));
}
- }
- loc.parentNode.parentNode.insertBefore(clone, loc.nextSibling);
+ var s = $(this).attr("name");
+ if(s.match(/mc_num/)){
+ $(this).attr("name",s.replace(/mc_num/, 'mc_' + maxMatchCheck));
+ }
+ });
+ $("#match_checks").append(clone);
}
function DeleteMatchpoint(loc) {
- var parentdiv = loc.parentNode.parentNode.parentNode;
- parentdiv.parentNode.removeChild(parentdiv);
+ $(loc).parent().parent().parent().remove();
+ if($(".matchgroup",$("#match_points")).length == 0){
+ maxMatchPoint = 0;
+ $("#addMatchPoint").show();
+ }
}
function DeleteMatchcheck(loc) {
- var parentdiv = loc.parentNode.parentNode.parentNode;
- parentdiv.parentNode.removeChild(parentdiv);
+ $(loc).parent().parent().parent().remove();
+ if($(".matchgroup",$("#match_checks")).length == 0){
+ maxMatchCheck = 0;
+ $("#addMatchCheck").show();
+ }
}
function DoCancel(f) {
@@ -145,7 +161,11 @@ function CheckRuleForm(f) {
//]]>
@@ -188,27 +208,31 @@ function CheckRuleForm(f) {
" />
- Matching rule code:
-
+ Matching rule code:
+ Required
- Description:
+ Description:
" />
+ value="" /> Required
- Match threshold:
+ Match threshold:
" />
+ value="" /> Required
-
- Match points Add matchpoint
+
+
+ Match points
+
+
Add match point
+ Add match point
-
+
-