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