1 ## displayMenu is defined in WEB-INF/classes/globalMacros.vm
2 #macro(digui)
3 #set ($s_parent = $s_owner.parent)
4 #set( $count = $s_parent.components.size() - 1)
5 #if($s_parent.components.get($count) == $s_owner)
6 </ul></li>
7 #set ($s_owner = $s_owner.parent)
8 #digui()
9 #end
10 #end
11
12 #macro( menuItem $menu $level )
13 ## set title
14 #set ($title = $displayer.getMessage($menu.title))
15 #if ($level == 0)
16 <li> <a href="javascript:void(0)">${title}</a>
17 <ul>
18 #else
19 <li>
20 #if ($menu.components.size() > 0)
21 #set ($numItems = $menu.components.size())
22 <a #if($menu.action)href="$!menu.action"#end #if($menu.jsFunctionName)onclick="$!menu.jsFunctionName" href="javascript:void(0)"#end target="#if($menu.target)$!menu.target#end">${title}</a>
23 <ul>
24 #else
25 <a #if($menu.define.checkbox) tname="hi_checkbox_common" tvalue="$!menu.checkbox"#end" #if($menu.action)href="$!menu.action"#end #if($menu.jsFunctionName)onclick="$!menu.jsFunctionName" href="javascript:void(0)"#end target="#if($menu.target)$!menu.target#end">${title}</a>
26 #end
27 #if($menu.components.size() == 0)
28 </li>
29 #end
30 #if ($level != 0 && $velocityCount == $menu.parent.components.size() && $menu.components.size() == 0)
31 #set ($s_owner = $menu)
32 #digui()
33 #end
34 #end
35 #end
36
37 <script type="text/javascript">
38 ${menu.define.javascript}
39 #if($menu.define.checkbox)
40 function selectedcb(button){
41 var checkeds = jQuery(button).parent().find(".tree :checkbox").filter(":checked").filter("[name]");
42 var ids = new Array();
43 var texts = new Array();
44 checkeds.each(function(i){
45 var input = jQuery(this);
46 ids[i] = input.val();
47 texts[i] = input.attr("text");
48 });
49 var result = new Array();
50 if(ids.length == 0)
51 return result;
52 result[0] = ids;result[1] = texts;
53 return result;
54 }
55 #end
56 </script>
57
58 <div style=" float:left; display:block; margin:10px; overflow:auto; width:200px; height:300px; border:solid 1px #CCC; line-height:21px; background:#FFF;">
59 <ul class="tree treeFolder collapse#if($menu.define.checkbox) treeCheck#end">
60 #displayMenu($menu 0)
61 </ul>
62 #if($menu.define.checkbox)
63 <input type='button' name='button1' value='带回' onclick='bringBackCheckBox(selectedcb(this))'/ >
64 #end
65 </div>
66
67
68