Subversion Repositories Sigmater

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
6 Andrea 1
#*
2
 * $Id: Action.java 502296 2007-02-01 17:33:39Z niallp $
3
 *
4
 * Licensed to the Apache Software Foundation (ASF) under one
5
 * or more contributor license agreements.  See the NOTICE file
6
 * distributed with this work for additional information
7
 * regarding copyright ownership.  The ASF licenses this file
8
 * to you under the Apache License, Version 2.0 (the
9
 * "License"); you may not use this file except in compliance
10
 * with the License.  You may obtain a copy of the License at
11
 *
12
 *  http://www.apache.org/licenses/LICENSE-2.0
13
 *
14
 * Unless required by applicable law or agreed to in writing,
15
 * software distributed under the License is distributed on an
16
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17
 * KIND, either express or implied.  See the License for the
18
 * specific language governing permissions and limitations
19
 * under the License.
20
 *#
21
`#parse("/$parameters.templateDir/simple/select.vm")
22
#set ( $startCount = 0)
23
#if ($parameters.headerKey && $parameters.headerValue)
24
    #set ( $startCount = $startCount + 1)
25
#end
26
#if ($parameters.emptyOption)
27
    #set ( $startCount = $startCount + 1)
28
#end
29
 
30
<br />
31
<select name="$!struts.htmlEncode($parameters.doubleName)"
32
    #if ($parameters.disabled)         disabled="disabled"                                         #end
33
    #if ($parameters.doubleTabindex)   tabindex="$!struts.htmlEncode($parameters.doubleTabindex)" #end
34
    #if ($parameters.doubleId)         id="$!struts.htmlEncode($parameters.doubleId)"             #end
35
    #if ($parameters.multiple)         multiple="multiple"                                         #end
36
    #if ($parameters.cssClass)         class="$!struts.htmlEncode($parameters.cssClass)"          #end
37
    #if ($parameters.cssStyle)         style="$!struts.htmlEncode($parameters.cssStyle)"          #end
38
>
39
</select>
40
<script type="text/javascript">
41
#set( $itemCount = $startCount )
42
var $!struts.htmlEncode($parameters.name)Group = new Array($!{parameters.listSize} + $startCount);
43
for (i = 0; i < ($!{parameters.listSize} + $startCount); i++)
44
$!struts.htmlEncode($parameters.name)Group[i] = new Array();
45
#foreach( $item in $items )
46
    $stack.push($item)
47
    #if( $parameters.listKey )
48
        #set( $itemKey = $stack.findValue($parameters.listKey) )
49
    #else
50
        #set( $itemKey = $item )
51
    #end
52
    #if( $parameters.listValue )
53
        #set( $itemValue  = $stack.findValue($parameters.listValue) )
54
    #else
55
        #set( $itemValue = $item )
56
    #end
57
    #set( $doubleItems = $stack.findValue($parameters.doubleList) )
58
    #set( $doubleItemCount = 0 )
59
    #if( $doubleItems )
60
        #foreach( $doubleItem in $doubleItems )
61
            $stack.push($doubleItem)
62
            #if( $parameters.doubleListKey )
63
                #set( $doubleItemKey = $stack.findValue($parameters.doubleListKey) )
64
            #else
65
                #set( $doubleItemKey = $doubleItem )
66
            #end
67
            #if( $parameters.doubleListValue )
68
                #set( $doubleItemValue  = $stack.findValue($parameters.doubleListValue) )
69
            #else
70
                #set( $doubleItemValue = $doubleItem )
71
            #end
72
            $!struts.htmlEncode($parameters.name)Group[$itemCount][$doubleItemCount] = new Option("$doubleItemKey", "$doubleItemValue");
73
            #set( $doubleItemCount = $doubleItemCount + 1 )
74
            #set ($trash = $stack.pop())
75
        #end
76
        #set( $itemCount = $itemCount + 1 )
77
    #end
78
    #set ($trash = $stack.pop())
79
#end
80
var $!struts.htmlEncode($parameters.name)Temp = document.$!struts.htmlEncode(${parameters.formName}).$!struts.htmlEncode(${parameters.doubleName});
81
#set( $itemCount = $startCount )
82
#set( $redirectTo = 0 )
83
#foreach( $item in $items )
84
    $stack.push($item)
85
    #if( $parameters.listValue )
86
        #set( $itemValue  = $stack.findValue($parameters.listValue) )
87
    #else
88
        #set( $itemValue = $item )
89
    #end
90
    #if( $tag.contains($parameters.nameValue, $itemKey) )
91
        #set( $redirectTo = $itemCount )
92
    #end
93
    #set( $itemCount = $itemCount + 1 )
94
    #set ($trash = $stack.pop())
95
#end
96
$!{struts.htmlEncode($parameters.name)}Redirect($redirectTo);
97
function $!{struts.htmlEncode($parameters.name)}Redirect(x) {
98
    for (m = $!{struts.htmlEncode($parameters.name)}Temp.options.length - 1; m >= 0; m--)
99
        $!{struts.htmlEncode($parameters.name)}Temp.options[m] = null;
100
 
101
    for (i = 0; i < $!{parameters.name}Group[x].length; i++) {
102
        $!{struts.htmlEncode($parameters.name)}Temp.options[i] = new Option($!{struts.htmlEncode($parameters.name)}Group[x][i].text, $!{struts.htmlEncode($parameters.name)}Group[x][i].value);
103
    }
104
 
105
    if ($!{parameters.name}Temp.options.length > 0)
106
        $!{struts.htmlEncode($parameters.name)}Temp.options[0].selected = true;
107
}
108
</script>