home *** CD-ROM | disk | FTP | other *** search
/ ftp.tcs3.com / ftp.tcs3.com.tar / ftp.tcs3.com / DRIVERS / Audio / Office2010 / ProPlus.WW / ProPsWW2.cab / VIEW.JS3 < prev    next >
Text File  |  2007-02-04  |  8KB  |  262 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. var g_objDataList;
  14.  
  15. var g_DataListInitialized = false;
  16.  
  17. var g_CurrentRecordID = -1;
  18. var g_CurrentFormID = -1;
  19. var g_PreviousRecordID = -1;
  20. var g_PreviousFormID = -1;
  21.  
  22. var g_PreviewTimeoutID;
  23. var g_ResizeTimeoutID;
  24.  
  25.  
  26. // =====================================================
  27. // ===            Document Event Handlers            ===
  28. // =====================================================
  29.  
  30. document.oncontextmenu = contextMenuEvent;
  31.  
  32. function contextMenuEvent()
  33. {
  34.     // Right-click context menu will only appear if 'Ctrl' key is held down.
  35.     if (!event.ctrlKey)
  36.         event.returnValue = false;
  37. }
  38.  
  39. // =====================================================
  40. // ===              View Initialization              ===
  41. // =====================================================
  42.  
  43. function initViewPage(i_ViewID)
  44. {
  45.     // Pass out document to be used by glue code.
  46.     getScriptHostQI("IGrooveFormsToolUIDelegateViewPrivate").SetCurrentDocument(document);
  47.  
  48.     // Find the data view object in the page.
  49.     var arrObject = document.getElementsByTagName("OBJECT");
  50.     if (arrObject.length > 0)
  51.     {
  52.         g_objDataList = arrObject[0];
  53.         resizeDataListDelayed();
  54.     }
  55.     
  56.     if (g_objDataList)
  57.         setTimeout("enableDataList()", 50);
  58.  
  59.     // Tell the UIDelegate we are in the ViewData state.
  60.     getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").SwitchWebState(FormsUIState_ViewData, g_CurrentRecordID);
  61.  
  62.     // Add the document so HTMLComponentBridge can spin up objects.
  63.     addDocument();
  64. }
  65.  
  66. function resizeDataList()
  67. {
  68.     window.clearTimeout(g_ResizeTimeoutID);
  69.     g_ResizeTimeoutID = window.setTimeout("resizeDataListDelayed()", 10);
  70. }
  71.  
  72. function resizeDataListDelayed()
  73. {
  74.     var intHeight = document.body.offsetHeight;
  75.     var intWidth = document.body.offsetWidth;
  76.     if (getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").ShowPreviewPane)
  77.     {
  78.         intHeight += 2;
  79.         intWidth += 4;
  80.     }
  81.     g_objDataList.height = intHeight;
  82.     g_objDataList.width = intWidth;
  83. }
  84.  
  85. function enableDataList()
  86. {
  87.     try
  88.     {
  89.         if (g_objDataList.IGrooveDataListDisplay.Initialized)
  90.         {
  91.             g_DataListInitialized = true;
  92.             getScriptHostQI("IGrooveFormsToolUIDelegateViewPrivate").EnableDataList(document, g_objDataList);
  93.             g_objDataList.focus();
  94.         }
  95.         else
  96.         {
  97.             setTimeout("enableDataList()", 50);
  98.         }
  99.     }
  100.     catch (error)
  101.     {
  102.         window.setTimeout("enableDataList()", 50);
  103.     }
  104. }
  105.  
  106. // =====================================================
  107. // ===               View Termination                ===
  108. // =====================================================
  109.  
  110. function terminateViewPage()
  111. {
  112.     // Remove the document so HTMLComponentBridge can terminate objects.
  113.     removeDocument();
  114. }
  115.  
  116. // =====================================================
  117. // ===             Button Event Handlers             ===
  118. // =====================================================
  119.  
  120. function goOpen(i_RowID)
  121. {
  122.     // Make sure the selected record ID is valid.
  123.     if (typeof i_RowID == "undefined" || i_RowID == null)
  124.     {
  125.         if (g_CurrentRecordID != null && g_CurrentRecordID != -1 && 
  126.             getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").DoesRecordExist(i_RowID))
  127.             i_RowID = g_CurrentRecordID;
  128.         else
  129.             return;
  130.     }
  131.  
  132.     // If the row is not a valid record, return else open the record.
  133.     if (getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").IsValidRecord(i_RowID))
  134.         return getScriptHostQI("IGrooveFormsToolUIDelegateViewPrivate").OpenViewRecord(i_RowID);
  135.     else
  136.         return;
  137. }
  138.  
  139. function goDelete()
  140. {
  141.     try
  142.     {
  143.         getScriptHostQI("IGrooveFormsToolUIDelegateViewPrivate").DeleteViewRecord(document);
  144.  
  145.         if (g_objDataList)
  146.             g_objDataList.focus();
  147.     }
  148.     catch(error)
  149.     {
  150.     }
  151. }
  152.  
  153. // =====================================================
  154. // ===            Record Preview Handlers            ===
  155. // =====================================================
  156.  
  157. function goPreview(i_RowID)
  158. {
  159.     window.clearTimeout(g_PreviewTimeoutID);
  160.     if (getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").IsValidRecord(i_RowID))
  161.         g_PreviewTimeoutID = window.setTimeout("goPreviewDelayed(" + i_RowID + ")", 350);
  162.     else
  163.         resetPreviewPane();
  164. }
  165.  
  166. function goPreviewDelayed(i_RowID)
  167. {
  168.     return getScriptHostQI("IGrooveFormsToolUIDelegateViewPrivate").PreviewViewRecord(i_RowID, document);
  169. }
  170.  
  171. // =====================================================
  172. // ===           Callback Preview Handlers           ===
  173. // =====================================================
  174.  
  175. function goPreviewRecord(i_RecordID, i_FormID)
  176. {
  177.     g_PreviousRecordID = g_CurrentRecordID;
  178.     g_PreviousFormID = g_CurrentFormID;
  179.     g_CurrentRecordID = i_RecordID;
  180.     g_CurrentFormID = i_FormID;
  181.  
  182.     if (g_PreviousFormID == g_CurrentFormID && g_CurrentFormID != -1)
  183.     {
  184.         window.top.FormsPreviewPage.removeDocument();
  185.         window.top.FormsPreviewPage.initFormPage(i_RecordID);
  186.     }
  187.     else if (g_CurrentFormID != -1)
  188.     {
  189.         // If there is a valid FormID, then navigate to that form and record.
  190.         var FormID = getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").ConvertDesignObjectIDToString(i_FormID);
  191.         var RecordID = getScriptHostQI("IGrooveFormsToolUIDelegatePrivate").ConvertDesignObjectIDToString(i_RecordID);
  192.         goPreviewURL("FormsFormTemplate.html?FormID=" + FormID + "&RecordID=" + RecordID + "&PreviewPane=true");
  193.     }
  194.     else
  195.     {
  196.         // If there is not valid FormID, then reset the preview pane.
  197.         resetPreviewPane();
  198.     }
  199. }
  200.  
  201. function goPreviewURL(i_URL)
  202. {
  203.     if (typeof window.top.FormsPreviewPage != "undefined" && window.top.FormsPreviewPage != null)
  204.         window.top.FormsPreviewPage.location.href = i_URL;
  205. }
  206.  
  207. function reloadPreviewPane()
  208. {
  209.     if (g_CurrentRecordID != -1)
  210.         goPreview(g_CurrentRecordID);
  211. }
  212.  
  213. function resetPreviewPane()
  214. {
  215.     goPreviewURL("FormsBlankPage.html");
  216.  
  217.     g_CurrentRecordID = -1;
  218.     g_PreviousRecordID = -1;
  219.     g_CurrentFormID = -1;
  220.     g_PreviousFormID = -1;
  221. }
  222.  
  223. // =====================================================
  224. // ===              View Event Handlers              ===
  225. // =====================================================
  226.  
  227. function goSetFocusRecordID(i_RowID)
  228. {
  229.     var RecordID = i_RowID;
  230.     if (RecordID != null)
  231.     {
  232.         g_CurrentRecordID = RecordID;
  233.         getScriptHostQI("IGrooveFormsToolUIDelegateViewPrivate").SetFocusRecordID(RecordID);
  234.         if (RecordID != -1)
  235.             g_objDataList.IGrooveDataListDisplay.ScrollToRow(RecordID);
  236.     }
  237. }
  238.  
  239. function goSetSelectedRecordID(i_DataListDisplay)
  240. {
  241.     getScriptHostQI("IGrooveFormsToolUIDelegateViewPrivate").SelectionChanged(i_DataListDisplay);    
  242. }
  243.  
  244. function goContextMenu(i_DataList, i_RowID, i_XPos, i_YPos)
  245. {
  246.     if (i_RowID != null  && i_RowID != -1)
  247.         getScriptHostQI("IGrooveFormsToolUIDelegateViewPrivate").ShowDataListContextMenu(i_DataList, i_RowID, i_XPos, i_YPos);    
  248. }
  249.  
  250. // =====================================================
  251. // ===              Add/Remove Document              ===
  252. // =====================================================
  253.  
  254. function addDocument()
  255. {
  256.     getScriptHostQI("IGrooveFormsToolUIDelegateHTMLDocumentPrivate").AddHTMLDocumentForView(document);
  257. }
  258.  
  259. function removeDocument()
  260. {
  261.     getScriptHostQI("IGrooveFormsToolUIDelegateHTMLDocumentPrivate").RemoveHTMLDocument(document);
  262. }