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 application_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 application_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: com.sourcetap.sfa.ui.UIXMLFileUtil uIXMLFileUtil = null;
0766: synchronized (application) {
0767: uIXMLFileUtil = (com.sourcetap.sfa.ui.UIXMLFileUtil) pageContext
0768: .getAttribute("uIXMLFileUtil",
0769: PageContext.APPLICATION_SCOPE);
0770: if (uIXMLFileUtil == null) {
0771: try {
0772: uIXMLFileUtil = (com.sourcetap.sfa.ui.UIXMLFileUtil) java.beans.Beans
0773: .instantiate(this .getClass()
0774: .getClassLoader(),
0775: "com.sourcetap.sfa.ui.UIXMLFileUtil");
0776: } catch (ClassNotFoundException exc) {
0777: throw new InstantiationException(exc
0778: .getMessage());
0779: } catch (Exception exc) {
0780: throw new ServletException(
0781: "Cannot create bean of class "
0782: + "com.sourcetap.sfa.ui.UIXMLFileUtil",
0783: exc);
0784: }
0785: pageContext.setAttribute("uIXMLFileUtil",
0786: uIXMLFileUtil,
0787: PageContext.APPLICATION_SCOPE);
0788: }
0789: }
0790: out.write("\r\n\r\n");
0791: out.write("\r\n");
0792: out.write("\r\n");
0793: out.write("\r\n");
0794: out.write("\r\n");
0795: out.write("\r\n");
0796: out.write("\r\n");
0797: out.write("\r\n");
0798: out.write("\r\n");
0799: out.write("\r\n");
0800: out.write("\r\n\r\n");
0801: out.write("\r\n");
0802: out.write("\r\n");
0803: out.write("\r\n");
0804: out.write("\r\n");
0805: out.write("\r\n");
0806: out.write("\r\n\r\n");
0807: out.write("\r\n");
0808: out.write("\r\n");
0809: out.write("\r\n");
0810: out.write("\r\n");
0811: out.write("\r\n");
0812: out.write("\r\n");
0813: out.write("\r\n");
0814: out.write("\r\n");
0815: out.write("\r\n\r\n");
0816: out.write("\r\n\r\n");
0817: org.ofbiz.security.Security security = null;
0818: synchronized (application) {
0819: security = (org.ofbiz.security.Security) pageContext
0820: .getAttribute("security",
0821: PageContext.APPLICATION_SCOPE);
0822: if (security == null) {
0823: throw new java.lang.InstantiationException(
0824: "bean security not found within scope");
0825: }
0826: }
0827: out.write("\r\n");
0828: org.ofbiz.entity.GenericDelegator delegator = null;
0829: synchronized (application) {
0830: delegator = (org.ofbiz.entity.GenericDelegator) pageContext
0831: .getAttribute("delegator",
0832: PageContext.APPLICATION_SCOPE);
0833: if (delegator == null) {
0834: throw new java.lang.InstantiationException(
0835: "bean delegator not found within scope");
0836: }
0837: }
0838: out.write("\r\n");
0839: com.sourcetap.sfa.event.GenericWebEventProcessor webEventProcessor = null;
0840: synchronized (application) {
0841: webEventProcessor = (com.sourcetap.sfa.event.GenericWebEventProcessor) pageContext
0842: .getAttribute("webEventProcessor",
0843: PageContext.APPLICATION_SCOPE);
0844: if (webEventProcessor == null) {
0845: try {
0846: webEventProcessor = (com.sourcetap.sfa.event.GenericWebEventProcessor) java.beans.Beans
0847: .instantiate(this .getClass()
0848: .getClassLoader(),
0849: "com.sourcetap.sfa.event.GenericWebEventProcessor");
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.GenericWebEventProcessor",
0857: exc);
0858: }
0859: pageContext.setAttribute("webEventProcessor",
0860: webEventProcessor,
0861: PageContext.APPLICATION_SCOPE);
0862: }
0863: }
0864: out.write("\r\n");
0865: com.sourcetap.sfa.event.GenericEventProcessor eventProcessor = null;
0866: synchronized (application) {
0867: eventProcessor = (com.sourcetap.sfa.event.GenericEventProcessor) pageContext
0868: .getAttribute("eventProcessor",
0869: PageContext.APPLICATION_SCOPE);
0870: if (eventProcessor == null) {
0871: try {
0872: eventProcessor = (com.sourcetap.sfa.event.GenericEventProcessor) java.beans.Beans
0873: .instantiate(this .getClass()
0874: .getClassLoader(),
0875: "com.sourcetap.sfa.event.GenericEventProcessor");
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.event.GenericEventProcessor",
0883: exc);
0884: }
0885: pageContext.setAttribute("eventProcessor",
0886: eventProcessor,
0887: PageContext.APPLICATION_SCOPE);
0888: }
0889: }
0890: out.write("\r\n");
0891: com.sourcetap.sfa.ui.UICache uiCache = null;
0892: synchronized (application) {
0893: uiCache = (com.sourcetap.sfa.ui.UICache) pageContext
0894: .getAttribute("uiCache",
0895: PageContext.APPLICATION_SCOPE);
0896: if (uiCache == null) {
0897: try {
0898: uiCache = (com.sourcetap.sfa.ui.UICache) java.beans.Beans
0899: .instantiate(this .getClass()
0900: .getClassLoader(),
0901: "com.sourcetap.sfa.ui.UICache");
0902: } catch (ClassNotFoundException exc) {
0903: throw new InstantiationException(exc
0904: .getMessage());
0905: } catch (Exception exc) {
0906: throw new ServletException(
0907: "Cannot create bean of class "
0908: + "com.sourcetap.sfa.ui.UICache",
0909: exc);
0910: }
0911: pageContext.setAttribute("uiCache", uiCache,
0912: PageContext.APPLICATION_SCOPE);
0913: }
0914: }
0915: out.write("\r\n\r\n");
0916: out.write("<!-- [oldFunctions.jsp] Begin -->\r\n");
0917: out.write("\r\n");
0918: out.write("<!-- [oldFunctions.jsp] End -->\r\n\r\n");
0919: out.write("\r\n");
0920: out.write("<!-- [oldDeclarations.jsp] Start -->\r\n\r\n");
0921: GenericValue userLogin = (GenericValue) session
0922: .getAttribute("_USER_LOGIN_");
0923: out.write("\r\n");
0924: UserInfo userInfo = (UserInfo) session
0925: .getAttribute("userInfo");
0926: out.write("\r\n\r\n");
0927: String partyId = "";
0928: if (userLogin != null)
0929: partyId = userLogin.getString("partyId");
0930:
0931: out.write("\r\n\r\n");
0932:
0933: DecimalFormat decimalFormat = new DecimalFormat("#,###.##");
0934: SimpleDateFormat simpleDateFormat = new SimpleDateFormat(
0935: "MM/dd/yyyy");
0936: SimpleDateFormat simpleTimeFormat = new SimpleDateFormat(
0937: "K:mm a");
0938:
0939: out.write("\r\n\r\n");
0940: String controlPath = (String) request
0941: .getAttribute("_CONTROL_PATH_");
0942: out.write("\r\n");
0943: String contextRoot = (String) request
0944: .getAttribute("_CONTEXT_ROOT_");
0945: out.write("\r\n\r\n");
0946: String pageName = UtilFormatOut
0947: .checkNull((String) pageContext
0948: .getAttribute("PageName"));
0949: out.write("\r\n\r\n");
0950: String companyName = UtilProperties.getPropertyValue(
0951: contextRoot + "/WEB-INF/sfa.properties",
0952: "company.name");
0953: out.write("\r\n");
0954: String companySubtitle = UtilProperties.getPropertyValue(
0955: contextRoot + "/WEB-INF/sfa.properties",
0956: "company.subtitle");
0957: out.write("\r\n");
0958: String headerImageUrl = UtilProperties.getPropertyValue(
0959: contextRoot + "/WEB-INF/sfa.properties",
0960: "header.image.url");
0961: out.write("\r\n\r\n");
0962: String headerBoxBorderColor = UtilProperties
0963: .getPropertyValue(contextRoot
0964: + "/WEB-INF/sfa.properties",
0965: "header.box.border.color", "black");
0966: out.write("\r\n");
0967: String headerBoxBorderWidth = UtilProperties
0968: .getPropertyValue(contextRoot
0969: + "/WEB-INF/sfa.properties",
0970: "header.box.border.width", "1");
0971: out.write("\r\n");
0972: String headerBoxTopColor = UtilProperties.getPropertyValue(
0973: contextRoot + "/WEB-INF/sfa.properties",
0974: "header.box.top.color", "#336699");
0975: out.write("\r\n");
0976: String headerBoxBottomColor = UtilProperties
0977: .getPropertyValue(contextRoot
0978: + "/WEB-INF/sfa.properties",
0979: "header.box.bottom.color", "#cccc99");
0980: out.write("\r\n");
0981: String headerBoxBottomColorAlt = UtilProperties
0982: .getPropertyValue(contextRoot
0983: + "/WEB-INF/sfa.properties",
0984: "header.box.bottom.alt.color", "#eeeecc");
0985: out.write("\r\n");
0986: String headerBoxTopPadding = UtilProperties
0987: .getPropertyValue(contextRoot
0988: + "/WEB-INF/sfa.properties",
0989: "header.box.top.padding", "4");
0990: out.write("\r\n");
0991: String headerBoxBottomPadding = UtilProperties
0992: .getPropertyValue(contextRoot
0993: + "/WEB-INF/sfa.properties",
0994: "header.box.bottom.padding", "2");
0995: out.write("\r\n\r\n");
0996: String boxBorderColor = UtilProperties.getPropertyValue(
0997: contextRoot + "/WEB-INF/sfa.properties",
0998: "box.border.color", "black");
0999: out.write("\r\n");
1000: String boxBorderWidth = UtilProperties.getPropertyValue(
1001: contextRoot + "/WEB-INF/sfa.properties",
1002: "box.border.width", "1");
1003: out.write("\r\n");
1004: String boxTopColor = UtilProperties.getPropertyValue(
1005: contextRoot + "/WEB-INF/sfa.properties",
1006: "box.top.color", "#336699");
1007: out.write("\r\n");
1008: String boxBottomColor = UtilProperties.getPropertyValue(
1009: contextRoot + "/WEB-INF/sfa.properties",
1010: "box.bottom.color", "white");
1011: out.write("\r\n");
1012: String boxBottomColorAlt = UtilProperties.getPropertyValue(
1013: contextRoot + "/WEB-INF/sfa.properties",
1014: "box.bottom.alt.color", "white");
1015: out.write("\r\n");
1016: String boxTopPadding = UtilProperties.getPropertyValue(
1017: contextRoot + "/WEB-INF/sfa.properties",
1018: "box.top.padding", "4");
1019: out.write("\r\n");
1020: String boxBottomPadding = UtilProperties.getPropertyValue(
1021: contextRoot + "/WEB-INF/sfa.properties",
1022: "box.bottom.padding", "4");
1023: out.write("\r\n");
1024: String userStyleSheet = "/sfa/includes/maincss.css";
1025: out.write("\r\n");
1026: String alphabet[] = { "a", "b", "c", "d", "e", "f", "g",
1027: "h", "i", "j", "k", "l", "m", "n", "o", "p", "q",
1028: "r", "s", "t", "u", "v", "w", "x", "y", "z", "*" };
1029: out.write("\r\n\r\n");
1030: out.write("<!-- [oldDeclarations.jsp] End -->\r\n\r\n");
1031: out.write("\r\n\r\n");
1032: out.write("<HTML>\r\n");
1033: out.write("<HEAD>\r\n\r\n");
1034:
1035: String clientRequest = (String) session
1036: .getAttribute("_CLIENT_REQUEST_");
1037: //out.write("Client request: " + clientRequest + "<BR>");
1038: String hostName = "";
1039: if (clientRequest != null
1040: && clientRequest.indexOf("//") > 0) {
1041: int startPos = clientRequest.indexOf("//") + 2;
1042: int endPos = clientRequest.indexOf(":", startPos);
1043: if (endPos < startPos)
1044: endPos = clientRequest.indexOf("/", startPos);
1045: if (endPos < startPos)
1046: hostName = clientRequest.substring(startPos);
1047: else
1048: hostName = clientRequest
1049: .substring(startPos, endPos);
1050: } else {
1051: hostName = "";
1052: }
1053: //out.write("Host name: " + hostName + "<BR>");
1054:
1055: out.write("\r\n\r\n");
1056: out.write("<title>");
1057: out.print(hostName);
1058: out.write(" - Sales Force Automation - ");
1059: out.print(companyName);
1060: out.write("</title>\r\n\r\n");
1061: out.write("\r\n");
1062: out.write("<!-- [userStyle.jsp] Start -->\r\n\r\n");
1063:
1064: //------------ Get the style sheet
1065: String styleSheetId = null;
1066:
1067: ModelEntity entityStyleUser = delegator
1068: .getModelEntity("UiUserTemplate");
1069: HashMap hashMapStyleUser = new HashMap();
1070: if (userLogin != null) {
1071: String ulogin = userLogin.getString("userLoginId");
1072: hashMapStyleUser.put("userLoginId", ulogin);
1073: } else {
1074: hashMapStyleUser.put("userLoginId", "Default");
1075: }
1076: GenericPK stylePk = new GenericPK(entityStyleUser,
1077: hashMapStyleUser);
1078: GenericValue userTemplate = delegator
1079: .findByPrimaryKey(stylePk);
1080: if (userTemplate != null) {
1081: styleSheetId = userTemplate.getString("styleSheetId");
1082: }
1083:
1084: if (styleSheetId == null) {
1085: hashMapStyleUser.put("userLoginId", "Default");
1086: stylePk = new GenericPK(entityStyleUser,
1087: hashMapStyleUser);
1088: userTemplate = delegator.findByPrimaryKey(stylePk);
1089: if (userTemplate != null) {
1090: styleSheetId = userTemplate
1091: .getString("styleSheetId");
1092: }
1093: }
1094:
1095: if (styleSheetId != null) {
1096: ModelEntity entityStyle = delegator
1097: .getModelEntity("UiStyleTemplate");
1098: HashMap hashMapStyle = new HashMap();
1099: hashMapStyle.put("styleSheetId", styleSheetId);
1100: stylePk = new GenericPK(entityStyle, hashMapStyle);
1101: GenericValue styleTemplate = delegator
1102: .findByPrimaryKey(stylePk);
1103: userStyleSheet = styleTemplate
1104: .getString("styleSheetLoc");
1105:
1106: if (userStyleSheet == null) {
1107: userStyleSheet = "/sfa/includes/maincss.css";
1108: }
1109: }
1110:
1111: out.write("\r\n");
1112: out.write("<link rel=\"stylesheet\" href=\"");
1113: out.print(userStyleSheet);
1114: out.write("\" type=\"text/css\">\r\n\r\n");
1115: out.write("<!-- [userStyle.jsp] End -->\r\n\r\n");
1116: out.write("\r\n");
1117: out
1118: .write("<LINK rel=\"stylesheet\" type=\"text/css\" href=\"/sfa/css/gridstyles.css\">\r\n");
1119: out
1120: .write("<script language=\"JavaScript\" >\r\n\r\n function sendDropDown(elementName, idName, fieldName, findClass, paramName, paramValue, frm, action)\r\n {\r\n var sUrl = '");
1121: if (_jspx_meth_ofbiz_url_0(pageContext))
1122: return;
1123: out
1124: .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 = '");
1125: if (_jspx_meth_ofbiz_url_1(pageContext))
1126: return;
1127: out
1128: .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");
1129: out
1130: .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");
1131: out
1132: .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");
1133: out
1134: .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");
1135: out
1136: .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");
1137: out
1138: .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");
1139: out
1140: .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");
1141: out
1142: .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] ");
1143: out
1144: .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 ");
1145: out
1146: .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 ");
1147: out
1148: .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 ");
1149: out
1150: .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 ");
1151: out
1152: .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 ");
1153: out
1154: .write("< myRows; i++) {\r\n myArray[i] = new Array(myCols)\r\n for (j=0; j ");
1155: out
1156: .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 ");
1157: out.write("< myRows; i++) {\r\n for (j=0; j ");
1158: out
1159: .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");
1160: out.write("</script>\r\n\r\n\r\n");
1161: out.write("\r\n\r\n");
1162: out.write("</HEAD>\r\n\r\n");
1163: out.write("<BASE TARGET=\"content\">\r\n");
1164: out.write("<!--");
1165: out
1166: .write("<BODY CLASS=\"bodyform\" onbeforeunload=\"verifyClose()\">-->\r\n");
1167: out.write("<BODY CLASS=\"bodyform\"\">\r\n\r\n");
1168: out.write("\r\n");
1169: out.write("<!-- onBeforeUnload.jsp - Start -->\r\n\r\n");
1170: out
1171: .write("<SCRIPT LANGUAGE=\"JScript\" TYPE=\"text/javascript\" FOR=window EVENT=onbeforeunload>\r\n return doOnBeforeUnload();\r\n");
1172: out.write("</SCRIPT>\r\n\r\n");
1173: out
1174: .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");
1175: out
1176: .write(" var vFormC = document.forms;\r\n for (var vFormNbr = 0; vFormNbr ");
1177: out
1178: .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==\"");
1179: out.print(UIScreenSection.ACTION_INSERT);
1180: out.write("\" ||\r\n vAction==\"");
1181: out.print(UIScreenSection.ACTION_UPDATE);
1182: out.write("\" ||\r\n vAction==\"");
1183: out.print(UIScreenSection.ACTION_UPDATE_SELECT);
1184: out
1185: .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 ");
1186: out
1187: .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 = \"");
1188: out.print(UIWebUtility.HTML_NAME_PREFIX_ORIGINAL);
1189: out
1190: .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");
1191: out
1192: .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");
1193: out.write("</SCRIPT>\r\n\r\n");
1194: out.write("<!-- onBeforeUnload.jsp - End -->\r\n\r\n\r\n");
1195: out.write("\r\n\r\n");
1196: out
1197: .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 ");
1198: out.write("<denis@softcomplex.com>; ");
1199: out
1200: .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");
1201: out
1202: .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\"");
1203: out.write("<html>\\n\"+\r\n\t\t\" ");
1204: out.write("<head>\\n\"+\r\n\t\t\" ");
1205: out.write("<title>Calendar");
1206: out.write("</title>\\n\"+\r\n\t\t\" ");
1207: out.write("</head>\\n\"+\r\n\t\t\" ");
1208: out.write("<body bgcolor=\\\"White\\\">\\n\"+\r\n\t\t\" ");
1209: out
1210: .write("<table class=\\\"clsOTable\\\" cellspacing=\\\"0\\\" border=\\\"0\\\" width=\\\"100%\\\">\\n\" +\r\n\t\t\" ");
1211: out.write("<tr>\\n\" +\r\n\t\t\" ");
1212: out
1213: .write("<td bgcolor=\\\"#4682B4\\\">\\n\" +\r\n\t\t\" ");
1214: out
1215: .write("<table cellspacing=\\\"1\\\" cellpadding=\\\"3\\\" border=\\\"0\\\" width=\\\"100%\\\">\\n\" +\r\n\t\t\" ");
1216: out.write("<tr>\\n\" +\r\n\t\t\" ");
1217: out
1218: .write("<td bgcolor=\\\"#4682B4\\\">\\n\" +\r\n\t\t\" ");
1219: out
1220: .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\" ");
1221: out
1222: .write("<img src=\\\"/sfaimages/prev.gif\\\" width=\\\"16\\\" height=\\\"16\\\" border=\\\"0\\\"\" +\r\n\t\t\" alt=\\\"previous month\\\">\\n\" +\r\n\t\t\" ");
1223: out.write("</a>\\n\" +\r\n\t\t\" ");
1224: out.write("</td>\\n\" +\r\n\t\t\" ");
1225: out
1226: .write("<td bgcolor=\\\"#4682B4\\\" colspan=\\\"5\\\">\\n\" +\r\n\t\t\" ");
1227: out
1228: .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\" ");
1229: out.write("</font>\\n\" +\r\n\t\t\" ");
1230: out.write("</td>\\n\" +\r\n\t\t\" ");
1231: out
1232: .write("<td bgcolor=\\\"#4682B4\\\" align=\\\"right\\\">\\n\" +\r\n\t\t\" ");
1233: out
1234: .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\" ");
1235: out
1236: .write("<img src=\\\"/sfaimages/next.gif\\\" width=\\\"16\\\" height=\\\"16\\\" border=\\\"0\\\"\" +\r\n\t\t\" alt=\\\"next month\\\">\\n\" +\r\n\t\t\" ");
1237: out.write("</a>\\n\" +\r\n\t\t\" ");
1238: out.write("</td>\\n\" +\r\n\t\t\" ");
1239: out
1240: .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 += \" ");
1241: out.write("<tr>\\n\";\r\n\tfor (var n=0; n");
1242: out.write("<7; n++)\r\n\t\tstr_buffer += \" ");
1243: out
1244: .write("<td bgcolor=\\\"#87CEFA\\\">\\n\" +\r\n\t\t\" ");
1245: out
1246: .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\" ");
1247: out.write("</font>");
1248: out
1249: .write("</td>\\n\";\r\n\t// print calendar table\r\n\tstr_buffer += \" ");
1250: out
1251: .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 += \" ");
1252: out
1253: .write("<tr>\\n\";\r\n\t\tfor (var n_current_wday=0; n_current_wday");
1254: out
1255: .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 += \" ");
1256: out
1257: .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 += \" ");
1258: out
1259: .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 += \" ");
1260: out
1261: .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 += \" ");
1262: out
1263: .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 += \" ");
1264: out
1265: .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 += \" ");
1266: out
1267: .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 += \" ");
1268: out
1269: .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\" ");
1270: out.write("</font>\\n\" +\r\n\t\t\t\t\" ");
1271: out.write("</a>\\n\" +\r\n\t\t\t\t\" ");
1272: out
1273: .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 += \" ");
1274: out
1275: .write("</tr>\\n\";\r\n\t}\r\n\t// print calendar footer\r\n\tstr_buffer +=\r\n\t\t\" ");
1276: out
1277: .write("<form name=\\\"cal\\\">\\n\" +\r\n\t\t\" ");
1278: out.write("<tr>\\n\" +\r\n\t\t\" ");
1279: out
1280: .write("<td colspan=\\\"7\\\" bgcolor=\\\"#87CEFA\\\">\\n\" +\r\n\t\t\" ");
1281: out
1282: .write("<font color=\\\"White\\\" face=\\\"tahoma, verdana\\\" size=\\\"2\\\">\\n\" +\r\n\t\t\" Time:\\n\" +\r\n\t\t\" ");
1283: out
1284: .write("<input type=\\\"text\\\" name=\\\"time\\\" value=\\\"\" + dt2tmstr(dt_datetime) +\r\n\t\t\"\\\" size=\\\"8\\\" maxlength=\\\"8\\\">\\n\" +\r\n\t\t\" ");
1285: out.write("</font>\\n\" +\r\n\t\t\" ");
1286: out.write("</td>\\n\" +\r\n\t\t\" ");
1287: out.write("</tr>\\n\" +\r\n\t\t\" ");
1288: out.write("</form>\\n\" +\r\n\t\t\" ");
1289: out.write("</table>\\n\" +\r\n\t\t\" ");
1290: out.write("</tr>\\n\" +\r\n\t\t\" ");
1291: out.write("</td>\\n\" +\r\n\t\t\" ");
1292: out.write("</table>\\n\" +\r\n\t\t\" ");
1293: out.write("</body>\\n\" +\r\n\t\t\"");
1294: out
1295: .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");
1296: out
1297: .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");
1298: out.write("</script>\r\n");
1299: out.write("\r\n\r\n");
1300: out.write("\r\n\r\n ");
1301: out
1302: .write("<table WIDTH=\"100%\" CLASS=\"freeFormSectionTitleTable\">");
1303: out.write("<tr>\r\n ");
1304: out
1305: .write("<td>\r\n Application: Import/Export\r\n ");
1306: out.write("</td>\r\n ");
1307: out.write("</table>\r\n\r\n ");
1308: out
1309: .write("<table WIDTH=\"100%\" HEIGHT=\"100%\" CLASS=\"freeFormSectionDisplayTable\">\r\n");
1310:
1311: String action = "";
1312: if (request.getParameter("action") != null) {
1313: action = request.getParameter("action");
1314: }
1315:
1316: if (action.equals("")) {
1317:
1318: out.write("\r\n\t");
1319: out.write("<p>");
1320: out.write("<br>");
1321: out
1322: .write("<br>You can use this page to import or export the application definitions from the system. If you choose to import, all existing \r\n\tapplication definitions will be deleted. If you are unsure, you should not import definitions into an existing system.");
1323: out.write("<p>");
1324: out.write("<br>");
1325: out.write("<hr>");
1326: out.write("<br>");
1327: out.write("<p>\r\n\t");
1328: out.write("<a href=\"");
1329: if (_jspx_meth_ofbiz_url_2(pageContext))
1330: return;
1331: out
1332: .write("?action=showExport\">Click here to export application definitions to XML files");
1333: out.write("</a>");
1334: out.write("<p>");
1335: out.write("<p>\r\n\t");
1336: out.write("<a href=\"");
1337: if (_jspx_meth_ofbiz_url_3(pageContext))
1338: return;
1339: out
1340: .write("?action=showImport\">Click here to import application definitions from XML files");
1341: out.write("</a>");
1342: out.write("<p>\r\n");
1343:
1344: }
1345:
1346: if (action.equals("showExport")) {
1347: String filePath = System.getProperty("ofbiz.home");
1348: filePath += "/hot-deploy/sfa/sfadb";
1349:
1350: out.write("\r\n ");
1351: out.write("<form method=\"post\" action=\"");
1352: if (_jspx_meth_ofbiz_url_4(pageContext))
1353: return;
1354: out.write("\">\r\n ");
1355: out
1356: .write("<input type=\"hidden\" value=\"doExport\" name=\"action\" >\r\n\r\n ");
1357: out.write("<TR>\r\n ");
1358: out
1359: .write("<TD CLASS=\"freeFormSectionLabel\">\r\n\t\t File Path:\r\n\t\t ");
1360: out.write("</TD>\r\n\t\t ");
1361: out
1362: .write("<TD CLASS=\"freeFormSectionField\">\r\n\t\t ");
1363: out
1364: .write("<input MAXLENGTH=100 SIZE=80 type=\"text\" name=\"filePath\" value=\"");
1365: out.print(filePath);
1366: out.write("\">\r\n\t\t ");
1367: out.write("</TD>\r\n ");
1368: out.write("</TR>\r\n\r\n ");
1369: out.write("<TR>\r\n\t\t ");
1370: out
1371: .write("<TD CLASS=\"freeFormSectionSaveButtonArea\" COLSPAN=\"2\">\r\n ");
1372: out
1373: .write("<input type=\"submit\" value=\"Write Files\" >\r\n\t\t ");
1374: out.write("</TD>\r\n ");
1375: out.write("</TR>\r\n\r\n ");
1376: out.write("</FORM>\r\n ");
1377: out.write("</TABLE>\r\n");
1378:
1379: return;
1380: }
1381:
1382: if (action.equals("doExport")) {
1383: String filePath = request.getParameter("filePath");
1384: String message = uIXMLFileUtil.saveAll(delegator,
1385: filePath);
1386:
1387: out.write("\r\n ");
1388: out.write("<TR>\r\n\t\t ");
1389: out
1390: .write("<TD CLASS=\"freeFormSectionField\" COLSPAN=\"2\">\r\n ");
1391: out.print(message);
1392: out.write("\r\n\t\t ");
1393: out.write("</TD>\r\n ");
1394: out.write("</TR>\r\n");
1395:
1396: return;
1397: }
1398:
1399: out.write("\r\n\r\n");
1400: out.write(" ");
1401: out.write("<!-- left column table -->\r\n ");
1402: out.write("</td>\r\n ");
1403: out.write("</tr>\r\n");
1404: out.write("</table>\r\n\r\n\r\n");
1405: out
1406: .write("<!-- used to get dynamic information from a server -->\r\n");
1407: out
1408: .write("<A style='visibility:hidden' id='searchA' name='searchA' target=\"searchIFrame\">");
1409: out.write("</A>\r\n");
1410: out
1411: .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();' >");
1412: out.write("</iframe>\r\n");
1413: out.write("<!--");
1414: out
1415: .write("<iframe id='searchIFrame' name='searchIFrame' WIDTH=\"100%\" onload='updateForm();' >");
1416: out.write("</iframe>-->\r\n\r\n\r\n");
1417: out.write("</body>\r\n");
1418: out.write("</html>\r\n");
1419: out.write("\r\n\r\n");
1420: } catch (Throwable t) {
1421: out = _jspx_out;
1422: if (out != null && out.getBufferSize() != 0)
1423: out.clearBuffer();
1424: if (pageContext != null)
1425: pageContext.handlePageException(t);
1426: } finally {
1427: if (_jspxFactory != null)
1428: _jspxFactory.releasePageContext(pageContext);
1429: }
1430: }
1431:
1432: private boolean _jspx_meth_ofbiz_url_0(
1433: javax.servlet.jsp.PageContext pageContext) throws Throwable {
1434: JspWriter out = pageContext.getOut();
1435: /* ---- ofbiz:url ---- */
1436: org.ofbiz.content.webapp.taglib.UrlTag _jspx_th_ofbiz_url_0 = (org.ofbiz.content.webapp.taglib.UrlTag) _jspx_tagPool_ofbiz_url
1437: .get(org.ofbiz.content.webapp.taglib.UrlTag.class);
1438: _jspx_th_ofbiz_url_0.setPageContext(pageContext);
1439: _jspx_th_ofbiz_url_0.setParent(null);
1440: int _jspx_eval_ofbiz_url_0 = _jspx_th_ofbiz_url_0.doStartTag();
1441: if (_jspx_eval_ofbiz_url_0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
1442: if (_jspx_eval_ofbiz_url_0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
1443: javax.servlet.jsp.tagext.BodyContent _bc = pageContext
1444: .pushBody();
1445: out = _bc;
1446: _jspx_th_ofbiz_url_0.setBodyContent(_bc);
1447: _jspx_th_ofbiz_url_0.doInitBody();
1448: }
1449: do {
1450: out.write("/testServer");
1451: int evalDoAfterBody = _jspx_th_ofbiz_url_0
1452: .doAfterBody();
1453: if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
1454: break;
1455: } while (true);
1456: if (_jspx_eval_ofbiz_url_0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE)
1457: out = pageContext.popBody();
1458: }
1459: if (_jspx_th_ofbiz_url_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE)
1460: return true;
1461: _jspx_tagPool_ofbiz_url.reuse(_jspx_th_ofbiz_url_0);
1462: return false;
1463: }
1464:
1465: private boolean _jspx_meth_ofbiz_url_1(
1466: javax.servlet.jsp.PageContext pageContext) throws Throwable {
1467: JspWriter out = pageContext.getOut();
1468: /* ---- ofbiz:url ---- */
1469: org.ofbiz.content.webapp.taglib.UrlTag _jspx_th_ofbiz_url_1 = (org.ofbiz.content.webapp.taglib.UrlTag) _jspx_tagPool_ofbiz_url
1470: .get(org.ofbiz.content.webapp.taglib.UrlTag.class);
1471: _jspx_th_ofbiz_url_1.setPageContext(pageContext);
1472: _jspx_th_ofbiz_url_1.setParent(null);
1473: int _jspx_eval_ofbiz_url_1 = _jspx_th_ofbiz_url_1.doStartTag();
1474: if (_jspx_eval_ofbiz_url_1 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
1475: if (_jspx_eval_ofbiz_url_1 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
1476: javax.servlet.jsp.tagext.BodyContent _bc = pageContext
1477: .pushBody();
1478: out = _bc;
1479: _jspx_th_ofbiz_url_1.setBodyContent(_bc);
1480: _jspx_th_ofbiz_url_1.doInitBody();
1481: }
1482: do {
1483: out.write("/testServer");
1484: int evalDoAfterBody = _jspx_th_ofbiz_url_1
1485: .doAfterBody();
1486: if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
1487: break;
1488: } while (true);
1489: if (_jspx_eval_ofbiz_url_1 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE)
1490: out = pageContext.popBody();
1491: }
1492: if (_jspx_th_ofbiz_url_1.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE)
1493: return true;
1494: _jspx_tagPool_ofbiz_url.reuse(_jspx_th_ofbiz_url_1);
1495: return false;
1496: }
1497:
1498: private boolean _jspx_meth_ofbiz_url_2(
1499: javax.servlet.jsp.PageContext pageContext) throws Throwable {
1500: JspWriter out = pageContext.getOut();
1501: /* ---- ofbiz:url ---- */
1502: org.ofbiz.content.webapp.taglib.UrlTag _jspx_th_ofbiz_url_2 = (org.ofbiz.content.webapp.taglib.UrlTag) _jspx_tagPool_ofbiz_url
1503: .get(org.ofbiz.content.webapp.taglib.UrlTag.class);
1504: _jspx_th_ofbiz_url_2.setPageContext(pageContext);
1505: _jspx_th_ofbiz_url_2.setParent(null);
1506: int _jspx_eval_ofbiz_url_2 = _jspx_th_ofbiz_url_2.doStartTag();
1507: if (_jspx_eval_ofbiz_url_2 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
1508: if (_jspx_eval_ofbiz_url_2 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
1509: javax.servlet.jsp.tagext.BodyContent _bc = pageContext
1510: .pushBody();
1511: out = _bc;
1512: _jspx_th_ofbiz_url_2.setBodyContent(_bc);
1513: _jspx_th_ofbiz_url_2.doInitBody();
1514: }
1515: do {
1516: out.write("/applications");
1517: int evalDoAfterBody = _jspx_th_ofbiz_url_2
1518: .doAfterBody();
1519: if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
1520: break;
1521: } while (true);
1522: if (_jspx_eval_ofbiz_url_2 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE)
1523: out = pageContext.popBody();
1524: }
1525: if (_jspx_th_ofbiz_url_2.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE)
1526: return true;
1527: _jspx_tagPool_ofbiz_url.reuse(_jspx_th_ofbiz_url_2);
1528: return false;
1529: }
1530:
1531: private boolean _jspx_meth_ofbiz_url_3(
1532: javax.servlet.jsp.PageContext pageContext) throws Throwable {
1533: JspWriter out = pageContext.getOut();
1534: /* ---- ofbiz:url ---- */
1535: org.ofbiz.content.webapp.taglib.UrlTag _jspx_th_ofbiz_url_3 = (org.ofbiz.content.webapp.taglib.UrlTag) _jspx_tagPool_ofbiz_url
1536: .get(org.ofbiz.content.webapp.taglib.UrlTag.class);
1537: _jspx_th_ofbiz_url_3.setPageContext(pageContext);
1538: _jspx_th_ofbiz_url_3.setParent(null);
1539: int _jspx_eval_ofbiz_url_3 = _jspx_th_ofbiz_url_3.doStartTag();
1540: if (_jspx_eval_ofbiz_url_3 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
1541: if (_jspx_eval_ofbiz_url_3 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
1542: javax.servlet.jsp.tagext.BodyContent _bc = pageContext
1543: .pushBody();
1544: out = _bc;
1545: _jspx_th_ofbiz_url_3.setBodyContent(_bc);
1546: _jspx_th_ofbiz_url_3.doInitBody();
1547: }
1548: do {
1549: out.write("/applications");
1550: int evalDoAfterBody = _jspx_th_ofbiz_url_3
1551: .doAfterBody();
1552: if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
1553: break;
1554: } while (true);
1555: if (_jspx_eval_ofbiz_url_3 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE)
1556: out = pageContext.popBody();
1557: }
1558: if (_jspx_th_ofbiz_url_3.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE)
1559: return true;
1560: _jspx_tagPool_ofbiz_url.reuse(_jspx_th_ofbiz_url_3);
1561: return false;
1562: }
1563:
1564: private boolean _jspx_meth_ofbiz_url_4(
1565: javax.servlet.jsp.PageContext pageContext) throws Throwable {
1566: JspWriter out = pageContext.getOut();
1567: /* ---- ofbiz:url ---- */
1568: org.ofbiz.content.webapp.taglib.UrlTag _jspx_th_ofbiz_url_4 = (org.ofbiz.content.webapp.taglib.UrlTag) _jspx_tagPool_ofbiz_url
1569: .get(org.ofbiz.content.webapp.taglib.UrlTag.class);
1570: _jspx_th_ofbiz_url_4.setPageContext(pageContext);
1571: _jspx_th_ofbiz_url_4.setParent(null);
1572: int _jspx_eval_ofbiz_url_4 = _jspx_th_ofbiz_url_4.doStartTag();
1573: if (_jspx_eval_ofbiz_url_4 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
1574: if (_jspx_eval_ofbiz_url_4 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
1575: javax.servlet.jsp.tagext.BodyContent _bc = pageContext
1576: .pushBody();
1577: out = _bc;
1578: _jspx_th_ofbiz_url_4.setBodyContent(_bc);
1579: _jspx_th_ofbiz_url_4.doInitBody();
1580: }
1581: do {
1582: out.write("/applications");
1583: int evalDoAfterBody = _jspx_th_ofbiz_url_4
1584: .doAfterBody();
1585: if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
1586: break;
1587: } while (true);
1588: if (_jspx_eval_ofbiz_url_4 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE)
1589: out = pageContext.popBody();
1590: }
1591: if (_jspx_th_ofbiz_url_4.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE)
1592: return true;
1593: _jspx_tagPool_ofbiz_url.reuse(_jspx_th_ofbiz_url_4);
1594: return false;
1595: }
1596: }
|