diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index e3c8c187ae..318c23414b 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -1629,7 +1629,6 @@ - Mvc\web.config diff --git a/src/Umbraco.Web/_Legacy/Utils/JSONSerializer.cs b/src/Umbraco.Web/_Legacy/Utils/JSONSerializer.cs deleted file mode 100644 index f5eaf708a0..0000000000 --- a/src/Umbraco.Web/_Legacy/Utils/JSONSerializer.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.Text.RegularExpressions; -using System.Web.Script.Serialization; - -namespace Umbraco.Web._Legacy.Utils -{ - /// - /// The built in JavaScriptSerializer does not allow you to export real JavaScript - /// objects, functions, etc... only string values which isn't always what you want. - /// See - /// - /// Override the JavaScriptSerializer serialization process and look for any - /// custom "tags" strings such as a @ symbol which depicts that the string value - /// should really be a JSON value, therefore the output removes the double quotes. - /// - /// - /// - /// If you want to output: - /// {"myFunction": function() {alert('hello');}} - /// The JavaScriptSerializer will not let you do this, it will render: - /// {"myFunction": "function() {alert('hello');}"} - /// which means that JavaScript will interpret it as a string. - /// This class allows you to output JavaScript objects, amongst other things. - /// - [Obsolete("Remove this for v8")] - internal class JSONSerializer : JavaScriptSerializer - { - - public new string Serialize(object obj) - { - string output = base.Serialize(obj); - - //replaces all strings beginning with this prefix to have no double quotes - Regex regex1 = new Regex(string.Format("(\"{0}(.*?)\")+", PrefixJavaScriptObject), - RegexOptions.Multiline - | RegexOptions.CultureInvariant - | RegexOptions.Compiled - ); - string result = regex1.Replace(output, "$2"); - - return result; - } - - private const string PrefixJavaScriptObject = "@@@@"; - - /// - /// method for a string to be converted to a json object. - /// - /// - /// A string formatted with a special prefix - /// - /// This essentially just prefixes the string with a special key that we will use - /// to parse with later during serialization. - /// - public static string ToJSONObject(string s) - { - return PrefixJavaScriptObject + s; - } - - - } - - - -} - diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/XmlTree.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/XmlTree.cs index def2bbb9b0..c6dfd4c758 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/XmlTree.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/XmlTree.cs @@ -7,7 +7,6 @@ using System.Web.Script.Serialization; using Umbraco.Core.IO; using Umbraco.Web.UI.Pages; using Umbraco.Web._Legacy.Actions; -using Umbraco.Web._Legacy.Utils; using Action = Umbraco.Web._Legacy.Actions.Action; namespace umbraco.cms.presentation.Trees @@ -48,7 +47,7 @@ namespace umbraco.cms.presentation.Trees private void Init() { - m_JSSerializer = new JSONSerializer { MaxJsonLength = int.MaxValue }; + m_JSSerializer = new JavaScriptSerializer { MaxJsonLength = int.MaxValue }; switch (m_TreeType) { @@ -70,7 +69,7 @@ namespace umbraco.cms.presentation.Trees } - private JSONSerializer m_JSSerializer; + private JavaScriptSerializer m_JSSerializer; private SerializedTreeType m_TreeType; /// @@ -717,7 +716,7 @@ namespace umbraco.cms.presentation.Trees metadata.Add("source", node.Source); //the metadata/jsTree requires this property to be in a quoted JSON syntax - JSONSerializer jsSerializer = new JSONSerializer(); + JavaScriptSerializer jsSerializer = new JavaScriptSerializer(); string strMetaData = jsSerializer.Serialize(metadata).Replace("\"", "'"); dataAttributes.Add("umb:nodedata", strMetaData); diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/JTreeContextMenu.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/JTreeContextMenu.cs index 8935aa9bdf..cfaf6bb2cd 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/JTreeContextMenu.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/JTreeContextMenu.cs @@ -4,7 +4,6 @@ using System.Web.Script.Serialization; using Umbraco.Core.Logging; using Umbraco.Core; using Umbraco.Web._Legacy.Actions; -using Umbraco.Web._Legacy.Utils; using Action = Umbraco.Web._Legacy.Actions.Action; namespace umbraco.controls.Tree @@ -14,7 +13,7 @@ namespace umbraco.controls.Tree public string RenderJSONMenu() { - JSONSerializer jSSerializer = new JSONSerializer(); + JavaScriptSerializer jSSerializer = new JavaScriptSerializer(); jSSerializer.RegisterConverters(new List() { diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/JTreeContextMenuItem.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/JTreeContextMenuItem.cs index f49bc75a50..c624c429c2 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/JTreeContextMenuItem.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/JTreeContextMenuItem.cs @@ -5,7 +5,6 @@ using System.Text; using Umbraco.Core; using Umbraco.Core.Services; using Umbraco.Web._Legacy.Actions; -using Umbraco.Web._Legacy.Utils; namespace umbraco.controls.Tree { @@ -56,12 +55,6 @@ namespace umbraco.controls.Tree data.Add("icon", a.Icon); } - //required by jsTree - data.Add("visible", JSONSerializer.ToJSONObject("function() {return true;}")); - - //The action handler is what is assigned to the IAction, but for flexibility, we'll call our onContextMenuSelect method which will need to return true if the function is to execute. - data.Add("action", JSONSerializer.ToJSONObject("function(N,T){" + a.JsFunctionName + ";}")); - return data; }