/// <summary> /// FormatHtmlText formats HtmlText content for display in the browser /// </summary> /// <remarks> /// </remarks> /// <param name="moduleId">The ModuleID</param> /// <param name = "content">The HtmlText Content</param> /// <param name = "settings">Module Settings</param> /// <param name="portalSettings">The Portal Settings.</param> /// <param name="page">The Page Instance.</param> public static string FormatHtmlText(int moduleId, string content, HtmlModuleSettings settings, PortalSettings portalSettings, Page page) { // token replace if (settings.ReplaceTokens) { //var tr = new HtmlTokenReplace(page) //DNN 7.x not support var tr = new TokenReplace() { AccessingUser = UserController.Instance.GetCurrentUserInfo(), DebugMessages = portalSettings.UserMode != PortalSettings.Mode.View, ModuleId = moduleId, PortalSettings = portalSettings }; content = tr.ReplaceEnvironmentTokens(content); } // Html decode content content = HttpUtility.HtmlDecode(content); // manage relative paths content = ManageRelativePaths(content, portalSettings.HomeDirectory, "src", portalSettings.PortalId); content = ManageRelativePaths(content, portalSettings.HomeDirectory, "background", portalSettings.PortalId); return(content); }
public void SaveSettings(ModuleInfo moduleContext, HtmlModuleSettings settings) { Requires.NotNull("moduleContext", moduleContext); Requires.NotNull("settings", settings); Type type = settings.GetType(); PropertyInfo[] properties = type.GetProperties(); foreach (PropertyInfo property in properties) { string key = Constants.ModuleSettingsPrefix + property.Name; string value = property.GetValue(settings, null).ToString(); _moduleController.UpdateModuleSetting(moduleContext.ModuleID, key, value); } }
public HtmlModuleSettings GetSettings(ModuleInfo moduleContext) { var settings = new HtmlModuleSettings(); if (moduleContext != null) { var moduleSettings = moduleContext.ModuleSettings; Type type = settings.GetType(); PropertyInfo[] properties = type.GetProperties(); foreach (PropertyInfo property in properties) { string key = Constants.ModuleSettingsPrefix + property.Name; if (moduleSettings.ContainsKey(key)) { property.SetValue(settings, Convert.ChangeType(moduleSettings[key], property.PropertyType), null); } } } return(settings); }