Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
6 | Andrea | 1 | <#-- |
2 | /* |
||
3 | * $Id: Action.java 502296 2007-02-01 17:33:39Z niallp $ |
||
4 | * |
||
5 | * Licensed to the Apache Software Foundation (ASF) under one |
||
6 | * or more contributor license agreements. See the NOTICE file |
||
7 | * distributed with this work for additional information |
||
8 | * regarding copyright ownership. The ASF licenses this file |
||
9 | * to you under the Apache License, Version 2.0 (the |
||
10 | * "License"); you may not use this file except in compliance |
||
11 | * with the License. You may obtain a copy of the License at |
||
12 | * |
||
13 | * http://www.apache.org/licenses/LICENSE-2.0 |
||
14 | * |
||
15 | * Unless required by applicable law or agreed to in writing, |
||
16 | * software distributed under the License is distributed on an |
||
17 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
||
18 | * KIND, either express or implied. See the License for the |
||
19 | * specific language governing permissions and limitations |
||
20 | * under the License. |
||
21 | */ |
||
22 | --> |
||
23 | <#include "/${parameters.templateDir}/simple/select.ftl" /> |
||
24 | <#assign startCount = 0/> |
||
25 | <#if parameters.headerKey?exists && parameters.headerValue?exists> |
||
26 | <#assign startCount = startCount + 1/> |
||
27 | </#if> |
||
28 | <#if parameters.emptyOption?exists> |
||
29 | <#assign startCount = startCount + 1/> |
||
30 | </#if> |
||
31 | |||
32 | <br /> |
||
33 | <select<#rt/> |
||
34 | name="${parameters.doubleName?default("")?html}"<#rt/> |
||
35 | <#if parameters.disabled?default(false)> |
||
36 | disabled="disabled"<#rt/> |
||
37 | </#if> |
||
38 | <#if parameters.doubleTabindex?exists> |
||
39 | tabindex="${parameters.doubleTabindex?html}"<#rt/> |
||
40 | </#if> |
||
41 | <#if parameters.doubleId?exists> |
||
42 | id="${parameters.doubleId?html}"<#rt/> |
||
43 | </#if> |
||
44 | <#if parameters.doubleCss?exists> |
||
45 | class="${parameters.doubleCss?html}"<#rt/> |
||
46 | </#if> |
||
47 | <#if parameters.doubleStyle?exists> |
||
48 | style="${parameters.doubleStyle?html}"<#rt/> |
||
49 | </#if> |
||
50 | <#if parameters.title?exists> |
||
51 | title="${parameters.title?html}"<#rt/> |
||
52 | </#if> |
||
53 | <#if parameters.multiple?default(false)> |
||
54 | multiple="multiple"<#rt/> |
||
55 | </#if> |
||
56 | <#if parameters.get("doubleSize")?exists> |
||
57 | size="${parameters.get("doubleSize")?html}"<#rt/> |
||
58 | </#if> |
||
59 | > |
||
60 | </select> |
||
61 | <script type="text/javascript"> |
||
62 | <#assign itemCount = startCount/> |
||
63 | var ${parameters.id}Group = new Array(${parameters.listSize} + ${startCount}); |
||
64 | for (i = 0; i < (${parameters.listSize} + ${startCount}); i++) |
||
65 | ${parameters.id}Group[i] = new Array(); |
||
66 | |||
67 | <@s.iterator value="parameters.list"> |
||
68 | <#if parameters.listKey?exists> |
||
69 | <#assign itemKey = stack.findValue(parameters.listKey)/> |
||
70 | <#else> |
||
71 | <#assign itemKey = stack.findValue('top')/> |
||
72 | </#if> |
||
73 | <#if parameters.listValue?exists> |
||
74 | <#assign itemValue = stack.findString(parameters.listValue)/> |
||
75 | <#else> |
||
76 | <#assign itemValue = stack.findString('top')/> |
||
77 | </#if> |
||
78 | <#assign doubleItemCount = 0/> |
||
79 | <@s.iterator value="${parameters.doubleList}"> |
||
80 | <#if parameters.doubleListKey?exists> |
||
81 | <#assign doubleItemKey = stack.findValue(parameters.doubleListKey)/> |
||
82 | <#else> |
||
83 | <#assign doubleItemKey = stack.findValue('top')/> |
||
84 | </#if> |
||
85 | <#assign doubleItemKeyStr = doubleItemKey.toString() /> |
||
86 | <#if parameters.doubleListValue?exists> |
||
87 | <#assign doubleItemValue = stack.findString(parameters.doubleListValue)/> |
||
88 | <#else> |
||
89 | <#assign doubleItemValue = stack.findString('top')/> |
||
90 | </#if> |
||
91 | ${parameters.id}Group[${itemCount}][${doubleItemCount}] = new Option("${doubleItemValue}", "${doubleItemKeyStr}"); |
||
92 | |||
93 | <#assign doubleItemCount = doubleItemCount + 1/> |
||
94 | </@s.iterator> |
||
95 | <#assign itemCount = itemCount + 1/> |
||
96 | </@s.iterator> |
||
97 | |||
98 | var ${parameters.id}Temp = document.${parameters.formName}.${parameters.doubleId}; |
||
99 | <#assign itemCount = startCount/> |
||
100 | <#assign redirectTo = 0/> |
||
101 | <@s.iterator value="parameters.list"> |
||
102 | <#if parameters.listKey?exists> |
||
103 | <#assign itemKey = stack.findValue(parameters.listKey)/> |
||
104 | <#else> |
||
105 | <#assign itemKey = stack.findValue('top')/> |
||
106 | </#if> |
||
107 | <#if tag.contains(parameters.nameValue, itemKey)> |
||
108 | <#assign redirectTo = itemCount/> |
||
109 | </#if> |
||
110 | <#assign itemCount = itemCount + 1/> |
||
111 | </@s.iterator> |
||
112 | ${parameters.id}Redirect(${redirectTo}); |
||
113 | function ${parameters.id}Redirect(x) { |
||
114 | var selected = false; |
||
115 | for (m = ${parameters.id}Temp.options.length - 1; m >= 0; m--) { |
||
116 | ${parameters.id}Temp.options[m] = null; |
||
117 | } |
||
118 | |||
119 | for (i = 0; i < ${parameters.id}Group[x].length; i++) { |
||
120 | ${parameters.id}Temp.options[i] = new Option(${parameters.id}Group[x][i].text, ${parameters.id}Group[x][i].value); |
||
121 | <#if parameters.doubleNameValue?exists> |
||
122 | if (${parameters.id}Temp.options[i].value == '${parameters.doubleNameValue}') { |
||
123 | ${parameters.id}Temp.options[i].selected = true; |
||
124 | selected = true; |
||
125 | } |
||
126 | </#if> |
||
127 | } |
||
128 | |||
129 | if ((${parameters.id}Temp.options.length > 0) && (! selected)) { |
||
130 | ${parameters.id}Temp.options[0].selected = true; |
||
131 | } |
||
132 | } |
||
133 | </script> |