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.

469 lines
16 KiB

  1. <%
  2. '-------------------------------------------------------------------------
  3. ' share_Appletalkprop.asp: Serves to Modify Appletalk share
  4. '
  5. ' Copyright (c) Microsoft Corporation. All rights reserved.
  6. '
  7. ' Date Description
  8. ' 09-Mar-2001 Creation Date.
  9. ' 23-Mar-2001 Modified Date.
  10. '-------------------------------------------------------------------------
  11. '-------------------------------------------------------------------------
  12. 'Form Variables
  13. '-------------------------------------------------------------------------
  14. Dim F_txtUsersAllowed 'No of Users given permission
  15. Dim F_txtPWD 'Password for the appletalk share
  16. Dim F_txtConfirmPWD 'Confirm password for the appletalk share
  17. Dim F_chkRead 'Read only access
  18. Dim F_strAllowUsersDisable 'Disable the text box for Maximum Users selected
  19. '-------------------------------------------------------------------------
  20. 'Global Variables
  21. '-------------------------------------------------------------------------
  22. Dim G_chkReadOnly 'Checked or Unchecked status of Readonly checkbox
  23. Dim G_radNoOfUsersAllowedAppleTalk 'Number of Users given permission
  24. Dim G_radMaxiUsersAllowedAppleTalk 'Unlimited Users given access
  25. Const CONST_REGISTRY_APPLETALK_PATH = "SYSTEM\CurrentControlSet\Services\MacFile\Parameters\Volumes"
  26. '-------------------------------------------------------------------------
  27. ' Function name : ServeAppleTalkPage
  28. ' Description : Serves UI of the page
  29. ' Input Variables : None
  30. ' Output Variables : None
  31. ' Return Values : True/False
  32. ' Global Variables : None
  33. '-------------------------------------------------------------------------
  34. Function ServeAppleTalkPage()
  35. Call SA_TraceOut("share_AppleTalkNew.asp","ServeAppleTalkPage")
  36. 'Emits common javascript functions
  37. Call ServeAppletalkCommonJavascript()
  38. 'Emits page UI for this page
  39. Call ServePageUI()
  40. ServeAppleTalkPage = true
  41. End Function
  42. '-------------------------------------------------------------------------
  43. ' Function name: AppleTalkOnPostBackPage
  44. ' Description: Serves in getting the values from previous form
  45. ' Input Variables: None
  46. ' Output Variables: None
  47. ' Return Values: None
  48. ' Global Variables: Out: G_radMaxiUsersAllowedAppleTalk
  49. ' Out: G_radNoOfUsersAllowedAppleTalk
  50. ' Out: F_txtUsersAllowed
  51. ' Out: F_txtPWD
  52. ' Out: F_flagDisable
  53. ' Out: G_chkReadOnly
  54. '-------------------------------------------------------------------------
  55. Function AppleTalkOnPostBackPage()
  56. Call SA_TraceOut("share_AppleTalkNew.asp","AppleTalkOnPostBackPage")
  57. G_radMaxiUsersAllowedAppleTalk = Request.Form("hdnradMaxiAllowedAppleTalk")
  58. G_radNoOfUsersAllowedAppleTalk = Request.Form("hdnradNoOfUsersAllowedAppleTalk")
  59. G_chkReadOnly = Request.Form("hdnchkReadOnly")
  60. F_txtUsersAllowed = Request.Form("txtUsersAllowed")
  61. F_txtPWD = Request.Form("txtSetPWD")
  62. F_txtConfirmPWD = Request.Form("txtConfirmPwd")
  63. End Function
  64. '-------------------------------------------------------------------------
  65. ' Function name: AppleTalkOnInitPage
  66. ' Description: Serves in getting the values from system
  67. ' Input Variables: None
  68. ' Output Variables: None
  69. ' Return Values: True/False
  70. ' Global Variables: None
  71. '-------------------------------------------------------------------------
  72. Function AppleTalkOnInitPage()
  73. Call SA_TraceOut("share_AppleTalkNew.asp","AppleTalkOnInitPage")
  74. 'Get Appletalk properties
  75. Call GetAppleTalkProperties()
  76. AppleTalkOnInitPage = true
  77. End Function
  78. '-------------------------------------------------------------------------
  79. ' Subroutine name: GetAppleTalkProperties
  80. ' Description: Gets All Apple Talk properties from SA machine
  81. ' Input Variables: None
  82. ' Output Variables: None
  83. ' Returns: True/False
  84. ' Global Variables: in: CONST_REGISTRY_APPLETALK_PATH - Registry path to
  85. ' access Appletalk Shares
  86. ' in: F_*,G_*
  87. '-------------------------------------------------------------------------
  88. Function GetAppleTalkProperties()
  89. Err.Clear
  90. On Error Resume Next
  91. Call SA_TraceOut("share_AppleTalkNew.asp","GetAppleTalkProperties")
  92. Dim objRegistryHandle 'holds registry handle
  93. Dim arrAppleTalkSharesValues 'holds Appletalk shares array
  94. Dim nUserLimit 'holds user limit
  95. Dim nProperties 'holds properties of the share
  96. Dim strKeyValue 'holds the keyvalue
  97. Dim arrFormValues 'holds split array
  98. GetAppleTalkProperties = false
  99. ' Get the registry connection Object.
  100. set objRegistryHandle = RegConnection()
  101. If Err.number <> 0 Then
  102. Call SA_ServeFailurePageEx(L_REGISTRYCONNECTIONFAILED_ERRORMESSAGE,mstrReturnURL)
  103. Exit Function
  104. End If
  105. strKeyValue = F_strShareName
  106. 'get the value from registry for the path passed
  107. arrAppleTalkSharesValues = getRegkeyvalue(objRegistryHandle,CONST_REGISTRY_APPLETALK_PATH,strKeyValue,CONST_MULTISTRING)
  108. If Err.number <> 0 Then
  109. Call SA_ServeFailurePageEx(L_REGISTRYCONNECTIONFAILED_ERRORMESSAGE,mstrReturnURL)
  110. Exit Function
  111. End If
  112. arrFormValues = split(arrAppleTalkSharesValues(0),"=",2)
  113. F_txtPWD = arrFormValues(1)
  114. F_txtConfirmPWD = arrFormValues(1)
  115. arrFormValues = split(arrAppleTalkSharesValues(1),"=",2)
  116. nUserLimit = arrFormValues(1)
  117. arrFormValues = split(arrAppleTalkSharesValues(2),"=",2)
  118. nProperties = arrFormValues(1)
  119. If nUserLimit = cstr(-1) Then
  120. G_radMaxiUsersAllowedAppleTalk = CONST_CHECKED
  121. G_radNoOfUsersAllowedAppleTalk = CONST_UNCHECKED
  122. Else
  123. G_radMaxiUsersAllowedAppleTalk = CONST_UNCHECKED
  124. G_radNoOfUsersAllowedAppleTalk = CONST_CHECKED
  125. F_txtUsersAllowed = nUserLimit
  126. End If
  127. If nProperties = 32769 Then
  128. G_chkReadOnly = CONST_CHECKED
  129. ELSE
  130. If nProperties = 32768 Then
  131. G_chkReadOnly = CONST_UNCHECKED
  132. Else
  133. If nProperties = 0 Then
  134. G_chkReadOnly = CONST_UNCHECKED
  135. Else
  136. G_chkReadOnly = CONST_CHECKED
  137. End If
  138. End If
  139. End If
  140. ' Destroying dynamically created objects
  141. set objRegistryHandle=Nothing
  142. GetAppleTalkProperties = true
  143. End Function
  144. '----------------------------------------------------------------------------
  145. 'Function name: SetShareforAppleTalk
  146. 'Description: Serves in updating existing Appletalk share
  147. 'Input Variables: strShareName holds appletalk share name
  148. ' strSharePath holds appletalk share path
  149. 'Output Variables: None
  150. 'Returns: True/False
  151. 'GlobalVariables: In : G_(*), F_*
  152. ' Out : L_(*)
  153. '----------------------------------------------------------------------------
  154. Function SetShareforAppleTalk(strShareName, strSharePath)
  155. Err.Clear
  156. On Error Resume Next
  157. Dim strQueryForCmd 'holds query to be executed at command
  158. Dim nReturnValue 'holds return value
  159. Call SA_TraceOut("share_AppleTalkNew.asp","SetShareforAppleTalk")
  160. SetShareforAppleTalk = False
  161. 'Forming the Command line Query
  162. strQueryForCmd = "VOLUME /SET /NAME:" & chr(34) & strShareName & chr(34)
  163. 'Check whether "Readonly" checkbox is checked and append the query with the READONLY switch
  164. If (UCase(G_chkReadOnly) = UCase("CHECKED")) Then
  165. strQueryForCmd = strQueryForCmd & " /READONLY:TRUE"
  166. Else
  167. strQueryForCmd = strQueryForCmd & " /READONLY:FALSE"
  168. End If
  169. 'Check whether password is entered and append the query with the PASSWORD switch
  170. strQueryForCmd = strQueryForCmd & " /PASSWORD:" & F_txtPWD
  171. 'Check whether Maxusers Option button is checked and append the query with the MAXUSERS switch
  172. If UCase(G_radMaxiUsersAllowedAppleTalk) = UCase("CHECKED") Then
  173. strQueryForCmd = strQueryForCmd & " /MAXUSERS:UNLIMITED"
  174. Else
  175. strQueryForCmd = strQueryForCmd & " /MAXUSERS:" & F_txtUsersAllowed
  176. End If
  177. 'Calling the UpdateAppleTalkShare present in inc_shares.asp to launch the
  178. 'command line Query
  179. nReturnValue = UpdateAppleTalkShare(strQueryForCmd)
  180. If nReturnValue = True Then
  181. SetShareforAppleTalk = True
  182. Else
  183. SA_SetErrMsg L_UPDATION_FAIL_ERRORMESSAGE & "(" & Hex(Err.Number) & ")"
  184. End If
  185. End Function
  186. '-------------------------------------------------------------------------
  187. 'Function: ServeAppletalkCommonJavascript
  188. 'Description: Serve common javascript that is required for this page type.
  189. 'Input Variables: None
  190. 'Output Variables: None
  191. 'Returns: None
  192. 'Global Variables: None
  193. '-------------------------------------------------------------------------
  194. Function ServeAppletalkCommonJavascript()
  195. Call SA_TraceOut("share_AppleTalkNew.asp","ServeAppletalkCommonJavascript")
  196. %>
  197. <script language="JavaScript" src="<%=m_VirtualRoot%>inc_global.js"></script>
  198. <script language="JavaScript" >
  199. // Set the initial form values
  200. function AppleTalkInit()
  201. {
  202. if (document.frmTask.radAllowUserlimit[0].checked == true)
  203. {
  204. document.frmTask.txtUsersAllowed.disabled = true;
  205. }
  206. else
  207. {
  208. document.frmTask.radAllowUserlimit[1].checked = true;
  209. document.frmTask.txtUsersAllowed.disabled = false
  210. selectFocus(document.frmTask.txtUsersAllowed);
  211. }
  212. }
  213. // Validate the page form values
  214. function AppleTalkValidatePage()
  215. {
  216. //Checking the maximum number of Users allowed
  217. if (((document.frmTask.txtUsersAllowed.value < 1) || (document.frmTask.txtUsersAllowed.value > 999999)) &&
  218. document.frmTask.radAllowUserlimit[1].checked == true)
  219. {
  220. DisplayErr("<%=Server.HTMLEncode(SA_EscapeQuotes(L_MAXIMUMALLOWED_ERRORMESSAGE))%>");
  221. document.frmTask.txtUsersAllowed.onkeypress=ClearErr;
  222. selectFocus(document.frmTask.txtUsersAllowed);
  223. return false;
  224. }
  225. //Checking if the Password and Confirm Password are same or not
  226. if (document.frmTask.txtSetPwd.value.toUpperCase() != document.frmTask.txtConfirmPwd.value.toUpperCase())
  227. {
  228. DisplayErr("<%=Server.HTMLEncode(SA_EscapeQuotes(L_CONFIRMPASSWORD_ERRORMESSAGE))%>");
  229. document.frmTask.txtConfirmPwd.onkeypress=ClearErr;
  230. selectFocus(document.frmTask.txtConfirmPwd);
  231. return false;
  232. }
  233. return true
  234. }
  235. //Function to update hidden varibles
  236. function AppleTalkSetData()
  237. {
  238. return true;
  239. }
  240. //Update the hidden variable when Maximum radio button is clicked
  241. function MaximumAllowed()
  242. {
  243. if (document.frmTask.radAllowUserlimit[0].checked == true)
  244. {
  245. document.frmTask.hdnradMaxiAllowedAppleTalk.value = "CHECKED"
  246. document.frmTask.hdnradNoOfUsersAllowedAppleTalk.value = ""
  247. document.frmTask.txtUsersAllowed.disabled = true
  248. }
  249. }
  250. //Update the hidden variable when UsersAllowed radio button is clicked
  251. function UsersAllowed()
  252. {
  253. if (document.frmTask.radAllowUserlimit[1].checked == true)
  254. {
  255. document.frmTask.hdnradNoOfUsersAllowedAppleTalk.value = "CHECKED"
  256. document.frmTask.hdnradMaxiAllowedAppleTalk.value = ""
  257. document.frmTask.txtUsersAllowed.disabled = false
  258. selectFocus(document.frmTask.txtUsersAllowed)
  259. }
  260. }
  261. //Update the hidden variable when Readonly checkbox is clicked
  262. function ReadOnlyStatus()
  263. {
  264. //Setting the hidden variable ReadOnly to either Checked or space
  265. if (document.frmTask.chkReadOnly.checked == true)
  266. {
  267. document.frmTask.hdnchkReadOnly.value = "CHECKED"
  268. }
  269. else
  270. {
  271. document.frmTask.hdnchkReadOnly.value = ""
  272. }
  273. }
  274. //Validation to allow only numbers as input for Users text box
  275. function OnlyNumbers()
  276. {
  277. // Clear any previous error messages
  278. ClearErr();
  279. if (!(window.event.keyCode >=48 && window.event.keyCode <=57))
  280. {
  281. window.event.keyCode = 0;
  282. }
  283. }
  284. </script>
  285. <%
  286. End Function
  287. '-------------------------------------------------------------------------
  288. 'Function: ServePageUI
  289. 'Description: Serves User Interface for the page
  290. 'Input Variables: None
  291. 'Output Variables: None
  292. 'Returns: None
  293. 'Global Variables: F_*,G_*,L_*
  294. '-------------------------------------------------------------------------
  295. Function ServePageUI()
  296. Call SA_TraceOut("share_AppleTalkprop.asp","ServePageUI")
  297. if G_radMaxiUsersAllowedAppleTalk = "" and G_radNoOfUsersAllowedAppleTalk = "" then
  298. G_radMaxiUsersAllowedAppleTalk = CONST_CHECKED
  299. G_radNoOfUsersAllowedAppleTalk = CONST_UNCHECKED
  300. end if
  301. %>
  302. <table valign="middle" align="left" border="0" cellspacing="0" cellpadding="2" >
  303. <tr>
  304. <td class="TasksBody">
  305. <%=L_USERLIMIT_TEXT%>
  306. </td>
  307. </tr>
  308. <tr>
  309. <td class="TasksBody">
  310. <input name="radAllowUserlimit" type="radio" class="FormRadioButton" value="Y" tabindex="1" <%=G_radMaxiUsersAllowedAppleTalk%> OnClick ="MaximumAllowed()" >&nbsp;<%=L_MAXIMUMALLOWED_TEXT%>
  311. </td>
  312. </tr>
  313. <tr>
  314. <td class="TasksBody" align="left">
  315. <input name="radAllowUserlimit" type="radio" class="FormRadioButton" value="N" <%=G_radNoOfUsersAllowedAppleTalk%>
  316. OnClick ="UsersAllowed()">&nbsp;<%=L_ALLOW_TEXT%>
  317. <input name="txtUsersAllowed" type="text" maxlength="6" class="FormField" value="<% = F_txtUsersAllowed %>" style="WIDTH=50px"<% =F_strAllowUsersDisable %> tabindex="2"
  318. OnKeypress="OnlyNumbers()" ><%=L_USERS_TEXT%>
  319. </td>
  320. </tr>
  321. <tr>
  322. <td class="TasksBody">
  323. &nbsp;
  324. </td>
  325. </tr>
  326. <tr>
  327. <td colspan="2" class="TasksBody">
  328. <%=L_APPLETALK_SECURITY_TXT%>
  329. </td>
  330. </tr>
  331. <tr>
  332. <td class="TasksBody">
  333. &nbsp;
  334. </td>
  335. </tr>
  336. <tr>
  337. <td class="TasksBody">
  338. <%=L_SETPWD_TXT%>
  339. </td>
  340. <td class="TasksBody">
  341. <input name="txtSetPwd" type="password" MAXLENGTH=8 class="FormField" value="<%=F_txtPWD%>">
  342. </td>
  343. </tr>
  344. <tr>
  345. <td class="TasksBody">
  346. <%=L_CONFIRMPWD_TXT%>
  347. </td>
  348. <td class="TasksBody">
  349. <input name="txtConfirmPwd" type="password" MAXLENGTH=8 class="FormField" value="<%=F_txtConfirmPWD%>">
  350. </td>
  351. </tr>
  352. <tr>
  353. <td class="TasksBody">
  354. &nbsp;
  355. </td>
  356. </tr>
  357. <tr>
  358. <td colspan="2" class="TasksBody">
  359. <input name="chkReadOnly" type="checkbox" class="FormCheckBox" <%=G_chkReadOnly%>
  360. onClick="ReadOnlyStatus()"><%=L_READ_TXT%>
  361. </td>
  362. </tr>
  363. </table>
  364. <%
  365. Call ServeAppleTalkHiddenValues()
  366. End Function
  367. '------------------------------------------------------------------
  368. 'Function name: ServeAppleTalkVisibleValues()
  369. 'Description: Serve Visible Values
  370. 'Input Variables: None
  371. 'Output Variables: None
  372. 'Global Variables: In : F_txtConfirmPWD, F_strPWD
  373. '------------------------------------------------------------------
  374. Function ServeAppleTalkVisibleValues
  375. %>
  376. <input type="hidden" name="txtConfirmPwd" value="<%=F_txtConfirmPWD%>">
  377. <input type="hidden" name="txtSetPwd" value="<%=F_txtPWD%>">
  378. <input type="hidden" name="txtUsersAllowed" value="<%=F_txtUsersAllowed%>">
  379. <%
  380. End Function
  381. '------------------------------------------------------------------
  382. 'Function name: ServeAppleTalkHiddenValues()
  383. 'Description: Serve Hidden Values
  384. 'Input Variables: None
  385. 'Output Variables: None
  386. 'Global Variables: In : G_(*)
  387. '------------------------------------------------------------------
  388. Function ServeAppleTalkHiddenValues
  389. %>
  390. <input type="hidden" name="hdnradMaxiAllowedAppleTalk" value="<%=G_radMaxiUsersAllowedAppleTalk%>">
  391. <input type="hidden" name="hdnradNoOfUsersAllowedAppleTalk" value="<%=G_radNoOfUsersAllowedAppleTalk%>">
  392. <input type="hidden" name="hdnchkReadOnly" value="<%=G_chkReadOnly%>">
  393. <%
  394. End Function
  395. %>