0byt3m1n1
Path:
C:
/
Program Files (x86)
/
Microsoft Office
/
Office12
/
Groove
/
ToolData
/
groove.net
/
GrooveForms3
/
[
Home
]
File: FORM.JS
/********************************************************************* Notice You may not modify, use, copy or distribute this file or its contents. Internal interfaces referenced in this file are nonpublic, unsupported and subject to change without notice. These interfaces may not be utilized in other software applications or components. *********************************************************************/ // This is an enum of all types of objects that can be on a form. var FormObjectType_Unknown = -1; var FormObjectType_FieldGroup = 0; var FormObjectType_TabGroup = 1; var FormObjectType_Tab = 2; var FormObjectType_SystemField = 3; var FormObjectType_Text = 4; var FormObjectType_MultiLineText = 5; var FormObjectType_UnformattedNumber = 6; var FormObjectType_Number = 7; var FormObjectType_Currency = 8; var FormObjectType_Date = 9; var FormObjectType_DateTime = 10; var FormObjectType_CheckBox = 11; var FormObjectType_Password = 12; var FormObjectType_OptionButtons = 13; var FormObjectType_DropDownList = 14; var FormObjectType_ListBox = 15; var FormObjectType_RichText = 16; var FormObjectType_EmbeddedView = 17; var FormObjectType_DigitalInk = 18; var FormObjectType_Attachments = 19; var FormObjectType_StaticText = 20; var FormObjectType_FormHeading = 21; var FormObjectType_SectionHeading = 22; var FormObjectType_HorizontalLine = 23; var FormObjectType_NewLine = 24; var FormObjectType_ScriptButton = 25; var FormObjectType_Image = 26; // ============================================ \\ // === Field Container Class === \\ // ============================================ \\ function FieldContainer(i_IsHeading) { this.IsHeading = i_IsHeading; this.NumberOfColumns = 1; this.Fields = new Array(); this.FieldGroups = new Array(); this.TabGroups = new Array(); this.FormObjects = new Array(); this.IsInitialized = false; } FieldContainer.prototype.addField = function(i_Field) { this.Fields.push(i_Field); } FieldContainer.prototype.addSpacer = function() { this.Fields.push(null); } FieldContainer.prototype.addFieldGroup = function(i_FieldGroup) { this.FieldGroups.push(i_FieldGroup); } FieldContainer.prototype.addTabGroup = function(i_TabGroup) { this.TabGroups.push(i_TabGroup); } FieldContainer.prototype.displayFields = function() { document.write(getFields(this)); } function getFields(i_objContainer) { var strFields = ""; if (i_objContainer.Fields.length > 0) { var objTableNoFieldsInfo = document.getElementById("tableNoFieldsInfo"); if (objTableNoFieldsInfo != null) objTableNoFieldsInfo.style.display = "none"; var objDivHeadingFieldsContainer = document.getElementById("divHeadingFieldsContainer"); if (objDivHeadingFieldsContainer != null) objDivHeadingFieldsContainer.style.display = "inline"; var objDivFieldsContainer = document.getElementById("divFieldsContainer"); if (objDivFieldsContainer != null) objDivFieldsContainer.style.display = "inline"; if (!i_objContainer.IsInitialized) { // Remove field group shared cells from the total cell count. for (var i = 0; i < i_objContainer.FieldGroups.length; i++) { for (var j = 0; j < i_objContainer.FieldGroups[i].FieldNames.length; j++) { var FieldName = i_objContainer.FieldGroups[i].FieldNames[j]; if (eval("typeof obj" + FieldName) != "undefined") { var Field = eval("obj" + FieldName); i_objContainer.FieldGroups[i].addField(Field); Field.FieldGroup = i_objContainer.FieldGroups[i]; } } } // Remove tab group shared cells from the total cell count. for (var i = 0; i < i_objContainer.TabGroups.length; i++) { for (var j = 0; j < i_objContainer.TabGroups[i].Tabs.length; j++) { for (var k = 0; k < i_objContainer.TabGroups[i].Tabs[j].FieldNames.length; k++) { var FieldName = i_objContainer.TabGroups[i].Tabs[j].FieldNames[k]; if (eval("typeof obj" + FieldName) != "undefined") { var Field = eval("obj" + FieldName); i_objContainer.TabGroups[i].Tabs[j].addField(Field); Field.TabGroup = i_objContainer.TabGroups[i]; Field.Tab = i_objContainer.TabGroups[i].Tabs[j]; } } } } // Set up ordered array of form objects. var FormObjectArray = new Array(); for (var i = 0; i < i_objContainer.Fields.length; i++) { var Field = i_objContainer.Fields[i]; if (Field.FieldGroup != null) { if (Field.FieldGroup.TabGroup != null) { if (!isFormObjectInArray(Field.FieldGroup.TabGroup.Name, FormObjectArray)) FormObjectArray.push(Field.FieldGroup.TabGroup); continue; } if (!isFormObjectInArray(Field.FieldGroup.Name, FormObjectArray)) FormObjectArray.push(Field.FieldGroup); } else if (Field.TabGroup != null) { if (!isFormObjectInArray(Field.TabGroup.Name, FormObjectArray)) FormObjectArray.push(Field.TabGroup); } else { if (!isFormObjectInArray(Field.Name, FormObjectArray)) FormObjectArray.push(Field); } } i_objContainer.FormObjects = FormObjectArray; i_objContainer.IsInitialized = true; } strFields += getTableHTML(i_objContainer); } else if (g_IsViewSource) { var objTableNoFieldsInfo = document.getElementById("tableNoFieldsInfo"); if (objTableNoFieldsInfo != null) objTableNoFieldsInfo.style.display = "none"; } if (g_IsViewSource) return strFields.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, "><br>"); else return strFields; } function getTableHTML(i_objContainer) { var TableHTML = ""; var FieldsCountArray = i_objContainer.Fields; // Get the cell count by adding up all column and row spans. var CellCount = 0; var ColumnCount = i_objContainer.NumberOfColumns; if (ColumnCount == 0 || ColumnCount == -1) ColumnCount = 1; for (var FieldCount = 0; FieldCount < FieldsCountArray.length; FieldCount++) { var CurrentField = FieldsCountArray[FieldCount]; var ColumnSpan = getColumnSpan(CurrentField); var RowSpan = getRowSpan(CurrentField); if (ColumnCount <= ColumnSpan) ColumnSpan = ColumnCount; if (ColumnCount == 1) RowSpan = 1; CellCount += ColumnSpan * RowSpan; } var WidthAttribute = ""; var IdAttribute = ""; if (i_objContainer instanceof FieldContainer) { // Remove field group shared cells from the total cell count. for (var i = 0; i < i_objContainer.FieldGroups.length; i++) { CellCount -= i_objContainer.FieldGroups[i].Fields.length - 1; } // Remove tab group shared cells from the total cell count. for (var i = 0; i < i_objContainer.TabGroups.length; i++) { for (var j = 0; j < i_objContainer.TabGroups[i].Tabs.length; j++) { CellCount -= i_objContainer.TabGroups[i].Tabs[j].Fields.length - 1; } } if (i_objContainer.IsHeading) { WidthAttribute = " WIDTH=\"100%\""; IdAttribute = " ID=\"HeadingTable\""; } else IdAttribute = " ID=\"FieldsTable\""; } var BorderAttribute = " BORDER=\"0\""; if (g_ShowBorder) BorderAttribute = " BORDER=\"2\""; TableHTML += "<TABLE CELLPADDING=\"3\" CELLSPACING=\"0\"" + IdAttribute + BorderAttribute + WidthAttribute + "><TR>"; // Get the row counts from the column and cell counts, and init the array. var RowCount = Math.round(CellCount / ColumnCount); var RowTotalArray = new Array(RowCount); for (var i = 0; i < RowTotalArray.length; i++) { RowTotalArray[i] = 0; } var FieldsArray = new Array(); if (i_objContainer instanceof Tab) FieldsArray = i_objContainer.Fields; else if (i_objContainer instanceof FieldContainer) FieldsArray = i_objContainer.FormObjects; var ColumnTotal = 0; var CurrentRow = 0; for (var FieldCount = 0; FieldCount < FieldsArray.length; FieldCount++) { // Check to see if we should go to a new row or not. if (ColumnTotal >= ColumnCount || RowTotalArray[CurrentRow] >= ColumnCount) { TableHTML += "</TR><TR>"; ColumnTotal = 0; CurrentRow++; } // Display the field label and body. var CurrentField = FieldsArray[FieldCount]; // Make sure there are no fields that are wider than the layout. if (getColumnSpan(CurrentField) > ColumnCount) CurrentField.ColumnSpan = ColumnCount - ColumnTotal; // Make sure there are no fields with a row span if there is only one column. if (ColumnCount == 1 && getRowSpan(CurrentField) > 1) CurrentField.RowSpan = 1; // Get the cell HTML for the field. TableHTML += getFieldCellHTML(CurrentField, i_objContainer); // Update the row and column totals. var CurrentFieldColumnSpan = 1; var CurrentFieldRowSpan = 1; if (CurrentField != null) { CurrentFieldColumnSpan = getColumnSpan(CurrentField); CurrentFieldRowSpan = getRowSpan(CurrentField); } // Update the current column total. ColumnTotal += CurrentFieldColumnSpan; // Update total of all rows this field is in. for (var i = 0; i < CurrentFieldRowSpan; i++) { RowTotalArray[CurrentRow + i] += CurrentFieldColumnSpan; } // Check to see if we should go to a new row or not. if (ColumnTotal >= ColumnCount || RowTotalArray[CurrentRow] >= ColumnCount) { TableHTML += "</TR><TR>"; ColumnTotal = 0; CurrentRow++; } } TableHTML += "</TR></TABLE>"; return TableHTML; } function getFieldCellHTML(i_FormObject, i_objContainer) { var FieldCellHTML = ""; if (i_FormObject != null) { if (i_FormObject.Type == FormObjectType_TabGroup) { var StyleAttribute = ""; if (i_FormObject.IsHidden || (g_IsReadOnly && i_FormObject.Type == FormObjectType_Attachments)) StyleAttribute = " STYLE=\"display:none;\""; var FieldBodyHTML = "<TABLE CELLPADDING=\"0\" CELLSPACING=\"0\" BORDER=\"0\" WIDTH=\"100%\"" + StyleAttribute + "><TR>"; if (i_FormObject.Tabs.length > 1) { FieldBodyHTML += "<TD>"; for (var i = 0; i < i_FormObject.Tabs.length; i++) { var Tab = i_FormObject.Tabs[i]; var ClassAttribute = " CLASS=\""; if (i == 0) { i_FormObject.ActiveTabName = Tab.Name; ClassAttribute += "activeTab"; } else ClassAttribute += "inactiveTab"; 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>"; } FieldBodyHTML += "</TD></TR><TR>"; } FieldBodyHTML += "<TD CLASS=\"tabContents\">"; for (var i = 0; i < i_FormObject.Tabs.length; i++) { var Tab = i_FormObject.Tabs[i]; var StyleAttribute = " STYLE=\"display:none; width:100%;\""; if (i_FormObject.ActiveTabName == Tab.Name || (i == 0 && i_FormObject.ActiveTabName == "")) StyleAttribute = " STYLE=\"width:100%;\""; FieldBodyHTML += "<DIV OBJECTTYPE=\"TabContents\" ID=\"" + Tab.Name + "Contents\"" + StyleAttribute + ">"; FieldBodyHTML += getTableHTML(Tab); FieldBodyHTML += "</DIV>"; } FieldBodyHTML += "</TD></TR></TABLE>"; // The CLASS attribute for the TD tag. var ClassAttribute = ""; if (i_FormObject.ClassName != "") ClassAttribute = " CLASS=\"" + i_FormObject.ClassName + "\""; // The common attributes for label and field TD tags. var LabelAttributes = " VALIGN=\"top\" ID=\"" + i_FormObject.Name + "_label\"" + ClassAttribute; var FieldAttributes = " VALIGN=\"top\" ID=\"" + i_FormObject.Name + "_field\"" + ClassAttribute; // The COLSPAN attribute for the TD tag. var ColumnSpan = getSpanAttribute("COLSPAN", getColumnSpan(i_FormObject) * 2); // The ROWSPAN attribute for the TD tag. var RowSpan = getSpanAttribute("ROWSPAN", getRowSpan(i_FormObject)); // The COLSPAN attribute for the TD tag. var FieldColumnSpan = getSpanAttribute("COLSPAN", (getColumnSpan(i_FormObject) * 2) - 1); // The FONT tag containing the field label. var FieldLabel = "<FONT CLASS=\"fieldLabel\">" + i_FormObject.Label + "</FONT>"; switch (i_FormObject.LabelPosition) { case "Right": FieldCellHTML += "<TD" + FieldAttributes + RowSpan + ">" + FieldBodyHTML + "</TD>"; FieldCellHTML += "<TD" + LabelAttributes + FieldColumnSpan + RowSpan + ">" + FieldLabel + "</TD>"; break; case "Top": FieldCellHTML += "<TD" + FieldAttributes + ColumnSpan + RowSpan + ">" + ((i_FormObject.Label != "") ? FieldLabel + "<BR>" : "") + FieldBodyHTML + "</TD>"; break; default: FieldCellHTML += "<TD" + LabelAttributes + RowSpan + ">" + FieldLabel + "</TD>"; FieldCellHTML += "<TD" + FieldAttributes + FieldColumnSpan + RowSpan + ">" + FieldBodyHTML + "</TD>"; break; } } else { var FieldBodyHTML = ""; if (i_FormObject.Type == FormObjectType_FieldGroup) FieldBodyHTML = getFieldGroupBody(i_FormObject, false); else FieldBodyHTML = i_FormObject.getBody() + getImageTag(i_FormObject); // The STYLE attribute for TD tags. var FieldStyleAttribute = ""; var LabelStyleAttribute = ""; // Hide fields that should be hidden. if (i_FormObject.IsHidden || (g_IsReadOnly && i_FormObject.Type == FormObjectType_Attachments)) { FieldStyleAttribute += " STYLE=\"display:none;\""; LabelStyleAttribute += " STYLE=\"display:none;\""; } // The CLASS attribute for the TD tags. var ClassAttribute = ""; if (i_FormObject.ClassName != "") ClassAttribute = " CLASS=\"" + i_FormObject.ClassName + "\""; // The common attributes for label and field TD tags. var LabelAttributes = " VALIGN=\"top\" ID=\"" + i_FormObject.Name + "_label\"" + ClassAttribute; var FieldAttributes = " VALIGN=\"top\" ID=\"" + i_FormObject.Name + "_field\"" + ClassAttribute; // The COLSPAN attribute for the TD tag. var ColumnSpan = getSpanAttribute("COLSPAN", getColumnSpan(i_FormObject) * 2); // The ROWSPAN attribute for the TD tag. var RowSpan = getSpanAttribute("ROWSPAN", getRowSpan(i_FormObject)); if (i_FormObject instanceof Static) { FieldCellHTML += "<TD" + FieldAttributes + FieldStyleAttribute + ColumnSpan + RowSpan + ">" + FieldBodyHTML + "</TD>"; } else { // The COLSPAN attribute for the TD tag. var FieldColumnSpan = getSpanAttribute("COLSPAN", (getColumnSpan(i_FormObject) * 2) - 1); // The FONT tag containing the field label. var FieldLabel = "<FONT CLASS=\"fieldLabel\">" + i_FormObject.Label + i_FormObject.getRequired() + "</FONT>"; switch (i_FormObject.LabelPosition) { case "Right": FieldCellHTML += "<TD" + FieldAttributes + FieldStyleAttribute + RowSpan + ">" + FieldBodyHTML + "</TD>"; FieldCellHTML += "<TD" + LabelAttributes + LabelStyleAttribute + FieldColumnSpan + RowSpan + ">" + FieldLabel + "</TD>"; break; case "Top": FieldCellHTML += "<TD" + FieldAttributes + FieldStyleAttribute + ColumnSpan + RowSpan + ">" + ((i_FormObject.Label != "" || i_FormObject.getRequired() != "") ? FieldLabel + "<BR>" : "") + FieldBodyHTML + "</TD>"; break; default: FieldCellHTML += "<TD" + LabelAttributes + LabelStyleAttribute + RowSpan + ">" + FieldLabel + "</TD>"; FieldCellHTML += "<TD" + FieldAttributes + FieldStyleAttribute + FieldColumnSpan + RowSpan + ">" + FieldBodyHTML + "</TD>"; break; } } } } else { FieldCellHTML += "<TD COLSPAN=\"2\"></TD>"; } return FieldCellHTML; } function getFieldGroupBody(i_FieldGroup, i_bIsPreview) { var FieldBodyHTML = ""; for (var i = 0; i < i_FieldGroup.Fields.length; i++) { var Field = i_FieldGroup.Fields[i]; var LabelSpanTag = "<FONT ID=\"" + Field.Name + "_label\" STYLE=\"padding-right:2px;"; var FieldSpanTag = "<SPAN ID=\"" + Field.Name + "_field\" STYLE=\"padding-right:6px;"; if (Field.IsHidden) { LabelSpanTag += "display:none;"; FieldSpanTag += "display:none;"; } LabelSpanTag += "\""; FieldSpanTag += "\""; // The ONCLICK and ONMOUSEOVER attributes for the SPAN tags. var OnClickAttribute = ""; var OnMouseOverAttribute = ""; var TitleAttribute = ""; if (i_bIsPreview) { OnClickAttribute = " ONCLICK=\"if (typeof obj" + Field.Name + " != 'undefined') { selectField(obj" + Field.Name + "); }\""; OnMouseOverAttribute = " ONMOUSEOVER=\"if (typeof obj" + Field.Name + " != 'undefined') { hoverField(obj" + Field.Name + "); }\""; TitleAttribute = " TITLE=\"Click to select this field: " + Field.Name + "\""; } LabelSpanTag += OnClickAttribute + OnMouseOverAttribute + TitleAttribute + ">"; FieldSpanTag += OnClickAttribute + OnMouseOverAttribute + TitleAttribute + ">"; if (Field instanceof Static) { FieldBodyHTML += FieldSpanTag + Field.getBody() + "</SPAN>"; } else { var ImgTag = ""; if (!i_bIsPreview) ImgTag = getImageTag(Field); switch (Field.LabelPosition) { case "Right": FieldBodyHTML += FieldSpanTag + Field.getBody() + ImgTag + "</SPAN>" + LabelSpanTag + Field.getRequired() + Field.Label + "</FONT>"; break; case "Top": if (i >= 1) FieldBodyHTML += "<BR>"; FieldBodyHTML += LabelSpanTag + Field.Label + Field.getRequired() + "</FONT><BR>" + FieldSpanTag + Field.getBody() + ImgTag + "</SPAN>"; break; default: FieldBodyHTML += LabelSpanTag + Field.Label + Field.getRequired() + "</FONT>" + FieldSpanTag + Field.getBody() + ImgTag + "</SPAN>"; break; } } } return FieldBodyHTML; } function getImageTag(i_FormObject) { if (i_FormObject instanceof Static || i_FormObject.Type == FormObjectType_SystemField || i_FormObject.Type == FormObjectType_Attachments) return ""; else return "<IMG SRC=\"error.gif\" WIDTH=\"12\" HEIGHT=\"12\" STYLE=\"position:absolute; z-index:1; display:none;\" ID=\"" + i_FormObject.Name + "_ErrorImage\">" } function getValidationScript(i_Type, i_Parameter) { i_Parameter = i_Parameter.replace(/\'/g, "\\'"); switch (i_Type) { // GrooveFormsToolFieldValidationType_IsSubStringPresent case 1: return " isSubStringPresent('" + i_Parameter + "', this);"; // GrooveFormsToolFieldValidationType_IsSubStringNotPresent case 2: return " isSubStringNotPresent('" + i_Parameter + "', this);"; // GrooveFormsToolFieldValidationType_AreAllSubStringsPresent case 3: return " areAllSubStringsPresent('" + i_Parameter + "', this);"; // GrooveFormsToolFieldValidationType_AreAnySubStringsPresent case 4: return " areAnySubStringsPresent('" + i_Parameter + "', this);"; // GrooveFormsToolFieldValidationType_AreNoSubStringsPresent case 5: return " areNoSubStringsPresent('" + i_Parameter + "', this);"; // GrooveFormsToolFieldValidationType_IsValidEmailAddress case 6: return " isValidEmailAddress(this);"; // GrooveFormsToolFieldValidationType_IsValidUSZipCode case 7: return " isValidUSZipCode(this);"; // GrooveFormsToolFieldValidationType_IsValidPassword case 8: return " isValidPassword(this);"; // GrooveFormsToolFieldValidationType_MinimumLength case 9: return " isMinimumLength('" + i_Parameter + "', this);"; // GrooveFormsToolFieldValidationType_MaximumLength case 10: return " isMaximumLength('" + i_Parameter + "', this);"; // GrooveFormsToolFieldValidationType_IsAlphabeticCharacters case 11: return " isAlpha(this);"; // GrooveFormsToolFieldValidationType_HasAlphabeticCharacters case 12: return " hasAlpha(this);"; // GrooveFormsToolFieldValidationType_IsNumericCharacters case 13: return " isNumeric(this);"; // GrooveFormsToolFieldValidationType_HasNumericCharacters case 14: return " hasNumeric(this);"; // GrooveFormsToolFieldValidationType_RegularExpression case 15: return " regularExpression('" + i_Parameter + "', this);"; default: return ""; } } function getColumnSpan(i_FormObject) { var ColumnSpan = 1; if (i_FormObject != null) { if (i_FormObject.ColumnSpan > 1) ColumnSpan = i_FormObject.ColumnSpan; } return ColumnSpan; } function getRowSpan(i_FormObject) { var RowSpan = 1; if (i_FormObject != null) { if (i_FormObject.RowSpan > 1) RowSpan = i_FormObject.RowSpan; } return RowSpan; } function getSpanAttribute(i_Type, i_Span) { var SpanAttribute = ""; if (i_Span > 1) SpanAttribute = " " + i_Type + "=\"" + i_Span + "\""; return SpanAttribute; } function getFieldWidthUnit(i_FieldWidth, i_FieldSizeType) { var WidthStyle = ""; if (i_FieldWidth.toString() != "") { switch (i_FieldSizeType) { case GrooveFormsToolFieldSizeType_Pixels: WidthStyle = i_FieldWidth + "px"; break; case GrooveFormsToolFieldSizeType_Percent: WidthStyle = i_FieldWidth + "%"; break; case GrooveFormsToolFieldSizeType_Characters: default: WidthStyle = (i_FieldWidth + 2) + "ex"; break; } WidthStyle = "width:" + WidthStyle + ";"; } return WidthStyle; } function getFieldHeightUnit(i_FieldHeight, i_FieldSizeType) { var HeightStyle = ""; if (i_FieldHeight.toString() != "") { switch (i_FieldSizeType) { case GrooveFormsToolFieldSizeType_Pixels: HeightStyle = i_FieldHeight + "px"; break; case GrooveFormsToolFieldSizeType_Percent: HeightStyle = i_FieldHeight + "%"; break; case GrooveFormsToolFieldSizeType_Characters: default: HeightStyle = (i_FieldHeight + 1) + "em"; break; } HeightStyle = "height:" + HeightStyle + ";"; } return HeightStyle; } function isFormObjectInArray(i_ObjectName, i_Array) { for (var j = 0; j < i_Array.length; j++) { if (i_Array[j].Name == i_ObjectName) return true; } return false; } // ============================================ \\ // === Field Group Class === \\ // ============================================ \\ function FieldGroup(i_Name, i_Fields, i_Container) { if (arguments.length > 0) this.initFieldGroup(i_Name, i_Fields, i_Container); this.Label = ""; this.LabelPosition = ""; this.IsHidden = false; this.ColumnSpan = 1; this.RowSpan = 1; this.ClassName = ""; this.Fields = new Array(); this.TabGroup = null; this.Type = FormObjectType_FieldGroup; } FieldGroup.prototype.initFieldGroup = FieldGroup_initFieldGroup; FieldGroup.prototype.addField = FieldGroup_addField; FieldGroup.prototype.getRequired = FieldGroup_getRequired; function FieldGroup_initFieldGroup(i_Name, i_Fields, i_Container) { this.Name = i_Name; if (i_Fields == "") this.FieldNames = new Array(); else this.FieldNames = i_Fields.split("|"); i_Container.addFieldGroup(this); } function FieldGroup_addField(i_Field) { this.Fields.push(i_Field); } function FieldGroup_getRequired() { return ""; } // ============================================ \\ // === Tab Group Class === \\ // ============================================ \\ function TabGroup(i_Name, i_Container) { if (arguments.length > 0) this.initTabGroup(i_Name, i_Container); this.Label = ""; this.LabelPosition = ""; this.IsHidden = false; this.ColumnSpan = 1; this.RowSpan = 1; this.ClassName = ""; this.Tabs = new Array(); this.ActiveTabName = ""; this.Type = FormObjectType_TabGroup; } TabGroup.prototype.initTabGroup = TabGroup_initTabGroup; TabGroup.prototype.addTab = TabGroup_addTab; TabGroup.prototype.getRequired = TabGroup_getRequired; function TabGroup_initTabGroup(i_Name, i_Container) { this.Name = i_Name; i_Container.addTabGroup(this); } function TabGroup_addTab(i_Tab) { this.Tabs.push(i_Tab); } function TabGroup_getRequired() { return ""; } // ============================================ \\ // === Tab Class === \\ // ============================================ \\ function Tab(i_Name, i_Fields, i_TabGroup) { if (arguments.length > 0) this.initTab(i_Name, i_Fields, i_TabGroup); this.Text = ""; this.NumberOfColumns = 1; this.Fields = new Array(); this.Type = FormObjectType_Tab; } Tab.prototype.initTab = Tab_initTab; Tab.prototype.addField = Tab_addField; function Tab_initTab(i_Name, i_Fields, i_TabGroup) { this.Name = i_Name; if (i_Fields == "") this.FieldNames = new Array(); else this.FieldNames = i_Fields.split("|"); i_TabGroup.addTab(this); } function Tab_addField(i_Field) { this.Fields.push(i_Field); } // ============================================ \\ // === Field Class === \\ // ============================================ \\ function Field() { this.Name = ""; this.Label = ""; this.LabelPosition = "Left"; this.IsHidden = false; this.ColumnSpan = 1; this.RowSpan = 1; this.IsReadOnly = false; this.IsRequired = false; this.IsPerIdentity = false; this.InheritFrom = ""; this.ClassName = ""; this.FieldGroup = null; this.TabGroup = null; this.Tab = null; } Field.prototype.initField = Field_initField; //Field.prototype.getRequired = Field_getRequired; function Field_initField(i_Name, i_Label, i_Container) { this.Name = i_Name; this.Label = i_Label; i_Container.addField(this); } Field.prototype.getRequired = function() { return ((this.IsRequired && ((!g_IsReadOnly && !g_IsPreviewPane) || g_IsFormPreview)) ? "<FONT STYLE=\"color:#FF0000; margin:0px 2px 0px 2px;\">*</FONT>" : ""); } // ============================================ \\ // === System Field === \\ // ============================================ \\ function SystemField(i_Name, i_Label, i_Container) { if (arguments.length > 0) this.initField(i_Name, i_Label, i_Container); this.Type = FormObjectType_SystemField; } SystemField.prototype = new Field; SystemField.prototype.getBody = SystemField_getBody; function SystemField_getBody() { return "<SPAN CLASS=\"system\" ID=\"" + this.Name + "\"></SPAN>"; } // ============================================ \\ // === Text Field === \\ // ============================================ \\ function TextField(i_Name, i_Label, i_Container) { if (arguments.length > 0) this.initField(i_Name, i_Label, i_Container); this.Width = ""; this.WidthType = GrooveFormsToolFieldSizeType_Characters; this.MaximumLength = ""; this.InitialTextType = 0; this.InitialTextFunction = ""; this.ValidationType = 0; this.ValidationParameter = ""; this.HasLookup = false; this.Type = FormObjectType_Text; } TextField.prototype = new Field; TextField.prototype.getBody = TextField_getBody; function TextField_getBody() { var TextHTML = ""; if (g_IsReadOnly && !g_IsFormPreview) { TextHTML = "<INPUT TYPE=\"text\" STYLE=\"display:none;\" FIELDTYPE=\"" + this.Type + "\" NAME=\"" + this.Name + "\" ID=\"" + this.Name + "\">"; TextHTML += "<SPAN CLASS=\"inputPreview\" ID=\"" + this.Name + "_preview\" STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) +"\"></SPAN>"; } else { TextHTML = "<INPUT"; TextHTML += " TYPE=\"text\""; TextHTML += " CLASS=\"text\""; TextHTML += " FIELDTYPE=\"" + this.Type + "\""; TextHTML += " NAME=\"" + this.Name + "\""; TextHTML += " ID=\"" + this.Name + "\""; TextHTML += " TABINDEX=\"1\""; //TextHTML += " LABEL=\"" + this.Label + "\""; TextHTML += " STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) +"\""; TextHTML += " MAXLENGTH=\"" + this.MaximumLength + "\""; TextHTML += " INITIALVALUETYPE=\"" + this.InitialTextType + "\""; TextHTML += " INITIALVALUEFUNCTION=\"" + this.InitialTextFunction + "\""; TextHTML += (this.IsHidden ? " ISHIDDEN" : ""); TextHTML += (this.IsRequired ? " ISREQUIRED" : ""); TextHTML += (this.IsReadOnly ? " ISREADONLY" : ""); TextHTML += (this.IsPerIdentity ? " ISPERIDENTITY" : ""); TextHTML += (this.HasLookup ? " LOOKUP" : ""); TextHTML += " INHERIT=\"" + this.InheritFrom + "\""; TextHTML += " ONBLUR=\"validateRequired(this);" + getValidationScript(this.ValidationType, this.ValidationParameter) + "\""; TextHTML += " ONKEYUP=\"setIsDirty()\">"; } return TextHTML; } // ============================================ \\ // === Multi-line Text Field === \\ // ============================================ \\ function MultiLineTextField(i_Name, i_Label, i_Container) { if (arguments.length > 0) this.initField(i_Name, i_Label, i_Container); this.Width = ""; this.WidthType = GrooveFormsToolFieldSizeType_Characters; this.Height = ""; this.HeightType = GrooveFormsToolFieldSizeType_Characters; this.ValidationType = 0; this.ValidationParameter = ""; this.HasLookup = false; this.Type = FormObjectType_MultiLineText; } MultiLineTextField.prototype = new Field; MultiLineTextField.prototype.getBody = MultiLineTextField_getBody; function MultiLineTextField_getBody() { var MultiLineTextHTML = ""; if (g_IsReadOnly && !g_IsFormPreview) { MultiLineTextHTML = "<TEXTAREA TYPE=\"text\" STYLE=\"display:none;\" FIELDTYPE=\"" + this.Type + "\" NAME=\"" + this.Name + "\" ID=\"" + this.Name + "\"></TEXTAREA>"; MultiLineTextHTML += "<SPAN CLASS=\"textareaPreview\" ID=\"" + this.Name + "_preview\" STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) + getFieldHeightUnit(this.Height, this.HeightType) + "\"></SPAN>"; } else { MultiLineTextHTML = "<TEXTAREA"; MultiLineTextHTML += " FIELDTYPE=\"" + this.Type + "\""; MultiLineTextHTML += " NAME=\"" + this.Name + "\""; MultiLineTextHTML += " ID=\"" + this.Name + "\""; MultiLineTextHTML += " TABINDEX=\"1\""; //MultiLineTextHTML += " LABEL=\"" + this.Label + "\""; MultiLineTextHTML += " STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) + getFieldHeightUnit(this.Height, this.HeightType) + "\""; MultiLineTextHTML += (this.IsHidden ? " ISHIDDEN" : ""); MultiLineTextHTML += (this.IsRequired ? " ISREQUIRED" : ""); MultiLineTextHTML += (this.IsReadOnly ? " ISREADONLY" : ""); MultiLineTextHTML += (this.IsPerIdentity ? " ISPERIDENTITY" : ""); MultiLineTextHTML += (this.HasLookup ? " LOOKUP" : ""); MultiLineTextHTML += " INHERIT=\"" + this.InheritFrom + "\""; MultiLineTextHTML += " ONBLUR=\"validateRequired(this);" + getValidationScript(this.ValidationType, this.ValidationParameter) + "\""; MultiLineTextHTML += " ONKEYUP=\"setIsDirty()\"></TEXTAREA>"; } return MultiLineTextHTML; } // ============================================ \\ // === Unformatted Number Field === \\ // ============================================ \\ function UnformattedNumberField(i_Name, i_Label, i_Container) { if (arguments.length > 0) this.initField(i_Name, i_Label, i_Container); this.Width = ""; this.WidthType = GrooveFormsToolFieldSizeType_Characters; this.MaximumLength = ""; this.MinimumValue = ""; this.MaximumValue = ""; this.Type = FormObjectType_UnformattedNumber; } UnformattedNumberField.prototype = new Field; UnformattedNumberField.prototype.getBody = UnformattedNumberField_getBody; function UnformattedNumberField_getBody() { var UnformattedNumberHTML = ""; if (g_IsReadOnly && !g_IsFormPreview) { UnformattedNumberHTML = "<INPUT TYPE=\"text\" STYLE=\"display:none;\" FIELDTYPE=\"" + this.Type + "\" NAME=\"" + this.Name + "\" ID=\"" + this.Name + "\" NOFORMAT DATATYPE=\"Numeric\">"; UnformattedNumberHTML += "<SPAN CLASS=\"inputPreview\" ID=\"" + this.Name + "_preview\" STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) +"\"></SPAN>"; } else { UnformattedNumberHTML = "<INPUT"; UnformattedNumberHTML += " TYPE=\"text\""; UnformattedNumberHTML += " CLASS=\"text\""; UnformattedNumberHTML += " FIELDTYPE=\"" + this.Type + "\""; UnformattedNumberHTML += " NAME=\"" + this.Name + "\""; UnformattedNumberHTML += " ID=\"" + this.Name + "\""; UnformattedNumberHTML += " TABINDEX=\"1\""; //UnformattedNumberHTML += " LABEL=\"" + this.Label + "\""; UnformattedNumberHTML += " STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) +"\""; UnformattedNumberHTML += " MAXLENGTH=\"" + this.MaximumLength + "\""; UnformattedNumberHTML += (this.IsHidden ? " ISHIDDEN" : ""); UnformattedNumberHTML += (this.IsRequired ? " ISREQUIRED" : ""); UnformattedNumberHTML += (this.IsReadOnly ? " ISREADONLY" : ""); UnformattedNumberHTML += (this.IsPerIdentity ? " ISPERIDENTITY" : ""); UnformattedNumberHTML += " INHERIT=\"" + this.InheritFrom + "\""; UnformattedNumberHTML += " MIN=\"" + this.MinimumValue + "\""; UnformattedNumberHTML += " MAX=\"" + this.MaximumValue + "\""; UnformattedNumberHTML += " NOFORMAT"; UnformattedNumberHTML += " ONBLUR=\"validateRequired(this); validateNumeric(this);\""; UnformattedNumberHTML += " ONKEYUP=\"setIsDirty()\""; UnformattedNumberHTML += " DATATYPE=\"Numeric\">"; } return UnformattedNumberHTML; } // ============================================ \\ // === Number Field === \\ // ============================================ \\ function NumberField(i_Name, i_Label, i_Container) { if (arguments.length > 0) this.initField(i_Name, i_Label, i_Container); this.Precision = 2; this.Type = FormObjectType_Number; } NumberField.prototype = new UnformattedNumberField; NumberField.prototype.getBody = NumberField_getBody; function NumberField_getBody() { var NumberHTML = ""; if (g_IsReadOnly && !g_IsFormPreview) { NumberHTML = "<INPUT TYPE=\"text\" STYLE=\"display:none;\" FIELDTYPE=\"" + this.Type + "\" NAME=\"" + this.Name + "\" ID=\"" + this.Name + "\" PRECISION=\"" + this.Precision + "\" DATATYPE=\"Numeric\">"; NumberHTML += "<SPAN CLASS=\"inputPreview\" ID=\"" + this.Name + "_preview\" STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) +"\"></SPAN>"; } else { NumberHTML = "<INPUT"; NumberHTML += " TYPE=\"text\""; NumberHTML += " CLASS=\"text\""; NumberHTML += " FIELDTYPE=\"" + this.Type + "\""; NumberHTML += " NAME=\"" + this.Name + "\""; NumberHTML += " ID=\"" + this.Name + "\""; NumberHTML += " TABINDEX=\"1\""; //NumberHTML += " LABEL=\"" + this.Label + "\""; NumberHTML += " STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) +"\""; NumberHTML += " MAXLENGTH=\"" + this.MaximumLength + "\""; NumberHTML += (this.IsHidden ? " ISHIDDEN" : ""); NumberHTML += (this.IsRequired ? " ISREQUIRED" : ""); NumberHTML += (this.IsReadOnly ? " ISREADONLY" : ""); NumberHTML += (this.IsPerIdentity ? " ISPERIDENTITY" : ""); NumberHTML += " INHERIT=\"" + this.InheritFrom + "\""; NumberHTML += " PRECISION=\"" + this.Precision + "\""; NumberHTML += " MIN=\"" + this.MinimumValue + "\""; NumberHTML += " MAX=\"" + this.MaximumValue + "\""; NumberHTML += " ONBLUR=\"validateRequired(this); if (validateNumeric(this)) { formatNumeric(this); }\""; NumberHTML += " ONKEYUP=\"setIsDirty()\""; NumberHTML += " DATATYPE=\"Numeric\">"; } return NumberHTML; } // ============================================ \\ // === Currency Field === \\ // ============================================ \\ function CurrencyField(i_Name, i_Label, i_Container) { if (arguments.length > 0) this.initField(i_Name, i_Label, i_Container); this.Symbol = "$"; this.Precision = 2; this.Type = FormObjectType_Currency; } CurrencyField.prototype = new UnformattedNumberField; CurrencyField.prototype.getBody = CurrencyField_getBody; function CurrencyField_getBody() { var CurrencyHTML = ""; if (g_IsReadOnly && !g_IsFormPreview) { CurrencyHTML = "<INPUT TYPE=\"text\" STYLE=\"display:none;\" FIELDTYPE=\"" + this.Type + "\" NAME=\"" + this.Name + "\" ID=\"" + this.Name + "\" PRECISION=\"" + this.Precision + "\" SYMBOL=\"" + this.Symbol + "\" DATATYPE=\"Numeric\">"; CurrencyHTML += "<SPAN CLASS=\"inputPreview\" ID=\"" + this.Name + "_preview\" STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) +"\"></SPAN>"; } else { CurrencyHTML = "<INPUT"; CurrencyHTML += " TYPE=\"text\""; CurrencyHTML += " CLASS=\"text\""; CurrencyHTML += " FIELDTYPE=\"" + this.Type + "\""; CurrencyHTML += " NAME=\"" + this.Name + "\""; CurrencyHTML += " ID=\"" + this.Name + "\""; CurrencyHTML += " TABINDEX=\"1\""; //CurrencyHTML += " LABEL=\"" + this.Label + "\""; CurrencyHTML += " STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) +"\""; CurrencyHTML += " MAXLENGTH=\"" + this.MaximumLength + "\""; CurrencyHTML += (this.IsHidden ? " ISHIDDEN" : ""); CurrencyHTML += (this.IsRequired ? " ISREQUIRED" : ""); CurrencyHTML += (this.IsReadOnly ? " ISREADONLY" : ""); CurrencyHTML += (this.IsPerIdentity ? " ISPERIDENTITY" : ""); CurrencyHTML += " INHERIT=\"" + this.InheritFrom + "\""; CurrencyHTML += " PRECISION=\"" + this.Precision + "\""; CurrencyHTML += " MIN=\"" + this.MinimumValue + "\""; CurrencyHTML += " MAX=\"" + this.MaximumValue + "\""; CurrencyHTML += " SYMBOL=\"" + this.Symbol + "\""; CurrencyHTML += " ONBLUR=\"validateRequired(this); if (validateNumeric(this)) { formatCurrency(this); }\""; CurrencyHTML += " ONKEYUP=\"setIsDirty()\""; CurrencyHTML += " DATATYPE=\"Numeric\">"; } return CurrencyHTML; } // ============================================ \\ // === Date Field === \\ // ============================================ \\ function DateField(i_Name, i_Label, i_Container) { if (arguments.length > 0) this.initField(i_Name, i_Label, i_Container); this.Width = 30; this.WidthType = GrooveFormsToolFieldSizeType_Characters; this.MaximumLength = ""; this.InitialDateType = 0; this.InitialDateFunction = ""; this.EarliestDate = ""; this.LatestDate = ""; this.Format = ""; this.Type = FormObjectType_Date; } DateField.prototype = new Field; DateField.prototype.getBody = DateField_getBody; function DateField_getBody() { var DateHTML = ""; if (g_IsReadOnly && !g_IsFormPreview) { DateHTML = "<INPUT TYPE=\"text\" STYLE=\"display:none;\" FIELDTYPE=\"" + this.Type + "\" NAME=\"" + this.Name + "\" ID=\"" + this.Name + "\" FORMAT=\"" + this.Format + "\" DATATYPE=\"Date\">"; DateHTML += "<SPAN CLASS=\"inputPreview\" ID=\"" + this.Name + "_preview\" STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) +"\"></SPAN>"; } else { DateHTML = "<INPUT"; DateHTML += " TYPE=\"text\""; DateHTML += " CLASS=\"text\""; DateHTML += " FIELDTYPE=\"" + this.Type + "\""; DateHTML += " NAME=\"" + this.Name + "\""; DateHTML += " ID=\"" + this.Name + "\""; DateHTML += " TABINDEX=\"1\""; //DateHTML += " LABEL=\"" + this.Label + "\""; DateHTML += " STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) +"\""; DateHTML += " MAXLENGTH=\"" + this.MaximumLength + "\""; DateHTML += " INITIALVALUETYPE=\"" + this.InitialDateType + "\""; DateHTML += " INITIALVALUEFUNCTION=\"" + this.InitialDateFunction + "\""; DateHTML += (this.IsHidden ? " ISHIDDEN" : ""); DateHTML += (this.IsRequired ? " ISREQUIRED" : ""); DateHTML += (this.IsReadOnly ? " ISREADONLY" : ""); DateHTML += (this.IsPerIdentity ? " ISPERIDENTITY" : ""); DateHTML += " INHERIT=\"" + this.InheritFrom + "\""; DateHTML += " MIN=\"" + this.EarliestDate + "\""; DateHTML += " MAX=\"" + this.LatestDate + "\""; DateHTML += " FORMAT=\"" + this.Format + "\""; DateHTML += " ONBLUR=\"validateRequired(this); if (validateDate(this)) { cleanDate(this); formatDate(this); }\""; DateHTML += " ONKEYUP=\"setIsDirty()\""; DateHTML += " DATATYPE=\"Date\">"; if (!this.IsReadOnly || g_IsSearch) { DateHTML += "<BUTTON CLASS=\"dateButton\""; DateHTML += " NAME=\"" + this.Name + "Button\""; DateHTML += " ID=\"" + this.Name + "Button\""; DateHTML += " TABINDEX=\"1\""; DateHTML += " ONCLICK=\"doCalendar('" + this.Name + "');\">"; DateHTML += "<IMG SRC=\"calendar.gif\" WIDTH=15 HEIGHT=13>"; DateHTML += "</BUTTON>"; } } return DateHTML; } // ============================================ \\ // === Date Time Field === \\ // ============================================ \\ function DateTimeField(i_Name, i_Label, i_Container) { if (arguments.length > 0) this.initField(i_Name, i_Label, i_Container); this.Width = 30; this.WidthType = GrooveFormsToolFieldSizeType_Characters; this.MaximumLength = ""; this.InitialDateType = 0; this.InitialDateFunction = ""; this.EarliestDate = ""; this.LatestDate = ""; this.Format = ""; this.Type = FormObjectType_DateTime; } DateTimeField.prototype = new Field; DateTimeField.prototype.getBody = DateTimeField_getBody; function DateTimeField_getBody() { var DateTimeHTML = ""; if (g_IsReadOnly && !g_IsFormPreview) { DateTimeHTML = "<INPUT TYPE=\"text\" STYLE=\"display:none;\" FIELDTYPE=\"" + this.Type + "\" NAME=\"" + this.Name + "\" ID=\"" + this.Name + "\" FORMAT=\"" + this.Format + "\" DATATYPE=\"Date\">"; DateTimeHTML += "<SPAN CLASS=\"inputPreview\" ID=\"" + this.Name + "_preview\" STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) +"\"></SPAN>"; } else { DateTimeHTML = "<INPUT"; DateTimeHTML += " TYPE=\"text\""; DateTimeHTML += " CLASS=\"text\""; DateTimeHTML += " FIELDTYPE=\"" + this.Type + "\""; DateTimeHTML += " NAME=\"" + this.Name + "\""; DateTimeHTML += " ID=\"" + this.Name + "\""; DateTimeHTML += " TABINDEX=\"1\""; //DateTimeHTML += " LABEL=\"" + this.Label + "\""; DateTimeHTML += " STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) +"\""; DateTimeHTML += " MAXLENGTH=\"" + this.MaximumLength + "\""; DateTimeHTML += " INITIALVALUETYPE=\"" + this.InitialDateType + "\""; DateTimeHTML += " INITIALVALUEFUNCTION=\"" + this.InitialDateFunction + "\""; DateTimeHTML += (this.IsHidden ? " ISHIDDEN" : ""); DateTimeHTML += (this.IsRequired ? " ISREQUIRED" : ""); DateTimeHTML += (this.IsReadOnly ? " ISREADONLY" : ""); DateTimeHTML += (this.IsPerIdentity ? " ISPERIDENTITY" : ""); DateTimeHTML += " INHERIT=\"" + this.InheritFrom + "\""; DateTimeHTML += " MIN=\"" + this.EarliestDate + "\""; DateTimeHTML += " MAX=\"" + this.LatestDate + "\""; DateTimeHTML += " FORMAT=\"" + this.Format + "\""; DateTimeHTML += " ONBLUR=\"validateRequired(this); if (validateDate(this)) { cleanDate(this); formatDate(this); }\""; DateTimeHTML += " ONKEYUP=\"setIsDirty()\""; DateTimeHTML += " DATATYPE=\"Date\">"; if (!this.IsReadOnly || g_IsSearch) { DateTimeHTML += "<BUTTON CLASS=\"dateButton\""; DateTimeHTML += " NAME=\"" + this.Name + "Button\""; DateTimeHTML += " ID=\"" + this.Name + "Button\""; DateTimeHTML += " TABINDEX=\"1\""; DateTimeHTML += " ONCLICK=\"doCalendar('" + this.Name + "');\">"; DateTimeHTML += "<IMG SRC=\"calendar.gif\" WIDTH=15 HEIGHT=13>"; DateTimeHTML += "</BUTTON>"; } } return DateTimeHTML; } // ============================================ \\ // === Check Box Field === \\ // ============================================ \\ function CheckBoxField(i_Name, i_Label, i_Container) { if (arguments.length > 0) this.initField(i_Name, i_Label, i_Container); this.StoredValue = ""; this.IsCheckedByDefault = false; this.Type = FormObjectType_CheckBox; } CheckBoxField.prototype = new Field; CheckBoxField.prototype.getBody = CheckBoxField_getBody; function CheckBoxField_getBody() { var CheckBoxHTML = "<INPUT"; CheckBoxHTML += " TYPE=\"checkbox\""; CheckBoxHTML += " CLASS=\"checkbox\""; CheckBoxHTML += " FIELDTYPE=\"" + this.Type + "\""; CheckBoxHTML += " NAME=\"" + this.Name + "\""; CheckBoxHTML += " ID=\"" + this.Name + "\""; CheckBoxHTML += " TABINDEX=\"1\""; //CheckBoxHTML += " LABEL=\"" + this.Label + "\""; CheckBoxHTML += " VALUE=\"" + this.StoredValue + "\""; CheckBoxHTML += (this.IsCheckedByDefault ? " CHECKED" : ""); CheckBoxHTML += (this.IsHidden ? " ISHIDDEN" : ""); CheckBoxHTML += (this.IsRequired ? " ISREQUIRED" : ""); CheckBoxHTML += (this.IsReadOnly ? " ISREADONLY" : ""); CheckBoxHTML += (this.IsPerIdentity ? " ISPERIDENTITY" : ""); CheckBoxHTML += " INHERIT=\"" + this.InheritFrom + "\""; CheckBoxHTML += " ONBLUR=\"validateRequired(this);\""; CheckBoxHTML += " ONCLICK=\"setIsDirty()\">"; return CheckBoxHTML; } // ============================================ \\ // === Password Field === \\ // ============================================ \\ function PasswordField(i_Name, i_Label, i_Container) { if (arguments.length > 0) this.initField(i_Name, i_Label, i_Container); this.Width = ""; this.WidthType = GrooveFormsToolFieldSizeType_Characters; this.MaximumLength = ""; this.ValidationType = 0; this.ValidationParameter = ""; this.Type = FormObjectType_Password; } PasswordField.prototype = new Field; PasswordField.prototype.getBody = PasswordField_getBody; function PasswordField_getBody() { var PasswordHTML = ""; if (g_IsReadOnly && !g_IsFormPreview) { PasswordHTML = "<INPUT TYPE=\"password\" STYLE=\"display:none;\" FIELDTYPE=\"" + this.Type + "\" NAME=\"" + this.Name + "\" ID=\"" + this.Name + "\">"; PasswordHTML += "<SPAN CLASS=\"inputPreview\" ID=\"" + this.Name + "_preview\" STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) +"\"></SPAN>"; } else { PasswordHTML = "<INPUT"; PasswordHTML += " TYPE=\"password\""; PasswordHTML += " CLASS=\"text\""; PasswordHTML += " FIELDTYPE=\"" + this.Type + "\""; PasswordHTML += " NAME=\"" + this.Name + "\""; PasswordHTML += " ID=\"" + this.Name + "\""; PasswordHTML += " TABINDEX=\"1\""; //PasswordHTML += " LABEL=\"" + this.Label + "\""; PasswordHTML += " STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) +"\""; PasswordHTML += " MAXLENGTH=\"" + this.MaximumLength + "\""; PasswordHTML += (this.IsHidden ? " ISHIDDEN" : ""); PasswordHTML += (this.IsRequired ? " ISREQUIRED" : ""); PasswordHTML += (this.IsReadOnly ? " ISREADONLY" : ""); PasswordHTML += (this.IsPerIdentity ? " ISPERIDENTITY" : ""); PasswordHTML += " INHERIT=\"" + this.InheritFrom + "\""; PasswordHTML += " ONBLUR=\"validateRequired(this);" + getValidationScript(this.ValidationType, this.ValidationParameter) + "\""; PasswordHTML += " ONKEYUP=\"setIsDirty()\">"; } return PasswordHTML; } // ============================================ \\ // === Option Field === \\ // ============================================ \\ function OptionField() { this.Options = new Array(); this.Values = new Array(); this.DefaultSelection = ""; } OptionField.prototype = new Field; // ============================================ \\ // === Radio Buttons Field === \\ // ============================================ \\ function OptionButtonsField(i_Name, i_Label, i_Container) { if (arguments.length > 0) this.initField(i_Name, i_Label, i_Container); this.Type = FormObjectType_OptionButtons; } OptionButtonsField.prototype = new OptionField; OptionButtonsField.prototype.getBody = OptionButtonsField_getBody; function OptionButtonsField_getBody() { var OptionButtonsHTML = ""; for (var i = 0; i < this.Options.length; i++) { OptionButtonsHTML += "<INPUT"; OptionButtonsHTML += " TYPE=\"radio\""; OptionButtonsHTML += " CLASS=\"radio\""; OptionButtonsHTML += " FIELDTYPE=\"" + this.Type + "\""; OptionButtonsHTML += " NAME=\"" + this.Name + "\""; OptionButtonsHTML += " ID=\"" + this.Name + "\""; OptionButtonsHTML += " TABINDEX=\"1\""; //OptionButtonsHTML += " LABEL=\"" + this.Label + "\""; OptionButtonsHTML += " VALUE=\"" + this.Values[i] + "\""; OptionButtonsHTML += (this.IsHidden ? " ISHIDDEN" : ""); OptionButtonsHTML += (this.IsRequired ? " ISREQUIRED" : ""); OptionButtonsHTML += (this.IsReadOnly ? " ISREADONLY" : ""); OptionButtonsHTML += (this.IsPerIdentity ? " ISPERIDENTITY" : ""); OptionButtonsHTML += (this.DefaultSelection == this.Options[i] ? " CHECKED" : ""); OptionButtonsHTML += " INHERIT=\"" + this.InheritFrom + "\""; OptionButtonsHTML += " ONBLUR=\"validateRequired(this)\""; OptionButtonsHTML += " ONCLICK=\"setIsDirty()\">"; OptionButtonsHTML += " "; OptionButtonsHTML += "<FONT>" + this.Options[i] + "</FONT>"; } OptionButtonsHTML += "<DIV ID=\"" + this.Name + "_RadioEnd\"></DIV>"; return OptionButtonsHTML; } // ============================================ \\ // === Combo Box Field === \\ // ============================================ \\ function DropDownListField(i_Name, i_Label, i_Container) { if (arguments.length > 0) this.initField(i_Name, i_Label, i_Container); this.AllowUserDefinedValues = false; this.IncludeBlankEntry = false; this.IncludeMemberNames = false; this.HasLookup = false; this.Type = FormObjectType_DropDownList; } DropDownListField.prototype = new OptionField; DropDownListField.prototype.getBody = DropDownListField_getBody; function DropDownListField_getBody() { var DropDownListHTML = ""; if (g_IsReadOnly && !g_IsFormPreview) { DropDownListHTML = "<SELECT"; DropDownListHTML += " STYLE=\"display:none;\""; DropDownListHTML += " FIELDTYPE=\"" + this.Type + "\""; DropDownListHTML += " NAME=\"" + this.Name + "\""; DropDownListHTML += " ID=\"" + this.Name + "\""; DropDownListHTML += (this.IncludeMemberNames ? " MEMBERS" : ""); DropDownListHTML += (this.HasLookup ? " LOOKUP" : ""); DropDownListHTML += ">"; if (this.IncludeBlankEntry) DropDownListHTML += "<OPTION ORIGINAL></OPTION>"; for (var i = 0; i < this.Options.length; i++) { if (this.Options[i] != "" || this.Values[i] != "") DropDownListHTML += "<OPTION VALUE=\"" + this.Values[i] + "\">" + this.Options[i] + "</OPTION>"; } DropDownListHTML += "</SELECT>"; DropDownListHTML += "<SPAN CLASS=\"selectPreview\" ID=\"" + this.Name + "_preview\"></SPAN>"; } else { DropDownListHTML = "<SELECT"; DropDownListHTML += " FIELDTYPE=\"" + this.Type + "\""; DropDownListHTML += " NAME=\"" + this.Name + "\""; DropDownListHTML += " ID=\"" + this.Name + "\""; DropDownListHTML += " TABINDEX=\"1\""; //DropDownListHTML += " LABEL=\"" + this.Label + "\""; DropDownListHTML += (this.AllowUserDefinedValues ? " CUSTOM" : ""); DropDownListHTML += (this.IncludeMemberNames ? " MEMBERS" : ""); DropDownListHTML += (this.IsHidden ? " ISHIDDEN" : ""); DropDownListHTML += (this.IsRequired ? " ISREQUIRED" : ""); DropDownListHTML += (this.IsReadOnly ? " ISREADONLY" : ""); DropDownListHTML += (this.IsPerIdentity ? " ISPERIDENTITY" : ""); DropDownListHTML += (this.IncludeBlankEntry ? " BLANK" : ""); DropDownListHTML += (this.HasLookup ? " LOOKUP" : ""); DropDownListHTML += " INHERIT=\"" + this.InheritFrom + "\""; DropDownListHTML += " ONBLUR=\"validateRequired(this)\""; DropDownListHTML += " ONCHANGE=\"setIsDirty();\""; DropDownListHTML += ">"; if (this.IncludeBlankEntry || g_IsSearch) DropDownListHTML += "<OPTION ORIGINAL></OPTION>"; for (var i = 0; i < this.Options.length; i++) { if (this.Options[i] != "" || this.Values[i] != "") { DropDownListHTML += "<OPTION ORIGINAL"; DropDownListHTML += " VALUE=\"" + this.Values[i] + "\""; DropDownListHTML += (this.DefaultSelection == this.Options[i] ? " SELECTED" : ""); DropDownListHTML += ">"; DropDownListHTML += this.Options[i]; DropDownListHTML += "</OPTION>"; } } DropDownListHTML += "</SELECT>"; if (this.AllowUserDefinedValues) { DropDownListHTML += "<BUTTON CLASS=\"customButton\""; DropDownListHTML += " NAME=\"" + this.Name + "Button\""; DropDownListHTML += " ID=\"" + this.Name + "Button\""; DropDownListHTML += " TABINDEX=\"1\""; DropDownListHTML += " ONCLICK=\"addNewOption('" + this.Name + "');\">+</BUTTON>"; } } return DropDownListHTML; } // ============================================ \\ // === List Box Field === \\ // ============================================ \\ function ListBoxField(i_Name, i_Label, i_Container) { if (arguments.length > 0) this.initField(i_Name, i_Label, i_Container); this.AllowMultipleSelection = false; this.IncludeBlankEntry = false; this.IncludeMemberNames = false; this.HasLookup = false; this.NumberVisible = 4; this.Type = FormObjectType_ListBox; } ListBoxField.prototype = new OptionField; ListBoxField.prototype.getBody = ListBoxField_getBody; function ListBoxField_getBody() { var ListBoxHTML = ""; if (g_IsReadOnly && !g_IsFormPreview) { ListBoxHTML = "<SELECT"; ListBoxHTML += " STYLE=\"display:none;\""; ListBoxHTML += " FIELDTYPE=\"" + this.Type + "\""; ListBoxHTML += " NAME=\"" + this.Name + "\""; ListBoxHTML += " ID=\"" + this.Name + "\""; ListBoxHTML += " SIZE=\"" + this.NumberVisible + "\""; ListBoxHTML += (this.AllowMultipleSelection ? " MULTIPLE" : ""); ListBoxHTML += (this.IncludeMemberNames ? " MEMBERS" : ""); ListBoxHTML += (this.HasLookup ? " LOOKUP" : ""); ListBoxHTML += ">"; if (this.IncludeBlankEntry) ListBoxHTML += "<OPTION ORIGINAL></OPTION>"; for (var i = 0; i < this.Options.length; i++) { if (this.Options[i] != "" || this.Values[i] != "") ListBoxHTML += "<OPTION VALUE=\"" + this.Values[i] + "\">" + this.Options[i] + "</OPTION>"; } ListBoxHTML += "</SELECT>"; ListBoxHTML += "<SPAN CLASS=\"selectPreview\" ID=\"" + this.Name + "_preview\"></SPAN>"; } else { ListBoxHTML = "<SELECT"; ListBoxHTML += " FIELDTYPE=\"" + this.Type + "\""; ListBoxHTML += " NAME=\"" + this.Name + "\""; ListBoxHTML += " ID=\"" + this.Name + "\""; ListBoxHTML += " TABINDEX=\"1\""; //ListBoxHTML += " LABEL=\"" + this.Label + "\""; ListBoxHTML += " SIZE=\"" + this.NumberVisible + "\""; ListBoxHTML += (this.AllowMultipleSelection ? " MULTIPLE" : ""); ListBoxHTML += (this.IsHidden ? " ISHIDDEN" : ""); ListBoxHTML += (this.IsRequired ? " ISREQUIRED" : ""); ListBoxHTML += (this.IsReadOnly ? " ISREADONLY" : ""); ListBoxHTML += (this.IsPerIdentity ? " ISPERIDENTITY" : ""); ListBoxHTML += (this.IncludeBlankEntry ? " BLANK" : ""); ListBoxHTML += (this.HasLookup ? " LOOKUP" : ""); ListBoxHTML += (this.IncludeMemberNames ? " MEMBERS" : ""); ListBoxHTML += " INHERIT=\"" + this.InheritFrom + "\""; ListBoxHTML += " ONBLUR=\"validateRequired(this)\""; ListBoxHTML += " ONCHANGE=\"setIsDirty()\">"; if (this.IncludeBlankEntry || g_IsSearch) ListBoxHTML += "<OPTION ORIGINAL></OPTION>"; for (var i = 0; i < this.Options.length; i++) { if (this.Options[i] != "" || this.Values[i] != "") { ListBoxHTML += "<OPTION ORIGINAL"; ListBoxHTML += " VALUE=\"" + this.Values[i] + "\""; ListBoxHTML += (this.DefaultSelection == this.Options[i] ? " SELECTED" : ""); ListBoxHTML += ">"; ListBoxHTML += this.Options[i]; ListBoxHTML += "</OPTION>"; } } ListBoxHTML += "</SELECT>"; } return ListBoxHTML; } // ============================================ \\ // === Rich Text Field === \\ // ============================================ \\ function RichTextField(i_Name, i_Label, i_Container) { if (arguments.length > 0) this.initField(i_Name, i_Label, i_Container); this.Width = 40; this.WidthType = GrooveFormsToolFieldSizeType_Characters; this.Height = 10; this.HeightType = GrooveFormsToolFieldSizeType_Characters; this.InitialRTF = ""; this.IsBorderHidden = false; this.IsSearchable = false; this.IsCommandBarHidden = true; this.BackgroundColor = ""; this.Type = FormObjectType_RichText; } RichTextField.prototype = new Field; RichTextField.prototype.getBody = RichTextField_getBody; function RichTextField_getBody() { var RichTextHTML = ""; if ((g_IsFormPreview && !this.IsCommandBarHidden) || (!g_IsReadOnly && !g_IsPreviewPane && !this.IsCommandBarHidden)) { var objRichTextCommandBar = new CommandBar(this.Name, getFieldWidthUnit(this.Width, this.WidthType)); var objBoldCommand = new Command(this.Name + "Bold", "rtf_bold.gif", "Bold", "doBold('" + this.Name + "')"); objRichTextCommandBar.addCommand(objBoldCommand); var objItalicCommand = new Command(this.Name + "Italic", "rtf_italic.gif", "Italicize", "doItalic('" + this.Name + "')"); objRichTextCommandBar.addCommand(objItalicCommand); var objUnderlineCommand = new Command(this.Name + "Underline", "rtf_underline.gif", "Underline", "doUnderline('" + this.Name + "')"); objRichTextCommandBar.addCommand(objUnderlineCommand); objRichTextCommandBar.addSeparator(); var objChooseFontCommand = new Command(this.Name + "ChooseFont", "rtf_choosefont.gif", "Choose Font", "doChooseFont('" + this.Name + "')"); objRichTextCommandBar.addCommand(objChooseFontCommand); var objChooseColorCommand = new Command(this.Name + "ChooseColor", "rtf_choosecolor.gif", "Choose Color", "doChooseColor('" + this.Name + "')"); objRichTextCommandBar.addCommand(objChooseColorCommand); objRichTextCommandBar.addSeparator(); var objAlignLeftCommand = new Command(this.Name + "AlignLeft", "rtf_alignleft.gif", "Align Left", "doAlignLeft('" + this.Name + "')"); objRichTextCommandBar.addCommand(objAlignLeftCommand); var objCenterCommand = new Command(this.Name + "Center", "rtf_center.gif", "Center", "doCenter('" + this.Name + "')"); objRichTextCommandBar.addCommand(objCenterCommand); var objAlignRightCommand = new Command(this.Name + "AlignRight", "rtf_alignright.gif", "Align Right", "doAlignRight('" + this.Name + "')"); objRichTextCommandBar.addCommand(objAlignRightCommand); var objJustifyCommand = new Command(this.Name + "Justify", "rtf_justify.gif", "Justify", "doJustify('" + this.Name + "')"); objRichTextCommandBar.addCommand(objJustifyCommand); objRichTextCommandBar.addSeparator(); var objBulletsCommand = new Command(this.Name + "Bullets", "rtf_bullets.gif", "Bullets", "doBullets('" + this.Name + "')"); objRichTextCommandBar.addCommand(objBulletsCommand); var objIncreaseIndentCommand = new Command(this.Name + "IncreaseIndent", "rtf_increaseindent.gif", "Increase Indent", "doIncreaseIndent('" + this.Name + "')"); objRichTextCommandBar.addCommand(objIncreaseIndentCommand); var objDecreaseIndentCommand = new Command(this.Name + "DecreaseIndent", "rtf_decreaseindent.gif", "Decrease Indent", "doDecreaseIndent('" + this.Name + "')"); objRichTextCommandBar.addCommand(objDecreaseIndentCommand); RichTextHTML = objRichTextCommandBar.getBody(); } if (g_IsFormPreview || !g_IsReadOnly || (g_IsReadOnly && !g_IsPreviewPane)) { RichTextHTML += "<SCRIPT LANGUAGE=\"JavaScript\" FOR=\"" + this.Name + "\" EVENT=\"OnChange()\">setIsDirty(); eventHandlerById('OnChange', '" + this.Name + "');</SCRIPT>"; if (!g_IsReadOnly && !g_IsFormPreview && !this.IsCommandBarHidden) { RichTextHTML += "<SCRIPT LANGUAGE=\"JavaScript\" FOR=\"" + this.Name + "\" EVENT=\"OnSetFocus()\">startInterval('" + this.Name + "');</SCRIPT>"; RichTextHTML += "<SCRIPT LANGUAGE=\"JavaScript\" FOR=\"" + this.Name + "\" EVENT=\"OnKillFocus()\">validateRequiredRichText('" + this.Name + "'); stopInterval('" + this.Name + "'); eventHandlerById('OnBlur', '" + this.Name + "');</SCRIPT>"; } else { RichTextHTML += "<SCRIPT LANGUAGE=\"JavaScript\" FOR=\"" + this.Name + "\" EVENT=\"OnKillFocus()\">validateRequiredRichText('" + this.Name + "'); eventHandlerById('OnBlur', '" + this.Name + "');</SCRIPT>"; } RichTextHTML += "<OBJECT"; RichTextHTML += " CLASSID=\"clsid:E01D1C6A-4F40-11D3-8958-00105A272DCF\""; RichTextHTML += " FIELDTYPE=\"" + this.Type + "\""; RichTextHTML += " NAME=\"" + this.Name + "\""; RichTextHTML += " ID=\"" + this.Name + "\""; RichTextHTML += " TABINDEX=\"1\""; RichTextHTML += " STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) + getFieldHeightUnit(this.Height, this.HeightType) + "\""; RichTextHTML += " BORDER=0"; RichTextHTML += (this.IsHidden ? " ISHIDDEN" : ""); RichTextHTML += (this.IsRequired ? " ISREQUIRED" : ""); RichTextHTML += (this.IsReadOnly ? " ISREADONLY" : ""); RichTextHTML += (this.IsPerIdentity ? " ISPERIDENTITY" : ""); if (g_IsReadOnly) { this.IsBorderHidden = true; if (this.BackgroundColor == null || this.BackgroundColor == "") this.BackgroundColor = "Transparent"; } RichTextHTML += (this.IsBorderHidden ? " ISBORDERHIDDEN" : ""); RichTextHTML += (this.IsSearchable ? " ISSEARCHABLE" : ""); RichTextHTML += " BACKGROUNDCOLOR=\"" + this.BackgroundColor + "\""; RichTextHTML += " INHERIT=\"" + this.InheritFrom + "\""; RichTextHTML += " DEFAULT=\"" + this.InitialRTF + "\""; RichTextHTML += " DATATYPE=\"RichText\"></OBJECT>"; } else { RichTextHTML += "<OBJECT"; RichTextHTML += " CLASSID=\"clsid:E01D1C6A-4F40-11D3-8958-00105A272DCF\""; RichTextHTML += " FIELDTYPE=\"" + this.Type + "\""; RichTextHTML += " NAME=\"" + this.Name + "\""; RichTextHTML += " ID=\"" + this.Name + "\""; RichTextHTML += " STYLE=\"display:none; " + getFieldWidthUnit(this.Width, this.WidthType) + getFieldHeightUnit(this.Height, this.HeightType) + "\""; RichTextHTML += " DATATYPE=\"RichText\"></OBJECT>"; RichTextHTML += "<SPAN STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) + " background-color:" + this.BackgroundColor + ";\" ID=\"" + this.Name + "_preview\"></SPAN>"; } return RichTextHTML; } // ============================================ \\ // === Embedded View Field === \\ // ============================================ \\ function EmbeddedViewField(i_Name, i_Label, i_Container) { if (arguments.length > 0) this.initField(i_Name, i_Label, i_Container); this.Width = 40; this.WidthType = GrooveFormsToolFieldSizeType_Characters; this.Height = 10; this.HeightType = GrooveFormsToolFieldSizeType_Characters; this.EmbeddedViewID = ""; this.EmbeddedViewFilter = false; this.Type = FormObjectType_EmbeddedView; } EmbeddedViewField.prototype = new Field; EmbeddedViewField.prototype.getBody = EmbeddedViewField_getBody; function EmbeddedViewField_getBody() { var EmbeddedViewHTML = ""; if (g_IsFormPreview) { EmbeddedViewHTML += "<DIV"; EmbeddedViewHTML += " STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) + getFieldHeightUnit(this.Height, this.HeightType) + " border:1px solid black; background-color:white;\""; EmbeddedViewHTML += ">"; 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>"; EmbeddedViewHTML += "</DIV>"; } else { EmbeddedViewHTML += "<OBJECT"; EmbeddedViewHTML += " CLASSID=\"clsid:56A58823-AE99-11D5-B90B-0050DACD1F75\""; EmbeddedViewHTML += " FIELDTYPE=\"" + this.Type + "\""; EmbeddedViewHTML += " NAME=\"" + this.EmbeddedViewID + "\""; EmbeddedViewHTML += " ID=\"" + this.EmbeddedViewID + "\""; EmbeddedViewHTML += " BORDER=\"1\""; //EmbeddedViewHTML += " LABEL=\"" + this.Label + "\""; EmbeddedViewHTML += " STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) + getFieldHeightUnit(this.Height, this.HeightType) + "\""; EmbeddedViewHTML += (this.IsHidden ? " ISHIDDEN" : ""); EmbeddedViewHTML += " EMBEDDEDVIEWFILTER=\"" + this.EmbeddedViewFilter + "\""; EmbeddedViewHTML += " DATATYPE=\"View\"></OBJECT>"; } return EmbeddedViewHTML; } // ============================================ \\ // === Digital Ink Field === \\ // ============================================ \\ function DigitalInkField(i_Name, i_Label, i_Container) { if (arguments.length > 0) this.initField(i_Name, i_Label, i_Container); this.ID = -1; this.Width = 40; this.WidthType = GrooveFormsToolFieldSizeType_Characters; this.Height = 10; this.HeightType = GrooveFormsToolFieldSizeType_Characters; this.Type = FormObjectType_DigitalInk; } DigitalInkField.prototype = new Field; DigitalInkField.prototype.getBody = DigitalInkField_getBody; function DigitalInkField_getBody() { var DigitalInkHTML = ""; if (g_IsFormPreview) { DigitalInkHTML += "<DIV"; DigitalInkHTML += " STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) + getFieldHeightUnit(this.Height, this.HeightType) + " border:1px solid black; background-color:white;\""; DigitalInkHTML += ">"; 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>"; DigitalInkHTML += "</DIV>"; } else { var DigitalInkObject = getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").CreateInkObject(); if (typeof DigitalInkObject != "undefined" && DigitalInkObject != null) { DigitalInkHTML += "<OBJECT"; DigitalInkHTML += " CLASSID=\"clsid:537E4D80-9531-4f07-9369-B3649EFF7130\""; DigitalInkHTML += " FIELDTYPE=\"" + this.Type + "\""; DigitalInkHTML += " NAME=\"" + this.Name + "\""; DigitalInkHTML += " ID=\"" + this.Name + "\""; //DigitalInkHTML += " LABEL=\"" + this.Label + "\""; DigitalInkHTML += " STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) + getFieldHeightUnit(this.Height, this.HeightType) + "\""; DigitalInkHTML += (this.IsHidden ? " ISHIDDEN" : ""); DigitalInkHTML += " BORDER=\"1\""; DigitalInkHTML += " DATATYPE=\"Ink\"></OBJECT>"; } else if (!g_IsNew) { DigitalInkHTML += "<IMG"; DigitalInkHTML += " NAME=\"" + this.Name + "\""; DigitalInkHTML += " ID=\"" + this.Name + "\""; DigitalInkHTML += " SRC=\"" + getImageBindableURLByID(this.ID) + "\""; DigitalInkHTML += (this.IsHidden ? " ISHIDDEN" : ""); DigitalInkHTML += " FIELDTYPE=\"" + this.Type + "\">"; } else { DigitalInkHTML += "<DIV"; DigitalInkHTML += " STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) + getFieldHeightUnit(this.Height, this.HeightType) + " border:1px solid black; background-color:white;\""; DigitalInkHTML += ">"; 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>"; DigitalInkHTML += "</DIV>"; } } return DigitalInkHTML; } // ============================================ \\ // === Attachments Field === \\ // ============================================ \\ function AttachmentsField(i_Name, i_Label, i_Container) { if (arguments.length > 0) this.initField(i_Name, i_Label, i_Container); this.Type = FormObjectType_Attachments; } AttachmentsField.prototype = new Field; AttachmentsField.prototype.getBody = AttachmentsField_getBody; AttachmentsField.prototype.getRequired = AttachmentsField_getRequired; function AttachmentsField_getBody() { var objAttachmentsCommandBar = new CommandBar(this.Name, "width:200px"); var objAddCommand = new Command(this.Name + "Add", "add.gif", "Add Attachment(s)", "doAddAttachments()"); objAttachmentsCommandBar.addCommand(objAddCommand); var objLaunchCommand = new Command(this.Name + "Launch", "launch.gif", "Launch Selected Attachment(s)", "doLaunchSelectedAttachments()"); objAttachmentsCommandBar.addCommand(objLaunchCommand); var objSaveCommand = new Command(this.Name + "Save", "save.gif", "Save Selected Attachment(s)", "doSaveSelectedAttachments()"); objAttachmentsCommandBar.addCommand(objSaveCommand); var objDeleteCommand = new Command(this.Name + "Delete", "delete.gif", "Delete Selected Attachment(s)", "doDeleteSelectedAttachments()"); objAttachmentsCommandBar.addCommand(objDeleteCommand); var AttachmentsHTML = objAttachmentsCommandBar.getBody(); AttachmentsHTML += "<OBJECT"; AttachmentsHTML += " CLASSID=\"clsid:0D012ABD-CEED-11D2-9C76-00105AA73033\""; AttachmentsHTML += " FIELDTYPE=\"" + this.Type + "\""; AttachmentsHTML += " NAME=\"" + this.Name + "\""; AttachmentsHTML += " ID=\"" + this.Name + "\""; AttachmentsHTML += " TABINDEX=\"1\""; //AttachmentsHTML += " LABEL=\"" + this.Label + "\""; AttachmentsHTML += " WIDTH=\"200\""; AttachmentsHTML += " HEIGHT=\"75\""; AttachmentsHTML += (this.IsHidden ? " ISHIDDEN" : ""); AttachmentsHTML += (this.IsReadOnly ? " ISREADONLY" : ""); AttachmentsHTML += (this.IsPerIdentity ? " ISPERIDENTITY" : ""); AttachmentsHTML += " INHERIT=\"" + this.InheritFrom + "\""; AttachmentsHTML += " TABINDEX=\"-1\""; AttachmentsHTML += " DATATYPE=\"Attachments\"></OBJECT>"; return AttachmentsHTML; } function AttachmentsField_getRequired() { return ""; } // ============================================ \\ // === Static Field Class === \\ // ============================================ \\ function Static() { this.Name = ""; this.IsHidden = false; this.ColumnSpan = 1; this.RowSpan = 1; } Static.prototype.initStatic = Static_initStatic; function Static_initStatic(i_Name, i_Container) { this.Name = i_Name; i_Container.addField(this); } // ============================================ \\ // === Text Static === \\ // ============================================ \\ function StaticTextField(i_Name, i_Container) { if (arguments.length > 0) this.initStatic(i_Name, i_Container); this.Text = ""; this.Center = false; this.HasLookup = false; this.Type = FormObjectType_StaticText; } StaticTextField.prototype = new Static; StaticTextField.prototype.getBody = StaticTextField_getBody; function StaticTextField_getBody() { var StaticTextHTML = "<DIV"; StaticTextHTML += " CLASS=\"staticText\""; StaticTextHTML += " FIELDTYPE=\"" + this.Type + "\""; StaticTextHTML += " NAME=\"" + this.Name + "\""; StaticTextHTML += " ID=\"" + this.Name + "\""; StaticTextHTML += (this.IsHidden ? " ISHIDDEN" : ""); StaticTextHTML += (this.Center ? " ALIGN=\"center\"" : ""); StaticTextHTML += (this.HasLookup ? " LOOKUP" : ""); StaticTextHTML += ">"; StaticTextHTML += this.Text; StaticTextHTML += "</DIV>"; return StaticTextHTML; } // ============================================ \\ // === Form Heading Static === \\ // ============================================ \\ function FormHeadingField(i_Name, i_Container) { if (arguments.length > 0) this.initStatic(i_Name, i_Container); this.HeadingText = ""; this.Center = false; this.Type = FormObjectType_FormHeading; } FormHeadingField.prototype = new Static; FormHeadingField.prototype.getBody = FormHeadingField_getBody; function FormHeadingField_getBody() { var FormHeadingHTML = "<DIV"; FormHeadingHTML += " CLASS=\"formHeading\""; FormHeadingHTML += " WIDTH=\"100%\""; FormHeadingHTML += " FIELDTYPE=\"" + this.Type + "\""; FormHeadingHTML += " NAME=\"" + this.Name + "\""; FormHeadingHTML += " ID=\"" + this.Name + "\""; FormHeadingHTML += (this.IsHidden ? " ISHIDDEN" : ""); FormHeadingHTML += (this.Center ? " ALIGN=\"center\"" : ""); FormHeadingHTML += ">"; FormHeadingHTML += this.HeadingText; FormHeadingHTML += "</DIV>"; return FormHeadingHTML; } // ============================================ \\ // === Section Heading Static === \\ // ============================================ \\ function SectionHeadingField(i_Name, i_Container) { if (arguments.length > 0) this.initStatic(i_Name, i_Container); this.HeadingText = ""; this.Center = false; this.Type = FormObjectType_SectionHeading; } SectionHeadingField.prototype = new Static; SectionHeadingField.prototype.getBody = SectionHeadingField_getBody; function SectionHeadingField_getBody() { var SectionHeadingHTML = "<DIV"; SectionHeadingHTML += " WIDTH=\"100%\""; SectionHeadingHTML += " CLASS=\"sectionHeading\""; SectionHeadingHTML += " FIELDTYPE=\"" + this.Type + "\""; SectionHeadingHTML += " NAME=\"" + this.Name + "\""; SectionHeadingHTML += " ID=\"" + this.Name + "\""; SectionHeadingHTML += (this.IsHidden ? " ISHIDDEN" : ""); SectionHeadingHTML += (this.Center ? " ALIGN=\"center\"" : ""); SectionHeadingHTML += ">"; SectionHeadingHTML += this.HeadingText; SectionHeadingHTML += "</DIV>"; return SectionHeadingHTML; } // ============================================ \\ // === Horizontal Line Static === \\ // ============================================ \\ function HorizontalLineField(i_Name, i_Container) { if (arguments.length > 0) this.initStatic(i_Name, i_Container); this.Thickness = ""; this.IsUnshaded = false; this.Type = FormObjectType_HorizontalLine; } HorizontalLineField.prototype = new Static; HorizontalLineField.prototype.getBody = HorizontalLineField_getBody; function HorizontalLineField_getBody() { var HorizontalLineHTML = "<HR"; HorizontalLineHTML += " FIELDTYPE=\"" + this.Type + "\""; HorizontalLineHTML += " NAME=\"" + this.Name + "\""; HorizontalLineHTML += " ID=\"" + this.Name + "\""; HorizontalLineHTML += " SIZE=\"" + this.Thickness + "\""; HorizontalLineHTML += (this.IsHidden ? " ISHIDDEN" : ""); HorizontalLineHTML += (this.IsUnshaded ? " NOSHADE" : ""); HorizontalLineHTML += ">"; return HorizontalLineHTML; } // ============================================ \\ // === New Line Static === \\ // ============================================ \\ function NewLineField(i_Name, i_Container) { if (arguments.length > 0) this.initStatic(i_Name, i_Container); this.Type = FormObjectType_NewLine; } NewLineField.prototype = new Static; NewLineField.prototype.getBody = NewLineField_getBody; function NewLineField_getBody() { var NewLineHTML = "<BR"; NewLineHTML += " FIELDTYPE=\"" + this.Type + "\""; NewLineHTML += " NAME=\"" + this.Name + "\""; NewLineHTML += " ID=\"" + this.Name + "\""; NewLineHTML += (this.IsHidden ? " ISHIDDEN" : ""); NewLineHTML += ">"; return NewLineHTML; } // ============================================ \\ // === Button Static === \\ // ============================================ \\ function ScriptButtonField(i_Name, i_Container) { if (arguments.length > 0) this.initStatic(i_Name, i_Container); this.ButtonText = ""; this.Center = false; this.OnClickScript = ""; this.Type = FormObjectType_ScriptButton; } ScriptButtonField.prototype = new Static; ScriptButtonField.prototype.getBody = ScriptButtonField_getBody; function ScriptButtonField_getBody() { var ScriptButtonHTML = "<BUTTON"; ScriptButtonHTML += " CLASS=\"button\""; ScriptButtonHTML += " NAME=\"" + this.Name + "\""; ScriptButtonHTML += " ID=\"" + this.Name + "\""; ScriptButtonHTML += " FIELDTYPE=\"" + this.Type + "\""; ScriptButtonHTML += (this.IsHidden ? " ISHIDDEN" : ""); ScriptButtonHTML += (this.Center ? " ALIGN=\"center\"" : ""); ScriptButtonHTML += (this.OnClickScript != "" ? " ONCLICK=\"" + this.OnClickScript.replace(/\"/g, "'") + "\"" : ""); if (g_IsSearch) ScriptButtonHTML += " DISABLED"; ScriptButtonHTML += ">"; ScriptButtonHTML += this.ButtonText; ScriptButtonHTML += "</BUTTON>"; return ScriptButtonHTML; } // ============================================ \\ // === Image Static === \\ // ============================================ \\ function ImageField(i_Name, i_Container) { if (arguments.length > 0) this.initStatic(i_Name, i_Container); this.ID = -1; this.BorderSize = ""; this.AltText = ""; this.Center = false; this.Type = FormObjectType_Image; } ImageField.prototype = new Static; ImageField.prototype.getBody = ImageField_getBody; function ImageField_getBody() { var ImageHTML = "<IMG"; ImageHTML += " NAME=\"" + this.Name + "\""; ImageHTML += " ID=\"" + this.Name + "\""; ImageHTML += " SRC=\"" + getImageBindableURLByID(this.ID) + "\""; ImageHTML += " FIELDTYPE=\"" + this.Type + "\""; ImageHTML += (this.IsHidden ? " ISHIDDEN" : ""); ImageHTML += (this.Center ? " ALIGN=\"center\"" : ""); ImageHTML += " BORDER=\"" + this.BorderSize + "\""; ImageHTML += " TITLE=\"" + this.AltText + "\">"; return ImageHTML; } // ============================================ \\ // === Unknown Static === \\ // ============================================ \\ function UnknownField(i_Name, i_Container) { if (arguments.length > 0) this.initStatic(i_Name, i_Container); this.Type = FormObjectType_Unknown; } UnknownField.prototype = new Static; UnknownField.prototype.getBody = function() { var UnknownHTML = "<DIV"; UnknownHTML += " STYLE=\"border:2px solid black; padding:4px; background-color:white; color:black;\">"; 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 + "'."; UnknownHTML += "</DIV>"; return UnknownHTML; } // ============================================ \\ // === Command Bar === \\ // ============================================ \\ function CommandBar(i_FieldName, i_Width) { this.Name = i_FieldName + "_commandbar"; this.Width = i_Width; this.Commands = new Array(); } CommandBar.prototype.addCommand = function (i_Command) { this.Commands.push(i_Command); } CommandBar.prototype.addSeparator = function() { this.Commands.push(null); } CommandBar.prototype.getBody = function () { var CommandBarHTML = '<TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0" ID="' + this.Name + '" NAME="' + this.Name + '" STYLE="' + this.Width + ';" CLASS="commandbar"><TR>'; for (var i = 0; i < this.Commands.length; i++) { var objCommand = this.Commands[i]; CommandBarHTML += '<TD'; if (objCommand != null) { CommandBarHTML += ' CLASS="command"'; CommandBarHTML += ' ID="' + objCommand.ID + '"'; CommandBarHTML += ' TITLE="' + objCommand.Tooltip + '"'; CommandBarHTML += ' ONCLICK="if (!this.getAttribute(\'COMMANDDISABLED\')) { ' + objCommand.Action + '; }"'; CommandBarHTML += ' ONMOUSEOVER="commandMouseOver(this);"'; CommandBarHTML += ' ONMOUSEOUT="commandMouseOut(this);"'; CommandBarHTML += ' ONMOUSEDOWN="commandMouseDown(this);"'; CommandBarHTML += ' ONMOUSEUP="commandMouseUp(this);">'; CommandBarHTML += '<IMG'; CommandBarHTML += ' SRC="' + objCommand.ImageURL + '"'; CommandBarHTML += ' ID="' + objCommand.ID + 'Button"'; CommandBarHTML += ' WIDTH="16"'; CommandBarHTML += ' HEIGHT="16">'; } else { CommandBarHTML += ' WIDTH="6">'; CommandBarHTML += '<DIV'; CommandBarHTML += ' CLASS="commandSep">'; CommandBarHTML += '</DIV>'; } CommandBarHTML += '</TD>'; } CommandBarHTML += '<TD> </TD>'; CommandBarHTML += '</TR></TABLE>'; return CommandBarHTML; } function Command(i_ID, i_ImageURL, i_Tooltip, i_Action) { this.ID = i_ID; this.ImageURL = i_ImageURL; this.Tooltip = i_Tooltip; this.Action = i_Action; }