diff --git a/Composite/Plugins/Forms/WebChannel/UiControlFactories/TemplatedTreelSelectorUiControlFactory.cs b/Composite/Plugins/Forms/WebChannel/UiControlFactories/TemplatedTreelSelectorUiControlFactory.cs index 4fb965d3a7..fbfcdaec54 100644 --- a/Composite/Plugins/Forms/WebChannel/UiControlFactories/TemplatedTreelSelectorUiControlFactory.cs +++ b/Composite/Plugins/Forms/WebChannel/UiControlFactories/TemplatedTreelSelectorUiControlFactory.cs @@ -111,9 +111,9 @@ public Control BuildWebControl() _userControl.SelectedKey = this.SelectedKey; _userControl.ElementProvider = this.ElementProvider; - _userControl.SelectableElementPropertyName = this.SelectableElementPropertyName; - _userControl.SelectableElementPropertyValue = this.SelectableElementPropertyValue; _userControl.SelectableElementReturnValue = this.SelectableElementReturnValue; + _userControl.SelectableElementPropertyName = string.IsNullOrEmpty(this.SelectableElementPropertyName) ? this.SelectableElementReturnValue : this.SelectableElementPropertyName; + _userControl.SelectableElementPropertyValue = this.SelectableElementPropertyValue; _userControl.SerializedSearchToken = this.SerializedSearchToken; _userControl.Required = this.Required; diff --git a/Composite/Plugins/Functions/WidgetFunctionProviders/StandardWidgetFunctionProvider/String/TreeSelectorWidgetFunction.cs b/Composite/Plugins/Functions/WidgetFunctionProviders/StandardWidgetFunctionProvider/String/TreeSelectorWidgetFunction.cs index 217dbe51a5..3438ea107d 100644 --- a/Composite/Plugins/Functions/WidgetFunctionProviders/StandardWidgetFunctionProvider/String/TreeSelectorWidgetFunction.cs +++ b/Composite/Plugins/Functions/WidgetFunctionProviders/StandardWidgetFunctionProvider/String/TreeSelectorWidgetFunction.cs @@ -35,31 +35,32 @@ private void SetParameterProfiles() "Element Provider", new HelpDefinition("The name of a tree element provider (as defined in Composite.config)"))); base.AddParameterProfile( - new ParameterProfile("SelectableElementPropertyName", + new ParameterProfile("SelectableElementReturnValue", typeof(string), true, - new ConstantValueProvider(string.Empty), + new ConstantValueProvider("EntityToken"), StandardWidgetFunctions.TextBoxWidget, null, - "Selectable Element Property Name", new HelpDefinition("The name of a property used to identify a selectable tree element by"))); + "Element field to return", new HelpDefinition("The name of the element field whose value to return for selection. Typical values here can be DataId (for data trees), Uri (for linkable elements), or EntityToken (for any element). Element providers may provide more fields."))); base.AddParameterProfile( - new ParameterProfile("SelectableElementPropertyValue", + new ParameterProfile("SelectableElementPropertyName", typeof(string), false, new ConstantValueProvider(string.Empty), StandardWidgetFunctions.TextBoxWidget, null, - "Selectable Element Property Value", new HelpDefinition("The value of the property optionally used (if provided) to further identify a selectable tree element by"))); + "Selection filter, Property Name", new HelpDefinition("An element must have this field to be selectable."))); base.AddParameterProfile( - new ParameterProfile("SelectableElementReturnValue", + new ParameterProfile("SelectableElementPropertyValue", typeof(string), false, new ConstantValueProvider(string.Empty), StandardWidgetFunctions.TextBoxWidget, null, - "Selectable Element Return Value", new HelpDefinition("The value to return for the selected tree element"))); + "Selection filter, Property Value", new HelpDefinition("The value of the property optionally used (if provided) to further identify a selectable tree element by. Seperate multiple values with spaces."))); + base.AddParameterProfile( new ParameterProfile("SerializedSearchToken", typeof(string), @@ -67,7 +68,7 @@ private void SetParameterProfiles() new ConstantValueProvider(string.Empty), StandardWidgetFunctions.TextBoxWidget, null, - "Selectable Element Return Value", new HelpDefinition("A search token to filter tree elements by"))); + "Search Token", new HelpDefinition("A search token, seriallized, to filter which tree elements is shown. To filter what is selectable, use the 'Selection filter' properties."))); base.AddParameterProfile( new ParameterProfile("Required", typeof(bool), @@ -85,7 +86,7 @@ public override XElement GetWidgetMarkup(ParameterList parameters, string label, XElement formElement = base.BuildBasicWidgetMarkup("TreeSelector", "SelectedKey", label, helpDefinition, bindingSourceName); foreach (var propertyName in new [] { - "ElementProvider", "SelectableElementPropertyName", "SelectableElementPropertyValue", "SelectableElementReturnValue", "SerializedSearchToken", "Required" + "ElementProvider", "SelectableElementReturnValue", "SelectableElementPropertyName", "SelectableElementPropertyValue", "SerializedSearchToken", "Required" }) { string propertyValue = parameters.GetParameter(propertyName); diff --git a/Website/Composite/content/dialogs/treeselector/TreeSelectorDialogPageBinding.js b/Website/Composite/content/dialogs/treeselector/TreeSelectorDialogPageBinding.js index 271c16cd2f..7cb620f238 100644 --- a/Website/Composite/content/dialogs/treeselector/TreeSelectorDialogPageBinding.js +++ b/Website/Composite/content/dialogs/treeselector/TreeSelectorDialogPageBinding.js @@ -601,16 +601,9 @@ TreeSelectorDialogPageBinding.prototype._updateDisplayAndResult = function (tree var prop = this._selectionResult; selections.each ( function ( binding ) { - if (prop == "EntityToken" && binding.node) { - - result.add( - binding.node.getEntityToken() - ); - } else { - result.add( - binding.getProperty(prop) - ); - } + result.add( + binding.getProperty(prop) + ); value += binding.getLabel (); if ( selections.hasNext ()) { value += "; "; diff --git a/Website/Composite/scripts/source/top/ui/bindings/system/SystemTreeNodeBinding.js b/Website/Composite/scripts/source/top/ui/bindings/system/SystemTreeNodeBinding.js index 89fd7959b3..b4d115541e 100644 --- a/Website/Composite/scripts/source/top/ui/bindings/system/SystemTreeNodeBinding.js +++ b/Website/Composite/scripts/source/top/ui/bindings/system/SystemTreeNodeBinding.js @@ -633,6 +633,19 @@ SystemTreeNodeBinding.prototype.selectToken = function (entityToken) { this.setHandle(this.node.getHandle()); } +/** + * Get bound element attribute or EnityToken. + * @overloads {Binding#getProperty} + */ +SystemTreeNodeBinding.prototype.getProperty = function ( attname ) { + + if(attname == 'EntityToken' && this.node && this.node.getEntityToken()) { + return this.node.getEntityToken(); + } + + return SystemTreeNodeBinding.superclass.getProperty.call ( this, attname ); +} + /** * SystemTreeNodeBinding factory. Notice that we supply a {@link SystemNode} as argument here! * @param {SystemNode} node