Exemple #1
0
        /// <summary>
        /// Update a setting for all language-versions of a module
        /// </summary>
        public static void UpdateModuleSettingForAllLanguages(int moduleId, string key, string value)
        {
            var moduleController = new ModuleController();

            // Find this module in other languages and update contentGroupGuid
            var originalModule = moduleController.GetModule(moduleId);
            var languages = LocaleController.Instance.GetLocales(originalModule.PortalID);

            if (!originalModule.IsDefaultLanguage && originalModule.DefaultLanguageModule != null)
                originalModule = originalModule.DefaultLanguageModule;

            foreach (var language in languages)
            {
                // Find module for given Culture
                var moduleByCulture = moduleController.GetModuleByCulture(originalModule.ModuleID, originalModule.TabID, originalModule.PortalID, language.Value);

                // Break if no module found
                if (moduleByCulture == null)
                    continue;

                if (value == null)
                    moduleController.DeleteModuleSetting(moduleByCulture.ModuleID, key);
                else
                    moduleController.UpdateModuleSetting(moduleByCulture.ModuleID, key, value);
            }
        }
 private void ClearModuleSettings(ModuleInfo objModule)
 {
     var moduleController = new ModuleController();
     if (objModule.ModuleDefinition.FriendlyName == "Text/HTML")
     {
         moduleController.DeleteModuleSetting(objModule.ModuleID, "WorkFlowID");
     }
 }
        /// <summary>
        /// Delete Settings only for this Module Instance
        /// </summary>
        private void DelModuleSettings()
        {
            this.moduleInstanceName = this.request.QueryString["minc"];
            string moduleKey = string.Format("DNNCKMI#{0}#INS#{1}#", this.ModuleId, this.moduleInstanceName);

            var moduleController = new ModuleController();

            foreach (PropertyInfo info in
                SettingsUtil.GetEditorConfigProperties())
            {
                moduleController.DeleteModuleSetting(this.ModuleId, string.Format("{0}{1}", moduleKey, info.Name));
            }

            moduleController.DeleteModuleSetting(
                this.ModuleId, string.Format("{0}{1}", moduleKey, SettingConstants.SKIN));
            moduleController.DeleteModuleSetting(
                this.ModuleId, string.Format("{0}{1}", moduleKey, SettingConstants.CODEMIRRORTHEME));
            moduleController.DeleteModuleSetting(
                this.ModuleId, string.Format("{0}{1}", moduleKey, SettingConstants.BROWSER));
            moduleController.DeleteModuleSetting(
                this.ModuleId, string.Format("{0}{1}", moduleKey, SettingConstants.FILELISTPAGESIZE));
            moduleController.DeleteModuleSetting(
                this.ModuleId, string.Format("{0}{1}", moduleKey, SettingConstants.FILELISTVIEWMODE));
            moduleController.DeleteModuleSetting(
                 this.ModuleId, string.Format("{0}{1}", moduleKey, SettingConstants.DEFAULTLINKMODE));
            moduleController.DeleteModuleSetting(
                this.ModuleId, string.Format("{0}{1}", moduleKey, SettingConstants.USEANCHORSELECTOR));
            moduleController.DeleteModuleSetting(
                this.ModuleId, string.Format("{0}{1}", moduleKey, SettingConstants.SHOWPAGELINKSTABFIRST));
            moduleController.DeleteModuleSetting(
               this.ModuleId, string.Format("{0}{1}", moduleKey, SettingConstants.OVERRIDEFILEONUPLOAD));
            moduleController.DeleteModuleSetting(
                this.ModuleId, string.Format("{0}{1}", moduleKey, SettingConstants.SUBDIRS));
            moduleController.DeleteModuleSetting(
                this.ModuleId, string.Format("{0}{1}", moduleKey, SettingConstants.BROWSERROOTDIRID));
            moduleController.DeleteModuleSetting(
                this.ModuleId, string.Format("{0}{1}", moduleKey, SettingConstants.UPLOADDIRID));
            moduleController.DeleteModuleSetting(
                this.ModuleId, string.Format("{0}{1}", moduleKey, SettingConstants.INJECTJS));
            moduleController.DeleteModuleSetting(
                this.ModuleId, string.Format("{0}{1}", moduleKey, SettingConstants.WIDTH));
            moduleController.DeleteModuleSetting(
                this.ModuleId, string.Format("{0}{1}", moduleKey, SettingConstants.HEIGHT));
            moduleController.DeleteModuleSetting(
                this.ModuleId, string.Format("{0}{1}", moduleKey, SettingConstants.BLANKTEXT));
            moduleController.DeleteModuleSetting(
                this.ModuleId, string.Format("{0}{1}", moduleKey, SettingConstants.STYLES));
            moduleController.DeleteModuleSetting(
                this.ModuleId, string.Format("{0}{1}", moduleKey, SettingConstants.CSS));
            moduleController.DeleteModuleSetting(
                this.ModuleId, string.Format("{0}{1}", moduleKey, SettingConstants.TEMPLATEFILES));
            moduleController.DeleteModuleSetting(
                this.ModuleId,
                string.Format("{0}{1}", moduleKey, SettingConstants.CUSTOMJSFILE));
            moduleController.DeleteModuleSetting(
                this.ModuleId, string.Format("{0}{1}", moduleKey, SettingConstants.CONFIG));
            moduleController.DeleteModuleSetting(
                this.ModuleId, string.Format("{0}{1}", moduleKey, SettingConstants.ROLES));
            moduleController.DeleteModuleSetting(
                this.ModuleId, string.Format("{0}{1}", moduleKey, SettingConstants.RESIZEHEIGHT));
            moduleController.DeleteModuleSetting(
                this.ModuleId, string.Format("{0}{1}", moduleKey, SettingConstants.RESIZEWIDTH));

            foreach (RoleInfo objRole in this.objRoleController.GetPortalRoles(this._portalSettings.PortalId))
            {
                moduleController.DeleteModuleSetting(
                    this.ModuleId, string.Format("{0}{2}#{1}", moduleKey, objRole.RoleID, SettingConstants.TOOLB));
            }

            moduleController.DeleteModuleSetting(
                this.ModuleId, string.Format("{0}{2}#{1}", moduleKey, "-1", SettingConstants.TOOLB));

            // Finally Clear Cache
            DataCache.ClearHostCache(true);
        }
        public override void UpdateSettings()
        {
            try
            {
                var moduleController = new ModuleController();

                //validate console width value
                var wdth = string.Empty;
                if ((ConsoleWidth.Text.Trim().Length > 0))
                {
                    try
                    {
                        wdth = Unit.Parse(ConsoleWidth.Text.Trim()).ToString();
                    }
                    catch (Exception exc)
                    {
                        Logger.Error(exc);

                        throw new Exception("ConsoleWidth value is invalid. Value must be numeric.");
                    }
                }
                if ((ParentTab.SelectedValue == string.Empty))
                {
                    moduleController.DeleteModuleSetting(ModuleId, "ParentTabID");
                }
                else
                {
                    moduleController.UpdateModuleSetting(ModuleId, "ParentTabID", ParentTab.SelectedValue);
                }
                moduleController.UpdateModuleSetting(ModuleId, "Mode", modeList.SelectedValue);
                moduleController.UpdateModuleSetting(ModuleId, "DefaultSize", DefaultSize.SelectedValue);
                moduleController.UpdateModuleSetting(ModuleId, "AllowSizeChange", AllowResize.Checked.ToString(CultureInfo.InvariantCulture));
                moduleController.UpdateModuleSetting(ModuleId, "DefaultView", DefaultView.SelectedValue);
                moduleController.UpdateModuleSetting(ModuleId, "AllowViewChange", AllowViewChange.Checked.ToString(CultureInfo.InvariantCulture));
                moduleController.UpdateModuleSetting(ModuleId, "ShowTooltip", ShowTooltip.Checked.ToString(CultureInfo.InvariantCulture));
                moduleController.UpdateModuleSetting(ModuleId, "IncludeParent", IncludeParent.Checked.ToString(CultureInfo.InvariantCulture));
                moduleController.UpdateModuleSetting(ModuleId, "ConsoleWidth", wdth);

                foreach (RepeaterItem item in tabs.Items)
                {
                    if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem)
                    {
                        var tabPath = (item.FindControl("tabPath") as HiddenField).Value;
                        var visibility = (item.FindControl("tabVisibility") as DnnComboBox).SelectedValue;

                        var key = String.Format("TabVisibility{0}", tabPath.Replace("//","-"));
                        moduleController.UpdateModuleSetting(ModuleId, key, visibility);
                    }
                }
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Exemple #5
0
 public static void DeletePreviewTemplateId(int moduleId)
 {
     var moduleController = new ModuleController();
     moduleController.DeleteModuleSetting(moduleId, PreviewTemplateIdString);
 }
        /// <summary>
        /// This method is used to load settings from the DNN Settings collection, for upgrade sites
        /// </summary>
        /// <param name="moduleId"></param>
        /// <param name="Settings"></param>
        public static ModuleSettingsInfo LoadSettingsFromDnn(int moduleId, Hashtable Settings)
        {
            var validSettings = true;
            var oNewSettings = new ModuleSettingsInfo();
            var oModController = new ModuleController();
            oNewSettings.ModuleId = moduleId;
            //If we have CSS settings use them
            object titleCssSetting = Settings["ICG_ETH_TitleCss"];
            object contentCssSetting = Settings["ICG_ETH_ContentCss"];
            object sortOrderSettings = Settings["ICG_ETH_SortOrder"];

            if (titleCssSetting != null)
            {
                oNewSettings.TitleCss = titleCssSetting.ToString();
                oModController.DeleteModuleSetting(moduleId, "ICG_ETH_TitleCss");
            }
            else
                validSettings = false;

            if (contentCssSetting != null)
            {
                oNewSettings.TitleCss = contentCssSetting.ToString();
                oModController.DeleteModuleSetting(moduleId, "ICG_ETH_ContentCss");
            }
            else
                validSettings = false;

            if (sortOrderSettings != null)
            {
                oNewSettings.SortOrder = sortOrderSettings.ToString();
                oModController.DeleteModuleSetting(moduleId, "ICG_ETH_SortOrder");
            }
            else
                validSettings = false;

            if (Settings["ICG_ETH_ExpandOnPrint"] != null)
            {
                oNewSettings.ExpandOnPrint = bool.Parse(Settings["ICG_ETH_ExpandOnPrint"].ToString());
                oModController.DeleteModuleSetting(moduleId, "ICG_ETH_ExpandOnPrint");
            }
            else
                validSettings = false;

            //Load the jquerysettings, if enable
            object jquerySetting = Settings["ICG_ETH_JQuery"];
            if (jquerySetting != null)
            {
                oNewSettings.UseJquery = bool.Parse(jquerySetting.ToString());
                oModController.DeleteModuleSetting(moduleId, "ICG_ETH_JQuery");
            }
            else
                validSettings = false;

            object displayLimitSetting = Settings["ICG_ETH_DisplayLimit"];
            if (displayLimitSetting != null)
            {
                oNewSettings.DisplayLimit = int.Parse(displayLimitSetting.ToString());
                oModController.DeleteModuleSetting(moduleId, "ICG_ETH_DisplayLimit");
            }
            else
                validSettings = false;

            //Also get show all text
            object showAllTextSetting = Settings["ICG_ETH_ShowAllText"];
            if (showAllTextSetting != null)
            {
                oNewSettings.ShowAllText = showAllTextSetting.ToString();
                oModController.DeleteModuleSetting(moduleId, "ICG_ETH_ShowAllText");
            }
            else
                validSettings = false;

            if (validSettings)
            {
                oNewSettings.ShowExpandCollapseAll = true;
                Save(oNewSettings);
                return oNewSettings;
            }
            else
            {
                return null;
            }
        }
        protected void SaveSettings()
        {
            ModuleController mc = new ModuleController();
            if (txtAnalyticsTrackingId.Text.Length > 0)
            {
                if (ModuleSettings.ContainsKey("GoogleTrackingId"))
                    ModuleSettings["GoogleTrackingId"] = txtAnalyticsTrackingId.Text;
                else
                    ModuleSettings.Add("GoogleTrackingId", txtAnalyticsTrackingId.Text);
                mc.UpdateModuleSetting(this.ModuleId, "GoogleTrackingId", txtAnalyticsTrackingId.Text);
            }

            if (ModuleSettings.ContainsKey("LocalHostAddress"))
                ModuleSettings["LocalHostAddress"] = txtLocalHostName.Text;
            else
                ModuleSettings.Add("LocalHostAddress", txtLocalHostName.Text );
            mc.UpdateModuleSetting(this.ModuleId, "LocalHostAddress", txtLocalHostName.Text );

            if (ddlSecurityGroups.SelectedValue != "-1")
            {
                if (ModuleSettings.ContainsKey("HideTrackingFromRole"))
                    ModuleSettings["HideTrackingFromRole"] = ddlSecurityGroups.SelectedItem.Text;
                else
                    ModuleSettings.Add("HideTrackingFromRole", ddlSecurityGroups.SelectedItem.Text);
                mc.UpdateModuleSetting(this.ModuleId, "HideTrackingFromRole", ddlSecurityGroups.SelectedItem.Text);
            }
            else
            {
                if (ModuleSettings.ContainsKey("HideTrackingFromRole"))
                    mc.DeleteModuleSetting(this.ModuleId, "HideTrackingFromRole");
            }
        }
        public override void UpdateSettings()
        {
            try
            {
                var objModules = new ModuleController();

                //validate console width value
                var wdth = string.Empty;
                if ((ConsoleWidth.Text.Trim().Length > 0))
                {
                    try
                    {
                        wdth = Unit.Parse(ConsoleWidth.Text.Trim()).ToString();
                    }
                    catch (Exception exc)
                    {
                        DnnLog.Error(exc);

                        throw new Exception("ConsoleWidth value is invalid. Value must be numeric.");
                    }
                }
                if ((ParentTab.SelectedValue == string.Empty))
                {
                    objModules.DeleteModuleSetting(ModuleId, "ParentTabID");
                }
                else
                {
                    objModules.UpdateModuleSetting(ModuleId, "ParentTabID", ParentTab.SelectedValue);
                }
                objModules.UpdateModuleSetting(ModuleId, "DefaultSize", DefaultSize.SelectedValue);
                objModules.UpdateModuleSetting(ModuleId, "AllowSizeChange", AllowResize.Checked.ToString());
                objModules.UpdateModuleSetting(ModuleId, "DefaultView", DefaultView.SelectedValue);
                objModules.UpdateModuleSetting(ModuleId, "AllowViewChange", AllowViewChange.Checked.ToString());
                objModules.UpdateModuleSetting(ModuleId, "ShowTooltip", ShowTooltip.Checked.ToString());
                objModules.UpdateModuleSetting(ModuleId, "ConsoleWidth", wdth);
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
 protected void cookie_clear()
 {
     if (cookie_check())
     {
         ModuleController obModule = new ModuleController();
         obModule.DeleteModuleSetting(ModuleId, cookie_user());
         Response.Cookies[cookie_name()].Expires = DateTime.Today.AddDays(-1);
         Response.Cookies["EOFFICE"].Expires = DateTime.Today.AddDays(-1);
         tbUsername.Visible = true;
         tbPassword.Visible = true;
         SignIn.Text = "Đăng nhập";
         cbRemember.Visible = true;
         btClear.Visible = false;
     }
 }
        private void LoadFormFields()
        {
            try
            {
                if (this.AttachedModule > 0)
                    this.cboModuleList.Items.FindByValue(this.AttachedModule.ToString()).Selected = true;
            }
            catch
            {
                ModuleController ctlModule = new ModuleController();
                ctlModule.DeleteModuleSetting(this.ModuleId, "AttachedModuleId");
                ModuleController.SynchronizeModule(this.ModuleId);
                this.cboModuleList.SelectedIndex = 0;
            }

            this.txtAppName.Text = DisqusApplicationName;
            chkRequireDnnLogin.Checked = RequireDnnLogin;

            if (string.IsNullOrEmpty(this.DisqusView))
            {
                this.cboModuleView.Items.FindByValue("comments").Selected = true;
                this.DisqusView = "comments";
            }
            else
            {
                this.cboModuleView.Items.FindByValue(this.DisqusView).Selected = true;
            }

            if (this.DisplayItems > 0)
            {
                this.cboDisplayItems.Items.FindByValue(this.DisplayItems.ToString()).Selected = true;
            }
            else
            {
                this.cboDisplayItems.Items[0].Selected = true;
            }

            this.chkShowModerators.Checked = this.ShowModerators;

            if (string.IsNullOrEmpty(this.ColorTheme))
            {
                this.cboColorTheme.Items.FindByValue("blue").Selected = true;
            }
            else
            {
                this.cboColorTheme.Items.FindByValue(this.ColorTheme).Selected = true;
            }

            if (string.IsNullOrEmpty(this.DefaultTab))
            {
                this.cboDefaultTab.Items.FindByValue("people").Selected = true;
            }
            else
            {
                this.cboDefaultTab.Items.FindByValue(this.DefaultTab).Selected = true;
            }

            if (this.CommentLength > 0)
            {
                this.txtCommentLength.Text = this.CommentLength.ToString();
            }
            else
            {
                this.txtCommentLength.Text = "200";
            }

            this.chkShowAvatar.Checked = this.ShowAvatar;

            if (this.AvatarSize > 0)
            {
                this.cboAvatarSize.Items.FindByValue(this.AvatarSize.ToString()).Selected = true;
            }
            else
            {
                this.cboAvatarSize.Items[0].Selected = true;
            }

            /* SITE-LEVEL SETTINGS */

            if (string.IsNullOrEmpty(DisqusApiSecret) == false)
            {
                txtApiSecret.Text = DisqusApiSecret;
            }

            if (UserInfo.IsSuperUser)
            {
                chkSchedule.Checked = ScheduleEnabled;
            }

            chkDeveloperMode.Checked = DisqusDeveloperMode;

            chkSsoEnabled.Checked = DisqusSsoEnabled;

            txtSsoApiKey.Text = DisqusSsoApiKey;

            this.ChangeView(this.DisqusView);
        }
Exemple #11
0
        public static void SetAppIdForModule(ModuleInfo module, int? appId)
        {
            var moduleController = new ModuleController();

            // Reset temporary template
            ContentGroups.DeletePreviewTemplateId(module.ModuleID);

            // ToDo: Should throw exception if a real ContentGroup exists

            var zoneId = GetZoneID(module.OwnerPortalID);

            if (appId == 0 || !appId.HasValue)
                moduleController.DeleteModuleSetting(module.ModuleID, AppNameString);
            else
            {
                var appName = ((BaseCache) DataSource.GetCache(0, 0)).ZoneApps[zoneId.Value].Apps[appId.Value];
                moduleController.UpdateModuleSetting(module.ModuleID, AppNameString, appName);
            }

            // Change to 1. available template if app has been set
            if (appId.HasValue)
            {
                var sexyForNewApp = new SexyContent(zoneId.Value, appId.Value, false);
                var templates = sexyForNewApp.GetAvailableTemplatesForSelector(module).ToList();
                if (templates.Any())
                    sexyForNewApp.ContentGroups.SetPreviewTemplateId(module.ModuleID, templates.First().TemplateId);
            }
        }