Merge branch temp8 into temp8-11502
This commit is contained in:
36
src/Umbraco.Web/Models/ContentEditing/ContentApp.cs
Normal file
36
src/Umbraco.Web/Models/ContentEditing/ContentApp.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines a "Content App" which are editor extensions
|
||||
/// </summary>
|
||||
[DataContract(Name = "app", Namespace = "")]
|
||||
public class ContentApp
|
||||
{
|
||||
[DataMember(Name = "name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[DataMember(Name = "alias")]
|
||||
public string Alias { get; set; }
|
||||
|
||||
[DataMember(Name = "icon")]
|
||||
public string Icon { get; set; }
|
||||
|
||||
[DataMember(Name = "view")]
|
||||
public string View { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The view model specific to this app
|
||||
/// </summary>
|
||||
[DataMember(Name = "viewModel")]
|
||||
public object ViewModel { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Normally reserved for Angular to deal with but in some cases this can be set on the server side
|
||||
/// </summary>
|
||||
[DataMember(Name = "active")]
|
||||
public bool Active { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Runtime.Serialization;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.Editors;
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
/// <summary>
|
||||
/// A model representing a content base item to be saved
|
||||
/// </summary>
|
||||
[DataContract(Name = "content", Namespace = "")]
|
||||
public abstract class ContentBaseItemSave<TPersisted> : ContentItemBasic<ContentPropertyBasic, TPersisted>, IHaveUploadedFiles
|
||||
where TPersisted : IContentBase
|
||||
{
|
||||
protected ContentBaseItemSave()
|
||||
{
|
||||
UploadedFiles = new List<ContentPropertyFile>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The action to perform when saving this content item
|
||||
/// </summary>
|
||||
[DataMember(Name = "action", IsRequired = true)]
|
||||
[Required]
|
||||
public ContentSaveAction Action { get; set; }
|
||||
|
||||
[IgnoreDataMember]
|
||||
public List<ContentPropertyFile> UploadedFiles { get; private set; }
|
||||
}
|
||||
}
|
||||
57
src/Umbraco.Web/Models/ContentEditing/ContentBaseSave.cs
Normal file
57
src/Umbraco.Web/Models/ContentEditing/ContentBaseSave.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Runtime.Serialization;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.Editors;
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
/// <summary>
|
||||
/// A model representing a content item to be saved
|
||||
/// </summary>
|
||||
[DataContract(Name = "content", Namespace = "")]
|
||||
public abstract class ContentBaseSave<TPersisted> : ContentItemBasic<ContentPropertyBasic>, IContentSave<TPersisted>
|
||||
where TPersisted : IContentBase
|
||||
{
|
||||
protected ContentBaseSave()
|
||||
{
|
||||
UploadedFiles = new List<ContentPropertyFile>();
|
||||
}
|
||||
|
||||
#region IContentSave
|
||||
/// <inheritdoc />
|
||||
[DataMember(Name = "action", IsRequired = true)]
|
||||
[Required]
|
||||
public ContentSaveAction Action { get; set; }
|
||||
|
||||
[IgnoreDataMember]
|
||||
public List<ContentPropertyFile> UploadedFiles { get; }
|
||||
|
||||
//These need explicit implementation because we are using internal models
|
||||
/// <inheritdoc />
|
||||
[IgnoreDataMember]
|
||||
TPersisted IContentSave<TPersisted>.PersistedContent { get; set; }
|
||||
|
||||
//Non explicit internal getter so we don't need to explicitly cast in our own code
|
||||
[IgnoreDataMember]
|
||||
internal TPersisted PersistedContent
|
||||
{
|
||||
get => ((IContentSave<TPersisted>)this).PersistedContent;
|
||||
set => ((IContentSave<TPersisted>) this).PersistedContent = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The property DTO object is used to gather all required property data including data type information etc... for use with validation - used during inbound model binding
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// We basically use this object to hydrate all required data from the database into one object so we can validate everything we need
|
||||
/// instead of having to look up all the data individually.
|
||||
/// This is not used for outgoing model information.
|
||||
/// </remarks>
|
||||
[IgnoreDataMember]
|
||||
internal ContentPropertyCollectionDto PropertyCollectionDto { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
using Umbraco.Core.Models;
|
||||
@@ -66,14 +67,13 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
/// A model representing a basic content item with properties
|
||||
/// </summary>
|
||||
[DataContract(Name = "content", Namespace = "")]
|
||||
public class ContentItemBasic<T, TPersisted> : ContentItemBasic
|
||||
public class ContentItemBasic<T> : ContentItemBasic, IContentProperties<T>
|
||||
where T : ContentPropertyBasic
|
||||
where TPersisted : IContentBase
|
||||
{
|
||||
public ContentItemBasic()
|
||||
{
|
||||
//ensure its not null
|
||||
_properties = new List<T>();
|
||||
_properties = Enumerable.Empty<T>();
|
||||
}
|
||||
|
||||
private IEnumerable<T> _properties;
|
||||
@@ -85,26 +85,5 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
set => _properties = value;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The real persisted content object - used during inbound model binding
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is not used for outgoing model information.
|
||||
/// </remarks>
|
||||
[IgnoreDataMember]
|
||||
internal TPersisted 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
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// We basically use this object to hydrate all required data from the database into one object so we can validate everything we need
|
||||
/// instead of having to look up all the data individually.
|
||||
/// This is not used for outgoing model information.
|
||||
/// </remarks>
|
||||
[IgnoreDataMember]
|
||||
internal ContentItemDto<TPersisted> ContentDto { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Runtime.Serialization;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Serialization;
|
||||
using Umbraco.Web.Routing;
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
@@ -10,40 +15,121 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
/// A model representing a content item to be displayed in the back office
|
||||
/// </summary>
|
||||
[DataContract(Name = "content", Namespace = "")]
|
||||
public class ContentItemDisplay : ListViewAwareContentItemDisplayBase<ContentPropertyDisplay, IContent>
|
||||
public class ContentItemDisplay : INotificationModel, IErrorModel //ListViewAwareContentItemDisplayBase<ContentPropertyDisplay, IContent>
|
||||
{
|
||||
public ContentItemDisplay()
|
||||
{
|
||||
AllowPreview = true;
|
||||
Notifications = new List<Notification>();
|
||||
Errors = new Dictionary<string, object>();
|
||||
Variants = new List<ContentVariantDisplay>();
|
||||
ContentApps = new List<ContentApp>();
|
||||
}
|
||||
|
||||
[DataMember(Name = "publishDate")]
|
||||
public DateTime? PublishDate { get; set; }
|
||||
[DataMember(Name = "id", IsRequired = true)]
|
||||
[Required]
|
||||
public int Id { get; set; }
|
||||
|
||||
[DataMember(Name = "udi")]
|
||||
[ReadOnly(true)]
|
||||
[JsonConverter(typeof(UdiJsonConverter))]
|
||||
public Udi Udi { get; set; }
|
||||
|
||||
[DataMember(Name = "icon")]
|
||||
public string Icon { get; set; }
|
||||
|
||||
[DataMember(Name = "trashed")]
|
||||
[ReadOnly(true)]
|
||||
public bool Trashed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// This is the unique Id stored in the database - but could also be the unique id for a custom membership provider
|
||||
/// </summary>
|
||||
[DataMember(Name = "key")]
|
||||
public Guid Key { get; set; }
|
||||
|
||||
[DataMember(Name = "parentId", IsRequired = true)]
|
||||
[Required]
|
||||
public int ParentId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The path of the entity
|
||||
/// </summary>
|
||||
[DataMember(Name = "path")]
|
||||
public string Path { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A collection of content variants
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If a content item is invariant, this collection will only contain one item, else it will contain all culture variants
|
||||
/// </remarks>
|
||||
[DataMember(Name = "variants")]
|
||||
public IEnumerable<ContentVariantDisplay> Variants { get; set; }
|
||||
|
||||
[DataMember(Name = "owner")]
|
||||
public UserProfile Owner { get; set; }
|
||||
|
||||
[DataMember(Name = "updater")]
|
||||
public UserProfile Updater { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of the content type
|
||||
/// </summary>
|
||||
[DataMember(Name = "contentTypeName")]
|
||||
public string ContentTypeName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates if the content is configured as a list view container
|
||||
/// </summary>
|
||||
[DataMember(Name = "isContainer")]
|
||||
public bool IsContainer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Property indicating if this item is part of a list view parent
|
||||
/// </summary>
|
||||
[DataMember(Name = "isChildOfListView")]
|
||||
public bool IsChildOfListView { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Property for the entity's individual tree node URL
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is required if the item is a child of a list view since the tree won't actually be loaded,
|
||||
/// so the app will need to go fetch the individual tree node in order to be able to load it's action list (menu)
|
||||
/// </remarks>
|
||||
[DataMember(Name = "treeNodeUrl")]
|
||||
public string TreeNodeUrl { get; set; }
|
||||
|
||||
[DataMember(Name = "contentTypeAlias", IsRequired = true)]
|
||||
[Required(AllowEmptyStrings = false)]
|
||||
public string ContentTypeAlias { get; set; }
|
||||
|
||||
[DataMember(Name = "sortOrder")]
|
||||
public int SortOrder { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// This is the last updated date for the entire content object regardless of variants
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Each variant has it's own update date assigned as well
|
||||
/// </remarks>
|
||||
[DataMember(Name = "updateDate")]
|
||||
public DateTime UpdateDate { get; set; }
|
||||
|
||||
//TODO: These will need to be moved once we have scheduled publishing in per culture
|
||||
[DataMember(Name = "releaseDate")]
|
||||
public DateTime? ReleaseDate { get; set; }
|
||||
|
||||
[DataMember(Name = "removeDate")]
|
||||
public DateTime? ExpireDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Represents the variant info for a content item
|
||||
/// </summary>
|
||||
[DataMember(Name = "variants")]
|
||||
public IEnumerable<ContentVariation> Variants { get; set; }
|
||||
|
||||
|
||||
[DataMember(Name = "template")]
|
||||
public string TemplateAlias { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
[DataMember(Name = "templateId")]
|
||||
public int TemplateId { get; set; }
|
||||
|
||||
|
||||
|
||||
|
||||
[DataMember(Name = "allowedTemplates")]
|
||||
public IDictionary<string, string> AllowedTemplates { get; set; }
|
||||
|
||||
@@ -73,5 +159,56 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
|
||||
[DataMember(Name = "isBlueprint")]
|
||||
public bool IsBlueprint { get; set; }
|
||||
|
||||
[DataMember(Name = "apps")]
|
||||
public IEnumerable<ContentApp> ContentApps { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The real persisted content object - used during inbound model binding
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is not used for outgoing model information.
|
||||
/// </remarks>
|
||||
[IgnoreDataMember]
|
||||
internal 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
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// We basically use this object to hydrate all required data from the database into one object so we can validate everything we need
|
||||
/// instead of having to look up all the data individually.
|
||||
/// This is not used for outgoing model information.
|
||||
/// </remarks>
|
||||
[IgnoreDataMember]
|
||||
internal 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.
|
||||
/// </summary>
|
||||
[DataMember(Name = "notifications")]
|
||||
[ReadOnly(true)]
|
||||
public List<Notification> Notifications { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// This is used for validation of a content item.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// A content item can be invalid but still be saved. This occurs when there's property validation errors, we will
|
||||
/// still save the item but it cannot be published. So we need a way of returning validation errors as well as the
|
||||
/// updated model.
|
||||
///
|
||||
/// NOTE: The ProperCase is important because when we return ModeState normally it will always be proper case.
|
||||
/// </remarks>
|
||||
[DataMember(Name = "ModelState")]
|
||||
[ReadOnly(true)]
|
||||
public IDictionary<string, object> Errors { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A collection of extra data that is available for this specific entity/entity type
|
||||
/// </summary>
|
||||
[DataMember(Name = "metaData")]
|
||||
[ReadOnly(true)]
|
||||
public IDictionary<string, object> AdditionalData { get; private set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,9 +5,8 @@ using Umbraco.Core.Models;
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
public abstract class ContentItemDisplayBase<T, TPersisted> : TabbedContentItem<T, TPersisted>, INotificationModel, IErrorModel
|
||||
public abstract class ContentItemDisplayBase<T> : TabbedContentItem<T>, INotificationModel, IErrorModel
|
||||
where T : ContentPropertyBasic
|
||||
where TPersisted : IContentBase
|
||||
{
|
||||
protected ContentItemDisplayBase()
|
||||
{
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
using Newtonsoft.Json;
|
||||
using Umbraco.Core.Models;
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a content item from the database including all of the required data that we need to work with such as data type data
|
||||
/// </summary>
|
||||
internal class ContentItemDto<TPersisted> : ContentItemBasic<ContentPropertyDto, TPersisted>
|
||||
where TPersisted : IContentBase
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.Editors;
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
@@ -10,13 +12,28 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
/// A model representing a content item to be saved
|
||||
/// </summary>
|
||||
[DataContract(Name = "content", Namespace = "")]
|
||||
public class ContentItemSave : ContentBaseItemSave<IContent>
|
||||
public class ContentItemSave : IContentSave<IContent>
|
||||
{
|
||||
/// <summary>
|
||||
/// The language Id for the content variation being saved
|
||||
/// </summary>
|
||||
[DataMember(Name = "culture")]
|
||||
public string Culture { get; set; } //TODO: Change this to ContentVariationPublish, but this will all change anyways when we can edit all variants at once
|
||||
protected ContentItemSave()
|
||||
{
|
||||
UploadedFiles = new List<ContentPropertyFile>();
|
||||
Variants = new List<ContentVariantSave>();
|
||||
}
|
||||
|
||||
[DataMember(Name = "id", IsRequired = true)]
|
||||
[Required]
|
||||
public int Id { get; set; }
|
||||
|
||||
[DataMember(Name = "parentId", IsRequired = true)]
|
||||
[Required]
|
||||
public int ParentId { get; set; }
|
||||
|
||||
[DataMember(Name = "variants", IsRequired = true)]
|
||||
public IEnumerable<ContentVariantSave> Variants { get; set; }
|
||||
|
||||
[DataMember(Name = "contentTypeAlias", IsRequired = true)]
|
||||
[Required(AllowEmptyStrings = false)]
|
||||
public string ContentTypeAlias { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The template alias to save
|
||||
@@ -24,16 +41,35 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
[DataMember(Name = "templateAlias")]
|
||||
public string TemplateAlias { get; set; }
|
||||
|
||||
//TODO: these will need to move to the variant
|
||||
[DataMember(Name = "releaseDate")]
|
||||
public DateTime? ReleaseDate { get; set; }
|
||||
|
||||
[DataMember(Name = "expireDate")]
|
||||
public DateTime? ExpireDate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that these variations should also be published
|
||||
/// </summary>
|
||||
[DataMember(Name = "publishVariations")]
|
||||
public IEnumerable<ContentVariationPublish> PublishVariations { get; set; }
|
||||
#region IContentSave
|
||||
|
||||
[DataMember(Name = "action", IsRequired = true)]
|
||||
[Required]
|
||||
public ContentSaveAction Action { get; set; }
|
||||
|
||||
[IgnoreDataMember]
|
||||
public List<ContentPropertyFile> UploadedFiles { get; }
|
||||
|
||||
//These need explicit implementation because we are using internal models
|
||||
/// <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
|
||||
{
|
||||
get => ((IContentSave<IContent>)this).PersistedContent;
|
||||
set => ((IContentSave<IContent>)this).PersistedContent = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Runtime.Serialization;
|
||||
using Umbraco.Core.PropertyEditors;
|
||||
|
||||
@@ -36,6 +37,17 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
[DataMember(Name = "isSensitive", IsRequired = false)]
|
||||
public bool IsSensitive { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The culture of the property
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If this is a variant property then this culture value will be the same as it's variant culture but if this
|
||||
/// is an invariant property then this will be a null value.
|
||||
/// </remarks>
|
||||
[DataMember(Name = "culture")]
|
||||
[ReadOnly(true)]
|
||||
public string Culture { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Used internally during model mapping
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using Umbraco.Core.Models;
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
/// <summary>
|
||||
/// Used to map property values when saving content/media/members
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is only used during mapping operations, it is not used for angular purposes
|
||||
/// </remarks>
|
||||
internal class ContentPropertyCollectionDto : IContentProperties<ContentPropertyDto>
|
||||
{
|
||||
public ContentPropertyCollectionDto()
|
||||
{
|
||||
Properties = Enumerable.Empty<ContentPropertyDto>();
|
||||
}
|
||||
|
||||
public IEnumerable<ContentPropertyDto> Properties { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -15,5 +15,6 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
public string Description { get; set; }
|
||||
public bool IsRequired { get; set; }
|
||||
public string ValidationRegExp { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
28
src/Umbraco.Web/Models/ContentEditing/ContentSavedState.cs
Normal file
28
src/Umbraco.Web/Models/ContentEditing/ContentSavedState.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
/// <summary>
|
||||
/// The saved state of a content item
|
||||
/// </summary>
|
||||
public enum ContentSavedState
|
||||
{
|
||||
/// <summary>
|
||||
/// The item isn't created yet
|
||||
/// </summary>
|
||||
NotCreated,
|
||||
|
||||
/// <summary>
|
||||
/// The item is saved but isn't published
|
||||
/// </summary>
|
||||
Draft,
|
||||
|
||||
/// <summary>
|
||||
/// The item is published and there are no pending changes
|
||||
/// </summary>
|
||||
Published,
|
||||
|
||||
/// <summary>
|
||||
/// The item is published and there are pending changes
|
||||
/// </summary>
|
||||
PublishedPendingChanges
|
||||
}
|
||||
}
|
||||
59
src/Umbraco.Web/Models/ContentEditing/ContentVariantSave.cs
Normal file
59
src/Umbraco.Web/Models/ContentEditing/ContentVariantSave.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.Validation;
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
[DataContract(Name = "contentVariant", Namespace = "")]
|
||||
public class ContentVariantSave : IContentProperties<ContentPropertyBasic>
|
||||
{
|
||||
public ContentVariantSave()
|
||||
{
|
||||
Properties = new List<ContentPropertyBasic>();
|
||||
}
|
||||
|
||||
[DataMember(Name = "name", IsRequired = true)]
|
||||
[RequiredForPersistence(AllowEmptyStrings = false, ErrorMessage = "Required")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[DataMember(Name = "properties")]
|
||||
public IEnumerable<ContentPropertyBasic> Properties { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The culture of this variant, if this is invariant than this is null or empty
|
||||
/// </summary>
|
||||
[DataMember(Name = "culture")]
|
||||
public string Culture { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates if the variant should be updated
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If this is false, this variant data will not be updated at all
|
||||
/// </remarks>
|
||||
[DataMember(Name = "save")]
|
||||
public bool Save { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates if the variant should be published
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This option will have no affect if <see cref="Save"/> is false.
|
||||
/// This is not used to unpublish.
|
||||
/// </remarks>
|
||||
[DataMember(Name = "publish")]
|
||||
public bool Publish { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The property DTO object is used to gather all required property data including data type information etc... for use with validation - used during inbound model binding
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// We basically use this object to hydrate all required data from the database into one object so we can validate everything we need
|
||||
/// instead of having to look up all the data individually.
|
||||
/// This is not used for outgoing model information.
|
||||
/// </remarks>
|
||||
[IgnoreDataMember]
|
||||
internal ContentPropertyCollectionDto PropertyCollectionDto { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Runtime.Serialization;
|
||||
using Umbraco.Core.Models;
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the variant info for a content item
|
||||
/// </summary>
|
||||
[DataContract(Name = "contentVariant", Namespace = "")]
|
||||
public class ContentVariation
|
||||
{
|
||||
[DataMember(Name = "language", IsRequired = true)]
|
||||
[Required]
|
||||
public Language Language { get; set; }
|
||||
|
||||
[DataMember(Name = "segment")]
|
||||
public string Segment { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The content name of the variant
|
||||
/// </summary>
|
||||
[DataMember(Name = "name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[DataMember(Name = "state")]
|
||||
public string PublishedState { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determines if the content variant for this culture has been created
|
||||
/// </summary>
|
||||
[DataMember(Name = "exists")]
|
||||
public bool Exists { get; set; }
|
||||
|
||||
[DataMember(Name = "isEdited")]
|
||||
public bool IsEdited { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determines if this is the variant currently being edited
|
||||
/// </summary>
|
||||
[DataMember(Name = "current")]
|
||||
public bool IsCurrent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If the variant is a required variant for validation purposes
|
||||
/// </summary>
|
||||
[DataMember(Name = "mandatory")]
|
||||
public bool Mandatory { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using Newtonsoft.Json.Converters;
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the variant info for a content item
|
||||
/// </summary>
|
||||
[DataContract(Name = "contentVariant", Namespace = "")]
|
||||
public class ContentVariantDisplay : ITabbedContent<ContentPropertyDisplay>, IContentProperties<ContentPropertyDisplay>
|
||||
{
|
||||
public ContentVariantDisplay()
|
||||
{
|
||||
Tabs = new List<Tab<ContentPropertyDisplay>>();
|
||||
}
|
||||
|
||||
[DataMember(Name = "name", IsRequired = true)]
|
||||
public string Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Defines the tabs containing display properties
|
||||
/// </summary>
|
||||
[DataMember(Name = "tabs")]
|
||||
public IEnumerable<Tab<ContentPropertyDisplay>> Tabs { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Internal property used for tests to get all properties from all tabs
|
||||
/// </summary>
|
||||
[IgnoreDataMember]
|
||||
[JsonIgnore]
|
||||
IEnumerable<ContentPropertyDisplay> IContentProperties<ContentPropertyDisplay>.Properties => Tabs.SelectMany(x => x.Properties);
|
||||
|
||||
/// <summary>
|
||||
/// The language/culture assigned to this content variation
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If this is null it means this content variant is an invariant culture
|
||||
/// </remarks>
|
||||
[DataMember(Name = "language")]
|
||||
public Language Language { get; set; }
|
||||
|
||||
[DataMember(Name = "segment")]
|
||||
public string Segment { get; set; }
|
||||
|
||||
[DataMember(Name = "state")]
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public ContentSavedState State { get; set; }
|
||||
|
||||
[DataMember(Name = "updateDate")]
|
||||
public DateTime UpdateDate { get; set; }
|
||||
|
||||
[DataMember(Name = "createDate")]
|
||||
public DateTime CreateDate { get; set; }
|
||||
|
||||
[DataMember(Name = "publishDate")]
|
||||
public DateTime? PublishDate { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
/// <summary>
|
||||
/// Used to indicate which additional variants to publish when a content item is published
|
||||
/// </summary>
|
||||
public class ContentVariationPublish
|
||||
{
|
||||
[DataMember(Name = "culture", IsRequired = true)]
|
||||
[Required]
|
||||
public string Culture { get; set; }
|
||||
|
||||
[DataMember(Name = "segment")]
|
||||
public string Segment { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -3,10 +3,12 @@ using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Web.Http.ModelBinding;
|
||||
using Newtonsoft.Json;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Models.Validation;
|
||||
using Umbraco.Core.Serialization;
|
||||
using Umbraco.Web.WebApi;
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
|
||||
12
src/Umbraco.Web/Models/ContentEditing/IContentProperties.cs
Normal file
12
src/Umbraco.Web/Models/ContentEditing/IContentProperties.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
using System.Collections.Generic;
|
||||
using Umbraco.Core.Models;
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
|
||||
public interface IContentProperties<T>
|
||||
where T : ContentPropertyBasic
|
||||
{
|
||||
IEnumerable<T> Properties { get; }
|
||||
}
|
||||
}
|
||||
25
src/Umbraco.Web/Models/ContentEditing/IContentSave.cs
Normal file
25
src/Umbraco.Web/Models/ContentEditing/IContentSave.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using Umbraco.Core.Models;
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
/// <summary>
|
||||
/// An interface exposes the shared parts of content, media, members that we use during model binding in order to share logic
|
||||
/// </summary>
|
||||
/// <typeparam name="TPersisted"></typeparam>
|
||||
internal interface IContentSave<TPersisted> : IHaveUploadedFiles
|
||||
where TPersisted : IContentBase
|
||||
{
|
||||
/// <summary>
|
||||
/// The action to perform when saving this content item
|
||||
/// </summary>
|
||||
ContentSaveAction Action { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The real persisted content object - used during inbound model binding
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This is not used for outgoing model information.
|
||||
/// </remarks>
|
||||
TPersisted PersistedContent { get; set; }
|
||||
}
|
||||
}
|
||||
11
src/Umbraco.Web/Models/ContentEditing/ITabbedContent.cs
Normal file
11
src/Umbraco.Web/Models/ContentEditing/ITabbedContent.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
|
||||
public interface ITabbedContent<T>
|
||||
where T : ContentPropertyBasic
|
||||
{
|
||||
IEnumerable<Tab<T>> Tabs { get; }
|
||||
}
|
||||
}
|
||||
@@ -7,10 +7,8 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
/// An abstract model representing a content item that can be contained in a list view
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <typeparam name="TPersisted"></typeparam>
|
||||
public abstract class ListViewAwareContentItemDisplayBase<T, TPersisted> : ContentItemDisplayBase<T, TPersisted>
|
||||
public abstract class ListViewAwareContentItemDisplayBase<T> : ContentItemDisplayBase<T>
|
||||
where T : ContentPropertyBasic
|
||||
where TPersisted : IContentBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Property indicating if this item is part of a list view parent
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using Umbraco.Core.Models;
|
||||
|
||||
@@ -8,12 +9,20 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
/// A model representing a content item to be displayed in the back office
|
||||
/// </summary>
|
||||
[DataContract(Name = "content", Namespace = "")]
|
||||
public class MediaItemDisplay : ListViewAwareContentItemDisplayBase<ContentPropertyDisplay, IMedia>
|
||||
public class MediaItemDisplay : ListViewAwareContentItemDisplayBase<ContentPropertyDisplay>
|
||||
{
|
||||
public MediaItemDisplay()
|
||||
{
|
||||
ContentApps = new List<ContentApp>();
|
||||
}
|
||||
|
||||
[DataMember(Name = "contentType")]
|
||||
public ContentTypeBasic ContentType { get; set; }
|
||||
|
||||
[DataMember(Name = "mediaLink")]
|
||||
public string MediaLink { get; set; }
|
||||
|
||||
[DataMember(Name = "apps")]
|
||||
public IEnumerable<ContentApp> ContentApps { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Runtime.Serialization;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Web.WebApi.Filters;
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
@@ -7,8 +8,7 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
/// A model representing a media item to be saved
|
||||
/// </summary>
|
||||
[DataContract(Name = "content", Namespace = "")]
|
||||
public class MediaItemSave : ContentBaseItemSave<IMedia>
|
||||
public class MediaItemSave : ContentBaseSave<IMedia>
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
/// <summary>
|
||||
/// Used for basic member information
|
||||
/// </summary>
|
||||
public class MemberBasic : ContentItemBasic<ContentPropertyBasic, IMember>
|
||||
public class MemberBasic : ContentItemBasic<ContentPropertyBasic>
|
||||
{
|
||||
[DataMember(Name = "username")]
|
||||
public string Username { get; set; }
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
/// A model representing a member to be displayed in the back office
|
||||
/// </summary>
|
||||
[DataContract(Name = "content", Namespace = "")]
|
||||
public class MemberDisplay : ListViewAwareContentItemDisplayBase<ContentPropertyDisplay, IMember>
|
||||
public class MemberDisplay : ListViewAwareContentItemDisplayBase<ContentPropertyDisplay>
|
||||
{
|
||||
public MemberDisplay()
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Runtime.Serialization;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
using Umbraco.Core.Models;
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
@@ -7,7 +8,9 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
/// A model representing a member list to be displayed in the back office
|
||||
/// </summary>
|
||||
[DataContract(Name = "content", Namespace = "")]
|
||||
public class MemberListDisplay : ContentItemDisplayBase<ContentPropertyDisplay, IMember>
|
||||
public class MemberListDisplay : ContentItemDisplayBase<ContentPropertyDisplay>
|
||||
{
|
||||
[DataMember(Name = "apps")]
|
||||
public IEnumerable<ContentApp> ContentApps { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,14 +3,14 @@ using System.Collections.Generic;
|
||||
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;
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
/// <summary>
|
||||
/// A model representing a member to be saved
|
||||
/// </summary>
|
||||
public class MemberSave : ContentBaseItemSave<IMember>
|
||||
/// <inheritdoc />
|
||||
public class MemberSave : ContentBaseSave<IMember>
|
||||
{
|
||||
|
||||
[DataMember(Name = "username", IsRequired = true)]
|
||||
@@ -35,6 +35,7 @@ namespace Umbraco.Web.Models.ContentEditing
|
||||
|
||||
[DataMember(Name = "isApproved")]
|
||||
public bool IsApproved { get; set; }
|
||||
|
||||
|
||||
//TODO: Need to add question / answer support
|
||||
}
|
||||
|
||||
19
src/Umbraco.Web/Models/ContentEditing/NotifySetting.cs
Normal file
19
src/Umbraco.Web/Models/ContentEditing/NotifySetting.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System.Runtime.Serialization;
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
[DataContract(Name = "notifySetting", Namespace = "")]
|
||||
public class NotifySetting
|
||||
{
|
||||
[DataMember(Name = "name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[DataMember(Name = "checked")]
|
||||
public bool Checked { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The letter from the IAction
|
||||
/// </summary>
|
||||
[DataMember(Name = "notifyCode")]
|
||||
public string NotifyCode { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -7,9 +7,7 @@ using Umbraco.Core.Models;
|
||||
|
||||
namespace Umbraco.Web.Models.ContentEditing
|
||||
{
|
||||
public abstract class TabbedContentItem<T, TPersisted> : ContentItemBasic<T, TPersisted>
|
||||
where T : ContentPropertyBasic
|
||||
where TPersisted : IContentBase
|
||||
public abstract class TabbedContentItem<T> : ContentItemBasic<T>, ITabbedContent<T> where T : ContentPropertyBasic
|
||||
{
|
||||
protected TabbedContentItem()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user