PageRenderTime 20ms CodeModel.GetById 18ms app.highlight 0ms RepoModel.GetById 1ms app.codeStats 0ms

/hudson-core/src/main/resources/lib/form/option.jelly

http://github.com/hudson/hudson
Unknown | 43 lines | 38 code | 5 blank | 0 comment | 0 complexity | 4f6e67a2cd54d5371faa7802179b8a7d MD5 | raw file
 1<!--
 2The MIT License
 3
 4Copyright (c) 2004-2010, Sun Microsystems, Inc., Kohsuke Kawaguchi
 5
 6Permission is hereby granted, free of charge, to any person obtaining a copy
 7of this software and associated documentation files (the "Software"), to deal
 8in the Software without restriction, including without limitation the rights
 9to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10copies of the Software, and to permit persons to whom the Software is
11furnished to do so, subject to the following conditions:
12
13The above copyright notice and this permission notice shall be included in
14all copies or substantial portions of the Software.
15
16THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22THE SOFTWARE.
23-->
24<?jelly escape-by-default='true'?>
25<j:jelly xmlns:j="jelly:core" xmlns:d="jelly:define" xmlns:st="jelly:stapler">
26  <st:documentation>
27    &lt;option> tag for the &lt;select> element that takes true/false for selected.
28
29    <st:attribute name="value">
30      The value to be sent when the form is submitted.
31      If omitted, the body of the tag will be placed in the value attribute as well
32      (due to the browser incompatibility between IE and Firefox, value attribute
33       must be included).
34    </st:attribute>
35    <st:attribute name="selected" type="boolean">
36      If true, the option value appears as selected.
37    </st:attribute>
38  </st:documentation>
39  <!-- No escape/encode to avoid double-encoding if used in value attribute below -->
40  <j:set var="optionBody" encode="false"><d:invokeBody escapeText="false"/></j:set>
41  <option value="${attrs.value!=null?attrs.value:h.xmlUnescape(optionBody)}"
42          selected="${attrs.selected?'true':null}"><j:out value="${optionBody}"/></option>
43</j:jelly>