提交 b080ec17 编写于 作者: K kohsuke

nested optional block was not working. Fixed that bug.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@5012 71c3de6d-444a-0410-be80-ed276b4c234a
上级 969ba3ab
......@@ -17,7 +17,7 @@
</j:if>
<tr id="oe_s${oe_id}" hasHelp="${help!=null}"><!-- this ID marks the beginning -->
<td colspan="3">
<f:checkbox name="${name}" onclick="javascript:updateOptionalBlock('oe_s${oe_id}','oe_e${oe_id}','oe_c${oe_id}')"
<f:checkbox name="${name}" onclick="javascript:updateOptionalBlock('oe_s${oe_id}','oe_c${oe_id}')"
id="oe_c${oe_id}" checked="${checked}" />
<st:nbsp/>
<label for="oe_c${oe_id}">${title}</label>
......@@ -33,9 +33,9 @@
</j:if>
<d:invokeBody />
<!-- end marker -->
<tr id="oe_e${oe_id}" style="display:none">
<tr class='optional-block-end' style="display:none">
<script>
initOptionalBlock('oe_s${oe_id}','oe_e${oe_id}','oe_c${oe_id}');
initOptionalBlock('oe_s${oe_id}','oe_c${oe_id}');
</script>
</tr>
</j:jelly>
......@@ -319,16 +319,23 @@ function applyNameRef(s,e,id) {
x.setAttribute("nameRef",id);
}
function initOptionalBlock(sid, eid, cid) {
applyNameRef($(sid),$(eid),cid);
updateOptionalBlock(sid,eid,cid);
function initOptionalBlock(sid,cid) {
function findEndOptionalBlock(s) {
while(!s.hasClassName("optional-block-end"))
s=s.nextSibling;
return s;
}
var s = $(sid);
var e = findEndOptionalBlock(s);
applyNameRef(s,e,cid);
updateOptionalBlock(sid,cid);
}
// used by optionalBlock.jelly to update the form status
// @param sid ID of the start marker
// @param sid ID of the end marker
// @param cid ID of the check box
function updateOptionalBlock(sid, eid, cid) {
function updateOptionalBlock(sid, cid) {
var tbl = document.getElementById(sid).parentNode;
var i = false;
var o = false;
......@@ -338,7 +345,7 @@ function updateOptionalBlock(sid, eid, cid) {
for (var j = 0; tbl.rows[j]; j++) {
var n = tbl.rows[j];
if (n.id == eid)
if (i && n.hasClassName("optional-block-end"))
o = true;
if (i && !o) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册