AB4549 - Moved more models

This commit is contained in:
Bjarke Berg
2020-01-20 15:20:21 +01:00
parent 5a67e5b395
commit 9fa18fe9a3
36 changed files with 41 additions and 76 deletions
@@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Editors;
@@ -30,7 +28,7 @@ namespace Umbraco.Web.Models.ContentEditing
[DataMember(Name = "variants", IsRequired = true)]
public IEnumerable<ContentVariantSave> Variants { get; set; }
[DataMember(Name = "contentTypeAlias", IsRequired = true)]
[Required(AllowEmptyStrings = false)]
public string ContentTypeAlias { get; set; }
@@ -40,7 +38,7 @@ namespace Umbraco.Web.Models.ContentEditing
/// </summary>
[DataMember(Name = "templateAlias")]
public string TemplateAlias { get; set; }
#region IContentSave
[DataMember(Name = "action", IsRequired = true)]
@@ -54,7 +52,7 @@ namespace Umbraco.Web.Models.ContentEditing
/// <inheritdoc />
[IgnoreDataMember]
IContent IContentSave<IContent>.PersistedContent { get; set; }
//Non explicit internal getter so we don't need to explicitly cast in our own code
[IgnoreDataMember]
internal IContent PersistedContent
@@ -1,7 +1,5 @@
using System.Collections.Generic;
using System.Linq;
using Newtonsoft.Json;
using Umbraco.Core.Models;
namespace Umbraco.Web.Models.ContentEditing
{
@@ -1,7 +1,4 @@
using System.Collections.Generic;
using Newtonsoft.Json;
using Umbraco.Core.Models;
using Umbraco.Core.PropertyEditors;
using Umbraco.Core.Models;
namespace Umbraco.Web.Models.ContentEditing
{
@@ -173,7 +173,7 @@ namespace Umbraco.Web.Models.ContentEditing
/// This is not used for outgoing model information.
/// </remarks>
[IgnoreDataMember]
internal IContent PersistedContent { get; set; }
public IContent PersistedContent { get; set; }
/// <summary>
/// The DTO object used to gather all required content data including data type information etc... for use with validation - used during inbound model binding
@@ -184,7 +184,7 @@ namespace Umbraco.Web.Models.ContentEditing
/// This is not used for outgoing model information.
/// </remarks>
[IgnoreDataMember]
internal ContentPropertyCollectionDto ContentDto { get; set; }
public ContentPropertyCollectionDto ContentDto { get; set; }
/// <summary>
/// This is used to add custom localized messages/strings to the response for the app to use for localized UI purposes.
@@ -4,7 +4,7 @@ using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using Umbraco.Core;
using Umbraco.Web.Composing;
namespace Umbraco.Web.Models.ContentEditing
{
@@ -67,15 +67,7 @@ namespace Umbraco.Web.Models.ContentEditing
/// </summary>
[DataMember(Name = "iconFilePath")]
[ReadOnly(true)]
public string IconFilePath
{
get
{
return IconIsClass
? string.Empty
: string.Format("{0}images/umbraco/{1}", Current.Configs.Global().Path.EnsureEndsWith("/"), Icon);
}
}
public string IconFilePath { get; set; }
/// <summary>
/// Returns true if the icon represents a CSS class instead of a file path
@@ -100,15 +92,7 @@ namespace Umbraco.Web.Models.ContentEditing
/// </summary>
[DataMember(Name = "thumbnailFilePath")]
[ReadOnly(true)]
public string ThumbnailFilePath
{
get
{
return ThumbnailIsClass
? string.Empty
: Current.IOHelper.ResolveUrl("~/umbraco/images/thumbnails/" + Thumbnail);
}
}
public string ThumbnailFilePath { get; set; }
[DataMember(Name = "blueprints")]
[ReadOnly(true)]
@@ -1,6 +1,5 @@
using System.Runtime.Serialization;
using Umbraco.Core.Models;
using Umbraco.Web.WebApi.Filters;
namespace Umbraco.Web.Models.ContentEditing
{
@@ -1,13 +1,9 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.Serialization;
using Newtonsoft.Json.Linq;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Editors;
using Umbraco.Core.Models.Validation;
using Umbraco.Web.WebApi.Filters;
using Umbraco.Core;
namespace Umbraco.Web.Models.ContentEditing
@@ -9,7 +9,7 @@ namespace Umbraco.Web.Models.ContentEditing
/// temporary files that were created.
/// </summary>
[DataContract]
internal class PostedFiles : IHaveUploadedFiles, INotificationModel
public class PostedFiles : IHaveUploadedFiles, INotificationModel
{
public PostedFiles()
{
@@ -31,10 +31,10 @@ namespace Umbraco.Web.Models.ContentEditing
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
if (UserGroups.Any() == false)
yield return new ValidationResult("A user must be assigned to at least one group", new[] { "UserGroups" });
yield return new ValidationResult("A user must be assigned to at least one group", new[] { nameof(UserGroups) });
if (Current.Configs.Settings().Security.UsernameIsEmail == false && Username.IsNullOrWhiteSpace())
yield return new ValidationResult("A username cannot be empty", new[] { "Username" });
yield return new ValidationResult("A username cannot be empty", new[] { nameof(Username) });
}
}
}
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using Umbraco.Core;
using Umbraco.Core.Configuration;
using Umbraco.Web.Composing;
using Umbraco.Core.Logging;
using Umbraco.Core.Mapping;
@@ -10,6 +11,7 @@ using Umbraco.Core.PropertyEditors;
using Umbraco.Web.Models.ContentEditing;
using Umbraco.Core.Services;
using Umbraco.Core.Exceptions;
using Umbraco.Core.IO;
using Umbraco.Core.Strings;
namespace Umbraco.Web.Models.Mapping
@@ -27,11 +29,13 @@ namespace Umbraco.Web.Models.Mapping
private readonly IMemberTypeService _memberTypeService;
private readonly ILogger _logger;
private readonly IShortStringHelper _shortStringHelper;
private readonly IIOHelper _ioHelper;
private readonly IGlobalSettings _globalSettings;
public ContentTypeMapDefinition(PropertyEditorCollection propertyEditors, IDataTypeService dataTypeService, IFileService fileService,
IContentTypeService contentTypeService, IMediaTypeService mediaTypeService, IMemberTypeService memberTypeService,
ILogger logger, IShortStringHelper shortStringHelper)
ILogger logger, IShortStringHelper shortStringHelper, IIOHelper ioHelper, IGlobalSettings globalSettings)
{
_propertyEditors = propertyEditors;
_dataTypeService = dataTypeService;
@@ -41,7 +45,8 @@ namespace Umbraco.Web.Models.Mapping
_memberTypeService = memberTypeService;
_logger = logger;
_shortStringHelper = shortStringHelper;
_ioHelper = ioHelper;
_globalSettings = globalSettings;
}
public void DefineMaps(UmbracoMapper mapper)
@@ -184,6 +189,11 @@ namespace Umbraco.Web.Models.Mapping
target.CreateDate = source.CreateDate;
target.Description = source.Description;
target.Icon = source.Icon;
target.IconFilePath = target.IconIsClass
? string.Empty
: $"{Current.Configs.Global().Path.EnsureEndsWith("/")}images/umbraco/{source.Icon}";
target.Trashed = source.Trashed;
target.Id = source.Id;
target.IsContainer = source.IsContainer;
target.IsElement = source.IsElement;
@@ -192,7 +202,9 @@ namespace Umbraco.Web.Models.Mapping
target.ParentId = source.ParentId;
target.Path = source.Path;
target.Thumbnail = source.Thumbnail;
target.Trashed = source.Trashed;
target.ThumbnailFilePath = target.ThumbnailIsClass
? string.Empty
: Current.IOHelper.ResolveUrl("~/umbraco/images/thumbnails/" + source.Thumbnail);
target.UpdateDate = source.UpdateDate;
}
@@ -487,6 +499,9 @@ namespace Umbraco.Web.Models.Mapping
target.CreateDate = source.CreateDate;
target.Description = source.Description;
target.Icon = source.Icon;
target.IconFilePath = target.IconIsClass
? string.Empty
: $"{Current.Configs.Global().Path.EnsureEndsWith("/")}images/umbraco/{source.Icon}";
target.Id = source.Id;
target.IsContainer = source.IsContainer;
target.IsElement = source.IsElement;
@@ -495,6 +510,9 @@ namespace Umbraco.Web.Models.Mapping
target.ParentId = source.ParentId;
target.Path = source.Path;
target.Thumbnail = source.Thumbnail;
target.ThumbnailFilePath = target.ThumbnailIsClass
? string.Empty
: Current.IOHelper.ResolveUrl("~/umbraco/images/thumbnails/" + source.Thumbnail);
target.Udi = MapContentTypeUdi(source);
target.UpdateDate = source.UpdateDate;
@@ -524,6 +542,9 @@ namespace Umbraco.Web.Models.Mapping
target.CompositeContentTypes = source.CompositeContentTypes;
target.Description = source.Description;
target.Icon = source.Icon;
target.IconFilePath = target.IconIsClass
? string.Empty
: $"{Current.Configs.Global().Path.EnsureEndsWith("/")}images/umbraco/{source.Icon}";
target.Id = source.Id;
target.IsContainer = source.IsContainer;
target.IsElement = source.IsElement;
@@ -532,6 +553,9 @@ namespace Umbraco.Web.Models.Mapping
target.ParentId = source.ParentId;
target.Path = source.Path;
target.Thumbnail = source.Thumbnail;
target.ThumbnailFilePath = target.ThumbnailIsClass
? string.Empty
: Current.IOHelper.ResolveUrl("~/umbraco/images/thumbnails/" + source.Thumbnail);
target.Trashed = source.Trashed;
target.Udi = source.Udi;
}
-31
View File
@@ -187,11 +187,6 @@
<Compile Include="Logging\WebProfilerProvider.cs" />
<Compile Include="Macros\IMacroRenderer.cs" />
<Compile Include="Migrations\PostMigrations\PublishedSnapshotRebuilder.cs" />
<Compile Include="Models\ContentEditing\ContentItemDisplay.cs" />
<Compile Include="Models\ContentEditing\ContentTypeBasic.cs" />
<Compile Include="Models\ContentEditing\ListViewAwareContentItemDisplayBase.cs" />
<Compile Include="Models\ContentEditing\MacroDisplay.cs" />
<Compile Include="Models\ContentEditing\MediaItemDisplay.cs" />
<Compile Include="Models\ContentEditing\UserInvite.cs" />
<Compile Include="Models\Identity\BackOfficeIdentityUser.cs" />
<Compile Include="Models\Identity\IdentityMapDefinition.cs" />
@@ -266,7 +261,6 @@
<Compile Include="Trees\TreeUse.cs" />
<Compile Include="Trees\Tree.cs" />
<Compile Include="Trees\ITree.cs" />
<Compile Include="Models\ContentEditing\PublicAccess.cs" />
<Compile Include="Services\ITreeService.cs" />
<Compile Include="Services\ISectionService.cs" />
<Compile Include="PropertyEditors\GridPropertyIndexValueFactory.cs" />
@@ -393,7 +387,6 @@
<Compile Include="HealthCheck\HealthCheckStatus.cs" />
<Compile Include="HealthCheck\Checks\Security\HttpsCheck.cs" />
<Compile Include="HealthCheck\StatusResultType.cs" />
<Compile Include="Models\ContentEditing\ContentVariantSave.cs" />
<Compile Include="Editors\IEditorValidator.cs" />
<Compile Include="Editors\EditorModelEventManager.cs" />
<Compile Include="HtmlHelperBackOfficeExtensions.cs" />
@@ -537,17 +530,6 @@
<Compile Include="Trees\TreeAttribute.cs" />
<Compile Include="Models\Trees\TreeNode.cs" />
<Compile Include="Routing\NotFoundHandlerHelper.cs" />
<Compile Include="Models\ContentEditing\DocumentTypeDisplay.cs" />
<Compile Include="Models\ContentEditing\ContentTypeCompositionDisplay.cs" />
<Compile Include="Models\ContentEditing\ContentTypeSave.cs" />
<Compile Include="Models\ContentEditing\DocumentTypeSave.cs" />
<Compile Include="Models\ContentEditing\MediaTypeDisplay.cs" />
<Compile Include="Models\ContentEditing\MediaTypeSave.cs" />
<Compile Include="Models\ContentEditing\MemberPropertyTypeBasic.cs" />
<Compile Include="Models\ContentEditing\MemberPropertyTypeDisplay.cs" />
<Compile Include="Models\ContentEditing\MemberTypeDisplay.cs" />
<Compile Include="Models\ContentEditing\MemberTypeSave.cs" />
<Compile Include="Models\ContentEditing\PostedFiles.cs" />
<Compile Include="Models\LocalPackageInstallModel.cs" />
<Compile Include="Mvc\ControllerContextExtensions.cs" />
<Compile Include="Mvc\DisableBrowserCacheAttribute.cs" />
@@ -560,7 +542,6 @@
<Compile Include="OwinMiddlewareConfiguredEventArgs.cs" />
<Compile Include="Routing\RedirectTrackingComponent.cs" />
<Compile Include="Editors\RedirectUrlManagementController.cs" />
<Compile Include="Models\ContentEditing\RedirectUrlSearchResults.cs" />
<Compile Include="DefaultEventMessagesFactory.cs" />
<Compile Include="Routing\ContentFinderByRedirectUrl.cs" />
<Compile Include="Scheduling\LatchedBackgroundTaskBase.cs" />
@@ -569,7 +550,6 @@
<Compile Include="Security\ForceRenewalCookieAuthenticationHandler.cs" />
<Compile Include="Security\ForceRenewalCookieAuthenticationMiddleware.cs" />
<Compile Include="Security\GetUserSecondsMiddleWare.cs" />
<Compile Include="Models\ContentEditing\PropertyGroupDisplay.cs" />
<Compile Include="Security\IUmbracoBackOfficeTwoFactorOptions.cs" />
<Compile Include="Models\Mapping\PropertyTypeGroupMapper.cs" />
<Compile Include="Services\TreeService.cs" />
@@ -621,11 +601,7 @@
<Compile Include="Editors\PackageInstallController.cs" />
<Compile Include="Editors\RelationController.cs" />
<Compile Include="GridTemplateExtensions.cs" />
<Compile Include="Models\ContentEditing\DataTypeBasic.cs" />
<Compile Include="Models\ContentEditing\MemberBasic.cs" />
<Compile Include="Models\ContentEditing\MemberListDisplay.cs" />
<Compile Include="Editors\TemplateQueryController.cs" />
<Compile Include="Models\ContentEditing\MediaItemSave.cs" />
<Compile Include="Install\InstallException.cs" />
<Compile Include="Install\InstallStatusTracker.cs" />
<Compile Include="Install\InstallSteps\DatabaseConfigureStep.cs" />
@@ -673,10 +649,7 @@
<Compile Include="Editors\MemberTypeController.cs" />
<Compile Include="Editors\UpdateCheckController.cs" />
<Compile Include="PasswordConfigurationExtensions.cs" />
<Compile Include="Models\ContentEditing\ModelWithNotifications.cs" />
<Compile Include="Editors\StylesheetController.cs" />
<Compile Include="Models\ContentEditing\MemberDisplay.cs" />
<Compile Include="Models\ContentEditing\MemberSave.cs" />
<Compile Include="Models\Mapping\MacroMapDefinition.cs" />
<Compile Include="Models\Mapping\MemberMapDefinition.cs" />
<Compile Include="Models\Mapping\TagMapDefinition.cs" />
@@ -692,8 +665,6 @@
<Compile Include="Editors\EntityController.cs" />
<Compile Include="Editors\MemberController.cs" />
<Compile Include="Editors\CurrentUserController.cs" />
<Compile Include="Models\ContentEditing\DataTypeDisplay.cs" />
<Compile Include="Models\ContentEditing\DataTypeConfigurationFieldDisplay.cs" />
<Compile Include="Models\Mapping\DataTypeMapDefinition.cs" />
<Compile Include="Models\Mapping\EntityMapDefinition.cs" />
<Compile Include="PropertyEditors\MultipleTextStringPropertyEditor.cs" />
@@ -770,7 +741,6 @@
<Compile Include="Editors\SectionController.cs" />
<Compile Include="Editors\UmbracoAuthorizedJsonController.cs" />
<Compile Include="HttpCookieExtensions.cs" />
<Compile Include="Models\ContentEditing\MessagesExtensions.cs" />
<Compile Include="FormDataCollectionExtensions.cs" />
<Compile Include="Models\Mapping\ContentPropertyBasicMapper.cs" />
<Compile Include="Models\Mapping\ContentPropertyDisplayMapper.cs" />
@@ -807,7 +777,6 @@
<Compile Include="Trees\TreeRenderingEventArgs.cs" />
<Compile Include="Trees\UrlHelperExtensions.cs" />
<Compile Include="JavaScript\JsInitialization.cs" />
<Compile Include="Models\ContentEditing\ContentItemSave.cs" />
<Compile Include="HttpRequestExtensions.cs" />
<Compile Include="HttpUrlHelperExtensions.cs" />
<Compile Include="Install\FilePermissionHelper.cs" />