Initial OpenECOMP policy/engine commit
[policy/engine.git] / ecomp-sdk-app / src / main / webapp / WEB-INF / fusion / raptor / wizard_sorting_edit.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 <%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataColumnType" %>
21 <%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %>
22 <%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportDefinition" %>
23 <%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %>
24 <%@ page import="org.openecomp.portalsdk.analytics.controller.WizardSequence" %>
25 <%@ page import="java.util.List" %>
26 <%@ page import="java.util.Iterator" %>
27 <%      
28     ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION);
29     WizardSequence ws = rdef.getWizardSequence();
30     String curSubStep = ws.getCurrentSubStep();
31         boolean isEdit = curSubStep.equals(AppConstants.WSS_EDIT);
32         DataColumnType currColumn = null;
33         if(isEdit)
34                 currColumn = rdef.getColumnById(AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID)); %>
35
36 <table width="100%" class="tableBorder" border="0" cellspacing="1" cellpadding="3" align=center>
37         <tr>
38                 <td class=rbg1 colspan=2 valign="Middle"><b class=rtableheader>Step <%= ws.getCurrentStepIndex() %> of <%= ws.getStepCount() %> - Report <%= ws.getCurrentStep() %><%= curSubStep.equals(AppConstants.WSS_EDIT)?"Edit Sorting":(curSubStep.equals(AppConstants.WSS_ADD)?"Add Sorting":"") %></b></td>
39         </tr>
40         <tr>
41                 <td class=rbg2 align="right" width="25%" height="30" style="background-image:url(<%= AppUtils.getImgFolderURL() %>required.gif); background-position:top right; background-repeat:no-repeat;">
42                         <font class=rtabletext>Sort By Column: </font>
43                 </td> 
44                 <td class=rbg3 align="left" width="50%"><font class=rtabletext>
45                 <% if(isEdit) { %>
46                         <%= currColumn.getDisplayName() %>
47                 <% } else { %>
48                         <select name="sortColId">
49                         <%      int iCount = 0;
50                                 List reportCols = rdef.getAllColumns();
51                                 for(Iterator iter=reportCols.iterator(); iter.hasNext(); ) { 
52                                         DataColumnType dct = (DataColumnType) iter.next();
53                                         if(dct.getOrderBySeq()<=0) { %>
54                                                 <option value="<%= dct.getColId() %>"<%= ((iCount++)==0)?" selected":"" %>><%= dct.getDisplayName() %>
55                         <%              }   // if
56                                 }   // for 
57                         %>
58                         </select>
59                 <% }    // else 
60                 %>
61                 </font></td>
62         </tr> 
63         <tr>
64                 <td class=rbg2 align="right" width="25%" height="30"><font class=rtabletext>Sort Type: </font></td> 
65                 <td class=rbg3 align="left" width="50%"><font class=rtabletext>
66                         <select name="sortAscDesc">
67                                 <option value="<%= AppConstants.SO_ASC %>" <%= (isEdit&&nvl(currColumn.getOrderByAscDesc(), AppConstants.SO_ASC).equals(AppConstants.SO_DESC))?"":" selected" %>>Ascending
68                                 <option value="<%= AppConstants.SO_DESC %>"<%= (isEdit&&nvl(currColumn.getOrderByAscDesc(), AppConstants.SO_ASC).equals(AppConstants.SO_DESC))?" selected":"" %>>Descending
69                         </select>
70                 </font></td>
71         </tr>
72 </table>
73 <br>
74
75 <script language="JavaScript">
76 <!--
77 function dataValidate() {
78         return true;
79 }   // dataValidate
80 //-->
81 </script>
82
83 <%!
84         private String nvl(String s)                  { return (s==null)?"":s; }
85         private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; } 
86 %>