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.

372 lines
13 KiB

  1. <%
  2. '-------------------------------------------------------------------------
  3. ' share_Appletalknew.asp: Serves to create Appletalk share
  4. '
  5. ' Copyright (c) Microsoft Corporation. All rights reserved.
  6. '
  7. ' Date Description
  8. ' 09-03-2001 Creation date
  9. ' 25-03-2001 Modified date
  10. '-------------------------------------------------------------------------
  11. '-------------------------------------------------------------------------
  12. 'Form Variables
  13. '-------------------------------------------------------------------------
  14. Dim F_txtUsersAllowed 'Number 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_radNoOfUserAllowedAppleTalk 'Access to specified number of users
  24. Dim G_radMaxUserAllowedAppleTalk 'Access to unlimited users
  25. '-------------------------------------------------------------------------
  26. ' Function name: ServeAppleTalkPage
  27. ' Description: Holds the Javascript and HTML code
  28. ' Input Variables: None
  29. ' Output Variables: None
  30. ' Return Values: True/False
  31. ' Global Variables: F_*,G_*,L_*
  32. '-------------------------------------------------------------------------
  33. Public Function ServeAppleTalkPage()
  34. Call SA_TraceOut("share_AppleTalkNew.asp","ServeAppleTalkPage")
  35. 'Emits common javascript functions
  36. Call ServeAppletalkCommonJavascript()
  37. 'Emits page UI for this page
  38. Call ServePageUI()
  39. ServeAppleTalkPage = true
  40. End Function
  41. '-------------------------------------------------------------------------
  42. ' Function name: AppleTalkOnPostBackPage
  43. ' Description: Serves in getting the values from previous form
  44. ' Input Variables: None
  45. ' Output Variables: None
  46. ' Return Values: None
  47. ' Global Variables: Out: G_radMaxUserAllowedAppleTalk
  48. ' Out: G_radNoOfUserAllowedAppleTalk
  49. ' Out: F_txtUsersAllowed
  50. ' Out: F_txtPWD
  51. ' Out: G_chkReadOnly
  52. '-------------------------------------------------------------------------
  53. Function AppleTalkOnPostBackPage()
  54. Call SA_TraceOut("share_AppleTalkNew.asp","AppleTalkOnPostBackPage")
  55. G_radMaxUserAllowedAppleTalk = Request.Form("hdnradMaxAllowedAppleTalk")
  56. G_radNoOfUserAllowedAppleTalk = Request.Form("hdnradNoOfUserAllowedAppleTalk")
  57. F_txtUsersAllowed = Request.Form("txtUsersAllowed")
  58. F_txtPWD = Request.Form("txtSetPwd")
  59. F_txtConfirmPWD = Request.Form("txtConfirmPwd")
  60. G_chkReadOnly = Request.Form("hdnchkReadOnly")
  61. End Function
  62. '-------------------------------------------------------------------------
  63. ' Function name: AppleTalkOnInitPage
  64. ' Description: Serves in getting the values from system
  65. ' Input Variables: None
  66. ' Output Variables: None
  67. ' Return Values: True/False
  68. ' Global Variables: None
  69. '-------------------------------------------------------------------------
  70. Function AppleTalkOnInitPage()
  71. Call SA_TraceOut("share_AppleTalkNew.asp","AppleTalkOnInitPage")
  72. G_radMaxUserAllowedAppleTalk = CONST_CHECKED
  73. G_radNoOfUserAllowedAppleTalk = CONST_UNCHECKED
  74. AppleTalkOnInitPage = True
  75. End Function
  76. '----------------------------------------------------------------------------
  77. 'Function name: SetShareforAppleTalk
  78. 'Description: Serves in updating existing Appletalk share
  79. 'Input Variables: strShareName holds appletalk share name
  80. ' strSharePath holds appletalk share path
  81. 'Output Variables: None
  82. 'Returns: True/False
  83. 'GlobalVariables: In : G_(*), F_*
  84. ' Out : L_(*)
  85. '----------------------------------------------------------------------------
  86. Function SetShareforAppleTalk(strShareName, strSharePath)
  87. Err.Clear
  88. On Error Resume Next
  89. Dim strQueryForCmd 'holds query to be executed at command
  90. Dim nReturnValue 'holds return value
  91. Call SA_TraceOut("share_AppleTalkNew.asp","SetShareforAppleTalk")
  92. SetShareforAppleTalk = False
  93. 'Forming the Command line Query
  94. strQueryForCmd = "VOLUME /SET /NAME:" & chr(34) & strShareName & chr(34)
  95. 'Check whether "Readonly" checkbox is checked and append the query with the READONLY switch
  96. If (UCase(G_chkReadOnly) = UCase("CHECKED")) Then
  97. strQueryForCmd = strQueryForCmd & " /READONLY:TRUE"
  98. Else
  99. strQueryForCmd = strQueryForCmd & " /READONLY:FALSE"
  100. End If
  101. 'Check whether password is entered and append the query with the PASSWORD switch
  102. strQueryForCmd = strQueryForCmd & " /PASSWORD:" & F_txtPWD
  103. 'Check whether Maxusers Option button is checked and append the query with the MAXUSERS switch
  104. If UCase(G_radMaxUserAllowedAppleTalk) = UCase("CHECKED") Then
  105. strQueryForCmd = strQueryForCmd & " /MAXUSERS:UNLIMITED"
  106. Else
  107. strQueryForCmd = strQueryForCmd & " /MAXUSERS:" & F_txtUsersAllowed
  108. End If
  109. 'Calling the UpdateAppleTalkShare present in inc_shares.asp to launch the
  110. 'command line Query
  111. nReturnValue = UpdateAppleTalkShare(strQueryForCmd)
  112. If nReturnValue = True Then
  113. SetShareforAppleTalk = True
  114. End If
  115. End Function
  116. '-------------------------------------------------------------------------
  117. 'Function: ServePageUI
  118. 'Description: Serves User Interface for the page
  119. 'Input Variables: None
  120. 'Output Variables: None
  121. 'Returns: None
  122. 'Global Variables: F_*,G_*,L_*
  123. '-------------------------------------------------------------------------
  124. Function ServePageUI()
  125. %>
  126. <table valign="middle" align="left" border="0" cellspacing="0" cellpadding="2" >
  127. <tr>
  128. <td class="TasksBody">
  129. <%=L_USERLIMIT_TEXT%>
  130. </td>
  131. </tr>
  132. <tr>
  133. <td class="TasksBody">
  134. <input name="radAllowUserlimit" type="radio" class="FormRadioButton" value="Y" checked tabindex="1" <%=G_radMaxUserAllowedAppleTalk%> OnClick ="MaximumAllowed()" >&nbsp;<%=L_MAXIMUMALLOWED_TEXT%>
  135. </td>
  136. </tr>
  137. <tr>
  138. <td align="left" class="TasksBody">
  139. <input name="radAllowUserlimit" type="radio" class="FormRadioButton" value="N" <%=G_radNoOfUserAllowedAppleTalk%>
  140. OnClick ="UsersAllowed()">&nbsp;<%=L_ALLOW_TEXT%>
  141. <input name="txtUsersAllowed" type="text" maxlength="6" class="FormField" value="<% = F_txtUsersAllowed %>" style="WIDTH=60px"<% =F_strAllowUsersDisable %> tabindex="2"
  142. OnKeypress="OnlyNumbers()" ><%=L_USERS_TEXT%>
  143. </td>
  144. </tr>
  145. <tr>
  146. <td class="TasksBody">
  147. &nbsp;
  148. </td>
  149. </tr>
  150. <tr>
  151. <td colspan=2 class="TasksBody">
  152. <%=L_APPLETALK_SECURITY_TXT%>
  153. </td>
  154. </tr>
  155. <tr>
  156. <td class="TasksBody">
  157. &nbsp;
  158. </td>
  159. </tr>
  160. <tr>
  161. <td class="TasksBody">
  162. <%=L_SETPWD_TXT%>
  163. </td>
  164. <td class="TasksBody">
  165. <input name="txtSetPwd" type="password" MAXLENGTH=8 class="FormField" value="<%=F_txtPWD%>">
  166. </td>
  167. </tr>
  168. <tr>
  169. <td class="TasksBody">
  170. <%=L_CONFIRMPWD_TXT%>
  171. </td>
  172. <td class="TasksBody">
  173. <input name="txtConfirmPwd" type="password" MAXLENGTH=8 class="FormField" value="<%=F_txtConfirmPWD%>">
  174. </td>
  175. </tr>
  176. <tr>
  177. <td class="TasksBody">
  178. &nbsp;
  179. </td>
  180. </tr>
  181. <tr>
  182. <td colspan="2" class="TasksBody">
  183. <input name="chkReadOnly" type="checkbox" class="FormCheckBox" <%=G_chkReadOnly%>
  184. onClick="ReadOnlyStatus()"><%=L_READ_TXT%>
  185. </td>
  186. </tr>
  187. </table>
  188. <%
  189. Call ServeAppleTalkHiddenValues() 'serve hidden value
  190. End Function
  191. '-------------------------------------------------------------------------
  192. 'Function: ServeAppletalkCommonJavascript
  193. 'Description: Serve common javascript that is required for this page type.
  194. 'Input Variables: None
  195. 'Output Variables: None
  196. 'Returns: None
  197. 'Global Variables: None
  198. '-------------------------------------------------------------------------
  199. Function ServeAppletalkCommonJavascript()
  200. Call SA_TraceOut("share_AppleTalkNew.asp","ServeAppletalkCommonJavascript")
  201. %>
  202. <script language="JavaScript" >
  203. // Set the initial form values
  204. function AppleTalkInit()
  205. {
  206. if (document.frmTask.radAllowUserlimit[0].checked == true)
  207. {
  208. document.frmTask.txtUsersAllowed.disabled = true;
  209. }
  210. }
  211. // Validate the page form values
  212. function AppleTalkValidatePage()
  213. {
  214. //Checking the maximum number of Users allowed
  215. if (((document.frmTask.txtUsersAllowed.value < 1) || (document.frmTask.txtUsersAllowed.value > 999999)) &&
  216. document.frmTask.radAllowUserlimit[1].checked == true)
  217. {
  218. DisplayErr("<%=Server.HTMLEncode(SA_EscapeQuotes(L_MAXIMUMALLOWED_ERRORMESSAGE))%>");
  219. document.frmTask.txtUsersAllowed.onkeypress=ClearErr;
  220. selectFocus(document.frmTask.txtUsersAllowed);
  221. return false;
  222. }
  223. //Checking if the Password and Confirm Password are same or not
  224. if (document.frmTask.txtSetPwd.value.toUpperCase() != document.frmTask.txtConfirmPwd.value.toUpperCase())
  225. {
  226. DisplayErr("<%=Server.HTMLEncode(SA_EscapeQuotes(L_CONFIRMPASSWORD_ERRORMESSAGE))%>");
  227. document.frmTask.txtConfirmPwd.onkeypress=ClearErr;
  228. selectFocus(document.frmTask.txtConfirmPwd);
  229. return false;
  230. }
  231. return true
  232. }
  233. //Function to update hidden variables
  234. function AppleTalkSetData()
  235. {
  236. }
  237. //Update the hidden variable when Maximum radio button is clicked
  238. function MaximumAllowed()
  239. {
  240. if (document.frmTask.radAllowUserlimit[0].checked == true)
  241. {
  242. document.frmTask.hdnradMaxAllowedAppleTalk.value = "CHECKED";
  243. document.frmTask.hdnradNoOfUserAllowedAppleTalk.value = "";
  244. document.frmTask.txtUsersAllowed.disabled = true;
  245. }
  246. }
  247. //Update the hidden variable when UsersAllowed radio button is clicked
  248. function UsersAllowed()
  249. {
  250. if (document.frmTask.radAllowUserlimit[1].checked == true)
  251. {
  252. document.frmTask.hdnradNoOfUserAllowedAppleTalk.value = "CHECKED";
  253. document.frmTask.hdnradMaxAllowedAppleTalk.value = "";
  254. document.frmTask.txtUsersAllowed.disabled = false;
  255. selectFocus(document.frmTask.txtUsersAllowed)
  256. }
  257. }
  258. //Update the hidden variable when Readonly checkbox is clicked
  259. function ReadOnlyStatus()
  260. {
  261. //Setting the hidden variable ReadOnly to either Checked or space
  262. if (document.frmTask.chkReadOnly.checked == true)
  263. {
  264. document.frmTask.hdnchkReadOnly.value = "CHECKED";
  265. }
  266. else
  267. {
  268. document.frmTask.hdnchkReadOnly.value = ""
  269. }
  270. }
  271. //Validation to allow only numbers as input for Users text box
  272. function OnlyNumbers()
  273. {
  274. // Clear any previous error messages
  275. ClearErr();
  276. if(window.event.keyCode == 13)
  277. return;
  278. if (!(window.event.keyCode >=48 && window.event.keyCode <=57))
  279. {
  280. window.event.keyCode = 0;
  281. }
  282. }
  283. </script>
  284. <%
  285. End Function
  286. '------------------------------------------------------------------
  287. 'Function name: ServeAppleTalkHiddenValues()
  288. 'Description: Serve Hidden Values
  289. 'Input Variables: None
  290. 'Output Variables: None
  291. 'Global Variables: In : G_(*)
  292. '------------------------------------------------------------------
  293. Function ServeAppleTalkHiddenValues
  294. %>
  295. <input type="hidden" name="hdnradMaxAllowedAppleTalk" value="<%=G_radMaxUserAllowedAppleTalk%>">
  296. <input type="hidden" name="hdnradNoOfUserAllowedAppleTalk" value="<%=G_radNoOfUserAllowedAppleTalk%>">
  297. <input type="hidden" name="hdnchkReadOnly" value="<%=G_chkReadOnly%>">
  298. <%
  299. End Function
  300. '---------------------------------------------------------------------
  301. 'Subroutine name: ServeAppleTalkVisibleValues
  302. 'Description: Serve Visible Values
  303. 'Input Variables: None
  304. 'Output Variables: None
  305. 'Global Variables: In : F_txtConfirmPWD, F_txtPWD, F_txtUsersAllowed
  306. '---------------------------------------------------------------------
  307. Sub ServeAppleTalkVisibleValues()
  308. Call SA_TraceOut("share_Appletalknew.asp","in ServeAppleTalkVisibleValues")
  309. %>
  310. <input type="hidden" name="txtConfirmPwd" value="<%=F_txtConfirmPWD%>">
  311. <input type="hidden" name="txtSetPwd" value="<%=F_txtPWD%>">
  312. <input type="hidden" name="txtUsersAllowed" value="<%=F_txtUsersAllowed%>">
  313. <!-- <input type="hidden" name="hdnradMaxAllowedAppleTalk" value="<%=G_radMaxUserAllowedAppleTalk%>" > -->
  314. <%
  315. End Sub
  316. %>