0byt3m1n1
Path:
C:
/
Program Files (x86)
/
Microsoft Office
/
Office12
/
Groove
/
ToolData
/
groove.net
/
GrooveForms5
/
[
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_Attachments = 17; var FormObjectType_StaticText = 18; var FormObjectType_FormHeading = 19; var FormObjectType_SectionHeading = 20; var FormObjectType_HorizontalLine = 21; var FormObjectType_NewLine = 22; var FormObjectType_ScriptButton = 23; var FormObjectType_Image = 24; var FormObjectType_Contact = 25; var FormObjectType_EmbeddedView = 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\">" + getFieldLabel(i_FormObject) + "</FONT>"; switch (i_FormObject.LabelPosition) { case "Right": FieldCellHTML += "<TD" + FieldAttributes + RowSpan + ">" + FieldBodyHTML + "</TD>"; FieldCellHTML += "<TD" + LabelAttributes + FieldColumnSpan + RowSpan + ">" + FieldLabel + "</TD>"; break; case "Top": var LineBreak = "<BR>"; if (getFieldLabel(i_FormObject).indexOf("<div") >= 0) LineBreak = ""; FieldCellHTML += "<TD" + FieldAttributes + ColumnSpan + RowSpan + ">" + ((getFieldLabel(i_FormObject) != "") ? FieldLabel + LineBreak : "") + 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) { var AlignAttribute = ""; if (i_FormObject.Center) AlignAttribute = " ALIGN=\"center\""; FieldCellHTML += "<TD" + FieldAttributes + FieldStyleAttribute + AlignAttribute + 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\">" + getFieldLabel(i_FormObject) + 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": var LineBreak = "<BR>"; if (getFieldLabel(i_FormObject).indexOf("<div") >= 0) LineBreak = ""; FieldCellHTML += "<TD" + FieldAttributes + FieldStyleAttribute + ColumnSpan + RowSpan + ">" + ((getFieldLabel(i_FormObject) != "" || i_FormObject.getRequired() != "") ? FieldLabel + LineBreak : "") + 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 getFieldLabel(i_Field) { if (i_Field.LabelHTML != "") return i_Field.LabelHTML; else return i_Field.Label; } function getFieldGroupBody(i_FieldGroup, i_bIsPreview) { var FieldBodyHTML = ""; for (var i = 0; i < i_FieldGroup.Fields.length; i++) { var Field = i_FieldGroup.Fields[i]; // The CLASS attribute for the field. var ClassAttribute = ""; if (Field.ClassName != "") ClassAttribute = " CLASS=\"" + Field.ClassName + "\""; var LabelSpanTag = "<FONT ID=\"" + Field.Name + "_label\"" + ClassAttribute + " STYLE=\"padding-right:2px;"; var FieldSpanTag = "<SPAN ID=\"" + Field.Name + "_field\"" + ClassAttribute + " 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) { var Priv = getScriptHostQI("IGrooveFormsToolUIDelegatePrivate"); OnClickAttribute = " ONCLICK=\"if (typeof obj" + Field.Name + " != 'undefined') { selectField(obj" + Field.Name + "); }\""; OnMouseOverAttribute = " ONMOUSEOVER=\"if (typeof obj" + Field.Name + " != 'undefined') { hoverField(obj" + Field.Name + "); }\""; var MsgFormatEnum = CreateBSTREnumFromArray([Field.Name]); // IDS_FORMS_TOOL_JS_FIELD_TITLE TitleAttribute = " TITLE=\"" + Priv.MessageFormat(IDS_FORMS_TOOL_JS_FIELD_TITLE, MsgFormatEnum) + "\""; } 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() + getFieldLabel(Field) + "</FONT>"; break; case "Top": if (i >= 1) FieldBodyHTML += "<BR>"; FieldBodyHTML += LabelSpanTag + getFieldLabel(Field) + Field.getRequired() + "</FONT><BR>" + FieldSpanTag + Field.getBody() + ImgTag + "</SPAN>"; break; default: FieldBodyHTML += LabelSpanTag + getFieldLabel(Field) + 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, "\\\\"); i_Parameter = i_Parameter.replace(/\'/g, "\\'"); 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);"; 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.LabelHTML = ""; 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 = function(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); } FieldGroup.prototype.addField = function(i_Field) { this.Fields.push(i_Field); } FieldGroup.prototype.getRequired = function() { return ""; } // ============================================ \\ // === Tab Group Class === \\ // ============================================ \\ function TabGroup(i_Name, i_Container) { if (arguments.length > 0) this.initTabGroup(i_Name, i_Container); this.Label = ""; this.LabelHTML = ""; 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 = function(i_Name, i_Container) { this.Name = i_Name; i_Container.addTabGroup(this); } TabGroup.prototype.addTab = function(i_Tab) { this.Tabs.push(i_Tab); } TabGroup.prototype.getRequired = function() { 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 = function(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); } Tab.prototype.addField = function(i_Field) { this.Fields.push(i_Field); } // ============================================ \\ // === Field Class === \\ // ============================================ \\ function Field() { this.Name = ""; this.Label = ""; this.LabelHTML = ""; this.LabelPosition = "Left"; this.IsHidden = false; this.ColumnSpan = 1; this.RowSpan = 1; this.IsReadOnly = false; this.IsRequired = false; this.PropagateUpdates = false; this.InheritFrom = ""; this.ClassName = ""; this.FieldGroup = null; this.TabGroup = null; this.Tab = null; } Field.prototype.initField = function(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_IsPrinting) || 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 = function() { 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 = function() { 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 += " 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.HasLookup ? " LOOKUP" : ""); TextHTML += (this.PropagateUpdates ? " PROPAGATEUPDATES" : ""); 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 = function() { 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 += " 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.HasLookup ? " LOOKUP" : ""); MultiLineTextHTML += (this.PropagateUpdates ? " PROPAGATEUPDATES" : ""); 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 = function() { 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 += " STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) +"\""; UnformattedNumberHTML += " MAXLENGTH=\"" + this.MaximumLength + "\""; UnformattedNumberHTML += (this.IsHidden ? " ISHIDDEN" : ""); UnformattedNumberHTML += (this.IsRequired ? " ISREQUIRED" : ""); UnformattedNumberHTML += (this.IsReadOnly ? " ISREADONLY" : ""); UnformattedNumberHTML += (this.PropagateUpdates ? " PROPAGATEUPDATES" : ""); 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 = function() { 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 += " STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) +"\""; NumberHTML += " MAXLENGTH=\"" + this.MaximumLength + "\""; NumberHTML += (this.IsHidden ? " ISHIDDEN" : ""); NumberHTML += (this.IsRequired ? " ISREQUIRED" : ""); NumberHTML += (this.IsReadOnly ? " ISREADONLY" : ""); NumberHTML += (this.PropagateUpdates ? " PROPAGATEUPDATES" : ""); 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 = function() { 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 += " STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) +"\""; CurrencyHTML += " MAXLENGTH=\"" + this.MaximumLength + "\""; CurrencyHTML += (this.IsHidden ? " ISHIDDEN" : ""); CurrencyHTML += (this.IsRequired ? " ISREQUIRED" : ""); CurrencyHTML += (this.IsReadOnly ? " ISREADONLY" : ""); CurrencyHTML += (this.PropagateUpdates ? " PROPAGATEUPDATES" : ""); 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 = function() { 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 += " 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.PropagateUpdates ? " PROPAGATEUPDATES" : ""); 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 = function() { 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 += " STYLE=\"" + getFieldWidthUnit((this.Width * 0.65), 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.PropagateUpdates ? " PROPAGATEUPDATES" : ""); 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\">"; // Need a separate input box for time. DateTimeHTML += "<INPUT"; DateTimeHTML += " TYPE=\"text\""; DateTimeHTML += " CLASS=\"text\""; DateTimeHTML += " FIELDTYPE=\"" + this.Type + "\""; DateTimeHTML += " NAME=\"" + this.Name + "_Time\""; DateTimeHTML += " ID=\"" + this.Name + "_Time\""; DateTimeHTML += " TABINDEX=\"1\""; DateTimeHTML += " STYLE=\"" + getFieldWidthUnit((this.Width * 0.35), this.WidthType) +"\""; DateTimeHTML += " ONBLUR=\"validateRequired(this.previousSibling); if (validateDate(this.previousSibling)) { cleanDate(this.previousSibling); formatDate(this.previousSibling); }\""; DateTimeHTML += " ONKEYUP=\"setIsDirty()\""; DateTimeHTML += " DATATYPE=\"Time\">"; 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 = function() { 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 += " VALUE=\"" + this.StoredValue + "\""; CheckBoxHTML += (this.IsCheckedByDefault ? " CHECKED" : ""); CheckBoxHTML += (this.IsHidden ? " ISHIDDEN" : ""); CheckBoxHTML += (this.IsRequired ? " ISREQUIRED" : ""); CheckBoxHTML += (this.IsReadOnly ? " ISREADONLY" : ""); CheckBoxHTML += (this.PropagateUpdates ? " PROPAGATEUPDATES" : ""); 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 = function() { 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 += " STYLE=\"" + getFieldWidthUnit(this.Width, this.WidthType) +"\""; PasswordHTML += " MAXLENGTH=\"" + this.MaximumLength + "\""; PasswordHTML += (this.IsHidden ? " ISHIDDEN" : ""); PasswordHTML += (this.IsRequired ? " ISREQUIRED" : ""); PasswordHTML += (this.IsReadOnly ? " ISREADONLY" : ""); PasswordHTML += (this.PropagateUpdates ? " PROPAGATEUPDATES" : ""); 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 = function() { 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 += " VALUE=\"" + this.Values[i] + "\""; OptionButtonsHTML += (this.IsHidden ? " ISHIDDEN" : ""); OptionButtonsHTML += (this.IsRequired ? " ISREQUIRED" : ""); OptionButtonsHTML += (this.IsReadOnly ? " ISREADONLY" : ""); OptionButtonsHTML += (this.PropagateUpdates ? " PROPAGATEUPDATES" : ""); 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 = function() { 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] != "") { var OptionText = this.Options[i]; if (OptionText.length > 100) OptionText = OptionText.substring(0, 96) + "..."; DropDownListHTML += "<OPTION VALUE=\"" + this.Values[i] + "\">" + OptionText + "</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 += (this.AllowUserDefinedValues ? " CUSTOM" : ""); DropDownListHTML += (this.IncludeMemberNames ? " MEMBERS" : ""); DropDownListHTML += (this.IsHidden ? " ISHIDDEN" : ""); DropDownListHTML += (this.IsRequired ? " ISREQUIRED" : ""); DropDownListHTML += (this.IsReadOnly ? " ISREADONLY" : ""); DropDownListHTML += (this.IncludeBlankEntry ? " BLANK" : ""); DropDownListHTML += (this.HasLookup ? " LOOKUP" : ""); DropDownListHTML += (this.PropagateUpdates ? " PROPAGATEUPDATES" : ""); 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] != "") { var OptionText = this.Options[i]; if (OptionText.length > 100) OptionText = OptionText.substring(0, 96) + "..."; DropDownListHTML += "<OPTION ORIGINAL"; DropDownListHTML += " VALUE=\"" + this.Values[i] + "\""; DropDownListHTML += (this.DefaultSelection == this.Options[i] ? " SELECTED" : ""); DropDownListHTML += ">"; DropDownListHTML += OptionText; 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 = function() { 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] != "") { var OptionText = this.Options[i]; if (OptionText.length > 100) OptionText = OptionText.substring(0, 96) + "..."; ListBoxHTML += "<OPTION VALUE=\"" + this.Values[i] + "\">" + OptionText + "</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 += " SIZE=\"" + this.NumberVisible + "\""; ListBoxHTML += (this.AllowMultipleSelection ? " MULTIPLE" : ""); ListBoxHTML += (this.IsHidden ? " ISHIDDEN" : ""); ListBoxHTML += (this.IsRequired ? " ISREQUIRED" : ""); ListBoxHTML += (this.IsReadOnly ? " ISREADONLY" : ""); ListBoxHTML += (this.IncludeBlankEntry ? " BLANK" : ""); ListBoxHTML += (this.HasLookup ? " LOOKUP" : ""); ListBoxHTML += (this.IncludeMemberNames ? " MEMBERS" : ""); ListBoxHTML += (this.PropagateUpdates ? " PROPAGATEUPDATES" : ""); 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] != "") { var OptionText = this.Options[i]; if (OptionText.length > 100) OptionText = OptionText.substring(0, 96) + "..."; ListBoxHTML += "<OPTION ORIGINAL"; ListBoxHTML += " VALUE=\"" + this.Values[i] + "\""; ListBoxHTML += (this.DefaultSelection == this.Options[i] ? " SELECTED" : ""); ListBoxHTML += ">"; ListBoxHTML += OptionText; 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 = 45; 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 = function() { var RichTextHTML = ""; if ((g_IsFormPreview && !this.IsCommandBarHidden) || (!g_IsReadOnly && !g_IsPreviewPane && !g_IsPrinting && !this.IsCommandBarHidden)) { var Priv = getScriptHostQI("IGrooveFormsToolUIDelegatePrivate"); var IconPath = getScriptHostQI("IGrooveFormsToolUIDelegateFormPrivate").GetIntlIconPath(); var objRichTextCommandBar = new CommandBar(this.Name, getFieldWidthUnit(this.Width, this.WidthType)); // IDS_FORMS_TOOL_JS_COMMAND_BAR_BOLD var objBoldCommand = new Command(this.Name + "Bold", IconPath + "rtf_bold.gif", Priv.GetResourcedString(IDS_FORMS_TOOL_JS_COMMAND_BAR_BOLD), "doBold('" + this.Name + "')"); objRichTextCommandBar.addCommand(objBoldCommand); // IDS_FORMS_TOOL_JS_COMMAND_BAR_ITALICIZE var objItalicCommand = new Command(this.Name + "Italic", IconPath + "rtf_italic.gif", Priv.GetResourcedString(IDS_FORMS_TOOL_JS_COMMAND_BAR_ITALICIZE), "doItalic('" + this.Name + "')"); objRichTextCommandBar.addCommand(objItalicCommand); // IDS_FORMS_TOOL_JS_COMMAND_BAR_UNDERLINE var objUnderlineCommand = new Command(this.Name + "Underline", IconPath + "rtf_underline.gif", Priv.GetResourcedString(IDS_FORMS_TOOL_JS_COMMAND_BAR_UNDERLINE), "doUnderline('" + this.Name + "')"); objRichTextCommandBar.addCommand(objUnderlineCommand); objRichTextCommandBar.addSeparator(); // IDS_FORMS_TOOL_JS_COMMAND_BAR_CHOOSE_FONT var objChooseFontCommand = new Command(this.Name + "ChooseFont", "rtf_choosefont.gif", Priv.GetResourcedString(IDS_FORMS_TOOL_JS_COMMAND_BAR_CHOOSE_FONT), "doChooseFont('" + this.Name + "')"); objRichTextCommandBar.addCommand(objChooseFontCommand); // IDS_FORMS_TOOL_JS_COMMAND_BAR_CHOOSE_COLOR var objChooseColorCommand = new Command(this.Name + "ChooseColor", "rtf_choosecolor.gif", Priv.GetResourcedString(IDS_FORMS_TOOL_JS_COMMAND_BAR_CHOOSE_COLOR), "doChooseColor('" + this.Name + "')"); objRichTextCommandBar.addCommand(objChooseColorCommand); objRichTextCommandBar.addSeparator(); // IDS_FORMS_TOOL_JS_COMMAND_BAR_ALIGN_LEFT var objAlignLeftCommand = new Command(this.Name + "AlignLeft", "rtf_alignleft.gif", Priv.GetResourcedString(IDS_FORMS_TOOL_JS_COMMAND_BAR_ALIGN_LEFT), "doAlignLeft('" + this.Name + "')"); objRichTextCommandBar.addCommand(objAlignLeftCommand); // IDS_FORMS_TOOL_JS_COMMAND_BAR_CENTER var objCenterCommand = new Command(this.Name + "Center", "rtf_center.gif", Priv.GetResourcedString(IDS_FORMS_TOOL_JS_COMMAND_BAR_CENTER), "doCenter('" + this.Name + "')"); objRichTextCommandBar.addCommand(objCenterCommand); // IDS_FORMS_TOOL_JS_COMMAND_BAR_ALIGN_RIGHT var objAlignRightCommand = new Command(this.Name + "AlignRight", "rtf_alignright.gif", Priv.GetResourcedString(IDS_FORMS_TOOL_JS_COMMAND_BAR_ALIGN_RIGHT), "doAlignRight('" + this.Name + "')"); objRichTextCommandBar.addCommand(objAlignRightCommand); // IDS_FORMS_TOOL_JS_COMMAND_BAR_JUSTIFY var objJustifyCommand = new Command(this.Name + "Justify", "rtf_justify.gif", Priv.GetResourcedString(IDS_FORMS_TOOL_JS_COMMAND_BAR_JUSTIFY), "doJustify('" + this.Name + "')"); objRichTextCommandBar.addCommand(objJustifyCommand); objRichTextCommandBar.addSeparator(); // IDS_FORMS_TOOL_JS_COMMAND_BAR_BULLETS var objBulletsCommand = new Command(this.Name + "Bullets", "rtf_bullets.gif", Priv.GetResourcedString(IDS_FORMS_TOOL_JS_COMMAND_BAR_BULLETS), "doBullets('" + this.Name + "')"); objRichTextCommandBar.addCommand(objBulletsCommand); // IDS_FORMS_TOOL_JS_COMMAND_BAR_INCREASE_INDENT var objIncreaseIndentCommand = new Command(this.Name + "IncreaseIndent", "rtf_increaseindent.gif", Priv.GetResourcedString(IDS_FORMS_TOOL_JS_COMMAND_BAR_INCREASE_INDENT), "doIncreaseIndent('" + this.Name + "')"); objRichTextCommandBar.addCommand(objIncreaseIndentCommand); // IDS_FORMS_TOOL_JS_COMMAND_BAR_DECREASE_INDENT var objDecreaseIndentCommand = new Command(this.Name + "DecreaseIndent", "rtf_decreaseindent.gif", Priv.GetResourcedString(IDS_FORMS_TOOL_JS_COMMAND_BAR_DECREASE_INDENT), "doDecreaseIndent('" + this.Name + "')"); objRichTextCommandBar.addCommand(objDecreaseIndentCommand); objRichTextCommandBar.addSeparator(); // IDS_FORMS_TOOL_JS_COMMAND_BAR_CHECK_SPELLING var objSpellCheckCommand = new Command(this.Name + "SpellCheck", "rtf_spellcheck.gif", Priv.GetResourcedString(IDS_FORMS_TOOL_JS_COMMAND_BAR_CHECK_SPELLING), "doSpellCheck('" + this.Name + "')"); objRichTextCommandBar.addCommand(objSpellCheckCommand); RichTextHTML = objRichTextCommandBar.getBody(); // IDS_FORMS_TOOL_JS_COMMAND_BAR_HYPERLINK var objHyperlinkCommand = new Command(this.Name + "Hyperlink", "rtf_hyperlink.gif", Priv.GetResourcedString(IDS_FORMS_TOOL_JS_COMMAND_BAR_HYPERLINK), "doHyperlink('" + this.Name + "')"); objRichTextCommandBar.addCommand(objHyperlinkCommand); RichTextHTML = objRichTextCommandBar.getBody(); } if (g_IsFormPreview || !g_IsReadOnly || (g_IsReadOnly && !g_IsPreviewPane && !g_IsPrinting)) { RichTextHTML += "<SCRIPT LANGUAGE=\"JavaScript\" FOR=\"" + this.Name + "\" EVENT=\"OnChange()\">setIsDirty();</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 + "');</SCRIPT>"; } else { RichTextHTML += "<SCRIPT LANGUAGE=\"JavaScript\" FOR=\"" + this.Name + "\" EVENT=\"OnKillFocus()\">validateRequiredRichText('" + 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" : ""); if (g_IsReadOnly) { this.IsBorderHidden = true; if (this.BackgroundColor == null || this.BackgroundColor == "") this.BackgroundColor = "Transparent"; } RichTextHTML += (this.IsBorderHidden ? " ISBORDERHIDDEN" : ""); RichTextHTML += (this.IsSearchable ? " ISSEARCHABLE" : ""); RichTextHTML += (this.PropagateUpdates ? " PROPAGATEUPDATES" : ""); 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; } // ============================================ \\ // === 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 = function() { var Priv = getScriptHostQI("IGrooveFormsToolUIDelegatePrivate"); var objAttachmentsCommandBar = new CommandBar(this.Name, "width:200px"); // IDS_FORMS_TOOL_JS_COMMAND_BAR_ADD_ATTACHMENT var objAddCommand = new Command(this.Name + "Add", "add.gif", Priv.GetResourcedString(IDS_FORMS_TOOL_JS_COMMAND_BAR_ADD_ATTACHMENT), "doAddAttachments()"); objAttachmentsCommandBar.addCommand(objAddCommand); // IDS_FORMS_TOOL_JS_COMMAND_BAR_LAUNCH_ATTACHMENT var objLaunchCommand = new Command(this.Name + "Launch", "launch.gif", Priv.GetResourcedString(IDS_FORMS_TOOL_JS_COMMAND_BAR_LAUNCH_ATTACHMENT), "doLaunchSelectedAttachments()"); objAttachmentsCommandBar.addCommand(objLaunchCommand); // IDS_FORMS_TOOL_JS_COMMAND_BAR_SAVE_ATTACHMENT var objSaveCommand = new Command(this.Name + "Save", "save.gif", Priv.GetResourcedString(IDS_FORMS_TOOL_JS_COMMAND_BAR_SAVE_ATTACHMENT), "doSaveSelectedAttachments()"); objAttachmentsCommandBar.addCommand(objSaveCommand); // IDS_FORMS_TOOL_JS_COMMAND_BAR_DELETE_ATTACHMENT var objDeleteCommand = new Command(this.Name + "Delete", "delete.gif", Priv.GetResourcedString(IDS_FORMS_TOOL_JS_COMMAND_BAR_DELETE_ATTACHMENT), "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 += " WIDTH=\"200\""; AttachmentsHTML += " HEIGHT=\"75\""; AttachmentsHTML += (this.IsHidden ? " ISHIDDEN" : ""); AttachmentsHTML += (this.IsReadOnly ? " ISREADONLY" : ""); AttachmentsHTML += (this.PropagateUpdates ? " PROPAGATEUPDATES" : ""); AttachmentsHTML += " INHERIT=\"" + this.InheritFrom + "\""; AttachmentsHTML += " TABINDEX=\"-1\""; AttachmentsHTML += " DATATYPE=\"Attachments\"></OBJECT>"; return AttachmentsHTML; } AttachmentsField.prototype.getRequired = function() { return ""; } // ============================================ \\ // === Contact Field === \\ // ============================================ \\ function ContactField(i_Name, i_Label, i_Container) { if (arguments.length > 0) this.initField(i_Name, i_Label, i_Container); this.IsAwarenessIconHidden = false; this.IsContextMenuHidden = false; this.UseAuthenticationColor = false; this.Type = FormObjectType_Contact; } ContactField.prototype = new Field; ContactField.prototype.getBody = function() { var ContactHTML = "<SPAN"; ContactHTML += " NAME=\"" + this.Name + "\""; ContactHTML += " ID=\"" + this.Name + "\""; ContactHTML += " FIELDTYPE=\"" + this.Type + "\""; ContactHTML += (this.IsReadOnly ? " ISREADONLY" : ""); ContactHTML += (this.IsHidden ? " ISHIDDEN" : ""); ContactHTML += (this.IsRequired ? " ISREQUIRED" : ""); ContactHTML += (this.PropagateUpdates ? " PROPAGATEUPDATES" : ""); ContactHTML += " INHERIT=\"" + this.InheritFrom + "\""; ContactHTML += (this.IsAwarenessIconHidden ? " ISAWARENESSICONHIDDEN" : ""); ContactHTML += (this.IsContextMenuHidden ? " ISCONTEXTMENUHIDDEN" : ""); ContactHTML += (this.UseAuthenticationColor ? " USEAUTHENTICATIONCOLOR" : ""); ContactHTML += " STYLE=\"cursor:default; padding-right:4px;\""; ContactHTML += " DATATYPE=\"Contact\""; ContactHTML += (this.IsContextMenuHidden ? "" : " ONCONTEXTMENU=\"showContactMenu('" + this.Name + "');\""); ContactHTML += " ONDBLCLICK=\"sendMessage('" + this.Name + "');\""; ContactHTML += " ONSELECTSTART=\"return false;\""; ContactHTML += " ONMOUSEOVER=\"updateIdleTime('" + this.Name +"');\">"; ContactHTML += "<IMG ID=\"" + this.Name + "_Icon\" STYLE=\"display:none; width:16px; height:16px;\" HSPACE=2>"; ContactHTML += "<SPAN ID=\"" + this.Name + "_Name\"></SPAN>"; ContactHTML += "</SPAN>"; if (!this.IsReadOnly && !g_IsReadOnly && !g_IsSearch) { var Priv = getScriptHostQI("IGrooveFormsToolUIDelegatePrivate"); ContactHTML += "<BUTTON CLASS=\"dateButton\" STYLE=\"height:24px; width:24px;\""; ContactHTML += " NAME=\"" + this.Name + "Button\""; ContactHTML += " ID=\"" + this.Name + "Button\""; ContactHTML += " TABINDEX=\"1\""; // IDS_FORMS_TOOL_JS_CONTACT_TITLE ContactHTML += " TITLE=\"" + Priv.GetResourcedString(IDS_FORMS_TOOL_JS_CONTACT_TITLE) + "\""; ContactHTML += " ONCLICK=\"selectContact('" + this.Name + "');\">"; ContactHTML += "<IMG SRC=\"../../../ToolIcons/ContactSelector.ico\" WIDTH=16 HEIGHT=16>"; ContactHTML += "</BUTTON>"; } return ContactHTML; } // ============================================ \\ // === 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 = -1; this.EmbeddedViewFilter = ""; this.Type = FormObjectType_EmbeddedView; } EmbeddedViewField.prototype = new Field; EmbeddedViewField.prototype.getBody = function() { var Priv = getScriptHostQI("IGrooveFormsToolUIDelegatePrivate"); var EmbeddedViewHTML = "<DIV"; EmbeddedViewHTML += " STYLE=\"border:2px solid black; padding:4px; background-color:white; color:black;\">"; var MsgFormatEnum = CreateBSTREnumFromArray([this.Name]); // IDS_FORMS_TOOL_JS_EMBEDDED_VIEW_INFO EmbeddedViewHTML += Priv.MessageFormat(IDS_FORMS_TOOL_JS_EMBEDDED_VIEW_INFO, MsgFormatEnum); EmbeddedViewHTML += "</DIV>"; return EmbeddedViewHTML; /* 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 += " 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; */ } // ============================================ \\ // === Static Field Class === \\ // ============================================ \\ function Static() { this.Name = ""; this.IsHidden = false; this.ColumnSpan = 1; this.RowSpan = 1; } Static.prototype.initStatic = function(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 = function() { 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 = function() { 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 = function() { 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 = function() { 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 = function() { 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 = function() { var ScriptButtonHTML = "<BUTTON"; ScriptButtonHTML += " CLASS=\"button\""; ScriptButtonHTML += " NAME=\"" + this.Name + "\""; ScriptButtonHTML += " ID=\"" + this.Name + "\""; ScriptButtonHTML += " TABINDEX=\"1\""; 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 = function() { 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 += " 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 Priv = getScriptHostQI("IGrooveFormsToolUIDelegatePrivate"); var UnknownHTML = "<DIV"; UnknownHTML += " STYLE=\"border:2px solid black; padding:4px; background-color:white; color:black;\">"; var MsgFormatEnum = CreateBSTREnumFromArray([this.Name]); // IDS_FORMS_TOOL_JS_UNKNOWN_FIELD_INFO UnknownHTML += Priv.MessageFormat(IDS_FORMS_TOOL_JS_UNKNOWN_FIELD_INFO, MsgFormatEnum); 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 + '; height:16px;" 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 += ' TABINDEX=\"1\"'; CommandBarHTML += ' ONCLICK="if (!this.getAttribute(\'COMMANDDISABLED\')) { ' + objCommand.Action + '; }"'; CommandBarHTML += ' ONKEYUP="if (event.keyCode == 32 && !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; }