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.

629 lines
22 KiB

  1. <%@ Language=VBScript %>
  2. <% Option Explicit %>
  3. <%
  4. '-------------------------------------------------------------------------
  5. ' quota_new.asp: create a new quota entry
  6. '
  7. ' Copyright (c) Microsoft Corporation. All rights reserved.
  8. '
  9. ' Date Description
  10. ' 17-Jan-01 Creation date
  11. ' 15-Mar-01 Ported to 2.0
  12. '-------------------------------------------------------------------------
  13. %>
  14. <!-- #include virtual = "/admin/inc_framework.asp" -->
  15. <!-- #include virtual = "/admin/inc_accountsgroups.asp" -->
  16. <!-- #include file="loc_quotas.asp" -->
  17. <!-- #include file="inc_quotas.asp" -->
  18. <%
  19. '-------------------------------------------------------------------------
  20. ' Global Variables
  21. '-------------------------------------------------------------------------
  22. Dim G_nRadioChecked ' to set radioButton values - contains 1 or 2 only
  23. Dim SOURCE_FILE ' the source file name used while Tracing
  24. SOURCE_FILE = SA_GetScriptFileName()
  25. '-------------------------------------------------------------------------
  26. ' Global Form Variables
  27. '-------------------------------------------------------------------------
  28. Dim F_strVolName ' Volume Name
  29. Dim F_strUsername ' to user Name
  30. Dim F_LimitSize ' Disk limit size - textBox value
  31. Dim F_LimitUnits ' Disk limit size units - comboBox value
  32. Dim F_ThresholdSize ' the warning level set for the user - textBox value
  33. Dim F_ThresholdUnits ' the units for the warning level set - comboBox Value
  34. Dim F_strUserList ' List of users to be displayed
  35. Dim F_strDisplayUserName ' to display user name in the TextBox
  36. '======================================================
  37. ' Entry point
  38. '======================================================
  39. Dim page
  40. Dim aPageTitle(2)
  41. aPageTitle(0) = L_BROWSERCAPTION_QUOTANEW_TEXT
  42. aPageTitle(1) = L_TASKTITLE_NEW_TEXT
  43. '
  44. ' Create a Property Page
  45. Call SA_CreatePage( aPageTitle, "", PT_PROPERTY, page )
  46. '
  47. ' Serve the page
  48. Call SA_ShowPage( page )
  49. '======================================================
  50. ' Web Framework Event Handlers
  51. '======================================================
  52. '---------------------------------------------------------------------
  53. ' Function name: OnInitPage
  54. ' Description: Called to signal first time processing for this page
  55. ' Input Variables: Out: PageIn
  56. ' Out: EventArg
  57. ' Output Variables: None
  58. ' Return Values: TRUE to indicate initialization was successful.
  59. ' FALSE to indicate errors. Returning FALSE will
  60. ' cause the page to be abandoned.
  61. ' Global Variables: None
  62. ' Functions Called: getValuesForDefault
  63. '
  64. ' Get ALL the initial form field settings
  65. '---------------------------------------------------------------------
  66. Public Function OnInitPage(ByRef PageIn, ByRef EventArg)
  67. Call SA_TraceOut(SOURCE_FILE, "OnInitPage")
  68. F_strVolName = Request.QueryString("driveletter")
  69. Call SA_MungeURL(mstrReturnURL,"driveletter",F_strVolName)
  70. ' Call the function to get the default values
  71. OnInitPage = getValuesForDefault ' True /False
  72. End Function
  73. '---------------------------------------------------------------------
  74. ' Function name: OnServePropertyPage
  75. ' Description: Called when the page needs to be served
  76. ' Input Variables: Out: PageIn
  77. ' Out: EventArg
  78. ' Output Variables: None
  79. ' Return Values: TRUE to indicate no problems occured. FALSE to
  80. ' indicate errors. Returning FALSE will cause the
  81. ' page to be abandoned.
  82. ' Global Variables: In: F_(*) - Form field values
  83. ' In: L_(*) - Text display strings
  84. ' In: G_nRadioChecked - radio to be selected
  85. ' Functions Called: (i)ServeCommonJavaScript, (ii)setUnits
  86. ' (iii)ServetoListBox
  87. '
  88. ' The UI is served here.
  89. '---------------------------------------------------------------------
  90. Public Function OnServePropertyPage(ByRef PageIn, ByRef EventArg)
  91. Call SA_TraceOut(SOURCE_FILE, "OnServePropertyPage")
  92. '
  93. ' Emit Javascript functions required by Web Framework
  94. Call ServeCommonJavaScript()
  95. %>
  96. <table border="0" cellspacing="0" cellpadding="0">
  97. <tr>
  98. <td colspan="2" nowrap class="TasksBody"><%=L_DESCRIPTION_NEW_TEXT%>
  99. </td>
  100. </tr>
  101. <tr>
  102. <td class="TasksBody" valign="top" width="40%">
  103. <select class="FormField" style="width:180px" size="6" name="lstDomainMembers" onFocus="DisableUser()" onClick="ClearErr()" >
  104. <%
  105. ServetoListBox(F_strUserList)
  106. %>
  107. </select>
  108. </td>
  109. <td valign="top" nowrap class="TasksBody">
  110. <input class="FormField" type="text" size="15" onKeyPress="ClearErr()" value="<%=Server.HTMLEncode(F_strDisplayUserName)%>" name ="txtDomainUser" onClick="Deselect()">
  111. </td>
  112. </tr>
  113. </table>
  114. </table>
  115. <hr>
  116. <table border="0" cellspacing="0" cellpadding="0">
  117. <tr>
  118. <td nowrap colspan="2" class="TasksBody">
  119. <input type="radio" class="FormRadioButton" name="donotlimit" value="1" <%If G_nRadioChecked = 1 Then Response.Write "CHECKED" Else Response.write "UNCHECKED" End If %> onClick="JavaScript:DisableWarnLevel(warndisksize,warndisksizeunits); DisableLimitLevel(limitdisksize,limitdisksizeunits)">&nbsp;<% =L_DONOTLIMITDISKUSAGE_TEXT %>
  120. </td>
  121. </tr>
  122. <tr>
  123. <td nowrap class="TasksBody">
  124. <input type="radio" class="FormRadioButton" name="donotlimit" value="2" <% If G_nRadioChecked = 2 Then Response.Write "CHECKED" Else Response.write "UNCHECKED" End If %> onClick="JavaScript:EnableWarnDiskSpace(warndisksize, warndisksizeunits); EnableLimitDiskSpace(limitdisksize,limitdisksizeunits) ">&nbsp;<% =L_SETLIMITDISKSPACE_TEXT %>
  125. </td>
  126. <td class="TasksBody" nowrap>
  127. <input type="text" name="limitdisksize" value="<% =server.HTMLEncode(SA_EscapeQuotes(F_LimitSize)) %>" class="FormField" size="14" maxlength = "11" onFocus="this.select()" onKeyPress="allownumbers( this );ClearErr()" onChange="validatedisklimit( this, document.frmTask.limitdisksizeunits.value)" >
  128. <select name="limitdisksizeunits" size="1" class="FormField" onChange="ClearErr();validatedisklimit( document.frmTask.limitdisksize, this.value)">
  129. <% setUnits(F_LimitUnits) %>
  130. </select>
  131. </td>
  132. </tr>
  133. <tr>
  134. <td nowrap class="TasksBody">
  135. &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<% =L_SETWARNINGLEVEL_TEXT %>
  136. </td>
  137. <td class="TasksBody" nowrap>
  138. <input type="text" name="warndisksize" class="FormField" value="<% =server.HTMLEncode(SA_EscapeQuotes(F_ThresholdSize)) %>" size="14" maxlength = "11" onFocus="this.select()" onKeyPress="allownumbers( this );ClearErr()" onChange="validatedisklimit( this, document.frmTask.warndisksizeunits.value)" >
  139. <select name="warndisksizeunits" size="1" class="FormField" onChange="ClearErr();validatedisklimit(document.frmTask.warndisksize, this.value)">
  140. <% setUnits(F_ThresholdUnits) %>
  141. </select>
  142. </td>
  143. </tr>
  144. </table>
  145. </table>
  146. <input name="user" type="hidden" value="<% =F_strUsername %>">
  147. <input name="volume" type="hidden" value="<% =F_strVolName %>">
  148. <%
  149. OnServePropertyPage = TRUE
  150. End Function
  151. '---------------------------------------------------------------------
  152. ' Function name: OnPostBackPage
  153. ' Description: Called to signal that the page has been posted-back
  154. ' Input Variables: Out: PageIn
  155. ' Out: EventArg
  156. ' Output Variables: None
  157. ' Return Values: TRUE to indicate success. FALSE to indicate errors.
  158. ' Returning FALSE will cause the page to be abandoned.
  159. ' Global Variables: Out: F_(*) - Form values
  160. ' Out: G_nRadioChecked - the selected radio value
  161. '
  162. ' Collect the form data vales.
  163. '---------------------------------------------------------------------
  164. Public Function OnPostBackPage(ByRef PageIn, ByRef EventArg)
  165. Call SA_TraceOut(SOURCE_FILE, "OnPostBackPage")
  166. Dim objService ' for the WMI Connection
  167. ' get user and volume values
  168. F_strVolName = Request.Form("volume")
  169. F_strUsername = Request.Form("user")
  170. ' get the display user name
  171. F_strDisplayUserName = Request.Form("txtDomainUser")
  172. ' get the radiButton selected
  173. G_nRadioChecked = Request.Form("donotlimit")
  174. ' get the Limit Size value and its units
  175. F_LimitSize = Request.Form("limitdisksize")
  176. F_LimitUnits = Request.Form("limitdisksizeunits")
  177. ' get the warning limit and its units
  178. F_ThresholdSize = Request.Form("warndisksize")
  179. F_ThresholdUnits = Request.Form("warndisksizeunits")
  180. ' get the wmi connection
  181. Set objService = GetWMIConnection(CONST_WMI_WIN32_NAMESPACE)
  182. ' get the List of users to be displayed in the ListBox
  183. F_strUserList =getLocalUsersListEx(objService , 2)'Calling only users
  184. ' clean up
  185. Set objService = Nothing
  186. If Len(Trim(F_strVolName)) = 0 OR Len(Trim(F_strUsername)) = 0 Then
  187. ' user or volume info not found. Cannot process further.
  188. OnPostBackPage = FALSE
  189. Else
  190. OnPostBackPage = TRUE
  191. End If
  192. End Function
  193. '---------------------------------------------------------------------
  194. ' Function name: OnSubmitPage
  195. ' Description: To process the submit request
  196. ' Input Variables: Out: PageIn
  197. ' Out: EventArg
  198. ' Output Variables: None
  199. ' Return Values: TRUE if the submit was successful, FALSE to indicate error(s).
  200. ' Returning FALSE will cause the page to be served again using
  201. ' a call to OnServePropertyPage.
  202. ' Returning FALSE will display error message.
  203. ' Global Variables: None
  204. ' Functions Called: updateValuesForUser
  205. '
  206. ' Updates the Quota Values for the given volume
  207. '---------------------------------------------------------------------
  208. Public Function OnSubmitPage(ByRef PageIn, ByRef EventArg)
  209. Call SA_TraceOut(SOURCE_FILE, "OnSubmitPage")
  210. ' Call updateValuesForUser to update the values for the user quota
  211. ' If any error occurs,the error message is set in the function.
  212. OnSubmitPage = updateValuesForUser ' returns True/False
  213. End Function
  214. '---------------------------------------------------------------------
  215. ' Function name: OnClosePage
  216. ' Description: to perform clean-up processing
  217. ' Input Variables: Out: PageIn
  218. ' Out: EventArg
  219. ' Output Variables: None
  220. ' Return Values: TRUE to allow close, FALSE to prevent close. Returning FALSE
  221. ' will result in a call to OnServePropertyPage.
  222. ' Global Variables: None
  223. '
  224. ' Called when the page is about to be closed.
  225. '---------------------------------------------------------------------
  226. Public Function OnClosePage(ByRef PageIn, ByRef EventArg)
  227. Call SA_TraceOut(SOURCE_FILE, "OnClosePage")
  228. ' no processing required here. Return True
  229. OnClosePage = TRUE
  230. End Function
  231. '======================================================
  232. ' Private Functions
  233. '======================================================
  234. '---------------------------------------------------------------------
  235. ' Function name: ServeCommonJavaScript
  236. ' Description: Serve JavaScript that is required for this page type
  237. ' Input Variables: None
  238. ' Output Variables: None
  239. ' Return Values: None
  240. ' Global Variables: L_(*) - Error messages displayed on the client side
  241. '
  242. ' This contains the Client-Side script required for the page.
  243. '---------------------------------------------------------------------
  244. Function ServeCommonJavaScript()
  245. %>
  246. <script language="JavaScript" src="<%=m_VirtualRoot%>inc_global.js">
  247. </script>
  248. <script language="JavaScript" src="inc_quotas.js">
  249. </script>
  250. <script language="JavaScript">
  251. //
  252. // Microsoft Server Appliance Web Framework Support Functions
  253. // Copyright (c) Microsoft Corporation. All rights reserved.
  254. //
  255. // to perform first time initialization.
  256. function Init()
  257. {
  258. // enable cancel in case of any server side error
  259. EnableCancel() ;
  260. if ( document.frmTask.donotlimit[0].checked )
  261. {
  262. document.frmTask.warndisksize.disabled = true;
  263. document.frmTask.limitdisksize.disabled = true;
  264. document.frmTask.warndisksizeunits.disabled = true;
  265. document.frmTask.limitdisksizeunits.disabled = true;
  266. if(document.frmTask.txtDomainUser.value.length > 0)
  267. {
  268. selectFocus(document.frmTask.txtDomainUser);
  269. }
  270. }
  271. else
  272. {
  273. if ( document.frmTask.donotlimit[1].checked )
  274. {
  275. if(document.frmTask.txtDomainUser.value.length > 0)
  276. {
  277. selectFocus(document.frmTask.txtDomainUser);
  278. }
  279. }
  280. else
  281. {
  282. // disable all except cancel button
  283. DisableOK() ;
  284. document.frmTask.donotlimit[0].disabled = true;
  285. document.frmTask.donotlimit[1].disabled = true;
  286. document.frmTask.warndisksize.disabled = true;
  287. document.frmTask.limitdisksize.disabled = true;
  288. document.frmTask.warndisksizeunits.disabled = true;
  289. document.frmTask.limitdisksizeunits.disabled = true;
  290. }
  291. }
  292. }
  293. // to validate user input. Returning false will cause the submit to abort
  294. // Returns: True if the page is OK, false if error(s) exist.
  295. function ValidatePage()
  296. {
  297. var objlimitSize = document.frmTask.limitdisksize ;
  298. var objwarnSize = document.frmTask.warndisksize ;
  299. var objlimitUnits = document.frmTask.limitdisksizeunits ;
  300. var objwarnUnits = document.frmTask.warndisksizeunits ;
  301. var strUserName = document.frmTask.txtDomainUser.value;
  302. var objListDomainMembers = document.frmTask.lstDomainMembers ;
  303. if ( ( objListDomainMembers.selectedIndex == -1 ) && ( Trim(strUserName) == "" ) )
  304. {
  305. SA_DisplayErr('<% = Server.HTMLEncode(SA_EscapeQuotes(L_USERNOTSELECTED_ERRORMESSAGE)) %>' );
  306. selectFocus(document.frmTask.txtDomainUser);
  307. return false;
  308. }
  309. if (objListDomainMembers.selectedIndex == -1 )
  310. {
  311. //Checking for the domain\user format
  312. if(!(strUserName.match( /[^(\\| )]{1,}\\[^(\\| )]{1,}/ ) ))
  313. {
  314. SA_DisplayErr('<% =Server.HTMLEncode(SA_EscapeQuotes(L_INVALIDFORMAT_ERRORMESSAGE)) %>');
  315. document.frmTask.onkeypress = ClearErr;
  316. selectFocus(document.frmTask.txtDomainUser);
  317. return false;
  318. }
  319. }
  320. if ( objListDomainMembers.selectedIndex != -1 )
  321. {
  322. strUserName= objListDomainMembers.options[objListDomainMembers.selectedIndex].value;
  323. }
  324. document.frmTask.user.value = strUserName;
  325. if ( document.frmTask.donotlimit[1].checked )
  326. {
  327. // validate the limit size
  328. if(!isSizeValidDataType(objlimitSize.value) )
  329. {
  330. SA_DisplayErr('<% =Server.HTMLEncode(SA_EscapeQuotes(L_INVALIDDATATYPE_ERRORMESSAGE))%>' );
  331. document.frmTask.onkeypress = ClearErr;
  332. selectFocus( objlimitSize );
  333. return false;
  334. }
  335. // validate the limit size and its units
  336. if (!checkSizeAndUnits(objlimitSize.value, objlimitUnits.value) )
  337. {
  338. SA_DisplayErr('<%=Server.HTMLEncode(SA_EscapeQuotes(L_SIZEOUTOFBOUND_ERRORMESSAGE))%>');
  339. document.frmTask.onkeypress = ClearErr;
  340. selectFocus( objlimitSize );
  341. return false;
  342. }
  343. // validate the warning limit value
  344. if(!isSizeValidDataType(objwarnSize.value) )
  345. {
  346. DisplayErr('<% =Server.HTMLEncode(SA_EscapeQuotes(L_INVALIDDATATYPE_ERRORMESSAGE))%>' );
  347. document.frmTask.onkeypress = ClearErr;
  348. selectFocus(objwarnSize);
  349. return false;
  350. }
  351. // validate the warning limit value and its units
  352. if (!checkSizeAndUnits(objwarnSize.value, objwarnUnits.value) )
  353. {
  354. SA_DisplayErr('<%=Server.HTMLEncode(SA_EscapeQuotes(L_SIZEOUTOFBOUND_ERRORMESSAGE))%>');
  355. document.frmTask.onkeypress = ClearErr;
  356. selectFocus( objwarnSize );
  357. return false;
  358. }
  359. // verify the warning level. Must be less than limit.
  360. if(isWarningMoreThanLimit(objlimitSize,objlimitUnits,objwarnSize,objwarnUnits))
  361. {
  362. SA_DisplayErr('<%=Server.HTMLEncode(SA_EscapeQuotes(L_WARNING_MORETHAN_LIMIT_ERRORMESSAGE))%>');
  363. document.frmTask.onkeypress = ClearErr;
  364. selectFocus( objwarnSize );
  365. return false;
  366. }
  367. }
  368. // if the Limit values are Less than 1 KB, set them to 1 KB
  369. validatedisklimit(objlimitSize, objlimitUnits.value);
  370. validatedisklimit(objwarnSize, objwarnUnits.value);
  371. return true;
  372. }
  373. // to modify hidden form fields
  374. function SetData()
  375. {
  376. // no updations required here
  377. }
  378. //Function to deselect
  379. function Deselect()
  380. {
  381. document.frmTask.lstDomainMembers.selectedIndex = -1;
  382. }
  383. function DisableUser()
  384. {
  385. document.frmTask.txtDomainUser.value="";
  386. }
  387. </script>
  388. <%
  389. End Function
  390. '---------------------------------------------------------------------
  391. ' Procedure Name: getValuesForDefault
  392. ' Description: gets the Default Quota entry values
  393. ' Input Variables: None
  394. ' Output Variables: None
  395. ' Returns: None
  396. ' Global Variables: In: F_strVolName
  397. ' Out: F_ThresholdSize
  398. ' Out: F_ThresholdUnits
  399. ' Out: F_LimitSize
  400. ' Out: F_LimitUnits
  401. ' Out: F_strUserList
  402. ' Out: G_nRadioChecked
  403. ' Functions Called:
  404. ' (i)getQuotaLimitRadioForDefault (iv)getLimitSizeForDefault
  405. ' (ii)getThresholdSizeForDefault (v)getLimitUnitsForDefault
  406. ' (iii)getThresholdSizeUnitsForDefault (vi)getLocalUsersOnlyList
  407. '
  408. ' For the new user display the default quota values as initial values.
  409. '---------------------------------------------------------------------
  410. Function getValuesForDefault
  411. On Error Resume Next
  412. Err.Clear
  413. Dim objQuotas ' the quota object
  414. Dim objService ' for WMI Connection
  415. F_strDisplayUserName = ""
  416. F_strUserName = ""
  417. ' get the wmi connection
  418. Set objService=GetWMIConnection(CONST_WMI_WIN32_NAMESPACE)
  419. ' get the List of users to be displayed in the ListBox
  420. F_strUserList =getLocalUsersListEx(objService , 2)'Calling only users
  421. Set objService = Nothing ' clean up
  422. ' create the quota object and initialize for the required Volume
  423. Set objQuotas = CreateObject("Microsoft.DiskQuota.1")
  424. objQuotas.Initialize F_strVolName & "\", 1
  425. If Err.number <> 0 Then
  426. ' cannot proceed. Display failure page.
  427. Call SA_ServeFailurePage(L_OBJECTNOTCREATED_ERRORMESSAGE)
  428. End If
  429. ' get the radioButton value to be selected - 1 or 2 only
  430. G_nRadioChecked = getQuotaLimitRadioForDefault(objQuotas)
  431. ' Compute Default Disk Limit and its units
  432. F_LimitSize = getLimitSizeForDefault(objQuotas)
  433. F_LimitUnits = getLimitUnitsForDefault(objQuotas)
  434. ' Compute Default Warning Limit and its units
  435. F_ThresholdSize = getThresholdSizeForDefault(objQuotas)
  436. F_ThresholdUnits = getThresholdSizeUnitsForDefault(objQuotas)
  437. If Err.number <> 0 Then
  438. ' error
  439. getValuesForDefault = False
  440. Else
  441. getValuesForDefault = True
  442. End If
  443. ' clean up
  444. Set objQuotas = Nothing
  445. End Function
  446. '---------------------------------------------------------------------
  447. ' Procedure Name: updateValuesForUser
  448. ' Description: Set the quota values for the given user
  449. ' Input Variables: None
  450. ' Output Variables: None
  451. ' Returns: True - if the values are updated
  452. ' False - if values could not be updated
  453. ' Global Variables: In: F_strVolName
  454. ' In: F_strUsername
  455. ' Out: F_ThresholdSize
  456. ' Out: F_ThresholdUnits
  457. ' Out: F_LimitSize
  458. ' Out: F_LimitUnits
  459. ' In: G_nRadioChecked
  460. ' In: L_(*)
  461. ' Functions Called: (i) setUserQuotaLimit
  462. ' (ii) setUserThreshold
  463. '---------------------------------------------------------------------
  464. Function updateValuesForUser
  465. On Error Resume Next
  466. Err.Clear
  467. Dim objQuotas ' the quota object
  468. Dim objUser ' the quota user object
  469. Dim blnUserFound ' to verify if the user is found
  470. Dim L_DUPLICATEUSER_ERRORMESSAGE
  471. Dim L_QUOTAUSERNOTFOUND_ERRORMESSAGE
  472. Dim arrVarReplacementStrings(1)
  473. ' create the quota object and initialize for the required Volume
  474. Set objQuotas = CreateObject("Microsoft.DiskQuota.1")
  475. objQuotas.Initialize F_strVolName & "\", 1
  476. objQuotas.UserNameResolution = 1 'wait for names
  477. If Err.number <> 0 Then
  478. ' cannot proceed. Display failure page.
  479. Call SA_ServeFailurePage(L_OBJECTNOTCREATED_ERRORMESSAGE)
  480. End If
  481. ' check if user already has an entry
  482. blnUserFound = False
  483. For Each objUser In objQuotas
  484. If LCase(Trim(F_strUsername)) = LCase(Trim(objUser.LogonName)) Then
  485. ' user found
  486. blnUserFound = True
  487. End If
  488. Next
  489. If blnUserFound Then
  490. ' duplicate entry
  491. arrVarReplacementStrings(0) = F_strUsername
  492. L_DUPLICATEUSER_ERRORMESSAGE = SA_GetLocString("diskmsg.dll", "C03E0068", arrVarReplacementStrings)
  493. SA_SetErrMsg L_DUPLICATEUSER_ERRORMESSAGE
  494. updateValuesForUser = False
  495. Exit Function
  496. End If
  497. ' add the new user entry
  498. Set objUser = objQuotas.AddUser( F_strUserName )
  499. ' If user is invalid, an error will occur
  500. If Err.number <> 0 Then
  501. arrVarReplacementStrings(0) = F_strUsername
  502. L_QUOTAUSERNOTFOUND_ERRORMESSAGE = SA_GetLocString("diskmsg.dll", "C03E0069", arrVarReplacementStrings)
  503. SA_SetErrMsg L_QUOTAUSERNOTFOUND_ERRORMESSAGE & "( " & Hex(Err.number) & " )"
  504. Err.Clear ' stop error propagation
  505. updateValuesForUser = False
  506. Exit Function
  507. End If
  508. ' verify the radio option checked
  509. If CInt(G_nRadioChecked) = CInt(CONST_RADIO_DONOT_LIMIT_DISKUSAGE) Then
  510. ' "Do not limit disk usage is selected. Set values of DiskLimit
  511. ' and WarningLimit to "No Limit"
  512. F_LimitSize = CONST_NO_LIMIT
  513. F_ThresholdSize = CONST_NO_LIMIT
  514. End If
  515. ' set the quota limit by calling the function
  516. If NOT setUserQuotaLimit(objUser, F_LimitSize, F_LimitUnits) then
  517. ' quota limit could not be set. Display error message and exit
  518. SA_SetErrMsg L_MAXLIMITNOTSET_ERRORMESSAGE & " ( " & Hex(Err.number) & " )"
  519. Err.Clear ' stop the error propagation
  520. updateValuesForUser = False
  521. Exit Function
  522. End If
  523. ' set the warning limit for the user, by calling the function
  524. If NOT setUserThreshold(objUser, F_ThresholdSize, F_ThresholdUnits) Then
  525. ' warning limit could not be set. display error and exit
  526. SA_SetErrMsg L_WARNINGLIMITNOTSET_ERRORMESSAGE & " ( " & Hex(Err.number) & " )"
  527. Err.Clear ' stop the error propagation
  528. updateValuesForUser = False
  529. Exit Function
  530. End If
  531. ' all values set. return true
  532. updateValuesForUser = True
  533. ' clean up
  534. Set objUser = Nothing
  535. Set objQuotas = Nothing
  536. End Function
  537. %>