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

  1. /*********************************************************************
  2.                                  Notice
  3.  
  4. You may not modify, use, copy or distribute this file or its contents. 
  5. Internal interfaces referenced in this file are nonpublic, unsupported 
  6. and subject to change without notice. These interfaces may not be 
  7. utilized in other software applications or components.
  8.  
  9.  
  10. *********************************************************************/
  11.  
  12. // ============================================================ \\
  13. // form_edit.js                                                 \\
  14. // ------------                                                 \\
  15. // This file contains functions that override what is comtained \\
  16. // in form.js, that allow form preview and layout changes.      \\
  17. // ============================================================ \\
  18.  
  19. FieldContainer.prototype.displayFields = function()
  20. {
  21.     var strDivName = "divFieldsContainer";
  22.     if (this.IsHeading)
  23.         strDivName = "divHeadingFieldsContainer";
  24.  
  25.     var FieldsHTML = getFields(this);
  26.     var objDivFieldContainer = document.getElementById(strDivName);
  27.     if (objDivFieldContainer != null)
  28.         objDivFieldContainer.innerHTML = FieldsHTML;
  29. }
  30.  
  31. function getFieldCellHTML(i_FormObject, i_objContainer)
  32. {
  33.     var FieldCellHTML = "";
  34.  
  35.     if (i_FormObject != null)
  36.     {
  37.         if (i_FormObject.Type == FormObjectType_TabGroup)
  38.         {
  39.             var StyleAttribute = "";
  40.             if (i_FormObject.IsHidden)
  41.                 StyleAttribute = " STYLE=\"display:none;\"";
  42.  
  43.             var FieldBodyHTML = "<TABLE CELLPADDING=\"0\" CELLSPACING=\"0\" BORDER=\"0\" WIDTH=\"100%\"" + StyleAttribute + "><TR>";
  44.  
  45.             if (i_FormObject.Tabs.length > 1)
  46.             {
  47.                 FieldBodyHTML += "<TD>";
  48.                 for (var i = 0; i < i_FormObject.Tabs.length; i++)
  49.                 {
  50.                     var Tab = i_FormObject.Tabs[i];
  51.                     var ClassAttribute = " CLASS=\"";
  52.                     if (i_FormObject.ActiveTabName == Tab.Name || (i == 0 && i_FormObject.ActiveTabName == ""))
  53.                     {
  54.                         i_FormObject.ActiveTabName = Tab.Name;
  55.                         ClassAttribute += "activeTab";
  56.                     }
  57.                     else
  58.                         ClassAttribute += "inactiveTab";
  59.                     FieldBodyHTML += "<SPAN STYLE=\"padding:2px 8px 2px 8px;\"" + ClassAttribute + "\" ID=\"" + Tab.Name + "\" ONCLICK=\"selectTab(obj" + Tab.Name + ", obj" + i_FormObject.Name + ")\" ONMOUSEOVER=\"hoverTab(obj" + Tab.Name + ", obj" + i_FormObject.Name + ")\">" + Tab.Text + "</SPAN>";
  60.                 }
  61.                 FieldBodyHTML += "</TD></TR><TR>";
  62.             }
  63.             FieldBodyHTML += "<TD CLASS=\"tabContents\">";
  64.  
  65.             for (var i = 0; i < i_FormObject.Tabs.length; i++)
  66.             {
  67.                 var Tab = i_FormObject.Tabs[i];
  68.                 var StyleAttribute = " STYLE=\"display:none; width:100%;\"";
  69.                 if (i_FormObject.ActiveTabName == Tab.Name || (i == 0 && i_FormObject.ActiveTabName == ""))
  70.                     StyleAttribute = " STYLE=\"width:100%;\"";
  71.                 var LayoutScript = "";
  72.                 if (i_FormObject.Tabs.length == 1)
  73.                     LayoutScript = " ONCLICK=\"selectTab(obj" + Tab.Name + ", obj" + i_FormObject.Name + ")\" ONMOUSEOVER=\"hoverTab(obj" + Tab.Name + ", obj" + i_FormObject.Name + ")\"";
  74.                 FieldBodyHTML += "<DIV ID=\"" + Tab.Name + "Contents\"" + StyleAttribute + LayoutScript + ">";
  75.                 FieldBodyHTML += getTableHTML(Tab);
  76.                 FieldBodyHTML += "</DIV>";
  77.             }
  78.             FieldBodyHTML += "</TD></TR></TABLE>";
  79.  
  80.             // The CLASS attribute for the TD tag.
  81.             var ClassAttribute = "";
  82.             if (i_FormObject.ClassName != "")
  83.                 ClassAttribute = " CLASS=\"" + i_FormObject.ClassName + "\"";
  84.             // The ONCLICK attribute for the TD tags.
  85.             var OnClickAttribute = " ONCLICK=\"if (typeof obj" + i_FormObject.Name + " != 'undefined') { selectField(obj" + i_FormObject.Name + "); }\"";
  86.             var OnMouseOverAttribute = " ONMOUSEOVER=\"if (typeof obj" + i_FormObject.Name + " != 'undefined') { hoverField(obj" + i_FormObject.Name + "); }\"";
  87.             // The TITLE attribute for the TD tags.
  88.             var TitleAttribute = " TITLE=\"Click to select this field: " + i_FormObject.Name + "\"";
  89.             // The common attributes for label and field TD tags.
  90.             var LabelAttributes = " VALIGN=\"top\" STYLE=\"cursor:hand;\"" + OnClickAttribute + OnMouseOverAttribute + " ID=\"" + i_FormObject.Name + "_label\"" + ClassAttribute + TitleAttribute;
  91.             var FieldAttributes = " VALIGN=\"top\" STYLE=\"cursor:hand;\"" + OnClickAttribute + OnMouseOverAttribute + " ID=\"" + i_FormObject.Name + "_field\"" + ClassAttribute + TitleAttribute;
  92.             // The COLSPAN attribute for the TD tag.
  93.             var ColumnSpan = getSpanAttribute("COLSPAN", i_FormObject.ColumnSpan * 2);
  94.             var RowSpan = getSpanAttribute("ROWSPAN", i_FormObject.RowSpan);
  95.             // The COLSPAN attribute for the TD tag.
  96.             var FieldColumnSpan = getSpanAttribute("COLSPAN", (i_FormObject.ColumnSpan * 2) - 1);
  97.             // The FONT tag containing the field label.
  98.             var FieldLabel = "<FONT CLASS=\"fieldLabel\">" + i_FormObject.Label + "</FONT>";
  99.  
  100.             switch (i_FormObject.LabelPosition)
  101.             {
  102.                 case "Right":
  103.                     FieldCellHTML += "<TD" + FieldAttributes + RowSpan + ">" + FieldBodyHTML + "</TD>";
  104.                     FieldCellHTML += "<TD" + LabelAttributes + FieldColumnSpan + RowSpan + ">" + FieldLabel + "</TD>";
  105.                     break;
  106.                 case "Top":
  107.                     FieldCellHTML += "<TD" + FieldAttributes + ColumnSpan + RowSpan + ">" + ((i_FormObject.Label != "") ? FieldLabel + "<BR>" : "") + FieldBodyHTML + "</TD>";
  108.                     break;
  109.                 default:
  110.                     FieldCellHTML += "<TD" + LabelAttributes + RowSpan + ">" + FieldLabel + "</TD>";
  111.                     FieldCellHTML += "<TD" + FieldAttributes + FieldColumnSpan + RowSpan + ">" + FieldBodyHTML + "</TD>";
  112.                     break;
  113.             }
  114.         }
  115.         else
  116.         {
  117.             // Get the body HTML for the field.
  118.             var FieldBodyHTML = "";
  119.             if (i_FormObject.Type == FormObjectType_FieldGroup)
  120.                 FieldBodyHTML = getFieldGroupBody(i_FormObject, true);
  121.             else
  122.                 FieldBodyHTML = i_FormObject.getBody();
  123.  
  124.             // The STYLE attribute for TD tags.
  125.             var FieldStyleAttribute = "";
  126.             var LabelStyleAttribute = "";
  127.             // Hide fields that should be hidden.
  128.             if (i_FormObject.IsHidden)
  129.             {
  130.                 FieldStyleAttribute += " STYLE=\"display:none;\"";
  131.                 LabelStyleAttribute += " STYLE=\"display:none;\"";
  132.             }
  133.  
  134.             // The CLASS attribute for the TD tags.
  135.             var ClassAttribute = "";
  136.             if (i_FormObject.ClassName != "")
  137.                 ClassAttribute = " CLASS=\"" + i_FormObject.ClassName + "\"";
  138.             // None of these properties apply to form heading fields.
  139.             var OnClickAttribute = "";
  140.             var OnMouseOverAttribute = "";
  141.             var TitleAttribute = "";
  142.             var LabelAttributes = " VALIGN=\"top\"";
  143.             var FieldAttributes = " VALIGN=\"top\"";
  144.             var ColumnSpan = "";
  145.             var RowSpan = getSpanAttribute("ROWSPAN", i_FormObject.RowSpan);
  146.             // If it is not a form heading field, set appropriate attributes.
  147.             if (!i_objContainer.IsHeading)
  148.             {
  149.                 // The ONCLICK attribute for the TD tags.
  150.                 OnClickAttribute = " ONCLICK=\"if (typeof obj" + i_FormObject.Name + " != 'undefined') { selectField(obj" + i_FormObject.Name + "); }\"";
  151.                 OnMouseOverAttribute = " ONMOUSEOVER=\"if (typeof obj" + i_FormObject.Name + " != 'undefined') { hoverField(obj" + i_FormObject.Name + "); }\"";
  152.                 // The TITLE attribute for the TD tags.
  153.                 TitleAttribute = " TITLE=\"Click to select this field: " + i_FormObject.Name + "\"";
  154.                 // The common attributes for label and field TD tags.
  155.                 var LabelAttributes = " VALIGN=\"top\" STYLE=\"cursor:hand;\"" + OnClickAttribute + OnMouseOverAttribute + " ID=\"" + i_FormObject.Name + "_label\"" + ClassAttribute + TitleAttribute;
  156.                 var FieldAttributes = " VALIGN=\"top\" STYLE=\"cursor:hand;\"" + OnClickAttribute + OnMouseOverAttribute + " ID=\"" + i_FormObject.Name + "_field\"" + ClassAttribute + TitleAttribute;
  157.                 // The COLSPAN attribute for the TD tag.
  158.                 var ColumnSpan = getSpanAttribute("COLSPAN", i_FormObject.ColumnSpan * 2);
  159.             }
  160.  
  161.             if (i_FormObject instanceof Static)
  162.             {
  163.                 FieldCellHTML += "<TD" + FieldAttributes + FieldStyleAttribute + ColumnSpan + RowSpan + ">" + FieldBodyHTML + "</TD>";
  164.             }
  165.             else
  166.             {
  167.                 // The COLSPAN attribute for the TD tag.
  168.                 var FieldColumnSpan = getSpanAttribute("COLSPAN", (i_FormObject.ColumnSpan * 2) - 1);
  169.                 // The FONT tag containing the field label.
  170.                 var FieldLabel = "<FONT CLASS=\"fieldLabel\">" + i_FormObject.Label + i_FormObject.getRequired() + "</FONT>";
  171.  
  172.                 switch (i_FormObject.LabelPosition)
  173.                 {
  174.                     case "Right":
  175.                         FieldCellHTML += "<TD" + FieldAttributes + FieldStyleAttribute + RowSpan + ">" + FieldBodyHTML + "</TD>";
  176.                         FieldCellHTML += "<TD" + LabelAttributes + LabelStyleAttribute + FieldColumnSpan + RowSpan + ">" + FieldLabel + "</TD>";
  177.                         break;
  178.                     case "Top":
  179.                         FieldCellHTML += "<TD" + FieldAttributes + FieldStyleAttribute + ColumnSpan + RowSpan + ">" + ((i_FormObject.Label != "" || i_FormObject.getRequired() != "") ? FieldLabel + "<BR>" : "") + FieldBodyHTML + "</TD>";
  180.                         break;
  181.                     default:
  182.                         FieldCellHTML += "<TD" + LabelAttributes + LabelStyleAttribute + RowSpan + ">" + FieldLabel + "</TD>";
  183.                         FieldCellHTML += "<TD" + FieldAttributes + FieldStyleAttribute + FieldColumnSpan + RowSpan + ">" + FieldBodyHTML + "</TD>";
  184.                         break;
  185.                 }
  186.             }
  187.         }
  188.     }
  189.     else
  190.     {
  191.         FieldCellHTML += "<TD COLSPAN=\"2\"></TD>";
  192.     }
  193.  
  194.     return FieldCellHTML;
  195. }