From 78741bf134cfa67238d2e6884766a5d94db5d858 Mon Sep 17 00:00:00 2001 From: Shannon Date: Fri, 6 Sep 2013 15:27:38 +1000 Subject: [PATCH] more work on removing the GUID requirement for prop editors, removes legacy editDataType webforms editor (U4-2801 Remove legacy/un-used editDataType.aspx webforms editor) --- src/Umbraco.Core/Models/PropertyExtensions.cs | 2 +- .../PropertyEditors/PropertyEditor.cs | 16 +- .../PropertyEditorAttribute.cs | 20 +-- .../PropertyEditors/PropertyEditorResolver.cs | 8 +- .../Manifest/ManifestParserTests.cs | 8 +- .../Mapping/ContentWebModelMappingTests.cs | 2 +- src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 5 +- .../developer/DataTypes/editDatatype.aspx | 27 ---- src/Umbraco.Web/Editors/DataTypeController.cs | 10 +- .../Editors/DataTypeValidateAttribute.cs | 2 +- .../Models/ContentEditing/DataTypeSave.cs | 2 +- .../ContentEditing/PropertyEditorBasic.cs | 4 +- .../Mapping/ContentPropertyBasicConverter.cs | 2 +- .../Models/Mapping/DataTypeModelMapper.cs | 3 +- .../Models/Mapping/DatabaseTypeResolver.cs | 2 +- .../Models/Mapping/PreValueDisplayResolver.cs | 6 +- .../Mapping/TabsAndPropertiesResolver.cs | 2 +- src/Umbraco.Web/Umbraco.Web.csproj | 10 -- .../developer/DataTypes/editDatatype.aspx | 27 ---- .../developer/DataTypes/editDatatype.aspx.cs | 144 ------------------ .../DataTypes/editDatatype.aspx.designer.cs | 105 ------------- 21 files changed, 46 insertions(+), 361 deletions(-) delete mode 100644 src/Umbraco.Web.UI/umbraco/developer/DataTypes/editDatatype.aspx delete mode 100644 src/Umbraco.Web/umbraco.presentation/umbraco/developer/DataTypes/editDatatype.aspx delete mode 100644 src/Umbraco.Web/umbraco.presentation/umbraco/developer/DataTypes/editDatatype.aspx.cs delete mode 100644 src/Umbraco.Web/umbraco.presentation/umbraco/developer/DataTypes/editDatatype.aspx.designer.cs diff --git a/src/Umbraco.Core/Models/PropertyExtensions.cs b/src/Umbraco.Core/Models/PropertyExtensions.cs index 01bd0d2c1b..58dad4198f 100644 --- a/src/Umbraco.Core/Models/PropertyExtensions.cs +++ b/src/Umbraco.Core/Models/PropertyExtensions.cs @@ -41,7 +41,7 @@ namespace Umbraco.Core.Models // XML construct from the value returned from the Property Editor. // More details discussed here: https://groups.google.com/forum/?fromgroups=#!topic/umbraco-dev/fieWZzHj7oY - var propertyEditor = PropertyEditorResolver.Current.GetById(property.PropertyType.DataTypeId); + var propertyEditor = PropertyEditorResolver.Current.GetByAlias(property.PropertyType.PropertyEditorAlias); if (propertyEditor != null) { var cacheValue = propertyEditor.ValueEditor.FormatValueForCache(property); diff --git a/src/Umbraco.Core/PropertyEditors/PropertyEditor.cs b/src/Umbraco.Core/PropertyEditors/PropertyEditor.cs index 7b2adf0e26..cf5ed24921 100644 --- a/src/Umbraco.Core/PropertyEditors/PropertyEditor.cs +++ b/src/Umbraco.Core/PropertyEditors/PropertyEditor.cs @@ -28,7 +28,7 @@ namespace Umbraco.Core.PropertyEditors if (_attribute != null) { //set the id/name from the attribute - Id = Guid.Parse(_attribute.Id); + Alias = _attribute.Alias; Name = _attribute.Name; } } @@ -48,8 +48,8 @@ namespace Umbraco.Core.PropertyEditors /// /// The id of the property editor /// - [JsonProperty("id", Required = Required.Always)] - public Guid Id { get; internal set; } + [JsonProperty("alias", Required = Required.Always)] + public string Alias { get; internal set; } /// /// The name of the property editor @@ -125,23 +125,23 @@ namespace Umbraco.Core.PropertyEditors //There's no manifest, just return an empty one return new PreValueEditor(); } - + protected bool Equals(PropertyEditor other) { - return Id.Equals(other.Id); + return string.Equals(Alias, other.Alias); } public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) return false; if (ReferenceEquals(this, obj)) return true; - var other = obj as PropertyEditor; - return other != null && Equals(other); + if (obj.GetType() != this.GetType()) return false; + return Equals((PropertyEditor) obj); } public override int GetHashCode() { - return Id.GetHashCode(); + return Alias.GetHashCode(); } } } \ No newline at end of file diff --git a/src/Umbraco.Core/PropertyEditors/PropertyEditorAttribute.cs b/src/Umbraco.Core/PropertyEditors/PropertyEditorAttribute.cs index 86912e8cc8..642298ae97 100644 --- a/src/Umbraco.Core/PropertyEditors/PropertyEditorAttribute.cs +++ b/src/Umbraco.Core/PropertyEditors/PropertyEditorAttribute.cs @@ -8,13 +8,13 @@ namespace Umbraco.Core.PropertyEditors /// public sealed class PropertyEditorAttribute : Attribute { - public PropertyEditorAttribute(string id, string name, string editorView) + public PropertyEditorAttribute(string alias, string name, string editorView) { - Mandate.ParameterNotNullOrEmpty(id, "id"); + Mandate.ParameterNotNullOrEmpty(alias, "alias"); Mandate.ParameterNotNullOrEmpty(name, "name"); Mandate.ParameterNotNullOrEmpty(editorView, "editorView"); - Id = id; + Alias = alias; Name = name; EditorView = editorView; @@ -22,32 +22,32 @@ namespace Umbraco.Core.PropertyEditors ValueType = "string"; } - public PropertyEditorAttribute(string id, string name) + public PropertyEditorAttribute(string alias, string name) { - Mandate.ParameterNotNullOrEmpty(id, "id"); + Mandate.ParameterNotNullOrEmpty(alias, "id"); Mandate.ParameterNotNullOrEmpty(name, "name"); - Id = id; + Alias = alias; Name = name; //defaults ValueType = "string"; } - public PropertyEditorAttribute(string id, string name, string valueType, string editorView) + public PropertyEditorAttribute(string alias, string name, string valueType, string editorView) { - Mandate.ParameterNotNullOrEmpty(id, "id"); + Mandate.ParameterNotNullOrEmpty(alias, "alias"); Mandate.ParameterNotNullOrEmpty(name, "name"); Mandate.ParameterNotNullOrEmpty(valueType, "valueType"); Mandate.ParameterNotNullOrEmpty(editorView, "editorView"); - Id = id; + Alias = alias; Name = name; ValueType = valueType; EditorView = editorView; } - public string Id { get; private set; } + public string Alias { get; private set; } public string Name { get; private set; } public string EditorView { get; private set; } public string ValueType { get; set; } diff --git a/src/Umbraco.Core/PropertyEditors/PropertyEditorResolver.cs b/src/Umbraco.Core/PropertyEditors/PropertyEditorResolver.cs index d39d14b652..e5eac179df 100644 --- a/src/Umbraco.Core/PropertyEditors/PropertyEditorResolver.cs +++ b/src/Umbraco.Core/PropertyEditors/PropertyEditorResolver.cs @@ -28,13 +28,13 @@ namespace Umbraco.Core.PropertyEditors } /// - /// Returns a property editor by id + /// Returns a property editor by alias /// - /// + /// /// - public PropertyEditor GetById(Guid id) + public PropertyEditor GetByAlias(string alias) { - return PropertyEditors.SingleOrDefault(x => x.Id == id); + return PropertyEditors.SingleOrDefault(x => x.Alias == alias); } } } \ No newline at end of file diff --git a/src/Umbraco.Tests/Manifest/ManifestParserTests.cs b/src/Umbraco.Tests/Manifest/ManifestParserTests.cs index 1e631bb09a..fabba3931b 100644 --- a/src/Umbraco.Tests/Manifest/ManifestParserTests.cs +++ b/src/Umbraco.Tests/Manifest/ManifestParserTests.cs @@ -77,7 +77,7 @@ namespace Umbraco.Belle.Tests var a = JsonConvert.DeserializeObject(@"[ { - id: '0EEBB7CE-51BA-4F6B-9D9C-78BB3314366C', + alias: 'Test.Test1', name: 'Test 1', editor: { view: '~/App_Plugins/MyPackage/PropertyEditors/MyEditor.html', @@ -94,7 +94,7 @@ namespace Umbraco.Belle.Tests } }, { - id: '1FCF5C39-5FC7-4BCE-AFBE-6500D9EBA261', + alias: 'Test.Test2', name: 'Test 2', defaultConfig: { key1: 'some default pre val' }, editor: { @@ -105,13 +105,13 @@ namespace Umbraco.Belle.Tests var parser = ManifestParser.GetPropertyEditors(a); Assert.AreEqual(2, parser.Count()); - Assert.AreEqual(new Guid("0EEBB7CE-51BA-4F6B-9D9C-78BB3314366C"), parser.ElementAt(0).Id); + Assert.AreEqual("Test.Test1", parser.ElementAt(0).Alias); Assert.AreEqual("Test 1", parser.ElementAt(0).Name); Assert.AreEqual("/App_Plugins/MyPackage/PropertyEditors/MyEditor.html", parser.ElementAt(0).ValueEditor.View); Assert.AreEqual("int", parser.ElementAt(0).ValueEditor.ValueType); Assert.AreEqual(2, parser.ElementAt(0).ValueEditor.Validators.Count()); - Assert.AreEqual(new Guid("1FCF5C39-5FC7-4BCE-AFBE-6500D9EBA261"), parser.ElementAt(1).Id); + Assert.AreEqual("Test.Test2", parser.ElementAt(1).Alias); Assert.AreEqual("Test 2", parser.ElementAt(1).Name); Assert.IsTrue(parser.ElementAt(1).DefaultPreValues.ContainsKey("key1")); Assert.AreEqual("some default pre val", parser.ElementAt(1).DefaultPreValues["key1"]); diff --git a/src/Umbraco.Tests/Models/Mapping/ContentWebModelMappingTests.cs b/src/Umbraco.Tests/Models/Mapping/ContentWebModelMappingTests.cs index 0b339a5910..c782a2fdfc 100644 --- a/src/Umbraco.Tests/Models/Mapping/ContentWebModelMappingTests.cs +++ b/src/Umbraco.Tests/Models/Mapping/ContentWebModelMappingTests.cs @@ -218,7 +218,7 @@ namespace Umbraco.Tests.Models.Mapping Assert.AreEqual(p.PropertyType.Description, pDto.Description); Assert.AreEqual(p.PropertyType.Name, pDto.Label); Assert.AreEqual(ApplicationContext.Services.DataTypeService.GetDataTypeDefinitionById(p.PropertyType.DataTypeDefinitionId), pDto.DataType); - Assert.AreEqual(PropertyEditorResolver.Current.GetById(p.PropertyType.DataTypeId), pDto.PropertyEditor); + Assert.AreEqual(PropertyEditorResolver.Current.GetByAlias(p.PropertyType.PropertyEditorAlias), pDto.PropertyEditor); } private void AssertContentItem(ContentItemBasic result, T content) diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index a0c160f9b0..9a4585ed08 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -2255,7 +2255,6 @@ - @@ -2632,8 +2631,8 @@ - - + + diff --git a/src/Umbraco.Web.UI/umbraco/developer/DataTypes/editDatatype.aspx b/src/Umbraco.Web.UI/umbraco/developer/DataTypes/editDatatype.aspx deleted file mode 100644 index 86066a5c63..0000000000 --- a/src/Umbraco.Web.UI/umbraco/developer/DataTypes/editDatatype.aspx +++ /dev/null @@ -1,27 +0,0 @@ -<%@ Page Language="c#" MasterPageFile="../../masterpages/umbracoPage.Master" Title="Edit data type" - CodeBehind="editDatatype.aspx.cs" AutoEventWireup="True" Inherits="umbraco.cms.presentation.developer.editDatatype" %> - -<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %> - - - - - - - - - - - - - - - - - - - diff --git a/src/Umbraco.Web/Editors/DataTypeController.cs b/src/Umbraco.Web/Editors/DataTypeController.cs index 78348e44eb..be844b1413 100644 --- a/src/Umbraco.Web/Editors/DataTypeController.cs +++ b/src/Umbraco.Web/Editors/DataTypeController.cs @@ -54,15 +54,15 @@ namespace Umbraco.Web.Editors /// /// Returns the pre-values for the specified property editor /// - /// + /// /// The data type id for the pre-values, -1 if it is a new data type /// - public IEnumerable GetPreValues(Guid editorId, int dataTypeId = -1) + public IEnumerable GetPreValues(string editorAlias, int dataTypeId = -1) { - var propEd = PropertyEditorResolver.Current.GetById(editorId); + var propEd = PropertyEditorResolver.Current.GetByAlias(editorAlias); if (propEd == null) { - throw new InvalidOperationException("Could not find property editor with id " + editorId); + throw new InvalidOperationException("Could not find property editor with alias " + editorAlias); } if (dataTypeId == -1) @@ -81,7 +81,7 @@ namespace Umbraco.Web.Editors //now, lets check if the data type has the current editor selected, if that is true //we will need to wire up it's saved values. Otherwise it's an existing data type //that is changing it's underlying property editor, in which case there's no values. - if (dataType.ControlId == editorId) + if (dataType.PropertyEditorAlias == editorAlias) { //this is the currently assigned pre-value editor, return with values. return Mapper.Map>(dataType); diff --git a/src/Umbraco.Web/Editors/DataTypeValidateAttribute.cs b/src/Umbraco.Web/Editors/DataTypeValidateAttribute.cs index c97d5828fd..54b3a6bd79 100644 --- a/src/Umbraco.Web/Editors/DataTypeValidateAttribute.cs +++ b/src/Umbraco.Web/Editors/DataTypeValidateAttribute.cs @@ -42,7 +42,7 @@ namespace Umbraco.Web.Editors var dataType = (DataTypeSave)actionContext.ActionArguments["dataType"]; //Validate that the property editor exists - var propertyEditor = PropertyEditorResolver.Current.GetById(dataType.SelectedEditor); + var propertyEditor = PropertyEditorResolver.Current.GetByAlias(dataType.SelectedEditor); if (propertyEditor == null) { var message = string.Format("Property editor with id: {0} was not found", dataType.SelectedEditor); diff --git a/src/Umbraco.Web/Models/ContentEditing/DataTypeSave.cs b/src/Umbraco.Web/Models/ContentEditing/DataTypeSave.cs index 907953bb13..16c7cade0b 100644 --- a/src/Umbraco.Web/Models/ContentEditing/DataTypeSave.cs +++ b/src/Umbraco.Web/Models/ContentEditing/DataTypeSave.cs @@ -23,7 +23,7 @@ namespace Umbraco.Web.Models.ContentEditing [DataMember(Name = "selectedEditor", IsRequired = true)] [Required] - public Guid SelectedEditor { get; set; } + public string SelectedEditor { get; set; } [DataMember(Name = "preValues")] public IEnumerable PreValues { get; set; } diff --git a/src/Umbraco.Web/Models/ContentEditing/PropertyEditorBasic.cs b/src/Umbraco.Web/Models/ContentEditing/PropertyEditorBasic.cs index 658a6c493d..17df4fde63 100644 --- a/src/Umbraco.Web/Models/ContentEditing/PropertyEditorBasic.cs +++ b/src/Umbraco.Web/Models/ContentEditing/PropertyEditorBasic.cs @@ -9,8 +9,8 @@ namespace Umbraco.Web.Models.ContentEditing [DataContract(Name = "propertyEditor", Namespace = "")] public class PropertyEditorBasic { - [DataMember(Name = "editorId")] - public Guid EditorId { get; set; } + [DataMember(Name = "alias")] + public string Alias { get; set; } [DataMember(Name = "name")] public string Name { get; set; } diff --git a/src/Umbraco.Web/Models/Mapping/ContentPropertyBasicConverter.cs b/src/Umbraco.Web/Models/Mapping/ContentPropertyBasicConverter.cs index a68d7fa29d..17d4946372 100644 --- a/src/Umbraco.Web/Models/Mapping/ContentPropertyBasicConverter.cs +++ b/src/Umbraco.Web/Models/Mapping/ContentPropertyBasicConverter.cs @@ -21,7 +21,7 @@ namespace Umbraco.Web.Models.Mapping /// protected override T ConvertCore(Property property) { - var editor = PropertyEditorResolver.Current.GetById(property.PropertyType.DataTypeId); + var editor = PropertyEditorResolver.Current.GetByAlias(property.PropertyType.PropertyEditorAlias); if (editor == null) { //TODO: Remove this check as we shouldn't support this at all! diff --git a/src/Umbraco.Web/Models/Mapping/DataTypeModelMapper.cs b/src/Umbraco.Web/Models/Mapping/DataTypeModelMapper.cs index bc09186a45..d0fd0d8b9a 100644 --- a/src/Umbraco.Web/Models/Mapping/DataTypeModelMapper.cs +++ b/src/Umbraco.Web/Models/Mapping/DataTypeModelMapper.cs @@ -21,8 +21,7 @@ namespace Umbraco.Web.Models.Mapping { var lazyDataTypeService = new Lazy(() => applicationContext.Services.DataTypeService); - config.CreateMap() - .ForMember(basic => basic.EditorId, expression => expression.MapFrom(editor => editor.Id)); + config.CreateMap(); //just maps the standard properties, does not map the value! config.CreateMap(); diff --git a/src/Umbraco.Web/Models/Mapping/DatabaseTypeResolver.cs b/src/Umbraco.Web/Models/Mapping/DatabaseTypeResolver.cs index 680220807b..cdfbb97960 100644 --- a/src/Umbraco.Web/Models/Mapping/DatabaseTypeResolver.cs +++ b/src/Umbraco.Web/Models/Mapping/DatabaseTypeResolver.cs @@ -13,7 +13,7 @@ namespace Umbraco.Web.Models.Mapping { protected override DataTypeDatabaseType ResolveCore(DataTypeSave source) { - var propertyEditor = PropertyEditorResolver.Current.GetById(source.SelectedEditor); + var propertyEditor = PropertyEditorResolver.Current.GetByAlias(source.SelectedEditor); if (propertyEditor == null) { throw new InvalidOperationException("Could not find property editor with id " + source.SelectedEditor); diff --git a/src/Umbraco.Web/Models/Mapping/PreValueDisplayResolver.cs b/src/Umbraco.Web/Models/Mapping/PreValueDisplayResolver.cs index 8991fbde8f..ddf7e2f8ac 100644 --- a/src/Umbraco.Web/Models/Mapping/PreValueDisplayResolver.cs +++ b/src/Umbraco.Web/Models/Mapping/PreValueDisplayResolver.cs @@ -23,12 +23,12 @@ namespace Umbraco.Web.Models.Mapping internal IEnumerable Convert(IDataTypeDefinition source) { PropertyEditor propEd = null; - if (source.ControlId != Guid.Empty) + if (source.PropertyEditorAlias.IsNullOrWhiteSpace() == false) { - propEd = PropertyEditorResolver.Current.GetById(source.ControlId); + propEd = PropertyEditorResolver.Current.GetByAlias(source.PropertyEditorAlias); if (propEd == null) { - throw new InvalidOperationException("Could not find property editor with id " + source.ControlId); + throw new InvalidOperationException("Could not find property editor with alias " + source.PropertyEditorAlias); } } diff --git a/src/Umbraco.Web/Models/Mapping/TabsAndPropertiesResolver.cs b/src/Umbraco.Web/Models/Mapping/TabsAndPropertiesResolver.cs index 89d605e375..be4246d71a 100644 --- a/src/Umbraco.Web/Models/Mapping/TabsAndPropertiesResolver.cs +++ b/src/Umbraco.Web/Models/Mapping/TabsAndPropertiesResolver.cs @@ -38,7 +38,7 @@ namespace Umbraco.Web.Models.Mapping //store the current props to append to the newly inserted ones var currProps = genericProps.Properties.ToArray(); - var labelEditor = PropertyEditorResolver.Current.GetById(new Guid(Constants.PropertyEditors.NoEdit)).ValueEditor.View; + var labelEditor = PropertyEditorResolver.Current.GetByAlias(Constants.PropertyEditors.NoEditAlias).ValueEditor.View; var contentProps = new List { diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index b8e2969da4..ac6b6b83f1 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -1301,13 +1301,6 @@ autoDoc.aspx - - editDatatype.aspx - ASPXCodeBehind - - - editDatatype.aspx - BrowseRepository.aspx ASPXCodeBehind @@ -2098,9 +2091,6 @@ - - ASPXCodeBehind - diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/DataTypes/editDatatype.aspx b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/DataTypes/editDatatype.aspx deleted file mode 100644 index 86066a5c63..0000000000 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/DataTypes/editDatatype.aspx +++ /dev/null @@ -1,27 +0,0 @@ -<%@ Page Language="c#" MasterPageFile="../../masterpages/umbracoPage.Master" Title="Edit data type" - CodeBehind="editDatatype.aspx.cs" AutoEventWireup="True" Inherits="umbraco.cms.presentation.developer.editDatatype" %> - -<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %> - - - - - - - - - - - - - - - - - - - diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/DataTypes/editDatatype.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/DataTypes/editDatatype.aspx.cs deleted file mode 100644 index 0423ce1f24..0000000000 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/DataTypes/editDatatype.aspx.cs +++ /dev/null @@ -1,144 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Globalization; -using System.Linq; -using System.Web.UI; -using System.Web.UI.WebControls; -using Umbraco.Core; -using Umbraco.Core.IO; -using Umbraco.Core.Models; -using Umbraco.Core.PropertyEditors; -using umbraco.cms.presentation.Trees; -using umbraco.interfaces; - -namespace umbraco.cms.presentation.developer -{ - public partial class editDatatype : BasePages.UmbracoEnsuredPage - { - public editDatatype() - { - CurrentApp = BusinessLogic.DefaultApps.developer.ToString(); - - } - protected ImageButton save; - - private int _id = 0; - private IDataPrevalue _prevalue; - private IDataTypeDefinition _dataTypeDefinition; - - protected void Page_Load(object sender, EventArgs e) - { - pp_name.Text = ui.Text("name"); - pp_renderControl.Text = ui.Text("renderControl"); - pane_settings.Text = ui.Text("settings"); - pp_guid.Text = ui.Text("guid"); - - _id = int.Parse(Request.QueryString["id"]); - - _dataTypeDefinition = ApplicationContext.Services.DataTypeService.GetDataTypeDefinitionById(_id); - - if (IsPostBack == false) - { - txtName.Text = _dataTypeDefinition.Name; - - //get the legacy data types - var datatypes = DataTypesResolver.Current.DataTypes - .ToDictionary(df => df.Id, df => "(legacy) " + df.DataTypeName); - - //get the new property editors - var propEditors = PropertyEditorResolver.Current.PropertyEditors - .ToDictionary(pe => pe.Id, pe => pe.Name); - - //join the lists - var combined = propEditors.Concat(datatypes); - - foreach (var item in combined) - { - var li = new ListItem - { - - Text = item.Value, - Value = item.Key.ToString() - }; - - //SJ Fixes U4-2488 Edit datatype: Media Picker appears incorrectly - //Apparently in some installs the media picker rendercontrol is installed twice with - //the exact same ID so we need to check for duplicates - if (ddlRenderControl.Items.Contains(li)) - continue; - - if (_dataTypeDefinition.ControlId != default(Guid) && li.Value == _dataTypeDefinition.ControlId.ToString()) - { - li.Selected = true; - } - - ddlRenderControl.Items.Add(li); - } - - ClientTools - .SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree().Tree.Alias) - .SyncTree("-1,init," + _id.ToString(CultureInfo.InvariantCulture), false); - - } - - if (_dataTypeDefinition.ControlId != default(Guid)) - { - litGuid.Text = _dataTypeDefinition.ControlId.ToString(); - } - - Panel1.Text = ui.Text("edit") + " datatype: " + _dataTypeDefinition.Name; - InsertPrevalueEditor(); - } - - private void InsertPrevalueEditor() - { - try - { - if (ddlRenderControl.SelectedIndex >= 0) - { - var o = DataTypesResolver.Current.GetById(new Guid(ddlRenderControl.SelectedValue)); - - o.DataTypeDefinitionId = _dataTypeDefinition.Id; - _prevalue = o.PrevalueEditor; - - if (o.PrevalueEditor.Editor != null) - plcEditorPrevalueControl.Controls.Add(o.PrevalueEditor.Editor); - } - else - { - plcEditorPrevalueControl.Controls.Add(new LiteralControl("No editor control selected")); - } - } - catch { } - - } - - protected void save_click(object sender, ImageClickEventArgs e) - { - // save prevalues; - if (_prevalue != null) - _prevalue.Save(); - - _dataTypeDefinition.ControlId = new Guid(ddlRenderControl.SelectedValue); - _dataTypeDefinition.Name = txtName.Text; - - ApplicationContext.Services.DataTypeService.Save(_dataTypeDefinition, UmbracoUser.Id); - - ClientTools.ShowSpeechBubble(speechBubbleIcon.save, ui.Text("speechBubbles", "dataTypeSaved"), ""); - ClientTools.SyncTree("-1,init," + _id.ToString(CultureInfo.InvariantCulture), true); - } - - override protected void OnInit(EventArgs e) - { - save = Panel1.Menu.NewImageButton(); - save.ID = "save"; - save.Click += save_click; - save.ImageUrl = SystemDirectories.Umbraco + "/images/editor/save.gif"; - - Panel1.hasMenu = true; - - base.OnInit(e); - } - } -} diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/DataTypes/editDatatype.aspx.designer.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/DataTypes/editDatatype.aspx.designer.cs deleted file mode 100644 index 9d1d8fc550..0000000000 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/DataTypes/editDatatype.aspx.designer.cs +++ /dev/null @@ -1,105 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace umbraco.cms.presentation.developer { - - - public partial class editDatatype { - - /// - /// Panel1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::umbraco.uicontrols.UmbracoPanel Panel1; - - /// - /// pane_control control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::umbraco.uicontrols.Pane pane_control; - - /// - /// pp_name control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::umbraco.uicontrols.PropertyPanel pp_name; - - /// - /// txtName control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.TextBox txtName; - - /// - /// pp_renderControl control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::umbraco.uicontrols.PropertyPanel pp_renderControl; - - /// - /// ddlRenderControl control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.DropDownList ddlRenderControl; - - /// - /// pp_guid control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::umbraco.uicontrols.PropertyPanel pp_guid; - - /// - /// litGuid control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Literal litGuid; - - /// - /// pane_settings control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::umbraco.uicontrols.Pane pane_settings; - - /// - /// plcEditorPrevalueControl control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.PlaceHolder plcEditorPrevalueControl; - } -}