From 449613de3ea4a043bc620af1d86dce313a063dbf Mon Sep 17 00:00:00 2001 From: "Hendy@Blueberry" Date: Mon, 24 Sep 2012 20:54:26 -0100 Subject: [PATCH] updated check for uQuery.IGetProperty added XPathCheckBoxList return obj for uQuery .GetProperty("alias") --- .../umbraco/uQuery/ContentExtensions.cs | 2 +- .../umbraco/uQuery/NodeExtensions.cs | 2 +- .../XPathCheckBoxList/XPathCheckBoxList.cs | 23 +++++++++++++++++++ .../umbraco.editorControls.csproj | 1 + 4 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 src/umbraco.editorControls/XPathCheckBoxList/XPathCheckBoxList.cs diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/uQuery/ContentExtensions.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/uQuery/ContentExtensions.cs index 0b1eba0cbc..0ff0dba254 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/uQuery/ContentExtensions.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/uQuery/ContentExtensions.cs @@ -37,7 +37,7 @@ namespace umbraco public static T GetProperty(this Content item, string propertyAlias) { // check to see if return object handles it's own object hydration - if (typeof(T).GetInterface(typeof(uQuery.IGetProperty).Name) != null) + if (typeof(uQuery.IGetProperty).IsAssignableFrom(typeof(T))) { // create new instance of T with empty constructor uQuery.IGetProperty t = (uQuery.IGetProperty)Activator.CreateInstance(); diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/uQuery/NodeExtensions.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/uQuery/NodeExtensions.cs index 2bebaf2fd6..7ba77ac082 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/uQuery/NodeExtensions.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/uQuery/NodeExtensions.cs @@ -271,7 +271,7 @@ namespace umbraco public static T GetProperty(this Node node, string propertyAlias) { // check to see if return object handles it's own object hydration - if (typeof(T).GetInterface(typeof(uQuery.IGetProperty).Name) != null) + if (typeof(uQuery.IGetProperty).IsAssignableFrom(typeof(T))) { // create new instance of T with empty constructor uQuery.IGetProperty t = (uQuery.IGetProperty)Activator.CreateInstance(); diff --git a/src/umbraco.editorControls/XPathCheckBoxList/XPathCheckBoxList.cs b/src/umbraco.editorControls/XPathCheckBoxList/XPathCheckBoxList.cs new file mode 100644 index 0000000000..b15a91eb71 --- /dev/null +++ b/src/umbraco.editorControls/XPathCheckBoxList/XPathCheckBoxList.cs @@ -0,0 +1,23 @@ +using System.Collections.Generic; +using umbraco.NodeFactory; + +namespace umbraco.editorControls.XPathCheckBoxList +{ + public class XPathCheckBoxList : uQuery.IGetProperty + { + public XPathCheckBoxList() + { + } + + void uQuery.IGetProperty.LoadPropertyValue(string value) + { + this.SelectedNodes = uQuery.GetNodesByXml(value); + } + + public IEnumerable SelectedNodes + { + get; + private set; + } + } +} diff --git a/src/umbraco.editorControls/umbraco.editorControls.csproj b/src/umbraco.editorControls/umbraco.editorControls.csproj index 6fd470981f..67ce867795 100644 --- a/src/umbraco.editorControls/umbraco.editorControls.csproj +++ b/src/umbraco.editorControls/umbraco.editorControls.csproj @@ -415,6 +415,7 @@ +