using System; using System.Data; using System.Collections; using System.Web; using System.Web.UI; using CMS.CMSHelper; using CMS.Community; using CMS.FormEngine; using CMS.GlobalHelper; using CMS.PortalControls; public partial class CMSWebParts_Community_Groups_GroupPublicProfile : CMSAbstractWebPart { #region "Public properties" /// /// Group name which profile should be displayed. /// public string GroupName { get { return ValidationHelper.GetString(GetValue("GroupName"), ""); } set { SetValue("GroupName", value); } } /// /// Name of the alternative form (ClassName.AlternativeFormName) /// Default value is Community.Group.DisplayProfile /// public string AlternativeFormName { get { return ValidationHelper.GetString(GetValue("AlternativeFormName"), "Community.Group.DisplayProfile"); } set { SetValue("AlternativeFormName", value); } } /// /// No profile text. /// public string NoProfileText { get { return ValidationHelper.GetString(GetValue("NoProfileText"), ""); } set { SetValue("NoProfileText", value); } } #endregion /// /// Content loaded event handler. /// public override void OnContentLoaded() { base.OnContentLoaded(); SetupControl(); } /// /// Reloads data. /// public override void ReloadData() { base.ReloadData(); SetupControl(); } /// /// Initializes the control properties. /// protected void SetupControl() { if (StopProcessing) { // Do nothing } else { // Get group info GroupInfo gi = null; if (((GroupName == "") || GroupName == GroupInfoProvider.CURRENT_GROUP) && (CommunityContext.CurrentGroup != null)) { gi = CommunityContext.CurrentGroup; } else { gi = GroupInfoProvider.GetGroupInfo(GroupName, CMSContext.CurrentSiteName); } if (gi != null) { // Get alternative form info AlternativeFormInfo afi = AlternativeFormInfoProvider.GetAlternativeFormInfo(AlternativeFormName); if (afi != null) { // Initialize data form formElem.Visible = true; formElem.Info = gi; formElem.AlternativeFormFullName = AlternativeFormName; formElem.BasicForm.SubmitButton.Visible = false; formElem.IsLiveSite = true; } else { lblError.Text = String.Format(GetString("altform.formdoesntexists"), AlternativeFormName); lblError.Visible = true; plcContent.Visible = false; } } else { // Hide data form formElem.Visible = false; lblNoProfile.Visible = true; lblNoProfile.Text = NoProfileText; } } } }