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

  1. function Add_Activate()
  2. {
  3. LoadScriptFile("idScriptUtil", "util.js");
  4. if (false == g_bAddPageLoaded)
  5. {
  6. g_bIsOnDomain = g_docAll.idCtlAppsDso.OnDomain;
  7. }
  8. g_docAll.idTrHeadMargin_Add.style.display = 'block';
  9. g_docAll.idTrHeadCDROM1_Add.style.display = 'block';
  10. g_docAll.idTrHeadCDROM2_Add.style.display = 'block';
  11. g_docAll.idTrHeadInternet1_Add.style.display = 'block';
  12. g_docAll.idTrHeadInternet2_Add.style.display = 'block';
  13. g_docAll.idTrHeadPub_Add.style.display = 'block';
  14. g_docAll.idTrBody2_Add.style.display = 'block';
  15. if (false == g_bAddPageLoaded)
  16. {
  17. if (Dso_IsRestricted("NoAddFromCDorFloppy"))
  18. {
  19. g_docAll.idTrHeadCDROM1_Add.style.visibility = 'hidden';
  20. g_docAll.idTrHeadCDROM2_Add.style.visibility = 'hidden';
  21. }
  22. if (Dso_IsRestricted("NoAddFromInternet"))
  23. {
  24. g_docAll.idTrHeadInternet1_Add.style.visibility = 'hidden';
  25. g_docAll.idTrHeadInternet2_Add.style.visibility = 'hidden';
  26. }
  27. if (false == g_bIsOnDomain || Dso_IsRestricted("NoAddFromNetwork"))
  28. {
  29. g_docAll.idTrHeadPub_Add.style.visibility = 'hidden';
  30. g_docAll.idTrBody2_Add.style.visibility = 'hidden';
  31. g_bIsOnDomain = false; 
  32. }
  33. g_bSelectDefault = true;
  34. }
  35. if (false == g_bIsOnDomain)
  36. {
  37. g_docAll.idTrBody1_Add.style.display = 'block';
  38. }
  39. g_bReenumInstalledList = false; 
  40. if (g_bIsAlpha)
  41. {
  42. g_docAll.idTrFoot_Add.style.display = 'block';
  43. g_docAll.idChkAddForcex86.attachEvent("onclick", new Function("idCtlAppsDso.Forcex86 = idChkAddForcex86.checked"));
  44. }
  45. if (false == g_bAddPageLoaded)
  46. {
  47. g_docAll.idBtnCDFloppy.onclick = _AddApp;
  48. g_docAll.idBtnInternet.onclick = _AddApp;
  49. if (g_bIsOnDomain)
  50. {
  51. _SetPubWaitingFeedback();
  52. g_docAll.idSelCategory.onchange = _OnChangeCategories;
  53. g_docAll.idBindCategories.dataFld = 'displayname';
  54. g_docAll.idBindCategories.dataSrc = '#idCtlAppsDso.Categories';
  55. g_docAll.idSpnAddLaterSchedule.dataSrc = "#idCtlAppsDso.Add"; 
  56. g_docAll.idAddListbox.dataSource = "idCtlAppsDso.Add";
  57. Dso_GetCtl("Categories").attachEvent("ondatasetcomplete", Cat_OnDatasetComplete);
  58. Dso_GetCtl("Add").attachEvent("ondatasetcomplete", Add_OnDatasetComplete);
  59. g_docAll.idAddListbox.Refresh();
  60. }
  61. g_bAddPageLoaded = true;
  62. }
  63. Add_SetFocus();
  64. }
  65. function Add_SetFocus()
  66. {
  67. g_docAll.idAddListbox.focus();
  68. }
  69. function Add_Deactivate()
  70. {
  71. g_docAll.idTrHeadMargin_Add.style.display = 'none';
  72. g_docAll.idTrHeadCDROM1_Add.style.display = 'none';
  73. g_docAll.idTrHeadCDROM2_Add.style.display = 'none';
  74. g_docAll.idTrHeadInternet1_Add.style.display = 'none';
  75. g_docAll.idTrHeadInternet2_Add.style.display = 'none';
  76. g_docAll.idTrHeadPub_Add.style.display = 'none';
  77. g_docAll.idTrFoot_Add.style.display = 'none';
  78. g_docAll.idTrBody1_Add.style.display = 'none';
  79. g_docAll.idTrBody2_Add.style.display = 'none';
  80. if (g_bReenumInstalledList)
  81. {
  82. Dso_Refresh("Remove");
  83. }
  84. }
  85. function Add_OnSetFocus()
  86. {
  87. var evt = window.event;
  88. ApplyExtraStyles(evt.srcChild, evt.bFocus);
  89. }
  90. function Add_OnCustomDraw()
  91. {
  92. var evt = window.event;
  93. var tblElem = evt.srcChild; 
  94. if (evt.bSelected)
  95. {
  96. var dwCapability = evt.Recordset("capability");
  97. if ('prepaint' == evt.drawStage)
  98. {
  99. if (dwCapability & APPCAP_ADDLATER)
  100. {
  101. evt.srcElement.EnableTemplate('idTrMultiBtns', true);
  102. evt.srcElement.EnableTemplate('idTrSingleBtns', false);
  103. }
  104. else
  105. {
  106. evt.srcElement.EnableTemplate('idTrMultiBtns', false);
  107. evt.srcElement.EnableTemplate('idTrSingleBtns', true);
  108. }
  109. }
  110. else
  111. {
  112. if (dwCapability & APPCAP_ADDLATER)
  113. {
  114. tblElem.all("idBtnAdd").onclick = _AddApp;
  115. tblElem.all("idBtnAddLater").onclick = _AddLater;
  116. }
  117. else
  118. {
  119. tblElem.all("idBtnAdd").onclick = _AddApp;
  120. }
  121. var szSupportUrl = evt.Recordset("supporturl");
  122. if ("" != szSupportUrl)
  123. {
  124. var spnMoreInfo = tblElem.all("idSpnMoreInfo");
  125. spnMoreInfo.all("idAMoreInfo").href = szSupportUrl;
  126. spnMoreInfo.style.display = 'block';
  127. }
  128. ApplyExtraStyles(evt.srcChild, evt.bFocus);
  129. }
  130. }
  131. }
  132. function _OpenMoreInfo()
  133. {
  134. window.open(window.event.srcElement.href, "", "");
  135. window.event.returnValue = false;
  136. }
  137. function _FilterCategories(optElem)
  138. {
  139. var szFilter;
  140. _SetPubWaitingFeedback();
  141. if (optElem.value == "all")
  142. szFilter = "";
  143. else
  144. szFilter = optElem.value;
  145. Dso_Filter("Add", szFilter);
  146. }
  147. function _OnChangeCategories()
  148. {
  149. var elem = window.event.srcElement;
  150. var optElem = elem.options(elem.selectedIndex);
  151. _FilterCategories(optElem);
  152. }
  153. function _AddApp()
  154. {
  155. var rsCur = Dso_GetRecordset("Add");
  156. switch(event.srcElement.id)
  157. {
  158. case "idBtnAdd":
  159. g_docAll.idCtlAppsDso.Exec("Add", "install", rsCur.AbsolutePosition);
  160. break;
  161. case "idBtnCDFloppy":
  162. g_docAll.idCtlAppsDso.Exec("Add", "generic install", 0);
  163. break;
  164. case "idBtnInternet":
  165. g_docAll.idCtlAppsDso.Exec("Add", "winupdate", 0);
  166. break;
  167. }
  168. if ("idBtnAdd" == event.srcElement.id || "idBtnInternet" == event.srcElement.id)
  169. {
  170. g_bReenumInstalledList = true;
  171. }
  172. }
  173. function _AddLater()
  174. {
  175. var rsCur = Dso_GetRecordset("Add");
  176. g_docAll.idCtlAppsDso.Exec("Add", "addlater", rsCur.AbsolutePosition);
  177. window.event.returnValue = false;
  178. window.event.cancelBubble = true;
  179. }
  180. function _Schedule()
  181. {
  182. var elemSrc = window.event.srcElement;
  183. if ("idASchedule" == elemSrc.id)
  184. {
  185. var rsCur = Dso_GetRecordset("Add");
  186. g_docAll.idCtlAppsDso.Exec("Add", "addlater", rsCur.AbsolutePosition);
  187. }
  188. window.event.returnValue = false;
  189. window.event.cancelBubble = true;
  190. }
  191. function _ResetCategoryList()
  192. {
  193. var i;
  194. var optElem;
  195. var colOptions = g_docAll.idSelCategory.options;
  196. for (i = 0; i < colOptions.length;)
  197. {
  198. optElem = colOptions[i];
  199. if (optElem.value != "all") 
  200. optElem.removeNode();
  201. else
  202. i++;
  203. }
  204. }
  205. function _InitCategoryList()
  206. {
  207. var rsCur = Dso_GetRecordset("Categories"); 
  208. if (rsCur.RecordCount > 0)
  209. {
  210. var i;
  211. var szDefault;
  212. var optElemSel = null;
  213. szDefault = g_docAll.idCtlAppsDso.DefaultCategory;
  214. if ("" == szDefault)
  215. {
  216. szDefault = "all"; 
  217. }
  218. rsCur.MoveFirst();
  219. for (i = 1; i <= rsCur.RecordCount; i++)
  220. {
  221. var optElem = document.createElement("option");
  222. optElem.value = rsCur("displayname");
  223. optElem.text = rsCur("displayname");
  224. if (g_bSelectDefault && optElem.value == szDefault)
  225. {
  226. optElem.selected = true; 
  227. optElemSel = optElem;
  228. }
  229. g_docAll.idSelCategory.add(optElem); 
  230. rsCur.MoveNext();
  231. }
  232. if (optElemSel)
  233. _FilterCategories(optElemSel);
  234. g_bSelectDefault = false; 
  235. }
  236. function Cat_OnDatasetComplete()
  237. {
  238. if (window.event.qualifier == "Categories")
  239. {
  240. _ResetCategoryList();
  241. _InitCategoryList();
  242. }
  243. }
  244. function Add_OnDatasetComplete()
  245. {
  246. if (window.event.qualifier == "Add")
  247. {
  248. var L_AddNoneAvailable_Text = "No programs are available on the network";
  249. Dso_FeedbackIfEmpty("Add", g_docAll.idAddListbox, L_AddNoneAvailable_Text);
  250. }
  251. }
  252.