Initial OpenECOMP policy/engine commit
[policy/engine.git] / ecomp-sdk-app / src / main / webapp / WEB-INF / fusion / raptor / wizard_columns_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="java.util.Map"%>
21 <%@page import="java.util.HashMap"%>
22 <%@page import="org.openecomp.portalsdk.analytics.model.ReportLoader"%>
23 <%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataColumnType" %>
24 <%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %>
25 <%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportDefinition" %>
26 <%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %>
27 <%@ page import="org.openecomp.portalsdk.analytics.controller.WizardSequence" %>
28 <%@ page import="java.util.Vector" %>
29 <%@ page import="java.util.List" %>
30 <%@ page import="org.openecomp.portalsdk.analytics.model.DataCache" %>
31 <%@ page import="java.util.Iterator" %>
32 <%@ page import="org.openecomp.portalsdk.analytics.xmlobj.DataSourceType" %>
33 <%@ page import="org.openecomp.portalsdk.analytics.model.definition.DBColumnInfo" %>
34 <%@ page import="org.openecomp.portalsdk.analytics.model.definition.TableSource" %>
35 <%@ page import="org.openecomp.portalsdk.analytics.model.base.IdNameValue" %>
36 <%@ page import="org.openecomp.portalsdk.analytics.xmlobj.SemaphoreType" %>
37 <%@ page import="org.openecomp.portalsdk.analytics.xmlobj.FormFieldType" %>
38 <%      
39     ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION);
40     WizardSequence ws = rdef.getWizardSequence();
41     String curSubStep = ws.getCurrentSubStep();
42         boolean isCrossTab = rdef.getReportType().equals(AppConstants.RT_CROSSTAB);
43         boolean isSQLBased = rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED);    
44         String dbInfo = null;
45         dbInfo = rdef.getDBInfo();      
46     boolean isEdit = curSubStep.equals(AppConstants.WSS_EDIT) || curSubStep.equals(AppConstants.WA_MODIFY);
47         DataColumnType currColumn = null;
48         if(isEdit)
49                 currColumn = rdef.getColumnById(AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID));
50         Vector reportTableSources = DataCache.getReportTableSources((String) session.getAttribute("remoteDB"));
51
52     List reportCols = rdef.getAllColumns();
53     
54     HashMap actionImgMap = ReportLoader.loadActionImgLookUp();
55
56         String[] numberFormats = { "9999999990", "9,999,999,990", "9999999990.99", "9,999,999,990.99", "$9,999,999,990.99", "$9,999,999,990.999" };
57         String[] dateFormats   = { "MM/DD/YYYY", "MM/YYYY", "DD-MON-YYYY", "Month DD, YYYY", "Month, YYYY", "MM/DD/YYYY HH24:MI:SS", "YYYY" };
58         String[] charFormats   = { "N/A" }; 
59         
60         String dispName  = "";
61         String dbColType = "";
62         String colType   = "";
63         if(isEdit) { 
64                 dbColType = currColumn.getDbColType();
65                 colType   = currColumn.getColType();
66         } 
67
68     String dependsOnFormField = currColumn.getDependsOnFormField();
69     %>
70 <script language="JavaScript" src="<%= AppUtils.getBaseFolderURL() %>js/editabledropdown.js"></script>    
71 <script language="JavaScript">
72 <!--
73 var tableDrillDownCount = 0;
74
75 function verifyCrossTabDrillDown() {
76 <%      if(isCrossTab) { %>
77         if(     (document.forma.crossTabValue.options[document.forma.crossTabValue.selectedIndex].value!="<%= AppConstants.CV_VALUE %>")
78                 &&(document.forma.drillDownCtl.selectedIndex!=0)) {
79                         alert("You cannot assign drill-down to this column unless the Column Usage in Cross-Tab is Report values.");
80                         document.forma.drillDownURL.value         = "";
81                         document.forma.drillDownParams.value      = "";
82                         document.forma.drillDownSuppress.value    = "";
83                         document.forma.drillDownRequest.value    = "";
84                         document.forma.drillDownCtl.selectedIndex = 0;
85                         return false;
86                 }
87 <%      } %>
88         return true;
89 }       // verifyCrossTabDrillDown
90
91 function showDrillDownPopup(resetParams) {
92         if(! verifyCrossTabDrillDown())
93                 return;
94         
95         if(resetParams) {
96                 document.forma.drillDownParams.value   = "";
97                 document.forma.drillDownSuppress.value = "";
98                 document.forma.drillDownRequest.value = "";
99         }
100         
101         if(document.forma.drillDownCtl.selectedIndex==0) {
102                 document.forma.drillDownURL.value = "";
103                 return;
104         }
105         
106         var ddValue = "";
107         ddValue = document.forma.drillDownCtl.options[document.forma.drillDownCtl.selectedIndex].value;
108         
109         var url = "";
110         if(document.forma.drillDownCtl.selectedIndex<=tableDrillDownCount) {
111                 document.forma.drillDownURL.value = ddValue;
112                 url = "<%= AppUtils.getRaptorActionURL() %>report.popup.drilldown.table&<%= AppConstants.RI_VIEW_ACTION %>="+ddValue;
113         } else {
114                 document.forma.drillDownURL.value = ddValue;
115                 url = "<%= AppUtils.getRaptorActionURL() %>report.popup.drilldown.report&<%= AppConstants.RI_REPORT_ID %>="+ddValue+"&drillDownParams="+escape(document.forma.drillDownParams.value)+"&drillDownSuppress="+escape(document.forma.drillDownSuppress.value)+"&drillDownRequest="+escape(document.forma.drillDownRequest.value);
116         }
117         var w = window.open(url, "drillDownPopup", "width=450,height=330,location=no,menubar=no,toolbar=no,status=no,resizable=yes,scrollbars=yes");
118         w.focus();
119         w.opener = this;
120 }   // showArgPopup
121
122 function setDrillDownValuesSuppress(newParams, newSuppress) {
123         document.forma.drillDownParams.value   = newParams;
124         document.forma.drillDownSuppress.value = newSuppress;
125 }   // setDrillDownValuesSuppress
126
127 function setDrillDownValues(newParams) {
128         setDrillDownValuesSuppress(newParams, "")
129 }   // setDrillDownValues
130
131 function setTotalDropDownValues(canHaveTotal) {
132 <% if(! isSQLBased) { %>
133         if(canHaveTotal) {
134                 if(document.forma.displayTotal.options.length>1)
135                         return;
136         } else {
137                 if(document.forma.displayTotal.options.length==1)
138                         return;
139         }
140         
141         document.forma.displayTotal.options.length = 0;
142         document.forma.displayTotal.options[0] = new Option("--- Do Not Display (Faster Report Execution) ---", "");
143 <%      if(isCrossTab) { %>
144         document.forma.displayTotalPerRow.options.length = 0;
145         document.forma.displayTotalPerRow.options[0] = new Option("--- Do Not Display (Faster Report Execution) ---", "");
146 <%  } %>
147         
148         if(canHaveTotal) {
149                 <% for(int i=0; i<AppConstants.TOTAL_FUNCTIONS.getCount(); i++) { 
150                                 IdNameValue tValue = AppConstants.TOTAL_FUNCTIONS.getValue(i); %>
151                         document.forma.displayTotal.options[<%= (i+1) %>] = new Option("<%= tValue.getName() %>", "<%= tValue.getId() %>");
152                         <%      if(isCrossTab) { %>
153                         document.forma.displayTotalPerRow.options[<%= (i+1) %>] = new Option("<%= tValue.getName() %>", "<%= tValue.getId() %>");
154                         <%  } %>
155                 <%  }   // for 
156                 %>
157         } // if
158     
159         document.forma.displayTotal.selectedIndex = 0;
160 <%      if(isCrossTab) { %>
161         document.forma.displayTotalPerRow.selectedIndex = 0;
162         if(document.layers)
163                 history.go(0);
164 <%  } %>
165 <% } // if(! isSQLBased) 
166 %>
167 }   // setTotalDropDownValues
168
169 <% if(! isSQLBased) { %>
170 <%--
171 function showFormatPopup() {
172         if((document.forma.colType.value!="< %= AppConstants.CT_NUMBER % >")&&(document.forma.colType.value!="< %= AppConstants.CT_DATE % >")) {
173                 alert("Display Format is not applicable to this column");
174                 return;
175         }
176         
177         var w = window.open("", "formatHint", "width=200,height=300,location=no,menubar=no,toolbar=no,status=no,resizable=yes,scrollbars=yes");
178         w.focus();
179         w.opener = this;
180         w.document.writeln("<html><head>");
181         w.document.writeln("<title>Display Formats</title>");
182         //w.document.writeln("<link rel=stylesheet type=text/css href='< %= AppUtils.getBaseFolderURL() % >css/raptor.css'>");
183         w.document.writeln("<script language=JavaScript>");
184         w.document.writeln("function setValue(newValue) {");
185         w.document.writeln("    window.opener.document.forma.displayFormat.value=newValue;");
186         w.document.writeln("    window.close();");
187         w.document.writeln("}   // setValue");
188         w.document.writeln("</"+"script>");
189         w.document.writeln("</head><body>");
190         if(document.forma.colType.value=="< %= AppConstants.CT_NUMBER % >") {
191                 w.document.writeln("<font face='Arial, Helvetica, sans-serif' size=2><b>Number formats:</b></font><ul>");
192                 w.document.writeln("<li><font face='Arial, Helvetica, sans-serif' size=2><b><a href=\"javascript:setValue('9999999990.99')\">9999999990.99</a></b></font></li>");
193                 w.document.writeln("<li><font face='Arial, Helvetica, sans-serif' size=2><b><a href=\"javascript:setValue('9,999,999,990.99')\">9,999,999,990.99</a></b></font></li>");
194                 w.document.writeln("<li><font face='Arial, Helvetica, sans-serif' size=2><b><a href=\"javascript:setValue('$9,999,999,990.99')\">$9,999,999,990.99</a></b></font></li>");
195                 w.document.writeln("</ul>");
196         } else if(document.forma.colType.value=="< %= AppConstants.CT_DATE % >") {
197                 w.document.writeln("<font face='Arial, Helvetica, sans-serif' size=2><b>Date formats:</b></font><ul>");
198                 w.document.writeln("<li><font face='Arial, Helvetica, sans-serif' size=2><b><a href=\"javascript:setValue('MM/DD/YYYY')\">MM/DD/YYYY</a></b></font></li>");
199                 w.document.writeln("<li><font face='Arial, Helvetica, sans-serif' size=2><b><a href=\"javascript:setValue('MM/YYYY')\">MM/YYYY</a></b></font></li>");
200                 w.document.writeln("<li><font face='Arial, Helvetica, sans-serif' size=2><b><a href=\"javascript:setValue('DD-MON-YYYY')\">DD-MON-YYYY</a></b></font></li>");
201                 w.document.writeln("<li><font face='Arial, Helvetica, sans-serif' size=2><b><a href=\"javascript:setValue('MONTH DD, YYYY')\">MONTH DD, YYYY</a></b></font></li>");
202                 w.document.writeln("</ul>");
203         }
204         w.document.writeln("</body></html>");
205         w.document.close();
206 }   // showFormatPopup
207 --%>
208
209 function showFormFieldPopup() {
210         var w = window.open("", "fieldPopup", "width=400,height=400,location=no,menubar=no,toolbar=no,status=no,resizable=yes,scrollbars=yes");
211         w.focus();
212         w.opener = this;
213         
214         w.document.writeln("<html><head>");
215         w.document.writeln("<title>Form Fields</title>");
216         w.document.writeln("<link rel=stylesheet type=text/css href='<%= AppUtils.getBaseFolderURL() %>css/raptor.css'>");
217         w.document.writeln("<script language=JavaScript>");
218         w.document.writeln("function setValue(newValue) {");
219         w.document.writeln("    window.opener.document.forma.exprFormula.selectedIndex = 12;");
220         w.document.writeln("    window.opener.exprFormulaChange(true);");
221         w.document.writeln("    window.opener.document.forma.exprText.value += newValue;");
222         w.document.writeln("    window.close();");
223         w.document.writeln("}   // setValue");
224         w.document.writeln("</"+"script>");
225         w.document.writeln("</head><body>");
226         
227         w.document.writeln("<table width=94% border=0 cellspacing=1 align=center>");
228         w.document.writeln("    <tr class=rbg1>");
229         w.document.writeln("            <td height=30>&nbsp;</td>");
230         w.document.writeln("            <td><b class=rtableheader>Report Form Fields</b></td>");
231         w.document.writeln("    </tr>");
232 <%      int iCnt = 0;
233         if(rdef.getFormFieldList()!=null)
234                 for(Iterator iter=rdef.getFormFieldList().getFormField().iterator(); iter.hasNext(); iCnt++) { 
235                         FormFieldType fft = (FormFieldType) iter.next(); %>
236         w.document.writeln("    <tr<%= (iCnt%2==0)?" class=rbg8":"" %>>");
237         w.document.writeln("            <td align=center valign=middle height=30><font class=rtabletext><%= (iCnt+1) %></font></td>");
238         w.document.writeln("            <td valign=middle>");
239         w.document.writeln("                    <b class=rtabletext><a href=\"javascript:setValue('[<%= fft.getFieldName() %>]')\"><%= fft.getFieldName() %></a></b>");
240         w.document.writeln("            </td>");
241         w.document.writeln("    </tr>");
242 <%                      }       // for
243         if(iCnt==0) { %>
244         w.document.writeln("    <tr class=rbg3 height=30>");
245         w.document.writeln("            <td colspan=2 align=center valign=middle><b class=rtabletext>There are no form fields defined</b></td>");
246         w.document.writeln("    </tr>");
247         w.document.writeln("    <tr>");
248         w.document.writeln("            <td colspan=2 align=center><br><input type=Submit class=button value=Close onClick=\"window.close();\"></td>");
249         w.document.writeln("    </tr>");
250 <%      } else { %>
251         w.document.writeln("    <tr class=rbg1 height=30>");
252         w.document.writeln("            <td>&nbsp;</td>");
253         w.document.writeln("            <td>&nbsp;</td>");
254         w.document.writeln("    </tr>");
255 <%      }       // if 
256 %>
257         w.document.writeln("</table>");
258         
259         w.document.writeln("</body></html>");
260         w.document.close();
261 }   // showFormFieldPopup
262
263 function exprFormulaChange(handleText) {
264         var exprValue = "";
265         exprValue = document.forma.exprFormula.options[document.forma.exprFormula.selectedIndex].value;
266         
267         if(handleText)
268                 if(exprValue!='_exprText_') { 
269                         document.forma.exprText.value    = ''; 
270                         document.forma.exprText.disabled = true; 
271                 } else 
272                         document.forma.exprText.disabled = false;
273         
274         var oldColType = "";
275         oldColType = document.forma.colType.value;
276         
277         if((exprValue=="")||(exprValue=="MAX(")||(exprValue=="MIN(")||(exprValue=="_exprText_"))
278                 document.forma.colType.value = document.forma.dbColType.value;
279         else
280                 document.forma.colType.value = "<%= AppConstants.CT_NUMBER %>";
281         
282         if(document.forma.colType.value!=oldColType) {
283                 // Updating displayFormat select list
284                 document.forma.displayFormat.options.length = 0;
285                 
286                 if(document.forma.colType.value=="<%= AppConstants.CT_NUMBER %>") {
287                 <% for(int i=0; i<numberFormats.length; i++) { %>
288                         document.forma.displayFormat.options[<%= i %>] = new Option("<%= numberFormats[i] %>", "<%= numberFormats[i] %>");
289                 <%  } %>
290                 } else if(document.forma.colType.value=="<%= AppConstants.CT_DATE %>") {
291                 <% for(int i=0; i<dateFormats.length; i++) { %>
292                         document.forma.displayFormat.options[<%= i %>] = new Option("<%= dateFormats[i] %>", "<%= dateFormats[i] %>");
293                 <%  } %>
294                 } else {
295                 <% for(int i=0; i<charFormats.length; i++) { %>
296                         document.forma.displayFormat.options[<%= i %>] = new Option("<%= charFormats[i] %>", "<%= charFormats[i].equals("N/A")?"":charFormats[i] %>");
297                 <%  } %>
298                 }       // else
299                 
300                 document.forma.displayFormat.selectedIndex = 0;
301 <%      if(! isCrossTab) { %>
302                 setTotalDropDownValues(document.forma.colType.value=="<%= AppConstants.CT_NUMBER %>");
303 <%  } %>
304                 if(document.layers)
305                         history.go(0);
306         }       // if
307 }   // exprFormulaChange
308
309 <% if(! isEdit) { %>
310 function columnDetailsChange() {
311         var selText  = "";
312         selText  = document.forma.columnDetails.options[document.forma.columnDetails.selectedIndex].text;
313         document.forma.displayName.value = selText.substr(selText.indexOf('.')+1);
314         
315         var selValue = "";
316         selValue = document.forma.columnDetails.options[document.forma.columnDetails.selectedIndex].value;
317         document.forma.dbColType.value  = selValue.substr(selValue.lastIndexOf('|')+1);
318         
319         exprFormulaChange(false);
320         
321         document.forma.displayFormat.selectedIndex = 0;
322 }   // columnDetailsChange
323 <% } %>
324         
325 function showMapPopup() {
326         var colType = document.forma.colType.value;
327         var displayName = document.forma.displayName.value;
328         var displayFormat = document.forma.displayFormat.options[document.forma.displayFormat.selectedIndex].value;
329 <% if(isEdit) { %>
330         var colName = "<%= currColumn.getDbColName() %>";
331         var tableId = "<%= rdef.getColumnTableById(currColumn.getColId()).getTableId() %>";
332 <% } else { %>
333         var selValue = "";
334         selValue = document.forma.columnDetails.options[document.forma.columnDetails.selectedIndex].value;
335         var colName = selValue.substr(selValue.indexOf('|')+1, selValue.lastIndexOf('|')-selValue.indexOf('|')-1);
336         var tableId = selValue.substr(0, selValue.indexOf('|'));
337 <% } %>
338         var w = window.open("<%= AppUtils.getRaptorActionURL() %>report.popup.map&colName="+colName+"&colType="+colType+"&displayName="+escape(displayName)+"&displayFormat="+escape(displayFormat)+"&tableId="+tableId, "mapPopup", "width=400,height=400,location=no,menubar=no,toolbar=no,status=no,resizable=yes,scrollbars=yes");
339         w.focus();
340         w.opener = this;
341 }   // showMapPopup
342 <% }    // if(! isSQLBased) 
343 %>
344
345 function verifyCrossTabSemaphore() {
346 <%      if(isCrossTab) { %>
347         if(     (document.forma.crossTabValue.options[document.forma.crossTabValue.selectedIndex].value!="<%= AppConstants.CV_VALUE %>")
348                 &&(document.forma.semaphore.selectedIndex!=0)) {
349                         alert("You cannot assign Advanced Formatting to this column unless the Column Usage in Cross-Tab is Report values.");
350                         document.forma.semaphore.selectedIndex = 0;
351                         return false;
352                 }
353 <%      } %>
354         return true;
355 }       // verifyCrossTabSemaphore
356         
357 function showSemaphorePopup() {
358         var semaphoreId = "";
359         semaphoreId = document.forma.semaphore.options[document.forma.semaphore.selectedIndex].value;
360         var w = window.open("<%= AppUtils.getRaptorActionURL() %>report.popup.semaphore&semaphoreId="+semaphoreId, "semaphorePopup", "width=720,height=400,location=no,menubar=no,toolbar=no,status=yes,resizable=yes,scrollbars=yes");
361         w.focus();
362         w.opener = this;
363 }   // showSemaphorePopup
364         
365 function updateSemaphoreList(semId, semName) {  // Returns the position of the current semaphore in the list
366         var lSize  = 0;
367         var selIdx = 0;
368         lSize  = document.forma.semaphore.options.length;
369         selIdx = document.forma.semaphore.selectedIndex;        
370         for(var i=0; i<lSize; i++)
371                 if(document.forma.semaphore.options[i].value==semId) {
372                         if(document.forma.semaphore.options[i].text!=semName) {
373                                 document.forma.semaphore.options[i] = new Option(semName, semId);
374                                 document.forma.semaphore.selectedIndex = selIdx;
375                         }       // if
376                         
377                         return i;
378                 }       // if
379         
380         document.forma.semaphore.options[lSize] = new Option(semName, semId);
381         return lSize;
382 }   // updateSemaphoreList
383         
384 function showSemaphoreImportPopup() {
385         if(document.forma.drillDownCtl.selectedIndex==0||document.forma.drillDownCtl.selectedIndex<=tableDrillDownCount) {
386                 alert("You need to select a report from the list, and then click this button\n"+
387                           "to import all the Advanced Display Formattings from selected report into\n"+
388                           "this report. No Advanced Display Formattings have been imported.");
389                 return;
390         }       // if
391         
392         var ddValue = "";
393         ddValue = document.forma.drillDownCtl.options[document.forma.drillDownCtl.selectedIndex].value;
394         var w = window.open("<%= AppUtils.getRaptorActionURL() %>report.popup.import.semaphore&<%= AppConstants.RI_REPORT_ID %>="+ddValue, "semaphoreImportPopup", "width=400,height=250,location=no,menubar=no,toolbar=no,status=yes,resizable=yes,scrollbars=yes");
395         w.focus();
396         w.opener = this;
397 }   // showSemaphoreImportPopup
398
399 function showImageOptions() {
400         var selectionType= document.forma.anchor.options[document.forma.anchor.selectedIndex].value;
401         if (selectionType == "IMAGE") {
402          //document.getElementById("imageSelectionDiv").style.display='block';
403         } else {
404                  document.getElementById("imageSelectionDiv").style.display='none';
405         }
406 }
407
408 function showDisplayFormats() {
409         
410         var colType= document.forma.colType.options[document.forma.colType.selectedIndex].value;
411         if (colType == "<%=AppConstants.CT_HYPERLINK%>") {
412                 document.getElementById("dataFormatDiv").style.display='none';
413                 //document.getElementById("hyperlinkDiv").style.display='block';
414         } else {
415                 document.getElementById("hyperlinkDiv").style.display='none';
416                 //document.getElementById("dataFormatDiv").style.display='block';
417         }
418         var dataFormat = document.forma.colDataFormat; 
419         dataFormat.options.length = 0; 
420
421         dataFormat.options[dataFormat.options.length] = new Option('Select', -1); 
422         if (colType == "<%=AppConstants.CT_NUMBER%>") { 
423                 dataFormat.options[dataFormat.options.length] = new Option('9999999990','9999999990'); 
424                 dataFormat.options[dataFormat.options.length] = new Option('9,999,999,990','9,999,999,990'); 
425                 dataFormat.options[dataFormat.options.length] = new Option('9999999990.99','9999999990.99'); 
426                 dataFormat.options[dataFormat.options.length] = new Option('9,999,999,990.99','9,999,999,990.99'); 
427                 dataFormat.options[dataFormat.options.length] = new Option('$9,999,999,990.99','$9,999,999,990.99'); 
428                 dataFormat.options[dataFormat.options.length] = new Option('$9,999,999,990.999','$9,999,999,990.999'); 
429                 var lSize = dataFormat.options.length;
430                 for(var i=0; i<lSize; i++) {
431                         if(dataFormat.options[i].value=="<%=currColumn.getColFormat()%>") {
432                                 dataFormat.options[i].selected = true;
433                         }
434                 }
435                 if(document.getElementById("filterDateColumn")) document.getElementById("filterDateColumn").style.display = "none";
436
437         } 
438         if (colType == "<%=AppConstants.CT_DATE%>") { 
439                 dataFormat.options[dataFormat.options.length] = new Option('MM/DD/YYYY','MM/DD/YYYY'); 
440                 dataFormat.options[dataFormat.options.length] = new Option('MM/YYYY','MM/YYYY'); 
441                 dataFormat.options[dataFormat.options.length] = new Option('DD-MON-YYYY','DD-MON-YYYY'); 
442                 dataFormat.options[dataFormat.options.length] = new Option('Month DD, YYYY','Month DD, YYYY'); 
443                 dataFormat.options[dataFormat.options.length] = new Option('Month, YYYY','Month, YYYY'); 
444                 dataFormat.options[dataFormat.options.length] = new Option('MM/DD/YYYY HH24:MI:SS','MM/DD/YYYY HH24:MI:SS'); 
445                 dataFormat.options[dataFormat.options.length] = new Option('YYYY/MM/DD HH24:MI:SS','YYYY/MM/DD HH24:MI:SS'); 
446                 dataFormat.options[dataFormat.options.length] = new Option('YYYY','YYYY'); 
447                 var lSize = dataFormat.options.length;
448                 for(var i=0; i<lSize; i++) {
449                         if(dataFormat.options[i].value=="<%=currColumn.getColFormat()%>") {
450                                 dataFormat.options[i].selected = true;
451                         }
452                 }
453                 //if(document.getElementById("filterDateColumn")) document.getElementById("filterDateColumn").style.display = "block";
454
455         } 
456         if (colType == "<%=AppConstants.CT_CHAR%>") { 
457                 dataFormat.options[dataFormat.options.length] = new Option('N/A','N/A'); 
458                 if(document.getElementById("filterDateColumn")) document.getElementById("filterDateColumn").style.display = "none";
459         } 
460         
461         
462 }
463 //-->
464 </script>
465
466 <table width="100%" class="tableBorder" border="0" cellspacing="1" cellpadding="3" align=center>
467         <tr>
468                 <td class=rbg1 colspan=2 valign="Middle"><b class=rtableheader>Step <%= ws.getCurrentStepIndex() %> of <%= ws.getStepCount() %> - Report <%= ws.getCurrentStep() %> - <%= curSubStep %></b></td>
469         </tr>
470 <% if(isSQLBased) { %>
471         <tr>
472                 <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;"><font class=rtabletext>Column ID: </font></td> 
473                 <td class=rbg3 align="left" width="50%"><font class=rtabletext>
474                         <%= currColumn.getColId() %>
475                         </font></td>
476         </tr>
477         <tr>
478           <td class=rbg2 align="right" width="25%" height="30" style="background-position:top right; background-repeat:no-repeat;"><font class=rtabletext>Depends on formfield: </font></td> 
479            <td class=rbg3 align="left" width="50%"><font class=rtabletext>
480               <input type="text" style="width: 200px;" name="dependsOnFormField" value="<%= nvl(dependsOnFormField,"")%>"></input>      </tr>
481 <% }    // if(! isSQLBased) 
482 %>
483 <% if(isCrossTab) { %>
484         <tr>
485                 <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;"><font class=rtabletext>Column Usage in Cross-Tab: </font></td> 
486                 <td class=rbg3 align="left" width="50%"><font class=rtabletext>
487                         <select name="crossTabValue"onChange="setTotalDropDownValues(this.options[this.selectedIndex].value=='<%= AppConstants.CV_VALUE %>')">
488                                 <option value="<%= AppConstants.CV_ROW %>"<%= isEdit?(nvl(currColumn.getCrossTabValue()).equals(AppConstants.CV_ROW)?" selected":""):" selected" %>><%= rdef.getCrossTabDisplayValue(AppConstants.CV_ROW) %>
489                                 <option value="<%= AppConstants.CV_COLUMN %>"<%= (isEdit&&nvl(currColumn.getCrossTabValue()).equals(AppConstants.CV_COLUMN))?" selected":"" %>><%= rdef.getCrossTabDisplayValue(AppConstants.CV_COLUMN) %>
490                                 <option value="<%= AppConstants.CV_VALUE %>"<%= (isEdit&&nvl(currColumn.getCrossTabValue()).equals(AppConstants.CV_VALUE))?" selected":"" %>><%= rdef.getCrossTabDisplayValue(AppConstants.CV_VALUE) %>
491                                 <option value=""<%= (isEdit&&(nvl(currColumn.getCrossTabValue()).length()==0))?" selected":"" %>>Invisible/Filter
492                         </select></font></td>
493         </tr>
494 <% } %>
495 <% if(! isSQLBased) { %>
496         <tr>
497                 <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;"><font class=rtabletext>Table Column: </font></td> 
498                 <td class=rbg3 align="left" width="50%"><font class=rtabletext>
499                 <% if(isEdit) { %>
500                         <%= nvl(rdef.getColumnLabel(currColumn), currColumn.getDbColName()) /*currColumn.getColName()*/ %>
501                 <% } else { %>
502                         <select name="columnDetails" onChange="columnDetailsChange();">
503 <%                                  int icnt = 0;
504                                         String remoteDbPrefix = dbInfo;
505                                         for(Iterator iter=rdef.getDataSourceList().getDataSource().iterator(); iter.hasNext(); ) { 
506                                                 DataSourceType dst = (DataSourceType) iter.next();
507                                                 
508                                                 Vector dbColumns = DataCache.getReportTableDbColumns(dst.getTableName().toUpperCase(),remoteDbPrefix);
509                                                 if(dbColumns!=null)
510                                                         for(int i=0; i<dbColumns.size(); i++) {
511                                                                 DBColumnInfo dbCol = (DBColumnInfo) dbColumns.get(i);
512                                                                 //if(dst.getTableName().toUpperCase().equals(dbCol.getTableName())) { 
513 %>
514                                                     <option value="<%= dst.getTableId() %>|<%= dbCol.getColName() %>|<%= dbCol.getColType() %>"<%= (icnt==0)?" selected":"" %>>[<%= dst.getDisplayName() %>].<%= dbCol.getLabel() %>
515 <%                                                                      if(icnt==0) {
516                                                                                 dispName  = dbCol.getLabel();
517                                                                                 dbColType = dbCol.getColType();
518                                                                                 colType   = dbColType;
519                                                                         }
520                                                                         icnt++;
521                                                                 //}   // if 
522                                                         }   // for 
523                                         }   // for 
524 %>
525                         </select>
526                 <% } %>
527                 <input type="hidden" name="dbColType" value="<%= dbColType %>">
528                 <input type="hidden" name="colType" value="<%= colType %>">
529                 </font></td>
530         </tr> 
531 <% }    // if(! isSQLBased) 
532 %>
533
534 <% if(isSQLBased) { %>
535         <tr>
536                 <td class=rbg2 align="right" height="30"><font class=rtabletext>Datatype: </font></td> 
537                 <td class=rbg3 align="left" nowrap><font class=rtabletext>
538             <select name="colType" style="width: 100px;" onChange="showDisplayFormats();">
539                         <option value="0"> Select</option>
540                         <option value="<%=AppConstants.CT_NUMBER%>" <%=currColumn.getColType().equals(AppConstants.CT_NUMBER)?" selected": ""%>> Number </option>
541                         <option value="<%=AppConstants.CT_DATE%>" <%=currColumn.getColType().equals(AppConstants.CT_DATE)?" selected": ""%>> Date</option>
542                         <option value="<%=AppConstants.CT_CHAR%>" <%=currColumn.getColType().equals(AppConstants.CT_CHAR)?" selected": ""%>> Character</option>
543                         <option value="<%=AppConstants.CT_HYPERLINK%>" <%=currColumn.getColType().equals(AppConstants.CT_HYPERLINK)?" selected": ""%>> Hyperlink</option>
544            </select>
545            </font>
546            </td>
547         </tr>
548         <tr>
549                 <td class=rbg2 align="right" height="30"><font class=rtabletext>Group By Pos: </font></td> 
550                 <td class=rbg3 align="left" nowrap><font class=rtabletext>
551             <select name="groupByPos" style="width: 100px;">
552                         <option value="0"> Select</option>
553                         <option value="1" <%=(currColumn.getGroupByPos()!=null && currColumn.getGroupByPos()==1)?" selected": ""%>> 1 </option>
554            </select>
555            </font>
556            </td>
557         </tr>
558         <tr>
559                 <td class=rbg2 align="right" height="30"><font class=rtabletext>Custom Text for Sub-Total: </font></td> 
560                 <td class=rbg3 align="left" nowrap><font class=rtabletext>
561             <font class=rtabletext>
562                         <input type="text" size="30" maxlength="500" style="width: 100px;" class=rtabletext  name="subTotalCustomText" value="<%= isEdit?(currColumn.getSubTotalCustomText()!=null?currColumn.getSubTotalCustomText():"Sub Total"):"Sub Total" %>"/>      
563            </font>
564            </font>
565            </td>
566         </tr>
567         <tr>
568                 <td class=rbg2 align="right" height="30"><font class=rtabletext>Hide Repeated Values : </font></td>
569                         <td class=rbg3 width="50%" align="left" nowrap><font class=rtabletext>
570                     <input type="checkbox" name="hideRepeatedKeys" value="Y" <%=(currColumn.isHideRepeatedKey()!=null && currColumn.isHideRepeatedKey().booleanValue())?" checked":"" %>>
571                    </font>
572                    </td>
573         </tr>
574
575
576         <tr>
577                 <td class=rbg2 align="right" height="30"><font class=rtabletext>Multi group Column Level: </font></td> 
578                 <td class=rbg3 align="left" nowrap><font class=rtabletext>
579             <select name="multiGroupColLevel" style="width: 100px;">
580                         <option value="0"> Select</option>
581                         <option value="-1" <%=(currColumn.getLevel()!=null && currColumn.getLevel()==-1)?" selected": ""%>> AUXILIARY-COLUMN </option>
582                         <option value="1" <%=(currColumn.getLevel()!=null && currColumn.getLevel()==1)?" selected": ""%>> 1 </option>
583                         <option value="2" <%=(currColumn.getLevel()!=null && currColumn.getLevel()==2)?" selected": ""%>> 2 </option>
584                         <option value="3" <%=(currColumn.getLevel()!=null && currColumn.getLevel()==3)?" selected": ""%>> 3 </option>
585                         <option value="4" <%=(currColumn.getLevel()!=null && currColumn.getLevel()==4)?" selected": ""%>> 4 </option>
586            </select>
587            </font>
588            </td>
589         </tr>
590
591         <tr>
592                 <td class=rbg2 align="right" height="30"><font class=rtabletext>Multi group Column Range : </font>
593                                 <font class=rtabletext>Colspan : </font>
594                 </td> 
595                 <td class=rbg3 align="left" nowrap>
596                 <font class=rtabletext>
597                         <input type="text" size="30" style="width: 100px;" maxlength="500" class=rtabletext  name="colspan" value="<%= isEdit?(currColumn.getColspan()!=null?currColumn.getColspan():""):"" %>"/>         
598                         
599            </font>
600            </td>
601         </tr>
602
603         <tr id ="dataFormatDiv">
604             <td colspan="2" class=rbg2>         
605                 <table width="100%" cellspacing="1" cellpadding="3" align=center>
606                 <tr>
607                         <td class=rbg2 width="25%" align="right" height="30"><font class=rtabletext>Dataformat: </font></td> 
608                         <td class=rbg3 width="50%" align="left" nowrap><font class=rtabletext>
609                     <select name="colDataFormat" style="width: 100px;">
610                    </select>
611                    </font>
612                    </td>
613                 </tr>
614          <% if(!isCrossTab) { %>           
615                 <tr id="filterDateColumn">
616                         <td class=rbg2 width="25%" align="right" height="30"><font class=rtabletext>Enhanced Pagination: </font></td> 
617                         <td class=rbg3 width="50%" align="left" nowrap><font class=rtabletext>
618                     <input type="checkbox" name="enhancedPagination" value="Y" <%=(currColumn.isEnhancedPagination()!=null && currColumn.isEnhancedPagination().booleanValue())?" checked":"" %> />
619                    </font>
620                    </td>
621                 </tr>
622         <%} %>   
623                 
624                 </table>
625                 </td>
626         </tr>
627         <tr id ="hyperlinkDiv">   
628           <td colspan="2">
629             <table  width="100%" cellspacing="1" cellpadding="3" align=center>
630                 <tr>
631                         <td class=rbg2 width="25%" align="right" height="30"><font class=rtabletext>URL: </font></td> 
632                         <td class=rbg3 width="50%" align="left" nowrap><font class=rtabletext>
633                           <input type="text" size="30" maxlength="500" class=rtabletext  name="hyperlinkURL" value="<%= isEdit?currColumn.getHyperlinkURL():"" %>"/>
634                    </font>
635                    </td>
636                 </tr>
637
638                 <tr>
639                         <td class=rbg2 width="25%" align="right" height="30"><font class=rtabletext>Anchor: </font></td> 
640                         <td class=rbg3 width="50%" align="left" nowrap><font class=rtabletext>
641                     <select name="anchor" onChange="showImageOptions()">
642                                 <option value="0"> Select</option>
643                                 <option value="VALUE" <%=nvl(currColumn.getHyperlinkType()).equals("VALUE")?" selected": ""%>> Value Of the Column </option>
644                                 <option value="IMAGE" <%=nvl(currColumn.getHyperlinkType()).equals("IMAGE")?" selected": ""%>> IMAGE</option>
645                    </select>
646                    </font>
647                    </td>
648                 </tr>
649                   <tr id="imageSelectionDiv" style="display:none;"> 
650                         <td class=rbg2 width="25%" height="30" align="right">
651                                 <font class=rtabletext>Select Image for anchor: </font>
652                         </td> 
653                         <td width="50%" align="left">
654                                 <font class=rtabletext>
655                   <select id = "actionImg" name="actionImg" >
656                     <option value=''> <!-- SELECT --></option>
657                   <%
658                         if(!actionImgMap.isEmpty()) {
659                                 for( Iterator itr=actionImgMap.entrySet().iterator(); itr.hasNext(); ) {
660                                         Map.Entry e = (Map.Entry)itr.next();
661                                         String image_id = (String)e.getKey();
662                                         String image_loc = (String)e.getValue();
663            %>
664            <%
665                         if (nvl(AppUtils.getRequestNvlValue(request, "actionImg")).length()>0 && !(AppUtils.getRequestNvlValue(request, "pdfImg").equals(currColumn.getActionImg())) ) {
666                                 if(image_loc .equals (AppUtils.getRequestNvlValue(request, "actionImg"))) {
667                         %>
668                         
669                         <option value='<%= image_loc %>' selected> <%=image_id %></option>
670                         <%      
671                                 } else {
672             %>                                  
673                                         <option value='<%= image_loc %>'> <%=image_id %></option>
674                         <%              
675                         } 
676                         } else {
677                                 if(image_loc .equals (currColumn.getActionImg())) {
678                                 %>
679                                 
680                                 <option value='<%= image_loc %>' selected> <%=image_id %> </option>
681                                 <%      
682                                 
683                             } else {
684                             %>                                  
685                                         <option value='<%= image_loc %>'> <%=image_id %></option>
686                         <%              
687                             }
688                         }
689            %>
690
691                    <% }
692                      }
693                    %>
694            </select>
695                    </font>
696            </td>                   
697                   </tr>
698                  </table>
699          </td>           
700                   </tr>
701 <% } %>
702         <tr>
703                 <td class=rbg2 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> 
704                 <td class=rbg3 align="left"><font class=rtabletext>
705                         <input type="text" style="width: 100px;" size="30" maxlength="60" class=rtabletext name="displayName" value="<%= isEdit?currColumn.getDisplayName():dispName %>"></font></td>
706         </tr>
707 <% if(! isSQLBased) { %>
708         <tr>
709                 <td class=rbg2 align="right" height="30"><font class=rtabletext>Display Format: </font></td> 
710                 <td class=rbg3 align="left" nowrap><font class=rtabletext>
711                         <!--input type="text" size="20" maxlength="30" name="displayFormat" value="< %= isEdit?nvl(currColumn.getColFormat()):"" % >" onFocus="blur();"></font>
712                     <a href="javascript:showFormatPopup()"><img border="0" src="<%= AppUtils.getImgFolderURL() %>shareicon.gif" alt="Select from list" width="12" height="12"></a-->
713                         <select name="displayFormat" style="width: 100px;" >
714                         <%  String[] fmt;
715                                 if(colType.equals(AppConstants.CT_NUMBER)) 
716                                         fmt = numberFormats;
717                                 else if(colType.equals(AppConstants.CT_DATE)) 
718                                         fmt = dateFormats;
719                                 else 
720                                         fmt = charFormats; 
721                                 for(int i=0; i<fmt.length; i++) { %>
722                                 <option value="<%= fmt[i].equals("N/A")?"":(fmt[i].startsWith("Month")?("fm"+fmt[i]):fmt[i]) %>"<%= (isEdit&&(nvl(currColumn.getColFormat()).toUpperCase().equals(fmt[i].toUpperCase())||("fm"+nvl(currColumn.getColFormat())).toUpperCase().equals(fmt[i].toUpperCase())))?" selected":"" %>><%= fmt[i] %>
723                         <%  } %>
724                         </select></font></td>
725         </tr>
726 <% }    // if(! isSQLBased) 
727 %>
728
729 <% if (false) { %>
730         <tr>
731                 <td class=rbg2 align="right" height="30"><font class=rtabletext>Display Width: </font></td> 
732                 <td class=rbg3 align="left"><font class=rtabletext>
733                 <% if (currColumn.getDisplayWidth()<=0) { currColumn.setDisplayWidth(10); } %>
734                         <select name="displayWidth" style="width: 100px;"  onKeyDown="fnKeyDownHandler(this, event);" onKeyUp="fnKeyUpHandler_A(this, event); return false;" onKeyPress = "return fnKeyPressHandler_A(this, event);"  onChange="fnChangeHandler_A(this, event);">
735                                 <option value="" style="COLOR:#ff0000;BACKGROUND-COLOR:#ffff00;">Custom</option> <!-- This is the Editable Option -->
736                                 <option value="10"<%=  (isEdit&&(currColumn.getDisplayWidth()<=0 || currColumn.getDisplayWidth()==10))?"":" selected" %>>10%
737                                 <option value="20"<%=  (isEdit&&(currColumn.getDisplayWidth()==20))?" selected":""  %>>20%
738                                 <option value="30"<%=  (isEdit&&(currColumn.getDisplayWidth()==30))?" selected":""  %>>30%
739                                 <option value="40"<%=  (isEdit&&(currColumn.getDisplayWidth()==40))?" selected":""  %>>40%
740                                 <option value="50"<%=  (isEdit&&(currColumn.getDisplayWidth()==50))?" selected":""  %>>50%
741                                 <option value="60"<%=  (isEdit&&(currColumn.getDisplayWidth()==60))?" selected":""  %>>60%
742                                 <option value="70"<%=  (isEdit&&(currColumn.getDisplayWidth()==70))?" selected":""  %>>70%
743                                 <option value="80"<%=  (isEdit&&(currColumn.getDisplayWidth()==80))?" selected":""  %>>80%
744                                 <option value="90"<%=  (isEdit&&(currColumn.getDisplayWidth()==90))?" selected":""  %>>90%
745                                 <option value="100"<%= (isEdit&&(currColumn.getDisplayWidth()==100))?" selected":"" %>>100%
746                                 <% if(!((currColumn.getDisplayWidth()%10 == 0) && (currColumn.getDisplayWidth() > 100)) ) {
747                                 %>
748                                         <option value="<%=currColumn.getDisplayWidth()%>" selected><%=currColumn.getDisplayWidth()%>%</option> 
749                 <%                              
750                                          } 
751                 %>                                              
752                                 
753                         </select></font></td>
754         </tr>
755         <% } %>
756         <% System.out.println("WidthInPxls " + currColumn.getDisplayWidthInPxls()); %>
757         <tr>
758                 <td class=rbg2 align="right" height="30"><font class=rtabletext>Display Width (In Pxls): </font></td> 
759                 <td class=rbg3 align="left"><font class=rtabletext>
760                                                 <input type="text" style="width: 100px;" class="rtabletext" size="40" maxlength="100" id="widthInPxls" name="widthInPxls" value="<%= (nvl(AppUtils.getRequestNvlValue(request, "widthInPxls")).length() > 0)? 
761                         (!(AppUtils.getRequestNvlValue(request, "widthInPxls").equals(currColumn.getDisplayWidthInPxls()))?
762                             AppUtils.getRequestNvlValue(request, "widthInPxls"):currColumn.getDisplayWidthInPxls()):
763                                 currColumn.getDisplayWidthInPxls() %>">
764
765 </font></td>
766         </tr>   
767         <tr>
768                 <td class=rbg2 align="right" height="30"><font class=rtabletext>No Wrap ? </font></td> 
769                 <td class=rbg3 align="left"><font class=rtabletext>
770                         <select name="nowrap" style="width: 100px;" >
771                                 <option value="Y"<%= isEdit?(nvl(currColumn.getNowrap(),"N").startsWith("Y")?" selected":(!nvl(currColumn.getNowrap(),"False").startsWith("N") && org.openecomp.portalsdk.analytics.system.Globals.IsGlobalNoWrap()?" selected": "")):"" %>>Yes
772                                 <option value="N"<%= (isEdit&&(nvl(currColumn.getNowrap(),"False").startsWith("N")))?" selected":"" %>>No
773                         </select></font></td>
774         </tr>
775         
776         <tr>
777                 <td class=rbg2 height="30" align="right"><font class=rtabletext>Indent Parameter to display value </font>
778                 </td> 
779                 <td class=rbg3 align="left">
780                         <select name="indentation" style="width: 100px;" >
781                             <option value="0"> Select</option>
782                                 <option value="1" <%= AppUtils.getRequestNvlValue(request, "indentation").equals("1") ? " selected":((AppUtils.getRequestNvlValue(request, "indentation").length()<=0)?(currColumn.getIndentation()!=null && currColumn.getIndentation().intValue()==1?" selected":""):"") %>> 1 </option>
783                                 <option value="2" <%= AppUtils.getRequestNvlValue(request, "indentation").equals("2") ? " selected":((AppUtils.getRequestNvlValue(request, "indentation").length()<=0)?(currColumn.getIndentation()!=null && currColumn.getIndentation().intValue()==2?" selected":""):"") %>> 2 </option>
784                                 <option value="3" <%= AppUtils.getRequestNvlValue(request, "indentation").equals("3") ? " selected":((AppUtils.getRequestNvlValue(request, "indentation").length()<=0)?(currColumn.getIndentation()!=null && currColumn.getIndentation().intValue()==3?" selected":""):"") %>> 3 </option>                              
785                         </select>
786                 </td>
787         </tr>
788                 
789         <tr>
790                 <td class=rbg2 align="right" height="30"><font class=rtabletext>Display Alignment: </font></td> 
791                 <td class=rbg3 align="left"><font class=rtabletext>
792                         <select name="displayAlign" style="width: 100px;" >
793                                 <option value="Left"<%=   isEdit?(nvl(currColumn.getDisplayAlignment(), "Left").equals("Left")?" selected":""):" selected" %>>Left
794                                 <option value="Center"<%= (isEdit&&nvl(currColumn.getDisplayAlignment()).equals("Center"))?" selected":""                  %>>Center
795                                 <option value="Right"<%=  (isEdit&&nvl(currColumn.getDisplayAlignment()).equals("Right"))?" selected":""                   %>>Right
796                         </select></font></td>
797         </tr>
798
799         <tr>
800                 <td class=rbg2 align="right" height="30"><font class=rtabletext>Display (Header) Alignment: </font></td> 
801                 <td class=rbg3 align="left"><font class=rtabletext>
802                         <select name="displayHeaderAlign" style="width: 100px;" >
803                                 <option value="Left"<%=   isEdit?(nvl(currColumn.getDisplayHeaderAlignment(), "Left").equals("Left")?" selected":""):" selected" %>>Left
804                                 <option value="Center"<%= (isEdit&&nvl(currColumn.getDisplayHeaderAlignment()).equals("Center"))?" selected":""                  %>>Center
805                                 <option value="Right"<%=  (isEdit&&nvl(currColumn.getDisplayHeaderAlignment()).equals("Right"))?" selected":""                   %>>Right
806                         </select></font></td>
807         </tr>
808         <tr>
809                 <td class=rbg2 align="right" height="30"><font class=rtabletext>Sortable? </font></td> 
810                 <td class=rbg3 align="left"><font class=rtabletext>
811                         <select name="sortable" style="width: 100px;" >
812                                 <option value="N"<%= isEdit?((currColumn.isIsSortable()!=null && !currColumn.isIsSortable())?" selected":""):" selected" %>>No
813                                 <option value="Y"<%= (isEdit&&currColumn.isIsSortable()!=null && currColumn.isIsSortable())?" selected":""        %>>Yes
814                         </select></font></td>
815         </tr>
816         
817
818         <% if(! isCrossTab) { %>
819         <tr>
820                 <td class=rbg2 align="right" height="30"><font class=rtabletext>Visible? </font></td> 
821                 <td class=rbg3 align="left"><font class=rtabletext>
822                         <select name="visible" style="width: 100px;" >
823                                 <option value="Y"<%= isEdit?(currColumn.isVisible()?" selected":""):" selected" %>>Yes
824                                 <option value="N"<%= (isEdit&&(! currColumn.isVisible()))?" selected":""        %>>No
825                         </select></font></td>
826         </tr>
827         <% if(! isSQLBased) { %>
828         <tr>
829                 <td class=rbg2 align="right" height="30"><font class=rtabletext>Group By? </font></td> 
830                 <td class=rbg3 align="left"><font class=rtabletext>
831                         <select name="groupBreak" style="width: 100px;" >
832                                 <option value="Y"<%= (isEdit&&currColumn.isGroupBreak())?" selected":""            %>>Yes
833                                 <option value="N"<%= isEdit?(currColumn.isGroupBreak()?"":" selected"):" selected" %>>No
834                         </select></font></td>
835         </tr>
836         <% } %>
837         <% } %>
838         <!--tr class=rbg2>
839                 <td class=rbg2  height="30" align="right" width="25%"><font face="Arial, Helvetica, sans-serif" size="1" class=rtabletext>Column Type </font></td> 
840                 <td align="left" width="50%" class=rbg3><font face="Arial, Helvetica, sans-serif" size="1" class=rtabletext>
841                         <select name="calculated">
842                                 <option value="N"< %= (isEdit&&currColumn.isCalculated())?"":" selected" % >>Table Column
843                                 <option value="Y"< %= (isEdit&&currColumn.isCalculated())?" selected":"" % >>Expression
844                         </select></font></td>
845         </tr-->
846         <% if(! isSQLBased) { %>  
847 <%
848 boolean isOtherExpr = isEdit&&currColumn.isCalculated()&&
849                                                 (! nvl(currColumn.getColName()).startsWith("SUM( "))&&
850                                                 (! nvl(currColumn.getColName()).startsWith("MAX( "))&&
851                                                 (! nvl(currColumn.getColName()).startsWith("MIN( "))&&
852                                                 (! nvl(currColumn.getColName()).startsWith("COUNT(*)"))&&
853                                                 (! nvl(currColumn.getColName()).startsWith("COUNT(ALL "))&&
854                                                 (! nvl(currColumn.getColName()).startsWith("COUNT(DISTINCT "))&&
855                                                 (! nvl(currColumn.getColName()).startsWith("AVG(ALL "))&&
856                                                 (! nvl(currColumn.getColName()).startsWith("AVG(DISTINCT "))&&
857                                                 (! nvl(currColumn.getColName()).startsWith("STDDEV(ALL "))&&
858                                                 (! nvl(currColumn.getColName()).startsWith("STDDEV(DISTINCT "))&&
859                                                 (! nvl(currColumn.getColName()).startsWith("VARIANCE(ALL "))&&
860                                                 (! nvl(currColumn.getColName()).startsWith("VARIANCE(DISTINCT "));
861 %>
862         <tr>
863                 <td class=rbg2 align="right" height="30"><font class=rtabletext>Expression: </font></td> 
864                 <td class=rbg3 align="left"><font class=rtabletext>
865                         <select name="exprFormula" onChange="exprFormulaChange(true);" style="width: 100px;" >
866                                 <option value=""<%=                  (isEdit&&currColumn.isCalculated())?"":" selected"                                                                %>>
867                                 <option value="SUM("<%=              (isEdit&&currColumn.isCalculated()&&nvl(currColumn.getColName()).startsWith("SUM( "))?" selected":""              %>>Sum
868                                 <option value="MAX("<%=              (isEdit&&currColumn.isCalculated()&&nvl(currColumn.getColName()).startsWith("MAX( "))?" selected":""              %>>Max
869                                 <option value="MIN("<%=              (isEdit&&currColumn.isCalculated()&&nvl(currColumn.getColName()).startsWith("MIN( "))?" selected":""              %>>Min
870                                 <option value="COUNT(*)"<%=          (isEdit&&currColumn.isCalculated()&&(nvl(currColumn.getColName()).startsWith("COUNT(*)")||nvl(currColumn.getColName()).startsWith("COUNT(ALL ")))?" selected":"" %>>Count All
871                                 <option value="COUNT(DISTINCT"<%=    (isEdit&&currColumn.isCalculated()&&nvl(currColumn.getColName()).startsWith("COUNT(DISTINCT "))?" selected":""    %>>Count Distinct
872                                 <option value="AVG(ALL"<%=           (isEdit&&currColumn.isCalculated()&&nvl(currColumn.getColName()).startsWith("AVG(ALL "))?" selected":""           %>>Average All
873                                 <option value="AVG(DISTINCT"<%=      (isEdit&&currColumn.isCalculated()&&nvl(currColumn.getColName()).startsWith("AVG(DISTINCT "))?" selected":""      %>>Average Distinct
874                                 <option value="STDDEV(ALL"<%=        (isEdit&&currColumn.isCalculated()&&nvl(currColumn.getColName()).startsWith("STDDEV(ALL "))?" selected":""        %>>Standard Deviation All
875                                 <option value="STDDEV(DISTINCT"<%=   (isEdit&&currColumn.isCalculated()&&nvl(currColumn.getColName()).startsWith("STDDEV(DISTINCT "))?" selected":""   %>>Standard Deviation Distinct
876                                 <option value="VARIANCE(ALL"<%=      (isEdit&&currColumn.isCalculated()&&nvl(currColumn.getColName()).startsWith("VARIANCE(ALL "))?" selected":""      %>>Variance All
877                                 <option value="VARIANCE(DISTINCT"<%= (isEdit&&currColumn.isCalculated()&&nvl(currColumn.getColName()).startsWith("VARIANCE(DISTINCT "))?" selected":"" %>>Variance Distinct
878                                 <option value="_exprText_"<%=        isOtherExpr?" selected":""                                                                                        %>>---------- Other ----------
879                         </select></font></td>
880         </tr>
881         <tr>
882                 <td class=rbg2 align="right" height="30"><font class=rtabletext>Expression Other: </font></td> 
883                 <td class=rbg3 align="left" nowrap><font class=rtabletext>
884                         <input type="text" size="30" name="exprText"<%= isOtherExpr?" value=\""+nvl(currColumn.getColName())+"\"":" value=\"\" disabled" %> onFocus="if(document.forma.exprFormula.options[document.forma.exprFormula.selectedIndex].value!='_exprText_') blur();"></font>
885                     <a href="javascript:showMapPopup()"><img border="0" src="<%= AppUtils.getImgFolderURL() %>shareicon.gif" alt="Define custom values mapping" width="12" height="12"></a>&nbsp;
886                     <a href="javascript:showFormFieldPopup()"><font class=rtabletext>Form Fields</font></a>
887                 </td>
888         </tr>
889 <% }    // if(! isSQLBased) 
890 %>
891 <%-- if(! isCrossTab) { --%>
892         <tr>
893                 <td class=rbg2 align="right" height="30"><font class=rtabletext>Drill-down Link: </font></td> 
894                 <td class=rbg3 align="left"><font class=rtabletext>
895                         <input type="hidden" name="drillDownURL" value="<%= isEdit?nvl(currColumn.getDrillDownURL()):"" %>">
896                         <input type="hidden" name="drillDownParams" value="<%= isEdit?nvl(currColumn.getDrillDownParams()):"" %>">
897                         <input type="hidden" name="drillDownSuppress" value="<%= isEdit?nvl(currColumn.getDrillDownType()):"" %>">
898                         <input type="hidden" name="drillDownRequest" value="<%= isEdit?getRequestParam(currColumn.getDrillDownParams()):"" %>">
899                         <input type="hidden" name="drillDownPopUp" value="<%= isEdit?(currColumn.isDrillinPoPUp()!=null?currColumn.isDrillinPoPUp():""):"" %>">
900                         <select name="drillDownCtl" onChange="showDrillDownPopup(true)" style="width: 300px;" >
901                                 <option value=""<%= (isEdit&&nvl(currColumn.getDrillDownURL()).length()>0)?"":" selected" %>>----- No Drill-down -----
902         <%      int tableDrillDownCount = 0;
903                 if(! isCrossTab)
904                         for(int i=0; i<reportTableSources.size(); i++) {
905                                 TableSource tableSource = (TableSource) reportTableSources.get(i);
906                                 if(nvl(tableSource.getViewAction()).length()>0&&rdef.getTableByDBName(tableSource.getTableName())!=null) { 
907                                         tableDrillDownCount++; %>
908                                         <option value="<%= tableSource.getViewAction() %>"<%= (isEdit&&nvl(currColumn.getDrillDownURL()).equals(AppUtils.getBaseActionURL()+tableSource.getViewAction()))?" selected":"" %>><%= tableSource.getDisplayName() %> Record Details
909         <%                      }       // if
910                         }       // for
911
912                 Vector publicReportIdNames = DataCache.getPublicReportIdNames();
913                 for(int i=0; i<publicReportIdNames.size(); i++) { 
914                         IdNameValue reportIdName = (IdNameValue) publicReportIdNames.get(i); %>
915                                 <option value="<%= reportIdName.getId() %>"<%= (isEdit&&nvl(currColumn.getDrillDownURL()).equals(reportIdName.getId()))?" selected":"" %>>Public Report: <%= reportIdName.getName() %>
916         <%      } %>:
917         
918         <%
919         //if(!AppUtils.isSuperUser(request)) {
920         Vector groupReportIdNames = DataCache.getGroupAccessibleReportIdNames(AppUtils.getUserID(request),AppUtils.getUserRoles(request));
921                 for(int j=0; j<groupReportIdNames.size(); j++) { 
922                         IdNameValue reportIdName = (IdNameValue) groupReportIdNames.get(j); %>
923                                 <option value="<%= reportIdName.getId() %>"<%= (isEdit&&nvl(currColumn.getDrillDownURL()).equals(reportIdName.getId()))?" selected":"" %>>Group Report: <%= reportIdName.getName() %>
924             <% } %>                     
925          <%// } 
926          %>   
927         <%
928         //if(!AppUtils.isSuperUser(request)) {
929         Vector privateReportIdNames = DataCache.getPrivateAccessibleReportIdNames(AppUtils.getUserID(request),AppUtils.getUserRoles(request));
930                 for(int j=0; j<privateReportIdNames.size(); j++) { 
931                         IdNameValue reportIdName = (IdNameValue) privateReportIdNames.get(j); %>
932                                 <option value="<%= reportIdName.getId() %>"<%= (isEdit&&nvl(currColumn.getDrillDownURL()).equals(reportIdName.getId()))?" selected":"" %>>Private Report: <%= reportIdName.getName() %>
933             <% } %>                     
934          <% // } 
935 %>   
936                         </select></font>
937                         <a href="javascript:showDrillDownPopup(false)"><img border="0" src="<%= AppUtils.getImgFolderURL() %>shareicon.gif" alt="Set new parameters configuration" width="12" height="12"></a>
938                         &nbsp;&nbsp;
939                         <a href="javascript:showSemaphoreImportPopup()"><img border="0" src="<%= AppUtils.getImgFolderURL() %>lookup_arrow.gif" alt="Import advanced formatting from selected report" width="17" height="17"></a>
940                 </td>
941         </tr>
942 <script language="JavaScript">
943 <!--
944         tableDrillDownCount = <%= tableDrillDownCount %>;
945 //-->
946 </script>
947         <%      String curSemId = "";
948                 if(isEdit)
949                         curSemId = nvl(currColumn.getSemaphoreId()); %>
950         <tr>
951                 <td class=rbg2 align="right" height="30"><font class=rtabletext>Advanced Display Formatting: </font></td> 
952                 <td class=rbg3 align="left" nowrap><font class=rtabletext>
953                         <select name="semaphore"" onChange="verifyCrossTabSemaphore()" style="width: 300px;" >
954                                 <option value=""<%= (curSemId.length()==0)?" selected":"" %>>----- Do Not Use Advanced Formatting -----
955         <%      if(rdef.getSemaphoreList()!=null)
956                         for(Iterator iter=rdef.getSemaphoreList().getSemaphore().iterator(); iter.hasNext(); ) {
957                                 SemaphoreType semaphore = (SemaphoreType) iter.next(); %>
958                                 <option value="<%= semaphore.getSemaphoreId() %>"<%= curSemId.equals(semaphore.getSemaphoreId())?" selected":"" %>><%= semaphore.getSemaphoreName() %>
959         <%              }       // for 
960         %>
961                         </select></font>
962                         <input type="hidden" name="semaphoreTypeHidden" value=""/>
963                         <a href="javascript:showSemaphorePopup()"><img border="0" src="<%= AppUtils.getImgFolderURL() %>shareicon.gif" alt="Define advanced formatting" width="12" height="12"></a>
964                 </td>
965         </tr>
966 <%-- } --%>
967
968 <%      boolean canHaveTotal = false; 
969         if(isSQLBased) {
970                 //canHaveTotal = (! isCrossTab);
971                 canHaveTotal = (!isCrossTab)||(isEdit&&nvl(currColumn.getCrossTabValue()).equals(AppConstants.CV_VALUE));
972         } else  {
973                 if(isCrossTab) 
974                         canHaveTotal = (isEdit&&nvl(currColumn.getCrossTabValue()).equals(AppConstants.CV_VALUE));
975                 else
976                         canHaveTotal = colType.equals(AppConstants.CT_NUMBER);
977         }
978         
979         String colTotalRow = "";
980         String colTotal    = isEdit?nvl(currColumn.getDisplayTotal()):"";
981         if(isCrossTab&&colTotal.indexOf('|')>=0) {
982                 colTotalRow = colTotal.substring(colTotal.indexOf('|')+1);
983                 colTotal    = colTotal.substring(0, colTotal.indexOf('|'));
984         } %>
985         <tr>
986                 <td class=rbg2 align="right" height="30"><font class=rtabletext>Total for <%= isCrossTab?"each":"the" %> column: </font></td> 
987                 <td class=rbg3 align="left"><font class=rtabletext>
988                         <select name="displayTotal" style="width: 300px;" >
989                                 <option value=""<%= (colTotal.length()>0)?"":" selected" %>>--- Do Not Display (Faster Report Execution) ---
990                         <%      if(canHaveTotal) {
991                                         for(int i=0; i<AppConstants.TOTAL_FUNCTIONS.getCount(); i++) { 
992                                                 IdNameValue tValue = AppConstants.TOTAL_FUNCTIONS.getValue(i); %>
993                                 <option value="<%= tValue.getId() %>"<%= (colTotal.startsWith(tValue.getId()))?" selected":"" %>><%= tValue.getName() %>
994                         <%      }       // for
995                                 } // if  
996                         %>
997                         </select></font></td>
998         </tr>
999 <%      if(isCrossTab) { %>
1000         <tr>
1001                 <td class=rbg2 align="right" height="30"><font class=rtabletext>Total for each row </font></td> 
1002                 <td class=rbg3 align="left"><font class=rtabletext>
1003                         <select name="displayTotalPerRow">
1004                                 <option value=""<%= (colTotalRow.length()>0)?"":" selected" %>>--- Do Not Display (Faster Report Execution) ---
1005                         <%      if(canHaveTotal) {
1006                                         for(int i=0; i<AppConstants.TOTAL_FUNCTIONS.getCount(); i++) { 
1007                                                 IdNameValue tValue = AppConstants.TOTAL_FUNCTIONS.getValue(i); %>
1008                                 <option value="<%= tValue.getId() %>"<%= (colTotalRow.startsWith(tValue.getId()))?" selected":"" %>><%= tValue.getName() %>
1009                         <%      }       // for
1010                                 } // if  
1011                         %>
1012                         </select></font></td>
1013         </tr>
1014 <%      }       // if(isCrossTab) 
1015 %>
1016 <% if(isSQLBased) { %>
1017         <tr>
1018                 <td class=rbg2 align="right" height="30"><font class=rtabletext>&nbsp; </font></td> 
1019                 <td class=rbg3 align="left"><font class=rtabletext>
1020                         <input type="Checkbox" name="no_parse_date" value="Y"<%= (isEdit&&rdef.getColumnNoParseDateFlag(currColumn))?" checked":"" %>>
1021                         Do not attempt to parse values as date</font></td>
1022         </tr>
1023 <% } %>
1024 </table>
1025 <br>
1026
1027 <script language="JavaScript">
1028 <!--
1029 function dataValidate() {
1030 <%      if(isCrossTab) {
1031                 /*if(rdef.getCrossTabColColumns().size()>0) { 
1032                         // Col headings column already defined
1033                 }*/ %>
1034                 
1035         if(document.forma.crossTabValue.options[document.forma.crossTabValue.selectedIndex].value=="<%= AppConstants.CV_VALUE %>") {
1036 <%              DataColumnType valueCol = rdef.getCrossTabValueColumn();
1037                 if((valueCol!=null)&&((currColumn==null)||(! currColumn.getColId().equals(valueCol.getColId())))) { 
1038                         // Report data column already defined 
1039 %>
1040                 alert("There is a column already designated for the report values.\nYou cannot have more than one column for that purpose.\nPlease change the Column Usage in Cross-Tab.");
1041                 document.forma.crossTabValue.focus();
1042                 
1043                 return false;
1044 <%              } else if(! isSQLBased) { %>
1045                 if(document.forma.exprFormula.selectedIndex==0) {
1046                         alert("The column designated for the report values must be an expression.\nPlease change the Column Type and select Expression.");
1047                         document.forma.exprFormula.focus();
1048                         
1049                         return false;
1050                 }
1051 <%              } %>
1052         } else {
1053                 verifyCrossTabDrillDown();
1054                 verifyCrossTabSemaphore();
1055         }
1056 <%      } %>
1057
1058 if(document.forma.displayWidth!=null && document.forma.displayWidth.options.selectedIndex == 0) {
1059         if(!checkNonNegativeInteger(document.forma.displayWidth.options[document.forma.displayWidth.options.selectedIndex].text)) {
1060                 alert("Please enter positive number greater than 1% in \"Display Width\". No Characters are allowed.");
1061                 return false;
1062         } else {
1063 /*                              if(eval(document.forma.displayWidth.options[document.forma.displayWidth.options.selectedIndex].text) < 10) {
1064                         alert("Please enter positive number less than 10% in \"Desired Container Height\". No Characters are allowed.");
1065                         return false;
1066                 }
1067 */                              
1068                 if(eval(document.forma.displayWidth.options[document.forma.displayWidth.options.selectedIndex].text) > 100) {
1069                         alert("Please enter positive number less than 100% in \"Display Width\". No Characters are allowed.");
1070                         return false;
1071                 }
1072                 document.forma.displayWidth.options[document.forma.displayWidth.options.selectedIndex].value=document.forma.displayWidth.options[document.forma.displayWidth.options.selectedIndex].text;
1073         }
1074 }
1075
1076         if(document.forma.displayName.value=="")
1077         <% if(isEdit) { %>
1078                 document.forma.displayName.value = "<%= currColumn.getDisplayName() %>";
1079         <% } else { %>
1080                 document.forma.displayName.value = document.forma.tableName.options[document.forma.tableName.selectedIndex].text.substr(document.forma.tableName.options[document.forma.tableName.selectedIndex].text.indexOf('.')+1);
1081         <% } %>
1082
1083 <% if(reportCols.size()>0) { %>
1084         if(false
1085 <%              for(Iterator iter=reportCols.iterator(); iter.hasNext(); ) { 
1086                     DataColumnType dc = (DataColumnType) iter.next();
1087                         
1088                         if(! (isEdit&&dc.getColId().equals(currColumn.getColId()))) { %>
1089                             ||(document.forma.displayName.value=="<%= dc.getDisplayName() %>")
1090 <%                  }
1091                 } %>
1092            ) {
1093                 alert("A column with display name "+document.forma.displayName.value+" already exists.\nPlease select another name.");
1094                 document.forma.displayName.focus();
1095                 document.forma.displayName.select();
1096                 
1097                 return false;
1098         }
1099 <% } %>
1100  
1101         return true;
1102 }   // dataValidate
1103 //-->
1104 showDisplayFormats();
1105 showImageOptions();
1106 </script> 
1107
1108 <%!
1109         private String nvl(String s)                  { return (s==null)?"":s; }
1110         private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; } 
1111         private String getRequestParam(String s) {
1112                 if(nvl(s).equals("")) return s;
1113                 else {
1114                         String requestParam="";
1115                         int pos = 0;
1116                         int iCnt = 0;
1117                         while(s.indexOf("#",pos)!=-1) {
1118                                 iCnt++;
1119                                 if(iCnt>1) requestParam += "|";
1120                                 pos = s.indexOf("#",pos)+1;
1121                                 requestParam += s.substring(s.indexOf("#")+1,s.indexOf("]",pos));
1122                         }
1123                         return requestParam;
1124                 }
1125
1126         } 
1127 %>