public void GroupInfo_Load(object o, System.EventArgs e) { if (PageMode.Equals(PageModes.Group) && CurrentGroup.CanViewHomePage(Usr.Current, CurrentGroupUsr)) { InfoNameLabel.Text = CurrentGroup.FriendlyName; if (CurrentGroup.TotalModerators == 0) { InfoModsPh.Visible = false; } else if (CurrentGroup.TotalModerators <= 10) { //draw the moderators usernames in InfoModsPh InfoModsPh.Controls.Clear(); InfoModsPh.Controls.Add(new LiteralControl("<p>")); InfoModsPh.Controls.Add(new LiteralControl(CurrentGroup.TotalModerators == 1 ? "The moderator is " : "The moderators are ")); Query q = new Query(); q.NoLock = true; q.Columns = Usr.LinkColumns; q.TableElement = Group.UsrMemberJoin; q.QueryCondition = CurrentGroup.ModeratorQ; q.OrderBy = new OrderBy(new OrderBy(GroupUsr.Columns.Owner, OrderBy.OrderDirection.Descending), new OrderBy(GroupUsr.Columns.MemberAdmin, OrderBy.OrderDirection.Descending), new OrderBy(GroupUsr.Columns.NewsAdmin, OrderBy.OrderDirection.Descending), new OrderBy(Usr.Columns.NickName)); UsrSet us = new UsrSet(q); us.WriteUsrLinks(InfoModsPh); InfoModsPh.Controls.Add(new LiteralControl(".</p>")); } else { InfoModsPh.Controls.Clear(); InfoModsPh.Controls.Add(new LiteralControl("<p>This group has <a href=\"" + CurrentGroup.UrlApp("members", "moderators", "") + "\">" + CurrentGroup.TotalModerators.ToString() + " moderator" + (CurrentGroup.TotalModerators == 1 ? "" : "s") + "</a>.</p>")); } if (CurrentGroup.Restriction.Equals(Group.RestrictionEnum.None)) PrivacySpan.InnerText = "It's an open group (anyone may join)"; else PrivacySpan.InnerText = "It's a restricted group (new members must be accepted)"; if (CurrentGroup.PrivateChat) PrivacySpan.InnerText += ", and the group chat is members-only."; else PrivacySpan.InnerText += "."; InfoMembersLinkPh.Controls.Clear(); if (CurrentGroup.TotalMembers > 0 && CurrentGroup.PrivateMemberList && !CurrentGroup.CanMember(Usr.Current, CurrentGroupUsr)) InfoMembersLinkPh.Controls.Add(new LiteralControl(CurrentGroup.TotalMembers + " member" + (CurrentGroup.TotalMembers == 1 ? "" : "s"))); else if (CurrentGroup.TotalMembers > 0) InfoMembersLinkPh.Controls.Add(new LiteralControl("<a href=\"" + CurrentGroup.UrlApp("members", "new", "") + "\">" + CurrentGroup.TotalMembers + " member" + (CurrentGroup.TotalMembers == 1 ? "" : "s") + "</a>")); else InfoMembersLinkPh.Controls.Add(new LiteralControl("no members")); InfoLeaveButton.Attributes["onclick"] = "if (confirm('Are you sure you want to exit this group?')){__doPostBack('" + InfoLeaveButton.UniqueID + "','');return false;}else{return false;};"; InfoJoinLoggedOutP.Visible = false;// Usr.Current == null; InfoJoinP.Visible = Usr.Current == null || Group.AllowJoinRequest(Usr.Current, CurrentGroup, CurrentGroupUsr); InfoLeaveP.Visible = Group.AllowExit(Usr.Current, CurrentGroup, CurrentGroupUsr); InfoInviteRejectButton.Visible = Group.AllowInviteReject(Usr.Current, CurrentGroupUsr); InfoFavouriteGroupButtonPanel.Visible = CurrentGroupUsr != null && CurrentGroupUsr.IsMember; CommentAlertButtonPanel.Visible = CurrentGroup.IsRead(Usr.Current, CurrentGroupUsr); if (CurrentGroupUsr == null) InfoMemberStatusP.InnerHtml = "You're not a member of this group."; else if (CurrentGroupUsr.Status.Equals(GroupUsr.StatusEnum.Barred)) InfoMemberStatusP.InnerHtml = "You've been barred from this group. Please contact a <a href=\"" + CurrentGroup.UrlApp("members", "moderators", "") + "\">group moderator</a> for more information."; else if (CurrentGroupUsr.Status.Equals(GroupUsr.StatusEnum.RequestRejected)) InfoMemberStatusP.InnerHtml = "Your request to join this group has been denied. Please contact a <a href=\"" + CurrentGroup.UrlApp("members", "moderators", "") + "\">group moderator</a> for more information."; else if (CurrentGroupUsr.Status.Equals(GroupUsr.StatusEnum.Exited)) InfoMemberStatusP.InnerHtml = "You've exited this group."; else if (CurrentGroupUsr.Status.Equals(GroupUsr.StatusEnum.Invite)) InfoMemberStatusP.InnerHtml = "You've been invited to join this group."; else if (CurrentGroupUsr.Status.Equals(GroupUsr.StatusEnum.Member)) InfoMemberStatusP.InnerHtml = "You're a member of this group. <a href=\"" + CurrentGroup.UrlApp("admin") + "\">Group options</a>."; else if (CurrentGroupUsr.Status.Equals(GroupUsr.StatusEnum.Request)) InfoMemberStatusP.InnerHtml = "You've requested to join this group. Please wait until a moderator reviews your application. If you still see this message after a few days, contact a <a href=\"" + CurrentGroup.UrlApp("members", "moderators", "") + "\">group moderator</a> for more information."; else if (CurrentGroupUsr.Status.Equals(GroupUsr.StatusEnum.Recommend)) InfoMemberStatusP.InnerHtml = "You're not a member of this group."; else if (CurrentGroupUsr.Status.Equals(GroupUsr.StatusEnum.RecommendRejected)) InfoMemberStatusP.InnerHtml = "You're not a member of this group."; else if (CurrentGroupUsr.Status.Equals(GroupUsr.StatusEnum.InviteRejected)) InfoMemberStatusP.InnerHtml = "You've previously been invited to this group, but you turned down the invitation."; if (CurrentGroupUsr != null && CurrentGroupUsr.Status.Equals(GroupUsr.StatusEnum.Member)) { if (Usr.Current.HasBuddiesFull) InfoInviteP.InnerHtml = "<a href=\"" + CurrentGroup.UrlApp("admin", "mode", "buddies") + "\">Invite your buddies</a> or "; InfoInviteP.InnerHtml += "<a href=\"" + CurrentGroup.UrlApp("admin", "mode", "email") + "\">" + (Usr.Current.HasBuddiesFull ? "i" : "I") + "nvite people by email</a>."; } else InfoInviteP.Visible = false; if (CurrentGroupUsr != null && CurrentGroupUsr.Status.Equals(GroupUsr.StatusEnum.Member) && CurrentGroupUsr.Owner && CurrentGroup.LongDescriptionHtml.Length > 0) { InfoMemberStatusP.InnerHtml += " <a href=\"" + CurrentGroup.UrlApp("edit", "mode", "details") + "\">Edit</a>."; } } }
private void LoadGroupJoin() { GroupHomePageLink.NavigateUrl = CurrentGroup.Url(); this.CancelButton.Visible = !IsInList; if (Mode.Equals(Modes.Join)) { if (CurrentGroup.PrivateGroupPage) { if (!CurrentGroup.CanViewHomePage(Usr.Current, CurrentGroupUsr)) { //throw new DSIUserFriendlyException("This group is private - you must be invited before joining."); CanJoinPanel.Visible = false; CanNotJoinPanel.Visible = true; CanNotJoinP.InnerHtml = "This group is private - you must be invited before joining."; return; } } //ContainerPage.SetPageTitle("Join the " + CurrentGroup.FriendlyName + " group"); JoinTitle.InnerText = "Join the " + CurrentGroup.FriendlyName + " group"; if (CurrentGroup.Brand != null && CurrentGroup.Brand.HasPic) JoinPicImg.Src = CurrentGroup.Brand.PicPath; else if (CurrentGroup.HasPic) JoinPicImg.Src = CurrentGroup.PicPath; else JoinPicCell.Visible = false; JoinPicAnchor.HRef = CurrentGroup.Url(); JoinNameLabel.Text = CurrentGroup.FriendlyName; if (CurrentGroup.TotalModerators == 0) { JoinModsPh.Visible = false; } else if (CurrentGroup.TotalModerators <= 10) { //draw the moderators usernames in InfoModsPh JoinModsPh.Controls.Clear(); JoinModsPh.Controls.Add(new LiteralControl(CurrentGroup.TotalModerators == 1 ? "The moderator is " : "The moderators are ")); Query q = new Query(); q.NoLock = true; q.Columns = Usr.LinkColumns; q.TableElement = Group.UsrMemberJoin; q.QueryCondition = CurrentGroup.ModeratorQ; q.OrderBy = new OrderBy(new OrderBy(GroupUsr.Columns.Owner, OrderBy.OrderDirection.Descending), new OrderBy(GroupUsr.Columns.MemberAdmin, OrderBy.OrderDirection.Descending), new OrderBy(GroupUsr.Columns.NewsAdmin, OrderBy.OrderDirection.Descending), new OrderBy(Usr.Columns.NickName)); UsrSet us = new UsrSet(q); us.WriteUsrLinks(JoinModsPh); JoinModsPh.Controls.Add(new LiteralControl(".")); } else { JoinModsPh.Controls.Clear(); JoinModsPh.Controls.Add(new LiteralControl("This group has <a href=\"" + CurrentGroup.UrlApp("members", "moderators", "") + "\">" + CurrentGroup.TotalModerators.ToString() + " moderator" + (CurrentGroup.TotalModerators == 1 ? "" : "s") + "</a>.")); } if (CurrentGroup.Restriction.Equals(Group.RestrictionEnum.None)) PrivacySpan.InnerText = "It's an open group - anyone may join."; else PrivacySpan.InnerText = "It's a restricted group - new members must be accepted."; JoinMembersLinkPh.Controls.Clear(); if (CurrentGroup.TotalMembers > 0 && CurrentGroup.PrivateMemberList && !CurrentGroup.CanMember(Usr.Current, CurrentGroupUsr)) JoinMembersLinkPh.Controls.Add(new LiteralControl(CurrentGroup.TotalMembers + " member" + (CurrentGroup.TotalMembers == 1 ? "" : "s"))); else if (CurrentGroup.TotalMembers > 0) JoinMembersLinkPh.Controls.Add(new LiteralControl("<a href=\"" + CurrentGroup.UrlApp("members") + "\">" + CurrentGroup.TotalMembers + " member" + (CurrentGroup.TotalMembers == 1 ? "" : "s") + "</a>")); else JoinMembersLinkPh.Controls.Add(new LiteralControl("no members")); JoinDescP.InnerText = CurrentGroup.Description; JoinRulesPanel.Visible = CurrentGroup.PostingRules.Trim().Length > 0; if (CurrentGroup.PostingRules.Trim().Length > 0) JoinRulesP.InnerHtml = CurrentGroup.PostingRules.Trim().Replace("\n", "<br>"); JoinWatchRadio.Attributes["onclick"] = "document.getElementById('" + GroupJoinEyeImage.ClientID + "').src='/gfx/icon-eye-up.png';"; JoinIgnoreRadio.Attributes["onclick"] = "document.getElementById('" + GroupJoinEyeImage.ClientID + "').src='/gfx/icon-eye-dn.png';"; GroupJoinEyeImage.Attributes["onclick"] = "if (document.getElementById('" + JoinWatchRadio.ClientID + "').checked){document.getElementById('" + JoinWatchRadio.ClientID + "').checked=false;document.getElementById('" + JoinIgnoreRadio.ClientID + "').checked=true;document.getElementById('" + GroupJoinEyeImage.ClientID + "').src='/gfx/icon-eye-dn.png';}else{document.getElementById('" + JoinWatchRadio.ClientID + "').checked=true;document.getElementById('" + JoinIgnoreRadio.ClientID + "').checked=false;document.getElementById('" + GroupJoinEyeImage.ClientID + "').src='/gfx/icon-eye-up.png';};"; if (JoinIgnoreRadio.Checked) GroupJoinEyeImage.Src = "/gfx/icon-eye-dn.png"; else if (JoinWatchRadio.Checked) GroupJoinEyeImage.Src = "/gfx/icon-eye-up.png"; if (Usr.Current == null || Group.AllowJoinRequest(Usr.Current, CurrentGroup, CurrentGroupUsr)) { CanJoinPanel.Visible = true; CanNotJoinPanel.Visible = false; } else { CanJoinPanel.Visible = false; CanNotJoinPanel.Visible = true; if (CurrentGroupUsr == null) CanNotJoinP.InnerHtml = "You're not a member of this group."; else if (CurrentGroupUsr.Status.Equals(GroupUsr.StatusEnum.Barred)) CanNotJoinP.InnerHtml = "You've been barred from this group. Please contact a <a href=\"" + CurrentGroup.UrlApp("members", "moderators", "") + "\">group moderator</a> for more information."; else if (CurrentGroupUsr.Status.Equals(GroupUsr.StatusEnum.RequestRejected)) CanNotJoinP.InnerHtml = "Your request to join this group has been denied. Please contact a <a href=\"" + CurrentGroup.UrlApp("members", "moderators", "") + "\">group moderator</a> for more information."; else if (CurrentGroupUsr.Status.Equals(GroupUsr.StatusEnum.Exited)) CanNotJoinP.InnerHtml = "You've exited this group."; else if (CurrentGroupUsr.Status.Equals(GroupUsr.StatusEnum.Invite)) CanNotJoinP.InnerHtml = "You've been invited to join this group."; else if (CurrentGroupUsr.Status.Equals(GroupUsr.StatusEnum.Member)) { CanNotJoinP.InnerHtml = "You're a member of this group. <a href=\"" + CurrentGroup.UrlApp("admin") + "\">Group options</a>."; JoinTitle.InnerText = "You're a member of the " + CurrentGroup.FriendlyName + " group"; GroupHomePageP.Visible = true; } else if (CurrentGroupUsr.Status.Equals(GroupUsr.StatusEnum.Request)) CanNotJoinP.InnerHtml = "You've requested to join this group. Please wait until a moderator reviews your application. If you still see this message after a few days, contact a <a href=\"" + CurrentGroup.UrlApp("members", "moderators", "") + "\">group moderator</a> for more information."; else if (CurrentGroupUsr.Status.Equals(GroupUsr.StatusEnum.Recommend)) CanNotJoinP.InnerHtml = "You're not a member of this group."; else if (CurrentGroupUsr.Status.Equals(GroupUsr.StatusEnum.RecommendRejected)) CanNotJoinP.InnerHtml = "You're not a member of this group."; else if (CurrentGroupUsr.Status.Equals(GroupUsr.StatusEnum.InviteRejected)) CanNotJoinP.InnerHtml = "You've previously been invited to this group, but you turned down the invitation."; } } }