Пример #1
0
        /// <summary>
        ///   UpdateSettings saves the modified settings to the Database
        /// </summary>
        public override void UpdateSettings()
        {
            try
            {
                var htmlTextController = new HtmlTextController();

                // update replace token setting
                ModuleSettings.ReplaceTokens    = chkReplaceTokens.Checked;
                ModuleSettings.UseDecorate      = cbDecorate.Checked;
                ModuleSettings.SearchDescLength = int.Parse(txtSearchDescLength.Text);
                var repo = new HtmlModuleSettingsRepository();
                repo.SaveSettings(this.ModuleConfiguration, ModuleSettings);

                // disable module caching if token replace is enabled
                if (chkReplaceTokens.Checked)
                {
                    ModuleInfo module = ModuleController.Instance.GetModule(ModuleId, TabId, false);
                    if (module.CacheTime > 0)
                    {
                        module.CacheTime = 0;
                        ModuleController.Instance.UpdateModule(module);
                    }
                }

                // update workflow/version settings
                switch (rblApplyTo.SelectedValue)
                {
                case "Module":
                    htmlTextController.UpdateWorkflow(ModuleId, rblApplyTo.SelectedValue, Int32.Parse(cboWorkflow.SelectedValue), chkReplace.Checked);
                    break;

                case "Page":
                    htmlTextController.UpdateWorkflow(TabId, rblApplyTo.SelectedValue, Int32.Parse(cboWorkflow.SelectedValue), chkReplace.Checked);
                    break;

                case "Site":
                    htmlTextController.UpdateWorkflow(PortalId, rblApplyTo.SelectedValue, Int32.Parse(cboWorkflow.SelectedValue), chkReplace.Checked);
                    break;
                }

                //Module failed to load
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
        /// -----------------------------------------------------------------------------
        /// <summary>
        /// UpdateSettings saves the modified settings to the Database
        /// </summary>
        /// -----------------------------------------------------------------------------
        public override void UpdateSettings()
        {
            try
            {
                //update module settings
                ModuleSettings.ReplaceTokens = chkReplaceTokens.Checked;
                int searchLength = 0;
                if (int.TryParse(txtSearchDescLength.Text.Trim(), out searchLength))
                {
                    ModuleSettings.SearchDescLength = searchLength;
                }
                ModuleSettings.EnableFallback = bool.Parse(rblEnableFallback.SelectedValue);
                var repo = new HtmlModuleSettingsRepository();
                repo.SaveSettings(this.ModuleConfiguration, ModuleSettings);

                // disable module caching if token replace is enabled
                if (chkReplaceTokens.Checked)
                {
                    ModuleInfo module = ModuleController.Instance.GetModule(ModuleId, TabId, false);
                    if (module.CacheTime > 0)
                    {
                        module.CacheTime = 0;
                        ModuleController.Instance.UpdateModule(module);
                    }
                }

                // advance global settings
                if (HasAdminRights())
                {
                    var htmlTextController = new HtmlTextController();
                    htmlTextController.UpdateMaximumVersionHistorySetting(PortalId, Convert.ToInt32(ddlMaxVersion.SelectedValue));
                }
            }
            catch (Exception exc) //Module failed to load
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }