提交 41b1ebd4 编写于 作者: M mindless

Add clazz attribute on f:textbox so clazz="number" or "positive-number"

can be used for client-side validation, and replaced some <input>
with f:textbox calls.  Also another encode->encodeURIComponent.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@21548 71c3de6d-444a-0410-be80-ed276b4c234a
上级 533b34e1
......@@ -49,12 +49,10 @@ THE SOFTWARE.
<f:slave-mode name="master.mode" node="${it}" />
</j:if>
<f:entry title="${%Quiet period}" help="/help/project-config/quietPeriod.html">
<input class="setting-input number" name="quiet_period"
type="text" value="${it.quietPeriod}"/>
<f:textbox clazz="number" name="quiet_period" value="${it.quietPeriod}"/>
</f:entry>
<f:entry title="${%SCM checkout retry count}" help="/help/project-config/scmCheckoutRetryCount.html">
<input class="setting-input number" name="retry_count"
type="text" value="${it.scmCheckoutRetryCount}"/>
<f:textbox clazz="number" name="retry_count" value="${it.scmCheckoutRetryCount}"/>
</f:entry>
<j:if test="${size(it.views) gt 1}">
......@@ -76,8 +74,8 @@ THE SOFTWARE.
<f:radio name="slaveAgentPortType" value="fixed" id="sat.fixed"
checked="${it.slaveAgentPort &gt; 0}" onclick="$('sat.port').disabled=false"/>
<label for="sat.fixed">${%Fixed}</label> :
<input type="text" class="number" name="slaveAgentPort" id="sat.port"
value ="${it.slaveAgentPort gt 0 ? it.slaveAgentPort : null}"
<input type="text" class="setting-input number" name="slaveAgentPort" id="sat.port"
value="${it.slaveAgentPort gt 0 ? it.slaveAgentPort : null}"
disabled="${it.slaveAgentPort gt 0 ? null : 'true'}"/>
<st:nbsp />
......@@ -179,4 +177,4 @@ THE SOFTWARE.
</f:form>
</l:main-panel>
</l:layout>
</j:jelly>
\ No newline at end of file
</j:jelly>
......@@ -25,12 +25,12 @@ 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="${%Days to keep builds}"
description="${%if not empty, build records are only kept up to this number of days}">
<input class="setting-input positive-number" name="logrotate_days"
type="text" value="${it.logRotator.daysToKeepStr}"/>
<f:textbox clazz="positive-number"
name="logrotate_days" value="${it.logRotator.daysToKeepStr}"/>
</f:entry>
<f:entry title="${%Max # of builds to keep}"
description="${%if not empty, only up to this number of build records are kept}">
<input class="setting-input positive-number" name="logrotate_nums"
type="text" value="${it.logRotator.numToKeepStr}"/>
<f:textbox clazz="positive-number"
name="logrotate_nums" value="${it.logRotator.numToKeepStr}"/>
</f:entry>
</j:jelly>
......@@ -33,18 +33,16 @@ THE SOFTWARE.
</f:description>
<f:entry title="${%SMTP server}"
help="/help/tasks/mailer/smtp-server.html">
<input class="setting-input" name="mailer_smtp_server"
type="text" value="${descriptor.smtpServer}"/>
<f:textbox name="mailer_smtp_server" value="${descriptor.smtpServer}"/>
</f:entry>
<f:entry title="${%Default user e-mail suffix}"
help="/help/tasks/mailer/default-suffix.html">
<input class="setting-input" name="mailer_default_suffix"
type="text" value="${descriptor.defaultSuffix}"/>
<f:textbox name="mailer_default_suffix" value="${descriptor.defaultSuffix}"/>
</f:entry>
<f:entry title="${%System Admin E-mail Address}"
help="/help/tasks/mailer/admin-address.html">
<f:textbox name="mailer_admin_address" value="${descriptor.adminAddress}"
checkUrl="'${rootURL}/publisher/Mailer/addressCheck?value='+encode(this.value)"/>
checkUrl="'${rootURL}/publisher/Mailer/addressCheck?value='+encodeURIComponent(this.value)"/>
</f:entry>
<f:entry title="${%Hudson URL}"
help="/help/tasks/mailer/url.html">
......@@ -54,12 +52,11 @@ THE SOFTWARE.
<f:optionalBlock name="mailer.useSMTPAuth" title="${%Use SMTP Authentication}" checked="${descriptor.smtpAuthUserName!=null}"
help="/help/tasks/mailer/smtpAuth.html">
<f:entry title="${%User Name}">
<input class="setting-input" name="mailer.SMTPAuth.userName"
type="text" value="${descriptor.smtpAuthUserName}"/>
<f:textbox name="mailer.SMTPAuth.userName"
value="${descriptor.smtpAuthUserName}"/>
</f:entry>
<f:entry title="${%Password}">
<input class="setting-input" name="mailer.SMTPAuth.password"
type="password" value="${descriptor.smtpAuthPassword}"/>
<f:password name="mailer.SMTPAuth.password" value="${descriptor.smtpAuthPassword}"/>
</f:entry>
</f:optionalBlock>
<f:entry title="${%Use SSL}"
......@@ -68,9 +65,8 @@ THE SOFTWARE.
</f:entry>
<f:entry title="${%SMTP Port}"
help="/help/tasks/mailer/smtp-port.html">
<input class="setting-input" name="mailer_smtp_port"
type="text" value="${descriptor.smtpPort}"/>
<f:textbox clazz="number" name="mailer_smtp_port" value="${descriptor.smtpPort}"/>
</f:entry>
</f:advanced>
</f:section>
</j:jelly>
\ No newline at end of file
</j:jelly>
......@@ -68,7 +68,7 @@ THE SOFTWARE.
<td width="*">
<j:set var="name" value="${attrs.name ?: '_.'+attrs.field}" />
<input class="setting-input" type="text"
name ="${name}" value="${value}"
name="${name}" value="${value}"
id="textarea.${name}" />
</td><td width="1">
<input type="button" value="&#x25BC;" onclick="expandTextArea(this,'textarea.${name}')"
......@@ -78,4 +78,4 @@ THE SOFTWARE.
</table>
</j:otherwise>
</j:choose>
</j:jelly>
\ No newline at end of file
</j:jelly>
......@@ -43,6 +43,15 @@ THE SOFTWARE.
<st:attribute name="default">
The default value of the text box, in case both @value is and 'instance[field]' is null.
</st:attribute>
<!-- Tomcat doesn't like us using the attribute called 'class' -->
<st:attribute name="clazz">
Additional CSS class(es) to add (such as client-side validation clazz="required",
"number" or "positive-number"; these may be combined, as clazz="required number").
</st:attribute>
<st:attribute name="checkMessage">
Override the default error message when client-side validation fails,
as with clazz="required", etc.
</st:attribute>
<st:attribute name="checkUrl">
If specified, the value entered in this input field will be checked (via AJAX)
against this URL, and errors will be rendered under the text field.
......@@ -52,11 +61,12 @@ THE SOFTWARE.
</st:attribute>
</st:documentation>
<f:prepareDatabinding />
<input class="setting-input ${attrs.checkUrl!=null?'validated':''}"
name ="${attrs.name ?: '_.'+attrs.field}"
<input class="setting-input ${attrs.checkUrl!=null?'validated':''} ${attrs.clazz}"
name="${attrs.name ?: '_.'+attrs.field}"
value="${attrs.value ?: instance[attrs.field] ?: attrs.default}"
id="${attrs.id}"
type="text"
checkUrl="${attrs.checkUrl}" checkMethod="${attrs.checkMethod}"
checkMessage="${attrs.checkMessage}"
onchange="${attrs.onchange}" onkeyup="${attrs.onkeyup}"/>
</j:jelly>
\ No newline at end of file
</j:jelly>
......@@ -28,8 +28,7 @@ THE SOFTWARE.
help="/help/project-config/quietPeriod.html">
<f:entry title="${%Quiet period}"
description="${%Number of seconds}">
<input class="setting-input" name="quiet_period"
type="text" value="${it.quietPeriod}"/>
<f:textbox clazz="number" name="quiet_period" value="${it.quietPeriod}"/>
</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.
先完成此消息的编辑!
想要评论请 注册