Fixed editContent.aspx to let the business logic handle the property validation when trying to publish and show the correct status message result (if it was not publishable). Adds the invalid properties collection to the PublishStatus so those can be shown too.

This commit is contained in:
Shannon
2013-07-24 12:54:10 +10:00
parent 4d39ce1202
commit 7f4abb4893
9 changed files with 102 additions and 58 deletions

View File

@@ -27,6 +27,7 @@ namespace Umbraco.Core.Models
private bool _trashed;
private int _contentTypeId;
private PropertyCollection _properties;
private readonly List<Property> _lastInvalidProperties = new List<Property>();
/// <summary>
/// Protected constructor for ContentBase (Base for Content and Media)
@@ -421,7 +422,17 @@ namespace Umbraco.Core.Models
/// <returns>True if content is valid otherwise false</returns>
public virtual bool IsValid()
{
return Properties.Any(property => !property.IsValid()) == false;
_lastInvalidProperties.Clear();
_lastInvalidProperties.AddRange(Properties.Where(property => property.IsValid() == false));
return _lastInvalidProperties.Any() == false;
}
/// <summary>
/// Returns a collection of the result of the last validation process, this collection contains all invalid properties.
/// </summary>
internal IEnumerable<Property> LastInvalidProperties
{
get { return _lastInvalidProperties; }
}
public abstract void ChangeTrashedState(bool isTrashed, int parentId = -20);