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.

2137 lines
71 KiB

  1. <% '==================================================
  2. ' Microsoft Server Appliance
  3. '
  4. ' Page-level functions
  5. '
  6. ' Copyright (c) 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. <!-- #include file="inc_base.asp" -->
  17. <%
  18. '
  19. ' If page caching is disabled, then set HTTP Headers to disable caching.
  20. ' Default case is disabled.
  21. '
  22. If ( FALSE = SAI_GetPageCaching() ) Then
  23. If ( IsNull(Response.Expires) OR Response.Expires >= 0 ) Then
  24. Response.Buffer = True
  25. Response.ExpiresAbsolute = DateAdd("yyyy", -10, Date)
  26. Response.AddHeader "pragma", "no-cache"
  27. Response.AddHeader "cache-control", "no-store"
  28. End If
  29. Call SA_TraceOut(SA_GetScriptFileName(), "Page Caching DISABLED")
  30. Else
  31. Call SA_TraceOut(SA_GetScriptFileName(), "Page Caching enabled")
  32. End If
  33. '--------------------------------------------------------------------
  34. ' Public Constants
  35. '--------------------------------------------------------------------
  36. '
  37. Const SA_RESERVED = ""
  38. Const SA_DEFAULT = ""
  39. '
  40. ' Page Types:
  41. ' -----------
  42. Const PT_PROPERTY = 1
  43. Const PT_TABBED = 2
  44. Const PT_WIZARD = 3
  45. Const PT_AREA = 4
  46. Const PT_PAGELET = 5
  47. '
  48. ' File System Explorer:
  49. ' -----------
  50. Const EXPLORE_FOLDERS = "0"
  51. Const EXPLORE_FILES_AND_FOLDERS = "1"
  52. '--------------------------------------------------------------------
  53. ' Framework Parameter Name
  54. '--------------------------------------------------------------------
  55. '
  56. Dim FLD_PagingAction
  57. Dim FLD_PagingRequest
  58. Dim FLD_PagingEnabled
  59. Dim FLD_PagingPageMin
  60. Dim FLD_PagingPageMax
  61. Dim FLD_PagingPageCurrent
  62. Dim FLD_SearchItem
  63. Dim FLD_SearchValue
  64. Dim FLD_SearchRequest
  65. Dim FLD_SortingColumn
  66. Dim FLD_SortingSequence
  67. Dim FLD_SortingRequest
  68. Dim FLD_SortingEnabled
  69. Dim FLD_IsToolbarEnabled
  70. FLD_PagingAction = "fldPagingAction"
  71. FLD_PagingRequest = "fldPagingRequest"
  72. FLD_PagingEnabled = "PageE"
  73. FLD_PagingPageMin = "PageMi"
  74. FLD_PagingPageMax = "PageMx"
  75. FLD_PagingPageCurrent = "PageCu"
  76. FLD_SearchItem = "SearchI"
  77. FLD_SearchValue = "SearchV"
  78. FLD_SearchRequest = "fldSearchRequest"
  79. FLD_SortingColumn = "SortC"
  80. FLD_SortingSequence = "SortS"
  81. FLD_SortingRequest = "fldSortingRequest"
  82. FLD_SortingEnabled = "SortE"
  83. FLD_IsToolbarEnabled = "fldIsToolbarEnabled"
  84. '--------------------------------------------------------------------
  85. ' Framework Version
  86. '--------------------------------------------------------------------
  87. '
  88. Dim g_iFrameworkVersion
  89. Const gc_V2 = 2.0
  90. g_iFrameworkVersion = 1.0
  91. Dim m_bPageCaching
  92. m_bPageCaching = FALSE
  93. Dim objLocMgr
  94. 'Dim intCaptionID
  95. 'Dim intDescriptionID
  96. Dim varReplacementStrings
  97. Dim m_intSpanIndex
  98. Dim m_VirtualRoot
  99. Dim miPageType
  100. Dim iNextButtonNumber
  101. iNextButtonNumber = 0
  102. Dim strSourceName
  103. strSourceName = ""
  104. m_intSpanIndex=0
  105. m_VirtualRoot = getVirtualDirectory()
  106. strSourceName = "sakitmsg.dll"
  107. Set objLocMgr = Server.CreateObject("ServerAppliance.LocalizationManager")
  108. If Err.number <> 0 Then
  109. If ( Err.number = &H800401F3 ) Then
  110. Response.Write("<H1>Problem:<H1>")
  111. Response.Write("Unable to locate a software component on the Server Appliance.<BR>")
  112. Response.Write("The Server Appliance core software components do not appear to be installed correctly.")
  113. Else
  114. Response.Write("<H1>Problem:<H1>")
  115. Response.Write("Server.CreateObject(ServerAppliance.LocalizationManager) failed with error code: " + CStr(Hex(Err.Number)) + " " + Err.Description)
  116. End If
  117. Call SA_TraceOut("SH_TASK", "Server.CreateObject(ServerAppliance.LocalizationManager) failed with error code: " + CStr(Hex(Err.Number)) )
  118. Response.End
  119. End If
  120. '-----------------------------------------------------
  121. 'START of localization content
  122. Dim L_FOKBUTTON_TEXT
  123. Dim L_FCANCELBUTTON_TEXT
  124. Dim L_FBACKBUTTON_TEXT
  125. Dim L_FNEXTBUTTON_TEXT
  126. Dim L_FFINISHBUTTON_TEXT
  127. Dim L_FCLOSEBUTTON_TEXT
  128. Dim L_AREABACKBUTTON_TEXT
  129. L_FOKBUTTON_TEXT = GetLocString(strSourceName, "&H40010012", "")
  130. L_FCANCELBUTTON_TEXT = GetLocString(strSourceName, "&H40010013", "")
  131. L_FBACKBUTTON_TEXT = GetLocString(strSourceName, "&H40010014", "")
  132. L_FNEXTBUTTON_TEXT = GetLocString(strSourceName, "&H40010015", "")
  133. L_FFINISHBUTTON_TEXT = GetLocString(strSourceName, "&H40010016", "")
  134. L_FCLOSEBUTTON_TEXT = GetLocString(strSourceName, "&H40010017", "")
  135. L_AREABACKBUTTON_TEXT = GetLocString(strSourceName, "&H40010018", "")
  136. 'End of localization content
  137. '-----------------------------------------------------
  138. '--------------------------------------------------------------------
  139. ' Private global variables
  140. '--------------------------------------------------------------------
  141. '
  142. Dim m_oLocManager
  143. Private Function SAI_GetNextButtonName()
  144. iNextButtonNumber = iNextButtonNumber + 1
  145. SAI_GetNextButtonName = "btnInternal_" + CStr(iNextButtonNumber)
  146. End Function
  147. Private Function SAI_EnablePageCaching(ByVal bEnable)
  148. m_bPageCaching = bEnable
  149. End Function
  150. Private Function SAI_GetPageCaching()
  151. '
  152. ' If Page Caching is not specified then it's disabled
  153. If ( Len(m_bPageCaching) <= 0 ) Then
  154. m_bPageCaching = FALSE
  155. End If
  156. SAI_GetPageCaching = m_bPageCaching
  157. End Function
  158. Private Function SAI_GetTSClientCodeBase()
  159. On Error Resume Next
  160. Err.Clear
  161. Dim objRegistry
  162. Dim s
  163. '
  164. ' Set default return value
  165. 'SAI_GetTSClientCodeBase = "../tsweb/msrdp.cab#version=5,1,2524,0"
  166. SAI_GetTSClientCodeBase = "/tsweb/msrdp.cab"
  167. '
  168. ' Connect to the Registry WMI Provider
  169. Set objRegistry = RegConnection()
  170. If (NOT IsObject(objRegistry)) Then
  171. Call SA_TraceOut(SA_GetScriptFileName() , "SAI_GetTSClientInfo::RegConnection() failed: " + CStr(Hex(Err.Number)))
  172. Exit Function
  173. End If
  174. '
  175. ' Fetch the REG key
  176. s = GetRegkeyValue( objRegistry, _
  177. "SOFTWARE\Microsoft\ServerAppliance\TSClient",_
  178. "Codebase", CONST_STRING)
  179. If ( Err.Number <> 0 ) Then
  180. Call SA_TraceOut(SA_GetScriptFileName() , "SAI_GetTSClientInfo::GetRegkeyValue() failed: " + CStr(Hex(Err.Number)))
  181. Set objRegistry = Nothing
  182. Exit Function
  183. End If
  184. '
  185. ' Check for invalid, empty value
  186. If ( Len(s) <= 0 ) Then
  187. Set objRegistry = Nothing
  188. Exit Function
  189. End If
  190. '
  191. ' Set the return value
  192. SAI_GetTSClientCodeBase = s
  193. Set objRegistry = Nothing
  194. End Function
  195. Private Function SA_SetPageID(ByVal sPageID)
  196. FLD_SearchItem = sPageID + FLD_SearchItem
  197. FLD_SearchValue = sPageID + FLD_SearchValue
  198. FLD_PagingEnabled = sPageID + FLD_PagingEnabled
  199. FLD_PagingPageMin = sPageID + FLD_PagingPageMin
  200. FLD_PagingPageMax = sPageID + FLD_PagingPageMax
  201. FLD_PagingPageCurrent = sPageID + FLD_PagingPageCurrent
  202. FLD_SortingColumn = sPageID + FLD_SortingColumn
  203. FLD_SortingSequence = sPageID + FLD_SortingSequence
  204. FLD_SortingEnabled = sPageID + FLD_SortingEnabled
  205. FLD_IsToolbarEnabled = sPageID + FLD_IsToolbarEnabled
  206. End Function
  207. Private Function SA_SetVersion(ByVal iVersion)
  208. g_iFrameworkVersion = iVersion
  209. End Function
  210. Public Function SA_GetVersion()
  211. SA_GetVersion = g_iFrameworkVersion
  212. End Function
  213. Public Function SA_GetParam(ByVal sParamName)
  214. If (Len(Request.Form(sParamName)) > 0 ) Then
  215. SA_GetParam = Request.Form(sParamName)
  216. 'Call SA_TraceOut("SH_PAGE", "SA_GetParam returning Request.Form("+sParamName+") value:" + CStr(SA_GetParam))
  217. Else
  218. SA_GetParam = Request.QueryString(sParamName)
  219. 'Call SA_TraceOut("SH_PAGE", "SA_GetParam returning Request.QueryString("+sParamName+") value:" + CStr(SA_GetParam))
  220. End If
  221. End Function
  222. '--------------------------------------------------------------------
  223. '
  224. ' Function: SA_GetNewHostURLBase
  225. '
  226. ' Synopsis: Format and return a new HOST URL base using the specified
  227. ' parameters.
  228. '
  229. ' Arguments: [in] sServerName Specifies the server name, optional.
  230. ' Use SA_DEFAULT to specify not change to the
  231. ' server name.
  232. '
  233. ' [in] sServerPort Port on the server, optional. Use the constant
  234. ' SA_DEFAULT to specify the current port.
  235. '
  236. ' [in] bUseSecurePort TRUE to indicate a secure (HTTPS) connection, FALSE
  237. ' for a normal connection (HTTP).
  238. '
  239. ' [in] sAdminRoot Administrative web root, which includes a trailing backslash,
  240. ' optional. To specify the current admin root use the constant
  241. ' SA_DEFAULT.
  242. '
  243. ' Returns: The new base url in the form http://server:port/adminroot/
  244. '
  245. '--------------------------------------------------------------------
  246. Public Function SA_GetNewHostURLBase(ByVal sHostName, ByVal sHostPort, ByVal bUseSecurePort, ByVal sAdminRoot)
  247. Dim bIsCurrentlySecure
  248. Dim sHostConnection
  249. '
  250. ' Validate bUseSecurePort argument
  251. '
  252. If ( bUseSecurePort = SA_DEFAULT ) Then
  253. bUseSecurePort = CInt(Request.ServerVariables("SERVER_PORT_SECURE"))
  254. End If
  255. If ( bUseSecurePort = TRUE ) Then
  256. ElseIf ( bUseSecurePort = FALSE ) Then
  257. Else
  258. Call SA_TraceErrorOut(SA_GetScriptFileName(), "SA_GetChangedHostPath called with invalid value specified for bUseSecurePort: " + CStr(bUseSecurePort))
  259. bUseSecurePort = FALSE
  260. End If
  261. '
  262. ' http://
  263. If ( TRUE = bUseSecurePort ) Then
  264. sHostConnection = "https://"
  265. Else
  266. sHostConnection = "https://"
  267. End If
  268. '
  269. ' http://server
  270. If ( Len(sHostName) <= 0 ) Then
  271. sHostName = GetServerName()
  272. End If
  273. sHostConnection = sHostConnection + sHostName
  274. '
  275. ' http://server:8080
  276. If ( Len(sHostPort) <= 0 ) Then
  277. sHostPort = Request.ServerVariables("SERVER_PORT")
  278. End If
  279. sHostConnection = sHostConnection + ":" + CStr(sHostPort)
  280. '
  281. ' http://server:8080/adminroot/
  282. sAdminRoot = Trim(sAdminRoot)
  283. If ( Len(sAdminRoot) <= 0 ) Then
  284. sAdminRoot = m_VirtualRoot
  285. End If
  286. If ( Left(sAdminRoot, 1) <> "/" ) Then
  287. sAdminRoot = "/" + sAdminRoot
  288. End If
  289. If ( Right(sAdminRoot, 1) <> "/" ) Then
  290. sAdminRoot = sAdminRoot + "/"
  291. End If
  292. sHostConnection = sHostConnection + sAdminRoot
  293. SA_GetNewHostURLBase = sHostConnection
  294. Call SA_TraceOut(SA_GetScriptFileName(), "SA_GetNewHostURLBase returning: " + CStr(SA_GetNewHostURLBase))
  295. End Function
  296. '--------------------------------------------------------------------
  297. '
  298. ' Function: SA_ServeFileExplorer
  299. '
  300. ' Synopsis: Serve the Appliance File System Explorer Widget. This Widget
  301. ' provides UI to allow the user to browse the Server Appliance
  302. ' file system to select a file or folder.
  303. '
  304. ' Arguments: [in] iExploreOptions (EXPLORE_FOLDERS, EXPLORE_FILES_AND_FOLDERS)
  305. ' [in] sStartingFolder
  306. ' [in] sNotifyFn
  307. ' [in] iWidth
  308. ' [in] iHeight
  309. ' [in] Reserved
  310. '
  311. ' Returns: Nothing
  312. '
  313. '--------------------------------------------------------------------
  314. Public Function SA_ServeFileExplorer( ByVal ExploreOptions,_
  315. ByVal sStartingFolder,_
  316. ByVal sNotifyFn,_
  317. ByVal iWidth,_
  318. ByVal iHeight,_
  319. ByRef Reserved)
  320. Dim sExplorerURL
  321. If ( Len(iWidth) <= 0 ) Then
  322. iWidth = "100%"
  323. End If
  324. If ( Len(iHeight) <= 0 ) Then
  325. iHeight="350px"
  326. End If
  327. sExplorerURL = m_VirtualRoot + "sh_fsexplorer.asp"
  328. Call SA_MungeURL(sExplorerURL, SAI_FLD_PAGEKEY, SAI_GetPageKey())
  329. If ( Len(Trim(sStartingFolder)) > 0 ) Then
  330. Call SA_MungeURL(sExplorerURL, "BaseFolder", Trim(sStartingFolder))
  331. End If
  332. Select Case ExploreOptions
  333. Case EXPLORE_FOLDERS
  334. Call SA_MungeURL(sExplorerURL, "Opt", CStr(EXPLORE_FOLDERS))
  335. Case EXPLORE_FILES_AND_FOLDERS
  336. Call SA_MungeURL(sExplorerURL, "Opt", CStr(EXPLORE_FILES_AND_FOLDERS))
  337. Case Else
  338. Call SA_TraceOut("SH_PAGE", "SA_ServeFileExplorerWidget invalid iExploreOptions: " + CStr(iExploreOptions))
  339. Call SA_MungeURL(sExplorerURL, "Opt", ""+EXPLORE_FOLDERS)
  340. End Select
  341. If ( Len(Trim(sNotifyFn)) > 0 ) Then
  342. Call SA_MungeURL(sExplorerURL, "NotifyFn", sNotifyFn )
  343. End If
  344. Response.Write("<IFRAME border=0 frameborder=0 name=IFrameFSExplorer src='"+sExplorerURL+"'' WIDTH='"+iWidth+"' HEIGHT='"+iHeight+"'>")
  345. Response.Write("</IFRAME>")
  346. End Function
  347. '--------------------------------------------------------------------
  348. '
  349. ' Function: SA_ServeResourceStatus
  350. '
  351. ' Synopsis: Serve Resource status information and reference link. This API
  352. ' should be used to emit resource status information which is shown
  353. ' on the appliance status page.
  354. '
  355. ' Arguments: [in] sImage Optional image url
  356. ' [in] sCaption Caption text
  357. ' [in] sHoverText Hover text
  358. ' [in] sURL Optional url which shows resource status details page
  359. ' [in] sURLTarget Optional target for url
  360. ' [in] sStatusInfo Status information text
  361. '
  362. ' Returns: Nothing
  363. '
  364. '--------------------------------------------------------------------
  365. Public Function SA_ServeResourceStatus(ByVal sImage, ByVal sCaption, ByVal sHoverText, ByVal sURL, ByVal sURLTarget, ByVal sStatusInfo)
  366. Dim sDefaultTarget
  367. If ( Len(sURLTarget) <= 0 ) Then
  368. sDefaultTarget = Request.QueryString("ContentTarget")
  369. If ( Len(sDefaultTarget) > 0 ) Then
  370. sDefaultTarget = " target='" + sDefaultTarget + "' "
  371. End If
  372. Else
  373. sDefaultTarget = " target='" + sURLTarget + "' "
  374. End If
  375. If ( Len(sImage) <= 0 ) Then
  376. Response.Write("<TD width=28px class=Resource>&nbsp;</TD>"+vbCrLf)
  377. Else
  378. Response.Write("<TD width=28px class=Resource><IMG src='"+m_VirtualRoot+sImage+"'></TD>"+vbCrLf)
  379. End If
  380. If ( Len(sURL) > 0 ) Then
  381. Call SA_MungeURL(sURL, "Tab1", Request.QueryString("Tab1"))
  382. Call SA_MungeURL(sURL, "Tab2", Request.QueryString("Tab2"))
  383. Call SA_MungeURL(sURL, "ReturnURL", Request.QueryString("ReturnURL"))
  384. Call SA_MungeURL(sURL, SAI_FLD_PAGEKEY, SAI_GetPageKey())
  385. Response.Write("<TD class=Resource nowrap>")
  386. Response.Write("<A class=ResourceLink")
  387. Response.Write(sDefaultTarget)
  388. Response.Write(" href='"+m_VirtualRoot + sURL + "' ")
  389. Response.Write(" title="""+Server.HTMLEncode(sHoverText)+""" ")
  390. Response.Write(" onMouseOut=""window.status='';return true;"" ")
  391. Response.Write(" onMouseOver=""window.status='"+Server.HTMLEncode(EscapeQuotes(sHoverText))+"';return true;"">")
  392. Response.Write(sCaption)
  393. Response.Write("</A>")
  394. Response.Write("</TD>"+vbCrLf)
  395. Else
  396. Response.Write("<TD class=Resource nowrap>")
  397. Response.Write(sCaption)
  398. Response.Write("</TD>"+vbCrLf)
  399. End If
  400. %>
  401. <TD class=StatusPageStatus align=right><%=sStatusInfo%></TD>
  402. <%
  403. End Function
  404. '--------------------------------------------------------------------
  405. '
  406. ' Function: SA_ServeAlertsPanel
  407. '
  408. ' Synopsis: Serve the alerts panel pagelet.
  409. '
  410. ' Arguments: [in] sAlertDefContainer
  411. ' [in] sPageTitle
  412. ' [in] sWidthAttr
  413. ' [in] sHeightAttr
  414. ' [in] sDetailsURLTarget
  415. '
  416. ' Returns: Nothing
  417. '
  418. '--------------------------------------------------------------------
  419. Public Function SA_ServeAlertsPanel(ByVal sAlertDefContainer, ByVal sPageTitle, ByVal sWidthAttr, ByVal sHeightAttr, ByVal sDetailsURLTarget)
  420. Dim sURL
  421. Dim sTarget
  422. Dim sReturnURL
  423. sURL = m_VirtualRoot+"sh_alertpanel.asp"
  424. If ( Len(sDetailsURLTarget) > 0 ) Then
  425. sTarget = sDetailsURLTarget
  426. sReturnURL = GetScriptPath()
  427. Dim tab
  428. tab = GetTab1()
  429. If ( Len(tab) > 0 ) Then
  430. Call SA_MungeURL(sReturnURL, "Tab1", tab)
  431. End If
  432. tab = GetTab2()
  433. If ( Len(tab) > 0 ) Then
  434. Call SA_MungeURL(sReturnURL, "Tab2", tab)
  435. End If
  436. Call SA_MungeURL(sReturnURL, SAI_FLD_PAGEKEY, SAI_GetPageKey())
  437. Else
  438. sTarget = "IFStatusContent"
  439. sReturnURL = ""
  440. End If
  441. If ( Len(sAlertDefContainer) <= 0 ) Then
  442. sAlertDefContainer = "AlertDefinitions"
  443. End If
  444. If ( Len(sWidthAttr) <= 0 ) Then
  445. sWidthAttr = "100%"
  446. End If
  447. If ( Len(sHeightAttr) <= 0 ) Then
  448. sHeightAttr = "250px"
  449. End If
  450. Call SA_MungeURL(sURL, "ContentTarget", sTarget)
  451. Call SA_MungeURL(sURL, "AlertContainer", sAlertDefContainer)
  452. Call SA_MungeURL(sURL, "Title", sPageTitle)
  453. Call SA_MungeURL(sURL, "ReturnURL", sReturnURL)
  454. Call SA_MungeURL(sURL, "Tab1", GetTab1())
  455. Call SA_MungeURL(sURL, "Tab2", GetTab2())
  456. Call SA_MungeURL(sURL, SAI_FLD_PAGEKEY, SAI_GetPageKey())
  457. Response.Write("<iframe src='"+sURL+"' border=0 frameborder=0 name=IFStatusAlerts width='"+sWidthAttr+"' height='"+sHeightAttr+"' ></iframe>")
  458. End Function
  459. '--------------------------------------------------------------------
  460. '
  461. ' Function: SA_ServeResourcesPanel
  462. '
  463. ' Synopsis: Serve the Resources panel pagelet.
  464. '
  465. ' Arguments: [in] sResourcesContainer
  466. ' [in] sPageTitle
  467. ' [in] sWidthAttr
  468. ' [in] sHeightAttr
  469. ' [in] sDetailsURLTarget
  470. '
  471. ' Returns: Nothing
  472. '
  473. '--------------------------------------------------------------------
  474. Public Function SA_ServeResourcesPanel(ByVal sResourcesContainer, ByVal sPageTitle, ByVal sWidthAttr, ByVal sHeightAttr, ByVal sDetailsURLTarget)
  475. Dim sURL
  476. Dim sTarget
  477. Dim sReturnURL
  478. Dim tab
  479. sURL = m_VirtualRoot+"sh_resourcepanel.asp"
  480. If ( Len(sDetailsURLTarget) > 0 ) Then
  481. sTarget = sDetailsURLTarget
  482. Else
  483. sTarget = "IFStatusContent"
  484. End If
  485. sReturnURL = GetScriptPath()
  486. tab = GetTab1()
  487. If ( Len(tab) > 0 ) Then
  488. Call SA_MungeURL(sReturnURL, "Tab1", tab)
  489. End If
  490. tab = GetTab2()
  491. If ( Len(tab) > 0 ) Then
  492. Call SA_MungeURL(sReturnURL, "Tab2", tab)
  493. End If
  494. Call SA_MungeURL(sReturnURL, SAI_FLD_PAGEKEY, SAI_GetPageKey())
  495. If ( Len(sResourcesContainer) <= 0 ) Then
  496. sResourcesContainer = "Resource"
  497. End If
  498. If ( Len(sWidthAttr) <= 0 ) Then
  499. sWidthAttr = "100%"
  500. End If
  501. If ( Len(sHeightAttr) <= 0 ) Then
  502. sHeightAttr = "250px"
  503. End If
  504. Call SA_MungeURL(sURL, "ContentTarget", sTarget)
  505. Call SA_MungeURL(sURL, "ResContainer", sResourcesContainer)
  506. Call SA_MungeURL(sURL, "Title", sPageTitle)
  507. Call SA_MungeURL(sURL, "ReturnURL", sReturnURL)
  508. Call SA_MungeURL(sURL, "Tab1", GetTab1())
  509. Call SA_MungeURL(sURL, "Tab2", GetTab2())
  510. Call SA_MungeURL(sURL, SAI_FLD_PAGEKEY, SAI_GetPageKey())
  511. Response.Write("<iframe src='"+sURL+"' border=0 frameborder=0 name=IFStatusAlerts width='"+sWidthAttr+"' height='"+sHeightAttr+"' ></iframe>")
  512. End Function
  513. '--------------------------------------------------------------------
  514. '
  515. ' Function: SA_EmitAdditionalStyleSheetReferences
  516. '
  517. ' Synopsis: Emit optional OEM CSS references into the response stream
  518. '
  519. ' Arguments: [in] sCSS_ContainerName optional container name to use for
  520. ' selecting the additional CSS sheets.
  521. '
  522. ' Returns: Nothing
  523. '
  524. '--------------------------------------------------------------------
  525. Public Function SA_EmitAdditionalStyleSheetReferences(ByVal sCSS_ContainerName)
  526. on error resume next
  527. err.clear
  528. Dim sStyleURL
  529. Dim oContainer
  530. Dim oElement
  531. If ( Len(Trim(sCSS_ContainerName)) <= 0 ) Then
  532. sCSS_ContainerName = "CSS"
  533. End If
  534. Set oContainer = GetElements(sCSS_ContainerName)
  535. If (Err.Number <> 0) Then
  536. Exit Function
  537. End If
  538. For each oElement in oContainer
  539. sStyleURL = Trim(oElement.GetProperty("URL"))
  540. If (Err.Number = 0) Then
  541. If ( Len(sStyleURL) > 0 ) Then
  542. Response.Write("<link rel='STYLESHEET' type='text/css' href='"+m_VirtualRoot+sStyleURL+"'>"+vbCrLf)
  543. End If
  544. End If
  545. Next
  546. Set oContainer = nothing
  547. End Function
  548. '--------------------------------------------------------------------
  549. '
  550. ' Function: SA_GetHelpRootDirectory
  551. '
  552. ' Synopsis: Return base directory for help files depending upon current
  553. ' language setting
  554. '
  555. ' Arguments: [out] sRootHelp output variable to recieve root directory for help
  556. ' html files.
  557. '
  558. ' Returns: True if success, False if an error occured. Errors are written
  559. ' to the web framework trace log file.
  560. '
  561. '--------------------------------------------------------------------
  562. Function SA_GetHelpRootDirectory(ByRef sRootOut)
  563. on error resume next
  564. Err.Clear
  565. Dim oLocalizationMgr
  566. Dim iCurLangID
  567. SA_GetHelpRootDirectory = TRUE
  568. sRootOut = "help/"
  569. Set oLocalizationMgr = Server.CreateObject("ServerAppliance.LocalizationManager")
  570. If ( Err.Number <> 0 ) Then
  571. SA_GetHelpRootDirectory = FALSE
  572. Call SA_TraceOut("ContextHelp", "Server.CreateObject(ServerAppliance.LocalizationManager) encountered error: " + Err.Number + " " + Err.Description)
  573. Exit Function
  574. End If
  575. iCurLangID = oLocalizationMgr.CurrentLangID
  576. If ( Err.Number <> 0 ) Then
  577. Set oLocalizationMgr = nothing
  578. SA_GetHelpRootDirectory = FALSE
  579. Call SA_TraceOut("ContextHelp", "oLocalizationMgr.CurrentLangID() encountered error: " + Err.Number + " " + Err.Description)
  580. Exit Function
  581. End If
  582. '
  583. ' MUI Language directory names are 4 digit hex codes
  584. '
  585. iCurLangID = CStr(Hex(iCurLangID))
  586. If ( Len(iCurLangID) < 4 ) Then
  587. iCurLangID = Left("0000", 4 - Len(iCurLangID)) + iCurLangID
  588. End If
  589. sRootOut = m_VirtualRoot + sRootOut + iCurLangID + "/"
  590. ' Call SA_TraceOut("SH_PAGE", "SA_GetHelpRootDirectory returning: " + sRootOut)
  591. Set oLocalizationMgr = nothing
  592. End Function
  593. '--------------------------------------------------------------------
  594. '
  595. ' Function: SA_IsCurrentPageType
  596. '
  597. ' Synopsis: Check if current page matches the specified page type
  598. '
  599. ' Arguments: Page type (See PT_XXXX enumeration)
  600. '
  601. ' Returns: True if it matches, otherwise false
  602. '
  603. '--------------------------------------------------------------------
  604. Public Function SA_IsCurrentPageType(ByVal iPageType)
  605. SA_ClearError()
  606. If ( miPageType = iPageType ) Then
  607. SA_IsCurrentPageType = true
  608. Else
  609. SA_IsCurrentPageType = false
  610. End If
  611. End Function
  612. '----------------------------------------------------------------------------
  613. '
  614. ' Function : SA_GetCharSet
  615. '
  616. ' Synopsis : Gets character set to use for current language
  617. '
  618. ' Arguments: None
  619. '
  620. ' Returns : charset string
  621. '
  622. '----------------------------------------------------------------------------
  623. Public Function SA_GetCharSet()
  624. SA_GetCharSet = GetCharSet()
  625. End Function
  626. Private Function GetCharSet()
  627. ' Err.Clear
  628. '
  629. ' Dim strCharSet
  630. '
  631. ' ' call Localization Manager
  632. ' Set objLocMgr = Server.CreateObject("ServerAppliance.LocalizationManager")
  633. '
  634. ' strCharSet = objLocMgr.CurrentCharSet
  635. '
  636. ' if strCharSet ="" then
  637. ' strCharSet = "iso-8859-1"
  638. ' end if
  639. '
  640. ' set objLocMgr = nothing
  641. '
  642. ' GetCharSet = strCharSet
  643. 'Hard coded for Unicode
  644. GetCharSet = "utf-8"
  645. End Function
  646. '----------------------------------------------------------------------------
  647. '
  648. ' Function : ServePageHeader
  649. '
  650. ' Synopsis : Serves the first part of the HTML
  651. '
  652. ' Arguments: (IN) -
  653. '
  654. ' Returns : None
  655. '
  656. '----------------------------------------------------------------------------
  657. Private Function ServePageHeader(Caption)
  658. End Function
  659. '----------------------------------------------------------------------------
  660. '
  661. ' Function : ServeStandardLabelBar
  662. '
  663. ' Synopsis : Serves label text inside of a bar, with an optional image
  664. '
  665. ' Arguments: Caption(IN) - label text
  666. '
  667. ' Returns : None
  668. '
  669. '----------------------------------------------------------------------------
  670. Private Function ServeStandardLabelBar(Caption)
  671. %>
  672. <table border="0" width=40% cellspacing="0">
  673. <tr>
  674. <td width="15"></td>
  675. <td width=100% class="titlebar" align=right>
  676. <% =Caption %>&nbsp;&nbsp;</td>
  677. </tr>
  678. <tr>
  679. <td width="15" height=1></td>
  680. <!-- <td height=1><img src="<%=m_VirtualRoot%>images/line.gif"></td> -->
  681. <td height=1>&nbsp;</td>
  682. </tr>
  683. </table>
  684. <%
  685. End Function
  686. '----------------------------------------------------------------------------
  687. '
  688. ' Function : ServeStandardHeaderBar
  689. '
  690. ' Synopsis : Serves label text followed by a line
  691. '
  692. ' Arguments: [in] sCaption label text
  693. ' [in] Image path to image file
  694. '
  695. ' Returns : None
  696. '
  697. '----------------------------------------------------------------------------
  698. Private Function ServeStandardHeaderBar(ByVal sCaption, ByVal Image)
  699. If ( Len(CStr(Image)) <= 0 AND Len(CStr(sCaption)) <= 0 ) Then
  700. Call SA_TraceOut("SH_PAGE", "ServeStandardHeaderBar() called with empty Caption and Image")
  701. Exit Function
  702. End If
  703. If (Len(CStr(Image)) <= 0) Then
  704. Response.Write("<div class='PageHeaderBar'>"+Server.HTMLEncode(sCaption)+"</div>")
  705. Else
  706. Response.Write("<div class='PageHeaderBar'>")
  707. Response.Write("<table class='PageHeaderBarNoBorder' border='0'><tr><td><img src="+m_VirtualRoot+Image+"></td>")
  708. Response.Write("<td>"+Server.HTMLEncode(sCaption)+"</td></tr></table>")
  709. Response.Write("</div>")
  710. End If
  711. End Function
  712. '----------------------------------------------------------------------------
  713. '
  714. ' Function : ServeAreaLabelBar
  715. '
  716. ' Synopsis : Serves label text for area pages followed by line
  717. '
  718. ' Arguments: Caption(IN) - label text
  719. '
  720. ' Returns : None
  721. '
  722. '----------------------------------------------------------------------------
  723. Private Function ServeAreaLabelBar(Caption)
  724. %>
  725. <table border="0" cellspacing="0">
  726. <tr>
  727. <td width="15">&nbsp;</td>
  728. <td align=right valign=middle class="areatitlebar">
  729. <% =Caption %>&nbsp;&nbsp;
  730. </td>
  731. </tr>
  732. <tr>
  733. <td width="15" height=1></td>
  734. <td height=1><img src="<%=m_VirtualRoot%>images/line.gif"></td>
  735. </tr>
  736. </table>
  737. <%
  738. End Function
  739. '----------------------------------------------------------------------------
  740. '
  741. ' Function : SA_ServeBackButton
  742. '
  743. ' Synopsis : Serves special back button (mostly used in area pages)
  744. '
  745. ' Arguments: [in] bIndent - True if the button should be indented using
  746. ' blockquote. False if the button should not be indented.
  747. ' [in] strBackURL - URL that should be opened when the back
  748. ' button is pressed. If the URL is blank then the button will
  749. ' navigate to the last page using window.history.back()
  750. '
  751. ' Returns : None
  752. '
  753. '----------------------------------------------------------------------------
  754. Public Function SA_ServeBackButton(ByVal bIndent, ByVal strBackURL)
  755. SA_ServeBackButton = ServeBackButton(bIndent, strBackURL)
  756. End Function
  757. Private Function ServeBackButton(ByVal bIndent, ByVal strBackURL)
  758. If (bIndent) Then
  759. Response.Write("<blockquote>")
  760. End If
  761. %>
  762. <BR><BR>
  763. <DIV ID="PropertyPageButtons" class="ButtonBar" align="left">
  764. <%
  765. Response.Write("<button class=TaskFrameButtons type=button name=butOK")
  766. If ( Len(Trim(strBackURL)) <= 0 ) Then
  767. Response.Write("onClick=""window.history.back();"">")
  768. Else
  769. If ( InStr(strBackURL, "://") ) Then
  770. Response.Write(" onClick=""OpenNormalPage('', '"+strBackURL+"');"" >")
  771. Else
  772. Response.Write(" onClick=""OpenNormalPage('"+m_VirtualRoot+"', '"+strBackURL+"');"" >")
  773. End If
  774. End If
  775. Response.Write("<table cellpadding=0 cellspacing=0 class=TaskFrameButtonsNoBorder>")
  776. Response.write("<tr><td><img src='"+m_VirtualRoot+"images/butGreenArrowLeft.gif' >")
  777. Response.Write("</td><td nowrap class=TaskFrameButtonsNoBorder>&nbsp;&nbsp;"+L_AREABACKBUTTON_TEXT+"&nbsp;&nbsp;</td></tr>")
  778. Response.Write("</table></button>")
  779. %>
  780. &nbsp;&nbsp;
  781. </div>
  782. <%
  783. If (bIndent) Then
  784. Response.Write("</blockquote>")
  785. End If
  786. End Function
  787. '----------------------------------------------------------------------------
  788. '
  789. ' Function : ServeAreaButton
  790. '
  791. ' Synopsis : This function has been Deprecated, see SA_ServeOnClickButton
  792. '
  793. '----------------------------------------------------------------------------
  794. Private Function ServeAreaButton(ByVal Caption, ByVal URL, ByVal Image, ByVal iWidth, ByVal iImageWidth)
  795. Call SA_ServeOnClickButton(Caption, Image, URL, iWidth, iImageWidth, SA_DEFAULT)
  796. End Function
  797. '----------------------------------------------------------------------------
  798. '
  799. ' Function : SA_ServeOnClickButton
  800. '
  801. ' Synopsis : Serves image button that invokes the specified Javascript function when clicked.
  802. '
  803. ' Arguments : [in] Caption Button caption
  804. ' [in] Image Button image
  805. ' [in] OnClickFn Javascript function to invoke when button is clicked
  806. ' [in] iWidth Width of button in pixels.
  807. ' [in] iImageWidth Width of button image in pixels
  808. ' [in] Attributes additional attributes, like DISABLED
  809. '
  810. ' Returns : Nothing
  811. '
  812. '----------------------------------------------------------------------------
  813. Public Function SA_ServeOnClickButton(ByVal Caption, ByVal Image, ByVal OnClickFn, ByVal iWidth, ByVal iImageWidth, ByVal Attributes)
  814. Call SA_ServeOnClickButtonEx(Caption, Image, OnClickFn, iWidth, iImageWidth, Attributes, SA_DEFAULT)
  815. End Function
  816. Public Function SA_ServeOnClickButtonEx(ByVal Caption, ByVal Image, ByVal OnClickFn, ByVal iWidth, ByVal iImageWidth, ByVal Attributes, ByVal sButtonName)
  817. Dim iCaptionWidth
  818. Dim sButtonWidthAttr
  819. Dim sImageWidthAttr
  820. Dim sCaptionWidthAttr
  821. Dim sCaptionAlign
  822. '
  823. ' Edit parameters, iWidth must be greater than iImageWidth
  824. '
  825. If ( Len(iWidth) <= 0 ) Then
  826. iWidth = 0
  827. End If
  828. If ( Len(iImageWidth) <= 0 ) Then
  829. iImageWidth = 0
  830. End If
  831. iCaptionWidth = CInt(iWidth) - CInt(iImageWidth)
  832. If ( iCaptionWidth <= 0 ) Then
  833. iCaptionWidth = iWidth
  834. End If
  835. If ( iWidth > 0 ) Then
  836. sButtonWidthAttr = " width="+CStr(iWidth)+" "
  837. sCaptionWidthAttr = " width="+CStr(iCaptionWidth)+" "
  838. Else
  839. sButtonWidthAttr = ""
  840. sCaptionWidthAttr = ""
  841. End If
  842. If ( iImageWidth > 0 ) Then
  843. sImageWidthAttr = " width="+CStr(iImageWidth)+" "
  844. Else
  845. sImageWidthAttr = ""
  846. End If
  847. If ( Len(sButtonName) > 0 ) Then
  848. sButtonName = " name="+sButtonName + " "
  849. End If
  850. If ( Len(Image) <= 0 AND iImageWidth <= 0 ) Then
  851. sCaptionAlign = "align='center'"
  852. Else
  853. sCaptionAlign = ""
  854. End If
  855. '
  856. ' Emit the button
  857. '
  858. Response.Write("<button class=TaskFrameButtons type=button "+sButtonName+" onClick="""+OnClickFn+""" " + Attributes+" >")
  859. Response.Write("<table border=0 "+sButtonWidthAttr+" cellpadding=0 cellspacing=0 class=TaskFrameButtonsNoBorder>"+vbCrLf)
  860. Response.Write("<tr>"+vbCrLf)
  861. If (Len(Image) > 0) Then
  862. Response.Write("<td align=center "+sImageWidthAttr+">")
  863. If Len(Image) <= 0 Then
  864. Response.Write("&nbsp;")
  865. Else
  866. Response.Write("<img src='"+m_VirtualRoot+Image+"' >")
  867. End If
  868. Response.Write("</td>")
  869. End If
  870. If (iWidth > 0) Or (Len(Trim(Caption)) > 0) Then
  871. Response.Write("<td class=TaskFrameButtonsNoBorder "+sCaptionAlign+" "+sCaptionWidthAttr+" nowrap>"+Server.HTMLEncode(Caption)+"</td>")
  872. End If
  873. Response.Write("</tr>"+vbCrLf)
  874. Response.Write("</table>")
  875. Response.Write("</button>"+vbCrLf)
  876. End Function
  877. '----------------------------------------------------------------------------
  878. '
  879. ' Function : SA_ServeOpenPageButton
  880. '
  881. ' Synopsis : Create an image button that allows opening the specified page type.
  882. '
  883. ' Arguments: [in] enPageType Type of page (PT_AREA, PT_PROPERTY, PT_TABBED, PT_WIZARD)
  884. ' [in] sURL URL of page to open
  885. ' [in] sReturnURL Return URL
  886. ' [in] sPageTitle Title for page
  887. ' [in] sButtonCaption Button caption
  888. ' [in] sButtonImage Button image
  889. ' [in] iButtonWidth Width of button
  890. ' [in] iButtonImageWidth Width of button image
  891. ' [in] sButtonAttr Additional HTML attributes for button (DISABLED)
  892. '
  893. ' Returns : None
  894. '
  895. '----------------------------------------------------------------------------
  896. Public Function SA_ServeOpenPageButton(ByVal enPageType, _
  897. ByVal sURL, _
  898. ByVal sReturnURL, _
  899. ByVal sPageTitle, _
  900. ByVal sButtonCaption, _
  901. ByVal sButtonImage, _
  902. ByVal iButtonWidth, _
  903. ByVal iButtonImageWidth, _
  904. ByVal sButtonAttr)
  905. Call SA_ServeOpenPageButtonEx(enPageType, sURL, sReturnURL, sPageTitle, sButtonCaption, _
  906. sButtonImage, iButtonWidth, iButtonImageWidth, sButtonAttr, SA_DEFAULT)
  907. End Function
  908. Public Function SA_ServeOpenPageButtonEx(ByVal enPageType, _
  909. ByVal sURL, _
  910. ByVal sReturnURL, _
  911. ByVal sPageTitle, _
  912. ByVal sButtonCaption, _
  913. ByVal sButtonImage, _
  914. ByVal iButtonWidth, _
  915. ByVal iButtonImageWidth, _
  916. ByVal sButtonAttr, _
  917. ByVal sButtonName )
  918. Dim sOpenPage
  919. Dim iCaptionWidth
  920. Dim sButtonWidthAttr
  921. Dim sImageWidthAttr
  922. Dim sCaptionWidthAttr
  923. Dim sCaptionAlign
  924. '
  925. ' Edit parameters, iButtonWidth must be greater than iImageWidth
  926. '
  927. If ( Len(iButtonWidth) <= 0 ) Then
  928. iButtonWidth = 0
  929. End If
  930. If ( Len(iButtonImageWidth) <= 0 ) Then
  931. iButtonImageWidth = 0
  932. End If
  933. iCaptionWidth = iButtonWidth - iButtonImageWidth
  934. If ( iCaptionWidth <= 0 ) Then
  935. iCaptionWidth = iButtonWidth
  936. End If
  937. If ( iButtonWidth > 0 ) Then
  938. sButtonWidthAttr = " width="+CStr(iButtonWidth)+" "
  939. sCaptionWidthAttr = " width="+CStr(iCaptionWidth)+" "
  940. Else
  941. sButtonWidthAttr = ""
  942. sCaptionWidthAttr = ""
  943. End If
  944. If ( iButtonImageWidth > 0 ) Then
  945. sImageWidthAttr = " width="+CStr(iButtonImageWidth)+" "
  946. Else
  947. sImageWidthAttr = ""
  948. End If
  949. If ( Len(sButtonName) > 0 ) Then
  950. sButtonName = " name="+Trim(sButtonName)
  951. Else
  952. sButtonName = " name="+Trim(SAI_GetNextButtonName())
  953. End If
  954. If ( Len(sButtonImage) <= 0 AND iButtonImageWidth <= 0 ) Then
  955. sCaptionAlign = "align='center'"
  956. Else
  957. sCaptionAlign = ""
  958. End If
  959. '
  960. ' Get the open page script
  961. Select Case enPageType
  962. Case PT_AREA
  963. sOpenPage = "onClick=""SA_OnOpenNormalPage('"+m_VirtualRoot+"', '"+sURL+"', '"+sReturnURL+"'); "" "
  964. Case PT_PROPERTY
  965. sOpenPage = "onClick=""SA_OnOpenPropertyPage('"+m_VirtualRoot+"', '"+sURL+"', '"+sReturnURL+"', '"+sPageTitle+"'); "" "
  966. Case PT_TABBED
  967. sOpenPage = "onClick=""SA_OnOpenPropertyPage('"+m_VirtualRoot+"', '"+sURL+"', '"+sReturnURL+"', '"+sPageTitle+"'); "" "
  968. Case PT_WIZARD
  969. sOpenPage = "onClick=""SA_OnOpenPropertyPage('"+m_VirtualRoot+"', '"+sURL+"', '"+sReturnURL+"', '"+sPageTitle+"'); "" "
  970. Case Else
  971. Call SA_TraceOut("SH_PAGE", "SA_ServeOpenPageButton invalid PageType: " +CStr(enPageType))
  972. sOpenPage = "onClick=""SA_OnOpenNormalPage('"+m_VirtualRoot+"', '"+sURL+"', '"+sReturnURL+"'); "" "
  973. End Select
  974. 'Call SA_TraceOut("SH_PAGE", sOpenPage)
  975. '
  976. ' Emit the button
  977. '
  978. Response.Write("<button class=TaskFrameButtons type=button "+sButtonName+" "+sOpenPage+" " + sButtonAttr+" >")
  979. Response.Write("<table border=0 "+sButtonWidthAttr+" cellpadding=0 cellspacing=0 class=TaskFrameButtonsNoBorder>"+vbCrLf)
  980. Response.Write("<tr>"+vbCrLf)
  981. If (Len(sButtonImage) > 0) Then
  982. Response.Write("<td align=center "+sImageWidthAttr+">")
  983. If Len(iButtonWidth) <= 0 Then
  984. Response.Write("&nbsp;")
  985. Else
  986. Response.Write("<img src='"+m_VirtualRoot+sButtonImage+"' >")
  987. End If
  988. Response.Write("</td>")
  989. End If
  990. If (iButtonWidth > 0 ) Or (Len(Trim(sButtonCaption)) > 0)Then
  991. Response.Write("<td class=TaskFrameButtonsNoBorder "+sCaptionAlign+" "+sCaptionWidthAttr+" nowrap>"+Server.HTMLEncode(sButtonCaption)+"</td>")
  992. End If
  993. Response.Write("</tr>"+vbCrLf)
  994. Response.Write("</table>")
  995. Response.Write("</button>"+vbCrLf)
  996. End Function
  997. '----------------------------------------------------------------------------
  998. '
  999. ' Function : SA_IsIE
  1000. '
  1001. ' Synopsis : Is client browser IE
  1002. '
  1003. ' Arguments: None
  1004. '
  1005. ' Returns : true/false
  1006. '
  1007. '----------------------------------------------------------------------------
  1008. Public Function SA_IsIE()
  1009. SA_IsIE = IsIE()
  1010. End Function
  1011. Private Function IsIE()
  1012. If InStr(Request.ServerVariables("HTTP_USER_AGENT"), "MSIE") Then
  1013. IsIE = True
  1014. Else
  1015. IsIE = False
  1016. End If
  1017. End Function
  1018. '----------------------------------------------------------------------------
  1019. '
  1020. ' Function : GetFirstTabURL
  1021. '
  1022. ' Synopsis : Get URL of the first tab
  1023. '
  1024. ' Arguments: None
  1025. '
  1026. ' Returns : URL string of the first tab
  1027. '
  1028. '----------------------------------------------------------------------------
  1029. Function GetFirstTabURL()
  1030. Dim objTabs
  1031. Dim objTab
  1032. Dim strHomeURL
  1033. strHomeURL = ""
  1034. Set objTabs = GetElements("TABS")
  1035. For Each objTab in objTabs
  1036. strHomeURL = objTab.GetProperty("URL")
  1037. Exit For
  1038. Next
  1039. Set objTab = Nothing
  1040. Set objTabs = Nothing
  1041. GetFirstTabURL = strHomeURL
  1042. End Function
  1043. '----------------------------------------------------------------------------
  1044. '
  1045. ' Function : GetServerName
  1046. '
  1047. ' Synopsis : Return server name as referred to in remote client
  1048. '
  1049. ' Arguments: None
  1050. '
  1051. ' Returns : server name string
  1052. '
  1053. '----------------------------------------------------------------------------
  1054. Function GetServerName()
  1055. GetServerName = Request.ServerVariables("SERVER_NAME")
  1056. End Function
  1057. '----------------------------------------------------------------------------
  1058. '
  1059. ' Function : GetScriptFileName
  1060. '
  1061. ' Synopsis : file name of current file being request by client
  1062. '
  1063. ' Arguments: None
  1064. '
  1065. ' Returns : file name string
  1066. '
  1067. '----------------------------------------------------------------------------
  1068. Public Function SA_GetScriptFileName()
  1069. SA_GetScriptFileName = GetScriptFileName()
  1070. End Function
  1071. Private Function GetScriptFileName()
  1072. Dim strPath
  1073. Dim intPos
  1074. strPath = Request.ServerVariables("PATH_INFO")
  1075. intPos = InStr(strPath, "/")
  1076. Do While intPos > 0
  1077. strPath = Right(strPath, Len(strPath) - intPos)
  1078. intPos = InStr(strPath, "/")
  1079. Loop
  1080. GetScriptFileName = strPath
  1081. End Function
  1082. '----------------------------------------------------------------------------
  1083. '
  1084. ' Function : SA_GetScriptPath
  1085. '
  1086. ' Synopsis : path of file name being request by client
  1087. '
  1088. ' Arguments: None
  1089. '
  1090. ' Returns : path string
  1091. '
  1092. '----------------------------------------------------------------------------
  1093. Public Function SA_GetScriptPath()
  1094. SA_GetScriptPath = GetScriptPath()
  1095. End Function
  1096. Function GetScriptPath()
  1097. ' Returns the path w/o virtual root
  1098. '
  1099. Dim strPath
  1100. strPath = Request.ServerVariables("PATH_INFO")
  1101. If Left(strPath, Len(m_VirtualRoot)) = m_VirtualRoot Then
  1102. strPath = Right(strPath, Len(strPath)-Len(m_VirtualRoot))
  1103. End If
  1104. 'In XPE, we need to remove the virtualRoot from the ScriptPath
  1105. If CONST_OSNAME_XPE = GetServerOSName() Then
  1106. strPath = "/" & strPath
  1107. if inStr(strPath, m_VirtualRoot) = 1 Then
  1108. strPath = mid(strPath, Len(m_VirtualRoot)+1)
  1109. End If
  1110. End If
  1111. GetScriptPath = strPath
  1112. End Function
  1113. '----------------------------------------------------------------------------
  1114. '
  1115. ' Function : SA_GetLocString
  1116. '
  1117. ' Synopsis : Retrieves a localized string resource
  1118. '
  1119. ' Arguments: SourceFile(IN) - resource dll name
  1120. ' ResourceID(IN) - resource id in hex
  1121. ' ReplacementStrings(IN) - parameters to replace in string
  1122. '
  1123. ' Returns : localized string
  1124. '
  1125. '----------------------------------------------------------------------------
  1126. Public Function SA_GetLocString(ByVal SourceFile, ByVal ResourceID, ByRef ReplacementStrings)
  1127. SA_GetLocString = GetLocString(SourceFile, ResourceID, ReplacementStrings)
  1128. End Function
  1129. Private Function GetLocString(ByVal SourceFile, ByVal ResourceID, ByRef ReplacementStrings)
  1130. on error resume next
  1131. Err.Clear
  1132. Dim errorCode
  1133. Dim errorDesc
  1134. Dim varReplacementStrings
  1135. Dim sDebugResourceID
  1136. sDebugResourceID = ResourceID
  1137. '
  1138. ' Validate parameters
  1139. '
  1140. If Left(ResourceID, 2) <> "&H" Then
  1141. ResourceID = "&H" & ResourceID
  1142. End If
  1143. If Trim(SourceFile) = "" Then
  1144. SourceFile = "svrapp"
  1145. End If
  1146. If (Not IsArray(ReplacementStrings)) Then
  1147. ReplacementStrings = varReplacementStrings
  1148. End If
  1149. '
  1150. ' Initialize the localization manager private global object reference
  1151. '
  1152. If ( NOT IsObject(m_oLocManager) ) Then
  1153. Set m_oLocManager = Server.CreateObject("ServerAppliance.LocalizationManager")
  1154. If ( Err.Number <> 0 ) Then
  1155. GetLocString = sDebugResourceID
  1156. Call SA_TraceOut("SH_PAGE", _
  1157. "Server.CreateObject(ServerAppliance.LocalizationManager) encountered exception: " _
  1158. + CStr(Hex(Err.Number)) + " " + Err.Description)
  1159. Exit Function
  1160. End If
  1161. End If
  1162. '
  1163. ' Get the string
  1164. '
  1165. GetLocString = m_oLocManager.GetString(SourceFile, ResourceID, ReplacementStrings)
  1166. '
  1167. ' Check error codes, primary error is string resource not found
  1168. '
  1169. errorCode = Err.Number
  1170. errorDesc = Err.description
  1171. Err.Clear
  1172. If errorCode <> 0 Then
  1173. GetLocString = sDebugResourceID
  1174. End If
  1175. End Function
  1176. '----------------------------------------------------------------------------
  1177. '
  1178. ' Function : SA_EscapeQuotes
  1179. '
  1180. ' Synopsis : Insert escape character before quote
  1181. '
  1182. ' Arguments: InString(IN) - string to fix
  1183. '
  1184. ' Returns : None
  1185. '
  1186. '----------------------------------------------------------------------------
  1187. Public Function SA_EscapeQuotes(ByVal InString)
  1188. SA_EscapeQuotes = EscapeQuotes(InString)
  1189. End Function
  1190. Function EscapeQuotes(ByVal InString)
  1191. Dim i
  1192. Dim strOut
  1193. strOut = InString
  1194. i = 1
  1195. Do While i <> 0
  1196. i = InStr(i, strOut, "'")
  1197. If i <> 0 Then
  1198. If (i > 1) And (Mid(strOut, i-1, 2) = "\'") Then
  1199. ' input string was escaped already - do nothing
  1200. Else
  1201. strOut = Left(strOut, i-1) & "\'" & Right(strOut, Len(strOut)-i)
  1202. End If
  1203. End If
  1204. If (i < Len(strOut)) And (i <> 0) Then
  1205. i = i + 1
  1206. Else
  1207. Exit Do
  1208. End If
  1209. Loop
  1210. '
  1211. ' Do not HTML encode the return url. If anything, URLEncode it
  1212. '
  1213. 'EscapeQuotes = Server.HTMLEncode(strOut)
  1214. '
  1215. EscapeQuotes = strOut
  1216. End Function
  1217. '----------------------------------------------------------------------------
  1218. '
  1219. ' Function : SA_GetElements
  1220. '
  1221. ' Synopsis : Return collection of IWebElement objects based on the
  1222. ' Container parm
  1223. '
  1224. ' Arguments: Container(IN) - container name
  1225. '
  1226. ' Returns : collection of elements
  1227. '
  1228. '----------------------------------------------------------------------------
  1229. Public Function SA_GetElements(ByVal Container)
  1230. Set SA_GetElements = GetElements(Container)
  1231. End Function
  1232. Function GetElements(ByVal Container)
  1233. 'Return collection of IWebElement objects based on the Container parm.
  1234. Dim objRetriever
  1235. Dim objElements
  1236. Set objRetriever = Server.CreateObject("Elementmgr.ElementRetriever")
  1237. Set objElements = objRetriever.GetElements(1, Container)
  1238. If Err.Number <> 0 Then
  1239. Err.Clear
  1240. End If
  1241. Set GetElements = objElements
  1242. Set objElements = Nothing
  1243. Set objRetriever = Nothing
  1244. End Function
  1245. Public Function SA_ServeRestartingPage(ByVal strOption, ByVal sInitialWait, ByVal sRetryWait, ByVal strRsrcDLL, ByVal sTitleRID, ByVal sMessageRID)
  1246. Call SA_ServeRestartingPageEx( strOption, sInitialWait, sRetryWait, strRsrcDLL, sTitleRID, sMessageRID, SA_DEFAULT )
  1247. End Function
  1248. Public Function SA_ServeRestartingPageEx(ByVal strOption, ByVal sInitialWait, ByVal sRetryWait, ByVal strRsrcDLL, ByVal sTitleRID, ByVal sMessageRID, ByVal sURLBase)
  1249. Dim sURL
  1250. sURL = m_VirtualRoot + "sh_restarting.asp"
  1251. If ( Len(strOption) > 0 ) Then
  1252. Call SA_MungeURL(sURL, "Option", strOption)
  1253. Else
  1254. Call SA_MungeURL(sURL, "Resrc", strRsrcDLL)
  1255. Call SA_MungeURL(sURL, "Title", sTitleRID)
  1256. Call SA_MungeURL(sURL, "Msg", sMessageRID)
  1257. End If
  1258. Call SA_MungeURL(sURL, "T1", sInitialWait)
  1259. Call SA_MungeURL(sURL, "T2", sRetryWait)
  1260. Call SA_MungeURL(sURL, "URLBase", sURLBase)
  1261. Call SA_MungeURL(sURL, SAI_FLD_PAGEKEY, SAI_GetPageKey())
  1262. Randomize
  1263. Call SA_MungeURL(sURL, "R", CStr(Rnd()))
  1264. %>
  1265. <html>
  1266. <!-- Copyright (c) Microsoft Corporation. All rights reserved.-->
  1267. <head>
  1268. <SCRIPT language=JavaScript>
  1269. function LoadPage() {
  1270. top.location='<%=sURL%>';
  1271. }
  1272. </SCRIPT>
  1273. </head>
  1274. <BODY onLoad="LoadPage();" bgcolor="#ffffff">
  1275. &nbsp;
  1276. </BODY>
  1277. </html>
  1278. <%
  1279. Response.End
  1280. End Function
  1281. '----------------------------------------------------------------------------
  1282. '
  1283. ' Function : Redirect
  1284. '
  1285. ' Synopsis : Redirect to given URL
  1286. '
  1287. ' Arguments: URL(IN) - URL to redirect to
  1288. '
  1289. ' Returns : None
  1290. '
  1291. '----------------------------------------------------------------------------
  1292. Function Redirect(URL)
  1293. %>
  1294. <html>
  1295. <!-- Copyright (c) Microsoft Corporation. All rights reserved.-->
  1296. <head>
  1297. <SCRIPT language=JavaScript>
  1298. function LoadPage() {
  1299. <% If Trim(URL) <> "" Then %>
  1300. top.hidden.SetupPage("<% =URL %>?R=" + Math.random());
  1301. <% Else %>
  1302. top.hidden.SetupPage("../<% =GetFirstTabURL() %>?R=" + Math.random());
  1303. <% End If %>
  1304. }
  1305. </SCRIPT>
  1306. </head>
  1307. <BODY onLoad="LoadPage();" bgcolor="#ffffff">
  1308. &nbsp;
  1309. </BODY>
  1310. </html>
  1311. <%
  1312. End Function
  1313. '----------------------------------------------------------------------------
  1314. '
  1315. ' Function : SwapRows
  1316. '
  1317. ' Synopsis : Swap routine used by QuickSort
  1318. '
  1319. ' Arguments: arr(IN) - array whose row needs to be swapped
  1320. ' row1(IN) - row to swap
  1321. ' row2(IN) - row to swap
  1322. '
  1323. ' Returns : None
  1324. '
  1325. '----------------------------------------------------------------------------
  1326. Sub SwapRows(ary,row1,row2)
  1327. '== This proc swaps two rows of an array
  1328. Dim x,tempvar
  1329. For x = 0 to Ubound(ary,2)
  1330. tempvar = ary(row1,x)
  1331. ary(row1,x) = ary(row2,x)
  1332. ary(row2,x) = tempvar
  1333. Next
  1334. End Sub 'SwapRows
  1335. '----------------------------------------------------------------------------
  1336. '
  1337. ' Function : QuickSort
  1338. '
  1339. ' Synopsis : the quick sort algorithm
  1340. '
  1341. ' Arguments: vec(IN) - array whose row needs to be swapped
  1342. ' loBound(IN) - lower bound of array vec
  1343. ' hiBound(IN) - upped bound of array vec
  1344. ' SortField(IN) - the field to sort on
  1345. '
  1346. ' Returns : None
  1347. '
  1348. '----------------------------------------------------------------------------
  1349. Sub QuickSort(vec, loBound, hiBound, SortField)
  1350. Dim pivot(),loSwap,hiSwap,temp,counter
  1351. Redim pivot (Ubound(vec,2))
  1352. '== Two items to sort
  1353. if hiBound - loBound = 1 then
  1354. if vec(loBound,SortField) > vec(hiBound,SortField) then Call SwapRows(vec,hiBound,loBound)
  1355. End If
  1356. '== Three or more items to sort
  1357. For counter = 0 to Ubound(vec,2)
  1358. pivot(counter) = vec(int((loBound + hiBound) / 2),counter)
  1359. vec(int((loBound + hiBound) / 2),counter) = vec(loBound,counter)
  1360. vec(loBound,counter) = pivot(counter)
  1361. Next
  1362. loSwap = loBound + 1
  1363. hiSwap = hiBound
  1364. do
  1365. '== Find the right loSwap
  1366. while loSwap < hiSwap and vec(loSwap,SortField) <= pivot(SortField)
  1367. loSwap = loSwap + 1
  1368. wend
  1369. '== Find the right hiSwap
  1370. while vec(hiSwap,SortField) > pivot(SortField)
  1371. hiSwap = hiSwap - 1
  1372. wend
  1373. '== Swap values if loSwap is less then hiSwap
  1374. if loSwap < hiSwap then Call SwapRows(vec,loSwap,hiSwap)
  1375. loop while loSwap < hiSwap
  1376. For counter = 0 to Ubound(vec,2)
  1377. vec(loBound,counter) = vec(hiSwap,counter)
  1378. vec(hiSwap,counter) = pivot(counter)
  1379. Next
  1380. '== Recursively call function .. the beauty of Quicksort
  1381. '== 2 or more items in first section
  1382. if loBound < (hiSwap - 1) then Call QuickSort(vec,loBound,hiSwap-1,SortField)
  1383. '== 2 or more items in second section
  1384. if hiSwap + 1 < hibound then Call QuickSort(vec,hiSwap+1,hiBound,SortField)
  1385. End Sub 'QuickSort
  1386. '----------------------------------------------------------------------------
  1387. '
  1388. ' Function : getVirtualDirectory
  1389. '
  1390. ' Synopsis : Gets the virtual directory where the serverappliance is installed.
  1391. '
  1392. ' Arguments: None
  1393. '
  1394. ' Returns : The virtual directory where serverappliance is installed.
  1395. '
  1396. '----------------------------------------------------------------------------
  1397. Function getVirtualDirectory
  1398. getVirtualDirectory = "/admin/"
  1399. 'Dim strVDir,strFinal
  1400. 'Dim idx
  1401. 'strVDir = Request.ServerVariables("APPL_MD_PATH")
  1402. 'idx = instr(2,strVDir,"ROOT",1)
  1403. 'strFinal=mid(strVDir,idx+4)
  1404. 'If strFinal<>"" Then
  1405. ' strFinal=strFinal& "/"
  1406. 'else
  1407. ' strFinal ="/"
  1408. 'End IF
  1409. 'getVirtualDirectory=strFinal
  1410. End Function
  1411. '----------------------------------------------------------------------------
  1412. '
  1413. ' Function : SA_GetCurrentURL
  1414. '
  1415. ' Synopsis : Gets the current url including query string
  1416. '
  1417. ' Arguments: None
  1418. '
  1419. ' Returns : The current url including query string
  1420. '
  1421. '----------------------------------------------------------------------------
  1422. Public Function SA_GetCurrentURL()
  1423. SA_GetCurrentURL = Request.ServerVariables("URL") + "?" + Request.ServerVariables("QUERY_STRING")
  1424. End Function
  1425. '-------------------------------------------------------------------------
  1426. 'Function name: CheckForSecureSite
  1427. 'Description:
  1428. 'Output Variables: None
  1429. 'Returns: None
  1430. '-------------------------------------------------------------------------
  1431. Sub CheckForSecureSite()
  1432. Dim objContextHelp
  1433. Dim objElement
  1434. Dim strHelpURL
  1435. Dim strSecureURL
  1436. Dim strURL
  1437. Dim L_WARN_TO_USE_HTTPS
  1438. Dim L_WARN_TO_INSTALL_CERT
  1439. Dim L_SECURE_SITE_LINK_PROMPT
  1440. L_WARN_TO_INSTALL_CERT = GetLocString("sacoremsg.dll", "&H402003EB", "")
  1441. Dim sHelpRoot
  1442. Call SA_GetHelpRootDirectory(sHelpRoot)
  1443. 'strHelpURL = sHelpRoot + "_nas_HTTPS__Creating_a_Secure_Connection.htm"
  1444. ' No SSL Certificate case
  1445. If ( FALSE = SAI_IsSSLCertificateInstalled()) Then
  1446. Response.write (" <DIV class='ErrMsg'>" & L_WARN_TO_INSTALL_CERT & " " & "</DIV>" )
  1447. ' Not using https warn use to use https
  1448. ElseIf LCASE( Request.ServerVariables("HTTPS") ) = "off" Then
  1449. Dim sSecureWebSite
  1450. Dim sSecurePort
  1451. Dim aRepString(1)
  1452. sSecurePort = SAI_GetSecurePort()
  1453. If ( sSecurePort > 0 ) Then
  1454. aRepString(0) = CStr(sSecurePort)
  1455. L_WARN_TO_USE_HTTPS = GetLocString("sacoremsg.dll", "&H402003E9", aRepString)
  1456. sSecureWebSite = SA_GetNewHostURLBase("", sSecurePort, TRUE, "")
  1457. Call SA_TraceOut("SH_PAGE", "Secure URL: " + sSecureWebSite)
  1458. If ( Len(sSecureWebSite) > 0 ) Then
  1459. L_SECURE_SITE_LINK_PROMPT = GetLocString("sacoremsg.dll", "402003EC", "")
  1460. End If
  1461. Else
  1462. L_WARN_TO_USE_HTTPS = GetLocString("sacoremsg.dll", "&H402003EA", "")
  1463. End If
  1464. strURL = "javascript:OpenRawPage('" & sSecureWebSite & "' );"
  1465. Response.write (" <DIV>" & "<table class='ErrMsg'><tr><td><img src='" & m_VirtualRoot & "images/alert.gif' border=0></td><td>" & L_WARN_TO_USE_HTTPS & "<a " )
  1466. Response.Write(" class='TasksPageLinkTextRed'")
  1467. Response.Write(" onmouseover=""this.className='TasksPageLinkTextHover'; return true;"" ")
  1468. Response.Write(" onmouseout=""this.className='TasksPageLinkTextRed'; return true;"" ")
  1469. Response.write (" target='_blank' onclick=" & chr(34) & strURL & chr(34) & ">"+L_SECURE_SITE_LINK_PROMPT+"</a>" )
  1470. Response.Write("</td></tr></table></DIV>" )
  1471. End If
  1472. End Sub
  1473. '----------------------------------------------------------------------------
  1474. '
  1475. ' Function : SA_ServeFailurePage
  1476. '
  1477. ' Synopsis : Serve the page which redirects the browser to the err_view.asp
  1478. ' failure page
  1479. '
  1480. ' Arguments: Message(IN) - message to be displayed by err_view.asp
  1481. '
  1482. ' Returns : None
  1483. '
  1484. '----------------------------------------------------------------------------
  1485. Public Function SA_ServeFailurePage(ByVal Message)
  1486. Call SA_ServeFailurePageEx(Message, mstrReturnURL)
  1487. End Function
  1488. '----------------------------------------------------------------------------
  1489. '
  1490. ' Function : SA_ServeFailurePageEx
  1491. '
  1492. ' Synopsis : Serve the page which redirects the browser to the err_view.asp
  1493. ' failure page
  1494. '
  1495. ' Arguments: [in] Message - Message that will be displayed in the error page
  1496. ' [in] ReturnURL - URL that should be navigated to when the user
  1497. ' clicks the OK button. If this value is SA_DEFAULT
  1498. ' the default home page will be used.
  1499. '
  1500. ' Returns : None
  1501. '
  1502. '----------------------------------------------------------------------------
  1503. Public Function SA_ServeFailurePageEx(ByVal Message, sReturnPage)
  1504. Dim sReturnURL
  1505. Dim sFailurePageURL
  1506. Const MINIMUM_VALID_URL = 3
  1507. Response.Clear
  1508. sReturnURL = sReturnPage
  1509. If ( Len(sReturnURL) <= MINIMUM_VALID_URL ) Then
  1510. sReturnURL = m_VirtualRoot + "default.asp"
  1511. Else
  1512. '
  1513. ' Make sure ReturnURL has the virtual root prepended
  1514. If ( Left(sReturnURL, Len("http://")) = "http://" OR Left(sReturnURL, Len("https://")) = "https://" ) Then
  1515. '
  1516. ' ReturnURL is fully qualified
  1517. '
  1518. ElseIf ( Left(sReturnURL, 1) <> "/" ) Then
  1519. '
  1520. ' Prepend the virtual root
  1521. '
  1522. sReturnURL = m_VirtualRoot + sReturnURL
  1523. End If
  1524. End If
  1525. Randomize()
  1526. Call SA_MungeURL(sReturnURL, "R", ""+CStr(Rnd()))
  1527. sFailurePageURL = m_VirtualRoot + "util/err_view.asp"
  1528. Call SA_MungeURL( sFailurePageURL, "Message", Message)
  1529. Call SA_MungeURL( sFailurePageURL, "ReturnURL", sReturnURL)
  1530. Call SA_TraceOut(SA_GetScriptFileName(), "SA_ServeFailurePage redirecting to: " + sFailurePageURL)
  1531. %>
  1532. <html>
  1533. <!-- Copyright (c) Microsoft Corporation. All rights reserved.-->
  1534. <head>
  1535. <SCRIPT language=JavaScript>
  1536. function Redirect() {
  1537. var frmError = document.getElementById("frmError");
  1538. frmError.action = "<%=sFailurePageURL%>";
  1539. frmError.submit();
  1540. }
  1541. </SCRIPT>
  1542. </head>
  1543. <BODY onLoad="Redirect();">
  1544. <form id="frmError" method="post">
  1545. <INPUT name="<%=SAI_FLD_PAGEKEY%>" type="hidden" value="<%=SAI_GetPageKey()%>">
  1546. </form>
  1547. </BODY>
  1548. </html>
  1549. <%
  1550. Response.Flush
  1551. Response.End
  1552. End Function
  1553. '--------------------------------------------------------------------
  1554. '
  1555. ' Function: SA_MungeURL
  1556. '
  1557. ' Synopsis: Munge the specified URL, to add, update, or delete the specified
  1558. ' parameter. This function will URLEncode the sParamValue parameter,
  1559. ' DO NOT Server.URLEncode(sParamValue) before passing to this function.
  1560. '
  1561. ' To delete a parameter value from the URL, specify the parameter name
  1562. ' and a blank value as in:
  1563. ' Call SA_MungURL(sURL, "FavoriteFood", "")
  1564. '
  1565. ' To add or update a parameter to the URL, specify the parameter name
  1566. ' and a valid non-blank value as in:
  1567. ' Call SA_MungeURL(sURL, "FavoriteFood", "ApplePie")
  1568. '
  1569. ' Arguments: [in/out] sURL - URL that is to be Munged, or updated.
  1570. ' [in] sParamName - Name of parameter that is to be changed
  1571. ' or added.
  1572. ' [in] sParamValue - Value of the parameter
  1573. '
  1574. ' Returns: Nothing
  1575. '
  1576. ' Example:
  1577. ' Dim sURLExample
  1578. ' Dim sOutput
  1579. '
  1580. ' sURLExample = "http://localhost/Tasks.asp?Param1=Red&Param2=Peach&Param3=Bird"
  1581. ' sOutput = "Starting with: " + sURLExample + vbCrLf
  1582. '
  1583. ' Call SA_MungeURL(sURLExample, "Param1", "Green")
  1584. ' sOutput = sOutput + sURLExample + vbCrLf
  1585. '
  1586. ' Call SA_MungeURL(sURLExample, "Param1", "Blue")
  1587. ' sOutput = sOutput + sURLExample + vbCrLf
  1588. '
  1589. ' Call SA_MungeURL(sURLExample, "Param3", "Dog")
  1590. ' sOutput = sOutput + sURLExample + vbCrLf
  1591. '
  1592. ' Call SA_MungeURL(sURLExample, "Param2", "Pear")
  1593. ' sOutput = sOutput + sURLExample + vbCrLf
  1594. '
  1595. ' Call SA_MungeURL(sURLExample, "Param4", "Software")
  1596. ' sOutput = sOutput + sURLExample + vbCrLf
  1597. '
  1598. ' WScript.Echo sOutput
  1599. '
  1600. '--------------------------------------------------------------------
  1601. Public Function SA_MungeURL(ByRef sURL, ByVal sParamName, ByVal sParamValue)
  1602. Dim rc
  1603. SA_MungeURL = 0
  1604. '
  1605. ' Strip off leading ?, & parameter token if it exists.
  1606. ' We are going to check for both cases in the URL.
  1607. '
  1608. sParamName = SA_StripParamToken(sParamName)
  1609. '
  1610. ' Strip leading and trailing spaces
  1611. '
  1612. sParamName = Trim(sParamName)
  1613. sParamValue = Trim(sParamValue)
  1614. '
  1615. ' Is this a delete parameter request
  1616. '
  1617. If (Len(sParamValue) <= 0 ) Then
  1618. '
  1619. ' Look for parameter using the ? token
  1620. '
  1621. rc = SA_DelURLParamInternal(sURL, "&"+sParamName)
  1622. If ( rc <> TRUE ) Then
  1623. '
  1624. ' Look for parameter using the "?" token
  1625. '
  1626. Call SA_DelURLParamInternal(sURL, "?"+sParamName)
  1627. End If
  1628. Exit Function
  1629. End If
  1630. '
  1631. ' URL Encode the parameter value
  1632. '
  1633. sParamValue = Server.URLEncode(sParamValue)
  1634. '
  1635. ' Look for matching param starting with "&" token
  1636. '
  1637. rc = SA_SetURLParamInternal(sURL, "&"+sParamName, sParamValue)
  1638. If ( rc <> TRUE ) Then
  1639. '
  1640. ' Look for matching param starting with "?" token
  1641. '
  1642. rc = SA_SetURLParamInternal(sURL, "?"+sParamName, sParamValue)
  1643. If ( rc <> TRUE ) Then
  1644. '
  1645. ' Param did not exist in the URL, add it
  1646. '
  1647. If InStr(sURL, "?") Then
  1648. sURL = sURL + "&" + sParamName + "=" + sParamValue
  1649. Else
  1650. sURL = sURL + "?" + sParamName + "=" + sParamValue
  1651. End If
  1652. End If
  1653. End If
  1654. End Function
  1655. Public Function SA_SetURLParamInternal(ByRef sURL, ByVal sParamName, ByVal sParamValue)
  1656. SA_SetURLParamInternal = FALSE
  1657. Dim i
  1658. Dim sUrl1
  1659. Dim sUrl2
  1660. '
  1661. ' Do Case insensitive search, starting in the first position
  1662. '
  1663. i = InStr(1, sURL, sParamName+"=", 1)
  1664. If ( i > 0 ) Then
  1665. sURL1 = Left(sURL, i - 1)
  1666. sURL2 = Mid(sURL, i + 1)
  1667. i = InStr(sURL2, "&")
  1668. If ( i > 0 ) Then
  1669. sURL2 = Mid( sURL2, i )
  1670. Else
  1671. sURL2 = ""
  1672. End If
  1673. If InStr(sURL1, "?") Then
  1674. sURL = sURL1 + "&" + SA_StripParamToken(sParamName) + "=" + sParamValue + sURL2
  1675. Else
  1676. sURL = sURL1 + "?" + SA_StripParamToken(sParamName) + "=" + sParamValue + sURL2
  1677. End If
  1678. SA_SetURLParamInternal = TRUE
  1679. End If
  1680. End Function
  1681. Public Function SA_DelURLParamInternal(ByRef sURL, ByVal sParamName)
  1682. SA_DelURLParamInternal = FALSE
  1683. Dim i
  1684. Dim sUrl1
  1685. Dim sUrl2
  1686. '
  1687. ' Do Case insensitive search, starting in the first position
  1688. '
  1689. i = InStr(1, sURL, sParamName+"=", 1)
  1690. If ( i > 0 ) Then
  1691. sURL1 = Left(sURL, i - 1)
  1692. sURL2 = Mid(sURL, i + 1)
  1693. i = InStr(sURL2, "&")
  1694. If ( i > 0 ) Then
  1695. sURL2 = Mid( sURL2, i )
  1696. Else
  1697. sURL2 = ""
  1698. End If
  1699. If InStr(sURL1, "?") Then
  1700. sURL = sURL1 + sURL2
  1701. ElseIf (Len(sURL2) > 0 ) Then
  1702. sURL = sURL1 + "?" + SA_StripParamToken(sURL2)
  1703. Else
  1704. sURL = sURL1
  1705. End If
  1706. SA_DelURLParamInternal = TRUE
  1707. End If
  1708. End Function
  1709. Public Function SA_StripParamToken(ByRef sParam )
  1710. If (Left(sParam,1) = "?") OR (Left(sParam,1) = "&") Then
  1711. SA_StripParamToken = Mid(sParam, 2)
  1712. Else
  1713. SA_StripParamToken = sParam
  1714. End If
  1715. End Function
  1716. Private Function SAI_IsSSLCertificateInstalled()
  1717. on error resume next
  1718. Err.Clear
  1719. Dim oWebServer
  1720. Dim sAdminSiteID
  1721. SAI_IsSSLCertificateInstalled = FALSE
  1722. 'sAdminSiteID = SAI_GetWebSiteID("Administration" )
  1723. sAdminSiteID = GetCurrentWebsiteName()
  1724. Call SA_TraceOut("SH_PAGE", "SAI_IsSSLCertificateInstalled - Checking for SSL Certificate on site ID: " + sAdminSiteID)
  1725. Set oWebServer = GetObject( "IIS://localhost/" + sAdminSiteID )
  1726. If (Len(oWebServer.SSLStoreName) > 0 ) Then
  1727. Call SA_TraceOut("SH_PAGE", "SSL Certificate found")
  1728. SAI_IsSSLCertificateInstalled = TRUE
  1729. End IF
  1730. Set oWebServer = Nothing
  1731. End Function
  1732. Function SAI_GetSecurePort()
  1733. On Error Resume Next
  1734. Err.Clear
  1735. Dim strSitename
  1736. Dim objService
  1737. Dim objWebsite
  1738. Dim strObjPath
  1739. Dim strSSLPort
  1740. Dim strIPArr
  1741. SAI_GetSecurePort = 0
  1742. strSitename = GetCurrentWebsiteName()
  1743. 'strSitename = SAI_GetWebSiteID("Administration" )
  1744. strObjPath = GetIISWMIProviderClassName("IIs_WebServerSetting") & ".Name=" & chr(34) & strSitename & chr(34)
  1745. Set objService = GetWMIConnection(CONST_WMI_IIS_NAMESPACE)
  1746. Set objWebsite = objService.get(strObjPath)
  1747. If IsIIS60Installed() Then
  1748. strSSLPort = objWebsite.SecureBindings(0).Port
  1749. strSSLPort = Left(strSSLPort, len(strSSLPort)-1)
  1750. Else
  1751. strIPArr=split(objWebsite.SecureBindings(0),":")
  1752. strSSLPort = strIPArr(1)
  1753. End If
  1754. If Err.number <> 0 Then
  1755. SA_TraceOut "SH_PAGE", "SAI_GetSecurePort(): failed:" + CStr(Hex(Err.Number))
  1756. Exit Function
  1757. End If
  1758. SAI_GetSecurePort = strSSLPort
  1759. Call SA_TraceOut("sh_page", "SAI_GetSecurePort() returning: " & SAI_GetSecurePort )
  1760. End Function
  1761. %>