Beispiel #1
0
 /// <summary>
 /// Sets the wiki settings entity
 /// </summary>
 private void SetWikiSettings()
 {
     // if (wikiSettings == null) {
     SettingBO wikiController = new SettingBO(this.UoW);
     this.mWikiSettingsObject = wikiController.GetByModuleID(this.ModuleId);
     if (this.mWikiSettingsObject == null)
     {
         this.mWikiSettingsObject = new Setting();
         this.mWikiSettingsObject.ContentEditorRoles = "UseDNNSettings";
     }
     //// }
 }
        /// <summary>
        /// Handles the Load event of the CtrlPage control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs" /> instance containing the event
        /// data.</param>
        private void CtrlPage_Load(object sender, System.EventArgs e)
        {
            try
            {
                using (UnitOfWork currentUnitOfWork = new UnitOfWork())
                {
                    var settingsBo = new SettingBO(currentUnitOfWork);

                    ////Put user code to initialize the page here

                    this.ContentEditors.DataTextField = "Text";
                    this.ContentEditors.DataValueField = "Text";
                    this.NotifyRoles.DataTextField = "Text";
                    this.NotifyRoles.DataValueField = "Text";

                    if (this.mSettingsModel == null)
                    {
                        this.mSettingsModel = settingsBo.GetByModuleID(this.ModuleId);
                        if (this.mSettingsModel == null)
                        {
                            this.mSettingsModel = new Setting();
                            this.mSettingsModel.ModuleId = -1;
                            this.mSettingsModel.ContentEditorRoles = StrUseDNNSettings;
                        }
                    }

                    if (!this.IsPostBack)
                    {
                        this.DNNSecurityChk.Checked = this.mSettingsModel.ContentEditorRoles.Equals(StrUseDNNSettings);
                        this.AllowPageComments.Checked = this.mSettingsModel.AllowDiscussions;
                        this.AllowPageRatings.Checked = this.mSettingsModel.AllowRatings;
                        this.DefaultCommentsMode.Checked = this.mSettingsModel.DefaultDiscussionMode == true;
                        this.DefaultRatingMode.Checked = this.mSettingsModel.DefaultRatingMode == true;
                        this.NotifyMethodUserComments.Checked = this.mSettingsModel.CommentNotifyUsers == true;

                        this.NotifyMethodCustomRoles.Checked =
                            !(!string.IsNullOrWhiteSpace(this.mSettingsModel.CommentNotifyRoles) &&
                            this.mSettingsModel.CommentNotifyRoles.StartsWith("UseDNNSettings;") &&
                            !string.IsNullOrWhiteSpace(this.mSettingsModel.CommentNotifyRoles));

                        if (this.NotifyMethodCustomRoles.Checked && !string.IsNullOrWhiteSpace(this.mSettingsModel.CommentNotifyRoles))
                        {
                            this.NotifyMethodEditRoles.Checked = this.mSettingsModel.CommentNotifyRoles.Contains(";Edit");
                            this.NotifyMethodViewRoles.Checked = this.mSettingsModel.CommentNotifyRoles.Contains(";View");
                        }

                        // Call the BindRights method
                        this.BindRights();

                        if (this.DNNSecurityChk.Checked == true)
                        {
                            this.ContentEditors.Visible = false;
                            this.WikiSecurity.Visible = false;
                        }
                        else
                        {
                            this.ContentEditors.Visible = true;
                            this.WikiSecurity.Visible = true;
                        }

                        if (this.AllowPageComments.Checked)
                        {
                            this.ActivateComments.Enabled = true;
                            this.DefaultCommentsMode.Enabled = true;
                        }
                        else
                        {
                            this.ActivateComments.Enabled = false;
                            this.ActivateComments.Checked = false;
                            this.DefaultCommentsMode.Enabled = false;
                            this.DefaultCommentsMode.Checked = false;
                        }

                        if (this.AllowPageRatings.Checked)
                        {
                            this.ActivateRatings.Enabled = true;
                            this.DefaultRatingMode.Enabled = true;
                        }
                        else
                        {
                            this.ActivateRatings.Enabled = false;
                            this.ActivateRatings.Checked = false;
                            this.DefaultRatingMode.Enabled = false;
                            this.DefaultRatingMode.Checked = false;
                        }

                        if (this.NotifyMethodCustomRoles.Checked)
                        {
                            this.NotifyRoles.Visible = true;
                            this.lblNotifyRoles.Visible = true;
                            this.NotifyMethodEditRoles.Enabled = false;
                            this.NotifyMethodViewRoles.Enabled = false;
                            this.NotifyMethodViewRoles.Checked = false;
                            this.NotifyMethodEditRoles.Checked = false;
                        }
                        else
                        {
                            this.NotifyMethodEditRoles.Enabled = true;
                            this.NotifyMethodViewRoles.Enabled = true;

                            this.NotifyRoles.Visible = false;
                            this.lblNotifyRoles.Visible = false;
                        }
                    }
                }
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }