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