提交 496bd9ce 编写于 作者: K kohsuke

implemented a mechanism to allow text input field to be expanded into a text area.


git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@1918 71c3de6d-444a-0410-be80-ed276b4c234a
上级 4aa523b7
......@@ -20,7 +20,10 @@ import java.util.Map;
* @author Kohsuke Kawaguchi
*/
public class Ant extends Builder {
/**
* The targets, properties, and other Ant options.
* Either separated by whitespace or newline.
*/
private final String targets;
/**
......@@ -60,16 +63,18 @@ public class Ant extends Builder {
else
execName = "ant";
String normalizedTarget = targets.replaceAll("[\t\r\n]+"," ");
AntInstallation ai = getAnt();
if(ai==null)
cmd = execName+' '+targets;
cmd = execName+' '+normalizedTarget;
else {
File exec = ai.getExecutable();
if(!ai.getExists()) {
listener.fatalError(exec+" doesn't exist");
return false;
}
cmd = exec.getPath()+' '+targets;
cmd = exec.getPath()+' '+normalizedTarget;
}
Map<String,String> env = build.getEnvVars();
......
......@@ -12,7 +12,6 @@
such as '-Dprop=value'. Also, &lt;a href='${rootURL}/env-vars.html' target=_new>some
environment variables are available to the build script&lt;/a>
">
<input class="setting-input" name="ant_targets"
type="text" value="${instance.targets}"/>
<f:expandableTextbox name="ant_targets" value="${instance.targets}" />
</f:entry>
</j:jelly>
\ No newline at end of file
<!--
textbox that can be expanded into text area
<input class="setting-input ${h.ifThenElse(attrs.checkUrl!=null,'validated','')}" name="${attrs.name}"
type="text" value="${attrs.value}" checkUrl="${attrs.checkUrl}"/>
TODO: support @checkUrl
-->
<j:jelly xmlns:j="jelly:core" xmlns:d="jelly:define">
<table border="0" style="width:100%" cellspacing="0" cellpadding="0">
<j:choose>
<j:when test="${h.isMultiline(attrs.value)}">
<!-- multiline text area to begin with -->
<textarea rows="8" class='setting-input' name='${attrs.name}'>${attrs.value}</textarea>
</j:when>
<j:otherwise>
<!-- single line textbox with expand button -->
<tr>
<td width="*">
<input class="setting-input" name="${attrs.name}" id="textarea.${attrs.name}"
type="text" value="${attrs.value}"/>
</td><td width="1">
<input type="button" value="&#x25BC;" onclick="expandTextArea(this,'textarea.${attrs.name}')" />
</td>
</tr>
</j:otherwise>
</j:choose>
</table>
</j:jelly>
\ No newline at end of file
......@@ -267,3 +267,13 @@ function AutoScroller(scrollContainer) {
}
};
}
// used in expandableTextbox.jelly to change a input field into a text area
function expandTextArea(button,id) {
button.style.display="none";
var field = document.getElementById(id);
var value = field.value.replace(/ +/g,'\n');
field.parentNode.parentNode.parentNode.parentNode.innerHTML =
"<textarea rows=8 class='setting-input' name='"+field.name+"'>"+value+"</textarea>";
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册