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="org.openecomp.portalsdk.analytics.xmlobj.DataColumnType" %>
21 <%@ page import="org.openecomp.portalsdk.analytics.util.AppConstants" %>
22 <%@ page import="org.openecomp.portalsdk.analytics.model.definition.ReportDefinition" %>
23 <%@ page import="org.openecomp.portalsdk.analytics.system.AppUtils" %>
24 <%@ page import="org.openecomp.portalsdk.analytics.controller.WizardSequence" %>
25 <%@ page import="java.util.List" %>
26 <%@ page import="java.util.Iterator" %>
27 <%@ page import="org.openecomp.portalsdk.analytics.system.Globals" %>
28 <%@ page import="org.openecomp.portalsdk.analytics.util.Utils" %>
29 <%@ page import="java.util.Vector" %>
30 <%@ page import="org.openecomp.portalsdk.analytics.model.ReportLoader" %>
31 <%@ page import="org.openecomp.portalsdk.analytics.model.base.IdNameValue" %>
32 <%@ page import="org.openecomp.portalsdk.analytics.xmlobj.FormFieldType" %>
33 <%@ page import="org.openecomp.portalsdk.analytics.model.base.ReportWrapper" %>
34 <%@ page import="org.openecomp.portalsdk.analytics.model.DataCache" %>
35 <%@ page import="org.openecomp.portalsdk.analytics.model.runtime.FormField" %>
36 <%@ page import="java.text.SimpleDateFormat"%>
38 ReportDefinition rdef = (ReportDefinition) request.getAttribute(AppConstants.SI_REPORT_DEFINITION);
39 WizardSequence ws = rdef.getWizardSequence();
40 String curSubStep = ws.getCurrentSubStep();
41 String reportID = rdef.getReportID();
42 boolean isCrossTab = rdef.getReportType().equals(AppConstants.RT_CROSSTAB);
43 boolean isSQLBased = rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED);
44 String dependsOnHelp = "Custom SQL can be defined";
47 <% String[] dateFormats = { "MM/DD/YYYY", "MM/YYYY", "DD-MON-YYYY", "Month DD, YYYY", "Month, YYYY" };
48 String[] charFormats = { "N/A" };
50 boolean isEdit = curSubStep.equals(AppConstants.WSS_EDIT);
51 FormFieldType currField = null;
53 currField = rdef.getFormFieldById(AppUtils.getRequestNvlValue(request, AppConstants.RI_DETAIL_ID));
55 String currColId = (currField!=null)?nvl(currField.getColId()):"";
56 String remoteDbPrefix = (String) session.getAttribute("remoteDB");
58 String colTableName = null;
59 String colColumnName = null;
60 String colDisplayFormat = null;
61 String colDisplayName = null;
63 if(currColId.length()>0) {
64 colTableName = ReportWrapper.getSQLBasedFFTColTableName(currColId);
65 colColumnName = ReportWrapper.getSQLBasedFFTColColumnName(currColId);
66 colDisplayFormat = ReportWrapper.getSQLBasedFFTColDisplayFormat(currColId);
68 if(currColId.indexOf("|")>=0)
69 currColId = currColId.substring(0, currColId.indexOf('|'));
70 colDisplayName = colColumnName;
71 //colDisplayName = currColId.substring(currColId.indexOf('.')+1);
74 <script language="JavaScript" src="<%= AppUtils.getBaseFolderURL() %>js/editabledropdown.js"></script>
75 <script language="JavaScript">
78 var fieldColName = "";
80 function toggleDiv(isChecked) {
82 if(document.getElementById('showDefaultSql'))
83 document.getElementById('showDefaultSql').style.display="";
84 if(document.getElementById('showDefaultValue'))
85 document.getElementById('showDefaultValue').style.display="none";
86 if(document.forma.defaultValue)
87 document.forma.defaultValue.value="";
89 if(document.getElementById('showDefaultSql'))
90 document.getElementById('showDefaultSql').style.display="none";
91 if(document.getElementById('showDefaultValue'))
92 document.getElementById('showDefaultValue').style.display="";
93 if(document.getElementById('showDefaultSql') && document.forma.fieldDefaultSQL)
94 document.forma.fieldDefaultSQL.value="";
99 function toggleFieldTypeSelection() {
100 var selectBox = document.forma.fieldType;
101 var selectedString = "";
103 selectedString = selectBox.options[selectBox.selectedIndex].value;
105 <% if(currField!=null) { %>
106 selectString = '<%=currField.getFieldType()%>';
110 if(selectedString == '<%= FormField.FFT_LIST_MULTI %>'){
111 document.getElementById('multiSelectListSizeDiv').style.display="block";
113 document.getElementById('multiSelectListSizeDiv').style.display="none";
114 document.getElementById('multiSelectListSize').value="4";
118 <% if(isSQLBased) { %>
119 function showTableColsPopup() {
120 var w = window.open("<%= AppUtils.getRaptorActionURL() %>report.popup.table.cols&single_value=Y&return_table_name=Y&return_col_type=Y&remoteDbPrefix=<%=remoteDbPrefix%>", "tableColsPopup", "width=450,height=330,location=no,menubar=no,toolbar=no,status=no,resizable=yes,scrollbars=yes");
123 } // showTableColsPopup
125 function setDisplayTypeValues(dbType) {
126 if(document.forma.colType.value!=dbType) {
127 document.forma.colType.value = dbType;
129 document.forma.displayFormat.options.length = 0;
131 if(document.forma.colType.value=="<%= AppConstants.CT_DATE %>") {
132 <% for(int i=0; i<dateFormats.length; i++) { %>
133 document.forma.displayFormat.options[<%= i %>] = new Option("<%= dateFormats[i] %>", "<%= dateFormats[i] %>");
136 <% for(int i=0; i<charFormats.length; i++) { %>
137 document.forma.displayFormat.options[<%= i %>] = new Option("<%= charFormats[i] %>", "<%= charFormats[i].equals("N/A")?"":charFormats[i] %>");
141 document.forma.displayFormat.selectedIndex = 0;
146 } // setDisplayTypeValues
148 function addText(newValue) {
150 if(newValue.indexOf("|")<0)
153 setDisplayTypeValues(newValue.substring(newValue.lastIndexOf("|")+1));
154 newText = newValue.substring(0, newValue.lastIndexOf("|"));
157 document.getElementById('fieldColId').value = newText;
159 var newFieldColName = "";
160 newFieldColName = newText.substring(newText.lastIndexOf(".")+1);
162 if(document.getElementById('fieldName').value==""||document.getElementById('fieldName').value==fieldColName)
163 document.getElementById('fieldName').value = newFieldColName;
164 fieldColName = newFieldColName;
167 function clearText() {
168 document.getElementById('fieldColId').value = "";
172 function changeColId() {
173 var newFieldColName = document.getElementById('fieldColId').options[document.getElementById('fieldColId').selectedIndex].text;
174 if(document.getElementById('fieldColId').selectedIndex>0&&(document.getElementById('fieldName').value==""||document.getElementById('fieldName').value==fieldColName))
175 document.getElementById('fieldName').value = newFieldColName;
176 fieldColName = newFieldColName;
179 function showDefaultValuePopup() {
180 if(document.getElementById('fieldColId').selectedIndex==0) {
181 alert("The assistance is available only if this field is based on a column.\nYou can select a column from the list or just type a default value.");
182 document.getElementById('fieldColId').focus();
186 var colId = document.getElementById('fieldColId').options[document.getElementById('fieldColId').selectedIndex].value;
188 var w = window.open("<%= AppUtils.getRaptorActionURL() %>report.popup.filter.data&<%= AppConstants.RI_ARG_TYPE %>=<%= AppConstants.AT_VALUE %>&<%= AppConstants.RI_COLUMN_ID %>="+colId+"&<%= AppConstants.RI_JS_TARGET_FIELD %>=document.forma.defaultValue&<%= AppConstants.RI_RESET_PARAMS %>=Y", "defaultValuePopup", "width=440,height=400,location=no,menubar=no,toolbar=no,status=no,resizable=yes,scrollbars=yes");
191 } // showDefaultValuePopup
192 <% } // else if(isSQLBased)
195 function showTestRunSQLPopup() {
196 //var w = window.open("<%= AppUtils.getRaptorActionURL() %>report.popup.testrun.sql&<%= AppConstants.RI_FORMATTED_SQL %>="+escape(""+document.getElementById('fieldSQL').value)+"&<%= AppConstants.RI_CHK_FIELD_SQL %>=Y", "testRunSQLPopup", "width=450,height=330,location=no,menubar=no,toolbar=no,status=no,resizable=yes,scrollbars=yes");
197 var w = window.open("<%= AppUtils.getRaptorActionURL() %>report.field.testrun.jsp", "testRunSQLPopup", "width=450,height=330,location=no,menubar=no,toolbar=no,status=no,resizable=yes,scrollbars=yes");
200 } // showTestRunSQLPopup
202 function showTestRunDefaultSQLPopup() {
203 //var w = window.open("<%= AppUtils.getRaptorActionURL() %>report.popup.testrun.sql&<%= AppConstants.RI_FORMATTED_SQL %>="+escape(""+document.getElementById('fieldSQL').value)+"&<%= AppConstants.RI_CHK_FIELD_SQL %>=Y", "testRunSQLPopup", "width=450,height=330,location=no,menubar=no,toolbar=no,status=no,resizable=yes,scrollbars=yes");
204 var w = window.open("<%= AppUtils.getRaptorActionURL() %>report.field.default.testrun.jsp", "testRunSQLPopup", "width=450,height=330,location=no,menubar=no,toolbar=no,status=no,resizable=yes,scrollbars=yes");
207 } // showTestRunDefaultSQLPopup
209 function showStartDatetRunSQLPopup( ) {
210 var w = window.open("<%= AppUtils.getRaptorActionURL() %>report.field.date.start.testrun.jsp", "testRunSQLPopup", "width=450,height=330,location=no,menubar=no,toolbar=no,status=no,resizable=yes,scrollbars=yes");
213 } // showTestRunRangeSQLPopup
215 function showEndDateRunSQLPopup( ) {
216 var w = window.open("<%= AppUtils.getRaptorActionURL() %>report.field.date.end.testrun.jsp", "testRunSQLPopup", "width=450,height=330,location=no,menubar=no,toolbar=no,status=no,resizable=yes,scrollbars=yes");
220 function setDefaultVerifyFlag() {
221 document.forma.fieldDefaultSQLOrig.value = document.forma.fieldDefaultSQL.value;
222 } // setDefaultVerifyFlag
224 function setVerifyFlag() {
225 document.forma.fieldSQLOrig.value = document.getElementById('fieldSQL').value;
228 function showSQLInstructions() {
229 var w = window.open("", "instrPopup", "width=400,height=330,location=no,menubar=no,toolbar=no,status=no,resizable=yes,scrollbars=yes");
233 w.document.writeln("<html><head>");
234 w.document.writeln("<title>Form Field SQL Instructions</title>");
235 w.document.writeln("<link rel=stylesheet type=text/css href='<%= AppUtils.getBaseFolderURL() %>css/raptor.css'>");
236 w.document.writeln("</head><body>");
238 w.document.writeln("<table width=94% border=0 cellspacing=1 cellpadding=3 align=center>");
239 w.document.writeln(" <tr class=rbg1 height=30>");
240 w.document.writeln(" <td><b class=rtableheader>Form Field SQL Instructions</b></td>");
241 w.document.writeln(" </tr>");
242 w.document.writeln(" <tr class=rbg3 align=center valign=middle>");
243 w.document.writeln(" <td align=left valign=middle><font class=rtabletext>");
244 w.document.writeln(" The SQL result set must have a column <b>id</b> and a column <b>name</b>. ");
245 w.document.writeln(" If selecting date values in visual report, the <b>id</b> must be formatted <b>MM/DD/YYYY</b>; the <b>name</b> can use any display format. ");
246 w.document.writeln(" Example:<br><br><b>SELECT DISTINCT</b><br> ");
247 w.document.writeln(" TO_CHAR(t.start_date, 'MM/DD/YYYY') <b>id</b>,<br> ");
248 w.document.writeln(" TO_CHAR(t.start_date, 'Month YYYY') <b>name</b><br> ");
249 w.document.writeln(" <b>FROM</b><br> ");
250 w.document.writeln(" my_table t<br> ");
251 w.document.writeln(" <b>WHERE</b><br> ");
252 w.document.writeln(" t.start_date IS NOT NULL<br> ");
253 w.document.writeln(" <b>ORDER BY</b><br> ");
254 w.document.writeln(" t.start_date DESC");
255 w.document.writeln(" </font></td>");
256 w.document.writeln(" </tr>");
257 w.document.writeln(" <tr class=rbg1 height=30>");
258 w.document.writeln(" <td> </td>");
259 w.document.writeln(" </tr>");
260 w.document.writeln(" <tr>");
261 w.document.writeln(" <td align=center><br><input type=Submit class=Button value=Close onClick=\"window.close();\"></td>");
262 w.document.writeln(" </tr>");
263 w.document.writeln("</table>");
265 w.document.writeln("</body></html>");
267 } // showSQLInstructions
269 function showRangeSQLInstructions() {
270 var w = window.open("", "instrPopup", "width=400,height=330,location=no,menubar=no,toolbar=no,status=no,resizable=yes,scrollbars=yes");
274 w.document.writeln("<html><head>");
275 w.document.writeln("<title>Form Field Range SQL Instructions</title>");
276 w.document.writeln("<link rel=stylesheet type=text/css href='<%= AppUtils.getBaseFolderURL() %>css/raptor.css'>");
277 w.document.writeln("</head><body>");
279 w.document.writeln("<table width=94% border=0 cellspacing=1 cellpadding=3 align=center>");
280 w.document.writeln(" <tr class=rbg1 height=30>");
281 w.document.writeln(" <td><b class=rtableheader>Form Field Range SQL Instructions</b></td>");
282 w.document.writeln(" </tr>");
283 w.document.writeln(" <tr class=rbg3 align=center valign=middle>");
284 w.document.writeln(" <td align=left valign=middle><font class=rtabletext>");
285 w.document.writeln(" The SQL should ALWAYS return a valid Oralce date. If the return is not a valid date, the range will not be set.<br>");
286 w.document.writeln(" The SQL will always get precedence over the static values.<br>");
287 w.document.writeln(" ");
288 w.document.writeln(" Example:<br><br><b>SELECT</b> SYSDATE<br> ");
289 w.document.writeln(" <b>FROM</b> DUAL");
290 w.document.writeln(" </font></td>");
291 w.document.writeln(" </tr>");
292 w.document.writeln(" <tr class=rbg1 height=30>");
293 w.document.writeln(" <td> </td>");
294 w.document.writeln(" </tr>");
295 w.document.writeln(" <tr>");
296 w.document.writeln(" <td align=center><br><input type=Submit class=Button value=Close onClick=\"window.close();\"></td>");
297 w.document.writeln(" </tr>");
298 w.document.writeln("</table>");
300 w.document.writeln("</body></html>");
302 } // showRangeSQLInstructions
307 <table width="100%" class="tableBorder" border="0" cellspacing="1" cellpadding="3" align=center>
309 <td class=rbg1 colspan=2 valign="Middle"><b class=rtableheader>Step <%= ws.getCurrentStepIndex() %> of <%= ws.getStepCount() %> - Report <%= ws.getCurrentStep() %> - <%= curSubStep %></b></td>
312 <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>Field Name: </font></td>
313 <td class=rbg3 align="left" width="50%"><font class=rtabletext>
314 <input type="text" style="width: 100px;" class="rtabletext" size="30" maxlength="30" id="fieldName" name="fieldName" value="<%= isEdit?currField.getFieldName():"" %>"></font></td>
317 <td class=rbg2 align="right" height="30"><font class=rtabletext>Based On Column: </font></td>
318 <td class=rbg3 align="left" nowrap><font class=rtabletext>
319 <% if(isSQLBased) { %>
320 <input type=text style="width: 100px;" class="rtabletext" size=50 id="fieldColId" name="fieldColId" value="<%= currColId %>" onFocus="blur()">
321 <a href="javascript:showTableColsPopup()"><img border=0 src="<%= AppUtils.getImgFolderURL() %>shareicon.gif" alt="Select database column" width=12 height=12></a>
323 <select name="fieldColId" class="rtabletext" onChange="changeColId()" style="width: 100px;" >
324 <option value=""<%= currColId.equals("")?" selected":"" %>>--- None ---
326 List reportCols = rdef.getAllColumns();
327 for(Iterator iter=reportCols.iterator(); iter.hasNext(); iCount++) {
328 DataColumnType dct = (DataColumnType) iter.next(); %>
329 <option value="<%= dct.getColId() %>"<%= currColId.equals(dct.getColId())?" selected":"" %>><%= dct.getDisplayName() %>
330 <% if(currColId.equals(dct.getColId()))
331 colDisplayName = dct.getDisplayName();
335 <% } // else if(isSQLBased)
336 if(colDisplayName!=null) { %>
337 <script language="JavaScript">
339 fieldColName = "<%= colDisplayName %>";
348 String colType = AppConstants.CT_CHAR;
349 if(colTableName!=null&&colColumnName!=null)
351 colType = nvl(DataCache.getReportTableDbColumnType(colTableName, colColumnName,((String) session.getAttribute("remoteDB"))), AppConstants.CT_CHAR);
352 } catch(Exception e) {}
355 if(colType.equals(AppConstants.CT_DATE))
358 fmt = charFormats; %>
360 <td class=rbg2 align="right" height="30"><font class=rtabletext>Display Format: </font></td>
361 <td class=rbg3 align="left"><font class=rtabletext>
362 <select name="displayFormat" style="width: 100px;" >
363 <% for(int i=0; i<fmt.length; i++) { %>
364 <option value="<%= fmt[i].equals("N/A")?"":fmt[i] %>"<%= (nvl(colDisplayFormat).toUpperCase().equals(fmt[i].toUpperCase()))?" selected":"" %>><%= fmt[i] %>
367 <input type="hidden" name="colType" value="<%= colType %>">
374 <td class=rbg2 align="right" height="30"><font class=rtabletext>Visible? </font></td>
375 <td class=rbg3 align="left"><font class=rtabletext>
376 <select name="visible" style="width: 100px;" >
377 <option value="Y"<%= isEdit?(nvl(currField.getVisible(),"Y").startsWith("Y")?" selected":""):" selected" %>>Yes
378 <option value="N"<%= (isEdit&&(! nvl(currField.getVisible(),"Y").startsWith("Y")))?" selected":"" %>>No
379 </select></font></td>
381 <% if(Globals.getAllowSQLBasedReports() || AppUtils.isAdminUser(request)) { %>
383 <td class=rbg2 height="30" align="right">
384 <font class=rtabletext>Is used in Group By Clause?</font>
386 <td class=rbg3 align="left" nowrap>
387 <input type="checkbox" name="isGroupFormField" value="Y" <%=(currField!=null && (currField.isGroupFormField()!=null && currField.isGroupFormField().booleanValue()))?" checked":"" %>>
394 <td class=rbg2 align="right" height="30"><font class=rtabletext>Field Type: </font></td>
395 <td class=rbg3 align="left"><font class=rtabletext>
396 <% String curValue = nvl((currField!=null)?currField.getFieldType():"", FormField.FFT_TEXT_W_POPUP); %>
397 <select name="fieldType" onChange="toggleFieldTypeSelection()" style="width: 100px;" >
398 <%--<option value="<%= FormField.FFT_TEXT_W_POPUP %>"<%= curValue.equals(FormField.FFT_TEXT_W_POPUP)?" selected":"" %>>Text Box with Popup --%>
399 <option value="<%= FormField.FFT_TEXT %>"<%= curValue.equals(FormField.FFT_TEXT )?" selected":"" %>>Text Box
400 <%--<option value="<%= FormField.FFT_TEXTAREA %>"<%= curValue.equals(FormField.FFT_TEXTAREA )?" selected":"" %>>Text Area--%>
401 <%--<option value="<%= FormField.FFT_COMBO_BOX %>"<%= curValue.equals(FormField.FFT_COMBO_BOX )?" selected":"" %>>Drop-Down List--%>
402 <option value="<%= FormField.FFT_LIST_BOX %>"<%= curValue.equals(FormField.FFT_LIST_BOX )?" selected":"" %>>List Box
403 <%--<option value="<%= FormField.FFT_RADIO_BTN %>"<%= curValue.equals(FormField.FFT_RADIO_BTN )?" selected":"" %>>Radio Buttons
404 <option value="<%= FormField.FFT_CHECK_BOX %>"<%= curValue.equals(FormField.FFT_CHECK_BOX )?" selected":"" %>>Check Boxes --%>
405 <option value="<%= FormField.FFT_LIST_MULTI %>"<%= curValue.equals(FormField.FFT_LIST_MULTI )?" selected":"" %>>Multi-select List Box
406 <option value="<%= FormField.FFT_HIDDEN %>"<%= curValue.equals(FormField.FFT_HIDDEN )?" selected":"" %>>Hidden
411 <tr id="multiSelectListSizeDiv">
412 <td class=rbg2 align="right" height="30"><font class=rtabletext>Visible Size: </font></td>
413 <td class=rbg3 align="left"><font class=rtabletext>
414 <select id="multiSelectListSize" name="multiSelectListSize" onKeyDown="fnKeyDownHandler(this, event);" onKeyUp="fnKeyUpHandler_A(this, event); return false;" onKeyPress = "return fnKeyPressHandler_A(this, event);" onChange="fnChangeHandler_A(this, event);">
415 <option value="1"<%= (currField!=null && nvl(currField.getMultiSelectListSize(), "4").equals("1")?" selected":"" )%>>1
416 <option value="2"<%= (currField!=null && nvl(currField.getMultiSelectListSize(), "4").equals("2")?" selected":"" )%>>2
417 <option value="3"<%= (currField!=null && nvl(currField.getMultiSelectListSize(), "4").equals("3")?" selected":"" )%>>3
418 <option value="4"<%= (currField!=null && nvl(currField.getMultiSelectListSize(), "4").equals("4")?" selected":"" )%>>4
419 <option value="5"<%= (currField!=null && nvl(currField.getMultiSelectListSize(), "4").equals("5")?" selected":"" )%>>5
420 <option value="6"<%= (currField!=null && nvl(currField.getMultiSelectListSize(), "4").equals("6")?" selected":"" )%>>6
421 <option value="7"<%= (currField!=null && nvl(currField.getMultiSelectListSize(), "4").equals("7")?" selected":"" )%>>7
422 <option value="8"<%= (currField!=null && nvl(currField.getMultiSelectListSize(), "4").equals("8")?" selected":"" )%>>8
423 <option value="9"<%= (currField!=null && nvl(currField.getMultiSelectListSize(), "4").equals("9")?" selected":"" )%>>9
424 <option value="10"<%= (currField!=null && nvl(currField.getMultiSelectListSize(), "4").equals("10")?" selected":"" )%>>10
425 <option value="" style="COLOR:#ff0000;BACKGROUND-COLOR:#ffff00;">Custom</option> <!-- This is the Editable Option -->
426 <% if(currField!=null && isNumber(nvl(currField.getMultiSelectListSize())) && new Integer(nvl(currField.getMultiSelectListSize(), "0")).intValue() <= 20) {
428 <option value="<%=nvl(currField.getMultiSelectListSize())%>" selected><%=nvl(currField.getMultiSelectListSize())%></option> <!-- This is the Editable Option -->
436 <%if(! isSQLBased) { %>
438 <td class=rbg2 align="right" height="30"><font class=rtabletext>Default Value: </font></td>
439 <td class=rbg3 align="left"><font class=rtabletext>
440 <input type="text" class="rtabletext" size="20" maxlength="50" name="defaultValue" value="<%= isEdit?nvl(currField.getDefaultValue()):"" %>"></font>
441 <a href="javascript:showDefaultValuePopup()"><img border="0" src="<%= AppUtils.getImgFolderURL() %>shareicon.gif" alt="Select from list" width="12" height="12"></a>
444 <% if(Globals.getAllowSQLBasedReports() || AppUtils.isAdminUser(request)) { %>
447 <td class=rbg2 height="30" align="right">
448 <font class=rtabletext>Is Default Value should be SQL</font>
450 <td class=rbg3 align="left" nowrap>
451 <input type="checkbox" id="isDefaultSQL" name="isDefaultSQL" value="N" <%=currField!=null && currField.getFieldDefaultSQL()!=null && currField.getFieldDefaultSQL().length()>0?" checked":"" %> onClick="toggleDiv(this.checked)">
456 <tbody id="showDefaultSql" style="display:none;">
458 <td class=rbg2 height="30" align="right">Default SQL: </td>
460 <table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td valign="top" rowspan="2">
461 <input type="hidden" name="fieldDefaultSQLOrig" value="<%= (currField!=null)?nvl(currField.getFieldDefaultSQL()):"" %>">
462 <textarea class="buttonLabelField" name="fieldDefaultSQL" cols="40" rows="3"><%= (currField!=null)?nvl(currField.getFieldDefaultSQL()):"" %></textarea>
464 <td align="center" valign="top"> <input type="Button" att-button btn-type="primary" size="small" class=button value="Verify SQL" onClick="if(document.forma.fieldDefaultSQL.value=='') {alert('Please provide SQL.'); return false; } showTestRunDefaultSQLPopup();"> </td>
465 <td rowspan="2" width="60%"> </td></tr><tr>
466 <td align="center" valign="middle"> <a href="javascript:showSQLInstructions()" class=rtabletext>Instructions</a> </td>
471 <% if(Globals.getAllowSQLBasedReports() || AppUtils.isAdminUser(request)) { %>
472 <script language="Javascript">
473 toggleDiv(document.getElementById('isDefaultSQL').checked);
476 <% } // if admin user %>
477 <tbody id="showDefaultValue">
479 <td class=rbg2 height="30" align="right"> Default Value: </td>
481 <table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td valign="top" rowspan="2">
482 <input type="text" style="width:200px" class="rtabletext" size="20" maxlength="50" name="defaultValue" value="<%= isEdit?nvl(currField.getDefaultValue()):"" %>"></font>
488 <% if(Globals.getAllowSQLBasedReports() || AppUtils.isAdminUser(request)) { %>
489 <script language="Javascript">
490 toggleDiv(document.getElementById('isDefaultSQL').checked);
495 <td class=rbg2 align="right" height="30"><font class=rtabletext>Verify Field Value As: </font></td>
496 <td class=rbg3 align="left"><font class=rtabletext>
497 <% curValue = nvl((currField!=null)?currField.getValidationType():"", FormField.VT_NONE); %>
498 <select name="validation" onChange="if (this.value =='<%= FormField.VT_DATE%>') ; else dateRangeRow.style.display='none'" style="width: 200px;" >
499 <option value="<%= FormField.VT_NONE %>"<%= curValue.equals(FormField.VT_NONE )?" selected":"" %>>--- Do Not Perform Validation ---
500 <option value="<%= FormField.VT_DATE %>"<%= curValue.equals(FormField.VT_DATE )?" selected":"" %>>Date
501 <option value="<%= FormField.VT_TIMESTAMP_HR %>"<%= curValue.equals(FormField.VT_TIMESTAMP_HR )?" selected":"" %>>TimeStamp (Hour)
502 <option value="<%= FormField.VT_TIMESTAMP_MIN %>"<%= curValue.equals(FormField.VT_TIMESTAMP_MIN )?" selected":"" %>>TimeStamp (Hour, Min)
503 <option value="<%= FormField.VT_TIMESTAMP_SEC %>"<%= curValue.equals(FormField.VT_TIMESTAMP_SEC )?" selected":"" %>>TimeStamp (Hour, Min, Sec)
504 <option value="<%= FormField.VT_INT %>"<%= curValue.equals(FormField.VT_INT )?" selected":"" %>>Integer
505 <option value="<%= FormField.VT_INT_NON_NEGATIVE %>"<%= curValue.equals(FormField.VT_INT_NON_NEGATIVE )?" selected":"" %>>Positive Integer
506 <option value="<%= FormField.VT_INT_POSITIVE %>"<%= curValue.equals(FormField.VT_INT_POSITIVE )?" selected":"" %>>Positive Integer, Cannot Be Zero
507 <option value="<%= FormField.VT_FLOAT %>"<%= curValue.equals(FormField.VT_FLOAT )?" selected":"" %>>Any Number
508 <option value="<%= FormField.VT_FLOAT_NON_NEGATIVE %>"<%= curValue.equals(FormField.VT_FLOAT_NON_NEGATIVE)?" selected":"" %>>Positive Number
509 <option value="<%= FormField.VT_FLOAT_POSITIVE %>"<%= curValue.equals(FormField.VT_FLOAT_POSITIVE )?" selected":"" %>>Positive Number, Cannot Be Zero
513 <tr id="dateRangeRow" <%if(curValue.equals(FormField.VT_DATE) || curValue.equals(FormField.VT_TIMESTAMP_HR) || curValue.equals(FormField.VT_TIMESTAMP_MIN) || curValue.equals(FormField.VT_TIMESTAMP_SEC)){%><%}else{%>style="display:none"<%}%>>
514 <td colspan="2" class=rbg2>
517 <td class=rbg2 align="right" width="33%" height="30"><font class=rtabletext>Valid Date Range: </font></td>
518 <td width="15%" align="left">
519 <font class=rtabletext >From </font>
522 <font class=rtabletext >To </font>
523
524 <a href="javascript:showRangeSQLInstructions()" class=rtabletext>Instructions</a>
529 <td class=rbg2 align="right"></td>
531 <td width="15%" align="left">
532 <input type="hidden" name="rangeStartDateSQLOrig" value="<%= (currField!=null)?nvl(currField.getRangeStartDateSQL()):"" %>">
533 <textarea name="rangeStartDateSQL" class="rtabletext" style="width: 200px;height: 100px" cols="20" rows="3"><%= (currField!=null)?nvl(currField.getRangeStartDateSQL()):"" %></textarea>
537 <input type="hidden" name="rangeEndDateSQLOrig" value="<%= (currField!=null)?nvl(currField.getRangeEndDateSQL()):"" %>">
538 <textarea name="rangeEndDateSQL" class="rtabletext" style="width: 200px;height: 100px" cols="20" rows="3"><%= (currField!=null)?nvl(currField.getRangeEndDateSQL()):"" %></textarea>
543 <td class=rbg2 align="right"></td>
545 <td width="15%" align="left">
546 <input type="Button" class=button att-button btn-type="primary" size="small" value="Verify SQL" onClick="if(document.forma.rangeStartDateSQL.value=='') {alert('Please provide SQL.'); return false; } showStartDatetRunSQLPopup();"> </td>
549 <input type="Button" class=button att-button btn-type="primary" size="small" value="Verify SQL" onClick="if(document.forma.rangeEndDateSQL.value=='') {alert('Please provide SQL.'); return false; } showEndDateRunSQLPopup();"> </td>
553 <td class=rbg2 align="right"></td>
554 <td class=rbg3 align="left">
555 <% String stDate = "";
558 && currField.getRangeStartDate() != null && currField.getRangeStartDate().equals("") == false
559 && currField.getRangeEndDate() != null && currField.getRangeEndDate().equals("") == false){
560 SimpleDateFormat dtf = new SimpleDateFormat("MM/dd/yyyy");
561 stDate = dtf.format(currField.getRangeStartDate().toGregorianCalendar().getTime());
562 endDate = dtf.format(currField.getRangeEndDate().toGregorianCalendar().getTime());
565 <input type="text" class="rtabletext" size="10" maxlength="10" style="width: 100px;" name="rangeStartDate" id="rangeStartDate" value="<%=stDate%>">
566 <img src="<%= AppUtils.getImgFolderURL() %>calender_icon.gif" align=absmiddle border=0 width="20" height="20" onClick="oCalendar.select(document.getElementById('rangeStartDate'),event,'MM/dd/yyyy'); return false;" style="cursor:hand">
571 <input type="text" class="rtabletext" size="10" maxlength="10" style="width: 100px;" name="rangeEndDate" id="rangeEndDate" value="<%=endDate%>">
572 <img src="<%= AppUtils.getImgFolderURL() %>calender_icon.gif" align=absmiddle border=0 width="20" height="20" onClick="oCalendar.select(document.getElementById('rangeEndDate'),event,'MM/dd/yyyy'); return false;" style="cursor:hand">
581 <td class=rbg2 align="right" height="30"><font class=rtabletext> </font></td>
582 <td class=rbg3 align="left">
583 <% curValue = nvl((currField!=null)?currField.getMandatory():"", "N"); %>
584 <input type="Checkbox" class="checkbox" name="mandatory" value="Y"<%= curValue.equals("Y")?" checked":"" %>>
585 <font class=rtabletext>User must provide value for this field</font>
589 <td class=rbg2 align="right" height="30"><font class=rtabletext>Field Help Text: </font></td>
590 <td class=rbg3 align="left">
591 <textarea name="fieldHelp" style="width: 100px;" class="rtabletext" cols="40" rows="3"><%= (currField!=null)?nvl(currField.getComment()):"" %></textarea>
594 <% if(Globals.getAllowSQLBasedReports()||AppUtils.isAdminUser(request)) { %>
596 <td class=rbg2 align="right" height="30"><font class=rtabletext>SQL Generating Custom List of Values: <br>(overrides default list) </font></td>
597 <td class=rbg3 align="left">
598 <table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td valign="top" rowspan="2">
599 <input type="hidden" name="fieldSQLOrig" value="<%= (currField!=null)?nvl(currField.getFieldSQL()):"" %>">
600 <textarea id="fieldSQL" name="fieldSQL" class="rtabletext" cols="40" rows="3"><%= (currField!=null)?nvl(currField.getFieldSQL()):"" %></textarea>
602 <td align="center" valign="top"> <input type="Button" class=button att-button btn-type="primary" size="small" value="Verify SQL" onClick="if(document.getElementById('fieldSQL').value=='') {alert('Please provide SQL.'); return false; } showTestRunSQLPopup();"> </td>
603 <td rowspan="2" width="60%"> </td></tr><tr>
604 <td align="center" valign="middle"> <a href="javascript:showSQLInstructions()" class=rtabletext>Instructions</a> </td>
609 <td class=rbg2 align="right" height="30"></td>
610 <td class=rbg3 align="left">
611 <% curValue = nvl((currField!=null)?currField.getDependsOn():"", "N"); %>
612 <font class=rtabletext><input id='dependsOn' type="checkbox" name="dependsOn" value="Y"<%= curValue.equals("Y") ? "checked":"" %>>
613 <label title="<%=dependsOnHelp%>" style="cursor: pointer;" for="dependsOn">Depends on another Form Field.</label>
617 <input type="hidden" id="fieldSQL" name="fieldSQL" value="<%= (currField!=null)?nvl(currField.getFieldSQL()):"" %>">
619 <% List predefinedValues = (currField!=null&&currField.getPredefinedValueList()!=null)?currField.getPredefinedValueList().getPredefinedValue():null; %>
621 <td class=rbg2 align="right" height="30"><font class=rtabletext>Provide Predefined List of Values:</font></td>
622 <td class=rbg3 align="left" nowrap><font class=rtabletext>
623 <% if(predefinedValues==null||predefinedValues.size()==0) { %>
624 Do not use Predefined list - Generate list from database
626 String value = (String) predefinedValues.get(0); %>
628
629 <input type=image border="0" src="<%= AppUtils.getImgFolderURL() %>deleteicon.gif" alt="Remove" width="12" height="12" onClick="if(! dataValidate()) {return false;} else if(! confirm('Are you sure?')) {return false;} else {document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_DELETE_USER %>'; document.forma.delPredefinedValue.value='<%= value %>'; }">
633 <% if(predefinedValues!=null&&predefinedValues.size()>1)
634 for(int i=1; i<predefinedValues.size(); i++) {
635 String value = (String) predefinedValues.get(i); %>
637 <td class=rbg2 align="right" height="30"><font class=rtabletext> </font></td>
638 <td class=rbg3 align="left" nowrap><font class=rtabletext>
640
641 <input type=image border="0" src="<%= AppUtils.getImgFolderURL() %>deleteicon.gif" alt="Remove" width="12" height="12" onClick="if(! dataValidate()) {return false;} else if(! confirm('Are you sure?')) {return false;} else {document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_DELETE_USER %>'; document.forma.delPredefinedValue.value='<%= value %>'; }">
647 <td class=rbg2 align="right" height="30"><font class=rtabletext> </font></td>
648 <td class=rbg3 align="left" valign="middle" nowrap><font class=rtabletext>
649 <input type="hidden" name="delPredefinedValue" value="">
650 <input type="text" style="width: 200px;" size="20" maxlength="50" name="newPredefinedValue" value="">
651 <input type="Submit" att-button btn-type="primary" size="small" class=button value="Add To List" onClick="if(document.forma.newPredefinedValue.value=='') {alert('Value cannot be empty.'); return false; } if(! stepDataValidate(false)) return false; <%= (predefinedValues==null||predefinedValues.size()==0)?"if(! confirm('If you create a list of predefined values, it will be displayed instead of the list selected from the database.\\nAre you sure you want to do that?')) return false; ":"" %>document.forma.<%= AppConstants.RI_WIZARD_ACTION %>.value='<%= AppConstants.WA_ADD_USER %>';">
657 <script language="JavaScript">
659 function stepDataValidate(checkCol) {
660 if(document.getElementById('fieldName').value=="") {
661 alert("Please enter Field Name");
662 document.getElementById('fieldName').focus();
663 document.getElementById('fieldName').select();
668 <% if(rdef.getFormFieldList()!=null) { %>
670 <% for(Iterator iter=rdef.getFormFieldList().getFormField().iterator(); iter.hasNext(); ) {
671 FormFieldType fft = (FormFieldType) iter.next();
673 if(! (isEdit&&fft.getFieldId().equals(currField.getFieldId()))) { %>
674 ||(document.getElementById('fieldName').value=="<%= fft.getFieldName() %>")
678 alert("Form field with name "+document.getElementById('fieldName').value+" already exists.\nPlease select another name.");
679 document.getElementById('fieldName').focus();
680 document.getElementById('fieldName').select();
686 <% if(predefinedValues==null||predefinedValues.size()==0) { %>
688 if(document.getElementById('fieldColId').selectedIndex==0)
689 if(document.forma.fieldType.selectedIndex!=1&&document.forma.fieldType.selectedIndex!=2) {
690 alert("Field Type can be only Text Box or Text Area if this field is not based on a column.\nPlease change the Field Type or select a column from the list.");
691 document.forma.fieldType.focus();
697 <% if((Globals.getAllowSQLBasedReports()||AppUtils.isAdminUser(request)) && (rdef.getReportDefType().equals(AppConstants.RD_SQL_BASED))) { %>
698 if(document.forma.fieldSQL.value!=""&&document.forma.fieldSQL.value!=document.forma.fieldSQLOrig.value) {
699 alert("You must verify the SQL.");
700 document.forma.fieldSQL.focus();
701 document.forma.fieldSQL.select();
705 if(document.forma.fieldDefaultSQL.value!=""&&document.forma.fieldDefaultSQL.value!=document.forma.fieldDefaultSQLOrig.value) {
706 alert("You must verify the Default SQL.");
707 document.forma.fieldDefaultSQL.focus();
708 document.forma.fieldDefaultSQL.select();
712 if(document.forma.fieldSQL.value.length<=0 && document.forma.fieldDefaultSQL.value.length > 1 ) {
713 alert("SQL Field cannot be empty when Default sql has value.");
718 if(document.getElementById('multiSelectListSize') && document.getElementById('multiSelectListSize').options.selectedIndex == 0) {
719 if(!checkNonNegativeInteger(document.forma.multiSelectListSize.options[document.forma.multiSelectListSize.options.selectedIndex].text)) {
720 alert("Please enter number in Multi Select List Size. No Characters are allowed.");
723 if(document.getElementById('multiSelectListSize').options[document.getElementById('multiSelectListSize').options.selectedIndex].text>20) {
724 alert("Please not only 20 items are allowed in Multi-Select form field.");
727 document.getElementById('multiSelectListSize').options[document.getElementById('multiSelectListSize').options.selectedIndex].value=document.getElementById('multiSelectListSize').options[document.getElementById('multiSelectListSize').options.selectedIndex].text;
734 function dataValidate() {
735 return stepDataValidate(true);
738 toggleFieldTypeSelection();
742 <script type="text/javascript" src="<%= AppUtils.getBaseFolderURL() %>js/CalendarPopup.js"></script>
743 <link rel="stylesheet" type="text/css" href="<%= AppUtils.getBaseFolderURL() %>css/calendar.css">
744 <iframe id="calendarFrame" class="nav" z-index:199; scrolling="no" frameborder="0" width=165px height=165px src="" style="position:absolute; display:none;">
746 <div id="calendarDiv" name="calendarDiv" style="position:absolute; z-index:20000; visibility:hidden; background-color:white;layer-background-color:white;"></div>
748 <SCRIPT LANGUAGE="JavaScript">
749 var oCalendar = new CalendarPopup("calendarDiv", "calendarFrame");
750 oCalendar.setCssPrefix("raptor");
755 private String nvl(String s) { return (s==null)?"":s; }
756 private String nvl(String s, String sDefault) { return nvl(s).equals("")?sDefault:s; }
757 private boolean isNumber(String value) { // As per Raptor def, like
760 value = value.trim();
761 if(value.length()>2) return false;
762 for (int i = 0; i < value.length(); i++) {
763 char c = value.charAt(i);
764 if (!(Character.isDigit(c) || c == '.' || c == '-' || c == '+' || c == ','
765 || c == '$' || c == '%'))