%@ Language=VBScript %> <% Option Explicit %> <% '------------------------------------------------------------------------- ' group_new.asp: Serves in creating a new group ' ' Copyright (c) Microsoft Corporation. All rights reserved. ' ' Date Description ' 16-Jan-2001 Creation Date '------------------------------------------------------------------------- %> <% '------------------------------------------------------------------------- ' Global Constants and Variables '------------------------------------------------------------------------- Dim G_objService 'To get WMI connection Dim G_CREDENTIAL_ERROR 'Error constant Dim rc 'Return value for CreatePage Dim page 'Variable that receives the output page object when 'creating a page Dim idTabGeneral 'Variable for General tab Dim idTabMembers 'Variable for Members tab Const GC_ERR_ACCESS_DENIED = &H80070005 '------------------------------------------------------------------------- 'Global Form Variables '------------------------------------------------------------------------- Dim F_strGroupName 'Group name Dim F_strGrpDescription 'Group description Dim F_strGroupMembers 'Members of the group Dim F_strCurrentGroupMembers 'Current members of the group Dim F_strCredentialID 'Credential ID Dim F_strCredentialPSW 'Credential Password Const N_ACCOUNTALREADYEXIST_ERRNO = &H800708B0 Const N_NONUNIQUEGROUPNAME_ERRNO = &H80070563 Const N_GROUPNOTPRESENT_ERRNO = &H8007056B '------------------------------------------------------------------------- 'Start of localization content '------------------------------------------------------------------------- Dim L_GROUP_NAME_TEXT Dim L_DESCRIPTION_TEXT Dim L_MEMBERS_TEXT Dim L_ADD_TEXT Dim L_REMOVE_TEXT Dim L_PAGETITLE_GROUPNEW_TEXT Dim L_ADDUSERORGROUP_TEXT Dim L_NOINPUTDATA_TEXT Dim L_TABPROPSHEET_TEXT Dim L_DOMAINUSERHELP_TEXT Dim L_MEMBERSPROMPT_TEXT Dim L_HOWTO_ADDDOMAINUSER_TEXT Dim L_HOWTO_ENTERCREDENTIALS_TEXT Dim L_USERNAME_PROMPT_TEXT Dim L_PASSWORD_PROMPT_TEXT Dim L_DUPLICATEMEMBER_ERRORMESSAGE Dim L_SELECTMEMBER_ERRORMESSAGE Dim L_NONUNIQUEGROUPNAME_ERRORMESSAGE Dim L_ACCOUNTALREADYEXIST_ERRORMESSAGE Dim L_GROUPNOTCREATED_ERRORMESSAGE Dim L_GROUPNOTPRESENT_ERRORMESSAGE Dim L_GROUPPROPERTIESNOTSET_ERRORMESSAGE Dim L_MEMBERADDITIONFAILED_ERRORMESSAGE Dim L_GROUPNAMENOTVALID_ERRORMESSAGE Dim L_INVALIDCHARACTER_ERRORMESSAGE Dim L_LOCALIZATIONOBJECTFAILED_ERRORMESSAGE Dim L_COMPUTERNAME_ERRORMESSAGE Dim L_DOMUSERINVALIDCHARACTER_ERRORMESSAGE Dim L_USERNOTFOUND_ERRORMESSAGE Dim L_INVALIDDOMAINUSER_ERRORMESSAGE Dim L_LONGGRPDESCRIPTION_ERRORMESSAGE Dim L_CREDENTIALS_ERRORMESSAGE Dim L_GENERAL_TEXT L_GENERAL_TEXT = GetLocString("usermsg.dll", "&H4031000A", "") L_HOWTO_ADDDOMAINUSER_TEXT = GetLocString("usermsg.dll", "403100C8", "") L_HOWTO_ENTERCREDENTIALS_TEXT = GetLocString("usermsg.dll", "403100C9", "") L_USERNAME_PROMPT_TEXT = GetLocString("usermsg.dll", "403100CA", "") L_PASSWORD_PROMPT_TEXT = GetLocString("usermsg.dll", "403100CB", "") L_GROUP_NAME_TEXT = GetLocString("usermsg.dll", "&H40310001", "") L_DESCRIPTION_TEXT = GetLocString("usermsg.dll", "&H40310030", "") L_MEMBERS_TEXT = GetLocString("usermsg.dll", "&H40310002", "") L_ADD_TEXT = GetLocString("usermsg.dll", "&H40310003", "") L_REMOVE_TEXT = GetLocString("usermsg.dll", "&H40310004", "") L_PAGETITLE_GROUPNEW_TEXT = GetLocString("usermsg.dll", "&H40310005", "") L_ADDUSERORGROUP_TEXT = GetLocString("usermsg.dll", "&H40310006", "") L_NOINPUTDATA_TEXT = GetLocString("usermsg.dll", "&H40310007", "") L_TABPROPSHEET_TEXT = GetLocString("usermsg.dll", "&H40310008", "") L_DOMAINUSERHELP_TEXT = GetLocString("usermsg.dll", "&H4031000B", "") L_MEMBERSPROMPT_TEXT = GetLocString("usermsg.dll", "&H40310042", "") 'Error Messages L_DUPLICATEMEMBER_ERRORMESSAGE = GetLocString("usermsg.dll", "&HC031000C", "") L_SELECTMEMBER_ERRORMESSAGE = GetLocString("usermsg.dll", "&HC031000D", "") L_NONUNIQUEGROUPNAME_ERRORMESSAGE = GetLocString("usermsg.dll", "&HC031000E", "") L_ACCOUNTALREADYEXIST_ERRORMESSAGE = GetLocString("usermsg.dll", "&HC031000F", "") L_GROUPNOTCREATED_ERRORMESSAGE = GetLocString("usermsg.dll", "&HC0310010", "") L_GROUPNOTPRESENT_ERRORMESSAGE = GetLocString("usermsg.dll", "&HC0310011", "") L_GROUPPROPERTIESNOTSET_ERRORMESSAGE = GetLocString("usermsg.dll", "&HC0310012", "") L_MEMBERADDITIONFAILED_ERRORMESSAGE = GetLocString("usermsg.dll", "&HC0310013", "") L_GROUPNAMENOTVALID_ERRORMESSAGE = GetLocString("usermsg.dll", "&HC0310014", "") L_INVALIDCHARACTER_ERRORMESSAGE = GetLocString("usermsg.dll", "&HC0310015", "") L_LOCALIZATIONOBJECTFAILED_ERRORMESSAGE = GetLocString("usermsg.dll", "&HC0310017", "") L_COMPUTERNAME_ERRORMESSAGE = GetLocString("usermsg.dll", "&HC0310018", "") L_DOMUSERINVALIDCHARACTER_ERRORMESSAGE = GetLocString("usermsg.dll", "&HC0310019", "") L_USERNOTFOUND_ERRORMESSAGE = GetLocString("usermsg.dll", "&HC031001B", "") L_INVALIDDOMAINUSER_ERRORMESSAGE = GetLocString("usermsg.dll", "&HC031001A", "") L_LONGGRPDESCRIPTION_ERRORMESSAGE = GetLocString("usermsg.dll", "&HC0310038", "") '------------------------------------------------------------------------- ' END of localization content '------------------------------------------------------------------------- ' 'Create a Tabbed Property Page rc = SA_CreatePage( L_PAGETITLE_GROUPNEW_TEXT , "", PT_TABBED, page ) ' 'Add two tabs rc = SA_AddTabPage( page, L_GENERAL_TEXT, idTabGeneral) rc = SA_AddTabPage( page, L_MEMBERS_TEXT, idTabMembers) ' 'Show the page rc = SA_ShowPage( page ) '--------------------------------------------------------------------- 'Function: OnInitPage() 'Description: Called to signal first time processing for this page. 'Input Variables: PageIn,EventArg 'Output Variables: None 'Returns: True/False 'Global Variables: G_objService,F_strGroupMembers,L_WMI_CONNECTIONFAIL_ERRORMESSAGE '--------------------------------------------------------------------- Public Function OnInitPage(ByRef PageIn, ByRef EventArg) OnInitPage = TRUE 'Connecting to the server Set G_objService=GetWMIConnection("Default") If Err.number <> 0 Then ServeFailurePage L_WMI_CONNECTIONFAIL_ERRORMESSAGE,1 End if 'Get the members of the domain & computer F_strGroupMembers = getLocalUsersList(G_objService) End Function '--------------------------------------------------------------------- 'Function: OnPostBackPage() 'Description: Called to signal that the page has been posted-back. 'Input Variables: PageIn,EventArg 'Output Variables: None 'Returns: True/False 'Global Variables: F_(*),G_objService,L_WMI_CONNECTIONFAIL_ERRORMESSAGE '--------------------------------------------------------------------- Public Function OnPostBackPage(ByRef PageIn, ByRef EventArg) F_strGroupName = Request.form("txtGroupName") F_strGrpDescription = Request.form("txaGrpDescription") F_strCurrentGroupMembers = Request.form("hdnGrpMembers") F_strCredentialID = Request.form("txtCredentialID") F_strCredentialPSW = Request.form("txtCredentialPSW") 'Connecting to the server Set G_objService=GetWMIConnection("Default") If Err.number <> 0 Then ServeFailurePage L_WMI_CONNECTIONFAIL_ERRORMESSAGE,1 End if F_strGroupMembers = getLocalUsersList(G_objService) OnPostBackPage = True End Function '--------------------------------------------------------------------- 'Function: OnServeTabbedPropertyPage() 'Description: Called when the content needs to send 'Input Variables: PageIn,EventArg,iTab,bIsVisible 'Output Variables: None 'Returns: True/False 'Global Variables: iTab '--------------------------------------------------------------------- Public Function OnServeTabbedPropertyPage(ByRef PageIn, _ ByVal iTab, _ ByVal bIsVisible, ByRef EventArg) ' ' Emit Web Framework required functions If ( iTab = 0 ) Then Call ServeCommonJavaScript() End If ' ' Emit content for the requested tab Select Case iTab Case idTabGeneral Call ServeTabGeneral(PageIn, bIsVisible) Case idTabMembers Call ServeTabMembers(PageIn, bIsVisible) Case Else SA_TraceOut "TEMPLAGE_TABBED", _ "OnServeTabbedPropertyPage unrecognized tab id: " + CStr(iTab) End Select OnServeTabbedPropertyPage = TRUE End Function '--------------------------------------------------------------------- 'Function: OnSubmitPage() 'Description: Called when the page has been submitted for processing. 'Input Variables: PageIn,EventArg 'Output Variables: None 'Returns: True/False 'Global Variables: None '--------------------------------------------------------------------- Public Function OnSubmitPage(ByRef PageIn, ByRef EventArg) 'Create new group on submitting the page OnSubmitPage = CreateNewGroup() End Function '--------------------------------------------------------------------- 'Function: OnClosePage() 'Description: Called when the page is about closed. 'Input Variables: PageIn,EventArg 'Output Variables: None 'Returns: True/False 'Global Variables: None '--------------------------------------------------------------------- Public Function OnClosePage(ByRef PageIn, ByRef EventArg) OnClosePage = TRUE End Function '------------------------------------------------------------------------- 'Function: ServeTabGeneral() 'Description: For displaying outputs HTML for tab 1 to the user 'Input Variables: PageIn,bIsVisible 'Output Variables: None 'Returns: gc_ERR_SUCCESS 'Global Variables: F_strGroupName,F_strGrpDescription,F_strCurrentGroupMembers,L_(*) '------------------------------------------------------------------------- Function ServeTabGeneral(ByRef PageIn, ByVal bIsVisible) If (bIsVisible) Then %>
<%=L_GROUP_NAME_TEXT %> | ||
<%=L_DESCRIPTION_TEXT %> |
<% CheckForSecureSite %> | |||||
  | |||||
<%=L_MEMBERSPROMPT_TEXT %> | <%=L_ADDUSERORGROUP_TEXT %> | ||||
|
<%=L_DOMAINUSERHELP_TEXT%>
<%=L_HOWTO_ADDDOMAINUSER_TEXT%>
<%=L_HOWTO_ENTERCREDENTIALS_TEXT%>
<%=Server.HTMLEncode(L_USERNAME_PROMPT_TEXT)%> | |
<%=Server.HTMLEncode(L_PASSWORD_PROMPT_TEXT)%> |