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.

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