<% 'Include Security 'do not include security because this file is referenced from the client side Server.Execute("/admin/includes/popup_security.asp") %> <%'Include Data Connection%> <%'Include ADO constants include file for VBScript%> <% 'open data connection OpenConn() %> <%'Include Utility Scripts%> <% dim intGroupID dim strGroupName dim intGroupParentID dim intGroupParentID2 dim strGroupDescriptions dim datDateCreated dim strDateCreated strMode = Trim(Request.QueryString("mode")) intGroupID = Trim(Request.QueryString("id")) If Request.Form <> "" Then 'BEGIN: ADD/EDIT (DB TRANSACTION) dim strDel dim arContactsAndGroups dim intContactCounter dim strUserFeedback dim intSubscriberIsLive dim intNewParent 'get form elements values strMode = Request.Form("txtMode") 'If the group is other, hardcode it to the variable if Request.Form("txtGroupID") = "5" Then strGroupName = "Other" strGroupDescription = Request.Form("hidDescription") Else strGroupName = Request.Form("txtGroupName") strGroupDescription = Request.Form("txtDescription") End if datDateCreated = Request.Form("txtDate") 'strEmail = Request.Form("txtEmail") 'strOrganization = Request.Form("txtOrganization") intFormGroupID = Request.Form("txtGroupID") strDel = Request.Form("txtDelimiter") 'strSubscriberType = Request.Form("txtSubscriberType") strRefererURL = Request.Form("txtRefererURL") arContactsAndGroups = Split(Request.Form("txtSelected"), strDel) intOldOption = Request.Form("txtOldOption") intNewOption = Request.Form("optParent") intNewParent = intNewOption 'strRelevantEducation = Request.Form("txtRelevantEducation") 'intFirstDegreeObtainedCountryId = CInt(Request.Form("selCountry")) 'intContactTypeId = CInt(Request.Form("selContactType")) 'strEmploymentStatus = Request.Form("selEmploymentStatus") 'strStatementOfInterest = Request.Form("txtStatementOfInterest") 'intYearsOfProfessionalExperience = Request.Form("txtYearsOfProExperience") 'if the application is in 'edit' mode If LCase(strMode) = "edit" Then 'Check if the user has moved a group to another group if intNewOption <> intOldOption then 'Assign the new parent id to that given group Call ModifyParent(intFormGroupID, intNewOption) end if 'Modify the group Name and description Call ModifyGroupInfo(intFormGroupID, strGroupName, strGroupDescription) Call Delete_LookUpGroup(intFormGroupID) For intContactCounter = LBound(arContactsAndGroups) To UBound(arContactsAndGroups) 'if the array item is not an empty string then... If Trim(arContactsAndGroups(intContactCounter)) <> "" Then 'add a posting type record related to the subscriber Call Add_ContactsToGroup(arContactsAndGroups(intContactCounter), intFormGroupID) End If Next 'if the application is in 'add' mode else 'Add a new group intFormGroupID = AddGroupInfo(intNewParent, strGroupName, strGroupDescription, datDateCreated) Call Delete_LookUpGroup(intFormGroupID) For intContactCounter = LBound(arContactsAndGroups) To UBound(arContactsAndGroups) 'if the array item is not an empty string then... If Trim(arContactsAndGroups(intContactCounter)) <> "" Then 'add a Subscriber ID record related to the Group ID record Call Add_ContactsToGroup(arContactsAndGroups(intContactCounter), intFormGroupID) End If Next End If If Request.Form("txtImport") = "1" Then Response.Write("") Else Session("FeedbackMode") = LCase(strMode) Session("FeedbackError") = err.number Session("FeedbackModule") = "groups" Session("Referer") = strRefererURL Server.Execute("/admin/feedback.asp") End If else If LCase(strMode) = "edit" Then dim rsGetEditGroups set rsGetEditGroups = PopulateGroupEditForm(intGroupId) do while not rsGetEditGroups.EOF strGroupName = rsGetEditGroups("GROUP_NAME") strGroupDescriptions = rsGetEditGroups("GROUP_DESCRIPTIONS") intGroupParentID = rsGetEditGroups("GROUP_PARENT_ID") strDateCreated = rsGetEditGroups("GROUP_DATE_CREATED") rsGetEditGroups.MoveNext loop dim rsGetEditGroups2 set rsGetEditGroups2 = PopulateGroupEditForm(intGroupId) do while not rsGetEditGroups.EOF strGroupName2 = rsGetEditGroups("GROUP_NAME") strGroupDescriptions2 = rsGetEditGroups("GROUP_DESCRIPTIONS") intGroupParentID2 = rsGetEditGroups("GROUP_PARENT_ID") strDateCreated2 = rsGetEditGroups("GROUP_DATE_CREATED") rsGetEditGroups2.MoveNext loop end if %>
Group Name:
readonly<%end if%>>
Group Description:
Date Created:
<% 'check if the date is empty or null in order not to just have two "/" if strDateCreated <> "" OR Isnull(strDateCreated) = False then strDateCreated = SimpleDate(strDateCreated) else strDateCreated = "" end if %> " readonly>
<% 'If its not the All Groups group, show the option buttons if intGroupId <> "1" then dim rsGetParentGroups dim rsGetParentGroups2 dim rsGetTopLevel dim strChecked dim intOptCounter dim intOldGroupID dim intBelongsAllLevels dim strOptDisabled dim intOptDisabled intOptDisabled = 0 intCounter = 0 set rsGetParentGroups = GetGroups(0) set rsGetParentGroups2 = GetGroups(1) if trim(lcase(strmode)) = "edit" then%> The current Group is a child of:
<%do while not rsGetParentGroups.EOF if intGroupParentID = rsGetParentGroups("GROUP_ID") then intBelongsAllLevels = 0 strChecked = "checked" intOptDisabled = 1 intOldGroupID = rsGetParentGroups("GROUP_ID") else strChecked = "" intBelongsAllLevels = 1 end if%> " <%=strChecked%>>All Groups
<%'If its not the "Other group", show the options if intGroupId <> 5 then do while not rsGetParentGroups2.EOF if intBelongsAllLevels = 0 and CInt(intGroupId) = CInt(rsGetParentGroups2("GROUP_ID")) then strOptDisabled = "disabled" else strOptDisabled = "" end if if intGroupParentID = rsGetParentGroups2("GROUP_ID") and intBelongsAllLevels <> 0 then strChecked = "checked" intOldGroupID = rsGetParentGroups2("GROUP_ID") else strChecked = "" end if 'If the Group has children, make sure only the Groups not containing children are shown except for the Group 'where the subgroup is located if HasParent(intGroupID) <> 1 then%>      id="optParent" name="optParent" value="<%=rsGetParentGroups2("GROUP_ID")%>" <%=strChecked%>><%=rsGetParentGroups2("GROUP_NAME")%>
<%elseif HasParent(intGroupID) = 1 and HasChildren(intGroupID) = 1 then%>      id="optParent" name="optParent" value="<%=rsGetParentGroups2("GROUP_ID")%>" <%=strChecked%>><%=rsGetParentGroups2("GROUP_NAME")%>
<%End if rsGetParentGroups2.MoveNext%> <%Loop%> <%end if%> <%rsGetParentGroups.MoveNext%> <%Loop%> <%else%> Select the Parent Group:
<%do while not rsGetParentGroups.EOF%> ">All Groups
<%do while not rsGetParentGroups2.EOF%>     "><%=rsGetParentGroups2("GROUP_NAME")%>
<%rsGetParentGroups2.MoveNext%> <%Loop%> <%rsGetParentGroups.MoveNext%> <%Loop%> <%end if%> <%end if%>
Currently this group has <%=GetContactCountForOneGroup(intGroupId)%><%else%>0<%end if%>" readonly> contact(s).
<%if trim(lcase(strmode)) = "edit" then%> Contacts that do not
belong to this group: <%else%> Contacts that do not belong to this group: <%end if%>

<%if trim(lcase(strmode)) = "edit" then%> Contacts that belong
to this group: <%else%> Contacts that belong
to this group: <%end if%>
<%'Response.Write 'GetNonSelectedPostingTypeOptions(10)%>
Update<%Else%>Add<%End If%>">  
">
<% 'END: INPUT (ADD/EDIT) End If %> <% 'close data connection CloseConn() %>