package org.apache.jsp;
import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import org.apache.jasper.runtime.*;
import org.ofbiz.entity.*;
import org.ofbiz.entity.model.*;
import java.lang.reflect.Method;
import java.util.*;
import java.io.*;
import org.ofbiz.entity.util.SequenceUtil;
import com.sourcetap.sfa.replication.*;
import com.sourcetap.sfa.ui.*;
import com.sourcetap.sfa.event.*;
import com.sourcetap.sfa.util.*;
import java.net.*;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServlet;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Vector;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.HashMap;
import java.util.Calendar;
import java.util.StringTokenizer;
import java.text.SimpleDateFormat;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.sql.Timestamp;
import java.sql.Time;
import java.sql.*;
import org.ofbiz.entity.util.SequenceUtil;
import org.ofbiz.security.*;
import org.ofbiz.entity.*;
import org.ofbiz.entity.condition.*;
import org.ofbiz.entity.model.*;
import org.ofbiz.base.util.*;
import com.sourcetap.sfa.ui.*;
import com.sourcetap.sfa.event.*;
import com.sourcetap.sfa.util.UserInfo;
public class leadCaptureSetup_jsp extends HttpJspBase {
/*
* Takes a string in the following format:
* formatString
* Where the first letter is lowercase, and
* subsequent unique words begin with an upper case.
* The function will convert a java string to a regular
* string in title case format.
*/
String formatJavaString(String s){
char ca[] = s.toCharArray();
StringBuffer sb = new StringBuffer();
int previous = 0;
for(int i=0;i<ca.length;i++){
if(i==s.length()-1){
sb.append(s.substring(previous, previous+1).toUpperCase());
sb.append(s.substring(previous+1, s.length()));
}
if(Character.isUpperCase(ca[i])){
sb.append(s.substring(previous, previous+1).toUpperCase());
sb.append(s.substring(previous+1, i));
sb.append(" ");
previous = i;
}
}
return sb.toString();
}
/**
Properties must include:
NAME-name of the select used in name-value form submit.
VALUE_FIELD-the value sent in form submit.
DISPLAY_FIELD-the field used in the display of the drop-down. use a
Properties can include:
Selected-The value to test for, and set selected on the drop-down
EMPTY_FIRST: if just a blank field use "{field display vaalue}, else if value supplied use "{field value}, {field value display name}"
*/
String buildDropDown(List l, Map properties){
StringBuffer returnString = new StringBuffer();
GenericValue genericValue = null;
Iterator i = l.iterator();
String selected = ((String)(properties.get("SELECTED") != null ? properties.get("SELECTED") : ""));
String display = ((String)(properties.get("DISPLAY_FIELD") != null ? properties.get("DISPLAY_FIELD") : ""));
String selectJavaScript = ((String)(properties.get("SELECT_JAVASCRIPT") != null ? properties.get("SELECT_JAVASCRIPT") : ""));
returnString.append("<select name=\"" + properties.get("NAME") + "\" " + selectJavaScript + " >");
if(properties.get("EMPTY_FIRST") != null) {
String empty = (String)properties.get("EMPTY_FIRST");
if(empty.indexOf(",") != -1){
StringTokenizer tok = new StringTokenizer(empty, ",");
returnString.append("<option value=\"" + ((String)tok.nextElement()).trim() + "\">" + ((String)tok.nextElement()).trim());
} else {
returnString.append("<option value=\"\">" + empty);
}
}
try{
while(i.hasNext()){
genericValue = (GenericValue)i.next();
returnString.append("<option value=\"" + String.valueOf(genericValue.get((String)properties.get("VALUE_FIELD"))) + "\"");
if(String.valueOf(genericValue.get((String)properties.get("VALUE_FIELD"))).equals(selected)){
returnString.append(" SELECTED ");
}
returnString.append(" >");
if(display.indexOf(",") != -1){
StringTokenizer tok = new StringTokenizer(display, ",");
while(tok.hasMoreElements()){
String elem = (String)tok.nextElement();
returnString.append(String.valueOf(genericValue.get(elem.trim())));
returnString.append(" ");
}
} else {
returnString.append(genericValue.get(display));
}
}
} catch (Exception e){ e.printStackTrace(); }
returnString.append("</select>");
return returnString.toString();
}
String buildStringDropDown(List l, Map properties){
StringBuffer returnString = new StringBuffer();
String value = "";
Iterator i = l.iterator();
String selected = ((String)(properties.get("SELECTED") != null ? properties.get("SELECTED") : ""));
String display = ((String)(properties.get("DISPLAY_FIELD") != null ? properties.get("DISPLAY_FIELD") : ""));
String selectJavaScript = ((String)(properties.get("SELECT_JAVASCRIPT") != null ? properties.get("SELECT_JAVASCRIPT") : ""));
returnString.append("<select name=\"" + properties.get("NAME") + "\" " + selectJavaScript + " >");
if(properties.get("EMPTY_FIRST") != null) {
String empty = (String)properties.get("EMPTY_FIRST");
if(empty.indexOf(",") != -1){
StringTokenizer tok = new StringTokenizer(empty, ",");
returnString.append("<option value=\"" + ((String)tok.nextElement()).trim() + "\">" + ((String)tok.nextElement()).trim());
} else {
returnString.append("<option value=\"\">" + empty);
}
}
while(i.hasNext()){
value = (String)i.next();
returnString.append("<option value=\"" + value + "\"");
if(value.equals(selected)){
returnString.append(" SELECTED ");
}
returnString.append(" >");
if(display.indexOf(",") != -1){
StringTokenizer tok = new StringTokenizer(display, ",");
while(tok.hasMoreElements()){
String elem = (String)tok.nextElement();
returnString.append(value);
returnString.append(" ");
}
} else {
returnString.append(value);
}
}
returnString.append("</select>");
return returnString.toString();
}
String buildFieldDropDown(Vector fields, String entityName, HashMap properties){
if(properties == null) properties = new HashMap();
StringBuffer returnString = new StringBuffer();
ModelField modelField = null;
String selected = ((String)(properties.get("SELECTED") != null ? properties.get("SELECTED") : ""));
returnString.append("<select name=\"" + entityName + "\" >");
if(properties.get("EMPTY_FIRST") != null) returnString.append("<option value=\"\">" + properties.get("EMPTY_FIRST"));
for(int i=0;i<fields.size();i++){
modelField = (ModelField)fields.get(i);
returnString.append("<option value=\"" + modelField.getName() + "\"");
if((modelField.getName()).equals(selected)){
returnString.append(" SELECTED ");
}
returnString.append(" >" + formatJavaString(modelField.getName()));
}
returnString.append("</select>");
return returnString.toString();
}
/**
* Checks a List of fields to see if the string
* that is passed in exists in the vector. If so,
* it returns the ModelField for the named field, else
* it returns null.
*/
ModelField contains(List v, String s){
ModelField field;
for(int i=0; i<v.size();i++){
field = (ModelField)v.get(i);
if(field.getName().equals(s))
return field;
}
return null;
}
String buildUIFieldDropDown(String sectionName, List fields, String entityName, HashMap properties){
if(properties == null) properties = new HashMap();
StringBuffer returnString = new StringBuffer();
UIFieldInfo fieldInfo = null;
String selected = ((String)(properties.get("SELECTED") != null ? properties.get("SELECTED") : ""));
returnString.append("<select name=\"" + entityName + "\" >");
if(properties.get("EMPTY_FIRST") != null) returnString.append("<option value=\"\">" + properties.get("EMPTY_FIRST"));
for(int i=0;i<fields.size();i++){
fieldInfo = (UIFieldInfo)fields.get(i);
if ( fieldInfo.getIsVisible() && !fieldInfo.getIsReadOnly() )
{
String attrId = UIWebUtility.getHtmlName(sectionName, fieldInfo, 0);
String attrName = fieldInfo.getDisplayLabel();
returnString.append("<option value=\"" + attrId + "\"");
if(attrName.equals(selected)){
returnString.append(" SELECTED ");
}
returnString.append(" >" + attrName);
}
}
returnString.append("</select>");
return returnString.toString();
}
/**
* Given a ModelField and a value, this function checks the datatype for the field, and
* converts the value to the correct datatype.
*/
GenericValue setCorrectDataType(GenericValue entity, ModelField curField, String value){
ModelFieldTypeReader modelFieldTypeReader = new ModelFieldTypeReader("mysql");
ModelFieldType mft = modelFieldTypeReader.getModelFieldType(curField.getType());
String fieldType = mft.getJavaType();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat timeFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm a");
if(fieldType.equals("java.lang.String") || fieldType.equals("String")){
if ( mft.getType().equals("indicator") )
{
if ( value.equals("on") )
entity.set(curField.getName(), "Y");
else if ( value.equals("off") )
entity.set(curField.getName(), "N");
else
entity.set(curField.getName(), value);
}
else
entity.set(curField.getName(), value);
} else if(fieldType.equals("java.sql.Timestamp") || fieldType.equals("Timestamp")) {
if(value.trim().length() == 0){
entity.set(curField.getName(), null);
} else {
try { entity.set(curField.getName(), new Timestamp(timeFormat.parse(value).getTime()));
} catch (ParseException e) { e.printStackTrace();
} //WTD: Implement error processing for ParseException. i.e. get rid of the printStackTrace()
}
} else if(fieldType.equals("java.sql.Time") || fieldType.equals("Time")) {
if(value.trim().length() == 0){
entity.set(curField.getName(), null);
} else {
try { entity.set(curField.getName(), new Time(timeFormat.parse(value).getTime()));
} catch (ParseException e) { e.printStackTrace();
} //WTD: Implement error processing for ParseException. i.e. get rid of the printStackTrace()
}
} else if(fieldType.equals("java.util.Date")) {
if(value.trim().length() == 0) {
entity.set(curField.getName(), null);
} else {
try { entity.set(curField.getName(), new java.sql.Date(dateFormat.parse(value).getTime()));
} catch (ParseException e) { e.printStackTrace();
} //WTD: Implement error processing for ParseException. i.e. get rid of the printStackTrace()
}
} else if(fieldType.equals("java.sql.Date") || fieldType.equals("Date")) {
if(value.trim().length() == 0) {
entity.set(curField.getName(), null);
} else {
try { entity.set(curField.getName(), new java.sql.Date(dateFormat.parse(value).getTime()));
} catch (ParseException e) { e.printStackTrace();
} //WTD: Implement error processing for ParseException. i.e. get rid of the printStackTrace()
}
} else if(fieldType.equals("java.lang.Integer") || fieldType.equals("Integer")) {
if(value.trim().length() == 0) value = "0";
entity.set(curField.getName(), Integer.valueOf(value));
}
else if(fieldType.equals("java.lang.Long") || fieldType.equals("Long")) {
if(value.trim().length() == 0) value = "0";
entity.set(curField.getName(), Long.valueOf(value));
}
else if(fieldType.equals("java.lang.Float") || fieldType.equals("Float")) {
if(value.trim().length() == 0) value = "0.0";
entity.set(curField.getName(), Float.valueOf(value));
}
else if(fieldType.equals("java.lang.Double") || fieldType.equals("Double")) {
if(value.trim().length() == 0 || value == null) value = "0";
entity.set(curField.getName(), Double.valueOf(value));
}
return entity;
}
String getFieldValue(List l, String fieldName, String equalsValue, String returnFieldName){
Iterator i = l.iterator();
GenericEntity genericEntity = null;
String retVal = "";
//TODO: add StringTokenizer to parse multiple fields.
while(i.hasNext()){
genericEntity = (GenericValue)i.next();
if(String.valueOf(genericEntity.get(fieldName)).equals(equalsValue))
retVal = String.valueOf(genericEntity.get(returnFieldName));
}
return retVal;
}
String getFieldValue(HttpServletRequest request, String fieldName){
return (request.getParameter(fieldName) != null ? request.getParameter(fieldName) : "");
}
Vector getGenericValue(List l, String fieldName, String equalsValue){
Vector returnVector = new Vector();
GenericValue genericValue = null;
GenericValue genericValues[] = (GenericValue[])l.toArray(new GenericValue[0]);
for(int i=0;i<genericValues.length;i++){
genericValue = (GenericValue)genericValues[i];
if(String.valueOf(genericValue.get(fieldName)).equals(equalsValue))
returnVector.add(genericValue);
}
return returnVector;
}
String getDateTimeFieldValue(List l, String fieldName, String equalsValue, String returnFieldName, String dateFormatString){
GenericValue genericValue = null;
GenericValue genericValues[] = (GenericValue[])l.toArray(new GenericValue[0]);
String retVal = "";
SimpleDateFormat dateFormat = new SimpleDateFormat(dateFormatString);
for(int i=0;i<genericValues.length;i++){
genericValue = genericValues[i];
try{
if(dateFormat.parse(genericValue.getString(fieldName)).equals(dateFormat.parse(equalsValue)))
retVal = String.valueOf(genericValue.get(returnFieldName));
} catch (ParseException e) {
e.printStackTrace();
}
}
return retVal;
}
Vector getDateTimeGenericValue(List l, String fieldName, String equalsValue, String dateFormatString){
Vector returnVector = new Vector();
GenericValue genericValue = null;
GenericValue genericValues[] = (GenericValue[])l.toArray(new GenericValue[0]);
String retVal = "";
SimpleDateFormat dateFormat = new SimpleDateFormat(dateFormatString);
for(int i=0;i<genericValues.length;i++){
genericValue = genericValues[i];
try{
if(dateFormat.parse(genericValue.getString(fieldName)).equals(dateFormat.parse(equalsValue)))
returnVector.add(genericValue);
} catch (ParseException e) {
e.printStackTrace();
}
}
return returnVector;
}
String getStatesDropDown(String name, String selected){
if(name == null) return null;
StringBuffer returnString = new StringBuffer();
returnString.append("<select class=\"\" name=\"" + name + "\" >");
returnString.append("<option " + (selected == null || selected.equals("") ? "selected" : "") + " >");
returnString.append("<option " + (selected != null && selected.equals("AK") ? "selected" : "") + " >AK");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("AL") ? " selected" : "") + ">AL");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("AR") ? " selected" : "") + ">AR");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("AZ") ? " selected" : "") + ">AZ");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("CA") ? " selected" : "") + ">CA");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("CO") ? " selected" : "") + ">CO");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("CT") ? " selected" : "") + ">CT");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("DC") ? " selected" : "") + ">DC");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("DE") ? " selected" : "") + ">DE");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("FL") ? " selected" : "") + ">FL");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("GA") ? " selected" : "") + ">GA");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("GU") ? " selected" : "") + ">GU");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("HI") ? " selected" : "") + ">HI");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("IA") ? " selected" : "") + ">IA");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("ID") ? " selected" : "") + ">ID");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("IL") ? " selected" : "") + ">IL");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("IN") ? " selected" : "") + ">IN");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("KS") ? " selected" : "") + ">KS");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("KY") ? " selected" : "") + ">KY");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("LA") ? " selected" : "") + ">LA");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("MA") ? " selected" : "") + ">MA");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("MD") ? " selected" : "") + ">MD");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("ME") ? " selected" : "") + ">ME");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("MI") ? " selected" : "") + ">MI");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("MN") ? " selected" : "") + ">MN");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("MO") ? " selected" : "") + ">MO");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("MS") ? " selected" : "") + ">MS");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("MT") ? " selected" : "") + ">MT");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("NC") ? " selected" : "") + ">NC");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("ND") ? " selected" : "") + ">ND");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("NE") ? " selected" : "") + ">NE");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("NH") ? " selected" : "") + ">NH");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("NJ") ? " selected" : "") + ">NJ");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("NM") ? " selected" : "") + ">NM");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("NV") ? " selected" : "") + ">NV");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("NY") ? " selected" : "") + ">NY");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("OH") ? " selected" : "") + ">OH");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("OK") ? " selected" : "") + ">OK");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("OR") ? " selected" : "") + ">OR");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("PA") ? " selected" : "") + ">PA");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("PR") ? " selected" : "") + ">PR");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("RI") ? " selected" : "") + ">RI");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("SC") ? " selected" : "") + ">SC");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("SD") ? " selected" : "") + ">SD");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("TN") ? " selected" : "") + ">TN");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("TX") ? " selected" : "") + ">TX");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("UT") ? " selected" : "") + ">UT");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("VA") ? " selected" : "") + ">VA");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("VI") ? " selected" : "") + ">VI");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("VT") ? " selected" : "") + ">VT");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("WA") ? " selected" : "") + ">WA");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("WI") ? " selected" : "") + ">WI");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("WV") ? " selected" : "") + ">WV");
returnString.append("<option" + (selected != null && selected.equalsIgnoreCase("WY") ? " selected" : "") + ">WY");
returnString.append("</select>");
return returnString.toString();
}
private static java.util.Vector _jspx_includes;
static {
_jspx_includes = new java.util.Vector(9);
_jspx_includes.add("/includes/header.jsp");
_jspx_includes.add("/includes/oldFunctions.jsp");
_jspx_includes.add("/includes/oldDeclarations.jsp");
_jspx_includes.add("/includes/windowTitle.jsp");
_jspx_includes.add("/includes/userStyle.jsp");
_jspx_includes.add("/includes/uiFunctions.js");
_jspx_includes.add("/includes/onBeforeUnload.jsp");
_jspx_includes.add("/includes/ts_picker.js");
_jspx_includes.add("/includes/footer.jsp");
}
private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_ofbiz_url;
public leadCaptureSetup_jsp() {
_jspx_tagPool_ofbiz_url = new org.apache.jasper.runtime.TagHandlerPool();
}
public java.util.List getIncludes() {
return _jspx_includes;
}
public void _jspDestroy() {
_jspx_tagPool_ofbiz_url.release();
}
public void _jspService(HttpServletRequest request, HttpServletResponse response)
throws java.io.IOException, ServletException {
JspFactory _jspxFactory = null;
javax.servlet.jsp.PageContext pageContext = null;
HttpSession session = null;
ServletContext application = null;
ServletConfig config = null;
JspWriter out = null;
Object page = this;
JspWriter _jspx_out = null;
try {
_jspxFactory = JspFactory.getDefaultFactory();
response.setContentType("text/html;charset=ISO-8859-1");
pageContext = _jspxFactory.getPageContext(this, request, response,
null, true, 8192, true);
application = pageContext.getServletContext();
config = pageContext.getServletConfig();
session = pageContext.getSession();
out = pageContext.getOut();
_jspx_out = out;
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n\r\n\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n");
out.write("\r\n\r\n");
out.write("\r\n\r\n");
org.ofbiz.security.Security security = null;
synchronized (application) {
security = (org.ofbiz.security.Security) pageContext.getAttribute("security", PageContext.APPLICATION_SCOPE);
if (security == null){
throw new java.lang.InstantiationException("bean security not found within scope");
}
}
out.write("\r\n");
org.ofbiz.entity.GenericDelegator delegator = null;
synchronized (application) {
delegator = (org.ofbiz.entity.GenericDelegator) pageContext.getAttribute("delegator", PageContext.APPLICATION_SCOPE);
if (delegator == null){
throw new java.lang.InstantiationException("bean delegator not found within scope");
}
}
out.write("\r\n");
com.sourcetap.sfa.event.GenericWebEventProcessor webEventProcessor = null;
synchronized (application) {
webEventProcessor = (com.sourcetap.sfa.event.GenericWebEventProcessor) pageContext.getAttribute("webEventProcessor", PageContext.APPLICATION_SCOPE);
if (webEventProcessor == null){
try {
webEventProcessor = (com.sourcetap.sfa.event.GenericWebEventProcessor) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "com.sourcetap.sfa.event.GenericWebEventProcessor");
} catch (ClassNotFoundException exc) {
throw new InstantiationException(exc.getMessage());
} catch (Exception exc) {
throw new ServletException("Cannot create bean of class " + "com.sourcetap.sfa.event.GenericWebEventProcessor", exc);
}
pageContext.setAttribute("webEventProcessor", webEventProcessor, PageContext.APPLICATION_SCOPE);
}
}
out.write("\r\n");
com.sourcetap.sfa.event.GenericEventProcessor eventProcessor = null;
synchronized (application) {
eventProcessor = (com.sourcetap.sfa.event.GenericEventProcessor) pageContext.getAttribute("eventProcessor", PageContext.APPLICATION_SCOPE);
if (eventProcessor == null){
try {
eventProcessor = (com.sourcetap.sfa.event.GenericEventProcessor) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "com.sourcetap.sfa.event.GenericEventProcessor");
} catch (ClassNotFoundException exc) {
throw new InstantiationException(exc.getMessage());
} catch (Exception exc) {
throw new ServletException("Cannot create bean of class " + "com.sourcetap.sfa.event.GenericEventProcessor", exc);
}
pageContext.setAttribute("eventProcessor", eventProcessor, PageContext.APPLICATION_SCOPE);
}
}
out.write("\r\n");
com.sourcetap.sfa.ui.UICache uiCache = null;
synchronized (application) {
uiCache = (com.sourcetap.sfa.ui.UICache) pageContext.getAttribute("uiCache", PageContext.APPLICATION_SCOPE);
if (uiCache == null){
try {
uiCache = (com.sourcetap.sfa.ui.UICache) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "com.sourcetap.sfa.ui.UICache");
} catch (ClassNotFoundException exc) {
throw new InstantiationException(exc.getMessage());
} catch (Exception exc) {
throw new ServletException("Cannot create bean of class " + "com.sourcetap.sfa.ui.UICache", exc);
}
pageContext.setAttribute("uiCache", uiCache, PageContext.APPLICATION_SCOPE);
}
}
out.write("\r\n\r\n");
out.write("<!-- [oldFunctions.jsp] Begin -->\r\n");
out.write("\r\n");
out.write("<!-- [oldFunctions.jsp] End -->\r\n\r\n");
out.write("\r\n");
out.write("<!-- [oldDeclarations.jsp] Start -->\r\n\r\n");
GenericValue userLogin = (GenericValue)session.getAttribute("_USER_LOGIN_");
out.write("\r\n");
UserInfo userInfo = (UserInfo) session.getAttribute("userInfo");
out.write("\r\n\r\n");
String partyId = "";
if (userLogin != null )
partyId = userLogin.getString("partyId");
out.write("\r\n\r\n");
DecimalFormat decimalFormat = new DecimalFormat("#,###.##");
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("MM/dd/yyyy");
SimpleDateFormat simpleTimeFormat = new SimpleDateFormat("K:mm a");
out.write("\r\n\r\n");
String controlPath=(String)request.getAttribute("_CONTROL_PATH_");
out.write("\r\n");
String contextRoot=(String)request.getAttribute("_CONTEXT_ROOT_");
out.write("\r\n\r\n");
String pageName = UtilFormatOut.checkNull((String)pageContext.getAttribute("PageName"));
out.write("\r\n\r\n");
String companyName = UtilProperties.getPropertyValue(contextRoot + "/WEB-INF/sfa.properties", "company.name");
out.write("\r\n");
String companySubtitle = UtilProperties.getPropertyValue(contextRoot + "/WEB-INF/sfa.properties", "company.subtitle");
out.write("\r\n");
String headerImageUrl = UtilProperties.getPropertyValue(contextRoot + "/WEB-INF/sfa.properties", "header.image.url");
out.write("\r\n\r\n");
String headerBoxBorderColor = UtilProperties.getPropertyValue(contextRoot + "/WEB-INF/sfa.properties", "header.box.border.color", "black");
out.write("\r\n");
String headerBoxBorderWidth = UtilProperties.getPropertyValue(contextRoot + "/WEB-INF/sfa.properties", "header.box.border.width", "1");
out.write("\r\n");
String headerBoxTopColor = UtilProperties.getPropertyValue(contextRoot + "/WEB-INF/sfa.properties", "header.box.top.color", "#336699");
out.write("\r\n");
String headerBoxBottomColor = UtilProperties.getPropertyValue(contextRoot + "/WEB-INF/sfa.properties", "header.box.bottom.color", "#cccc99");
out.write("\r\n");
String headerBoxBottomColorAlt = UtilProperties.getPropertyValue(contextRoot + "/WEB-INF/sfa.properties", "header.box.bottom.alt.color", "#eeeecc");
out.write("\r\n");
String headerBoxTopPadding = UtilProperties.getPropertyValue(contextRoot + "/WEB-INF/sfa.properties", "header.box.top.padding", "4");
out.write("\r\n");
String headerBoxBottomPadding = UtilProperties.getPropertyValue(contextRoot + "/WEB-INF/sfa.properties", "header.box.bottom.padding", "2");
out.write("\r\n\r\n");
String boxBorderColor = UtilProperties.getPropertyValue(contextRoot + "/WEB-INF/sfa.properties", "box.border.color", "black");
out.write("\r\n");
String boxBorderWidth = UtilProperties.getPropertyValue(contextRoot + "/WEB-INF/sfa.properties", "box.border.width", "1");
out.write("\r\n");
String boxTopColor = UtilProperties.getPropertyValue(contextRoot + "/WEB-INF/sfa.properties", "box.top.color", "#336699");
out.write("\r\n");
String boxBottomColor = UtilProperties.getPropertyValue(contextRoot + "/WEB-INF/sfa.properties", "box.bottom.color", "white");
out.write("\r\n");
String boxBottomColorAlt = UtilProperties.getPropertyValue(contextRoot + "/WEB-INF/sfa.properties", "box.bottom.alt.color", "white");
out.write("\r\n");
String boxTopPadding = UtilProperties.getPropertyValue(contextRoot + "/WEB-INF/sfa.properties", "box.top.padding", "4");
out.write("\r\n");
String boxBottomPadding = UtilProperties.getPropertyValue(contextRoot + "/WEB-INF/sfa.properties", "box.bottom.padding", "4");
out.write("\r\n");
String userStyleSheet = "/sfa/includes/maincss.css";
out.write("\r\n");
String alphabet[]={"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "*"};
out.write("\r\n\r\n");
out.write("<!-- [oldDeclarations.jsp] End -->\r\n\r\n");
out.write("\r\n\r\n");
out.write("<HTML>\r\n");
out.write("<HEAD>\r\n\r\n");
String clientRequest = (String)session.getAttribute("_CLIENT_REQUEST_");
//out.write("Client request: " + clientRequest + "<BR>");
String hostName = "";
if (clientRequest!=null && clientRequest.indexOf("//") > 0) {
int startPos = clientRequest.indexOf("//") + 2;
int endPos = clientRequest.indexOf(":", startPos);
if ( endPos < startPos )
endPos = clientRequest.indexOf("/", startPos);
if ( endPos < startPos )
hostName = clientRequest.substring(startPos);
else
hostName = clientRequest.substring(startPos, endPos);
} else {
hostName = "";
}
//out.write("Host name: " + hostName + "<BR>");
out.write("\r\n\r\n");
out.write("<title>");
out.print(hostName);
out.write(" - Sales Force Automation - ");
out.print(companyName);
out.write("</title>\r\n\r\n");
out.write("\r\n");
out.write("<!-- [userStyle.jsp] Start -->\r\n\r\n");
//------------ Get the style sheet
String styleSheetId = null;
ModelEntity entityStyleUser = delegator.getModelEntity("UiUserTemplate");
HashMap hashMapStyleUser = new HashMap();
if ( userLogin != null ) {
String ulogin = userLogin.getString("userLoginId");
hashMapStyleUser.put("userLoginId", ulogin);
} else {
hashMapStyleUser.put("userLoginId", "Default");
}
GenericPK stylePk = new GenericPK(entityStyleUser, hashMapStyleUser);
GenericValue userTemplate = delegator.findByPrimaryKey(stylePk);
if ( userTemplate != null ) {
styleSheetId = userTemplate.getString("styleSheetId");
}
if (styleSheetId == null){
hashMapStyleUser.put("userLoginId", "Default");
stylePk = new GenericPK(entityStyleUser, hashMapStyleUser);
userTemplate = delegator.findByPrimaryKey(stylePk);
if ( userTemplate != null ) {
styleSheetId = userTemplate.getString("styleSheetId");
}
}
if (styleSheetId != null){
ModelEntity entityStyle = delegator.getModelEntity("UiStyleTemplate");
HashMap hashMapStyle = new HashMap();
hashMapStyle.put("styleSheetId", styleSheetId);
stylePk = new GenericPK(entityStyle, hashMapStyle);
GenericValue styleTemplate = delegator.findByPrimaryKey(stylePk);
userStyleSheet = styleTemplate.getString("styleSheetLoc");
if ( userStyleSheet == null ){
userStyleSheet = "/sfa/includes/maincss.css";
}
}
out.write("\r\n");
out.write("<link rel=\"stylesheet\" href=\"");
out.print(userStyleSheet);
out.write("\" type=\"text/css\">\r\n\r\n");
out.write("<!-- [userStyle.jsp] End -->\r\n\r\n");
out.write("\r\n");
out.write("<LINK rel=\"stylesheet\" type=\"text/css\" href=\"/sfa/css/gridstyles.css\">\r\n");
out.write("<script language=\"JavaScript\" >\r\n\r\n function sendDropDown(elementName, idName, fieldName, findClass, paramName, paramValue, frm, action)\r\n {\r\n var sUrl = '");
if (_jspx_meth_ofbiz_url_0(pageContext))
return;
out.write("?findMode=filter&fieldName=' +\r\n\t\t\tfieldName + '&idName=' + idName + '¶m_' + paramName + '=' + paramValue +\r\n\t\t\t'&formName=' + frm.name + '&elementName=' + elementName + '&findClass=' + findClass + '&action=' + action;\r\n document.anchors('searchA').href=sUrl;\r\n document.anchors('searchA').click();\r\n }\r\n\r\n\r\n function sendData(ele, frm, action){\r\n if(ele.tagName != 'SELECT'){\r\n if(ele.value.length > 0){\r\n entity = ele.getAttribute(\"entityName\");\r\n field = ele.getAttribute(\"fieldName\");\r\n idName = ele.getAttribute(\"idName\");\r\n findClass = ele.getAttribute(\"findClass\");\r\n findValue = ele.value;\r\n elementName = ele.name;\r\n var sUrl = '");
if (_jspx_meth_ofbiz_url_1(pageContext))
return;
out.write("?entityName=' + entity + '&fieldName=' +\r\n\t\t\tfield + '&idName=' + idName + '&findByLikeValue=' + findValue + '&formName=' + frm.name +\r\n\t\t\t'&elementName=' + elementName + '&findClass=' + findClass + '&action=' + action;\r\n document.anchors('searchA').href=sUrl;\r\n document.anchors('searchA').click();\r\n } else {\r\n //alert('Enter search criteria to find a value.');\r\n //frm.item(ele.name).value = 'Enter search criteria.';\r\n }\r\n }\r\n }\r\n\r\n function updateForm(){\r\n var innDoc = document.frames('searchIFrame').document;\r\n var innHtml = innDoc.body.innerHTML;\r\n if(innHtml.length > 0){\r\n var sDiv = innDoc.all('searchResultDiv');\r\n if(sDiv != null){\r\n var formName = sDiv.getAttribute(\"formName\");\r\n var fieldName = sDiv.getAttribute(\"fieldName\");\r\n var elementName = sDiv.getAttribute(\"elementName\");\r\n var findClass = sDiv.getAttribute(\"findClass\");\r\n var findMode = sDiv.getAttribute(\"findMode\");\r\n var showMultiple = sDiv.getAttribute(\"showMultiple\");\r\n");
out.write(" var nde = innDoc.all(elementName);\r\n var existingNode = document.all(elementName);\r\n if(nde != null){\r\n var frm = document.forms(formName);\r\n if(nde.tagName == 'SELECT'){\r\n var opts = nde.children.tags('OPTION');\r\n if ( findMode == 'filter')\r\n {\r\n\t\t\t\tvar oldOpts = existingNode.children.tags('OPTION');\r\n//\t\t\t\talert('oldOpts.length = ' + oldOpts.length);\r\n//\t\t\t\talert('opts.length = ' + opts.length);\r\n\t\t\t\tvar numOpt = existingNode.options.length;\r\n//\t\t\t\talert('numOpt = ' + numOpt);\r\n\t\t\t\tfor (var i=0; i");
out.write("<numOpt;i++)\r\n\t\t\t\t\texistingNode.options.remove(numOpt - 1 - i);\r\n\t\t\t\tfor (var i=0; i");
out.write("<opts.length;i++)\r\n\t\t\t\t{\r\n\t\t\t\t\tvar opt = document.createElement(\"option\");\r\n\t\t\t\t\topt.setAttribute(\"value\", opts(i).value);\r\n\t\t\t\t\topt.innerText = opts(i).innerText;\r\n\t\t\t\t\texistingNode.appendChild(opt);\r\n\t\t\t\t}\r\n }\r\n else if(opts.length");
out.write("<=0){\r\n //alert('No results were found. Please try another search.');\r\n existingNode.focus();\r\n } else {\r\n var ele = document.createElement(nde.tagName);\r\n ele.id = nde.name;\r\n ele.name = nde.name;\r\n ele.setAttribute(\"className\", existingNode.getAttribute(\"className\"));\r\n\t\t\t ele.setAttribute(\"entityName\", sDiv.getAttribute(\"entityName\"));\r\n ele.setAttribute(\"fieldName\", sDiv.getAttribute(\"fieldName\"));\r\n ele.setAttribute(\"elementName\", sDiv.getAttribute(\"elementName\"));\r\n ele.setAttribute(\"idName\", sDiv.getAttribute(\"idName\"));\r\n ele.setAttribute(\"findClass\", sDiv.getAttribute(\"findClass\"));\r\n if (showMultiple == \"true\") ele.multiple = true;\r\n ele.tabIndex = existingNode.tabIndex;\r\n ele.attachEvent(\"onchange\", searchAgain);\r\n for(var i=0;i");
out.write("<opts.length;i++){\r\n var opt = document.createElement(\"option\");\r\n opt.setAttribute(\"value\", opts(i).value);\r\n opt.innerText = opts(i).innerText;\r\n ele.appendChild(opt);\r\n }\r\n var opt = document.createElement(\"option\");\r\n opt.setAttribute(\"value\", \"search again\");\r\n opt.innerText = \"Search again...\";\r\n ele.appendChild(opt);\r\n var sRepNde = elementName + 'Holder';\r\n var repNde = document.all(sRepNde);\r\n repNde.replaceChild(ele, existingNode);\r\n ele.focus();\r\n\t ele.fireEvent(\"onchange\");\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n function searchAgain(sel, frm){\r\n if(sel.tagName == 'SELECT'){\r\n var fieldName = sel.getAttribute('fieldName');\r\n var findClass = sel.getAttribute('findClass');\r\n var elementName = sel.name;\r\n var formName = frm.name;\r\n var existingNode = document.all(elementName);\r\n");
out.write(" if(sel.value == 'search again'){\r\n var ele = document.createElement(\"INPUT\");\r\n ele.id = sel.name;\r\n ele.name = sel.name;\r\n ele.type = \"TEXT\";\r\n ele.setAttribute(\"className\", existingNode.getAttribute(\"className\"));\r\n ele.setAttribute(\"entityName\", sel.getAttribute(\"entityName\"));\r\n ele.setAttribute(\"fieldName\", fieldName);\r\n ele.setAttribute(\"elementName\", elementName);\r\n ele.setAttribute(\"idName\", sel.getAttribute(\"idName\"));\r\n ele.setAttribute(\"findClass\", findClass);\r\n ele.tabIndex = sel.tabIndex;\r\n var sRepNde = elementName + 'Holder';\r\n var repNde = document.all(sRepNde);\r\n repNde.replaceChild(ele, existingNode);\r\n ele.focus();\r\n }\r\n }\r\n }\r\n\r\n // currently only used by accountPopup to force activity_accountId to be a select field\r\n function forceSearchAgain(sel, frm){\r\n if(sel.tagName == 'SELECT'){\r\n var fieldName = sel.getAttribute('fieldName');\r\n var findClass = sel.getAttribute('findClass');\r\n");
out.write(" var elementName = sel.name;\r\n var formName = frm.name;\r\n var existingNode = document.all(elementName);\r\n\t var ele = document.createElement(\"INPUT\");\r\n\t ele.id = sel.name;\r\n\t ele.name = sel.name;\r\n\t ele.type = \"TEXT\";\r\n\t ele.setAttribute(\"className\", existingNode.getAttribute(\"className\"));\r\n\t ele.setAttribute(\"entityName\", sel.getAttribute(\"entityName\"));\r\n\t ele.setAttribute(\"fieldName\", fieldName);\r\n\t ele.setAttribute(\"elementName\", elementName);\r\n\t ele.setAttribute(\"idName\", sel.getAttribute(\"idName\"));\r\n\t ele.setAttribute(\"findClass\", findClass);\r\n\t ele.tabIndex = sel.tabIndex;\r\n\t var sRepNde = elementName + 'Holder';\r\n\t var repNde = document.all(sRepNde);\r\n\t repNde.replaceChild(ele, existingNode);\r\n }\r\n }\r\n\r\nvar currentCol = 0;\r\nvar previousCol = -1;\r\nvar reverse = false;\r\n\r\n function CompareAlpha(a, b) {\r\n if (a[currentCol] ");
out.write("< b[currentCol]) { return -1; }\r\n if (a[currentCol] > b[currentCol]) { return 1; }\r\n return 0;\r\n }\r\n\r\n function CompareAlphaIgnore(a, b) {\r\n strA = a[currentCol].toLowerCase();\r\n strB = b[currentCol].toLowerCase();\r\n if (strA ");
out.write("< strB) { return -1;\r\n } else {\r\n if (strA > strB) { return 1;\r\n } else { return 0;\r\n }\r\n }\r\n }\r\n\r\n function CompareDate(a, b) {\r\n datA = new Date(a[currentCol]);\r\n datB = new Date(b[currentCol]);\r\n if (datA ");
out.write("< datB) { return -1;\r\n } else {\r\n if (datA > datB) { return 1;\r\n } else { return 0;\r\n }\r\n }\r\n }\r\n\r\n function CompareDateEuro(a, b) {\r\n strA = a[currentCol].split(\".\");\r\n strB = b[currentCol].split(\".\");\r\n datA = new Date(strA[2], strA[1], strA[0]);\r\n datB = new Date(strB[2], strB[1], strB[0]);\r\n if (datA ");
out.write("< datB) { return -1;\r\n } else {\r\n if (datA > datB) { return 1;\r\n } else { return 0;\r\n }\r\n }\r\n }\r\n\r\n function CompareNumeric(a, b) {\r\n numA = a[currentCol];\r\n numB = b[currentCol];\r\n if (isNaN(numA)) { return 0;\r\n } else {\r\n if (isNaN(numB)) { return 0;\r\n } else { return numA - numB;\r\n }\r\n }\r\n }\r\n\r\nfunction TableSort(myTable, myCol, myType) {\r\n\r\n var mySource = document.all(myTable);\r\n var myRows = mySource.rows.length;\r\n var myCols = mySource.rows(0).cells.length;\r\n currentCol = myCol\r\n\r\n var theadrow = mySource.parentElement.tHead;\r\n var imgcol= theadrow.all('srtImg');\r\n for(var x = 0; x ");
out.write("< imgcol.length; x++){\r\n imgcol[x].src = \"dude07232001blank.gif\";\r\n imgcol[x].alt = \"sort\";\r\n }\r\n\r\n if(previousCol == myCol){\r\n if(reverse == false){\r\n imgcol[myCol-1].src = \"dude07232001down.gif\";\r\n reverse = true;\r\n } else {\r\n imgcol[myCol-1].src = \"dude07232001up.gif\";\r\n reverse = false;\r\n }\r\n } else {\r\n reverse = false;\r\n imgcol[myCol-1].src = \"dude07232001up.gif\";\r\n }\r\n\r\n myArray = new Array(myRows)\r\n for (i=0; i ");
out.write("< myRows; i++) {\r\n myArray[i] = new Array(myCols)\r\n for (j=0; j ");
out.write("< myCols; j++) {\r\n myArray[i][j] = document.all(myTable).rows(i).cells(j).innerHTML;\r\n }\r\n }\r\n\r\n if (myCol == previousCol) {\r\n myArray.reverse();\r\n } else {\r\n switch (myType) {\r\n case \"a\":\r\n myArray.sort(CompareAlpha);\r\n break;\r\n case \"ai\":\r\n myArray.sort(CompareAlphaIgnore);\r\n break;\r\n case \"d\":\r\n myArray.sort(CompareDate);\r\n break;\r\n case \"de\":\r\n myArray.sort(CompareDateEuro);\r\n break;\r\n case \"n\":\r\n myArray.sort(CompareNumeric);\r\n break;\r\n default:\r\n myArray.sort();\r\n }\r\n }\r\n\r\n\r\n // Re-write the table contents\r\n for (i=0; i ");
out.write("< myRows; i++) {\r\n for (j=0; j ");
out.write("< myCols; j++) {\r\n mySource.rows(i).cells(j).innerHTML = myArray[i][j];\r\n }\r\n }\r\n\r\n previousCol = myCol;\r\n highlightSelectedRow();\r\n return 0;\r\n\r\n}\r\n\r\n function fixSize() {\r\n // The body represents the outer-most frameset for frameset documents.\r\n if ( parent.name == \"content\" )\r\n {\r\n\t maxH = parent.document.body.clientHeight - 150;\r\n\t topH = document.body.scrollHeight + 10;\r\n\t if ( topH > maxH )\r\n\t \ttopH = maxH;\r\n\t \t\r\n\t parent.document.body.rows = topH + \", *\"\r\n\t //window.frames.headerFrame.document.body.rows = window.frames.headerFrame.document.body.scrollHeight + \", *\" \r\n\t // Walk into the header frame and get the scrollHeight - \r\n\t // this represents the height of the contents in pixels. \r\n\t }\r\n }\r\n");
out.write("</script>\r\n\r\n\r\n");
out.write("\r\n\r\n");
out.write("</HEAD>\r\n\r\n");
out.write("<BASE TARGET=\"content\">\r\n");
out.write("<!--");
out.write("<BODY CLASS=\"bodyform\" onbeforeunload=\"verifyClose()\">-->\r\n");
out.write("<BODY CLASS=\"bodyform\"\">\r\n\r\n");
out.write("\r\n");
out.write("<!-- onBeforeUnload.jsp - Start -->\r\n\r\n");
out.write("<SCRIPT LANGUAGE=\"JScript\" TYPE=\"text/javascript\" FOR=window EVENT=onbeforeunload>\r\n return doOnBeforeUnload();\r\n");
out.write("</SCRIPT>\r\n\r\n");
out.write("<SCRIPT LANGUAGE=\"JScript\" TYPE=\"text/javascript\">\r\n\r\n // Create variable we can change to prevent the check from being done.\r\n var checkForChanges = true;\r\n \r\n function doOnBeforeUnload() {\r\n // This script fires when anything is about to cause the current page to be unloaded.\r\n // If any unsaved changes have been made, this script returns a non-empty string, which\r\n // causes a response window to warn the user that changes will be lost, and to allow\r\n // them to cancel.\r\n \r\n // In free form, tabular, and select screen sections built by the UI builder,\r\n // the preSubmit method fired by the onSubmit event of the form removes this script from\r\n // the onBeforeUnload event, which prevents this check from happening if the Save button\r\n // was just clicked.\r\n \r\n // alert(\"event.fromElement: \" + event.fromElement);\r\n \r\n // See if the checkForChanges flag has been cleared. If so, just allow the\r\n // body unload to continue.\r\n if (!checkForChanges) return;\r\n \r\n // Look at all forms on the page to see if any of them have any changes.\r\n");
out.write(" var vFormC = document.forms;\r\n for (var vFormNbr = 0; vFormNbr ");
out.write("< vFormC.length; vFormNbr++) {\r\n //alert(\"[verifyClose] Window name: \" + window.name);\r\n //alert(\"[verifyClose] Checking form #\" + vFormNbr);\r\n var vFormObj = vFormC.item(vFormNbr);\r\n //alert(\"[verifyClose] Form name is \" + vFormObj.name);\r\n \r\n // Check the action. If it's query or view mode, don't bother checking this form.\r\n var vActionObj = vFormObj.elements.item(\"action\");\r\n if (vActionObj != null) {\r\n var vAction = vActionObj.value;\r\n if (vAction!=null) {\r\n //alert(\"Action: \" + vAction);\r\n if (vAction==\"");
out.print(UIScreenSection.ACTION_INSERT);
out.write("\" ||\r\n vAction==\"");
out.print(UIScreenSection.ACTION_UPDATE);
out.write("\" ||\r\n vAction==\"");
out.print(UIScreenSection.ACTION_UPDATE_SELECT);
out.write("\") {\r\n \r\n // This is an updateable form in an updateable mode. Check for changes.\r\n \r\n // Look through all the objects in the form to see if there are any unsaved changes.\r\n var vElemC = vFormObj.elements;\r\n for (var vElemNbr = 0; vElemNbr ");
out.write("< vElemC.length; vElemNbr++) {\r\n var vElemObj = vElemC.item(vElemNbr);\r\n \r\n // Find out if this is the \"add\" or \"delete\" select object that appears on a \"select\" type screen section.\r\n //alert(\"[window.onbeforeunload] Object name: \" + vElemObj.name);\r\n if (vElemObj.name.indexOf(\"DBSel\")>=0) {\r\n // This is the add or delete select object. See if there are any items in it. If so, it means\r\n // the user has made changes.\r\n if (vElemObj.length > 0) {\r\n // Changes have been made. Trigger the response window.\r\n return \"IF YOU CLICK OK, YOUR CHANGES WILL BE LOST.\";\r\n } else {\r\n // No changes in this add or delete select object.\r\n }\r\n } else {\r\n // Object is not the add or delete select object.\");\r\n // See if this element is an original value field.\r\n var vOrigPrefix = \"");
out.print(UIWebUtility.HTML_NAME_PREFIX_ORIGINAL);
out.write("\";\r\n if (vElemObj.name.indexOf(vOrigPrefix)==0) {\r\n // This is an original value field. Compare its value to the current value field.\r\n var vOrigElemObj = vElemObj;\r\n var vOrigElemName = vOrigElemObj.name;\r\n var vCurElemName = vOrigElemName.substring(vOrigPrefix.length, vOrigElemName.length);\r\n var vCurElemObj = vElemC.item(vCurElemName);\r\n var vCurElemTagName = vCurElemObj.tagName;\r\n var vCurElemType = vCurElemObj.type;\r\n if (vCurElemObj!=null) {\r\n // Got the current field. Compare the values.\r\n var vCurValue;\r\n if (vCurElemTagName==\"INPUT\" && vCurElemType==\"checkbox\") {\r\n // This is a check box. Use special processing to get current value.\r\n vCurValue = vCurElemObj.checked ? \"Y\" : \"N\";\r\n } else {\r\n // Not a check box.\r\n vCurValue = vCurElemObj.value;\r\n }\r\n var vOrigValue = vOrigElemObj.value;\r\n if (vCurValue != vOrigValue) {\r\n // This field was changed. Trigger the response window.\r\n");
out.write(" // alert('Field ' + vCurElemName + ' changed.');\r\n // alert('Original Value: ' + vOrigValue);\r\n // alert('Current Value: ' + vCurValue);\r\n return \"IF YOU CLICK OK, YOUR CHANGES WILL BE LOST.\";\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n }\r\n");
out.write("</SCRIPT>\r\n\r\n");
out.write("<!-- onBeforeUnload.jsp - End -->\r\n\r\n\r\n");
out.write("\r\n\r\n");
out.write("<script>\r\n// Title: Timestamp picker\r\n// Description: See the demo at url\r\n// URL: http://us.geocities.com/tspicker/\r\n// Script featured on: http://javascriptkit.com/script/script2/timestamp.shtml\r\n// Version: 1.0\r\n// Date: 12-05-2001 (mm-dd-yyyy)\r\n// Author: Denis Gritcyuk ");
out.write("<denis@softcomplex.com>; ");
out.write("<tspicker@yahoo.com>\r\n// Notes: Permission given to use this script in any kind of applications if\r\n// header lines are left unchanged. Feel free to contact the author\r\n// for feature requests and/or donations\r\n\r\nfunction setCalendarHasFocus(aFormObj, aHasFocus) {\r\n\t// Set hidden variable to show that a popup calendar is about to\r\n\t// be displayed. This variable will be tested in the onBeforeUnload\r\n\t// handling to avoid popping up a confimation prompt.\r\n\talert(\"setCalendarHasFocus start - \" + aHasFocus);\r\n\tvar vCalendarHasFocusObj = aFormObj.elements.item(\"calendarHasFocus\");\r\n\tif (vCalendarHasFocusObj == null) {\r\n\t\t//alert(\"Did not find calendarHasFocus hidden field\");\r\n\t} else {\r\n\t\t//alert(\"Found calendarHasFocus hidden field\");\r\n\t\tif (aHasFocus) {\r\n\t\t\t//alert(\"Setting calendarHasFocus to true\");\r\n\t\t\tvCalendarHasFocusObj.value = \"true\";\r\n\t\t} else {\r\n\t\t\t//alert(\"Setting calendarHasFocus to false\");\r\n\t\t\tvCalendarHasFocusObj.value = \"false\";\r\n\t\t}\r\n\t}\r\n\treturn false;\r\n}\r\n\r\nfunction show_calendar(str_target, str_datetime, isDateTime) {\r\n");
out.write("//\talert(\"show_calendar start\");\r\n\tvar arr_months = [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\",\r\n\t\t\"July\", \"August\", \"September\", \"October\", \"November\", \"December\"];\r\n\tvar week_days = [\"Su\", \"Mo\", \"Tu\", \"We\", \"Th\", \"Fr\", \"Sa\"];\r\n\tvar n_weekstart = 1; // day week starts from (normally 0 or 1)\r\n\r\n\tvar dt_datetime = (str_datetime == null || str_datetime ==\"\" ? new Date() : str2datetime(str_datetime) );\r\n\tvar dt_prev_month = new Date(dt_datetime);\r\n\tdt_prev_month.setMonth(dt_datetime.getMonth()-1);\r\n\tvar dt_next_month = new Date(dt_datetime);\r\n\tdt_next_month.setMonth(dt_datetime.getMonth()+1);\r\n\tvar dt_firstday = new Date(dt_datetime);\r\n\tdt_firstday.setDate(1);\r\n\tdt_firstday.setDate(1-(7+dt_firstday.getDay()-n_weekstart)%7);\r\n\tvar dt_lastday = new Date(dt_next_month);\r\n\tdt_lastday.setDate(0);\r\n\t\r\n\t// html generation (feel free to tune it for your particular application)\r\n\t// print calendar header\r\n\tvar str_buffer = new String (\r\n\t\t\"");
out.write("<html>\\n\"+\r\n\t\t\" ");
out.write("<head>\\n\"+\r\n\t\t\" ");
out.write("<title>Calendar");
out.write("</title>\\n\"+\r\n\t\t\" ");
out.write("</head>\\n\"+\r\n\t\t\" ");
out.write("<body bgcolor=\\\"White\\\">\\n\"+\r\n\t\t\" ");
out.write("<table class=\\\"clsOTable\\\" cellspacing=\\\"0\\\" border=\\\"0\\\" width=\\\"100%\\\">\\n\" +\r\n\t\t\" ");
out.write("<tr>\\n\" +\r\n\t\t\" ");
out.write("<td bgcolor=\\\"#4682B4\\\">\\n\" +\r\n\t\t\" ");
out.write("<table cellspacing=\\\"1\\\" cellpadding=\\\"3\\\" border=\\\"0\\\" width=\\\"100%\\\">\\n\" +\r\n\t\t\" ");
out.write("<tr>\\n\" +\r\n\t\t\" ");
out.write("<td bgcolor=\\\"#4682B4\\\">\\n\" +\r\n\t\t\" ");
out.write("<a href=\\\"javascript:window.opener.show_calendar('\"+\r\n\t\t str_target + \"', '\" + dt2dtstr(dt_prev_month)+\"'+' ' +document.cal.time.value);\\\">\" +\r\n\t\t\" ");
out.write("<img src=\\\"/sfaimages/prev.gif\\\" width=\\\"16\\\" height=\\\"16\\\" border=\\\"0\\\"\" +\r\n\t\t\" alt=\\\"previous month\\\">\\n\" +\r\n\t\t\" ");
out.write("</a>\\n\" +\r\n\t\t\" ");
out.write("</td>\\n\" +\r\n\t\t\" ");
out.write("<td bgcolor=\\\"#4682B4\\\" colspan=\\\"5\\\">\\n\" +\r\n\t\t\" ");
out.write("<font color=\\\"white\\\" face=\\\"tahoma, verdana\\\" size=\\\"2\\\">\\n\" +\r\n\t\t\" \" + arr_months[dt_datetime.getMonth()] + \" \" + dt_datetime.getFullYear() + \"\\n\" +\r\n\t\t\" ");
out.write("</font>\\n\" +\r\n\t\t\" ");
out.write("</td>\\n\" +\r\n\t\t\" ");
out.write("<td bgcolor=\\\"#4682B4\\\" align=\\\"right\\\">\\n\" +\r\n\t\t\" ");
out.write("<a href=\\\"javascript:window.opener.show_calendar('\" +\r\n\t\t str_target+\"', '\"+dt2dtstr(dt_next_month)+\"'+' ' +document.cal.time.value);\\\">\\n\" +\r\n\t\t\" ");
out.write("<img src=\\\"/sfaimages/next.gif\\\" width=\\\"16\\\" height=\\\"16\\\" border=\\\"0\\\"\" +\r\n\t\t\" alt=\\\"next month\\\">\\n\" +\r\n\t\t\" ");
out.write("</a>\\n\" +\r\n\t\t\" ");
out.write("</td>\\n\" +\r\n\t\t\" ");
out.write("</tr>\\n\"\r\n\t);\r\n\r\n\tvar dt_current_day = new Date(dt_firstday);\r\n\t// print weekdays titles\r\n\tstr_buffer += \" ");
out.write("<tr>\\n\";\r\n\tfor (var n=0; n");
out.write("<7; n++)\r\n\t\tstr_buffer += \" ");
out.write("<td bgcolor=\\\"#87CEFA\\\">\\n\" +\r\n\t\t\" ");
out.write("<font color=\\\"white\\\" face=\\\"tahoma, verdana\\\" size=\\\"2\\\">\\n\" +\r\n\t\t\" \" + week_days[(n_weekstart+n)%7] + \"\\n\" +\r\n\t\t\" ");
out.write("</font>");
out.write("</td>\\n\";\r\n\t// print calendar table\r\n\tstr_buffer += \" ");
out.write("</tr>\\n\";\r\n\twhile (dt_current_day.getMonth() == dt_datetime.getMonth() ||\r\n\t\tdt_current_day.getMonth() == dt_firstday.getMonth()) {\r\n\t\t// print row heder\r\n\t\tstr_buffer += \" ");
out.write("<tr>\\n\";\r\n\t\tfor (var n_current_wday=0; n_current_wday");
out.write("<7; n_current_wday++) {\r\n\t\t\t\tif (dt_current_day.getDate() == dt_datetime.getDate() &&\r\n\t\t\t\t\tdt_current_day.getMonth() == dt_datetime.getMonth())\r\n\t\t\t\t\t// print current date\r\n\t\t\t\t\tstr_buffer += \" ");
out.write("<td bgcolor=\\\"#FFB6C1\\\" align=\\\"right\\\">\\n\";\r\n\t\t\t\telse if (dt_current_day.getDay() == 0 || dt_current_day.getDay() == 6)\r\n\t\t\t\t\t// weekend days\r\n\t\t\t\t\tstr_buffer += \" ");
out.write("<td bgcolor=\\\"#DBEAF5\\\" align=\\\"right\\\">\\n\";\r\n\t\t\t\telse\r\n\t\t\t\t\t// print working days of current month\r\n\t\t\t\t\tstr_buffer += \" ");
out.write("<td bgcolor=\\\"white\\\" align=\\\"right\\\">\\n\";\r\n\r\n\t\t\t\tif (isDateTime == \"1\" )\r\n\t\t\t\t\tstr_buffer += \" ");
out.write("<a href=\\\"javascript:window.opener.\" + str_target +\r\n\t\t\t\t\t\t\".value='\"+dt2dtstr(dt_current_day)+\"'+' ' +document.cal.time.value;window.close();\\\">\\n\";\r\n\t\t\t\telse\r\n\t\t\t\t\tstr_buffer += \" ");
out.write("<a href=\\\"javascript:window.opener.\" + str_target +\r\n\t\t\t\t\t\t\".value='\"+dt2dtstr(dt_current_day)+\"';window.close();\\\">\\n\";\r\n\t\t\t\t\t\r\n\t\t\t\tif (dt_current_day.getMonth() == dt_datetime.getMonth())\r\n\t\t\t\t\t// print days of current month\r\n\t\t\t\t\tstr_buffer += \" ");
out.write("<font color=\\\"black\\\" face=\\\"tahoma, verdana\\\" size=\\\"2\\\">\\n\";\r\n\t\t\t\telse \r\n\t\t\t\t\t// print days of other months\r\n\t\t\t\t\tstr_buffer += \" ");
out.write("<font color=\\\"gray\\\" face=\\\"tahoma, verdana\\\" size=\\\"2\\\">\\n\";\r\n\t\t\t\t\t\r\n\t\t\t\tstr_buffer += \" \" + dt_current_day.getDate() + \"\\n\" +\r\n\t\t\t\t\" ");
out.write("</font>\\n\" +\r\n\t\t\t\t\" ");
out.write("</a>\\n\" +\r\n\t\t\t\t\" ");
out.write("</td>\\n\";\r\n\t\t\t\tdt_current_day.setDate(dt_current_day.getDate()+1);\r\n\t\t}\r\n\t\t// print row footer\r\n\t\tstr_buffer += \" ");
out.write("</tr>\\n\";\r\n\t}\r\n\t// print calendar footer\r\n\tstr_buffer +=\r\n\t\t\" ");
out.write("<form name=\\\"cal\\\">\\n\" +\r\n\t\t\" ");
out.write("<tr>\\n\" +\r\n\t\t\" ");
out.write("<td colspan=\\\"7\\\" bgcolor=\\\"#87CEFA\\\">\\n\" +\r\n\t\t\" ");
out.write("<font color=\\\"White\\\" face=\\\"tahoma, verdana\\\" size=\\\"2\\\">\\n\" +\r\n\t\t\" Time:\\n\" +\r\n\t\t\" ");
out.write("<input type=\\\"text\\\" name=\\\"time\\\" value=\\\"\" + dt2tmstr(dt_datetime) +\r\n\t\t\"\\\" size=\\\"8\\\" maxlength=\\\"8\\\">\\n\" +\r\n\t\t\" ");
out.write("</font>\\n\" +\r\n\t\t\" ");
out.write("</td>\\n\" +\r\n\t\t\" ");
out.write("</tr>\\n\" +\r\n\t\t\" ");
out.write("</form>\\n\" +\r\n\t\t\" ");
out.write("</table>\\n\" +\r\n\t\t\" ");
out.write("</tr>\\n\" +\r\n\t\t\" ");
out.write("</td>\\n\" +\r\n\t\t\" ");
out.write("</table>\\n\" +\r\n\t\t\" ");
out.write("</body>\\n\" +\r\n\t\t\"");
out.write("</html>\\n\";\r\n\r\n\t//alert(\"Fixin to open window\");\r\n\tvar vWinCal = window.open(\"\", \"Calendar\", \r\n\t\t\"width=200,height=250,status=no,resizable=yes,top=200,left=200\");\r\n\t//alert(\"Fixin to set window opener to self\");\r\n\tvWinCal.opener = self;\r\n\tvar calc_doc = vWinCal.document;\r\n\t//alert(\"Fixin to write str_buffer\");\r\n\tcalc_doc.write (str_buffer);\r\n\tcalc_doc.close();\r\n}\r\n// datetime parsing and formatting routimes. modify them if you wish other datetime format\r\nfunction str2datetime (str_datetime) {\r\n\tvar re_date = /^(\\d+)\\/(\\d+)\\/(\\d+)\\s+(\\d+)\\:(\\d+)\\:(\\d+)$/;\r\n\tif (!re_date.exec(str_datetime))\r\n\t\treturn str2date(str_datetime)\r\n\treturn (new Date (RegExp.$3, RegExp.$1-1, RegExp.$2, RegExp.$4, RegExp.$5, RegExp.$6));\r\n}\r\nfunction str2date (str_date) {\r\n\tvar re_date = /^(\\d+)\\/(\\d+)\\/(\\d+)$/;\r\n\tif (!re_date.exec(str_date))\r\n\t\treturn alert(\"Invalid Date format: \"+ str_date);\r\n\treturn (new Date (RegExp.$3, RegExp.$1-1, RegExp.$2, 0, 0, 0));\r\n}\r\n\r\nfunction dt2dtstr (dt_datetime) {\r\n\treturn (new String (\r\n\t\t\t(dt_datetime.getMonth()+1)+\"/\"+dt_datetime.getDate()+\"/\"+dt_datetime.getFullYear()));\r\n");
out.write("}\r\nfunction dt2tmstr (dt_datetime) {\r\n\treturn (new String (\r\n\t\t\tdt_datetime.getHours()+\":\"+dt_datetime.getMinutes()+\":\"+dt_datetime.getSeconds()));\r\n}\r\n\r\n");
out.write("</script>\r\n");
out.write("\r\n\r\n");
out.write("\r\n");
com.sourcetap.sfa.lead.LeadEventProcessor leadEventProcessor = null;
synchronized (application) {
leadEventProcessor = (com.sourcetap.sfa.lead.LeadEventProcessor) pageContext.getAttribute("leadEventProcessor", PageContext.APPLICATION_SCOPE);
if (leadEventProcessor == null){
try {
leadEventProcessor = (com.sourcetap.sfa.lead.LeadEventProcessor) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "com.sourcetap.sfa.lead.LeadEventProcessor");
} catch (ClassNotFoundException exc) {
throw new InstantiationException(exc.getMessage());
} catch (Exception exc) {
throw new ServletException("Cannot create bean of class " + "com.sourcetap.sfa.lead.LeadEventProcessor", exc);
}
pageContext.setAttribute("leadEventProcessor", leadEventProcessor, PageContext.APPLICATION_SCOPE);
}
}
out.write("\r\n");
com.sourcetap.sfa.event.GenericImportEventProcessor importEventProcessor = null;
synchronized (application) {
importEventProcessor = (com.sourcetap.sfa.event.GenericImportEventProcessor) pageContext.getAttribute("importEventProcessor", PageContext.APPLICATION_SCOPE);
if (importEventProcessor == null){
try {
importEventProcessor = (com.sourcetap.sfa.event.GenericImportEventProcessor) java.beans.Beans.instantiate(this.getClass().getClassLoader(), "com.sourcetap.sfa.event.GenericImportEventProcessor");
} catch (ClassNotFoundException exc) {
throw new InstantiationException(exc.getMessage());
} catch (Exception exc) {
throw new ServletException("Cannot create bean of class " + "com.sourcetap.sfa.event.GenericImportEventProcessor", exc);
}
pageContext.setAttribute("importEventProcessor", importEventProcessor, PageContext.APPLICATION_SCOPE);
}
}
out.write("\r\n\r\n");
String screen = "LEAD";
String screenSection = "LeadHeader";
String entityName = "Lead";
CsvConverter csvConverter = null;
String action = "start"; // default action
if ( request.getParameter("action") != null )
{
action = request.getParameter("action");
}
try{
if(action.equals("start")){
ModelEntity entity = delegator.getModelEntity(entityName);
UIWebScreenSection uiWebScreenSection = importEventProcessor.getUiWebScreenSection(userInfo, screen, screenSection, delegator, uiCache);
List fields = uiWebScreenSection.getDisplayFields(uiCache);
int numFields = fields.size();
out.write("\r\n\t\t\t");
out.write("<table width=\"100%\" class=\"freeFormSectionDisplayTable\">");
out.write("<tr>");
out.write("<td valign=\"top\">\r\n\t\t\t");
out.write("<tr>");
out.write("<td>");
out.write("<center>");
out.write("<b>Choose Fields to include in Form.");
out.write("</b>");
out.write("</center>");
out.write("</td>");
out.write("</tr>\r\n\t\t\t");
out.write("<tr>");
out.write("<td>\r\n\t\t\t ");
out.write("<!-- title table -->\r\n\t\t\t\t\t ");
out.write("<center>");
out.write("<table class=\"freeFormSectionDisplayTable\" cellspacing=\"0\" cellpadding=\"2\" id='queryListTable'>\r\n\t\t\t\t\t ");
out.write("<form method=\"post\" action=\"/sfa/control/leadCaptureSetup\">\r\n\t\t\t\t\t\t ");
out.write("<input type=hidden name=action value=\"generate\">\r\n\t\t\t\t\t\t ");
out.write("<input type=\"hidden\" name=\"numFields\" value=\"");
out.print(numFields);
out.write("\">\r\n\t\t\t\t\t\t\t");
out.write("<input type=hidden id=queryListMaxRows name=queryListMaxRows value=4>\r\n \t\t\t\t\t\t");
out.write("<tr>");
out.write("<td class=freeFormSectionLabel>");
out.write("<center>Field");
out.write("<center>");
out.write("</td>\r\n\t\t\t\t\t\t ");
out.write("<td class=freeFormSectionLabel>");
out.write("<center>Label");
out.write("</center>");
out.write("</td>\r\n\t\t\t\t\t\t");
out.write("</tr>\r\n");
Iterator fieldIter = fields.iterator();
StringBuffer fieldNameOptions = new StringBuffer(200);
while (fieldIter.hasNext())
{
UIFieldInfo fieldInfo = (UIFieldInfo)fieldIter.next();
// if ( fieldInfo.getIsVisible() && !fieldInfo.getIsReadOnly() )
String fieldName = UIWebUtility.getHtmlName(screenSection, fieldInfo, 0);
String displayName = fieldInfo.getDisplayLabel();
if ( fieldName.equals("lastUpdatedStamp") || fieldName.equals("lastUpdatedTxStamp") ||
fieldName.equals("createdStamp") || fieldName.equals("createdTxStamp") )
continue;
String htmlName = fieldName;
String displayObjectId = fieldInfo.getDisplayObjectId();
String displayTypeId = "TEXT"; //fieldInfo.getDisplayTypeId();
String attributeId = fieldInfo.getAttributeId();
String displayLabel = fieldInfo.getDisplayLabel();
String optValue = htmlName + ";" + attributeId + ";" + displayTypeId + ";" + displayObjectId + ";" + displayLabel;
fieldNameOptions.append("<option value='" + optValue + "'>" + displayLabel + "</option>");
}
for ( int i=1; i < 5; i++)
{
out.write("<tr id=queryListRow" + i + "><td><select name=queryListField" + i + ">" + fieldNameOptions.toString() + "</select></td>\n");
out.write(" <td><input name=queryListLabel" + i + " size=30></td>\n");
out.write(" <td><img src=/sfaimages/remove.gif alt=Del onClick=delConditionRow(" + i + ")>\n");
out.write(" <img src=/sfaimages/add.gif alt=Add onClick=addConditionRow(" + i + ")></td>\n");
out.write("</tr>");
}
out.write("\r\n\t\t\t\t");
out.write("</table>");
out.write("</center>\r\n\t\t\t\t");
out.write("</td>");
out.write("</tr>\r\n\t\t\t\t");
out.write("<tr>");
out.write("<td>");
out.write("<center>\r\n\t\t\t\t");
out.write("<table>");
out.write("<tr>");
out.write("<td>URL to Redirect to on Success:");
out.write("</td>");
out.write("<td>");
out.write("<input name=\"onSuccessURL\" size=80>");
out.write("</td>");
out.write("</tr>\r\n\t\t\t\t ");
out.write("<tr>");
out.write("<td>URL to Redirect to on Error:");
out.write("</td>");
out.write("<td>");
out.write("<input name=\"onErrorURL\" size=80>");
out.write("</td>");
out.write("</tr>\t\r\n\t\t\t\t");
out.write("</table>\t\t\t\r\n\t\t\t\t");
out.write("<tr>");
out.write("<td>");
out.write("<center>");
out.write("<input type=submit value=\"Generate HTML\">");
out.write("</center>");
out.write("</td>");
out.write("</tr>\r\n\t\t\t\t");
out.write("</form>\r\n\t\t\t");
out.write("</table>\r\n\t\t\t\r\n\t\t\t");
out.write("<script type='text/javascript'>\r\n\t\t\tfunction addConditionRow(i) {\r\n\t\t\t\tvar tab1=document.getElementById('queryListTable')\r\n\t\t\t\tif ( tab1 ) {\r\n\t\t\t\t\tvar numRows = tab1.rows.length\r\n\t\t\t\t\tvar maxRows = 30\r\n\t\t\t\t\tif ( numRows > maxRows )\r\n\t\t\t\t\t\talert(\"Can't have more than 10 fields\");\r\n\t\t\t\t\telse {\r\n\t\t\t\t\t\tvar x = tab1.insertRow(numRows)\r\n\t\t\t\t\t\tvar maxRows = document.getElementById('queryListMaxRows')\r\n\t\t\t\t\t\tvar newRow = maxRows.value - -1\r\n\t\t\t\t\t\tmaxRows.value = newRow\r\n\t\t\t\t\t\tx.id = \"queryListRow\" + newRow\r\n\t\t\t\t\t\tvar c1=x.insertCell(0)\r\n\t\t\t\t\t\tvar c2=x.insertCell(1)\r\n\t\t\t\t\t\tvar c3=x.insertCell(2)\r\n\t\t\t\t\t\tc1.innerHTML=\"");
out.write("<select name=queryListField\" + newRow + \">");
out.print(fieldNameOptions.toString());
out.write("</select>\"\r\n\t\t\t\t\t\tc2.innerHTML=\"");
out.write("<input name=queryListLabel\" + newRow + \" size=30>\"\r\n\t\t\t\t\t\tc3.innerHTML=\"");
out.write("<img src=/sfaimages/remove.gif alt=Del onClick=delConditionRow(\" + newRow + \")>\" + \" ");
out.write("<img src=/sfaimages/add.gif alt=Add onClick=addConditionRow(\" + newRow + \")>\"\r\n\t\t\t\t\t}\r\n\t\t\t\t\tfixSize()\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\tfunction delConditionRow(i)\r\n\t\t\t{\r\n\t\t\t\tvar row1 = document.getElementById('queryListRow' + i)\r\n\t\t\t\tvar tab = document.getElementById('queryListTable')\r\n\t\t\t\tvar rows = tab.rows\r\n\t\t\t\tif ( rows.length == 2 ) {\r\n\t\t\t\t\tevent.returnValue = false\r\n\t\t\t\t\treturn;\r\n\t\t\t\t}\r\n\t\t\t\tfor ( i=0; i ");
out.write("< rows.length; i++ ) {\r\n\t\t\t\t\trow = rows[i];\r\n\t\t\t\t\tif ( row.id == row1.id) {\r\n\t\t\t\t\t\ttab.deleteRow(i);\r\n\t\t\t\t\t\tbreak;\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tfixSize()\r\n\t\t\t}\r\n\t\t\t");
out.write("</script>\r\n\t\t\t\r\n");
} else if(action.equals("generate")) {
StringBuffer formHTML = new StringBuffer(1000);
String successURL = UtilFormatOut.checkNull(request.getParameter("onSuccessURL"));
String errorURL = UtilFormatOut.checkNull(request.getParameter("onErrorURL"));
String path = request.getRequestURL().toString();
int lastSlash = path.lastIndexOf('/');
path = path.substring(0, lastSlash);
formHTML.append("<form action=" + path + "/leadCapture target='_self' method=post>\n");
formHTML.append("<input type=hidden name=action value='save'>\n");
formHTML.append("<input type=hidden name=cid value='" + userInfo.getAccountId() + "'>\n");
formHTML.append("<input type=hidden name=uid value='" + userInfo.getPartyId() + "'>\n");
formHTML.append("<input type=hidden name=onSuccess value='" + successURL + "'>\n");
formHTML.append("<input type=hidden name=onError value='" + errorURL+ "'>\n");
formHTML.append("<table>\n");
String queryListMaxRows = request.getParameter("queryListMaxRows");
// if queryListMaxRows is set, then we are using advanced query mode
if ( (queryListMaxRows != null ) && ( queryListMaxRows.length() > 0) )
{
int maxRows = Integer.valueOf(queryListMaxRows).intValue();
for ( int i=1; i <= maxRows; i++ )
{
String qlFieldInfo = request.getParameter("queryListField" + i);
if ( ( qlFieldInfo != null ) && ( qlFieldInfo.length() > 0 ) )
{
StringTokenizer tokSemi = new StringTokenizer(qlFieldInfo,";");
String qlFieldName = "";
String qlAttributeId = "";
String qlDisplayObjectId = "";
String qlDisplayTypeId = "";
String qlDisplayLabel = "";
if (tokSemi.countTokens() == 5) {
qlFieldName = tokSemi.nextToken();
qlAttributeId = tokSemi.nextToken();
qlDisplayTypeId = tokSemi.nextToken();
qlDisplayObjectId = tokSemi.nextToken();
qlDisplayLabel = tokSemi.nextToken();
}
else
{
qlFieldName = qlFieldInfo;
}
String qlLabel = request.getParameter("queryListLabel" + i);
if ( (qlLabel == null ) || ( qlLabel.length() < 1) )
qlLabel = qlDisplayLabel;
formHTML.append("<tr><td>" + qlLabel + "<td><input name='" + qlFieldName + "' size=30></td></tr>\n");
}
}
}
formHTML.append("<tr><td colspan=2><center><input type=submit value=submit></center></td></tr>\n");
formHTML.append("</table>\n");
formHTML.append("</form>\n");
out.write("<center><br><h3>copy and paste the code below into your web page</h3><p>\n");
out.write("<textarea rows=20 cols=80>" + formHTML.toString() + "</textarea></center>");
} else {
out.write("csv Null error");
}
out.write("\r\n");
out.write("</table>\r\n\r\n ");
} catch (Exception e) { e.printStackTrace();
}
out.write("\r\n\r\n");
out.write(" ");
out.write("<!-- left column table -->\r\n ");
out.write("</td>\r\n ");
out.write("</tr>\r\n");
out.write("</table>\r\n\r\n\r\n");
out.write("<!-- used to get dynamic information from a server -->\r\n");
out.write("<A style='visibility:hidden' id='searchA' name='searchA' target=\"searchIFrame\">");
out.write("</A>\r\n");
out.write("<iframe style='visibility:hidden; width:0; height:0; margin:0; padding:0;' id='searchIFrame' name='searchIFrame' FRAMEBORDER=0 FRAMESPACING=0 MARGINWIDTH=0 MARGINHEIGHT=0 onload='updateForm();' >");
out.write("</iframe>\r\n");
out.write("<!--");
out.write("<iframe id='searchIFrame' name='searchIFrame' WIDTH=\"100%\" onload='updateForm();' >");
out.write("</iframe>-->\r\n\r\n\r\n");
out.write("</body>\r\n");
out.write("</html>\r\n");
out.write("\r\n");
} catch (Throwable t) {
out = _jspx_out;
if (out != null && out.getBufferSize() != 0)
out.clearBuffer();
if (pageContext != null) pageContext.handlePageException(t);
} finally {
if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
}
}
private boolean _jspx_meth_ofbiz_url_0(javax.servlet.jsp.PageContext pageContext)
throws Throwable {
JspWriter out = pageContext.getOut();
/* ---- ofbiz:url ---- */
org.ofbiz.content.webapp.taglib.UrlTag _jspx_th_ofbiz_url_0 = (org.ofbiz.content.webapp.taglib.UrlTag) _jspx_tagPool_ofbiz_url.get(org.ofbiz.content.webapp.taglib.UrlTag.class);
_jspx_th_ofbiz_url_0.setPageContext(pageContext);
_jspx_th_ofbiz_url_0.setParent(null);
int _jspx_eval_ofbiz_url_0 = _jspx_th_ofbiz_url_0.doStartTag();
if (_jspx_eval_ofbiz_url_0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
if (_jspx_eval_ofbiz_url_0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
javax.servlet.jsp.tagext.BodyContent _bc = pageContext.pushBody();
out = _bc;
_jspx_th_ofbiz_url_0.setBodyContent(_bc);
_jspx_th_ofbiz_url_0.doInitBody();
}
do {
out.write("/testServer");
int evalDoAfterBody = _jspx_th_ofbiz_url_0.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
if (_jspx_eval_ofbiz_url_0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE)
out = pageContext.popBody();
}
if (_jspx_th_ofbiz_url_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE)
return true;
_jspx_tagPool_ofbiz_url.reuse(_jspx_th_ofbiz_url_0);
return false;
}
private boolean _jspx_meth_ofbiz_url_1(javax.servlet.jsp.PageContext pageContext)
throws Throwable {
JspWriter out = pageContext.getOut();
/* ---- ofbiz:url ---- */
org.ofbiz.content.webapp.taglib.UrlTag _jspx_th_ofbiz_url_1 = (org.ofbiz.content.webapp.taglib.UrlTag) _jspx_tagPool_ofbiz_url.get(org.ofbiz.content.webapp.taglib.UrlTag.class);
_jspx_th_ofbiz_url_1.setPageContext(pageContext);
_jspx_th_ofbiz_url_1.setParent(null);
int _jspx_eval_ofbiz_url_1 = _jspx_th_ofbiz_url_1.doStartTag();
if (_jspx_eval_ofbiz_url_1 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
if (_jspx_eval_ofbiz_url_1 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
javax.servlet.jsp.tagext.BodyContent _bc = pageContext.pushBody();
out = _bc;
_jspx_th_ofbiz_url_1.setBodyContent(_bc);
_jspx_th_ofbiz_url_1.doInitBody();
}
do {
out.write("/testServer");
int evalDoAfterBody = _jspx_th_ofbiz_url_1.doAfterBody();
if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
break;
} while (true);
if (_jspx_eval_ofbiz_url_1 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE)
out = pageContext.popBody();
}
if (_jspx_th_ofbiz_url_1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE)
return true;
_jspx_tagPool_ofbiz_url.reuse(_jspx_th_ofbiz_url_1);
return false;
}
}