Merge branch 'dev-v7.7' into temp-isearchabletree

# Conflicts:
#	src/Umbraco.Web.UI/umbraco/config/lang/en.xml
#	src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml
#	src/Umbraco.Web/Trees/ContentTreeController.cs
This commit is contained in:
Shannon
2017-07-20 22:21:59 +10:00
1505 changed files with 11362 additions and 60852 deletions

View File

@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using System.Runtime.Serialization;
@@ -18,6 +19,11 @@ namespace Umbraco.Web.Models.ContentEditing
[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>
@@ -105,5 +111,9 @@ namespace Umbraco.Web.Models.ContentEditing
: IOHelper.ResolveUrl("~/umbraco/images/thumbnails/" + Thumbnail);
}
}
[DataMember(Name = "blueprints")]
[ReadOnly(true)]
public IDictionary<int, string> Blueprints { get; set; }
}
}

View File

@@ -1,11 +1,7 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;
using Umbraco.Core.Models.Validation;
namespace Umbraco.Web.Models.ContentEditing
{
@@ -24,6 +20,9 @@ namespace Umbraco.Web.Models.ContentEditing
[DataMember(Name = "alias")]
public string Alias { get; set; }
[DataMember(Name = "key")]
public Guid Key { get; set; }
[DataMember(Name = "content")]
public string Content { get; set; }

View File

@@ -0,0 +1,166 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Umbraco.Core;
using Umbraco.Core.Models;
using Umbraco.Core.Models.PublishedContent;
namespace Umbraco.Web.Models
{
public class DetachedPublishedContent : PublishedContentWithKeyBase
{
private readonly Guid _key;
private readonly string _name;
private readonly PublishedContentType _contentType;
private readonly IEnumerable<IPublishedProperty> _properties;
private readonly int _sortOrder;
private readonly bool _isPreviewing;
private readonly IPublishedContent _containerNode;
public DetachedPublishedContent(
Guid key,
string name,
PublishedContentType contentType,
IEnumerable<IPublishedProperty> properties,
IPublishedContent containerNode = null,
int sortOrder = 0,
bool isPreviewing = false)
{
_key = key;
_name = name;
_contentType = contentType;
_properties = properties;
_sortOrder = sortOrder;
_isPreviewing = isPreviewing;
_containerNode = containerNode;
}
public override Guid Key
{
get { return _key; }
}
public override int Id
{
get { return 0; }
}
public override string Name
{
get { return _name; }
}
public override bool IsDraft
{
get { return _isPreviewing; }
}
public override PublishedItemType ItemType
{
get { return PublishedItemType.Content; }
}
public override PublishedContentType ContentType
{
get { return _contentType; }
}
public override string DocumentTypeAlias
{
get { return _contentType.Alias; }
}
public override int DocumentTypeId
{
get { return _contentType.Id; }
}
public override ICollection<IPublishedProperty> Properties
{
get { return _properties.ToArray(); }
}
public override IPublishedProperty GetProperty(string alias)
{
return _properties.FirstOrDefault(x => x.PropertyTypeAlias.InvariantEquals(alias));
}
public override IPublishedProperty GetProperty(string alias, bool recurse)
{
if (recurse)
throw new NotSupportedException();
return GetProperty(alias);
}
public override IPublishedContent Parent
{
get { return null; }
}
public override IEnumerable<IPublishedContent> Children
{
get { return Enumerable.Empty<IPublishedContent>(); }
}
public override int TemplateId
{
get { return 0; }
}
public override int SortOrder
{
get { return _sortOrder; }
}
public override string UrlName
{
get { return null; }
}
public override string WriterName
{
get { return _containerNode != null ? _containerNode.WriterName : null; }
}
public override string CreatorName
{
get { return _containerNode != null ? _containerNode.CreatorName : null; }
}
public override int WriterId
{
get { return _containerNode != null ? _containerNode.WriterId : 0; }
}
public override int CreatorId
{
get { return _containerNode != null ? _containerNode.CreatorId : 0; }
}
public override string Path
{
get { return null; }
}
public override DateTime CreateDate
{
get { return _containerNode != null ? _containerNode.CreateDate : DateTime.MinValue; }
}
public override DateTime UpdateDate
{
get { return _containerNode != null ? _containerNode.UpdateDate : DateTime.MinValue; }
}
public override Guid Version
{
get { return _containerNode != null ? _containerNode.Version : Guid.Empty; }
}
public override int Level
{
get { return 0; }
}
}
}

View File

@@ -0,0 +1,52 @@
using System;
using Umbraco.Core.Models;
using Umbraco.Core.Models.PublishedContent;
namespace Umbraco.Web.Models
{
internal class DetachedPublishedProperty : IPublishedProperty
{
private readonly PublishedPropertyType _propertyType;
private readonly object _rawValue;
private readonly Lazy<object> _sourceValue;
private readonly Lazy<object> _objectValue;
private readonly Lazy<object> _xpathValue;
private readonly bool _isPreview;
public DetachedPublishedProperty(PublishedPropertyType propertyType, object value)
: this(propertyType, value, false)
{
}
public DetachedPublishedProperty(PublishedPropertyType propertyType, object value, bool isPreview)
{
_propertyType = propertyType;
_isPreview = isPreview;
_rawValue = value;
_sourceValue = new Lazy<object>(() => _propertyType.ConvertDataToSource(_rawValue, _isPreview));
_objectValue = new Lazy<object>(() => _propertyType.ConvertSourceToObject(_sourceValue.Value, _isPreview));
_xpathValue = new Lazy<object>(() => _propertyType.ConvertSourceToXPath(_sourceValue.Value, _isPreview));
}
public string PropertyTypeAlias
{
get
{
return _propertyType.PropertyTypeAlias;
}
}
public bool HasValue
{
get { return DataValue != null && DataValue.ToString().Trim().Length > 0; }
}
public object DataValue { get { return _rawValue; } }
public object Value { get { return _objectValue.Value; } }
public object XPathValue { get { return _xpathValue.Value; } }
}
}

View File

@@ -76,7 +76,7 @@ namespace Umbraco.Web.Models
public bool HasImage()
{
return string.IsNullOrEmpty(Src);
return ! string.IsNullOrEmpty(Src);
}
public string ToHtmlString()

View File

@@ -108,7 +108,7 @@ namespace Umbraco.Web.Models.Mapping
}
//fill in the template config to be passed to the template drop down.
var templateItemConfig = new Dictionary<string, string> {{"", "Choose..."}};
var templateItemConfig = new Dictionary<string, string> {{"", localizedText.Localize("general/choose")}};
foreach (var t in content.ContentType.AllowedTemplates
.Where(t => t.Alias.IsNullOrWhiteSpace() == false && t.Name.IsNullOrWhiteSpace() == false))
{

View File

@@ -163,11 +163,14 @@ namespace Umbraco.Web.Models.Mapping
});
config.CreateMap<IMemberType, ContentTypeBasic>()
.ForMember(x => x.Udi, expression => expression.MapFrom(content => Udi.Create(Constants.UdiEntityType.MemberType, content.Key)));
.ForMember(x => x.Udi, expression => expression.MapFrom(content => Udi.Create(Constants.UdiEntityType.MemberType, content.Key)))
.ForMember(x => x.Blueprints, expression => expression.Ignore());
config.CreateMap<IMediaType, ContentTypeBasic>()
.ForMember(x => x.Udi, expression => expression.MapFrom(content => Udi.Create(Constants.UdiEntityType.MediaType, content.Key)));
.ForMember(x => x.Udi, expression => expression.MapFrom(content => Udi.Create(Constants.UdiEntityType.MediaType, content.Key)))
.ForMember(x => x.Blueprints, expression => expression.Ignore());
config.CreateMap<IContentType, ContentTypeBasic>()
.ForMember(x => x.Udi, expression => expression.MapFrom(content => Udi.Create(Constants.UdiEntityType.DocumentType, content.Key)));
.ForMember(x => x.Udi, expression => expression.MapFrom(content => Udi.Create(Constants.UdiEntityType.DocumentType, content.Key)))
.ForMember(x => x.Blueprints, expression => expression.Ignore());
config.CreateMap<PropertyTypeBasic, PropertyType>()

View File

@@ -129,6 +129,7 @@ namespace Umbraco.Web.Models.Mapping
return mapping
.ForMember(x => x.Udi, expression => expression.ResolveUsing(new ContentTypeUdiResolver()))
.ForMember(display => display.Notifications, expression => expression.Ignore())
.ForMember(display => display.Blueprints, expression => expression.Ignore())
.ForMember(display => display.Errors, expression => expression.Ignore())
.ForMember(display => display.AllowAsRoot, expression => expression.MapFrom(type => type.AllowedAsRoot))
.ForMember(display => display.ListViewEditorName, expression => expression.Ignore())

View File

@@ -165,12 +165,20 @@ namespace Umbraco.Web.Models.Mapping
var listViewTab = new Tab<ContentPropertyDisplay>();
listViewTab.Alias = Constants.Conventions.PropertyGroups.ListViewGroupName;
listViewTab.Label = localizedTextService.Localize("content/childItems");
listViewTab.Id = 25;
listViewTab.Id = display.Tabs.Count() + 1;
listViewTab.IsActive = true;
var listViewConfig = editor.PreValueEditor.ConvertDbToEditor(editor.DefaultPreValues, preVals);
//add the entity type to the config
listViewConfig["entityType"] = entityType;
listViewConfig["entityType"] = entityType;
//Override Tab Label if tabName is provided
if (listViewConfig.ContainsKey("tabName"))
{
var configTabName = listViewConfig["tabName"];
if (configTabName != null && string.IsNullOrWhiteSpace(configTabName.ToString()) == false)
listViewTab.Label = configTabName.ToString();
}
var listViewProperties = new List<ContentPropertyDisplay>();
listViewProperties.Add(new ContentPropertyDisplay

View File

@@ -15,7 +15,6 @@ namespace Umbraco.Web.Models.Mapping
config.CreateMap<TemplateDisplay, Template>()
.ForMember(x => x.DeletedDate, exp => exp.Ignore())
.ForMember(x => x.Key, exp => exp.Ignore())
.ForMember(x => x.Path, exp => exp.Ignore())
.ForMember(x => x.CreateDate, exp => exp.Ignore())
.ForMember(x => x.UpdateDate, exp => exp.Ignore())

View File

@@ -23,7 +23,7 @@ namespace Umbraco.Web.Models.Mapping
.ForMember(detail => detail.Culture, opt => opt.MapFrom(user => user.GetUserCulture(applicationContext.Services.TextService)))
.ForMember(
detail => detail.EmailHash,
opt => opt.MapFrom(user => user.Email.ToLowerInvariant().Trim().ToMd5()))
opt => opt.MapFrom(user => user.Email.ToLowerInvariant().Trim().GenerateHash()))
.ForMember(detail => detail.SecondsUntilTimeout, opt => opt.Ignore());
config.CreateMap<BackOfficeIdentityUser, UserDetail>()
@@ -35,7 +35,7 @@ namespace Umbraco.Web.Models.Mapping
.ForMember(detail => detail.AllowedSections, opt => opt.MapFrom(user => user.AllowedSections))
.ForMember(
detail => detail.EmailHash,
opt => opt.MapFrom(user => user.Email.ToLowerInvariant().Trim().ToMd5()))
opt => opt.MapFrom(user => user.Email.ToLowerInvariant().Trim().GenerateHash()))
.ForMember(detail => detail.SecondsUntilTimeout, opt => opt.Ignore());
config.CreateMap<IProfile, UserBasic>()

View File

@@ -24,6 +24,10 @@ namespace Umbraco.Web.Models
[DataMember(Name = "zipFilePath")]
public string ZipFilePath { get; set; }
/// <summary>
/// During installation this can be used to track any pending appdomain restarts
/// </summary>
[DataMember(Name = "isRestarting")]
public bool IsRestarting { get; set; }
}
}

View File

@@ -1,8 +1,11 @@
namespace Umbraco.Web.Models
using Umbraco.Core.Models;
namespace Umbraco.Web.Models
{
public class RelatedLink : RelatedLinkBase
{
public int? Id { get; internal set; }
internal bool IsDeleted { get; set; }
}
public class RelatedLink : RelatedLinkBase
{
public int? Id { get; internal set; }
internal bool IsDeleted { get; set; }
public IPublishedContent Content { get; set; }
}
}

View File

@@ -1,5 +1,4 @@
using Newtonsoft.Json;
using Umbraco.Core.Models;
namespace Umbraco.Web.Models
{
@@ -15,7 +14,5 @@ namespace Umbraco.Web.Models
public bool IsInternal { get; set; }
[JsonProperty("type")]
public RelatedLinkType Type { get; set; }
[JsonIgnore]
public IPublishedContent Content { get; set; }
}
}