From c97085f9bb8f666b4e911a02826bd567f7ccc579 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Thu, 27 Dec 2012 17:29:54 -0100 Subject: [PATCH] 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 --- src/Umbraco.Core/Services/ContentService.cs | 6 +++--- .../umbraco.presentation/umbraco/editContent.aspx.cs | 3 ++- src/umbraco.cms/businesslogic/web/Document.cs | 7 ++++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/Umbraco.Core/Services/ContentService.cs b/src/Umbraco.Core/Services/ContentService.cs index 8df5013228..61cdd4bf45 100644 --- a/src/Umbraco.Core/Services/ContentService.cs +++ b/src/Umbraco.Core/Services/ContentService.cs @@ -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; } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/editContent.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/editContent.aspx.cs index 9e8d5d37db..d3b9b7d4a2 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/editContent.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/editContent.aspx.cs @@ -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("" + ui.Text("content", "itemNotPublished", base.getUser()) + "", null); return; diff --git a/src/umbraco.cms/businesslogic/web/Document.cs b/src/umbraco.cms/businesslogic/web/Document.cs index efbb5d4ebe..4055d58f29 100644 --- a/src/umbraco.cms/businesslogic/web/Document.cs +++ b/src/umbraco.cms/businesslogic/web/Document.cs @@ -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)]