home *** CD-ROM | disk | FTP | other *** search
/ ftp.tcs3.com / ftp.tcs3.com.tar / ftp.tcs3.com / DRIVERS / Audio / Office2010 / ProPlus.WW / ProPsWW.cab / FORMSHOMEPAGESCRIPT.JS3 < prev    next >
Text File  |  2007-02-04  |  8KB  |  200 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. // Capture keydown and contextmenu events for the document.
  13. document.oncontextmenu = contextMenuEvent;
  14.  
  15. function contextMenuEvent()
  16. {
  17.     // Right-click context menu will only appear if 'Ctrl' key is held down.
  18.     if (!event.ctrlKey)
  19.         event.returnValue = false;
  20. }
  21.  
  22. function initMainPage()
  23. {
  24.     var GrooveFormsToolDesignObjectType_Form = 0x0001;
  25.     var GrooveFormsToolDesignObjectType_View = 0x0002;
  26.  
  27.  
  28.     var bNavigated = false;
  29.     // If the design is initialized and there are at least one form and view, go to the view frame.
  30.     if (getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").IsDesignInitialized(false))
  31.     {
  32.         if (getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").DesignObjectCount(GrooveFormsToolDesignObjectType_Form, false) > 0 &&
  33.             getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").DesignObjectCount(GrooveFormsToolDesignObjectType_View, false) > 0)
  34.         {
  35.             if (getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").NeedToAutoCreateRecord())
  36.             {
  37.                 var dFormID = getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").AutoCreateForm;
  38.                 if (dFormID == -1)
  39.                     dFormID = getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").DefaultFormID;                    
  40.                 
  41.                 // Navigate to the form designated for auto-creating.
  42.                 if (dFormID != -1)
  43.                 {
  44.                     var sFormID = getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").ConvertDesignObjectIDToString(dFormID);
  45.                     window.location.replace("FormsFormTemplate.html?FormID=" + sFormID);
  46.                     bNavigated = true;
  47.                 }
  48.             }
  49.             else if (getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").DocumentMode)
  50.             {
  51.                 var Transaction = getScriptHostQI("IGrooveFormsToolUIDelegate").OpenTransaction();
  52.                 try
  53.                 {
  54.                     if (getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").DesignObjectCount(GrooveFormsToolDesignObjectType_Form) > 0)
  55.                     {
  56.                         
  57.                         var dFormID = getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").DefaultFormID;
  58.                         var sFormID = getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").ConvertDesignObjectIDToString(dFormID);
  59.                         // Get the currently selected record ID.
  60.                         var dRecordID = getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").GetSelectedRecordID();
  61.                         if (dRecordID == -1 || !getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").IsValidRecord(dRecordID))
  62.                             dRecordID = getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").GetFirstValidRecordID();
  63.                         
  64.                         if (getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").IsValidRecord(dRecordID))
  65.                         {
  66.                             var sRecordID = getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").ConvertDesignObjectIDToString(dRecordID);
  67.                             
  68.                             // If the record has a form specified use it instead of the first form in the enum.
  69.                             var Record = getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").OpenRecord(dRecordID);
  70.                             if (Record.HasField("Forms_Tool_grooveFormID"))
  71.                             {
  72.                                 dFormID = Record.OpenField("Forms_Tool_grooveFormID");
  73.                                 sFormID = getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").ConvertDesignObjectIDToString(dFormID);
  74.                             }
  75.                             
  76.                             if (dFormID != -1)
  77.                             {
  78.                                 window.location.replace("FormsFormTemplate.html?FormID=" + sFormID + "&RecordID=" + sRecordID);
  79.                                 bNavigated = true;
  80.                                 // Call to set the initial state of the StatusBarViewNameButton
  81.                                 getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").SetCurrentDocumentModeRecordID(dRecordID);
  82.                             }
  83.                         }
  84.                         else
  85.                             getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").SetCurrentDocumentModeRecordID(-1);
  86.                     }
  87.                     Transaction.Commit();
  88.                 }
  89.                 catch(error)
  90.                 {
  91.                     //alert("Tranaction aborted in initMainPage [" + error.description + "]");
  92.                     Transaction.Abort();
  93.                 }
  94.             }
  95.             else
  96.             {
  97.                 window.location.replace("FormsViewFrame.html");
  98.                 bNavigated = true;
  99.             }
  100.         }
  101.     }
  102.  
  103.     if (!bNavigated)
  104.     {
  105.         // If the design is not complete, display the welcome page.
  106.         setVisibility("tblMain", "visible");
  107.  
  108.         // Disable the command bar buttons that can't be used yet.
  109.         getScriptHostQI("IGrooveFormsToolUIDelegateHomePagePrivate").DisableUICommands();
  110.  
  111.         if (getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").CanUseDesigner)
  112.         {
  113.             try
  114.             {
  115.                 if (getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").IsDesignInitialized(true) ||
  116.                     (getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").DesignObjectCount(GrooveFormsToolDesignObjectType_Form, false) <= 0 && 
  117.                     getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").DesignObjectCount(GrooveFormsToolDesignObjectType_View, false) > 0) ||
  118.                     (getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").DesignObjectCount(GrooveFormsToolDesignObjectType_Form, false) > 0 && 
  119.                     getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").DesignObjectCount(GrooveFormsToolDesignObjectType_View, false) <= 0))
  120.                 {
  121.                     setDisplay("divSandbox", "block");
  122.                     setDisplay("divSandboxButton", "block");
  123.                 }
  124.                 else
  125.                 {
  126.                     setDisplay("divDesigner", "block");
  127.  
  128.                     if (getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").DesignObjectCount(GrooveFormsToolDesignObjectType_Form, false) <= 0 &&
  129.                         getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").DesignObjectCount(GrooveFormsToolDesignObjectType_View, false) <= 0)
  130.                     {
  131.                         setVisibility("pDesigner", "visible");
  132.                         setDisplay("divButton", "block");
  133.                     }
  134.                 }
  135.             }
  136.             catch (error)
  137.             {
  138.                 // Hide designer related divs on error.
  139.                 setDisplay("divDesigner", "none");
  140.                 setDisplay("divButton", "none");
  141.                 // Show generic non-designer div on error.
  142.                 setDisplay("divNonDesigner", "block");
  143.             }
  144.         }
  145.         else
  146.             setDisplay("divNonDesigner", "block");
  147.     }
  148. }
  149.  
  150. function setVisibility(i_ID, i_Visibility)
  151. {
  152.     var objVisibility = document.getElementById(i_ID);
  153.     if (objVisibility != null)
  154.         objVisibility.style.visibility = i_Visibility;
  155. }
  156.  
  157. function setDisplay(i_ID, i_Display)
  158. {
  159.     var objDisplay = document.getElementById(i_ID);
  160.     if (objDisplay != null)
  161.         objDisplay.style.display = i_Display;
  162. }
  163.  
  164. function doButtonOver()
  165. {
  166.     tdButtonLeft.style.background = "url(button_left_over.gif)";
  167.     tdButtonMid.style.background = "url(button_mid_over.gif)";
  168.     tdButtonRight.style.background = "url(button_right_over.gif)";
  169. }
  170.  
  171. function doButtonOut()
  172. {
  173.     tdButtonLeft.style.background = "url(button_left.gif)";
  174.     tdButtonMid.style.background = "url(button_mid.gif)";
  175.     tdButtonRight.style.background = "url(button_right.gif)";
  176. }
  177.  
  178. function doSandboxButtonOver()
  179. {
  180.     tdSandboxButtonLeft.style.background = "url(button_left_over.gif)";
  181.     tdSandboxButtonMid.style.background = "url(button_mid_over.gif)";
  182.     tdSandboxButtonRight.style.background = "url(button_right_over.gif)";
  183. }
  184.  
  185. function doSandboxButtonOut()
  186. {
  187.     tdSandboxButtonLeft.style.background = "url(button_left.gif)";
  188.     tdSandboxButtonMid.style.background = "url(button_mid.gif)";
  189.     tdSandboxButtonRight.style.background = "url(button_right.gif)";
  190. }
  191.  
  192. function goCreate()
  193. {
  194.     getScriptHostQI("IGrooveFormsToolUIDelegateHomePagePrivate").CreateNewForm();
  195. }
  196.  
  197. function goContinue()
  198. {
  199.     getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").SwitchWebState(FormsUIState_SettingsAndOptions, -1);
  200. }