Initial OpenECOMP policy/engine commit
[policy/engine.git] / ecomp-sdk-app / src / main / webapp / WEB-INF / fusion / raptor / custom_header_include.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.model.runtime.*" %>
21 <%@ page import="org.openecomp.portalsdk.analytics.system.*" %>
22 <%@ page import="org.openecomp.portalsdk.analytics.util.*" %>
23
24 <%@ page import="java.net.*" %>
25
26
27 <script src='dwr/engine.js'></script>
28 <script src='dwr/util.js'></script>
29 <script src='dwr/interface/fusionAjax.js'></script>
30
31 <%@ include file="/WEB-INF/fusion/jsp/include.jsp" %>
32
33 <%
34    String url = request.getParameter("returnUrl");
35
36    if (url != null) {
37      request.setAttribute("returnUrl", URLDecoder.decode(url, "UTF-8"));
38    }
39
40 %>
41
42 <BODY height="100%">
43 <form name="listForm" action="<%=request.getAttribute("returnUrl")%>" method="POST" target="_parent">
44   <input type="hidden" name="selected" value=""/>
45 </form>
46
47
48 <!-- Submit record action functionality -->
49 <script type="text/javascript">
50   function submitAction(actionUrl, task, actionUrlParameters) {
51
52    var formFieldParameters = "";          
53    var actionUrlHtml       = actionUrl;
54    
55    <!-- Keep track of form field params to ensure the refreshed list matches  -->
56    <c:if test="${(param['reset_action'] ne 'Y') && (param['reset_action'] ne 'y')}">
57      <c:forEach items="${param}" var="request_param">
58           <c:if test="${fn:startsWith(request_param.key,\"ff\")}">   
59             <c:if test="${!empty request_param.value}">
60               formFieldParameters += "&${request_param.key}=${v:decodeUrl(request_param.value)}";
61             </c:if>   
62           </c:if> 
63    </c:forEach>
64  </c:if>   
65
66    if (task != null) {
67      actionUrlHtml += "?task=" + task;
68    }         
69
70    if (actionUrlParameters != null) {
71     actionUrlHtml += "&" + actionUrlParameters; 
72    }         
73
74    
75    document.listForm.action = actionUrlHtml + formFieldParameters; 
76    document.listForm.submit();    
77   }
78 </script>
79   
80 <!-- Select Profile functionality -->
81 <script type="text/javascript">
82   function submitSelection() {
83     var selectedProfiles = document.listForm.selected;
84     var      allProfiles = document.formd.selected;
85     var          numRows = null;
86
87     if (allProfiles) {
88       numRows = allProfiles.length;
89
90       if (numRows) {
91         for (i=0; i < numRows; i++) {
92           if (allProfiles[i].checked) {
93             selectedProfiles.value += allProfiles[i].value + ",";
94           }
95         }
96
97         if (selectedProfiles.value != '') {
98           selectedProfiles.value = selectedProfiles.value.substring(0, selectedProfiles.value.length-1);
99         }
100       }
101       else {
102         if (allProfiles.checked) {
103           selectedProfiles.value += allProfiles.value;
104         }
105       }
106     }
107
108     //alert(selectedProfiles.value);
109     document.listForm.submit();
110   }
111 </script>
112
113
114 <!-- Profile Search activation/deactivation functionality -->
115 <script type="text/javascript">
116   function toggleUserActive(element, userId) {
117     var user_id = "'"+${user.id}+"'";
118         if(user_id.length == 0) user_id = 1;
119         else
120     fusionAjax.toggleUserActive(${user.id}, userId, toggleUserActiveCB);
121     return false;
122   }
123
124   function toggleUserActiveCB(data) {
125     var element = document.getElementById('user_active_' + data);
126     if(element.alt == "Activate") {
127       element.src = "static/fusion/images/active.gif";
128       element.alt = "Inactivate";
129     }
130     else {
131       element.src = "static/fusion/images/inactive.gif";
132       element.alt = "Activate";
133     }
134   }
135 </script>