Source Code Cross Referenced for leadCaptureSetup_jsp.java in  » ERP-CRM-Financial » SourceTap-CRM » org » apache » jsp » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » ERP CRM Financial » SourceTap CRM » org.apache.jsp 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        package org.apache.jsp;
0002:
0003:        import javax.servlet.*;
0004:        import javax.servlet.http.*;
0005:        import javax.servlet.jsp.*;
0006:        import org.apache.jasper.runtime.*;
0007:        import org.ofbiz.entity.*;
0008:        import org.ofbiz.entity.model.*;
0009:        import java.lang.reflect.Method;
0010:        import java.util.*;
0011:        import java.io.*;
0012:        import org.ofbiz.entity.util.SequenceUtil;
0013:        import com.sourcetap.sfa.replication.*;
0014:        import com.sourcetap.sfa.ui.*;
0015:        import com.sourcetap.sfa.event.*;
0016:        import com.sourcetap.sfa.util.*;
0017:        import java.net.*;
0018:        import javax.servlet.ServletException;
0019:        import javax.servlet.http.HttpServletRequest;
0020:        import javax.servlet.http.HttpServletResponse;
0021:        import javax.servlet.http.HttpServlet;
0022:        import java.util.Date;
0023:        import java.util.List;
0024:        import java.util.Map;
0025:        import java.util.Vector;
0026:        import java.util.ArrayList;
0027:        import java.util.Enumeration;
0028:        import java.util.Iterator;
0029:        import java.util.HashMap;
0030:        import java.util.Calendar;
0031:        import java.util.StringTokenizer;
0032:        import java.text.SimpleDateFormat;
0033:        import java.text.DecimalFormat;
0034:        import java.text.ParseException;
0035:        import java.sql.Timestamp;
0036:        import java.sql.Time;
0037:        import java.sql.*;
0038:        import org.ofbiz.entity.util.SequenceUtil;
0039:        import org.ofbiz.security.*;
0040:        import org.ofbiz.entity.*;
0041:        import org.ofbiz.entity.condition.*;
0042:        import org.ofbiz.entity.model.*;
0043:        import org.ofbiz.base.util.*;
0044:        import com.sourcetap.sfa.ui.*;
0045:        import com.sourcetap.sfa.event.*;
0046:        import com.sourcetap.sfa.util.UserInfo;
0047:
0048:        public class leadCaptureSetup_jsp extends HttpJspBase {
0049:
0050:            /*
0051:             *  Takes a string in the following format:
0052:             *    formatString
0053:             *  Where the first letter is lowercase, and
0054:             *  subsequent unique words begin with an upper case.
0055:             *  The function will convert a java string to a regular
0056:             *  string in title case format.
0057:             */
0058:            String formatJavaString(String s) {
0059:                char ca[] = s.toCharArray();
0060:                StringBuffer sb = new StringBuffer();
0061:                int previous = 0;
0062:                for (int i = 0; i < ca.length; i++) {
0063:                    if (i == s.length() - 1) {
0064:                        sb.append(s.substring(previous, previous + 1)
0065:                                .toUpperCase());
0066:                        sb.append(s.substring(previous + 1, s.length()));
0067:                    }
0068:                    if (Character.isUpperCase(ca[i])) {
0069:                        sb.append(s.substring(previous, previous + 1)
0070:                                .toUpperCase());
0071:                        sb.append(s.substring(previous + 1, i));
0072:                        sb.append(" ");
0073:                        previous = i;
0074:                    }
0075:                }
0076:                return sb.toString();
0077:            }
0078:
0079:            /**
0080:             Properties must include:
0081:              NAME-name of the select used in name-value form submit.
0082:              VALUE_FIELD-the value sent in form submit.
0083:              DISPLAY_FIELD-the field used in the display of the drop-down. use a
0084:              Properties can include:
0085:              Selected-The value to test for, and set selected on the drop-down
0086:              EMPTY_FIRST: if just a blank field use "{field display vaalue}, else if value supplied use "{field value}, {field value display name}"
0087:             */
0088:            String buildDropDown(List l, Map properties) {
0089:                StringBuffer returnString = new StringBuffer();
0090:                GenericValue genericValue = null;
0091:                Iterator i = l.iterator();
0092:                String selected = ((String) (properties.get("SELECTED") != null ? properties
0093:                        .get("SELECTED")
0094:                        : ""));
0095:                String display = ((String) (properties.get("DISPLAY_FIELD") != null ? properties
0096:                        .get("DISPLAY_FIELD")
0097:                        : ""));
0098:                String selectJavaScript = ((String) (properties
0099:                        .get("SELECT_JAVASCRIPT") != null ? properties
0100:                        .get("SELECT_JAVASCRIPT") : ""));
0101:                returnString.append("<select name=\"" + properties.get("NAME")
0102:                        + "\" " + selectJavaScript + " >");
0103:                if (properties.get("EMPTY_FIRST") != null) {
0104:                    String empty = (String) properties.get("EMPTY_FIRST");
0105:                    if (empty.indexOf(",") != -1) {
0106:                        StringTokenizer tok = new StringTokenizer(empty, ",");
0107:                        returnString.append("<option value=\""
0108:                                + ((String) tok.nextElement()).trim() + "\">"
0109:                                + ((String) tok.nextElement()).trim());
0110:                    } else {
0111:                        returnString.append("<option value=\"\">" + empty);
0112:                    }
0113:                }
0114:                try {
0115:                    while (i.hasNext()) {
0116:                        genericValue = (GenericValue) i.next();
0117:                        returnString.append("<option value=\""
0118:                                + String.valueOf(genericValue
0119:                                        .get((String) properties
0120:                                                .get("VALUE_FIELD"))) + "\"");
0121:                        if (String.valueOf(
0122:                                genericValue.get((String) properties
0123:                                        .get("VALUE_FIELD"))).equals(selected)) {
0124:                            returnString.append(" SELECTED ");
0125:                        }
0126:                        returnString.append(" >");
0127:                        if (display.indexOf(",") != -1) {
0128:                            StringTokenizer tok = new StringTokenizer(display,
0129:                                    ",");
0130:                            while (tok.hasMoreElements()) {
0131:                                String elem = (String) tok.nextElement();
0132:                                returnString.append(String.valueOf(genericValue
0133:                                        .get(elem.trim())));
0134:                                returnString.append(" ");
0135:                            }
0136:                        } else {
0137:                            returnString.append(genericValue.get(display));
0138:                        }
0139:                    }
0140:                } catch (Exception e) {
0141:                    e.printStackTrace();
0142:                }
0143:                returnString.append("</select>");
0144:                return returnString.toString();
0145:            }
0146:
0147:            String buildStringDropDown(List l, Map properties) {
0148:                StringBuffer returnString = new StringBuffer();
0149:                String value = "";
0150:                Iterator i = l.iterator();
0151:                String selected = ((String) (properties.get("SELECTED") != null ? properties
0152:                        .get("SELECTED")
0153:                        : ""));
0154:                String display = ((String) (properties.get("DISPLAY_FIELD") != null ? properties
0155:                        .get("DISPLAY_FIELD")
0156:                        : ""));
0157:                String selectJavaScript = ((String) (properties
0158:                        .get("SELECT_JAVASCRIPT") != null ? properties
0159:                        .get("SELECT_JAVASCRIPT") : ""));
0160:                returnString.append("<select name=\"" + properties.get("NAME")
0161:                        + "\" " + selectJavaScript + " >");
0162:                if (properties.get("EMPTY_FIRST") != null) {
0163:                    String empty = (String) properties.get("EMPTY_FIRST");
0164:                    if (empty.indexOf(",") != -1) {
0165:                        StringTokenizer tok = new StringTokenizer(empty, ",");
0166:                        returnString.append("<option value=\""
0167:                                + ((String) tok.nextElement()).trim() + "\">"
0168:                                + ((String) tok.nextElement()).trim());
0169:                    } else {
0170:                        returnString.append("<option value=\"\">" + empty);
0171:                    }
0172:                }
0173:                while (i.hasNext()) {
0174:                    value = (String) i.next();
0175:                    returnString.append("<option value=\"" + value + "\"");
0176:                    if (value.equals(selected)) {
0177:                        returnString.append(" SELECTED ");
0178:                    }
0179:                    returnString.append(" >");
0180:                    if (display.indexOf(",") != -1) {
0181:                        StringTokenizer tok = new StringTokenizer(display, ",");
0182:                        while (tok.hasMoreElements()) {
0183:                            String elem = (String) tok.nextElement();
0184:                            returnString.append(value);
0185:                            returnString.append(" ");
0186:                        }
0187:                    } else {
0188:                        returnString.append(value);
0189:                    }
0190:                }
0191:                returnString.append("</select>");
0192:                return returnString.toString();
0193:            }
0194:
0195:            String buildFieldDropDown(Vector fields, String entityName,
0196:                    HashMap properties) {
0197:                if (properties == null)
0198:                    properties = new HashMap();
0199:                StringBuffer returnString = new StringBuffer();
0200:                ModelField modelField = null;
0201:                String selected = ((String) (properties.get("SELECTED") != null ? properties
0202:                        .get("SELECTED")
0203:                        : ""));
0204:                returnString.append("<select name=\"" + entityName + "\" >");
0205:                if (properties.get("EMPTY_FIRST") != null)
0206:                    returnString.append("<option value=\"\">"
0207:                            + properties.get("EMPTY_FIRST"));
0208:                for (int i = 0; i < fields.size(); i++) {
0209:                    modelField = (ModelField) fields.get(i);
0210:                    returnString.append("<option value=\""
0211:                            + modelField.getName() + "\"");
0212:                    if ((modelField.getName()).equals(selected)) {
0213:                        returnString.append(" SELECTED ");
0214:                    }
0215:                    returnString.append(" >"
0216:                            + formatJavaString(modelField.getName()));
0217:                }
0218:                returnString.append("</select>");
0219:                return returnString.toString();
0220:            }
0221:
0222:            /**
0223:             * Checks a List of fields to see if the string
0224:             * that is passed in exists in the vector.  If so,
0225:             * it returns the ModelField for the named field, else
0226:             * it returns null.
0227:             */
0228:            ModelField contains(List v, String s) {
0229:                ModelField field;
0230:                for (int i = 0; i < v.size(); i++) {
0231:                    field = (ModelField) v.get(i);
0232:                    if (field.getName().equals(s))
0233:                        return field;
0234:                }
0235:                return null;
0236:            }
0237:
0238:            String buildUIFieldDropDown(String sectionName, List fields,
0239:                    String entityName, HashMap properties) {
0240:                if (properties == null)
0241:                    properties = new HashMap();
0242:                StringBuffer returnString = new StringBuffer();
0243:                UIFieldInfo fieldInfo = null;
0244:                String selected = ((String) (properties.get("SELECTED") != null ? properties
0245:                        .get("SELECTED")
0246:                        : ""));
0247:                returnString.append("<select name=\"" + entityName + "\" >");
0248:                if (properties.get("EMPTY_FIRST") != null)
0249:                    returnString.append("<option value=\"\">"
0250:                            + properties.get("EMPTY_FIRST"));
0251:                for (int i = 0; i < fields.size(); i++) {
0252:                    fieldInfo = (UIFieldInfo) fields.get(i);
0253:                    if (fieldInfo.getIsVisible() && !fieldInfo.getIsReadOnly()) {
0254:                        String attrId = UIWebUtility.getHtmlName(sectionName,
0255:                                fieldInfo, 0);
0256:                        String attrName = fieldInfo.getDisplayLabel();
0257:                        returnString.append("<option value=\"" + attrId + "\"");
0258:                        if (attrName.equals(selected)) {
0259:                            returnString.append(" SELECTED ");
0260:                        }
0261:                        returnString.append(" >" + attrName);
0262:                    }
0263:                }
0264:                returnString.append("</select>");
0265:                return returnString.toString();
0266:            }
0267:
0268:            /**
0269:             * Given a ModelField and a value, this function checks the datatype for the field, and
0270:             * converts the value to the correct datatype.
0271:             */
0272:            GenericValue setCorrectDataType(GenericValue entity,
0273:                    ModelField curField, String value) {
0274:                ModelFieldTypeReader modelFieldTypeReader = new ModelFieldTypeReader(
0275:                        "mysql");
0276:                ModelFieldType mft = modelFieldTypeReader
0277:                        .getModelFieldType(curField.getType());
0278:                String fieldType = mft.getJavaType();
0279:                SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
0280:                SimpleDateFormat timeFormat = new SimpleDateFormat(
0281:                        "yyyy-MM-dd hh:mm a");
0282:
0283:                if (fieldType.equals("java.lang.String")
0284:                        || fieldType.equals("String")) {
0285:                    if (mft.getType().equals("indicator")) {
0286:                        if (value.equals("on"))
0287:                            entity.set(curField.getName(), "Y");
0288:                        else if (value.equals("off"))
0289:                            entity.set(curField.getName(), "N");
0290:                        else
0291:                            entity.set(curField.getName(), value);
0292:                    } else
0293:                        entity.set(curField.getName(), value);
0294:                } else if (fieldType.equals("java.sql.Timestamp")
0295:                        || fieldType.equals("Timestamp")) {
0296:                    if (value.trim().length() == 0) {
0297:                        entity.set(curField.getName(), null);
0298:                    } else {
0299:                        try {
0300:                            entity.set(curField.getName(), new Timestamp(
0301:                                    timeFormat.parse(value).getTime()));
0302:                        } catch (ParseException e) {
0303:                            e.printStackTrace();
0304:                        } //WTD: Implement error processing for ParseException.  i.e. get rid of the printStackTrace()
0305:                    }
0306:                } else if (fieldType.equals("java.sql.Time")
0307:                        || fieldType.equals("Time")) {
0308:                    if (value.trim().length() == 0) {
0309:                        entity.set(curField.getName(), null);
0310:                    } else {
0311:                        try {
0312:                            entity.set(curField.getName(), new Time(timeFormat
0313:                                    .parse(value).getTime()));
0314:                        } catch (ParseException e) {
0315:                            e.printStackTrace();
0316:                        } //WTD: Implement error processing for ParseException.  i.e. get rid of the printStackTrace()
0317:                    }
0318:                } else if (fieldType.equals("java.util.Date")) {
0319:                    if (value.trim().length() == 0) {
0320:                        entity.set(curField.getName(), null);
0321:                    } else {
0322:                        try {
0323:                            entity.set(curField.getName(), new java.sql.Date(
0324:                                    dateFormat.parse(value).getTime()));
0325:                        } catch (ParseException e) {
0326:                            e.printStackTrace();
0327:                        } //WTD: Implement error processing for ParseException.  i.e. get rid of the printStackTrace()
0328:                    }
0329:                } else if (fieldType.equals("java.sql.Date")
0330:                        || fieldType.equals("Date")) {
0331:                    if (value.trim().length() == 0) {
0332:                        entity.set(curField.getName(), null);
0333:                    } else {
0334:                        try {
0335:                            entity.set(curField.getName(), new java.sql.Date(
0336:                                    dateFormat.parse(value).getTime()));
0337:                        } catch (ParseException e) {
0338:                            e.printStackTrace();
0339:                        } //WTD: Implement error processing for ParseException.  i.e. get rid of the printStackTrace()
0340:                    }
0341:                } else if (fieldType.equals("java.lang.Integer")
0342:                        || fieldType.equals("Integer")) {
0343:                    if (value.trim().length() == 0)
0344:                        value = "0";
0345:                    entity.set(curField.getName(), Integer.valueOf(value));
0346:                } else if (fieldType.equals("java.lang.Long")
0347:                        || fieldType.equals("Long")) {
0348:                    if (value.trim().length() == 0)
0349:                        value = "0";
0350:                    entity.set(curField.getName(), Long.valueOf(value));
0351:                } else if (fieldType.equals("java.lang.Float")
0352:                        || fieldType.equals("Float")) {
0353:                    if (value.trim().length() == 0)
0354:                        value = "0.0";
0355:                    entity.set(curField.getName(), Float.valueOf(value));
0356:                } else if (fieldType.equals("java.lang.Double")
0357:                        || fieldType.equals("Double")) {
0358:                    if (value.trim().length() == 0 || value == null)
0359:                        value = "0";
0360:                    entity.set(curField.getName(), Double.valueOf(value));
0361:                }
0362:                return entity;
0363:            }
0364:
0365:            String getFieldValue(List l, String fieldName, String equalsValue,
0366:                    String returnFieldName) {
0367:                Iterator i = l.iterator();
0368:                GenericEntity genericEntity = null;
0369:                String retVal = "";
0370:                //TODO: add StringTokenizer to parse multiple fields.
0371:                while (i.hasNext()) {
0372:                    genericEntity = (GenericValue) i.next();
0373:                    if (String.valueOf(genericEntity.get(fieldName)).equals(
0374:                            equalsValue))
0375:                        retVal = String.valueOf(genericEntity
0376:                                .get(returnFieldName));
0377:                }
0378:                return retVal;
0379:            }
0380:
0381:            String getFieldValue(HttpServletRequest request, String fieldName) {
0382:                return (request.getParameter(fieldName) != null ? request
0383:                        .getParameter(fieldName) : "");
0384:            }
0385:
0386:            Vector getGenericValue(List l, String fieldName, String equalsValue) {
0387:                Vector returnVector = new Vector();
0388:                GenericValue genericValue = null;
0389:                GenericValue genericValues[] = (GenericValue[]) l
0390:                        .toArray(new GenericValue[0]);
0391:                for (int i = 0; i < genericValues.length; i++) {
0392:                    genericValue = (GenericValue) genericValues[i];
0393:                    if (String.valueOf(genericValue.get(fieldName)).equals(
0394:                            equalsValue))
0395:                        returnVector.add(genericValue);
0396:                }
0397:                return returnVector;
0398:            }
0399:
0400:            String getDateTimeFieldValue(List l, String fieldName,
0401:                    String equalsValue, String returnFieldName,
0402:                    String dateFormatString) {
0403:                GenericValue genericValue = null;
0404:                GenericValue genericValues[] = (GenericValue[]) l
0405:                        .toArray(new GenericValue[0]);
0406:                String retVal = "";
0407:                SimpleDateFormat dateFormat = new SimpleDateFormat(
0408:                        dateFormatString);
0409:                for (int i = 0; i < genericValues.length; i++) {
0410:                    genericValue = genericValues[i];
0411:                    try {
0412:                        if (dateFormat.parse(genericValue.getString(fieldName))
0413:                                .equals(dateFormat.parse(equalsValue)))
0414:                            retVal = String.valueOf(genericValue
0415:                                    .get(returnFieldName));
0416:                    } catch (ParseException e) {
0417:                        e.printStackTrace();
0418:                    }
0419:                }
0420:                return retVal;
0421:            }
0422:
0423:            Vector getDateTimeGenericValue(List l, String fieldName,
0424:                    String equalsValue, String dateFormatString) {
0425:                Vector returnVector = new Vector();
0426:                GenericValue genericValue = null;
0427:                GenericValue genericValues[] = (GenericValue[]) l
0428:                        .toArray(new GenericValue[0]);
0429:                String retVal = "";
0430:                SimpleDateFormat dateFormat = new SimpleDateFormat(
0431:                        dateFormatString);
0432:                for (int i = 0; i < genericValues.length; i++) {
0433:                    genericValue = genericValues[i];
0434:                    try {
0435:                        if (dateFormat.parse(genericValue.getString(fieldName))
0436:                                .equals(dateFormat.parse(equalsValue)))
0437:                            returnVector.add(genericValue);
0438:                    } catch (ParseException e) {
0439:                        e.printStackTrace();
0440:                    }
0441:                }
0442:                return returnVector;
0443:            }
0444:
0445:            String getStatesDropDown(String name, String selected) {
0446:                if (name == null)
0447:                    return null;
0448:                StringBuffer returnString = new StringBuffer();
0449:                returnString.append("<select class=\"\" name=\"" + name
0450:                        + "\" >");
0451:                returnString.append("<option "
0452:                        + (selected == null || selected.equals("") ? "selected"
0453:                                : "") + " >");
0454:                returnString
0455:                        .append("<option "
0456:                                + (selected != null && selected.equals("AK") ? "selected"
0457:                                        : "") + " >AK");
0458:                returnString
0459:                        .append("<option"
0460:                                + (selected != null
0461:                                        && selected.equalsIgnoreCase("AL") ? " selected"
0462:                                        : "") + ">AL");
0463:                returnString
0464:                        .append("<option"
0465:                                + (selected != null
0466:                                        && selected.equalsIgnoreCase("AR") ? " selected"
0467:                                        : "") + ">AR");
0468:                returnString
0469:                        .append("<option"
0470:                                + (selected != null
0471:                                        && selected.equalsIgnoreCase("AZ") ? " selected"
0472:                                        : "") + ">AZ");
0473:                returnString
0474:                        .append("<option"
0475:                                + (selected != null
0476:                                        && selected.equalsIgnoreCase("CA") ? " selected"
0477:                                        : "") + ">CA");
0478:                returnString
0479:                        .append("<option"
0480:                                + (selected != null
0481:                                        && selected.equalsIgnoreCase("CO") ? " selected"
0482:                                        : "") + ">CO");
0483:                returnString
0484:                        .append("<option"
0485:                                + (selected != null
0486:                                        && selected.equalsIgnoreCase("CT") ? " selected"
0487:                                        : "") + ">CT");
0488:                returnString
0489:                        .append("<option"
0490:                                + (selected != null
0491:                                        && selected.equalsIgnoreCase("DC") ? " selected"
0492:                                        : "") + ">DC");
0493:                returnString
0494:                        .append("<option"
0495:                                + (selected != null
0496:                                        && selected.equalsIgnoreCase("DE") ? " selected"
0497:                                        : "") + ">DE");
0498:                returnString
0499:                        .append("<option"
0500:                                + (selected != null
0501:                                        && selected.equalsIgnoreCase("FL") ? " selected"
0502:                                        : "") + ">FL");
0503:                returnString
0504:                        .append("<option"
0505:                                + (selected != null
0506:                                        && selected.equalsIgnoreCase("GA") ? " selected"
0507:                                        : "") + ">GA");
0508:                returnString
0509:                        .append("<option"
0510:                                + (selected != null
0511:                                        && selected.equalsIgnoreCase("GU") ? " selected"
0512:                                        : "") + ">GU");
0513:                returnString
0514:                        .append("<option"
0515:                                + (selected != null
0516:                                        && selected.equalsIgnoreCase("HI") ? " selected"
0517:                                        : "") + ">HI");
0518:                returnString
0519:                        .append("<option"
0520:                                + (selected != null
0521:                                        && selected.equalsIgnoreCase("IA") ? " selected"
0522:                                        : "") + ">IA");
0523:                returnString
0524:                        .append("<option"
0525:                                + (selected != null
0526:                                        && selected.equalsIgnoreCase("ID") ? " selected"
0527:                                        : "") + ">ID");
0528:                returnString
0529:                        .append("<option"
0530:                                + (selected != null
0531:                                        && selected.equalsIgnoreCase("IL") ? " selected"
0532:                                        : "") + ">IL");
0533:                returnString
0534:                        .append("<option"
0535:                                + (selected != null
0536:                                        && selected.equalsIgnoreCase("IN") ? " selected"
0537:                                        : "") + ">IN");
0538:                returnString
0539:                        .append("<option"
0540:                                + (selected != null
0541:                                        && selected.equalsIgnoreCase("KS") ? " selected"
0542:                                        : "") + ">KS");
0543:                returnString
0544:                        .append("<option"
0545:                                + (selected != null
0546:                                        && selected.equalsIgnoreCase("KY") ? " selected"
0547:                                        : "") + ">KY");
0548:                returnString
0549:                        .append("<option"
0550:                                + (selected != null
0551:                                        && selected.equalsIgnoreCase("LA") ? " selected"
0552:                                        : "") + ">LA");
0553:                returnString
0554:                        .append("<option"
0555:                                + (selected != null
0556:                                        && selected.equalsIgnoreCase("MA") ? " selected"
0557:                                        : "") + ">MA");
0558:                returnString
0559:                        .append("<option"
0560:                                + (selected != null
0561:                                        && selected.equalsIgnoreCase("MD") ? " selected"
0562:                                        : "") + ">MD");
0563:                returnString
0564:                        .append("<option"
0565:                                + (selected != null
0566:                                        && selected.equalsIgnoreCase("ME") ? " selected"
0567:                                        : "") + ">ME");
0568:                returnString
0569:                        .append("<option"
0570:                                + (selected != null
0571:                                        && selected.equalsIgnoreCase("MI") ? " selected"
0572:                                        : "") + ">MI");
0573:                returnString
0574:                        .append("<option"
0575:                                + (selected != null
0576:                                        && selected.equalsIgnoreCase("MN") ? " selected"
0577:                                        : "") + ">MN");
0578:                returnString
0579:                        .append("<option"
0580:                                + (selected != null
0581:                                        && selected.equalsIgnoreCase("MO") ? " selected"
0582:                                        : "") + ">MO");
0583:                returnString
0584:                        .append("<option"
0585:                                + (selected != null
0586:                                        && selected.equalsIgnoreCase("MS") ? " selected"
0587:                                        : "") + ">MS");
0588:                returnString
0589:                        .append("<option"
0590:                                + (selected != null
0591:                                        && selected.equalsIgnoreCase("MT") ? " selected"
0592:                                        : "") + ">MT");
0593:                returnString
0594:                        .append("<option"
0595:                                + (selected != null
0596:                                        && selected.equalsIgnoreCase("NC") ? " selected"
0597:                                        : "") + ">NC");
0598:                returnString
0599:                        .append("<option"
0600:                                + (selected != null
0601:                                        && selected.equalsIgnoreCase("ND") ? " selected"
0602:                                        : "") + ">ND");
0603:                returnString
0604:                        .append("<option"
0605:                                + (selected != null
0606:                                        && selected.equalsIgnoreCase("NE") ? " selected"
0607:                                        : "") + ">NE");
0608:                returnString
0609:                        .append("<option"
0610:                                + (selected != null
0611:                                        && selected.equalsIgnoreCase("NH") ? " selected"
0612:                                        : "") + ">NH");
0613:                returnString
0614:                        .append("<option"
0615:                                + (selected != null
0616:                                        && selected.equalsIgnoreCase("NJ") ? " selected"
0617:                                        : "") + ">NJ");
0618:                returnString
0619:                        .append("<option"
0620:                                + (selected != null
0621:                                        && selected.equalsIgnoreCase("NM") ? " selected"
0622:                                        : "") + ">NM");
0623:                returnString
0624:                        .append("<option"
0625:                                + (selected != null
0626:                                        && selected.equalsIgnoreCase("NV") ? " selected"
0627:                                        : "") + ">NV");
0628:                returnString
0629:                        .append("<option"
0630:                                + (selected != null
0631:                                        && selected.equalsIgnoreCase("NY") ? " selected"
0632:                                        : "") + ">NY");
0633:                returnString
0634:                        .append("<option"
0635:                                + (selected != null
0636:                                        && selected.equalsIgnoreCase("OH") ? " selected"
0637:                                        : "") + ">OH");
0638:                returnString
0639:                        .append("<option"
0640:                                + (selected != null
0641:                                        && selected.equalsIgnoreCase("OK") ? " selected"
0642:                                        : "") + ">OK");
0643:                returnString
0644:                        .append("<option"
0645:                                + (selected != null
0646:                                        && selected.equalsIgnoreCase("OR") ? " selected"
0647:                                        : "") + ">OR");
0648:                returnString
0649:                        .append("<option"
0650:                                + (selected != null
0651:                                        && selected.equalsIgnoreCase("PA") ? " selected"
0652:                                        : "") + ">PA");
0653:                returnString
0654:                        .append("<option"
0655:                                + (selected != null
0656:                                        && selected.equalsIgnoreCase("PR") ? " selected"
0657:                                        : "") + ">PR");
0658:                returnString
0659:                        .append("<option"
0660:                                + (selected != null
0661:                                        && selected.equalsIgnoreCase("RI") ? " selected"
0662:                                        : "") + ">RI");
0663:                returnString
0664:                        .append("<option"
0665:                                + (selected != null
0666:                                        && selected.equalsIgnoreCase("SC") ? " selected"
0667:                                        : "") + ">SC");
0668:                returnString
0669:                        .append("<option"
0670:                                + (selected != null
0671:                                        && selected.equalsIgnoreCase("SD") ? " selected"
0672:                                        : "") + ">SD");
0673:                returnString
0674:                        .append("<option"
0675:                                + (selected != null
0676:                                        && selected.equalsIgnoreCase("TN") ? " selected"
0677:                                        : "") + ">TN");
0678:                returnString
0679:                        .append("<option"
0680:                                + (selected != null
0681:                                        && selected.equalsIgnoreCase("TX") ? " selected"
0682:                                        : "") + ">TX");
0683:                returnString
0684:                        .append("<option"
0685:                                + (selected != null
0686:                                        && selected.equalsIgnoreCase("UT") ? " selected"
0687:                                        : "") + ">UT");
0688:                returnString
0689:                        .append("<option"
0690:                                + (selected != null
0691:                                        && selected.equalsIgnoreCase("VA") ? " selected"
0692:                                        : "") + ">VA");
0693:                returnString
0694:                        .append("<option"
0695:                                + (selected != null
0696:                                        && selected.equalsIgnoreCase("VI") ? " selected"
0697:                                        : "") + ">VI");
0698:                returnString
0699:                        .append("<option"
0700:                                + (selected != null
0701:                                        && selected.equalsIgnoreCase("VT") ? " selected"
0702:                                        : "") + ">VT");
0703:                returnString
0704:                        .append("<option"
0705:                                + (selected != null
0706:                                        && selected.equalsIgnoreCase("WA") ? " selected"
0707:                                        : "") + ">WA");
0708:                returnString
0709:                        .append("<option"
0710:                                + (selected != null
0711:                                        && selected.equalsIgnoreCase("WI") ? " selected"
0712:                                        : "") + ">WI");
0713:                returnString
0714:                        .append("<option"
0715:                                + (selected != null
0716:                                        && selected.equalsIgnoreCase("WV") ? " selected"
0717:                                        : "") + ">WV");
0718:                returnString
0719:                        .append("<option"
0720:                                + (selected != null
0721:                                        && selected.equalsIgnoreCase("WY") ? " selected"
0722:                                        : "") + ">WY");
0723:                returnString.append("</select>");
0724:                return returnString.toString();
0725:            }
0726:
0727:            private static java.util.Vector _jspx_includes;
0728:
0729:            static {
0730:                _jspx_includes = new java.util.Vector(9);
0731:                _jspx_includes.add("/includes/header.jsp");
0732:                _jspx_includes.add("/includes/oldFunctions.jsp");
0733:                _jspx_includes.add("/includes/oldDeclarations.jsp");
0734:                _jspx_includes.add("/includes/windowTitle.jsp");
0735:                _jspx_includes.add("/includes/userStyle.jsp");
0736:                _jspx_includes.add("/includes/uiFunctions.js");
0737:                _jspx_includes.add("/includes/onBeforeUnload.jsp");
0738:                _jspx_includes.add("/includes/ts_picker.js");
0739:                _jspx_includes.add("/includes/footer.jsp");
0740:            }
0741:
0742:            private org.apache.jasper.runtime.TagHandlerPool _jspx_tagPool_ofbiz_url;
0743:
0744:            public leadCaptureSetup_jsp() {
0745:                _jspx_tagPool_ofbiz_url = new org.apache.jasper.runtime.TagHandlerPool();
0746:            }
0747:
0748:            public java.util.List getIncludes() {
0749:                return _jspx_includes;
0750:            }
0751:
0752:            public void _jspDestroy() {
0753:                _jspx_tagPool_ofbiz_url.release();
0754:            }
0755:
0756:            public void _jspService(HttpServletRequest request,
0757:                    HttpServletResponse response) throws java.io.IOException,
0758:                    ServletException {
0759:
0760:                JspFactory _jspxFactory = null;
0761:                javax.servlet.jsp.PageContext pageContext = null;
0762:                HttpSession session = null;
0763:                ServletContext application = null;
0764:                ServletConfig config = null;
0765:                JspWriter out = null;
0766:                Object page = this ;
0767:                JspWriter _jspx_out = null;
0768:
0769:                try {
0770:                    _jspxFactory = JspFactory.getDefaultFactory();
0771:                    response.setContentType("text/html;charset=ISO-8859-1");
0772:                    pageContext = _jspxFactory.getPageContext(this , request,
0773:                            response, null, true, 8192, true);
0774:                    application = pageContext.getServletContext();
0775:                    config = pageContext.getServletConfig();
0776:                    session = pageContext.getSession();
0777:                    out = pageContext.getOut();
0778:                    _jspx_out = out;
0779:
0780:                    out.write("\r\n");
0781:                    out.write("\r\n");
0782:                    out.write("\r\n");
0783:                    out.write("\r\n");
0784:                    out.write("\r\n");
0785:                    out.write("\r\n");
0786:                    out.write("\r\n");
0787:                    out.write("\r\n");
0788:                    out.write("\r\n");
0789:                    out.write("\r\n");
0790:                    out.write("\r\n\r\n");
0791:                    out.write("\r\n");
0792:                    out.write("\r\n");
0793:                    out.write("\r\n");
0794:                    out.write("\r\n\r\n\r\n");
0795:                    out.write("\r\n");
0796:                    out.write("\r\n");
0797:                    out.write("\r\n");
0798:                    out.write("\r\n");
0799:                    out.write("\r\n");
0800:                    out.write("\r\n");
0801:                    out.write("\r\n");
0802:                    out.write("\r\n");
0803:                    out.write("\r\n");
0804:                    out.write("\r\n\r\n");
0805:                    out.write("\r\n");
0806:                    out.write("\r\n");
0807:                    out.write("\r\n");
0808:                    out.write("\r\n");
0809:                    out.write("\r\n");
0810:                    out.write("\r\n\r\n");
0811:                    out.write("\r\n");
0812:                    out.write("\r\n");
0813:                    out.write("\r\n");
0814:                    out.write("\r\n");
0815:                    out.write("\r\n");
0816:                    out.write("\r\n");
0817:                    out.write("\r\n");
0818:                    out.write("\r\n");
0819:                    out.write("\r\n\r\n");
0820:                    out.write("\r\n\r\n");
0821:                    org.ofbiz.security.Security security = null;
0822:                    synchronized (application) {
0823:                        security = (org.ofbiz.security.Security) pageContext
0824:                                .getAttribute("security",
0825:                                        PageContext.APPLICATION_SCOPE);
0826:                        if (security == null) {
0827:                            throw new java.lang.InstantiationException(
0828:                                    "bean security not found within scope");
0829:                        }
0830:                    }
0831:                    out.write("\r\n");
0832:                    org.ofbiz.entity.GenericDelegator delegator = null;
0833:                    synchronized (application) {
0834:                        delegator = (org.ofbiz.entity.GenericDelegator) pageContext
0835:                                .getAttribute("delegator",
0836:                                        PageContext.APPLICATION_SCOPE);
0837:                        if (delegator == null) {
0838:                            throw new java.lang.InstantiationException(
0839:                                    "bean delegator not found within scope");
0840:                        }
0841:                    }
0842:                    out.write("\r\n");
0843:                    com.sourcetap.sfa.event.GenericWebEventProcessor webEventProcessor = null;
0844:                    synchronized (application) {
0845:                        webEventProcessor = (com.sourcetap.sfa.event.GenericWebEventProcessor) pageContext
0846:                                .getAttribute("webEventProcessor",
0847:                                        PageContext.APPLICATION_SCOPE);
0848:                        if (webEventProcessor == null) {
0849:                            try {
0850:                                webEventProcessor = (com.sourcetap.sfa.event.GenericWebEventProcessor) java.beans.Beans
0851:                                        .instantiate(this .getClass()
0852:                                                .getClassLoader(),
0853:                                                "com.sourcetap.sfa.event.GenericWebEventProcessor");
0854:                            } catch (ClassNotFoundException exc) {
0855:                                throw new InstantiationException(exc
0856:                                        .getMessage());
0857:                            } catch (Exception exc) {
0858:                                throw new ServletException(
0859:                                        "Cannot create bean of class "
0860:                                                + "com.sourcetap.sfa.event.GenericWebEventProcessor",
0861:                                        exc);
0862:                            }
0863:                            pageContext.setAttribute("webEventProcessor",
0864:                                    webEventProcessor,
0865:                                    PageContext.APPLICATION_SCOPE);
0866:                        }
0867:                    }
0868:                    out.write("\r\n");
0869:                    com.sourcetap.sfa.event.GenericEventProcessor eventProcessor = null;
0870:                    synchronized (application) {
0871:                        eventProcessor = (com.sourcetap.sfa.event.GenericEventProcessor) pageContext
0872:                                .getAttribute("eventProcessor",
0873:                                        PageContext.APPLICATION_SCOPE);
0874:                        if (eventProcessor == null) {
0875:                            try {
0876:                                eventProcessor = (com.sourcetap.sfa.event.GenericEventProcessor) java.beans.Beans
0877:                                        .instantiate(this .getClass()
0878:                                                .getClassLoader(),
0879:                                                "com.sourcetap.sfa.event.GenericEventProcessor");
0880:                            } catch (ClassNotFoundException exc) {
0881:                                throw new InstantiationException(exc
0882:                                        .getMessage());
0883:                            } catch (Exception exc) {
0884:                                throw new ServletException(
0885:                                        "Cannot create bean of class "
0886:                                                + "com.sourcetap.sfa.event.GenericEventProcessor",
0887:                                        exc);
0888:                            }
0889:                            pageContext.setAttribute("eventProcessor",
0890:                                    eventProcessor,
0891:                                    PageContext.APPLICATION_SCOPE);
0892:                        }
0893:                    }
0894:                    out.write("\r\n");
0895:                    com.sourcetap.sfa.ui.UICache uiCache = null;
0896:                    synchronized (application) {
0897:                        uiCache = (com.sourcetap.sfa.ui.UICache) pageContext
0898:                                .getAttribute("uiCache",
0899:                                        PageContext.APPLICATION_SCOPE);
0900:                        if (uiCache == null) {
0901:                            try {
0902:                                uiCache = (com.sourcetap.sfa.ui.UICache) java.beans.Beans
0903:                                        .instantiate(this .getClass()
0904:                                                .getClassLoader(),
0905:                                                "com.sourcetap.sfa.ui.UICache");
0906:                            } catch (ClassNotFoundException exc) {
0907:                                throw new InstantiationException(exc
0908:                                        .getMessage());
0909:                            } catch (Exception exc) {
0910:                                throw new ServletException(
0911:                                        "Cannot create bean of class "
0912:                                                + "com.sourcetap.sfa.ui.UICache",
0913:                                        exc);
0914:                            }
0915:                            pageContext.setAttribute("uiCache", uiCache,
0916:                                    PageContext.APPLICATION_SCOPE);
0917:                        }
0918:                    }
0919:                    out.write("\r\n\r\n");
0920:                    out.write("<!-- [oldFunctions.jsp] Begin -->\r\n");
0921:                    out.write("\r\n");
0922:                    out.write("<!-- [oldFunctions.jsp] End -->\r\n\r\n");
0923:                    out.write("\r\n");
0924:                    out.write("<!-- [oldDeclarations.jsp] Start -->\r\n\r\n");
0925:                    GenericValue userLogin = (GenericValue) session
0926:                            .getAttribute("_USER_LOGIN_");
0927:                    out.write("\r\n");
0928:                    UserInfo userInfo = (UserInfo) session
0929:                            .getAttribute("userInfo");
0930:                    out.write("\r\n\r\n");
0931:                    String partyId = "";
0932:                    if (userLogin != null)
0933:                        partyId = userLogin.getString("partyId");
0934:
0935:                    out.write("\r\n\r\n");
0936:
0937:                    DecimalFormat decimalFormat = new DecimalFormat("#,###.##");
0938:                    SimpleDateFormat simpleDateFormat = new SimpleDateFormat(
0939:                            "MM/dd/yyyy");
0940:                    SimpleDateFormat simpleTimeFormat = new SimpleDateFormat(
0941:                            "K:mm a");
0942:
0943:                    out.write("\r\n\r\n");
0944:                    String controlPath = (String) request
0945:                            .getAttribute("_CONTROL_PATH_");
0946:                    out.write("\r\n");
0947:                    String contextRoot = (String) request
0948:                            .getAttribute("_CONTEXT_ROOT_");
0949:                    out.write("\r\n\r\n");
0950:                    String pageName = UtilFormatOut
0951:                            .checkNull((String) pageContext
0952:                                    .getAttribute("PageName"));
0953:                    out.write("\r\n\r\n");
0954:                    String companyName = UtilProperties.getPropertyValue(
0955:                            contextRoot + "/WEB-INF/sfa.properties",
0956:                            "company.name");
0957:                    out.write("\r\n");
0958:                    String companySubtitle = UtilProperties.getPropertyValue(
0959:                            contextRoot + "/WEB-INF/sfa.properties",
0960:                            "company.subtitle");
0961:                    out.write("\r\n");
0962:                    String headerImageUrl = UtilProperties.getPropertyValue(
0963:                            contextRoot + "/WEB-INF/sfa.properties",
0964:                            "header.image.url");
0965:                    out.write("\r\n\r\n");
0966:                    String headerBoxBorderColor = UtilProperties
0967:                            .getPropertyValue(contextRoot
0968:                                    + "/WEB-INF/sfa.properties",
0969:                                    "header.box.border.color", "black");
0970:                    out.write("\r\n");
0971:                    String headerBoxBorderWidth = UtilProperties
0972:                            .getPropertyValue(contextRoot
0973:                                    + "/WEB-INF/sfa.properties",
0974:                                    "header.box.border.width", "1");
0975:                    out.write("\r\n");
0976:                    String headerBoxTopColor = UtilProperties.getPropertyValue(
0977:                            contextRoot + "/WEB-INF/sfa.properties",
0978:                            "header.box.top.color", "#336699");
0979:                    out.write("\r\n");
0980:                    String headerBoxBottomColor = UtilProperties
0981:                            .getPropertyValue(contextRoot
0982:                                    + "/WEB-INF/sfa.properties",
0983:                                    "header.box.bottom.color", "#cccc99");
0984:                    out.write("\r\n");
0985:                    String headerBoxBottomColorAlt = UtilProperties
0986:                            .getPropertyValue(contextRoot
0987:                                    + "/WEB-INF/sfa.properties",
0988:                                    "header.box.bottom.alt.color", "#eeeecc");
0989:                    out.write("\r\n");
0990:                    String headerBoxTopPadding = UtilProperties
0991:                            .getPropertyValue(contextRoot
0992:                                    + "/WEB-INF/sfa.properties",
0993:                                    "header.box.top.padding", "4");
0994:                    out.write("\r\n");
0995:                    String headerBoxBottomPadding = UtilProperties
0996:                            .getPropertyValue(contextRoot
0997:                                    + "/WEB-INF/sfa.properties",
0998:                                    "header.box.bottom.padding", "2");
0999:                    out.write("\r\n\r\n");
1000:                    String boxBorderColor = UtilProperties.getPropertyValue(
1001:                            contextRoot + "/WEB-INF/sfa.properties",
1002:                            "box.border.color", "black");
1003:                    out.write("\r\n");
1004:                    String boxBorderWidth = UtilProperties.getPropertyValue(
1005:                            contextRoot + "/WEB-INF/sfa.properties",
1006:                            "box.border.width", "1");
1007:                    out.write("\r\n");
1008:                    String boxTopColor = UtilProperties.getPropertyValue(
1009:                            contextRoot + "/WEB-INF/sfa.properties",
1010:                            "box.top.color", "#336699");
1011:                    out.write("\r\n");
1012:                    String boxBottomColor = UtilProperties.getPropertyValue(
1013:                            contextRoot + "/WEB-INF/sfa.properties",
1014:                            "box.bottom.color", "white");
1015:                    out.write("\r\n");
1016:                    String boxBottomColorAlt = UtilProperties.getPropertyValue(
1017:                            contextRoot + "/WEB-INF/sfa.properties",
1018:                            "box.bottom.alt.color", "white");
1019:                    out.write("\r\n");
1020:                    String boxTopPadding = UtilProperties.getPropertyValue(
1021:                            contextRoot + "/WEB-INF/sfa.properties",
1022:                            "box.top.padding", "4");
1023:                    out.write("\r\n");
1024:                    String boxBottomPadding = UtilProperties.getPropertyValue(
1025:                            contextRoot + "/WEB-INF/sfa.properties",
1026:                            "box.bottom.padding", "4");
1027:                    out.write("\r\n");
1028:                    String userStyleSheet = "/sfa/includes/maincss.css";
1029:                    out.write("\r\n");
1030:                    String alphabet[] = { "a", "b", "c", "d", "e", "f", "g",
1031:                            "h", "i", "j", "k", "l", "m", "n", "o", "p", "q",
1032:                            "r", "s", "t", "u", "v", "w", "x", "y", "z", "*" };
1033:                    out.write("\r\n\r\n");
1034:                    out.write("<!-- [oldDeclarations.jsp] End -->\r\n\r\n");
1035:                    out.write("\r\n\r\n");
1036:                    out.write("<HTML>\r\n");
1037:                    out.write("<HEAD>\r\n\r\n");
1038:
1039:                    String clientRequest = (String) session
1040:                            .getAttribute("_CLIENT_REQUEST_");
1041:                    //out.write("Client request: " + clientRequest + "<BR>");
1042:                    String hostName = "";
1043:                    if (clientRequest != null
1044:                            && clientRequest.indexOf("//") > 0) {
1045:                        int startPos = clientRequest.indexOf("//") + 2;
1046:                        int endPos = clientRequest.indexOf(":", startPos);
1047:                        if (endPos < startPos)
1048:                            endPos = clientRequest.indexOf("/", startPos);
1049:                        if (endPos < startPos)
1050:                            hostName = clientRequest.substring(startPos);
1051:                        else
1052:                            hostName = clientRequest
1053:                                    .substring(startPos, endPos);
1054:                    } else {
1055:                        hostName = "";
1056:                    }
1057:                    //out.write("Host name: " + hostName + "<BR>");
1058:
1059:                    out.write("\r\n\r\n");
1060:                    out.write("<title>");
1061:                    out.print(hostName);
1062:                    out.write(" - Sales Force Automation - ");
1063:                    out.print(companyName);
1064:                    out.write("</title>\r\n\r\n");
1065:                    out.write("\r\n");
1066:                    out.write("<!-- [userStyle.jsp] Start -->\r\n\r\n");
1067:
1068:                    //------------ Get the style sheet
1069:                    String styleSheetId = null;
1070:
1071:                    ModelEntity entityStyleUser = delegator
1072:                            .getModelEntity("UiUserTemplate");
1073:                    HashMap hashMapStyleUser = new HashMap();
1074:                    if (userLogin != null) {
1075:                        String ulogin = userLogin.getString("userLoginId");
1076:                        hashMapStyleUser.put("userLoginId", ulogin);
1077:                    } else {
1078:                        hashMapStyleUser.put("userLoginId", "Default");
1079:                    }
1080:                    GenericPK stylePk = new GenericPK(entityStyleUser,
1081:                            hashMapStyleUser);
1082:                    GenericValue userTemplate = delegator
1083:                            .findByPrimaryKey(stylePk);
1084:                    if (userTemplate != null) {
1085:                        styleSheetId = userTemplate.getString("styleSheetId");
1086:                    }
1087:
1088:                    if (styleSheetId == null) {
1089:                        hashMapStyleUser.put("userLoginId", "Default");
1090:                        stylePk = new GenericPK(entityStyleUser,
1091:                                hashMapStyleUser);
1092:                        userTemplate = delegator.findByPrimaryKey(stylePk);
1093:                        if (userTemplate != null) {
1094:                            styleSheetId = userTemplate
1095:                                    .getString("styleSheetId");
1096:                        }
1097:                    }
1098:
1099:                    if (styleSheetId != null) {
1100:                        ModelEntity entityStyle = delegator
1101:                                .getModelEntity("UiStyleTemplate");
1102:                        HashMap hashMapStyle = new HashMap();
1103:                        hashMapStyle.put("styleSheetId", styleSheetId);
1104:                        stylePk = new GenericPK(entityStyle, hashMapStyle);
1105:                        GenericValue styleTemplate = delegator
1106:                                .findByPrimaryKey(stylePk);
1107:                        userStyleSheet = styleTemplate
1108:                                .getString("styleSheetLoc");
1109:
1110:                        if (userStyleSheet == null) {
1111:                            userStyleSheet = "/sfa/includes/maincss.css";
1112:                        }
1113:                    }
1114:
1115:                    out.write("\r\n");
1116:                    out.write("<link rel=\"stylesheet\" href=\"");
1117:                    out.print(userStyleSheet);
1118:                    out.write("\" type=\"text/css\">\r\n\r\n");
1119:                    out.write("<!-- [userStyle.jsp] End -->\r\n\r\n");
1120:                    out.write("\r\n");
1121:                    out
1122:                            .write("<LINK rel=\"stylesheet\" type=\"text/css\" href=\"/sfa/css/gridstyles.css\">\r\n");
1123:                    out
1124:                            .write("<script language=\"JavaScript\" >\r\n\r\n  function sendDropDown(elementName, idName, fieldName, findClass, paramName, paramValue, frm, action)\r\n  {\r\n        var sUrl = '");
1125:                    if (_jspx_meth_ofbiz_url_0(pageContext))
1126:                        return;
1127:                    out
1128:                            .write("?findMode=filter&fieldName=' +\r\n\t\t\tfieldName + '&idName=' + idName + '&param_' + 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 = '");
1129:                    if (_jspx_meth_ofbiz_url_1(pageContext))
1130:                        return;
1131:                    out
1132:                            .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");
1133:                    out
1134:                            .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");
1135:                    out
1136:                            .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");
1137:                    out
1138:                            .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");
1139:                    out
1140:                            .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");
1141:                    out
1142:                            .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");
1143:                    out
1144:                            .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");
1145:                    out
1146:                            .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] ");
1147:                    out
1148:                            .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 ");
1149:                    out
1150:                            .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 ");
1151:                    out
1152:                            .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 ");
1153:                    out
1154:                            .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 ");
1155:                    out
1156:                            .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 ");
1157:                    out
1158:                            .write("< myRows; i++) {\r\n    myArray[i] = new Array(myCols)\r\n    for (j=0; j ");
1159:                    out
1160:                            .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 ");
1161:                    out.write("< myRows; i++) {\r\n    for (j=0; j ");
1162:                    out
1163:                            .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");
1164:                    out.write("</script>\r\n\r\n\r\n");
1165:                    out.write("\r\n\r\n");
1166:                    out.write("</HEAD>\r\n\r\n");
1167:                    out.write("<BASE TARGET=\"content\">\r\n");
1168:                    out.write("<!--");
1169:                    out
1170:                            .write("<BODY CLASS=\"bodyform\" onbeforeunload=\"verifyClose()\">-->\r\n");
1171:                    out.write("<BODY CLASS=\"bodyform\"\">\r\n\r\n");
1172:                    out.write("\r\n");
1173:                    out.write("<!-- onBeforeUnload.jsp - Start -->\r\n\r\n");
1174:                    out
1175:                            .write("<SCRIPT LANGUAGE=\"JScript\" TYPE=\"text/javascript\" FOR=window EVENT=onbeforeunload>\r\n return doOnBeforeUnload();\r\n");
1176:                    out.write("</SCRIPT>\r\n\r\n");
1177:                    out
1178:                            .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");
1179:                    out
1180:                            .write("  var vFormC = document.forms;\r\n  for (var vFormNbr = 0; vFormNbr ");
1181:                    out
1182:                            .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==\"");
1183:                    out.print(UIScreenSection.ACTION_INSERT);
1184:                    out.write("\" ||\r\n         vAction==\"");
1185:                    out.print(UIScreenSection.ACTION_UPDATE);
1186:                    out.write("\" ||\r\n         vAction==\"");
1187:                    out.print(UIScreenSection.ACTION_UPDATE_SELECT);
1188:                    out
1189:                            .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 ");
1190:                    out
1191:                            .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 = \"");
1192:                    out.print(UIWebUtility.HTML_NAME_PREFIX_ORIGINAL);
1193:                    out
1194:                            .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");
1195:                    out
1196:                            .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");
1197:                    out.write("</SCRIPT>\r\n\r\n");
1198:                    out.write("<!-- onBeforeUnload.jsp - End -->\r\n\r\n\r\n");
1199:                    out.write("\r\n\r\n");
1200:                    out
1201:                            .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 ");
1202:                    out.write("<denis@softcomplex.com>; ");
1203:                    out
1204:                            .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");
1205:                    out
1206:                            .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\"");
1207:                    out.write("<html>\\n\"+\r\n\t\t\" ");
1208:                    out.write("<head>\\n\"+\r\n\t\t\"  ");
1209:                    out.write("<title>Calendar");
1210:                    out.write("</title>\\n\"+\r\n\t\t\" ");
1211:                    out.write("</head>\\n\"+\r\n\t\t\" ");
1212:                    out.write("<body bgcolor=\\\"White\\\">\\n\"+\r\n\t\t\"  ");
1213:                    out
1214:                            .write("<table class=\\\"clsOTable\\\" cellspacing=\\\"0\\\" border=\\\"0\\\" width=\\\"100%\\\">\\n\" +\r\n\t\t\"   ");
1215:                    out.write("<tr>\\n\" +\r\n\t\t\"    ");
1216:                    out
1217:                            .write("<td bgcolor=\\\"#4682B4\\\">\\n\" +\r\n\t\t\"     ");
1218:                    out
1219:                            .write("<table cellspacing=\\\"1\\\" cellpadding=\\\"3\\\" border=\\\"0\\\" width=\\\"100%\\\">\\n\" +\r\n\t\t\"      ");
1220:                    out.write("<tr>\\n\" +\r\n\t\t\"       ");
1221:                    out
1222:                            .write("<td bgcolor=\\\"#4682B4\\\">\\n\" +\r\n\t\t\"        ");
1223:                    out
1224:                            .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\"         ");
1225:                    out
1226:                            .write("<img src=\\\"/sfaimages/prev.gif\\\" width=\\\"16\\\" height=\\\"16\\\" border=\\\"0\\\"\" +\r\n\t\t\"           alt=\\\"previous month\\\">\\n\" +\r\n\t\t\"        ");
1227:                    out.write("</a>\\n\" +\r\n\t\t\"       ");
1228:                    out.write("</td>\\n\" +\r\n\t\t\"       ");
1229:                    out
1230:                            .write("<td bgcolor=\\\"#4682B4\\\" colspan=\\\"5\\\">\\n\" +\r\n\t\t\"        ");
1231:                    out
1232:                            .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\"        ");
1233:                    out.write("</font>\\n\" +\r\n\t\t\"       ");
1234:                    out.write("</td>\\n\" +\r\n\t\t\"       ");
1235:                    out
1236:                            .write("<td bgcolor=\\\"#4682B4\\\" align=\\\"right\\\">\\n\" +\r\n\t\t\"        ");
1237:                    out
1238:                            .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\"         ");
1239:                    out
1240:                            .write("<img src=\\\"/sfaimages/next.gif\\\" width=\\\"16\\\" height=\\\"16\\\" border=\\\"0\\\"\" +\r\n\t\t\"           alt=\\\"next month\\\">\\n\" +\r\n\t\t\"        ");
1241:                    out.write("</a>\\n\" +\r\n\t\t\"       ");
1242:                    out.write("</td>\\n\" +\r\n\t\t\"      ");
1243:                    out
1244:                            .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 += \"      ");
1245:                    out.write("<tr>\\n\";\r\n\tfor (var n=0; n");
1246:                    out.write("<7; n++)\r\n\t\tstr_buffer += \"       ");
1247:                    out
1248:                            .write("<td bgcolor=\\\"#87CEFA\\\">\\n\" +\r\n\t\t\"       ");
1249:                    out
1250:                            .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\"       ");
1251:                    out.write("</font>");
1252:                    out
1253:                            .write("</td>\\n\";\r\n\t// print calendar table\r\n\tstr_buffer += \"      ");
1254:                    out
1255:                            .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 += \"      ");
1256:                    out
1257:                            .write("<tr>\\n\";\r\n\t\tfor (var n_current_wday=0; n_current_wday");
1258:                    out
1259:                            .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 += \"       ");
1260:                    out
1261:                            .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 += \"       ");
1262:                    out
1263:                            .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 += \"       ");
1264:                    out
1265:                            .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 += \"        ");
1266:                    out
1267:                            .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 += \"        ");
1268:                    out
1269:                            .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 += \"         ");
1270:                    out
1271:                            .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 += \"         ");
1272:                    out
1273:                            .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\"         ");
1274:                    out.write("</font>\\n\" +\r\n\t\t\t\t\"        ");
1275:                    out.write("</a>\\n\" +\r\n\t\t\t\t\"       ");
1276:                    out
1277:                            .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 += \"      ");
1278:                    out
1279:                            .write("</tr>\\n\";\r\n\t}\r\n\t// print calendar footer\r\n\tstr_buffer +=\r\n\t\t\"      ");
1280:                    out
1281:                            .write("<form name=\\\"cal\\\">\\n\" +\r\n\t\t\"       ");
1282:                    out.write("<tr>\\n\" +\r\n\t\t\"        ");
1283:                    out
1284:                            .write("<td colspan=\\\"7\\\" bgcolor=\\\"#87CEFA\\\">\\n\" +\r\n\t\t\"         ");
1285:                    out
1286:                            .write("<font color=\\\"White\\\" face=\\\"tahoma, verdana\\\" size=\\\"2\\\">\\n\" +\r\n\t\t\"          Time:\\n\" +\r\n\t\t\"          ");
1287:                    out
1288:                            .write("<input type=\\\"text\\\" name=\\\"time\\\" value=\\\"\" + dt2tmstr(dt_datetime) +\r\n\t\t\"\\\" size=\\\"8\\\" maxlength=\\\"8\\\">\\n\" +\r\n\t\t\"         ");
1289:                    out.write("</font>\\n\" +\r\n\t\t\"        ");
1290:                    out.write("</td>\\n\" +\r\n\t\t\"       ");
1291:                    out.write("</tr>\\n\" +\r\n\t\t\"      ");
1292:                    out.write("</form>\\n\" +\r\n\t\t\"     ");
1293:                    out.write("</table>\\n\" +\r\n\t\t\"    ");
1294:                    out.write("</tr>\\n\" +\r\n\t\t\"   ");
1295:                    out.write("</td>\\n\" +\r\n\t\t\"  ");
1296:                    out.write("</table>\\n\" +\r\n\t\t\" ");
1297:                    out.write("</body>\\n\" +\r\n\t\t\"");
1298:                    out
1299:                            .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");
1300:                    out
1301:                            .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");
1302:                    out.write("</script>\r\n");
1303:                    out.write("\r\n\r\n");
1304:                    out.write("\r\n");
1305:                    com.sourcetap.sfa.lead.LeadEventProcessor leadEventProcessor = null;
1306:                    synchronized (application) {
1307:                        leadEventProcessor = (com.sourcetap.sfa.lead.LeadEventProcessor) pageContext
1308:                                .getAttribute("leadEventProcessor",
1309:                                        PageContext.APPLICATION_SCOPE);
1310:                        if (leadEventProcessor == null) {
1311:                            try {
1312:                                leadEventProcessor = (com.sourcetap.sfa.lead.LeadEventProcessor) java.beans.Beans
1313:                                        .instantiate(this .getClass()
1314:                                                .getClassLoader(),
1315:                                                "com.sourcetap.sfa.lead.LeadEventProcessor");
1316:                            } catch (ClassNotFoundException exc) {
1317:                                throw new InstantiationException(exc
1318:                                        .getMessage());
1319:                            } catch (Exception exc) {
1320:                                throw new ServletException(
1321:                                        "Cannot create bean of class "
1322:                                                + "com.sourcetap.sfa.lead.LeadEventProcessor",
1323:                                        exc);
1324:                            }
1325:                            pageContext.setAttribute("leadEventProcessor",
1326:                                    leadEventProcessor,
1327:                                    PageContext.APPLICATION_SCOPE);
1328:                        }
1329:                    }
1330:                    out.write("\r\n");
1331:                    com.sourcetap.sfa.event.GenericImportEventProcessor importEventProcessor = null;
1332:                    synchronized (application) {
1333:                        importEventProcessor = (com.sourcetap.sfa.event.GenericImportEventProcessor) pageContext
1334:                                .getAttribute("importEventProcessor",
1335:                                        PageContext.APPLICATION_SCOPE);
1336:                        if (importEventProcessor == null) {
1337:                            try {
1338:                                importEventProcessor = (com.sourcetap.sfa.event.GenericImportEventProcessor) java.beans.Beans
1339:                                        .instantiate(this .getClass()
1340:                                                .getClassLoader(),
1341:                                                "com.sourcetap.sfa.event.GenericImportEventProcessor");
1342:                            } catch (ClassNotFoundException exc) {
1343:                                throw new InstantiationException(exc
1344:                                        .getMessage());
1345:                            } catch (Exception exc) {
1346:                                throw new ServletException(
1347:                                        "Cannot create bean of class "
1348:                                                + "com.sourcetap.sfa.event.GenericImportEventProcessor",
1349:                                        exc);
1350:                            }
1351:                            pageContext.setAttribute("importEventProcessor",
1352:                                    importEventProcessor,
1353:                                    PageContext.APPLICATION_SCOPE);
1354:                        }
1355:                    }
1356:                    out.write("\r\n\r\n");
1357:
1358:                    String screen = "LEAD";
1359:                    String screenSection = "LeadHeader";
1360:                    String entityName = "Lead";
1361:                    CsvConverter csvConverter = null;
1362:                    String action = "start"; // default action
1363:
1364:                    if (request.getParameter("action") != null) {
1365:                        action = request.getParameter("action");
1366:                    }
1367:
1368:                    try {
1369:
1370:                        if (action.equals("start")) {
1371:
1372:                            ModelEntity entity = delegator
1373:                                    .getModelEntity(entityName);
1374:
1375:                            UIWebScreenSection uiWebScreenSection = importEventProcessor
1376:                                    .getUiWebScreenSection(userInfo, screen,
1377:                                            screenSection, delegator, uiCache);
1378:                            List fields = uiWebScreenSection
1379:                                    .getDisplayFields(uiCache);
1380:
1381:                            int numFields = fields.size();
1382:
1383:                            out.write("\r\n\t\t\t");
1384:                            out
1385:                                    .write("<table width=\"100%\" class=\"freeFormSectionDisplayTable\">");
1386:                            out.write("<tr>");
1387:                            out.write("<td valign=\"top\">\r\n\t\t\t");
1388:                            out.write("<tr>");
1389:                            out.write("<td>");
1390:                            out.write("<center>");
1391:                            out.write("<b>Choose Fields to include in Form.");
1392:                            out.write("</b>");
1393:                            out.write("</center>");
1394:                            out.write("</td>");
1395:                            out.write("</tr>\r\n\t\t\t");
1396:                            out.write("<tr>");
1397:                            out.write("<td>\r\n\t\t\t      ");
1398:                            out.write("<!-- title table -->\r\n\t\t\t\t\t  ");
1399:                            out.write("<center>");
1400:                            out
1401:                                    .write("<table class=\"freeFormSectionDisplayTable\" cellspacing=\"0\" cellpadding=\"2\" id='queryListTable'>\r\n\t\t\t\t\t  ");
1402:                            out
1403:                                    .write("<form method=\"post\" action=\"/sfa/control/leadCaptureSetup\">\r\n\t\t\t\t\t\t   ");
1404:                            out
1405:                                    .write("<input type=hidden name=action value=\"generate\">\r\n\t\t\t\t\t\t   ");
1406:                            out
1407:                                    .write("<input type=\"hidden\" name=\"numFields\" value=\"");
1408:                            out.print(numFields);
1409:                            out.write("\">\r\n\t\t\t\t\t\t\t");
1410:                            out
1411:                                    .write("<input type=hidden id=queryListMaxRows name=queryListMaxRows value=4>\r\n \t\t\t\t\t\t");
1412:                            out.write("<tr>");
1413:                            out.write("<td class=freeFormSectionLabel>");
1414:                            out.write("<center>Field");
1415:                            out.write("<center>");
1416:                            out.write("</td>\r\n\t\t\t\t\t\t    ");
1417:                            out.write("<td class=freeFormSectionLabel>");
1418:                            out.write("<center>Label");
1419:                            out.write("</center>");
1420:                            out.write("</td>\r\n\t\t\t\t\t\t");
1421:                            out.write("</tr>\r\n");
1422:
1423:                            Iterator fieldIter = fields.iterator();
1424:                            StringBuffer fieldNameOptions = new StringBuffer(
1425:                                    200);
1426:
1427:                            while (fieldIter.hasNext()) {
1428:
1429:                                UIFieldInfo fieldInfo = (UIFieldInfo) fieldIter
1430:                                        .next();
1431:                                //     if ( fieldInfo.getIsVisible() && !fieldInfo.getIsReadOnly() )
1432:
1433:                                String fieldName = UIWebUtility.getHtmlName(
1434:                                        screenSection, fieldInfo, 0);
1435:                                String displayName = fieldInfo
1436:                                        .getDisplayLabel();
1437:
1438:                                if (fieldName.equals("lastUpdatedStamp")
1439:                                        || fieldName
1440:                                                .equals("lastUpdatedTxStamp")
1441:                                        || fieldName.equals("createdStamp")
1442:                                        || fieldName.equals("createdTxStamp"))
1443:                                    continue;
1444:
1445:                                String htmlName = fieldName;
1446:                                String displayObjectId = fieldInfo
1447:                                        .getDisplayObjectId();
1448:                                String displayTypeId = "TEXT"; //fieldInfo.getDisplayTypeId();
1449:                                String attributeId = fieldInfo.getAttributeId();
1450:                                String displayLabel = fieldInfo
1451:                                        .getDisplayLabel();
1452:                                String optValue = htmlName + ";" + attributeId
1453:                                        + ";" + displayTypeId + ";"
1454:                                        + displayObjectId + ";" + displayLabel;
1455:                                fieldNameOptions.append("<option value='"
1456:                                        + optValue + "'>" + displayLabel
1457:                                        + "</option>");
1458:                            }
1459:
1460:                            for (int i = 1; i < 5; i++) {
1461:                                out.write("<tr id=queryListRow" + i
1462:                                        + "><td><select name=queryListField"
1463:                                        + i + ">" + fieldNameOptions.toString()
1464:                                        + "</select></td>\n");
1465:                                out.write("	<td><input name=queryListLabel" + i
1466:                                        + " size=30></td>\n");
1467:                                out
1468:                                        .write("	<td><img src=/sfaimages/remove.gif alt=Del onClick=delConditionRow("
1469:                                                + i + ")>\n");
1470:                                out
1471:                                        .write("	    <img src=/sfaimages/add.gif alt=Add onClick=addConditionRow("
1472:                                                + i + ")></td>\n");
1473:                                out.write("</tr>");
1474:                            }
1475:
1476:                            out.write("\r\n\t\t\t\t");
1477:                            out.write("</table>");
1478:                            out.write("</center>\r\n\t\t\t\t");
1479:                            out.write("</td>");
1480:                            out.write("</tr>\r\n\t\t\t\t");
1481:                            out.write("<tr>");
1482:                            out.write("<td>");
1483:                            out.write("<center>\r\n\t\t\t\t");
1484:                            out.write("<table>");
1485:                            out.write("<tr>");
1486:                            out.write("<td>URL to Redirect to on Success:");
1487:                            out.write("</td>");
1488:                            out.write("<td>");
1489:                            out.write("<input name=\"onSuccessURL\" size=80>");
1490:                            out.write("</td>");
1491:                            out.write("</tr>\r\n\t\t\t\t       ");
1492:                            out.write("<tr>");
1493:                            out.write("<td>URL to Redirect to on Error:");
1494:                            out.write("</td>");
1495:                            out.write("<td>");
1496:                            out.write("<input name=\"onErrorURL\" size=80>");
1497:                            out.write("</td>");
1498:                            out.write("</tr>\t\r\n\t\t\t\t");
1499:                            out.write("</table>\t\t\t\r\n\t\t\t\t");
1500:                            out.write("<tr>");
1501:                            out.write("<td>");
1502:                            out.write("<center>");
1503:                            out
1504:                                    .write("<input type=submit value=\"Generate HTML\">");
1505:                            out.write("</center>");
1506:                            out.write("</td>");
1507:                            out.write("</tr>\r\n\t\t\t\t");
1508:                            out.write("</form>\r\n\t\t\t");
1509:                            out.write("</table>\r\n\t\t\t\r\n\t\t\t");
1510:                            out
1511:                                    .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=\"");
1512:                            out
1513:                                    .write("<select name=queryListField\" + newRow + \">");
1514:                            out.print(fieldNameOptions.toString());
1515:                            out
1516:                                    .write("</select>\"\r\n\t\t\t\t\t\tc2.innerHTML=\"");
1517:                            out
1518:                                    .write("<input name=queryListLabel\" + newRow + \" size=30>\"\r\n\t\t\t\t\t\tc3.innerHTML=\"");
1519:                            out
1520:                                    .write("<img src=/sfaimages/remove.gif alt=Del onClick=delConditionRow(\" + newRow + \")>\" + \" ");
1521:                            out
1522:                                    .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 ");
1523:                            out
1524:                                    .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");
1525:                            out.write("</script>\r\n\t\t\t\r\n");
1526:
1527:                        } else if (action.equals("generate")) {
1528:
1529:                            StringBuffer formHTML = new StringBuffer(1000);
1530:                            String successURL = UtilFormatOut.checkNull(request
1531:                                    .getParameter("onSuccessURL"));
1532:                            String errorURL = UtilFormatOut.checkNull(request
1533:                                    .getParameter("onErrorURL"));
1534:
1535:                            String path = request.getRequestURL().toString();
1536:                            int lastSlash = path.lastIndexOf('/');
1537:                            path = path.substring(0, lastSlash);
1538:                            formHTML
1539:                                    .append("<form action="
1540:                                            + path
1541:                                            + "/leadCapture target='_self' method=post>\n");
1542:                            formHTML
1543:                                    .append("<input type=hidden name=action value='save'>\n");
1544:                            formHTML
1545:                                    .append("<input type=hidden name=cid value='"
1546:                                            + userInfo.getAccountId() + "'>\n");
1547:                            formHTML
1548:                                    .append("<input type=hidden name=uid value='"
1549:                                            + userInfo.getPartyId() + "'>\n");
1550:                            formHTML
1551:                                    .append("<input type=hidden name=onSuccess value='"
1552:                                            + successURL + "'>\n");
1553:                            formHTML
1554:                                    .append("<input type=hidden name=onError value='"
1555:                                            + errorURL + "'>\n");
1556:                            formHTML.append("<table>\n");
1557:
1558:                            String queryListMaxRows = request
1559:                                    .getParameter("queryListMaxRows");
1560:                            // if queryListMaxRows is set, then we are using advanced query mode
1561:                            if ((queryListMaxRows != null)
1562:                                    && (queryListMaxRows.length() > 0)) {
1563:                                int maxRows = Integer.valueOf(queryListMaxRows)
1564:                                        .intValue();
1565:                                for (int i = 1; i <= maxRows; i++) {
1566:                                    String qlFieldInfo = request
1567:                                            .getParameter("queryListField" + i);
1568:                                    if ((qlFieldInfo != null)
1569:                                            && (qlFieldInfo.length() > 0)) {
1570:                                        StringTokenizer tokSemi = new StringTokenizer(
1571:                                                qlFieldInfo, ";");
1572:                                        String qlFieldName = "";
1573:                                        String qlAttributeId = "";
1574:                                        String qlDisplayObjectId = "";
1575:                                        String qlDisplayTypeId = "";
1576:                                        String qlDisplayLabel = "";
1577:
1578:                                        if (tokSemi.countTokens() == 5) {
1579:                                            qlFieldName = tokSemi.nextToken();
1580:                                            qlAttributeId = tokSemi.nextToken();
1581:                                            qlDisplayTypeId = tokSemi
1582:                                                    .nextToken();
1583:                                            qlDisplayObjectId = tokSemi
1584:                                                    .nextToken();
1585:                                            qlDisplayLabel = tokSemi
1586:                                                    .nextToken();
1587:                                        } else {
1588:                                            qlFieldName = qlFieldInfo;
1589:                                        }
1590:
1591:                                        String qlLabel = request
1592:                                                .getParameter("queryListLabel"
1593:                                                        + i);
1594:                                        if ((qlLabel == null)
1595:                                                || (qlLabel.length() < 1))
1596:                                            qlLabel = qlDisplayLabel;
1597:
1598:                                        formHTML.append("<tr><td>" + qlLabel
1599:                                                + "<td><input name='"
1600:                                                + qlFieldName
1601:                                                + "' size=30></td></tr>\n");
1602:
1603:                                    }
1604:                                }
1605:                            }
1606:                            formHTML
1607:                                    .append("<tr><td colspan=2><center><input type=submit value=submit></center></td></tr>\n");
1608:                            formHTML.append("</table>\n");
1609:                            formHTML.append("</form>\n");
1610:
1611:                            out
1612:                                    .write("<center><br><h3>copy and paste the code below into your web page</h3><p>\n");
1613:                            out.write("<textarea rows=20 cols=80>"
1614:                                    + formHTML.toString()
1615:                                    + "</textarea></center>");
1616:
1617:                        } else {
1618:                            out.write("csv Null error");
1619:                        }
1620:
1621:                        out.write("\r\n");
1622:                        out.write("</table>\r\n\r\n  ");
1623:
1624:                    } catch (Exception e) {
1625:                        e.printStackTrace();
1626:                    }
1627:
1628:                    out.write("\r\n\r\n");
1629:                    out.write("  ");
1630:                    out.write("<!-- left column table -->\r\n  ");
1631:                    out.write("</td>\r\n ");
1632:                    out.write("</tr>\r\n");
1633:                    out.write("</table>\r\n\r\n\r\n");
1634:                    out
1635:                            .write("<!-- used to get dynamic information from a server -->\r\n");
1636:                    out
1637:                            .write("<A style='visibility:hidden' id='searchA' name='searchA' target=\"searchIFrame\">");
1638:                    out.write("</A>\r\n");
1639:                    out
1640:                            .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();' >");
1641:                    out.write("</iframe>\r\n");
1642:                    out.write("<!--");
1643:                    out
1644:                            .write("<iframe id='searchIFrame' name='searchIFrame' WIDTH=\"100%\" onload='updateForm();' >");
1645:                    out.write("</iframe>-->\r\n\r\n\r\n");
1646:                    out.write("</body>\r\n");
1647:                    out.write("</html>\r\n");
1648:                    out.write("\r\n");
1649:                } catch (Throwable t) {
1650:                    out = _jspx_out;
1651:                    if (out != null && out.getBufferSize() != 0)
1652:                        out.clearBuffer();
1653:                    if (pageContext != null)
1654:                        pageContext.handlePageException(t);
1655:                } finally {
1656:                    if (_jspxFactory != null)
1657:                        _jspxFactory.releasePageContext(pageContext);
1658:                }
1659:            }
1660:
1661:            private boolean _jspx_meth_ofbiz_url_0(
1662:                    javax.servlet.jsp.PageContext pageContext) throws Throwable {
1663:                JspWriter out = pageContext.getOut();
1664:                /* ----  ofbiz:url ---- */
1665:                org.ofbiz.content.webapp.taglib.UrlTag _jspx_th_ofbiz_url_0 = (org.ofbiz.content.webapp.taglib.UrlTag) _jspx_tagPool_ofbiz_url
1666:                        .get(org.ofbiz.content.webapp.taglib.UrlTag.class);
1667:                _jspx_th_ofbiz_url_0.setPageContext(pageContext);
1668:                _jspx_th_ofbiz_url_0.setParent(null);
1669:                int _jspx_eval_ofbiz_url_0 = _jspx_th_ofbiz_url_0.doStartTag();
1670:                if (_jspx_eval_ofbiz_url_0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
1671:                    if (_jspx_eval_ofbiz_url_0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
1672:                        javax.servlet.jsp.tagext.BodyContent _bc = pageContext
1673:                                .pushBody();
1674:                        out = _bc;
1675:                        _jspx_th_ofbiz_url_0.setBodyContent(_bc);
1676:                        _jspx_th_ofbiz_url_0.doInitBody();
1677:                    }
1678:                    do {
1679:                        out.write("/testServer");
1680:                        int evalDoAfterBody = _jspx_th_ofbiz_url_0
1681:                                .doAfterBody();
1682:                        if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
1683:                            break;
1684:                    } while (true);
1685:                    if (_jspx_eval_ofbiz_url_0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE)
1686:                        out = pageContext.popBody();
1687:                }
1688:                if (_jspx_th_ofbiz_url_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE)
1689:                    return true;
1690:                _jspx_tagPool_ofbiz_url.reuse(_jspx_th_ofbiz_url_0);
1691:                return false;
1692:            }
1693:
1694:            private boolean _jspx_meth_ofbiz_url_1(
1695:                    javax.servlet.jsp.PageContext pageContext) throws Throwable {
1696:                JspWriter out = pageContext.getOut();
1697:                /* ----  ofbiz:url ---- */
1698:                org.ofbiz.content.webapp.taglib.UrlTag _jspx_th_ofbiz_url_1 = (org.ofbiz.content.webapp.taglib.UrlTag) _jspx_tagPool_ofbiz_url
1699:                        .get(org.ofbiz.content.webapp.taglib.UrlTag.class);
1700:                _jspx_th_ofbiz_url_1.setPageContext(pageContext);
1701:                _jspx_th_ofbiz_url_1.setParent(null);
1702:                int _jspx_eval_ofbiz_url_1 = _jspx_th_ofbiz_url_1.doStartTag();
1703:                if (_jspx_eval_ofbiz_url_1 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
1704:                    if (_jspx_eval_ofbiz_url_1 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
1705:                        javax.servlet.jsp.tagext.BodyContent _bc = pageContext
1706:                                .pushBody();
1707:                        out = _bc;
1708:                        _jspx_th_ofbiz_url_1.setBodyContent(_bc);
1709:                        _jspx_th_ofbiz_url_1.doInitBody();
1710:                    }
1711:                    do {
1712:                        out.write("/testServer");
1713:                        int evalDoAfterBody = _jspx_th_ofbiz_url_1
1714:                                .doAfterBody();
1715:                        if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
1716:                            break;
1717:                    } while (true);
1718:                    if (_jspx_eval_ofbiz_url_1 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE)
1719:                        out = pageContext.popBody();
1720:                }
1721:                if (_jspx_th_ofbiz_url_1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE)
1722:                    return true;
1723:                _jspx_tagPool_ofbiz_url.reuse(_jspx_th_ofbiz_url_1);
1724:                return false;
1725:            }
1726:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.