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.

969 lines
28 KiB

  1. <% '==================================================
  2. ' Microsoft Server Appliance
  3. '
  4. ' Page-level functions
  5. '
  6. ' Copyright (c) 1999 - 2000 Microsoft Corporation. All rights reserved.
  7. '================================================== %>
  8. <%
  9. '
  10. ' This file (i.e., sh_page.asp) should be the first include file
  11. ' in all asp files, since autoconfiglang.asp sets the default
  12. ' language settings for the web UI.
  13. '
  14. %>
  15. <!-- #include file="autoconfiglang.asp" -->
  16. <%
  17. Response.Buffer = True
  18. Dim objLocMgr
  19. Dim intCaptionID
  20. Dim intDescriptionID
  21. Dim varReplacementStrings
  22. Dim m_intSpanIndex
  23. Dim strSourceName
  24. strSourceName = ""
  25. m_intSpanIndex=0
  26. On Error Resume Next
  27. Set objLocMgr = Server.CreateObject("ServerAppliance.LocalizationManager")
  28. strSourceName = "sakitmsg.dll"
  29. if Err.number <> 0 then
  30. Response.Write "Error in localizing the web content "
  31. Response.End
  32. end if
  33. '-----------------------------------------------------
  34. 'START of localization content
  35. Dim L_FOKBUTTON_TEXT
  36. Dim L_FCANCELBUTTON_TEXT
  37. Dim L_FBACKBUTTON_TEXT
  38. Dim L_FNEXTBUTTON_TEXT
  39. Dim L_FFINISHBUTTON_TEXT
  40. Dim L_FCLOSEBUTTON_TEXT
  41. Dim L_AREABACKBUTTON_TEXT
  42. L_FOKBUTTON_TEXT = objLocMgr.GetString(strSourceName, "&H40010012",varReplacementStrings)
  43. L_FCANCELBUTTON_TEXT = objLocMgr.GetString(strSourceName, "&H40010013",varReplacementStrings)
  44. L_FBACKBUTTON_TEXT = objLocMgr.GetString(strSourceName, "&H40010014",varReplacementStrings)
  45. L_FNEXTBUTTON_TEXT = objLocMgr.GetString(strSourceName, "&H40010015",varReplacementStrings)
  46. L_FFINISHBUTTON_TEXT = objLocMgr.GetString(strSourceName, "&H40010016",varReplacementStrings)
  47. L_FCLOSEBUTTON_TEXT = objLocMgr.GetString(strSourceName, "&H40010017",varReplacementStrings)
  48. L_AREABACKBUTTON_TEXT = objLocMgr.GetString(strSourceName, "&H40010018",varReplacementStrings)
  49. 'End of localization content
  50. '-----------------------------------------------------
  51. '----------------------------------------------------------------------------
  52. '
  53. ' Function : GetCharSet
  54. '
  55. ' Synopsis : Gets character set to use for current language
  56. '
  57. ' Arguments: None
  58. '
  59. ' Returns : charset string
  60. '
  61. '----------------------------------------------------------------------------
  62. Function GetCharSet()
  63. On Error Resume Next
  64. Err.Clear
  65. Dim strCharSet
  66. ' call Localization Manager
  67. Set objLocMgr = Server.CreateObject("ServerAppliance.LocalizationManager")
  68. strCharSet = objLocMgr.CurrentCharSet
  69. if strCharSet ="" then
  70. strCharSet = "iso-8859-1"
  71. end if
  72. set objLocMgr = nothing
  73. GetCharSet = strCharSet
  74. End Function
  75. '----------------------------------------------------------------------------
  76. '
  77. ' Function : ServeStandardLabelBar
  78. '
  79. ' Synopsis : Serves label text followed by a line
  80. '
  81. ' Arguments: Caption(IN) - label text
  82. '
  83. ' Returns : None
  84. '
  85. '----------------------------------------------------------------------------
  86. Function ServeStandardLabelBar(Caption)
  87. On Error Resume Next %>
  88. <table border="0" cellspacing="0">
  89. <tr>
  90. <td width="15"></td>
  91. <td class="titlebar" align=right>
  92. <% =Caption %>&nbsp;&nbsp;</td>
  93. </tr>
  94. <tr>
  95. <td width="15" height=1></td>
  96. <td height=1><img src="/images/line.gif"></td>
  97. </tr>
  98. </table>
  99. <%
  100. End Function
  101. '----------------------------------------------------------------------------
  102. '
  103. ' Function : ServeAreaLabelBar
  104. '
  105. ' Synopsis : Serves label text for area pages followed by line
  106. '
  107. ' Arguments: Caption(IN) - label text
  108. '
  109. ' Returns : None
  110. '
  111. '----------------------------------------------------------------------------
  112. Function ServeAreaLabelBar(Caption)
  113. On Error Resume Next
  114. %>
  115. <table border="0" cellspacing="0">
  116. <tr>
  117. <td width="15">&nbsp;</td>
  118. <td align=right valign=middle class="areatitlebar">
  119. <% =Caption %>&nbsp;&nbsp;
  120. </td>
  121. </tr>
  122. <tr>
  123. <td width="15" height=1></td>
  124. <td height=1><img src="/images/line.gif"></td>
  125. </tr>
  126. </table>
  127. <%
  128. End Function
  129. '----------------------------------------------------------------------------
  130. '
  131. ' Function : ServeBackButton
  132. '
  133. ' Synopsis : Serves back button (mostly used in area pages)
  134. '
  135. ' Arguments: None
  136. '
  137. ' Returns : None
  138. '
  139. '----------------------------------------------------------------------------
  140. Function ServeBackButton()
  141. On Error Resume Next
  142. %>
  143. <BR><BR>
  144. <div id=backButton onMouseOver="window.status='';return true;" title="">
  145. <A href=""
  146. class="PAGENAVBUTTON"
  147. onkeydown = "if (window.event.keyCode == 13) {this.href=GetCurrentTabURL();}"
  148. onClick = "this.href=GetCurrentTabURL();"
  149. onFocus="window.status='';return true;"
  150. style="cursor:default;"
  151. >
  152. <img src="/images/back_button.gif" border="0">
  153. <div class="PAGENAVBUTTON"
  154. style="position:relative; left:2px; top:-26px; width:65px; margin-top:3px; text-align:center; z-index:1;">
  155. <% =L_AREABACKBUTTON_TEXT %>
  156. </div>
  157. </A>
  158. </div>
  159. <%
  160. End Function
  161. '----------------------------------------------------------------------------
  162. '
  163. ' Function : ServeAreaButton
  164. '
  165. ' Synopsis : Serves button used mostly in area pages
  166. '
  167. ' Arguments: Caption(IN) - label text
  168. ' URL(IN) - URL to link the button to
  169. ' Size(IN) - Size of button
  170. '
  171. '
  172. ' Returns : None
  173. '
  174. '----------------------------------------------------------------------------
  175. Function ServeAreaButton(Caption, URL, Size)
  176. On Error Resume Next
  177. If m_intSpanIndex < 1 Then %>
  178. <!-- Dummy span to guarantee that the spanAreaButton ID is always an array -->
  179. <span ID="spanAreaButton">
  180. </span>
  181. <% End If
  182. m_intSpanIndex = m_intSpanIndex + 1
  183. dim tmpHeader,tmpFooter 'Temp variable used for table display
  184. if not IsIE then
  185. tmpHeader = "<table bgcolor='#999966' height='15' width='120' ><tr><td >"
  186. tmpFooter = "</td></tr></table>"
  187. end if
  188. Response.Write tmpHeader
  189. %>
  190. <a href="<% =URL %>;"
  191. onfocus ="window.status=''; spanAreaButton(<%= m_intSpanIndex%>).className='AREABUTTONhover';"
  192. onblur="spanAreaButton(<%= m_intSpanIndex%>).className='AREABUTTON';"
  193. onClick="if (spanAreaButton(<%= m_intSpanIndex%>).disabled) { return false; }"
  194. >
  195. <span class="AreaButton" style="overflow:visible;"
  196. ID="spanAreaButton"
  197. onMouseOver="if (!this.disabled) { window.status=''; this.className='AREABUTTONhover';} return true;"
  198. onMouseOut="this.className='AREABUTTON';"
  199. >
  200. <% =Caption %>
  201. </span>
  202. </a>
  203. <%
  204. Response.Write tmpFooter
  205. End Function
  206. '----------------------------------------------------------------------------
  207. '
  208. ' Function : ServeElementBlock
  209. '
  210. ' Synopsis : Serves elements belonging to the same container
  211. '
  212. ' Arguments: Container(IN) - container whose elements need to be served
  213. ' EmptyMsg(IN) - Msg to display if no elements are found
  214. ' Icons(IN) - Should icons be displayed with text
  215. ' Links(IN) - Should text be displayed as hyperlink
  216. ' NewWindow(IN) - Should this be displayed in a separate browser
  217. ' window or not
  218. '
  219. ' Returns : None
  220. '
  221. '----------------------------------------------------------------------------
  222. Function ServeElementBlock(Container, EmptyMsg, Icons, Links, NewWindow)
  223. Dim objElements
  224. Dim objItem
  225. Dim arrTitle()
  226. Dim arrURL()
  227. Dim arrHelpText()
  228. Dim arrIconPath()
  229. Dim blnWroteElement
  230. Dim blnEnabled
  231. Dim i
  232. On Error Resume Next
  233. Set objElements = GetElements(Container)
  234. ReDim arrTitle(objElements.Count)
  235. ReDim arrURL(objElements.Count)
  236. ReDim arrHelpText(objElements.Count)
  237. ReDim arrIconPath(objElements.Count)
  238. blnWroteElement = False
  239. i = 0
  240. 'response.write "calling LocMgr, count is " & objElements.Count & " ....<P>"
  241. Set objLocMgr = Server.CreateObject("ServerAppliance.LocalizationManager")
  242. Response.Write "<table border=0 width=386 cellspacing=0>"
  243. Response.Flush
  244. For Each objItem in objElements
  245. If objItem.GetProperty("IsEnabled") Then
  246. blnEnabled = True
  247. Else
  248. blnEnabled = False
  249. End If
  250. Err.Clear
  251. If blnEnabled Then
  252. arrIconPath(i) = objItem.GetProperty("ElementGraphic")
  253. %>
  254. <tr>
  255. <td width="20" height="28" valign="middle">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
  256. <td width="25" height="28" valign="middle" align=left>
  257. <% If Icons = True And arrIconPath(i) <> "" Then
  258. Response.Write "<IMG src=" & Chr(34) & arrIconPath(i) & Chr(34) & " border=0>"
  259. End If
  260. If objItem.GetProperty("IsEmbedded") Then
  261. Response.Write "</td><td height=28 valign=middle align=left>"
  262. Response.Write "<span class=RESOURCE>"
  263. If Not GetEmbedHTML(objItem, 0) Then
  264. 'response.write "GetEmbedHTML returned false<P>...."
  265. 'Response.Flush
  266. Response.Clear
  267. Else
  268. blnWroteElement = True
  269. Response.Write "</span>"
  270. Response.Flush
  271. End If
  272. Else
  273. blnWroteElement = True
  274. Response.Write "&nbsp;"
  275. Response.Write "</td><td height=28 valign=middle align=left>"
  276. intCaptionID = "&H" & objItem.GetProperty("CaptionRID")
  277. strSourceName = ""
  278. strSourceName = objItem.GetProperty ("Source")
  279. If strSourceName = "" Then
  280. strSourceName = "svrapp"
  281. End If
  282. arrTitle(i) = objLocMgr.GetString(strSourceName, intCaptionID, varReplacementStrings)
  283. intDescriptionID = "&H" & objItem.GetProperty("DescriptionRID")
  284. arrHelpText(i) = objLocMgr.GetString(strSourceName, intDescriptionID, varReplacementStrings)
  285. arrURL(i) = objItem.GetProperty("URL")
  286. If Links = True Then %>
  287. <a class="NAVLINK" href="JavaScript:OpenPage('<% =arrURL(i) %>');"
  288. <% If NewWindow Then ' open URL in a new browser window named after the Element URL property
  289. Response.Write "target=" & Chr(34) & arrURL(i) & Chr(34)
  290. End If %>
  291. title="<% =Server.HTMLEncode(arrHelpText(i)) %>"
  292. onMouseOver="window.status='<% =EscapeQuotes(arrHelpText(i)) %>';return true;"
  293. onMouseOut="window.status='';return true;"
  294. onFocus="window.status='<% =EscapeQuotes(arrHelpText(i)) %>';return true;">
  295. <% Response.Write arrTitle(i)
  296. Response.Write "</a>"
  297. Else
  298. Response.Write arrTitle(i)
  299. End If
  300. End If
  301. Response.Write "</td></tr>"
  302. i = i + 1
  303. End If
  304. Next
  305. Set objElements = Nothing
  306. Set objItem = Nothing
  307. If Not blnWroteElement Then %>
  308. <tr>
  309. <td width=30 height=28 colspan=2 valign=middle>&nbsp;</td>
  310. <td width=25 height=28 valign=middle>&nbsp;</td>
  311. <td width=314 height=28 valign=middle class="Resource">
  312. <% =EmptyMsg %>
  313. </td>
  314. </tr>
  315. <% End If
  316. Response.Write "</table>"
  317. Response.Flush
  318. End Function
  319. '=========================================
  320. Sub ForceAuthentication()
  321. On Error Resume Next
  322. Response.Buffer = TRUE
  323. Response.Status = ("401 Unauthorized")
  324. Response.End
  325. End Sub
  326. '=========================================
  327. Function ServePageWaterMark(ImagePath)
  328. On Error Resume Next
  329. If IsIE() Then %>
  330. <!--<div style="position: absolute; width:100%; height:90%; z-index:-1"> -->
  331. <div style="position:absolute;width:100%; height:92%; z-index:-1">
  332. <%else %>
  333. <div style="position:absolute;width:100%; height:87%; z-index:-1">
  334. <% end if%>
  335. <table width=100% height=100% cellpadding=2 cellspacing=0 >
  336. <TR><td height=70% >&nbsp;</td><td height=70% >&nbsp;</td></tr>
  337. <TR><td width=100% >&nbsp;</td><td><img src="<% =ImagePath %>"></td></tr>
  338. <TR><TD colspan="2" width=100% bgcolor=#000000>&nbsp;</TD></TR>
  339. </table>
  340. </div>
  341. <% 'End If
  342. End Function
  343. '----------------------------------------------------------------------------
  344. '
  345. ' Function : IsIE
  346. '
  347. ' Synopsis : Is client browser IE
  348. '
  349. ' Arguments: None
  350. '
  351. ' Returns : true/false
  352. '
  353. '----------------------------------------------------------------------------
  354. Function IsIE()
  355. On Error Resume Next
  356. If InStr(Request.ServerVariables("HTTP_USER_AGENT"), "MSIE") Then
  357. IsIE = True
  358. Else
  359. IsIE = False
  360. End If
  361. End Function
  362. '----------------------------------------------------------------------------
  363. '
  364. ' Function : IsNT
  365. '
  366. ' Synopsis : Is client NT4
  367. '
  368. ' Arguments: None
  369. '
  370. ' Returns : true/false
  371. '
  372. '----------------------------------------------------------------------------
  373. Function IsNT()
  374. On Error Resume Next
  375. If InStr(Request.ServerVariables("HTTP_USER_AGENT"), "Windows NT") Then
  376. IsNT = True
  377. Else
  378. IsNT = False
  379. End If
  380. End Function
  381. '----------------------------------------------------------------------------
  382. '
  383. ' Function : IsNT5
  384. '
  385. ' Synopsis : Is client Windows 2000
  386. '
  387. ' Arguments: None
  388. '
  389. ' Returns : true/false
  390. '
  391. '----------------------------------------------------------------------------
  392. Function IsNT5()
  393. On Error Resume Next
  394. If InStr(Request.ServerVariables("HTTP_USER_AGENT"), "Windows NT 5.") Then
  395. IsNT5 = True
  396. Else
  397. IsNT5 = False
  398. End If
  399. End Function
  400. '----------------------------------------------------------------------------
  401. '
  402. ' Function : IsWin98
  403. '
  404. ' Synopsis : Is client Windows 98
  405. '
  406. ' Arguments: None
  407. '
  408. ' Returns : true/false
  409. '
  410. '----------------------------------------------------------------------------
  411. Function IsWin98()
  412. On Error Resume Next
  413. If InStr(Request.ServerVariables("HTTP_USER_AGENT"), "Windows 98") Then
  414. IsWin98 = True
  415. Else
  416. IsWin98 = False
  417. End If
  418. End Function
  419. '----------------------------------------------------------------------------
  420. '
  421. ' Function : GetFirstTabURL
  422. '
  423. ' Synopsis : Get URL of the first tab
  424. '
  425. ' Arguments: None
  426. '
  427. ' Returns : URL string of the first tab
  428. '
  429. '----------------------------------------------------------------------------
  430. Function GetFirstTabURL()
  431. Dim objTabs
  432. Dim objTab
  433. Dim strHomeURL
  434. On Error Resume Next
  435. strHomeURL = ""
  436. Set objTabs = GetElements("TABS")
  437. For Each objTab in objTabs
  438. strHomeURL = objTab.GetProperty("URL")
  439. Exit For
  440. Next
  441. Set objTab = Nothing
  442. Set objTabs = Nothing
  443. GetFirstTabURL = strHomeURL
  444. End Function
  445. '----------------------------------------------------------------------------
  446. '
  447. ' Function : GetUserAccount
  448. '
  449. ' Synopsis : Username of user on remote client
  450. '
  451. ' Arguments: None
  452. '
  453. ' Returns : User name string
  454. '
  455. '----------------------------------------------------------------------------
  456. Function GetUserAccount()
  457. Dim strLogonUser
  458. On Error Resume Next
  459. strLogonUser = Request.ServerVariables("LOGON_USER")
  460. If strLogonUser <> "" Then
  461. strLogonUser = Right(strLogonUser, (Len(strLogonUser) - InStr(strLogonUser, "\")))
  462. GetUserAccount = strLogonUser
  463. Else
  464. GetUserAccount = ""
  465. End If
  466. End Function
  467. '----------------------------------------------------------------------------
  468. '
  469. ' Function : GetServerName
  470. '
  471. ' Synopsis : Return server name as referred to in remote client
  472. '
  473. ' Arguments: None
  474. '
  475. ' Returns : server name string
  476. '
  477. '----------------------------------------------------------------------------
  478. Function GetServerName()
  479. On Error Resume Next
  480. GetServerName = Request.ServerVariables("SERVER_NAME")
  481. End Function
  482. '----------------------------------------------------------------------------
  483. '
  484. ' Function : GetScriptFileName
  485. '
  486. ' Synopsis : file name of current file being request by client
  487. '
  488. ' Arguments: None
  489. '
  490. ' Returns : file name string
  491. '
  492. '----------------------------------------------------------------------------
  493. Function GetScriptFileName()
  494. Dim strPath
  495. Dim intPos
  496. On Error Resume Next
  497. strPath = Request.ServerVariables("PATH_INFO")
  498. intPos = InStr(strPath, "/")
  499. Do While intPos > 0
  500. strPath = Right(strPath, Len(strPath) - intPos)
  501. intPos = InStr(strPath, "/")
  502. Loop
  503. GetScriptFileName = strPath
  504. End Function
  505. '----------------------------------------------------------------------------
  506. '
  507. ' Function : GetScriptPath
  508. '
  509. ' Synopsis : path of file name being request by client
  510. '
  511. ' Arguments: None
  512. '
  513. ' Returns : path string
  514. '
  515. '----------------------------------------------------------------------------
  516. Function GetScriptPath()
  517. ' Returns the path w/o leading slashes (/)
  518. '
  519. Dim strPath
  520. On Error Resume Next
  521. strPath = Request.ServerVariables("PATH_INFO")
  522. If Left(strPath, 1) = "/" Then
  523. strPath = Right(strPath, Len(strPath)-1)
  524. End If
  525. GetScriptPath = strPath
  526. End Function
  527. '----------------------------------------------------------------------------
  528. '
  529. ' Function : GetLocString
  530. '
  531. ' Synopsis : Gets localized string from resource dll
  532. '
  533. ' Arguments: SourceFile(IN) - resource dll name
  534. ' ResourceID(IN) - resource id in hex
  535. ' ReplacementStrings(IN) - parameters to replace in string
  536. '
  537. ' Returns : localized string
  538. '
  539. '----------------------------------------------------------------------------
  540. Function GetLocString(SourceFile, ResourceID, ReplacementStrings)
  541. ' returns localized string
  542. '
  543. Dim objLocMgr
  544. Dim varReplacementStrings
  545. On Error Resume Next
  546. ' prep inputs
  547. If Left(ResourceID, 2) <> "&H" Then
  548. ResourceID = "&H" & ResourceID
  549. End If
  550. If Trim(SourceFile) = "" Then
  551. SourceFile = "svrapp"
  552. End If
  553. If (Not IsArray(ReplacementStrings)) Then
  554. ReplacementStrings = varReplacementStrings
  555. End If
  556. ' call Localization Manager
  557. Set objLocMgr = Server.CreateObject("ServerAppliance.LocalizationManager")
  558. Err.Clear
  559. GetLocString = objLocMgr.GetString(SourceFile, ResourceID, ReplacementStrings)
  560. If Err <> 0 Then
  561. GetLocString = Err.description
  562. Err.Clear
  563. End If
  564. Set objLocMgr = Nothing
  565. End Function
  566. '----------------------------------------------------------------------------
  567. '
  568. ' Function : FixHTMLSpaces
  569. '
  570. ' Synopsis : Replace space with &nbsp;
  571. '
  572. ' Arguments: InString(IN) - string to fix
  573. '
  574. ' Returns : None
  575. '
  576. '----------------------------------------------------------------------------
  577. Function FixHTMLSpaces(InString)
  578. ' Replaces a 'space' character with the HTML &nbsp; equivalent
  579. On Error Resume Next
  580. FixHTMLSpaces = Replace(InString, " ", "&nbsp;")
  581. End Function
  582. '----------------------------------------------------------------------------
  583. '
  584. ' Function : EscapeQuotes
  585. '
  586. ' Synopsis : Insert escape character before quote
  587. '
  588. ' Arguments: InString(IN) - string to fix
  589. '
  590. ' Returns : None
  591. '
  592. '----------------------------------------------------------------------------
  593. Function EscapeQuotes(InString)
  594. On Error Resume Next
  595. Dim i
  596. Dim strOut
  597. strOut = InString
  598. i = 1
  599. Do While i <> 0
  600. i = InStr(i, strOut, "'")
  601. If i <> 0 Then
  602. If (i > 1) And (Mid(strOut, i-1, 2) = "\'") Then
  603. ' input string was escaped already - do nothing
  604. Else
  605. strOut = Left(strOut, i-1) & "\'" & Right(strOut, Len(strOut)-i)
  606. End If
  607. End If
  608. If (i < Len(strOut)) And (i <> 0) Then
  609. i = i + 1
  610. Else
  611. Exit Do
  612. End If
  613. Loop
  614. EscapeQuotes = Server.HTMLEncode(strOut)
  615. End Function
  616. '----------------------------------------------------------------------------
  617. '
  618. ' Function : GetElements
  619. '
  620. ' Synopsis : Return collection of IWebElement objects based on the
  621. ' Container parm
  622. '
  623. ' Arguments: Container(IN) - container name
  624. '
  625. ' Returns : collection of elements
  626. '
  627. '----------------------------------------------------------------------------
  628. Function GetElements(Container)
  629. 'Return collection of IWebElement objects based on the Container parm.
  630. '
  631. Dim objRetriever
  632. Dim objElements
  633. On Error Resume Next
  634. Set objRetriever = Server.CreateObject("Elementmgr.ElementRetriever")
  635. Set objElements = objRetriever.GetElements(1, Container)
  636. If Err.Number <> 0 Then
  637. Err.Clear
  638. End If
  639. Set GetElements = objElements
  640. Set objElements = Nothing
  641. Set objRetriever = Nothing
  642. End Function
  643. '----------------------------------------------------------------------------
  644. '
  645. ' Function : ServeRestartingPage
  646. '
  647. ' Synopsis : Redirect user to the restarting page
  648. '
  649. ' Arguments: strRsrcDLL(IN) - resource DLL name which contains the msg to
  650. ' be displayed in the restaring page.
  651. ' strMsgID(IN) - msg ID in strRsrcDLL to be displayed. This ID
  652. ' should be a string. For e.g., if the msg id is
  653. ' 80010004, then set strMsgID="80010004".
  654. ' strInitWaitTime(IN) - initial wait time in milliseconds.
  655. ' strWaitTime(IN) - subsequent wait time in milliseconds.
  656. '
  657. ' Returns : None
  658. '
  659. '----------------------------------------------------------------------------
  660. Function ServeRestartingPage(strRsrcDLL, strMsgID, strInitWaitTime, strWaitTime)
  661. On Error Resume Next
  662. %>
  663. <html>
  664. <!-- Copyright (c) 1999 - 2000 Microsoft Corporation. All rights reserved-->
  665. <head>
  666. <SCRIPT language=JavaScript>
  667. function LoadPage() {
  668. top.location='/sh_restarting.asp?Resrc=' + '<%=strRsrcDLL%>' + '&ID=' + '<%=strMsgID%>' + '&T1=' + '<%=strInitWaitTime%>' + '&T2=' + '<%=strWaitTime%>' + '&R=' + Math.random();
  669. }
  670. </SCRIPT>
  671. </head>
  672. <body onLoad="LoadPage();" bgcolor="#666699">
  673. &nbsp;
  674. </body>
  675. </html>
  676. <% Response.End
  677. End Function
  678. '----------------------------------------------------------------------------
  679. '
  680. ' Function : Redirect
  681. '
  682. ' Synopsis : Redirect to given URL
  683. '
  684. ' Arguments: URL(IN) - URL to redirect to
  685. '
  686. ' Returns : None
  687. '
  688. '----------------------------------------------------------------------------
  689. Function Redirect(URL)
  690. On Error Resume Next %>
  691. <html>
  692. <!-- Copyright (c) 1999 - 2000 Microsoft Corporation. All rights reserved-->
  693. <head>
  694. <SCRIPT language=JavaScript>
  695. function LoadPage() {
  696. <% If Trim(URL) <> "" Then %>
  697. top.hidden.SetupPage("<% =URL %>?R=" + Math.random());
  698. <% Else %>
  699. top.hidden.SetupPage("../<% =GetFirstTabURL() %>?R=" + Math.random());
  700. <% End If %>
  701. }
  702. </SCRIPT>
  703. </head>
  704. <body onLoad="LoadPage();" bgcolor="#000000">
  705. &nbsp;
  706. </body>
  707. </html>
  708. <%
  709. End Function
  710. '----------------------------------------------------------------------------
  711. '
  712. ' Function : ClearAlert
  713. '
  714. ' Synopsis : Clears an alert
  715. '
  716. ' Arguments: Cookie(IN) - cookie of alert to clear
  717. '
  718. ' Returns : true/false
  719. '
  720. '----------------------------------------------------------------------------
  721. Function ClearAlert(Cookie)
  722. Dim objAM
  723. Dim rc
  724. On Error Resume Next
  725. Set objAM = GetObject("WINMGMTS:{impersonationLevel=impersonate}!\\" & GetServerName & "\root\cimv2:Microsoft_SA_Manager=@" )
  726. rc = objAM.ClearAlert(CInt(Cookie))
  727. If rc = 0 And Err = 0 Then
  728. ClearAlert = True
  729. Else
  730. ClearAlert = False
  731. End If
  732. Set objAM = Nothing
  733. End Function
  734. '----------------------------------------------------------------------------
  735. '
  736. ' Function : SwapRows
  737. '
  738. ' Synopsis : Swap routine used by QuickSort
  739. '
  740. ' Arguments: arr(IN) - array whose row needs to be swapped
  741. ' row1(IN) - row to swap
  742. ' row2(IN) - row to swap
  743. '
  744. ' Returns : None
  745. '
  746. '----------------------------------------------------------------------------
  747. Sub SwapRows(ary,row1,row2)
  748. '== This proc swaps two rows of an array
  749. Dim x,tempvar
  750. For x = 0 to Ubound(ary,2)
  751. tempvar = ary(row1,x)
  752. ary(row1,x) = ary(row2,x)
  753. ary(row2,x) = tempvar
  754. Next
  755. End Sub 'SwapRows
  756. '----------------------------------------------------------------------------
  757. '
  758. ' Function : QuickSort
  759. '
  760. ' Synopsis : the quick sort algorithm
  761. '
  762. ' Arguments: vec(IN) - array whose row needs to be swapped
  763. ' loBound(IN) - lower bound of array vec
  764. ' hiBound(IN) - upped bound of array vec
  765. ' SortField(IN) - the field to sort on
  766. '
  767. ' Returns : None
  768. '
  769. '----------------------------------------------------------------------------
  770. Sub QuickSort(vec, loBound, hiBound, SortField)
  771. Dim pivot(),loSwap,hiSwap,temp,counter
  772. Redim pivot (Ubound(vec,2))
  773. 'loBound = LBound(vec)
  774. 'hiBound = UBound(vec)
  775. '== Two items to sort
  776. if hiBound - loBound = 1 then
  777. if vec(loBound,SortField) > vec(hiBound,SortField) then Call SwapRows(vec,hiBound,loBound)
  778. End If
  779. '== Three or more items to sort
  780. For counter = 0 to Ubound(vec,2)
  781. pivot(counter) = vec(int((loBound + hiBound) / 2),counter)
  782. vec(int((loBound + hiBound) / 2),counter) = vec(loBound,counter)
  783. vec(loBound,counter) = pivot(counter)
  784. Next
  785. loSwap = loBound + 1
  786. hiSwap = hiBound
  787. do
  788. '== Find the right loSwap
  789. while loSwap < hiSwap and vec(loSwap,SortField) <= pivot(SortField)
  790. loSwap = loSwap + 1
  791. wend
  792. '== Find the right hiSwap
  793. while vec(hiSwap,SortField) > pivot(SortField)
  794. hiSwap = hiSwap - 1
  795. wend
  796. '== Swap values if loSwap is less then hiSwap
  797. if loSwap < hiSwap then Call SwapRows(vec,loSwap,hiSwap)
  798. loop while loSwap < hiSwap
  799. For counter = 0 to Ubound(vec,2)
  800. vec(loBound,counter) = vec(hiSwap,counter)
  801. vec(hiSwap,counter) = pivot(counter)
  802. Next
  803. '== Recursively call function .. the beauty of Quicksort
  804. '== 2 or more items in first section
  805. if loBound < (hiSwap - 1) then Call QuickSort(vec,loBound,hiSwap-1,SortField)
  806. '== 2 or more items in second section
  807. if hiSwap + 1 < hibound then Call QuickSort(vec,hiSwap+1,hiBound,SortField)
  808. End Sub 'QuickSort
  809. Function ServePageWaterMarkNavIE
  810. if isIE then
  811. %>
  812. <table cellpadding=0 cellspacing=0 border=0 width=100% height=100% >
  813. <% else %>
  814. <table cellpadding=0 cellspacing=0 border=0 width=100% height=103% >
  815. <% end if %>
  816. <tr valign="top"><td>
  817. <%
  818. End Function
  819. Function ServePageWaterMarkEndNavIE(WaterMarkImagePath, OEMImagePath, fServeBack)
  820. %>
  821. </td></tr>
  822. <%if fServeBack=false then%>
  823. <TR ALIGN="right"><td><img src="<%=WaterMarkImagePath%>"></td></tr>
  824. <%else%>
  825. <TR>
  826. <TD>
  827. <TABLE WIDTH="100%">
  828. <TR>
  829. <TD><%ServeBackButton%></TD>
  830. <TD ALIGN="right"><IMG SRC="<%=WaterMarkImagePath%>"></TD>
  831. </TR>
  832. </TABLE>
  833. </TD>
  834. </TR>
  835. <%end if%>
  836. <TR ALIGN="left" height="30" bgcolor="black"><td><img src="<%=OEMImagePath%>"></td></tr>
  837. </table>
  838. <%
  839. End Function
  840. %>