Salome HOME
Show URLs for previous versions of the document's files.
[tools/siman.git] / Workspace / Siman / WebContent / jsp / menuitem.jsp
1 <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
2     pageEncoding="ISO-8859-1"
3 %>
4 <%@ page import="java.util.Iterator"%>
5 <%@ page import="org.splat.wapp.Menu"%>
6 <%@ page import="org.splat.wapp.MenuItem"%>
7 <%@ page import="org.splat.simer.Action"%>
8 <%@page import="com.opensymphony.xwork2.ActionContext"%>
9 <%@ taglib prefix="s" uri="/struts-tags"%>
10
11 <s:set var="menuname" value="leftMenuSettings.menuName" />
12   <s:set var="namespace" value="leftMenuSettings.menuNamespace" />
13
14 <!-- Display of the menu tab
15   -->
16   <div id="tab-bar">
17     <span id="tab-front">&nbsp;&nbsp;<s:text name="title.%{#menuname}"/>&nbsp;&nbsp;</span>
18   </div>
19   
20
21 <!-- Display of menu items
22   -->
23   <div id=menuitem-box>
24 <%
25     Action anAction = (Action)ActionContext.getContext().getActionInvocation().getAction();
26         Menu menu = anAction.getLeftMenuSettings().getMenu();
27     boolean submenu = false;
28 %>
29 <s:if test="leftMenuSettings.menu != null">
30 <%    
31     for (Iterator<MenuItem> listem = menu.asList().iterator(); listem.hasNext(); ) {
32         MenuItem item  = listem.next();
33         String   arrow = "image.hold.gif";
34
35         if (item.isSubItem()) {
36         if (!submenu) {
37           submenu = true;
38 %>        <div id="article-separator"></div>
39 <%      }
40         } else {                
41         if (submenu) {
42           submenu = false;
43 %>        <div id="article-separator"></div>
44 <%      }
45         if (item.isGroup()) {
46           if (item.isOpen()) arrow = "image.downarrow.png";
47           else               arrow = "image.rightarrow.png";
48         }
49       }
50       String name = item.getLabel();
51       String icon = item.getIcon();
52 %>        <div id="article-item" onMouseOver="this.style.backgroundImage='url(<s:url value="/skin/image.highlighted.png"/>)'" onMouseOut="this.style.backgroundImage='url(<s:url value="/skin/image.white.png"/>)'">
53           <table width=100% border=0 cellspacing=0 cellpadding=0 class=menu>
54             <tr height=22 valign=middle>
55               <s:set var="menulabel"><%=name%></s:set>
56               <s:set var="menuicon">/skin/<%=icon%></s:set>
57               <s:set var="menuarrow">/skin/<%=arrow%></s:set>
58 <%    if (item.isSelected()) {
59           if (icon != null) {
60 %>          <td background="<s:url value="/skin/image.highlighted.png"/>" width=20 align=center><img src="<s:url value="%{#menuicon}"/>" border="none" /></td>
61 <%        }
62 %>          <td background="<s:url value="/skin/image.highlighted.png"/>">&nbsp;<s:text name="%{#menulabel}"/></td>
63             <td background="<s:url value="/skin/image.highlighted.png"/>" width=20 align=right><img src="<s:url value="%{#menuarrow}"/>" border="none" /></td>
64 <%    } else {
65         if (icon != null) {
66 %>          <td width=20 align=center><img src="<s:url value="%{#menuicon}"/>" border="none" /></td>
67 <%      }
68         String href = item.getAction();
69         if (href != null) {
70                 String[] link = href.split("\\x3F");   // '?' character
71 %>          <s:set var="menulink"><%=link[0]%></s:set>
72             <s:url id="item" namespace="%{#namespace}" action="%{#menulink}">
73 <%        if (link.length > 1) {
74                   link = link[1].split("\\x26");       // '&' character
75                   for (int i=0; i<link.length; i++) {
76                           String[] param = link[i].split("=");
77 %>            <s:set var="menuitemparameter"><%=param[0]%></s:set>
78               <s:set var="menuitemvalue"><%=param[1]%></s:set>
79               <s:param name="%{#menuitemparameter}" value="%{#menuitemvalue}"/>
80 <%          }
81           }
82 %>          </s:url>
83             <td>&nbsp;<s:a href="%{#item}" cssClass="item"><s:text name="%{#menulabel}"/></s:a></td>
84 <%      } else {
85 %>          <td>&nbsp;<font color=#A1A192><s:text name="%{#menulabel}"/></font></td>
86 <%      }
87 %>          <td width=20 align=right><img src="<s:url value="%{#menuarrow}"/>" border="none" /></td>
88 <%    }
89 %>
90             </tr>
91           </table>
92           </div>
93 <%  }
94 %>  
95 </s:if>
96   </div>