From 4fce47cff3e670ac0027aa9a99152a7fb0ceaf45 Mon Sep 17 00:00:00 2001 From: Shannon Date: Fri, 14 Nov 2014 18:22:31 +1100 Subject: [PATCH] Completes: U4-5808 All old legacy 'datatypes' since they are not supported or used --- src/Umbraco.Core/ObjectExtensions.cs | 2 +- .../CodeFirst/Attributes/Numeric.cs | 4 +- .../TestModels/AdvancedContentPage.cs | 4 +- .../CodeFirst/TestModels/Composition/Meta.cs | 7 +- .../TestModels/Composition/MetaSeo.cs | 4 +- .../CodeFirst/TestModels/Composition/News.cs | 4 +- .../TestModels/DecoratedModelPage.cs | 6 +- .../CodeFirst/TestModels/Home.cs | 7 +- .../CodeFirst/TestModels/SimpleContentPage.cs | 4 +- .../CodeFirst/TestModels/TextPage.cs | 6 +- src/Umbraco.Tests/Models/Collections/Item.cs | 2 - .../Plugins/PluginManagerTests.cs | 4 +- src/Umbraco.Tests/Plugins/TypeFinderTests.cs | 2 - src/Umbraco.Tests/Umbraco.Tests.csproj | 4 - src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 4 - src/Umbraco.Web/Dynamics/DynamicQueryable.cs | 8 +- src/Umbraco.Web/Dynamics/ExpressionParser.cs | 2 +- src/Umbraco.Web/UmbracoHelper.cs | 6 +- .../umbraco/users/EditUser.aspx.cs | 5 +- .../businesslogic/web/StylesheetProperty.cs | 6 +- src/umbraco.controls/TabView.cs | 5 +- .../UmbracoClientDependencyLoader.cs | 2 +- .../AbstractJsonPrevalueEditor.cs | 109 - src/umbraco.editorControls/AbstractOptions.cs | 44 - .../AbstractPrevalueEditor.cs | 81 - src/umbraco.editorControls/BaseDataType.cs | 96 - .../BaseTreePickerEditor.cs | 116 - src/umbraco.editorControls/CsvToXmlData.cs | 98 - src/umbraco.editorControls/DataTypeGuids.cs | 48 - src/umbraco.editorControls/DefaultData.cs | 101 - .../DefaultDataKeyValue.cs | 50 - .../DefaultPrevalueEditor.cs | 216 -- .../KeyValuePrevalueEditor.css | 7 - .../KeyValuePrevalueEditor.js | 40 - .../MultiNodeTreePicker/BaseTreeExtensions.cs | 195 -- .../FilteredContentTree.cs | 230 -- .../MultiNodeTreePicker/FilteredMediaTree.cs | 147 -- .../HttpCookieExtensions.cs | 156 -- .../MNTPResources.Designer.cs | 381 ---- .../MultiNodeTreePicker/MNTPResources.resx | 225 -- .../MultiNodeTreePicker/MNTP_DataEditor.cs | 706 ------ .../MultiNodeTreePicker/MNTP_DataType.cs | 213 -- .../MNTP_PrevalueEditor.cs | 746 ------ .../MultiNodePickerScripts.js | 322 --- .../MultiNodePickerStyles.css | 210 -- .../MultiNodeTreePicker/NodeSelectionType.cs | 21 - .../SelectedItemsTemplate.cs | 82 - .../XPathExpressionType.cs | 21 - .../MultiNodeTreePicker/XPathFilterType.cs | 21 - .../XmlTreeNodeExtensions.cs | 80 - .../MultipleTextstring/MultipleTextstring.css | 33 - .../MultipleTextstring/MultipleTextstring.js | 122 - .../MultipleTextstringControl.cs | 189 -- .../MultipleTextstringDataType.cs | 137 -- .../MultipleTextstringOptions.cs | 43 - .../MultipleTextstringPrevalueEditor.cs | 117 - .../PickerRelationsDataEditor.cs | 253 --- .../PickerRelationsDataType.cs | 89 - .../PickerRelationsEventHandler.cs | 266 --- .../PickerRelations/PickerRelationsOptions.cs | 46 - .../PickerRelationsPreValueEditor.cs | 236 -- src/umbraco.editorControls/PrevalueEditor.css | 81 - .../PrevalueEditorExtensions.cs | 107 - .../Properties/AssemblyInfo.cs | 14 - .../PropertyTypePicker.cs | 84 - .../ResourceExtensions.cs | 75 - .../SettingControls/CheckBox.cs | 41 - .../SettingControls/CheckBoxList.cs | 62 - .../SettingControls/DropDownList.cs | 47 - .../SettingControls/ListBox.cs | 49 - .../SettingControls/ListBoxMultiple.cs | 60 - .../SettingControls/Password.cs | 42 - .../SettingControls/Pickers/BasePicker.cs | 69 - .../SettingControls/Pickers/Content.cs | 181 -- .../SettingControls/Pickers/Date.cs | 43 - .../SettingControls/Pickers/DateWithTime.cs | 42 - .../SettingControls/Pickers/DocumentType.cs | 15 - .../SettingControls/Pickers/Field.cs | 67 - .../SettingControls/Pickers/Media.cs | 51 - .../SettingControls/Pickers/MediaType.cs | 17 - .../SettingControls/Pickers/MemberGroup.cs | 17 - .../SettingControls/Pickers/MemberType.cs | 17 - .../SettingControls/Pickers/Path.cs | 93 - .../SettingControls/RadioButtonList.cs | 47 - .../SettingControls/TextArea.cs | 43 - .../SettingControls/TextField.cs | 40 - .../SettingControls/Values.cs | 73 - .../SettingControls/css/Values.css | 15 - .../SettingControls/js/Values.js | 183 -- .../Slider/SliderControl.cs | 187 -- .../Slider/SliderDataType.cs | 158 -- .../Slider/SliderOptions.cs | 100 - .../Slider/SliderPrevalueEditor.cs | 302 --- .../XPathCheckBoxList/XPathCheckBoxList.cs | 25 - .../XPathCheckBoxListDataEditor.cs | 179 -- .../XPathCheckBoxListDataType.cs | 133 -- .../XPathCheckBoxListOptions.cs | 78 - .../XPathCheckBoxListPreValueEditor.cs | 224 -- .../XPathDropDownListDataEditor.cs | 168 -- .../XPathDropDownListDataType.cs | 102 - .../XPathDropDownListOptions.cs | 64 - .../XPathDropDownListPreValueEditor.cs | 209 -- src/umbraco.editorControls/XmlData.cs | 47 - src/umbraco.editorControls/app.config | 36 - .../DataTypeDatefieldMultiple.cs | 45 - .../datepicker/DateData.cs | 43 - .../datepicker/DateDataType.cs | 61 - .../datepicker/dateField.cs | 72 - .../folderbrowser/DataTypeFolderbrowser.cs | 35 - .../folderbrowser/folderBrowser.cs | 37 - .../imagecropper/Config.cs | 61 - .../imagecropper/Data.cs | 124 - .../imagecropper/DataEditor.cs | 209 -- .../imagecropper/DataType.cs | 62 - .../imagecropper/DataTypeData.cs | 24 - .../imagecropper/Helper.cs | 24 - .../imagecropper/ImageInfo.cs | 102 - .../imagecropper/ImageManipulation.cs | 130 -- .../imagecropper/PrevalueEditor.cs | 431 ---- .../imagecropper/Resources.Designer.cs | 159 -- .../imagecropper/Resources.resx | 2014 ----------------- .../imagecropper/SaveData.cs | 105 - .../imagecropper/SmartListBox.cs | 49 - .../label/DataTypeNoEdit.cs | 54 - src/umbraco.editorControls/label/noEdit.cs | 48 - .../macrocontainer/DataType.cs | 66 - .../macrocontainer/Editor.cs | 279 --- .../macrocontainer/MacroContainerEvent.cs | 26 - .../macrocontainer/MacroEditor.cs | 319 --- .../macrocontainer/PrevalueEditor.cs | 310 --- .../MediaChooserScripts.Designer.cs | 81 - .../mediapicker/MediaChooserScripts.resx | 124 - .../mediapicker/MediaPicker.js | 52 - .../mediapicker/MediaPickerDataType.cs | 43 - .../mediapicker/MediaPickerPrevalueEditor.cs | 166 -- .../mediapicker/mediaChooser.cs | 158 -- .../memberpicker/MemberPickerDataType.cs | 37 - .../memberpicker/memberPicker.cs | 88 - .../numberfield/DataInteger.cs | 24 - .../numberfield/DataTypeInteger.cs | 71 - .../numberfield/numberField.cs | 89 - src/umbraco.editorControls/packages.config | 4 - .../pagepicker/PagePickerDataType.cs | 64 - .../pagepicker/pagePicker.cs | 50 - .../relatedlinks/PagePickerDataExtractor.cs | 64 - .../relatedlinks/RelatedLinksData.cs | 15 - .../relatedlinks/RelatedLinksDataEditor.cs | 327 --- .../relatedlinks/RelatedLinksDataType.cs | 55 - .../RelatedLinksPrevalueEditor.cs | 103 - .../simpleEditor/simpleEditor.cs | 105 - .../simpleEditor/simpleEditorDataType.cs | 55 - src/umbraco.editorControls/tags/DataEditor.cs | 180 -- src/umbraco.editorControls/tags/DataType.cs | 60 - .../tags/PrevalueEditor.cs | 111 - src/umbraco.editorControls/tags/library.cs | 332 --- .../textfield/TextFieldDataType.cs | 52 - .../textfield/textFieldDataEditor.cs | 52 - .../textfield/textFieldDataEditor.resx | 42 - .../textfieldMultipleDataType.cs | 58 - .../ultimatePickerDataEditor.cs | 432 ---- .../ultimatepicker/ultimatePickerDataType.cs | 60 - .../ultimatePickerPrevalueEditor.cs | 208 -- .../umbraco.editorControls.csproj | 445 ---- .../uploadfield/DataTypeUploadField.cs | 62 - .../uploadfield/uploadField.cs | 324 --- .../uploadfield/uploadFieldPreValue.cs | 120 - .../IUsercontrolDataEditor.cs | 17 - .../userControlWrapper/SerializationHelper.cs | 35 - .../userControlWrapper/usercontrolData.cs | 43 - .../usercontrolDataEditor.cs | 111 - .../userControlWrapper/usercontrolDataType.cs | 60 - .../usercontrolPrevalueEditor.cs | 326 --- .../wysiwyg/editorButton.cs | 24 - .../yesno/YesNoDataType.cs | 56 - src/umbraco.editorControls/yesno/yesNo.cs | 70 - src/umbraco.sln | 6 - 176 files changed, 34 insertions(+), 19994 deletions(-) delete mode 100644 src/umbraco.editorControls/AbstractJsonPrevalueEditor.cs delete mode 100644 src/umbraco.editorControls/AbstractOptions.cs delete mode 100644 src/umbraco.editorControls/AbstractPrevalueEditor.cs delete mode 100644 src/umbraco.editorControls/BaseDataType.cs delete mode 100644 src/umbraco.editorControls/BaseTreePickerEditor.cs delete mode 100644 src/umbraco.editorControls/CsvToXmlData.cs delete mode 100644 src/umbraco.editorControls/DataTypeGuids.cs delete mode 100644 src/umbraco.editorControls/DefaultData.cs delete mode 100644 src/umbraco.editorControls/DefaultDataKeyValue.cs delete mode 100644 src/umbraco.editorControls/DefaultPrevalueEditor.cs delete mode 100644 src/umbraco.editorControls/KeyValuePrevalueEditor.css delete mode 100644 src/umbraco.editorControls/KeyValuePrevalueEditor.js delete mode 100644 src/umbraco.editorControls/MultiNodeTreePicker/BaseTreeExtensions.cs delete mode 100644 src/umbraco.editorControls/MultiNodeTreePicker/FilteredContentTree.cs delete mode 100644 src/umbraco.editorControls/MultiNodeTreePicker/FilteredMediaTree.cs delete mode 100644 src/umbraco.editorControls/MultiNodeTreePicker/HttpCookieExtensions.cs delete mode 100644 src/umbraco.editorControls/MultiNodeTreePicker/MNTPResources.Designer.cs delete mode 100644 src/umbraco.editorControls/MultiNodeTreePicker/MNTPResources.resx delete mode 100644 src/umbraco.editorControls/MultiNodeTreePicker/MNTP_DataEditor.cs delete mode 100644 src/umbraco.editorControls/MultiNodeTreePicker/MNTP_DataType.cs delete mode 100644 src/umbraco.editorControls/MultiNodeTreePicker/MNTP_PrevalueEditor.cs delete mode 100644 src/umbraco.editorControls/MultiNodeTreePicker/MultiNodePickerScripts.js delete mode 100644 src/umbraco.editorControls/MultiNodeTreePicker/MultiNodePickerStyles.css delete mode 100644 src/umbraco.editorControls/MultiNodeTreePicker/NodeSelectionType.cs delete mode 100644 src/umbraco.editorControls/MultiNodeTreePicker/SelectedItemsTemplate.cs delete mode 100644 src/umbraco.editorControls/MultiNodeTreePicker/XPathExpressionType.cs delete mode 100644 src/umbraco.editorControls/MultiNodeTreePicker/XPathFilterType.cs delete mode 100644 src/umbraco.editorControls/MultiNodeTreePicker/XmlTreeNodeExtensions.cs delete mode 100644 src/umbraco.editorControls/MultipleTextstring/MultipleTextstring.css delete mode 100644 src/umbraco.editorControls/MultipleTextstring/MultipleTextstring.js delete mode 100644 src/umbraco.editorControls/MultipleTextstring/MultipleTextstringControl.cs delete mode 100644 src/umbraco.editorControls/MultipleTextstring/MultipleTextstringDataType.cs delete mode 100644 src/umbraco.editorControls/MultipleTextstring/MultipleTextstringOptions.cs delete mode 100644 src/umbraco.editorControls/MultipleTextstring/MultipleTextstringPrevalueEditor.cs delete mode 100644 src/umbraco.editorControls/PickerRelations/PickerRelationsDataEditor.cs delete mode 100644 src/umbraco.editorControls/PickerRelations/PickerRelationsDataType.cs delete mode 100644 src/umbraco.editorControls/PickerRelations/PickerRelationsEventHandler.cs delete mode 100644 src/umbraco.editorControls/PickerRelations/PickerRelationsOptions.cs delete mode 100644 src/umbraco.editorControls/PickerRelations/PickerRelationsPreValueEditor.cs delete mode 100644 src/umbraco.editorControls/PrevalueEditor.css delete mode 100644 src/umbraco.editorControls/PrevalueEditorExtensions.cs delete mode 100644 src/umbraco.editorControls/Properties/AssemblyInfo.cs delete mode 100644 src/umbraco.editorControls/PropertyTypePicker.cs delete mode 100644 src/umbraco.editorControls/ResourceExtensions.cs delete mode 100644 src/umbraco.editorControls/SettingControls/CheckBox.cs delete mode 100644 src/umbraco.editorControls/SettingControls/CheckBoxList.cs delete mode 100644 src/umbraco.editorControls/SettingControls/DropDownList.cs delete mode 100644 src/umbraco.editorControls/SettingControls/ListBox.cs delete mode 100644 src/umbraco.editorControls/SettingControls/ListBoxMultiple.cs delete mode 100644 src/umbraco.editorControls/SettingControls/Password.cs delete mode 100644 src/umbraco.editorControls/SettingControls/Pickers/BasePicker.cs delete mode 100644 src/umbraco.editorControls/SettingControls/Pickers/Content.cs delete mode 100644 src/umbraco.editorControls/SettingControls/Pickers/Date.cs delete mode 100644 src/umbraco.editorControls/SettingControls/Pickers/DateWithTime.cs delete mode 100644 src/umbraco.editorControls/SettingControls/Pickers/DocumentType.cs delete mode 100644 src/umbraco.editorControls/SettingControls/Pickers/Field.cs delete mode 100644 src/umbraco.editorControls/SettingControls/Pickers/Media.cs delete mode 100644 src/umbraco.editorControls/SettingControls/Pickers/MediaType.cs delete mode 100644 src/umbraco.editorControls/SettingControls/Pickers/MemberGroup.cs delete mode 100644 src/umbraco.editorControls/SettingControls/Pickers/MemberType.cs delete mode 100644 src/umbraco.editorControls/SettingControls/Pickers/Path.cs delete mode 100644 src/umbraco.editorControls/SettingControls/RadioButtonList.cs delete mode 100644 src/umbraco.editorControls/SettingControls/TextArea.cs delete mode 100644 src/umbraco.editorControls/SettingControls/TextField.cs delete mode 100644 src/umbraco.editorControls/SettingControls/Values.cs delete mode 100644 src/umbraco.editorControls/SettingControls/css/Values.css delete mode 100644 src/umbraco.editorControls/SettingControls/js/Values.js delete mode 100644 src/umbraco.editorControls/Slider/SliderControl.cs delete mode 100644 src/umbraco.editorControls/Slider/SliderDataType.cs delete mode 100644 src/umbraco.editorControls/Slider/SliderOptions.cs delete mode 100644 src/umbraco.editorControls/Slider/SliderPrevalueEditor.cs delete mode 100644 src/umbraco.editorControls/XPathCheckBoxList/XPathCheckBoxList.cs delete mode 100644 src/umbraco.editorControls/XPathCheckBoxList/XPathCheckBoxListDataEditor.cs delete mode 100644 src/umbraco.editorControls/XPathCheckBoxList/XPathCheckBoxListDataType.cs delete mode 100644 src/umbraco.editorControls/XPathCheckBoxList/XPathCheckBoxListOptions.cs delete mode 100644 src/umbraco.editorControls/XPathCheckBoxList/XPathCheckBoxListPreValueEditor.cs delete mode 100644 src/umbraco.editorControls/XPathDropDownList/XPathDropDownListDataEditor.cs delete mode 100644 src/umbraco.editorControls/XPathDropDownList/XPathDropDownListDataType.cs delete mode 100644 src/umbraco.editorControls/XPathDropDownList/XPathDropDownListOptions.cs delete mode 100644 src/umbraco.editorControls/XPathDropDownList/XPathDropDownListPreValueEditor.cs delete mode 100644 src/umbraco.editorControls/XmlData.cs delete mode 100644 src/umbraco.editorControls/app.config delete mode 100644 src/umbraco.editorControls/datefieldmultiple/DataTypeDatefieldMultiple.cs delete mode 100644 src/umbraco.editorControls/datepicker/DateData.cs delete mode 100644 src/umbraco.editorControls/datepicker/DateDataType.cs delete mode 100644 src/umbraco.editorControls/datepicker/dateField.cs delete mode 100644 src/umbraco.editorControls/folderbrowser/DataTypeFolderbrowser.cs delete mode 100644 src/umbraco.editorControls/folderbrowser/folderBrowser.cs delete mode 100644 src/umbraco.editorControls/imagecropper/Config.cs delete mode 100644 src/umbraco.editorControls/imagecropper/Data.cs delete mode 100644 src/umbraco.editorControls/imagecropper/DataEditor.cs delete mode 100644 src/umbraco.editorControls/imagecropper/DataType.cs delete mode 100644 src/umbraco.editorControls/imagecropper/DataTypeData.cs delete mode 100644 src/umbraco.editorControls/imagecropper/Helper.cs delete mode 100644 src/umbraco.editorControls/imagecropper/ImageInfo.cs delete mode 100644 src/umbraco.editorControls/imagecropper/ImageManipulation.cs delete mode 100644 src/umbraco.editorControls/imagecropper/PrevalueEditor.cs delete mode 100644 src/umbraco.editorControls/imagecropper/Resources.Designer.cs delete mode 100644 src/umbraco.editorControls/imagecropper/Resources.resx delete mode 100644 src/umbraco.editorControls/imagecropper/SaveData.cs delete mode 100644 src/umbraco.editorControls/imagecropper/SmartListBox.cs delete mode 100644 src/umbraco.editorControls/label/DataTypeNoEdit.cs delete mode 100644 src/umbraco.editorControls/label/noEdit.cs delete mode 100644 src/umbraco.editorControls/macrocontainer/DataType.cs delete mode 100644 src/umbraco.editorControls/macrocontainer/Editor.cs delete mode 100644 src/umbraco.editorControls/macrocontainer/MacroContainerEvent.cs delete mode 100644 src/umbraco.editorControls/macrocontainer/MacroEditor.cs delete mode 100644 src/umbraco.editorControls/macrocontainer/PrevalueEditor.cs delete mode 100644 src/umbraco.editorControls/mediapicker/MediaChooserScripts.Designer.cs delete mode 100644 src/umbraco.editorControls/mediapicker/MediaChooserScripts.resx delete mode 100644 src/umbraco.editorControls/mediapicker/MediaPicker.js delete mode 100644 src/umbraco.editorControls/mediapicker/MediaPickerDataType.cs delete mode 100644 src/umbraco.editorControls/mediapicker/MediaPickerPrevalueEditor.cs delete mode 100644 src/umbraco.editorControls/mediapicker/mediaChooser.cs delete mode 100644 src/umbraco.editorControls/memberpicker/MemberPickerDataType.cs delete mode 100644 src/umbraco.editorControls/memberpicker/memberPicker.cs delete mode 100644 src/umbraco.editorControls/numberfield/DataInteger.cs delete mode 100644 src/umbraco.editorControls/numberfield/DataTypeInteger.cs delete mode 100644 src/umbraco.editorControls/numberfield/numberField.cs delete mode 100644 src/umbraco.editorControls/packages.config delete mode 100644 src/umbraco.editorControls/pagepicker/PagePickerDataType.cs delete mode 100644 src/umbraco.editorControls/pagepicker/pagePicker.cs delete mode 100644 src/umbraco.editorControls/relatedlinks/PagePickerDataExtractor.cs delete mode 100644 src/umbraco.editorControls/relatedlinks/RelatedLinksData.cs delete mode 100644 src/umbraco.editorControls/relatedlinks/RelatedLinksDataEditor.cs delete mode 100644 src/umbraco.editorControls/relatedlinks/RelatedLinksDataType.cs delete mode 100644 src/umbraco.editorControls/relatedlinks/RelatedLinksPrevalueEditor.cs delete mode 100644 src/umbraco.editorControls/simpleEditor/simpleEditor.cs delete mode 100644 src/umbraco.editorControls/simpleEditor/simpleEditorDataType.cs delete mode 100644 src/umbraco.editorControls/tags/DataEditor.cs delete mode 100644 src/umbraco.editorControls/tags/DataType.cs delete mode 100644 src/umbraco.editorControls/tags/PrevalueEditor.cs delete mode 100644 src/umbraco.editorControls/tags/library.cs delete mode 100644 src/umbraco.editorControls/textfield/TextFieldDataType.cs delete mode 100644 src/umbraco.editorControls/textfield/textFieldDataEditor.cs delete mode 100644 src/umbraco.editorControls/textfield/textFieldDataEditor.resx delete mode 100644 src/umbraco.editorControls/textfieldmultiple/textfieldMultipleDataType.cs delete mode 100644 src/umbraco.editorControls/ultimatepicker/ultimatePickerDataEditor.cs delete mode 100644 src/umbraco.editorControls/ultimatepicker/ultimatePickerDataType.cs delete mode 100644 src/umbraco.editorControls/ultimatepicker/ultimatePickerPrevalueEditor.cs delete mode 100644 src/umbraco.editorControls/umbraco.editorControls.csproj delete mode 100644 src/umbraco.editorControls/uploadfield/DataTypeUploadField.cs delete mode 100644 src/umbraco.editorControls/uploadfield/uploadField.cs delete mode 100644 src/umbraco.editorControls/uploadfield/uploadFieldPreValue.cs delete mode 100644 src/umbraco.editorControls/userControlWrapper/IUsercontrolDataEditor.cs delete mode 100644 src/umbraco.editorControls/userControlWrapper/SerializationHelper.cs delete mode 100644 src/umbraco.editorControls/userControlWrapper/usercontrolData.cs delete mode 100644 src/umbraco.editorControls/userControlWrapper/usercontrolDataEditor.cs delete mode 100644 src/umbraco.editorControls/userControlWrapper/usercontrolDataType.cs delete mode 100644 src/umbraco.editorControls/userControlWrapper/usercontrolPrevalueEditor.cs delete mode 100644 src/umbraco.editorControls/wysiwyg/editorButton.cs delete mode 100644 src/umbraco.editorControls/yesno/YesNoDataType.cs delete mode 100644 src/umbraco.editorControls/yesno/yesNo.cs diff --git a/src/Umbraco.Core/ObjectExtensions.cs b/src/Umbraco.Core/ObjectExtensions.cs index 90d173b49a..dc497eadb1 100644 --- a/src/Umbraco.Core/ObjectExtensions.cs +++ b/src/Umbraco.Core/ObjectExtensions.cs @@ -206,7 +206,7 @@ namespace Umbraco.Core return Attempt.Fail(); } - private static Nullable> TryConvertToFromString(this string input, Type destinationType) + private static Attempt? TryConvertToFromString(this string input, Type destinationType) { if (destinationType == typeof(string)) return Attempt.Succeed(input); diff --git a/src/Umbraco.Tests/CodeFirst/Attributes/Numeric.cs b/src/Umbraco.Tests/CodeFirst/Attributes/Numeric.cs index 9c98033b13..623fb1c6bb 100644 --- a/src/Umbraco.Tests/CodeFirst/Attributes/Numeric.cs +++ b/src/Umbraco.Tests/CodeFirst/Attributes/Numeric.cs @@ -1,7 +1,7 @@ using System; using Umbraco.Core.Models; using Umbraco.Tests.CodeFirst.Definitions; -using umbraco.editorControls.numberfield; +using Umbraco.Web.PropertyEditors; namespace Umbraco.Tests.CodeFirst.Attributes { @@ -9,7 +9,7 @@ namespace Umbraco.Tests.CodeFirst.Attributes public class Numeric : PropertyTypeAttribute { public Numeric(string dataTypeName) - : base(typeof(IDataTypenteger)) + : base(typeof(IntegerPropertyEditor)) { DataTypeName = dataTypeName; DatabaseType = DataTypeDatabaseType.Integer; diff --git a/src/Umbraco.Tests/CodeFirst/TestModels/AdvancedContentPage.cs b/src/Umbraco.Tests/CodeFirst/TestModels/AdvancedContentPage.cs index bb30988d59..e02b223b24 100644 --- a/src/Umbraco.Tests/CodeFirst/TestModels/AdvancedContentPage.cs +++ b/src/Umbraco.Tests/CodeFirst/TestModels/AdvancedContentPage.cs @@ -1,12 +1,12 @@ using System; using Umbraco.Tests.CodeFirst.Attributes; -using umbraco.editorControls.textfield; +using Umbraco.Web.PropertyEditors; namespace Umbraco.Tests.CodeFirst.TestModels { public class AdvancedContentPage : SimpleContentPage { - [PropertyType(typeof(TextFieldDataType), PropertyGroup = "Content")] + [PropertyType(typeof(TextboxPropertyEditor), PropertyGroup = "Content")] public string Author { get; set; } public DateTime PublishDate { get; set; } diff --git a/src/Umbraco.Tests/CodeFirst/TestModels/Composition/Meta.cs b/src/Umbraco.Tests/CodeFirst/TestModels/Composition/Meta.cs index d15481df28..cdecc6491b 100644 --- a/src/Umbraco.Tests/CodeFirst/TestModels/Composition/Meta.cs +++ b/src/Umbraco.Tests/CodeFirst/TestModels/Composition/Meta.cs @@ -1,15 +1,14 @@ using Umbraco.Tests.CodeFirst.Attributes; -using umbraco.editorControls.textfield; -using umbraco.editorControls.textfieldmultiple; +using Umbraco.Web.PropertyEditors; namespace Umbraco.Tests.CodeFirst.TestModels.Composition { public class Meta : ContentTypeBase, IMeta { - [PropertyType(typeof(TextFieldDataType), PropertyGroup = "Content")] + [PropertyType(typeof(TextboxPropertyEditor), PropertyGroup = "Content")] public string MetaKeywords { get; set; } - [PropertyType(typeof(textfieldMultipleDataType))] + [PropertyType(typeof(MultipleTextStringPropertyEditor))] public string MetaDescription { get; set; } } diff --git a/src/Umbraco.Tests/CodeFirst/TestModels/Composition/MetaSeo.cs b/src/Umbraco.Tests/CodeFirst/TestModels/Composition/MetaSeo.cs index 1708222053..ef36f0bf7d 100644 --- a/src/Umbraco.Tests/CodeFirst/TestModels/Composition/MetaSeo.cs +++ b/src/Umbraco.Tests/CodeFirst/TestModels/Composition/MetaSeo.cs @@ -1,11 +1,11 @@ using Umbraco.Tests.CodeFirst.Attributes; -using umbraco.editorControls.textfieldmultiple; +using Umbraco.Web.PropertyEditors; namespace Umbraco.Tests.CodeFirst.TestModels.Composition { public class MetaSeo : ContentTypeBase, IMetaSeo { - [PropertyType(typeof(textfieldMultipleDataType))] + [PropertyType(typeof(MultipleTextStringPropertyEditor))] public string FriendlySeoStuff { get; set; } } diff --git a/src/Umbraco.Tests/CodeFirst/TestModels/Composition/News.cs b/src/Umbraco.Tests/CodeFirst/TestModels/Composition/News.cs index 766b9f002d..9849f205c3 100644 --- a/src/Umbraco.Tests/CodeFirst/TestModels/Composition/News.cs +++ b/src/Umbraco.Tests/CodeFirst/TestModels/Composition/News.cs @@ -1,5 +1,5 @@ using Umbraco.Tests.CodeFirst.Attributes; -using umbraco.editorControls.textfield; +using Umbraco.Web.PropertyEditors; namespace Umbraco.Tests.CodeFirst.TestModels.Composition { @@ -8,7 +8,7 @@ namespace Umbraco.Tests.CodeFirst.TestModels.Composition /// public class News : Base, IMetaSeo, IMeta { - [PropertyType(typeof(TextFieldDataType), PropertyGroup = "Content")] + [PropertyType(typeof(TextboxPropertyEditor), PropertyGroup = "Content")] public string Author { get; set; } } } \ No newline at end of file diff --git a/src/Umbraco.Tests/CodeFirst/TestModels/DecoratedModelPage.cs b/src/Umbraco.Tests/CodeFirst/TestModels/DecoratedModelPage.cs index 2fa69e7d4d..34caeba97c 100644 --- a/src/Umbraco.Tests/CodeFirst/TestModels/DecoratedModelPage.cs +++ b/src/Umbraco.Tests/CodeFirst/TestModels/DecoratedModelPage.cs @@ -1,6 +1,6 @@ using System; using Umbraco.Tests.CodeFirst.Attributes; -using umbraco.editorControls.textfield; +using Umbraco.Web.PropertyEditors; namespace Umbraco.Tests.CodeFirst.TestModels { @@ -9,10 +9,10 @@ namespace Umbraco.Tests.CodeFirst.TestModels AllowedTemplates = new[]{"umbMaster"})] public class DecoratedModelPage : ContentTypeBase { - [PropertyType(typeof(TextFieldDataType), PropertyGroup = "Content")] + [PropertyType(typeof(TextboxPropertyEditor), PropertyGroup = "Content")] public string Author { get; set; } - [PropertyType(typeof(TextFieldDataType), PropertyGroup = "Content")] + [PropertyType(typeof(TextboxPropertyEditor), PropertyGroup = "Content")] public string Title { get; set; } [Richtext(PropertyGroup = "Content")] diff --git a/src/Umbraco.Tests/CodeFirst/TestModels/Home.cs b/src/Umbraco.Tests/CodeFirst/TestModels/Home.cs index e874e5a3b1..b8e1014634 100644 --- a/src/Umbraco.Tests/CodeFirst/TestModels/Home.cs +++ b/src/Umbraco.Tests/CodeFirst/TestModels/Home.cs @@ -1,17 +1,16 @@ using Umbraco.Tests.CodeFirst.Attributes; -using umbraco.editorControls.textfield; -using umbraco.editorControls.textfieldmultiple; +using Umbraco.Web.PropertyEditors; namespace Umbraco.Tests.CodeFirst.TestModels { [ContentType("home", AllowedChildContentTypes = new[] { typeof(ContentPage) })] public class Home : ContentTypeBase { - [PropertyType(typeof(TextFieldDataType))] + [PropertyType(typeof(TextboxPropertyEditor))] public string SiteName { get; set; } [Alias("umbSiteDescription", Name = "Site Description")] // ignored by the mapper at the moment - [PropertyType(typeof(textfieldMultipleDataType))] + [PropertyType(typeof(MultipleTextStringPropertyEditor))] public string SiteDescription { get; set; } } } \ No newline at end of file diff --git a/src/Umbraco.Tests/CodeFirst/TestModels/SimpleContentPage.cs b/src/Umbraco.Tests/CodeFirst/TestModels/SimpleContentPage.cs index aa26795b8a..e27d864fcb 100644 --- a/src/Umbraco.Tests/CodeFirst/TestModels/SimpleContentPage.cs +++ b/src/Umbraco.Tests/CodeFirst/TestModels/SimpleContentPage.cs @@ -1,11 +1,11 @@ using Umbraco.Tests.CodeFirst.Attributes; -using umbraco.editorControls.textfield; +using Umbraco.Web.PropertyEditors; namespace Umbraco.Tests.CodeFirst.TestModels { public class SimpleContentPage : ContentTypeBase { - [PropertyType(typeof(TextFieldDataType), PropertyGroup = "Content")] + [PropertyType(typeof(TextboxPropertyEditor), PropertyGroup = "Content")] public string Title { get; set; } [Richtext(PropertyGroup = "Content")] diff --git a/src/Umbraco.Tests/CodeFirst/TestModels/TextPage.cs b/src/Umbraco.Tests/CodeFirst/TestModels/TextPage.cs index 923c8495c7..353c3fa0e9 100644 --- a/src/Umbraco.Tests/CodeFirst/TestModels/TextPage.cs +++ b/src/Umbraco.Tests/CodeFirst/TestModels/TextPage.cs @@ -1,14 +1,14 @@ using Umbraco.Tests.CodeFirst.Attributes; -using umbraco.editorControls.textfield; +using Umbraco.Web.PropertyEditors; namespace Umbraco.Tests.CodeFirst.TestModels { public class TextPage : ContentTypeBase { - [PropertyType(typeof(TextFieldDataType), PropertyGroup = "Content")] + [PropertyType(typeof(TextboxPropertyEditor), PropertyGroup = "Content")] public string Author { get; set; } - [PropertyType(typeof(TextFieldDataType), PropertyGroup = "Content")] + [PropertyType(typeof(TextboxPropertyEditor), PropertyGroup = "Content")] public string Title { get; set; } } } \ No newline at end of file diff --git a/src/Umbraco.Tests/Models/Collections/Item.cs b/src/Umbraco.Tests/Models/Collections/Item.cs index ff1789a850..7f4163218f 100644 --- a/src/Umbraco.Tests/Models/Collections/Item.cs +++ b/src/Umbraco.Tests/Models/Collections/Item.cs @@ -180,8 +180,6 @@ namespace Umbraco.Tests.Models.Collections return false;*/ return ReferenceEquals(left, right); - - return left.Equals(right); } public static bool operator !=(Item left, Item right) diff --git a/src/Umbraco.Tests/Plugins/PluginManagerTests.cs b/src/Umbraco.Tests/Plugins/PluginManagerTests.cs index 07b1910ccc..d4c58e666c 100644 --- a/src/Umbraco.Tests/Plugins/PluginManagerTests.cs +++ b/src/Umbraco.Tests/Plugins/PluginManagerTests.cs @@ -13,7 +13,6 @@ using Umbraco.Core; using Umbraco.Core.IO; using Umbraco.Core.PropertyEditors; using umbraco.DataLayer; -using umbraco.editorControls; using Umbraco.Tests.TestHelpers; using umbraco.uicontrols; using Umbraco.Web; @@ -52,8 +51,7 @@ namespace Umbraco.Tests.Plugins typeof(System.Web.Mvc.ActionResult).Assembly, typeof(TypeFinder).Assembly, typeof(ISqlHelper).Assembly, - typeof(UmbracoContext).Assembly, - typeof(BaseDataType).Assembly + typeof(UmbracoContext).Assembly }; } diff --git a/src/Umbraco.Tests/Plugins/TypeFinderTests.cs b/src/Umbraco.Tests/Plugins/TypeFinderTests.cs index 0f1bf24f39..5faac0e56c 100644 --- a/src/Umbraco.Tests/Plugins/TypeFinderTests.cs +++ b/src/Umbraco.Tests/Plugins/TypeFinderTests.cs @@ -18,7 +18,6 @@ using umbraco.cms.businesslogic; using Umbraco.Core; using Umbraco.Core.IO; using umbraco.DataLayer; -using umbraco.editorControls.tags; using umbraco.interfaces; using Umbraco.Tests.TestHelpers; using umbraco.uicontrols; @@ -59,7 +58,6 @@ namespace Umbraco.Tests.Plugins typeof(System.Web.Mvc.ActionResult).Assembly, typeof(TypeFinder).Assembly, typeof(ISqlHelper).Assembly, - typeof(Tag).Assembly, typeof(global::UmbracoExamine.BaseUmbracoIndexer).Assembly }; diff --git a/src/Umbraco.Tests/Umbraco.Tests.csproj b/src/Umbraco.Tests/Umbraco.Tests.csproj index 19f21fe98d..1a29975872 100644 --- a/src/Umbraco.Tests/Umbraco.Tests.csproj +++ b/src/Umbraco.Tests/Umbraco.Tests.csproj @@ -598,10 +598,6 @@ {C7CB79F0-1C97-4B33-BFA7-00731B579AE2} umbraco.datalayer - - {255F5DF1-4E43-4758-AC05-7A0B68EB021B} - umbraco.editorControls - {511F6D8D-7717-440A-9A57-A507E9A8B27F} umbraco.interfaces diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 858de6fc5f..81d16a1405 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -263,10 +263,6 @@ {31785bc3-256c-4613-b2f5-a1b0bdded8c1} Umbraco.Core - - {255F5DF1-4E43-4758-AC05-7A0B68EB021B} - umbraco.editorControls - {6EDD2061-82F2-461B-BB6E-879245A832DE} umbraco.controls diff --git a/src/Umbraco.Web/Dynamics/DynamicQueryable.cs b/src/Umbraco.Web/Dynamics/DynamicQueryable.cs index 122fa0cd29..2810761788 100644 --- a/src/Umbraco.Web/Dynamics/DynamicQueryable.cs +++ b/src/Umbraco.Web/Dynamics/DynamicQueryable.cs @@ -194,13 +194,9 @@ namespace Umbraco.Web.Dynamics } } - bool isDynamicNodeList = false; - if (typedSource != null) - { - isDynamicNodeList = true; - } + bool isDynamicNodeList = false || typedSource != null; - ParameterExpression[] parameters = new ParameterExpression[] { + ParameterExpression[] parameters = new ParameterExpression[] { Expression.Parameter(source.ElementType, "") }; var parser = new ExpressionParser(parameters, ordering, values, false); IEnumerable orderings = parser.ParseOrdering(); diff --git a/src/Umbraco.Web/Dynamics/ExpressionParser.cs b/src/Umbraco.Web/Dynamics/ExpressionParser.cs index d348682428..0f5f366277 100644 --- a/src/Umbraco.Web/Dynamics/ExpressionParser.cs +++ b/src/Umbraco.Web/Dynamics/ExpressionParser.cs @@ -516,7 +516,7 @@ namespace Umbraco.Web.Dynamics ParameterExpression[] parameters = new ParameterExpression[(expr as LambdaExpression).Parameters.Count]; (expr as LambdaExpression).Parameters.CopyTo(parameters, 0); var invokedExpr = Expression.Invoke(expr, parameters); - var not = Expression.Not(Expression.TypeAs(invokedExpr, typeof(Nullable))); + var not = Expression.Not(Expression.TypeAs(invokedExpr, typeof(bool?))); expr = Expression.Lambda>( Expression.Condition( Expression.Property(not, "HasValue"), diff --git a/src/Umbraco.Web/UmbracoHelper.cs b/src/Umbraco.Web/UmbracoHelper.cs index e18b912e9a..3ac19a1987 100644 --- a/src/Umbraco.Web/UmbracoHelper.cs +++ b/src/Umbraco.Web/UmbracoHelper.cs @@ -1175,11 +1175,7 @@ namespace Umbraco.Web insideTagSpaceEncountered = false; currentTag = string.Empty; tagContents = string.Empty; - isTagClose = false; - if (tr.Peek() == (int)'/') - { - isTagClose = true; - } + isTagClose = false || tr.Peek() == (int)'/'; } else if (ic == (int)'>') { diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUser.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUser.aspx.cs index b5fff5e39a..33877a082f 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUser.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUser.aspx.cs @@ -240,10 +240,7 @@ namespace umbraco.cms.presentation.user void sectionValidator_ServerValidate(object source, ServerValidateEventArgs args) { - args.IsValid = false; - - if (lapps.SelectedIndex >= 0) - args.IsValid = true; + args.IsValid = false || lapps.SelectedIndex >= 0; } private void SetupChannel() diff --git a/src/umbraco.cms/businesslogic/web/StylesheetProperty.cs b/src/umbraco.cms/businesslogic/web/StylesheetProperty.cs index 230b03fa1d..71527fa0da 100644 --- a/src/umbraco.cms/businesslogic/web/StylesheetProperty.cs +++ b/src/umbraco.cms/businesslogic/web/StylesheetProperty.cs @@ -146,15 +146,15 @@ namespace umbraco.cms.businesslogic.web /// /// The save event handler /// - new public delegate void SaveEventHandler(StylesheetProperty sender, SaveEventArgs e); + public delegate void SaveEventHandler(StylesheetProperty sender, SaveEventArgs e); /// /// The new event handler /// - new public delegate void NewEventHandler(StylesheetProperty sender, NewEventArgs e); + public delegate void NewEventHandler(StylesheetProperty sender, NewEventArgs e); /// /// The delete event handler /// - new public delegate void DeleteEventHandler(StylesheetProperty sender, DeleteEventArgs e); + public delegate void DeleteEventHandler(StylesheetProperty sender, DeleteEventArgs e); /// diff --git a/src/umbraco.controls/TabView.cs b/src/umbraco.controls/TabView.cs index 30f5688fd5..06b1461ad2 100644 --- a/src/umbraco.controls/TabView.cs +++ b/src/umbraco.controls/TabView.cs @@ -48,10 +48,7 @@ namespace umbraco.uicontrols { for (int i = 0; i < Tabs.Count; i++) { var tabPage = TabPages.ElementAt(i).Value; - tabPage.Active = false; - - if (tabPage.ID == ActiveTabId) - tabPage.Active = true; + tabPage.Active = false || tabPage.ID == ActiveTabId; _tabsHolder.Controls.Add(tabPage); } diff --git a/src/umbraco.controls/UmbracoClientDependencyLoader.cs b/src/umbraco.controls/UmbracoClientDependencyLoader.cs index 06c369a5a1..8838bcf90b 100644 --- a/src/umbraco.controls/UmbracoClientDependencyLoader.cs +++ b/src/umbraco.controls/UmbracoClientDependencyLoader.cs @@ -28,7 +28,7 @@ namespace umbraco.uicontrols } - public static new ClientDependencyLoader TryCreate(Control parent, out bool isNew) + public static ClientDependencyLoader TryCreate(Control parent, out bool isNew) { if (ClientDependencyLoader.Instance == null) { diff --git a/src/umbraco.editorControls/AbstractJsonPrevalueEditor.cs b/src/umbraco.editorControls/AbstractJsonPrevalueEditor.cs deleted file mode 100644 index 1b61f5fb60..0000000000 --- a/src/umbraco.editorControls/AbstractJsonPrevalueEditor.cs +++ /dev/null @@ -1,109 +0,0 @@ -using System; -using System.Web.Script.Serialization; -using Umbraco.Core.Logging; -using umbraco.BusinessLogic; -using umbraco.cms.businesslogic.datatype; - -namespace umbraco.editorControls -{ - /// - /// Abstract class for the PreValue Editor. - /// Specifically designed to serialize/deserialize the options as JSON. - /// - [Obsolete("IDataType and all other references to the legacy property editors are no longer used this will be removed from the codebase in future versions")] - public abstract class AbstractJsonPrevalueEditor : AbstractPrevalueEditor - { - /// - /// The underlying base data-type. - /// - protected readonly umbraco.cms.businesslogic.datatype.BaseDataType m_DataType; - - /// - /// An object to temporarily lock writing to the database. - /// - private static readonly object m_Locker = new object(); - - /// - /// Initializes a new instance of the class. - /// - /// Type of the data. - public AbstractJsonPrevalueEditor(umbraco.cms.businesslogic.datatype.BaseDataType dataType) - { - this.m_DataType = dataType; - } - - /// - /// Initializes a new instance of the class. - /// - /// Type of the data. - /// Type of the database field. - public AbstractJsonPrevalueEditor(umbraco.cms.businesslogic.datatype.BaseDataType dataType, umbraco.cms.businesslogic.datatype.DBTypes dbType) - : base() - { - this.m_DataType = dataType; - this.m_DataType.DBType = dbType; - } - - /// - /// Gets the PreValue options for the data-type. - /// - /// The type of the resulting object. - /// - /// Returns the options for the PreValue Editor - /// - public T GetPreValueOptions() - { - var prevalues = PreValues.GetPreValues(this.m_DataType.DataTypeDefinitionId); - if (prevalues.Count > 0) - { - var prevalue = (PreValue)prevalues[0]; - if (!string.IsNullOrEmpty(prevalue.Value)) - { - try - { - // deserialize the options - var serializer = new JavaScriptSerializer(); - - // return the options - return serializer.Deserialize(prevalue.Value); - } - catch (Exception ex) - { - LogHelper.Error("umbraco.editorControls: Execption thrown", ex); - } - } - } - - // if all else fails, return default options - return default(T); - } - - /// - /// Saves the data-type PreValue options. - /// - public void SaveAsJson(object options) - { - // serialize the options into JSON - var serializer = new JavaScriptSerializer(); - var json = serializer.Serialize(options); - - lock (m_Locker) - { - var prevalues = PreValues.GetPreValues(this.m_DataType.DataTypeDefinitionId); - if (prevalues.Count > 0) - { - var prevalue = (PreValue)prevalues[0]; - - // update - prevalue.Value = json; - prevalue.Save(); - } - else - { - // insert - PreValue.MakeNew(this.m_DataType.DataTypeDefinitionId, json); - } - } - } - } -} \ No newline at end of file diff --git a/src/umbraco.editorControls/AbstractOptions.cs b/src/umbraco.editorControls/AbstractOptions.cs deleted file mode 100644 index ccdc460700..0000000000 --- a/src/umbraco.editorControls/AbstractOptions.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using System.ComponentModel; - -namespace umbraco.editorControls -{ - /// - /// Abstract class for the Prevalue Editor options. - /// - [Obsolete("IDataType and all other references to the legacy property editors are no longer used this will be removed from the codebase in future versions")] - public abstract class AbstractOptions - { - /// - /// Initializes a new instance of the class. - /// - public AbstractOptions() - { - } - - /// - /// Initializes a new instance of the class. - /// - /// if set to true [load defaults]. - public AbstractOptions(bool loadDefaults) - : this() - { - if (loadDefaults) - { - // get the type of the object. - var type = this.GetType(); - - // iterate through the properties. - foreach (var property in type.GetProperties()) - { - // iterate through the DefaultValue attributes. - foreach (DefaultValueAttribute attribute in property.GetCustomAttributes(typeof(DefaultValueAttribute), true)) - { - // set the default value of the property. - property.SetValue(this, attribute.Value, null); - } - } - } - } - } -} \ No newline at end of file diff --git a/src/umbraco.editorControls/AbstractPrevalueEditor.cs b/src/umbraco.editorControls/AbstractPrevalueEditor.cs deleted file mode 100644 index a7e5b735ad..0000000000 --- a/src/umbraco.editorControls/AbstractPrevalueEditor.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using System.Web.UI; -using System.Web.UI.WebControls; -using ClientDependency.Core; -using umbraco.interfaces; -using umbraco.cms.businesslogic.datatype; - -[assembly: WebResource("umbraco.editorControls.PrevalueEditor.css", "text/css")] - -namespace umbraco.editorControls -{ - /// - /// Abstract class for the PreValue Editor. - /// - [Obsolete("IDataType and all other references to the legacy property editors are no longer used this will be removed from the codebase in future versions")] - public abstract class AbstractPrevalueEditor : WebControl, IDataPrevalue - { - /// - /// Initializes a new instance of the class. - /// - public AbstractPrevalueEditor() - : base() - { - } - - /// - /// Gets the editor. - /// - /// The editor. - public virtual Control Editor - { - get - { - return this; - } - } - - /// - /// Saves this instance. - /// - public virtual void Save() - { - } - - /// - /// Raises the event. - /// - /// An object that contains the event data. - protected override void OnInit(EventArgs e) - { - base.OnInit(e); - this.EnsureChildControls(); - - // Adds the client dependencies. - this.RegisterEmbeddedClientResource(typeof(AbstractPrevalueEditor), "umbraco.editorControls.PrevalueEditor.css", ClientDependencyType.Css); - } - - /// - /// Renders the HTML opening tag of the control to the specified writer. This method is used primarily by control developers. - /// - /// A that represents the output stream to render HTML content on the client. - public override void RenderBeginTag(HtmlTextWriter writer) - { - writer.AddAttribute(HtmlTextWriterAttribute.Class, "PrevalueEditor"); - writer.RenderBeginTag(HtmlTextWriterTag.Div); - - base.RenderBeginTag(writer); - } - - /// - /// Renders the HTML closing tag of the control into the specified writer. This method is used primarily by control developers. - /// - /// A that represents the output stream to render HTML content on the client. - public override void RenderEndTag(HtmlTextWriter writer) - { - base.RenderEndTag(writer); - - writer.RenderEndTag(); - } - } -} \ No newline at end of file diff --git a/src/umbraco.editorControls/BaseDataType.cs b/src/umbraco.editorControls/BaseDataType.cs deleted file mode 100644 index ce132d0784..0000000000 --- a/src/umbraco.editorControls/BaseDataType.cs +++ /dev/null @@ -1,96 +0,0 @@ -using System; - -using umbraco.DataLayer; -using umbraco.BusinessLogic; - -namespace umbraco.editorControls -{ - [Obsolete("IDataType and all other references to the legacy property editors are no longer used this will be removed from the codebase in future versions")] - public abstract class BaseDataType - { - private int _datatypedefinitionid; - private string _datafield = ""; - private DBTypes _DBType; - - protected static ISqlHelper SqlHelper - { - get { return Application.SqlHelper; } - } - - public BaseDataType() - {} - - #region IDataType Members - public abstract Guid Id {get;} - public abstract string DataTypeName{get;} - public abstract interfaces.IDataEditor DataEditor{get;} - public abstract interfaces.IDataPrevalue PrevalueEditor {get;} - public abstract interfaces.IData Data{get;} - - public int DataTypeDefinitionId { - set { - _datatypedefinitionid = value; - } - get { - return _datatypedefinitionid; - } - } - - public DBTypes DBType { - get { - string test= ""; - if (_datafield == "") - test = DataFieldName; - return _DBType; - } - set { - _DBType = value; - SqlHelper.ExecuteNonQuery("update cmsDataType set dbType = '" + value.ToString() + "' where nodeId = @datadefinitionid", - SqlHelper.CreateParameter("@datadefinitionid",_datatypedefinitionid)).ToString(); - - } - } - // Umbraco legacy - get the datafield - the columnname of the cmsPropertyData table - // where to find the data, since it's configurable - there is no way of telling if - // its a bit, nvarchar, ntext or datetime field. - // get it by lookup the value associated to the datatypedefinition id. - public string DataFieldName - { - get { - if (_datafield == "") - { - string dbtypestr = SqlHelper.ExecuteScalar("select dbType from cmsDataType where nodeId = @datadefinitionid", - SqlHelper.CreateParameter("@datadefinitionid",_datatypedefinitionid)); - DBTypes DataTypeSQLType = (DBTypes) Enum.Parse(typeof(DBTypes),dbtypestr,true); - _DBType = DataTypeSQLType; - switch (DataTypeSQLType) - { - case DBTypes.Date : - _datafield = "dataDate"; - break; - case DBTypes.Integer : - _datafield = "DataInt"; - break; - case DBTypes.Ntext : - _datafield = "dataNtext"; - break; - case DBTypes.Nvarchar : - _datafield = "dataNvarchar"; - break; - } - return _datafield; - } - return _datafield; - } - } - #endregion - } - [Obsolete("IDataType and all other references to the legacy property editors are no longer used this will be removed from the codebase in future versions")] - public enum DBTypes - { - Integer, - Date, - Nvarchar, - Ntext - } -} diff --git a/src/umbraco.editorControls/BaseTreePickerEditor.cs b/src/umbraco.editorControls/BaseTreePickerEditor.cs deleted file mode 100644 index 1e2305be45..0000000000 --- a/src/umbraco.editorControls/BaseTreePickerEditor.cs +++ /dev/null @@ -1,116 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using umbraco.uicontrols.TreePicker; -using umbraco.interfaces; -using System.Web.UI; -using umbraco.presentation; - -namespace umbraco.editorControls -{ - /// - /// A base tree picker class that has all of the functionality built in for an IDataEditor - /// - [Obsolete("IDataType and all other references to the legacy property editors are no longer used this will be removed from the codebase in future versions")] - public abstract class BaseTreePickerEditor : BaseTreePicker, IDataEditor - { - - interfaces.IData _data; - protected int StoredItemId = -1; - - public BaseTreePickerEditor() - : base() { } - - public BaseTreePickerEditor(IData Data) - : base() - { - _data = Data; - } - - private void StoreItemId(IData Data) - { - if (_data != null && _data.Value != null && !String.IsNullOrEmpty(_data.Value.ToString())) - { - int.TryParse(_data.Value.ToString(), out StoredItemId); - } - } - - protected override void OnInit(EventArgs e) - { - StoreItemId(_data); - - // zb-00024 #299260 : see the loooong comments in OnLoad - // setting the value here seems OK but use this.Value to ensure - // that the hidden control exists - this.Value = StoredItemId != -1 ? StoredItemId.ToString() : ""; - - base.OnInit(e); - } - - protected override void OnLoad(EventArgs e) - { - base.OnLoad(e); - - //need to check if this is an async postback in live editing, because if it is, we need to set the value - //SD: Since live editing is removed I don't really think this is at all necessary but it's still here. - if ((ScriptManager.GetCurrent(Page).IsInAsyncPostBack) || !Page.IsPostBack) - { - ItemIdValue.Value = StoredItemId != -1 ? StoredItemId.ToString() : ""; - } - - // zb-00024 #299260 : support postback - // on postback ItemIdValue.Value is restored by LoadPostData - // on non-postback it is initialized by the code above - // w/RCC when clicking on 'edit' it is not initialized - - // StoredItemId is initialized in OnInit with whatever comes from the - // database, or from what the RCC decides we need to display--but when - // we changes something in the web page, it is handled by LoadPostData - - // RCC 'edit': - // ItemIdValue.Value has no value, or a wrong value, which we should ignore - // StoredItemId is initialized with the right value in RCC code - // so we'd need to set ItemIdValue.Value from it - - // but if we do it in prerender then we copy over the /old/ StoredItemIt - // value which was the one before we saved... because we don't refresh it - // when we update - - // and if we refresh it here we are in trouble because we overwrite what - // comes from the form and we can't actually change the value anymore - - // so we should change it /once/ the ItemIdValue.Value changes have been - // akn - - // the viewed image ID is set in mediaChoose onPreRender from - // ItemIdValue.Value so we really want it to have a value! - } - - #region IDataField Members - - public System.Web.UI.Control Editor { get { return this; } } - - public virtual bool TreatAsRichTextEditor - { - get { return false; } - } - public bool ShowLabel - { - get - { - return true; - } - } - - public void Save() - { - if (ItemIdValue.Value.Trim() != "") - _data.Value = int.Parse(ItemIdValue.Value.Trim()); - else - _data.Value = null; - } - - #endregion - } -} diff --git a/src/umbraco.editorControls/CsvToXmlData.cs b/src/umbraco.editorControls/CsvToXmlData.cs deleted file mode 100644 index 6bae96bcf6..0000000000 --- a/src/umbraco.editorControls/CsvToXmlData.cs +++ /dev/null @@ -1,98 +0,0 @@ -using System; -using System.Xml; -using umbraco; -using umbraco.cms.businesslogic.datatype; - -namespace umbraco.editorControls -{ - /// - /// Overrides the object to return the value as XML. - /// - [Obsolete("IDataType and all other references to the legacy property editors are no longer used this will be removed from the codebase in future versions")] - public class CsvToXmlData : umbraco.cms.businesslogic.datatype.DefaultData - { - /// - /// The separators to split the delimited string. - /// - private string[] separator; - - /// - /// Name for the root node. - /// - private string rootName; - - /// - /// Name for the element/node that contains the value. - /// - private string elementName; - - /// - /// Initializes a new instance of the class. - /// - /// Type of the data. - public CsvToXmlData(umbraco.cms.businesslogic.datatype.BaseDataType dataType) - : this(dataType, "values") - { - } - - /// - /// Initializes a new instance of the class. - /// - /// Type of the data. - /// Name of the root. - public CsvToXmlData(umbraco.cms.businesslogic.datatype.BaseDataType dataType, string rootName) - : this(dataType, rootName, "value") - { - } - - - /// - /// Initializes a new instance of the class. - /// - /// Type of the data. - /// Name of the root. - /// Name of the element. - public CsvToXmlData(umbraco.cms.businesslogic.datatype.BaseDataType dataType, string rootName, string elementName) - : this(dataType, rootName, elementName, new[] { "," }) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// Type of the data. - /// Name of the root. - /// Name of the element. - /// The separator. - public CsvToXmlData(umbraco.cms.businesslogic.datatype.BaseDataType dataType, string rootName, string elementName, string[] separator) - : base(dataType) - { - this.rootName = rootName; - this.elementName = elementName; - this.separator = separator; - } - - /// - /// Converts the data value to XML. - /// - /// The data to convert to XML. - /// Returns the data value as an XmlNode - public override XmlNode ToXMl(XmlDocument data) - { - // check that the value isn't null - if (this.Value != null) - { - // split the CSV data into an XML document. - var xml = xmlHelper.Split(new XmlDocument(), this.Value.ToString(), this.separator, this.rootName, this.elementName); - - // return the XML node. - return data.ImportNode(xml.DocumentElement, true); - } - else - { - // otherwise render the value as default (in CDATA) - return base.ToXMl(data); - } - } - } -} \ No newline at end of file diff --git a/src/umbraco.editorControls/DataTypeGuids.cs b/src/umbraco.editorControls/DataTypeGuids.cs deleted file mode 100644 index d50bcba1f2..0000000000 --- a/src/umbraco.editorControls/DataTypeGuids.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System; -using Umbraco.Core; - -namespace umbraco.editorControls -{ - /// - /// Defines the Guids for all the DataTypes; e.g. quick access to 3rd-party developers. - /// - [Obsolete("This class is now obsolete please use Umbraco.Core.Constants.PropertyEditors", false)] - public static class DataTypeGuids - { - /// - /// Guid for the MultiNodeTreePicker data-type. - /// - [Obsolete("This property is now obsolete please use Umbraco.Core.Constants.PropertyEditors.MultiNodeTreePicker", false)] - public const string MultiNodeTreePickerId = Constants.PropertyEditors.MultiNodeTreePicker; - - /// - /// Guid for the MultipleTextstring data-type. - /// - [Obsolete("This property is now obsolete please use Umbraco.Core.Constants.PropertyEditors.MultipleTextstring", false)] - public const string MultipleTextstringId = Constants.PropertyEditors.MultipleTextstring; - - /// - /// Guid for the PickerRelations (previoulsy uComponents: MultiPickerRelations) - /// - [Obsolete("This property is now obsolete please use Umbraco.Core.Constants.PropertyEditors.PickerRelations", false)] - public const string PickerRelationsId = Constants.PropertyEditors.PickerRelations; - - /// - /// Guid for the Slider data-type. - /// - [Obsolete("This property is now obsolete please use Umbraco.Core.Constants.PropertyEditors.Slider", false)] - public const string SliderId = Constants.PropertyEditors.Slider; - - /// - /// Guid for the XPathCheckBoxList data-type. - /// - [Obsolete("This property is now obsolete please use Umbraco.Core.Constants.PropertyEditors.XPathCheckBoxList", false)] - public const string XPathCheckBoxListId = Constants.PropertyEditors.XPathCheckBoxList; - - /// - /// Guid for the XPathDropDownList data-type. - /// - [Obsolete("This property is now obsolete please use Umbraco.Core.Constants.PropertyEditors.XPathDropDownList", false)] - public const string XPathDropDownListId = Constants.PropertyEditors.XPathDropDownList; - } -} \ No newline at end of file diff --git a/src/umbraco.editorControls/DefaultData.cs b/src/umbraco.editorControls/DefaultData.cs deleted file mode 100644 index 955d6da7c9..0000000000 --- a/src/umbraco.editorControls/DefaultData.cs +++ /dev/null @@ -1,101 +0,0 @@ -using System; -using Umbraco.Core.Logging; -using umbraco.BusinessLogic; -using umbraco.DataLayer; - -namespace umbraco.editorControls -{ - [Obsolete("Use umbraco.cms.businesslogic.datatype.DefaultData instead")] - public class DefaultData : interfaces.IData - { - private int _propertyId; - private object _value; - protected BaseDataType _dataType; - - public static ISqlHelper SqlHelper - { - get { return Application.SqlHelper; } - } - - public DefaultData(BaseDataType DataType) { - _dataType = DataType; - } - - #region IData Members - - public virtual System.Xml.XmlNode ToXMl(System.Xml.XmlDocument d) - { - if (this._dataType.DBType == DBTypes.Ntext) - return d.CreateCDataSection(this.Value.ToString()); - return d.CreateTextNode(Value.ToString()); - } - - public object Value - { - get - { - return _value; - } - set - { - // Try to set null values if possible - try - { - if (value == null) - SqlHelper.ExecuteNonQuery("update cmsPropertyData set "+ _dataType.DataFieldName +" = NULL where id = " + _propertyId); - else - SqlHelper.ExecuteNonQuery("update cmsPropertyData set "+ _dataType.DataFieldName +" = @value where id = " + _propertyId, SqlHelper.CreateParameter("@value", value) ); - _value = value; - } - catch (Exception e) - { - LogHelper.Error(typeof(DefaultData), "Error updating item: " + e.ToString(), e); - - if (value==null) value =""; - SqlHelper.ExecuteNonQuery("update cmsPropertyData set "+ _dataType.DataFieldName +" = @value where id = " + _propertyId, SqlHelper.CreateParameter("@value", value) ); - _value = value; - } - - } - } - - public virtual void MakeNew(int PropertyId) - { - // this default implementation of makenew does not do anything sínce - // it uses the default datastorage of umbraco, and the row is already populated by the "property" object - // If the datatype needs to have a default value, inherit this class and override this method. - } - - public void Delete() { - // this default implementation of delete does not do anything sínce - // it uses the default datastorage of umbraco, and the row is already deleted by the "property" object - } - - public int PropertyId - { - get { - return _propertyId; - } - set - { - _propertyId = value; - _value = SqlHelper.ExecuteScalar("Select " + _dataType.DataFieldName + " from cmsPropertyData where id = " + value); - } - } - - // TODO: clean up Legacy - these are needed by the wysiwyeditor, in order to feed the richtextholder with version and nodeid - // solution, create a new version of the richtextholder, which does not depend on these. - public Guid Version { - get { - return new Guid(SqlHelper.ExecuteScalar("Select versionId from cmsPropertyData where id = " + PropertyId).ToString()); - } - } - - public int NodeId { - get { - return SqlHelper.ExecuteScalar("Select contentNodeid from cmsPropertyData where id = " + PropertyId); - } - } - #endregion - } -} diff --git a/src/umbraco.editorControls/DefaultDataKeyValue.cs b/src/umbraco.editorControls/DefaultDataKeyValue.cs deleted file mode 100644 index d1288cbd1f..0000000000 --- a/src/umbraco.editorControls/DefaultDataKeyValue.cs +++ /dev/null @@ -1,50 +0,0 @@ -using System; -using System.Linq; -using Umbraco.Core.Logging; - -namespace umbraco.editorControls -{ - /// - /// Summary description for cms.businesslogic.datatype.DefaultDataKeyValue. - /// - [Obsolete("IDataType and all other references to the legacy property editors are no longer used this will be removed from the codebase in future versions")] - public class DefaultDataKeyValue : cms.businesslogic.datatype.DefaultData - { - public DefaultDataKeyValue(cms.businesslogic.datatype.BaseDataType DataType) - : base(DataType) - { } - - /// - /// Gets the values of from cmsDataTypePreValues table by id and puts them into a CDATA section - /// - /// - /// - public override System.Xml.XmlNode ToXMl(System.Xml.XmlDocument xmlDocument) - { - var value = string.Empty; - try - { - // Don't query if there's nothing to query for.. - if (string.IsNullOrWhiteSpace(Value.ToString()) == false) - { - var dr = SqlHelper.ExecuteReader(string.Format("Select [value] from cmsDataTypeprevalues where id in ({0})", SqlHelper.EscapeString(Value.ToString()))); - - while (dr.Read()) - { - value += value.Length == 0 - ? dr.GetString("value") - : string.Format(",{0}", dr.GetString("value")); - } - - dr.Close(); - } - } - catch (Exception ex) - { - LogHelper.Error("An exception occurred converting the property data to XML", ex); - } - - return xmlDocument.CreateCDataSection(value); - } - } -} diff --git a/src/umbraco.editorControls/DefaultPrevalueEditor.cs b/src/umbraco.editorControls/DefaultPrevalueEditor.cs deleted file mode 100644 index 6386cfd5c5..0000000000 --- a/src/umbraco.editorControls/DefaultPrevalueEditor.cs +++ /dev/null @@ -1,216 +0,0 @@ -using System; -using System.Web.UI; -using System.Web.UI.WebControls; - -using umbraco.interfaces; -using umbraco.BusinessLogic; -using umbraco.DataLayer; - -namespace umbraco.editorControls -{ - [Obsolete("IDataType and all other references to the legacy property editors are no longer used this will be removed from the codebase in future versions")] - public class DefaultPrevalueEditor : PlaceHolder, IDataPrevalue - { - // UI controls - private TextBox _textbox; - private DropDownList _dropdownlist; - - // referenced datatype - private cms.businesslogic.datatype.BaseDataType _datatype; - private BaseDataType _datatypeOld; - - private bool _isEnsured = false; - private string _prevalue; - private bool _displayTextBox; - - public static ISqlHelper SqlHelper - { - get { return Application.SqlHelper; } - } - - /// - /// The default editor for editing the build-in pre values in umbraco - /// - /// The DataType to be parsed - /// Whether to use the default text box - public DefaultPrevalueEditor(cms.businesslogic.datatype.BaseDataType DataType, bool DisplayTextBox) - { - // state it knows its datatypedefinitionid - _displayTextBox = DisplayTextBox; - _datatype = DataType; - setupChildControls(); - } - - /// - /// For backwards compatibility, should be replaced in your extension with the constructor that - /// uses the BaseDataType from the cms.businesslogic.datatype namespace - /// - /// The DataType to be parsed (note: the BaseDataType from editorControls is obsolete) - /// Whether to use the default text box - public DefaultPrevalueEditor(BaseDataType DataType, bool DisplayTextBox) - { - // state it knows its datatypedefinitionid - _displayTextBox = DisplayTextBox; - _datatypeOld = DataType; - setupChildControls(); - } - - private void setupChildControls() - { - _dropdownlist = new DropDownList(); - _dropdownlist.ID = "dbtype"; - - _textbox = new TextBox(); - _textbox.ID = "prevalues"; - _textbox.Visible = _displayTextBox; - - // put the childcontrols in context - ensuring that - // the viewstate is persisted etc. - Controls.Add(_textbox); - Controls.Add(_dropdownlist); - - _dropdownlist.Items.Add(DBTypes.Date.ToString()); - _dropdownlist.Items.Add(DBTypes.Integer.ToString()); - _dropdownlist.Items.Add(DBTypes.Ntext.ToString()); - _dropdownlist.Items.Add(DBTypes.Nvarchar.ToString()); - } - - protected override void OnLoad(EventArgs e) - { - base.OnLoad(e); - if (!Page.IsPostBack) - { - if (_datatype != null) - _dropdownlist.SelectedValue = _datatype.DBType.ToString(); - else - _dropdownlist.SelectedValue = _datatypeOld.DBType.ToString(); - - _textbox.Text = Prevalue; - } - } - - public string Prevalue - { - get - { - ensurePrevalue(); - if (_prevalue == null) { - int defId; - if (_datatype != null) - defId = _datatype.DataTypeDefinitionId; - else if (_datatypeOld != null) - defId = _datatypeOld.DataTypeDefinitionId; - else - throw new ArgumentException("Datatype is not initialized"); - - _prevalue = - SqlHelper.ExecuteScalar("Select [value] from cmsDataTypePreValues where DataTypeNodeId = " + defId); - } - return _prevalue; - } - set - { - int defId; - if (_datatype != null) - defId = _datatype.DataTypeDefinitionId; - else if (_datatypeOld != null) - defId = _datatypeOld.DataTypeDefinitionId; - else - throw new ArgumentException("Datatype is not initialized"); - - _prevalue = value; - ensurePrevalue(); - IParameter[] SqlParams = new IParameter[] - { - SqlHelper.CreateParameter("@value", _textbox.Text), - SqlHelper.CreateParameter("@dtdefid", defId) - }; - // update prevalue - SqlHelper.ExecuteNonQuery("update cmsDataTypePreValues set [value] = @value where datatypeNodeId = @dtdefid", SqlParams); - } - } - - private void ensurePrevalue() - { - if (!_isEnsured) - { - - int defId; - if (_datatype != null) - defId = _datatype.DataTypeDefinitionId; - else if (_datatypeOld != null) - defId = _datatypeOld.DataTypeDefinitionId; - else - throw new ArgumentException("Datatype is not initialized"); - - - bool hasPrevalue = (SqlHelper.ExecuteScalar("select count(id) from cmsDataTypePreValues where dataTypeNodeId = " + defId) > 0); - IParameter[] SqlParams = new IParameter[] - { - SqlHelper.CreateParameter("@value", _textbox.Text), - SqlHelper.CreateParameter("@dtdefid", defId) - }; - if (!hasPrevalue) - { - SqlHelper.ExecuteNonQuery("insert into cmsDataTypePreValues (datatypenodeid,[value],sortorder,alias) values (@dtdefid,@value,0,'')", - SqlParams); - } - _isEnsured = true; - } - } - - public Control Editor - { - get { return this; } - } - - public void Save() - { - // save the prevalue data and get on with you life ;) - if (_datatype != null) - _datatype.DBType = (cms.businesslogic.datatype.DBTypes)Enum.Parse(typeof (cms.businesslogic.datatype.DBTypes), _dropdownlist.SelectedValue, true); - else if (_datatypeOld != null) - _datatypeOld.DBType = (DBTypes)Enum.Parse(typeof (DBTypes), _dropdownlist.SelectedValue, true); - - - if (_displayTextBox) - { - // If the prevalue editor has an prevalue textbox - save the textbox value as the prevalue - Prevalue = _textbox.Text; - } - } - - protected override void Render(HtmlTextWriter writer) - { - writer.Write("
" + ui.Text("dataBaseDatatype") + "
"); - _dropdownlist.RenderControl(writer); - writer.Write("
"); - - - if (_displayTextBox) { - writer.Write("
" + ui.Text("prevalue") + "
"); - _textbox.RenderControl(writer); - writer.Write("
"); - } - - /* - writer.WriteLine("
"); - writer.WriteLine("Database datatype"); - _dropdownlist.RenderControl(writer); - writer.Write(""); - if (_displayTextBox) - writer.WriteLine("Prevalue: "); - _textbox.RenderControl(writer); - writer.WriteLine(""); - writer.Write("
"); - */ - - } - - public static string GetPrevalueFromId(int Id) - { - return SqlHelper.ExecuteScalar("Select [value] from cmsDataTypePreValues where id = @id", - SqlHelper.CreateParameter("@id", Id)); - } - } -} \ No newline at end of file diff --git a/src/umbraco.editorControls/KeyValuePrevalueEditor.css b/src/umbraco.editorControls/KeyValuePrevalueEditor.css deleted file mode 100644 index 71c9b57a7e..0000000000 --- a/src/umbraco.editorControls/KeyValuePrevalueEditor.css +++ /dev/null @@ -1,7 +0,0 @@ - - -#prevalues .ui-sortable-helper -{ - border: 2px dotted #ccc; - background-color: #EEE; -} diff --git a/src/umbraco.editorControls/KeyValuePrevalueEditor.js b/src/umbraco.editorControls/KeyValuePrevalueEditor.js deleted file mode 100644 index 4d3f2a6622..0000000000 --- a/src/umbraco.editorControls/KeyValuePrevalueEditor.js +++ /dev/null @@ -1,40 +0,0 @@ - -jQuery(document).ready(function () { - - jQuery("#prevalues .text").editable(function (value, settings) { $(this).html(value); ResetValues(); }, { onblur: 'submit', tooltip: 'Click to edit', cssclass: 'inlineEditor' }); - - jQuery("#prevalues tbody").sortable({ - items: "tr:not(.header)", - handle: '.handle', - update: function () { - - ResetValues(); - - } - }); - - - -}); - - -function ResetValues() { - - var val = ""; - - jQuery("#prevalues .row").each(function () { - - var text = jQuery(".text", this).html(); - var value = jQuery(".value", this).html(); - - - val += value + "|" + text + "¶"; - - }); - - jQuery(".valuesHiddenInput").val(val); -} - -function ConfirmPrevalueDelete() { - return confirm("Are you sure you want to delete"); -} \ No newline at end of file diff --git a/src/umbraco.editorControls/MultiNodeTreePicker/BaseTreeExtensions.cs b/src/umbraco.editorControls/MultiNodeTreePicker/BaseTreeExtensions.cs deleted file mode 100644 index 71abb531b5..0000000000 --- a/src/umbraco.editorControls/MultiNodeTreePicker/BaseTreeExtensions.cs +++ /dev/null @@ -1,195 +0,0 @@ -using System; -using System.Linq; -using System.Web; -using umbraco.cms.businesslogic; -using umbraco.cms.presentation.Trees; - -namespace umbraco.editorControls.MultiNodeTreePicker -{ - /// - /// BaseTree extensions for MultiNodeTreePicker. - /// - [Obsolete("IDataType and all other references to the legacy property editors are no longer used this will be removed from the codebase in future versions")] - public static class BaseTreeExtensions - { - - internal const int NoAccessId = -123456789; - internal const int NoChildNodesId = -897987654; - - /// - /// Determines if it needs to render a null tree based on the start node id and returns true if it is the case. - /// - /// - /// - /// - /// - /// - internal static bool SetNullTreeRootNode(this BaseTree tree, int startNodeId, ref XmlTreeNode rootNode, string app) - { - if (startNodeId == NoAccessId) - { - rootNode = new NullTree(app).RootNode; - rootNode.Text = "You do not have permission to view this tree"; - rootNode.HasChildren = false; - rootNode.Source = string.Empty; - return true; - } - - if (startNodeId == NoChildNodesId) - { - rootNode = new NullTree(app).RootNode; - rootNode.Text = "[No start node found]"; - rootNode.HasChildren = false; - rootNode.Source = string.Empty; - return true; - } - - return false; - } - - /// - /// Used to determine the start node id while taking into account a user's security - /// - /// - /// - /// - /// - internal static int GetStartNodeId(this BaseTree tree, Content definedStartNode, Content userStartNode) - { - if (userStartNode == null) - { - throw new ArgumentNullException("userStartNode"); - } - - //the output start node id - var determinedStartNodeId = uQuery.RootNodeId; - - if (definedStartNode == null) - { - //if the defined (desired) start node is null (could not be found), return NoChildNodesId - determinedStartNodeId = NoChildNodesId; - } - else if (definedStartNode.Id == uQuery.RootNodeId) - { - //if the id is -1, then the start node is the user's start node - determinedStartNodeId = userStartNode.Id; - } - else if (definedStartNode.Path.Split(',').Contains(userStartNode.Id.ToString())) - { - //If User's start node id is found in the defined path, then the start node id - //can (allowed) be the defined path. - //This should always work for administrator (-1) - - determinedStartNodeId = definedStartNode.Id; - } - else if (userStartNode.Path.Split(',').Contains(definedStartNode.Id.ToString())) - { - //if the defined start node id is found in the user's path, then the start node id - //can only be the user's, not the actual start - determinedStartNodeId = userStartNode.Id; - } - else if (!definedStartNode.Path.Split(',').Contains(userStartNode.Id.ToString())) - { - //they should not have any access! - determinedStartNodeId = NoAccessId; - } - - return determinedStartNodeId; - } - - /// - /// Returns the data type id for the current base tree - /// - /// - /// The data type definition id is persisted between request as a query string. - /// This is used to retrieve values from the cookie which are easier persisted values - /// than trying to append everything to custom query strings. - /// - /// - /// - internal static int GetDataTypeId(this BaseTree tree) - { - var id = -1; - int.TryParse(tree.NodeKey, out id); - return id; - } - - /// - /// return the xpath statement stored in the cookie for this control id - /// - /// - /// - /// - internal static string GetXPathFromCookie(this BaseTree tree, int dataTypeDefId) - { - //try to read an existing cookie - var cookie = HttpContext.Current.Request.Cookies["MultiNodeTreePicker"]; - if (cookie != null && cookie.Values.Count > 0) - { - return cookie.MntpGetXPathFilter(dataTypeDefId); - } - return ""; - } - - - /// - /// Returns the xpath filter from the cookie for the current data type - /// - /// - /// - /// - internal static XPathFilterType GetXPathFilterTypeFromCookie(this BaseTree tree, int dataTypeDefId) - { - //try to read an existing cookie - var cookie = HttpContext.Current.Request.Cookies["MultiNodeTreePicker"]; - if (cookie != null && cookie.Values.Count > 0) - { - return cookie.MntpGetXPathFilterType(dataTypeDefId); - } - return XPathFilterType.Disable; - } - - /// - /// Helper method to return the persisted cookied value for the tree - /// - /// - /// - /// - /// - /// - internal static T GetPersistedCookieValue(this BaseTree tree, Func output, T defaultVal) - { - var cookie = HttpContext.Current.Request.Cookies["MultiNodeTreePicker"]; - if (cookie != null && cookie.Values.Count > 0) - { - return output(cookie); - } - return defaultVal; - } - - /// - /// This will return the normal service url based on id but will also ensure that the data type definition id is passed through as the nodeKey param - /// - /// The tree. - /// The id. - /// The data type def id. - /// - /// - /// We only need to set the custom source to pass in our extra NodeKey data. - /// By default the system will use one or the other: Id or NodeKey, in this case - /// we are sort of 'tricking' the system and we require both. - /// Umbraco allows you to theoretically pass in any source as long as it meets the standard - /// which means you can pass around any arbitrary data to your trees in the form of a query string, - /// though it's just a bit convoluted to do so. - /// - internal static string GetTreeServiceUrlWithParams(this BaseTree tree, int id, int dataTypeDefId) - { - var url = tree.GetTreeServiceUrl(id); - //append the node key - return url + "&nodeKey=" + dataTypeDefId; - } - - - - } -} diff --git a/src/umbraco.editorControls/MultiNodeTreePicker/FilteredContentTree.cs b/src/umbraco.editorControls/MultiNodeTreePicker/FilteredContentTree.cs deleted file mode 100644 index 40dfce710b..0000000000 --- a/src/umbraco.editorControls/MultiNodeTreePicker/FilteredContentTree.cs +++ /dev/null @@ -1,230 +0,0 @@ -using System; -using System.Linq; -using System.Xml; -using System.Xml.Linq; -using umbraco.cms.businesslogic.web; -using umbraco.cms.presentation.Trees; - -namespace umbraco.editorControls.MultiNodeTreePicker -{ - /// - /// FilteredContentTree for the MultiNodeTreePicker - /// - [Obsolete("IDataType and all other references to the legacy property editors are no longer used this will be removed from the codebase in future versions")] - public class FilteredContentTree : BaseContentTree - { - /// - /// Initializes a new instance of the class. - /// - /// The app. - public FilteredContentTree(string app) - : base(app) - { - } - - /// - /// - /// - private Document m_UserStartNodeDoc; - - /// - /// - /// - private Document m_DefinedStartNodeDoc; - - /// - /// The start node id determined by the defined id and by the user's defined id - /// - private int? m_DeterminedStartNodeId = null; - - protected override bool LoadMinimalDocument - { - get - { - return false; - } - } - - /// - /// Returns the Document object of the starting node for the current User. This ensures - /// that the Document object is only instantiated once. - /// - protected Document UserStartNodeDoc - { - get - { - if (m_UserStartNodeDoc == null) - { - if (CurrentUser.StartNodeId <= 0) - { - return new Document(uQuery.RootNodeId, true); - } - m_UserStartNodeDoc = new Document(CurrentUser.StartNodeId); - } - return m_UserStartNodeDoc; - } - } - - /// - /// Returns the Document object of the starting node that is defined in the prevalue editor. This ensures - /// that the Document object is only instantiated once. - /// - protected Document DefinedStartNodeDoc - { - get - { - if (m_DefinedStartNodeDoc == null) - { - var startNodeSelectionType = - this.GetPersistedCookieValue(x => x.MntpGetStartNodeSelectionType(this.GetDataTypeId()), - NodeSelectionType.Picker); - switch (startNodeSelectionType) - { - case NodeSelectionType.Picker: - //if it is a picker, then find the start node id - var definedId = this.GetPersistedCookieValue( - x => x.MntpGetStartNodeId(this.GetDataTypeId()), uQuery.RootNodeId); - //return a document with id -1 (don't set this up as it will exception!) - m_DefinedStartNodeDoc = (definedId > 0) ? new Document(definedId) : new Document(uQuery.RootNodeId, true); - break; - case NodeSelectionType.XPathExpression: - //if it is an expression, then we need to find the start node based on the xpression type, etc... - var expressionType = - this.GetPersistedCookieValue( - x => x.MntpGetStartNodeXPathExpressionType(this.GetDataTypeId()), - XPathExpressionType.Global); - //the default expression should match both schema types - var xpath = - this.GetPersistedCookieValue( - x => x.MntpGetStartNodeXPathExpression(this.GetDataTypeId()), "//*[number(@id)>0]"); - switch (expressionType) - { - case XPathExpressionType.Global: - //if its a global expression, then we need to run the xpath against the entire tree - var nodes = uQuery.GetNodesByXPath(xpath); - //we'll just use the first node found (THERE SHOULD ONLY BE ONE) - m_DefinedStartNodeDoc = nodes.Any() ? new Document(nodes.First().Id) : null; - break; - case XPathExpressionType.FromCurrent: - //if it's a relative query, then it cannot start with //! - if (xpath.StartsWith("/")) - { - throw new InvalidOperationException("A relative xpath query cannot start with a slash"); - } - - //if it's a FromCurrent expression, then we need to run the xpath from this node and below - var currId = - this.GetPersistedCookieValue( - x => x.MntpGetCurrentEditingNode(this.GetDataTypeId()), uQuery.RootNodeId); - var currNode = umbraco.library.GetXmlNodeById(currId.ToString()); - if (currNode.MoveNext()) - { - if (currNode.Current != null) - { - var result = currNode.Current.Select(xpath); - //set it to the first node found (if there is one), otherwise to -1 - if (result.Current != null) - m_DefinedStartNodeDoc = result.MoveNext() ? uQuery.GetDocument(result.Current.GetAttribute("id", string.Empty)) : null; - else - m_DefinedStartNodeDoc = null; - } - else - m_DefinedStartNodeDoc = null; - } - else - { - m_DefinedStartNodeDoc = null; - } - break; - default: - throw new ArgumentOutOfRangeException(); - } - break; - default: - throw new ArgumentOutOfRangeException(); - } - - } - return m_DefinedStartNodeDoc; - } - } - - #region Overridden methods - /// - /// Determines the allowed start node id based on the users start node id and the - /// defined start node id in the data type. - /// - public override int StartNodeID - { - get - { - //we only need to determine the id once - if (m_DeterminedStartNodeId.HasValue) - { - return m_DeterminedStartNodeId.Value; - } - - //based on security principles, get the actual start node id - m_DeterminedStartNodeId = this.GetStartNodeId(DefinedStartNodeDoc, UserStartNodeDoc); - - return m_DeterminedStartNodeId.Value; - } - } - - /// - /// Creates the root node. - /// - /// The root node. - protected override void CreateRootNode(ref XmlTreeNode rootNode) - { - if (!this.SetNullTreeRootNode(StartNodeID, ref rootNode, app)) - { - rootNode.Action = "javascript:openContent(-1);"; - rootNode.Source = this.GetTreeServiceUrlWithParams(StartNodeID, this.GetDataTypeId()); - if (StartNodeID > 0) - { - var startNode = new Document(StartNodeID); - rootNode.Text = startNode.Text; - rootNode.Icon = startNode.ContentTypeIcon; - } - } - } - - /// - /// Called when [render node]. - /// - /// The x node. - /// The doc. - protected override void OnRenderNode(ref XmlTreeNode xNode, Document doc) - { - base.OnRenderNode(ref xNode, doc); - - var dataTypeId = this.GetDataTypeId(); - var xpath = this.GetXPathFromCookie(dataTypeId); - var xPathType = this.GetXPathFilterTypeFromCookie(dataTypeId); - - // resolves any Umbraco params in the XPath - xpath = uQuery.ResolveXPath(xpath); - - var xDoc = new XmlDocument(); - XmlNode xmlDoc; - if (!doc.Published) - { - xmlDoc = doc.ToPreviewXml(xDoc); - } - else - { - xmlDoc = doc.ToXml(xDoc, false); - } - - var xmlString = "" + xmlDoc.OuterXml + ""; - var xml = XElement.Parse(xmlString); - - xNode.DetermineClickable(xpath, xPathType, xml); - - //ensure that the NodeKey is passed through - xNode.Source = this.GetTreeServiceUrlWithParams(int.Parse(xNode.NodeID), dataTypeId); - } - #endregion - } -} diff --git a/src/umbraco.editorControls/MultiNodeTreePicker/FilteredMediaTree.cs b/src/umbraco.editorControls/MultiNodeTreePicker/FilteredMediaTree.cs deleted file mode 100644 index 8faea4e395..0000000000 --- a/src/umbraco.editorControls/MultiNodeTreePicker/FilteredMediaTree.cs +++ /dev/null @@ -1,147 +0,0 @@ -using System; -using System.Xml; -using System.Xml.Linq; -using umbraco.cms.businesslogic.media; -using umbraco.cms.presentation.Trees; - -namespace umbraco.editorControls.MultiNodeTreePicker -{ - /// - /// FilteredMediaTree for the MultiNodeTreePicker. - /// - [Obsolete("IDataType and all other references to the legacy property editors are no longer used this will be removed from the codebase in future versions")] - public class FilteredMediaTree : BaseMediaTree - { - /// - /// Initializes a new instance of the class. - /// - /// The app. - public FilteredMediaTree(string app) - : base(app) - { - } - - /// - /// - /// - private Media m_UserStartNodeMedia; - - /// - /// - /// - private Media m_DefinedStartNodeMedia; - - /// - /// Returns the Media object of the starting node for the current User. This ensures - /// that the Media object is only instantiated once. - /// - protected Media UserStartNodeDoc - { - get - { - if (m_UserStartNodeMedia == null) - { - if (CurrentUser.StartMediaId <= 0) - { - return new Media(-1, true); - } - m_UserStartNodeMedia = new Media(CurrentUser.StartMediaId); - } - return m_UserStartNodeMedia; - } - } - - /// - /// Returns the Media object of the starting node that is defined in the prevalue editor. This ensures - /// that the Media object is only instantiated once. - /// - protected Media DefinedStartNodeMedia - { - get - { - if (m_DefinedStartNodeMedia == null) - { - var definedId = this.GetPersistedCookieValue(x => x.MntpGetStartNodeId(this.GetDataTypeId()), -1); - if (definedId <= 0) - { - return new Media(-1, true); - } - m_DefinedStartNodeMedia = new Media(definedId); - } - return m_DefinedStartNodeMedia; - } - } - - /// - /// The start node id determined by the defined id and by the user's defined id - /// - private int? m_DeterminedStartNodeId = null; - - #region Overridden methods - /// - /// Determines the allowed start node id based on the users start node id and the - /// defined start node id in the data type. - /// - public override int StartNodeID - { - get - { - //we only need to determine the id once - if (m_DeterminedStartNodeId.HasValue) - { - return m_DeterminedStartNodeId.Value; - } - - m_DeterminedStartNodeId = this.GetStartNodeId(DefinedStartNodeMedia, UserStartNodeDoc); - - return m_DeterminedStartNodeId.Value; - } - } - - /// - /// Creates the root node. - /// - /// The root node. - protected override void CreateRootNode(ref XmlTreeNode rootNode) - { - if (!this.SetNullTreeRootNode(StartNodeID, ref rootNode, app)) - { - rootNode.Action = "javascript:openContent(-1);"; - rootNode.Source = this.GetTreeServiceUrlWithParams(StartNodeID, this.GetDataTypeId()); - if (StartNodeID > 0) - { - var startNode = new Media(StartNodeID); - rootNode.Text = startNode.Text; - rootNode.Icon = startNode.ContentTypeIcon; - } - } - } - - /// - /// Called when [before node render]. - /// - /// The sender. - /// The node. - /// The instance containing the event data. - protected override void OnBeforeNodeRender(ref XmlTree sender, ref XmlTreeNode node, EventArgs e) - { - - var xpath = this.GetXPathFromCookie(this.GetDataTypeId()); - var xPathType = this.GetXPathFilterTypeFromCookie(this.GetDataTypeId()); - var xDoc = new XmlDocument(); - - var xmlNode = umbraco.library.GetMedia(int.Parse(node.NodeID), false).Current.OuterXml; - - var xmlString = "" + xmlNode + ""; - var xml = XElement.Parse(xmlString); - - node.DetermineClickable(xpath, xPathType, xml); - - //ensure that the NodeKey is passed through - node.Source = this.GetTreeServiceUrlWithParams(int.Parse(node.NodeID), this.GetDataTypeId()); - - base.OnBeforeNodeRender(ref sender, ref node, e); - } - #endregion - } -} diff --git a/src/umbraco.editorControls/MultiNodeTreePicker/HttpCookieExtensions.cs b/src/umbraco.editorControls/MultiNodeTreePicker/HttpCookieExtensions.cs deleted file mode 100644 index 30c34a0a1a..0000000000 --- a/src/umbraco.editorControls/MultiNodeTreePicker/HttpCookieExtensions.cs +++ /dev/null @@ -1,156 +0,0 @@ -using System; -using System.Linq; -using System.Web; - -namespace umbraco.editorControls.MultiNodeTreePicker -{ - - /// - /// A helper class to store and retrieve cookie values for the MNTP cookie. - /// - /// - /// The cookie is used to persist values from the client to the server since - /// it is much more complicated to try to persist these values between ajax request, - /// given the tree's current architecture. - /// - [Obsolete("IDataType and all other references to the legacy property editors are no longer used this will be removed from the codebase in future versions")] - public static class HttpCookieExtensions - { - - private enum CookieVals - { - /// - /// XPath filter - /// - Xpf, - /// - /// XPath filter type - /// - Xpft, - /// - /// Start node - /// - Sn, - /// - /// Start node xpath expression type - /// - Snxet, - /// - /// Start node select type - /// - Snst, - /// - /// Start node xpath expression - /// - Snxe, - /// - /// Current editing node id - /// - Ceni - } - - - #region Setters - - internal static void MntpAddXPathFilter(this HttpCookie c, int id, string xpath) - { - c[string.Concat(CookieVals.Xpf, "_", id)] = xpath; - } - - internal static void MntpAddXPathFilterType(this HttpCookie c, int id, XPathFilterType type) - { - c[string.Concat(CookieVals.Xpft, "_", id)] = ((int)type).ToString(); - } - - internal static void MntpAddStartNodeId(this HttpCookie c, int id, int startNodeId) - { - c[string.Concat(CookieVals.Sn, "_", id)] = startNodeId.ToString(); - } - - internal static void MntpAddStartNodeXPathExpressionType(this HttpCookie c, int id, XPathExpressionType xPathExpressionType) - { - c[string.Concat(CookieVals.Snxet, "_", id)] = ((int)xPathExpressionType).ToString(); - } - - internal static void MntpAddStartNodeSelectionType(this HttpCookie c, int id, NodeSelectionType startNodeSelectionType) - { - c[string.Concat(CookieVals.Snst, "_", id)] = ((int)startNodeSelectionType).ToString(); - } - - internal static void MntpAddStartNodeXPathExpression(this HttpCookie c, int id, string xPathExpression) - { - c[string.Concat(CookieVals.Snxe, "_", id)] = xPathExpression; - } - - internal static void MntpAddCurrentEditingNode(this HttpCookie c, int id, int currEditingNodeId) - { - c[string.Concat(CookieVals.Ceni, "_", id)] = currEditingNodeId.ToString(); - } - - #endregion - - #region Getters - - internal static string MntpGetXPathFilter(this HttpCookie c, int dataTypeId) - { - return c.ValidateCookieVal(CookieVals.Xpf, dataTypeId) - ? c.Values[string.Concat(CookieVals.Xpf, "_", dataTypeId)] - : string.Empty; - } - - internal static XPathFilterType MntpGetXPathFilterType(this HttpCookie c, int dataTypeId) - { - return c.ValidateCookieVal(CookieVals.Xpft, dataTypeId) - ? (XPathFilterType) Enum.ToObject(typeof (XPathFilterType), - int.Parse( - c.Values[string.Concat(CookieVals.Xpft, "_", dataTypeId)])) - : XPathFilterType.Disable; - } - - internal static int MntpGetStartNodeId(this HttpCookie c, int dataTypeId) - { - return c.ValidateCookieVal(CookieVals.Sn, dataTypeId) - ? int.Parse(c.Values[string.Concat(CookieVals.Sn, "_", dataTypeId)]) - : -1; - } - - internal static XPathExpressionType MntpGetStartNodeXPathExpressionType(this HttpCookie c, int dataTypeId) - { - return c.ValidateCookieVal(CookieVals.Snxet, dataTypeId) - ? (XPathExpressionType) - Enum.ToObject(typeof(XPathExpressionType), - int.Parse(c.Values[string.Concat(CookieVals.Snxet, "_", dataTypeId)])) - : XPathExpressionType.Global; - } - - internal static NodeSelectionType MntpGetStartNodeSelectionType(this HttpCookie c, int dataTypeId) - { - return c.ValidateCookieVal(CookieVals.Snst, dataTypeId) - ? (NodeSelectionType) - Enum.ToObject(typeof(NodeSelectionType), - int.Parse(c.Values[string.Concat(CookieVals.Snst, "_", dataTypeId)])) - : NodeSelectionType.Picker; - } - - internal static string MntpGetStartNodeXPathExpression(this HttpCookie c, int dataTypeId) - { - return c.ValidateCookieVal(CookieVals.Snxe, dataTypeId) - ? c.Values[string.Concat(CookieVals.Snxe, "_", dataTypeId)] - : string.Empty; - } - - internal static int MntpGetCurrentEditingNode(this HttpCookie c, int dataTypeId) - { - return c.ValidateCookieVal(CookieVals.Ceni, dataTypeId) - ? int.Parse(c.Values[string.Concat(CookieVals.Ceni, "_", dataTypeId)]) - : -1; - } - - private static bool ValidateCookieVal(this HttpCookie c, CookieVals val, int dataTypeId) - { - return dataTypeId == 0 ? false : (c.Values.Keys.Cast().Where(x => x == string.Concat(val, "_", dataTypeId)).Any()); - } - - #endregion - } -} diff --git a/src/umbraco.editorControls/MultiNodeTreePicker/MNTPResources.Designer.cs b/src/umbraco.editorControls/MultiNodeTreePicker/MNTPResources.Designer.cs deleted file mode 100644 index 645332f848..0000000000 --- a/src/umbraco.editorControls/MultiNodeTreePicker/MNTPResources.Designer.cs +++ /dev/null @@ -1,381 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.488 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -using System; - -namespace umbraco.editorControls.MultiNodeTreePicker -{ - - - /// - /// A strongly-typed resource class, for looking up localized strings, etc. - /// - // This class was auto-generated by the StronglyTypedResourceBuilder - // class via a tool like ResGen or Visual Studio. - // To add or remove a member, edit your .ResX file then rerun ResGen - // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] - [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [Obsolete("IDataType and all other references to the legacy property editors are no longer used this will be removed from the codebase in future versions")] - public class MNTPResources { - - private static global::System.Resources.ResourceManager resourceMan; - - private static global::System.Globalization.CultureInfo resourceCulture; - - [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal MNTPResources() { - } - - /// - /// Returns the cached ResourceManager instance used by this class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - public static global::System.Resources.ResourceManager ResourceManager { - get { - if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("umbraco.editorControls.MultiNodeTreePicker.MNTPResources", typeof(MNTPResources).Assembly); - resourceMan = temp; - } - return resourceMan; - } - } - - /// - /// Overrides the current thread's CurrentUICulture property for all - /// resource lookups using this strongly typed resource class. - /// - [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] - public static global::System.Globalization.CultureInfo Culture { - get { - return resourceCulture; - } - set { - resourceCulture = value; - } - } - - /// - /// Looks up a localized string similar to The maximum number of items that are allowed to be selected by a content editor. If an unlimited number of node selections should be allowed, then enter -1 as the value. - /// - public static string Desc_MaxItemsAllowed { - get { - return ResourceManager.GetString("Desc_MaxItemsAllowed", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The minimum number of items that are allowed to be selected by a content editor.. - /// - public static string Desc_MinItemsAllowed { - get { - return ResourceManager.GetString("Desc_MinItemsAllowed", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Nodes can be selected from a parent node (Node Picker) or by an XPath expression. NOTE:When using an XPath expression, only published nodes can be shown.. - /// - public static string Desc_NodeSelectionType { - get { - return ResourceManager.GetString("Desc_NodeSelectionType", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to If enabled and 'media' is selected as the tree type then a thumbnail will be rendered for each item selected.. - /// - public static string Desc_ShowThumbnails { - get { - return ResourceManager.GetString("Desc_ShowThumbnails", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to If enabled will show an information icon next to each node selected. When the icon is clicked, a tooltip is shown displaying the nodes extended properties.. - /// - public static string Desc_ShowTooltips { - get { - return ResourceManager.GetString("Desc_ShowTooltips", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Define the starting node that should be rendered for the picker. This will ensure that the correct security measures are in place by checking the defined start node ID for the user accessing the picker. In some cases, if the user is not able to view the node, then the picker will render an error message.. - /// - public static string Desc_StartNodeId { - get { - return ResourceManager.GetString("Desc_StartNodeId", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to You can specify to store the data in Umbraco as comma seperated or as XML. By default it is stored as XML which makes it easier to use the saved value in XSLT, however, storing it as comma seperated makes it easier to work with the data using the API such as Node factory.. - /// - public static string Desc_StoreAsComma { - get { - return ResourceManager.GetString("Desc_StoreAsComma", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to This XPath expression is used to select a starting node and depends on the XPath expression type chosen (global or from current). IMPORTANT: This XPath expression should be written to match ONE node, if the expression matches more than one node, then the first node matched will be used as the start node.. - /// - public static string Desc_XPathExpression { - get { - return ResourceManager.GetString("Desc_XPathExpression", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The XPath expression that is evaluated to match a start node can be evaluated at a global tree level, or matched from the current node being edited.. - /// - public static string Desc_XPathExpressionType { - get { - return ResourceManager.GetString("Desc_XPathExpressionType", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to An xpath filter to match nodes that will be either enabled or disabled from being clicked (depending on what is selected for the XPath filter type). This XPath filter is for one node only so it should be formatted to select only one node. The XML to XPath against is the same as the Umbraco XML for one node.<br/><br/>Example: /*[name()='myNodeType' or name()='yourNodeType'] <br/><br/>The above would make all nodes of types: myNodeType or yourNodeType not selectable in the tree. - /// - public static string Desc_XPathFilter { - get { - return ResourceManager.GetString("Desc_XPathFilter", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Should the XPath filter match nodes to enable nodes or disable nodes. If Enable is selected, this means that only nodes that match the XPath filter will be allowed to be selected in the tree picker and vise versa for Disabled. - /// - public static string Desc_XPathFilterType { - get { - return ResourceManager.GetString("Desc_XPathFilterType", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Node Picker. - /// - public static string Item_NodeSelectionType_Picker { - get { - return ResourceManager.GetString("Item_NodeSelectionType_Picker", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to XPath Expression. - /// - public static string Item_NodeSelectionType_XPath { - get { - return ResourceManager.GetString("Item_NodeSelectionType_XPath", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to From Current. - /// - public static string Item_XPathExpressionType_CurrentNode { - get { - return ResourceManager.GetString("Item_XPathExpressionType_CurrentNode", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Global. - /// - public static string Item_XPathExpressionType_Global { - get { - return ResourceManager.GetString("Item_XPathExpressionType_Global", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Disable. - /// - public static string Item_XPathMatchType_Disable { - get { - return ResourceManager.GetString("Item_XPathMatchType_Disable", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Enable. - /// - public static string Item_XPathMatchType_Enable { - get { - return ResourceManager.GetString("Item_XPathMatchType_Enable", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Pixel height of the tree control box. - /// - public static string Lbl_ControlHeight { - get { - return ResourceManager.GetString("Lbl_ControlHeight", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Maximum node selections. - /// - public static string Lbl_MaxItemsAllowed { - get { - return ResourceManager.GetString("Lbl_MaxItemsAllowed", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Minimum node selections. - /// - public static string Lbl_MinItemsAllowed { - get { - return ResourceManager.GetString("Lbl_MinItemsAllowed", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Node selection type. - /// - public static string Lbl_NodeSelectionType { - get { - return ResourceManager.GetString("Lbl_NodeSelectionType", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Select tree type. - /// - public static string Lbl_SelectTreeType { - get { - return ResourceManager.GetString("Lbl_SelectTreeType", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Show tooltip for selected item. - /// - public static string Lbl_ShowItemInfoTooltipCheckBox { - get { - return ResourceManager.GetString("Lbl_ShowItemInfoTooltipCheckBox", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Show thumbnails for media items?. - /// - public static string Lbl_ShowThumbnails { - get { - return ResourceManager.GetString("Lbl_ShowThumbnails", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Start node ID. - /// - public static string Lbl_StartNodeId { - get { - return ResourceManager.GetString("Lbl_StartNodeId", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Data as CSV or XML? . - /// - public static string Lbl_StoreAsComma { - get { - return ResourceManager.GetString("Lbl_StoreAsComma", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to XPath expression. - /// - public static string Lbl_XPathExpression { - get { - return ResourceManager.GetString("Lbl_XPathExpression", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to XPath type. - /// - public static string Lbl_XPathExpressionType { - get { - return ResourceManager.GetString("Lbl_XPathExpressionType", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to XPath filter. - /// - public static string Lbl_XPathFilter { - get { - return ResourceManager.GetString("Lbl_XPathFilter", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to XPath filter type. - /// - public static string Lbl_XPathFilterType { - get { - return ResourceManager.GetString("Lbl_XPathFilterType", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Please enter a pixel value between 1 - 999. - /// - public static string Val_ControlHeightMsg { - get { - return ResourceManager.GetString("Val_ControlHeightMsg", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Please enter only numbers. - /// - public static string Val_MaxItemsMsg { - get { - return ResourceManager.GetString("Val_MaxItemsMsg", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to The highlighted Multi Node Tree Picker property requires a minimum node selection of {0}. - /// - public static string Val_MinItemsInvalid { - get { - return ResourceManager.GetString("Val_MinItemsInvalid", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Please enter only numbers. - /// - public static string Val_MinItemsMsg { - get { - return ResourceManager.GetString("Val_MinItemsMsg", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to A relative xpath expression cannot start with "/" or "//". - /// - public static string Val_RelativeXpath { - get { - return ResourceManager.GetString("Val_RelativeXpath", resourceCulture); - } - } - } -} diff --git a/src/umbraco.editorControls/MultiNodeTreePicker/MNTPResources.resx b/src/umbraco.editorControls/MultiNodeTreePicker/MNTPResources.resx deleted file mode 100644 index 0224ee5734..0000000000 --- a/src/umbraco.editorControls/MultiNodeTreePicker/MNTPResources.resx +++ /dev/null @@ -1,225 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - The maximum number of items that are allowed to be selected by a content editor. If an unlimited number of node selections should be allowed, then enter -1 as the value - - - The minimum number of items that are allowed to be selected by a content editor. - - - Nodes can be selected from a parent node (Node Picker) or by an XPath expression. NOTE: When using an XPath expression, only published nodes can be shown. - - - If enabled and 'media' is selected as the tree type then a thumbnail will be rendered for each item selected. - - - If enabled will show an information icon next to each node selected. When the icon is clicked, a tooltip is shown displaying the nodes extended properties. - - - Define the starting node that should be rendered for the picker. This will ensure that the correct security measures are in place by checking the defined start node ID for the user accessing the picker. In some cases, if the user is not able to view the node, then the picker will render an error message. - - - You can specify to store the data in Umbraco as comma seperated or as XML. By default it is stored as XML which makes it easier to use the saved value in XSLT, however, storing it as comma seperated makes it easier to work with the data using the API such as Node factory. - - - This XPath expression is used to select a starting node and depends on the XPath expression type chosen (global or from current). <u>IMPORTANT</u>: This XPath expression should be written to match <b>ONE</b> node, if the expression matches more than one node, then the first node matched will be used as the start node. - - - The XPath expression that is evaluated to match a start node can be evaluated at a global tree level, or matched from the current node being edited. - - - An xpath filter to match nodes that will be either enabled or disabled from being clicked (depending on what is selected for the XPath filter type). This XPath filter is for one node only so it should be formatted to select only one node. The XML to XPath against is the same as the Umbraco XML for one node.<br/><br/>Example: <code>/*[self::myNodeType or self::yourNodeType]</code><br/><br/>The above would make all nodes of types: myNodeType or yourNodeType not selectable in the tree - - - Should the XPath filter match nodes to enable nodes or disable nodes. If Enable is selected, this means that only nodes that match the XPath filter will be allowed to be selected in the tree picker and vise versa for Disabled - - - Node Picker - - - XPath Expression - - - From Current - - - Global - - - Disable - - - Enable - - - Pixel height of the tree control box - - - Maximum node selections - - - Minimum node selections - - - Node selection type - - - Select tree type - - - Show tooltip for selected item - - - Show thumbnails for media items? - - - Start node ID - - - Data as CSV or XML? - - - XPath expression - - - XPath type - - - XPath filter - - - XPath filter type - - - Please enter a pixel value between 1 - 999 - - - Please enter only numbers - - - The highlighted Multi Node Tree Picker property requires a minimum node selection of {0} - - - Please enter only numbers - - - A relative xpath expression cannot start with "/" or "//" - - \ No newline at end of file diff --git a/src/umbraco.editorControls/MultiNodeTreePicker/MNTP_DataEditor.cs b/src/umbraco.editorControls/MultiNodeTreePicker/MNTP_DataEditor.cs deleted file mode 100644 index 1786aea4ff..0000000000 --- a/src/umbraco.editorControls/MultiNodeTreePicker/MNTP_DataEditor.cs +++ /dev/null @@ -1,706 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Web; -using System.Web.UI; -using System.Web.UI.HtmlControls; -using System.Web.UI.WebControls; -using System.Xml.Linq; -using ClientDependency.Core; -using Umbraco.Core; -using Umbraco.Core.IO; -using umbraco.BusinessLogic; -using umbraco.cms.presentation.Trees; -using umbraco.controls.Images; -using umbraco.controls.Tree; - -[assembly: WebResource("umbraco.editorControls.MultiNodeTreePicker.MultiNodePickerStyles.css", "text/css")] -[assembly: WebResource("umbraco.editorControls.MultiNodeTreePicker.MultiNodePickerScripts.js", "application/x-javascript")] - -namespace umbraco.editorControls.MultiNodeTreePicker -{ - /// - /// The user interface to display to the content editor - /// - [ClientDependency(ClientDependencyType.Javascript, "ui/jqueryui.js", "UmbracoClient")] - [ClientDependency(ClientDependencyType.Javascript, "ui/jquery.tooltip.min.js", "UmbracoClient")] - [ClientDependency(ClientDependencyType.Javascript, "controls/Images/ImageViewer.js", "UmbracoRoot")] - [ValidationProperty("Value")] - [Obsolete("IDataType and all other references to the legacy property editors are no longer used this will be removed from the codebase in future versions")] - public class MNTP_DataEditor : Control, INamingContainer - { - #region Static Constructor - - /// - /// This adds our filtered tree definition to the TreeDefinitionCollection at runtime - /// instead of having to declare it in the database - /// - static MNTP_DataEditor() - { - //NOTE: Before we had locking here but static ctors are always threadsafe - - if (TreeDefinitionCollection.Instance.Any(x => x.TreeType == typeof (FilteredContentTree))) - return; - - - //need to add our tree definitions to the collection. - - //find the content tree to duplicate - var contentTree = TreeDefinitionCollection.Instance.SingleOrDefault(x => string.Equals(x.Tree.Alias, Umbraco.Core.Constants.Applications.Content, StringComparison.OrdinalIgnoreCase)); - //have put this here because the legacy content tree no longer exists as a tree def - if (contentTree == null) - { - contentTree = new TreeDefinition( - typeof (loadContent), - new ApplicationTree(false, true, 0, "content", "content", "Content", ".sprTreeFolder", ".sprTreeFolder_o", "", typeof (loadContent).GetFullNameWithAssembly(), ""), - new Application("Content", "content", "content")); - } - var filteredContentTree = new TreeDefinition(typeof(FilteredContentTree), - new umbraco.BusinessLogic.ApplicationTree(true, false, 0, - contentTree.Tree.ApplicationAlias, - "FilteredContentTree", - contentTree.Tree.Title, - contentTree.Tree.IconClosed, - contentTree.Tree.IconOpened, - "umbraco.editorControls", - "MultiNodeTreePicker.FilteredContentTree", - contentTree.Tree.Action), - contentTree.App); - - //find the media tree to duplicate - var mediaTree = TreeDefinitionCollection.Instance.SingleOrDefault(x => string.Equals(x.Tree.Alias, Umbraco.Core.Constants.Applications.Media, StringComparison.OrdinalIgnoreCase)); - //have put this here because the legacy content tree no longer exists as a tree def - if (mediaTree == null) - { - mediaTree = new TreeDefinition( - typeof(loadMedia), - new ApplicationTree(false, true, 0, "media", "media", "Media", ".sprTreeFolder", ".sprTreeFolder_o", "", typeof(loadMedia).GetFullNameWithAssembly(), ""), - new Application("Media", "media", "media")); - } - var filteredMediaTree = new TreeDefinition(typeof(FilteredMediaTree), - new umbraco.BusinessLogic.ApplicationTree(true, false, 0, - mediaTree.Tree.ApplicationAlias, - "FilteredMediaTree", - mediaTree.Tree.Title, - mediaTree.Tree.IconClosed, - mediaTree.Tree.IconOpened, - "umbraco.editorControls", - "MultiNodeTreePicker.FilteredMediaTree", - mediaTree.Tree.Action), - mediaTree.App); - - //add it to the collection at runtime - TreeDefinitionCollection.Instance.Add(filteredContentTree); - TreeDefinitionCollection.Instance.Add(filteredMediaTree); - } - - #endregion - - /// - /// Initializes a new instance of the class. - /// - public MNTP_DataEditor() - { - this.MediaTypesWithThumbnails = new string[] { Umbraco.Core.Constants.Conventions.MediaTypes.Image }; - ShowThumbnailsForMedia = true; - TreeToRender = Umbraco.Core.Constants.Applications.Content; - MaxNodeCount = -1; - MinNodeCount = 0; - StartNodeId = uQuery.RootNodeId; - ShowToolTips = true; - ControlHeight = 200; - } - - /// - /// This is used for validation purposes only, see the [ValidationProperty("Value")] attribute above. - /// - public string Value - { - get { return string.Join(",", SelectedIds); } - } - - #region Protected members - - /// - /// - /// - protected CustomValidator MinItemsValidator; - - /// - /// - /// - protected CustomTreeControl TreePickerControl; - - /// - /// - /// - protected Repeater SelectedValues; - - /// - /// - /// - protected HiddenField PickedValue; - - /// - /// - /// - protected HtmlGenericControl RightColumn; - #endregion - - #region public Properties - - /// - /// gets/sets the value based on an array of IDs selected - /// - public string[] SelectedIds - { - get - { - List val = new List(); - var splitVals = PickedValue.Value.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); - //this will make sure only the node count specified is saved - //into umbraco, even if people try to hack the front end for whatever reason. - if (MaxNodeCount >= 0) - { - for (var i = 0; i < splitVals.Length; i++) - { - if (i < MaxNodeCount) - { - val.Add(splitVals[i]); - } - else break; - } - } - else - { - val = splitVals.ToList(); - } - return val.ToArray(); - } - set - { - XmlValue = ConvertToXDocument(value); - } - } - - /// - /// get/set the value for the selected nodes in xml format - /// - public XDocument XmlValue - { - get - { - return ConvertToXDocument(SelectedIds); - } - set - { - if (value == null) - { - SelectedValues.DataSource = null; - PickedValue.Value = ""; - } - else - { - //set the data source for the repeater and hidden field - var nodes = value.Descendants("nodeId"); - SelectedValues.DataSource = nodes; - PickedValue.Value = string.Join(",", nodes.Select(x => x.Value).ToArray()); - } - } - } - - /// - /// The property name being edited with the current data editor. This is used for the min items validation statement. - /// - public string PropertyName { get; set; } - - /// - /// The tree type alias to render - /// - public string TreeToRender { get; set; } - - /// - /// An xpath filter to match nodes that will be disabled from being clicked - /// - public string XPathFilter { get; set; } - - /// - /// The minimum amount of nodes that can be selected - /// - public int MinNodeCount { get; set; } - - /// - /// The maximum amount of nodes that can be selected - /// - public int MaxNodeCount { get; set; } - - /// - /// The start node id - /// - public int StartNodeId { get; set; } - - /// - /// The start node selection type - /// - public NodeSelectionType StartNodeSelectionType { get; set; } - - /// - /// The xpath expression type to select the start node when the StartNodeSelectionType is XPath - /// - public XPathExpressionType StartNodeXPathExpressionType { get; set; } - - /// - /// The XPath expression to use to determine the start node when the StartNodeSelectionType is XPath - /// - public string StartNodeXPathExpression { get; set; } - - /// - /// Gets or sets a value indicating whether [show tool tips]. - /// - /// true if [show tool tips]; otherwise, false. - /// Shows/Hides the tooltip info bubble. - public bool ShowToolTips { get; set; } - - /// - /// The XPathFilterType to match - /// - public XPathFilterType XPathFilterMatchType { get; set; } - - /// - /// Gets or sets a value indicating whether [show thumbnails for media]. - /// - /// - /// true if [show thumbnails for media]; otherwise, false. - /// - /// Whether or not to show thumbnails for media - public bool ShowThumbnailsForMedia { get; set; } - - /// - /// A list of media type names that can have thumbnails (i.e. 'image') - /// - public string[] MediaTypesWithThumbnails { get; set; } - - /// - /// This is set by the data type and allows us to save a cookie value - /// for persistence for the data type. - /// - public int DataTypeDefinitionId { get; set; } - - /// - /// The height of the tree control box in pixels - /// - public int ControlHeight { get; set; } - - #endregion - - /// - /// Initialize the control, make sure children are created - /// - /// An object that contains the event data. - protected override void OnInit(EventArgs e) - { - base.OnInit(e); - - EnsureChildControls(); - } - - /// - /// Add the resources (sytles/scripts) - /// - /// - protected override void OnLoad(EventArgs e) - { - base.OnLoad(e); - - //add the js/css required - this.RegisterEmbeddedClientResource("umbraco.editorControls.MultiNodeTreePicker.MultiNodePickerStyles.css", ClientDependencyType.Css); - this.RegisterEmbeddedClientResource("umbraco.editorControls.MultiNodeTreePicker.MultiNodePickerScripts.js", ClientDependencyType.Javascript); - - //update the tree type (we need to do this each time because i don't think view state works with these controls) - switch (TreeToRender) - { - case Umbraco.Core.Constants.Applications.Media: - TreePickerControl.TreeType = "FilteredMediaTree"; - TreePickerControl.App = Umbraco.Core.Constants.Applications.Media; - break; - case Umbraco.Core.Constants.Applications.Content: - default: - TreePickerControl.TreeType = "FilteredContentTree"; - TreePickerControl.App = Umbraco.Core.Constants.Applications.Content; - break; - } - - if (Page.IsPostBack) - { - //since it is a post back, bind the data source to the view state values - XmlValue = ConvertToXDocument(SelectedIds); - } - - //bind the repeater if theres a data source, or if there's no datasource but this is a postback (i.e. nodes deleted) - if (SelectedValues.DataSource != null || Page.IsPostBack) - { - SelectedValues.DataBind(); - } - - } - - /// - /// Creates the child controls for this control - /// - protected override void CreateChildControls() - { - base.CreateChildControls(); - - EnsureChildControls(); - - //create the tree control - TreePickerControl = new CustomTreeControl - { - ID = "TreePicker", - IsDialog = true, - ShowContextMenu = false, - DialogMode = TreeDialogModes.id, - Height = Unit.Pixel(ControlHeight), - StartNodeID = StartNodeId - }; - - //create the hidden field - PickedValue = new HiddenField { ID = "PickedValue" }; - - //create the right column - RightColumn = new HtmlGenericControl("div") { ID = "RightColumn" }; - RightColumn.Attributes.Add("class", "right propertypane"); - - //create the repeater - SelectedValues = new Repeater - { - //EnableViewState = false, - ID = "SelectedValues", - ItemTemplate = new SelectedItemsTemplate() - }; - - SelectedValues.ItemDataBound += SelectedValues_ItemDataBound; - - //add the repeater to the right column - RightColumn.Controls.Add(SelectedValues); - - MinItemsValidator = new CustomValidator() - { - ID = "MinItemsValidator", - ErrorMessage = - string.Format(MNTPResources.Val_MinItemsInvalid, MinNodeCount) - }; - MinItemsValidator.ServerValidate += new ServerValidateEventHandler(MinItemsValidator_ServerValidate); - - //add the controls - this.Controls.Add(MinItemsValidator); - this.Controls.Add(TreePickerControl); - this.Controls.Add(PickedValue); - this.Controls.Add(RightColumn); - } - - /// - /// Ensure the repeater is data bound - /// - public override void DataBind() - { - base.DataBind(); - SelectedValues.DataBind(); - } - - void MinItemsValidator_ServerValidate(object source, ServerValidateEventArgs args) - { - args.IsValid = true; - if (MinNodeCount > 0 && SelectedIds.Length < MinNodeCount) - { - args.IsValid = false; - } - } - - /// - /// Event handler for the selected node repeater. - /// This will fill in all of the text values, icons, etc.. for nodes based on their ID. - /// - /// - /// - void SelectedValues_ItemDataBound(object sender, RepeaterItemEventArgs e) - { - var liSelectNode = (HtmlGenericControl)e.Item.FindControl("SelectedNodeListItem"); - var lnkSelectNode = (HtmlAnchor)e.Item.FindControl("SelectedNodeLink"); - var litSelectNodeName = (Literal)e.Item.FindControl("SelectedNodeText"); - var infoButton = (HtmlAnchor)e.Item.FindControl("InfoButton"); - - //hide the info button if tooltips are hidden - if (!ShowToolTips) - { - infoButton.Style.Add(HtmlTextWriterStyle.Display, "none"); - } - - var thisNode = (XElement)e.Item.DataItem; - int thisNodeId; - if (int.TryParse(thisNode.Value, out thisNodeId)) - { - umbraco.cms.businesslogic.Content loadedNode; - - try - { - loadedNode = new umbraco.cms.businesslogic.Content(thisNodeId); - - //add the node id - liSelectNode.Attributes["rel"] = thisNodeId.ToString(); - //add the path to be referenced - liSelectNode.Attributes["umb:nodedata"] = loadedNode.Path; - lnkSelectNode.HRef = "javascript:void(0);"; - litSelectNodeName.Text = loadedNode.Text; - - if (loadedNode.IsTrashed) - { - //need to flag this to be removed which will be done after all items are data bound - liSelectNode.Attributes["rel"] = "trashed"; - } - else - { - //we need to set the icon - if (loadedNode.ContentTypeIcon.StartsWith(".spr")) - lnkSelectNode.Attributes["class"] += " " + loadedNode.ContentTypeIcon.TrimStart('.'); - else - { - //it's a real icon, so make it a background image - lnkSelectNode.Style.Add(HtmlTextWriterStyle.BackgroundImage, - string.Format("url('{0}')", IconPath + loadedNode.ContentTypeIcon)); - //set the nospr class since it's not a sprite - lnkSelectNode.Attributes["class"] += " noSpr"; - } - - //show the media preview if media and allowed - if (TreeToRender == Umbraco.Core.Constants.Applications.Media && ShowThumbnailsForMedia) - { - var imgPreview = (ImageViewer)e.Item.FindControl("ImgPreview"); - //show the thubmnail controls - imgPreview.Visible = true; - - //add the item class - var item = (HtmlGenericControl)e.Item.FindControl("Item"); - item.Attributes["class"] += " thumb-item"; - - //item.Style.Add(HtmlTextWriterStyle.Height, "50px"); - ////make the content sit beside the item - //var inner = (HtmlGenericControl)e.Item.FindControl("InnerItem"); - //inner.Style.Add(HtmlTextWriterStyle.Width, "224px"); - - //check if it's a thumbnail type element, we need to check both schemas - if (MediaTypesWithThumbnails.Select(x => x.ToUpper()) - .Contains(loadedNode.ContentType.Alias.ToUpper())) - { - imgPreview.MediaId = thisNodeId; - imgPreview.DataBind(); - } - } - } - - } - catch (ArgumentException) - { - //the node no longer exists, so we display a msg - litSelectNodeName.Text = "NODE NO LONGER EXISTS"; - } - } - } - - /// - /// set the nodekey to the id of this datatype - /// - /// - /// this is how get the xpath out of the cookie to know how the tree knows how to filter things. - /// generally the nodekey is used for a string id, but we'll use it for something different. - /// - /// - protected override void OnPreRender(EventArgs e) - { - base.OnPreRender(e); - - TreePickerControl.NodeKey = this.DataTypeDefinitionId.ToString(); - - SavePersistentValuesForTree(XPathFilter); - } - - /// - /// Override render to control the exact output of what is rendered this includes instantiating the jquery plugin - /// - /// The object that receives the server control content. - /// - /// Generally i don't like to do this but there's a few div's, etc... to render so this makes more sense. - /// - protected override void Render(HtmlTextWriter writer) - { - //
- //
- //
Select items
- //
- //
- // - //
- //
- //
- //
- - RenderTooltip(writer); - - writer.AddAttribute("class", (!MinItemsValidator.IsValid ? "error " : "") + "multiNodePicker clearfix"); - writer.AddAttribute("id", this.ClientID); - writer.RenderBeginTag(HtmlTextWriterTag.Div); - - writer.AddAttribute("class", "header propertypane"); - writer.RenderBeginTag(HtmlTextWriterTag.Div); - writer.RenderBeginTag(HtmlTextWriterTag.Div); - writer.Write("Select Items"); - writer.RenderEndTag(); - writer.RenderEndTag(); - - writer.AddAttribute("class", "left propertypane"); - writer.AddStyleAttribute(HtmlTextWriterStyle.Height, ((ControlHeight + 10).ToString() + "px")); - writer.RenderBeginTag(HtmlTextWriterTag.Div); - //add the tree control here - TreePickerControl.RenderControl(writer); - writer.RenderEndTag(); - - RightColumn.RenderControl(writer); - - //render the hidden field - PickedValue.RenderControl(writer); - - writer.RenderEndTag(); //end multiNodePicker div - - var tooltipAjaxUrl = IOHelper.ResolveUrl(SystemDirectories.Umbraco) + @"/controls/Tree/CustomTreeService.asmx/GetNodeInfo"; - - //add jquery window load event to create the js tree picker - var jsMethod = string.Format("jQuery('#{0}').MultiNodeTreePicker('{1}', {2}, '{3}', {4}, {5}, '{6}', '{7}');", - TreePickerControl.ClientID, - this.ClientID, - MaxNodeCount, - tooltipAjaxUrl, - ShowToolTips.ToString().ToLower(), - (TreeToRender == Umbraco.Core.Constants.Applications.Media && ShowThumbnailsForMedia).ToString().ToLower(), - IOHelper.ResolveUrl(SystemDirectories.Umbraco), - TreeToRender); - var js = "jQuery(window).load(function() { " + jsMethod + " });"; - - writer.WriteLine(""); - - } - - /// - /// converts a list of Ids to the XDocument structure - /// - /// The value. - /// - private XDocument ConvertToXDocument(IEnumerable val) - { - if (val.Count() > 0) - { - return new XDocument(new XElement("MultiNodePicker", - new XAttribute("type", TreeToRender), - val.Select(x => new XElement("nodeId", x.ToString())))); - } - else - { - //return null to support recursive values - return null; - - //return an empty node set - //return new XDocument(new XElement("MultiNodePicker")); - } - } - - /// - /// this will render the tooltip object on the page so long as another - /// one hasn't already been registered. There should only be one tooltip. - /// - private void RenderTooltip(HtmlTextWriter writer) - { - if (this.Page.Items.Contains("MNTPTooltip")) - { - return; - } - - //render the tooltip holder - //
- //
- //
- //
- //this.Page.Controls.AddAt(0, new LiteralControl("
")); - writer.AddAttribute("id", "MNTPTooltip"); - writer.RenderBeginTag(HtmlTextWriterTag.Div); - writer.AddAttribute("class", "throbber"); - writer.RenderBeginTag(HtmlTextWriterTag.Div); - writer.RenderEndTag(); //end throbber - writer.AddAttribute("class", "tooltipInfo"); - writer.RenderBeginTag(HtmlTextWriterTag.Div); - writer.RenderEndTag(); //end tooltipInfo - writer.RenderEndTag(); //end tooltipo - - //ensure we add this to our page items so it's not duplicated - this.Page.Items.Add("MNTPTooltip", true); - } - - /// - /// This will update the multi-node tree picker data which is used to store - /// the xpath data and xpath match type for this control id. - /// - /// The xpath. - /// - /// This will save the data into a cookie and also into the request cookie. It must save - /// it to both locations in case the request cookie has been changed and the request cookie - /// is different than the response cookie. - /// - private void SavePersistentValuesForTree(string xpath) - { - - //create the output cookie with all of the values of the request cookie - - var newCookie = HttpContext.Current.Response.Cookies[MNTP_DataType.PersistenceCookieName] ?? new HttpCookie(MNTP_DataType.PersistenceCookieName); - - //store the xpath for this data type definition - newCookie.MntpAddXPathFilter(this.DataTypeDefinitionId, xpath); - //store the match type - newCookie.MntpAddXPathFilterType(this.DataTypeDefinitionId, XPathFilterMatchType); - //store the start node id - newCookie.MntpAddStartNodeId(this.DataTypeDefinitionId, StartNodeId); - //store the start node selection type - newCookie.MntpAddStartNodeSelectionType(this.DataTypeDefinitionId, StartNodeSelectionType); - //store the start node xpath expression type - newCookie.MntpAddStartNodeXPathExpressionType(this.DataTypeDefinitionId, StartNodeXPathExpressionType); - //store the start node xpath expression - newCookie.MntpAddStartNodeXPathExpression(this.DataTypeDefinitionId, StartNodeXPathExpression); - //store the current editing node if found - if (!string.IsNullOrEmpty(HttpContext.Current.Request["id"])) - { - var id = 0; - if (int.TryParse(HttpContext.Current.Request["id"], out id)) - { - newCookie.MntpAddCurrentEditingNode(this.DataTypeDefinitionId, id); - } - } - - HttpContext.Current.Response.Cookies.Add(newCookie); - - //add it to the request cookies too, thus overriding any old data - if (HttpContext.Current.Request.Cookies[MNTP_DataType.PersistenceCookieName] != null && HttpContext.Current.Request.Cookies[MNTP_DataType.PersistenceCookieName].Values.Count > 0) - { - //remove the incoming one and replace with new one - HttpContext.Current.Request.Cookies.Remove(MNTP_DataType.PersistenceCookieName); - } - HttpContext.Current.Request.Cookies.Add(newCookie); - - } - - /// - /// A reference path to where the icons are actually stored as compared to where the tree themes folder is - /// - private static readonly string IconPath = IOHelper.ResolveUrl(SystemDirectories.Umbraco) + "/images/umbraco/"; - } -} diff --git a/src/umbraco.editorControls/MultiNodeTreePicker/MNTP_DataType.cs b/src/umbraco.editorControls/MultiNodeTreePicker/MNTP_DataType.cs deleted file mode 100644 index 1933b1dc8d..0000000000 --- a/src/umbraco.editorControls/MultiNodeTreePicker/MNTP_DataType.cs +++ /dev/null @@ -1,213 +0,0 @@ -using System; -using System.Web; -using System.Xml; -using System.Xml.Linq; -using umbraco.cms.businesslogic.datatype; -using umbraco.interfaces; - -namespace umbraco.editorControls.MultiNodeTreePicker -{ - /// - /// Multi-node tree picker data type - /// - [Obsolete("IDataType and all other references to the legacy property editors are no longer used this will be removed from the codebase in future versions")] - public class MNTP_DataType : AbstractDataEditor - { - - /// - /// Initializes a new instance of the class. - /// - public MNTP_DataType() - { - RenderControl = m_Tree; - m_Tree.Init += Tree_Init; - m_Tree.Load += Tree_Load; - DataEditorControl.OnSave += DataEditorControl_OnSave; - - } - - private umbraco.interfaces.IData m_Data; - - /// - /// The internal tree picker control to render - /// - private readonly MNTP_DataEditor m_Tree = new MNTP_DataEditor(); - - /// - /// Internal pre value editor to render - /// - private MNTP_PrevalueEditor m_PreValues; - - /// - /// - public override Guid Id - { - get - { - return new Guid(DataTypeGuids.MultiNodeTreePickerId); - } - } - - /// - /// - public override string DataTypeName - { - get - { - return "Multi-Node Tree Picker"; - } - } - - /// - /// - public override IData Data - { - get - { - if (this.m_Data == null) - { - m_Data = StoreAsCommaDelimited - ? new umbraco.cms.businesslogic.datatype.DefaultData(this) - : new XmlData(this); - } - - return m_Data; - } - - } - - /// - /// Value indicating whether to store as comma seperated or Xml - /// - public bool StoreAsCommaDelimited - { - get - { - return ((MNTP_PrevalueEditor)PrevalueEditor).StoreAsCommaDelimited; - } - } - - /// - /// Initialize the tree, here's where we can set some initial properties for the tree - /// - /// - /// - private void Tree_Init(object sender, EventArgs e) - { - var preVal = ((MNTP_PrevalueEditor)PrevalueEditor); - m_Tree.TreeToRender = preVal.SelectedTreeType; - m_Tree.XPathFilter = preVal.XPathFilter; - m_Tree.MaxNodeCount = preVal.MaxNodeCount; - m_Tree.ShowToolTips = preVal.ShowToolTip; - m_Tree.XPathFilterMatchType = preVal.XPathFilterMatchType; - m_Tree.StartNodeId = preVal.StartNodeId; - m_Tree.DataTypeDefinitionId = DataTypeDefinitionId; - m_Tree.ShowThumbnailsForMedia = preVal.ShowThumbnailsForMedia; - m_Tree.PropertyName = this.DataTypeName; - m_Tree.StartNodeSelectionType = preVal.StartNodeSelectionType; - m_Tree.StartNodeXPathExpression = preVal.StartNodeXPathExpression; - m_Tree.StartNodeXPathExpressionType = preVal.StartNodeXPathExpressionType; - m_Tree.ControlHeight = preVal.ControlHeight; - m_Tree.MinNodeCount = preVal.MinNodeCount; - - - } - - /// - /// Set the data source for the editor - /// - /// - /// - private void Tree_Load(object sender, EventArgs e) - { - if (!m_Tree.Page.IsPostBack) - { - // set the value of the control - if (Data.Value != null && !string.IsNullOrEmpty(Data.Value.ToString())) - { - var strVal = this.Data.Value.ToString(); - - //check how the data is stored - if (StoreAsCommaDelimited) - { - //need to check if it was XML, if so, we'll clear the data (Error checkign) - if (!strVal.StartsWith("<")) - { - m_Tree.SelectedIds = this.Data.Value.ToString().Split(','); - } - else - { - //this must have been saved as XML before, we'll reset it but this will cause a loss of data - m_Tree.SelectedIds = new string[] { }; - } - } - else - { - try - { - var xmlDoc = XDocument.Parse(this.Data.Value.ToString()); - m_Tree.XmlValue = xmlDoc; - } - catch (XmlException) - { - //not a valid xml doc, must have been saved as csv before. - //set to empty val, this will cause a loss of data - m_Tree.XmlValue = null; - } - } - } - } - - } - - /// - /// Handle the saving event, need to give data to Umbraco - /// - /// The source of the event. - /// The instance containing the event data. - private void DataEditorControl_OnSave(EventArgs e) - { - string val; - if (StoreAsCommaDelimited) - { - val = string.Join(",", m_Tree.SelectedIds); - } - else - { - val = m_Tree.XmlValue == null ? string.Empty : m_Tree.XmlValue.ToString(); - } - - Data.Value = !string.IsNullOrEmpty(val) ? val : null; - } - - /// - /// return a custom pre value editor - /// - public override IDataPrevalue PrevalueEditor - { - get - { - return m_PreValues ?? (m_PreValues = new MNTP_PrevalueEditor(this)); - } - } - - internal const string PersistenceCookieName = "MultiNodeTreePicker"; - - /// - /// Helper method to ensure the pesistence cookie is cleared. - /// This is used on app startup and after editing the pre-value editor - /// - internal static void ClearCookiePersistence() - { - if (HttpContext.Current == null) - { - return; - } - - if (HttpContext.Current.Response.Cookies[PersistenceCookieName] != null) - { - HttpContext.Current.Response.Cookies[PersistenceCookieName].Expires = DateTime.Now.AddDays(-1); - } - } - } -} diff --git a/src/umbraco.editorControls/MultiNodeTreePicker/MNTP_PrevalueEditor.cs b/src/umbraco.editorControls/MultiNodeTreePicker/MNTP_PrevalueEditor.cs deleted file mode 100644 index 7ae2e83153..0000000000 --- a/src/umbraco.editorControls/MultiNodeTreePicker/MNTP_PrevalueEditor.cs +++ /dev/null @@ -1,746 +0,0 @@ -using System; -using System.Collections; -using System.Web.UI; -using System.Web.UI.HtmlControls; -using System.Web.UI.WebControls; -using ClientDependency.Core; -using umbraco.cms.businesslogic.datatype; -using umbraco.interfaces; -using umbraco.uicontrols.TreePicker; -using Constants = Umbraco.Core.Constants; - -namespace umbraco.editorControls.MultiNodeTreePicker -{ - /// - /// The pre-value editor for the multi node tree picker. - /// - [Obsolete("IDataType and all other references to the legacy property editors are no longer used this will be removed from the codebase in future versions")] - public class MNTP_PrevalueEditor : Control, IDataPrevalue - { - private readonly umbraco.cms.businesslogic.datatype.BaseDataType m_DataType; - private static readonly object Locker = new object(); - private SortedList m_PreValues = null; - - #region Public properties - - /// - /// The chosen tree type to render - /// - public string SelectedTreeType - { - get - { - return GetPreValue(PropertyIndex.TreeType, x => x.Value, Constants.Applications.Content); - } - } - - /// - /// An xpath filter to disable nodes to be selectable - /// - public string XPathFilter - { - get - { - return GetPreValue(PropertyIndex.XPathFilter, x => x.Value, string.Empty); - } - } - - /// - /// The number of nodes this picker will support picking - /// - public int MaxNodeCount - { - get - { - return GetPreValue(PropertyIndex.MaxNodeCount, x => - { - var max = -1; - return int.TryParse(x.Value, out max) ? max : -1; - }, -1); - } - } - - /// - /// The minimum number of nodes this picker will support picking - /// - public int MinNodeCount - { - get - { - return GetPreValue(PropertyIndex.MinNodeCount, x => - { - var min = 0; - return int.TryParse(x.Value, out min) ? min : 0; - }, 0); - } - } - - /// - /// A boolean value indicating whether or not to show the informational tool tips - /// - public bool ShowToolTip - { - get - { - return GetPreValue(PropertyIndex.ShowToolTip, x => - { - var show = true; - return bool.TryParse(x.Value, out show) ? show : true; - }, true); - - } - } - - /// - /// Value to check if the data should be stored as CSV or XML - /// - public bool StoreAsCommaDelimited - { - get - { - return GetPreValue(PropertyIndex.StoreAsCommaDelimited, x => - { - var asComma = 0; - return int.TryParse(x.Value, out asComma) ? asComma == 1 : false; - }, false); - - } - } - - /// - /// The XPath expression used when the node type selection is Xpath - /// - public string StartNodeXPathExpression - { - get - { - return GetPreValue(PropertyIndex.StartNodeXPathExpression, x => x.Value, string.Empty); - } - } - - /// - /// The type of xpath expression used for the xpathexpressiontext if using an xpath node selection - /// - public XPathExpressionType StartNodeXPathExpressionType - { - get - { - return GetPreValue(PropertyIndex.StartNodeXPathExpressionType, - x => (XPathExpressionType)Enum.ToObject(typeof(XPathExpressionType), int.Parse(x.Value)), - XPathExpressionType.Global); - } - } - - /// - /// The type of selection type to use for the start node - /// - public NodeSelectionType StartNodeSelectionType - { - get - { - return GetPreValue(PropertyIndex.StartNodeSelectionType, - x => (NodeSelectionType)Enum.ToObject(typeof(NodeSelectionType), int.Parse(x.Value)), - NodeSelectionType.Picker); - } - } - - /// - /// The type of xpath filter applied - /// - public XPathFilterType XPathFilterMatchType - { - get - { - return GetPreValue(PropertyIndex.XPathFilterType, - x => (XPathFilterType)Enum.ToObject(typeof(XPathFilterType), int.Parse(x.Value)), - XPathFilterType.Disable); - } - } - - /// - /// The start node id used when the node selection is a picker - /// - public int StartNodeId - { - get - { - return GetPreValue(PropertyIndex.StartNodeId, x => - { - var max = 0; - return int.TryParse(x.Value, out max) ? max : uQuery.RootNodeId; - }, uQuery.RootNodeId); - } - } - - /// - /// A boolean value indicating whether or not to show the thumbnails for media - /// - public bool ShowThumbnailsForMedia - { - get - { - return GetPreValue(PropertyIndex.ShowThumbnails, x => - { - var show = true; - bool.TryParse(x.Value, out show); - return show; - }, true); - } - } - - /// - /// Returns the control height in pixels - /// - public int ControlHeight - { - get - { - return GetPreValue(PropertyIndex.ControlHeight, x => - { - var max = 0; - return int.TryParse(x.Value, out max) ? max : 200; - }, 200); - } - } - - #endregion - - #region Protected properties - - /// - /// The control height text box - /// - protected TextBox ControlHeightTextBox; - - /// - /// - /// - protected RadioButtonList StartNodeSelectionTypeRadioButtons; - - /// - /// The start node id content picker - /// - protected SimpleContentPicker StartContentNodeIdPicker; - - /// - /// The start node id media picker - /// - protected SimpleMediaPicker StartMediaNodeIdPicker; - - /// - /// XPath expression type radio button list - /// - protected RadioButtonList StartNodeXPathExpressionTypeRadioButtons; - - /// - /// - /// - protected TextBox StartNodeXPathExpressionTextBox; - - /// - /// - /// - protected CheckBox ShowThumbnailsForMediaCheckBox; - - /// - /// - /// - protected DropDownList TreeTypeDropDown; - - /// - /// - /// - protected TextBox XPathFilterTextBox; - - /// - /// Text box for maximum amount of items - /// - protected TextBox MaxItemsTextBox; - - /// - /// Text box for minimum amount of items - /// - protected TextBox MinItemsTextBox; - - /// - /// Minimum items validator - /// - protected RegularExpressionValidator NumbersMinItemsValidator; - - /// - /// Validator for validating relative xpath expressions - /// - protected CustomValidator RelativeXpathValidator; - - /// - /// - /// - protected RegularExpressionValidator NumbersMaxItemsValidator; - - /// - /// - /// - protected RegularExpressionValidator ControlHeightValidatator; - - /// - /// - /// - protected CheckBox ShowItemInfoTooltipCheckBox; - - /// - /// - /// - protected RadioButtonList StoreAsCommaDelimitedRadioButtons; - - /// - /// - /// - protected RadioButtonList XPathFilterTypeRadioButtons; - - #endregion - - /// - /// Initializes a new instance of the class. - /// - /// Type of the data. - public MNTP_PrevalueEditor(umbraco.cms.businesslogic.datatype.BaseDataType dataType) - { - this.m_DataType = dataType; - } - - /// - /// Override on init to ensure child controls - /// - /// An object that contains the event data. - protected override void OnInit(EventArgs e) - { - base.OnInit(e); - this.EnsureChildControls(); - - this.RegisterEmbeddedClientResource("umbraco.editorControls.PrevalueEditor.css", ClientDependencyType.Css); - } - - /// - /// Ensures the css to render this control is included. - /// Binds the saved value to the drop down. - /// - /// - protected override void OnLoad(EventArgs e) - { - base.OnLoad(e); - - //add the css required - //// this.AddCssMNTPClientDependencies(); - - //let view state handle the rest - if (!Page.IsPostBack) - { - TreeTypeDropDown.SelectedValue = SelectedTreeType; - XPathFilterTextBox.Text = XPathFilter; - MaxItemsTextBox.Text = MaxNodeCount.ToString(); - ShowItemInfoTooltipCheckBox.Checked = ShowToolTip; - StoreAsCommaDelimitedRadioButtons.SelectedIndex = StoreAsCommaDelimited ? 1 : 0; - XPathFilterTypeRadioButtons.SelectedIndex = XPathFilterMatchType == XPathFilterType.Disable ? 0 : 1; - ShowThumbnailsForMediaCheckBox.Checked = ShowThumbnailsForMedia; - - StartNodeXPathExpressionTextBox.Text = StartNodeXPathExpression; - StartNodeXPathExpressionTypeRadioButtons.SelectedIndex = StartNodeXPathExpressionType == XPathExpressionType.Global ? 0 : 1; - StartNodeSelectionTypeRadioButtons.SelectedIndex = StartNodeSelectionType == NodeSelectionType.Picker ? 0 : 1; - - switch (SelectedTreeType.ToLower()) - { - case Constants.Applications.Content: - StartContentNodeIdPicker.Value = StartNodeId.ToString(); - break; - case Constants.Applications.Media: - default: - StartMediaNodeIdPicker.Value = StartNodeId.ToString(); - break; - } - - ControlHeightTextBox.Text = ControlHeight.ToString(); - MinItemsTextBox.Text = MinNodeCount.ToString(); - } - - - } - - /// - /// Creates child controls for this control - /// - protected override void CreateChildControls() - { - base.CreateChildControls(); - - - TreeTypeDropDown = new DropDownList { ID = "TreeTypeList" }; - TreeTypeDropDown.Items.Add(new ListItem("Content", Constants.Applications.Content)); - TreeTypeDropDown.Items.Add(new ListItem("Media", Constants.Applications.Media)); - TreeTypeDropDown.AutoPostBack = true; - AddPreValueRow(MNTPResources.Lbl_SelectTreeType, "", TreeTypeDropDown); - - - StartNodeSelectionTypeRadioButtons = new RadioButtonList { ID = "NodeSelectionTypeRadioButtons" }; - StartNodeSelectionTypeRadioButtons.Items.Add(MNTPResources.Item_NodeSelectionType_Picker); - StartNodeSelectionTypeRadioButtons.Items.Add(new ListItem(MNTPResources.Item_NodeSelectionType_XPath, MNTPResources.Item_NodeSelectionType_XPath.Replace(" ", ""))); - StartNodeSelectionTypeRadioButtons.RepeatDirection = RepeatDirection.Horizontal; - StartNodeSelectionTypeRadioButtons.AutoPostBack = true; - AddPreValueRow(MNTPResources.Lbl_NodeSelectionType, MNTPResources.Desc_NodeSelectionType, StartNodeSelectionTypeRadioButtons); - - - StartContentNodeIdPicker = new SimpleContentPicker { ID = "StartNodeIdTextBox" }; - AddPreValueRow(MNTPResources.Lbl_StartNodeId, MNTPResources.Desc_StartNodeId, StartContentNodeIdPicker); - - StartMediaNodeIdPicker = new SimpleMediaPicker { ID = "StartMediaNodeIdPicker" }; - AddPreValueRow(MNTPResources.Lbl_StartNodeId, MNTPResources.Desc_StartNodeId, StartMediaNodeIdPicker); - - - ShowThumbnailsForMediaCheckBox = new CheckBox { ID = "ShowThumbnailsForMedia" }; - AddPreValueRow(MNTPResources.Lbl_ShowThumbnails, MNTPResources.Desc_ShowThumbnails, ShowThumbnailsForMediaCheckBox); - - StartNodeXPathExpressionTypeRadioButtons = new RadioButtonList { ID = "XPathExpressionTypeRadioButtons" }; - StartNodeXPathExpressionTypeRadioButtons.Items.Add(MNTPResources.Item_XPathExpressionType_Global); - StartNodeXPathExpressionTypeRadioButtons.Items.Add(new ListItem(MNTPResources.Item_XPathExpressionType_CurrentNode, MNTPResources.Item_XPathExpressionType_CurrentNode.Replace(" ", ""))); - StartNodeXPathExpressionTypeRadioButtons.RepeatDirection = RepeatDirection.Horizontal; - AddPreValueRow(MNTPResources.Lbl_XPathExpressionType, MNTPResources.Desc_XPathExpressionType, StartNodeXPathExpressionTypeRadioButtons); - - StartNodeXPathExpressionTextBox = new TextBox { ID = "XPathExpressionTextBox", Width = Unit.Pixel(400) }; - RelativeXpathValidator = new CustomValidator() - { - ID = "RelativeXpathValidator", - ControlToValidate = "XPathExpressionTextBox", - ErrorMessage = MNTPResources.Val_RelativeXpath, - CssClass = "validator" - }; - RelativeXpathValidator.ServerValidate += new ServerValidateEventHandler(RelativeXpathValidator_ServerValidate); - AddPreValueRow(MNTPResources.Lbl_XPathExpression, MNTPResources.Desc_XPathExpression, StartNodeXPathExpressionTextBox, RelativeXpathValidator); - - XPathFilterTypeRadioButtons = new RadioButtonList { ID = "XPathMatchTypeRadioButtons" }; - XPathFilterTypeRadioButtons.Items.Add(MNTPResources.Item_XPathMatchType_Disable); - XPathFilterTypeRadioButtons.Items.Add(MNTPResources.Item_XPathMatchType_Enable); - XPathFilterTypeRadioButtons.RepeatDirection = RepeatDirection.Horizontal; - AddPreValueRow(MNTPResources.Lbl_XPathFilterType, MNTPResources.Desc_XPathFilterType, XPathFilterTypeRadioButtons); - - XPathFilterTextBox = new TextBox { ID = "XPathFilter", Width = Unit.Pixel(400) }; - AddPreValueRow(MNTPResources.Lbl_XPathFilter, MNTPResources.Desc_XPathFilter, XPathFilterTextBox); - - MaxItemsTextBox = new TextBox { ID = "MaxItemsCount", Width = Unit.Pixel(50) }; - NumbersMaxItemsValidator = new RegularExpressionValidator - { - ID = "NumbersMaxItemsValidator", - ControlToValidate = "MaxItemsCount", - CssClass = "validator", - ErrorMessage = MNTPResources.Val_MaxItemsMsg, - ValidationExpression = @"^-{0,1}\d*\.{0,1}\d+$" - }; - AddPreValueRow(MNTPResources.Lbl_MaxItemsAllowed, MNTPResources.Desc_MaxItemsAllowed, MaxItemsTextBox, NumbersMaxItemsValidator); - - MinItemsTextBox = new TextBox { ID = "MinItemsCount", Width = Unit.Pixel(50) }; - NumbersMinItemsValidator = new RegularExpressionValidator - { - ID = "NumbersMinItemsValidator", - ControlToValidate = "MinItemsCount", - CssClass = "validator", - ErrorMessage = MNTPResources.Val_MinItemsMsg, - ValidationExpression = @"^\d{1,3}$" - }; - AddPreValueRow(MNTPResources.Lbl_MinItemsAllowed, MNTPResources.Desc_MinItemsAllowed, MinItemsTextBox, NumbersMinItemsValidator); - - ShowItemInfoTooltipCheckBox = new CheckBox { ID = "ShowItemInfoTooltipCheckBox" }; - AddPreValueRow(MNTPResources.Lbl_ShowItemInfoTooltipCheckBox, MNTPResources.Desc_ShowTooltips, ShowItemInfoTooltipCheckBox); - - StoreAsCommaDelimitedRadioButtons = new RadioButtonList { ID = "StoreAsCommaDelimitedRadioButtons" }; - StoreAsCommaDelimitedRadioButtons.Items.Add("XML"); - StoreAsCommaDelimitedRadioButtons.Items.Add("CSV"); - StoreAsCommaDelimitedRadioButtons.RepeatDirection = RepeatDirection.Horizontal; - AddPreValueRow(MNTPResources.Lbl_StoreAsComma, MNTPResources.Desc_StoreAsComma, StoreAsCommaDelimitedRadioButtons); - - ControlHeightTextBox = new TextBox() { ID = "ControlHeightTextBox", Width = Unit.Pixel(50) }; - ControlHeightValidatator = new RegularExpressionValidator - { - ID = "ControlHeightValidator", - ControlToValidate = "ControlHeightTextBox", - CssClass = "validator", - ErrorMessage = MNTPResources.Val_ControlHeightMsg, - ValidationExpression = @"^\d{1,3}$" - }; - AddPreValueRow(MNTPResources.Lbl_ControlHeight, "", ControlHeightTextBox, ControlHeightValidatator); - } - - void RelativeXpathValidator_ServerValidate(object source, ServerValidateEventArgs args) - { - args.IsValid = true; - if (TreeTypeDropDown.SelectedIndex == 0 && StartNodeXPathExpressionTypeRadioButtons.SelectedIndex == 1 && StartNodeXPathExpressionTextBox.Text.StartsWith("/")) - { - args.IsValid = false; - } - } - - /// - /// Helper method to add a server side pre value row - /// - /// - /// - /// - /// - /// Using server side syntax because of the post backs and because i don't want to manage the view state manually - /// - private void AddPreValueRow(string lbl, string description, params Control[] ctl) - { - var div = new HtmlGenericControl("div"); - div.Attributes.Add("class", "row clearfix"); - var label = new HtmlGenericControl("div"); - label.Attributes.Add("class", "label"); - var span = new HtmlGenericControl("span"); - span.InnerText = lbl; - label.Controls.Add(span); - var field = new HtmlGenericControl("div"); - field.Attributes.Add("class", "field"); - foreach (var c in ctl) - { - field.Controls.Add(c); - } - div.Controls.Add(label); - div.Controls.Add(field); - - if (!string.IsNullOrEmpty(description)) - { - var desc = new HtmlGenericControl("div"); - var descSpan = new HtmlGenericControl("span"); - descSpan.InnerHtml = description; - desc.Attributes.Add("class", "description"); - desc.Controls.Add(descSpan); - div.Controls.Add(desc); - } - - this.Controls.Add(div); - } - - /// - /// Hides/Shows controls based on the selection of other controls - /// - /// - protected override void OnPreRender(EventArgs e) - { - base.OnPreRender(e); - - //we can only show the node selection type based on content - if (TreeTypeDropDown.SelectedIndex == 0) - { - this.StartNodeSelectionTypeRadioButtons.Parent.Parent.Visible = true; - } - else - { - this.StartNodeSelectionTypeRadioButtons.Parent.Parent.Visible = false; - } - - //if media is selected, or the node type selection is a picker type - if (TreeTypeDropDown.SelectedIndex == 1 || StartNodeSelectionTypeRadioButtons.SelectedIndex == 0) - { - StartNodeXPathExpressionTypeRadioButtons.Parent.Parent.Visible = false; - StartNodeXPathExpressionTextBox.Parent.Parent.Visible = false; - - switch (TreeTypeDropDown.SelectedIndex) - { - case 0: - //content selected - StartContentNodeIdPicker.Parent.Parent.Visible = true; - - StartMediaNodeIdPicker.Parent.Parent.Visible = false; - ShowThumbnailsForMediaCheckBox.Parent.Parent.Visible = false; - break; - case 1: - default: - //media selected: - StartContentNodeIdPicker.Parent.Parent.Visible = false; - - StartMediaNodeIdPicker.Parent.Parent.Visible = true; - ShowThumbnailsForMediaCheckBox.Parent.Parent.Visible = true; - break; - } - - } - else - { - //since it's an xpath expression, not node picker, hide all node pickers - StartContentNodeIdPicker.Parent.Parent.Visible = false; - StartMediaNodeIdPicker.Parent.Parent.Visible = false; - ShowThumbnailsForMediaCheckBox.Parent.Parent.Visible = false; - - StartNodeXPathExpressionTypeRadioButtons.Parent.Parent.Visible = true; - StartNodeXPathExpressionTextBox.Parent.Parent.Visible = true; - } - } - - /// - /// render our own custom markup - /// - /// The object that receives the server control content. - protected override void Render(HtmlTextWriter writer) - { - writer.AddAttribute(HtmlTextWriterAttribute.Class, "PrevalueEditor"); - writer.RenderBeginTag(HtmlTextWriterTag.Div); //start 'PrevalueEditor' - - base.Render(writer); - - writer.RenderEndTag(); //end 'PrevalueEditor' - - } - - /// - /// Lazy loads the prevalues for this data type - /// - /// - private SortedList GetPreValues() - { - if (m_PreValues == null) - { - m_PreValues = PreValues.GetPreValues(m_DataType.DataTypeDefinitionId); - } - return m_PreValues; - } - - #region IDataPrevalue Members - - /// - /// returns this as it's own editor - /// - public Control Editor - { - get { return this; } - } - - /// - /// Saves data to Umbraco - /// - public void Save() - { - if (!Page.IsValid) { return; } - - //it will always be text since people may save a huge amount of selected nodes and serializing to xml could be large. - m_DataType.DBType = umbraco.cms.businesslogic.datatype.DBTypes.Ntext; - - //need to lock this operation since multiple inserts are happening and if 2 threads reach here at the same time, there - //could be issues. - lock (Locker) - { - var vals = GetPreValues(); - - //store the tree type - SavePreValue(PropertyIndex.TreeType, TreeTypeDropDown.SelectedValue, vals); - - //store the xpath - SavePreValue(PropertyIndex.XPathFilter, XPathFilterTextBox.Text, vals); - - //store the max node count - SavePreValue(PropertyIndex.MaxNodeCount, string.IsNullOrEmpty(MaxItemsTextBox.Text) ? "-1" : MaxItemsTextBox.Text, vals); - - //store the 'show tooltips' - SavePreValue(PropertyIndex.ShowToolTip, ShowItemInfoTooltipCheckBox.Checked.ToString(), vals); - - //store the 'as comma' - SavePreValue(PropertyIndex.StoreAsCommaDelimited, StoreAsCommaDelimitedRadioButtons.SelectedIndex.ToString(), vals); - - //the xpath filter type - SavePreValue(PropertyIndex.XPathFilterType, XPathFilterTypeRadioButtons.SelectedIndex.ToString(), vals); - - //based on the media type selected, we need to get the correct start node id - //from the correct control. - var startNodeId = -1; - switch (TreeTypeDropDown.SelectedIndex) - { - case 0: - int.TryParse(StartContentNodeIdPicker.Value, out startNodeId); - break; - case 1: - default: - int.TryParse(StartMediaNodeIdPicker.Value, out startNodeId); - break; - } - - //store the start node id - SavePreValue(PropertyIndex.StartNodeId, startNodeId.ToString(), vals); - - //store the 'show thumbnails' - SavePreValue(PropertyIndex.ShowThumbnails, ShowThumbnailsForMediaCheckBox.Checked.ToString(), vals); - - //store the 'node selection type' - SavePreValue(PropertyIndex.StartNodeSelectionType, StartNodeSelectionTypeRadioButtons.SelectedIndex.ToString(), vals); - - //store the 'xpath expression type' - SavePreValue(PropertyIndex.StartNodeXPathExpressionType, StartNodeXPathExpressionTypeRadioButtons.SelectedIndex.ToString(), vals); - - //save the 'xpath expression' - SavePreValue(PropertyIndex.StartNodeXPathExpression, StartNodeXPathExpressionTextBox.Text, vals); - - //save the control height - SavePreValue(PropertyIndex.ControlHeight, ControlHeightTextBox.Text, vals); - - //save the min amount - SavePreValue(PropertyIndex.MinNodeCount, MinItemsTextBox.Text, vals); - } - - //once everything is saved, clear the cookie vals - MNTP_DataType.ClearCookiePersistence(); - - } - - /// - /// Used to determine the index number of where the property is saved in the pre values repository - /// - private enum PropertyIndex - { - TreeType, - XPathFilter, - MaxNodeCount, - ShowToolTip, - StoreAsCommaDelimited, - XPathFilterType, - StartNodeId, - ShowThumbnails, - StartNodeSelectionType, - StartNodeXPathExpressionType, - StartNodeXPathExpression, - ControlHeight, - MinNodeCount - } - - /// - /// Helper method to save/create pre value values in the db - /// - /// - /// - /// - private void SavePreValue(PropertyIndex propIndex, string value, SortedList currentVals) - { - var index = (int)propIndex; - if (currentVals.Count >= ((int)propIndex + 1)) - { - //update - ((PreValue)currentVals[index]).Value = value; - ((PreValue)currentVals[index]).Save(); - } - else - { - //insert - PreValue.MakeNew(m_DataType.DataTypeDefinitionId, value); - } - } - - /// - /// Generic method to return a strongly typed object from the pre value bucket - /// - /// - /// - /// - /// - /// - private T GetPreValue(PropertyIndex index, Func output, T defaultVal) - { - var vals = GetPreValues(); - return vals.Count >= (int)index + 1 ? output((PreValue)vals[(int)index]) : defaultVal; - } - - #endregion - } -} diff --git a/src/umbraco.editorControls/MultiNodeTreePicker/MultiNodePickerScripts.js b/src/umbraco.editorControls/MultiNodeTreePicker/MultiNodePickerScripts.js deleted file mode 100644 index 9b548f142d..0000000000 --- a/src/umbraco.editorControls/MultiNodeTreePicker/MultiNodePickerScripts.js +++ /dev/null @@ -1,322 +0,0 @@ -(function ($) { - - //jquery plugin for our tree picker - $.fn.MultiNodeTreePicker = function (ctlId, maxItems, tooltipAjaxUrl, showTooltip, showThumbnail, umbPath, treeType) { - - /* internal properties */ - var $tree = $(this); - var ctl = $("#" + ctlId); - var hiddenField = ctl.find("input[type='hidden']"); - var rightCol = ctl.find(".right"); - var tooltip = null; //the tooltip object (will be defined when it is shown) - var throbber = null; - var collapseNode = null; //this is used to track collapsing of tree nodes due to the issue of the nodeClicked event being fired on tree collapse - - //store a reference to the hidden field in the right columns data collection - rightCol.data("hiddenField", hiddenField); - - function getPosition(trigger, tip, conf) { - // get origin top/left position - var top = trigger.offset().top, - left = trigger.offset().left, - pos = conf.position[0]; - - top -= tip.outerHeight() - conf.offset[0]; - left += trigger.outerWidth() + conf.offset[1]; - - // adjust Y - var height = tip.outerHeight() + trigger.outerHeight(); - if (pos == 'center') { top += height / 2; } - if (pos == 'bottom') { top += height; } - - - // adjust X - pos = conf.position[1]; - var width = tip.outerWidth() + trigger.outerWidth(); - if (pos == 'center') { left -= width / 2; } - if (pos == 'left') { left -= width; } - - return { top: top, left: left }; - } - - //used to create the tooltip - var tooltipOptions = { - tip: "#MNTPTooltip", - effect: "fade", - predelay: 0, - position: 'center left', - relative: true, - offset: [30, 0], - onShow: function () { - //get the id of the item being queried - var id = this.getTrigger().next().find("li").attr("rel"); - $.ajax({ - type: "POST", - data: "{\"id\": " + id + "}", - dataType: "json", - url: tooltipAjaxUrl, - contentType: "application/json; charset=UTF-8", - success: function (data) { - var newLocation = (treeType == "content" ? umbPath + "/editContent.aspx?id=" : umbPath + "/editMedia.aspx?id=") + data.d.Id; - var h = $("[edit]
ID: " + data.d.Id + "

Path: " + data.d.Path + "

" + data.d.PathAsNames + "

"); - h.click(function () { - - if (!confirm("Are you sure you want to navigate away from this page?\n\nYou may have unsaved changes.\n\nPress OK to continue or Cancel to stay on the current page.")) { - return false; - } - - //this is a VERY dodgy work around for deep linking between sections and pages - var iframe = UmbClientMgr.mainWindow().jQuery("#deepLinkScriptFrame"); - if (iframe.length == 0) { - var html = ""; - iframe = UmbClientMgr.mainWindow().jQuery("