home *** CD-ROM | disk | FTP | other *** search
/ ftp.tcs3.com / ftp.tcs3.com.tar / ftp.tcs3.com / DRIVERS / Audio / Office2010 / ProPlus.WW / ProPsWW2.cab / FORM.JS3 < prev    next >
Text File  |  2007-02-04  |  80KB  |  2,182 lines

  1. /*********************************************************************
  2.                                  Notice
  3.  
  4. You may not modify, use, copy or distribute this file or its contents. 
  5. Internal interfaces referenced in this file are nonpublic, unsupported 
  6. and subject to change without notice. These interfaces may not be 
  7. utilized in other software applications or components.
  8.  
  9.  
  10. *********************************************************************/
  11.  
  12. // This is an enum of all types of objects that can be on a form.
  13. var FormObjectType_Unknown = -1;
  14. var FormObjectType_FieldGroup = 0;
  15. var FormObjectType_TabGroup = 1;
  16. var FormObjectType_Tab = 2;
  17. var FormObjectType_SystemField = 3;
  18. var FormObjectType_Text = 4;
  19. var FormObjectType_MultiLineText = 5;
  20. var FormObjectType_UnformattedNumber = 6;
  21. var FormObjectType_Number = 7;
  22. var FormObjectType_Currency = 8;
  23. var FormObjectType_Date = 9;
  24. var FormObjectType_DateTime = 10;
  25. var FormObjectType_CheckBox = 11;
  26. var FormObjectType_Password = 12;
  27. var FormObjectType_OptionButtons = 13;
  28. var FormObjectType_DropDownList = 14;
  29. var FormObjectType_ListBox = 15;
  30. var FormObjectType_RichText = 16;
  31. var FormObjectType_EmbeddedView = 17;
  32. var FormObjectType_DigitalInk = 18;
  33. var FormObjectType_Attachments = 19;
  34. var FormObjectType_StaticText = 20;
  35. var FormObjectType_FormHeading = 21;
  36. var FormObjectType_SectionHeading = 22;
  37. var FormObjectType_HorizontalLine = 23;
  38. var FormObjectType_NewLine = 24;
  39. var FormObjectType_ScriptButton = 25;
  40. var FormObjectType_Image = 26;
  41.  
  42. // ============================================ \\
  43. // ===        Field Container Class         === \\
  44. // ============================================ \\
  45.  
  46. function FieldContainer(i_IsHeading)
  47. {
  48.     this.IsHeading            = i_IsHeading;
  49.     this.NumberOfColumns    = 1;
  50.     this.Fields                = new Array();
  51.     this.FieldGroups        = new Array();
  52.     this.TabGroups            = new Array();
  53.     this.FormObjects        = new Array();
  54.     this.IsInitialized        = false;
  55. }
  56.  
  57. FieldContainer.prototype.addField = function(i_Field) { this.Fields.push(i_Field); }
  58. FieldContainer.prototype.addSpacer = function() { this.Fields.push(null); }
  59. FieldContainer.prototype.addFieldGroup = function(i_FieldGroup) { this.FieldGroups.push(i_FieldGroup); }
  60. FieldContainer.prototype.addTabGroup = function(i_TabGroup) { this.TabGroups.push(i_TabGroup); }
  61. FieldContainer.prototype.displayFields = function() { document.write(getFields(this)); }
  62.  
  63. function getFields(i_objContainer)
  64. {
  65.     var strFields = "";
  66.  
  67.     if (i_objContainer.Fields.length > 0)
  68.     {
  69.         var objTableNoFieldsInfo = document.getElementById("tableNoFieldsInfo");
  70.         if (objTableNoFieldsInfo != null)
  71.             objTableNoFieldsInfo.style.display = "none";
  72.  
  73.         var objDivHeadingFieldsContainer = document.getElementById("divHeadingFieldsContainer");
  74.         if (objDivHeadingFieldsContainer != null)
  75.             objDivHeadingFieldsContainer.style.display = "inline";
  76.  
  77.         var objDivFieldsContainer = document.getElementById("divFieldsContainer");
  78.         if (objDivFieldsContainer != null)
  79.             objDivFieldsContainer.style.display = "inline";
  80.  
  81.         if (!i_objContainer.IsInitialized)
  82.         {
  83.             // Remove field group shared cells from the total cell count.
  84.             for (var i = 0; i < i_objContainer.FieldGroups.length; i++)
  85.             {
  86.                 for (var j = 0; j < i_objContainer.FieldGroups[i].FieldNames.length; j++)
  87.                 {
  88.                     var FieldName = i_objContainer.FieldGroups[i].FieldNames[j];
  89.                     if (eval("typeof obj" + FieldName) != "undefined")
  90.                     {
  91.                         var Field = eval("obj" + FieldName);
  92.                         i_objContainer.FieldGroups[i].addField(Field);
  93.                         Field.FieldGroup = i_objContainer.FieldGroups[i];
  94.                     }
  95.                 }
  96.             }
  97.  
  98.             // Remove tab group shared cells from the total cell count.
  99.             for (var i = 0; i < i_objContainer.TabGroups.length; i++)
  100.             {
  101.                 for (var j = 0; j < i_objContainer.TabGroups[i].Tabs.length; j++)
  102.                 {
  103.                     for (var k = 0; k < i_objContainer.TabGroups[i].Tabs[j].FieldNames.length; k++)
  104.                     {
  105.                         var FieldName = i_objContainer.TabGroups[i].Tabs[j].FieldNames[k];
  106.                         if (eval("typeof obj" + FieldName) != "undefined")
  107.                         {
  108.                             var Field = eval("obj" + FieldName);
  109.                             i_objContainer.TabGroups[i].Tabs[j].addField(Field);
  110.                             Field.TabGroup = i_objContainer.TabGroups[i];
  111.                             Field.Tab = i_objContainer.TabGroups[i].Tabs[j];
  112.                         }
  113.                     }
  114.                 }
  115.             }
  116.  
  117.             // Set up ordered array of form objects.
  118.             var FormObjectArray = new Array();
  119.             for (var i = 0; i < i_objContainer.Fields.length; i++)
  120.             {
  121.                 var Field = i_objContainer.Fields[i];
  122.                 if (Field.FieldGroup != null)
  123.                 {
  124.                     if (Field.FieldGroup.TabGroup != null)
  125.                     {
  126.                         if (!isFormObjectInArray(Field.FieldGroup.TabGroup.Name, FormObjectArray))
  127.                             FormObjectArray.push(Field.FieldGroup.TabGroup);
  128.                         continue;
  129.                     }
  130.  
  131.                     if (!isFormObjectInArray(Field.FieldGroup.Name, FormObjectArray))
  132.                         FormObjectArray.push(Field.FieldGroup);
  133.                 }
  134.                 else if (Field.TabGroup != null)
  135.                 {
  136.                     if (!isFormObjectInArray(Field.TabGroup.Name, FormObjectArray))
  137.                         FormObjectArray.push(Field.TabGroup);
  138.                 }
  139.                 else
  140.                 {
  141.                     if (!isFormObjectInArray(Field.Name, FormObjectArray))
  142.                         FormObjectArray.push(Field);
  143.                 }
  144.             }
  145.             i_objContainer.FormObjects = FormObjectArray;
  146.  
  147.             i_objContainer.IsInitialized = true;
  148.         }
  149.  
  150.         strFields += getTableHTML(i_objContainer);
  151.     }
  152.     else if (g_IsViewSource)
  153.     {
  154.         var objTableNoFieldsInfo = document.getElementById("tableNoFieldsInfo");
  155.         if (objTableNoFieldsInfo != null)
  156.             objTableNoFieldsInfo.style.display = "none";
  157.     }
  158.  
  159.     if (g_IsViewSource)
  160.         return strFields.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, "><br>");
  161.     else
  162.         return strFields;
  163. }
  164.  
  165. function getTableHTML(i_objContainer)
  166. {
  167.     var TableHTML = "";
  168.  
  169.     var FieldsCountArray = i_objContainer.Fields;
  170.  
  171.     // Get the cell count by adding up all column and row spans.
  172.     var CellCount = 0;
  173.     var ColumnCount = i_objContainer.NumberOfColumns;
  174.     if (ColumnCount == 0 || ColumnCount == -1)
  175.         ColumnCount = 1;
  176.     for (var FieldCount = 0; FieldCount < FieldsCountArray.length; FieldCount++)
  177.     {
  178.         var CurrentField = FieldsCountArray[FieldCount];
  179.         var ColumnSpan = getColumnSpan(CurrentField);
  180.         var RowSpan = getRowSpan(CurrentField);
  181.         if (ColumnCount <= ColumnSpan)
  182.             ColumnSpan = ColumnCount;
  183.         if (ColumnCount == 1)
  184.             RowSpan = 1;
  185.         CellCount += ColumnSpan * RowSpan;
  186.     }
  187.  
  188.     var WidthAttribute = "";
  189.     var IdAttribute = "";
  190.     if (i_objContainer instanceof FieldContainer)
  191.     {
  192.         // Remove field group shared cells from the total cell count.
  193.         for (var i = 0; i < i_objContainer.FieldGroups.length; i++)
  194.         {
  195.             CellCount -= i_objContainer.FieldGroups[i].Fields.length - 1;
  196.         }
  197.  
  198.         // Remove tab group shared cells from the total cell count.
  199.         for (var i = 0; i < i_objContainer.TabGroups.length; i++)
  200.         {
  201.             for (var j = 0; j < i_objContainer.TabGroups[i].Tabs.length; j++)
  202.             {
  203.                 CellCount -= i_objContainer.TabGroups[i].Tabs[j].Fields.length - 1;
  204.             }
  205.         }
  206.  
  207.         if (i_objContainer.IsHeading)
  208.         {
  209.             WidthAttribute = " WIDTH=\"100%\"";
  210.             IdAttribute = " ID=\"HeadingTable\"";
  211.         }
  212.         else
  213.             IdAttribute = " ID=\"FieldsTable\"";
  214.     }
  215.  
  216.     var BorderAttribute = " BORDER=\"0\"";
  217.     if (g_ShowBorder)
  218.         BorderAttribute = " BORDER=\"2\"";
  219.  
  220.     TableHTML += "<TABLE CELLPADDING=\"3\" CELLSPACING=\"0\"" + IdAttribute + BorderAttribute + WidthAttribute + "><TR>";
  221.  
  222.     // Get the row counts from the column and cell counts, and init the array.
  223.     var RowCount = Math.round(CellCount / ColumnCount);
  224.     var RowTotalArray = new Array(RowCount);
  225.     for (var i = 0; i < RowTotalArray.length; i++)
  226.     {
  227.         RowTotalArray[i] = 0;
  228.     }
  229.  
  230.     var FieldsArray = new Array();
  231.     if (i_objContainer instanceof Tab)
  232.         FieldsArray = i_objContainer.Fields;
  233.     else if (i_objContainer instanceof FieldContainer)
  234.         FieldsArray = i_objContainer.FormObjects;
  235.  
  236.     var ColumnTotal = 0;
  237.     var CurrentRow = 0;
  238.     for (var FieldCount = 0; FieldCount < FieldsArray.length; FieldCount++)
  239.     {
  240.         // Check to see if we should go to a new row or not.
  241.         if (ColumnTotal >= ColumnCount || RowTotalArray[CurrentRow] >= ColumnCount)
  242.         {
  243.             TableHTML += "</TR><TR>";
  244.             ColumnTotal = 0;
  245.             CurrentRow++;
  246.         }
  247.  
  248.         // Display the field label and body.
  249.         var CurrentField = FieldsArray[FieldCount];
  250.         // Make sure there are no fields that are wider than the layout.
  251.         if (getColumnSpan(CurrentField) > ColumnCount)
  252.             CurrentField.ColumnSpan = ColumnCount - ColumnTotal;
  253.         // Make sure there are no fields with a row span if there is only one column.
  254.         if (ColumnCount == 1 && getRowSpan(CurrentField) > 1)
  255.             CurrentField.RowSpan = 1;
  256.         // Get the cell HTML for the field.
  257.         TableHTML += getFieldCellHTML(CurrentField, i_objContainer);
  258.  
  259.         // Update the row and column totals.
  260.         var CurrentFieldColumnSpan = 1;
  261.         var CurrentFieldRowSpan = 1;
  262.         if (CurrentField != null)
  263.         {
  264.             CurrentFieldColumnSpan = getColumnSpan(CurrentField);
  265.             CurrentFieldRowSpan = getRowSpan(CurrentField);
  266.         }
  267.         // Update the current column total.
  268.         ColumnTotal += CurrentFieldColumnSpan;
  269.         // Update total of all rows this field is in.
  270.         for (var i = 0; i < CurrentFieldRowSpan; i++)
  271.         {
  272.             RowTotalArray[CurrentRow + i] += CurrentFieldColumnSpan;
  273.         }
  274.  
  275.         // Check to see if we should go to a new row or not.
  276.         if (ColumnTotal >= ColumnCount || RowTotalArray[CurrentRow] >= ColumnCount)
  277.         {
  278.             TableHTML += "</TR><TR>";
  279.             ColumnTotal = 0;
  280.             CurrentRow++;
  281.         }
  282.     }
  283.  
  284.     TableHTML += "</TR></TABLE>";
  285.     return TableHTML;
  286. }
  287.  
  288. function getFieldCellHTML(i_FormObject, i_objContainer)
  289. {
  290.     var FieldCellHTML = "";
  291.  
  292.     if (i_FormObject != null)
  293.     {
  294.         if (i_FormObject.Type == FormObjectType_TabGroup)
  295.         {
  296.             var StyleAttribute = "";
  297.             if (i_FormObject.IsHidden || (g_IsReadOnly && i_FormObject.Type == FormObjectType_Attachments))
  298.                 StyleAttribute = " STYLE=\"display:none;\"";
  299.  
  300.             var FieldBodyHTML = "<TABLE CELLPADDING=\"0\" CELLSPACING=\"0\" BORDER=\"0\" WIDTH=\"100%\"" + StyleAttribute + "><TR>";
  301.  
  302.             if (i_FormObject.Tabs.length > 1)
  303.             {
  304.                 FieldBodyHTML += "<TD>";
  305.                 for (var i = 0; i < i_FormObject.Tabs.length; i++)
  306.                 {
  307.                     var Tab = i_FormObject.Tabs[i];
  308.                     var ClassAttribute = " CLASS=\"";
  309.                     if (i == 0)
  310.                     {
  311.                         i_FormObject.ActiveTabName = Tab.Name;
  312.                         ClassAttribute += "activeTab";
  313.                     }
  314.                     else
  315.                         ClassAttribute += "inactiveTab";
  316.                     FieldBodyHTML += "<SPAN OBJECTTYPE=\"Tab\" TABINDEX=\"1\" STYLE=\"padding:2px 8px 2px 8px;\"" + ClassAttribute + "\" ID=\"" + Tab.Name + "\" ONCLICK=\"tabClick(this, obj" + i_FormObject.Name + ")\" ONKEYPRESS=\"tabClick(this, obj" + i_FormObject.Name + ")\">" + Tab.Text + "</SPAN>";
  317.                 }
  318.                 FieldBodyHTML += "</TD></TR><TR>";
  319.             }
  320.             FieldBodyHTML += "<TD CLASS=\"tabContents\">";
  321.  
  322.             for (var i = 0; i < i_FormObject.Tabs.length; i++)
  323.             {
  324.                 var Tab = i_FormObject.Tabs[i];
  325.                 var StyleAttribute = " STYLE=\"display:none; width:100%;\"";
  326.                 if (i_FormObject.ActiveTabName == Tab.Name || (i == 0 && i_FormObject.ActiveTabName == ""))
  327.                     StyleAttribute = " STYLE=\"width:100%;\"";
  328.                 FieldBodyHTML += "<DIV OBJECTTYPE=\"TabContents\" ID=\"" + Tab.Name + "Contents\"" + StyleAttribute + ">";
  329.                 FieldBodyHTML += getTableHTML(Tab);
  330.                 FieldBodyHTML += "</DIV>";
  331.             }
  332.             FieldBodyHTML += "</TD></TR></TABLE>";
  333.  
  334.             // The CLASS attribute for the TD tag.
  335.             var ClassAttribute = "";
  336.             if (i_FormObject.ClassName != "")
  337.                 ClassAttribute = " CLASS=\"" + i_FormObject.ClassName + "\"";
  338.             // The common attributes for label and field TD tags.
  339.             var LabelAttributes = " VALIGN=\"top\" ID=\"" + i_FormObject.Name + "_label\"" + ClassAttribute;
  340.             var FieldAttributes = " VALIGN=\"top\" ID=\"" + i_FormObject.Name + "_field\"" + ClassAttribute;
  341.             // The COLSPAN attribute for the TD tag.
  342.             var ColumnSpan = getSpanAttribute("COLSPAN", getColumnSpan(i_FormObject) * 2);
  343.             // The ROWSPAN attribute for the TD tag.
  344.             var RowSpan = getSpanAttribute("ROWSPAN", getRowSpan(i_FormObject));
  345.             // The COLSPAN attribute for the TD tag.
  346.             var FieldColumnSpan = getSpanAttribute("COLSPAN", (getColumnSpan(i_FormObject) * 2) - 1);
  347.             // The FONT tag containing the field label.
  348.             var FieldLabel = "<FONT CLASS=\"fieldLabel\">" + i_FormObject.Label + "</FONT>";
  349.  
  350.             switch (i_FormObject.LabelPosition)
  351.             {
  352.                 case "Right":
  353.                     FieldCellHTML += "<TD" + FieldAttributes + RowSpan + ">" + FieldBodyHTML + "</TD>";
  354.                     FieldCellHTML += "<TD" + LabelAttributes + FieldColumnSpan + RowSpan + ">" + FieldLabel + "</TD>";
  355.                     break;
  356.                 case "Top":
  357.                     FieldCellHTML += "<TD" + FieldAttributes + ColumnSpan + RowSpan + ">" + ((i_FormObject.Label != "") ? FieldLabel + "<BR>" : "") + FieldBodyHTML + "</TD>";
  358.                     break;
  359.                 default:
  360.                     FieldCellHTML += "<TD" + LabelAttributes + RowSpan + ">" + FieldLabel + "</TD>";
  361.                     FieldCellHTML += "<TD" + FieldAttributes + FieldColumnSpan + RowSpan + ">" + FieldBodyHTML + "</TD>";
  362.                     break;
  363.             }
  364.         }
  365.         else
  366.         {
  367.             var FieldBodyHTML = "";
  368.             if (i_FormObject.Type == FormObjectType_FieldGroup)
  369.                 FieldBodyHTML = getFieldGroupBody(i_FormObject, false);
  370.             else
  371.                 FieldBodyHTML = i_FormObject.getBody() + getImageTag(i_FormObject);
  372.  
  373.             // The STYLE attribute for TD tags.
  374.             var FieldStyleAttribute = "";
  375.             var LabelStyleAttribute = "";
  376.             // Hide fields that should be hidden.
  377.             if (i_FormObject.IsHidden || (g_IsReadOnly && i_FormObject.Type == FormObjectType_Attachments))
  378.             {
  379.                 FieldStyleAttribute += " STYLE=\"display:none;\"";
  380.                 LabelStyleAttribute += " STYLE=\"display:none;\"";
  381.             }
  382.  
  383.             // The CLASS attribute for the TD tags.
  384.             var ClassAttribute = "";
  385.             if (i_FormObject.ClassName != "")
  386.                 ClassAttribute = " CLASS=\"" + i_FormObject.ClassName + "\"";
  387.             // The common attributes for label and field TD tags.
  388.             var LabelAttributes = " VALIGN=\"top\" ID=\"" + i_FormObject.Name + "_label\"" + ClassAttribute;
  389.             var FieldAttributes = " VALIGN=\"top\" ID=\"" + i_FormObject.Name + "_field\"" + ClassAttribute;
  390.             // The COLSPAN attribute for the TD tag.
  391.             var ColumnSpan = getSpanAttribute("COLSPAN", getColumnSpan(i_FormObject) * 2);
  392.             // The ROWSPAN attribute for the TD tag.
  393.             var RowSpan = getSpanAttribute("ROWSPAN", getRowSpan(i_FormObject));
  394.  
  395.             if (i_FormObject instanceof Static)
  396.             {
  397.                 FieldCellHTML += "<TD" + FieldAttributes + FieldStyleAttribute + ColumnSpan + RowSpan + ">" + FieldBodyHTML + "</TD>";
  398.             }
  399.             else
  400.             {
  401.                 // The COLSPAN attribute for the TD tag.
  402.                 var FieldColumnSpan = getSpanAttribute("COLSPAN", (getColumnSpan(i_FormObject) * 2) - 1);
  403.                 // The FONT tag containing the field label.
  404.                 var FieldLabel = "<FONT CLASS=\"fieldLabel\">" + i_FormObject.Label + i_FormObject.getRequired() + "</FONT>";
  405.  
  406.                 switch (i_FormObject.LabelPosition)
  407.                 {
  408.                     case "Right":
  409.                         FieldCellHTML += "<TD" + FieldAttributes + FieldStyleAttribute + RowSpan + ">" + FieldBodyHTML + "</TD>";
  410.                         FieldCellHTML += "<TD" + LabelAttributes + LabelStyleAttribute + FieldColumnSpan + RowSpan + ">" + FieldLabel + "</TD>";
  411.                         break;
  412.                     case "Top":
  413.                         FieldCellHTML += "<TD" + FieldAttributes + FieldStyleAttribute + ColumnSpan + RowSpan + ">" + ((i_FormObject.Label != "" || i_FormObject.getRequired() != "") ? FieldLabel + "<BR>" : "") + FieldBodyHTML + "</TD>";
  414.                         break;
  415.                     default:
  416.                         FieldCellHTML += "<TD" + LabelAttributes + LabelStyleAttribute + RowSpan + ">" + FieldLabel + "</TD>";
  417.                         FieldCellHTML += "<TD" + FieldAttributes + FieldStyleAttribute + FieldColumnSpan + RowSpan + ">" + FieldBodyHTML + "</TD>";
  418.                         break;
  419.                 }
  420.             }
  421.         }
  422.     }
  423.     else
  424.     {
  425.         FieldCellHTML += "<TD COLSPAN=\"2\"></TD>";
  426.     }
  427.  
  428.     return FieldCellHTML;
  429. }
  430.  
  431. function getFieldGroupBody(i_FieldGroup, i_bIsPreview)
  432. {
  433.     var FieldBodyHTML = "";
  434.     for (var i = 0; i < i_FieldGroup.Fields.length; i++)
  435.     {
  436.         var Field = i_FieldGroup.Fields[i];
  437.  
  438.         var LabelSpanTag = "<FONT ID=\"" + Field.Name + "_label\" STYLE=\"padding-right:2px;";
  439.         var FieldSpanTag = "<SPAN ID=\"" + Field.Name + "_field\" STYLE=\"padding-right:6px;";
  440.         if (Field.IsHidden)
  441.         {
  442.             LabelSpanTag += "display:none;";
  443.             FieldSpanTag += "display:none;";
  444.         }
  445.         LabelSpanTag += "\"";
  446.         FieldSpanTag += "\"";
  447.  
  448.         // The ONCLICK and ONMOUSEOVER attributes for the SPAN tags.
  449.         var OnClickAttribute = "";
  450.         var OnMouseOverAttribute = "";
  451.         var TitleAttribute = "";
  452.         if (i_bIsPreview)
  453.         {
  454.             OnClickAttribute = " ONCLICK=\"if (typeof obj" + Field.Name + " != 'undefined') { selectField(obj" + Field.Name + "); }\"";
  455.             OnMouseOverAttribute = " ONMOUSEOVER=\"if (typeof obj" + Field.Name + " != 'undefined') { hoverField(obj" + Field.Name + "); }\"";
  456.             TitleAttribute = " TITLE=\"Click to select this field: " + Field.Name + "\"";
  457.         }
  458.  
  459.         LabelSpanTag += OnClickAttribute + OnMouseOverAttribute + TitleAttribute + ">";
  460.         FieldSpanTag += OnClickAttribute + OnMouseOverAttribute + TitleAttribute + ">";
  461.  
  462.         if (Field instanceof Static)
  463.         {
  464.             FieldBodyHTML += FieldSpanTag + Field.getBody() + "</SPAN>";
  465.         }
  466.         else
  467.         {
  468.             var ImgTag = "";
  469.             if (!i_bIsPreview)
  470.                 ImgTag = getImageTag(Field);
  471.  
  472.             switch (Field.LabelPosition)
  473.             {
  474.                 case "Right":
  475.                     FieldBodyHTML += FieldSpanTag + Field.getBody() + ImgTag + "</SPAN>" + LabelSpanTag + Field.getRequired() + Field.Label + "</FONT>";
  476.                     break;
  477.                 case "Top":
  478.                     if (i >= 1)
  479.                         FieldBodyHTML += "<BR>";
  480.                     FieldBodyHTML += LabelSpanTag + Field.Label + Field.getRequired() + "</FONT><BR>" + FieldSpanTag + Field.getBody() + ImgTag + "</SPAN>";
  481.                     break;
  482.                 default:
  483.                     FieldBodyHTML += LabelSpanTag + Field.Label + Field.getRequired() + "</FONT>" + FieldSpanTag + Field.getBody() + ImgTag + "</SPAN>";
  484.                     break;
  485.             }
  486.         }
  487.     }
  488.     return FieldBodyHTML;
  489. }
  490.  
  491. function getImageTag(i_FormObject)
  492. {
  493.     if (i_FormObject instanceof Static || i_FormObject.Type == FormObjectType_SystemField || i_FormObject.Type == FormObjectType_Attachments)
  494.         return "";
  495.     else
  496.         return "<IMG SRC=\"error.gif\" WIDTH=\"12\" HEIGHT=\"12\" STYLE=\"position:absolute; z-index:1; display:none;\" ID=\"" + i_FormObject.Name + "_ErrorImage\">"
  497. }
  498.  
  499. function getValidationScript(i_Type, i_Parameter)
  500. {
  501.     i_Parameter = i_Parameter.replace(/\'/g, "\\'");
  502.     switch (i_Type)
  503.     {
  504.         // GrooveFormsToolFieldValidationType_IsSubStringPresent
  505.         case 1:
  506.             return " isSubStringPresent('" + i_Parameter + "', this);";
  507.         // GrooveFormsToolFieldValidationType_IsSubStringNotPresent
  508.         case 2:
  509.             return " isSubStringNotPresent('" + i_Parameter + "', this);";
  510.         // GrooveFormsToolFieldValidationType_AreAllSubStringsPresent
  511.         case 3:
  512.             return " areAllSubStringsPresent('" + i_Parameter + "', this);";
  513.         // GrooveFormsToolFieldValidationType_AreAnySubStringsPresent
  514.         case 4:
  515.             return " areAnySubStringsPresent('" + i_Parameter + "', this);";
  516.         // GrooveFormsToolFieldValidationType_AreNoSubStringsPresent
  517.         case 5:
  518.             return " areNoSubStringsPresent('" + i_Parameter + "', this);";
  519.         // GrooveFormsToolFieldValidationType_IsValidEmailAddress
  520.         case 6:
  521.             return " isValidEmailAddress(this);";
  522.         // GrooveFormsToolFieldValidationType_IsValidUSZipCode
  523.         case 7:
  524.             return " isValidUSZipCode(this);";
  525.         // GrooveFormsToolFieldValidationType_IsValidPassword
  526.         case 8:
  527.             return " isValidPassword(this);";
  528.         // GrooveFormsToolFieldValidationType_MinimumLength
  529.         case 9:
  530.             return " isMinimumLength('" + i_Parameter + "', this);";
  531.         // GrooveFormsToolFieldValidationType_MaximumLength
  532.         case 10:
  533.             return " isMaximumLength('" + i_Parameter + "', this);";
  534.         // GrooveFormsToolFieldValidationType_IsAlphabeticCharacters
  535.         case 11:
  536.             return " isAlpha(this);";
  537.         // GrooveFormsToolFieldValidationType_HasAlphabeticCharacters
  538.         case 12:
  539.             return " hasAlpha(this);";
  540.         // GrooveFormsToolFieldValidationType_IsNumericCharacters
  541.         case 13:
  542.             return " isNumeric(this);";
  543.         // GrooveFormsToolFieldValidationType_HasNumericCharacters
  544.         case 14:
  545.             return " hasNumeric(this);";
  546.         // GrooveFormsToolFieldValidationType_RegularExpression
  547.         case 15:
  548.             return " regularExpression('" + i_Parameter + "', this);";
  549.         default:
  550.             return "";
  551.     }
  552. }
  553.  
  554. function getColumnSpan(i_FormObject)
  555. {
  556.     var ColumnSpan = 1;
  557.     if (i_FormObject != null)
  558.     {
  559.         if (i_FormObject.ColumnSpan > 1)
  560.             ColumnSpan = i_FormObject.ColumnSpan;
  561.     }
  562.     return ColumnSpan;
  563. }
  564.  
  565. function getRowSpan(i_FormObject)
  566. {
  567.     var RowSpan = 1;
  568.     if (i_FormObject != null)
  569.     {
  570.         if (i_FormObject.RowSpan > 1)
  571.             RowSpan = i_FormObject.RowSpan;
  572.     }
  573.     return RowSpan;
  574. }
  575.  
  576. function getSpanAttribute(i_Type, i_Span)
  577. {
  578.     var SpanAttribute = "";
  579.     if (i_Span > 1)
  580.         SpanAttribute = " " + i_Type + "=\"" + i_Span + "\"";
  581.     return SpanAttribute;
  582. }
  583.  
  584. function getFieldWidthUnit(i_FieldWidth, i_FieldSizeType)
  585. {
  586.     var WidthStyle = "";
  587.     if (i_FieldWidth.toString() != "")
  588.     {
  589.         switch (i_FieldSizeType)
  590.         {
  591.             case GrooveFormsToolFieldSizeType_Pixels:
  592.                 WidthStyle = i_FieldWidth + "px";
  593.                 break;
  594.             case GrooveFormsToolFieldSizeType_Percent:
  595.                 WidthStyle = i_FieldWidth + "%";
  596.                 break;
  597.             case GrooveFormsToolFieldSizeType_Characters:
  598.             default:
  599.                 WidthStyle = (i_FieldWidth + 2) + "ex";
  600.                 break;
  601.         }
  602.         WidthStyle = "width:" + WidthStyle + ";";
  603.     }
  604.     return WidthStyle;
  605. }
  606.  
  607. function getFieldHeightUnit(i_FieldHeight, i_FieldSizeType)
  608. {
  609.     var HeightStyle = "";
  610.     if (i_FieldHeight.toString() != "")
  611.     {
  612.         switch (i_FieldSizeType)
  613.         {
  614.             case GrooveFormsToolFieldSizeType_Pixels:
  615.                 HeightStyle = i_FieldHeight + "px";
  616.                 break;
  617.             case GrooveFormsToolFieldSizeType_Percent:
  618.                 HeightStyle = i_FieldHeight + "%";
  619.                 break;
  620.             case GrooveFormsToolFieldSizeType_Characters:
  621.             default:
  622.                 HeightStyle = (i_FieldHeight + 1) + "em";
  623.                 break;
  624.         }
  625.         HeightStyle = "height:" + HeightStyle + ";";
  626.     }
  627.     return HeightStyle;
  628. }
  629.  
  630. function isFormObjectInArray(i_ObjectName, i_Array)
  631. {
  632.     for (var j = 0; j < i_Array.length; j++)
  633.     {
  634.         if (i_Array[j].Name == i_ObjectName)
  635.             return true;
  636.     }
  637.  
  638.     return false;
  639. }
  640.  
  641. // ============================================ \\
  642. // ===          Field Group Class           === \\
  643. // ============================================ \\
  644.  
  645. function FieldGroup(i_Name, i_Fields, i_Container)
  646. {
  647.     if (arguments.length > 0)
  648.         this.initFieldGroup(i_Name, i_Fields, i_Container);
  649.  
  650.     this.Label = "";
  651.     this.LabelPosition = "";
  652.     this.IsHidden = false;
  653.     this.ColumnSpan = 1;
  654.     this.RowSpan = 1;
  655.     this.ClassName = "";
  656.     this.Fields = new Array();
  657.     this.TabGroup = null;
  658.     this.Type = FormObjectType_FieldGroup;
  659. }
  660.  
  661. FieldGroup.prototype.initFieldGroup = FieldGroup_initFieldGroup;
  662. FieldGroup.prototype.addField = FieldGroup_addField;
  663. FieldGroup.prototype.getRequired = FieldGroup_getRequired;
  664.  
  665. function FieldGroup_initFieldGroup(i_Name, i_Fields, i_Container)
  666. {
  667.     this.Name = i_Name;
  668.  
  669.     if (i_Fields == "")
  670.         this.FieldNames = new Array();
  671.     else
  672.         this.FieldNames = i_Fields.split("|");
  673.  
  674.     i_Container.addFieldGroup(this);
  675. }
  676.  
  677. function FieldGroup_addField(i_Field)
  678. {
  679.     this.Fields.push(i_Field);
  680. }
  681.  
  682. function FieldGroup_getRequired()
  683. {
  684.     return "";
  685. }
  686.  
  687. // ============================================ \\
  688. // ===            Tab Group Class           === \\
  689. // ============================================ \\
  690.  
  691. function TabGroup(i_Name, i_Container)
  692. {
  693.     if (arguments.length > 0)
  694.         this.initTabGroup(i_Name, i_Container);
  695.  
  696.     this.Label = "";
  697.     this.LabelPosition = "";
  698.     this.IsHidden = false;
  699.     this.ColumnSpan = 1;
  700.     this.RowSpan = 1;
  701.     this.ClassName = "";
  702.     this.Tabs = new Array();
  703.     this.ActiveTabName = "";
  704.     this.Type = FormObjectType_TabGroup;
  705. }
  706.  
  707. TabGroup.prototype.initTabGroup = TabGroup_initTabGroup;
  708. TabGroup.prototype.addTab = TabGroup_addTab;
  709. TabGroup.prototype.getRequired = TabGroup_getRequired;
  710.  
  711. function TabGroup_initTabGroup(i_Name, i_Container)
  712. {
  713.     this.Name = i_Name;
  714.  
  715.     i_Container.addTabGroup(this);
  716. }
  717.  
  718. function TabGroup_addTab(i_Tab)
  719. {
  720.     this.Tabs.push(i_Tab);
  721. }
  722.  
  723. function TabGroup_getRequired()
  724. {
  725.     return "";
  726. }
  727.  
  728. // ============================================ \\
  729. // ===              Tab Class               === \\
  730. // ============================================ \\
  731.  
  732. function Tab(i_Name, i_Fields, i_TabGroup)
  733. {
  734.     if (arguments.length > 0)
  735.         this.initTab(i_Name, i_Fields, i_TabGroup);
  736.  
  737.     this.Text = "";
  738.     this.NumberOfColumns = 1;
  739.     this.Fields = new Array();
  740.     this.Type = FormObjectType_Tab;
  741. }
  742.  
  743. Tab.prototype.initTab = Tab_initTab;
  744. Tab.prototype.addField = Tab_addField;
  745.  
  746. function Tab_initTab(i_Name, i_Fields, i_TabGroup)
  747. {
  748.     this.Name = i_Name;
  749.  
  750.     if (i_Fields == "")
  751.         this.FieldNames = new Array();
  752.     else
  753.         this.FieldNames = i_Fields.split("|");
  754.  
  755.     i_TabGroup.addTab(this);
  756. }
  757.  
  758. function Tab_addField(i_Field)
  759. {
  760.     this.Fields.push(i_Field);
  761. }
  762.  
  763. // ============================================ \\
  764. // ===             Field Class              === \\
  765. // ============================================ \\
  766.  
  767. function Field()
  768. {
  769.     this.Name = "";
  770.     this.Label = "";
  771.     this.LabelPosition = "Left";
  772.     this.IsHidden = false;
  773.     this.ColumnSpan = 1;
  774.     this.RowSpan = 1;
  775.     this.IsReadOnly = false;
  776.     this.IsRequired = false;
  777.     this.IsPerIdentity = false;
  778.     this.InheritFrom = "";
  779.     this.ClassName = "";
  780.     this.FieldGroup = null;
  781.     this.TabGroup = null;
  782.     this.Tab = null;
  783. }
  784.  
  785. Field.prototype.initField = Field_initField;
  786. //Field.prototype.getRequired = Field_getRequired;
  787.  
  788. function Field_initField(i_Name, i_Label, i_Container)
  789. {
  790.     this.Name = i_Name;
  791.     this.Label = i_Label;
  792.  
  793.     i_Container.addField(this);
  794. }
  795. Field.prototype.getRequired = function() { return ((this.IsRequired && ((!g_IsReadOnly && !g_IsPreviewPane) || g_IsFormPreview)) ? "<FONT STYLE=\"color:#FF0000; margin:0px 2px 0px 2px;\">*</FONT>" : ""); }
  796.  
  797. // ============================================ \\
  798. // ===             System Field             === \\
  799. // ============================================ \\
  800.  
  801. function SystemField(i_Name, i_Label, i_Container)
  802. {
  803.     if (arguments.length > 0)
  804.         this.initField(i_Name, i_Label, i_Container);
  805.  
  806.     this.Type = FormObjectType_SystemField;
  807. }
  808.  
  809. SystemField.prototype = new Field;
  810. SystemField.prototype.getBody = SystemField_getBody;
  811.  
  812. function SystemField_getBody()
  813. {
  814.     return "<SPAN CLASS=\"system\" ID=\"" + this.Name + "\"></SPAN>";
  815. }
  816.  
  817. // ============================================ \\
  818. // ===              Text Field              === \\
  819. // ============================================ \\
  820.  
  821. function TextField(i_Name, i_Label, i_Container)
  822. {
  823.     if (arguments.length > 0)
  824.         this.initField(i_Name, i_Label, i_Container);
  825.  
  826.     this.Width = "";
  827.     this.WidthType = GrooveFormsToolFieldSizeType_Characters;
  828.     this.MaximumLength = "";
  829.     this.InitialTextType = 0;
  830.     this.InitialTextFunction = "";
  831.     this.ValidationType = 0;
  832.     this.ValidationParameter = "";
  833.     this.HasLookup = false;
  834.     this.Type = FormObjectType_Text;
  835. }
  836.  
  837. TextField.prototype = new Field;
  838. TextField.prototype.getBody = TextField_getBody;
  839.  
  840. function TextField_getBody()
  841. {
  842.     var TextHTML = "";
  843.     if (g_IsReadOnly && !g_IsFormPreview)
  844.     {
  845.         TextHTML  = "<INPUT TYPE=\"text\" STYLE=\"display:none;\" FIELDTYPE=\"" + this.Type + "\" NAME=\"" + this.Name + "\" ID=\"" + this.Name + "\">";
  846.         TextHTML += "<SPAN CLASS=\"inputPreview\" ID=\"" + this.Name + "_preview\" STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) +"\"></SPAN>";
  847.     }
  848.     else
  849.     {
  850.         TextHTML  = "<INPUT";
  851.         TextHTML += " TYPE=\"text\"";
  852.         TextHTML += " CLASS=\"text\"";
  853.         TextHTML += " FIELDTYPE=\"" + this.Type + "\"";
  854.         TextHTML += " NAME=\"" + this.Name + "\"";
  855.         TextHTML += " ID=\"" + this.Name + "\"";
  856.         TextHTML += " TABINDEX=\"1\"";
  857.         //TextHTML += " LABEL=\"" + this.Label + "\"";
  858.         TextHTML += " STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) +"\"";
  859.         TextHTML += " MAXLENGTH=\"" + this.MaximumLength + "\"";
  860.         TextHTML += " INITIALVALUETYPE=\"" + this.InitialTextType + "\"";
  861.         TextHTML += " INITIALVALUEFUNCTION=\"" + this.InitialTextFunction + "\"";
  862.         TextHTML += (this.IsHidden ? " ISHIDDEN" : "");
  863.         TextHTML += (this.IsRequired ? " ISREQUIRED" : "");
  864.         TextHTML += (this.IsReadOnly ? " ISREADONLY" : "");
  865.         TextHTML += (this.IsPerIdentity ? " ISPERIDENTITY" : "");
  866.         TextHTML += (this.HasLookup ? " LOOKUP" : "");
  867.         TextHTML += " INHERIT=\"" + this.InheritFrom + "\"";
  868.         TextHTML += " ONBLUR=\"validateRequired(this);" + getValidationScript(this.ValidationType, this.ValidationParameter) + "\"";
  869.         TextHTML += " ONKEYUP=\"setIsDirty()\">";
  870.     }
  871.     return TextHTML;
  872. }
  873.  
  874. // ============================================ \\
  875. // ===        Multi-line Text Field         === \\
  876. // ============================================ \\
  877.  
  878. function MultiLineTextField(i_Name, i_Label, i_Container)
  879. {
  880.     if (arguments.length > 0)
  881.         this.initField(i_Name, i_Label, i_Container);
  882.  
  883.     this.Width = "";
  884.     this.WidthType = GrooveFormsToolFieldSizeType_Characters;
  885.     this.Height = "";
  886.     this.HeightType = GrooveFormsToolFieldSizeType_Characters;
  887.     this.ValidationType = 0;
  888.     this.ValidationParameter = "";
  889.     this.HasLookup = false;
  890.     this.Type = FormObjectType_MultiLineText;
  891. }
  892.  
  893. MultiLineTextField.prototype = new Field;
  894. MultiLineTextField.prototype.getBody = MultiLineTextField_getBody;
  895.  
  896. function MultiLineTextField_getBody()
  897. {
  898.     var MultiLineTextHTML = "";
  899.     if (g_IsReadOnly && !g_IsFormPreview)
  900.     {
  901.         MultiLineTextHTML  = "<TEXTAREA TYPE=\"text\" STYLE=\"display:none;\" FIELDTYPE=\"" + this.Type + "\" NAME=\"" + this.Name + "\" ID=\"" + this.Name + "\"></TEXTAREA>";
  902.         MultiLineTextHTML += "<SPAN CLASS=\"textareaPreview\" ID=\"" + this.Name + "_preview\" STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) + getFieldHeightUnit(this.Height, this.HeightType) + "\"></SPAN>";
  903.     }
  904.     else
  905.     {
  906.         MultiLineTextHTML  = "<TEXTAREA";
  907.         MultiLineTextHTML += " FIELDTYPE=\"" + this.Type + "\"";
  908.         MultiLineTextHTML += " NAME=\"" + this.Name + "\"";
  909.         MultiLineTextHTML += " ID=\"" + this.Name + "\"";
  910.         MultiLineTextHTML += " TABINDEX=\"1\"";
  911.         //MultiLineTextHTML += " LABEL=\"" + this.Label + "\"";
  912.         MultiLineTextHTML += " STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) + getFieldHeightUnit(this.Height, this.HeightType) + "\"";
  913.         MultiLineTextHTML += (this.IsHidden ? " ISHIDDEN" : "");
  914.         MultiLineTextHTML += (this.IsRequired ? " ISREQUIRED" : "");
  915.         MultiLineTextHTML += (this.IsReadOnly ? " ISREADONLY" : "");
  916.         MultiLineTextHTML += (this.IsPerIdentity ? " ISPERIDENTITY" : "");
  917.         MultiLineTextHTML += (this.HasLookup ? " LOOKUP" : "");
  918.         MultiLineTextHTML += " INHERIT=\"" + this.InheritFrom + "\"";
  919.         MultiLineTextHTML += " ONBLUR=\"validateRequired(this);" + getValidationScript(this.ValidationType, this.ValidationParameter) + "\"";
  920.         MultiLineTextHTML += " ONKEYUP=\"setIsDirty()\"></TEXTAREA>";
  921.     }
  922.     return MultiLineTextHTML;
  923. }
  924.  
  925. // ============================================ \\
  926. // ===       Unformatted Number Field       === \\
  927. // ============================================ \\
  928.  
  929. function UnformattedNumberField(i_Name, i_Label, i_Container)
  930. {
  931.     if (arguments.length > 0)
  932.         this.initField(i_Name, i_Label, i_Container);
  933.  
  934.     this.Width = "";
  935.     this.WidthType = GrooveFormsToolFieldSizeType_Characters;
  936.     this.MaximumLength = "";
  937.     this.MinimumValue = "";
  938.     this.MaximumValue = "";
  939.     this.Type = FormObjectType_UnformattedNumber;
  940. }
  941.  
  942. UnformattedNumberField.prototype = new Field;
  943. UnformattedNumberField.prototype.getBody = UnformattedNumberField_getBody;
  944.  
  945. function UnformattedNumberField_getBody()
  946. {
  947.     var UnformattedNumberHTML = "";
  948.     if (g_IsReadOnly && !g_IsFormPreview)
  949.     {
  950.         UnformattedNumberHTML  = "<INPUT TYPE=\"text\" STYLE=\"display:none;\" FIELDTYPE=\"" + this.Type + "\" NAME=\"" + this.Name + "\" ID=\"" + this.Name + "\" NOFORMAT DATATYPE=\"Numeric\">";
  951.         UnformattedNumberHTML += "<SPAN CLASS=\"inputPreview\" ID=\"" + this.Name + "_preview\" STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) +"\"></SPAN>";
  952.     }
  953.     else
  954.     {
  955.         UnformattedNumberHTML  = "<INPUT";
  956.         UnformattedNumberHTML += " TYPE=\"text\"";
  957.         UnformattedNumberHTML += " CLASS=\"text\"";
  958.         UnformattedNumberHTML += " FIELDTYPE=\"" + this.Type + "\"";
  959.         UnformattedNumberHTML += " NAME=\"" + this.Name + "\"";
  960.         UnformattedNumberHTML += " ID=\"" + this.Name + "\"";
  961.         UnformattedNumberHTML += " TABINDEX=\"1\"";
  962.         //UnformattedNumberHTML += " LABEL=\"" + this.Label + "\"";
  963.         UnformattedNumberHTML += " STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) +"\"";
  964.         UnformattedNumberHTML += " MAXLENGTH=\"" + this.MaximumLength + "\"";
  965.         UnformattedNumberHTML += (this.IsHidden ? " ISHIDDEN" : "");
  966.         UnformattedNumberHTML += (this.IsRequired ? " ISREQUIRED" : "");
  967.         UnformattedNumberHTML += (this.IsReadOnly ? " ISREADONLY" : "");
  968.         UnformattedNumberHTML += (this.IsPerIdentity ? " ISPERIDENTITY" : "");
  969.         UnformattedNumberHTML += " INHERIT=\"" + this.InheritFrom + "\"";
  970.         UnformattedNumberHTML += " MIN=\"" + this.MinimumValue + "\"";
  971.         UnformattedNumberHTML += " MAX=\"" + this.MaximumValue + "\"";
  972.         UnformattedNumberHTML += " NOFORMAT";
  973.         UnformattedNumberHTML += " ONBLUR=\"validateRequired(this); validateNumeric(this);\"";
  974.         UnformattedNumberHTML += " ONKEYUP=\"setIsDirty()\"";
  975.         UnformattedNumberHTML += " DATATYPE=\"Numeric\">";
  976.     }
  977.     return UnformattedNumberHTML;
  978. }
  979.  
  980. // ============================================ \\
  981. // ===             Number Field             === \\
  982. // ============================================ \\
  983.  
  984. function NumberField(i_Name, i_Label, i_Container)
  985. {
  986.     if (arguments.length > 0)
  987.         this.initField(i_Name, i_Label, i_Container);
  988.  
  989.     this.Precision = 2;
  990.     this.Type = FormObjectType_Number;
  991. }
  992.  
  993. NumberField.prototype = new UnformattedNumberField;
  994. NumberField.prototype.getBody = NumberField_getBody;
  995.  
  996. function NumberField_getBody()
  997. {
  998.     var NumberHTML = "";
  999.     if (g_IsReadOnly && !g_IsFormPreview)
  1000.     {
  1001.         NumberHTML  = "<INPUT TYPE=\"text\" STYLE=\"display:none;\" FIELDTYPE=\"" + this.Type + "\" NAME=\"" + this.Name + "\" ID=\"" + this.Name + "\" PRECISION=\"" + this.Precision + "\" DATATYPE=\"Numeric\">";
  1002.         NumberHTML += "<SPAN CLASS=\"inputPreview\" ID=\"" + this.Name + "_preview\" STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) +"\"></SPAN>";
  1003.     }
  1004.     else
  1005.     {
  1006.         NumberHTML  = "<INPUT";
  1007.         NumberHTML += " TYPE=\"text\"";
  1008.         NumberHTML += " CLASS=\"text\"";
  1009.         NumberHTML += " FIELDTYPE=\"" + this.Type + "\"";
  1010.         NumberHTML += " NAME=\"" + this.Name + "\"";
  1011.         NumberHTML += " ID=\"" + this.Name + "\"";
  1012.         NumberHTML += " TABINDEX=\"1\"";
  1013.         //NumberHTML += " LABEL=\"" + this.Label + "\"";
  1014.         NumberHTML += " STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) +"\"";
  1015.         NumberHTML += " MAXLENGTH=\"" + this.MaximumLength + "\"";
  1016.         NumberHTML += (this.IsHidden ? " ISHIDDEN" : "");
  1017.         NumberHTML += (this.IsRequired ? " ISREQUIRED" : "");
  1018.         NumberHTML += (this.IsReadOnly ? " ISREADONLY" : "");
  1019.         NumberHTML += (this.IsPerIdentity ? " ISPERIDENTITY" : "");
  1020.         NumberHTML += " INHERIT=\"" + this.InheritFrom + "\"";
  1021.         NumberHTML += " PRECISION=\"" + this.Precision + "\"";
  1022.         NumberHTML += " MIN=\"" + this.MinimumValue + "\"";
  1023.         NumberHTML += " MAX=\"" + this.MaximumValue + "\"";
  1024.         NumberHTML += " ONBLUR=\"validateRequired(this); if (validateNumeric(this)) { formatNumeric(this); }\"";
  1025.         NumberHTML += " ONKEYUP=\"setIsDirty()\"";
  1026.         NumberHTML += " DATATYPE=\"Numeric\">";
  1027.     }
  1028.     return NumberHTML;
  1029. }
  1030.  
  1031. // ============================================ \\
  1032. // ===            Currency Field            === \\
  1033. // ============================================ \\
  1034.  
  1035. function CurrencyField(i_Name, i_Label, i_Container)
  1036. {
  1037.     if (arguments.length > 0)
  1038.         this.initField(i_Name, i_Label, i_Container);
  1039.  
  1040.     this.Symbol = "$";
  1041.     this.Precision = 2;
  1042.     this.Type = FormObjectType_Currency;
  1043. }
  1044.  
  1045. CurrencyField.prototype = new UnformattedNumberField;
  1046. CurrencyField.prototype.getBody = CurrencyField_getBody;
  1047.  
  1048. function CurrencyField_getBody()
  1049. {
  1050.     var CurrencyHTML = "";
  1051.     if (g_IsReadOnly && !g_IsFormPreview)
  1052.     {
  1053.         CurrencyHTML  = "<INPUT TYPE=\"text\" STYLE=\"display:none;\" FIELDTYPE=\"" + this.Type + "\" NAME=\"" + this.Name + "\" ID=\"" + this.Name + "\" PRECISION=\"" + this.Precision + "\" SYMBOL=\"" + this.Symbol + "\" DATATYPE=\"Numeric\">";
  1054.         CurrencyHTML += "<SPAN CLASS=\"inputPreview\" ID=\"" + this.Name + "_preview\" STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) +"\"></SPAN>";
  1055.     }
  1056.     else
  1057.     {
  1058.         CurrencyHTML  = "<INPUT";
  1059.         CurrencyHTML += " TYPE=\"text\"";
  1060.         CurrencyHTML += " CLASS=\"text\"";
  1061.         CurrencyHTML += " FIELDTYPE=\"" + this.Type + "\"";
  1062.         CurrencyHTML += " NAME=\"" + this.Name + "\"";
  1063.         CurrencyHTML += " ID=\"" + this.Name + "\"";
  1064.         CurrencyHTML += " TABINDEX=\"1\"";
  1065.         //CurrencyHTML += " LABEL=\"" + this.Label + "\"";
  1066.         CurrencyHTML += " STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) +"\"";
  1067.         CurrencyHTML += " MAXLENGTH=\"" + this.MaximumLength + "\"";
  1068.         CurrencyHTML += (this.IsHidden ? " ISHIDDEN" : "");
  1069.         CurrencyHTML += (this.IsRequired ? " ISREQUIRED" : "");
  1070.         CurrencyHTML += (this.IsReadOnly ? " ISREADONLY" : "");
  1071.         CurrencyHTML += (this.IsPerIdentity ? " ISPERIDENTITY" : "");
  1072.         CurrencyHTML += " INHERIT=\"" + this.InheritFrom + "\"";
  1073.         CurrencyHTML += " PRECISION=\"" + this.Precision + "\"";
  1074.         CurrencyHTML += " MIN=\"" + this.MinimumValue + "\"";
  1075.         CurrencyHTML += " MAX=\"" + this.MaximumValue + "\"";
  1076.         CurrencyHTML += " SYMBOL=\"" + this.Symbol + "\"";
  1077.         CurrencyHTML += " ONBLUR=\"validateRequired(this); if (validateNumeric(this)) { formatCurrency(this); }\"";
  1078.         CurrencyHTML += " ONKEYUP=\"setIsDirty()\"";
  1079.         CurrencyHTML += " DATATYPE=\"Numeric\">";
  1080.     }
  1081.     return CurrencyHTML;
  1082. }
  1083.  
  1084. // ============================================ \\
  1085. // ===              Date Field              === \\
  1086. // ============================================ \\
  1087.  
  1088. function DateField(i_Name, i_Label, i_Container)
  1089. {
  1090.     if (arguments.length > 0)
  1091.         this.initField(i_Name, i_Label, i_Container);
  1092.  
  1093.     this.Width = 30;
  1094.     this.WidthType = GrooveFormsToolFieldSizeType_Characters;
  1095.     this.MaximumLength = "";
  1096.     this.InitialDateType = 0;
  1097.     this.InitialDateFunction = "";
  1098.     this.EarliestDate = "";
  1099.     this.LatestDate = "";
  1100.     this.Format = "";
  1101.     this.Type = FormObjectType_Date;
  1102. }
  1103.  
  1104. DateField.prototype = new Field;
  1105. DateField.prototype.getBody = DateField_getBody;
  1106.  
  1107. function DateField_getBody()
  1108. {
  1109.     var DateHTML = "";
  1110.     if (g_IsReadOnly && !g_IsFormPreview)
  1111.     {
  1112.         DateHTML  = "<INPUT TYPE=\"text\" STYLE=\"display:none;\" FIELDTYPE=\"" + this.Type + "\" NAME=\"" + this.Name + "\" ID=\"" + this.Name + "\" FORMAT=\"" + this.Format + "\" DATATYPE=\"Date\">";
  1113.         DateHTML += "<SPAN CLASS=\"inputPreview\" ID=\"" + this.Name + "_preview\" STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) +"\"></SPAN>";
  1114.     }
  1115.     else
  1116.     {
  1117.         DateHTML  = "<INPUT";
  1118.         DateHTML += " TYPE=\"text\"";
  1119.         DateHTML += " CLASS=\"text\"";
  1120.         DateHTML += " FIELDTYPE=\"" + this.Type + "\"";
  1121.         DateHTML += " NAME=\"" + this.Name + "\"";
  1122.         DateHTML += " ID=\"" + this.Name + "\"";
  1123.         DateHTML += " TABINDEX=\"1\"";
  1124.         //DateHTML += " LABEL=\"" + this.Label + "\"";
  1125.         DateHTML += " STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) +"\"";
  1126.         DateHTML += " MAXLENGTH=\"" + this.MaximumLength + "\"";
  1127.         DateHTML += " INITIALVALUETYPE=\"" + this.InitialDateType + "\"";
  1128.         DateHTML += " INITIALVALUEFUNCTION=\"" + this.InitialDateFunction + "\"";
  1129.         DateHTML += (this.IsHidden ? " ISHIDDEN" : "");
  1130.         DateHTML += (this.IsRequired ? " ISREQUIRED" : "");
  1131.         DateHTML += (this.IsReadOnly ? " ISREADONLY" : "");
  1132.         DateHTML += (this.IsPerIdentity ? " ISPERIDENTITY" : "");
  1133.         DateHTML += " INHERIT=\"" + this.InheritFrom + "\"";
  1134.         DateHTML += " MIN=\"" + this.EarliestDate + "\"";
  1135.         DateHTML += " MAX=\"" + this.LatestDate + "\"";
  1136.         DateHTML += " FORMAT=\"" + this.Format + "\"";
  1137.         DateHTML += " ONBLUR=\"validateRequired(this); if (validateDate(this)) { cleanDate(this); formatDate(this); }\"";
  1138.         DateHTML += " ONKEYUP=\"setIsDirty()\"";
  1139.         DateHTML += " DATATYPE=\"Date\">";
  1140.  
  1141.         if (!this.IsReadOnly || g_IsSearch)
  1142.         {
  1143.             DateHTML += "<BUTTON CLASS=\"dateButton\"";
  1144.             DateHTML += " NAME=\"" + this.Name + "Button\"";
  1145.             DateHTML += " ID=\"" + this.Name + "Button\"";
  1146.             DateHTML += " TABINDEX=\"1\"";
  1147.             DateHTML += " ONCLICK=\"doCalendar('" + this.Name + "');\">";
  1148.             DateHTML += "<IMG SRC=\"calendar.gif\" WIDTH=15 HEIGHT=13>";
  1149.             DateHTML += "</BUTTON>";
  1150.         }
  1151.     }
  1152.     return DateHTML;
  1153. }
  1154.  
  1155. // ============================================ \\
  1156. // ===           Date Time Field            === \\
  1157. // ============================================ \\
  1158.  
  1159. function DateTimeField(i_Name, i_Label, i_Container)
  1160. {
  1161.     if (arguments.length > 0)
  1162.         this.initField(i_Name, i_Label, i_Container);
  1163.  
  1164.     this.Width = 30;
  1165.     this.WidthType = GrooveFormsToolFieldSizeType_Characters;
  1166.     this.MaximumLength = "";
  1167.     this.InitialDateType = 0;
  1168.     this.InitialDateFunction = "";
  1169.     this.EarliestDate = "";
  1170.     this.LatestDate = "";
  1171.     this.Format = "";
  1172.     this.Type = FormObjectType_DateTime;
  1173. }
  1174.  
  1175. DateTimeField.prototype = new Field;
  1176. DateTimeField.prototype.getBody = DateTimeField_getBody;
  1177.  
  1178. function DateTimeField_getBody()
  1179. {
  1180.     var DateTimeHTML = "";
  1181.     if (g_IsReadOnly && !g_IsFormPreview)
  1182.     {
  1183.         DateTimeHTML  = "<INPUT TYPE=\"text\" STYLE=\"display:none;\" FIELDTYPE=\"" + this.Type + "\" NAME=\"" + this.Name + "\" ID=\"" + this.Name + "\" FORMAT=\"" + this.Format + "\" DATATYPE=\"Date\">";
  1184.         DateTimeHTML += "<SPAN CLASS=\"inputPreview\" ID=\"" + this.Name + "_preview\" STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) +"\"></SPAN>";
  1185.     }
  1186.     else
  1187.     {
  1188.         DateTimeHTML  = "<INPUT";
  1189.         DateTimeHTML += " TYPE=\"text\"";
  1190.         DateTimeHTML += " CLASS=\"text\"";
  1191.         DateTimeHTML += " FIELDTYPE=\"" + this.Type + "\"";
  1192.         DateTimeHTML += " NAME=\"" + this.Name + "\"";
  1193.         DateTimeHTML += " ID=\"" + this.Name + "\"";
  1194.         DateTimeHTML += " TABINDEX=\"1\"";
  1195.         //DateTimeHTML += " LABEL=\"" + this.Label + "\"";
  1196.         DateTimeHTML += " STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) +"\"";
  1197.         DateTimeHTML += " MAXLENGTH=\"" + this.MaximumLength + "\"";
  1198.         DateTimeHTML += " INITIALVALUETYPE=\"" + this.InitialDateType + "\"";
  1199.         DateTimeHTML += " INITIALVALUEFUNCTION=\"" + this.InitialDateFunction + "\"";
  1200.         DateTimeHTML += (this.IsHidden ? " ISHIDDEN" : "");
  1201.         DateTimeHTML += (this.IsRequired ? " ISREQUIRED" : "");
  1202.         DateTimeHTML += (this.IsReadOnly ? " ISREADONLY" : "");
  1203.         DateTimeHTML += (this.IsPerIdentity ? " ISPERIDENTITY" : "");
  1204.         DateTimeHTML += " INHERIT=\"" + this.InheritFrom + "\"";
  1205.         DateTimeHTML += " MIN=\"" + this.EarliestDate + "\"";
  1206.         DateTimeHTML += " MAX=\"" + this.LatestDate + "\"";
  1207.         DateTimeHTML += " FORMAT=\"" + this.Format + "\"";
  1208.         DateTimeHTML += " ONBLUR=\"validateRequired(this); if (validateDate(this)) { cleanDate(this); formatDate(this); }\"";
  1209.         DateTimeHTML += " ONKEYUP=\"setIsDirty()\"";
  1210.         DateTimeHTML += " DATATYPE=\"Date\">";
  1211.  
  1212.         if (!this.IsReadOnly || g_IsSearch)
  1213.         {
  1214.             DateTimeHTML += "<BUTTON CLASS=\"dateButton\"";
  1215.             DateTimeHTML += " NAME=\"" + this.Name + "Button\"";
  1216.             DateTimeHTML += " ID=\"" + this.Name + "Button\"";
  1217.             DateTimeHTML += " TABINDEX=\"1\"";
  1218.             DateTimeHTML += " ONCLICK=\"doCalendar('" + this.Name + "');\">";
  1219.             DateTimeHTML += "<IMG SRC=\"calendar.gif\" WIDTH=15 HEIGHT=13>";
  1220.             DateTimeHTML += "</BUTTON>";
  1221.         }
  1222.     }
  1223.     return DateTimeHTML;
  1224. }
  1225.  
  1226. // ============================================ \\
  1227. // ===           Check Box Field            === \\
  1228. // ============================================ \\
  1229.  
  1230. function CheckBoxField(i_Name, i_Label, i_Container)
  1231. {
  1232.     if (arguments.length > 0)
  1233.         this.initField(i_Name, i_Label, i_Container);
  1234.  
  1235.     this.StoredValue = "";
  1236.     this.IsCheckedByDefault = false;
  1237.     this.Type = FormObjectType_CheckBox;
  1238. }
  1239.  
  1240. CheckBoxField.prototype = new Field;
  1241. CheckBoxField.prototype.getBody = CheckBoxField_getBody;
  1242.  
  1243. function CheckBoxField_getBody()
  1244. {
  1245.     var CheckBoxHTML = "<INPUT";
  1246.     CheckBoxHTML += " TYPE=\"checkbox\"";
  1247.     CheckBoxHTML += " CLASS=\"checkbox\"";
  1248.     CheckBoxHTML += " FIELDTYPE=\"" + this.Type + "\"";
  1249.     CheckBoxHTML += " NAME=\"" + this.Name + "\"";
  1250.     CheckBoxHTML += " ID=\"" + this.Name + "\"";
  1251.     CheckBoxHTML += " TABINDEX=\"1\"";
  1252.     //CheckBoxHTML += " LABEL=\"" + this.Label + "\"";
  1253.     CheckBoxHTML += " VALUE=\"" + this.StoredValue + "\"";
  1254.     CheckBoxHTML += (this.IsCheckedByDefault ? " CHECKED" : "");
  1255.     CheckBoxHTML += (this.IsHidden ? " ISHIDDEN" : "");
  1256.     CheckBoxHTML += (this.IsRequired ? " ISREQUIRED" : "");
  1257.     CheckBoxHTML += (this.IsReadOnly ? " ISREADONLY" : "");
  1258.     CheckBoxHTML += (this.IsPerIdentity ? " ISPERIDENTITY" : "");
  1259.     CheckBoxHTML += " INHERIT=\"" + this.InheritFrom + "\"";
  1260.     CheckBoxHTML += " ONBLUR=\"validateRequired(this);\"";
  1261.     CheckBoxHTML += " ONCLICK=\"setIsDirty()\">";
  1262.     return CheckBoxHTML;
  1263. }
  1264.  
  1265. // ============================================ \\
  1266. // ===            Password Field            === \\
  1267. // ============================================ \\
  1268.  
  1269. function PasswordField(i_Name, i_Label, i_Container)
  1270. {
  1271.     if (arguments.length > 0)
  1272.         this.initField(i_Name, i_Label, i_Container);
  1273.  
  1274.     this.Width = "";
  1275.     this.WidthType = GrooveFormsToolFieldSizeType_Characters;
  1276.     this.MaximumLength = "";
  1277.     this.ValidationType = 0;
  1278.     this.ValidationParameter = "";
  1279.     this.Type = FormObjectType_Password;
  1280. }
  1281.  
  1282. PasswordField.prototype = new Field;
  1283. PasswordField.prototype.getBody = PasswordField_getBody;
  1284.  
  1285. function PasswordField_getBody()
  1286. {
  1287.     var PasswordHTML = "";
  1288.     if (g_IsReadOnly && !g_IsFormPreview)
  1289.     {
  1290.         PasswordHTML  = "<INPUT TYPE=\"password\" STYLE=\"display:none;\" FIELDTYPE=\"" + this.Type + "\" NAME=\"" + this.Name + "\" ID=\"" + this.Name + "\">";
  1291.         PasswordHTML += "<SPAN CLASS=\"inputPreview\" ID=\"" + this.Name + "_preview\" STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) +"\"></SPAN>";
  1292.     }
  1293.     else
  1294.     {
  1295.         PasswordHTML  = "<INPUT";
  1296.         PasswordHTML += " TYPE=\"password\"";
  1297.         PasswordHTML += " CLASS=\"text\"";
  1298.         PasswordHTML += " FIELDTYPE=\"" + this.Type + "\"";
  1299.         PasswordHTML += " NAME=\"" + this.Name + "\"";
  1300.         PasswordHTML += " ID=\"" + this.Name + "\"";
  1301.         PasswordHTML += " TABINDEX=\"1\"";
  1302.         //PasswordHTML += " LABEL=\"" + this.Label + "\"";
  1303.         PasswordHTML += " STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) +"\"";
  1304.         PasswordHTML += " MAXLENGTH=\"" + this.MaximumLength + "\"";
  1305.         PasswordHTML += (this.IsHidden ? " ISHIDDEN" : "");
  1306.         PasswordHTML += (this.IsRequired ? " ISREQUIRED" : "");
  1307.         PasswordHTML += (this.IsReadOnly ? " ISREADONLY" : "");
  1308.         PasswordHTML += (this.IsPerIdentity ? " ISPERIDENTITY" : "");
  1309.         PasswordHTML += " INHERIT=\"" + this.InheritFrom + "\"";
  1310.         PasswordHTML += " ONBLUR=\"validateRequired(this);" + getValidationScript(this.ValidationType, this.ValidationParameter) + "\"";
  1311.         PasswordHTML += " ONKEYUP=\"setIsDirty()\">";
  1312.     }
  1313.     return PasswordHTML;
  1314. }
  1315.  
  1316. // ============================================ \\
  1317. // ===             Option Field             === \\
  1318. // ============================================ \\
  1319.  
  1320. function OptionField()
  1321. {
  1322.     this.Options = new Array();
  1323.     this.Values = new Array();
  1324.     this.DefaultSelection = "";
  1325. }
  1326.  
  1327. OptionField.prototype = new Field;
  1328.  
  1329. // ============================================ \\
  1330. // ===         Radio Buttons Field          === \\
  1331. // ============================================ \\
  1332.  
  1333. function OptionButtonsField(i_Name, i_Label, i_Container)
  1334. {
  1335.     if (arguments.length > 0)
  1336.         this.initField(i_Name, i_Label, i_Container);
  1337.  
  1338.     this.Type = FormObjectType_OptionButtons;
  1339. }
  1340.  
  1341. OptionButtonsField.prototype = new OptionField;
  1342. OptionButtonsField.prototype.getBody = OptionButtonsField_getBody;
  1343.  
  1344. function OptionButtonsField_getBody()
  1345. {
  1346.     var OptionButtonsHTML = "";
  1347.     for (var i = 0; i < this.Options.length; i++)
  1348.     {
  1349.         OptionButtonsHTML += "<INPUT";
  1350.         OptionButtonsHTML += " TYPE=\"radio\"";
  1351.         OptionButtonsHTML += " CLASS=\"radio\"";
  1352.         OptionButtonsHTML += " FIELDTYPE=\"" + this.Type + "\"";
  1353.         OptionButtonsHTML += " NAME=\"" + this.Name + "\"";
  1354.         OptionButtonsHTML += " ID=\"" + this.Name + "\"";
  1355.         OptionButtonsHTML += " TABINDEX=\"1\"";
  1356.         //OptionButtonsHTML += " LABEL=\"" + this.Label + "\"";
  1357.         OptionButtonsHTML += " VALUE=\"" + this.Values[i] + "\"";
  1358.         OptionButtonsHTML += (this.IsHidden ? " ISHIDDEN" : "");
  1359.         OptionButtonsHTML += (this.IsRequired ? " ISREQUIRED" : "");
  1360.         OptionButtonsHTML += (this.IsReadOnly ? " ISREADONLY" : "");
  1361.         OptionButtonsHTML += (this.IsPerIdentity ? " ISPERIDENTITY" : "");
  1362.         OptionButtonsHTML += (this.DefaultSelection == this.Options[i] ? " CHECKED" : "");
  1363.         OptionButtonsHTML += " INHERIT=\"" + this.InheritFrom + "\"";
  1364.         OptionButtonsHTML += " ONBLUR=\"validateRequired(this)\"";
  1365.         OptionButtonsHTML += " ONCLICK=\"setIsDirty()\">";
  1366.         OptionButtonsHTML += " ";
  1367.         OptionButtonsHTML += "<FONT>" + this.Options[i] + "</FONT>";
  1368.     }
  1369.     OptionButtonsHTML += "<DIV ID=\"" + this.Name + "_RadioEnd\"></DIV>";
  1370.     return OptionButtonsHTML;
  1371. }
  1372.  
  1373. // ============================================ \\
  1374. // ===           Combo Box Field            === \\
  1375. // ============================================ \\
  1376.  
  1377. function DropDownListField(i_Name, i_Label, i_Container)
  1378. {
  1379.     if (arguments.length > 0)
  1380.         this.initField(i_Name, i_Label, i_Container);
  1381.  
  1382.     this.AllowUserDefinedValues = false;
  1383.     this.IncludeBlankEntry = false;
  1384.     this.IncludeMemberNames = false;
  1385.     this.HasLookup = false;
  1386.     this.Type = FormObjectType_DropDownList;
  1387. }
  1388.  
  1389. DropDownListField.prototype = new OptionField;
  1390. DropDownListField.prototype.getBody = DropDownListField_getBody;
  1391.  
  1392. function DropDownListField_getBody()
  1393. {
  1394.     var DropDownListHTML = "";
  1395.     if (g_IsReadOnly && !g_IsFormPreview)
  1396.     {
  1397.         DropDownListHTML  = "<SELECT";
  1398.         DropDownListHTML += " STYLE=\"display:none;\"";
  1399.         DropDownListHTML += " FIELDTYPE=\"" + this.Type + "\"";
  1400.         DropDownListHTML += " NAME=\"" + this.Name + "\"";
  1401.         DropDownListHTML += " ID=\"" + this.Name + "\"";
  1402.         DropDownListHTML += (this.IncludeMemberNames ? " MEMBERS" : "");
  1403.         DropDownListHTML += (this.HasLookup ? " LOOKUP" : "");
  1404.         DropDownListHTML += ">";
  1405.  
  1406.         if (this.IncludeBlankEntry)
  1407.             DropDownListHTML += "<OPTION ORIGINAL></OPTION>";
  1408.  
  1409.         for (var i = 0; i < this.Options.length; i++)
  1410.         {
  1411.             if (this.Options[i] != "" || this.Values[i] != "")
  1412.                 DropDownListHTML += "<OPTION VALUE=\"" + this.Values[i] + "\">" + this.Options[i] + "</OPTION>";
  1413.         }
  1414.  
  1415.         DropDownListHTML += "</SELECT>";
  1416.         DropDownListHTML += "<SPAN CLASS=\"selectPreview\" ID=\"" + this.Name + "_preview\"></SPAN>";
  1417.     }
  1418.     else
  1419.     {
  1420.         DropDownListHTML  = "<SELECT";
  1421.         DropDownListHTML += " FIELDTYPE=\"" + this.Type + "\"";
  1422.         DropDownListHTML += " NAME=\"" + this.Name + "\"";
  1423.         DropDownListHTML += " ID=\"" + this.Name + "\"";
  1424.         DropDownListHTML += " TABINDEX=\"1\"";
  1425.         //DropDownListHTML += " LABEL=\"" + this.Label + "\"";
  1426.         DropDownListHTML += (this.AllowUserDefinedValues ? " CUSTOM" : "");
  1427.         DropDownListHTML += (this.IncludeMemberNames ? " MEMBERS" : "");
  1428.         DropDownListHTML += (this.IsHidden ? " ISHIDDEN" : "");
  1429.         DropDownListHTML += (this.IsRequired ? " ISREQUIRED" : "");
  1430.         DropDownListHTML += (this.IsReadOnly ? " ISREADONLY" : "");
  1431.         DropDownListHTML += (this.IsPerIdentity ? " ISPERIDENTITY" : "");
  1432.         DropDownListHTML += (this.IncludeBlankEntry ? " BLANK" : "");
  1433.         DropDownListHTML += (this.HasLookup ? " LOOKUP" : "");
  1434.         DropDownListHTML += " INHERIT=\"" + this.InheritFrom + "\"";
  1435.         DropDownListHTML += " ONBLUR=\"validateRequired(this)\"";
  1436.         DropDownListHTML += " ONCHANGE=\"setIsDirty();\"";
  1437.         DropDownListHTML += ">";
  1438.  
  1439.         if (this.IncludeBlankEntry || g_IsSearch)
  1440.             DropDownListHTML += "<OPTION ORIGINAL></OPTION>";
  1441.  
  1442.         for (var i = 0; i < this.Options.length; i++)
  1443.         {
  1444.             if (this.Options[i] != "" || this.Values[i] != "")
  1445.             {
  1446.                 DropDownListHTML += "<OPTION ORIGINAL";
  1447.                 DropDownListHTML += " VALUE=\"" + this.Values[i] + "\"";
  1448.                 DropDownListHTML += (this.DefaultSelection == this.Options[i] ? " SELECTED" : "");
  1449.                 DropDownListHTML += ">";
  1450.                 DropDownListHTML += this.Options[i];
  1451.                 DropDownListHTML += "</OPTION>";
  1452.             }
  1453.         }
  1454.  
  1455.         DropDownListHTML += "</SELECT>";
  1456.  
  1457.         if (this.AllowUserDefinedValues)
  1458.         {
  1459.             DropDownListHTML += "<BUTTON CLASS=\"customButton\"";
  1460.             DropDownListHTML += " NAME=\"" + this.Name + "Button\"";
  1461.             DropDownListHTML += " ID=\"" + this.Name + "Button\"";
  1462.             DropDownListHTML += " TABINDEX=\"1\"";
  1463.             DropDownListHTML += " ONCLICK=\"addNewOption('" + this.Name + "');\">+</BUTTON>";
  1464.         }
  1465.     }
  1466.     return DropDownListHTML;
  1467. }
  1468.  
  1469. // ============================================ \\
  1470. // ===            List Box Field            === \\
  1471. // ============================================ \\
  1472.  
  1473. function ListBoxField(i_Name, i_Label, i_Container)
  1474. {
  1475.     if (arguments.length > 0)
  1476.         this.initField(i_Name, i_Label, i_Container);
  1477.  
  1478.     this.AllowMultipleSelection = false;
  1479.     this.IncludeBlankEntry = false;
  1480.     this.IncludeMemberNames = false;
  1481.     this.HasLookup = false;
  1482.     this.NumberVisible = 4;
  1483.     this.Type = FormObjectType_ListBox;
  1484. }
  1485.  
  1486. ListBoxField.prototype = new OptionField;
  1487. ListBoxField.prototype.getBody = ListBoxField_getBody;
  1488.  
  1489. function ListBoxField_getBody()
  1490. {
  1491.     var ListBoxHTML = "";
  1492.     if (g_IsReadOnly && !g_IsFormPreview)
  1493.     {
  1494.         ListBoxHTML  = "<SELECT";
  1495.         ListBoxHTML += " STYLE=\"display:none;\"";
  1496.         ListBoxHTML += " FIELDTYPE=\"" + this.Type + "\"";
  1497.         ListBoxHTML += " NAME=\"" + this.Name + "\"";
  1498.         ListBoxHTML += " ID=\"" + this.Name + "\"";
  1499.         ListBoxHTML += " SIZE=\"" + this.NumberVisible + "\"";
  1500.         ListBoxHTML += (this.AllowMultipleSelection ? " MULTIPLE" : "");
  1501.         ListBoxHTML += (this.IncludeMemberNames ? " MEMBERS" : "");
  1502.         ListBoxHTML += (this.HasLookup ? " LOOKUP" : "");
  1503.         ListBoxHTML += ">";
  1504.  
  1505.         if (this.IncludeBlankEntry)
  1506.             ListBoxHTML += "<OPTION ORIGINAL></OPTION>";
  1507.  
  1508.         for (var i = 0; i < this.Options.length; i++)
  1509.         {
  1510.             if (this.Options[i] != "" || this.Values[i] != "")
  1511.                 ListBoxHTML += "<OPTION VALUE=\"" + this.Values[i] + "\">" + this.Options[i] + "</OPTION>";
  1512.         }
  1513.  
  1514.         ListBoxHTML += "</SELECT>";
  1515.         ListBoxHTML += "<SPAN CLASS=\"selectPreview\" ID=\"" + this.Name + "_preview\"></SPAN>";
  1516.     }
  1517.     else
  1518.     {
  1519.         ListBoxHTML  = "<SELECT";
  1520.         ListBoxHTML += " FIELDTYPE=\"" + this.Type + "\"";
  1521.         ListBoxHTML += " NAME=\"" + this.Name + "\"";
  1522.         ListBoxHTML += " ID=\"" + this.Name + "\"";
  1523.         ListBoxHTML += " TABINDEX=\"1\"";
  1524.         //ListBoxHTML += " LABEL=\"" + this.Label + "\"";
  1525.         ListBoxHTML += " SIZE=\"" + this.NumberVisible + "\"";
  1526.         ListBoxHTML += (this.AllowMultipleSelection ? " MULTIPLE" : "");
  1527.         ListBoxHTML += (this.IsHidden ? " ISHIDDEN" : "");
  1528.         ListBoxHTML += (this.IsRequired ? " ISREQUIRED" : "");
  1529.         ListBoxHTML += (this.IsReadOnly ? " ISREADONLY" : "");
  1530.         ListBoxHTML += (this.IsPerIdentity ? " ISPERIDENTITY" : "");
  1531.         ListBoxHTML += (this.IncludeBlankEntry ? " BLANK" : "");
  1532.         ListBoxHTML += (this.HasLookup ? " LOOKUP" : "");
  1533.         ListBoxHTML += (this.IncludeMemberNames ? " MEMBERS" : "");
  1534.         ListBoxHTML += " INHERIT=\"" + this.InheritFrom + "\"";
  1535.         ListBoxHTML += " ONBLUR=\"validateRequired(this)\"";
  1536.         ListBoxHTML += " ONCHANGE=\"setIsDirty()\">";
  1537.  
  1538.         if (this.IncludeBlankEntry || g_IsSearch)
  1539.             ListBoxHTML += "<OPTION ORIGINAL></OPTION>";
  1540.  
  1541.         for (var i = 0; i < this.Options.length; i++)
  1542.         {
  1543.             if (this.Options[i] != "" || this.Values[i] != "")
  1544.             {
  1545.                 ListBoxHTML += "<OPTION ORIGINAL";
  1546.                 ListBoxHTML += " VALUE=\"" + this.Values[i] + "\"";
  1547.                 ListBoxHTML += (this.DefaultSelection == this.Options[i] ? " SELECTED" : "");
  1548.                 ListBoxHTML += ">";
  1549.                 ListBoxHTML += this.Options[i];
  1550.                 ListBoxHTML += "</OPTION>";
  1551.             }
  1552.         }
  1553.  
  1554.         ListBoxHTML += "</SELECT>";
  1555.     }
  1556.     return ListBoxHTML;
  1557. }
  1558.  
  1559. // ============================================ \\
  1560. // ===           Rich Text Field            === \\
  1561. // ============================================ \\
  1562.  
  1563. function RichTextField(i_Name, i_Label, i_Container)
  1564. {
  1565.     if (arguments.length > 0)
  1566.         this.initField(i_Name, i_Label, i_Container);
  1567.  
  1568.     this.Width = 40;
  1569.     this.WidthType = GrooveFormsToolFieldSizeType_Characters;
  1570.     this.Height = 10;
  1571.     this.HeightType = GrooveFormsToolFieldSizeType_Characters;
  1572.     this.InitialRTF = "";
  1573.     this.IsBorderHidden = false;
  1574.     this.IsSearchable = false;
  1575.     this.IsCommandBarHidden = true;
  1576.     this.BackgroundColor = "";
  1577.     this.Type = FormObjectType_RichText;
  1578. }
  1579.  
  1580. RichTextField.prototype = new Field;
  1581. RichTextField.prototype.getBody = RichTextField_getBody;
  1582.  
  1583. function RichTextField_getBody()
  1584. {
  1585.     var RichTextHTML = "";
  1586.     if ((g_IsFormPreview && !this.IsCommandBarHidden) || (!g_IsReadOnly && !g_IsPreviewPane && !this.IsCommandBarHidden))
  1587.     {
  1588.         var objRichTextCommandBar = new CommandBar(this.Name, getFieldWidthUnit(this.Width, this.WidthType));
  1589.         var objBoldCommand = new Command(this.Name + "Bold", "rtf_bold.gif", "Bold", "doBold('" + this.Name + "')");
  1590.         objRichTextCommandBar.addCommand(objBoldCommand);
  1591.         var objItalicCommand = new Command(this.Name + "Italic", "rtf_italic.gif", "Italicize", "doItalic('" + this.Name + "')");
  1592.         objRichTextCommandBar.addCommand(objItalicCommand);
  1593.         var objUnderlineCommand = new Command(this.Name + "Underline", "rtf_underline.gif", "Underline", "doUnderline('" + this.Name + "')");
  1594.         objRichTextCommandBar.addCommand(objUnderlineCommand);
  1595.  
  1596.         objRichTextCommandBar.addSeparator();
  1597.  
  1598.         var objChooseFontCommand = new Command(this.Name + "ChooseFont", "rtf_choosefont.gif", "Choose Font", "doChooseFont('" + this.Name + "')");
  1599.         objRichTextCommandBar.addCommand(objChooseFontCommand);
  1600.         var objChooseColorCommand = new Command(this.Name + "ChooseColor", "rtf_choosecolor.gif", "Choose Color", "doChooseColor('" + this.Name + "')");
  1601.         objRichTextCommandBar.addCommand(objChooseColorCommand);
  1602.  
  1603.         objRichTextCommandBar.addSeparator();
  1604.  
  1605.         var objAlignLeftCommand = new Command(this.Name + "AlignLeft", "rtf_alignleft.gif", "Align Left", "doAlignLeft('" + this.Name + "')");
  1606.         objRichTextCommandBar.addCommand(objAlignLeftCommand);
  1607.         var objCenterCommand = new Command(this.Name + "Center", "rtf_center.gif", "Center", "doCenter('" + this.Name + "')");
  1608.         objRichTextCommandBar.addCommand(objCenterCommand);
  1609.         var objAlignRightCommand = new Command(this.Name + "AlignRight", "rtf_alignright.gif", "Align Right", "doAlignRight('" + this.Name + "')");
  1610.         objRichTextCommandBar.addCommand(objAlignRightCommand);
  1611.         var objJustifyCommand = new Command(this.Name + "Justify", "rtf_justify.gif", "Justify", "doJustify('" + this.Name + "')");
  1612.         objRichTextCommandBar.addCommand(objJustifyCommand);
  1613.  
  1614.         objRichTextCommandBar.addSeparator();
  1615.  
  1616.         var objBulletsCommand = new Command(this.Name + "Bullets", "rtf_bullets.gif", "Bullets", "doBullets('" + this.Name + "')");
  1617.         objRichTextCommandBar.addCommand(objBulletsCommand);
  1618.         var objIncreaseIndentCommand = new Command(this.Name + "IncreaseIndent", "rtf_increaseindent.gif", "Increase Indent", "doIncreaseIndent('" + this.Name + "')");
  1619.         objRichTextCommandBar.addCommand(objIncreaseIndentCommand);
  1620.         var objDecreaseIndentCommand = new Command(this.Name + "DecreaseIndent", "rtf_decreaseindent.gif", "Decrease Indent", "doDecreaseIndent('" + this.Name + "')");
  1621.         objRichTextCommandBar.addCommand(objDecreaseIndentCommand);
  1622.  
  1623.         RichTextHTML = objRichTextCommandBar.getBody();
  1624.     }
  1625.  
  1626.     if (g_IsFormPreview || !g_IsReadOnly || (g_IsReadOnly && !g_IsPreviewPane))
  1627.     {
  1628.         RichTextHTML += "<SCRIPT LANGUAGE=\"JavaScript\" FOR=\"" + this.Name + "\" EVENT=\"OnChange()\">setIsDirty(); eventHandlerById('OnChange', '" + this.Name + "');</SCRIPT>";
  1629.         if (!g_IsReadOnly && !g_IsFormPreview && !this.IsCommandBarHidden)
  1630.         {
  1631.             RichTextHTML += "<SCRIPT LANGUAGE=\"JavaScript\" FOR=\"" + this.Name + "\" EVENT=\"OnSetFocus()\">startInterval('" + this.Name + "');</SCRIPT>";
  1632.             RichTextHTML += "<SCRIPT LANGUAGE=\"JavaScript\" FOR=\"" + this.Name + "\" EVENT=\"OnKillFocus()\">validateRequiredRichText('" + this.Name + "'); stopInterval('" + this.Name + "'); eventHandlerById('OnBlur', '" + this.Name + "');</SCRIPT>";
  1633.         }
  1634.         else
  1635.         {
  1636.             RichTextHTML += "<SCRIPT LANGUAGE=\"JavaScript\" FOR=\"" + this.Name + "\" EVENT=\"OnKillFocus()\">validateRequiredRichText('" + this.Name + "'); eventHandlerById('OnBlur', '" + this.Name + "');</SCRIPT>";
  1637.         }
  1638.         RichTextHTML += "<OBJECT";
  1639.         RichTextHTML += " CLASSID=\"clsid:E01D1C6A-4F40-11D3-8958-00105A272DCF\"";
  1640.         RichTextHTML += " FIELDTYPE=\"" + this.Type + "\"";
  1641.         RichTextHTML += " NAME=\"" + this.Name + "\"";
  1642.         RichTextHTML += " ID=\"" + this.Name + "\"";
  1643.         RichTextHTML += " TABINDEX=\"1\"";
  1644.         RichTextHTML += " STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) + getFieldHeightUnit(this.Height, this.HeightType) + "\"";
  1645.         RichTextHTML += " BORDER=0";
  1646.         RichTextHTML += (this.IsHidden ? " ISHIDDEN" : "");
  1647.         RichTextHTML += (this.IsRequired ? " ISREQUIRED" : "");
  1648.         RichTextHTML += (this.IsReadOnly ? " ISREADONLY" : "");
  1649.         RichTextHTML += (this.IsPerIdentity ? " ISPERIDENTITY" : "");
  1650.  
  1651.         if (g_IsReadOnly)
  1652.         {
  1653.             this.IsBorderHidden = true;
  1654.             if (this.BackgroundColor == null || this.BackgroundColor == "")
  1655.                 this.BackgroundColor = "Transparent";
  1656.         }
  1657.  
  1658.         RichTextHTML += (this.IsBorderHidden ? " ISBORDERHIDDEN" : "");
  1659.         RichTextHTML += (this.IsSearchable ? " ISSEARCHABLE" : "");
  1660.         RichTextHTML += " BACKGROUNDCOLOR=\"" + this.BackgroundColor + "\"";
  1661.         RichTextHTML += " INHERIT=\"" + this.InheritFrom + "\"";
  1662.         RichTextHTML += " DEFAULT=\"" + this.InitialRTF + "\"";
  1663.         RichTextHTML += " DATATYPE=\"RichText\"></OBJECT>";
  1664.     }
  1665.     else
  1666.     {
  1667.         RichTextHTML += "<OBJECT";
  1668.         RichTextHTML += " CLASSID=\"clsid:E01D1C6A-4F40-11D3-8958-00105A272DCF\"";
  1669.         RichTextHTML += " FIELDTYPE=\"" + this.Type + "\"";
  1670.         RichTextHTML += " NAME=\"" + this.Name + "\"";
  1671.         RichTextHTML += " ID=\"" + this.Name + "\"";
  1672.         RichTextHTML += " STYLE=\"display:none; " + getFieldWidthUnit(this.Width, this.WidthType) + getFieldHeightUnit(this.Height, this.HeightType) + "\"";
  1673.         RichTextHTML += " DATATYPE=\"RichText\"></OBJECT>";
  1674.         RichTextHTML += "<SPAN STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) + " background-color:" + this.BackgroundColor + ";\" ID=\"" + this.Name + "_preview\"></SPAN>";
  1675.     }
  1676.     return RichTextHTML;
  1677. }
  1678.  
  1679. // ============================================ \\
  1680. // ===         Embedded View Field          === \\
  1681. // ============================================ \\
  1682.  
  1683. function EmbeddedViewField(i_Name, i_Label, i_Container)
  1684. {
  1685.     if (arguments.length > 0)
  1686.         this.initField(i_Name, i_Label, i_Container);
  1687.  
  1688.     this.Width = 40;
  1689.     this.WidthType = GrooveFormsToolFieldSizeType_Characters;
  1690.     this.Height = 10;
  1691.     this.HeightType = GrooveFormsToolFieldSizeType_Characters;
  1692.     this.EmbeddedViewID = "";
  1693.     this.EmbeddedViewFilter = false;
  1694.     this.Type = FormObjectType_EmbeddedView;
  1695. }
  1696.  
  1697. EmbeddedViewField.prototype = new Field;
  1698. EmbeddedViewField.prototype.getBody = EmbeddedViewField_getBody;
  1699.  
  1700. function EmbeddedViewField_getBody()
  1701. {
  1702.     var EmbeddedViewHTML = "";
  1703.     if (g_IsFormPreview)
  1704.     {
  1705.         EmbeddedViewHTML += "<DIV";
  1706.         EmbeddedViewHTML += " STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) + getFieldHeightUnit(this.Height, this.HeightType) + " border:1px solid black; background-color:white;\"";
  1707.         EmbeddedViewHTML += ">";
  1708.         EmbeddedViewHTML += "<TABLE WIDTH=\"100%\" HEIGHT=\"100%\"><TR><TD ALIGN=\"center\" VALIGN=\"middle\"><FONT><B>Embedded View field with the name '" + this.Name + "' will display here.</B></FONT></TD></TR></TABLE>";
  1709.         EmbeddedViewHTML += "</DIV>";
  1710.     }
  1711.     else
  1712.     {
  1713.         EmbeddedViewHTML += "<OBJECT";
  1714.         EmbeddedViewHTML += " CLASSID=\"clsid:56A58823-AE99-11D5-B90B-0050DACD1F75\"";
  1715.         EmbeddedViewHTML += " FIELDTYPE=\"" + this.Type + "\"";
  1716.         EmbeddedViewHTML += " NAME=\"" + this.EmbeddedViewID + "\"";
  1717.         EmbeddedViewHTML += " ID=\"" + this.EmbeddedViewID + "\"";
  1718.         EmbeddedViewHTML += " BORDER=\"1\"";
  1719.         //EmbeddedViewHTML += " LABEL=\"" + this.Label + "\"";
  1720.         EmbeddedViewHTML += " STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) + getFieldHeightUnit(this.Height, this.HeightType) + "\"";
  1721.         EmbeddedViewHTML += (this.IsHidden ? " ISHIDDEN" : "");
  1722.         EmbeddedViewHTML += " EMBEDDEDVIEWFILTER=\"" + this.EmbeddedViewFilter + "\"";
  1723.         EmbeddedViewHTML += " DATATYPE=\"View\"></OBJECT>";
  1724.     }
  1725.     return EmbeddedViewHTML;
  1726. }
  1727.  
  1728. // ============================================ \\
  1729. // ===          Digital Ink Field           === \\
  1730. // ============================================ \\
  1731.  
  1732. function DigitalInkField(i_Name, i_Label, i_Container)
  1733. {
  1734.     if (arguments.length > 0)
  1735.         this.initField(i_Name, i_Label, i_Container);
  1736.  
  1737.     this.ID = -1;
  1738.     this.Width = 40;
  1739.     this.WidthType = GrooveFormsToolFieldSizeType_Characters;
  1740.     this.Height = 10;
  1741.     this.HeightType = GrooveFormsToolFieldSizeType_Characters;
  1742.     this.Type = FormObjectType_DigitalInk;
  1743. }
  1744.  
  1745. DigitalInkField.prototype = new Field;
  1746. DigitalInkField.prototype.getBody = DigitalInkField_getBody;
  1747.  
  1748. function DigitalInkField_getBody()
  1749. {
  1750.     var DigitalInkHTML = "";
  1751.     if (g_IsFormPreview)
  1752.     {
  1753.         DigitalInkHTML += "<DIV";
  1754.         DigitalInkHTML += " STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) + getFieldHeightUnit(this.Height, this.HeightType) + " border:1px solid black; background-color:white;\"";
  1755.         DigitalInkHTML += ">";
  1756.         DigitalInkHTML += "<TABLE WIDTH=\"100%\" HEIGHT=\"100%\"><TR><TD ALIGN=\"center\" VALIGN=\"middle\"><FONT><B>Digital Ink field with the name '" + this.Name + "' will display here.</B></FONT></TD></TR></TABLE>";
  1757.         DigitalInkHTML += "</DIV>";
  1758.     }
  1759.     else
  1760.     {
  1761.         var DigitalInkObject = getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").CreateInkObject();
  1762.         if (typeof DigitalInkObject != "undefined" && DigitalInkObject != null)
  1763.         {
  1764.             DigitalInkHTML += "<OBJECT";
  1765.             DigitalInkHTML += " CLASSID=\"clsid:537E4D80-9531-4f07-9369-B3649EFF7130\"";
  1766.             DigitalInkHTML += " FIELDTYPE=\"" + this.Type + "\"";
  1767.             DigitalInkHTML += " NAME=\"" + this.Name + "\"";
  1768.             DigitalInkHTML += " ID=\"" + this.Name + "\"";
  1769.             //DigitalInkHTML += " LABEL=\"" + this.Label + "\"";
  1770.             DigitalInkHTML += " STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) + getFieldHeightUnit(this.Height, this.HeightType) + "\"";
  1771.             DigitalInkHTML += (this.IsHidden ? " ISHIDDEN" : "");
  1772.             DigitalInkHTML += " BORDER=\"1\"";
  1773.             DigitalInkHTML += " DATATYPE=\"Ink\"></OBJECT>";
  1774.         }
  1775.         else if (!g_IsNew)
  1776.         {
  1777.             DigitalInkHTML += "<IMG";
  1778.             DigitalInkHTML += " NAME=\"" + this.Name + "\"";
  1779.             DigitalInkHTML += " ID=\"" + this.Name + "\"";
  1780.             DigitalInkHTML += " SRC=\"" + getImageBindableURLByID(this.ID) + "\"";
  1781.             DigitalInkHTML += (this.IsHidden ? " ISHIDDEN" : "");
  1782.             DigitalInkHTML += " FIELDTYPE=\"" + this.Type + "\">";
  1783.         }
  1784.         else
  1785.         {
  1786.             DigitalInkHTML += "<DIV";
  1787.             DigitalInkHTML += " STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) + getFieldHeightUnit(this.Height, this.HeightType) + " border:1px solid black; background-color:white;\"";
  1788.             DigitalInkHTML += ">";
  1789.             DigitalInkHTML += "<TABLE WIDTH=\"100%\" HEIGHT=\"100%\"><TR><TD ALIGN=\"center\" VALIGN=\"middle\"><FONT><B>Digital Ink field with the name '" + this.Name + "' should be displayed here. You must have Digital Ink installed in order to use this field.</B></FONT></TD></TR></TABLE>";
  1790.             DigitalInkHTML += "</DIV>";
  1791.         }
  1792.     }
  1793.  
  1794.     return DigitalInkHTML;
  1795. }
  1796.  
  1797. // ============================================ \\
  1798. // ===          Attachments Field           === \\
  1799. // ============================================ \\
  1800.  
  1801. function AttachmentsField(i_Name, i_Label, i_Container)
  1802. {
  1803.     if (arguments.length > 0)
  1804.         this.initField(i_Name, i_Label, i_Container);
  1805.  
  1806.     this.Type = FormObjectType_Attachments;
  1807. }
  1808.  
  1809. AttachmentsField.prototype = new Field;
  1810. AttachmentsField.prototype.getBody = AttachmentsField_getBody;
  1811. AttachmentsField.prototype.getRequired = AttachmentsField_getRequired;
  1812.  
  1813. function AttachmentsField_getBody()
  1814. {
  1815.     var objAttachmentsCommandBar = new CommandBar(this.Name, "width:200px");
  1816.     var objAddCommand = new Command(this.Name + "Add", "add.gif", "Add Attachment(s)", "doAddAttachments()");
  1817.     objAttachmentsCommandBar.addCommand(objAddCommand);
  1818.     var objLaunchCommand = new Command(this.Name + "Launch", "launch.gif", "Launch Selected Attachment(s)", "doLaunchSelectedAttachments()");
  1819.     objAttachmentsCommandBar.addCommand(objLaunchCommand);
  1820.     var objSaveCommand = new Command(this.Name + "Save", "save.gif", "Save Selected Attachment(s)", "doSaveSelectedAttachments()");
  1821.     objAttachmentsCommandBar.addCommand(objSaveCommand);
  1822.     var objDeleteCommand = new Command(this.Name + "Delete", "delete.gif", "Delete Selected Attachment(s)", "doDeleteSelectedAttachments()");
  1823.     objAttachmentsCommandBar.addCommand(objDeleteCommand);
  1824.  
  1825.     var AttachmentsHTML = objAttachmentsCommandBar.getBody();
  1826.  
  1827.     AttachmentsHTML += "<OBJECT";
  1828.     AttachmentsHTML += " CLASSID=\"clsid:0D012ABD-CEED-11D2-9C76-00105AA73033\"";
  1829.     AttachmentsHTML += " FIELDTYPE=\"" + this.Type + "\"";
  1830.     AttachmentsHTML += " NAME=\"" + this.Name + "\"";
  1831.     AttachmentsHTML += " ID=\"" + this.Name + "\"";
  1832.     AttachmentsHTML += " TABINDEX=\"1\"";
  1833.     //AttachmentsHTML += " LABEL=\"" + this.Label + "\"";
  1834.     AttachmentsHTML += " WIDTH=\"200\"";
  1835.     AttachmentsHTML += " HEIGHT=\"75\"";
  1836.     AttachmentsHTML += (this.IsHidden ? " ISHIDDEN" : "");
  1837.     AttachmentsHTML += (this.IsReadOnly ? " ISREADONLY" : "");
  1838.     AttachmentsHTML += (this.IsPerIdentity ? " ISPERIDENTITY" : "");
  1839.     AttachmentsHTML += " INHERIT=\"" + this.InheritFrom + "\"";
  1840.     AttachmentsHTML += " TABINDEX=\"-1\"";
  1841.     AttachmentsHTML += " DATATYPE=\"Attachments\"></OBJECT>";
  1842.     return AttachmentsHTML;
  1843. }
  1844.  
  1845. function AttachmentsField_getRequired()
  1846. {
  1847.     return "";
  1848. }
  1849.  
  1850. // ============================================ \\
  1851. // ===          Static Field Class          === \\
  1852. // ============================================ \\
  1853.  
  1854. function Static()
  1855. {
  1856.     this.Name        = "";
  1857.     this.IsHidden    = false;
  1858.     this.ColumnSpan    = 1;
  1859.     this.RowSpan    = 1;
  1860. }
  1861.  
  1862. Static.prototype.initStatic = Static_initStatic;
  1863.  
  1864. function Static_initStatic(i_Name, i_Container)
  1865. {
  1866.     this.Name = i_Name;
  1867.  
  1868.     i_Container.addField(this);
  1869. }
  1870.  
  1871. // ============================================ \\
  1872. // ===             Text Static              === \\
  1873. // ============================================ \\
  1874.  
  1875. function StaticTextField(i_Name, i_Container)
  1876. {
  1877.     if (arguments.length > 0)
  1878.         this.initStatic(i_Name, i_Container);
  1879.  
  1880.     this.Text = "";
  1881.     this.Center = false;
  1882.     this.HasLookup = false;
  1883.     this.Type = FormObjectType_StaticText;
  1884. }
  1885.  
  1886. StaticTextField.prototype = new Static;
  1887. StaticTextField.prototype.getBody = StaticTextField_getBody;
  1888.  
  1889. function StaticTextField_getBody()
  1890. {
  1891.     var StaticTextHTML = "<DIV";
  1892.     StaticTextHTML += " CLASS=\"staticText\"";
  1893.     StaticTextHTML += " FIELDTYPE=\"" + this.Type + "\"";
  1894.     StaticTextHTML += " NAME=\"" + this.Name + "\"";
  1895.     StaticTextHTML += " ID=\"" + this.Name + "\"";
  1896.     StaticTextHTML += (this.IsHidden ? " ISHIDDEN" : "");
  1897.     StaticTextHTML += (this.Center ? " ALIGN=\"center\"" : "");
  1898.     StaticTextHTML += (this.HasLookup ? " LOOKUP" : "");
  1899.     StaticTextHTML += ">";
  1900.     StaticTextHTML += this.Text;
  1901.     StaticTextHTML += "</DIV>";
  1902.     return StaticTextHTML;
  1903. }
  1904.  
  1905. // ============================================ \\
  1906. // ===         Form Heading Static          === \\
  1907. // ============================================ \\
  1908.  
  1909. function FormHeadingField(i_Name, i_Container)
  1910. {
  1911.     if (arguments.length > 0)
  1912.         this.initStatic(i_Name, i_Container);
  1913.  
  1914.     this.HeadingText = "";
  1915.     this.Center = false;
  1916.     this.Type = FormObjectType_FormHeading;
  1917. }
  1918.  
  1919. FormHeadingField.prototype = new Static;
  1920. FormHeadingField.prototype.getBody = FormHeadingField_getBody;
  1921.  
  1922. function FormHeadingField_getBody()
  1923. {
  1924.     var FormHeadingHTML = "<DIV";
  1925.     FormHeadingHTML += " CLASS=\"formHeading\"";
  1926.     FormHeadingHTML += " WIDTH=\"100%\"";
  1927.     FormHeadingHTML += " FIELDTYPE=\"" + this.Type + "\"";
  1928.     FormHeadingHTML += " NAME=\"" + this.Name + "\"";
  1929.     FormHeadingHTML += " ID=\"" + this.Name + "\"";
  1930.     FormHeadingHTML += (this.IsHidden ? " ISHIDDEN" : "");
  1931.     FormHeadingHTML += (this.Center ? " ALIGN=\"center\"" : "");
  1932.     FormHeadingHTML += ">";
  1933.     FormHeadingHTML += this.HeadingText;
  1934.     FormHeadingHTML += "</DIV>";
  1935.     return FormHeadingHTML;
  1936. }
  1937.  
  1938. // ============================================ \\
  1939. // ===        Section Heading Static        === \\
  1940. // ============================================ \\
  1941.  
  1942. function SectionHeadingField(i_Name, i_Container)
  1943. {
  1944.     if (arguments.length > 0)
  1945.         this.initStatic(i_Name, i_Container);
  1946.  
  1947.     this.HeadingText = "";
  1948.     this.Center = false;
  1949.     this.Type = FormObjectType_SectionHeading;
  1950. }
  1951.  
  1952. SectionHeadingField.prototype = new Static;
  1953. SectionHeadingField.prototype.getBody = SectionHeadingField_getBody;
  1954.  
  1955. function SectionHeadingField_getBody()
  1956. {
  1957.     var SectionHeadingHTML = "<DIV";
  1958.     SectionHeadingHTML += " WIDTH=\"100%\"";
  1959.     SectionHeadingHTML += " CLASS=\"sectionHeading\"";
  1960.     SectionHeadingHTML += " FIELDTYPE=\"" + this.Type + "\"";
  1961.     SectionHeadingHTML += " NAME=\"" + this.Name + "\"";
  1962.     SectionHeadingHTML += " ID=\"" + this.Name + "\"";
  1963.     SectionHeadingHTML += (this.IsHidden ? " ISHIDDEN" : "");
  1964.     SectionHeadingHTML += (this.Center ? " ALIGN=\"center\"" : "");
  1965.     SectionHeadingHTML += ">";
  1966.     SectionHeadingHTML += this.HeadingText;
  1967.     SectionHeadingHTML += "</DIV>";
  1968.     return SectionHeadingHTML;
  1969. }
  1970.  
  1971. // ============================================ \\
  1972. // ===        Horizontal Line Static        === \\
  1973. // ============================================ \\
  1974.  
  1975. function HorizontalLineField(i_Name, i_Container)
  1976. {
  1977.     if (arguments.length > 0)
  1978.         this.initStatic(i_Name, i_Container);
  1979.  
  1980.     this.Thickness = "";
  1981.     this.IsUnshaded = false;
  1982.     this.Type = FormObjectType_HorizontalLine;
  1983. }
  1984.  
  1985. HorizontalLineField.prototype = new Static;
  1986. HorizontalLineField.prototype.getBody = HorizontalLineField_getBody;
  1987.  
  1988. function HorizontalLineField_getBody()
  1989. {
  1990.     var HorizontalLineHTML = "<HR";
  1991.     HorizontalLineHTML += " FIELDTYPE=\"" + this.Type + "\"";
  1992.     HorizontalLineHTML += " NAME=\"" + this.Name + "\"";
  1993.     HorizontalLineHTML += " ID=\"" + this.Name + "\"";
  1994.     HorizontalLineHTML += " SIZE=\"" + this.Thickness + "\"";
  1995.     HorizontalLineHTML += (this.IsHidden ? " ISHIDDEN" : "");
  1996.     HorizontalLineHTML += (this.IsUnshaded ? " NOSHADE" : "");
  1997.     HorizontalLineHTML += ">";
  1998.     return HorizontalLineHTML;
  1999. }
  2000.  
  2001. // ============================================ \\
  2002. // ===           New Line Static           === \\
  2003. // ============================================ \\
  2004.  
  2005. function NewLineField(i_Name, i_Container)
  2006. {
  2007.     if (arguments.length > 0)
  2008.         this.initStatic(i_Name, i_Container);
  2009.  
  2010.     this.Type = FormObjectType_NewLine;
  2011. }
  2012.  
  2013. NewLineField.prototype = new Static;
  2014. NewLineField.prototype.getBody = NewLineField_getBody;
  2015.  
  2016. function NewLineField_getBody()
  2017. {
  2018.     var NewLineHTML = "<BR";
  2019.     NewLineHTML += " FIELDTYPE=\"" + this.Type + "\"";
  2020.     NewLineHTML += " NAME=\"" + this.Name + "\"";
  2021.     NewLineHTML += " ID=\"" + this.Name + "\"";
  2022.     NewLineHTML += (this.IsHidden ? " ISHIDDEN" : "");
  2023.     NewLineHTML += ">";
  2024.     return NewLineHTML;
  2025. }
  2026.  
  2027. // ============================================ \\
  2028. // ===            Button Static             === \\
  2029. // ============================================ \\
  2030.  
  2031. function ScriptButtonField(i_Name, i_Container)
  2032. {
  2033.     if (arguments.length > 0)
  2034.         this.initStatic(i_Name, i_Container);
  2035.  
  2036.     this.ButtonText = "";
  2037.     this.Center = false;
  2038.     this.OnClickScript = "";
  2039.     this.Type = FormObjectType_ScriptButton;
  2040. }
  2041.  
  2042. ScriptButtonField.prototype = new Static;
  2043. ScriptButtonField.prototype.getBody = ScriptButtonField_getBody;
  2044.  
  2045. function ScriptButtonField_getBody()
  2046. {
  2047.     var ScriptButtonHTML = "<BUTTON";
  2048.     ScriptButtonHTML += " CLASS=\"button\"";
  2049.     ScriptButtonHTML += " NAME=\"" + this.Name + "\"";
  2050.     ScriptButtonHTML += " ID=\"" + this.Name + "\"";
  2051.     ScriptButtonHTML += " FIELDTYPE=\"" + this.Type + "\"";
  2052.     ScriptButtonHTML += (this.IsHidden ? " ISHIDDEN" : "");
  2053.     ScriptButtonHTML += (this.Center ? " ALIGN=\"center\"" : "");
  2054.     ScriptButtonHTML += (this.OnClickScript != "" ? " ONCLICK=\"" + this.OnClickScript.replace(/\"/g, "'") + "\"" : "");
  2055.     if (g_IsSearch)
  2056.         ScriptButtonHTML += " DISABLED";
  2057.     ScriptButtonHTML += ">";
  2058.     ScriptButtonHTML += this.ButtonText;
  2059.     ScriptButtonHTML += "</BUTTON>";
  2060.  
  2061.     return ScriptButtonHTML;
  2062. }
  2063.  
  2064. // ============================================ \\
  2065. // ===             Image Static             === \\
  2066. // ============================================ \\
  2067.  
  2068. function ImageField(i_Name, i_Container)
  2069. {
  2070.     if (arguments.length > 0)
  2071.         this.initStatic(i_Name, i_Container);
  2072.  
  2073.     this.ID = -1;
  2074.     this.BorderSize = "";
  2075.     this.AltText = "";
  2076.     this.Center = false;
  2077.     this.Type = FormObjectType_Image;
  2078. }
  2079.  
  2080. ImageField.prototype = new Static;
  2081. ImageField.prototype.getBody = ImageField_getBody;
  2082.  
  2083. function ImageField_getBody()
  2084. {
  2085.     var ImageHTML = "<IMG";
  2086.     ImageHTML += " NAME=\"" + this.Name + "\"";
  2087.     ImageHTML += " ID=\"" + this.Name + "\"";
  2088.     ImageHTML += " SRC=\"" + getImageBindableURLByID(this.ID) + "\"";
  2089.     ImageHTML += " FIELDTYPE=\"" + this.Type + "\"";
  2090.     ImageHTML += (this.IsHidden ? " ISHIDDEN" : "");
  2091.     ImageHTML += (this.Center ? " ALIGN=\"center\"" : "");
  2092.     ImageHTML += " BORDER=\"" + this.BorderSize + "\"";
  2093.     ImageHTML += " TITLE=\"" + this.AltText + "\">";
  2094.  
  2095.     return ImageHTML;
  2096. }
  2097.  
  2098. // ============================================ \\
  2099. // ===            Unknown Static            === \\
  2100. // ============================================ \\
  2101.  
  2102. function UnknownField(i_Name, i_Container)
  2103. {
  2104.     if (arguments.length > 0)
  2105.         this.initStatic(i_Name, i_Container);
  2106.         
  2107.     this.Type = FormObjectType_Unknown;
  2108. }
  2109.  
  2110. UnknownField.prototype = new Static;
  2111. UnknownField.prototype.getBody = function()
  2112. {
  2113.     var UnknownHTML = "<DIV";
  2114.     UnknownHTML += " STYLE=\"border:2px solid black; padding:4px; background-color:white; color:black;\">";
  2115.     UnknownHTML += "An unknown field from a future version of Forms has been added to this form. Please upgrade to the latest version of Groove to enable the field '" + this.Name + "'.";
  2116.     UnknownHTML += "</DIV>";
  2117.     return UnknownHTML;
  2118. }
  2119.  
  2120. // ============================================ \\
  2121. // ===             Command Bar              === \\
  2122. // ============================================ \\
  2123.  
  2124. function CommandBar(i_FieldName, i_Width)
  2125. {
  2126.     this.Name = i_FieldName + "_commandbar";
  2127.     this.Width = i_Width;
  2128.     this.Commands = new Array();
  2129. }
  2130. CommandBar.prototype.addCommand = function (i_Command) { this.Commands.push(i_Command); }
  2131. CommandBar.prototype.addSeparator = function() { this.Commands.push(null); }
  2132. CommandBar.prototype.getBody = function ()
  2133. {
  2134.     var CommandBarHTML = '<TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0" ID="' + this.Name + '" NAME="' + this.Name + '" STYLE="' + this.Width + ';" CLASS="commandbar"><TR>';
  2135.  
  2136.     for (var i = 0; i < this.Commands.length; i++)
  2137.     {
  2138.         var objCommand = this.Commands[i];
  2139.         CommandBarHTML += '<TD';
  2140.  
  2141.         if (objCommand != null)
  2142.         {
  2143.             CommandBarHTML += ' CLASS="command"';
  2144.             CommandBarHTML += ' ID="' + objCommand.ID + '"';
  2145.             CommandBarHTML += ' TITLE="' + objCommand.Tooltip + '"';
  2146.             CommandBarHTML += ' ONCLICK="if (!this.getAttribute(\'COMMANDDISABLED\')) { ' + objCommand.Action + '; }"';
  2147.             CommandBarHTML += ' ONMOUSEOVER="commandMouseOver(this);"';
  2148.             CommandBarHTML += ' ONMOUSEOUT="commandMouseOut(this);"';
  2149.             CommandBarHTML += ' ONMOUSEDOWN="commandMouseDown(this);"';
  2150.             CommandBarHTML += ' ONMOUSEUP="commandMouseUp(this);">';
  2151.  
  2152.             CommandBarHTML += '<IMG';
  2153.             CommandBarHTML += ' SRC="' + objCommand.ImageURL + '"';
  2154.             CommandBarHTML += ' ID="' + objCommand.ID + 'Button"';
  2155.             CommandBarHTML += ' WIDTH="16"';
  2156.             CommandBarHTML += ' HEIGHT="16">';
  2157.         }
  2158.         else
  2159.         {
  2160.             CommandBarHTML += ' WIDTH="6">';
  2161.  
  2162.             CommandBarHTML += '<DIV';
  2163.             CommandBarHTML += ' CLASS="commandSep">';
  2164.             CommandBarHTML += '</DIV>';
  2165.         }
  2166.  
  2167.         CommandBarHTML += '</TD>';
  2168.     }
  2169.  
  2170.     CommandBarHTML += '<TD> </TD>';
  2171.     CommandBarHTML += '</TR></TABLE>';
  2172.     return CommandBarHTML;
  2173. }
  2174.  
  2175. function Command(i_ID, i_ImageURL, i_Tooltip, i_Action)
  2176. {
  2177.     this.ID = i_ID;
  2178.     this.ImageURL = i_ImageURL;
  2179.     this.Tooltip = i_Tooltip;
  2180.     this.Action = i_Action;
  2181. }
  2182.