home *** CD-ROM | disk | FTP | other *** search
/ Australian Personal Computer 2000 November / APC5112K.ISO / patch / microsoft / i386 / appwiz.cp_ / appwiz.cpl / HTML / PRELOAD.JS < prev    next >
Encoding:
Text File  |  2000-07-21  |  3.8 KB  |  190 lines

  1. function EatErrors(szMsg, szUrl, iLine)
  2. {
  3. alert("An unexpected error occurred.\n\n" + szMsg + "\n" + szUrl + "\nLine: " + iLine);
  4. window.event.returnValue = true; 
  5. }
  6. function LoadScriptFile(szScriptID, szUrl)
  7. {
  8. if (null == g_docAll(szScriptID))
  9. {
  10. var elemScript = document.createElement("<SCRIPT id=" + szScriptID + " src='" + szUrl + "' language='javascript'></SCRIPT>");
  11. if (elemScript)
  12. {
  13. document.body.insertBefore(elemScript);
  14. }
  15. }
  16. }
  17. function Dso_IsRestricted(szPolicy)
  18. {
  19. var bResult;
  20. bResult = g_docAll.idCtlAppsDso.IsRestricted(szPolicy);
  21.  
  22.  
  23. return bResult;
  24. }
  25. function _ParseCmdLine()
  26. {
  27. var szCmdLine = g_docAll.idAppARP.commandLine;
  28. var ichParam = szCmdLine.indexOf("default.hta") + 12;
  29. var cch = szCmdLine.length;
  30. while (ichParam < cch)
  31. {
  32. if (szCmdLine.charAt(ichParam) != ' ')
  33. break;
  34. ichParam++;
  35. }
  36. var nPage = parseInt(szCmdLine.charAt(ichParam));
  37. if (isNaN(nPage) || 2 < nPage)
  38. nPage = g_iPageDefault;
  39. g_docAll.idPlaces.currentButton = nPage;
  40. }
  41. function _InitPlacesBar()
  42. {
  43. var _idPlaces = g_docAll.idPlaces;
  44. if (Dso_IsRestricted("NoRemovePage"))
  45. {
  46. _idPlaces.ShowButton('idChangeRemove', false);
  47. g_iPageDefault++;
  48. }
  49. if (Dso_IsRestricted("NoAddPage"))
  50. {
  51. _idPlaces.ShowButton('idAdd', false);
  52. if (1 == g_iPageDefault)
  53. g_iPageDefault++;
  54. }
  55. if (Dso_IsRestricted("NoWindowsSetupPage"))
  56. {
  57. _idPlaces.ShowButton('idConfig', false);
  58. if (2 == g_iPageDefault)
  59. g_iPageDefault++;
  60. }
  61. }
  62. function Body_OnLoad()
  63. {
  64. window.onerror = EatErrors; 
  65. document.body.onkeydown = Body_OnKeyDown;
  66. g_docAll.idBtnClose.onclick = _CloseWindow;
  67. var bExecOCMgr;
  68. bExecOCMgr = !g_docAll.idCtlAppsDso.ShowPostSetup;
  69. if (Dso_IsRestricted("ShowPostSetup"))
  70. bExecOCMgr = false;
  71. else if (Dso_IsRestricted("NoServices"))
  72. bExecOCMgr = true;
  73. var _idPlaces = g_docAll.idPlaces;
  74. _idPlaces.SetExecButton("idConfig", bExecOCMgr);
  75. g_docAll.idColPlaces.width = g_docAll.idPlaces.offsetWidth;
  76. g_docAll.idImgDummy1.width = g_docAll.idPlaces.offsetWidth;
  77. g_docAll.idImgDummy2.width = g_docAll.idPlaces.offsetWidth;
  78. g_docAll.idImgDummy3.width = g_docAll.idPlaces.offsetWidth;
  79. _ParseCmdLine();
  80. }
  81. function Body_OnKeyDown() 
  82. {
  83. if (KC_F5 == event.keyCode) 
  84. {
  85. switch (g_idCur)
  86. {
  87. case 'idChangeRemove':
  88. Dso_Refresh("Remove");
  89. break;
  90. case 'idAdd':
  91. Dso_Refresh("Categories");
  92. Dso_Refresh("Add");
  93. break;
  94. case 'idConfig':
  95. Dso_Refresh("ocsetup");
  96. break;
  97. }
  98. event.returnValue=false;
  99. }
  100. }
  101. function _CloseWindow()
  102. {
  103. window.parent.close();
  104. }
  105. function _SetPage(idElem)
  106. {
  107. switch (idElem)
  108. {
  109. case 'idChangeRemove':
  110. LoadScriptFile("idScriptRemove", "remove.js");
  111. break;
  112. case 'idAdd':
  113. LoadScriptFile("idScriptAdd", "add.js");
  114. break;
  115. case 'idConfig':
  116. LoadScriptFile("idScriptConfig", "config.js");
  117. break;
  118. }
  119. switch (g_idCur)
  120. {
  121. case 'idChangeRemove':
  122. Remove_Deactivate();
  123. break;
  124. case 'idAdd':
  125. Add_Deactivate();
  126. break;
  127. case 'idConfig':
  128. Config_Deactivate();
  129. break;
  130. }
  131. switch (idElem)
  132. {
  133. case 'idChangeRemove':
  134. Remove_Activate();
  135. break;
  136. case 'idAdd':
  137. Add_Activate();
  138. break;
  139. case 'idConfig':
  140. Config_Activate(false);
  141. break;
  142. }
  143. g_idCur = idElem;
  144. }
  145. function Places_OnExecItem()
  146. {
  147. var idElem = window.event.srcID;
  148. if ('idConfig' == idElem)
  149. {
  150. LoadScriptFile("idScriptConfig", "config.js");
  151. Config_Activate(true);
  152. }
  153. }
  154. function Places_OnSelectItem()
  155. {
  156. if (g_idCur == window.event.srcID)
  157. {
  158. switch (g_idCur)
  159. {
  160. case 'idChangeRemove':
  161. Remove_SetFocus();
  162. break;
  163. case 'idAdd':
  164. Add_SetFocus();
  165. break;
  166. case 'idConfig':
  167. Config_SetFocus();
  168. break;
  169. }
  170. return;
  171. }
  172. _SetPage(window.event.srcID);
  173. }
  174. function Places_OnComplete()
  175. {
  176. if ("undefined" == typeof g_docAll)
  177. g_docAll = document.all;
  178. _InitPlacesBar();
  179. }
  180. var KC_SPACE = 32;
  181. var KC_RETURN = 13;
  182. function _OnKeyDownFakeAnchor()
  183. {
  184. var keyCode = window.event.keyCode;
  185. if (KC_SPACE == keyCode || KC_RETURN == keyCode)
  186. {
  187. window.event.srcElement.click();
  188. }
  189. }
  190.