<% '------------------------------------------------------------------------- ' share_ftpprop.asp: Serves in modifying FTP share properties. ' ' Copyright (c) Microsoft Corporation. All rights reserved. ' ' Date Description ' 14 sep 2001 Creation Date. ' 17 Mar 2001 Modified Date '------------------------------------------------------------------------- '------------------------------------------------------------------------- 'Global Variables & Constants '------------------------------------------------------------------------- Const CONST_ACCESS_READ_ONLY = 1 ' wmi access flag for Read Only Const CONST_ACCESS_WRITE_ONLY = 2 ' wmi access flag for Write only Const CONST_CHECKBOX_SELECTED = "CHECKED" ' status for checkbox-CHECKED Const CONST_CHECKBOX_NOT_SELECTED = "" ' status for checkbox-NOT CHECKED 'FTP WMI Path Const CONST_FTPWMIPATH = "MSFTPSVC/1/ROOT/" '------------------------------------------------------------------------- 'Form Variables '------------------------------------------------------------------------- Dim F_strReadCheckStatus_FtpProp ' to set the Read CheckBox status Dim F_strWriteCheckStatus_FtpProp ' to set the Write CheckBox status Dim F_strLogVisitsCheckStatus_FtpProp ' to set the LogVisits CheckBox status Dim F_nAccessReadWrite_FtpProp ' to store the access value(0,1,2 or 3) Dim F_nLogVisits_FtpProp ' to store the log visit status(0 or 1) F_nAccessReadWrite_FtpProp = CONST_ACCESS_READ_ONLY ' allow read permission F_nLogVisits_FtpProp = CONST_ACCESS_WRITE_ONLY ' allow Log Visits %> <% '------------------------------------------------------------------------- ' SubRoutine: ServeFTPPage ' Description: Serves in displaying the page content ' Input Variables: None ' Output Variables: None ' Returns: None ' Global Variables: ' In: F_strReadCheckStatus_FtpProp - to set status of Read checkBox ' In: F_strWriteCheckStatus_FtpProp - to set status of Write checkBox ' In: F_strLogVisitsCheckStatus_FtpProp - to set status of LogVisits checkBox ' In: L_* - Localization content(form label text) '------------------------------------------------------------------------- Sub ServeFTPPage Err.Clear On Error Resume Next %>
<%=L_ALLOW_PERMISSIONS_LABEL_TEXT%>
> <%=L_READ_LABEL_TEXT%>
> <%=L_WRITE_LABEL_TEXT%>
<%=L_LOGVISITS_LABEL_TEXT%> >
<% Call ServeFTPHiddenValues End Sub '------------------------------------------------------------------------- ' SubRoutine: FTPOnPostBackPage ' Description: Serves in getting the values from the form. ' Input Variables: None ' Output Variables: None ' Returns: None ' Global Variables: ' Out: F_nAccessReadWrite_FtpProp - the access permissions ' (0,1,2 or 3 only) ' Out: F_nLogVisits_FtpProp - do we log the visits ? ' (0 or 1 only) ' Out: F_strReadCheckStatus_FtpProp - status of READ checkBox ' Out: F_strWriteCheckStatus_FtpProp - status of WRITE checkBox ' Out: F_strLogVisitsCheckStatus_FtpProp - status of LOGVISITS chkBox '------------------------------------------------------------------------- Sub FTPOnPostBackPage() Err.Clear On Error Resume Next ' get the values of the hidden variables from the form F_nAccessReadWrite_FtpProp = Request.Form("hdnintAccessReadWriteFtpProp") F_nLogVisits_FtpProp = Request.Form("hdnintLogVisitsFtpProp") Const CONST_LOGVISIT_INT= 1 ' If the share is not FTP and the checkBox is checked now, ' give the default values for the ftp share If NOT IsNumeric(F_nAccessReadWrite_FtpProp) Then F_nAccessReadWrite_FtpProp = CONST_ACCESS_READ_ONLY ' the log visits also will be empty. Initialize it also F_nLogVisits_FtpProp = CONST_LOGVISIT_INT End If ' initialize the status of CheckBoxes to "NOT CHECKED" F_strReadCheckStatus_FtpProp = CONST_CHECKBOX_NOT_SELECTED F_strWriteCheckStatus_FtpProp = CONST_CHECKBOX_NOT_SELECTED F_strLogVisitsCheckStatus_FtpProp = CONST_CHECKBOX_NOT_SELECTED ' convert to integer type F_nAccessReadWrite_FtpProp = CInt(F_nAccessReadWrite_FtpProp) F_nLogVisits_FtpProp = CInt(F_nLogVisits_FtpProp) ' ' set the status of "CheckBoxes" if the values are set ' ' if the Read access is given. ' perform an AND to verify if the value is set If (F_nAccessReadWrite_FtpProp AND CONST_ACCESS_READ_ONLY) Then F_strReadCheckStatus_FtpProp = CONST_CHECKBOX_SELECTED End If ' if the write access is given. ' perform an AND to verify if the value is set If (F_nAccessReadWrite_FtpProp AND CONST_ACCESS_WRITE_ONLY) Then F_strWriteCheckStatus_FtpProp = CONST_CHECKBOX_SELECTED End If ' if the "Log Visits" is checked. ' the 0 OR 1 is converted to Boolean and verified instead of comparision If CBool(F_nLogVisits_FtpProp) Then F_strLogVisitsCheckStatus_FtpProp = CONST_CHECKBOX_SELECTED End If End Sub '------------------------------------------------------------------------- ' SubRoutine: FTPOnInitPage ' Input Variables: None ' Output Variables: None ' Returns: None ' Global Variables: ' Out: F_nAccessReadWrite_FtpProp - the access permissions ' (0,1,2 or 3 only) ' Out: F_nLogVisits_FtpProp - do we log the visits ? ' (0 or 1 only) ' Out: F_strReadCheckStatus_FtpProp - status of READ checkBox ' Out: F_strWriteCheckStatus_FtpProp - status of WRITE checkBox ' Out: F_strLogVisitsCheckStatus_FtpProp - status of LOGVISITS chkBox '------------------------------------------------------------------------- Sub FTPOnInitPage() Err.Clear On Error Resume Next Dim objFTPShare ' to get the share object for which we need to get the properties from ' initialize the checkbox status for all checkboxes as "not checked" F_strReadCheckStatus_FtpProp = CONST_CHECKBOX_NOT_SELECTED F_strWriteCheckStatus_FtpProp = CONST_CHECKBOX_NOT_SELECTED F_strLogVisitsCheckStatus_FtpProp = CONST_CHECKBOX_NOT_SELECTED ' get the ftp share object from which we will get the properties Set objFTPShare = getFTPShareObject() ' get the access flags of the share F_nAccessReadWrite_FtpProp = CInt(objFTPShare.AccessFlags) ' if read flag is set, the Read checkBox must be checked ' perform an AND to verify if the value is set If (F_nAccessReadWrite_FtpProp AND CONST_ACCESS_READ_ONLY) Then F_strReadCheckStatus_FtpProp = CONST_CHECKBOX_SELECTED End If ' if write flag is set, the Write checkBox must be checked ' perform an AND to verify if the value is set If (F_nAccessReadWrite_FtpProp AND CONST_ACCESS_WRITE_ONLY) Then F_strWriteCheckStatus_FtpProp = CONST_CHECKBOX_SELECTED End If ' if "Do not log" flag is NOT set, ' the "Log visits" checkBox must be checked F_nLogVisits_FtpProp = 0 If NOT objFTPShare.DontLog Then F_nLogVisits_FtpProp = 1 F_strLogVisitsCheckStatus_FtpProp = CONST_CHECKBOX_SELECTED End If ' clean up Set objFTPShare = Nothing End Sub '------------------------------------------------------------------------- ' Function name: SetFTPshareProp() ' Description: Serves in setting the values of the ftp share ' Input Variables: None ' Output Variables: None ' Returns: TRUE if successful, else FALSE ' Global Variables: ' In: L_* - Localization content(form label text) ' In: F_nAccessReadWrite_FtpProp - the access permissions ' (0,1,2 or 3 only) ' In: F_nLogVisits_FtpProp - do we log the visits ? ' (0 or 1 only) '------------------------------------------------------------------------- Function SetFTPshareProp() On Error Resume Next Err.Clear Dim objFTPShare ' to get the share object for which we need to ' change properties ' get the FTP share object for which we need to set properties Set objFTPShare = getFTPShareObject() ' ' It is enough to set the boolean values(AccessRead and AccessWrite). ' The AccessFlags(integer) need not be set.(wmi takes care of it) ' if the Read CheckBox is checked, set the flag to TRUE, else FALSE If (F_nAccessReadWrite_FtpProp AND CONST_ACCESS_READ_ONLY) Then objFTPShare.AccessRead = True Else objFTPShare.AccessRead = False End If ' if the Write CheckBox is checked, set the flag to TRUE, else FALSE If (F_nAccessReadWrite_FtpProp AND CONST_ACCESS_WRITE_ONLY) Then objFTPShare.AccessWrite = True Else objFTPShare.AccessWrite = False End If ' bring the changes made to properties to effect objFTPShare.Put_ If Err.Number <> 0 Then ' the changes could not be PUT (system values could not be changed) SA_SetErrMsg L_FAILEDTOSETSHAREINFO_ERRORMESSAGE SetFTPshareProp = False Set objFTPShare = Nothing Exit Function End If ' clean up Set objFTPShare = Nothing 'Function call to set the Dont log property If SetDontLogProp(F_StrShareName, F_nLogVisits_FtpProp) Then SA_SetErrMsg L_LOG_VISITS_ERRORMESSAGE Exit Function SetFTPshareProp = False End If SetFTPshareProp = True End Function '------------------------------------------------------------------------- ' SubRoutine: ServeFTPHiddenValues ' Description: Serves in printing the hidden values of the form ' Input Variables: None ' Output Variables: None ' Returns: None ' Global Variables: ' In: F_nAccessReadWrite_FtpProp - the access permissions ' In: F_nLogVisits_FtpProp - do we log the visits ? '------------------------------------------------------------------------- Sub ServeFTPHiddenValues ' the hidden values to store the access flag value ' and the "Log Visits" value ' (Whether the checkBox must be checked OR NOT) %> <% End Sub %>