Merge remote-tracking branch 'origin/netcore/dev' into netcore/feature/AB4385-move-content-apps-to-abstractions

This commit is contained in:
Bjarke Berg
2020-01-21 14:29:27 +01:00
179 changed files with 138 additions and 319 deletions

View File

@@ -29,7 +29,6 @@ using Umbraco.Web.Mvc;
using Umbraco.Web.WebApi;
using Umbraco.Web.WebApi.Filters;
using Constants = Umbraco.Core.Constants;
using Notification = Umbraco.Web.Models.ContentEditing.Notification;
using Umbraco.Core.Mapping;
namespace Umbraco.Web.Editors
@@ -599,7 +598,7 @@ namespace Umbraco.Web.Editors
}
else
{
model.Notifications.Add(new Notification(
model.Notifications.Add(new BackOfficeNotification(
Services.TextService.Localize("speechBubbles/operationFailedHeader"),
Services.TextService.Localize("media/disallowedFileType"),
NotificationStyle.Warning));

View File

@@ -18,7 +18,6 @@ using Umbraco.Web.Mvc;
using Umbraco.Web.WebApi;
using Umbraco.Web.WebApi.Filters;
using Constants = Umbraco.Core.Constants;
using Notification = Umbraco.Web.Models.ContentEditing.Notification;
namespace Umbraco.Web.Editors
{
@@ -188,7 +187,7 @@ namespace Umbraco.Web.Editors
var model = Mapper.Map<IDictionaryItem, DictionaryDisplay>(dictionaryItem);
model.Notifications.Add(new Notification(
model.Notifications.Add(new BackOfficeNotification(
Services.TextService.Localize("speechBubbles/dictionaryItemSaved", userCulture), string.Empty,
NotificationStyle.Success));

View File

@@ -213,7 +213,7 @@ namespace Umbraco.Web.Editors
macroDisplay.Notifications.Clear();
macroDisplay.Notifications.Add(new Models.ContentEditing.Notification("Success", "Macro saved", NotificationStyle.Success));
macroDisplay.Notifications.Add(new BackOfficeNotification("Success", "Macro saved", NotificationStyle.Success));
return this.Request.CreateResponse(HttpStatusCode.OK, macroDisplay);
}

View File

@@ -47,7 +47,6 @@ using Umbraco.Web.Mvc;
using Umbraco.Web.WebApi;
using Umbraco.Web.WebApi.Filters;
using Constants = Umbraco.Core.Constants;
using Notification = Umbraco.Web.Models.ContentEditing.Notification;
using Umbraco.Core.Strings;
using Umbraco.Core.Mapping;
@@ -460,7 +459,7 @@ namespace Umbraco.Web.Editors
if (sourceParentID == destinationParentID)
{
return Request.CreateValidationErrorResponse(new SimpleNotificationModel(new Notification("",Services.TextService.Localize("media/moveToSameFolderFailed"),NotificationStyle.Error)));
return Request.CreateValidationErrorResponse(new SimpleNotificationModel(new BackOfficeNotification("",Services.TextService.Localize("media/moveToSameFolderFailed"),NotificationStyle.Error)));
}
if (moveResult == false)
{
@@ -773,7 +772,7 @@ namespace Umbraco.Web.Editors
}
else
{
tempFiles.Notifications.Add(new Notification(
tempFiles.Notifications.Add(new BackOfficeNotification(
Services.TextService.Localize("speechBubbles/operationFailedHeader"),
Services.TextService.Localize("media/disallowedFileType"),
NotificationStyle.Warning));
@@ -864,7 +863,7 @@ namespace Umbraco.Web.Editors
{
throw new HttpResponseException(Request.CreateResponse(
HttpStatusCode.Forbidden,
new SimpleNotificationModel(new Notification(
new SimpleNotificationModel(new BackOfficeNotification(
Services.TextService.Localize("speechBubbles/operationFailedHeader"),
Services.TextService.Localize("speechBubbles/invalidUserPermissionsText"),
NotificationStyle.Warning))));

View File

@@ -11,6 +11,7 @@ using Umbraco.Core.Cache;
using Umbraco.Web.Composing;
using Umbraco.Core.Configuration;
using Umbraco.Core.Logging;
using Umbraco.Core.Mapping;
using Umbraco.Core.Models.Editors;
using Umbraco.Core.Models.Packaging;
using Umbraco.Core.Packaging;
@@ -24,8 +25,6 @@ using Umbraco.Web.Mvc;
using Umbraco.Web.WebApi;
using Umbraco.Web.WebApi.Filters;
using File = System.IO.File;
using Notification = Umbraco.Web.Models.ContentEditing.Notification;
using Umbraco.Core.Mapping;
namespace Umbraco.Web.Editors
{
@@ -194,7 +193,7 @@ namespace Umbraco.Web.Editors
}
else
{
model.Notifications.Add(new Notification(
model.Notifications.Add(new BackOfficeNotification(
Services.TextService.Localize("speechBubbles/operationFailedHeader"),
Services.TextService.Localize("media/disallowedFileType"),
NotificationStyle.Warning));

View File

@@ -1,7 +0,0 @@
namespace Umbraco.Web.Models
{
public class AnchorsModel
{
public string RteContent { get; set; }
}
}

View File

@@ -1,44 +0,0 @@
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models
{
/// <summary>
/// A model representing a tour.
/// </summary>
[DataContract(Name = "tour", Namespace = "")]
public class BackOfficeTour
{
public BackOfficeTour()
{
RequiredSections = new List<string>();
}
[DataMember(Name = "name")]
public string Name { get; set; }
[DataMember(Name = "alias")]
public string Alias { get; set; }
[DataMember(Name = "group")]
public string Group { get; set; }
[DataMember(Name = "groupOrder")]
public int GroupOrder { get; set; }
[DataMember(Name = "hidden")]
public bool Hidden { get; set; }
[DataMember(Name = "allowDisable")]
public bool AllowDisable { get; set; }
[DataMember(Name = "requiredSections")]
public List<string> RequiredSections { get; set; }
[DataMember(Name = "steps")]
public BackOfficeTourStep[] Steps { get; set; }
[DataMember(Name = "culture")]
public string Culture { get; set; }
}
}

View File

@@ -1,35 +0,0 @@
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models
{
/// <summary>
/// A model representing the file used to load a tour.
/// </summary>
[DataContract(Name = "tourFile", Namespace = "")]
public class BackOfficeTourFile
{
public BackOfficeTourFile()
{
Tours = new List<BackOfficeTour>();
}
/// <summary>
/// The file name for the tour
/// </summary>
[DataMember(Name = "fileName")]
public string FileName { get; set; }
/// <summary>
/// The plugin folder that the tour comes from
/// </summary>
/// <remarks>
/// If this is null it means it's a Core tour
/// </remarks>
[DataMember(Name = "pluginName")]
public string PluginName { get; set; }
[DataMember(Name = "tours")]
public IEnumerable<BackOfficeTour> Tours { get; set; }
}
}

View File

@@ -1,33 +0,0 @@
using System.Runtime.Serialization;
using Newtonsoft.Json.Linq;
namespace Umbraco.Web.Models
{
/// <summary>
/// A model representing a step in a tour.
/// </summary>
[DataContract(Name = "step", Namespace = "")]
public class BackOfficeTourStep
{
[DataMember(Name = "title")]
public string Title { get; set; }
[DataMember(Name = "content")]
public string Content { get; set; }
[DataMember(Name = "type")]
public string Type { get; set; }
[DataMember(Name = "element")]
public string Element { get; set; }
[DataMember(Name = "elementPreventClick")]
public bool ElementPreventClick { get; set; }
[DataMember(Name = "backdropOpacity")]
public float? BackdropOpacity { get; set; }
[DataMember(Name = "event")]
public string Event { get; set; }
[DataMember(Name = "view")]
public string View { get; set; }
[DataMember(Name = "eventElement")]
public string EventElement { get; set; }
[DataMember(Name = "customProperties")]
public JObject CustomProperties { get; set; }
}
}

View File

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

View File

@@ -1,21 +0,0 @@
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// The permissions assigned to a content node
/// </summary>
/// <remarks>
/// The underlying <see cref="EntityBasic"/> data such as Name, etc... is that of the Content item
/// </remarks>
[DataContract(Name = "contentPermissions", Namespace = "")]
public class AssignedContentPermissions : EntityBasic
{
/// <summary>
/// The assigned permissions to the content item organized by permission group name
/// </summary>
[DataMember(Name = "permissions")]
public IDictionary<string, IEnumerable<Permission>> AssignedPermissions { get; set; }
}
}

View File

@@ -1,38 +0,0 @@
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// The user group permissions assigned to a content node
/// </summary>
/// <remarks>
/// The underlying <see cref="EntityBasic"/> data such as Name, etc... is that of the User Group
/// </remarks>
[DataContract(Name = "userGroupPermissions", Namespace = "")]
public class AssignedUserGroupPermissions : EntityBasic
{
/// <summary>
/// The assigned permissions for the user group organized by permission group name
/// </summary>
[DataMember(Name = "permissions")]
public IDictionary<string, IEnumerable<Permission>> AssignedPermissions { get; set; }
/// <summary>
/// The default permissions for the user group organized by permission group name
/// </summary>
[DataMember(Name = "defaultPermissions")]
public IDictionary<string, IEnumerable<Permission>> DefaultPermissions { get; set; }
public static IDictionary<string, IEnumerable<Permission>> ClonePermissions(IDictionary<string, IEnumerable<Permission>> permissions)
{
var result = new Dictionary<string, IEnumerable<Permission>>();
foreach (var permission in permissions)
{
result[permission.Key] = new List<Permission>(permission.Value.Select(x => (Permission)x.Clone()));
}
return result;
}
}
}

View File

@@ -1,36 +0,0 @@
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")]
public string[] UserAvatars { 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; }
}
}

View File

@@ -1,80 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
using Umbraco.Core;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "scriptFile", Namespace = "")]
public class CodeFileDisplay : INotificationModel, IValidatableObject
{
public CodeFileDisplay()
{
Notifications = new List<Notification>();
}
/// <summary>
/// VirtualPath is the path to the file on disk
/// /views/partials/file.cshtml
/// </summary>
[DataMember(Name = "virtualPath", IsRequired = true)]
public string VirtualPath { get; set; }
/// <summary>
/// Path represents the path used by the backoffice tree
/// For files stored on disk, this is a urlencoded, comma separated
/// path to the file, always starting with -1.
///
/// -1,Partials,Parials%2FFolder,Partials%2FFolder%2FFile.cshtml
/// </summary>
[DataMember(Name = "path")]
[ReadOnly(true)]
public string Path { get; set; }
[DataMember(Name = "name", IsRequired = true)]
public string Name { get; set; }
[DataMember(Name = "content", IsRequired = true)]
public string Content { get; set; }
[DataMember(Name = "fileType", IsRequired = true)]
public string FileType { get; set; }
[DataMember(Name = "snippet")]
[ReadOnly(true)]
public string Snippet { get; set; }
[DataMember(Name = "id")]
[ReadOnly(true)]
public string Id { get; set; }
public List<Notification> Notifications { get; private set; }
/// <summary>
/// Some custom validation is required for valid file names
/// </summary>
/// <param name="validationContext"></param>
/// <returns></returns>
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
var illegalChars = System.IO.Path.GetInvalidFileNameChars();
if (Name.ContainsAny(illegalChars))
{
yield return new ValidationResult(
"The file name cannot contain illegal characters",
new[] { "Name" });
}
else if (System.IO.Path.GetFileNameWithoutExtension(Name).IsNullOrWhiteSpace())
{
yield return new ValidationResult(
"The file name cannot be empty",
new[] { "Name" });
}
}
}
}

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,105 +0,0 @@
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; }
public int ContentTypeId { 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;
}
}
}

View File

@@ -1,217 +0,0 @@
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>
/// Indicates if the content is configured as an element
/// </summary>
[DataMember(Name = "isElement")]
public bool IsElement { 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 = "contentTypeId")]
public int ContentTypeId { 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; }
}
}

View File

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

View File

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

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,27 +0,0 @@
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 IsRequiredMessage { get; set; }
public string ValidationRegExp { get; set; }
public string ValidationRegExpMessage { get; set; }
}
}

View File

@@ -1,27 +0,0 @@
using System;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "contentRedirectUrl", Namespace = "")]
public class ContentRedirectUrl
{
[DataMember(Name = "redirectId")]
public Guid RedirectId { get; set; }
[DataMember(Name = "originalUrl")]
public string OriginalUrl { get; set; }
[DataMember(Name = "destinationUrl")]
public string DestinationUrl { get; set; }
[DataMember(Name = "createDateUtc")]
public DateTime CreateDateUtc { get; set; }
[DataMember(Name = "contentId")]
public int ContentId { get; set; }
[DataMember(Name = "culture")]
public string Culture { get; set; }
}
}

View File

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

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 +0,0 @@
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 hierarchy!!
/// </remarks>
[DataMember(Name = "idSortOrder", IsRequired = true)]
[Required]
public int[] IdSortOrder { get; set; }
}
}

View File

@@ -1,125 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
using Umbraco.Core;
using Umbraco.Web.Composing;
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>
[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}", Current.Configs.Global().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
: Current.IOHelper.ResolveUrl("~/umbraco/images/thumbnails/" + Thumbnail);
}
}
[DataMember(Name = "blueprints")]
[ReadOnly(true)]
public IDictionary<int, string> Blueprints { get; set; }
[DataMember(Name = "isContainer")]
[ReadOnly(true)]
public bool IsContainer { get; set; }
[DataMember(Name = "isElement")]
[ReadOnly(true)]
public bool IsElement { get; set; }
}
}

View File

@@ -1,74 +0,0 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
public abstract class ContentTypeCompositionDisplay : ContentTypeBasic, INotificationModel
{
protected ContentTypeCompositionDisplay()
{
//initialize collections so at least their never null
AllowedContentTypes = new List<int>();
CompositeContentTypes = new List<string>();
Notifications = new List<Notification>();
}
//name, alias, icon, thumb, desc, inherited from basic
[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")]
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)]
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; }
}
[DataContract(Name = "contentType", Namespace = "")]
public abstract class ContentTypeCompositionDisplay<TPropertyTypeDisplay> : ContentTypeCompositionDisplay
where TPropertyTypeDisplay : PropertyTypeDisplay
{
protected ContentTypeCompositionDisplay()
{
//initialize collections so at least their never null
Groups = new List<PropertyGroupDisplay<TPropertyTypeDisplay>>();
}
//Tabs
[DataMember(Name = "groups")]
public IEnumerable<PropertyGroupDisplay<TPropertyTypeDisplay>> Groups { get; set; }
}
}

View File

@@ -1,114 +0,0 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.Serialization;
using Umbraco.Core;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// Abstract model used to save content types
/// </summary>
[DataContract(Name = "contentType", Namespace = "")]
public abstract class ContentTypeSave : ContentTypeBasic, IValidatableObject
{
protected ContentTypeSave()
{
AllowedContentTypes = new List<int>();
CompositeContentTypes = new List<string>();
}
//Compositions
[DataMember(Name = "compositeContentTypes")]
public IEnumerable<string> CompositeContentTypes { get; set; }
[DataMember(Name = "isContainer")]
public bool IsContainer { get; set; }
[DataMember(Name = "isElement")]
public bool IsElement { get; set; }
[DataMember(Name = "allowAsRoot")]
public bool AllowAsRoot { get; set; }
//Allowed child types
[DataMember(Name = "allowedContentTypes")]
public IEnumerable<int> AllowedContentTypes { get; set; }
/// <summary>
/// Custom validation
/// </summary>
/// <param name="validationContext"></param>
/// <returns></returns>
public virtual IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
if (CompositeContentTypes.Any(x => x.IsNullOrWhiteSpace()))
yield return new ValidationResult("Composite Content Type value cannot be null", new[] {"CompositeContentTypes"});
}
}
/// <summary>
/// Abstract model used to save content types
/// </summary>
/// <typeparam name="TPropertyType"></typeparam>
[DataContract(Name = "contentType", Namespace = "")]
public abstract class ContentTypeSave<TPropertyType> : ContentTypeSave
where TPropertyType : PropertyTypeBasic
{
protected ContentTypeSave()
{
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; }
/// <summary>
/// Custom validation
/// </summary>
/// <param name="validationContext"></param>
/// <returns></returns>
public override IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
foreach (var validationResult in base.Validate(validationContext))
{
yield return validationResult;
}
var duplicateGroups = Groups.GroupBy(x => x.Name).Where(x => x.Count() > 1).ToArray();
if (duplicateGroups.Any())
{
//we need to return the field name with an index so it's wired up correctly
var lastIndex = Groups.IndexOf(duplicateGroups.Last().Last());
yield return new ValidationResult("Duplicate group names not allowed", new[]
{
string.Format("Groups[{0}].Name", lastIndex)
});
}
var duplicateProperties = Groups.SelectMany(x => x.Properties).Where(x => x.Inherited == false).GroupBy(x => x.Alias).Where(x => x.Count() > 1).ToArray();
if (duplicateProperties.Any())
{
//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));
yield return new ValidationResult("Duplicate property aliases not allowed: " + lastProperty.Alias, new[]
{
string.Format("Groups[{0}].Properties[{1}].Alias", propertyGroup.SortOrder, lastProperty.SortOrder)
});
}
}
}
}

View File

@@ -1,74 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
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")]
[MaxLength(255, ErrorMessage ="Name must be less than 255 characters")]
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>
/// The segment of this variant, if this is invariant than this is null or empty
/// </summary>
[DataMember(Name = "segment")]
public string Segment { 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 messages 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,27 +0,0 @@
using System.ComponentModel;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// The basic data type information
/// </summary>
[DataContract(Name = "dataType", Namespace = "")]
public class DataTypeBasic : EntityBasic
{
/// <summary>
/// Whether or not this is a system data type, in which case it cannot be deleted
/// </summary>
[DataMember(Name = "isSystem")]
[ReadOnly(true)]
public bool IsSystemDataType { get; set; }
[DataMember(Name = "group")]
[ReadOnly(true)]
public string Group { get; set; }
[DataMember(Name = "hasPrevalues")]
[ReadOnly(true)]
public bool HasPrevalues { get; set; }
}
}

View File

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

View File

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

View File

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

View File

@@ -1,36 +0,0 @@
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "dataTypeReferences", Namespace = "")]
public class DataTypeReferences
{
[DataMember(Name = "documentTypes")]
public IEnumerable<ContentTypeReferences> DocumentTypes { get; set; } = Enumerable.Empty<ContentTypeReferences>();
[DataMember(Name = "mediaTypes")]
public IEnumerable<ContentTypeReferences> MediaTypes { get; set; } = Enumerable.Empty<ContentTypeReferences>();
[DataMember(Name = "memberTypes")]
public IEnumerable<ContentTypeReferences> MemberTypes { get; set; } = Enumerable.Empty<ContentTypeReferences>();
[DataContract(Name = "contentType", Namespace = "")]
public class ContentTypeReferences : EntityBasic
{
[DataMember(Name = "properties")]
public object Properties { get; set; }
[DataContract(Name = "property", Namespace = "")]
public class PropertyTypeReferences
{
[DataMember(Name = "name")]
public string Name { get; set; }
[DataMember(Name = "alias")]
public string Alias { get; set; }
}
}
}
}

View File

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

View File

@@ -1,41 +0,0 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// The dictionary display model
/// </summary>
[DataContract(Name = "dictionary", Namespace = "")]
public class DictionaryDisplay : EntityBasic, INotificationModel
{
/// <summary>
/// Initializes a new instance of the <see cref="DictionaryDisplay"/> class.
/// </summary>
public DictionaryDisplay()
{
this.Notifications = new List<Notification>();
this.Translations = new List<DictionaryTranslationDisplay>();
}
/// <inheritdoc />
/// <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; }
/// <summary>
/// Gets or sets the parent id.
/// </summary>
[DataMember(Name = "parentId")]
public new Guid ParentId { get; set; }
/// <summary>
/// Gets the translations.
/// </summary>
[DataMember(Name = "translations")]
public List<DictionaryTranslationDisplay> Translations { get; private set; }
}
}

View File

@@ -1,44 +0,0 @@
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// The dictionary overview display.
/// </summary>
[DataContract(Name = "dictionary", Namespace = "")]
public class DictionaryOverviewDisplay
{
/// <summary>
/// Initializes a new instance of the <see cref="DictionaryOverviewDisplay"/> class.
/// </summary>
public DictionaryOverviewDisplay()
{
Translations = new List<DictionaryOverviewTranslationDisplay>();
}
/// <summary>
/// Gets or sets the key.
/// </summary>
[DataMember(Name = "name")]
public string Name { get; set; }
/// <summary>
/// Gets or sets the id.
/// </summary>
[DataMember(Name = "id")]
public int Id { get; set; }
/// <summary>
/// Gets or sets the level.
/// </summary>
[DataMember(Name = "level")]
public int Level { get; set; }
/// <summary>
/// Gets or sets the translations.
/// </summary>
[DataMember(Name = "translations")]
public List<DictionaryOverviewTranslationDisplay> Translations { get; set; }
}
}

View File

@@ -1,23 +0,0 @@
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// The dictionary translation overview display.
/// </summary>
[DataContract(Name = "dictionaryTranslation", Namespace = "")]
public class DictionaryOverviewTranslationDisplay
{
/// <summary>
/// Gets or sets the display name.
/// </summary>
[DataMember(Name = "displayName")]
public string DisplayName { get; set; }
/// <summary>
/// Gets or sets a value indicating whether has translation.
/// </summary>
[DataMember(Name = "hasTranslation")]
public bool HasTranslation { get; set; }
}
}

View File

@@ -1,39 +0,0 @@
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// Dictionary Save model
/// </summary>
[DataContract(Name = "dictionary", Namespace = "")]
public class DictionarySave : EntityBasic
{
/// <summary>
/// Initializes a new instance of the <see cref="DictionarySave"/> class.
/// </summary>
public DictionarySave()
{
this.Translations = new List<DictionaryTranslationSave>();
}
/// <summary>
/// Gets or sets a value indicating whether name is dirty.
/// </summary>
[DataMember(Name = "nameIsDirty")]
public bool NameIsDirty { get; set; }
/// <summary>
/// Gets the translations.
/// </summary>
[DataMember(Name = "translations")]
public List<DictionaryTranslationSave> Translations { get; private set; }
/// <summary>
/// Gets or sets the parent id.
/// </summary>
[DataMember(Name = "parentId")]
public new Guid ParentId { get; set; }
}
}

View File

@@ -1,18 +0,0 @@
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
/// <inheritdoc />
/// <summary>
/// The dictionary translation display model
/// </summary>
[DataContract(Name = "dictionaryTranslation", Namespace = "")]
public class DictionaryTranslationDisplay : DictionaryTranslationSave
{
/// <summary>
/// Gets or sets the display name.
/// </summary>
[DataMember(Name = "displayName")]
public string DisplayName { get; set; }
}
}

View File

@@ -1,29 +0,0 @@
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// The dictionary translation save model
/// </summary>
[DataContract(Name = "dictionaryTranslation", Namespace = "")]
public class DictionaryTranslationSave
{
/// <summary>
/// Gets or sets the ISO code.
/// </summary>
[DataMember(Name = "isoCode")]
public string IsoCode { get; set; }
/// <summary>
/// Gets or sets the translation.
/// </summary>
[DataMember(Name = "translation")]
public string Translation { get; set; }
/// <summary>
/// Gets or sets the language id.
/// </summary>
[DataMember(Name = "languageId")]
public int LanguageId { get; set; }
}
}

View File

@@ -1,28 +0,0 @@
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "contentType", Namespace = "")]
public class DocumentTypeDisplay : ContentTypeCompositionDisplay<PropertyTypeDisplay>
{
public DocumentTypeDisplay()
{
//initialize collections so at least their never null
AllowedTemplates = new List<EntityBasic>();
}
//name, alias, icon, thumb, desc, inherited from the content type
// Templates
[DataMember(Name = "allowedTemplates")]
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,43 +0,0 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.Serialization;
using Umbraco.Core;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// Model used to save a document type
/// </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>
[DataMember(Name = "defaultTemplate")]
public string DefaultTemplate { get; set; }
/// <summary>
/// Custom validation
/// </summary>
/// <param name="validationContext"></param>
/// <returns></returns>
public override IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
if (AllowedTemplates.Any(x => x.IsNullOrWhiteSpace()))
yield return new ValidationResult("Template value cannot be null", new[] { "AllowedTemplates" });
foreach (var v in base.Validate(validationContext))
{
yield return v;
}
}
}
}

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,26 +0,0 @@
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// A model representing the navigation ("apps") inside an editor in the back office
/// </summary>
[DataContract(Name = "user", Namespace = "")]
public class EditorNavigation
{
[DataMember(Name = "name")]
public string Name { get; set; }
[DataMember(Name = "alias")]
public string Alias { get; set; }
[DataMember(Name = "icon")]
public string Icon { get; set; }
[DataMember(Name = "view")]
public string View { get; set; }
[DataMember(Name = "active")]
public bool Active { get; set; }
}
}

View File

@@ -1,75 +0,0 @@
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>
/// It is possible to override this 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,25 +0,0 @@
namespace Umbraco.Web.Models.ContentEditing
{
public class GetAvailableCompositionsFilter
{
public int ContentTypeId { get; set; }
/// <summary>
/// This is normally an empty list but if additional property type aliases are passed in, any content types that have these aliases will be filtered out.
/// This is required because in the case of creating/modifying a content type because new property types being added to it are not yet persisted so cannot
/// be looked up via the db, they need to be passed in.
/// </summary>
public string[] FilterPropertyTypes { get; set; }
/// <summary>
/// This is normally an empty list but if additional content type aliases are passed in, any content types containing those aliases will be filtered out
/// along with any content types that have matching property types that are included in the filtered content types
/// </summary>
public string[] FilterContentTypes { get; set; }
/// <summary>
/// Wether the content type is currently marked as an element type
/// </summary>
public bool IsElement { 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 +0,0 @@
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 +0,0 @@
using System.Collections.Generic;
using Umbraco.Core.Models.Editors;
namespace Umbraco.Web.Models.ContentEditing
{
public interface IHaveUploadedFiles
{
List<ContentPropertyFile> UploadedFiles { get; }
}
}

View File

@@ -1,14 +0,0 @@
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,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,33 +0,0 @@
using System.Runtime.Serialization;
using Umbraco.Core;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "link", Namespace = "")]
internal class LinkDisplay
{
[DataMember(Name = "icon")]
public string Icon { get; set; }
[DataMember(Name = "name")]
public string Name { get; set; }
[DataMember(Name = "published")]
public bool Published { get; set; }
[DataMember(Name = "queryString")]
public string QueryString { get; set; }
[DataMember(Name = "target")]
public string Target { get; set; }
[DataMember(Name = "trashed")]
public bool Trashed { get; set; }
[DataMember(Name = "udi")]
public GuidUdi Udi { get; set; }
[DataMember(Name = "url")]
public string Url { get; set; }
}
}

View File

@@ -1,29 +0,0 @@
using System.Runtime.Serialization;
using Umbraco.Core.Models;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// 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>
where T : ContentPropertyBasic
{
/// <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; }
}
}

View File

@@ -1,67 +0,0 @@
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// The macro display model
/// </summary>
[DataContract(Name = "dictionary", Namespace = "")]
public class MacroDisplay : EntityBasic, INotificationModel
{
/// <summary>
/// Initializes a new instance of the <see cref="MacroDisplay"/> class.
/// </summary>
public MacroDisplay()
{
this.Notifications = new List<Notification>();
this.Parameters = new List<MacroParameterDisplay>();
}
/// <inheritdoc />
[DataMember(Name = "notifications")]
public List<Notification> Notifications { get; }
/// <summary>
/// Gets or sets a value indicating whether the macro can be used in a rich text editor.
/// </summary>
[DataMember(Name = "useInEditor")]
public bool UseInEditor { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the macro should be rendered a rich text editor.
/// </summary>
[DataMember(Name = "renderInEditor")]
public bool RenderInEditor { get; set; }
/// <summary>
/// Gets or sets the cache period.
/// </summary>
[DataMember(Name = "cachePeriod")]
public int CachePeriod { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the macro should be cached by page
/// </summary>
[DataMember(Name = "cacheByPage")]
public bool CacheByPage { get; set; }
/// <summary>
/// Gets or sets a value indicating whether the macro should be cached by user
/// </summary>
[DataMember(Name = "cacheByUser")]
public bool CacheByUser { get; set; }
/// <summary>
/// Gets or sets the view.
/// </summary>
[DataMember(Name = "view")]
public string View { get; set; }
/// <summary>
/// Gets or sets the parameters.
/// </summary>
[DataMember(Name = "parameters")]
public IEnumerable<MacroParameterDisplay> Parameters { get; set; }
}
}

View File

@@ -1,48 +0,0 @@
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,35 +0,0 @@
namespace Umbraco.Web.Models.ContentEditing
{
using System.Runtime.Serialization;
/// <summary>
/// The macro parameter display.
/// </summary>
[DataContract(Name = "parameter", Namespace = "")]
public class MacroParameterDisplay
{
/// <summary>
/// Gets or sets the key.
/// </summary>
[DataMember(Name = "key")]
public string Key { get; set; }
/// <summary>
/// Gets or sets the label.
/// </summary>
[DataMember(Name = "label")]
public string Label { get; set; }
/// <summary>
/// Gets or sets the editor.
/// </summary>
[DataMember(Name = "editor")]
public string Editor { get; set; }
/// <summary>
/// Gets or sets the id.
/// </summary>
[DataMember(Name = "id")]
public int Id { get; set; }
}
}

View File

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

View File

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

View File

@@ -1,10 +0,0 @@
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "contentType", Namespace = "")]
public class MediaTypeDisplay : ContentTypeCompositionDisplay<PropertyTypeDisplay>
{
}
}

View File

@@ -1,12 +0,0 @@
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// Model used to save a media type
/// </summary>
[DataContract(Name = "contentType", Namespace = "")]
public class MediaTypeSave : ContentTypeSave<PropertyTypeBasic>
{
}
}

View File

@@ -1,17 +0,0 @@
using System.Runtime.Serialization;
using Umbraco.Core.Models;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// Used for basic member information
/// </summary>
public class MemberBasic : ContentItemBasic<ContentPropertyBasic>
{
[DataMember(Name = "username")]
public string Username { get; set; }
[DataMember(Name = "email")]
public string Email { get; set; }
}
}

View File

@@ -1,41 +0,0 @@
using System.Collections.Generic;
using System.Runtime.Serialization;
using Umbraco.Core.Models;
using Umbraco.Core.Models.ContentEditing;
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>();
ContentApps = new List<ContentApp>();
}
[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; }
[DataMember(Name = "apps")]
public IEnumerable<ContentApp> ContentApps { 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,17 +0,0 @@
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 member list to be displayed in the back office
/// </summary>
[DataContract(Name = "content", Namespace = "")]
public class MemberListDisplay : ContentItemDisplayBase<ContentPropertyDisplay>
{
[DataMember(Name = "apps")]
public IEnumerable<ContentApp> ContentApps { get; set; }
}
}

View File

@@ -1,20 +0,0 @@
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// Basic member property type
/// </summary>
[DataContract(Name = "contentType", Namespace = "")]
public class MemberPropertyTypeBasic : PropertyTypeBasic
{
[DataMember(Name = "showOnMemberProfile")]
public bool MemberCanViewProperty { get; set; }
[DataMember(Name = "memberCanEdit")]
public bool MemberCanEditProperty { get; set; }
[DataMember(Name = "isSensitiveData")]
public bool IsSensitiveData { get; set; }
}
}

View File

@@ -1,17 +0,0 @@
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "propertyType")]
public class MemberPropertyTypeDisplay : PropertyTypeDisplay
{
[DataMember(Name = "showOnMemberProfile")]
public bool MemberCanViewProperty { get; set; }
[DataMember(Name = "memberCanEdit")]
public bool MemberCanEditProperty { get; set; }
[DataMember(Name = "isSensitiveData")]
public bool IsSensitiveData { get; set; }
}
}

View File

@@ -1,57 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.Serialization;
using Newtonsoft.Json.Linq;
using Umbraco.Core.Models;
using Umbraco.Core.Models.Editors;
using Umbraco.Core.Models.Validation;
using Umbraco.Web.WebApi.Filters;
using Umbraco.Core;
namespace Umbraco.Web.Models.ContentEditing
{
/// <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")]
[EmailAddress]
public string Email { get; set; }
[DataMember(Name = "password")]
public ChangingPasswordModel Password { get; set; }
[DataMember(Name = "memberGroups")]
public IEnumerable<string> Groups { get; set; }
/// <summary>
/// Returns the value from the Comments property
/// </summary>
public string Comments => GetPropertyValue<string>(Constants.Conventions.Member.Comments);
/// <summary>
/// Returns the value from the IsLockedOut property
/// </summary>
public bool IsLockedOut => GetPropertyValue<bool>(Constants.Conventions.Member.IsLockedOut);
/// <summary>
/// Returns the value from the IsApproved property
/// </summary>
public bool IsApproved => GetPropertyValue<bool>(Constants.Conventions.Member.IsApproved);
private T GetPropertyValue<T>(string alias)
{
var prop = Properties.FirstOrDefault(x => x.Alias == alias);
if (prop == null) return default;
var converted = prop.Value.TryConvertTo<T>();
return converted.ResultOr(default);
}
}
}

View File

@@ -1,10 +0,0 @@
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "contentType", Namespace = "")]
public class MemberTypeDisplay : ContentTypeCompositionDisplay<MemberPropertyTypeDisplay>
{
}
}

View File

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

View File

@@ -1,71 +0,0 @@

using System.Linq;
using Umbraco.Core;
namespace Umbraco.Web.Models.ContentEditing
{
public static class MessagesExtensions
{
public static void AddNotification(this INotificationModel model, string header, string msg, NotificationStyle type)
{
if (model.Exists(header, msg, type)) return;
model.Notifications.Add(new Notification()
{
Header = header,
Message = msg,
NotificationType = type
});
}
public static void AddSuccessNotification(this INotificationModel model, string header, string msg)
{
if (model.Exists(header, msg, NotificationStyle.Success)) return;
model.Notifications.Add(new Notification()
{
Header = header,
Message = msg,
NotificationType = NotificationStyle.Success
});
}
public static void AddErrorNotification(this INotificationModel model, string header, string msg)
{
if (model.Exists(header, msg, NotificationStyle.Error)) return;
model.Notifications.Add(new Notification()
{
Header = header,
Message = msg,
NotificationType = NotificationStyle.Error
});
}
public static void AddWarningNotification(this INotificationModel model, string header, string msg)
{
if (model.Exists(header, msg, NotificationStyle.Warning)) return;
model.Notifications.Add(new Notification()
{
Header = header,
Message = msg,
NotificationType = NotificationStyle.Warning
});
}
public static void AddInfoNotification(this INotificationModel model, string header, string msg)
{
if (model.Exists(header, msg, NotificationStyle.Info)) return;
model.Notifications.Add(new Notification()
{
Header = header,
Message = msg,
NotificationType = NotificationStyle.Info
});
}
private static bool Exists(this INotificationModel model, string header, string message, NotificationStyle notificationType) => model.Notifications.Any(x => x.Header.InvariantEquals(header) && x.Message.InvariantEquals(message) && x.NotificationType == notificationType);
}
}

View File

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

View File

@@ -1,30 +0,0 @@
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "notification", Namespace = "")]
public class Notification
{
public Notification()
{
}
public Notification(string header, string message, NotificationStyle 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 NotificationStyle NotificationType { get; set; }
}
}

View File

@@ -1,26 +0,0 @@
namespace Umbraco.Web.Models.ContentEditing
{
public enum NotificationStyle
{
/// <summary>
/// Save icon
/// </summary>
Save = 0,
/// <summary>
/// Info icon
/// </summary>
Info = 1,
/// <summary>
/// Error icon
/// </summary>
Error = 2,
/// <summary>
/// Success icon
/// </summary>
Success = 3,
/// <summary>
/// Warning icon
/// </summary>
Warning = 4
}
}

View File

@@ -1,19 +0,0 @@
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "notifySetting", Namespace = "")]
public class NotifySetting
{
[DataMember(Name = "name")]
public string Name { get; set; }
[DataMember(Name = "checked")]
public bool Checked { get; set; }
/// <summary>
/// The letter from the IAction
/// </summary>
[DataMember(Name = "notifyCode")]
public string NotifyCode { get; set; }
}
}

View File

@@ -1,15 +0,0 @@
using System;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "objectType", Namespace = "")]
public class ObjectType
{
[DataMember(Name = "name")]
public string Name { get; set; }
[DataMember(Name = "id")]
public Guid Id { get; set; }
}
}

View File

@@ -1,38 +0,0 @@
using System;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "permission", Namespace = "")]
public class Permission : ICloneable
{
[DataMember(Name = "name")]
public string Name { get; set; }
[DataMember(Name = "description")]
public string Description { get; set; }
[DataMember(Name = "checked")]
public bool Checked { get; set; }
[DataMember(Name = "icon")]
public string Icon { get; set; }
/// <summary>
/// We'll use this to map the categories but it wont' be returned in the json
/// </summary>
[IgnoreDataMember]
internal string Category { get; set; }
/// <summary>
/// The letter from the IAction
/// </summary>
[DataMember(Name = "permissionCode")]
public string PermissionCode { get; set; }
public object Clone()
{
return this.MemberwiseClone();
}
}
}

View File

@@ -1,24 +0,0 @@
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
/// temporary files that were created.
/// </summary>
[DataContract]
internal class PostedFiles : IHaveUploadedFiles, INotificationModel
{
public PostedFiles()
{
UploadedFiles = new List<ContentPropertyFile>();
Notifications = new List<Notification>();
}
public List<ContentPropertyFile> UploadedFiles { get; private set; }
[DataMember(Name = "notifications")]
public List<Notification> Notifications { get; private set; }
}
}

View File

@@ -1,17 +0,0 @@
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
/// <summary>
/// Used to create a folder with the MediaController
/// </summary>
[DataContract]
public class PostedFolder
{
[DataMember(Name = "parentId")]
public string ParentId { get; set; }
[DataMember(Name = "name")]
public string Name { get; set; }
}
}

View File

@@ -1,21 +0,0 @@
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,55 +0,0 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "propertyGroup", Namespace = "")]
public abstract class PropertyGroupBasic
{
/// <summary>
/// Gets the special generic properties tab identifier.
/// </summary>
public const int GenericPropertiesGroupId = -666;
/// <summary>
/// Gets a value indicating whether this tab is the generic properties tab.
/// </summary>
[IgnoreDataMember]
public bool IsGenericProperties => Id == GenericPropertiesGroupId;
/// <summary>
/// Gets a value indicating whether the property group is inherited through
/// content types composition.
/// </summary>
/// <remarks>A property group can be inherited and defined on the content type
/// currently being edited, at the same time. Inherited is true when there exists at least
/// one property group higher in the composition, with the same alias.</remarks>
[DataMember(Name = "inherited")]
public bool Inherited { get; set; }
// needed - so we can handle alias renames
[DataMember(Name = "id")]
public int Id { get; set; }
[DataMember(Name = "sortOrder")]
public int SortOrder { get; set; }
[Required]
[DataMember(Name = "name")]
public string Name { get; set; }
}
[DataContract(Name = "propertyGroup", Namespace = "")]
public class PropertyGroupBasic<TPropertyType> : PropertyGroupBasic
where TPropertyType: PropertyTypeBasic
{
public PropertyGroupBasic()
{
Properties = new List<TPropertyType>();
}
[DataMember(Name = "properties")]
public IEnumerable<TPropertyType> Properties { get; set; }
}
}

View File

@@ -1,39 +0,0 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "propertyGroup", Namespace = "")]
public class PropertyGroupDisplay<TPropertyTypeDisplay> : PropertyGroupBasic<TPropertyTypeDisplay>
where TPropertyTypeDisplay : PropertyTypeDisplay
{
public PropertyGroupDisplay()
{
Properties = new List<TPropertyTypeDisplay>();
ParentTabContentTypeNames = new List<string>();
ParentTabContentTypes = new List<int>();
}
/// <summary>
/// Gets the context content type.
/// </summary>
[DataMember(Name = "contentTypeId")]
[ReadOnly(true)]
public int ContentTypeId { get; set; }
/// <summary>
/// Gets the identifiers of the content types that define this group.
/// </summary>
[DataMember(Name = "parentTabContentTypes")]
[ReadOnly(true)]
public IEnumerable<int> ParentTabContentTypes { get; set; }
/// <summary>
/// Gets the name of the content types that define this group.
/// </summary>
[DataMember(Name = "parentTabContentTypeNames")]
[ReadOnly(true)]
public IEnumerable<string> ParentTabContentTypeNames { get; set; }
}
}

View File

@@ -1,58 +0,0 @@
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "propertyType")]
public class PropertyTypeBasic
{
/// <summary>
/// Gets a value indicating whether the property type is inherited through
/// content types composition.
/// </summary>
/// <remarks>Inherited is true when the property is defined by a content type
/// higher in the composition, and not by the content type currently being
/// edited.</remarks>
[DataMember(Name = "inherited")]
public bool Inherited { get; set; }
// needed - so we can handle alias renames
[DataMember(Name = "id")]
public int Id { get; set; }
[Required]
[RegularExpression(@"^([a-zA-Z]\w.*)$", ErrorMessage = "Invalid alias")]
[DataMember(Name = "alias")]
public string Alias { get; set; }
[DataMember(Name = "description")]
public string Description { get; set; }
[DataMember(Name = "validation")]
public PropertyTypeValidation Validation { get; set; }
[DataMember(Name = "label")]
[Required]
public string Label { get; set; }
[DataMember(Name = "sortOrder")]
public int SortOrder { get; set; }
[DataMember(Name = "dataTypeId")]
[Required]
public int DataTypeId { get; set; }
[DataMember(Name = "dataTypeKey")]
[ReadOnly(true)]
public Guid DataTypeKey { get; set; }
//SD: Is this really needed ?
[DataMember(Name = "groupId")]
public int GroupId { get; set; }
[DataMember(Name = "allowCultureVariant")]
public bool AllowCultureVariant { get; set; }
}
}

View File

@@ -1,48 +0,0 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "propertyType")]
public class PropertyTypeDisplay : PropertyTypeBasic
{
[DataMember(Name = "editor")]
[ReadOnly(true)]
public string Editor { get; set; }
[DataMember(Name = "view")]
[ReadOnly(true)]
public string View { get; set; }
[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>
/// <remarks>This is used for built in properties like the default MemberType
/// properties that should not be editable from the backoffice.</remarks>
[DataMember(Name = "locked")]
[ReadOnly(true)]
public bool Locked { get; set; }
/// <summary>
/// This is required for the UI editor to know if this particular property belongs to
/// an inherited item or the current item.
/// </summary>
[DataMember(Name = "contentTypeId")]
[ReadOnly(true)]
public int ContentTypeId { get; set; }
/// <summary>
/// This is required for the UI editor to know which content type name this property belongs
/// to based on the property inheritance structure
/// </summary>
[DataMember(Name = "contentTypeName")]
[ReadOnly(true)]
public string ContentTypeName { get; set; }
}
}

View File

@@ -1,20 +0,0 @@
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "publicAccess", Namespace = "")]
public class PublicAccess
{
[DataMember(Name = "groups")]
public MemberGroupDisplay[] Groups { get; set; }
[DataMember(Name = "loginPage")]
public EntityBasic LoginPage { get; set; }
[DataMember(Name = "errorPage")]
public EntityBasic ErrorPage { get; set; }
[DataMember(Name = "members")]
public MemberDisplay[] Members { get; set; }
}
}

View File

@@ -1,22 +0,0 @@
using System.Collections.Generic;
using System.Runtime.Serialization;
using Umbraco.Core.Models;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "redirectUrlSearchResult", Namespace = "")]
public class RedirectUrlSearchResult
{
[DataMember(Name = "searchResults")]
public IEnumerable<ContentRedirectUrl> SearchResults { get; set; }
[DataMember(Name = "totalCount")]
public long TotalCount { get; set; }
[DataMember(Name = "pageCount")]
public int PageCount { get; set; }
[DataMember(Name = "currentPage")]
public int CurrentPage { get; set; }
}
}

View File

@@ -1,52 +0,0 @@
using System;
using System.ComponentModel;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "relation", Namespace = "")]
public class RelationDisplay
{
/// <summary>
/// Gets or sets the Parent Id of the Relation (Source).
/// </summary>
[DataMember(Name = "parentId")]
[ReadOnly(true)]
public int ParentId { get; set; }
/// <summary>
/// Gets or sets the Parent Name of the relation (Source).
/// </summary>
[DataMember(Name = "parentName")]
[ReadOnly(true)]
public string ParentName { get; set; }
/// <summary>
/// Gets or sets the Child Id of the Relation (Destination).
/// </summary>
[DataMember(Name = "childId")]
[ReadOnly(true)]
public int ChildId { get; set; }
/// <summary>
/// Gets or sets the Child Name of the relation (Destination).
/// </summary>
[DataMember(Name = "childName")]
[ReadOnly(true)]
public string ChildName { get; set; }
/// <summary>
/// Gets or sets the date when the Relation was created.
/// </summary>
[DataMember(Name = "createDate")]
[ReadOnly(true)]
public DateTime CreateDate { get; set; }
/// <summary>
/// Gets or sets a comment for the Relation.
/// </summary>
[DataMember(Name = "comment")]
[ReadOnly(true)]
public string Comment { get; set; }
}
}

View File

@@ -1,56 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "relationType", Namespace = "")]
public class RelationTypeDisplay : EntityBasic, INotificationModel
{
public RelationTypeDisplay()
{
Notifications = new List<Notification>();
}
/// <summary>
/// Gets or sets a boolean indicating whether the RelationType is Bidirectional (true) or Parent to Child (false)
/// </summary>
[DataMember(Name = "isBidirectional", IsRequired = true)]
public bool IsBidirectional { get; set; }
/// <summary>
/// Gets or sets the Parents object type id
/// </summary>
/// <remarks>Corresponds to the NodeObjectType in the umbracoNode table</remarks>
[DataMember(Name = "parentObjectType", IsRequired = true)]
public Guid? ParentObjectType { get; set; }
/// <summary>
/// Gets or sets the Parent's object type name.
/// </summary>
[DataMember(Name = "parentObjectTypeName")]
[ReadOnly(true)]
public string ParentObjectTypeName { get; set; }
/// <summary>
/// Gets or sets the Child's object type id
/// </summary>
/// <remarks>Corresponds to the NodeObjectType in the umbracoNode table</remarks>
[DataMember(Name = "childObjectType", IsRequired = true)]
public Guid? ChildObjectType { get; set; }
/// <summary>
/// Gets or sets the Child's object type name.
/// </summary>
[DataMember(Name = "childObjectTypeName")]
[ReadOnly(true)]
public string ChildObjectTypeName { 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,27 +0,0 @@
using System;
using System.Runtime.Serialization;
namespace Umbraco.Web.Models.ContentEditing
{
[DataContract(Name = "relationType", Namespace = "")]
public class RelationTypeSave : EntityBasic
{
/// <summary>
/// Gets or sets a boolean indicating whether the RelationType is Bidirectional (true) or Parent to Child (false)
/// </summary>
[DataMember(Name = "isBidirectional", IsRequired = true)]
public bool IsBidirectional { get; set; }
/// <summary>
/// Gets or sets the parent object type ID.
/// </summary>
[DataMember(Name = "parentObjectType", IsRequired = false)]
public Guid? ParentObjectType { get; set; }
/// <summary>
/// Gets or sets the child object type ID.
/// </summary>
[DataMember(Name = "childObjectType", IsRequired = false)]
public Guid? ChildObjectType { get; set; }
}
}

View File

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

View File

@@ -1,28 +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
{
[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 +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
{
[DataContract(Name = "richtexteditorplugin", Namespace = "")]
public class RichTextEditorPlugin
{
[DataMember(Name = "name")]
public string Name { get; set; }
}
}

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