Merge branch 'UKFest-6322' of https://github.com/JJCLane/Umbraco-CMS into JJCLane-UKFest-6322
This commit is contained in:
@@ -234,7 +234,7 @@ namespace Umbraco.Core.Persistence.Repositories
|
||||
var processed = 0;
|
||||
do
|
||||
{
|
||||
var descendants = GetPagedResultsByQuery(query, pageIndex, pageSize, out total, "Path", Direction.Ascending);
|
||||
var descendants = GetPagedResultsByQueryNoFilter(query, pageIndex, pageSize, out total, "Path", Direction.Ascending);
|
||||
|
||||
var xmlItems = (from descendant in descendants
|
||||
let xml = serializer(descendant)
|
||||
@@ -728,7 +728,7 @@ namespace Umbraco.Core.Persistence.Repositories
|
||||
/// <param name="content"></param>
|
||||
/// <param name="xml"></param>
|
||||
public void AddOrUpdateContentXml(IContent content, Func<IContent, XElement> xml)
|
||||
{
|
||||
{
|
||||
_contentXmlRepository.AddOrUpdate(new ContentXmlEntity<IContent>(content, xml));
|
||||
}
|
||||
|
||||
@@ -787,6 +787,26 @@ namespace Umbraco.Core.Persistence.Repositories
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets paged content results
|
||||
/// </summary>
|
||||
/// <param name="query">Query to excute</param>
|
||||
/// <param name="pageIndex">Page number</param>
|
||||
/// <param name="pageSize">Page size</param>
|
||||
/// <param name="totalRecords">Total records query would return without paging</param>
|
||||
/// <param name="orderBy">Field to order by</param>
|
||||
/// <param name="orderDirection">Direction to order by</param>
|
||||
/// <returns>An Enumerable list of <see cref="IContent"/> objects</returns>
|
||||
public IEnumerable<IContent> GetPagedResultsByQueryNoFilter(IQuery<IContent> query, long pageIndex, int pageSize, out long totalRecords,
|
||||
string orderBy, Direction orderDirection)
|
||||
{
|
||||
|
||||
return GetPagedResultsByQuery<DocumentDto, Content>(query, pageIndex, pageSize, out totalRecords,
|
||||
new Tuple<string, string>("cmsDocument", "nodeId"),
|
||||
ProcessQuery, orderBy, orderDirection);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IRecycleBinRepository members
|
||||
@@ -826,11 +846,11 @@ namespace Umbraco.Core.Persistence.Repositories
|
||||
var contentTypes = _contentTypeRepository.GetAll(dtos.Select(x => x.ContentVersionDto.ContentDto.ContentTypeId).ToArray())
|
||||
.ToArray();
|
||||
|
||||
|
||||
|
||||
var ids = dtos
|
||||
.Where(dto => dto.TemplateId.HasValue && dto.TemplateId.Value > 0)
|
||||
.Select(x => x.TemplateId.Value).ToArray();
|
||||
|
||||
|
||||
//NOTE: This should be ok for an SQL 'IN' statement, there shouldn't be an insane amount of content types
|
||||
var templates = ids.Length == 0 ? Enumerable.Empty<ITemplate>() : _templateRepository.GetAll(ids).ToArray();
|
||||
|
||||
@@ -972,4 +992,4 @@ namespace Umbraco.Core.Persistence.Repositories
|
||||
_contentXmlRepository.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1977,6 +1977,10 @@ namespace Umbraco.Core.Services
|
||||
var uow = UowProvider.GetUnitOfWork();
|
||||
using (var repository = RepositoryFactory.CreateContentRepository(uow))
|
||||
{
|
||||
if (published == false)
|
||||
{
|
||||
content.ChangePublishedState(PublishedState.Saved);
|
||||
}
|
||||
//Since this is the Save and Publish method, the content should be saved even though the publish fails or isn't allowed
|
||||
if (content.HasIdentity == false)
|
||||
{
|
||||
@@ -2119,6 +2123,22 @@ namespace Umbraco.Core.Services
|
||||
content.Name, content.Id));
|
||||
return PublishStatusType.FailedPathNotPublished;
|
||||
}
|
||||
else if (content.ExpireDate.HasValue && content.ExpireDate.Value > DateTime.MinValue && DateTime.Now > content.ExpireDate.Value)
|
||||
{
|
||||
Logger.Info<ContentService>(
|
||||
string.Format(
|
||||
"Content '{0}' with Id '{1}' has expired and could not be published.",
|
||||
content.Name, content.Id));
|
||||
return PublishStatusType.FailedHasExpired;
|
||||
}
|
||||
else if (content.ReleaseDate.HasValue && content.ReleaseDate.Value > DateTime.MinValue && content.ReleaseDate.Value > DateTime.Now)
|
||||
{
|
||||
Logger.Info<ContentService>(
|
||||
string.Format(
|
||||
"Content '{0}' with Id '{1}' is awaiting release and could not be published.",
|
||||
content.Name, content.Id));
|
||||
return PublishStatusType.FailedAwaitingRelease;
|
||||
}
|
||||
|
||||
return PublishStatusType.Success;
|
||||
}
|
||||
|
||||
@@ -695,6 +695,9 @@ To manage your website, simply open the Umbraco back office and start adding con
|
||||
%0% could not be published because the item is scheduled for release.
|
||||
]]>
|
||||
</key>
|
||||
<key alias="contentPublishedFailedExpired"><![CDATA[
|
||||
%0% could not be published because the item has expired.
|
||||
]]></key>
|
||||
<key alias="contentPublishedFailedInvalid"><![CDATA[
|
||||
%0% could not be published because these properties: %1% did not pass validation rules.
|
||||
]]></key>
|
||||
|
||||
@@ -659,9 +659,17 @@ namespace Umbraco.Web.Editors
|
||||
new[] {string.Format("{0} ({1})", status.ContentItem.Name, status.ContentItem.Id)}).Trim());
|
||||
break;
|
||||
case PublishStatusType.FailedHasExpired:
|
||||
//TODO: We should add proper error messaging for this!
|
||||
display.AddWarningNotification(
|
||||
Services.TextService.Localize("publish"),
|
||||
Services.TextService.Localize("publish/contentPublishedFailedExpired",
|
||||
new[]
|
||||
{
|
||||
string.Format("{0} ({1})", status.ContentItem.Name, status.ContentItem.Id),
|
||||
}).Trim());
|
||||
break;
|
||||
case PublishStatusType.FailedIsTrashed:
|
||||
//TODO: We should add proper error messaging for this!
|
||||
break;
|
||||
case PublishStatusType.FailedContentInvalid:
|
||||
display.AddWarningNotification(
|
||||
Services.TextService.Localize("publish"),
|
||||
|
||||
Reference in New Issue
Block a user