Revert "Temp8 tinymce"

This commit is contained in:
Warren Buckley
2018-11-22 14:05:51 +00:00
committed by GitHub
parent 2a0748fc1e
commit 54a2aa00a7
6677 changed files with 646351 additions and 410535 deletions

View File

@@ -0,0 +1,61 @@
using System.Text.RegularExpressions;
namespace Umbraco.Web.Models
{
public class BackOfficeTourFilter
{
public Regex PluginName { get; private set; }
public Regex TourFileName { get; private set; }
public Regex TourAlias { get; private set; }
/// <summary>
/// Create a filter to filter out a whole plugin's tours
/// </summary>
/// <param name="pluginName"></param>
/// <returns></returns>
public static BackOfficeTourFilter FilterPlugin(Regex pluginName)
{
return new BackOfficeTourFilter(pluginName, null, null);
}
/// <summary>
/// Create a filter to filter out a whole tour file
/// </summary>
/// <param name="tourFileName"></param>
/// <returns></returns>
public static BackOfficeTourFilter FilterFile(Regex tourFileName)
{
return new BackOfficeTourFilter(null, tourFileName, null);
}
/// <summary>
/// Create a filter to filter out a tour alias, this will filter out the same alias found in all files
/// </summary>
/// <param name="tourAlias"></param>
/// <returns></returns>
public static BackOfficeTourFilter FilterAlias(Regex tourAlias)
{
return new BackOfficeTourFilter(null, null, tourAlias);
}
/// <summary>
/// Constructor to create a tour filter
/// </summary>
/// <param name="pluginName">Value to filter out tours by a plugin, can be null</param>
/// <param name="tourFileName">Value to filter out a tour file, can be null</param>
/// <param name="tourAlias">Value to filter out a tour alias, can be null</param>
/// <remarks>
/// Depending on what is null will depend on how the filter is applied.
/// If pluginName is not NULL and it's matched then we check if tourFileName is not NULL and it's matched then we check tour alias is not NULL and then match it,
/// if any steps is NULL then the filters upstream are applied.
/// Example, pluginName = "hello", tourFileName="stuff", tourAlias=NULL = we will filter out the tour file "stuff" from the plugin "hello" but not from other plugins if the same file name exists.
/// Example, tourAlias="test.*" = we will filter out all tour aliases that start with the word "test" regardless of the plugin or file name
/// </remarks>
public BackOfficeTourFilter(Regex pluginName, Regex tourFileName, Regex tourAlias)
{
PluginName = pluginName;
TourFileName = tourFileName;
TourAlias = tourAlias;
}
}
}

View File

@@ -1,53 +1,53 @@
using System.Runtime.Serialization;
namespace Umbraco.Web.Models
{
/// <summary>
/// A model representing the data required to set a member/user password depending on the provider installed.
/// </summary>
public class ChangingPasswordModel
{
/// <summary>
/// The password value
/// </summary>
[DataMember(Name = "newPassword")]
public string NewPassword { get; set; }
/// <summary>
/// The old password - used to change a password when: EnablePasswordRetrieval = false
/// </summary>
[DataMember(Name = "oldPassword")]
public string OldPassword { get; set; }
/// <summary>
/// Set to true if the password is to be reset
/// </summary>
/// <remarks>
/// <para>
/// This operator is different between using ASP.NET Identity APIs and Membership APIs.
/// </para>
/// <para>
/// When using Membership APIs, this is only valid when: EnablePasswordReset = true and it will reset the password to something auto generated.
/// </para>
/// <para>
/// When using ASP.NET Identity APIs this needs to be set if an administrator user that has access to the Users section is changing another users
/// password. This flag is required to indicate that the oldPassword value is not required and that we are in fact performing a password reset and
/// then a password change if the executing user has access to do so.
/// </para>
/// </remarks>
[DataMember(Name = "reset")]
public bool? Reset { get; set; }
/// <summary>
/// The password answer - required for reset when: RequiresQuestionAndAnswer = true
/// </summary>
[DataMember(Name = "answer")]
public string Answer { get; set; }
/// <summary>
/// This is filled in on the server side if the password has been reset/generated
/// </summary>
[DataMember(Name = "generatedPassword")]
public string GeneratedPassword { get; set; }
}
}
using System.Runtime.Serialization;
namespace Umbraco.Web.Models
{
/// <summary>
/// A model representing the data required to set a member/user password depending on the provider installed.
/// </summary>
public class ChangingPasswordModel
{
/// <summary>
/// The password value
/// </summary>
[DataMember(Name = "newPassword")]
public string NewPassword { get; set; }
/// <summary>
/// The old password - used to change a password when: EnablePasswordRetrieval = false
/// </summary>
[DataMember(Name = "oldPassword")]
public string OldPassword { get; set; }
/// <summary>
/// Set to true if the password is to be reset
/// </summary>
/// <remarks>
/// <para>
/// This operator is different between using ASP.NET Identity APIs and Membership APIs.
/// </para>
/// <para>
/// When using Membership APIs, this is only valid when: EnablePasswordReset = true and it will reset the password to something auto generated.
/// </para>
/// <para>
/// When using ASP.NET Identity APIs this needs to be set if an administrator user that has access to the Users section is changing another users
/// password. This flag is required to indicate that the oldPassword value is not required and that we are in fact performing a password reset and
/// then a password change if the executing user has access to do so.
/// </para>
/// </remarks>
[DataMember(Name = "reset")]
public bool? Reset { get; set; }
/// <summary>
/// The password answer - required for reset when: RequiresQuestionAndAnswer = true
/// </summary>
[DataMember(Name = "answer")]
public string Answer { get; set; }
/// <summary>
/// This is filled in on the server side if the password has been reset/generated
/// </summary>
[DataMember(Name = "generatedPassword")]
public string GeneratedPassword { get; set; }
}
}

View File

@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
@@ -18,4 +18,4 @@ namespace Umbraco.Web.Models.ContentEditing
[DataMember(Name = "permissions")]
public IDictionary<string, IEnumerable<Permission>> AssignedPermissions { get; set; }
}
}
}

View File

@@ -35,4 +35,4 @@ namespace Umbraco.Web.Models.ContentEditing
return result;
}
}
}
}

View File

@@ -1,36 +1,35 @@
using System;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "auditLog", Namespace = "")]
public class AuditLog
{
[DataMember(Name = "userId")]
public int UserId { get; set; }
[DataMember(Name = "userName")]
public string UserName { get; set; }
[DataMember(Name = "userAvatars")]
using System;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Umbraco.Core.Models;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "auditLog", Namespace = "")]
public class AuditLog
{
[DataMember(Name = "userId")]
public int UserId { get; set; }
[DataMember(Name = "userName")]
public string UserName { get; set; }
[DataMember(Name = "userAvatars")]
public string[] UserAvatars { get; set; }
[DataMember(Name = "nodeId")]
public int NodeId { get; set; }
[DataMember(Name = "timestamp")]
public DateTime Timestamp { get; set; }
[DataMember(Name = "nodeId")]
public int NodeId { get; set; }
[DataMember(Name = "timestamp")]
public DateTime Timestamp { get; set; }
[DataMember(Name = "logType")]
public string LogType { get; set; }
[DataMember(Name = "entityType")]
public string EntityType { get; set; }
[DataMember(Name = "comment")]
public string Comment { get; set; }
[DataMember(Name = "parameters")]
public string Parameters { get; set; }
}
}
[JsonConverter(typeof(StringEnumConverter))]
[DataMember(Name = "logType")]
public AuditType LogType { get; set; }
[DataMember(Name = "comment")]
public string Comment { get; set; }
}
}

View File

@@ -0,0 +1,85 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Umbraco.Web.Models.ContentEditing
{
[Obsolete("Use Umbraco.Core.Models.AuditType instead")]
[EditorBrowsable(EditorBrowsableState.Never)]
public enum AuditLogType
{
/// <summary>
/// Used when new nodes are added
/// </summary>
New,
/// <summary>
/// Used when nodes are saved
/// </summary>
Save,
/// <summary>
/// Used when nodes are opened
/// </summary>
Open,
/// <summary>
/// Used when nodes are deleted
/// </summary>
Delete,
/// <summary>
/// Used when nodes are published
/// </summary>
Publish,
/// <summary>
/// Used when nodes are send to publishing
/// </summary>
SendToPublish,
/// <summary>
/// Used when nodes are unpublished
/// </summary>
UnPublish,
/// <summary>
/// Used when nodes are moved
/// </summary>
Move,
/// <summary>
/// Used when nodes are copied
/// </summary>
Copy,
/// <summary>
/// Used when nodes are assígned a domain
/// </summary>
AssignDomain,
/// <summary>
/// Used when public access are changed for a node
/// </summary>
PublicAccess,
/// <summary>
/// Used when nodes are sorted
/// </summary>
Sort,
/// <summary>
/// Used when a notification are send to a user
/// </summary>
Notify,
/// <summary>
/// Used when a node's content is rolled back to a previous version
/// </summary>
RollBack,
/// <summary>
/// Used when a package is installed
/// </summary>
PackagerInstall,
/// <summary>
/// Used when a package is uninstalled
/// </summary>
PackagerUninstall,
/// <summary>
/// Used when a node is send to translation
/// </summary>
SendToTranslate
}
}

View File

@@ -0,0 +1,12 @@
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// The model representing Previewing of a content item from the back office
/// </summary>
public class BackOfficePreview
{
public string PreviewExtendedHeaderView { get; set; }
//TODO: We could potentially have a 'footer' view
public bool DisableDevicePreview { get; set; }
}
}

View File

@@ -29,8 +29,8 @@ namespace Umbraco.Web.Models.ContentEditing
/// Path represents the path used by the backoffice tree
/// For files stored on disk, this is a urlencoded, comma seperated
/// path to the file, always starting with -1.
///
/// -1,Partials,Parials%2FFolder,Partials%2FFolder%2FFile.cshtml
///
/// -1,Partials,Parials%2FFolder,Partials%2FFolder%2FFile.cshtml
/// </summary>
[DataMember(Name = "path")]
[ReadOnly(true)]
@@ -66,7 +66,7 @@ namespace Umbraco.Web.Models.ContentEditing
if (Name.ContainsAny(illegalChars))
{
yield return new ValidationResult(
"The file name cannot contain illegal characters",
"The file name cannot contain illegal characters",
new[] { "Name" });
}
else if (System.IO.Path.GetFileNameWithoutExtension(Name).IsNullOrWhiteSpace())

View File

@@ -0,0 +1,30 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using Umbraco.Core.Models;
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<ContentItemFile>();
}
/// <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<ContentItemFile> UploadedFiles { get; private set; }
}
}

View File

@@ -1,57 +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 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
}
}

View File

@@ -1,15 +0,0 @@
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "ContentDomainsAndCulture")]
public class ContentDomainsAndCulture
{
[DataMember(Name = "domains")]
public IEnumerable<DomainDisplay> Domains { get; set; }
[DataMember(Name = "language")]
public string Language { get; internal set; }
}
}

View File

@@ -1,103 +1,108 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// A model representing a basic content item
/// </summary>
[DataContract(Name = "content", Namespace = "")]
public class ContentItemBasic : EntityBasic
{
[DataMember(Name = "updateDate")]
public DateTime UpdateDate { get; set; }
[DataMember(Name = "createDate")]
public DateTime CreateDate { get; set; }
/// <summary>
/// Boolean indicating if this item is published or not based on it's <see cref="State"/>
/// </summary>
[DataMember(Name = "published")]
public bool Published => State == ContentSavedState.Published || State == ContentSavedState.PublishedPendingChanges;
/// <summary>
/// Determines if the content item is a draft
/// </summary>
[DataMember(Name = "edited")]
public bool Edited { get; set; }
[DataMember(Name = "owner")]
public UserProfile Owner { get; set; }
[DataMember(Name = "updater")]
public UserProfile Updater { get; set; }
[DataMember(Name = "contentTypeAlias", IsRequired = true)]
[Required(AllowEmptyStrings = false)]
public string ContentTypeAlias { get; set; }
[DataMember(Name = "sortOrder")]
public int SortOrder { get; set; }
/// <summary>
/// The saved/published state of an item
/// </summary>
/// <remarks>
/// This is nullable since it's only relevant for content (non-content like media + members will be null)
/// </remarks>
[DataMember(Name = "state")]
[JsonConverter(typeof(StringEnumConverter))]
public ContentSavedState? State { get; set; }
[DataMember(Name = "variesByCulture")]
public bool VariesByCulture { get; set; }
protected bool Equals(ContentItemBasic other)
{
return Id == other.Id;
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
var other = obj as ContentItemBasic;
return other != null && Equals(other);
}
public override int GetHashCode()
{
return Id.GetHashCode();
}
}
/// <summary>
/// A model representing a basic content item with properties
/// </summary>
[DataContract(Name = "content", Namespace = "")]
public class ContentItemBasic<T> : ContentItemBasic, IContentProperties<T>
where T : ContentPropertyBasic
{
public ContentItemBasic()
{
//ensure its not null
_properties = Enumerable.Empty<T>();
}
private IEnumerable<T> _properties;
[DataMember(Name = "properties")]
public virtual IEnumerable<T> Properties
{
get => _properties;
set => _properties = value;
}
}
}
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.Validation;
using Umbraco.Web.WebApi;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// A model representing a basic content item
/// </summary>
[DataContract(Name = "content", Namespace = "")]
public class ContentItemBasic : EntityBasic
{
[DataMember(Name = "updateDate")]
public DateTime UpdateDate { get; set; }
[DataMember(Name = "createDate")]
public DateTime CreateDate { get; set; }
[DataMember(Name = "published")]
public bool Published { get; set; }
[DataMember(Name = "hasPublishedVersion")]
public bool HasPublishedVersion { get; set; }
[DataMember(Name = "owner")]
public UserProfile Owner { get; set; }
[DataMember(Name = "updater")]
public UserProfile Updater { get; set; }
[DataMember(Name = "contentTypeAlias", IsRequired = true)]
[Required(AllowEmptyStrings = false)]
public string ContentTypeAlias { get; set; }
[DataMember(Name = "sortOrder")]
public int SortOrder { get; set; }
protected bool Equals(ContentItemBasic other)
{
return Id == other.Id;
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
var other = obj as ContentItemBasic;
return other != null && Equals(other);
}
public override int GetHashCode()
{
return Id.GetHashCode();
}
}
/// <summary>
/// A model representing a basic content item with properties
/// </summary>
[DataContract(Name = "content", Namespace = "")]
public class ContentItemBasic<T, TPersisted> : ContentItemBasic
where T : ContentPropertyBasic
where TPersisted : IContentBase
{
public ContentItemBasic()
{
//ensure its not null
_properties = new List<T>();
}
private IEnumerable<T> _properties;
[DataMember(Name = "properties")]
public virtual IEnumerable<T> Properties
{
get { return _properties; }
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; }
}
}

View File

@@ -1,208 +1,70 @@
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.Models.ContentEditing;
using Umbraco.Core.Serialization;
using Umbraco.Web.Routing;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// A model representing a content item to be displayed in the back office
/// </summary>
[DataContract(Name = "content", Namespace = "")]
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 = "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; }
[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; }
[DataMember(Name = "documentType")]
public ContentTypeBasic DocumentType { get; set; }
[DataMember(Name = "urls")]
public UrlInfo[] Urls { get; set; }
/// <summary>
/// Determines whether previewing is allowed for this node
/// </summary>
/// <remarks>
/// By default this is true but by using events developers can toggle this off for certain documents if there is nothing to preview
/// </remarks>
[DataMember( Name = "allowPreview" )]
public bool AllowPreview { get; set; }
/// <summary>
/// The allowed 'actions' based on the user's permissions - Create, Update, Publish, Send to publish
/// </summary>
/// <remarks>
/// Each char represents a button which we can then map on the front-end to the correct actions
/// </remarks>
[DataMember(Name = "allowedActions")]
public IEnumerable<string> AllowedActions { get; set; }
[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; }
}
}
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Umbraco.Core.Models;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// 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 ContentItemDisplay()
{
AllowPreview = true;
}
[DataMember(Name = "publishDate")]
public DateTime? PublishDate { get; set; }
[DataMember(Name = "releaseDate")]
public DateTime? ReleaseDate { get; set; }
[DataMember(Name = "removeDate")]
public DateTime? ExpireDate { 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; }
[DataMember(Name = "documentType")]
public ContentTypeBasic DocumentType { get; set; }
[DataMember(Name = "urls")]
public string[] Urls { get; set; }
/// <summary>
/// Determines whether previewing is allowed for this node
/// </summary>
/// <remarks>
/// By default this is true but by using events developers can toggle this off for certain documents if there is nothing to preview
/// </remarks>
[DataMember( Name = "allowPreview" )]
public bool AllowPreview { get; set; }
/// <summary>
/// The allowed 'actions' based on the user's permissions - Create, Update, Publish, Send to publish
/// </summary>
/// <remarks>
/// Each char represents a button which we can then map on the front-end to the correct actions
/// </remarks>
[DataMember(Name = "allowedActions")]
public IEnumerable<string> AllowedActions { get; set; }
[DataMember(Name = "isBlueprint")]
public bool IsBlueprint { get; set; }
}
}

View File

@@ -1,50 +1,51 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.Serialization;
using Umbraco.Core.Models;
namespace Umbraco.Web.Models.ContentEditing
{
public abstract class ContentItemDisplayBase<T> : TabbedContentItem<T>, INotificationModel, IErrorModel
where T : ContentPropertyBasic
{
protected ContentItemDisplayBase()
{
Notifications = new List<Notification>();
Errors = new Dictionary<string, object>();
}
/// <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>
/// 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; }
}
}
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.Serialization;
using Umbraco.Core.Models;
namespace Umbraco.Web.Models.ContentEditing
{
public abstract class ContentItemDisplayBase<T, TPersisted> : TabbedContentItem<T, TPersisted>, INotificationModel, IErrorModel
where T : ContentPropertyBasic
where TPersisted : IContentBase
{
protected ContentItemDisplayBase()
{
Notifications = new List<Notification>();
Errors = new Dictionary<string, object>();
}
/// <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>
/// 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; }
}
}

View File

@@ -0,0 +1,14 @@
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
{
}
}

View File

@@ -0,0 +1,23 @@
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// Represents an uploaded file for a particular property
/// </summary>
public class ContentItemFile
{
/// <summary>
/// The property alias associated with the file
/// </summary>
public string PropertyAlias { get; set; }
/// <summary>
/// The original file name
/// </summary>
public string FileName { get; set; }
/// <summary>
/// The file path for the uploaded file for where the MultipartFormDataStreamProvider has saved the temp file
/// </summary>
public string TempFilePath { get; set; }
}
}

View File

@@ -1,69 +1,27 @@
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
{
/// <summary>
/// A model representing a content item to be saved
/// </summary>
[DataContract(Name = "content", Namespace = "")]
public class ContentItemSave : IContentSave<IContent>
{
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
/// </summary>
[DataMember(Name = "templateAlias")]
public string TemplateAlias { 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
}
}
using System;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Umbraco.Core.Models;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// A model representing a content item to be saved
/// </summary>
[DataContract(Name = "content", Namespace = "")]
public class ContentItemSave : ContentBaseItemSave<IContent>
{
/// <summary>
/// The template alias to save
/// </summary>
[DataMember(Name = "templateAlias")]
public string TemplateAlias { get; set; }
[DataMember(Name = "releaseDate")]
public DateTime? ReleaseDate { get; set; }
[DataMember(Name = "expireDate")]
public DateTime? ExpireDate { get; set; }
}
}

View File

@@ -1,58 +1,46 @@
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using Umbraco.Core.PropertyEditors;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// Represents a content property to be saved
/// </summary>
[DataContract(Name = "property", Namespace = "")]
public class ContentPropertyBasic
{
/// <summary>
/// This is the PropertyData ID
/// </summary>
/// <remarks>
/// This is not really used for anything
/// </remarks>
[DataMember(Name = "id", IsRequired = true)]
[Required]
public int Id { get; set; }
[DataMember(Name = "value")]
public object Value { get; set; }
[DataMember(Name = "alias", IsRequired = true)]
[Required(AllowEmptyStrings = false)]
public string Alias { get; set; }
[DataMember(Name = "editor", IsRequired = false)]
public string Editor { get; set; }
/// <summary>
/// Flags the property to denote that it can contain sensitive data
/// </summary>
[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>
[IgnoreDataMember]
internal IDataEditor PropertyEditor { get; set; }
}
}
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using Umbraco.Core.PropertyEditors;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// Represents a content property to be saved
/// </summary>
[DataContract(Name = "property", Namespace = "")]
public class ContentPropertyBasic
{
/// <summary>
/// This is the cmsPropertyData ID
/// </summary>
/// <remarks>
/// This is not really used for anything
/// </remarks>
[DataMember(Name = "id", IsRequired = true)]
[Required]
public int Id { get; set; }
[DataMember(Name = "value")]
public object Value { get; set; }
[DataMember(Name = "alias", IsRequired = true)]
[Required(AllowEmptyStrings = false)]
public string Alias { get; set; }
[DataMember(Name = "editor", IsRequired = false)]
public string Editor { get; set; }
/// <summary>
/// Flags the property to denote that it can contain sensitive data
/// </summary>
[DataMember(Name = "isSensitive", IsRequired = false)]
public bool IsSensitive { get; set; }
/// <summary>
/// Used internally during model mapping
/// </summary>
[IgnoreDataMember]
internal PropertyEditor PropertyEditor { get; set; }
}
}

View File

@@ -1,23 +0,0 @@
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; }
}
}

View File

@@ -1,42 +1,42 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// Represents a content property that is displayed in the UI
/// </summary>
[DataContract(Name = "property", Namespace = "")]
public class ContentPropertyDisplay : ContentPropertyBasic
{
public ContentPropertyDisplay()
{
Config = new Dictionary<string, object>();
Validation = new PropertyTypeValidation();
}
[DataMember(Name = "label", IsRequired = true)]
[Required]
public string Label { get; set; }
[DataMember(Name = "description")]
public string Description { get; set; }
[DataMember(Name = "view", IsRequired = true)]
[Required(AllowEmptyStrings = false)]
public string View { get; set; }
[DataMember(Name = "config")]
public IDictionary<string, object> Config { get; set; }
[DataMember(Name = "hideLabel")]
public bool HideLabel { get; set; }
[DataMember(Name = "validation")]
public PropertyTypeValidation Validation { get; set; }
[DataMember(Name = "readonly")]
public bool Readonly { get; set; }
}
}
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// Represents a content property that is displayed in the UI
/// </summary>
[DataContract(Name = "property", Namespace = "")]
public class ContentPropertyDisplay : ContentPropertyBasic
{
public ContentPropertyDisplay()
{
Config = new Dictionary<string, object>();
Validation = new PropertyTypeValidation();
}
[DataMember(Name = "label", IsRequired = true)]
[Required]
public string Label { get; set; }
[DataMember(Name = "description")]
public string Description { get; set; }
[DataMember(Name = "view", IsRequired = true)]
[Required(AllowEmptyStrings = false)]
public string View { get; set; }
[DataMember(Name = "config")]
public IDictionary<string, object> Config { get; set; }
[DataMember(Name = "hideLabel")]
public bool HideLabel { get; set; }
[DataMember(Name = "validation")]
public PropertyTypeValidation Validation { get; set; }
[DataMember(Name = "readonly")]
public bool Readonly { get; set; }
}
}

View File

@@ -1,20 +1,25 @@
using System.Collections.Generic;
using Newtonsoft.Json;
using Umbraco.Core.Models;
using Umbraco.Core.PropertyEditors;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// Represents a content property from the database
/// </summary>
internal class ContentPropertyDto : ContentPropertyBasic
{
public IDataType DataType { get; set; }
public string Label { get; set; }
public string Description { get; set; }
public bool IsRequired { get; set; }
public string ValidationRegExp { get; set; }
}
}
using System.Collections.Generic;
using Newtonsoft.Json;
using Umbraco.Core.Models;
using Umbraco.Core.PropertyEditors;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// Represents a content property from the database
/// </summary>
internal class ContentPropertyDto : ContentPropertyBasic
{
public IDataTypeDefinition DataType { get; set; }
public string Label { get; set; }
public string Description { get; set; }
public bool IsRequired { get; set; }
public string ValidationRegExp { get; set; }
/// <summary>
/// The current pre-values for this property
/// </summary>
[JsonIgnore]
internal PreValueCollection PreValues { get; set; }
}
}

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
@@ -21,4 +21,4 @@ namespace Umbraco.Web.Models.ContentEditing
[DataMember(Name = "contentId")]
public int ContentId { get; set; }
}
}
}

View File

@@ -1,68 +1,38 @@
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// The action associated with saving a content item
/// </summary>
public enum ContentSaveAction
{
/// <summary>
/// Saves the content item, no publish
/// </summary>
Save = 0,
/// <summary>
/// Creates a new content item
/// </summary>
SaveNew = 1,
/// <summary>
/// Saves and publishes the content item
/// </summary>
Publish = 2,
/// <summary>
/// Creates and publishes a new content item
/// </summary>
PublishNew = 3,
/// <summary>
/// Saves and sends publish notification
/// </summary>
SendPublish = 4,
/// <summary>
/// Creates and sends publish notification
/// </summary>
SendPublishNew = 5,
/// <summary>
/// Saves and schedules publishing
/// </summary>
Schedule = 6,
/// <summary>
/// Creates and schedules publishing
/// </summary>
ScheduleNew = 7,
/// <summary>
/// Saves and publishes the content item including all descendants that have a published version
/// </summary>
PublishWithDescendants = 8,
/// <summary>
/// Creates and publishes the content item including all descendants that have a published version
/// </summary>
PublishWithDescendantsNew = 9,
/// <summary>
/// Saves and publishes the content item including all descendants regardless of whether they have a published version or not
/// </summary>
PublishWithDescendantsForce = 10,
/// <summary>
/// Creates and publishes the content item including all descendants regardless of whether they have a published version or not
/// </summary>
PublishWithDescendantsForceNew = 11
}
}
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// The action associated with saving a content item
/// </summary>
public enum ContentSaveAction
{
/// <summary>
/// Saves the content item, no publish
/// </summary>
Save = 0,
/// <summary>
/// Creates a new content item
/// </summary>
SaveNew = 1,
/// <summary>
/// Saves and publishes the content item
/// </summary>
Publish = 2,
/// <summary>
/// Creates and publishes a new content item
/// </summary>
PublishNew = 3,
/// <summary>
/// Saves and sends publish notification
/// </summary>
SendPublish = 4,
/// <summary>
/// Creates and sends publish notification
/// </summary>
SendPublishNew = 5
}
}

View File

@@ -1,28 +0,0 @@
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 = 1,
/// <summary>
/// The item is saved but isn't published
/// </summary>
Draft = 2,
/// <summary>
/// The item is published and there are no pending changes
/// </summary>
Published = 3,
/// <summary>
/// The item is published and there are pending changes
/// </summary>
PublishedPendingChanges = 4
}
}

View File

@@ -1,35 +1,35 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// A model representing a new sort order for a content/media item
/// </summary>
[DataContract(Name = "content", Namespace = "")]
public class ContentSortOrder
{
/// <summary>
/// The parent Id of the nodes being sorted
/// </summary>
[DataMember(Name = "parentId", IsRequired = true)]
[Required]
public int ParentId { get; set; }
/// <summary>
/// An array of integer Ids representing the sort order
/// </summary>
/// <remarks>
/// Of course all of these Ids should be at the same level in the heirarchy!!
/// </remarks>
[DataMember(Name = "idSortOrder", IsRequired = true)]
[Required]
public int[] IdSortOrder { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// A model representing a new sort order for a content/media item
/// </summary>
[DataContract(Name = "content", Namespace = "")]
public class ContentSortOrder
{
/// <summary>
/// The parent Id of the nodes being sorted
/// </summary>
[DataMember(Name = "parentId", IsRequired = true)]
[Required]
public int ParentId { get; set; }
/// <summary>
/// An array of integer Ids representing the sort order
/// </summary>
/// <remarks>
/// Of course all of these Ids should be at the same level in the heirarchy!!
/// </remarks>
[DataMember(Name = "idSortOrder", IsRequired = true)]
[Required]
public int[] IdSortOrder { get; set; }
}
}

View File

@@ -1,119 +1,119 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using Umbraco.Core;
using Umbraco.Core.Configuration;
using Umbraco.Core.IO;
using Umbraco.Core.Models.Validation;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// A basic version of a content type
/// </summary>
/// <remarks>
/// Generally used to return the minimal amount of data about a content type
/// </remarks>
[DataContract(Name = "contentType", Namespace = "")]
public class ContentTypeBasic : EntityBasic
{
public ContentTypeBasic()
{
Blueprints = new Dictionary<int, string>();
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using Umbraco.Core;
using Umbraco.Core.Configuration;
using Umbraco.Core.IO;
using Umbraco.Core.Models.Validation;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// A basic version of a content type
/// </summary>
/// <remarks>
/// Generally used to return the minimal amount of data about a content type
/// </remarks>
[DataContract(Name = "contentType", Namespace = "")]
public class ContentTypeBasic : EntityBasic
{
public ContentTypeBasic()
{
Blueprints = new Dictionary<int, string>();
}
/// <summary>
/// Overridden to apply our own validation attributes since this is not always required for other classes
/// </summary>
/// <summary>
/// Overridden to apply our own validation attributes since this is not always required for other classes
/// </summary>
[Required]
[RegularExpression(@"^([a-zA-Z]\w.*)$", ErrorMessage = "Invalid alias")]
[DataMember(Name = "alias")]
public override string Alias { get; set; }
[DataMember(Name = "updateDate")]
[ReadOnly(true)]
public DateTime UpdateDate { get; set; }
[DataMember(Name = "createDate")]
[ReadOnly(true)]
public DateTime CreateDate { get; set; }
[DataMember(Name = "description")]
public string Description { get; set; }
[DataMember(Name = "thumbnail")]
public string Thumbnail { get; set; }
/// <summary>
/// Returns true if the icon represents a CSS class instead of a file path
/// </summary>
[DataMember(Name = "iconIsClass")]
[ReadOnly(true)]
public bool IconIsClass
{
get
{
if (Icon.IsNullOrWhiteSpace())
{
return true;
}
//if it starts with a '.' or doesn't contain a '.' at all then it is a class
return Icon.StartsWith(".") || Icon.Contains(".") == false;
}
}
/// <summary>
/// Returns the icon file path if the icon is not a class, otherwise returns an empty string
/// </summary>
[DataMember(Name = "iconFilePath")]
[ReadOnly(true)]
public string IconFilePath
{
get
{
return IconIsClass
? string.Empty
: string.Format("{0}images/umbraco/{1}", UmbracoConfig.For.GlobalSettings().Path.EnsureEndsWith("/"), Icon);
}
}
/// <summary>
/// Returns true if the icon represents a CSS class instead of a file path
/// </summary>
[DataMember(Name = "thumbnailIsClass")]
[ReadOnly(true)]
public bool ThumbnailIsClass
{
get
{
if (Thumbnail.IsNullOrWhiteSpace())
{
return true;
}
//if it starts with a '.' or doesn't contain a '.' at all then it is a class
return Thumbnail.StartsWith(".") || Thumbnail.Contains(".") == false;
}
}
/// <summary>
/// Returns the icon file path if the icon is not a class, otherwise returns an empty string
/// </summary>
[DataMember(Name = "thumbnailFilePath")]
[ReadOnly(true)]
public string ThumbnailFilePath
{
get
{
return ThumbnailIsClass
? string.Empty
: IOHelper.ResolveUrl("~/umbraco/images/thumbnails/" + Thumbnail);
}
}
[DataMember(Name = "blueprints")]
[ReadOnly(true)]
public IDictionary<int, string> Blueprints { get; set; }
}
}
public override string Alias { get; set; }
[DataMember(Name = "updateDate")]
[ReadOnly(true)]
public DateTime UpdateDate { get; set; }
[DataMember(Name = "createDate")]
[ReadOnly(true)]
public DateTime CreateDate { get; set; }
[DataMember(Name = "description")]
public string Description { get; set; }
[DataMember(Name = "thumbnail")]
public string Thumbnail { get; set; }
/// <summary>
/// Returns true if the icon represents a CSS class instead of a file path
/// </summary>
[DataMember(Name = "iconIsClass")]
[ReadOnly(true)]
public bool IconIsClass
{
get
{
if (Icon.IsNullOrWhiteSpace())
{
return true;
}
//if it starts with a '.' or doesn't contain a '.' at all then it is a class
return Icon.StartsWith(".") || Icon.Contains(".") == false;
}
}
/// <summary>
/// Returns the icon file path if the icon is not a class, otherwise returns an empty string
/// </summary>
[DataMember(Name = "iconFilePath")]
[ReadOnly(true)]
public string IconFilePath
{
get
{
return IconIsClass
? string.Empty
: string.Format("{0}images/umbraco/{1}", GlobalSettings.Path.EnsureEndsWith("/"), Icon);
}
}
/// <summary>
/// Returns true if the icon represents a CSS class instead of a file path
/// </summary>
[DataMember(Name = "thumbnailIsClass")]
[ReadOnly(true)]
public bool ThumbnailIsClass
{
get
{
if (Thumbnail.IsNullOrWhiteSpace())
{
return true;
}
//if it starts with a '.' or doesn't contain a '.' at all then it is a class
return Thumbnail.StartsWith(".") || Thumbnail.Contains(".") == false;
}
}
/// <summary>
/// Returns the icon file path if the icon is not a class, otherwise returns an empty string
/// </summary>
[DataMember(Name = "thumbnailFilePath")]
[ReadOnly(true)]
public string ThumbnailFilePath
{
get
{
return ThumbnailIsClass
? string.Empty
: IOHelper.ResolveUrl("~/umbraco/images/thumbnails/" + Thumbnail);
}
}
[DataMember(Name = "blueprints")]
[ReadOnly(true)]
public IDictionary<int, string> Blueprints { get; set; }
}
}

View File

@@ -15,55 +15,55 @@ namespace Umbraco.Web.Models.ContentEditing
protected ContentTypeCompositionDisplay()
{
//initialize collections so at least their never null
AllowedContentTypes = new List<int>();
AllowedContentTypes = new List<int>();
CompositeContentTypes = new List<string>();
Notifications = new List<Notification>();
}
//name, alias, icon, thumb, desc, inherited from basic
//List view
[DataMember(Name = "isContainer")]
public bool IsContainer { get; set; }
[DataMember(Name = "listViewEditorName")]
[ReadOnly(true)]
}
//name, alias, icon, thumb, desc, inherited from basic
//List view
[DataMember(Name = "isContainer")]
public bool IsContainer { get; set; }
[DataMember(Name = "listViewEditorName")]
[ReadOnly(true)]
public string ListViewEditorName { get; set; }
//Allowed child types
[DataMember(Name = "allowedContentTypes")]
public IEnumerable<int> AllowedContentTypes { get; set; }
//Compositions
[DataMember(Name = "compositeContentTypes")]
public IEnumerable<string> CompositeContentTypes { get; set; }
//Locked compositions
[DataMember(Name = "lockedCompositeContentTypes")]
public IEnumerable<string> LockedCompositeContentTypes { get; set; }
[DataMember(Name = "allowAsRoot")]
//Allowed child types
[DataMember(Name = "allowedContentTypes")]
public IEnumerable<int> AllowedContentTypes { get; set; }
//Compositions
[DataMember(Name = "compositeContentTypes")]
public IEnumerable<string> CompositeContentTypes { get; set; }
//Locked compositions
[DataMember(Name = "lockedCompositeContentTypes")]
public IEnumerable<string> LockedCompositeContentTypes { get; set; }
[DataMember(Name = "allowAsRoot")]
public bool AllowAsRoot { 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)]
/// <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)]
/// <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; }
}
@@ -75,11 +75,11 @@ namespace Umbraco.Web.Models.ContentEditing
{
//initialize collections so at least their never null
Groups = new List<PropertyGroupDisplay<TPropertyTypeDisplay>>();
}
}
//Tabs
[DataMember(Name = "groups")]
public IEnumerable<PropertyGroupDisplay<TPropertyTypeDisplay>> Groups { get; set; }
public IEnumerable<PropertyGroupDisplay<TPropertyTypeDisplay>> Groups { get; set; }
}
}

View File

@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.Serialization;
@@ -56,16 +56,7 @@ namespace Umbraco.Web.Models.ContentEditing
{
Groups = new List<PropertyGroupBasic<TPropertyType>>();
}
/// <summary>
/// A rule for defining how a content type can be varied
/// </summary>
/// <remarks>
/// This is only supported on document types right now but in the future it could be media types too
/// </remarks>
[DataMember(Name = "allowCultureVariant")]
public bool AllowCultureVariant { get; set; }
//Tabs
[DataMember(Name = "groups")]
public IEnumerable<PropertyGroupBasic<TPropertyType>> Groups { get; set; }
@@ -98,7 +89,7 @@ namespace Umbraco.Web.Models.ContentEditing
{
//we need to return the field name with an index so it's wired up correctly
var lastProperty = duplicateProperties.Last().Last();
var propertyGroup = Groups.Single(x => x.Properties.Contains(lastProperty));
var propertyGroup = Groups.Single(x => x.Properties.Contains(lastProperty));
yield return new ValidationResult("Duplicate property aliases not allowed: " + lastProperty.Alias, new[]
{
@@ -108,4 +99,4 @@ namespace Umbraco.Web.Models.ContentEditing
}
}
}
}

View File

@@ -1,66 +0,0 @@
using System;
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; }
[DataMember(Name = "expireDate")]
public DateTime? ExpireDate { get; set; }
[DataMember(Name = "releaseDate")]
public DateTime? ReleaseDate { 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; }
}
}

View File

@@ -1,82 +0,0 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
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>, INotificationModel
{
public ContentVariantDisplay()
{
Tabs = new List<Tab<ContentPropertyDisplay>>();
Notifications = new List<Notification>();
}
[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; }
[DataMember(Name = "releaseDate")]
public DateTime? ReleaseDate { get; set; }
[DataMember(Name = "expireDate")]
public DateTime? ExpireDate { 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>
/// <remarks>
/// The notifications assigned to a variant are currently only used to show custom messagse in the save/publish dialogs.
/// </remarks>
[DataMember(Name = "notifications")]
[ReadOnly(true)]
public List<Notification> Notifications { get; private set; }
}
}

View File

@@ -1,22 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// The result of creating a content type collection in the UI
/// </summary>
[DataContract(Name = "contentTypeCollection", Namespace = "")]
public class CreatedContentTypeCollectionResult
{
[DataMember(Name = "collectionId")]
public int CollectionId { get; set; }
[DataMember(Name = "containerId")]
public int ContainerId { get; set; }
}
}

View File

@@ -1,28 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "control", Namespace = "")]
public class DashboardControl
{
[DataMember(Name = "showOnce")]
public bool ShowOnce { get; set; }
[DataMember(Name = "addPanel")]
public bool AddPanel { get; set; }
[DataMember(Name = "serverSide")]
public bool ServerSide { get; set; }
[DataMember(Name = "path")]
public string Path { get; set; }
[DataMember(Name = "caption")]
public string Caption { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "control", Namespace = "")]
public class DashboardControl
{
[DataMember(Name = "showOnce")]
public bool ShowOnce { get; set; }
[DataMember(Name = "addPanel")]
public bool AddPanel { get; set; }
[DataMember(Name = "serverSide")]
public bool ServerSide { get; set; }
[DataMember(Name = "path")]
public string Path { get; set; }
[DataMember(Name = "caption")]
public string Caption { get; set; }
}
}

View File

@@ -18,10 +18,10 @@ namespace Umbraco.Web.Models.ContentEditing
[DataMember(Name = "group")]
[ReadOnly(true)]
public string Group { get; set; }
[DataMember(Name = "hasPrevalues")]
[ReadOnly(true)]
public string Group { get; set; }
[DataMember(Name = "hasPrevalues")]
[ReadOnly(true)]
public bool HasPrevalues { get; set; }
}
}
}

View File

@@ -1,39 +1,39 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// Represents a data type that is being edited
/// </summary>
[DataContract(Name = "dataType", Namespace = "")]
public class DataTypeDisplay : DataTypeBasic, INotificationModel
{
public DataTypeDisplay()
{
Notifications = new List<Notification>();
}
/// <summary>
/// The alias of the property editor
/// </summary>
[DataMember(Name = "selectedEditor", IsRequired = true)]
[Required]
public string SelectedEditor { get; set; }
[DataMember(Name = "availableEditors")]
public IEnumerable<PropertyEditorBasic> AvailableEditors { get; set; }
[DataMember(Name = "preValues")]
public IEnumerable<DataTypeConfigurationFieldDisplay> PreValues { 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")]
public List<Notification> Notifications { get; private set; }
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// Represents a data type that is being edited
/// </summary>
[DataContract(Name = "dataType", Namespace = "")]
public class DataTypeDisplay : DataTypeBasic, INotificationModel
{
public DataTypeDisplay()
{
Notifications = new List<Notification>();
}
/// <summary>
/// The alias of the property editor
/// </summary>
[DataMember(Name = "selectedEditor", IsRequired = true)]
[Required]
public string SelectedEditor { get; set; }
[DataMember(Name = "availableEditors")]
public IEnumerable<PropertyEditorBasic> AvailableEditors { get; set; }
[DataMember(Name = "preValues")]
public IEnumerable<PreValueFieldDisplay> PreValues { 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")]
public List<Notification> Notifications { get; private set; }
}
}

View File

@@ -1,51 +1,44 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using Umbraco.Core.Models;
using Umbraco.Core.PropertyEditors;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// Represents a datatype model for editing.
/// </summary>
[DataContract(Name = "dataType", Namespace = "")]
public class DataTypeSave : EntityBasic
{
/// <summary>
/// Gets or sets the action to perform.
/// </summary>
/// <remarks>
/// Some values (publish) are illegal here.
/// </remarks>
[DataMember(Name = "action", IsRequired = true)]
[Required]
public ContentSaveAction Action { get; set; }
/// <summary>
/// Gets or sets the datatype editor.
/// </summary>
[DataMember(Name = "selectedEditor", IsRequired = true)]
[Required]
public string EditorAlias { get; set; }
/// <summary>
/// Gets or sets the datatype configuration fields.
/// </summary>
[DataMember(Name = "preValues")]
public IEnumerable<DataTypeConfigurationFieldSave> ConfigurationFields { get; set; }
/// <summary>
/// Gets or sets the persisted data type.
/// </summary>
[IgnoreDataMember]
internal IDataType PersistedDataType { get; set; }
/// <summary>
/// Gets or sets the property editor.
/// </summary>
[IgnoreDataMember]
internal IDataEditor PropertyEditor { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Umbraco.Core.Models;
using Umbraco.Core.PropertyEditors;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "dataType", Namespace = "")]
public class DataTypeSave : EntityBasic
{
/// <summary>
/// The action to perform when saving this data type
/// </summary>
/// <remarks>
/// If either of the Publish actions are specified an exception will be thrown.
/// </remarks>
[DataMember(Name = "action", IsRequired = true)]
[Required]
public ContentSaveAction Action { get; set; }
[DataMember(Name = "selectedEditor", IsRequired = true)]
[Required]
public string SelectedEditor { get; set; }
[DataMember(Name = "preValues")]
public IEnumerable<PreValueFieldSave> PreValues { get; set; }
/// <summary>
/// The real persisted data type
/// </summary>
[IgnoreDataMember]
internal IDataTypeDefinition PersistedDataType { get; set; }
/// <summary>
/// The PropertyEditor assigned
/// </summary>
[IgnoreDataMember]
internal PropertyEditor PropertyEditor { get; set; }
}
}

View File

@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Umbraco.Web.Models.ContentEditing
{
public class DocumentTypeCollectionDisplay
{
public int CollectionId { get; set; }
public int ItemId { get; set; }
}
}

View File

@@ -9,20 +9,17 @@ namespace Umbraco.Web.Models.ContentEditing
public DocumentTypeDisplay()
{
//initialize collections so at least their never null
AllowedTemplates = new List<EntityBasic>();
AllowedTemplates = new List<EntityBasic>();
}
//name, alias, icon, thumb, desc, inherited from the content type
// Templates
[DataMember(Name = "allowedTemplates")]
public IEnumerable<EntityBasic> AllowedTemplates { get; set; }
public IEnumerable<EntityBasic> AllowedTemplates { get; set; }
[DataMember(Name = "defaultTemplate")]
public EntityBasic DefaultTemplate { get; set; }
[DataMember(Name = "allowCultureVariant")]
public bool AllowCultureVariant { get; set; }
}
}

View File

@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.Serialization;
@@ -11,13 +11,13 @@ namespace Umbraco.Web.Models.ContentEditing
/// </summary>
[DataContract(Name = "contentType", Namespace = "")]
public class DocumentTypeSave : ContentTypeSave<PropertyTypeBasic>
{
{
/// <summary>
/// The list of allowed templates to assign (template alias)
/// </summary>
[DataMember(Name = "allowedTemplates")]
public IEnumerable<string> AllowedTemplates { get; set; }
/// <summary>
/// The default template to assign (template alias)
/// </summary>
@@ -31,7 +31,7 @@ namespace Umbraco.Web.Models.ContentEditing
/// <returns></returns>
public override IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
if (AllowedTemplates.Any(x => x.IsNullOrWhiteSpace()))
if (AllowedTemplates.Any(x => StringExtensions.IsNullOrWhiteSpace(x)))
yield return new ValidationResult("Template value cannot be null", new[] { "AllowedTemplates" });
foreach (var v in base.Validate(validationContext))
@@ -40,4 +40,4 @@ namespace Umbraco.Web.Models.ContentEditing
}
}
}
}
}

View File

@@ -1,26 +0,0 @@
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "DomainDisplay")]
public class DomainDisplay
{
public DomainDisplay(string name, int lang)
{
Name = name;
Lang = lang;
}
[DataMember(Name = "name")]
public string Name { get; }
[DataMember(Name = "lang")]
public int Lang { get; }
[DataMember(Name = "duplicate")]
public bool Duplicate { get; set; }
[DataMember(Name = "other")]
public string Other { get; set; }
}
}

View File

@@ -1,20 +0,0 @@
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "DomainSave")]
public class DomainSave
{
[DataMember(Name = "valid")]
public bool Valid { get; set; }
[DataMember(Name = "nodeId")]
public int NodeId { get; set; }
[DataMember(Name = "language")]
public int Language { get; set; }
[DataMember(Name = "domains")]
public DomainDisplay[] Domains { get; set; }
}
}

View File

@@ -1,75 +1,73 @@
using System;
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
{
[DataContract(Name = "entity", Namespace = "")]
public class EntityBasic
{
public EntityBasic()
{
AdditionalData = new Dictionary<string, object>();
}
[DataMember(Name = "name", IsRequired = true)]
[RequiredForPersistence(AllowEmptyStrings = false, ErrorMessage = "Required")]
public string Name { get; set; }
[DataMember(Name = "id", IsRequired = true)]
[Required]
public object 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>
/// This will only be populated for some entities like macros
/// </summary>
/// <remarks>
/// This is overrideable to specify different validation attributes if required
/// </remarks>
[DataMember(Name = "alias")]
public virtual string Alias { get; set; }
/// <summary>
/// The path of the entity
/// </summary>
[DataMember(Name = "path")]
public string Path { 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; }
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Umbraco.Core;
using Umbraco.Core.Models.Validation;
using Umbraco.Core.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "entity", Namespace = "")]
public class EntityBasic
{
public EntityBasic()
{
AdditionalData = new Dictionary<string, object>();
}
[DataMember(Name = "name", IsRequired = true)]
[RequiredForPersistence(AllowEmptyStrings = false, ErrorMessage = "Required")]
public string Name { get; set; }
[DataMember(Name = "id", IsRequired = true)]
[Required]
public object 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>
/// This will only be populated for some entities like macros
/// </summary>
/// <remarks>
/// This is overrideable to specify different validation attributes if required
/// </remarks>
[DataMember(Name = "alias")]
public virtual string Alias { get; set; }
/// <summary>
/// The path of the entity
/// </summary>
[DataMember(Name = "path")]
public string Path { 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; }
}
}

View File

@@ -1,4 +1,4 @@
namespace Umbraco.Web.Models.ContentEditing
namespace Umbraco.Web.Models.ContentEditing
{
public class GetAvailableCompositionsFilter
{
@@ -17,4 +17,4 @@
/// </summary>
public string[] FilterContentTypes { get; set; }
}
}
}

View File

@@ -1,12 +0,0 @@
using System.Collections.Generic;
using Umbraco.Core.Models;
namespace Umbraco.Web.Models.ContentEditing
{
public interface IContentProperties<T>
where T : ContentPropertyBasic
{
IEnumerable<T> Properties { get; }
}
}

View File

@@ -1,25 +0,0 @@
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; }
}
}

View File

@@ -1,17 +1,17 @@
using System.Collections.Generic;
namespace Umbraco.Web.Models.ContentEditing
{
public interface IErrorModel
{
/// <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.
/// </remarks>
IDictionary<string, object> Errors { get; set; }
}
}
using System.Collections.Generic;
namespace Umbraco.Web.Models.ContentEditing
{
public interface IErrorModel
{
/// <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.
/// </remarks>
IDictionary<string, object> Errors { get; set; }
}
}

View File

@@ -1,10 +1,9 @@
using System.Collections.Generic;
using Umbraco.Core.Models.Editors;
namespace Umbraco.Web.Models.ContentEditing
{
public interface IHaveUploadedFiles
{
List<ContentPropertyFile> UploadedFiles { get; }
}
}
using System.Collections.Generic;
namespace Umbraco.Web.Models.ContentEditing
{
public interface IHaveUploadedFiles
{
List<ContentItemFile> UploadedFiles { get; }
}
}

View File

@@ -1,14 +1,14 @@
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
public interface INotificationModel
{
/// <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")]
List<Notification> Notifications { get; }
}
}
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
public interface INotificationModel
{
/// <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")]
List<Notification> Notifications { get; }
}
}

View File

@@ -1,11 +0,0 @@
using System.Collections.Generic;
namespace Umbraco.Web.Models.ContentEditing
{
public interface ITabbedContent<T>
where T : ContentPropertyBasic
{
IEnumerable<Tab<T>> Tabs { get; }
}
}

View File

@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
@@ -33,4 +33,4 @@ namespace Umbraco.Web.Models.ContentEditing
[DataMember(Name = "iconUrl")]
public string IconUrl { get; set; }
}
}
}

View File

@@ -1,30 +0,0 @@
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "language", Namespace = "")]
public class Language
{
[DataMember(Name = "id")]
public int Id { get; set; }
[DataMember(Name = "culture", IsRequired = true)]
[Required(AllowEmptyStrings = false)]
public string IsoCode { get; set; }
[DataMember(Name = "name")]
[ReadOnly(true)]
public string Name { get; set; }
[DataMember(Name = "isDefault")]
public bool IsDefault { get; set; }
[DataMember(Name = "isMandatory")]
public bool IsMandatory { get; set; }
[DataMember(Name = "fallbackLanguageId")]
public int? FallbackLanguageId { get; set; }
}
}

View File

@@ -1,4 +1,4 @@
using System.Runtime.Serialization;
using System.Runtime.Serialization;
using Umbraco.Core.Models;
namespace Umbraco.Web.Models.ContentEditing
@@ -7,8 +7,10 @@ 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>
public abstract class ListViewAwareContentItemDisplayBase<T> : ContentItemDisplayBase<T>
/// <typeparam name="TPersisted"></typeparam>
public abstract class ListViewAwareContentItemDisplayBase<T, TPersisted> : ContentItemDisplayBase<T, TPersisted>
where T : ContentPropertyBasic
where TPersisted : IContentBase
{
/// <summary>
/// Property indicating if this item is part of a list view parent
@@ -20,10 +22,10 @@ namespace Umbraco.Web.Models.ContentEditing
/// 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,
/// 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; }
}
}
}

View File

@@ -1,48 +1,48 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// Represents a macro parameter with an editor
/// </summary>
[DataContract(Name = "macroParameter", Namespace = "")]
public class MacroParameter
{
[DataMember(Name = "alias", IsRequired = true)]
[Required]
public string Alias { get; set; }
[DataMember(Name = "name")]
public string Name { get; set; }
[DataMember(Name = "sortOrder")]
public int SortOrder { get; set; }
/// <summary>
/// The editor view to render for this parameter
/// </summary>
[DataMember(Name = "view", IsRequired = true)]
[Required(AllowEmptyStrings = false)]
public string View { get; set; }
/// <summary>
/// The configuration for this parameter editor
/// </summary>
[DataMember(Name = "config", IsRequired = true)]
[Required(AllowEmptyStrings = false)]
public IDictionary<string, object> Configuration { get; set; }
/// <summary>
/// Since we don't post this back this isn't currently really used on the server side
/// </summary>
[DataMember(Name = "value")]
public object Value { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// Represents a macro parameter with an editor
/// </summary>
[DataContract(Name = "macroParameter", Namespace = "")]
public class MacroParameter
{
[DataMember(Name = "alias", IsRequired = true)]
[Required]
public string Alias { get; set; }
[DataMember(Name = "name")]
public string Name { get; set; }
[DataMember(Name = "sortOrder")]
public int SortOrder { get; set; }
/// <summary>
/// The editor view to render for this parameter
/// </summary>
[DataMember(Name = "view", IsRequired = true)]
[Required(AllowEmptyStrings = false)]
public string View { get; set; }
/// <summary>
/// The configuration for this parameter editor
/// </summary>
[DataMember(Name = "config", IsRequired = true)]
[Required(AllowEmptyStrings = false)]
public IDictionary<string, object> Configuration { get; set; }
/// <summary>
/// Since we don't post this back this isn't currently really used on the server side
/// </summary>
[DataMember(Name = "value")]
public object Value { get; set; }
}
}

View File

@@ -1,29 +1,19 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Umbraco.Core.Models;
using Umbraco.Core.Models.ContentEditing;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// A model representing a content item to be displayed in the back office
/// </summary>
[DataContract(Name = "content", Namespace = "")]
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; }
}
}
using System;
using System.Runtime.Serialization;
using Umbraco.Core.Models;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// A model representing a content item to be displayed in the back office
/// </summary>
[DataContract(Name = "content", Namespace = "")]
public class MediaItemDisplay : ListViewAwareContentItemDisplayBase<ContentPropertyDisplay, IMedia>
{
[DataMember(Name = "contentType")]
public ContentTypeBasic ContentType { get; set; }
[DataMember(Name = "mediaLink")]
public string MediaLink { get; set; }
}
}

View File

@@ -1,6 +1,5 @@
using System.Runtime.Serialization;
using System.Runtime.Serialization;
using Umbraco.Core.Models;
using Umbraco.Web.WebApi.Filters;
namespace Umbraco.Web.Models.ContentEditing
{
@@ -8,7 +7,8 @@ namespace Umbraco.Web.Models.ContentEditing
/// A model representing a media item to be saved
/// </summary>
[DataContract(Name = "content", Namespace = "")]
public class MediaItemSave : ContentBaseSave<IMedia>
public class MediaItemSave : ContentBaseItemSave<IMedia>
{
}
}
}

View File

@@ -1,4 +1,4 @@
using System.Runtime.Serialization;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
@@ -7,4 +7,4 @@ namespace Umbraco.Web.Models.ContentEditing
{
}
}
}

View File

@@ -1,4 +1,4 @@
using System.Runtime.Serialization;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
@@ -9,4 +9,4 @@ namespace Umbraco.Web.Models.ContentEditing
public class MediaTypeSave : ContentTypeSave<PropertyTypeBasic>
{
}
}
}

View File

@@ -6,7 +6,7 @@ namespace Umbraco.Web.Models.ContentEditing
/// <summary>
/// Used for basic member information
/// </summary>
public class MemberBasic : ContentItemBasic<ContentPropertyBasic>
public class MemberBasic : ContentItemBasic<ContentPropertyBasic, IMember>
{
[DataMember(Name = "username")]
public string Username { get; set; }
@@ -14,4 +14,4 @@ namespace Umbraco.Web.Models.ContentEditing
[DataMember(Name = "email")]
public string Email { get; set; }
}
}
}

View File

@@ -1,38 +1,38 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Membership;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// A model representing a member to be displayed in the back office
/// </summary>
[DataContract(Name = "content", Namespace = "")]
public class MemberDisplay : ListViewAwareContentItemDisplayBase<ContentPropertyDisplay>
{
public MemberDisplay()
{
MemberProviderFieldMapping = new Dictionary<string, string>();
}
[DataMember(Name = "username")]
public string Username { get; set; }
[DataMember(Name = "email")]
public string Email { get; set; }
[DataMember(Name = "membershipScenario")]
public MembershipScenario MembershipScenario { get; set; }
/// <summary>
/// This is used to indicate how to map the membership provider properties to the save model, this mapping
/// will change if a developer has opted to have custom member property aliases specified in their membership provider config,
/// or if we are editing a member that is not an Umbraco member (custom provider)
/// </summary>
[DataMember(Name = "fieldConfig")]
public IDictionary<string, string> MemberProviderFieldMapping { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Membership;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// A model representing a member to be displayed in the back office
/// </summary>
[DataContract(Name = "content", Namespace = "")]
public class MemberDisplay : ListViewAwareContentItemDisplayBase<ContentPropertyDisplay, IMember>
{
public MemberDisplay()
{
MemberProviderFieldMapping = new Dictionary<string, string>();
}
[DataMember(Name = "username")]
public string Username { get; set; }
[DataMember(Name = "email")]
public string Email { get; set; }
[DataMember(Name = "membershipScenario")]
public MembershipScenario MembershipScenario { get; set; }
/// <summary>
/// This is used to indicate how to map the membership provider properties to the save model, this mapping
/// will change if a developer has opted to have custom member property aliases specified in their membership provider config,
/// or if we are editing a member that is not an Umbraco member (custom provider)
/// </summary>
[DataMember(Name = "fieldConfig")]
public IDictionary<string, string> MemberProviderFieldMapping { get; set; }
}
}

View File

@@ -1,21 +0,0 @@
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
using System.Collections.Generic;
[DataContract(Name = "memberGroup", Namespace = "")]
public class MemberGroupDisplay : EntityBasic, INotificationModel
{
public MemberGroupDisplay()
{
Notifications = new List<Notification>();
}
/// <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")]
public List<Notification> Notifications { get; private set; }
}
}

View File

@@ -1,9 +0,0 @@
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "memberGroup", Namespace = "")]
public class MemberGroupSave : EntityBasic
{
}
}

View File

@@ -1,7 +1,5 @@
using System.Collections.Generic;
using System.Runtime.Serialization;
using Umbraco.Core.Models;
using Umbraco.Core.Models.ContentEditing;
namespace Umbraco.Web.Models.ContentEditing
{
@@ -9,9 +7,7 @@ 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>
public class MemberListDisplay : ContentItemDisplayBase<ContentPropertyDisplay, IMember>
{
[DataMember(Name = "apps")]
public IEnumerable<ContentApp> ContentApps { get; set; }
}
}
}

View File

@@ -1,4 +1,4 @@
using System.Runtime.Serialization;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{

View File

@@ -1,4 +1,4 @@
using System.Runtime.Serialization;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{

View File

@@ -1,42 +1,41 @@
using System;
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
{
/// <inheritdoc />
public class MemberSave : ContentBaseSave<IMember>
{
[DataMember(Name = "username", IsRequired = true)]
[RequiredForPersistence(AllowEmptyStrings = false, ErrorMessage = "Required")]
public string Username { get; set; }
[DataMember(Name = "email", IsRequired = true)]
[RequiredForPersistence(AllowEmptyStrings = false, ErrorMessage = "Required")]
public string Email { get; set; }
[DataMember(Name = "password")]
public ChangingPasswordModel Password { get; set; }
[DataMember(Name = "memberGroups")]
public IEnumerable<string> Groups { get; set; }
[DataMember(Name = "comments")]
public string Comments { get; set; }
[DataMember(Name = "isLockedOut")]
public bool IsLockedOut { get; set; }
[DataMember(Name = "isApproved")]
public bool IsApproved { get; set; }
//TODO: Need to add question / answer support
}
}
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Newtonsoft.Json.Linq;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Validation;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// A model representing a member to be saved
/// </summary>
public class MemberSave : ContentBaseItemSave<IMember>
{
[DataMember(Name = "username", IsRequired = true)]
[RequiredForPersistence(AllowEmptyStrings = false, ErrorMessage = "Required")]
public string Username { get; set; }
[DataMember(Name = "email", IsRequired = true)]
[RequiredForPersistence(AllowEmptyStrings = false, ErrorMessage = "Required")]
public string Email { get; set; }
[DataMember(Name = "password")]
public ChangingPasswordModel Password { get; set; }
[DataMember(Name = "memberGroups")]
public IEnumerable<string> Groups { get; set; }
[DataMember(Name = "comments")]
public string Comments { get; set; }
[DataMember(Name = "isLockedOut")]
public bool IsLockedOut { get; set; }
[DataMember(Name = "isApproved")]
public bool IsApproved { get; set; }
//TODO: Need to add question / answer support
}
}

View File

@@ -1,4 +1,4 @@
using System.Runtime.Serialization;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
@@ -7,4 +7,4 @@ namespace Umbraco.Web.Models.ContentEditing
{
}
}
}

View File

@@ -1,10 +1,10 @@
namespace Umbraco.Web.Models.ContentEditing
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// Model used to save a member type
/// </summary>
public class MemberTypeSave : ContentTypeSave<MemberPropertyTypeBasic>
{
}
}
}

View File

@@ -1,57 +1,57 @@
using Umbraco.Web.UI;
namespace Umbraco.Web.Models.ContentEditing
{
public static class MessagesExtensions
{
public static void AddNotification(this INotificationModel model, string header, string msg, SpeechBubbleIcon type)
{
model.Notifications.Add(new Notification()
{
Header = header,
Message = msg,
NotificationType = type
});
}
public static void AddSuccessNotification(this INotificationModel model, string header, string msg)
{
model.Notifications.Add(new Notification()
{
Header = header,
Message = msg,
NotificationType = SpeechBubbleIcon.Success
});
}
public static void AddErrorNotification(this INotificationModel model, string header, string msg)
{
model.Notifications.Add(new Notification()
{
Header = header,
Message = msg,
NotificationType = SpeechBubbleIcon.Error
});
}
public static void AddWarningNotification(this INotificationModel model, string header, string msg)
{
model.Notifications.Add(new Notification()
{
Header = header,
Message = msg,
NotificationType = SpeechBubbleIcon.Warning
});
}
public static void AddInfoNotification(this INotificationModel model, string header, string msg)
{
model.Notifications.Add(new Notification()
{
Header = header,
Message = msg,
NotificationType = SpeechBubbleIcon.Info
});
}
}
}
using Umbraco.Web.UI;
namespace Umbraco.Web.Models.ContentEditing
{
public static class MessagesExtensions
{
public static void AddNotification(this INotificationModel model, string header, string msg, SpeechBubbleIcon type)
{
model.Notifications.Add(new Notification()
{
Header = header,
Message = msg,
NotificationType = type
});
}
public static void AddSuccessNotification(this INotificationModel model, string header, string msg)
{
model.Notifications.Add(new Notification()
{
Header = header,
Message = msg,
NotificationType = SpeechBubbleIcon.Success
});
}
public static void AddErrorNotification(this INotificationModel model, string header, string msg)
{
model.Notifications.Add(new Notification()
{
Header = header,
Message = msg,
NotificationType = SpeechBubbleIcon.Error
});
}
public static void AddWarningNotification(this INotificationModel model, string header, string msg)
{
model.Notifications.Add(new Notification()
{
Header = header,
Message = msg,
NotificationType = SpeechBubbleIcon.Warning
});
}
public static void AddInfoNotification(this INotificationModel model, string header, string msg)
{
model.Notifications.Add(new Notification()
{
Header = header,
Message = msg,
NotificationType = SpeechBubbleIcon.Info
});
}
}
}

View File

@@ -1,31 +1,31 @@
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// A generic model supporting notifications, this is useful for returning any model type to include notifications from api controllers
/// </summary>
/// <typeparam name="T"></typeparam>
[DataContract(Name = "model", Namespace = "")]
public class ModelWithNotifications<T> : INotificationModel
{
public ModelWithNotifications(T value)
{
Value = value;
Notifications = new List<Notification>();
}
/// <summary>
/// The generic value
/// </summary>
[DataMember(Name = "value")]
public T Value { get; private set; }
/// <summary>
/// The notifications
/// </summary>
[DataMember(Name = "notifications")]
public List<Notification> Notifications { get; private set; }
}
}
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// A generic model supporting notifications, this is useful for returning any model type to include notifications from api controllers
/// </summary>
/// <typeparam name="T"></typeparam>
[DataContract(Name = "model", Namespace = "")]
public class ModelWithNotifications<T> : INotificationModel
{
public ModelWithNotifications(T value)
{
Value = value;
Notifications = new List<Notification>();
}
/// <summary>
/// The generic value
/// </summary>
[DataMember(Name = "value")]
public T Value { get; private set; }
/// <summary>
/// The notifications
/// </summary>
[DataMember(Name = "notifications")]
public List<Notification> Notifications { get; private set; }
}
}

View File

@@ -1,44 +1,45 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// A model representing a model for moving or copying
/// </summary>
[DataContract(Name = "content", Namespace = "")]
public class MoveOrCopy
{
/// <summary>
/// The Id of the node to move or copy to
/// </summary>
[DataMember(Name = "parentId", IsRequired = true)]
[Required]
public int ParentId { get; set; }
/// <summary>
/// The id of the node to move or copy
/// </summary>
[DataMember(Name = "id", IsRequired = true)]
[Required]
public int Id { get; set; }
/// <summary>
/// Boolean indicating whether copying the object should create a relation to it's original
/// </summary>
[DataMember(Name = "relateToOriginal", IsRequired = true)]
[Required]
public bool RelateToOriginal { get; set; }
/// <summary>
/// Boolean indicating whether copying the object should be recursive
/// </summary>
[DataMember(Name = "recursive", IsRequired = true)]
[Required]
public bool Recursive { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// A model representing a model for moving or copying
/// </summary>
[DataContract(Name = "content", Namespace = "")]
public class MoveOrCopy
{
/// <summary>
/// The Id of the node to move or copy to
/// </summary>
[DataMember(Name = "parentId", IsRequired = true)]
[Required]
public int ParentId { get; set; }
/// <summary>
/// The id of the node to move or copy
/// </summary>
[DataMember(Name = "id", IsRequired = true)]
[Required]
public int Id { get; set; }
/// <summary>
/// Boolean indicating whether copying the object should create a relation to it's original
/// </summary>
[DataMember(Name = "relateToOriginal", IsRequired = true)]
[Required]
public bool RelateToOriginal { get; set; }
/// <summary>
/// Boolean indicating whether copying the object should be recursive
/// </summary>
[DataMember(Name = "recursive", IsRequired = true)]
[Required]
public bool Recursive { get; set; }
}
}

View File

@@ -1,31 +1,28 @@
using System.Runtime.Serialization;
using Umbraco.Web.UI;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "notification", Namespace = "")]
public class Notification
{
public Notification()
{
}
public Notification(string header, string message, SpeechBubbleIcon notificationType)
{
Header = header;
Message = message;
NotificationType = notificationType;
}
[DataMember(Name = "header")]
public string Header { get; set; }
[DataMember(Name = "message")]
public string Message { get; set; }
[DataMember(Name = "type")]
public SpeechBubbleIcon NotificationType { get; set; }
}
}
using System.Runtime.Serialization;
using Umbraco.Web.UI;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "notification", Namespace = "")]
public class Notification
{
public Notification()
{
}
public Notification(string header, string message, SpeechBubbleIcon notificationType)
{
Header = header;
Message = message;
NotificationType = notificationType;
}
[DataMember(Name = "header")]
public string Header { get; set; }
[DataMember(Name = "message")]
public string Message { get; set; }
[DataMember(Name = "type")]
public SpeechBubbleIcon NotificationType { get; set; }
}
}

View File

@@ -1,4 +1,4 @@
using System;
using System;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
@@ -35,4 +35,4 @@ namespace Umbraco.Web.Models.ContentEditing
return this.MemberwiseClone();
}
}
}
}

View File

@@ -1,11 +1,10 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.Runtime.Serialization;
using Umbraco.Core.Models.Editors;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// This is used for the response of PostAddFile so that we can analyze the response in a filter and remove the
/// This is used for the response of PostAddFile so that we can analyze the response in a filter and remove the
/// temporary files that were created.
/// </summary>
[DataContract]
@@ -13,12 +12,12 @@ namespace Umbraco.Web.Models.ContentEditing
{
public PostedFiles()
{
UploadedFiles = new List<ContentPropertyFile>();
UploadedFiles = new List<ContentItemFile>();
Notifications = new List<Notification>();
}
public List<ContentPropertyFile> UploadedFiles { get; private set; }
public List<ContentItemFile> UploadedFiles { get; private set; }
[DataMember(Name = "notifications")]
public List<Notification> Notifications { get; private set; }
}
}
}

View File

@@ -1,43 +1,44 @@
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// Represents a datatype configuration field model for editing.
/// </summary>
[DataContract(Name = "preValue", Namespace = "")]
public class DataTypeConfigurationFieldDisplay : DataTypeConfigurationFieldSave
{
/// <summary>
/// The name to display for this pre-value field
/// </summary>
[DataMember(Name = "label", IsRequired = true)]
public string Name { get; set; }
/// <summary>
/// The description to display for this pre-value field
/// </summary>
[DataMember(Name = "description")]
public string Description { get; set; }
/// <summary>
/// Specifies whether to hide the label for the pre-value
/// </summary>
[DataMember(Name = "hideLabel")]
public bool HideLabel { get; set; }
/// <summary>
/// The view to render for the field
/// </summary>
[DataMember(Name = "view", IsRequired = true)]
public string View { get; set; }
/// <summary>
/// This allows for custom configuration to be injected into the pre-value editor
/// </summary>
[DataMember(Name = "config")]
public IDictionary<string, object> Config { get; set; }
}
}
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// Defines a pre value editable field for a data type
/// </summary>
[DataContract(Name = "preValue", Namespace = "")]
public class PreValueFieldDisplay : PreValueFieldSave
{
/// <summary>
/// The name to display for this pre-value field
/// </summary>
[DataMember(Name = "label", IsRequired = true)]
public string Name { get; set; }
/// <summary>
/// The description to display for this pre-value field
/// </summary>
[DataMember(Name = "description")]
public string Description { get; set; }
/// <summary>
/// Specifies whether to hide the label for the pre-value
/// </summary>
[DataMember(Name = "hideLabel")]
public bool HideLabel { get; set; }
/// <summary>
/// The view to render for the field
/// </summary>
[DataMember(Name = "view", IsRequired = true)]
public string View { get; set; }
/// <summary>
/// This allows for custom configuration to be injected into the pre-value editor
/// </summary>
[DataMember(Name = "config")]
public IDictionary<string, object> Config { get; set; }
}
}

View File

@@ -1,24 +1,23 @@
using System.Runtime.Serialization;
using Newtonsoft.Json.Linq;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// Represents a datatype configuration field model for editing.
/// </summary>
[DataContract(Name = "preValue", Namespace = "")]
public class DataTypeConfigurationFieldSave
{
/// <summary>
/// Gets or sets the configuration field key.
/// </summary>
[DataMember(Name = "key", IsRequired = true)]
public string Key { get; set; }
/// <summary>
/// Gets or sets the configuration field value.
/// </summary>
[DataMember(Name = "value", IsRequired = true)]
public object Value { get; set; }
}
}
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// Defines a pre value editable field for a data type
/// </summary>
[DataContract(Name = "preValue", Namespace = "")]
public class PreValueFieldSave
{
/// <summary>
/// The key to store the pre-value against
/// </summary>
[DataMember(Name = "key", IsRequired = true)]
public string Key { get; set; }
/// <summary>
/// The value stored for the pre-value field
/// </summary>
[DataMember(Name = "value", IsRequired = true)]
public object Value { get; set; }
}
}

View File

@@ -1,21 +1,21 @@
using System;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// Defines an available property editor to be able to select for a data type
/// </summary>
[DataContract(Name = "propertyEditor", Namespace = "")]
public class PropertyEditorBasic
{
[DataMember(Name = "alias")]
public string Alias { get; set; }
[DataMember(Name = "name")]
public string Name { get; set; }
[DataMember(Name = "icon")]
public string Icon { get; set; }
}
}
using System;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// Defines an available property editor to be able to select for a data type
/// </summary>
[DataContract(Name = "propertyEditor", Namespace = "")]
public class PropertyEditorBasic
{
[DataMember(Name = "alias")]
public string Alias { get; set; }
[DataMember(Name = "name")]
public string Name { get; set; }
[DataMember(Name = "icon")]
public string Icon { get; set; }
}
}

View File

@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
@@ -16,7 +16,7 @@ namespace Umbraco.Web.Models.ContentEditing
/// Gets a value indicating whether this tab is the generic properties tab.
/// </summary>
[IgnoreDataMember]
public bool IsGenericProperties => Id == GenericPropertiesGroupId;
public bool IsGenericProperties { get { return Id == GenericPropertiesGroupId; } }
/// <summary>
/// Gets a value indicating whether the property group is inherited through
@@ -49,7 +49,11 @@ namespace Umbraco.Web.Models.ContentEditing
Properties = new List<TPropertyType>();
}
[DataMember(Name = "properties")]
public IEnumerable<TPropertyType> Properties { get; set; }
}
}
}

View File

@@ -5,7 +5,7 @@ using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "propertyGroup", Namespace = "")]
public class PropertyGroupDisplay<TPropertyTypeDisplay> : PropertyGroupBasic<TPropertyTypeDisplay>
public class PropertyGroupDisplay<TPropertyTypeDisplay> : PropertyGroupBasic<TPropertyTypeDisplay>
where TPropertyTypeDisplay : PropertyTypeDisplay
{
public PropertyGroupDisplay()

View File

@@ -46,8 +46,5 @@ namespace Umbraco.Web.Models.ContentEditing
//SD: Is this really needed ?
[DataMember(Name = "groupId")]
public int GroupId { get; set; }
[DataMember(Name = "allowCultureVariant")]
public bool AllowCultureVariant { get; set; }
}
}
}

View File

@@ -10,7 +10,7 @@ namespace Umbraco.Web.Models.ContentEditing
[DataMember(Name = "editor")]
[ReadOnly(true)]
public string Editor { get; set; }
[DataMember(Name = "view")]
[ReadOnly(true)]
public string View { get; set; }
@@ -18,7 +18,7 @@ namespace Umbraco.Web.Models.ContentEditing
[DataMember(Name = "config")]
[ReadOnly(true)]
public IDictionary<string, object> Config { get; set; }
/// <summary>
/// Gets a value indicating whether this property should be locked when editing.
/// </summary>
@@ -29,9 +29,9 @@ namespace Umbraco.Web.Models.ContentEditing
public bool Locked { get; set; }
/// <summary>
/// This is required for the UI editor to know if this particular property belongs to
/// This is required for the UI editor to know if this particular property belongs to
/// an inherited item or the current item.
/// </summary>
/// </summary>
[DataMember(Name = "contentTypeId")]
[ReadOnly(true)]
public int ContentTypeId { get; set; }

View File

@@ -14,4 +14,4 @@ namespace Umbraco.Web.Models.ContentEditing
[DataMember(Name = "pattern")]
public string Pattern { get; set; }
}
}
}

View File

@@ -9,7 +9,7 @@ namespace Umbraco.Web.Models.ContentEditing
{
[DataMember(Name = "searchResults")]
public IEnumerable<ContentRedirectUrl> SearchResults { get; set; }
[DataMember(Name = "totalCount")]
public long TotalCount { get; set; }
@@ -17,6 +17,6 @@ namespace Umbraco.Web.Models.ContentEditing
public int PageCount { get; set; }
[DataMember(Name = "currentPage")]
public int CurrentPage { get; set; }
public int CurrentPage { get; set; }
}
}
}

View File

@@ -39,4 +39,4 @@ namespace Umbraco.Web.Models.ContentEditing
[DataMember(Name = "childObjectType", IsRequired = true)]
public Guid ChildObjectType { get; set; }
}
}
}

View File

@@ -1,32 +1,40 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "richtexteditorcommand", Namespace = "")]
public class RichTextEditorCommand
{
[DataMember(Name = "name")]
public string Name { get; set; }
[DataMember(Name = "alias")]
public string Alias { get; set; }
[JsonConverter(typeof(StringEnumConverter))]
[DataMember(Name = "mode")]
public RichTextEditorCommandMode Mode { get; set; }
}
public enum RichTextEditorCommandMode
{
Insert,
Selection,
All
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "richtexteditorcommand", Namespace = "")]
public class RichTextEditorCommand
{
[DataMember(Name = "name")]
public string Name { get; set; }
[DataMember(Name = "icon")]
public string Icon { get; set; }
[DataMember(Name = "command")]
public string Command { get; set; }
[DataMember(Name = "alias")]
public string Alias { get; set; }
[DataMember(Name = "userInterface")]
public string UserInterface { get; set; }
[DataMember(Name = "frontEndCommand")]
public string FrontEndCommand { get; set; }
[DataMember(Name = "value")]
public string Value { get; set; }
[DataMember(Name = "priority")]
public int Priority { get; set; }
[DataMember(Name = "isStylePicker")]
public bool IsStylePicker { get; set; }
}
}

View File

@@ -1,28 +1,28 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "richtexteditorconfiguration", Namespace = "")]
public class RichTextEditorConfiguration
{
[DataMember(Name = "plugins")]
public IEnumerable<RichTextEditorPlugin> Plugins { get; set; }
[DataMember(Name = "commands")]
public IEnumerable<RichTextEditorCommand> Commands { get; set; }
[DataMember(Name = "validElements")]
public string ValidElements { get; set; }
[DataMember(Name = "inValidElements")]
public string InvalidElements { get; set; }
[DataMember(Name = "customConfig")]
public IDictionary<string,string> CustomConfig { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "richtexteditorconfiguration", Namespace = "")]
public class RichTextEditorConfiguration
{
[DataMember(Name = "plugins")]
public IEnumerable<RichTextEditorPlugin> Plugins { get; set; }
[DataMember(Name = "commands")]
public IEnumerable<RichTextEditorCommand> Commands { get; set; }
[DataMember(Name = "validElements")]
public string ValidElements { get; set; }
[DataMember(Name = "inValidElements")]
public string InvalidElements { get; set; }
[DataMember(Name = "customConfig")]
public IDictionary<string,string> CustomConfig { get; set; }
}
}

View File

@@ -1,16 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "richtexteditorplugin", Namespace = "")]
public class RichTextEditorPlugin
{
[DataMember(Name = "name")]
public string Name { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "richtexteditorplugin", Namespace = "")]
public class RichTextEditorPlugin
{
[DataMember(Name = "name")]
public string Name { get; set; }
[DataMember(Name = "useOnFrontend")]
public bool UseOnFrontend { get; set; }
}
}

View File

@@ -1,21 +0,0 @@
using System;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "rollbackVersion", Namespace = "")]
public class RollbackVersion
{
[DataMember(Name = "versionId")]
public int VersionId { get; set; }
[DataMember(Name = "versionDate")]
public DateTime VersionDate { get; set; }
[DataMember(Name = "versionAuthorId")]
public int VersionAuthorId { get; set; }
[DataMember(Name = "versionAuthorName")]
public string VersionAuthorName { get; set; }
}
}

View File

@@ -1,15 +1,15 @@
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "searchResult", Namespace = "")]
public class SearchResultItem : EntityBasic
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "searchResult", Namespace = "")]
public class SearchResultItem : EntityBasic
{
/// <summary>
/// The score of the search result
/// </summary>
[DataMember(Name = "score")]
public float Score { get; set; }
}
}
/// <summary>
/// The score of the search result
/// </summary>
[DataMember(Name = "score")]
public float Score { get; set; }
}
}

View File

@@ -1,27 +1,35 @@
using System.Runtime.Serialization;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// Represents a section (application) in the back office
/// </summary>
[DataContract(Name = "section", Namespace = "")]
public class Section
{
[DataMember(Name = "name")]
public string Name { get; set; }
[DataMember(Name = "cssclass")]
public string Icon { get; set; }
[DataMember(Name = "alias")]
public string Alias { get; set; }
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// Represents a section (application) in the back office
/// </summary>
[DataContract(Name = "section", Namespace = "")]
public class Section
{
[DataMember(Name = "name")]
public string Name { get; set; }
[DataMember(Name = "cssclass")]
public string Icon { get; set; }
[DataMember(Name = "alias")]
public string Alias { get; set; }
/// <summary>
/// In some cases a custom route path can be specified so that when clicking on a section it goes to this
/// path instead of the normal dashboard path
/// </summary>
[DataMember(Name = "routePath")]
/// <summary>
/// In some cases a custom route path can be specified so that when clicking on a section it goes to this
/// path instead of the normal dashboard path
/// </summary>
[DataMember(Name = "routePath")]
public string RoutePath { get; set; }
}
}
}
}

View File

@@ -23,9 +23,9 @@ namespace Umbraco.Web.Models.ContentEditing
public List<Notification> Notifications { get; private set; }
/// <summary>
/// A default msg
/// A default msg
/// </summary>
[DataMember(Name = "message")]
public string Message { get; set; }
}
}
}

View File

@@ -1,18 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "stylesheet", Namespace = "")]
public class Stylesheet
{
[DataMember(Name="name")]
public string Name { get; set; }
[DataMember(Name = "path")]
public string Path { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "stylesheet", Namespace = "")]
public class Stylesheet
{
[DataMember(Name="name")]
public string Name { get; set; }
[DataMember(Name = "path")]
public string Path { get; set; }
}
}

View File

@@ -1,22 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "stylesheetRule", Namespace = "")]
public class StylesheetRule
{
[DataMember(Name = "name")]
public string Name { get; set; }
[DataMember(Name = "selector")]
public string Selector { get; set; }
[DataMember(Name = "styles")]
public string Styles { get; set; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "stylesheetRule", Namespace = "")]
public class StylesheetRule
{
[DataMember(Name = "name")]
public string Name { get; set; }
[DataMember(Name = "selector")]
public string Selector { get; set; }
}
}

View File

@@ -1,33 +1,27 @@
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// Represents a tab in the UI
/// </summary>
[DataContract(Name = "tab", Namespace = "")]
public class Tab<T>
{
[DataMember(Name = "id")]
public int Id { get; set; }
[DataMember(Name = "active")]
public bool IsActive { get; set; }
[DataMember(Name = "label")]
public string Label { get; set; }
[DataMember(Name = "alias")]
public string Alias { get; set; }
/// <summary>
/// The expanded state of the tab
/// </summary>
[DataMember(Name = "open")]
public bool Expanded { get; set; } = true;
[DataMember(Name = "properties")]
public IEnumerable<T> Properties { get; set; }
}
}
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// Represents a tab in the UI
/// </summary>
[DataContract(Name = "tab", Namespace = "")]
public class Tab<T>
{
[DataMember(Name = "id")]
public int Id { get; set; }
[DataMember(Name = "active")]
public bool IsActive { get; set; }
[DataMember(Name = "label")]
public string Label { get; set; }
[DataMember(Name = "alias")]
public string Alias { get; set; }
[DataMember(Name = "properties")]
public IEnumerable<T> Properties { get; set; }
}
}

View File

@@ -1,48 +1,39 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Umbraco.Core.Models;
namespace Umbraco.Web.Models.ContentEditing
{
public abstract class TabbedContentItem<T> : ContentItemBasic<T>, ITabbedContent<T> where T : ContentPropertyBasic
{
protected TabbedContentItem()
{
Tabs = new List<Tab<T>>();
}
/// <summary>
/// Defines the tabs containing display properties
/// </summary>
[DataMember(Name = "tabs")]
public IEnumerable<Tab<T>> Tabs { get; set; }
// note
// once a [DataContract] has been defined on a class, with a [DataMember] property,
// one simply cannot ignore that property anymore - [IgnoreDataMember] on an overriden
// property is ignored, and 'newing' the property means that it's the base property
// which is used
//
// OTOH, Json.NET is happy having [JsonIgnore] on overrides, even though the base
// property is [JsonProperty]. so, forcing [JsonIgnore] here, but really, we should
// rething the whole thing.
/// <summary>
/// Override the properties property to ensure we don't serialize this
/// and to simply return the properties based on the properties in the tabs collection
/// </summary>
/// <remarks>
/// This property cannot be set
/// </remarks>
[IgnoreDataMember]
[JsonIgnore] // see note above on IgnoreDataMember vs JsonIgnore
public override IEnumerable<T> Properties
{
get => Tabs.SelectMany(x => x.Properties);
set => throw new NotImplementedException();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Umbraco.Core.Models;
namespace Umbraco.Web.Models.ContentEditing
{
public abstract class TabbedContentItem<T, TPersisted> : ContentItemBasic<T, TPersisted>
where T : ContentPropertyBasic
where TPersisted : IContentBase
{
protected TabbedContentItem()
{
Tabs = new List<Tab<T>>();
}
/// <summary>
/// Defines the tabs containing display properties
/// </summary>
[DataMember(Name = "tabs")]
public IEnumerable<Tab<T>> Tabs { get; set; }
/// <summary>
/// Override the properties property to ensure we don't serialize this
/// and to simply return the properties based on the properties in the tabs collection
/// </summary>
/// <remarks>
/// This property cannot be set
/// </remarks>
[IgnoreDataMember]
public override IEnumerable<T> Properties
{
get { return Tabs.SelectMany(x => x.Properties); }
set { throw new NotImplementedException(); }
}
}
}

View File

@@ -17,8 +17,8 @@ namespace Umbraco.Web.Models.ContentEditing
public string TreeAlias { get; set; }
/// <summary>
/// This is optional but if specified should be the name of an angular service to format the search result.
/// </summary>
/// This is optional but if specified should be the name of an angular service to format the search result.
/// </summary>
[DataMember(Name = "jsSvc")]
public string JsFormatterService { get; set; }
@@ -32,4 +32,4 @@ namespace Umbraco.Web.Models.ContentEditing
[DataMember(Name = "results")]
public IEnumerable<SearchResultItem> Results { get; set; }
}
}
}

View File

@@ -1,91 +1,98 @@
using System;
using System.ComponentModel;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// Represents the type's of Umbraco entities that can be resolved from the EntityController
/// </summary>
public enum UmbracoEntityTypes
{
/// <summary>
/// Domain
/// </summary>
Domain,
/// <summary>
/// Language
/// </summary>
Language,
/// <summary>
/// User
/// </summary>
User,
/// <summary>
/// Macro
/// </summary>
Macro,
/// <summary>
/// Document
/// </summary>
Document,
/// <summary>
/// Media
/// </summary>
Media,
/// <summary>
/// Member Type
/// </summary>
MemberType,
/// <summary>
/// Template
/// </summary>
Template,
/// <summary>
/// Member Group
/// </summary>
MemberGroup,
/// <summary>
/// "Media Type
/// </summary>
MediaType,
/// <summary>
/// Document Type
/// </summary>
DocumentType,
/// <summary>
/// Stylesheet
/// </summary>
Stylesheet,
/// <summary>
/// Member
/// </summary>
Member,
/// <summary>
/// Data Type
/// </summary>
DataType,
/// <summary>
/// Property Type
/// </summary>
PropertyType,
/// <summary>
/// Property Group
/// </summary>
PropertyGroup
}
}
using System;
using System.ComponentModel;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// Represents the type's of Umbraco entities that can be resolved from the EntityController
/// </summary>
public enum UmbracoEntityTypes
{
/// <summary>
/// Domain
/// </summary>
Domain,
/// <summary>
/// Language
/// </summary>
Language,
/// <summary>
/// User
/// </summary>
User,
/// <summary>
/// Macro
/// </summary>
Macro,
/// <summary>
/// Document
/// </summary>
Document,
/// <summary>
/// Media
/// </summary>
Media,
/// <summary>
/// Member Type
/// </summary>
MemberType,
/// <summary>
/// Template
/// </summary>
Template,
/// <summary>
/// Member Group
/// </summary>
MemberGroup,
/// <summary>
/// Content Item
/// </summary>
[Obsolete("This is not used and will be removed in future versions")]
[EditorBrowsable(EditorBrowsableState.Never)]
ContentItem,
/// <summary>
/// "Media Type
/// </summary>
MediaType,
/// <summary>
/// Document Type
/// </summary>
DocumentType,
/// <summary>
/// Stylesheet
/// </summary>
Stylesheet,
/// <summary>
/// Member
/// </summary>
Member,
/// <summary>
/// Data Type
/// </summary>
DataType,
/// <summary>
/// Property Type
/// </summary>
PropertyType,
/// <summary>
/// Property Group
/// </summary>
PropertyGroup
}
}

View File

@@ -1,22 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// Used to unpublish content and variants
/// </summary>
[DataContract(Name = "unpublish", Namespace = "")]
public class UnpublishContent
{
[DataMember(Name = "id")]
public int Id { get; set; }
[DataMember(Name = "cultures")]
public string[] Cultures { get; set; }
}
}

View File

@@ -1,68 +1,68 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.Serialization;
using Umbraco.Core.Models.Membership;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// The user model used for paging and listing users in the UI
/// </summary>
[DataContract(Name = "user", Namespace = "")]
[ReadOnly(true)]
public class UserBasic : EntityBasic, INotificationModel
{
public UserBasic()
{
Notifications = new List<Notification>();
UserGroups = new List<UserGroupBasic>();
}
[DataMember(Name = "username")]
public string Username { get; set; }
/// <summary>
/// The MD5 lowercase hash of the email which can be used by gravatar
/// </summary>
[DataMember(Name = "emailHash")]
public string EmailHash { get; set; }
[DataMember(Name = "lastLoginDate")]
public DateTime? LastLoginDate { get; set; }
/// <summary>
/// Returns a list of different size avatars
/// </summary>
[DataMember(Name = "avatars")]
public string[] Avatars { get; set; }
[DataMember(Name = "userState")]
public UserState UserState { get; set; }
[DataMember(Name = "culture", IsRequired = true)]
public string Culture { get; set; }
[DataMember(Name = "email", IsRequired = true)]
public string Email { get; set; }
/// <summary>
/// The list of group aliases assigned to the user
/// </summary>
[DataMember(Name = "userGroups")]
public IEnumerable<UserGroupBasic> UserGroups { get; set; }
/// <summary>
/// This is an info flag to denote if this object is the equivalent of the currently logged in user
/// </summary>
[DataMember(Name = "isCurrentUser")]
[ReadOnly(true)]
public bool IsCurrentUser { 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")]
public List<Notification> Notifications { get; private set; }
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.Serialization;
using Umbraco.Core.Models.Membership;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// The user model used for paging and listing users in the UI
/// </summary>
[DataContract(Name = "user", Namespace = "")]
[ReadOnly(true)]
public class UserBasic : EntityBasic, INotificationModel
{
public UserBasic()
{
Notifications = new List<Notification>();
UserGroups = new List<UserGroupBasic>();
}
[DataMember(Name = "username")]
public string Username { get; set; }
/// <summary>
/// The MD5 lowercase hash of the email which can be used by gravatar
/// </summary>
[DataMember(Name = "emailHash")]
public string EmailHash { get; set; }
[DataMember(Name = "lastLoginDate")]
public DateTime? LastLoginDate { get; set; }
/// <summary>
/// Returns a list of different size avatars
/// </summary>
[DataMember(Name = "avatars")]
public string[] Avatars { get; set; }
[DataMember(Name = "userState")]
public UserState UserState { get; set; }
[DataMember(Name = "culture", IsRequired = true)]
public string Culture { get; set; }
[DataMember(Name = "email", IsRequired = true)]
public string Email { get; set; }
/// <summary>
/// The list of group aliases assigned to the user
/// </summary>
[DataMember(Name = "userGroups")]
public IEnumerable<UserGroupBasic> UserGroups { get; set; }
/// <summary>
/// This is an info flag to denote if this object is the equivalent of the currently logged in user
/// </summary>
[DataMember(Name = "isCurrentUser")]
[ReadOnly(true)]
public bool IsCurrentUser { 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")]
public List<Notification> Notifications { get; private set; }
}
}

View File

@@ -1,63 +1,71 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// Represents information for the current user
/// </summary>
[DataContract(Name = "user", Namespace = "")]
public class UserDetail : UserProfile
{
[DataMember(Name = "email", IsRequired = true)]
[Required]
public string Email { get; set; }
[DataMember(Name = "locale", IsRequired = true)]
[Required]
public string Culture { get; set; }
/// <summary>
/// The MD5 lowercase hash of the email which can be used by gravatar
/// </summary>
[DataMember(Name = "emailHash")]
public string EmailHash { get; set; }
[ReadOnly(true)]
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// Represents information for the current user
/// </summary>
[DataContract(Name = "user", Namespace = "")]
public class UserDetail : UserProfile
{
[DataMember(Name = "email", IsRequired = true)]
[Required]
public string Email { get; set; }
[DataMember(Name = "locale", IsRequired = true)]
[Required]
public string Culture { get; set; }
/// <summary>
/// The MD5 lowercase hash of the email which can be used by gravatar
/// </summary>
[DataMember(Name = "emailHash")]
public string EmailHash { get; set; }
[Obsolete("This should not be used it exists for legacy reasons only, use user groups instead, it will be removed in future versions")]
[EditorBrowsable(EditorBrowsableState.Never)]
[ReadOnly(true)]
[DataMember(Name = "userType")]
public string UserType { get; set; }
[ReadOnly(true)]
[DataMember(Name = "userGroups")]
public string[] UserGroups { get; set; }
/// <summary>
/// Gets/sets the number of seconds for the user's auth ticket to expire
/// </summary>
[DataMember(Name = "remainingAuthSeconds")]
public double SecondsUntilTimeout { get; set; }
/// <summary>
/// Gets/sets the number of seconds for the user's auth ticket to expire
/// </summary>
[DataMember(Name = "remainingAuthSeconds")]
public double SecondsUntilTimeout { get; set; }
/// <summary>
/// The user's calculated start nodes based on the start nodes they have assigned directly to them and via the groups they're assigned to
/// </summary>
[DataMember(Name = "startContentIds")]
public int[] StartContentIds { get; set; }
/// <summary>
/// The user's calculated start nodes based on the start nodes they have assigned directly to them and via the groups they're assigned to
/// </summary>
[DataMember(Name = "startContentIds")]
public int[] StartContentIds { get; set; }
/// <summary>
/// The user's calculated start nodes based on the start nodes they have assigned directly to them and via the groups they're assigned to
/// </summary>
[DataMember(Name = "startMediaIds")]
public int[] StartMediaIds { get; set; }
/// <summary>
/// Returns a list of different size avatars
/// </summary>
[DataMember(Name = "avatars")]
/// <summary>
/// The user's calculated start nodes based on the start nodes they have assigned directly to them and via the groups they're assigned to
/// </summary>
[DataMember(Name = "startMediaIds")]
public int[] StartMediaIds { get; set; }
/// <summary>
/// Returns a list of different size avatars
/// </summary>
[DataMember(Name = "avatars")]
public string[] Avatars { get; set; }
/// <summary>
/// A list of sections the user is allowed to view.
/// </summary>
[DataMember(Name = "allowedSections")]
/// <summary>
/// A list of sections the user is allowed to view.
/// </summary>
[DataMember(Name = "allowedSections")]
public IEnumerable<string> AllowedSections { get; set; }
}
}
}
}

View File

@@ -31,7 +31,7 @@ namespace Umbraco.Web.Models.ContentEditing
/// </summary>
[DataMember(Name = "availableCultures")]
public IDictionary<string, string> AvailableCultures { get; set; }
[DataMember(Name = "startContentIds")]
public IEnumerable<EntityBasic> StartContentIds { get; set; }
@@ -80,4 +80,4 @@ namespace Umbraco.Web.Models.ContentEditing
public DateTime UpdateDate { get; set; }
}
}
}

View File

@@ -34,4 +34,4 @@ namespace Umbraco.Web.Models.ContentEditing
[DataMember(Name = "userCount")]
public int UserCount { get; set; }
}
}
}

Some files were not shown because too many files have changed in this diff Show More