merged
This commit is contained in:
@@ -47,8 +47,7 @@ namespace Umbraco.Core.Collections
|
|||||||
var newList = new DeepCloneableList<T>(ListCloneBehavior.None);
|
var newList = new DeepCloneableList<T>(ListCloneBehavior.None);
|
||||||
foreach (var item in this)
|
foreach (var item in this)
|
||||||
{
|
{
|
||||||
var dc = item as IDeepCloneable;
|
if (item is IDeepCloneable dc)
|
||||||
if (dc != null)
|
|
||||||
{
|
{
|
||||||
newList.Add((T)dc.DeepClone());
|
newList.Add((T)dc.DeepClone());
|
||||||
}
|
}
|
||||||
@@ -66,8 +65,7 @@ namespace Umbraco.Core.Collections
|
|||||||
var newList2 = new DeepCloneableList<T>(ListCloneBehavior.Always);
|
var newList2 = new DeepCloneableList<T>(ListCloneBehavior.Always);
|
||||||
foreach (var item in this)
|
foreach (var item in this)
|
||||||
{
|
{
|
||||||
var dc = item as IDeepCloneable;
|
if (item is IDeepCloneable dc)
|
||||||
if (dc != null)
|
|
||||||
{
|
{
|
||||||
newList2.Add((T)dc.DeepClone());
|
newList2.Add((T)dc.DeepClone());
|
||||||
}
|
}
|
||||||
@@ -121,6 +119,16 @@ namespace Umbraco.Core.Collections
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void DisableChangeTracking()
|
||||||
|
{
|
||||||
|
// noop
|
||||||
|
}
|
||||||
|
|
||||||
|
public void EnableChangeTracking()
|
||||||
|
{
|
||||||
|
// noop
|
||||||
|
}
|
||||||
|
|
||||||
public void ResetWereDirtyProperties()
|
public void ResetWereDirtyProperties()
|
||||||
{
|
{
|
||||||
foreach (var dc in this.OfType<IRememberBeingDirty>())
|
foreach (var dc in this.OfType<IRememberBeingDirty>())
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
namespace Umbraco.Core.Configuration
|
namespace Umbraco.Core.Configuration
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Contains general settings information for the entire Umbraco instance based on information from web.config appsettings
|
/// Contains general settings information for the entire Umbraco instance based on information from web.config appsettings
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IGlobalSettings
|
public interface IGlobalSettings
|
||||||
{
|
{
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
/// Gets the path to umbraco's root directory (/umbraco by default).
|
/// Gets the path to umbraco's root directory (/umbraco by default).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
string Path { get; }
|
string Path { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the configuration status. This will return the version number of the currently installed umbraco instance.
|
/// Gets or sets the configuration status. This will return the version number of the currently installed umbraco instance.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -67,5 +67,10 @@
|
|||||||
/// Gets the location of temporary files.
|
/// Gets the location of temporary files.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
string LocalTempPath { get; }
|
string LocalTempPath { get; }
|
||||||
|
|
||||||
|
string UmbracoPath { get; }
|
||||||
|
string UmbracoCssPath { get; }
|
||||||
|
string UmbracoScriptsPath { get; }
|
||||||
|
string UmbracoMediaPath { get; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,6 +46,26 @@ namespace Umbraco.Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public const string ReservedUrls = "Umbraco.Core.ReservedUrls";
|
public const string ReservedUrls = "Umbraco.Core.ReservedUrls";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The path of backoffice.
|
||||||
|
/// </summary>
|
||||||
|
public const string UmbracoPath = "umbracoPath";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The path of the stylesheet folder.
|
||||||
|
/// </summary>
|
||||||
|
public const string UmbracoCssPath = "umbracoCssPath";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The path of script folder.
|
||||||
|
/// </summary>
|
||||||
|
public const string UmbracoScriptsPath = "umbracoScriptsPath";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The path of media folder.
|
||||||
|
/// </summary>
|
||||||
|
public const string UmbracoMediaPath = "umbracoMediaPath";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The reserved paths from web.config
|
/// The reserved paths from web.config
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
36
src/Umbraco.Abstractions/Constants-SystemDirectories.cs
Normal file
36
src/Umbraco.Abstractions/Constants-SystemDirectories.cs
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
namespace Umbraco.Core
|
||||||
|
{
|
||||||
|
public static partial class Constants
|
||||||
|
{
|
||||||
|
public static class SystemDirectories
|
||||||
|
{
|
||||||
|
public const string Bin = "~/bin";
|
||||||
|
|
||||||
|
public const string Config = "~/config";
|
||||||
|
|
||||||
|
public const string Data = "~/App_Data";
|
||||||
|
|
||||||
|
public const string TempData = Data + "/TEMP";
|
||||||
|
|
||||||
|
public const string TempFileUploads = TempData + "/FileUploads";
|
||||||
|
|
||||||
|
public const string TempImageUploads = TempFileUploads + "/rte";
|
||||||
|
|
||||||
|
public const string Install = "~/install";
|
||||||
|
|
||||||
|
public const string AppCode = "~/App_Code";
|
||||||
|
|
||||||
|
public const string AppPlugins = "~/App_Plugins";
|
||||||
|
|
||||||
|
public const string MvcViews = "~/Views";
|
||||||
|
|
||||||
|
public const string PartialViews = MvcViews + "/Partials/";
|
||||||
|
|
||||||
|
public const string MacroPartials = MvcViews + "/MacroPartials/";
|
||||||
|
|
||||||
|
public const string Packages = Data + "/packages";
|
||||||
|
|
||||||
|
public const string Preview = Data + "/preview";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,7 +5,7 @@ namespace Umbraco.Core.IO
|
|||||||
public interface IIOHelper
|
public interface IIOHelper
|
||||||
{
|
{
|
||||||
bool ForceNotHosted { get; set; }
|
bool ForceNotHosted { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether Umbraco is hosted.
|
/// Gets a value indicating whether Umbraco is hosted.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -18,8 +18,6 @@ namespace Umbraco.Core.IO
|
|||||||
Attempt<string> TryResolveUrl(string virtualPath);
|
Attempt<string> TryResolveUrl(string virtualPath);
|
||||||
string MapPath(string path, bool useHttpContext);
|
string MapPath(string path, bool useHttpContext);
|
||||||
string MapPath(string path);
|
string MapPath(string path);
|
||||||
string ReturnPath(string settingsKey, string standardPath, bool useTilde);
|
|
||||||
string ReturnPath(string settingsKey, string standardPath);
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Verifies that the current filepath matches a directory where the user is allowed to edit a file.
|
/// Verifies that the current filepath matches a directory where the user is allowed to edit a file.
|
||||||
@@ -80,5 +78,14 @@ namespace Umbraco.Core.IO
|
|||||||
/// <param name="path"></param>
|
/// <param name="path"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
string GetRelativePath(string path);
|
string GetRelativePath(string path);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the root path of the application
|
||||||
|
/// </summary>
|
||||||
|
string Root
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set; //Only required for unit tests
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
|
||||||
namespace Umbraco.Core.Manifest
|
namespace Umbraco.Core.Manifest
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
23
src/Umbraco.Abstractions/Manifest/IManifestParser.cs
Normal file
23
src/Umbraco.Abstractions/Manifest/IManifestParser.cs
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using Umbraco.Core.PropertyEditors;
|
||||||
|
|
||||||
|
namespace Umbraco.Core.Manifest
|
||||||
|
{
|
||||||
|
public interface IManifestParser
|
||||||
|
{
|
||||||
|
string Path { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets all manifests, merged into a single manifest object.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
PackageManifest Manifest { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Parses a manifest.
|
||||||
|
/// </summary>
|
||||||
|
PackageManifest ParseManifest(string text);
|
||||||
|
|
||||||
|
IEnumerable<GridEditor> ParseGridEditors(string text);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
using Umbraco.Core.Composing;
|
|
||||||
using Umbraco.Core.IO;
|
|
||||||
|
|
||||||
namespace Umbraco.Core.Manifest
|
namespace Umbraco.Core.Manifest
|
||||||
{
|
{
|
||||||
@@ -65,11 +63,7 @@ namespace Umbraco.Core.Manifest
|
|||||||
/// Gets or sets the view for rendering the content app.
|
/// Gets or sets the view for rendering the content app.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name = "view")]
|
[DataMember(Name = "view")]
|
||||||
public string View
|
public string View { get; set; }
|
||||||
{
|
|
||||||
get => _view;
|
|
||||||
set => _view = Current.IOHelper.ResolveVirtualUrl(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the list of 'show' conditions for the content app.
|
/// Gets or sets the list of 'show' conditions for the content app.
|
||||||
26
src/Umbraco.Abstractions/Manifest/ManifestDashboard.cs
Normal file
26
src/Umbraco.Abstractions/Manifest/ManifestDashboard.cs
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
using System;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
|
using Umbraco.Core.Dashboards;
|
||||||
|
|
||||||
|
namespace Umbraco.Core.Manifest
|
||||||
|
{
|
||||||
|
[DataContract]
|
||||||
|
public class ManifestDashboard : IDashboard
|
||||||
|
{
|
||||||
|
[DataMember(Name = "alias", IsRequired = true)]
|
||||||
|
public string Alias { get; set; }
|
||||||
|
|
||||||
|
[DataMember(Name = "weight")]
|
||||||
|
public int Weight { get; set; } = 100;
|
||||||
|
|
||||||
|
[DataMember(Name = "view", IsRequired = true)]
|
||||||
|
public string View { get; set; }
|
||||||
|
|
||||||
|
[DataMember(Name = "sections")]
|
||||||
|
public string[] Sections { get; set; } = Array.Empty<string>();
|
||||||
|
|
||||||
|
[DataMember(Name = "access")]
|
||||||
|
public IAccessRule[] AccessRules { get; set; } = Array.Empty<IAccessRule>();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,70 +1,71 @@
|
|||||||
using System;
|
using System;
|
||||||
using Newtonsoft.Json;
|
using System.Runtime.Serialization;
|
||||||
using Umbraco.Core.PropertyEditors;
|
using Umbraco.Core.PropertyEditors;
|
||||||
|
|
||||||
namespace Umbraco.Core.Manifest
|
namespace Umbraco.Core.Manifest
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents the content of a package manifest.
|
/// Represents the content of a package manifest.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class PackageManifest
|
[DataContract]
|
||||||
{
|
public class PackageManifest
|
||||||
/// <summary>
|
{
|
||||||
/// Gets the source path of the manifest.
|
/// <summary>
|
||||||
/// </summary>
|
/// Gets the source path of the manifest.
|
||||||
/// <remarks>
|
/// </summary>
|
||||||
/// <para>Gets the full absolute file path of the manifest,
|
/// <remarks>
|
||||||
/// using system directory separators.</para>
|
/// <para>Gets the full absolute file path of the manifest,
|
||||||
/// </remarks>
|
/// using system directory separators.</para>
|
||||||
[JsonIgnore]
|
/// </remarks>
|
||||||
public string Source { get; set; }
|
[IgnoreDataMember]
|
||||||
|
public string Source { get; set; }
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the scripts listed in the manifest.
|
/// <summary>
|
||||||
/// </summary>
|
/// Gets or sets the scripts listed in the manifest.
|
||||||
[JsonProperty("javascript")]
|
/// </summary>
|
||||||
public string[] Scripts { get; set; } = Array.Empty<string>();
|
[DataMember(Name = "javascript")]
|
||||||
|
public string[] Scripts { get; set; } = Array.Empty<string>();
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the stylesheets listed in the manifest.
|
/// <summary>
|
||||||
/// </summary>
|
/// Gets or sets the stylesheets listed in the manifest.
|
||||||
[JsonProperty("css")]
|
/// </summary>
|
||||||
public string[] Stylesheets { get; set; } = Array.Empty<string>();
|
[DataMember(Name = "css")]
|
||||||
|
public string[] Stylesheets { get; set; } = Array.Empty<string>();
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the property editors listed in the manifest.
|
/// <summary>
|
||||||
/// </summary>
|
/// Gets or sets the property editors listed in the manifest.
|
||||||
[JsonProperty("propertyEditors")]
|
/// </summary>
|
||||||
public IDataEditor[] PropertyEditors { get; set; } = Array.Empty<IDataEditor>();
|
[DataMember(Name = "propertyEditors")]
|
||||||
|
public IDataEditor[] PropertyEditors { get; set; } = Array.Empty<IDataEditor>();
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the parameter editors listed in the manifest.
|
/// <summary>
|
||||||
/// </summary>
|
/// Gets or sets the parameter editors listed in the manifest.
|
||||||
[JsonProperty("parameterEditors")]
|
/// </summary>
|
||||||
public IDataEditor[] ParameterEditors { get; set; } = Array.Empty<IDataEditor>();
|
[DataMember(Name = "parameterEditors")]
|
||||||
|
public IDataEditor[] ParameterEditors { get; set; } = Array.Empty<IDataEditor>();
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the grid editors listed in the manifest.
|
/// <summary>
|
||||||
/// </summary>
|
/// Gets or sets the grid editors listed in the manifest.
|
||||||
[JsonProperty("gridEditors")]
|
/// </summary>
|
||||||
public GridEditor[] GridEditors { get; set; } = Array.Empty<GridEditor>();
|
[DataMember(Name = "gridEditors")]
|
||||||
|
public GridEditor[] GridEditors { get; set; } = Array.Empty<GridEditor>();
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the content apps listed in the manifest.
|
/// <summary>
|
||||||
/// </summary>
|
/// Gets or sets the content apps listed in the manifest.
|
||||||
[JsonProperty("contentApps")]
|
/// </summary>
|
||||||
public ManifestContentAppDefinition[] ContentApps { get; set; } = Array.Empty<ManifestContentAppDefinition>();
|
[DataMember(Name = "contentApps")]
|
||||||
|
public ManifestContentAppDefinition[] ContentApps { get; set; } = Array.Empty<ManifestContentAppDefinition>();
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the dashboards listed in the manifest.
|
/// <summary>
|
||||||
/// </summary>
|
/// Gets or sets the dashboards listed in the manifest.
|
||||||
[JsonProperty("dashboards")]
|
/// </summary>
|
||||||
public ManifestDashboard[] Dashboards { get; set; } = Array.Empty<ManifestDashboard>();
|
[DataMember(Name = "dashboards")]
|
||||||
|
public ManifestDashboard[] Dashboards { get; set; } = Array.Empty<ManifestDashboard>();
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the sections listed in the manifest.
|
/// <summary>
|
||||||
/// </summary>
|
/// Gets or sets the sections listed in the manifest.
|
||||||
[JsonProperty("sections")]
|
/// </summary>
|
||||||
public ManifestSection[] Sections { get; set; } = Array.Empty<ManifestSection>();
|
[DataMember(Name = "sections")]
|
||||||
}
|
public ManifestSection[] Sections { get; set; } = Array.Empty<ManifestSection>();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,7 @@
|
|||||||
namespace Umbraco.Core.Models.ContentEditing
|
using System.Runtime.Serialization;
|
||||||
|
|
||||||
|
namespace Umbraco.Core.Models.ContentEditing
|
||||||
{
|
{
|
||||||
using System.Runtime.Serialization;
|
|
||||||
|
|
||||||
using Umbraco.Core.Events;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a content app badge
|
/// Represents a content app badge
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
using System.Runtime.Serialization;
|
||||||
|
|
||||||
|
namespace Umbraco.Core.Models.ContentEditing
|
||||||
|
{
|
||||||
|
// TODO: This was marked with `[StringEnumConverter]` to inform the serializer
|
||||||
|
// to serialize the values to string instead of INT (which is the default)
|
||||||
|
// so we need to either invent our own attribute and make the implementation aware of it
|
||||||
|
// or ... something else?
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represent the content app badge types
|
||||||
|
/// </summary>
|
||||||
|
[DataContract(Name = "contentAppBadgeType")]
|
||||||
|
public enum ContentAppBadgeType
|
||||||
|
{
|
||||||
|
[EnumMember(Value = "default")]
|
||||||
|
Default = 0,
|
||||||
|
|
||||||
|
[EnumMember(Value = "warning")]
|
||||||
|
Warning = 1,
|
||||||
|
|
||||||
|
[EnumMember(Value = "alert")]
|
||||||
|
Alert = 2
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -36,7 +36,7 @@ namespace Umbraco.Core.Models
|
|||||||
/// Gets the unique identifier of the document targeted by the scheduled action.
|
/// Gets the unique identifier of the document targeted by the scheduled action.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember]
|
[DataMember]
|
||||||
public Guid Id { get; internal set; }
|
public Guid Id { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the culture of the scheduled action.
|
/// Gets the culture of the scheduled action.
|
||||||
@@ -11,7 +11,7 @@ namespace Umbraco.Core.Models
|
|||||||
[DataContract(IsReference = true)]
|
[DataContract(IsReference = true)]
|
||||||
public class DictionaryTranslation : EntityBase, IDictionaryTranslation
|
public class DictionaryTranslation : EntityBase, IDictionaryTranslation
|
||||||
{
|
{
|
||||||
internal Func<int, ILanguage> GetLanguage { get; set; }
|
public Func<int, ILanguage> GetLanguage { get; set; }
|
||||||
|
|
||||||
private ILanguage _language;
|
private ILanguage _language;
|
||||||
private string _value;
|
private string _value;
|
||||||
@@ -35,13 +35,13 @@ namespace Umbraco.Core.Models
|
|||||||
Key = uniqueId;
|
Key = uniqueId;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal DictionaryTranslation(int languageId, string value)
|
public DictionaryTranslation(int languageId, string value)
|
||||||
{
|
{
|
||||||
_languageId = languageId;
|
_languageId = languageId;
|
||||||
_value = value;
|
_value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
internal DictionaryTranslation(int languageId, string value, Guid uniqueId)
|
public DictionaryTranslation(int languageId, string value, Guid uniqueId)
|
||||||
{
|
{
|
||||||
_languageId = languageId;
|
_languageId = languageId;
|
||||||
_value = value;
|
_value = value;
|
||||||
@@ -80,37 +80,7 @@ namespace Umbraco.Core.Models.Entities
|
|||||||
_id = default;
|
_id = default;
|
||||||
_key = Guid.Empty;
|
_key = Guid.Empty;
|
||||||
_hasIdentity = false;
|
_hasIdentity = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Updates the entity when it is being saved for the first time.
|
|
||||||
/// </summary>
|
|
||||||
internal virtual void AddingEntity()
|
|
||||||
{
|
|
||||||
var now = DateTime.Now;
|
|
||||||
|
|
||||||
// set the create and update dates, if not already set
|
|
||||||
if (IsPropertyDirty("CreateDate") == false || _createDate == default)
|
|
||||||
CreateDate = now;
|
|
||||||
if (IsPropertyDirty("UpdateDate") == false || _updateDate == default)
|
|
||||||
UpdateDate = now;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Updates the entity when it is being saved.
|
|
||||||
/// </summary>
|
|
||||||
internal virtual void UpdatingEntity()
|
|
||||||
{
|
|
||||||
var now = DateTime.Now;
|
|
||||||
|
|
||||||
// just in case
|
|
||||||
if (_createDate == default)
|
|
||||||
CreateDate = now;
|
|
||||||
|
|
||||||
// set the update date if not already set
|
|
||||||
if (IsPropertyDirty("UpdateDate") == false || _updateDate == default)
|
|
||||||
UpdateDate = now;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual bool Equals(EntityBase other)
|
public virtual bool Equals(EntityBase other)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,12 +2,12 @@
|
|||||||
|
|
||||||
namespace Umbraco.Core.Models.Entities
|
namespace Umbraco.Core.Models.Entities
|
||||||
{
|
{
|
||||||
internal static class EntityExtensions
|
public static class EntityExtensions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates the entity when it is being saved.
|
/// Updates the entity when it is being saved.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static void UpdatingEntity(this IEntity entity)
|
public static void UpdatingEntity(this IEntity entity)
|
||||||
{
|
{
|
||||||
var now = DateTime.Now;
|
var now = DateTime.Now;
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ namespace Umbraco.Core.Models.Entities
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Updates the entity when it is being saved for the first time.
|
/// Updates the entity when it is being saved for the first time.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static void AddingEntity(this IEntity entity)
|
public static void AddingEntity(this IEntity entity)
|
||||||
{
|
{
|
||||||
var now = DateTime.Now;
|
var now = DateTime.Now;
|
||||||
var canBeDirty = entity as ICanBeDirty;
|
var canBeDirty = entity as ICanBeDirty;
|
||||||
@@ -146,6 +146,16 @@ namespace Umbraco.Core.Models.Entities
|
|||||||
throw new WontImplementException();
|
throw new WontImplementException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void DisableChangeTracking()
|
||||||
|
{
|
||||||
|
// noop
|
||||||
|
}
|
||||||
|
|
||||||
|
public void EnableChangeTracking()
|
||||||
|
{
|
||||||
|
// noop
|
||||||
|
}
|
||||||
|
|
||||||
public bool WasDirty()
|
public bool WasDirty()
|
||||||
{
|
{
|
||||||
throw new WontImplementException();
|
throw new WontImplementException();
|
||||||
|
|||||||
@@ -26,5 +26,15 @@ namespace Umbraco.Core.Models.Entities
|
|||||||
/// Resets dirty properties.
|
/// Resets dirty properties.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void ResetDirtyProperties();
|
void ResetDirtyProperties();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Disables change tracking.
|
||||||
|
/// </summary>
|
||||||
|
void DisableChangeTracking();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Enables change tracking.
|
||||||
|
/// </summary>
|
||||||
|
void EnableChangeTracking();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ namespace Umbraco.Core.Models
|
|||||||
/// List of properties, which make up all the data available for this Content object
|
/// List of properties, which make up all the data available for this Content object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>Properties are loaded as part of the Content object graph</remarks>
|
/// <remarks>Properties are loaded as part of the Content object graph</remarks>
|
||||||
PropertyCollection Properties { get; set; }
|
IPropertyCollection Properties { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets a value indicating whether the content entity has a property with the supplied alias.
|
/// Gets a value indicating whether the content entity has a property with the supplied alias.
|
||||||
@@ -3,7 +3,6 @@ using System.ComponentModel.DataAnnotations;
|
|||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
using Umbraco.Core.Models;
|
using Umbraco.Core.Models;
|
||||||
using Umbraco.Core.Models.Editors;
|
using Umbraco.Core.Models.Editors;
|
||||||
using Umbraco.Core.Services;
|
|
||||||
|
|
||||||
namespace Umbraco.Core.PropertyEditors
|
namespace Umbraco.Core.PropertyEditors
|
||||||
{
|
{
|
||||||
@@ -59,12 +58,12 @@ namespace Umbraco.Core.PropertyEditors
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Converts a property value to a value for the editor.
|
/// Converts a property value to a value for the editor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
object ToEditor(Property property, IDataTypeService dataTypeService, string culture = null, string segment = null);
|
object ToEditor(IProperty property, string culture = null, string segment = null);
|
||||||
|
|
||||||
// TODO: / deal with this when unplugging the xml cache
|
// TODO: / deal with this when unplugging the xml cache
|
||||||
// why property vs propertyType? services should be injected! etc...
|
// why property vs propertyType? services should be injected! etc...
|
||||||
IEnumerable<XElement> ConvertDbToXml(Property property, IDataTypeService dataTypeService, ILocalizationService localizationService, bool published);
|
IEnumerable<XElement> ConvertDbToXml(IProperty property, bool published);
|
||||||
XNode ConvertDbToXml(PropertyType propertyType, object value, IDataTypeService dataTypeService);
|
XNode ConvertDbToXml(IPropertyType propertyType, object value);
|
||||||
string ConvertDbToString(PropertyType propertyType, object value, IDataTypeService dataTypeService);
|
string ConvertDbToString(IPropertyType propertyType, object value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
45
src/Umbraco.Abstractions/Models/IProperty.cs
Normal file
45
src/Umbraco.Abstractions/Models/IProperty.cs
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Umbraco.Core.Models.Entities;
|
||||||
|
|
||||||
|
namespace Umbraco.Core.Models
|
||||||
|
{
|
||||||
|
public interface IProperty : IEntity, IRememberBeingDirty
|
||||||
|
{
|
||||||
|
|
||||||
|
ValueStorageType ValueStorageType { get; }
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the PropertyType, which this Property is based on
|
||||||
|
/// </summary>
|
||||||
|
IPropertyType PropertyType { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the list of values.
|
||||||
|
/// </summary>
|
||||||
|
IReadOnlyCollection<IPropertyValue> Values { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the Alias of the PropertyType, which this Property is based on
|
||||||
|
/// </summary>
|
||||||
|
string Alias { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the value.
|
||||||
|
/// </summary>
|
||||||
|
object GetValue(string culture = null, string segment = null, bool published = false);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Sets a value.
|
||||||
|
/// </summary>
|
||||||
|
void SetValue(object value, string culture = null, string segment = null);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resets the entity identity.
|
||||||
|
/// </summary>
|
||||||
|
void ResetIdentity();
|
||||||
|
|
||||||
|
int PropertyTypeId { get; }
|
||||||
|
void PublishValues(string culture = "*", string segment = "*");
|
||||||
|
void UnpublishValues(string culture = "*", string segment = "*");
|
||||||
|
}
|
||||||
|
}
|
||||||
38
src/Umbraco.Abstractions/Models/IPropertyCollection.cs
Normal file
38
src/Umbraco.Abstractions/Models/IPropertyCollection.cs
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.Specialized;
|
||||||
|
|
||||||
|
namespace Umbraco.Core.Models
|
||||||
|
{
|
||||||
|
public interface IPropertyCollection : IEnumerable<IProperty>, IDeepCloneable, INotifyCollectionChanged
|
||||||
|
{
|
||||||
|
bool TryGetValue(string propertyTypeAlias, out IProperty property);
|
||||||
|
bool Contains(string key);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Ensures that the collection contains properties for the specified property types.
|
||||||
|
/// </summary>
|
||||||
|
void EnsurePropertyTypes(IEnumerable<IPropertyType> propertyTypes);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Ensures that the collection does not contain properties not in the specified property types.
|
||||||
|
/// </summary>
|
||||||
|
void EnsureCleanPropertyTypes(IEnumerable<IPropertyType> propertyTypes);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the property with the specified alias.
|
||||||
|
/// </summary>
|
||||||
|
IProperty this[string name] { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the property at the specified index.
|
||||||
|
/// </summary>
|
||||||
|
IProperty this[int index] { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds or updates a property.
|
||||||
|
/// </summary>
|
||||||
|
void Add(IProperty property);
|
||||||
|
|
||||||
|
int Count { get; }
|
||||||
|
}
|
||||||
|
}
|
||||||
87
src/Umbraco.Abstractions/Models/IPropertyType.cs
Normal file
87
src/Umbraco.Abstractions/Models/IPropertyType.cs
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
using System;
|
||||||
|
using System.Runtime.Serialization;
|
||||||
|
using Umbraco.Core.Models.Entities;
|
||||||
|
|
||||||
|
namespace Umbraco.Core.Models
|
||||||
|
{
|
||||||
|
public interface IPropertyType : IEntity, IRememberBeingDirty
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets of sets the name of the property type.
|
||||||
|
/// </summary>
|
||||||
|
string Name { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets of sets the alias of the property type.
|
||||||
|
/// </summary>
|
||||||
|
string Alias { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets of sets the description of the property type.
|
||||||
|
/// </summary>
|
||||||
|
string Description { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the identifier of the datatype for this property type.
|
||||||
|
/// </summary>
|
||||||
|
int DataTypeId { get; }
|
||||||
|
|
||||||
|
Guid DataTypeKey { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the alias of the property editor for this property type.
|
||||||
|
/// </summary>
|
||||||
|
string PropertyEditorAlias { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the database type for storing value for this property type.
|
||||||
|
/// </summary>
|
||||||
|
ValueStorageType ValueStorageType { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the identifier of the property group this property type belongs to.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>For generic properties, the value is <c>null</c>.</remarks>
|
||||||
|
Lazy<int> PropertyGroupId { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets of sets a value indicating whether a value for this property type is required.
|
||||||
|
/// </summary>
|
||||||
|
bool Mandatory { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets of sets the sort order of the property type.
|
||||||
|
/// </summary>
|
||||||
|
int SortOrder { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the regular expression validating the property values.
|
||||||
|
/// </summary>
|
||||||
|
string ValidationRegExp { get; }
|
||||||
|
|
||||||
|
bool SupportsPublishing { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the content variation of the property type.
|
||||||
|
/// </summary>
|
||||||
|
ContentVariation Variations { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines whether the property type supports a combination of culture and segment.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="culture">The culture.</param>
|
||||||
|
/// <param name="segment">The segment.</param>
|
||||||
|
/// <param name="wildcards">A value indicating whether wildcards are valid.</param>
|
||||||
|
bool SupportsVariation(string culture, string segment, bool wildcards = false);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Converts a value assigned to a property.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// <para>The input value can be pretty much anything, and is converted to the actual CLR type
|
||||||
|
/// expected by the property (eg an integer if the property values are integers).</para>
|
||||||
|
/// <para>Throws if the value cannot be converted.</para>
|
||||||
|
/// </remarks>
|
||||||
|
object ConvertAssignedValue(object value);
|
||||||
|
}
|
||||||
|
}
|
||||||
34
src/Umbraco.Abstractions/Models/IPropertyValue.cs
Normal file
34
src/Umbraco.Abstractions/Models/IPropertyValue.cs
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
namespace Umbraco.Core.Models
|
||||||
|
{
|
||||||
|
public interface IPropertyValue
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the culture of the property.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>The culture is either null (invariant) or a non-empty string. If the property is
|
||||||
|
/// set with an empty or whitespace value, its value is converted to null.</remarks>
|
||||||
|
string Culture { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the segment of the property.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>The segment is either null (neutral) or a non-empty string. If the property is
|
||||||
|
/// set with an empty or whitespace value, its value is converted to null.</remarks>
|
||||||
|
string Segment { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the edited value of the property.
|
||||||
|
/// </summary>
|
||||||
|
object EditedValue { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the published value of the property.
|
||||||
|
/// </summary>
|
||||||
|
object PublishedValue { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clones the property value.
|
||||||
|
/// </summary>
|
||||||
|
IPropertyValue Clone();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -41,7 +41,7 @@ namespace Umbraco.Core.Models
|
|||||||
/// <param name="name"></param>
|
/// <param name="name"></param>
|
||||||
/// <param name="sortOrder"></param>
|
/// <param name="sortOrder"></param>
|
||||||
/// <param name="editorAlias"></param>
|
/// <param name="editorAlias"></param>
|
||||||
internal MacroProperty(int id, Guid key, string @alias, string name, int sortOrder, string editorAlias)
|
public MacroProperty(int id, Guid key, string @alias, string name, int sortOrder, string editorAlias)
|
||||||
{
|
{
|
||||||
_id = id;
|
_id = id;
|
||||||
_alias = alias;
|
_alias = alias;
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used to track the property types that are visible/editable on member profiles
|
/// Used to track the property types that are visible/editable on member profiles
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal class MemberTypePropertyProfileAccess
|
public class MemberTypePropertyProfileAccess
|
||||||
{
|
{
|
||||||
public MemberTypePropertyProfileAccess(bool isVisible, bool isEditable, bool isSenstive)
|
public MemberTypePropertyProfileAccess(bool isVisible, bool isEditable, bool isSenstive)
|
||||||
{
|
{
|
||||||
@@ -6,6 +6,8 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public enum MembershipScenario
|
public enum MembershipScenario
|
||||||
{
|
{
|
||||||
|
//TODO: This will become obsolete when we get asp.net identity members in place
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The member is based on the native Umbraco members (IMember + Umbraco membership provider)
|
/// The member is based on the native Umbraco members (IMember + Umbraco membership provider)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ namespace Umbraco.Core.Models
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal IEnumerable<Guid> RemovedRules => _removedRules;
|
public IEnumerable<Guid> RemovedRules => _removedRules;
|
||||||
|
|
||||||
public IEnumerable<PublicAccessRule> Rules => _ruleCollection;
|
public IEnumerable<PublicAccessRule> Rules => _ruleCollection;
|
||||||
|
|
||||||
@@ -7,7 +7,7 @@ namespace Umbraco.Core.Models.PublishedContent
|
|||||||
/// Provides a base class for <c>IPublishedProperty</c> implementations which converts and caches
|
/// Provides a base class for <c>IPublishedProperty</c> implementations which converts and caches
|
||||||
/// the value source to the actual value to use when rendering content.
|
/// the value source to the actual value to use when rendering content.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal abstract class PublishedPropertyBase : IPublishedProperty
|
public abstract class PublishedPropertyBase : IPublishedProperty
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="PublishedPropertyBase"/> class.
|
/// Initializes a new instance of the <see cref="PublishedPropertyBase"/> class.
|
||||||
@@ -14,7 +14,7 @@ namespace Umbraco.Core.Models.PublishedContent
|
|||||||
/// <para>Does not support variations: the ctor throws if the property type
|
/// <para>Does not support variations: the ctor throws if the property type
|
||||||
/// supports variations.</para>
|
/// supports variations.</para>
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
internal class RawValueProperty : PublishedPropertyBase
|
public class RawValueProperty : PublishedPropertyBase
|
||||||
{
|
{
|
||||||
private readonly object _sourceValue; //the value in the db
|
private readonly object _sourceValue; //the value in the db
|
||||||
private readonly Lazy<object> _objectValue;
|
private readonly Lazy<object> _objectValue;
|
||||||
@@ -49,6 +49,6 @@ namespace Umbraco.Core.Models
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Readonly value of the language ISO code for the domain
|
/// Readonly value of the language ISO code for the domain
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string LanguageIsoCode { get; internal set; }
|
public string LanguageIsoCode { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
76
src/Umbraco.Abstractions/Models/UmbracoUserExtensions.cs
Normal file
76
src/Umbraco.Abstractions/Models/UmbracoUserExtensions.cs
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Umbraco.Core.Configuration;
|
||||||
|
using Umbraco.Core.Models.Membership;
|
||||||
|
using Umbraco.Core.Services;
|
||||||
|
|
||||||
|
namespace Umbraco.Core.Models
|
||||||
|
{
|
||||||
|
public static class UmbracoUserExtensions
|
||||||
|
{
|
||||||
|
public static IEnumerable<string> GetPermissions(this IUser user, string path, IUserService userService)
|
||||||
|
{
|
||||||
|
return userService.GetPermissionsForPath(user, path).GetAllPermissions();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool HasSectionAccess(this IUser user, string app)
|
||||||
|
{
|
||||||
|
var apps = user.AllowedSections;
|
||||||
|
return apps.Any(uApp => uApp.InvariantEquals(app));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines whether this user is the 'super' user.
|
||||||
|
/// </summary>
|
||||||
|
public static bool IsSuper(this IUser user)
|
||||||
|
{
|
||||||
|
if (user == null) throw new ArgumentNullException(nameof(user));
|
||||||
|
return user.Id == Constants.Security.SuperUserId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines whether this user belongs to the administrators group.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>The 'super' user does not automatically belongs to the administrators group.</remarks>
|
||||||
|
public static bool IsAdmin(this IUser user)
|
||||||
|
{
|
||||||
|
if (user == null) throw new ArgumentNullException(nameof(user));
|
||||||
|
return user.Groups != null && user.Groups.Any(x => x.Alias == Constants.Security.AdminGroupAlias);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns the culture info associated with this user, based on the language they're assigned to in the back office
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="user"></param>
|
||||||
|
/// <param name="textService"></param>
|
||||||
|
/// <param name="globalSettings"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static CultureInfo GetUserCulture(this IUser user, ILocalizedTextService textService, IGlobalSettings globalSettings)
|
||||||
|
{
|
||||||
|
if (user == null) throw new ArgumentNullException(nameof(user));
|
||||||
|
if (textService == null) throw new ArgumentNullException(nameof(textService));
|
||||||
|
return GetUserCulture(user.Language, textService, globalSettings);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static CultureInfo GetUserCulture(string userLanguage, ILocalizedTextService textService, IGlobalSettings globalSettings)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var culture = CultureInfo.GetCultureInfo(userLanguage.Replace("_", "-"));
|
||||||
|
// TODO: This is a hack because we store the user language as 2 chars instead of the full culture
|
||||||
|
// which is actually stored in the language files (which are also named with 2 chars!) so we need to attempt
|
||||||
|
// to convert to a supported full culture
|
||||||
|
var result = textService.ConvertToSupportedCultureWithRegionCode(culture);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
catch (CultureNotFoundException)
|
||||||
|
{
|
||||||
|
//return the default one
|
||||||
|
return CultureInfo.GetCultureInfo(globalSettings.DefaultUILanguage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,7 +19,7 @@ namespace Umbraco.Core.Models.Validation
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines whether an object has all required values for persistence.
|
/// Determines whether an object has all required values for persistence.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static bool HasRequiredValuesForPersistence(object model)
|
public static bool HasRequiredValuesForPersistence(object model)
|
||||||
{
|
{
|
||||||
return model.GetType().GetProperties().All(x =>
|
return model.GetType().GetProperties().All(x =>
|
||||||
{
|
{
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
namespace Umbraco.Core.PackageActions
|
namespace Umbraco.Core.PackageActions
|
||||||
{
|
{
|
||||||
internal class PackageActionCollectionBuilder : LazyCollectionBuilderBase<PackageActionCollectionBuilder, PackageActionCollection, IPackageAction>
|
public class PackageActionCollectionBuilder : LazyCollectionBuilderBase<PackageActionCollectionBuilder, PackageActionCollection, IPackageAction>
|
||||||
{
|
{
|
||||||
protected override PackageActionCollectionBuilder This => this;
|
protected override PackageActionCollectionBuilder This => this;
|
||||||
}
|
}
|
||||||
@@ -7,7 +7,7 @@ using Umbraco.Core.Services;
|
|||||||
|
|
||||||
namespace Umbraco.Core.Packaging
|
namespace Umbraco.Core.Packaging
|
||||||
{
|
{
|
||||||
internal class ConflictingPackageData
|
public class ConflictingPackageData
|
||||||
{
|
{
|
||||||
private readonly IMacroService _macroService;
|
private readonly IMacroService _macroService;
|
||||||
private readonly IFileService _fileService;
|
private readonly IFileService _fileService;
|
||||||
@@ -9,7 +9,7 @@ namespace Umbraco.Core.Packaging
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Package actions are executed on package install / uninstall.
|
/// Package actions are executed on package install / uninstall.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal class PackageActionRunner : IPackageActionRunner
|
public class PackageActionRunner : IPackageActionRunner
|
||||||
{
|
{
|
||||||
private readonly ILogger _logger;
|
private readonly ILogger _logger;
|
||||||
private readonly PackageActionCollection _packageActions;
|
private readonly PackageActionCollection _packageActions;
|
||||||
@@ -6,7 +6,7 @@ using System.IO.Compression;
|
|||||||
|
|
||||||
namespace Umbraco.Core.Packaging
|
namespace Umbraco.Core.Packaging
|
||||||
{
|
{
|
||||||
internal class PackageExtraction
|
public class PackageExtraction
|
||||||
{
|
{
|
||||||
public string ReadTextFileFromArchive(FileInfo packageFile, string fileToRead, out string directoryInPackage)
|
public string ReadTextFileFromArchive(FileInfo packageFile, string fileToRead, out string directoryInPackage)
|
||||||
{
|
{
|
||||||
@@ -1,15 +1,15 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Newtonsoft.Json;
|
using System.Reflection;
|
||||||
using Umbraco.Core.Composing;
|
using System.Runtime.Serialization;
|
||||||
using Umbraco.Core.IO;
|
|
||||||
|
|
||||||
namespace Umbraco.Core.PropertyEditors
|
namespace Umbraco.Core.PropertyEditors
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a datatype configuration field for editing.
|
/// Represents a datatype configuration field for editing.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[DataContract]
|
||||||
public class ConfigurationField
|
public class ConfigurationField
|
||||||
{
|
{
|
||||||
private string _view;
|
private string _view;
|
||||||
@@ -50,37 +50,35 @@ namespace Umbraco.Core.PropertyEditors
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the key of the field.
|
/// Gets or sets the key of the field.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("key", Required = Required.Always)]
|
[DataMember(Name = "key", IsRequired = true)]
|
||||||
public string Key { get; set; }
|
public string Key { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the name of the field.
|
/// Gets or sets the name of the field.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("label", Required = Required.Always)]
|
[DataMember(Name = "label", IsRequired = true)]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the property name of the field.
|
/// Gets or sets the property name of the field.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonIgnore]
|
|
||||||
public string PropertyName { get; set; }
|
public string PropertyName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the property CLR type of the field.
|
/// Gets or sets the property CLR type of the field.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonIgnore]
|
|
||||||
public Type PropertyType { get; set; }
|
public Type PropertyType { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the description of the field.
|
/// Gets or sets the description of the field.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("description")]
|
[DataMember(Name = "description")]
|
||||||
public string Description { get; set; }
|
public string Description { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a value indicating whether to hide the label of the field.
|
/// Gets or sets a value indicating whether to hide the label of the field.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("hideLabel")]
|
[DataMember(Name = "hideLabel")]
|
||||||
public bool HideLabel { get; set; }
|
public bool HideLabel { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -90,23 +88,19 @@ namespace Umbraco.Core.PropertyEditors
|
|||||||
/// <para>Can be the full virtual path, or the relative path to the Umbraco folder,
|
/// <para>Can be the full virtual path, or the relative path to the Umbraco folder,
|
||||||
/// or a simple view name which will map to ~/Views/PreValueEditors/{view}.html.</para>
|
/// or a simple view name which will map to ~/Views/PreValueEditors/{view}.html.</para>
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
[JsonProperty("view", Required = Required.Always)]
|
[DataMember(Name = "view", IsRequired = true)]
|
||||||
public string View
|
public string View { get; set; }
|
||||||
{
|
|
||||||
get => _view;
|
|
||||||
set => _view = Current.Factory.GetInstance<IIOHelper>().ResolveVirtualUrl(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the validators of the field.
|
/// Gets the validators of the field.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("validation")]
|
[DataMember(Name = "validation")]
|
||||||
public List<IValueValidator> Validators { get; }
|
public List<IValueValidator> Validators { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets extra configuration properties for the editor.
|
/// Gets or sets extra configuration properties for the editor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonProperty("config")]
|
[DataMember(Name = "config")]
|
||||||
public IDictionary<string, object> Config { get; set; }
|
public IDictionary<string, object> Config { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,50 +1,38 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Newtonsoft.Json;
|
using System.Runtime.Serialization;
|
||||||
using Umbraco.Core.Composing;
|
|
||||||
using Umbraco.Core.Configuration.Grid;
|
using Umbraco.Core.Configuration.Grid;
|
||||||
using Umbraco.Core.IO;
|
|
||||||
|
|
||||||
namespace Umbraco.Core.PropertyEditors
|
namespace Umbraco.Core.PropertyEditors
|
||||||
{
|
{
|
||||||
|
|
||||||
|
[DataContract]
|
||||||
public class GridEditor : IGridEditorConfig
|
public class GridEditor : IGridEditorConfig
|
||||||
{
|
{
|
||||||
private readonly IIOHelper _ioHelper;
|
public GridEditor()
|
||||||
private string _view;
|
|
||||||
private string _render;
|
|
||||||
|
|
||||||
public GridEditor(IIOHelper ioHelper)
|
|
||||||
{
|
{
|
||||||
_ioHelper = ioHelper;
|
_ioHelper = ioHelper;
|
||||||
Config = new Dictionary<string, object>();
|
Config = new Dictionary<string, object>();
|
||||||
}
|
}
|
||||||
|
|
||||||
[JsonProperty("name", Required = Required.Always)]
|
[DataMember(Name = "name", IsRequired = true)]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
[JsonProperty("nameTemplate")]
|
[DataMember(Name = "nameTemplate")]
|
||||||
public string NameTemplate { get; set; }
|
public string NameTemplate { get; set; }
|
||||||
|
|
||||||
[JsonProperty("alias", Required = Required.Always)]
|
[DataMember(Name = "alias", IsRequired = true)]
|
||||||
public string Alias { get; set; }
|
public string Alias { get; set; }
|
||||||
|
|
||||||
[JsonProperty("view", Required = Required.Always)]
|
[DataMember(Name = "view", IsRequired = true)]
|
||||||
public string View
|
public string View{ get; set; }
|
||||||
{
|
|
||||||
get => _view;
|
|
||||||
set => _view = _ioHelper.ResolveVirtualUrl(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
[JsonProperty("render")]
|
[DataMember(Name = "render")]
|
||||||
public string Render
|
public string Render { get; set; }
|
||||||
{
|
|
||||||
get => _render;
|
|
||||||
set => _render = _ioHelper.ResolveVirtualUrl(value);
|
|
||||||
}
|
|
||||||
|
|
||||||
[JsonProperty("icon", Required = Required.Always)]
|
[DataMember(Name = "icon", IsRequired = true)]
|
||||||
public string Icon { get; set; }
|
public string Icon { get; set; }
|
||||||
|
|
||||||
[JsonProperty("config")]
|
[DataMember(Name = "config")]
|
||||||
public IDictionary<string, object> Config { get; set; }
|
public IDictionary<string, object> Config { get; set; }
|
||||||
|
|
||||||
protected bool Equals(GridEditor other)
|
protected bool Equals(GridEditor other)
|
||||||
@@ -19,6 +19,6 @@ namespace Umbraco.Core.PropertyEditors
|
|||||||
/// values. By default, there would be only one object: the property value. But some implementations may return
|
/// values. By default, there would be only one object: the property value. But some implementations may return
|
||||||
/// more than one value for a given field.</para>
|
/// more than one value for a given field.</para>
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
IEnumerable<KeyValuePair<string, IEnumerable<object>>> GetIndexValues(Property property, string culture, string segment, bool published);
|
IEnumerable<KeyValuePair<string, IEnumerable<object>>> GetIndexValues(IProperty property, string culture, string segment, bool published);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
using Umbraco.Core.Composing;
|
||||||
|
|
||||||
|
namespace Umbraco.Core.PropertyEditors
|
||||||
|
{
|
||||||
|
public class ManifestValueValidatorCollectionBuilder : LazyCollectionBuilderBase<ManifestValueValidatorCollectionBuilder, ManifestValueValidatorCollection, IManifestValueValidator>
|
||||||
|
{
|
||||||
|
protected override ManifestValueValidatorCollectionBuilder This => this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,7 +6,7 @@ namespace Umbraco.Core.PropertyEditors.Validators
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// A validator that validates that the value is a valid decimal
|
/// A validator that validates that the value is a valid decimal
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal sealed class DecimalValidator : IManifestValueValidator
|
public sealed class DecimalValidator : IManifestValueValidator
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public string ValidationName => "Decimal";
|
public string ValidationName => "Decimal";
|
||||||
@@ -6,7 +6,7 @@ namespace Umbraco.Core.PropertyEditors.Validators
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// A validator that validates an email address
|
/// A validator that validates an email address
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal sealed class EmailValidator : IManifestValueValidator
|
public sealed class EmailValidator : IManifestValueValidator
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public string ValidationName => "Email";
|
public string ValidationName => "Email";
|
||||||
@@ -6,7 +6,7 @@ namespace Umbraco.Core.PropertyEditors.Validators
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// A validator that validates that the value is a valid integer
|
/// A validator that validates that the value is a valid integer
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal sealed class IntegerValidator : IManifestValueValidator
|
public sealed class IntegerValidator : IManifestValueValidator
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
public string ValidationName => "Integer";
|
public string ValidationName => "Integer";
|
||||||
@@ -19,7 +19,7 @@ namespace Umbraco.Core.Services
|
|||||||
/// Adds or updates a translation for a dictionary item and language
|
/// Adds or updates a translation for a dictionary item and language
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="item"></param>
|
/// <param name="item"></param>
|
||||||
/// <param name="language"></param>
|
/// <param name="language"></param
|
||||||
/// <param name="value"></param>
|
/// <param name="value"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
void AddOrUpdateDictionaryValue(IDictionaryItem item, ILanguage language, string value);
|
void AddOrUpdateDictionaryValue(IDictionaryItem item, ILanguage language, string value);
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using Umbraco.Core.Models;
|
|
||||||
using Umbraco.Core.Models.Membership;
|
using Umbraco.Core.Models.Membership;
|
||||||
using Umbraco.Core.Persistence.DatabaseModelDefinitions;
|
|
||||||
using Umbraco.Core.Persistence.Querying;
|
using Umbraco.Core.Persistence.Querying;
|
||||||
|
|
||||||
namespace Umbraco.Core.Services
|
namespace Umbraco.Core.Services
|
||||||
@@ -7,6 +7,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="System.ComponentModel.Annotations" Version="4.6.0" />
|
||||||
<PackageReference Include="System.Runtime.Caching" Version="4.6.0" />
|
<PackageReference Include="System.Runtime.Caching" Version="4.6.0" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user