\ No newline at end of file
diff --git a/war/resources/scripts/hudson-behavior.js b/war/resources/scripts/hudson-behavior.js
index 149cc140d5..eb442339e5 100644
--- a/war/resources/scripts/hudson-behavior.js
+++ b/war/resources/scripts/hudson-behavior.js
@@ -140,6 +140,13 @@ function findAncestor(e, tagName) {
return e;
}
+function findAncestorClass(e, cssClass) {
+ do {
+ e = e.parentNode;
+ } while (e != null && !Element.hasClassName(e,cssClass));
+ return e;
+}
+
function findFollowingTR(input, className) {
// identify the parent TR
var tr = input;
@@ -643,6 +650,54 @@ var hudsonRules = {
return false;
};
e = null; // memory leak prevention
+ },
+
+ // radioBlock.jelly
+ "INPUT.radio-block-control" : function(r) {
+ r.id = "radio-block-"+(iota++);
+
+ // when one radio button is clicked, we need to update foldable block for
+ // other radio buttons with the same name. To do this, group all the
+ // radio buttons with the same name together and hang it under the form object
+ var f = r.form;
+ var radios = f.radios;
+ if (radios == null)
+ f.radios = radios = {};
+
+ var g = radios[r.name];
+ if (g == null) {
+ radios[r.name] = g = object(radioBlockSupport);
+ g.buttons = [];
+ }
+
+ var s = findAncestorClass(r,"radio-block-start");
+
+ // find the end node
+ var e = (function() {
+ var e = s;
+ var cnt=1;
+ while(cnt>0) {
+ e = e.nextSibling;
+ if (Element.hasClassName(e,"radio-block-start"))
+ cnt++;
+ if (Element.hasClassName(e,"radio-block-end"))
+ cnt--;
+ }
+ return e;
+ })();
+
+ var u = function() {
+ g.updateSingleButton(r,s,e);
+ };
+ applyNameRef(s,e,r.id);
+ g.buttons.push(u);
+
+ // apply the initial visibility
+ u();
+
+ // install event handlers to update visibility.
+ // needs to use onclick and onchange for Safari compatibility
+ r.onclick = r.onchange = function() { g.updateButtons(); };
}
};
@@ -1047,78 +1102,43 @@ var repeatableSupport = {
}
};
-// Used by radioBlock.jelly to wire up expandable radio block
-function addRadioBlock(id) {
- // prototype object to be duplicated for each radio button group
- var radioBlockSupport = {
- buttons : null,
+// prototype object to be duplicated for each radio button group
+var radioBlockSupport = {
+ buttons : null,
- updateButtons : function() {
- for( var i=0; i