提交 f7e9b4fb 编写于 作者: M mindless

Replace uses of /fieldCheck validator with clazz="required" client-side validation.

Marked Hudson.doFieldCheck as deprecated.
Also a few more escape->encodeURIComponent.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@21549 71c3de6d-444a-0410-be80-ed276b4c234a
上级 41b1ebd4
......@@ -2982,11 +2982,15 @@ public final class Hudson extends Node implements ItemGroup<TopLevelItem>, Stapl
/**
* Checks if the value for a field is set; if not an error or warning text is displayed.
* If the parameter "value" is not set then the parameter "errorText" is displayed
* as an error text. If the parameter "errorText" is not set, then the parameter "warningText" is
* displayed as a warning text.
* as an error text. If the parameter "errorText" is not set, then the parameter "warningText"
* is displayed as a warning text.
* <p>
* If the text is set and the parameter "type" is set, it will validate that the value is of the
* correct type. Supported types are "number, "number-positive" and "number-negative".
*
* @deprecated as of 1.324
* Either use client-side validation (e.g. class="required number")
* or define your own check method, instead of relying on this generic one.
*/
public FormValidation doFieldCheck(@QueryParameter(fixEmpty=true) String value,
@QueryParameter(fixEmpty=true) String type,
......
......@@ -32,8 +32,7 @@ THE SOFTWARE.
<l:main-panel>
<f:form method="post" action="doCreateItem">
<f:entry title="${%Name}" help="/help/system-config/master-slave/name.html">
<f:textbox name="name" value="${request.getParameter('name')}"
checkUrl="'../fieldCheck?errorText=${h.jsStringEscape(h.encode('%Name is mandatory'))}&amp;value='+escape(this.value)"/>
<f:textbox name="name" value="${request.getParameter('name')}" clazz="required" checkMessage="${%Name is mandatory}"/>
</f:entry>
<!-- main body of the configuration -->
......
......@@ -37,8 +37,8 @@ THE SOFTWARE.
<table>
<f:block>
${%Choose the CVS tag name for this build}:
<input type="text" name="name" value="hudson-${it.build.number}" class="validated"
checkUrl="'checkTag?value='+escape(this.value)"/>
<f:textbox name="name" value="hudson-${it.build.number}"
checkUrl="'checkTag?value='+encodeURIComponent(this.value)"/>
</f:block>
<j:set var="upstream" value="${it.build.transitiveUpstreamBuilds}" />
......@@ -46,8 +46,8 @@ THE SOFTWARE.
<f:optionalBlock name="upstream" title="Tag all upstream builds at once" help="${descriptor.getHelpFile('tagAll')}">
<j:forEach var="up" items="${upstream}">
<f:entry title="${up.key.name} #${up.value}">
<input type="text" name="upstream.${up.key.name}" value="hudson-${up.value}" class="validated"
checkUrl="'checkTag?value='+escape(this.value)"/>
<f:textbox name="upstream.${up.key.name}" value="hudson-${up.value}"
checkUrl="'checkTag?value='+encodeURIComponent(this.value)"/>
</f:entry>
</j:forEach>
</f:optionalBlock>
......@@ -117,4 +117,4 @@ THE SOFTWARE.
</j:choose>
</l:main-panel>
</l:layout>
</j:jelly>
\ No newline at end of file
</j:jelly>
......@@ -25,13 +25,13 @@ THE SOFTWARE.
<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="${%In demand delay}" help="/help/system-config/master-slave/demand/inDemandDelay.html">
<input class="setting-input number validated" name="retentionStrategy.inDemandDelay"
type="text" value="${instance.inDemandDelay}"
checkUrl="'${rootURL}/fieldCheck?errorText=${h.jsStringEscape(h.encode('%In demand delay is mandatory.'))}&amp;value='+escape(this.value)"/>
<f:textbox clazz="required number"
name="retentionStrategy.inDemandDelay" value="${instance.inDemandDelay}"
checkMessage="${%In demand delay is mandatory and must be a number.}"/>
</f:entry>
<f:entry title="${%Idle delay}" help="/help/system-config/master-slave/demand/idleDelay.html">
<input class="setting-input number validated" name="retentionStrategy.idleDelay"
type="text" value="${instance.idleDelay}"
checkUrl="'${rootURL}/fieldCheck?errorText=${h.jsStringEscape(h.encode('%Idle delay is mandatory.'))}&amp;value='+escape(this.value)"/>
<f:textbox clazz="required number"
name="retentionStrategy.idleDelay" value="${instance.idleDelay}"
checkMessage="${%Idle delay is mandatory and must be a number.}"/>
</f:entry>
</j:jelly>
......@@ -25,14 +25,14 @@ THE SOFTWARE.
<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="${%Startup Schedule}" help="/help/project-config/timer-format.html">
<f:textarea name="retentionStrategy.startTimeSpec" checkUrl="'${rootURL}/retentionStrategy/SimpleScheduledRetentionStrategy/check?value='+escape(this.value)"
<f:textarea name="retentionStrategy.startTimeSpec" checkUrl="'${rootURL}/retentionStrategy/SimpleScheduledRetentionStrategy/check?value='+encodeURIComponent(this.value)"
value="${instance.startTimeSpec}"/>
</f:entry>
<f:entry title="${%Scheduled Uptime}"
description="The number of minutes to keep the node up for. If this is longer than the startup schedule, then the node will remain constantly on-line.">
<input class="setting-input number validated" name="retentionStrategy.upTimeMins"
type="text" value="${instance.upTimeMins}"
checkUrl="'${rootURL}/fieldCheck?errorText=${h.jsStringEscape(h.encode('%Scheduled Uptime is mandatory.'))}&amp;value='+escape(this.value)"/>
<f:textbox clazz="required number"
name="retentionStrategy.upTimeMins" value="${instance.upTimeMins}"
checkMessage="${%Scheduled Uptime is mandatory and must be a number.}"/>
</f:entry>
<f:entry title="${%Keep on-line while jobs are running}">
<f:checkbox name="retentionStrategy.keepUpWhenActive" checked="${h.defaultToTrue(instance.keepUpWhenActive)}"/>
......
......@@ -36,9 +36,8 @@ THE SOFTWARE.
checked="${!empty(up)}">
<f:entry title="${%Projects names}"
description="${%Multiple projects can be specified like 'abc, def'}">
<input class="setting-input validated" name="upstreamProjects"
checkUrl="'descriptorByName/BuildTrigger/check?value='+escape(this.value)"
type="text" value="${h.getProjectListString(up)}"/>
<f:textbox name="upstreamProjects" value="${h.getProjectListString(up)}"
checkUrl="'descriptorByName/BuildTrigger/check?value='+encodeURIComponent(this.value)"/>
</f:entry>
</f:optionalBlock>
</j:jelly>
\ No newline at end of file
</j:jelly>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册