Fix errors and wrong display of subnodes under and unpublished node showing as

published. Also fixes error message where it says on the subnode:
This document is published but is not visible because the parent '???' is unpublished
This commit is contained in:
Sebastiaan Janssen
2012-12-27 17:29:54 -01:00
parent e10cb56502
commit c97085f9bb
3 changed files with 9 additions and 7 deletions

View File

@@ -1182,14 +1182,14 @@ namespace Umbraco.Core.Services
if (id == -20)
return false;
//We don't chech the System Root, so just continue
//We don't check the System Root, so just continue
if (id == -1) continue;
//If the current id equals that of the passed in content and if current shouldn't be checked we skip it.
if (checkCurrent == false && id == content.Id) continue;
//Check if the content for the current id has a published version - escape the loop if we encounter content with no published version
bool hasPublishedVersion = HasPublishedVersion(id);
//Check if the content for the current id is published - escape the loop if we encounter content that isn't published
var hasPublishedVersion = ApplicationContext.Current.Services.ContentService.GetById(id).Published;
if (hasPublishedVersion == false)
return false;
}

View File

@@ -1,6 +1,7 @@
using System;
using System.Web.UI;
using System.Web.UI.WebControls;
using Umbraco.Core.Persistence.Caching;
using umbraco.BusinessLogic.Actions;
using umbraco.IO;
using umbraco.uicontrols.DatePicker;
@@ -378,7 +379,7 @@ namespace umbraco.cms.presentation
void UpdateNiceUrls()
{
if (!_documentHasPublishedVersion)
if (!_documentHasPublishedVersion || _document.Published == false)
{
UpdateNiceUrlProperties("<i>" + ui.Text("content", "itemNotPublished", base.getUser()) + "</i>", null);
return;

View File

@@ -6,6 +6,7 @@ using System.Xml;
using Umbraco.Core;
using Umbraco.Core.Models;
using Umbraco.Core.Logging;
using Umbraco.Core.Persistence.Caching;
using umbraco.BusinessLogic;
using umbraco.BusinessLogic.Actions;
using umbraco.cms.helpers;
@@ -849,8 +850,8 @@ namespace umbraco.cms.businesslogic.web
if (!e.Cancel)
{
ApplicationContext.Current.Services.ContentService.UnPublish(Content, 0, true);
_published = ApplicationContext.Current.Services.ContentService.UnPublish(Content, 0, true);
FireAfterUnPublish(e);
}
}
@@ -1258,7 +1259,7 @@ namespace umbraco.cms.businesslogic.web
if (Content.ReleaseDate.HasValue)
_release = Content.ReleaseDate.Value;
_published = Content.HasPublishedVersion();
_published = Content.Published;
}
[Obsolete("Deprecated", false)]