OSDN Git Service

Initial commit
[ultramonkey-l7/l7gui.git] / src / WebContent / logout.jsp
1 <%@ page import="org.ultramonkey.l7.model.*,
2                                  org.ultramonkey.l7.controller.*,
3                                  org.ultramonkey.l7.view.*, java.util.*"
4         language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"
5 %>
6 <%
7         /*
8          * check session
9          */
10         L7guiServletBase base = new L7guiServletBase();
11         if (session.isNew() || base.checkSession(session) == false) {
12                 MessageView error = new MessageView(41305, LogCategorySet.GUI_USER_AUTHENTICATION,
13                                 Message.INVALID_SESSSION);
14                 session.setAttribute(SessionKeys.RESULT_MESSAGE, error);
15                 response.sendRedirect(RedirectPages.LOGIN);
16                 return;
17         }
18
19         /*
20          * get cluster status and fix css seat
21          */
22         L7guiFramework framework = new L7guiFramework(); 
23         ClusterData cd = framework.getClusterData();
24         if (cd == null) {
25                 MessageView error = new MessageView(41306, LogCategorySet.GUI_IO_COMMAND,
26                                 Message.CLUSTER_DATA_ERROR);
27                 session.setAttribute(SessionKeys.RESULT_MESSAGE, error);
28                 response.sendRedirect(RedirectPages.LOGIN);
29                 return;
30         }       
31         
32         String cssSeat = "l7gui_single_style.css";
33         if ( cd.self_status == ClusterStatus.ACTIVE ){
34                 cssSeat = "l7gui_act_style.css";
35         }
36         else if ( cd.self_status == ClusterStatus.STANDBY ){
37                 cssSeat = "l7gui_sby_style.css";
38         }
39
40         /*
41          * in case : sessionTimeout == null(Adm Command Normal)
42          *  get save status & sync status
43          */      
44
45         /*
46          * Adm timeout status
47          */
48         Parameter param = Parameter.getInstance(); 
49         if (param == null){
50                 MessageView error = new MessageView(41307, LogCategorySet.GUI_START_STOP,
51                                 Message.UNEXPECTED_ERROR);
52                 session.setAttribute(SessionKeys.RESULT_MESSAGE, error);
53                 response.sendRedirect(RedirectPages.LOGIN);
54                 return;
55         }
56         String sessionTimeout = param.getValue(Parameter.L7VSADM_TIMEOUT_FLAG);
57
58         boolean saveState = false;
59         String logSaveState = (String)session.getAttribute(SessionKeys.LOG_SAVE_STATE);
60         String vsSaveState = (String)session.getAttribute(SessionKeys.VS_SAVE_STATE);
61         
62         int syncState = 0; 
63         String logSyncState = null;
64         String vsSyncState = null;
65         String monitorSyncState = null;
66         String repSyncState = null;
67         String snmpSyncState = null;
68         String guiSyncState = null;
69
70         String legendInfo = null;
71  
72         if ( sessionTimeout == null ) {
73                 /*
74                  * get save status
75                  */      
76         
77                 if ( (logSaveState == null) || (vsSaveState == null) ){
78                         MessageView error = new MessageView(41308, LogCategorySet.GUI_USER_AUTHENTICATION,
79                                         Message.UNEXPECTED_ERROR);
80                         session.setAttribute(SessionKeys.RESULT_MESSAGE, error);
81                         response.sendRedirect(RedirectPages.LOGIN);
82                         return;
83                 }
84                 
85                 if ((logSaveState.equals(SessionKeys.SAVE)) && (vsSaveState.equals(SessionKeys.SAVE))){
86                         saveState = true;
87                 }
88         
89                 
90                 /*
91                  * in case : ACT or SBY get sync status
92                  */
93                 if ( (cd.self_status == ClusterStatus.ACTIVE) || (cd.self_status == ClusterStatus.STANDBY) ){
94                         syncState = 1;
95                         logSyncState = (String)session.getAttribute(SessionKeys.LOG_SYNC_STATE);
96                         vsSyncState = (String)session.getAttribute(SessionKeys.VS_SYNC_STATE);
97                         monitorSyncState = (String)session.getAttribute(SessionKeys.MONITOR_SYNC_STATE);
98                         repSyncState = (String)session.getAttribute(SessionKeys.REP_SYNC_STATE);
99                         snmpSyncState = (String)session.getAttribute(SessionKeys.SNMP_SYNC_STATE);
100                         guiSyncState = (String)session.getAttribute(SessionKeys.GUI_SYNC_STATE);
101                 
102                         if ( (logSyncState == null) || (vsSyncState == null) 
103                                         || (monitorSyncState == null ) || (repSyncState == null ) 
104                                         || (snmpSyncState == null ) || (guiSyncState == null) ){
105                                 
106                                 MessageView error = new MessageView(41309, LogCategorySet.GUI_USER_AUTHENTICATION,
107                                                 Message.UNEXPECTED_ERROR);
108                                 session.setAttribute(SessionKeys.RESULT_MESSAGE, error);
109                                 response.sendRedirect(RedirectPages.LOGIN);
110                                 return;
111                         }
112                         
113                         if ( (logSyncState.equals(SessionKeys.SYNC)) && (vsSyncState.equals(SessionKeys.SYNC)) 
114                                         && (monitorSyncState.equals(SessionKeys.SYNC)) && (repSyncState.equals(SessionKeys.SYNC)) 
115                                         && (snmpSyncState.equals(SessionKeys.SYNC)) && (guiSyncState.equals(SessionKeys.SYNC)) ){
116         
117                                 syncState = 2;
118                         }
119                 }
120         
121
122                 if ( (cd.self_status == ClusterStatus.ACTIVE) || (cd.self_status == ClusterStatus.STANDBY) ){ 
123                         if ( saveState == true && syncState == 1 ){
124                                 legendInfo = "No Sync Info";
125                         }
126                         else if ( saveState == false && syncState == 1 ){
127                                 legendInfo = "No Sync & No Save Info";
128                         }
129                         else if ( saveState == false && syncState == 2 ){
130                                 legendInfo = "No Save Info";
131                         }
132                 }
133                 else {
134                         if (saveState == false ){
135                                 legendInfo = "No Save Info";
136                         }
137                 }
138         }
139 %>
140
141 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
142 <html>
143         <head>
144                 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
145                 <meta http-equiv="Pragma" content="no-cache">
146                 <meta http-equiv="Cache-Control" content="no-cache">
147                 <meta http-equiv="Expires" content="0">                                 
148                 <meta http-equiv="Content-Script-Type" content="text/javascript" />
149                 <meta http-equiv="Content-Style-Type" content="text/css" />
150                 <script src="l7gui.js" type="text/javascript"></script>
151                 <noscript> 
152                         <meta http-equiv="refresh" content="<%= RedirectPages.NOSCRIPT_TIME %>; url=<%= RedirectPages.LOGIN %>"/>
153                 </noscript> 
154                 <link rel="stylesheet" type="text/css" href="<%=cssSeat %>" />
155                 <link rel="shortcut icon" href="images/favicon.ico" />
156                 <title>Check Logout</title>
157         </head>
158
159         <body class="normal">
160         <jsp:include page="menu.jsp" flush="false"/>
161
162         <div id="content">
163
164                 <h1>Check Logout </h1>
165                 <form method="post" action="logout_success.jsp">
166                 <%
167                 if ( sessionTimeout == null ) {
168                         if ( legendInfo != null ){
169                 %>
170                                 <fieldset>
171                                 <legend><%=legendInfo %></legend>
172                                         <table class="status">
173                                         <% 
174                                         if ( saveState == false ){
175                                         %>
176                                         <tr>
177                                                 <th>
178                                                         <label for="noSaveCategory">No Save Category</label>
179                                                 </th>
180                                                 <td>
181                                                 <%
182                                                 if ( logSaveState.equals(SessionKeys.NO_SAVE) )
183                                                         out.println("<p class=\"text\"> Log </p>");
184                                                 if ( vsSaveState.equals(SessionKeys.NO_SAVE ) )
185                                                         out.println("<p class=\"text\"> Service </p>");
186                                                 %>
187                                                 </td>
188                                         </tr>
189                                         <%
190                                         }
191                                         %>
192                                         <% 
193                                         if ( syncState == 1){
194                                         %>
195                                         <tr>
196                                                 <th>
197                                                         <label for="noSyncCategory">No Sync Category</label>
198                                                 </th>
199                                                 <td>
200                                                 <%
201                                                 if ( logSyncState.equals(SessionKeys.NO_SYNC) )
202                                                         out.println("<p class=\"text\"> Log </p>");
203                                                 if ( monitorSyncState.equals(SessionKeys.NO_SYNC ) )
204                                                         out.println("<p class=\"text\"> Monitor </p>");
205                                                 if ( vsSyncState.equals(SessionKeys.NO_SYNC ) )
206                                                         out.println("<p class=\"text\"> Service </p>");
207                                                 if ( repSyncState.equals(SessionKeys.NO_SYNC ) )
208                                                         out.println("<p class=\"text\"> Replication </p>");
209                                                 if ( snmpSyncState.equals(SessionKeys.NO_SYNC ) )
210                                                         out.println("<p class=\"text\"> SNMPAgent </p>");
211                                                 if ( guiSyncState.equals(SessionKeys.NO_SYNC ) )
212                                                         out.println("<p class=\"text\"> GUI </p>");
213                                                 %>
214                                                 </td>
215                                         </tr>
216                                         <%
217                                         }
218                                         %>
219                                 </table>
220                                 </fieldset>
221                                 <%
222                                 }
223                 }
224                                 %>
225                                         
226                         <h2>Logout OK?</h2>
227                         <input type="submit" name="button" value="<%=ButtonMode.YES %>" onClick="return confirm(logout)" />
228                 </form>
229
230         </div>
231         </body>
232 </html>