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.

272 lines
9.6 KiB

  1. <%
  2. '-------------------------------------------------------------------------
  3. ' share_httpnew.asp: Serves in creating new HTTP share properties.
  4. '
  5. ' Copyright (c) Microsoft Corporation. All rights reserved.
  6. '
  7. ' Date Description
  8. ' 9 Mar 2001 Creation Date.
  9. ' 17 Mar 2001 Modified Date.
  10. '-------------------------------------------------------------------------
  11. '-------------------------------------------------------------------------
  12. 'Form Variables
  13. '-------------------------------------------------------------------------
  14. Dim F_strReadCheckStatus_HttpNew ' to set the Read CheckBox status
  15. Dim F_strWriteCheckStatus_HttpNew ' to set the Write CheckBox status
  16. Dim F_nAccessReadWrite_HttpNew ' to store the access value(0,1,2 or 3)
  17. '-------------------------------------------------------------------------
  18. 'Global Constants
  19. '-------------------------------------------------------------------------
  20. 'constants used for querying WMI for Http share
  21. Const CONST_IIS = "IIS://"
  22. Const CONST_ROOT = "/Root/"
  23. %>
  24. <script language="JavaScript" src="<%=m_VirtualRoot%>inc_global.js"></script>
  25. <script language="JavaScript" >
  26. // Set the initial form values
  27. function HTTPInit()
  28. {
  29. // no initializations required for the checkboxes
  30. // the status of checkBoxes is taken care on server side
  31. }// end of function Init()
  32. // Validate the page form values
  33. function HTTPValidatePage()
  34. {
  35. // the LeftSide tabs are clicked, "OK" is not clicked
  36. // set the hidden variables. No other validations required here
  37. UpdateHiddenVariablesHttpNew();
  38. return true;
  39. }
  40. // Function to set the hidden varibales to be sent to the server
  41. function HTTPSetData()
  42. {
  43. // "OK" is clicked. The hidden values are already set in the
  44. // HTTPValidatePage function above. Nothing to set here.
  45. }
  46. // Function to update the hidden values in the form
  47. function UpdateHiddenVariablesHttpNew()
  48. {
  49. var objForm
  50. // initialize the access value to 0 (NO Read, NO Write access)
  51. var accessValue = 0
  52. // assign the form object to variable
  53. objForm = eval("document.frmTask")
  54. // if the allow read is checked, make access value as 1
  55. // for read only - access = 1 (Read Only, NO Write)
  56. if (objForm.chkAllowReadHttpNew.checked)
  57. {
  58. accessValue = accessValue + 1;
  59. }
  60. // if the allow write is checked, make access value as 2 or 3
  61. // for read and write - access = 3 (Read AND Write)
  62. // for write only - access = 2 (NO Read, Write Only)
  63. if (objForm.chkAllowWriteHttpNew.checked)
  64. {
  65. accessValue = accessValue + 2;
  66. }
  67. // now update the hidden form value with the access value
  68. objForm.hdnintAccessReadWriteHttpNew.value = accessValue;
  69. } // end of UpdateHiddenVariablesHttpNew()
  70. </script>
  71. <%
  72. '-------------------------------------------------------------------------
  73. ' SubRoutine: ServeHTTPPage
  74. ' Description: Serves in displaying the page content
  75. ' Input Variables: None
  76. ' Output Variables: None
  77. ' Returns: None
  78. ' Global Variables:
  79. ' In: L_* - Localization content(form label text)
  80. ' In: F_strReadCheckStatus_HttpNew - status of Read CheckBox
  81. ' In: F_strWriteCheckStatus_HttpNew - status of Write CheckBox
  82. '-------------------------------------------------------------------------
  83. Sub ServeHTTPPage
  84. %>
  85. <table border="0" cellspacing="0" cellpadding="0">
  86. <tr>
  87. <td class="TasksBody">
  88. <%=L_ALLOW_PERMISSIONS_LABEL_TEXT%>
  89. </td>
  90. </tr>
  91. <tr>
  92. <td align="left" class="TasksBody">
  93. <input name="chkAllowReadHttpNew" class="FormCheckBox" type="checkbox" <%=F_strReadCheckStatus_HttpNew%> >
  94. <%=L_READ_LABEL_TEXT%>
  95. </td>
  96. </tr>
  97. <tr>
  98. <td align="left" class="TasksBody">
  99. <input name="chkAllowWriteHttpNew" class="FormCheckBox" type="checkbox" <%=F_strWriteCheckStatus_HttpNew%> >
  100. <%=L_WRITE_LABEL_TEXT%>
  101. </td>
  102. </tr>
  103. </table>
  104. <%
  105. Call ServeHTTPHiddenValues
  106. End Sub
  107. '-------------------------------------------------------------------------
  108. ' SubRoutine: HTTPOnPostBackPage
  109. ' Description: Serves in getting the values from the form.
  110. ' Input Variables: None
  111. ' Output Variables: None
  112. ' Returns: None
  113. ' Global Variables:
  114. ' Out: F_nAccessReadWrite_HttpNew - the access permissions
  115. ' (0,1,2 or 3 only)
  116. ' Out: F_strReadCheckStatus_HttpNew - status of READ checkBox
  117. ' Out: F_strWriteCheckStatus_HttpNew - status of WRITE checkBox
  118. ' Status of checkBoxes = "CHECKED" or ""
  119. '-------------------------------------------------------------------------
  120. Sub HTTPOnPostBackPage
  121. Err.Clear
  122. On Error Resume Next
  123. ' get the value of the hidden variable from the form
  124. F_nAccessReadWrite_HttpNew = Request.Form("hdnintAccessReadWriteHttpNew")
  125. ' initialize the status of CheckBoxes to "NOT CHECKED"
  126. F_strReadCheckStatus_HttpNew = CONST_CHECKBOX_NOT_SELECTED
  127. F_strWriteCheckStatus_HttpNew = CONST_CHECKBOX_NOT_SELECTED
  128. ' convert to integer type
  129. F_nAccessReadWrite_HttpNew = CInt(F_nAccessReadWrite_HttpNew)
  130. ' set the status of "CheckBoxes" if the values are set
  131. ' if the Read access is given.
  132. ' perform an AND to verify if the value is set
  133. If (F_nAccessReadWrite_HttpNew AND CONST_ACCESS_READ_ONLY) Then
  134. F_strReadCheckStatus_HttpNew = CONST_CHECKBOX_SELECTED
  135. End If
  136. ' if the write access is given.
  137. ' perform an AND to verify if the value is set
  138. If (F_nAccessReadWrite_HttpNew AND CONST_ACCESS_WRITE_ONLY) Then
  139. F_strWriteCheckStatus_HttpNew = CONST_CHECKBOX_SELECTED
  140. End If
  141. End Sub
  142. '-------------------------------------------------------------------------
  143. ' SubRoutine: HTTPOnInitPage
  144. ' Description: Serves in getting the values from system
  145. ' Input Variables: None
  146. ' Output Variables: None
  147. ' Returns: None
  148. ' Global Variables:
  149. ' Out: F_nAccessReadWrite_HttpNew - the access permissions
  150. ' (0,1,2 or 3 only)
  151. ' Out: F_strReadCheckStatus_HttpNew - status of READ checkBox
  152. ' Out: F_strWriteCheckStatus_HttpNew - status of WRITE checkBox
  153. ' Status of checkBoxes = "CHECKED" or ""
  154. '-------------------------------------------------------------------------
  155. Sub HTTPOnInitPage
  156. Err.Clear
  157. On Error Resume Next
  158. Const CONST_READ_PERMISSION=1
  159. ' initialize the checkbox status
  160. ' set Allow-Read and Deny-None as default values for permissions
  161. F_nAccessReadWrite_HttpNew = CONST_READ_PERMISSION
  162. F_strReadCheckStatus_HttpNew = CONST_CHECKBOX_SELECTED
  163. F_strWriteCheckStatus_HttpNew = CONST_CHECKBOX_NOT_SELECTED
  164. End Sub
  165. '-------------------------------------------------------------------------
  166. ' Function name: SetHTTPshareProp
  167. ' Description: Serves in setting the values of the http share
  168. ' Input Variables: None
  169. ' Output Variables: None
  170. ' Returns: TRUE if successful, else FALSE
  171. ' Global Variables:
  172. ' In: L_* - Localization content(error messages)
  173. ' In: F_nAccessReadWrite_HttpNew - the access permissions
  174. ' (0,1,2 or 3 only)
  175. '
  176. ' Support functions used: getHTTPShareObject() - to get the share object
  177. '-------------------------------------------------------------------------
  178. Function SetHTTPshareProp
  179. Err.Clear
  180. On Error Resume Next
  181. Dim objHTTPShare ' to get the share object for which we need to
  182. ' change properties
  183. Const CONST_ACCESSREAD = "AccessRead"
  184. Const CONST_ACCESSWRITE = "AccessWrite"
  185. ' get the HTTP share object for which we need to set properties
  186. Set objHTTPShare = getHTTPShareObject()
  187. ' It is enough to set the boolean values(AccessRead and AccessWrite).
  188. ' The AccessFlags(integer) need not be set.
  189. ' if the Read CheckBox is checked, set the flag to TRUE, else FALSE
  190. If (F_nAccessReadWrite_HttpNew AND CONST_ACCESS_READ_ONLY) Then
  191. objHTTPShare.Put CONST_ACCESSREAD,True
  192. Else
  193. objHTTPShare.Put CONST_ACCESSREAD,False
  194. End If
  195. ' if the Write CheckBox is checked, set the flag to TRUE, else FALSE
  196. If (F_nAccessReadWrite_HttpNew AND CONST_ACCESS_WRITE_ONLY) Then
  197. objHTTPShare.Put CONST_ACCESSWRITE,True
  198. Else
  199. objHTTPShare.Put CONST_ACCESSWRITE,False
  200. End If
  201. ' Enable the dir browsing by default to show the dir listing
  202. objHTTPShare.Put "EnableDirBrowsing",True
  203. ' bring the changes made to properties to effect
  204. objHTTPShare.SetInfo()
  205. ' clean up
  206. Set objHTTPShare = Nothing
  207. ' in case of any error, return FALSE, else return TRUE
  208. If Err.number <> 0 Then
  209. ' the changes could not be PUT (system values could not be changed)
  210. SA_SetErrMsg L_FAILEDTOSETSHAREINFO_ERRORMESSAGE
  211. Exit Function
  212. SetHTTPshareProp = False
  213. Else
  214. SetHTTPshareProp = True
  215. End If
  216. End Function
  217. '-------------------------------------------------------------------------
  218. ' SubRoutine: ServeHTTPHiddenValues
  219. ' Description: Serves in printing the hidden values of the form
  220. ' Input Variables: None
  221. ' Output Variables: None
  222. ' Returns: None
  223. ' Global Variables:
  224. ' In: F_nAccessReadWrite_HttpNew - the access permissions
  225. '-------------------------------------------------------------------------
  226. Sub ServeHTTPHiddenValues
  227. ' the hidden values to store the access flag value
  228. ' (Whether the checkBoxes must be checked OR NOT)
  229. %>
  230. <input type="hidden" name="hdnintAccessReadWriteHttpNew" value="<%=F_nAccessReadWrite_HttpNew%>" >
  231. <%
  232. End Sub
  233. %>