提交 8403cc77 编写于 作者: K kohsuke

updated to use structured form submission.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@6132 71c3de6d-444a-0410-be80-ed276b4c234a
上级 89a71a42
......@@ -11,11 +11,14 @@ import hudson.model.Result;
import hudson.util.FormFieldValidator;
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;
import org.kohsuke.stapler.DataBoundConstructor;
import javax.servlet.ServletException;
import java.io.File;
import java.io.IOException;
import net.sf.json.JSONObject;
/**
* Copies the artifacts into an archive directory.
*
......@@ -38,9 +41,10 @@ public class ArtifactArchiver extends Publisher {
*/
private final boolean latestOnly;
@DataBoundConstructor
public ArtifactArchiver(String artifacts, String excludes, boolean latestOnly) {
this.artifacts = artifacts;
this.excludes = excludes;
this.artifacts = artifacts.trim();
this.excludes = Util.fixEmptyAndTrim(excludes);
this.latestOnly = latestOnly;
}
......@@ -125,11 +129,8 @@ public class ArtifactArchiver extends Publisher {
new FormFieldValidator.WorkspaceFileMask(req,rsp).process();
}
public Publisher newInstance(StaplerRequest req) {
return new ArtifactArchiver(
req.getParameter("artifacts").trim(),
Util.fixEmpty(req.getParameter("artifacts_excludes").trim()),
req.getParameter("artifacts_latest_only")!=null);
public ArtifactArchiver newInstance(StaplerRequest req, JSONObject formData) throws FormException {
return req.bindJSON(ArtifactArchiver.class,formData);
}
}
}
<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="Files to archive" help="/help/tasks/artifactArchiver/includes.html">
<f:textbox name="artifacts" value="${instance.artifacts}"
<f:textbox name="artifacts.artifacts" value="${instance.artifacts}"
checkUrl="'${rootURL}/publisher/ArtifactArchiver/check?job=${it.fullName}&amp;value='+escape(this.value)" />
</f:entry>
<f:advanced>
<f:entry title="Excludes" help="/help/tasks/artifactArchiver/excludes.html">
<f:textbox name="artifacts_excludes" value="${instance.excludes}"/>
<f:textbox name="artifacts.excludes" value="${instance.excludes}"/>
</f:entry>
<f:entry title="">
<f:checkbox name="artifacts_latest_only" checked="${instance.latestOnly}" />
<f:checkbox name="artifacts.latestOnly" checked="${instance.latestOnly}" />
<label class="attach-previous">Discard all but the last successful artifact to save disk space</label>
</f:entry>
</f:advanced>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册