Move constants

This commit is contained in:
Bjarke Berg
2019-11-05 13:45:42 +01:00
parent befcabfced
commit 63bfc4c2c0
324 changed files with 1710 additions and 1704 deletions

View File

@@ -51,7 +51,7 @@ namespace Umbraco.Web.Models.Mapping
// TODO: We can resolve the UmbracoContext from the IValueResolver options!
// OMG
if (HttpContext.Current != null && Composing.Current.UmbracoContext != null && Composing.Current.UmbracoContext.Security.CurrentUser != null
&& Composing.Current.UmbracoContext.Security.CurrentUser.AllowedSections.Any(x => x.Equals(ConstantsCore.Applications.Settings)))
&& Composing.Current.UmbracoContext.Security.CurrentUser.AllowedSections.Any(x => x.Equals(Constants.Applications.Settings)))
{
var contentType = _contentTypeBaseServiceProvider.GetContentTypeOf(source);
var contentTypeBasic = context.Map<IContentTypeComposition, ContentTypeBasic>(contentType);

View File

@@ -541,7 +541,7 @@ namespace Umbraco.Web.Models.Mapping
private IEnumerable<string> MapLockedCompositions(IContentTypeComposition source)
{
// get ancestor ids from path of parent if not root
if (source.ParentId == ConstantsCore.System.Root)
if (source.ParentId == Constants.System.Root)
return Enumerable.Empty<string>();
var parent = _contentTypeService.Get(source.ParentId);

View File

@@ -24,9 +24,9 @@ namespace Umbraco.Web.Models.Mapping
private static readonly int[] SystemIds =
{
ConstantsCore.DataTypes.DefaultContentListView,
ConstantsCore.DataTypes.DefaultMediaListView,
ConstantsCore.DataTypes.DefaultMembersListView
Constants.DataTypes.DefaultContentListView,
Constants.DataTypes.DefaultMediaListView,
Constants.DataTypes.DefaultMembersListView
};
public void DefineMaps(UmbracoMapper mapper)
@@ -160,7 +160,7 @@ namespace Umbraco.Web.Models.Mapping
foreach (var field in fields.ToList())
{
//filter out the not-supported pre-values for built-in data types
if (dataType != null && dataType.IsBuildInDataType() && field.Key.InvariantEquals(ConstantsCore.DataTypes.ReservedPreValueKeys.IgnoreUserStartNodes))
if (dataType != null && dataType.IsBuildInDataType() && field.Key.InvariantEquals(Constants.DataTypes.ReservedPreValueKeys.IgnoreUserStartNodes))
{
fields.Remove(field);
continue;

View File

@@ -95,7 +95,7 @@ namespace Umbraco.Web.Models.Mapping
private static void Map(IUser source, EntityBasic target, MapperContext context)
{
target.Alias = source.Username;
target.Icon = ConstantsCore.Icons.User;
target.Icon = Constants.Icons.User;
target.Id = source.Id;
target.Key = source.Key;
target.Name = source.Name;
@@ -107,7 +107,7 @@ namespace Umbraco.Web.Models.Mapping
private static void Map(ITemplate source, EntityBasic target, MapperContext context)
{
target.Alias = source.Alias;
target.Icon = ConstantsCore.Icons.Template;
target.Icon = Constants.Icons.Template;
target.Id = source.Id;
target.Key = source.Key;
target.Name = source.Name;
@@ -149,16 +149,16 @@ namespace Umbraco.Web.Models.Mapping
if (target.Icon.IsNullOrWhiteSpace())
{
if (source.NodeObjectType == ConstantsCore.ObjectTypes.Member)
target.Icon = ConstantsCore.Icons.Member;
else if (source.NodeObjectType == ConstantsCore.ObjectTypes.DataType)
target.Icon = ConstantsCore.Icons.DataType;
else if (source.NodeObjectType == ConstantsCore.ObjectTypes.DocumentType)
target.Icon = ConstantsCore.Icons.ContentType;
else if (source.NodeObjectType == ConstantsCore.ObjectTypes.MediaType)
target.Icon = ConstantsCore.Icons.MediaType;
else if (source.NodeObjectType == ConstantsCore.ObjectTypes.TemplateType)
target.Icon = ConstantsCore.Icons.Template;
if (source.NodeObjectType == Constants.ObjectTypes.Member)
target.Icon = Constants.Icons.Member;
else if (source.NodeObjectType == Constants.ObjectTypes.DataType)
target.Icon = Constants.Icons.DataType;
else if (source.NodeObjectType == Constants.ObjectTypes.DocumentType)
target.Icon = Constants.Icons.ContentType;
else if (source.NodeObjectType == Constants.ObjectTypes.MediaType)
target.Icon = Constants.Icons.MediaType;
else if (source.NodeObjectType == Constants.ObjectTypes.TemplateType)
target.Icon = Constants.Icons.Template;
}
}
@@ -173,7 +173,7 @@ namespace Umbraco.Web.Models.Mapping
//get the icon if there is one
target.Icon = source.Values.ContainsKey(UmbracoExamineIndex.IconFieldName)
? source.Values[UmbracoExamineIndex.IconFieldName]
: ConstantsCore.Icons.DefaultIcon;
: Constants.Icons.DefaultIcon;
target.Name = source.Values.ContainsKey("nodeName") ? source.Values["nodeName"] : "[no name]";
@@ -230,7 +230,7 @@ namespace Umbraco.Web.Models.Mapping
// NOTE: this case covers both content and media entities
return contentEntity.ContentTypeIcon;
case MemberEntitySlim memberEntity:
return memberEntity.ContentTypeIcon.IfNullOrWhiteSpace(ConstantsCore.Icons.Member);
return memberEntity.ContentTypeIcon.IfNullOrWhiteSpace(Constants.Icons.Member);
}
return null;

View File

@@ -31,7 +31,7 @@ namespace Umbraco.Web.Models.Mapping
private static void Map(IMacro source, EntityBasic target, MapperContext context)
{
target.Alias = source.Alias;
target.Icon = ConstantsCore.Icons.Macro;
target.Icon = Constants.Icons.Macro;
target.Id = source.Id;
target.Key = source.Key;
target.Name = source.Name;

View File

@@ -128,7 +128,7 @@ namespace Umbraco.Web.Models.Mapping
{
target.CreateDate = source.CreationDate;
target.Email = source.Email;
target.Icon = ConstantsCore.Icons.Member;
target.Icon = Constants.Icons.Member;
target.Id = int.MaxValue;
target.Key = source.ProviderUserKey.TryConvertTo<Guid>().Result;
target.Name = source.UserName;

View File

@@ -82,7 +82,7 @@ namespace Umbraco.Web.Models.Mapping
var umbracoContext = _umbracoContextAccessor.UmbracoContext;
if (umbracoContext != null
&& umbracoContext.Security.CurrentUser != null
&& umbracoContext.Security.CurrentUser.AllowedSections.Any(x => x.Equals(ConstantsCore.Applications.Settings)))
&& umbracoContext.Security.CurrentUser.AllowedSections.Any(x => x.Equals(Constants.Applications.Settings)))
{
var memberTypeLink = string.Format("#/member/memberTypes/edit/{0}", source.ContentTypeId);
@@ -96,7 +96,7 @@ namespace Umbraco.Web.Models.Mapping
linkText = source.ContentType.Name,
url = memberTypeLink,
target = "_self",
icon = ConstantsCore.Icons.ContentType
icon = Constants.Icons.ContentType
}
};
docTypeProperty.View = "urllist";

View File

@@ -150,7 +150,7 @@ namespace Umbraco.Web.Models.Mapping
// handle locked properties
var lockedPropertyAliases = new List<string>();
// add built-in member property aliases to list of aliases to be locked
foreach (var propertyAlias in Constants.Conventions.Member.GetStandardPropertyTypeStubs().Keys)
foreach (var propertyAlias in ConventionsHelper.GetStandardPropertyTypeStubs().Keys)
{
lockedPropertyAliases.Add(propertyAlias);
}

View File

@@ -183,7 +183,7 @@ namespace Umbraco.Web.Models.Mapping
target.DefaultPermissions = MapUserGroupDefaultPermissions(source);
if (target.Icon.IsNullOrWhiteSpace())
target.Icon = ConstantsCore.Icons.UserGroup;
target.Icon = Constants.Icons.UserGroup;
}
// Umbraco.Code.MapAll -Trashed -Alias -AssignedPermissions
@@ -197,8 +197,8 @@ namespace Umbraco.Web.Models.Mapping
target.Path = source.Path;
target.Udi = Udi.Create(ObjectTypes.GetUdiType(source.NodeObjectType), source.Key);
if (source.NodeObjectType == ConstantsCore.ObjectTypes.Member && target.Icon.IsNullOrWhiteSpace())
target.Icon = ConstantsCore.Icons.Member;
if (source.NodeObjectType == Constants.ObjectTypes.Member && target.Icon.IsNullOrWhiteSpace())
target.Icon = Constants.Icons.Member;
}
// Umbraco.Code.MapAll -ContentStartNode -MediaStartNode -Sections -Notifications -Udi
@@ -355,7 +355,7 @@ namespace Umbraco.Web.Models.Mapping
target.ContentStartNode = CreateRootNode(_textService.Localize("content/contentRoot"));
if (target.Icon.IsNullOrWhiteSpace())
target.Icon = ConstantsCore.Icons.UserGroup;
target.Icon = Constants.Icons.UserGroup;
}
private IDictionary<string, IEnumerable<Permission>> MapUserGroupDefaultPermissions(IUserGroup source)

View File

@@ -65,7 +65,7 @@ namespace Umbraco.Web.Models
/// </summary>
[Required]
public string Password { get; set; }
/// <summary>
/// The username of the model, if UsernameIsEmail is true then this is ignored.
/// </summary>

View File

@@ -26,7 +26,7 @@ namespace Umbraco.Web.Models.Trees
[DataContract(Name = "node", Namespace = "")]
public sealed class TreeRootNode : TreeNode
{
private static readonly string RootId = Core.ConstantsCore.System.RootString;
private static readonly string RootId = Core.Constants.System.RootString;
private bool _isGroup;
private bool _isSingleNodeTree;