From c9bfab866b778fcf610d5f79156b137e1c173c01 Mon Sep 17 00:00:00 2001 From: Taras Nakonechnyi Date: Wed, 27 Nov 2019 16:21:11 +0200 Subject: [PATCH 1/3] Fix label --- .../String/TreeSelectorWidgetFunction.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Composite/Plugins/Functions/WidgetFunctionProviders/StandardWidgetFunctionProvider/String/TreeSelectorWidgetFunction.cs b/Composite/Plugins/Functions/WidgetFunctionProviders/StandardWidgetFunctionProvider/String/TreeSelectorWidgetFunction.cs index 217dbe51a5..1cce1a854e 100644 --- a/Composite/Plugins/Functions/WidgetFunctionProviders/StandardWidgetFunctionProvider/String/TreeSelectorWidgetFunction.cs +++ b/Composite/Plugins/Functions/WidgetFunctionProviders/StandardWidgetFunctionProvider/String/TreeSelectorWidgetFunction.cs @@ -67,7 +67,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"))); + "Serialized Search Token", new HelpDefinition("A search token to filter tree elements by"))); base.AddParameterProfile( new ParameterProfile("Required", typeof(bool), From 44ba5aebb619d7db4a1f703708bf8284a0f17bf7 Mon Sep 17 00:00:00 2001 From: mawtex Date: Wed, 27 Nov 2019 18:16:16 +0100 Subject: [PATCH 2/3] Expanding on TreeSelector help texts, ensuring only required fields are marked as required. --- .../TemplatedTreelSelectorUiControlFactory.cs | 4 ++-- .../String/TreeSelectorWidgetFunction.cs | 19 ++++++++++--------- 2 files changed, 12 insertions(+), 11 deletions(-) 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 1cce1a854e..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, - "Serialized Search Token", 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); From d93cb5a08c54dd39f0eb4bb05ccff70e09f776b9 Mon Sep 17 00:00:00 2001 From: Taras Nakonechnyi Date: Thu, 28 Nov 2019 13:42:54 +0200 Subject: [PATCH 3/3] GetProperty returns EntityToken for SystemTreeNodeBinding --- .../treeselector/TreeSelectorDialogPageBinding.js | 13 +++---------- .../top/ui/bindings/system/SystemTreeNodeBinding.js | 13 +++++++++++++ 2 files changed, 16 insertions(+), 10 deletions(-) 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