Initial OpenECOMP policy/engine commit
[policy/engine.git] / ecomp-sdk-app / src / main / webapp / WEB-INF / fusion / raptor / report_wizard.jsp
1 <%--
2   ================================================================================
3   eCOMP Portal SDK
4   ================================================================================
5   Copyright (C) 2017 AT&T Intellectual Property
6   ================================================================================
7   Licensed under the Apache License, Version 2.0 (the "License");
8   you may not use this file except in compliance with the License.
9   You may obtain a copy of the License at
10   
11        http://www.apache.org/licenses/LICENSE-2.0
12   
13   Unless required by applicable law or agreed to in writing, software
14   distributed under the License is distributed on an "AS IS" BASIS,
15   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16   See the License for the specific language governing permissions and
17   limitations under the License.
18   ================================================================================
19   --%>
20 <%--
21  Name: report_wizard.jsp
22  Use : Master JSP which navigates to specific JSP when different tab is selected. Default it navigates to the wizard_definition.jsp 
23  
24  Change Log
25  ==========
26  
27  22-Jun-2009 : Version 8.4 (Sundar); 
28                                 
29                                 <UL> 
30                                 <LI> Save button is suppressed from showing when wizard is in the last page (Run page).</LI>
31                                 <LI> width of the content_iframe is changed back to default one when navigated from >100% report's run page.</LI>
32                                 </UL>
33 --%>
34 <%@ page import="java.util.*" %>
35 <%@ page import="org.openecomp.portalsdk.analytics.xmlobj.*" %>
36 <%@ page import="org.openecomp.portalsdk.analytics.model.*" %>
37 <%@ page import="org.openecomp.portalsdk.analytics.model.base.*" %>
38 <%@ page import="org.openecomp.portalsdk.analytics.model.definition.*" %>
39 <%@ page import="org.openecomp.portalsdk.analytics.model.runtime.*" %>
40 <%@ page import="org.openecomp.portalsdk.analytics.controller.*" %>
41 <%@ page import="org.openecomp.portalsdk.analytics.system.*" %>
42 <%@ page import="org.openecomp.portalsdk.analytics.util.*" %>
43
44 <%@ page errorPage="error_page.jsp" %>
45 <html>
46  <body>
47 <script language="Javascript" src="<%= AppUtils.getBaseFolderURL() %>js/form-field-tooltip.js"></script>
48 <script language="Javascript" src="<%= AppUtils.getBaseFolderURL() %>js/other_scripts.js"></script>
49 <style>
50 td, th {
51     padding: 0px;
52 }
53 </style>
54 <script>
55         <%
56                 String paramString = "";
57                 Enumeration en = request.getParameterNames();
58                 if (en != null) {
59                 while (en.hasMoreElements()) {
60                         String name = (String) en.nextElement();
61                         String values[] = request.getParameterValues(name);
62                         if (name.equals(AppConstants.RI_ACTION) == false 
63                                 && name.equals("c_master") == false && name.equals("action") == false
64                                 && values != null) {
65                                 for (int i = 0; i < values.length; i++) {
66                                         //values[i] = values[i].replaceAll("=", "%3d");
67                                         //values[i] = values[i].replaceAll("\\?", "%3f");
68                                         //values[i] = values[i].replaceAll("&", "%26"); 
69                                         //System.out.println(name + " (" + i + "): [" + values[i] + "]");
70                                         paramString = paramString + "&" + name + "=" + java.net.URLEncoder.encode(values[i],"UTF8");
71                                 }
72                         }
73                 }
74                 }
75
76         %>      
77         if (window.parent.document.getElementById('content_Iframe') || window.document.getElementById('content_Iframe')){
78         }else{
79                 //window.location="<%= AppUtils.getRaptorActionURL() %>report.create.container&c_master=<%=request.getParameter("c_master")%><%=paramString%>";
80         }
81 </script>
82 <%      ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
83         
84         String reportID   = rdef.getReportID();
85         WizardSequence ws = rdef.getWizardSequence();
86         
87         String curStep    = ws.getCurrentStep();
88         String curSubStep = ws.getCurrentSubStep();
89     
90         String dbInfo = null;
91         dbInfo = rdef.getDBInfo();
92         int sessionflag = 0;
93         if(dbInfo == null  || dbInfo.length() == 0) {
94            dbInfo = (String) session.getAttribute("remoteDB");
95        sessionflag = 1; 
96         }
97        session.setAttribute("remoteDB", dbInfo);
98         if((dbInfo == null) && (request.getParameter("dataSource")!=null)) 
99            session.setAttribute("remoteDB", request.getParameter("dataSource"));
100
101         String title = (reportID.equals("-1")?"Create Report":"Edit Report");
102         String navTitle = Globals.getBaseTitle()+" > " + title;
103         
104         boolean isCrossTab = rdef.getReportType().equals(AppConstants.RT_CROSSTAB);
105         boolean isSQLBased = rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED); 
106 %>
107 <!--  Set All variable to request, to enable included jsp to access it -->      
108 <%
109         request.setAttribute(AppConstants.SI_REPORT_DEFINITION,rdef);
110 %>      
111
112  <link rel="stylesheet" type="text/css" href="<%= AppUtils.getBaseFolderURL() %>css/raptor.css">
113  <link rel="stylesheet" type="text/css" href="<%= AppUtils.getBaseFolderURL() %>css/ral.css">
114  
115  
116 <script language="JavaScript" src="<%= AppUtils.getBaseFolderURL() %>js/raptor.js"></script>
117  
118 <jsp:include page="error_include.jsp" flush="true" />
119
120 <table width="100%" >
121 <tr><td id="folderTreeContainer" width="1%" height='300' valign='top' ><table>
122                 <!--<jsp:include page="tree/folderNav.jsp" flush="true" >       
123                 <jsp:param name="doCollapseTree" value="Y" />
124         </jsp:include>-->
125         </table>
126 </td>
127 <td id="searchContentContainer" valign='top' >
128 <div id="contentDiv" style="position:absoulte;overflow:auto;">
129 <jsp:include page="custom_js_include.jsp" flush="true" />
130 <form id="forma" name="forma" action="<%= AppUtils.getBaseURL() %>" method="post">
131         <input type="hidden" name="action" value="raptor">
132         <input type="hidden" name="<%= AppConstants.RI_ACTION %>" value="report.wizard">
133         <input type="hidden" name="<%= AppConstants.RI_REPORT_ID %>" value="<%= reportID %>">
134         <input type="hidden" name="<%= AppConstants.RI_DETAIL_ID %>" id="<%= AppConstants.RI_DETAIL_ID %>" value="<%= AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID) %>">
135         <input type="hidden" id="<%= AppConstants.RI_GO_TO_STEP %>" name="<%= AppConstants.RI_GO_TO_STEP %>" value="">
136         <input type="hidden" id="<%= AppConstants.RI_WIZARD_ACTION %>" name="<%= AppConstants.RI_WIZARD_ACTION %>" value="<%= AppConstants.WA_BACK %>">
137         <input type="hidden" name="<%= AppConstants.RI_JAVASCRIPT_ITEM_ID %>" value="">
138
139 <table width="94%" border="0" cellspacing="0" cellpadding="0" align=center>
140 <tr><td>
141         <table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin: 0px;">
142                 <tr>
143 <%              for(ws.resetNext(); ws.hasNext(); ) { 
144                         String sTab = ws.getNext(); %>
145                         <td width="9" align="right"><img border="0" src="<%= AppUtils.getImgFolderURL() %><%= sTab.equals(curStep)?"tab_left_sel.gif":"tab_left.gif" %>" width="9" height="24"></td>
146                         <td class=<%= sTab.equals(curStep)?"rbg1":"rbg1d" %> align="center" valign="middle">
147                         <%      if(sTab.equals(curStep)) { %>
148                                 &nbsp;<a href="javascript:document.forma.submit()" class=rtabselected onClick="document.getElementById('<%= AppConstants.RI_GO_TO_STEP %>').value='<%= sTab %>';"><%= clearSpaces(sTab) %></a>&nbsp;
149                         <%      } else if(reportID.equals("-1")) { %>   
150                                 &nbsp;<b class=rtabtext><%= clearSpaces(sTab) %></b>&nbsp;
151                         <%      } else { %>     
152                                 &nbsp;<a href="javascript:document.forma.submit()" class=rtabtext onClick="document.getElementById('<%= AppConstants.RI_GO_TO_STEP %>').value='<%= sTab %>';"><%= clearSpaces(sTab) %></a>&nbsp;
153                         <%      } %>
154                         </td>
155                         <td width="9" align="left"><img border="0" src="<%= AppUtils.getImgFolderURL() %><%= sTab.equals(curStep)?"tab_right_sel.gif":"tab_right.gif" %>" width="9" height="24"></td>
156 <%              }       // for 
157 %>
158                         <td width="80%">&nbsp;</td>
159                 </tr>
160         </table>
161 </td></tr><tr><td>
162         <table width="100%" border="0" cellspacing="0" cellpadding="3" style="margin: 0px;">
163                 <tr class=rbg1>
164                         <td valign="Middle"><b class=rtableheader><%= navTitle %></b></td>
165                 </tr>
166         </table>
167 </td></tr><tr><td><%    if(curStep.equals(AppConstants.WS_DEFINITION)) { %>
168         <% if(sessionflag == 1) dbInfo = ""; %>
169                    <jsp:include page="wizard_definition.jsp"/>
170 <%      } else if(curStep.equals(AppConstants.WS_SQL)) { %>
171                  <jsp:include page="wizard_sql_def.jsp"/>
172 <%      } else if(curStep.equals(AppConstants.WS_TABLES)&&curSubStep.equals("")) { %>
173                  <jsp:include page="wizard_tables_list.jsp"/>
174 <%      } else if(curStep.equals(AppConstants.WS_TABLES)&&(curSubStep.equals(AppConstants.WSS_ADD)||curSubStep.equals(AppConstants.WSS_EDIT))) { %>
175                  <jsp:include page="wizard_tables_edit.jsp"/>
176 <%      } else if(curStep.equals(AppConstants.WS_COLUMNS)&&curSubStep.equals("")) { %>
177                  <jsp:include page="wizard_columns_list.jsp"/>
178 <%      } else if(curStep.equals(AppConstants.WS_COLUMNS)&&curSubStep.equals(AppConstants.WSS_ADD_MULTI)) { %>
179                  <jsp:include page="wizard_columns_add_multi.jsp"/>
180 <%      } else if(curStep.equals(AppConstants.WS_COLUMNS)&&curSubStep.equals(AppConstants.WSS_ORDER_ALL)) { %>
181                  <jsp:include page="wizard_columns_order_all.jsp"/>
182 <%      } else if(curStep.equals(AppConstants.WS_COLUMNS)&&(curSubStep.equals(AppConstants.WSS_ADD)||curSubStep.equals(AppConstants.WSS_EDIT) ||curSubStep.equals(AppConstants.WA_MODIFY))) { %>
183                  <jsp:include page="wizard_columns_edit.jsp"/>
184 <%      } else if(curStep.equals(AppConstants.WS_FORM_FIELDS)&&curSubStep.equals("")||curSubStep.equals(AppConstants.WSS_ADD_BLANK)) { %>
185                  <jsp:include page="wizard_form_fields_list.jsp"/>
186 <%      } else if(curStep.equals(AppConstants.WS_FORM_FIELDS)&&(curSubStep.equals(AppConstants.WSS_ADD)||curSubStep.equals(AppConstants.WSS_EDIT))) { %>
187                  <jsp:include page="wizard_form_fields_edit.jsp"/>
188 <%      } else if(curStep.equals(AppConstants.WS_FILTERS)&&curSubStep.equals("")) { %>
189                 <jsp:include page="wizard_filters_list.jsp"/>
190 <%      } else if(curStep.equals(AppConstants.WS_FILTERS)&&(curSubStep.equals(AppConstants.WSS_ADD)||curSubStep.equals(AppConstants.WSS_EDIT))) { %>
191                   <jsp:include page="wizard_filters_edit.jsp"/>
192 <%      } else if(curStep.equals(AppConstants.WS_SORTING)&&curSubStep.equals("")) { %>
193                  <jsp:include page="wizard_sorting_list.jsp"/>
194 <%      } else if(curStep.equals(AppConstants.WS_SORTING)&&curSubStep.equals(AppConstants.WSS_ORDER_ALL)) { %>
195                 <jsp:include page="wizard_sorting_order_all.jsp"/>
196 <%      } else if(curStep.equals(AppConstants.WS_SORTING)&&(curSubStep.equals(AppConstants.WSS_ADD)||curSubStep.equals(AppConstants.WSS_EDIT))) { %>
197                  <jsp:include page="wizard_sorting_edit.jsp"/>
198 <%      } else if(curStep.equals(AppConstants.WS_JAVASCRIPT)) { %>
199                  <jsp:include page="wizard_javascript.jsp"/>             
200 <%      } else if(curStep.equals(AppConstants.WS_CHART)) { %>
201                  <jsp:include page="wizard_chart.jsp"/>
202 <%      } else if(curStep.equals(AppConstants.WS_USER_ACCESS)) { %>
203                  <jsp:include page="wizard_user_access.jsp"/>
204 <%      } else if(curStep.equals(AppConstants.WS_SCHEDULE)) { %>
205                  <jsp:include page="wizard_schedule.jsp"/>
206 <%      } else if(curStep.equals(AppConstants.WS_REPORT_LOG)) { %>
207                  <jsp:include page="wizard_log.jsp"/>
208 <%      } else if(curStep.equals(AppConstants.WS_MAP)) { %>
209                  <jsp:include page="wizard_map.jsp"/>
210 <%      } else if(curStep.equals(AppConstants.WS_DATA_FORECASTING)) { %>
211                  <jsp:include page="wizard_data_forecasting.jsp"/>
212 <%      } else { %>     
213                  <jsp:include page="wizard_run.jsp"/>
214 <%      } %>
215         
216 </td></tr><tr><td>
217         <table width="100%" border="0" cellspacing="1" cellpadding="3">
218                 <tr>
219                         <td width="10%" align="right">
220                                 &nbsp;
221                         </td>
222                         <td align=center>
223                                 <% if(! ws.isInitialStep()) { %>
224                                 <button type="submit" onClick="document.getElementById('<%= AppConstants.RI_WIZARD_ACTION %>').value='<%= AppConstants.WA_BACK %>';document.forma.submit();" att-button btn-type="primary" size="small" title='Back'>Back</button>
225                                 <% } %>
226                                 
227                                 <% if(! ws.isFinalStep()) { %>
228                                 <button type="submit" onClick="if(! dataValidate()) return false;  document.getElementById('<%= AppConstants.RI_WIZARD_ACTION %>').value='<%= AppConstants.WA_SAVE %>';document.forma.submit();" att-button btn-type="primary" size="small" title='Save'>Save</button>
229                                 <button type="submit" onClick="if(! dataValidate()) return false;  document.getElementById('<%= AppConstants.RI_WIZARD_ACTION %>').value='<%= AppConstants.WA_NEXT %>';document.forma.submit();" att-button btn-type="primary" size="small" title='Next'>Next</button>
230                                 <% } %>
231                         </td>
232                 </tr>
233         </table>        
234 </td></tr>
235 </table>        
236
237 </form>
238
239 <script type="text/javascript">
240   document.title += ' <%=title%>';
241 </script>
242
243  <jsp:include page="footer.jsp" flush="true" />
244
245 </div>
246 </td>
247 </tr>
248 </table>
249 <%--<jsp:include page="disclaimer.jsp" flush="true" />--%>
250 <script>
251         //document.getElementById('loadingMessageDiv').style.display='none';
252     //adding the bread crumb on the folder tree
253         if (window.parent && window.parent.addBreadCrumb)
254                 window.parent.addBreadCrumb(true, "000<%=rdef.getReportID()%>");
255         //displayTree("000<%=rdef.getReportID()%>");
256         <%
257                 String isTreeHidden = "true";
258                 if(request.getSession().getAttribute("isTreeHidden") != null && ((String)request.getSession().getAttribute("isTreeHidden")).equals("true")){
259                         isTreeHidden = "true";
260                 }else{
261                         isTreeHidden = "false";
262                 }
263         %>
264         //if ("<%=isTreeHidden%>" == "true"){
265         //      hideTree();
266         //}
267         //document.getElementById('contentDiv').style.height=document.body.offsetHeight - 210;
268         function resizeDivScrollbar(){
269                 var parentBody = window.parent.document.body;
270                 var parentMenu = window.parent.document.getElementById("application"); 
271                 var searchTD = document.getElementById("contentDiv"); 
272                 var contentIframe = window.parent.document.getElementById("content_Iframe");
273                 //parentBody.style.width = window.screen.size; 
274                 //searchTD.style.width  = parentBody.clientWidth - 200;
275                 //parentMenu.style.width = 1263;
276                 //javascript:resizeTo(screen.availWidth,screen.availHeight);
277                 if(parentMenu) parentMenu.style.width = screen.availWidth - 150;
278                 if(contentIframe) contentIframe.style.width = screen.availWidth - 30;
279         }
280         resizeDivScrollbar();
281 </script>
282 <%!     private String HTMLEncode(String value) {
283                 StringBuffer sb = new StringBuffer(value);
284                 
285                 for(int i=0; i<sb.length(); i++)
286                         if(sb.charAt(i)=='<')
287                                 sb.replace(i, i+1, "&lt;");
288                         else if(sb.charAt(i)=='>')
289                                 sb.replace(i, i+1, "&gt;");
290                         else if(sb.charAt(i)=='"')
291                                 sb.replace(i, i+1, "&quot;");
292                 
293                 return sb.toString();
294         }   // HTMLEncode
295         
296         private String clearSpaces(String value) {
297                 StringBuffer sb = new StringBuffer(value);
298                 
299                 for(int i=0; i<sb.length(); i++)
300                         if(sb.charAt(i)==' ')
301                                 sb.replace(i, i+1, "&nbsp;");
302                 
303                 return sb.toString();
304         }   // clearSpaces
305         
306         private String nvl(String s)                  { return (s==null)?"":s; }
307         private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; } %>
308
309