From 12e1769cd32bc0fcf9446ba1142f6b9feaa73fcc Mon Sep 17 00:00:00 2001 From: Nathan Heskew Date: Thu, 24 Mar 2011 14:52:04 -0700 Subject: [PATCH] Show the widget layer creation hint only when a "Page" type is taken from an unpublished -> published state. The hint won't appear with subsequent publishes of the page *but* it will appear if the page is unpublished then later published. --HG-- branch : dev --- .../Orchard.Widgets/Handlers/LayerHintHandler.cs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.Widgets/Handlers/LayerHintHandler.cs b/src/Orchard.Web/Modules/Orchard.Widgets/Handlers/LayerHintHandler.cs index 65f4116f6..c0b9002f8 100644 --- a/src/Orchard.Web/Modules/Orchard.Widgets/Handlers/LayerHintHandler.cs +++ b/src/Orchard.Web/Modules/Orchard.Widgets/Handlers/LayerHintHandler.cs @@ -1,27 +1,22 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web.Mvc; +using System.Web.Mvc; using System.Web.Routing; -using Orchard.ContentManagement; -using Orchard.ContentManagement.Aspects; -using Orchard.ContentManagement.Drivers; using Orchard.ContentManagement.Handlers; using Orchard.Core.Routable.Models; using Orchard.Environment.Extensions; using Orchard.Localization; using Orchard.UI.Notify; -namespace Orchard.Widgets.Drivers { +namespace Orchard.Widgets.Handlers { [OrchardFeature("Orchard.Widgets.PageLayerHinting")] public class LayerHintHandler : ContentHandler { public LayerHintHandler(IOrchardServices services, RequestContext requestContext) { T = NullLocalizer.Instance; OnPublished((context, part) => { - if (string.IsNullOrWhiteSpace(part.Path)) // only going to help in creating a layer if the content has a path + // only going to help in creating a layer if the content is a page with no previous version and a path + if (!(context.ContentType == "Page" && context.PreviousItemVersionRecord == null && !string.IsNullOrWhiteSpace(part.Path))) return; - + var urlHelper = new UrlHelper(requestContext);