diff --git a/core/src/main/java/hudson/model/Project.java b/core/src/main/java/hudson/model/Project.java index fd228a3521..fb63c2c837 100644 --- a/core/src/main/java/hudson/model/Project.java +++ b/core/src/main/java/hudson/model/Project.java @@ -195,7 +195,7 @@ public abstract class Project

,B extends Build> buildWrappers.rebuild(req,json, BuildWrappers.getFor(this)); builders.rebuildHetero(req,json, Builder.all(), "builder"); - publishers.rebuild(req, json, BuildStepDescriptor.filter(Publisher.all(), this.getClass())); + publishers.rebuildHetero(req, json, Publisher.all(), "publisher"); } @Override diff --git a/core/src/main/resources/lib/form/hetero-list.jelly b/core/src/main/resources/lib/form/hetero-list.jelly index 3325dc18d5..198ff6e733 100644 --- a/core/src/main/resources/lib/form/hetero-list.jelly +++ b/core/src/main/resources/lib/form/hetero-list.jelly @@ -52,6 +52,16 @@ THE SOFTWARE. For each item, add a caption from descriptor.getDisplayName(). This also activates drag&drop (where the header is a grip), and help text support. + + If true, only allow up to one instance per descriptor. + + + Menu alignment against the button. Defaults to tl-bl + + + If true, insert new addition by default to their 'desired' location, which + is the order induced by the descriptors. + @@ -90,12 +100,12 @@ THE SOFTWARE. -

+
-
+
@@ -121,7 +131,7 @@ THE SOFTWARE.
- +
diff --git a/core/src/main/resources/lib/hudson/project/config-publishers.jelly b/core/src/main/resources/lib/hudson/project/config-publishers.jelly index ddbf60fc64..ad29a3c429 100644 --- a/core/src/main/resources/lib/hudson/project/config-publishers.jelly +++ b/core/src/main/resources/lib/hudson/project/config-publishers.jelly @@ -27,7 +27,15 @@ THE SOFTWARE. --> - + + + + + \ No newline at end of file diff --git a/war/src/main/webapp/scripts/hudson-behavior.js b/war/src/main/webapp/scripts/hudson-behavior.js index 98b945a4a9..3a8a08c699 100644 --- a/war/src/main/webapp/scripts/hudson-behavior.js +++ b/war/src/main/webapp/scripts/hudson-behavior.js @@ -510,6 +510,7 @@ var jenkinsRules = { // other behavior rules change them (like YUI buttons.) "DIV.hetero-list-container" : function(e) { + e=$(e); if(isInsideRemovable(e)) return; // components for the add button @@ -537,24 +538,84 @@ var jenkinsRules = { var withDragDrop = initContainerDD(e); - var menuButton = new YAHOO.widget.Button(btn, { type: "menu", menu: menu }); + var menuAlign = (btn.getAttribute("menualign")||"tl-bl"); + + var menuButton = new YAHOO.widget.Button(btn, { type: "menu", menu: menu, menualignment: menuAlign.split("-") }); 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 item = args[1]; + if (item.cfg.getProperty("disabled")) return; + var t = templates[parseInt(item.value)]; var nc = document.createElement("div"); nc.className = "repeated-chunk"; nc.setAttribute("name",t.name); + nc.setAttribute("descriptorId",t.descriptorId); nc.innerHTML = t.html; + $(nc).setOpacity(0); + + var scroll = document.body.scrollTop; renderOnDemand(findElementsBySelector(nc,"TR.config-page")[0],function() { - insertionPoint.parentNode.insertBefore(nc, insertionPoint); + function findInsertionPoint() { + // given the element to be inserted 'prospect', + // and the array of existing items 'current', + // and preferred ordering function, return the position in the array + // the prospect should be inserted. + // (for example 0 if it should be the first item) + function findBestPosition(prospect,current,order) { + function desirability(pos) { + var count=0; + for (var i=0; i0) { + document.body.scrollTop += d; + } else { + var d = Y-y; + if (d>0) document.body.scrollTop -= d; + } +} // set up logic behind the search box function createSearchBox(searchURL) {