Moved lots of mapping files

This commit is contained in:
Bjarke Berg
2020-02-17 09:15:48 +01:00
parent f2b1558cb1
commit 402867f115
27 changed files with 34 additions and 60 deletions
@@ -1,8 +1,8 @@
namespace Umbraco.Core.Models
{
internal static class MediaTypeExtensions
public static class MediaTypeExtensions
{
internal static bool IsSystemMediaType(this IMediaType mediaType) =>
public static bool IsSystemMediaType(this IMediaType mediaType) =>
mediaType.Alias == Constants.Conventions.MediaTypes.File
|| mediaType.Alias == Constants.Conventions.MediaTypes.Folder
|| mediaType.Alias == Constants.Conventions.MediaTypes.Image;
@@ -22,7 +22,7 @@ namespace Umbraco.Web.Models.ContentEditing
/// We'll use this to map the categories but it wont' be returned in the json
/// </summary>
[IgnoreDataMember]
internal string Category { get; set; }
public string Category { get; set; }
/// <summary>
/// The letter from the IAction
@@ -75,7 +75,7 @@ namespace Umbraco.Core.Models
/// </summary>
/// <param name="dataType">The data type definition.</param>
/// <returns></returns>
internal static bool IsBuildInDataType(this IDataType dataType)
public static bool IsBuildInDataType(this IDataType dataType)
{
return IsBuildInDataType(dataType.Key);
}
@@ -83,7 +83,7 @@ namespace Umbraco.Core.Models
/// <summary>
/// Returns true if this date type is build-in/default.
/// </summary>
internal static bool IsBuildInDataType(Guid key)
public static bool IsBuildInDataType(Guid key)
{
return IdsOfBuildInDataTypes.Contains(key);
}
@@ -5,7 +5,7 @@ using Umbraco.Core.Services;
namespace Umbraco.Web
{
internal static class PasswordConfigurationExtensions
public static class PasswordConfigurationExtensions
{
/// <summary>
/// Returns the configuration of the membership provider used to configure change password editors
@@ -2,8 +2,8 @@
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.Serialization;
using Umbraco.Composing;
using Umbraco.Core;
using Umbraco.Web.Composing;
namespace Umbraco.Web.Models.ContentEditing
{
@@ -18,7 +18,7 @@ namespace Umbraco.Web.Models.Mapping
/// <summary>
/// Defines mappings for content/media/members type mappings
/// </summary>
internal class ContentTypeMapDefinition : IMapDefinition
public class ContentTypeMapDefinition : IMapDefinition
{
private readonly PropertyEditorCollection _propertyEditors;
private readonly IDataTypeService _dataTypeService;
@@ -591,7 +591,7 @@ namespace Umbraco.Web.Models.Mapping
return aliases.OrderBy(x => x);
}
internal static Udi MapContentTypeUdi(IContentTypeComposition source)
public static Udi MapContentTypeUdi(IContentTypeComposition source)
{
if (source == null) return null;
@@ -7,12 +7,11 @@ using Umbraco.Core.Logging;
using Umbraco.Core.Mapping;
using Umbraco.Core.Models;
using Umbraco.Core.PropertyEditors;
using Umbraco.Web.Composing;
using Umbraco.Web.Models.ContentEditing;
namespace Umbraco.Web.Models.Mapping
{
internal class DataTypeMapDefinition : IMapDefinition
public class DataTypeMapDefinition : IMapDefinition
{
private readonly PropertyEditorCollection _propertyEditors;
private readonly ILogger _logger;
@@ -142,7 +141,7 @@ namespace Umbraco.Web.Models.Mapping
// an empty fields list, which made no sense since there would be nothing to map to - and besides,
// a datatype without an editor alias is a serious issue - v8 wants an editor here
if (string.IsNullOrWhiteSpace(dataType.EditorAlias) || !Current.PropertyEditors.TryGet(dataType.EditorAlias, out var editor))
if (string.IsNullOrWhiteSpace(dataType.EditorAlias) || !_propertyEditors.TryGet(dataType.EditorAlias, out var editor))
throw new InvalidOperationException($"Could not find a property editor with alias \"{dataType.EditorAlias}\".");
var configurationEditor = editor.GetConfigurationEditor();
@@ -3,12 +3,12 @@ using System.Collections.Generic;
using System.Linq;
using Umbraco.Core;
using Umbraco.Core.Mapping;
using Umbraco.Web.Composing;
using Umbraco.Core.Models;
using Umbraco.Core.Services;
using Umbraco.Web.Models.ContentEditing;
using Umbraco.Core.Dictionary;
using Umbraco.Core.Configuration;
using Umbraco.Core.PropertyEditors;
namespace Umbraco.Web.Models.Mapping
{
@@ -20,7 +20,7 @@ namespace Umbraco.Web.Models.Mapping
/// This also ensures that the IsLocked out property is readonly when the member is not locked out - this is because
/// an admin cannot actually set isLockedOut = true, they can only unlock.
/// </remarks>
internal class MemberTabsAndPropertiesMapper : TabsAndPropertiesMapper<IMember>
public class MemberTabsAndPropertiesMapper : TabsAndPropertiesMapper<IMember>
{
private readonly IUmbracoContextAccessor _umbracoContextAccessor;
private readonly ILocalizedTextService _localizedTextService;
@@ -28,8 +28,17 @@ namespace Umbraco.Web.Models.Mapping
private readonly IMemberService _memberService;
private readonly IMemberGroupService _memberGroupService;
private readonly IMemberPasswordConfiguration _memberPasswordConfiguration;
private readonly PropertyEditorCollection _propertyEditorCollection;
public MemberTabsAndPropertiesMapper(ICultureDictionary cultureDictionary, IUmbracoContextAccessor umbracoContextAccessor, ILocalizedTextService localizedTextService, IMemberTypeService memberTypeService, IMemberService memberService, IMemberGroupService memberGroupService, IMemberPasswordConfiguration memberPasswordConfiguration, IContentTypeBaseServiceProvider contentTypeBaseServiceProvider)
public MemberTabsAndPropertiesMapper(ICultureDictionary cultureDictionary,
IUmbracoContextAccessor umbracoContextAccessor,
ILocalizedTextService localizedTextService,
IMemberTypeService memberTypeService,
IMemberService memberService,
IMemberGroupService memberGroupService,
IMemberPasswordConfiguration memberPasswordConfiguration,
IContentTypeBaseServiceProvider contentTypeBaseServiceProvider,
PropertyEditorCollection propertyEditorCollection)
: base(cultureDictionary, localizedTextService, contentTypeBaseServiceProvider)
{
_umbracoContextAccessor = umbracoContextAccessor ?? throw new ArgumentNullException(nameof(umbracoContextAccessor));
@@ -38,6 +47,7 @@ namespace Umbraco.Web.Models.Mapping
_memberService = memberService ?? throw new ArgumentNullException(nameof(memberService));
_memberGroupService = memberGroupService ?? throw new ArgumentNullException(nameof(memberGroupService));
_memberPasswordConfiguration = memberPasswordConfiguration;
_propertyEditorCollection = propertyEditorCollection;
}
/// <inheritdoc />
@@ -108,7 +118,7 @@ namespace Umbraco.Web.Models.Mapping
Alias = $"{Constants.PropertyEditors.InternalGenericPropertiesPrefix}doctype",
Label = _localizedTextService.Localize("content/membertype"),
Value = _localizedTextService.UmbracoDictionaryTranslate(CultureDictionary, member.ContentType.Name),
View = Current.PropertyEditors[Constants.PropertyEditors.Aliases.Label].GetValueEditor().View
View = _propertyEditorCollection[Constants.PropertyEditors.Aliases.Label].GetValueEditor().View
},
GetLoginProperty(_memberTypeService, member, _localizedTextService),
new ContentPropertyDisplay
@@ -7,7 +7,6 @@ using Umbraco.Core.Models;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Services;
using Umbraco.Core.Strings;
using Umbraco.Web.Composing;
using Umbraco.Web.Models.ContentEditing;
namespace Umbraco.Web.Models.Mapping
@@ -5,7 +5,7 @@ using Umbraco.Web.Routing;
namespace Umbraco.Web.Models.Mapping
{
internal class RedirectUrlMapDefinition : IMapDefinition
public class RedirectUrlMapDefinition : IMapDefinition
{
private readonly IPublishedUrlProvider _publishedUrlProvider;
@@ -6,12 +6,11 @@ using Umbraco.Core.Mapping;
using Umbraco.Core.Models;
using Umbraco.Core.Services;
using Umbraco.Web.Models.ContentEditing;
using Umbraco.Web.Composing;
using Umbraco.Core.Dictionary;
namespace Umbraco.Web.Models.Mapping
{
internal abstract class TabsAndPropertiesMapper
public abstract class TabsAndPropertiesMapper
{
protected ICultureDictionary CultureDictionary { get; }
protected ILocalizedTextService LocalizedTextService { get; }
@@ -115,7 +114,7 @@ namespace Umbraco.Web.Models.Mapping
/// <summary>
/// Creates the tabs collection with properties assigned for display models
/// </summary>
internal class TabsAndPropertiesMapper<TSource> : TabsAndPropertiesMapper
public class TabsAndPropertiesMapper<TSource> : TabsAndPropertiesMapper
where TSource : IContentBase
{
private readonly IContentTypeBaseServiceProvider _contentTypeBaseServiceProvider;
@@ -4,7 +4,6 @@ using System.Globalization;
using System.Linq;
using Umbraco.Core;
using Umbraco.Core.Cache;
using Umbraco.Web.Composing;
using Umbraco.Core.Configuration;
using Umbraco.Core.IO;
using Umbraco.Core.Mapping;
@@ -20,7 +19,7 @@ using Umbraco.Web.Services;
namespace Umbraco.Web.Models.Mapping
{
internal class UserMapDefinition : IMapDefinition
public class UserMapDefinition : IMapDefinition
{
private readonly ISectionService _sectionService;
private readonly IEntityService _entityService;
@@ -53,8 +53,6 @@ namespace Umbraco.Tests.PublishedContent
var dataTypeService = new TestObjects.TestDataTypeService(
new DataType(new RichTextPropertyEditor(
Mock.Of<ILogger>(),
Mock.Of<IMediaService>(),
Mock.Of<IContentTypeBaseServiceProvider>(),
Mock.Of<IUmbracoContextAccessor>(),
Mock.Of<IDataTypeService>(),
Mock.Of<ILocalizationService>(),
@@ -59,7 +59,7 @@ namespace Umbraco.Tests.PublishedContent
var dataTypeService = new TestObjects.TestDataTypeService(
new DataType(new VoidEditor(logger, Mock.Of<IDataTypeService>(), localizationService, LocalizedTextService, ShortStringHelper)) { Id = 1 },
new DataType(new TrueFalsePropertyEditor(logger, Mock.Of<IDataTypeService>(), localizationService, IOHelper, ShortStringHelper, LocalizedTextService)) { Id = 1001 },
new DataType(new RichTextPropertyEditor(logger, mediaService, contentTypeBaseServiceProvider, umbracoContextAccessor, Mock.Of<IDataTypeService>(), localizationService, imageSourceParser, linkParser, pastedImages, ShortStringHelper, IOHelper, LocalizedTextService, Mock.Of<IImageUrlGenerator>())) { Id = 1002 },
new DataType(new RichTextPropertyEditor(logger,umbracoContextAccessor, Mock.Of<IDataTypeService>(), localizationService, imageSourceParser, linkParser, pastedImages, ShortStringHelper, IOHelper, LocalizedTextService, Mock.Of<IImageUrlGenerator>())) { Id = 1002 },
new DataType(new IntegerPropertyEditor(logger, Mock.Of<IDataTypeService>(), localizationService, ShortStringHelper, LocalizedTextService)) { Id = 1003 },
new DataType(new TextboxPropertyEditor(logger, Mock.Of<IDataTypeService>(), localizationService, IOHelper, ShortStringHelper, LocalizedTextService)) { Id = 1004 },
new DataType(new MediaPickerPropertyEditor(logger, Mock.Of<IDataTypeService>(), localizationService, IOHelper, ShortStringHelper, LocalizedTextService)) { Id = 1005 });
@@ -1,5 +1,4 @@
using System;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
@@ -7,7 +6,6 @@ using System.Web.Security;
using Moq;
using NUnit.Framework;
using Umbraco.Core.Cache;
using Umbraco.Core.Configuration.UmbracoSettings;
using Umbraco.Core.Dictionary;
using Umbraco.Core.Logging;
using Umbraco.Core.Models.PublishedContent;
@@ -18,7 +16,6 @@ using Umbraco.Tests.Testing.Objects.Accessors;
using Umbraco.Web;
using Umbraco.Web.Mvc;
using Umbraco.Web.PublishedCache;
using Umbraco.Web.Routing;
using Umbraco.Web.Security;
using Umbraco.Web.Security.Providers;
using Current = Umbraco.Web.Composing.Current;
@@ -134,7 +131,6 @@ namespace Umbraco.Tests.Web.Mvc
[Test]
public void Mock_Current_Page()
{
var webRoutingSettings = Mock.Of<IWebRoutingSection>(section => section.UrlProviderMode == "Auto");
var globalSettings = TestObjects.GetGlobalSettings();
var httpContextAccessor = TestHelper.GetHttpContextAccessor();
@@ -17,22 +17,20 @@ using UserProfile = Umbraco.Web.Models.ContentEditing.UserProfile;
namespace Umbraco.Web.Models.Mapping
{
internal class CommonMapper
public class CommonMapper
{
private readonly IUserService _userService;
private readonly IContentTypeBaseServiceProvider _contentTypeBaseServiceProvider;
private readonly IUmbracoContextAccessor _umbracoContextAccessor;
private readonly ContentAppFactoryCollection _contentAppDefinitions;
private readonly ILocalizedTextService _localizedTextService;
private readonly IHttpContextAccessor _httpContextAccessor;
private readonly ICurrentUserAccessor _currentUserAccessor;
public CommonMapper(IUserService userService, IContentTypeBaseServiceProvider contentTypeBaseServiceProvider, IUmbracoContextAccessor umbracoContextAccessor,
public CommonMapper(IUserService userService, IContentTypeBaseServiceProvider contentTypeBaseServiceProvider,
ContentAppFactoryCollection contentAppDefinitions, ILocalizedTextService localizedTextService, IHttpContextAccessor httpContextAccessor, ICurrentUserAccessor currentUserAccessor)
{
_userService = userService;
_contentTypeBaseServiceProvider = contentTypeBaseServiceProvider;
_umbracoContextAccessor = umbracoContextAccessor;
_contentAppDefinitions = contentAppDefinitions;
_localizedTextService = localizedTextService;
_httpContextAccessor = httpContextAccessor;
@@ -15,7 +15,7 @@ namespace Umbraco.Web.Models.Mapping
/// <summary>
/// Declares model mappings for media.
/// </summary>
internal class MediaMapDefinition : IMapDefinition
public class MediaMapDefinition : IMapDefinition
{
private readonly CommonMapper _commonMapper;
private readonly ILogger _logger;
@@ -8,7 +8,7 @@ namespace Umbraco.Web.Models.Mapping
/// <summary>
/// Declares model mappings for members.
/// </summary>
internal class MemberMapDefinition : IMapDefinition
public class MemberMapDefinition : IMapDefinition
{
private readonly CommonMapper _commonMapper;
private readonly MemberTabsAndPropertiesMapper _tabsAndPropertiesMapper;
@@ -30,8 +30,6 @@ namespace Umbraco.Web.PropertyEditors
public class GridPropertyEditor : DataEditor
{
private readonly IUmbracoContextAccessor _umbracoContextAccessor;
private readonly IDataTypeService _dataTypeService;
private readonly ILocalizationService _localizationService;
private readonly IIOHelper _ioHelper;
private readonly ILogger _logger;
private readonly IMediaService _mediaService;
@@ -58,8 +56,6 @@ namespace Umbraco.Web.PropertyEditors
: base(logger, dataTypeService, localizationService, localizedTextService, shortStringHelper)
{
_umbracoContextAccessor = umbracoContextAccessor;
_dataTypeService = dataTypeService;
_localizationService = localizationService;
_ioHelper = ioHelper;
_logger = logger;
_mediaService = mediaService;
@@ -40,8 +40,6 @@ namespace Umbraco.Web.PropertyEditors
/// </summary>
public RichTextPropertyEditor(
ILogger logger,
IMediaService mediaService,
IContentTypeBaseServiceProvider contentTypeBaseServiceProvider,
IUmbracoContextAccessor umbracoContextAccessor,
IDataTypeService dataTypeService,
ILocalizationService localizationService,
@@ -1,17 +1,12 @@
using System.Text;
using Umbraco.Core;
using Umbraco.Core.Macros;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Models.PublishedContent;
using Umbraco.Core.PropertyEditors.ValueConverters;
using Umbraco.Web.Templates;
using System.Linq;
using HtmlAgilityPack;
using Umbraco.Core.Cache;
using Umbraco.Core.Services;
using Umbraco.Web.Composing;
using Umbraco.Web.Macros;
using System.Web;
using Umbraco.Core.Strings;
namespace Umbraco.Web.PropertyEditors.ValueConverters
-13
View File
@@ -168,26 +168,15 @@
<Compile Include="Logging\WebProfilerProvider.cs" />
<Compile Include="Macros\IMacroRenderer.cs" />
<Compile Include="Macros\PublishedContentHashtableConverter.cs" />
<Compile Include="Models\ContentEditing\UserInvite.cs" />
<Compile Include="Models\Identity\BackOfficeIdentityUser.cs" />
<Compile Include="Models\Identity\IdentityMapDefinition.cs" />
<Compile Include="Models\Identity\IdentityUser.cs" />
<Compile Include="Models\Identity\UserLoginInfoWrapper.cs" />
<Compile Include="Models\Mapping\CommonMapper.cs" />
<Compile Include="Models\Mapping\ContentMapDefinition.cs" />
<Compile Include="Models\Mapping\ContentPropertyBasicMapper.cs" />
<Compile Include="Models\Mapping\ContentPropertyDisplayMapper.cs" />
<Compile Include="Models\Mapping\ContentPropertyDtoMapper.cs" />
<Compile Include="Models\Mapping\ContentPropertyMapDefinition.cs" />
<Compile Include="Models\Mapping\ContentTypeMapDefinition.cs" />
<Compile Include="Models\Mapping\EntityMapDefinition.cs" />
<Compile Include="Models\Mapping\MediaMapDefinition.cs" />
<Compile Include="Models\Mapping\MemberMapDefinition.cs" />
<Compile Include="Models\Mapping\MemberTabsAndPropertiesMapper.cs" />
<Compile Include="Models\Mapping\PropertyTypeGroupMapper.cs" />
<Compile Include="Models\Mapping\RedirectUrlMapDefinition.cs" />
<Compile Include="Models\Mapping\TabsAndPropertiesMapper.cs" />
<Compile Include="Models\Mapping\UserMapDefinition.cs" />
<Compile Include="Models\Membership\UmbracoMembershipMember.cs" />
<Compile Include="Models\Trees\MenuItemCollection.cs" />
<Compile Include="Models\Trees\MenuItemList.cs" />
@@ -466,14 +455,12 @@
<Compile Include="Editors\MacroRenderingController.cs" />
<Compile Include="Editors\MemberTypeController.cs" />
<Compile Include="Editors\UpdateCheckController.cs" />
<Compile Include="PasswordConfigurationExtensions.cs" />
<Compile Include="Editors\StylesheetController.cs" />
<Compile Include="PropertyEditors\PropertyEditorAssetAttribute.cs" />
<Compile Include="PropertyEditors\RteEmbedController.cs" />
<Compile Include="Editors\EntityController.cs" />
<Compile Include="Editors\MemberController.cs" />
<Compile Include="Editors\CurrentUserController.cs" />
<Compile Include="Models\Mapping\DataTypeMapDefinition.cs" />
<Compile Include="PropertyEditors\RichTextPreValueController.cs" />
<Compile Include="PublishedContentQuery.cs" />
<Compile Include="ImageCropperTemplateExtensions.cs" />