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.

217 lines
5.3 KiB

  1. // ==============================================================
  2. // Microsoft Server Appliance
  3. // Page-level JavaScript functions
  4. //
  5. // Copyright (c) 1999 - 2000 Microsoft Corporation. All rights reserved.
  6. // ==============================================================
  7. <!-- Copyright (c) 1999 - 2000 Microsoft Corporation. All rights reserved-->
  8. //-------------------------------------------------------------------------
  9. //
  10. // Function : GetCurrentTabURL
  11. //
  12. // Synopsis : Get the URL of the currently active tab
  13. //
  14. // Arguments: None
  15. //
  16. // Returns : None
  17. //
  18. //-------------------------------------------------------------------------
  19. function GetCurrentTabURL()
  20. {
  21. var strReturnURL;
  22. var strStart;
  23. var strEnd;
  24. var intTab;
  25. strReturnURL = document.location.search;
  26. strStart = strReturnURL.indexOf("Tab=");
  27. if (strStart != -1)
  28. {
  29. strEnd = strReturnURL.indexOf("&", strStart+4);
  30. if (strEnd != -1)
  31. {
  32. intTab = strReturnURL.substring(strStart+4, strEnd);
  33. }
  34. else
  35. {
  36. intTab = strReturnURL.substring(strStart+4, strReturnURL.length);
  37. }
  38. }
  39. if (intTab==null)
  40. {
  41. intTab=0;
  42. }
  43. return GetTabURL(intTab);
  44. }
  45. //-------------------------------------------------------------------------
  46. //
  47. // Function : OpenPage
  48. //
  49. // Synopsis : Builds a URL, adding a ReturnURL and a random number(R),
  50. // and sets the current window to open it.
  51. //
  52. // Arguments: VirtualRoot(IN) - current virtual root
  53. // TaskURL(IN) - URL to open
  54. // ReturnURL(IN) - URL to mark as return URL for the TaskURL
  55. // strTitle(IN) - title of wizard
  56. //
  57. // Returns : None
  58. //
  59. //-------------------------------------------------------------------------
  60. function OpenPage(VirtualRoot, TaskURL, ReturnURL, strTitle) {
  61. var strURL;
  62. var strQueryString;
  63. var strCurrentURL;
  64. var i;
  65. var intReturnURLIndex;
  66. i = TaskURL.indexOf('&R=');
  67. if (i != -1)
  68. {
  69. strURL = TaskURL.substring(0, i);
  70. }
  71. else
  72. {
  73. i = TaskURL.indexOf('?R=');
  74. if (i != -1)
  75. {
  76. strURL = TaskURL.substring(0, i);
  77. }
  78. else
  79. {
  80. strURL = TaskURL;
  81. }
  82. }
  83. strURL = '&URL=' + strURL + '&';
  84. if (TaskURL.indexOf('ReturnURL') == -1)
  85. {
  86. if ( (ReturnURL == null) || (ReturnURL == '') )
  87. {
  88. strQueryString = window.location.search;
  89. i = strQueryString.indexOf('&R=');
  90. if (i != -1)
  91. {
  92. strQueryString = strQueryString.substring(0, i);
  93. }
  94. else
  95. {
  96. i = strQueryString.indexOf('?R=');
  97. if (i != -1)
  98. {
  99. strQueryString = strQueryString.substring(0, i);
  100. }
  101. }
  102. intReturnURLIndex = strQueryString.indexOf('ReturnURL');
  103. if (intReturnURLIndex != -1)
  104. {
  105. strQueryString = strQueryString.substring(0, intReturnURLIndex);
  106. }
  107. strCurrentURL = window.location.pathname + strQueryString;
  108. }
  109. else
  110. {
  111. strCurrentURL = ReturnURL;
  112. }
  113. strURL += "ReturnURL=";
  114. if (strCurrentURL.indexOf('/', 1) != -1 && strCurrentURL.substr('..', 0, 2) == -1)
  115. {
  116. strURL += "..";
  117. }
  118. strURL += strCurrentURL;
  119. }
  120. strURL += "&R=" + Math.random();
  121. strURL = 'Title=' + escape(strTitle) + strURL;
  122. strURL = VirtualRoot + 'sh_taskframes.asp?' + strURL;
  123. top.location = strURL;
  124. }
  125. //-------------------------------------------------------------------------
  126. //
  127. // Function : GetServerName
  128. //
  129. // Synopsis : Return server name as specified in browser address bar
  130. //
  131. // Arguments: None
  132. //
  133. // Returns : server name object
  134. //
  135. //-------------------------------------------------------------------------
  136. function GetServerName()
  137. {
  138. return window.location.host;
  139. }
  140. //-------------------------------------------------------------------------
  141. //
  142. // Function : IsIE
  143. //
  144. // Synopsis : Is browser IE
  145. //
  146. // Arguments: None
  147. //
  148. // Returns : true/false
  149. //
  150. //-------------------------------------------------------------------------
  151. function IsIE()
  152. {
  153. if (navigator.userAgent.indexOf('IE')>-1)
  154. return true;
  155. else
  156. return false;
  157. }
  158. //-------------------------------------------------------------------------
  159. //
  160. // Function : Trim
  161. //
  162. // Synopsis : remove all spaces from a string
  163. //
  164. // Arguments: str(IN) - string to modify
  165. //
  166. // Returns : modified string
  167. //
  168. //-------------------------------------------------------------------------
  169. function Trim(str)
  170. {
  171. var res="", i, ch;
  172. for (i=0; i < str.length; i++) {
  173. ch = str.charAt(i);
  174. if (ch != ' '){
  175. res = res + ch;
  176. }
  177. }
  178. return res;
  179. }
  180. //-------------------------------------------------------------------------
  181. //
  182. // Function : BlurLayer
  183. //
  184. // Synopsis : hide layer
  185. //
  186. // Arguments: None
  187. //
  188. // Returns : None
  189. //
  190. //-------------------------------------------------------------------------
  191. function BlurLayer()
  192. {
  193. document.menu.visibility = "hide";
  194. }