/// <summary> /// SaveMediaSettings - this allows you to abstract the saving of the settings that can be defined /// </summary> /// <remarks> /// 20120820 - Created. /// </remarks> private void SaveMediaSettings() { Entities.Modules.ModuleController ctlModule = new Entities.Modules.ModuleController(); // save settings to the module settings data store ctlModule.UpdateModuleSetting(ModuleId, MediaController.SETTING_POSTTOJOURNAL, chkPostToJournal.Checked.ToString()); ctlModule.UpdateModuleSetting(ModuleId, MediaController.SETTING_OVERRIDEJOURNALSETTING, chkOverrideJournalSetting.Checked.ToString()); /// /// TODO: Need to add logic to take the setting changes below into account before leaving the page /// Example: Notify users before leaving this view if that setting just got saved. /// if (IsCurrentUserAdmin) { // save settings to the portal settings data store Entities.Portals.PortalController.UpdatePortalSetting(PortalId, MediaController.SETTING_POSTTOJOURNAL, chkPostToJournal.Checked.ToString(), true, PortalSettings.CultureCode); Entities.Portals.PortalController.UpdatePortalSetting(PortalId, MediaController.SETTING_POSTTOJOURNALSITEWIDE, chkPostToJournalSiteWide.Checked.ToString(), true, PortalSettings.CultureCode); Entities.Portals.PortalController.UpdatePortalSetting(PortalId, MediaController.SETTING_NOTIFYONUPDATE, chkNotifyOnUpdate.Checked.ToString(), true, PortalSettings.CultureCode); } // force the module to use the new settings Entities.Modules.ModuleController.SynchronizeModule(ModuleId); }
private void LoadSettings(int PortalId, int ModuleId) { try { var objModules = new Entities.Modules.ModuleController(); var xDoc = new System.Xml.XmlDocument(); xDoc.Load(sPath); if (xDoc != null) { System.Xml.XmlNode xRoot = xDoc.DocumentElement; System.Xml.XmlNodeList xNodeList = xRoot.SelectNodes("//mainsettings/setting"); if (xNodeList.Count > 0) { int i; for (i = 0; i < xNodeList.Count; i++) { objModules.UpdateModuleSetting(ModuleId, xNodeList[i].Attributes["name"].Value, xNodeList[i].Attributes["value"].Value); } } } objModules.UpdateModuleSetting(ModuleId, SettingKeys.IsInstalled, "True"); objModules.UpdateModuleSetting(ModuleId, "NeedsConvert", "False"); try { System.Globalization.DateTimeFormatInfo nfi = new System.Globalization.CultureInfo("en-US", true).DateTimeFormat; objModules.UpdateModuleSetting(ModuleId, SettingKeys.InstallDate, DateTime.Now.ToString(new System.Globalization.CultureInfo("en-US"))); } catch (Exception ex) { Services.Exceptions.Exceptions.LogException(ex); } } catch (Exception ex) { } }
public override void UpdateSettings() { try { var objModules = new Entities.Modules.ModuleController(); // Update ModuleSettings objModules.UpdateModuleSetting(ModuleId, "AFTopicsTemplate", drpTopicsTemplate.SelectedItem.Value); objModules.UpdateModuleSetting(ModuleId, "AFTopicTemplate", drpTopicTemplate.SelectedItem.Value); objModules.UpdateModuleSetting(ModuleId, "AFForumViewTemplate", drpForumViewTemplate.SelectedItem.Value); objModules.UpdateModuleSetting(ModuleId, "AFForumModuleID", drpForumInstance.SelectedItem.Value); objModules.UpdateModuleSetting(ModuleId, "AFForumGroup", drpForum.SelectedItem.Value); //objModules.UpdateModuleSetting(ModuleId, "AFEnableToolbar", CType(chkEnableToolbar.Checked, String)) string ForumGroup; int ForumGroupID = 0; ForumGroup = drpForum.SelectedItem.Value; if ((ForumGroup.IndexOf("GROUPID:", 0) + 1) > 0) { objModules.UpdateModuleSetting(ModuleId, "AFViewType", "AFGROUP"); } else { objModules.UpdateModuleSetting(ModuleId, "AFViewType", "TOPICS"); } int @int = ForumGroup.IndexOf(":") + 1; string sID = ForumGroup.Substring(@int); //ForumGroupID = CType(ForumGroup.Substring(ForumGroup.IndexOf(":")), Integer) objModules.UpdateModuleSetting(ModuleId, "AFForumGroupID", sID); DataCache.CacheClear(drpForumInstance.SelectedItem.Value + TabId + sID + "TopicTemplate"); DataCache.CacheClear(drpForumInstance.SelectedItem.Value + TabId + sID + "TopicsTemplate"); DataCache.CacheClear(drpForumInstance.SelectedItem.Value + TabId + "ForumTemplate"); // Redirect back to the portal home page Response.Redirect(Utilities.NavigateUrl(TabId), true); } catch (Exception exc) { Services.Exceptions.Exceptions.ProcessModuleLoadException(this, exc); } }
public bool MoveSettings(int forumModuleId, int tabModuleId) { var objModules = new Entities.Modules.ModuleController(); var currSettings = new SettingsInfo { MainSettings = Settings.GeneralSettings(forumModuleId, "GEN") }; objModules.UpdateModuleSetting(tabModuleId, SettingKeys.PageSize, currSettings.PageSize.ToString()); objModules.UpdateModuleSetting(tabModuleId, SettingKeys.UserNameDisplay, currSettings.UserNameDisplay); objModules.UpdateModuleSetting(tabModuleId, SettingKeys.ProfileVisibility, ((int)currSettings.ProfileVisibility).ToString()); objModules.UpdateModuleSetting(tabModuleId, SettingKeys.EnablePoints, currSettings.EnablePoints.ToString()); objModules.UpdateModuleSetting(tabModuleId, SettingKeys.TopicPointValue, currSettings.TopicPointValue.ToString()); objModules.UpdateModuleSetting(tabModuleId, SettingKeys.ReplyPointValue, currSettings.ReplyPointValue.ToString()); objModules.UpdateModuleSetting(tabModuleId, SettingKeys.AnswerPointValue, currSettings.AnswerPointValue.ToString()); objModules.UpdateModuleSetting(tabModuleId, SettingKeys.MarkAnswerPointValue, currSettings.MarkAsAnswerPointValue.ToString()); objModules.UpdateModuleSetting(tabModuleId, SettingKeys.ModPointValue, currSettings.ModPointValue.ToString()); objModules.UpdateModuleSetting(tabModuleId, SettingKeys.AvatarHeight, currSettings.AvatarHeight.ToString()); objModules.UpdateModuleSetting(tabModuleId, SettingKeys.AvatarWidth, currSettings.AvatarWidth.ToString()); objModules.UpdateModuleSetting(tabModuleId, SettingKeys.AllowSignatures, currSettings.AllowSignatures.ToString()); objModules.UpdateModuleSetting(tabModuleId, SettingKeys.ForumTemplateId, currSettings.ForumTemplateID.ToString()); objModules.UpdateModuleSetting(tabModuleId, SettingKeys.InstallDate, currSettings.InstallDate.ToString()); objModules.UpdateModuleSetting(tabModuleId, SettingKeys.IsInstalled, currSettings.IsInstalled.ToString()); objModules.UpdateModuleSetting(tabModuleId, SettingKeys.Theme, currSettings.Theme); objModules.UpdateModuleSetting(tabModuleId, SettingKeys.FullText, currSettings.FullText.ToString()); objModules.UpdateModuleSetting(tabModuleId, SettingKeys.MailQueue, currSettings.MailQueue.ToString()); objModules.UpdateModuleSetting(tabModuleId, SettingKeys.FloodInterval, currSettings.FloodInterval.ToString()); objModules.UpdateModuleSetting(tabModuleId, SettingKeys.EditInterval, currSettings.EditInterval.ToString()); objModules.UpdateModuleSetting(tabModuleId, SettingKeys.DeleteBehavior, currSettings.DeleteBehavior.ToString()); objModules.UpdateModuleSetting(tabModuleId, SettingKeys.AddThisAccount, currSettings.AddThisAccount); objModules.UpdateModuleSetting(tabModuleId, SettingKeys.EnableAutoLink, currSettings.AutoLinkEnabled.ToString()); objModules.UpdateModuleSetting(tabModuleId, SettingKeys.EnableURLRewriter, currSettings.URLRewriteEnabled.ToString()); if (string.IsNullOrEmpty(currSettings.PrefixURLBase)) { objModules.UpdateModuleSetting(tabModuleId, SettingKeys.PrefixURLBase, "forums"); } else { objModules.UpdateModuleSetting(tabModuleId, SettingKeys.PrefixURLBase, currSettings.PrefixURLBase); } if (string.IsNullOrEmpty(currSettings.PrefixURLOther)) { objModules.UpdateModuleSetting(tabModuleId, SettingKeys.PrefixURLOther, "views"); } else { objModules.UpdateModuleSetting(tabModuleId, SettingKeys.PrefixURLOther, currSettings.PrefixURLOther); } if (string.IsNullOrEmpty(currSettings.PrefixURLTag)) { objModules.UpdateModuleSetting(tabModuleId, SettingKeys.PrefixURLTags, "tag"); } else { objModules.UpdateModuleSetting(tabModuleId, SettingKeys.PrefixURLTags, currSettings.PrefixURLTag); } if (string.IsNullOrEmpty(currSettings.PrefixURLCategory)) { objModules.UpdateModuleSetting(tabModuleId, SettingKeys.PrefixURLCategories, "category"); } else { objModules.UpdateModuleSetting(tabModuleId, SettingKeys.PrefixURLCategories, currSettings.PrefixURLCategory); } objModules.UpdateModuleSetting(tabModuleId, "NeedsConvert", "False"); objModules.UpdateModuleSetting(tabModuleId, "AFINSTALLED", "True"); DataCache.CacheClear(string.Format(CacheKeys.MainSettings, forumModuleId)); return(false); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); jQuery.RequestRegistration(); jQuery.RequestUIRegistration(); IsCallBack = cbShell.IsCallback; btnReturn.ClientSideScript = "window.location.href = '" + Common.Globals.NavigateURL(TabId) + "';"; var objModules = new Entities.Modules.ModuleController(); cbModal.LoadingTemplate = GetLoadingTemplateSmall(); Hashtable Settings = objModules.GetModuleSettings(ModuleId); string upFilePath = Server.MapPath("~/desktopmodules/activeforums/upgrade4x.txt"); if (Convert.ToBoolean(Settings["AFINSTALLED"]) == false) { try { var fc = new ForumsConfig(); bool configComplete = fc.ForumsInit(PortalId, ModuleId); objModules.UpdateModuleSetting(ModuleId, "AFINSTALLED", configComplete.ToString()); if (System.IO.File.Exists(upFilePath)) { System.IO.File.Delete(upFilePath); } } catch (Exception ex) { Services.Exceptions.Exceptions.LogException(ex); } } bool loadDefault = true; if (System.IO.File.Exists(upFilePath)) { var db = new Data.Common(); if (db.SecurityUpgraded()) { if (System.IO.File.Exists(upFilePath)) { System.IO.File.Delete(upFilePath); } } else { loadDefault = false; GetControl("upgrade", string.Empty, IsCallBack); } } ClientResourceManager.RegisterStyleSheet(Page, "~/DesktopModules/ActiveForums/ControlPanel.css"); ClientResourceManager.RegisterStyleSheet(Page, "~/DesktopModules/ActiveForums/themes/" + MainSettings.Theme + "/jquery-ui.min.css"); lblProd.Visible = true; lblCopy.Visible = true; //TODO: this should be resources instead of harcoded text? lblProd.Text = "Active Forums " + System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; lblCopy.Text = "©" + DateTime.Now.Year + " DotNetNuke Corporation"; try { if (!Page.IsPostBack) { GetControl(CurrentView, Params, IsCallBack); } } catch (Exception ex) { if (Request.QueryString["cptry"] == null) { string sURL = EditUrl("", "", "EDIT", "cptry=1"); Response.Redirect(sURL); } else { Services.Exceptions.Exceptions.ProcessModuleLoadException(this, ex); } } ClientResourceManager.RegisterScript(Page, "~/desktopmodules/activeforums/scripts/json2009.min.js", 101); ClientResourceManager.RegisterScript(Page, "~/desktopmodules/activeforums/scripts/jquery.history.js", 102); ClientResourceManager.RegisterScript(Page, "~/desktopmodules/activeforums/scripts/afadmin.js", 103); ClientResourceManager.RegisterScript(Page, "~/desktopmodules/activeforums/scripts/jquery.listreorder.js", 104); ClientResourceManager.RegisterScript(Page, "~/desktopmodules/activeforums/active/amlib.js", 105); string lang = "en-US"; if (Request.QueryString["language"] != null) { lang = Request.QueryString["language"]; } if (string.IsNullOrEmpty(lang)) { lang = PortalSettings.DefaultLanguage; } if (string.IsNullOrEmpty(lang)) { lang = "en-US"; } string adminHandler = VirtualPathUtility.ToAbsolute("~/desktopmodules/activeforums/handlers/adminhelper.ashx") + "?TabId=" + TabId.ToString() + "&PortalId=" + PortalId.ToString() + "&moduleid=" + ModuleId + "&language=" + lang; var sb = new StringBuilder(); sb.AppendLine("var asScriptPath = '" + VirtualPathUtility.ToAbsolute("~/desktopmodules/activeforums/scripts/") + "';"); sb.AppendFormat("var afAdminHandlerURL = '{0}';", adminHandler); sb.AppendLine("var af_imgPath = '" + VirtualPathUtility.ToAbsolute("~/DesktopModules/ActiveForums/themes/" + MainSettings.Theme) + "';"); string sLoadImg; sLoadImg = "var afSpinLg = new Image();afSpinLg.src='" + VirtualPathUtility.ToAbsolute("~/desktopmodules/activeforums/images/spinner-lg.gif") + "';"; sLoadImg += "var afSpin = new Image();afSpin.src='" + VirtualPathUtility.ToAbsolute("~/desktopmodules/activeforums/images/spinner.gif") + "';"; sb.AppendLine(sLoadImg); Page.ClientScript.RegisterStartupScript(Page.GetType(), "afscripts", sb.ToString(), true); ServicesFramework.Instance.RequestAjaxAntiForgerySupport(); }
public bool MoveSettings(int forumModuleId, int tabModuleId) { var objModules = new Entities.Modules.ModuleController(); var currSettings = new SettingsInfo {MainSettings = Settings.GeneralSettings(forumModuleId, "GEN")}; objModules.UpdateModuleSetting(tabModuleId, SettingKeys.PageSize, currSettings.PageSize.ToString()); objModules.UpdateModuleSetting(tabModuleId, SettingKeys.UserNameDisplay, currSettings.UserNameDisplay); objModules.UpdateModuleSetting(tabModuleId, SettingKeys.ProfileVisibility, ((int)currSettings.ProfileVisibility).ToString()); objModules.UpdateModuleSetting(tabModuleId, SettingKeys.EnablePoints, currSettings.EnablePoints.ToString()); objModules.UpdateModuleSetting(tabModuleId, SettingKeys.TopicPointValue, currSettings.TopicPointValue.ToString()); objModules.UpdateModuleSetting(tabModuleId, SettingKeys.ReplyPointValue, currSettings.ReplyPointValue.ToString()); objModules.UpdateModuleSetting(tabModuleId, SettingKeys.AnswerPointValue, currSettings.AnswerPointValue.ToString()); objModules.UpdateModuleSetting(tabModuleId, SettingKeys.MarkAnswerPointValue, currSettings.MarkAsAnswerPointValue.ToString()); objModules.UpdateModuleSetting(tabModuleId, SettingKeys.ModPointValue, currSettings.ModPointValue.ToString()); objModules.UpdateModuleSetting(tabModuleId, SettingKeys.AvatarHeight, currSettings.AvatarHeight.ToString()); objModules.UpdateModuleSetting(tabModuleId, SettingKeys.AvatarWidth, currSettings.AvatarWidth.ToString()); objModules.UpdateModuleSetting(tabModuleId, SettingKeys.AllowSignatures, currSettings.AllowSignatures.ToString()); objModules.UpdateModuleSetting(tabModuleId, SettingKeys.ForumTemplateId, currSettings.ForumTemplateID.ToString()); objModules.UpdateModuleSetting(tabModuleId, SettingKeys.InstallDate, currSettings.InstallDate.ToString()); objModules.UpdateModuleSetting(tabModuleId, SettingKeys.IsInstalled, currSettings.IsInstalled.ToString()); objModules.UpdateModuleSetting(tabModuleId, SettingKeys.Theme, currSettings.Theme); objModules.UpdateModuleSetting(tabModuleId, SettingKeys.FullText, currSettings.FullText.ToString()); objModules.UpdateModuleSetting(tabModuleId, SettingKeys.MailQueue, currSettings.MailQueue.ToString()); objModules.UpdateModuleSetting(tabModuleId, SettingKeys.FloodInterval, currSettings.FloodInterval.ToString()); objModules.UpdateModuleSetting(tabModuleId, SettingKeys.EditInterval, currSettings.EditInterval.ToString()); objModules.UpdateModuleSetting(tabModuleId, SettingKeys.DeleteBehavior, currSettings.DeleteBehavior.ToString()); objModules.UpdateModuleSetting(tabModuleId, SettingKeys.AddThisAccount, currSettings.AddThisAccount); objModules.UpdateModuleSetting(tabModuleId, SettingKeys.EnableAutoLink, currSettings.AutoLinkEnabled.ToString()); objModules.UpdateModuleSetting(tabModuleId, SettingKeys.EnableURLRewriter, currSettings.URLRewriteEnabled.ToString()); if (string.IsNullOrEmpty(currSettings.PrefixURLBase)) { objModules.UpdateModuleSetting(tabModuleId, SettingKeys.PrefixURLBase, "forums"); } else { objModules.UpdateModuleSetting(tabModuleId, SettingKeys.PrefixURLBase, currSettings.PrefixURLBase); } if (string.IsNullOrEmpty(currSettings.PrefixURLOther)) { objModules.UpdateModuleSetting(tabModuleId, SettingKeys.PrefixURLOther, "views"); } else { objModules.UpdateModuleSetting(tabModuleId, SettingKeys.PrefixURLOther, currSettings.PrefixURLOther); } if (string.IsNullOrEmpty(currSettings.PrefixURLTag)) { objModules.UpdateModuleSetting(tabModuleId, SettingKeys.PrefixURLTags, "tag"); } else { objModules.UpdateModuleSetting(tabModuleId, SettingKeys.PrefixURLTags, currSettings.PrefixURLTag); } if (string.IsNullOrEmpty(currSettings.PrefixURLCategory)) { objModules.UpdateModuleSetting(tabModuleId, SettingKeys.PrefixURLCategories, "category"); } else { objModules.UpdateModuleSetting(tabModuleId, SettingKeys.PrefixURLCategories, currSettings.PrefixURLCategory); } objModules.UpdateModuleSetting(tabModuleId, "NeedsConvert", "False"); objModules.UpdateModuleSetting(tabModuleId, "AFINSTALLED", "True"); DataCache.CacheClear(string.Format(CacheKeys.MainSettings, forumModuleId)); return false; }
/// ----------------------------------------------------------------------------- /// ''' <summary> /// ''' UpdateSettings saves the modified settings to the Database /// ''' </summary> /// ''' <remarks> /// ''' </remarks> /// ''' <history> /// ''' [cnurse] 10/20/2004 created /// ''' [cnurse] 10/25/2004 upated to use TabModuleId rather than TabId/ModuleId /// ''' </history> /// ''' ----------------------------------------------------------------------------- public override void UpdateSettings() { try { Entities.Modules.ModuleController objModules = new Entities.Modules.ModuleController(); // 2014 TODO: Menu objModules.UpdateModuleSetting(ModuleId, SettingName.DisplayMode, optControl.SelectedItem.Value); objModules.UpdateModuleSetting(ModuleId, SettingName.Direction, optView.SelectedItem.Value); objModules.UpdateModuleSetting(ModuleId, SettingName.LinkDescriptionMode, optInfo.SelectedItem.Value); objModules.UpdateModuleSetting(ModuleId, SettingName.Icon, ctlIcon.Url); objModules.UpdateModuleSetting(ModuleId, "nowrap", optNoWrap.SelectedItem.Value); objModules.UpdateModuleSetting(ModuleId, SettingName.ModuleContentType, optLinkModuleType.SelectedValue); objModules.UpdateModuleSetting(ModuleId, SettingName.UsePermissions, optUsePermissions.SelectedValue); // objModules.UpdateModuleSetting(ModuleId, "usepopup", optUsePopup.SelectedValue) objModules.UpdateModuleSetting(ModuleId, SettingName.DisplayAttribute, optDisplayAttribute.SelectedValue); objModules.UpdateModuleSetting(ModuleId, SettingName.DisplayOrder, optDisplayOrder.SelectedValue); // 2014 TODO objModules.UpdateModuleSetting(ModuleId, SettingName.MenuAllUsers, optMenuAllUsers.SelectedValue); switch ((Enums.ModuleContentTypes) int.Parse(optLinkModuleType.SelectedValue)) { case Enums.ModuleContentTypes.Menu: { objModules.UpdateModuleSetting(ModuleId, Consts.ModuleContentItem, optTypeContentSelection.SelectedValue); break; } case Enums.ModuleContentTypes.Folder: { objModules.UpdateModuleSetting(ModuleId, Consts.ModuleContentItem, optTypeContentSelection.SelectedValue); objModules.UpdateModuleSetting(ModuleId, Consts.FolderId, optTypeContentSelection.SelectedValue); break; } case Enums.ModuleContentTypes.Friends: { objModules.UpdateModuleSetting(ModuleId, Consts.ModuleContentItem, optTypeContentSelection.SelectedValue); break; } default: { break; } } bool allowCaching = true; if (optControl.SelectedItem.Value == Consts.DisplayModeDropdown) { allowCaching = false; } if (optInfo.SelectedItem.Value == "Y") { allowCaching = false; } if (!allowCaching) { DotNetNuke.Entities.Modules.ModuleInfo objModule = objModules.GetModule(ModuleId, TabId, false); if (objModule.CacheTime > 0) { objModule.CacheTime = 0; objModules.UpdateModule(objModule); } } ModuleController.SynchronizeModule(ModuleId); } catch (Exception exc) { Exceptions.ProcessModuleLoadException(this, exc); } }