#18538: Fixing Page Layer Hinting with Autoroute

--HG--
branch : 1.x
This commit is contained in:
Sebastien Ros 2012-03-12 15:02:00 -07:00
parent 4954f3a781
commit 6b36a256b0
2 changed files with 6 additions and 9 deletions

View File

@ -1,4 +1,4 @@
d695b7235fc4f1edf216a610ced8fb9c6e7f29d6 src/Orchard.Web/Modules/Orchard.Autoroute
35c9fddc4d187a0ee48a4599df476ffe4802f143 src/Orchard.Web/Modules/Orchard.Autoroute
214e7b89d42abd00abd4e5fe2b1eb0b181b79946 src/Orchard.Web/Modules/Orchard.Forms
7a1553d61ec49f709395a409a8edfe0956ab991c src/Orchard.Web/Modules/Orchard.Rules
dab42f20280f46c25c6c78ef13870f9a063bd026 src/Orchard.Web/Modules/Orchard.TaskLease

View File

@ -1,23 +1,20 @@
using System.Web.Mvc;
using System.Web.Routing;
using Orchard.ContentManagement.Handlers;
using Orchard.Environment.Extensions;
using Orchard.Localization;
using Orchard.UI.Notify;
using Orchard.Events;
using Orchard.ContentManagement;
using System;
using System.Collections.Generic;
using Orchard.ContentManagement.Aspects;
namespace Orchard.Widgets.Handlers {
public interface IRoutePatternProvider : IEventHandler {
void Routed(IContent content, String path, ICollection<Tuple<string, RouteValueDictionary>> aliases);
public interface IRouteEvents : IEventHandler {
void Routed(IContent content, String path);
}
[OrchardFeature("Orchard.Widgets.PageLayerHinting")]
public class LayerHintHandler : IRoutePatternProvider {
public class LayerHintHandler : IRouteEvents {
public LayerHintHandler(IOrchardServices services, RequestContext requestContext) {
T = NullLocalizer.Instance;
_requestContext = requestContext;
@ -27,12 +24,12 @@ namespace Orchard.Widgets.Handlers {
public IOrchardServices Services { get; set; }
public Localizer T { get; set; }
public void Routed(IContent content, string path, ICollection<Tuple<string, RouteValueDictionary>> aliases) {
public void Routed(IContent content, String path) {
// Only going to help in creating a layer if the content is a page
// TODO: (PH) Any reason not to enable the hint for *all* routed content?
// TODO: (PH:Autoroute) Previously this only ran when the item was first published. Now it's running any time item is published. We want to catch
// that and edit the existing layer rule rather than create a new one.
if (!(content.ContentItem.ContentType == "Page"))
if (content.ContentItem.ContentType != "Page")
return;
var urlHelper = new UrlHelper(_requestContext);