From 130f543944ccaa992052b5beecba74e2479a75f6 Mon Sep 17 00:00:00 2001 From: Kan Ma Date: Wed, 21 Dec 2016 11:47:21 -0800 Subject: [PATCH] DNN-8137: Fixed CodeMirror & WordCount settings not loading issue --- DNNConnect.CKEditorProvider.dnn | 2 +- Properties/AssemblyInfo.cs | 4 +-- Utilities/SettingsUtil.cs | 56 ++++++++++++++++++--------------- 3 files changed, 33 insertions(+), 29 deletions(-) diff --git a/DNNConnect.CKEditorProvider.dnn b/DNNConnect.CKEditorProvider.dnn index f75baec..b1fab3c 100644 --- a/DNNConnect.CKEditorProvider.dnn +++ b/DNNConnect.CKEditorProvider.dnn @@ -1,5 +1,5 @@  - + DNN Connect CKEditor Provider CKEditor Provider by DNN Connect for DNN ~/Providers/HtmlEditorProviders/DNNConnect.CKE/LogoCKEditor.png diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs index 967d32f..064b3da 100644 --- a/Properties/AssemblyInfo.cs +++ b/Properties/AssemblyInfo.cs @@ -15,8 +15,8 @@ [assembly: AssemblyDescription("CKEditor HTML Editor Provider for DNN")] [assembly: AssemblyTitle("CKEditor HTML Editor Provider for DNN")] -[assembly: AssemblyVersion("1.0.2.*")] -[assembly: AssemblyFileVersion("1.0.2")] +[assembly: AssemblyVersion("1.0.3.*")] +[assembly: AssemblyFileVersion("1.0.3")] [assembly: ComVisible(false)] [assembly: AssemblyCompany("DNN-Connect")] [assembly: AssemblyCopyright("2015 DNN-Connect")] diff --git a/Utilities/SettingsUtil.cs b/Utilities/SettingsUtil.cs index 90a1b95..6b15880 100644 --- a/Utilities/SettingsUtil.cs +++ b/Utilities/SettingsUtil.cs @@ -103,37 +103,39 @@ internal static EditorProviderSettings LoadPortalOrPageSettings( { if (!filteredSettings.Any(s => s.Name.Equals(string.Format("{0}{1}", key, info.Name)))) { - continue; + if (!info.Name.Equals("CodeMirror") && !info.Name.Equals("WordCount")) + { + continue; + } } - /*if (!info.Name.Equals("CodeMirror") && !info.Name.Equals("WordCount")) + var settingValue = string.Empty; + if (!info.Name.Equals("CodeMirror") && !info.Name.Equals("WordCount")) { - continue; - }*/ - - var settingValue = - filteredSettings.FirstOrDefault( - setting => setting.Name.Equals(string.Format("{0}{1}", key, info.Name))).Value; + settingValue = + filteredSettings.FirstOrDefault( + setting => setting.Name.Equals(string.Format("{0}{1}", key, info.Name))).Value; - if (string.IsNullOrEmpty(settingValue)) - { - continue; - } + if (string.IsNullOrEmpty(settingValue)) + { + continue; + } - switch (info.PropertyType.Name) - { - case "String": - info.SetValue(currentSettings.Config, settingValue, null); - break; - case "Int32": - info.SetValue(currentSettings.Config, int.Parse(settingValue), null); - break; - case "Decimal": - info.SetValue(currentSettings.Config, decimal.Parse(settingValue), null); - break; - case "Boolean": - info.SetValue(currentSettings.Config, bool.Parse(settingValue), null); - break; + switch (info.PropertyType.Name) + { + case "String": + info.SetValue(currentSettings.Config, settingValue, null); + break; + case "Int32": + info.SetValue(currentSettings.Config, int.Parse(settingValue), null); + break; + case "Decimal": + info.SetValue(currentSettings.Config, decimal.Parse(settingValue), null); + break; + case "Boolean": + info.SetValue(currentSettings.Config, bool.Parse(settingValue), null); + break; + } } switch (info.Name) @@ -168,6 +170,7 @@ internal static EditorProviderSettings LoadPortalOrPageSettings( typeof(CodeMirror).GetProperties() .Where(codeMirrorInfo => !codeMirrorInfo.Name.Equals("Theme"))) { + settingValue = filteredSettings.FirstOrDefault(setting => setting.Name.Equals(string.Format("{0}{1}", key, codeMirrorInfo.Name))).Value; switch (codeMirrorInfo.PropertyType.Name) { case "String": @@ -198,6 +201,7 @@ internal static EditorProviderSettings LoadPortalOrPageSettings( case "WordCount": foreach (var wordCountInfo in typeof(WordCountConfig).GetProperties()) { + settingValue = filteredSettings.FirstOrDefault(setting => setting.Name.Equals(string.Format("{0}{1}", key, wordCountInfo.Name))).Value; switch (wordCountInfo.PropertyType.Name) { case "String":