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.

224 lines
6.8 KiB

  1. <%@ Language=VBScript %>
  2. <% Option Explicit %>
  3. <%
  4. '-------------------------------------------------------------------------
  5. ' folder_dispatch.asp This is the customised area page which acts as a
  6. ' intemediate page for redirecting to respective pages
  7. ' (with task that to be done)
  8. '
  9. ' Copyright (c) Microsoft Corporation. All rights reserved.
  10. '
  11. ' Date Description
  12. ' 31 mar 2001 Creation Date
  13. '-------------------------------------------------------------------------
  14. %>
  15. <!-- #include virtual="/admin/inc_framework.asp" -->
  16. <!-- #include file="inc_folders.asp"-->
  17. <%
  18. '-------------------------------------------------------------------------
  19. ' Global Variables
  20. '-------------------------------------------------------------------------
  21. Dim SOURCE_FILE
  22. SOURCE_FILE = SA_GetScriptFileName()
  23. Dim G_strPath 'Path from the previous page
  24. Dim G_strShareName 'Share path
  25. Dim G_strShareType 'Share Type
  26. Dim G_strFrameSetURL 'URL to be redirected
  27. Dim G_strReturnURL 'Return URL
  28. Dim G_strFolder 'Folder path
  29. Dim G_strShares 'Type of Shares retrieved from previous page
  30. Call SA_StoreTableParameters()
  31. Call InitializePage()
  32. Call DispatchPage()
  33. Public Function InitializePage()
  34. Dim strItemFolder
  35. Dim arrFolder
  36. G_strPath = Request.QueryString("parent")
  37. Call OTS_GetTableSelection(SA_DEFAULT, 1, strItemFolder)
  38. arrFolder = split(strItemFolder,chr(1))
  39. 'Checking for isarray or not
  40. If Isarray(arrFolder) Then
  41. 'checking for the existence
  42. If Ubound(arrFolder) = 2 Then
  43. arrFolder(0) = UnescapeChars(arrFolder(0))
  44. G_strFolder = trim(replace(arrFolder(0),"/","\"))
  45. G_strShares = Trim(arrFolder(2))
  46. End if
  47. End if
  48. G_strReturnURL = Request.QueryString("ReturnURL")
  49. End Function
  50. Public Function DispatchPage()
  51. Call setPageURL()
  52. End Function
  53. '-------------------------------------------------------------------------
  54. ' Function name: setPageURL
  55. ' Description: page url is set and redirecting to the respective
  56. ' page depending on the request
  57. ' Input Variables: None
  58. ' Output Variables: None
  59. ' Return Values: None
  60. ' Global Variables: G_strFolder,G_strShareName
  61. '-------------------------------------------------------------------------
  62. Function setPageURL()
  63. Err.Clear
  64. On Error Goto 0
  65. 'On Error Resume Next
  66. Dim tab1 'Tab1
  67. Dim tab2 'Tab2
  68. Dim strDesc 'Description
  69. Dim strShare 'Concatenated string to be sent to share_prop.asp
  70. Dim strURL 'URL to be redirected for multiple shares
  71. Dim strSharePath 'Share path
  72. 'Getting tab1 and tab2 values
  73. tab1 = GetTab1()
  74. tab2 = GetTab2()
  75. If G_strShares = "" then
  76. strURL = "Shares/share_new.asp"
  77. Call SA_MungeURL(strURL, "Tab1", tab1)
  78. Call SA_MungeURL(strURL, "Tab2", tab2)
  79. Call SA_MungeURL(strURL,"ParentPlugin","Folders")
  80. Call SA_MungeURL(strURL,"parent",G_strFolder)
  81. Call SA_MungeURL(strURL,"path",G_strPath)
  82. Call SA_MungeURL(strURL, "ReturnURL", G_strReturnURL)
  83. Call SA_MungeURL(strURL, SAI_FLD_PAGEKEY, SAI_GetPageKey())
  84. G_strFrameSetURL = m_VirtualRoot + "sh_taskframes.asp"
  85. Call SA_MungeURL(G_strFrameSetURL, "URL", strURL)
  86. Call SA_MungeURL(G_strFrameSetURL, SAI_FLD_PAGEKEY, SAI_GetPageKey())
  87. SA_TraceOut "FOLDER_DISPATCH", "Redirect frameset URL to New page: " + G_strFrameSetURL
  88. 'redirecting to shares new page
  89. Response.Redirect (G_strFrameSetURL)
  90. Exit Function
  91. End If
  92. Call GetShareNames(G_strFolder)
  93. strSharePath= split(G_strShareName, chr(1))
  94. If strSharePath(1) = "" then
  95. strDesc = ""
  96. strShare = replace(strSharePath(0) & chr(1) & G_strFolder & chr(1) & G_strShareType & chr(1) & strDesc, "\","/")
  97. strURL = "Shares/share_prop.asp"
  98. Call SA_MungeURL(strURL, "Tab1", tab1)
  99. Call SA_MungeURL(strURL, "Tab2", tab2)
  100. Call SA_MungeURL(strURL,"ParentPlugin","Folders")
  101. Call SA_MungeURL(strURL, "PKey", strShare)
  102. Call SA_MungeURL(strURL,"path",G_strPath)
  103. Call SA_MungeURL(strURL, "ReturnURL", G_strReturnURL)
  104. Call SA_MungeURL(strURL, SAI_FLD_PAGEKEY, SAI_GetPageKey())
  105. G_strFrameSetURL = m_VirtualRoot + "sh_taskframes.asp"
  106. Call SA_MungeURL(G_strFrameSetURL, "URL", strURL)
  107. Call SA_MungeURL(G_strFrameSetURL, SAI_FLD_PAGEKEY, SAI_GetPageKey())
  108. SA_TraceOut "FOLDER_DISPATCH", "Redirect frameset URL to property page: " + G_strFrameSetURL
  109. 'redirecting to shares properties page
  110. Response.Redirect (G_strFrameSetURL)
  111. Exit Function
  112. End If
  113. Call SA_TraceOut("FOLDER_DISPATCH", "Redirect to ReturnURL: " + G_strReturnURL)
  114. Response.Redirect (G_strReturnURL)
  115. End Function
  116. '-------------------------------------------------------------------------
  117. ' Function name: GetShareNames
  118. ' Description: Get the share name
  119. ' Input Variables: Share path -- sharepath
  120. ' Output Variables: G_strShareName, G_strShareType
  121. ' Return Values: None
  122. ' Global Variables: G_strShareName, G_strShareType
  123. '-------------------------------------------------------------------------
  124. Function GetShareNames(byval sharepath)
  125. Err.Clear
  126. On Error Resume Next
  127. Dim strkey
  128. Dim strShare
  129. Dim arrDicItems
  130. Dim strShareTypes
  131. Dim strSharePath
  132. Dim objDict
  133. ' Taking the instance of Dictionary Object to place all shares
  134. ' in Dictionay object.
  135. Set objDict=server.CreateObject("scripting.dictionary")
  136. ' Setting the property of Dictionary object to compare the shares in
  137. ' incase sensitive
  138. objDict.CompareMode= vbTextCompare
  139. ' Add all shares to shares table
  140. ' Gets all windows shares with name,path and description and type
  141. call GetCifsShares(objDict)
  142. ' Gets all unix shares with name,path and type
  143. call GetNfsshares(objDict)
  144. ' Gets all Ftp shares with name,path and type
  145. call GetFtpShares(objDict)
  146. ' Gets all Http shares with name,path and type
  147. call GetHttpShares(objDict)
  148. ' Gets all netware shares with name,path and type
  149. call GetNetWareShares(objDict)
  150. ' Gets all AppleTalk shares with name,path and type
  151. call GetAppleTalkShares(objDict)
  152. For each strkey in objDict.Keys
  153. strShareTypes=""
  154. strShare=split(strKey,chr(1))
  155. arrDicItems = split(objDict.Item(strKey),chr(1))
  156. If IsArray(arrDicItems) then
  157. If Ubound(arrDicItems) = 1 then
  158. strShareTypes = arrDicItems(1)
  159. strSharePath = strShare(1)
  160. End if
  161. End if
  162. if lcase(TRIM(sharepath)) = lcase(TRIM(strSharePath)) then
  163. G_strShareName= G_strShareName & trim(strShare(0)) & chr(1)
  164. G_strShareType = trim(strShareTypes)
  165. end if
  166. Next
  167. Set objDict = Nothing
  168. End Function
  169. %>