using System; using System.Data; using System.Collections; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using CMS.CMSHelper; using CMS.GlobalHelper; using CMS.PortalControls; using CMS.SettingsProvider; public partial class CMSWebParts_Community_GroupRegistration : CMSAbstractWebPart { #region "Public properties" /// /// Gets or sets the value that indicates whether form should be hidden after successful registration. /// public bool HideFormAfterRegistration { get { return ValidationHelper.GetBoolean(GetValue("HideFormAfterRegistration"), false); } set { SetValue("HideFormAfterRegistration", value); } } /// /// Gets or sets text which should be displayed after successful registration. /// public string SuccessfullRegistrationText { get { return DataHelper.GetNotEmpty(GetValue("SuccessfullRegistrationText"), groupRegistrationElem.SuccessfullRegistrationText); } set { SetValue("SuccessfullRegistrationText", value); groupRegistrationElem.SuccessfullRegistrationText = value; } } /// /// Emails of admins capable of approving the group. /// public string SendWaitingForApprovalEmailTo { get { return ValidationHelper.GetString(GetValue("SendWaitingForApprovalEmailTo"), String.Empty); } set { SetValue("SendWaitingForApprovalEmailTo", value); groupRegistrationElem.SendWaitingForApprovalEmailTo = value; } } /// /// Gets or sets text which should be displayed after successful registration and waiting for approving. /// public string SuccessfullRegistrationWaitingForApprovalText { get { return ValidationHelper.GetString(GetValue("SuccessfullRegistrationWaitingForApprovalText"), groupRegistrationElem.SuccessfullRegistrationWaitingForApprovalText); } set { SetValue("SuccessfullRegistrationWaitingForApprovalText", value); groupRegistrationElem.SuccessfullRegistrationWaitingForApprovalText = value; } } /// /// If true, the group must be approved before it can be active. /// public bool CombineWithDefaultCulture { get { return ValidationHelper.GetBoolean(GetValue("CombineWithDefaultCulture"), false); } set { SetValue("CombineWithDefaultCulture", value); } } /// /// If true, the group must be approved before it can be active. /// public bool RequireApproval { get { return ValidationHelper.GetBoolean(GetValue("RequireApproval"), false); } set { SetValue("RequireApproval", value); } } /// /// Alias path of the document structure which will be copied as the group content. /// public string GroupTemplateSourceAliasPath { get { return ValidationHelper.GetString(GetValue("GroupTemplateSourceAliasPath"), ""); } set { SetValue("GroupTemplateSourceAliasPath", value); } } /// /// Alias where the group content will be created by copying the source template. /// public string GroupTemplateTargetAliasPath { get { return ValidationHelper.GetString(GetValue("GroupTemplateTargetAliasPath"), ""); } set { SetValue("GroupTemplateTargetAliasPath", value); } } /// /// Gets or sets the document url under which will be accessible the profile of newly created group. /// public string GroupProfileURLPath { get { return ValidationHelper.GetString(GetValue("GroupProfileURLPath"), ""); } set { SetValue("GroupProfileURLPath", value); } } /// /// Gets or sets the url, where is user redirected after registration. /// public string RedirectToURL { get { return ValidationHelper.GetString(GetValue("RedirectToURL"), ""); } set { SetValue("RedirectToURL", value); } } /// /// Gets or sets the label text of display name field. /// public string GroupNameLabelText { get { return DataHelper.GetNotEmpty(GetValue("GroupNameLabelText"), GetString("Groups.GroupName") + ResHelper.Colon); } set { SetValue("GroupNameLabelText", value); groupRegistrationElem.GroupNameLabelText = value; } } /// /// Indicates if group forum should be created. /// public bool CreateForum { get { return ValidationHelper.GetBoolean(GetValue("CreateForum"), true); } set { SetValue("CreateForum", value); groupRegistrationElem.CreateForum = value; } } /// /// Indicates if group media library should be created. /// public bool CreateMediaLibrary { get { return ValidationHelper.GetBoolean(GetValue("CreateMediaLibrary"), true); } set { SetValue("CreateMediaLibrary", value); groupRegistrationElem.CreateMediaLibrary = value; } } /// /// Indicates if search indexes should be created. /// public bool CreateSearchIndexes { get { return ValidationHelper.GetBoolean(GetValue("CreateSearchIndexes"), true); } set { SetValue("CreateSearchIndexes", value); groupRegistrationElem.CreateSearchIndexes = 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 { if (CMSContext.CurrentSite != null) { groupRegistrationElem.SiteID = CMSContext.CurrentSite.SiteID; } groupRegistrationElem.HideFormAfterRegistration = HideFormAfterRegistration; groupRegistrationElem.SuccessfullRegistrationText = SuccessfullRegistrationText; groupRegistrationElem.SuccessfullRegistrationWaitingForApprovalText = SuccessfullRegistrationWaitingForApprovalText; groupRegistrationElem.GroupNameLabelText = GroupNameLabelText; groupRegistrationElem.CombineWithDefaultCulture = CombineWithDefaultCulture; groupRegistrationElem.RequireApproval = RequireApproval; groupRegistrationElem.GroupTemplateSourceAliasPath = GroupTemplateSourceAliasPath; groupRegistrationElem.GroupTemplateTargetAliasPath = GroupTemplateTargetAliasPath; groupRegistrationElem.GroupProfileURLPath = GroupProfileURLPath; groupRegistrationElem.RedirectToURL = RedirectToURL; groupRegistrationElem.SendWaitingForApprovalEmailTo = SendWaitingForApprovalEmailTo; groupRegistrationElem.CreateForum = CreateForum; groupRegistrationElem.CreateMediaLibrary = CreateMediaLibrary; groupRegistrationElem.CreateSearchIndexes = CreateSearchIndexes; groupRegistrationElem.IsLiveSite = true; } } }