diff --git a/core/src/main/resources/lib/form/hetero-list.jelly b/core/src/main/resources/lib/form/hetero-list.jelly new file mode 100644 index 0000000000000000000000000000000000000000..96fedaffefde4e0bae36074ec5cde0d7c7636a24 --- /dev/null +++ b/core/src/main/resources/lib/form/hetero-list.jelly @@ -0,0 +1,38 @@ + + +
+ + + + + + +
+
+ +
+ + +
+ +
+
+ \ No newline at end of file diff --git a/war/resources/css/style.css b/war/resources/css/style.css index 754f601b210be39dadc673381c1849f24d0f7a96..717328c974ca98539e8e4ca7a32716d91008f02a 100644 --- a/war/resources/css/style.css +++ b/war/resources/css/style.css @@ -626,6 +626,7 @@ DIV.yahooTree td { background: white url(../images/16x16/search.gif) no-repeat 2px center; padding-left: 20px; width: 10em; + position: static; } #search-box.defaulted { diff --git a/war/resources/scripts/hudson-behavior.js b/war/resources/scripts/hudson-behavior.js index 88d617165ea8c36bdc585ebc1aebb54a112878c8..ff66b5764451cd685a9b8b9c401b2aedd2ffc664 100644 --- a/war/resources/scripts/hudson-behavior.js +++ b/war/resources/scripts/hudson-behavior.js @@ -311,6 +311,41 @@ var hudsonRules = { e.onmouseout = function(ev) { return tooltip.onContextMouseOut .call(this,YAHOO.util.Event.getEvent(ev),tooltip); } e.title = e.getAttribute("tooltip"); e = null; // avoid memory leak + }, + + + "DIV.hetero-list-container" : function(e) { + // components for the add button + var menu = document.createElement("SELECT"); + var btn = findElementsBySelector(e,"INPUT.hetero-list-add")[0]; + YAHOO.util.Dom.insertAfter(menu,btn); + + var prototypes = e.lastChild; + while(!Element.hasClassName(prototypes,"prototypes")) + prototypes = prototypes.previousSibling; + var insertionPoint = prototypes.previousSibling; // this is where the new item is inserted. + + // extract templates + var templates = []; var i=0; + for(var n=prototypes.firstChild;n!=null;n=n.nextSibling,i++) { + var name = n.getAttribute("name"); + menu.options[i] = new Option(n.getAttribute("title"),""+i); + templates.push({html:n.innerHTML, name:name}); + } + Element.remove(prototypes); + + var menuButton = new YAHOO.widget.Button(btn, { type: "menu", menu: menu }); + menuButton.getMenu().clickEvent.subscribe(function(type,args,value) { + var t = templates[parseInt(args[1].value)]; // where this args[1] comes is a real mystery + + var nc = document.createElement("div"); + nc.className = "repeated-chunk"; + nc.setAttribute("name",t.name); + nc.innerHTML = t.html; + insertionPoint.parentNode.insertBefore(nc, insertionPoint); + + Behaviour.applySubtree(nc); + }); } };