/*
* ============LICENSE_START==========================================
* ONAP Portal SDK
* ===================================================================
* Copyright © 2017 AT&T Intellectual Property. All rights reserved.
* ===================================================================
*
* Unless otherwise specified, all software contained herein is licensed
* under the Apache License, Version 2.0 (the “License”);
* you may not use this software except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Unless otherwise specified, all documentation contained herein is licensed
* under the Creative Commons License, Attribution 4.0 Intl. (the “License”);
* you may not use this documentation except in compliance with the License.
* You may obtain a copy of the License at
*
* https://creativecommons.org/licenses/by/4.0/
*
* Unless required by applicable law or agreed to in writing, documentation
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* ============LICENSE_END============================================
*
* ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
/* ===========================================================================================
* This class is part of RAPTOR (Rapid Application Programming Tool for OLAP Reporting)
* Raptor : This tool is used to generate different kinds of reports with lot of utilities
* ===========================================================================================
*
* -------------------------------------------------------------------------------------------
* FormField.java - This class is used to generate all types of form field.
* -------------------------------------------------------------------------------------------
*
* Created By : Stan Pishamanov
* Modified & Maintained By : Sundar Ramalingam
*
* Changes
* -------
* 18-Aug-2009 : Version 8.5 (Sundar); Populating predefined formfields bug has been resolved.
* 13-Aug-2009 : Version 8.5 (RS); Form field chaining is supported even for hidden variables.
* 13-Aug-2009 : Version 8.5 (RS); Nothing changed just comment.
* 10-Aug-2009 : Version 9.0 (RS); required logic is added for Multiple Dropdown.
* 06-Aug-2009 : Version 9.0 (RS); B getAjaxHtml is added for converting form field chain from Iframe to AJAX.
* 08-Jun-2009 : Version 8.3 (RS); Hidden formfields now is displayed even when the sql is not provided.
*
*/
package org.onap.portalsdk.analytics.model.runtime;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.Map.Entry;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.swing.text.html.HTMLDocument.HTMLReader.HiddenAction;
import org.onap.portalsdk.analytics.error.RaptorException;
import org.onap.portalsdk.analytics.error.RaptorRuntimeException;
import org.onap.portalsdk.analytics.error.UserDefinedException;
import org.onap.portalsdk.analytics.model.base.*;
import org.onap.portalsdk.analytics.system.*;
import org.onap.portalsdk.analytics.util.*;
import org.onap.portalsdk.analytics.xmlobj.*;
public class FormField extends org.onap.portalsdk.analytics.RaptorObject implements Serializable {
private static final String HTML_FORM = "formd";
private String fieldName = null;
private String fieldDisplayName = null;
private String fieldType = FFT_TEXT_W_POPUP;
private String validationType = VT_NONE;
private boolean required = false;
public boolean hasPredefinedList = false;
private String defaultValue = null;
private Calendar rangeStartDate = null;
private Calendar rangeEndDate = null;
private String rangeStartDateSQL = null;
private String rangeEndDateSQL = null;
private String fieldDefaultSQL = null;
private String multiSelectListSize = null;
private String helpText = null;
private IdNameList lookupList = null;
private String dbInfo = null;
private String userId = null;
private boolean visible = true;
private String dependsOn = null;
private boolean triggerOtherFormFields = false;
private boolean triggerThisFormfield = false;
// Form field types
public static final String FFT_TEXT_W_POPUP = "TEXT_WITH_POPUP";
public static final String FFT_TEXT = "TEXT";
public static final String FFT_TEXTAREA = "TEXTAREA";
public static final String FFT_COMBO_BOX = "COMBO_BOX";
public static final String FFT_LIST_BOX = "LIST_BOX";
public static final String FFT_RADIO_BTN = "RADIO_BTN";
public static final String FFT_CHECK_BOX = "CHECK_BOX";
public static final String FFT_LIST_MULTI = "LIST_MULTI_SELECT";
public static final String FFT_HIDDEN = "HIDDEN";
public static final String FFT_BLANK = "BLANK";
// Validation types
public static final String VT_NONE = "NONE";
public static final String VT_DATE = "DATE";
public static final String VT_TIMESTAMP_HR = "TIMESTAMP_HR";
public static final String VT_TIMESTAMP_MIN = "TIMESTAMP_MIN";
public static final String VT_TIMESTAMP_SEC = "TIMESTAMP_SEC";
public static final String VT_INT = "INTEGER";
public static final String VT_INT_POSITIVE = "POSITIVE_INTEGER";
public static final String VT_INT_NON_NEGATIVE = "NON_NEGATIVE_INTEGER";
public static final String VT_FLOAT = "FLOAT";
public static final String VT_FLOAT_POSITIVE = "POSITIVE_FLOAT";
public static final String VT_FLOAT_NON_NEGATIVE = "NON_NEGATIVE_FLOAT";
private FormField(String fieldName, String fieldDisplayName, String fieldType,
String validationType, boolean required, String defaultValue, String helpText, boolean visible, String dependsOn, Calendar rangeStartDate, Calendar rangeEndDate,
String rangeStartDateSQL, String rangeEndDateSQL, String multiSelectListSize ) {
//super();
this (fieldName,fieldDisplayName,fieldType,validationType,required,defaultValue,helpText, dependsOn, rangeStartDate, rangeEndDate, rangeStartDateSQL, rangeEndDateSQL, multiSelectListSize);
setVisible(visible);
} // FormField
private FormField(String fieldName, String fieldDisplayName, String fieldType,
String validationType, boolean required, String defaultValue, String helpText, String dependsOn, Calendar rangeStartDate, Calendar rangeEndDate,
String rangeStartDateSQL, String rangeEndDateSQL, String multiSelectListSize ) {
super();
setFieldName(fieldName);
setFieldDisplayName(fieldDisplayName);
setFieldType(nvl(fieldType, FFT_TEXT));
setValidationType(validationType);
setRequired(required);
setDefaultValue(defaultValue);
setHelpText(helpText);
setDependsOn(dependsOn);
setRangeStartDate(rangeStartDate);
setRangeEndDate(rangeEndDate);
setRangeStartDateSQL(rangeStartDateSQL);
setRangeEndDateSQL(rangeEndDateSQL);
setMultiSelectListSize(multiSelectListSize);
}
public FormField(String fieldName, String fieldDisplayName, String fieldType,
String validationType, boolean required, String defaultValue, String helpText,
List predefinedValues, boolean visible, String dependsOn, Calendar rangeStartDate, Calendar rangeEndDate,
String rangeStartDateSQL, String rangeEndDateSQL, String multiSelectListSize) {
this(fieldName, fieldDisplayName, fieldType, validationType, required, defaultValue,
helpText,visible, dependsOn, rangeStartDate, rangeEndDate, rangeStartDateSQL, rangeEndDateSQL, multiSelectListSize);
if (predefinedValues != null)
setPredefinedListLookup(predefinedValues);
} // FormField
public FormField(String fieldName, String fieldDisplayName, String fieldType,
String validationType, boolean required, String defaultValue, String helpText,
String lookupSql, boolean visible, String dependsOn, Calendar rangeStartDate, Calendar rangeEndDate,
String rangeStartDateSQL, String rangeEndDateSQL, String multiSelectListSize ) {
this(fieldName, fieldDisplayName, fieldType, validationType, required, defaultValue,
helpText,visible, dependsOn, rangeStartDate, rangeEndDate, rangeStartDateSQL, rangeEndDateSQL, multiSelectListSize);
if (defaultValue!=null && defaultValue.length()>10 && defaultValue.substring(0,10).trim().toLowerCase().startsWith("select")) {
setFieldDefaultSQL(defaultValue);
setDefaultValue("");
}
setLookupList(new IdNameSql(lookupSql,defaultValue));
} // FormField
public FormField(String fieldName, String fieldDisplayName, String fieldType,
String validationType, boolean required, String defaultValue, String helpText,
String dbTableName, String dbIdField, String dbNameField, String dbSortByField, boolean visible, String dependsOn, Calendar rangeStartDate, Calendar rangeEndDate,
String rangeStartDateSQL, String rangeEndDateSQL, String multiSelectListSize) {
this(fieldName, fieldDisplayName, fieldType, validationType, required, defaultValue,
helpText,dbTableName,dbIdField,dbNameField,dbSortByField, dependsOn, rangeStartDate, rangeEndDate, rangeStartDateSQL, rangeEndDateSQL, multiSelectListSize);
setVisible(visible);
}
public FormField(String fieldName, String fieldDisplayName, String fieldType,
String validationType, boolean required, String defaultValue, String helpText,
String dbTableName, String dbIdField, String dbNameField, String dbSortByField, String dependsOn,
Calendar rangeStartDate, Calendar rangeEndDate,
String rangeStartDateSQL, String rangeEndDateSQL, String multiSelectListSize ) {
this(fieldName, fieldDisplayName, fieldType, validationType, required, defaultValue,
helpText,dependsOn, rangeStartDate, rangeEndDate, rangeStartDateSQL, rangeEndDateSQL, multiSelectListSize);
//if(dependsOn !=null){ this.dependsOn = dependsOn; }else { this.dependsOn = ""
if (defaultValue!=null && defaultValue.length()>10 && defaultValue.substring(0,10).trim().toLowerCase().startsWith("select")) {
setFieldDefaultSQL(defaultValue);
setDefaultValue("");
if(fieldType.equals(FFT_TEXT))
setLookupList(new IdNameLookup(dbTableName, dbIdField, dbNameField, dbSortByField,defaultValue,true));
else
setLookupList(new IdNameLookup(dbTableName, dbIdField, dbNameField, dbSortByField,defaultValue,false));
}
else {
if(fieldType.equals(FFT_TEXT))
setLookupList(new IdNameLookup(dbTableName, dbIdField, dbNameField, dbSortByField, true));
else
setLookupList(new IdNameLookup(dbTableName, dbIdField, dbNameField, dbSortByField, false));
}
this.setRangeStartDate(rangeStartDate);
this.setRangeEndDate(rangeEndDate);
this.setRangeStartDateSQL(rangeStartDateSQL);
this.setRangeEndDateSQL(rangeEndDateSQL);
} // FormField
private void setPredefinedListLookup(List predefinedValues) {
IdNameList lookup = new IdNameList();
for (Iterator iter = predefinedValues.iterator(); iter.hasNext();) {
String value = (String) iter.next();
lookup.addValue(value, value);
} // for
setHasPredefinedList(true);
setLookupList(lookup);
} // setPredefinedListLookup
public String getFieldName() {
return fieldName;
}
public String getFieldDisplayName() {
return fieldDisplayName;
}
public String getFieldType() {
return fieldType;
}
public String getValidationType() {
return validationType;
}
public boolean isRequired() {
return required;
}
public String getDefaultValue() {
return defaultValue;
}
public String getHelpText() {
return helpText;
}
public IdNameList getLookupList() {
return lookupList;
}
public void setFieldName(String fieldName) {
this.fieldName = fieldName;
}
public void setFieldDisplayName(String fieldDisplayName) {
this.fieldDisplayName = fieldDisplayName;
}
public void setFieldType(String fieldType) {
this.fieldType = fieldType;
}
public void setValidationType(String validationType) {
this.validationType = nvl(validationType, VT_NONE);
}
public void setRequired(boolean required) {
this.required = required;
}
public void setDefaultValue(String defaultValue) {
this.defaultValue = defaultValue;
}
public void setHelpText(String helpText) {
this.helpText = helpText;
}
public void setLookupList(IdNameList lookupList) {
this.lookupList = lookupList;
}
public void setDefaultList(IdNameList lookupList) {
this.lookupList = lookupList;
}
public String getBaseSQL() {
return (lookupList == null) ? null : lookupList.getBaseSQL();
} // getBaseSQL
public String getBaseWholeSQL() {
return (lookupList == null) ? null : lookupList.getBaseWholeSQL();
} // getBaseWholeSQL
public String getBaseWholeReadonlySQL() {
return (lookupList == null) ? null : lookupList.getBaseWholeReadonlySQL();
} // getBaseWholeReadonlySQL
public String getBaseSQLForPDFExcel() {
return (lookupList == null) ? null : lookupList.getBaseSQLForPDFExcel(getFieldType().equals(FFT_LIST_MULTI)||getFieldType().equals(FFT_CHECK_BOX)?true:false);
} // getBaseSQLForPDFExcel
public String getDisplayNameHtml() {
if (nvl(helpText).length() > 0)
return "" + fieldDisplayName + "";
else
return fieldDisplayName;
} // getDisplayNameHtml
/*public String getHtml() throws RaptorRuntimeException {
return getHtml("" , null, null, false);
} // getHtml*/
public String getHtml(String fieldValue, HashMap formValues, ReportRuntime rr)throws RaptorRuntimeException {
return getHtml(fieldValue,formValues, rr, false);
}
public String getHelpLink(String fieldName) {
//return "
";
return ((getHelpText()!=null && getHelpText().length()>0)? "tooltipText=\""+ getHelpText()+"\">": ">");
//return ((getHelpText()!=null && getHelpText().length()>0)? "
": "");
}
public String getCallableAfterChainingJavascript(String fieldName, ReportRuntime rr) {
JavascriptItemType javascriptItemType = null;
StringBuffer callJavascriptText = new StringBuffer("");
if(rr.getJavascriptList()!=null) {
for (Iterator iter = rr.getJavascriptList().getJavascriptItem().iterator(); iter.hasNext();) {
javascriptItemType = (JavascriptItemType)iter.next();
if(javascriptItemType.getFieldId().equals(fieldName)) {
if(nvl(javascriptItemType.getCallText()).toLowerCase().startsWith("afterchaining"))
callJavascriptText.append(" "+javascriptItemType.getCallText());
}
}
}
return callJavascriptText.toString()+" ";
}
public String getCallableJavascript(String fieldName, ReportRuntime rr) {
JavascriptItemType javascriptItemType = null;
StringBuffer callJavascriptText = new StringBuffer("");
if(rr.getJavascriptList()!=null) {
for (Iterator iter = rr.getJavascriptList().getJavascriptItem().iterator(); iter.hasNext();) {
javascriptItemType = (JavascriptItemType)iter.next();
if(javascriptItemType.getFieldId().equals(fieldName)) {
if(!nvl(javascriptItemType.getCallText()).toLowerCase().startsWith("afterchaining"))
callJavascriptText.append(" "+javascriptItemType.getCallText());
}
}
}
return callJavascriptText.toString()+" ";
}
public String getCallableOnChangeJavascript(String fieldName, ReportRuntime rr) {
String callText = getCallableJavascript(fieldName, rr);
if(callText != null && callText.trim().toLowerCase().indexOf("onchange")>=0) {
Pattern re1 = Pattern.compile("\\=(.*?)\\)");
Matcher matcher = re1.matcher(callText);
while (matcher.find()) {
callText = matcher.group();
if(callText!=null && callText.startsWith("=\"")) {
callText = callText.substring(2);
} else if (callText!=null)
callText = callText.substring(1);
}
callText = callText.replaceAll("this", "documentForm."+fieldName);
} else callText = null;
return callText;
}
public String getAjaxHtml(String fieldValue, HashMap formValues, ReportRuntime rr, boolean inSchedule) throws RaptorRuntimeException {
fieldValue = nvl(fieldValue, defaultValue);
String readOnly = "ff_readonly";
try {
if(fieldValue !=null && fieldValue.length() > 0)
fieldValue = java.net.URLDecoder.decode(fieldValue, "UTF-8");
} catch (UnsupportedEncodingException ex) {}
catch (IllegalArgumentException ex1){}
catch (Exception ex2){}
if (fieldType.equals(FFT_COMBO_BOX)) {
StringBuffer sb = new StringBuffer();
//System.out.println("COMBO BOX " + fieldName);
String oldSQL = "";
if (!required)
sb.append("obj.options[obj.options.length] = new Option('-->select value<--','');");
IdNameList lookup = getLookupList();
try {
if(!hasPredefinedList) {
//if(dependsOn != null && dependsOn != "") {
//if(dependsOn != null && dependsOn != "" ) {
IdNameSql lu = (IdNameSql) lookup;
String SQL = "";
SQL = lu.getSql();
/*if(nvl(fieldValue,"").length()<=0)
SQL = lu.getSql();
else
SQL = lu.getBaseSQLForPDFExcel(false);
*/
//System.out.println("FORMFIELD 6666667 First" + ((IdNameSql)lookup).getSql());
oldSQL = lu.getSql();
//SQL = Utils.replaceInString(SQL, "[VALUE]", fieldValue);
if(formValues != null) {
Set set = formValues.entrySet();
String value = "";
for(Iterator iter = set.iterator(); iter.hasNext(); ) {
Map.Entry entry = (Entry) iter.next();
value = (String) entry.getValue();
if(inSchedule) {
try {
value = java.net.URLDecoder.decode(Utils.oracleSafe(value), "UTF-8");
} catch (UnsupportedEncodingException ex) {
}
}
if (value!=null && (value.length() <=0 || value.equals("NULL"))) {
value = "NULL";
SQL = Utils.replaceInString(SQL, "'["+entry.getKey()+"]'", value);
SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", value);
} else {
SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", value);
}
}
lookup = new IdNameSql(-1,SQL,lu.getDefaultSQL());
}
//}
lookupList = lookup;
//}
try {
lookup.loadUserData(0, "", getDbInfo(), getUserId());
} catch (Exception e ){ e.printStackTrace(); //throw new RaptorRuntimeException(e);
}
}
lookup.trimToSize();
String selectedValue = "";
int count = 0;
for (lookup.resetNext(); lookup.hasNext();) {
IdNameValue value = lookup.getNext();
if(value != null && value.getId() != null && value.getName() != null ) {
/*if (count == 0 && required) {
selectedValue = value.getId();
count++;
} else if (nvl(fieldValue).length()>0){
if (fieldValue != null && fieldValue.equals(value.getId())){
selectedValue = value.getId();
}
count++;
} else {
count++;
} */
if (count == 0) {
if(required){
selectedValue = value.getId();
}
count++;
}
sb.append("obj.options[obj.options.length] = new Option('" + Utils.singleQuoteEncode(value.getName())+"','"+Utils.singleQuoteEncode(value.getId())+"');");
if ((fieldValue != null && fieldValue.equals(value.getId()))){
sb.append("obj.options[obj.options.length-1].selected=true;");
selectedValue = value.getId();
}
if(value.isReadOnly())
sb.append("obj.disabled=true;");
else
sb.append("obj.disabled=false;");
}
} // for
if (formValues.containsKey(fieldDisplayName)){
formValues.remove(fieldDisplayName);
}
formValues.put(fieldDisplayName, selectedValue);
} catch (Exception e) {
//throw new RaptorRuntimeException(e);
}
if(!hasPredefinedList) {
if(oldSQL != null && !oldSQL.equals("")) {
((IdNameSql)lookup).setSQL(oldSQL);
}
}
//System.out.println("FORMFIELD 6666667 " + ((IdNameSql)lookup).getSql());
if( isVisible())
return sb.toString();
else return "";
} else if (fieldType.equals(FFT_LIST_MULTI)) {
StringBuffer sb = new StringBuffer();
String oldSQL = "";
fieldValue = '|' + fieldValue + '|';
IdNameList lookup = getLookupList();
try {
if(!hasPredefinedList) {
//if(dependsOn != null && dependsOn != "") {
//if(dependsOn != null && dependsOn != "" ) {
IdNameSql lu = (IdNameSql) lookup;
String SQL = "";
SQL = lu.getSql();
/*if(nvl(fieldValue,"").length()<=0)
SQL = lu.getSql();
else
SQL = lu.getBaseSQLForPDFExcel(false);
SQL = Utils.replaceInString(SQL, "[VALUE]", fieldValue);
*/
oldSQL = lu.getSql();
if(formValues != null) {
Set set = formValues.entrySet();
String value = "";
for(Iterator iter = set.iterator(); iter.hasNext(); ) {
Map.Entry entry = (Entry) iter.next();
value = (String) entry.getValue();
if(inSchedule) { //('1347')
try {
value = java.net.URLDecoder.decode(value, "UTF-8");
} catch (UnsupportedEncodingException ex) {
}
}
SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", value);
}
lookup = new IdNameSql(-1,SQL,lu.getDefaultSQL());
}
//}
lookupList = lookup;
//}
lookup.loadUserData(0, "", getDbInfo(),getUserId());
}
for (lookup.resetNext(); lookup.hasNext();) {
IdNameValue value = lookup.getNext();
sb.append("obj.options[obj.options.length] = new Option('" + Utils.singleQuoteEncode(value.getName()) +"','"+Utils.singleQuoteEncode(value.getId())+"');");
if (fieldValue.indexOf('|' + value.getId() + '|') >= 0)
sb.append("obj.options[obj.options.length-1].selected=true;");
if(value.isReadOnly())
sb.append("obj.disabled=true;");
else
sb.append("obj.disabled=false;");
} // for
// lookup.clearData();
} catch (Exception e) {
//throw new RaptorRuntimeException(e);
}
if(!hasPredefinedList) {
if(oldSQL != null && !oldSQL.equals("")) {
((IdNameSql)lookup).setSQL(oldSQL);
}
}
if(isVisible())
return sb.toString();
else
return "";
} else if (fieldType.equals(FFT_TEXT_W_POPUP)) {
//System.out.println("TEXT POPUP " + fieldName);
String oldSQL = "";
IdNameValue idNamevalue = null;
String fieldDefValue="";
String fieldDefDisplay="";
try {
IdNameList lookup = getLookupList();
if(dependsOn != null && dependsOn != "" ) {
IdNameSql lu = (IdNameSql) lookup;
String SQL = getBaseWholeSQL();
if(SQL.toLowerCase().indexOf(readOnly) != -1) {
SQL = getBaseWholeReadonlySQL();
}
oldSQL = lu.getSql();
if(formValues != null) {
Set set = formValues.entrySet();
String value = "";
for(Iterator iter = set.iterator(); iter.hasNext(); ) {
Map.Entry entry = (Entry) iter.next();
value = (String) entry.getValue();
if(inSchedule) {
try {
value = java.net.URLDecoder.decode(Utils.oracleSafe(value), "UTF-8");
} catch (UnsupportedEncodingException ex) {
}
}
SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", value);
// if(SQL.indexOf("'"+"["+entry.getKey()+"]"+"'")!=-1) {
if(SQL.indexOf("'"+"["+entry.getKey()+"]"+"'")!=-1 || SQL.indexOf("'"+"["+entry.getKey())!=-1 || SQL.indexOf(entry.getKey()+"]"+"'")!=-1
|| SQL.indexOf("'%"+"["+entry.getKey()+"]"+"%'")!=-1 || SQL.indexOf("'%"+"["+entry.getKey())!=-1 || SQL.indexOf(entry.getKey()+"]"+"%'")!=-1
|| SQL.indexOf("'_"+"["+entry.getKey()+"]"+"_'")!=-1 || SQL.indexOf("'_"+"["+entry.getKey())!=-1 || SQL.indexOf(entry.getKey()+"]"+"_'")!=-1
|| SQL.indexOf("'%_"+"["+entry.getKey()+"]"+"_%'")!=-1 || SQL.indexOf("'%_"+"["+entry.getKey())!=-1 || SQL.indexOf(entry.getKey()+"]"+"_%'")!=-1) {
SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", nvl(
value, "NULL"));
} else {
// Added to prevent SQL Injection
if(SQL.indexOf("["+entry.getKey()+"]")!=-1) {
try {
double vD = Double.parseDouble(value);
SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", nvl(
value, "NULL"));
} catch (NumberFormatException ex) {
throw new UserDefinedException("Expected number, Given String for the form field \"" + "["+entry.getKey()+"]"+"\"");
}
}
}
}
if(getFieldDefaultSQL()!=null && (fieldValue == null || fieldValue.trim().equalsIgnoreCase("null")|| fieldValue.trim().length()<=0))
lookup = new IdNameSql(-1,SQL,lu.getDefaultSQL());
else
lookup = new IdNameSql(-1,SQL,null);
}
}
//lookupList = lookup;
if(getFieldDefaultSQL()!=null && (fieldValue == null || fieldValue.trim().equalsIgnoreCase("null")|| fieldValue.trim().length()<=0)) {
lookup.loadUserData(0, "", getDbInfo(), getUserId());
for (lookup.resetNext(); lookup.hasNext();) {
idNamevalue = lookup.getNext();
break;
}
fieldDefValue = nvl(idNamevalue.getId());
fieldDefDisplay = nvl(idNamevalue.getName());
} else {
try {
// -2 indicates to run the whole sql for matching value
lookup.loadUserData(-2, "", getDbInfo(), getUserId());
lookup.trimToSize();
for (lookup.resetNext(); lookup.hasNext();) {
IdNameValue value = lookup.getNext();
if(value != null && value.getId() != null && value.getName() != null ) {
fieldDefValue = nvl(value.getId());
if (fieldValue != null && fieldValue.equals(value.getId())) {
fieldDefDisplay = nvl(value.getName());
break;
}
else {
fieldDefValue = "";
fieldDefDisplay = "";
}
}
}
if (fieldDefDisplay == null || fieldDefDisplay.length()<=0) {
fieldDefDisplay = nvl(fieldDefValue);
}
if(oldSQL != null && !oldSQL.equals("")) {
((IdNameSql)lookup).setSQL(oldSQL);
}
} catch (Exception e) {
//throw new RaptorRuntimeException(e);
}
//----- END ---//
if(getFieldDefaultSQL()!=null && (fieldValue == null || fieldValue.trim().equalsIgnoreCase("null")|| fieldValue.length()<=0)) {
fieldDefValue = nvl((idNamevalue!=null)?idNamevalue.getId():"");
fieldDefDisplay = nvl((idNamevalue!=null)?idNamevalue.getName():"");
} else {
if(fieldValue == null || fieldValue.trim().equalsIgnoreCase("null")|| fieldValue.length()<=0) fieldValue="";
fieldDefValue = nvl(fieldDefValue);
fieldDefDisplay = nvl(fieldDefDisplay);
}
}
}catch(Exception e) { //throw new RaptorRuntimeException(e);
}
if(isVisible()) {
/* return "\n" + "
0 && (dependsOn == null || dependsOn.length()<=0)) {
sb.append((fieldValue!=null)?"obj.value=\""+nvl(fieldValue)+"\";":"");
} else if (lookup != null) {
lookup.loadUserData(0, "", getDbInfo(), getUserId());
int iCnt = 0;
for (lookup.resetNext(); lookup.hasNext(); iCnt++) {
IdNameValue value = lookup.getNext();
//System.out.println("HIDDEN " + value.getId() + " " + value.getName());
sb.append((value!=null)?"obj.value=\""+nvl(value.getId())+"\";":"");
if(value.isReadOnly())
sb.append("obj.disabled=true;");
else
sb.append("obj.disabled=false;");
break;
} // for
if(lookup.size()<=0) {
sb.append("obj.value=\"\"");
}
} else {
sb.append((fieldValue!=null)?"obj.value=\""+Utils.singleQuoteEncode(nvl(fieldValue))+"\";":"");
}
if(oldSQL != null && !oldSQL.equals("")) {
((IdNameSql)lookup).setSQL(oldSQL);
}
// lookup.clearData();
} catch (Exception e) {
//throw new RaptorRuntimeException(e);
}
//if(isVisible())
return sb.toString() ;
} else if (fieldType.equals(FFT_LIST_BOX)) {
StringBuffer sb = new StringBuffer();
//System.out.println("COMBO BOX " + fieldName);
String oldSQL = "";
if (!required)
sb.append("obj.options[obj.options.length] = new Option('-->select value<--','');");
IdNameList lookup = getLookupList();
try {
if(!hasPredefinedList) {
//if(dependsOn != null && dependsOn != "") {
//if(dependsOn != null && dependsOn != "" ) {
IdNameSql lu = (IdNameSql) lookup;
String SQL = "";
SQL = lu.getSql();
/*if(nvl(fieldValue,"").length()<=0)
SQL = lu.getSql();
else
SQL = lu.getBaseSQLForPDFExcel(false);
*/
//System.out.println("FORMFIELD 6666667 First" + ((IdNameSql)lookup).getSql());
oldSQL = lu.getSql();
//SQL = Utils.replaceInString(SQL, "[VALUE]", fieldValue);
if(formValues != null) {
Set set = formValues.entrySet();
String value = "";
for(Iterator iter = set.iterator(); iter.hasNext(); ) {
Map.Entry entry = (Entry) iter.next();
value = (String) entry.getValue();
if(inSchedule) {
try {
value = java.net.URLDecoder.decode(Utils.oracleSafe(value), "UTF-8");
} catch (UnsupportedEncodingException ex) {
}
}
if (value!=null && (value.length() <=0 || value.equals("NULL"))) {
value = "NULL";
SQL = Utils.replaceInString(SQL, "'["+entry.getKey()+"]'", value);
SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", value);
} else {
SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", value);
}
}
lookup = new IdNameSql(-1,SQL,lu.getDefaultSQL());
}
//}
lookupList = lookup;
//}
try {
lookup.loadUserData(0, "", getDbInfo(), getUserId());
} catch (Exception e ){ e.printStackTrace(); //throw new RaptorRuntimeException(e);
}
}
lookup.trimToSize();
String selectedValue = "";
int count = 0;
for (lookup.resetNext(); lookup.hasNext();) {
IdNameValue value = lookup.getNext();
if(value != null && value.getId() != null && value.getName() != null ) {
/*if (count == 0 && required) {
selectedValue = value.getId();
count++;
} else if (nvl(fieldValue).length()>0){
if (fieldValue != null && fieldValue.equals(value.getId())){
selectedValue = value.getId();
}
count++;
} else {
count++;
} */
if (count == 0) {
if(required){
selectedValue = value.getId();
}
count++;
}
sb.append("obj.options[obj.options.length] = new Option('" + Utils.singleQuoteEncode(value.getName())+"','"+Utils.singleQuoteEncode(value.getId())+"');");
if ((fieldValue != null && fieldValue.equals(value.getId()))){
sb.append("obj.options[obj.options.length-1].selected=true;");
selectedValue = value.getId();
}
if(value.isReadOnly())
sb.append("obj.disabled=true;");
else
sb.append("obj.disabled=false;");
}
} // for
if (formValues.containsKey(fieldDisplayName)){
formValues.remove(fieldDisplayName);
}
formValues.put(fieldDisplayName, selectedValue);
} catch (Exception e) {
//throw new RaptorRuntimeException(e);
}
if(!hasPredefinedList) {
if(oldSQL != null && !oldSQL.equals("")) {
((IdNameSql)lookup).setSQL(oldSQL);
}
}
//System.out.println("FORMFIELD 6666667 " + ((IdNameSql)lookup).getSql());
if( isVisible())
return sb.toString();
else return "";
}
return "";
}
public String getHtml(String fieldValue, HashMap formValues, ReportRuntime rr, boolean inSchedule) throws RaptorRuntimeException {
fieldValue = nvl(fieldValue, defaultValue);
int MILLIS_IN_DAY = 1000 * 60 * 60 * 24;
String readOnlyInSql = "ff_readonly";
boolean readOnly = false;
try {
if(fieldValue !=null && fieldValue.length() > 0)
fieldValue = java.net.URLDecoder.decode(fieldValue, "UTF-8");
} catch (UnsupportedEncodingException ex) {}
catch (IllegalArgumentException ex1){}
catch (Exception ex2){}
//System.out.println(fieldName + " " + fieldType + " " + fieldValue);
if (fieldType.equals(FFT_TEXT_W_POPUP)) {
//System.out.println("TEXT POPUP " + fieldName);
String oldSQL = "";
IdNameValue idNamevalue = null;
String fieldDefValue="";
String fieldDefDisplay="";
IdNameList lookup = null;
try {
lookup = getLookupList();
if(!hasPredefinedList) {
if(dependsOn != null && dependsOn != "" ) {
IdNameSql lu = (IdNameSql) lookup;
String SQL = getBaseWholeSQL();
if(SQL.toLowerCase().indexOf(readOnlyInSql) != -1) {
SQL = getBaseWholeReadonlySQL();
}
oldSQL = lu.getSql();
if(formValues != null) {
Set set = formValues.entrySet();
String value = "";
for(Iterator iter = set.iterator(); iter.hasNext(); ) {
Map.Entry entry = (Entry) iter.next();
value = (String) entry.getValue();
SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", value);
// if(SQL.indexOf("'"+"["+entry.getKey()+"]"+"'")!=-1) {
if(SQL.indexOf("'"+"["+entry.getKey()+"]"+"'")!=-1 || SQL.indexOf("'"+"["+entry.getKey())!=-1 || SQL.indexOf(entry.getKey()+"]"+"'")!=-1
|| SQL.indexOf("'%"+"["+entry.getKey()+"]"+"%'")!=-1 || SQL.indexOf("'%"+"["+entry.getKey())!=-1 || SQL.indexOf(entry.getKey()+"]"+"%'")!=-1
|| SQL.indexOf("'_"+"["+entry.getKey()+"]"+"_'")!=-1 || SQL.indexOf("'_"+"["+entry.getKey())!=-1 || SQL.indexOf(entry.getKey()+"]"+"_'")!=-1
|| SQL.indexOf("'%_"+"["+entry.getKey()+"]"+"_%'")!=-1 || SQL.indexOf("'%_"+"["+entry.getKey())!=-1 || SQL.indexOf(entry.getKey()+"]"+"_%'")!=-1) {
SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", nvl(
value, "NULL"));
} else {
// Added to prevent SQL Injection
if(SQL.indexOf("["+entry.getKey()+"]")!=-1) {
try {
double vD = Double.parseDouble(value);
SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", nvl(
value, "NULL"));
} catch (NumberFormatException ex) {
throw new UserDefinedException("Expected number, Given String for the form field \"" + "["+entry.getKey()+"]"+"\"");
}
}
}
}
if(getFieldDefaultSQL()!=null && (fieldValue == null || fieldValue.trim().equalsIgnoreCase("null")|| fieldValue.trim().length()<=0))
lookup = new IdNameSql(-1,SQL,lu.getDefaultSQL());
else
lookup = new IdNameSql(-1,SQL,null);
}
}
//lookupList = lookup;
if(getFieldDefaultSQL()!=null && (fieldValue == null || fieldValue.trim().equalsIgnoreCase("null")|| fieldValue.trim().length()<=0)) {
lookup.loadUserData(0, "", getDbInfo(), getUserId());
for (lookup.resetNext(); lookup.hasNext();) {
idNamevalue = lookup.getNext();
break;
}
fieldDefValue = nvl(idNamevalue.getId());
fieldDefDisplay = nvl(idNamevalue.getName());
} else {
try {
// -2 indicates to run the whole sql for matching value
lookup.loadUserData(-2, "", getDbInfo(), getUserId());
} catch (Exception e) {
//throw new RaptorRuntimeException(e);
}
lookup.trimToSize();
for (lookup.resetNext(); lookup.hasNext();) {
IdNameValue value = lookup.getNext();
if(value != null && value.getId() != null && value.getName() != null ) {
fieldDefValue = nvl(value.getId());
if (fieldValue != null && fieldValue.equals(value.getId())) {
fieldDefDisplay = nvl(value.getName());
break;
}
else {
fieldDefValue = "";
fieldDefDisplay = "";
}
}
}
if (fieldDefDisplay == null || fieldDefDisplay.length()<=0) {
fieldDefDisplay = nvl(fieldDefValue);
}
//----- END ---//
if(getFieldDefaultSQL()!=null && (fieldValue == null || fieldValue.trim().equalsIgnoreCase("null")|| fieldValue.length()<=0)) {
fieldDefValue = nvl((idNamevalue!=null)?idNamevalue.getId():"");
fieldDefDisplay = nvl((idNamevalue!=null)?idNamevalue.getName():"");
} else {
if(fieldValue == null || fieldValue.trim().equalsIgnoreCase("null")|| fieldValue.length()<=0) fieldValue="";
fieldDefValue = nvl(fieldDefValue);
fieldDefDisplay = nvl(fieldDefDisplay);
}
}
} else {
lookup.trimToSize();
for (lookup.resetNext(); lookup.hasNext();) {
IdNameValue value = lookup.getNext();
if(value != null && value.getId() != null && value.getName() != null ) {
fieldDefValue = nvl(value.getId());
if (fieldValue != null && fieldValue.equals(value.getId())) {
fieldDefDisplay = nvl(value.getName());
break;
}
else {
fieldDefValue = "";
fieldDefDisplay = "";
}
}
}
if (fieldDefDisplay == null || fieldDefDisplay.length()<=0) {
fieldDefDisplay = nvl(fieldDefValue);
}
}
}catch(Exception e) { //throw new RaptorRuntimeException(e);
}
if(!hasPredefinedList) {
if(oldSQL != null && !oldSQL.equals("")) {
((IdNameSql)lookup).setSQL(oldSQL);
}
}
if(isVisible()) {
/* return "\n" + "
";
return progress+" \n \n"
+ "
0) {
valueSQL = lu.getSql();
avail_ReadOnly = (valueSQL.toLowerCase().indexOf(readOnlyInSql)!=-1);
//System.out.println("OLD SQL TEXT" + valueSQL);
//oldSQL = lu.getSql();
if(formValues != null) {
Set set = formValues.entrySet();
String value1 = "";
for(Iterator iter = set.iterator(); iter.hasNext(); ) {
Map.Entry entry = (Entry) iter.next();
value1 = (String) entry.getValue();
if (value1.length() <=0) {
value1 = "NULL";
valueSQL = Utils.replaceInString(valueSQL, "'["+entry.getKey()+"]'", value1);
valueSQL = Utils.replaceInString(valueSQL, "["+entry.getKey()+"]", value1);
} else {
valueSQL = Utils.replaceInString(valueSQL, "["+entry.getKey()+"]", value1);
}
}
// should be value one.
//lookup = new IdNameSql(-1,valueSQL,lu.getDefaultSQL());
}
}
//lookupList = lookup;
//System.out.println("8888888 88 " + valueSQL);
}
if(valueSQL!=null && valueSQL.length()>0) {
DataSet ds = ConnectionUtils.getDataSet(valueSQL.toString(), dbInfo);
strValue = ds.getString(0,1);
if(avail_ReadOnly) readOnly = ds.getString(0, 2).toUpperCase().startsWith("Y")||ds.getString(0, 2).toUpperCase().startsWith("T");;
}
}catch(Exception e) { //throw new RaptorRuntimeException(e);
}
String returnString = "";
String timestamp ="", timestamphr = "", timestampmin = "", timestampsec = "";
returnString = "0 && (!(fieldValue.toUpperCase().indexOf("SELECT ")!= -1 && fieldValue.toUpperCase().indexOf("FROM")!= -1)) ) {
if(validationType.startsWith("TIMESTAMP")) {
returnString += nvl((fieldValue!=null)?fieldValue.split(" ")[0]:"");
if(fieldValue!=null && fieldValue.length()>0) {
timestamp = (fieldValue.split(" ").length > 1)?fieldValue.split(" ")[1]:"";
String timestampArr[] = timestamp.split(":");
if((timestampArr.length == 1) || (timestampArr.length == 2) || (timestampArr.length == 3))
timestamphr = timestampArr[0];
if((timestampArr.length == 2) || (timestampArr.length == 3))
timestampmin = timestampArr[1];
if(timestampArr.length == 3)
timestampsec = timestampArr[2];
}
} else returnString += fieldValue;
} else if(getFieldDefaultSQL()!=null) {
if(validationType.startsWith("TIMESTAMP")) {
returnString += nvl((strValue.length()>0)?strValue.split(" ")[0]:"");
if(strValue.length()>0) {
timestamp = (strValue.split(" ").length > 1)?strValue.split(" ")[1]:"";
String timestampArr[] = timestamp.split(":");
if((timestampArr.length == 1) || (timestampArr.length == 2) || (timestampArr.length == 3))
timestamphr = timestampArr[0];
if((timestampArr.length == 2) || (timestampArr.length == 3))
timestampmin = timestampArr[1];
if(timestampArr.length == 3)
timestampsec = timestampArr[2];
}
} else if (nvl(strValue).length()>0) {
returnString += strValue;
} else
returnString += nvl((value!=null)?value.getId():"");
} else if (nvl(strValue).length()>0) {
returnString += strValue;
} else
returnString += nvl((value!=null)?value.getId():"");
/*returnString += "\">"
+ (validationType.equals(VT_DATE) ? "\n\t\t\t"
+ "\n\t\t\t\t
"
: ""); */
SimpleDateFormat dtf = new SimpleDateFormat("MM/dd/yyyy");
String stRangeText = this.getRangeStartDate() == null ? null : dtf.format(this.getRangeStartDate().getTime());
String endRangeText = this.getRangeEndDate() == null ? null : dtf.format(this.getRangeEndDate().getTime());
/////////////////////////
//get the date sqls
//System.out.println("////////////start range date before Start" + this.getRangeStartDateSQL());
if (this.getRangeStartDateSQL() != null && this.getRangeStartDateSQL().trim().toLowerCase().startsWith("select")){
//System.out.println("////////////start range date Starting");
String SQL = this.getRangeStartDateSQL();
if(formValues != null) {
Set set = formValues.entrySet();
String v = "";
for(Iterator iter = set.iterator(); iter.hasNext(); ) {
Map.Entry entry = (Entry) iter.next();
v = (String) entry.getValue();
//System.out.println("///////// key is " + entry.getKey() + " = " + v);
SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", v);
}
}
//System.out.println("////////////start range date sql created" + SQL);
try{
DataSet ds = ConnectionUtils.getDataSet(SQL.toString(), dbInfo);
//System.out.println("////////////start range date is : " + ds.get(0));
dtf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Calendar tStart = Calendar.getInstance();
tStart.setTime(dtf.parse(ds.getString(0,0)));
dtf = new SimpleDateFormat("MM/dd/yyyy");
stRangeText = dtf.format(tStart.getTime().getTime()-MILLIS_IN_DAY);
}catch(Exception e){
System.out.println("Exception////////// : start range date is : " + e);
}
}
if (this.getRangeEndDateSQL() != null && this.getRangeEndDateSQL().trim().toLowerCase().startsWith("select")){
//System.out.println("////////////end range date Starting");
String SQL = this.getRangeEndDateSQL();
if(formValues != null) {
Set set = formValues.entrySet();
String v = "";
for(Iterator iter = set.iterator(); iter.hasNext(); ) {
Map.Entry entry = (Entry) iter.next();
v = (String) entry.getValue();
SQL = Utils.replaceInString(SQL, "["+entry.getKey()+"]", v);
}
}
try{
DataSet ds = ConnectionUtils.getDataSet(SQL.toString(), dbInfo);
//System.out.println("////////////end range date is : " + ds.get(0));
dtf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Calendar tStart = Calendar.getInstance();
tStart.setTime(dtf.parse(ds.getString(0,0)));
dtf = new SimpleDateFormat("MM/dd/yyyy");
//endRangeText = dtf.format(tStart.getTime());
endRangeText = dtf.format(tStart.getTime().getTime()+MILLIS_IN_DAY);
}catch(Exception e){
System.out.println("Exception////////// : end range date is : " + e);
}
}
//////////////////////
String calendarOnClickMethodCall = "";
String timeStampStr = "";
if (stRangeText == null || endRangeText == null)
calendarOnClickMethodCall = "'oCalendar.select(document." + HTML_FORM + "." + fieldName + ", event,\""+ Globals.getCalendarOutputDateFormat() +"\"); return false;'";
else
calendarOnClickMethodCall = "'oCalendar=new CalendarPopup(\"calendarDiv\", \"calendarFrame\");oCalendar.setCssPrefix(\"raptor\");oCalendar.addDisabledDates(null, \"" + stRangeText + "\"); oCalendar.addDisabledDates(\"" + endRangeText + "\", null); oCalendar.select(document." + HTML_FORM + "." + fieldName + ", event,\""+ Globals.getCalendarOutputDateFormat() +"\"); return false;'";
returnString += "\" " + getHelpLink(fieldName)
+ (validationType.equals(VT_DATE) || validationType.equals(VT_TIMESTAMP_HR) || validationType.equals(VT_TIMESTAMP_MIN) || validationType.equals(VT_TIMESTAMP_SEC)
? "\n\t\t\t
"
: "");
if(validationType.equals(VT_TIMESTAMP_HR) || validationType.equals(VT_TIMESTAMP_MIN) || validationType.equals(VT_TIMESTAMP_SEC) ) {
//Add Hours/Minutes and Seconds.
timeStampStr = " Hour ";
}
//Minutes
if( validationType.equals(VT_TIMESTAMP_MIN) || validationType.equals(VT_TIMESTAMP_SEC) ) {
int minutes = 0;
int t_min = 0;
try {
minutes = Integer.parseInt(nvl(rr.getParamValue(fieldName+"_Min"),"0"));
if(minutes == 0) {
if(inSchedule) minutes = Integer.parseInt(nvl(((String)formValues.get(fieldName+"_Min")),"0"));
}
} catch (NumberFormatException ex) {minutes = 0;}
try {
t_min = Integer.parseInt(timestampmin);
} catch (NumberFormatException ex) { t_min = 0;}
if(minutes <= 0) minutes = t_min;
/*if (formValues.containsKey(fieldDisplayName+"_Min")){
formValues.remove(fieldDisplayName+"_Min");
formValues.put(fieldDisplayName+"_Min", minutes);
} else
formValues.put(fieldDisplayName+"_Min", minutes);
*/
timeStampStr += " Min ";
}
//Seconds
if( validationType.equals(VT_TIMESTAMP_SEC) ) {
int seconds = 0;
int t_sec = 0;
try {
seconds = Integer.parseInt(nvl(rr.getParamValue(fieldName+"_Sec"),"0"));
if(seconds == 0) {
if(inSchedule) seconds = Integer.parseInt(nvl(((String)formValues.get(fieldName+"_Sec")),"0"));
}
} catch (NumberFormatException ex) {seconds = 0;}
try {
t_sec = Integer.parseInt(timestampsec);
} catch (NumberFormatException ex) { t_sec = 0;}
if(seconds <= 0) seconds = t_sec;
/*if (formValues.containsKey(fieldDisplayName+"_Sec")){
formValues.remove(fieldDisplayName+"_Sec");
formValues.put(fieldDisplayName+"_Sec", seconds);
} else
formValues.put(fieldDisplayName+"_Sec", seconds);
*/
timeStampStr += " Sec ";
}
returnString += timeStampStr;
String checkboxStr = "";
if(inSchedule && (validationType.equals(VT_DATE) || validationType.equals(VT_TIMESTAMP_HR) || validationType.equals(VT_TIMESTAMP_MIN) || validationType.equals(VT_TIMESTAMP_SEC)) ) {
if(!Globals.isScheduleDateParamAutoIncr()) {
checkboxStr = /*checkboxStr +" "+ */ "";
} else {
checkboxStr = /*checkboxStr +" "+ */"";
}
/*if(validationType.equals(VT_TIMESTAMP_HR) || validationType.equals(VT_TIMESTAMP_MIN) || validationType.equals(VT_TIMESTAMP_SEC)) {
checkboxStr = checkboxStr +" "+ "";
}
if(validationType.equals(VT_TIMESTAMP_MIN) || validationType.equals(VT_TIMESTAMP_SEC)) {
checkboxStr = checkboxStr +" "+ "";
}
if(validationType.equals(VT_TIMESTAMP_SEC)) {
checkboxStr = checkboxStr +" "+ "";
}*/
}
if(isVisible())
return returnString+checkboxStr;
else return "";
} else if (fieldType.equals(FFT_TEXTAREA)) {
if(nvl(fieldValue).length()>0) {
fieldValue = Pattern.compile("(^[\r\n])|\\([\\']", Pattern.DOTALL).matcher(fieldValue).replaceAll("");
fieldValue = Pattern.compile("[\\']\\)", Pattern.DOTALL).matcher(fieldValue).replaceAll("");
fieldValue = fieldValue.replaceAll("','",","); // changed from "|"
fieldValue = fieldValue.replaceAll("' , '","\r\n");
}
if(isVisible())
return "