Changes the explicit paramet editor implementations to simply use the already created property editors, updates the legacy parameter editor mappings and adjusts the resolver to use the mappings if one is not found.

This commit is contained in:
Shannon
2013-10-30 14:36:07 +11:00
parent 68b955e611
commit 46ba9718ff
10 changed files with 22 additions and 34 deletions

View File

@@ -69,6 +69,7 @@ namespace Umbraco.Core
//Create the legacy prop-eds mapping
LegacyPropertyEditorIdToAliasConverter.CreateMappingsForCoreEditors();
LegacyParameterEditorAliasConverter.CreateMappingsForCoreEditors();
//create database and service contexts for the app context
var dbFactory = new DefaultDatabaseFactory(GlobalSettings.UmbracoConnectionName);

View File

@@ -84,6 +84,16 @@ namespace Umbraco.Core.PropertyEditors
/// </summary>
internal static void CreateMappingsForCoreEditors()
{
//All of these map to the content picker
CreateMap("contentSubs", Constants.PropertyEditors.ContentPickerAlias);
CreateMap("contentRandom", Constants.PropertyEditors.ContentPickerAlias);
CreateMap("contentPicker", Constants.PropertyEditors.ContentPickerAlias);
CreateMap("contentTree", Constants.PropertyEditors.ContentPickerAlias);
CreateMap("contentAll", Constants.PropertyEditors.ContentPickerAlias);
CreateMap("textMultiLine", Constants.PropertyEditors.TextboxMultipleAlias);
CreateMap("text", Constants.PropertyEditors.TextboxAlias);
CreateMap("bool", Constants.PropertyEditors.TrueFalseAlias);
}
}

View File

@@ -51,7 +51,14 @@ namespace Umbraco.Core.PropertyEditors
/// <returns></returns>
public IParameterEditor GetByAlias(string alias)
{
return ParameterEditors.SingleOrDefault(x => x.Alias == alias);
var found = ParameterEditors.SingleOrDefault(x => x.Alias == alias);
if (found != null) return found;
//couldn't find one, so try the map
var mapped = LegacyParameterEditorAliasConverter.GetNewAliasFromLegacyAlias(alias);
return mapped == null
? null
: ParameterEditors.SingleOrDefault(x => x.Alias == mapped);
}
}
}

View File

@@ -1,9 +0,0 @@
using Umbraco.Core.PropertyEditors;
namespace Umbraco.Web.PropertyEditors.ParameterEditors
{
[ParameterEditor("textMultiLine", "Textarea", "textarea")]
public class TextAreaParameterEditor : ParameterEditor
{
}
}

View File

@@ -1,9 +0,0 @@
using Umbraco.Core.PropertyEditors;
namespace Umbraco.Web.PropertyEditors.ParameterEditors
{
[ParameterEditor("text", "Text", "textbox")]
public class TextParameterEditor : ParameterEditor
{
}
}

View File

@@ -1,9 +0,0 @@
using Umbraco.Core.PropertyEditors;
namespace Umbraco.Web.PropertyEditors.ParameterEditors
{
[ParameterEditor("bool", "True/False", "boolean")]
public class TrueFalseParameterEditor : ParameterEditor
{
}
}

View File

@@ -3,7 +3,7 @@ using Umbraco.Core.PropertyEditors;
namespace Umbraco.Web.PropertyEditors
{
[PropertyEditor(Constants.PropertyEditors.TextboxMultipleAlias, "Textarea", "textarea")]
[PropertyEditor(Constants.PropertyEditors.TextboxMultipleAlias, "Textarea", "textarea", IsParameterEditor = true)]
public class TextAreaPropertyEditor : PropertyEditor
{
}

View File

@@ -10,7 +10,7 @@ using Umbraco.Core.Services;
namespace Umbraco.Web.PropertyEditors
{
[PropertyEditor(Constants.PropertyEditors.TextboxAlias, "Textbox", "textbox")]
[PropertyEditor(Constants.PropertyEditors.TextboxAlias, "Textbox", "textbox", IsParameterEditor = true)]
public class TextboxPropertyEditor : PropertyEditor
{
}

View File

@@ -3,7 +3,7 @@ using Umbraco.Core.PropertyEditors;
namespace Umbraco.Web.PropertyEditors
{
[PropertyEditor(Constants.PropertyEditors.TrueFalseAlias, "True/False", "boolean")]
[PropertyEditor(Constants.PropertyEditors.TrueFalseAlias, "True/False", "boolean", IsParameterEditor = true)]
public class TrueFalsePropertyEditor : PropertyEditor
{
}

View File

@@ -346,9 +346,6 @@
<Compile Include="PropertyEditors\ListViewPropertyEditor.cs" />
<Compile Include="PropertyEditors\MemberPickerPropertyEditor.cs" />
<Compile Include="PropertyEditors\MultiNodeTreePickerPropertyEditor.cs" />
<Compile Include="PropertyEditors\ParameterEditors\TextAreaParameterEditor.cs" />
<Compile Include="PropertyEditors\ParameterEditors\TextParameterEditor.cs" />
<Compile Include="PropertyEditors\ParameterEditors\TrueFalseParameterEditor.cs" />
<Compile Include="PropertyEditors\RelatedLinksPropertyEditor.cs" />
<Compile Include="PropertyEditors\RteEmbedController.cs" />
<Compile Include="Editors\EntityController.cs" />