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