home *** CD-ROM | disk | FTP | other *** search
/ Venus 7000 / darktronics.iso / Software / Service Packs / WinXPSP1.exe / appwiz.cp_ / appwiz.cpl / HTML / PRELOAD.JS < prev    next >
Encoding:
Text File  |  2002-08-29  |  3.9 KB  |  196 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. if (document.dir == "rtl")
  66. {
  67. g_docAll.idTdClose.align = "left";
  68. g_docAll.idTdCDFloppy.align = "left";
  69. g_docAll.idTdWindowsUpdate.align = "left";
  70. }
  71. document.body.onkeydown = Body_OnKeyDown;
  72. g_docAll.idBtnClose.onclick = _CloseWindow;
  73. var bExecOCMgr;
  74. bExecOCMgr = !g_docAll.idCtlAppsDso.ShowPostSetup;
  75. if (Dso_IsRestricted("ShowPostSetup"))
  76. bExecOCMgr = false;
  77. else if (Dso_IsRestricted("NoServices"))
  78. bExecOCMgr = true;
  79. var _idPlaces = g_docAll.idPlaces;
  80. _idPlaces.SetExecButton("idConfig", bExecOCMgr);
  81. g_docAll.idColPlaces.width = g_docAll.idPlaces.offsetWidth;
  82. g_docAll.idImgDummy1.width = g_docAll.idPlaces.offsetWidth;
  83. g_docAll.idImgDummy2.width = g_docAll.idPlaces.offsetWidth;
  84. g_docAll.idImgDummy3.width = g_docAll.idPlaces.offsetWidth;
  85. _ParseCmdLine();
  86. }
  87. function Body_OnKeyDown() 
  88. {
  89. if (KC_F5 == event.keyCode) 
  90. {
  91. switch (g_idCur)
  92. {
  93. case 'idChangeRemove':
  94. Dso_Refresh("Remove");
  95. break;
  96. case 'idAdd':
  97. Dso_Refresh("Categories");
  98. Dso_Refresh("Add");
  99. break;
  100. case 'idConfig':
  101. Dso_Refresh("ocsetup");
  102. break;
  103. }
  104. event.returnValue=false;
  105. }
  106. }
  107. function _CloseWindow()
  108. {
  109. window.parent.close();
  110. }
  111. function _SetPage(idElem)
  112. {
  113. switch (idElem)
  114. {
  115. case 'idChangeRemove':
  116. LoadScriptFile("idScriptRemove", "remove.js");
  117. break;
  118. case 'idAdd':
  119. LoadScriptFile("idScriptAdd", "add.js");
  120. break;
  121. case 'idConfig':
  122. LoadScriptFile("idScriptConfig", "config.js");
  123. break;
  124. }
  125. switch (g_idCur)
  126. {
  127. case 'idChangeRemove':
  128. Remove_Deactivate();
  129. break;
  130. case 'idAdd':
  131. Add_Deactivate();
  132. break;
  133. case 'idConfig':
  134. Config_Deactivate();
  135. break;
  136. }
  137. switch (idElem)
  138. {
  139. case 'idChangeRemove':
  140. Remove_Activate();
  141. break;
  142. case 'idAdd':
  143. Add_Activate();
  144. break;
  145. case 'idConfig':
  146. Config_Activate(false);
  147. break;
  148. }
  149. g_idCur = idElem;
  150. }
  151. function Places_OnExecItem()
  152. {
  153. var idElem = window.event.srcID;
  154. if ('idConfig' == idElem)
  155. {
  156. LoadScriptFile("idScriptConfig", "config.js");
  157. Config_Activate(true);
  158. }
  159. }
  160. function Places_OnSelectItem()
  161. {
  162. if (g_idCur == window.event.srcID)
  163. {
  164. switch (g_idCur)
  165. {
  166. case 'idChangeRemove':
  167. Remove_SetFocus();
  168. break;
  169. case 'idAdd':
  170. Add_SetFocus();
  171. break;
  172. case 'idConfig':
  173. Config_SetFocus();
  174. break;
  175. }
  176. return;
  177. }
  178. _SetPage(window.event.srcID);
  179. }
  180. function Places_OnComplete()
  181. {
  182. if ("undefined" == typeof g_docAll)
  183. g_docAll = document.all;
  184. _InitPlacesBar();
  185. }
  186. var KC_SPACE = 32;
  187. var KC_RETURN = 13;
  188. function _OnKeyDownFakeAnchor()
  189. {
  190. var keyCode = window.event.keyCode;
  191. if (KC_SPACE == keyCode || KC_RETURN == keyCode)
  192. {
  193. window.event.srcElement.click();
  194. }
  195. }
  196.