From 1d26a0353b88c2a78828fa5efe50d838395ec626 Mon Sep 17 00:00:00 2001 From: starfighter83 Date: Tue, 21 Dec 2010 08:14:41 -0100 Subject: [PATCH] update to usercontrol wrapper, detect if value is xml (if it is, don't store in cdata) --- .../umbraco.editorControls.csproj | 1 + .../userControlWrapper/usercontrolData.cs | 42 +++++++++++++++++++ .../userControlWrapper/usercontrolDataType.cs | 2 +- 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 components/editorControls/userControlWrapper/usercontrolData.cs diff --git a/components/editorControls/umbraco.editorControls.csproj b/components/editorControls/umbraco.editorControls.csproj index c1dc628513..4eaa7aa880 100644 --- a/components/editorControls/umbraco.editorControls.csproj +++ b/components/editorControls/umbraco.editorControls.csproj @@ -344,6 +344,7 @@ + diff --git a/components/editorControls/userControlWrapper/usercontrolData.cs b/components/editorControls/userControlWrapper/usercontrolData.cs new file mode 100644 index 0000000000..ee1386c648 --- /dev/null +++ b/components/editorControls/userControlWrapper/usercontrolData.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Xml; + +namespace umbraco.editorControls.userControlGrapper +{ + public class usercontrolData : umbraco.cms.businesslogic.datatype.DefaultData + { + public usercontrolData(umbraco.cms.businesslogic.datatype.BaseDataType DataType) : base(DataType) { } + + + public override System.Xml.XmlNode ToXMl(System.Xml.XmlDocument data) + { + + if (this.Value != null) + { + + XmlDocument xd = new XmlDocument(); + + try + { + xd.LoadXml(this.Value.ToString()); + return data.ImportNode(xd.DocumentElement, true); + } + catch + { + return base.ToXMl(data); + } + + } + else + { + + return base.ToXMl(data); + + } + + } + } +} diff --git a/components/editorControls/userControlWrapper/usercontrolDataType.cs b/components/editorControls/userControlWrapper/usercontrolDataType.cs index 13db9418ee..b9d99982ce 100644 --- a/components/editorControls/userControlWrapper/usercontrolDataType.cs +++ b/components/editorControls/userControlWrapper/usercontrolDataType.cs @@ -31,7 +31,7 @@ namespace umbraco.editorControls.userControlGrapper get { if (_baseData == null) - _baseData = new umbraco.cms.businesslogic.datatype.DefaultData(this); + _baseData = new usercontrolData(this); return _baseData; } }