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