提交 11c4c53f 编写于 作者: K kohsuke

Added @field to <f:editableComboBox /> just like how <f:textbox field="abc"/> works.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@11024 71c3de6d-444a-0410-be80-ed276b4c234a
上级 8599de2d
......@@ -35,6 +35,7 @@ import org.apache.tools.zip.ZipEntry;
import org.apache.tools.zip.ZipOutputStream;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import org.kohsuke.stapler.DataBoundConstructor;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletResponse;
......@@ -117,14 +118,12 @@ public class CVSSCM extends SCM implements Serializable {
private boolean isTag;
/**
* @stapler-constructor
*/
public CVSSCM(String cvsroot, String module,String branch,String cvsRsh,boolean canUseUpdate, boolean legacy, boolean isTag) {
@DataBoundConstructor
public CVSSCM(String cvsRoot, String module,String branch,String cvsRsh,boolean canUseUpdate, boolean legacy, boolean isTag) {
if(fixNull(branch).equals("HEAD"))
branch = null;
this.cvsroot = cvsroot;
this.cvsroot = cvsRoot;
this.module = module.trim();
this.branch = nullify(branch);
this.cvsRsh = nullify(cvsRsh);
......@@ -1084,7 +1083,7 @@ public class CVSSCM extends SCM implements Serializable {
* <p>
* Also checks if .cvspass file contains the entry for this.
*/
public void doCvsrootCheck(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
public void doCheckCvsRoot(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
new FormFieldValidator(req,rsp,false) {
protected void check() throws IOException, ServletException {
String v = fixEmpty(request.getParameter("value"));
......
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<f:entry title="CVSROOT" help="/help/_cvs/cvsroot.html">
<f:editableComboBox id="cvs_root" clazz="setting-input validated"
name="cvs.cvsroot" value="${scm.cvsRoot}"
items="${app.allCvsRoots}"
checkUrl="'${rootURL}/scm/CVSSCM/cvsrootCheck?value='+escape(this.value)" />
<f:editableComboBox id="cvs_root" clazz="setting-input" field="cvsRoot" items="${app.allCvsRoots}" />
</f:entry>
<f:entry title="${%Modules}" help="/help/_cvs/modules.html">
<f:expandableTextbox name="cvs.module" value="${scm.allModules}"/>
......
<!--
Attributes:
If @field is specified:
in this case, name and value are inferred from field,
and checkUrl is auto-generated if the check method is present.
Otherwise
@name and @value are mandatory.
<%@attribute name="id" required="true" %>
<%@attribute name="clazz" required="false" %>
<%@attribute name="name" required="false" %>
<%@attribute name="value" required="false" %>
<%@attribute name="items" type="java.lang.Object" description="Optional list of possible values" %>
-->
<!-- Tomcat doesn't like us using the attribute called 'class' -->
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<j:if test="${editableComboBox_source_loaded==null}">
<script type="text/javascript" src="${request.contextPath}/scripts/utilities.js"></script>
<script type="text/javascript" src="${request.contextPath}/scripts/combobox.js"></script>
<script type="text/javascript" src="${request.contextPath}/scripts/utilities.js"/>
<script type="text/javascript" src="${request.contextPath}/scripts/combobox.js"/>
<j:set target="${requestScope}" property="editableComboBox_source_loaded" value="true" />
</j:if>
<input id="${attrs.id}" autocomplete="off" class="${attrs.clazz}"
name="${attrs.name}" value="${attrs.value}"
checkUrl="${attrs.checkUrl}" />
<j:set var="checkUrl" value="${h.getCheckUrl(attrs.checkUrl,descriptor,attrs.field)}" />
<input id="${attrs.id}" autocomplete="off" class="${attrs.clazz} ${h.ifThenElse(checkUrl!=null,'validated','')}"
name ="${h.defaulted(attrs.name,'_.'+attrs.field)}"
value="${h.defaulted(attrs.value,instance[attrs.field])}"
checkUrl="${checkUrl}" />
<j:set target="${requestScope}" property="editableComboBox" value="${attrs.id}" />
<script type="text/javascript">
var ${id}_values = new Array();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册