2 ================================================================================
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
11 http://www.apache.org/licenses/LICENSE-2.0
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 ================================================================================
20 <%@ page import="java.util.*" %>
22 <%@ page import="org.openecomp.portalsdk.analytics.xmlobj.*" %>
23 <%@ page import="org.openecomp.portalsdk.analytics.model.base.*" %>
24 <%@ page import="org.openecomp.portalsdk.analytics.model.definition.*" %>
25 <%@ page import="org.openecomp.portalsdk.analytics.system.*" %>
26 <%@ page import="org.openecomp.portalsdk.analytics.util.*" %>
28 <% ReportDefinition rdef = (ReportDefinition) request.getSession().getAttribute(AppConstants.SI_REPORT_DEFINITION);
30 String semaphoreId = AppUtils.getRequestNvlValue(request, "semaphoreId");
31 String semaphoreType = AppUtils.getRequestNvlValue(request, "semaphoreType");
32 SemaphoreType semaphore = rdef.getSemaphoreById(semaphoreId);
33 String semaphoreName = null;
34 List listColumns = rdef.getAllColumns();
36 semaphoreName = semaphore.getSemaphoreName();
38 if(rdef.getSemaphoreList()!=null)
39 semaphoreName = "Display Formatting "+(rdef.getSemaphoreList().getSemaphore().size()+1);
41 semaphoreName = "Display Formatting 1";
43 String submitBtn = AppUtils.getRequestNvlValue(request, "submit_btn"); %>
47 <title>Advanced Display Formatting</title>
48 <link rel="stylesheet" type="text/css" href="<%= AppUtils.getBaseFolderURL() %>css/raptor.css">
50 <% if(submitBtn.startsWith("Save")) { %>
51 <script language=JavaScript>
53 function updateOpenerList() { // Returns the position of the current semaphore in the list
54 return window.opener.updateSemaphoreList("<%= semaphoreId %>", "<%= semaphoreName %>");
57 function saveAndClose() {
59 idx = updateOpenerList();
60 window.opener.document.forma.semaphore.selectedIndex = idx;
61 window.opener.document.forma.semaphoreTypeHidden.value='<%=semaphoreType%>';
68 <% if(submitBtn.equals("Save")) { %>
70 <body onLoad="saveAndClose()">
71 <b class=rerrortext>Please wait...</b>
74 <script language=JavaScript>
76 function setBold(iCount) {
77 var flag = document.dataform.boldChk[iCount].checked;
78 document.dataform.bold[iCount].value = (flag?"Y":"N");
79 document.getElementById("preview"+iCount).style.fontWeight = (flag?"bold":"normal");
82 function setItalic(iCount) {
83 var flag = document.dataform.italicChk[iCount].checked;
84 document.dataform.italic[iCount].value = (flag?"Y":"N");
85 document.getElementById("preview"+iCount).style.fontStyle = (flag?"italic":"normal");
88 function setUnderline(iCount) {
89 var flag = document.dataform.underlineChk[iCount].checked;
90 document.dataform.underline[iCount].value = (flag?"Y":"N");
91 document.getElementById("preview"+iCount).style.textDecorationUnderline = flag;
94 function setBgColor(iCount) {
95 var value = document.dataform.bgColor[iCount].options[document.dataform.bgColor[iCount].selectedIndex].value;
96 document.getElementById("preview"+iCount).style.backgroundColor = value;
99 function setFontColor(iCount) {
100 var value = document.dataform.fontColor[iCount].options[document.dataform.fontColor[iCount].selectedIndex].value;
101 document.getElementById("preview"+iCount).style.color = value;
104 function setFontFace(iCount) {
105 var value = document.dataform.fontFace[iCount].options[document.dataform.fontFace[iCount].selectedIndex].value;
106 document.getElementById("preview"+iCount).style.fontFamily = value;
109 function setFontSize(iCount) {
110 var value = document.dataform.fontSize[iCount].options[document.dataform.fontSize[iCount].selectedIndex].value;
111 document.getElementById("preview"+iCount).style.fontSize = value+"px";
114 /* function setAlignment(iCount) {
115 var value = document.dataform.alignment[iCount].options[document.dataform.alignment[iCount].selectedIndex].value;
116 document.getElementById("preview"+iCount).style.textAlign = value;
119 var semaphoreIds = new Array(<%= 2+((rdef.getSemaphoreList()==null)?0:rdef.getSemaphoreList().getSemaphore().size()) %>);
120 var semaphoreNames = new Array(<%= 2+((rdef.getSemaphoreList()==null)?0:rdef.getSemaphoreList().getSemaphore().size()) %>);
122 if(rdef.getSemaphoreList()!=null)
123 for(Iterator iter=rdef.getSemaphoreList().getSemaphore().iterator(); iter.hasNext(); iCount++) {
124 SemaphoreType sem = (SemaphoreType) iter.next(); %>
125 semaphoreIds[<%= iCount %>] = "<%= sem.getSemaphoreId() %>";
126 semaphoreNames[<%= iCount %>] = "<%= sem.getSemaphoreName() %>";
129 semaphoreIds[<%= iCount %>] = "-";
130 semaphoreNames[<%= iCount++ %>] = "-";
131 semaphoreIds[<%= iCount %>] = "-";
132 semaphoreNames[<%= iCount++ %>] = "-";
134 function dataValidate() {
135 if(document.dataform.semaphoreName.value=="") {
136 alert("Please enter Display Name");
137 document.forma.semaphoreName.focus();
138 document.forma.semaphoreName.select();
143 for(var i=0; i<semaphoreIds.length; i++)
144 if((document.dataform.semaphoreName.value==semaphoreNames[i])&&(semaphoreIds[i]!="<%= semaphoreId %>")) {
145 alert("Advanced Formatting with that name already exists.\nPlease select another name");
146 document.dataform.semaphoreName.focus();
147 document.dataform.semaphoreName.select();
152 for(var i=0; i<document.dataform.lessThanValue.length; i++)
153 for(var j=i+1; j<document.dataform.lessThanValue.length; j++)
154 if( document.dataform.lessThanValue[i].value!=""&&
155 document.dataform.lessThanValue[j].value!=""&&
156 document.dataform.lessThanValue[i].value==document.dataform.lessThanValue[j].value) {
157 alert("You cannot have duplicate values in the list.\nPlease change one of the values ["+document.dataform.lessThanValue[j].value+"]");
158 document.dataform.lessThanValue[j].focus();
159 document.dataform.lessThanValue[j].select();
168 <% if(submitBtn.startsWith("Save")) { %>
172 <% for(int i = 0; i<3+((semaphore==null)?2:semaphore.getFormatList().getFormat().size()); i++) {
173 FormatType ft = null;
174 if(semaphore!=null&&i<semaphore.getFormatList().getFormat().size())
175 ft = (FormatType) semaphore.getFormatList().getFormat().get(i);
179 setUnderline(<%= i %>);
180 setBgColor(<%= i %>);
181 setFontColor(<%= i %>);
182 setFontFace(<%= i %>);
183 setFontSize(<%= i %>);
184 //setAlignment(<%= i %>);
193 <body onLoad="doInit()">
195 <form name="dataform" action="<%= AppUtils.getBaseURL() %>" method="post" onSubmit="return dataValidate()">
196 <input type="hidden" name="action" value="raptor">
197 <input type="hidden" name="<%= AppConstants.RI_ACTION %>" value="report.popup.semaphore.save">
199 <table class="mTAB" width=94% border=0 cellspacing=1 align=center>
201 <td valign="middle" colspan="10" height="24"><b class=rtableheader> Advanced Display Formatting Definition</b></td>
204 <td class=rbg2 colspan="4" align="right" height="30" style="background-image:url(<%= AppUtils.getImgFolderURL() %>required.gif); background-position:top right; background-repeat:no-repeat;"><font class=rtabletext>Display Name: </font></td>
205 <td class=rbg3 colspan="6" align="left"><font class=rtabletext>
206 <input type="hidden" name="semaphoreId" value="<%= semaphoreId %>">
207 <input type="text" size="30" maxlength="30" name="semaphoreName" value="<%= semaphoreName %>"></font></td>
210 <td class=rbg2 colspan="4" align="right" height="30"><font class=rtabletext>Apply Formatting To: </font></td>
211 <td class=rbg3 colspan="6" align="left"><font class=rtabletext>
212 <% String sValue = AppConstants.ST_CELL;
214 sValue = nvl(semaphore.getSemaphoreType(), AppConstants.ST_CELL); %>
215 <select name="semaphoreType">
217 for (Iterator iterC = listColumns.iterator(); iterC.hasNext();) {
218 DataColumnType dc = (DataColumnType) iterC.next();
221 <option value="<%= AppConstants.ST_CELL+"|"+dc.getColId() %>"<%= sValue.equals(AppConstants.ST_CELL+"|"+dc.getColId() )?" selected":"" %>><%=dc.getColName() %>
226 <option value="<%= AppConstants.ST_CELL %>"<%= sValue.equals(AppConstants.ST_CELL)?" selected":"" %>>Current Value Only
227 <option value="<%= AppConstants.ST_ROW %>"<%= sValue.equals(AppConstants.ST_ROW) ?" selected":"" %>>The Entire Row
228 </select></font></td>
231 <td colspan="10"> </td>
234 <td align="center" valign="middle" colspan=2 height="30"><b class=rtableheader>Column Value Is</b></td>
235 <td align="center" valign="middle"><b class=rtableheader>Bold?</b></td>
236 <td align="center" valign="middle"><b class=rtableheader>Italic?</b></td>
237 <td align="center" valign="middle"><b class=rtableheader>Under-<br>line?</b></td>
238 <td align="center" valign="middle"><b class=rtableheader>Background Color</b></td>
239 <td align="center" valign="middle"><b class=rtableheader>Font Color</b></td>
240 <td align="center" valign="middle"><b class=rtableheader>Font Face</b></td>
241 <td align="center" valign="middle"><b class=rtableheader>Font Size</b></td>
242 <!--td align="center" valign="middle"><b class=rtableheader>Alignment</b></td-->
243 <td align="center" valign="middle"><b class=rtableheader> Preview </b></td>
245 <% for(int i = 0; i<3+((semaphore==null)?2:semaphore.getFormatList().getFormat().size()); i++) {
246 FormatType ft = null;
247 if(semaphore!=null&&i<semaphore.getFormatList().getFormat().size())
248 ft = (FormatType) semaphore.getFormatList().getFormat().get(i); %>
249 <tr<%= (i%2==0)?" class=rowalt1":" class=rowalt2" %>>
251 <td align="center" valign="middle" colspan=2 height="30">
252 <font class=rtabletext>Any Other</font>
253 <input type="hidden" name="formatId" value="<%= (ft==null)?"":ft.getFormatId() %>">
254 <input type="hidden" name="expression" value="">
255 <input type="hidden" name="lessThanValue" value="">
256 <!-- <input type="hidden" name="anyFmt" value="Y"> -->
259 <!-- <input type="hidden" name="anyFmt" value="N"> -->
260 <td align="center" valign="middle" height="30">
261 <input type="hidden" name="formatId" value="<%= (ft==null)?"":ft.getFormatId() %>">
264 sValue = nvl(ft.getExpression(), "="); %>
265 <select name="expression">
266 <option value="="<%= sValue.equals("=") ?" selected":"" %>>=
267 <option value="<>"<%= sValue.equals("<>")?" selected":"" %>><>
268 <option value=">"<%= sValue.equals(">") ?" selected":"" %>>>
269 <option value=">="<%= sValue.equals(">=")?" selected":"" %>>>=
270 <option value="<"<%= sValue.equals("<") ?" selected":"" %>><
271 <option value="<="<%= sValue.equals("<=")?" selected":"" %>><=
274 <td align="center" valign="middle">
275 <input type="text" size="10" name="lessThanValue" value="<%= (ft==null)?"":ft.getLessThanValue() %>">
278 <td align="center" valign="middle">
279 <% boolean bValue = false;
281 bValue = ft.isBold(); %>
282 <input type="hidden" name="bold" value="<%= bValue?"Y":"N" %>">
283 <input type="checkbox" name="boldChk" value="Y"<%= bValue?" checked":"" %> onClick="setBold(<%= i %>)">
285 <td align="center" valign="middle">
288 bValue = ft.isItalic(); %>
289 <input type="hidden" name="italic" value="<%= bValue?"Y":"N" %>">
290 <input type="checkbox" name="italicChk" value="Y"<%= bValue?" checked":"" %> onClick="setItalic(<%= i %>)">
292 <td align="center" valign="middle">
295 bValue = ft.isUnderline(); %>
296 <input type="hidden" name="underline" value="<%= bValue?"Y":"N" %>">
297 <input type="checkbox" name="underlineChk" value="Y"<%= bValue?" checked":"" %> onClick="setUnderline(<%= i %>)">
299 <td align="center" valign="middle">
302 sValue = nvl(ft.getBgColor()); %>
303 <select name="bgColor" onChange="setBgColor(<%= i %>)">
304 <option value=""<%= sValue.equals("") ?" selected":"" %>>
305 <option value="#00FFFF"<%= sValue.equals("#00FFFF")?" selected":"" %>>Aqua
306 <option value="#000000"<%= sValue.equals("#000000")?" selected":"" %>>Black
307 <option value="#0000FF"<%= sValue.equals("#0000FF")?" selected":"" %>>Blue
308 <option value="#FF00FF"<%= sValue.equals("#FF00FF")?" selected":"" %>>Fuchsia
309 <option value="#808080"<%= sValue.equals("#808080")?" selected":"" %>>Gray
310 <option value="#008000"<%= sValue.equals("#008000")?" selected":"" %>>Green
311 <option value="#00FF00"<%= sValue.equals("#00FF00")?" selected":"" %>>Lime
312 <option value="#800000"<%= sValue.equals("#800000")?" selected":"" %>>Maroon
313 <option value="#000080"<%= sValue.equals("#000080")?" selected":"" %>>Navy
314 <option value="#808000"<%= sValue.equals("#808000")?" selected":"" %>>Olive
315 <option value="#FF9900"<%= sValue.equals("#FF9900")?" selected":"" %>>Orange
316 <option value="#800080"<%= sValue.equals("#800080")?" selected":"" %>>Purple
317 <option value="#FF0000"<%= sValue.equals("#FF0000")?" selected":"" %>>Red
318 <option value="#C0C0C0"<%= sValue.equals("#C0C0C0")?" selected":"" %>>Silver
319 <option value="#008080"<%= sValue.equals("#008080")?" selected":"" %>>Teal
320 <option value="#FFFFFF"<%= sValue.equals("#FFFFFF")?" selected":"" %>>White
321 <option value="#FFFF00"<%= sValue.equals("#FFFF00")?" selected":"" %>>Yellow
324 <td align="center" valign="middle">
327 sValue = nvl(ft.getFontColor()); %>
328 <select name="fontColor" onChange="setFontColor(<%= i %>)">
329 <option value=""<%= sValue.equals("") ?" selected":"" %>>
330 <option value="#00FFFF"<%= sValue.equals("#00FFFF")?" selected":"" %>>Aqua
331 <option value="#000000"<%= sValue.equals("#000000")?" selected":"" %>>Black
332 <option value="#0000FF"<%= sValue.equals("#0000FF")?" selected":"" %>>Blue
333 <option value="#FF00FF"<%= sValue.equals("#FF00FF")?" selected":"" %>>Fuchsia
334 <option value="#808080"<%= sValue.equals("#808080")?" selected":"" %>>Gray
335 <option value="#008000"<%= sValue.equals("#008000")?" selected":"" %>>Green
336 <option value="#00FF00"<%= sValue.equals("#00FF00")?" selected":"" %>>Lime
337 <option value="#800000"<%= sValue.equals("#800000")?" selected":"" %>>Maroon
338 <option value="#000080"<%= sValue.equals("#000080")?" selected":"" %>>Navy
339 <option value="#808000"<%= sValue.equals("#808000")?" selected":"" %>>Olive
340 <option value="#FF9900"<%= sValue.equals("#FF9900")?" selected":"" %>>Orange
341 <option value="#800080"<%= sValue.equals("#800080")?" selected":"" %>>Purple
342 <option value="#FF0000"<%= sValue.equals("#FF0000")?" selected":"" %>>Red
343 <option value="#C0C0C0"<%= sValue.equals("#C0C0C0")?" selected":"" %>>Silver
344 <option value="#008080"<%= sValue.equals("#008080")?" selected":"" %>>Teal
345 <option value="#FFFFFF"<%= sValue.equals("#FFFFFF")?" selected":"" %>>White
346 <option value="#FFFF00"<%= sValue.equals("#FFFF00")?" selected":"" %>>Yellow
349 <td align="center" valign="middle">
352 sValue = nvl(ft.getFontFace()); %>
353 <select name="fontFace" onChange="setFontFace(<%= i %>)">
354 <option value=""<%= sValue.equals("") ?" selected":"" %>>--- Default ---
355 <option value="Arial,Helvetica,sans-serif"<%= sValue.equals("Arial,Helvetica,sans-serif") ?" selected":"" %>>Arial
356 <option value="Courier New,Courier,mono"<%= sValue.equals("Courier New,Courier,mono") ?" selected":"" %>>Courier New
357 <option value="Geneva,Arial,Helvetica,sans-serif"<%= sValue.equals("Geneva,Arial,Helvetica,sans-serif") ?" selected":"" %>>Geneva
358 <option value="Georgia,Times New Roman,Times,serif"<%= sValue.equals("Georgia,Times New Roman,Times,serif")?" selected":"" %>>Georgia
359 <option value="Times New Roman,Times,serif"<%= sValue.equals("Times New Roman,Times,serif") ?" selected":"" %>>Times New Roman
360 <option value="Verdana,Arial,Helvetica,sans-serif"<%= sValue.equals("Verdana,Arial,Helvetica,sans-serif") ?" selected":"" %>>Verdana
363 <td align="center" valign="middle">
366 sValue = nvl(ft.getFontSize(), "11"); %>
367 <select name="fontSize" onChange="setFontSize(<%= i %>)">
368 <option value="6"<%= sValue.equals("6") ?" selected":"" %>>6
369 <option value="8"<%= sValue.equals("8") ?" selected":"" %>>8
370 <option value="9"<%= sValue.equals("9") ?" selected":"" %>>9
371 <option value="10"<%= sValue.equals("10")?" selected":"" %>>10
372 <option value="11"<%= sValue.equals("11")?" selected":"" %>>11
373 <option value="12"<%= sValue.equals("12")?" selected":"" %>>12
374 <option value="14"<%= sValue.equals("14")?" selected":"" %>>14
375 <option value="16"<%= sValue.equals("16")?" selected":"" %>>16
376 <option value="18"<%= sValue.equals("18")?" selected":"" %>>18
377 <option value="24"<%= sValue.equals("24")?" selected":"" %>>24
378 <option value="36"<%= sValue.equals("36")?" selected":"" %>>36
379 <option value="48"<%= sValue.equals("48")?" selected":"" %>>48
380 <option value="72"<%= sValue.equals("72")?" selected":"" %>>72
383 <!--td align="center" valign="middle">
386 sValue = nvl(ft.getAlignment(), "left"); % >
387 <select name="alignment" onChange="setAlignment(< %= i % >)">
388 <option value="left" < %= sValue.equals("left") ?" selected":"" % >>Left
389 <option value="center"< %= sValue.equals("center")?" selected":"" % >>Center
390 <option value="right" < %= sValue.equals("right") ?" selected":"" % >>Right
394 <span id="preview<%= i %>" style="font-family:Arial,Helvetica,sans-serif;font-size:11px;color:#000000;width:100">Sample</span>
400 <td colspan="10" align="center">
402 <input type="Submit" class=button name="submit_btn" value="Save">
403 <input type="Submit" class=button name="submit_btn" value="Save & More Rows">
404 <input type="Button" class=button value="Cancel" onClick="window.close();">
411 <% } // if(submitBtn.equals("Save")) { ... } else {
417 <%! private String nvl(String s) { return (s==null)?"":s; }
418 private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; } %>