Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

431 lines
12 KiB

  1. <html>
  2. <head>
  3. <meta HTTP-EQUIV="MSThemeCompatible" CONTENT="Yes">
  4. </head>
  5. <script language="jscript" >
  6. var DefWindowWidth = 800;
  7. var DefWindowHeight = 600;
  8. var LEFT = 0;
  9. var TOP = 1;
  10. var WIDTH = 2;
  11. var HEIGHT = 3;
  12. var mysObject;
  13. mysObject = new ActiveXObject("ServerAdmin.ManageYourServer");
  14. var msxmlControl = "Msxml2.DOMDocument.3.0";
  15. // load xml resources
  16. var xmlStatic = new ActiveXObject(msxmlControl);
  17. xmlStatic.load("mysstatic.xml");
  18. var xslStatic = new ActiveXObject(msxmlControl);
  19. xslStatic.load("mysstatic.xsl");
  20. var xslDynamic = new ActiveXObject(msxmlControl);
  21. xslDynamic.load("mysdynamic.xsl");
  22. function minInt( x, y )
  23. {
  24. if (x < y)
  25. {
  26. return x;
  27. }
  28. else
  29. {
  30. return y;
  31. }
  32. }
  33. function maxInt( x, y )
  34. {
  35. if (x > y)
  36. {
  37. return x;
  38. }
  39. else
  40. {
  41. return y;
  42. }
  43. }
  44. function sizeMainWindow()
  45. {
  46. var area;
  47. try
  48. {
  49. var area_string = mysObject.GetWorkingAreaInfo();
  50. area = area_string.split(",");
  51. if (area.length != 4)
  52. {
  53. throw "Unexpected info format.";
  54. }
  55. }
  56. catch(ex)
  57. {
  58. // Fall back to best guess.
  59. area = new Array(4);
  60. area[LEFT] = 0;
  61. area[TOP] = 0;
  62. area[WIDTH] = screen.availWidth;
  63. area[HEIGHT] = screen.availHeight;
  64. }
  65. var w = minInt(area[WIDTH], DefWindowWidth);
  66. var h = minInt(area[HEIGHT], DefWindowHeight);
  67. window.resizeTo(w, h);
  68. // Center in middle of available area.
  69. // Need " - 0 " to avoid string concatenation.
  70. var left = (area[WIDTH] - w)/2 + (area[LEFT] - 0);
  71. var top = (area[HEIGHT] - h)/2 + (area[TOP] - 0);
  72. window.moveTo(left, top);
  73. }
  74. sizeMainWindow();
  75. </script>
  76. <link rel="stylesheet" type="text/css" href="mys.css"></link>
  77. <script language="jscript" event="onload" for="window">
  78. //set the document title
  79. document.title = xmlStatic.selectSingleNode("/mys/@title").value;
  80. //build up our standard page
  81. divMain.innerHTML = xmlStatic.transformNode(xslStatic);
  82. updateServMgmtLink();
  83. //refreshSysMgmtLink();
  84. var validUser ; validUser = mysObject.IsCurrentUserAnAdministrator() > 0;
  85. var validSKU ; validSKU = mysObject.IsSupportedSku() > 0;
  86. var isCluster ; isCluster = mysObject.IsClusterNode() > 0;
  87. var isDontDisplayPolicyEnabled ; isDontDisplayPolicyEnabled = mysObject.IsShowAtStartupPolicyEnabled() > 0;
  88. var isDatacenter ; isDatacenter = mysObject.IsDatacenterServer() > 0;
  89. var addrole ; addrole = document.all.item("addrole");
  90. var managerole ; managerole = document.all.item("managerole");
  91. var errInvalidUser ; errInvalidUser = document.all.item("errInvalidUser");
  92. var errInvalidSku ; errInvalidSku = document.all.item("errInvalidSku");
  93. var errIsCluster ; errIsCluster = document.all.item("errIsCluster");
  94. errInvalidUser.style.display = "none";
  95. errInvalidSku.style.display = "none";
  96. errIsCluster.style.display = "none";
  97. if( isDontDisplayPolicyEnabled || isDatacenter )
  98. {
  99. document.all.item("logonBoxDiv").style.display = "none";
  100. }
  101. if ( !validUser || !validSKU || isCluster)
  102. {
  103. addrole.style.display = "none";
  104. managerole.style.display = "none";
  105. var err
  106. if (!validUser)
  107. {
  108. errInvalidUser.style.display = "inline";
  109. document.all.item("logonBoxDiv").style.display = "none";
  110. }
  111. else if (!validSKU)
  112. {
  113. errInvalidSku.style.display = "inline";
  114. document.all.item("logonBoxDiv").style.display = "none";
  115. }
  116. else if (isCluster)
  117. {
  118. errIsCluster.style.display = "inline";
  119. }
  120. }
  121. else
  122. {
  123. buildDynamicContent();
  124. //refreshSysMgmtLink();
  125. updateServMgmtLink();
  126. refreshWebMgmtLink();
  127. window.setInterval("refreshRoles()", 15000);
  128. }
  129. var WshNetwork
  130. WshNetwork = new ActiveXObject("WScript.Network");
  131. server.innerText = WshNetwork.ComputerName;
  132. onLoadMainWindow();
  133. </script>
  134. <script language="jscript">
  135. function buildDynamicContent()
  136. {
  137. var strXml ; strXml = mysObject.GetConfiguredRoleMarkup();
  138. var xmldom ; xmldom = new ActiveXObject(msxmlControl);
  139. xmldom.loadXML(strXml);
  140. //build up the dynamic info
  141. var addrole ; addrole = document.all.item("addrole");
  142. var managerole ; managerole = document.all.item("managerole");
  143. var rolestd = managerole.all.item("roles");
  144. rolestd.innerHTML = xmldom.transformNode(xslDynamic);
  145. //if there are roles, hide the addrole task
  146. var roles;
  147. roles = document.all.item("roletable");
  148. var tb ; tb = managerole.all.item("taskBody");
  149. var rd ; rd = managerole.all.item("roleDescription");
  150. var tberr ; tberr = managerole.all.item("taskBodyNoInfo");
  151. if (roles == null || roles.length == 0)
  152. {
  153. addrole.style.display = "inline";
  154. tb.style.display = "none";
  155. rd.style.display = "none";
  156. tberr.style.display = "inline";
  157. }
  158. else
  159. {
  160. addrole.style.display = "none";
  161. tb.style.display = "inline";
  162. rd.style.display = "inline";
  163. tberr.style.display = "none";
  164. // Initialize expanded/collapsed state of roles...
  165. for(var index = 0; index < roles.length; index++)
  166. {
  167. InitRoleExpansion(roles.item(index));
  168. }
  169. }
  170. }
  171. function updateServMgmtLink()
  172. {
  173. var isServMgmtInstalled = (mysObject.IsServerManagementConsolePresent() > 0);
  174. var elemServMgmt = document.all.item("servMgmtLink");
  175. if (elemServMgmt != null)
  176. {
  177. elemServMgmt.style.display = isServMgmtInstalled ?
  178. "inline" :
  179. "none";
  180. }
  181. }
  182. /* Old implementation to switch b/w AD snapin and servmgmt.msc for DC role.
  183. function refreshSysMgmtLink()
  184. {
  185. // refresh system management snapin link
  186. var elemServNoMgmt = document.all.item("adDSALinkNoServMgmt");
  187. var elemServMgmt = document.all.item("adDSALinkServMgmt");
  188. if( elemServNoMgmt != null && elemServMgmt != null)
  189. {
  190. var isServMgmtInstalled = (mysObject.IsServerManagementConsolePresent() > 0);
  191. elemServMgmt.style.display = isServMgmtInstalled ?
  192. "inline" :
  193. "none";
  194. elemServNoMgmt.style.display = isServMgmtInstalled ?
  195. "none" :
  196. "inline";
  197. }
  198. }
  199. */
  200. function refreshWebMgmtLink()
  201. {
  202. // refresh web application server management link
  203. var elemWebMgmt = document.all.item("webServerMgmtLink");
  204. if (elemWebMgmt != null)
  205. {
  206. elemWebMgmt.style.display =
  207. (mysObject.IsWebServerConsolePresent() > 0) ? "inline" : "none";
  208. }
  209. }
  210. function refreshRoles()
  211. {
  212. if ( mysObject.HasRoleStatusChanged() > 0 )
  213. {
  214. buildDynamicContent();
  215. }
  216. //refreshSysMgmtLink();
  217. updateServMgmtLink();
  218. refreshWebMgmtLink();
  219. }
  220. </script>
  221. <script language="jscript" for="window" event="onresize">
  222. divBody.style.posHeight = document.body.clientHeight - divHeader.offsetHeight;
  223. </script>
  224. <script language="jscript">
  225. function onLoadMainWindow()
  226. {
  227. document.all.item("logonBox").checked = getLogonBox();
  228. divBody.style.posHeight = document.body.clientHeight - divHeader.offsetHeight;
  229. }
  230. function ExpandRole(roleTable, expand)
  231. {
  232. row = roleTable.rows("roleBody");
  233. td1 = row.cells("roleBodyTd1");
  234. td2 = row.cells("roleBodyTd2");
  235. img = roleTable.rows("roleHeader").children("roleImageCell").children("roleImageSpan").children("roleImage");
  236. rule = roleTable.rows("roleHeader").children("roleTextCell").children("roleTextTable").rows("ruleRow");
  237. if (expand == true)
  238. {
  239. td1.style.display = "inline";
  240. td2.style.display = "inline";
  241. rule.style.display = "inline";
  242. img.src = "MinusIcon.gif";
  243. }
  244. else
  245. {
  246. td1.style.display = "none";
  247. td2.style.display = "none";
  248. rule.style.display = "none";
  249. img.src = "PlusIcon.gif";
  250. }
  251. roleId = roleTable.parentNode.getAttribute("mys_id");
  252. try
  253. {
  254. mysObject.CollapseRole(roleId, !expand);
  255. }
  256. catch (ex)
  257. {
  258. // Nothing we can do here.
  259. }
  260. }
  261. function ToggleExpandRole(roleTable)
  262. {
  263. row = roleTable.rows("roleBody")
  264. td1 = row.cells("roleBodyTd1")
  265. ExpandRole( roleTable, (td1.style.display == "none") );
  266. }
  267. function ToggleFromKeyboard ( roleTable )
  268. {
  269. if (window.event.keyCode == 13)
  270. {
  271. window.event.returnValue = false;
  272. ToggleExpandRole(roleTable);
  273. }
  274. }
  275. function InitRoleExpansion(roleTable)
  276. {
  277. var roleId = roleTable.getAttribute("mys_id");
  278. if (roleId != null && roleId != "")
  279. {
  280. ExpandRole(roleTable.firstChild, !mysObject.IsRoleCollapsed(roleId));
  281. }
  282. }
  283. function Common_EscapeURL( url )
  284. {
  285. var esc;
  286. esc = url;
  287. esc = escape( esc );
  288. esc = esc.replace( /\+/g , "%2B" );
  289. esc = esc.replace( /\%20/g, "+" );
  290. return esc;
  291. }
  292. function SearchHelp (param)
  293. {
  294. var query = Common_EscapeURL(param);
  295. execCmd('hcp://services/search?query=' + query);
  296. }
  297. </script>
  298. <script language="jscript" >
  299. function execCmd ( cmdString )
  300. {
  301. try
  302. {
  303. var shellObj = new ActiveXObject("WScript.Shell");
  304. shellObj.Run (cmdString);
  305. }
  306. catch( ex )
  307. {
  308. var sErrText = xmlStatic.selectSingleNode("/mys/linkerror/@text").value;
  309. sErrText = sErrText.replace("%1", cmdString);
  310. window.alert(sErrText);
  311. }
  312. }
  313. function execChm ( cmdString )
  314. {
  315. execCmd('"%SystemRoot%\\hh.exe" ' + cmdString);
  316. }
  317. function execCpl ( cmdString )
  318. {
  319. execCmd('"%SystemRoot%\\system32\\control.exe" ' + cmdString);
  320. }
  321. function getLogonBox()
  322. {
  323. return !mysObject.IsStartupFlagSet();
  324. }
  325. function setLogonBox( checkVal )
  326. {
  327. mysObject.SetRunAtLogon( !checkVal );
  328. }
  329. </script>
  330. <HTA:APPLICATION
  331. APPLICATIONNAME="mys"
  332. BORDER="thick"
  333. CAPTION="yes"
  334. SHOWINTASKBAR="yes"
  335. SINGLEINSTANCE="yes"
  336. SYSMENU="yes"
  337. WINDOWSTATE="normal"
  338. SELECTION="no"
  339. SCROLL="no"
  340. NAVIGABLE="yes"
  341. ICON="ico_server.ico"
  342. />
  343. <body>
  344. <div id="divMain"></div>
  345. </body>
  346. </html>