/// <summary> /// Reload data. /// </summary> public override void ReloadData() { requestedGroupId = ValidationHelper.GetInteger(ContextMenu.Parameter, 0); DataTable table = new DataTable(); table.Columns.Add("ActionIcon"); table.Columns.Add("ActionDisplayName"); table.Columns.Add("ActionScript"); // Add only if community is present if (CommunityPresent) { // Get resource strings prefix string resourcePrefix = ContextMenu.ResourcePrefix; // View group profile string profileUrl = ""; // Get group profile URL GeneralizedInfo infoObj = ModuleCommands.CommunityGetGroupInfo(requestedGroupId); if (infoObj != null) { profileUrl = ResolveUrl(CMSContext.GetUrl(ModuleCommands.CommunityGetGroupProfilePath(infoObj.ObjectCodeName, CMSContext.CurrentSiteName))); } table.Rows.Add(new object[] { "groupprofile.png", ResHelper.GetString(resourcePrefix + ".viewgroup|group.viewgroup"), "window.location.replace('" + profileUrl + "');" }); if (!currentUser.IsGroupMember(requestedGroupId)) { table.Rows.Add(new object[] { "jointhegroup.png", ResHelper.GetString(resourcePrefix + ".joingroup|group.joingroup"), !currentUser.IsPublic() ? "ContextJoinTheGroup(GetContextMenuParameter('" + ContextMenu.MenuID + "'))" : "ContextRedirectToSignInUrl()" }); } else { table.Rows.Add(new object[] { "leavethegroup.png", ResHelper.GetString(resourcePrefix + ".leavegroup|group.leavegroup"), !currentUser.IsPublic() ? "ContextLeaveTheGroup(GetContextMenuParameter('" + ContextMenu.MenuID + "'))" : "ContextRedirectToSignInUrl()" }); } if (infoObj != null) { // Display Manage the group link if user is logged as group administrator and user is visiting a group page if (currentUser.IsGroupAdministrator(requestedGroupId) || currentUser.IsGlobalAdministrator) { string managementUrl = ResolveUrl(TreePathUtils.GetUrl(ModuleCommands.CommunityGetGroupManagementPath(infoObj.ObjectCodeName, CMSContext.CurrentSiteName))); table.Rows.Add(new object[] { "managegroup.png", ResHelper.GetString(resourcePrefix + ".managegroup|group.managegroup"), !currentUser.IsPublic() ? " window.location.replace('" + managementUrl + "');" : "ContextRedirectToSignInUrl()" }); } } } // Add count column DataColumn countColumn = new DataColumn(); countColumn.ColumnName = "Count"; countColumn.DefaultValue = table.Rows.Count; table.Columns.Add(countColumn); repItem.DataSource = table; repItem.DataBind(); }