mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Cut all ties to Routable module
--HG-- branch : autoroute
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
72d4e648204d19d918c5eddec55c7be73d05a00d src/Orchard.Web/Modules/Orchard.Alias
|
||||
2324a4ee85573614dad9df657d383cf541d34d54 src/Orchard.Web/Modules/Orchard.Autoroute
|
||||
bdbb631a4a7ba0ffcd59269b79a5084065c0a9f7 src/Orchard.Web/Modules/Orchard.Alias
|
||||
99ad03b59b759dfea5246c10ef2a90475aa8a350 src/Orchard.Web/Modules/Orchard.Autoroute
|
||||
ec573e5476f7e8a5a61593d6393e9985e9484fcc src/Orchard.Web/Modules/Orchard.Forms
|
||||
0d1100754d594a2977eaab40630f1c46a9e8cf2c src/Orchard.Web/Modules/Orchard.Projections
|
||||
e793a7bbb75d025193b89d5f6647bde444b4868f src/Orchard.Web/Modules/Orchard.Projections
|
||||
bf1f2857f36786c66013e0dee3c37e94cd26465e src/Orchard.Web/Modules/Orchard.Routable
|
||||
01b83c05050bb731d9f69256bbe8884d458ea1c9 src/Orchard.Web/Modules/Orchard.Rules
|
||||
65057c6a5cd71f7994ba9bcbeece50dbb737620e src/Orchard.Web/Modules/Orchard.TaskLease
|
||||
|
@@ -16,7 +16,6 @@ using Orchard.Core.Feeds.Controllers;
|
||||
using Orchard.Core.Feeds.Models;
|
||||
using Orchard.Core.Feeds.Rss;
|
||||
using Orchard.Core.Feeds.StandardBuilders;
|
||||
using Orchard.Core.Routable.Models;
|
||||
using Orchard.Tests.Modules;
|
||||
using Orchard.Tests.Stubs;
|
||||
using Orchard.Core.Title.Models;
|
||||
|
@@ -105,7 +105,6 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="Common\Providers\CommonPartProviderTests.cs" />
|
||||
<Compile Include="Body\BodyPartTests.cs" />
|
||||
<Compile Include="Routable\Services\RoutableServiceTests.cs" />
|
||||
<Compile Include="Feeds\Controllers\FeedControllerTests.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Scheduling\ScheduledTaskManagerTests.cs" />
|
||||
|
@@ -8,8 +8,6 @@ using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Aspects;
|
||||
using Orchard.Core.Common.Models;
|
||||
using Orchard.Core.Navigation.Models;
|
||||
using Orchard.Core.Routable.Models;
|
||||
using Orchard.Core.Routable.Services;
|
||||
using Orchard.Security;
|
||||
using Orchard.Blogs.Services;
|
||||
using Orchard.Core.Navigation.Services;
|
||||
|
@@ -5,7 +5,6 @@ using Orchard.Blogs.Extensions;
|
||||
using Orchard.Blogs.Routing;
|
||||
using Orchard.Blogs.Services;
|
||||
using Orchard.Core.Feeds;
|
||||
using Orchard.Core.Routable.Services;
|
||||
using Orchard.DisplayManagement;
|
||||
using Orchard.Logging;
|
||||
using Orchard.Mvc;
|
||||
|
@@ -21,10 +21,10 @@ namespace Orchard.Blogs.Controllers {
|
||||
|
||||
protected ILogger Logger { get; set; }
|
||||
|
||||
public ActionResult Rsd(string blogPath) {
|
||||
public ActionResult Rsd(int blogId) {
|
||||
Logger.Debug("RSD requested");
|
||||
|
||||
BlogPart blogPart = _blogService.Get(blogPath);
|
||||
BlogPart blogPart = _blogService.Get(blogId);
|
||||
|
||||
if (blogPart == null)
|
||||
return HttpNotFound();
|
||||
|
@@ -5,7 +5,7 @@ using Orchard.Blogs.ViewModels;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.ContentManagement.Handlers;
|
||||
using Orchard.Core.Routable.Models;
|
||||
using System;
|
||||
|
||||
namespace Orchard.Blogs.Drivers {
|
||||
public class BlogArchivesPartDriver : ContentPartDriver<BlogArchivesPart> {
|
||||
@@ -25,7 +25,7 @@ namespace Orchard.Blogs.Drivers {
|
||||
protected override DriverResult Display(BlogArchivesPart part, string displayType, dynamic shapeHelper) {
|
||||
return ContentShape("Parts_Blogs_BlogArchives",
|
||||
() => {
|
||||
BlogPart blog = GetBlogFromSlug(part.ForBlog);
|
||||
BlogPart blog = _blogService.Get(part.ForBlog);
|
||||
|
||||
if (blog == null)
|
||||
return null;
|
||||
@@ -36,7 +36,7 @@ namespace Orchard.Blogs.Drivers {
|
||||
|
||||
protected override DriverResult Editor(BlogArchivesPart part, dynamic shapeHelper) {
|
||||
var viewModel = new BlogArchivesViewModel {
|
||||
Slug = part.ForBlog,
|
||||
BlogId = part.ForBlog,
|
||||
Blogs = _blogService.Get().ToList().OrderBy(b => b.Name)
|
||||
};
|
||||
|
||||
@@ -47,27 +47,22 @@ namespace Orchard.Blogs.Drivers {
|
||||
protected override DriverResult Editor(BlogArchivesPart part, IUpdateModel updater, dynamic shapeHelper) {
|
||||
var viewModel = new BlogArchivesViewModel();
|
||||
if (updater.TryUpdateModel(viewModel, Prefix, null, null)) {
|
||||
part.ForBlog = viewModel.Slug;
|
||||
part.ForBlog = viewModel.BlogId;
|
||||
}
|
||||
|
||||
return Editor(part, shapeHelper);
|
||||
}
|
||||
|
||||
protected override void Importing(BlogArchivesPart part, ImportContentContext context) {
|
||||
var blogSlug = context.Attribute(part.PartDefinition.Name, "BlogSlug");
|
||||
if (blogSlug != null) {
|
||||
part.ForBlog = blogSlug;
|
||||
var blogId = context.Attribute(part.PartDefinition.Name, "BlogId");
|
||||
if (blogId != null) {
|
||||
part.ForBlog = Convert.ToInt32(blogId);
|
||||
}
|
||||
}
|
||||
|
||||
protected override void Exporting(BlogArchivesPart part, ExportContentContext context) {
|
||||
context.Element(part.PartDefinition.Name).SetAttributeValue("BlogSlug", part.ForBlog);
|
||||
context.Element(part.PartDefinition.Name).SetAttributeValue("BlogId", part.ForBlog);
|
||||
}
|
||||
|
||||
private BlogPart GetBlogFromSlug(string slug) {
|
||||
return _contentManager.Query<BlogPart, BlogPartRecord>()
|
||||
.Join<RoutePartRecord>().Where(rr => rr.Slug == slug)
|
||||
.List().FirstOrDefault();
|
||||
}
|
||||
}
|
||||
}
|
@@ -7,8 +7,6 @@ using Orchard.Blogs.Models;
|
||||
using Orchard.Blogs.Routing;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Handlers;
|
||||
using Orchard.Core.Routable.Models;
|
||||
using Orchard.Core.Routable.Services;
|
||||
using Orchard.Data;
|
||||
using Orchard.Services;
|
||||
|
||||
|
@@ -6,7 +6,6 @@ using Orchard.Blogs.Services;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Handlers;
|
||||
using Orchard.Core.Common.Models;
|
||||
using Orchard.Core.Routable.Models;
|
||||
|
||||
namespace Orchard.Blogs.Handlers {
|
||||
[UsedImplicitly]
|
||||
|
@@ -1,13 +1,15 @@
|
||||
using Orchard.ContentManagement;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Orchard.Blogs.Models {
|
||||
/// <summary>
|
||||
/// The content part used by the BlogArchives widget
|
||||
/// </summary>
|
||||
public class BlogArchivesPart : ContentPart<BlogArchivesPartRecord> {
|
||||
public string ForBlog {
|
||||
get { return Record.BlogSlug; }
|
||||
set { Record.BlogSlug = value; }
|
||||
[Required]
|
||||
public int ForBlog {
|
||||
get { return Record.BlogId; }
|
||||
set { Record.BlogId = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -6,10 +6,6 @@ namespace Orchard.Blogs.Models {
|
||||
/// The content part used by the BlogArchives widget
|
||||
/// </summary>
|
||||
public class BlogArchivesPartRecord : ContentPartRecord {
|
||||
public const ushort DefaultBlogSlugLength = 255;
|
||||
|
||||
[StringLength(DefaultBlogSlugLength)]
|
||||
[Required]
|
||||
public virtual string BlogSlug { get; set; }
|
||||
public virtual int BlogId { get; set; }
|
||||
}
|
||||
}
|
||||
|
@@ -2,19 +2,14 @@ using System;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Aspects;
|
||||
using Orchard.Core.Common.Models;
|
||||
using Orchard.Core.Routable.Models;
|
||||
using Orchard.Security;
|
||||
using Orchard.Core.Title.Models;
|
||||
|
||||
namespace Orchard.Blogs.Models {
|
||||
public class BlogPostPart : ContentPart {
|
||||
public string Title {
|
||||
get { return this.As<RoutePart>().Title; }
|
||||
set { this.As<RoutePart>().Title = value; }
|
||||
}
|
||||
|
||||
public string Slug {
|
||||
get { return this.As<RoutePart>().Slug; }
|
||||
set { this.As<RoutePart>().Slug = value; }
|
||||
get { return this.As<TitlePart>().Title; }
|
||||
set { this.As<TitlePart>().Title = value; }
|
||||
}
|
||||
|
||||
public string Text {
|
||||
|
@@ -4,6 +4,7 @@ using Orchard.ContentManagement;
|
||||
namespace Orchard.Blogs.Models {
|
||||
public class RecentBlogPostsPart : ContentPart<RecentBlogPostsPartRecord> {
|
||||
|
||||
[Required]
|
||||
public int ForBlog {
|
||||
get { return Record.BlogId; }
|
||||
set { Record.BlogId = value; }
|
||||
|
@@ -5,7 +5,7 @@ using Orchard.Blogs.Models;
|
||||
using Orchard.Blogs.Routing;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Aspects;
|
||||
using Orchard.Core.Routable.Models;
|
||||
using Orchard.Core.Title.Models;
|
||||
|
||||
namespace Orchard.Blogs.Services {
|
||||
[UsedImplicitly]
|
||||
@@ -17,11 +17,8 @@ namespace Orchard.Blogs.Services {
|
||||
_contentManager = contentManager;
|
||||
_blogPathConstraint = blogPathConstraint;
|
||||
}
|
||||
|
||||
public BlogPart Get(string path) {
|
||||
return _contentManager.Query<BlogPart, BlogPartRecord>()
|
||||
.Join<RoutePartRecord>().Where(rr => rr.Path == path)
|
||||
.List().FirstOrDefault();
|
||||
public BlogPart Get(int id) {
|
||||
return _contentManager.Get<BlogPart>(id);
|
||||
}
|
||||
|
||||
public ContentItem Get(int id, VersionOptions versionOptions) {
|
||||
@@ -34,17 +31,11 @@ namespace Orchard.Blogs.Services {
|
||||
|
||||
public IEnumerable<BlogPart> Get(VersionOptions versionOptions) {
|
||||
return _contentManager.Query<BlogPart, BlogPartRecord>(versionOptions)
|
||||
.Join<RoutePartRecord>()
|
||||
.Join<TitlePartRecord>()
|
||||
.OrderBy(br => br.Title)
|
||||
.List();
|
||||
}
|
||||
|
||||
public BlogPart GetFromSlug(string slug) {
|
||||
return _contentManager.Query<BlogPart, BlogPartRecord>()
|
||||
.Join<RoutePartRecord>().Where(rr => rr.Slug == slug)
|
||||
.List().FirstOrDefault();
|
||||
}
|
||||
|
||||
public void Delete(ContentItem blog) {
|
||||
_contentManager.Remove(blog);
|
||||
}
|
||||
|
@@ -4,7 +4,7 @@ using Orchard.ContentManagement;
|
||||
|
||||
namespace Orchard.Blogs.Services {
|
||||
public interface IBlogService : IDependency {
|
||||
BlogPart Get(string path);
|
||||
BlogPart Get(int id);
|
||||
ContentItem Get(int id, VersionOptions versionOptions);
|
||||
IEnumerable<BlogPart> Get();
|
||||
IEnumerable<BlogPart> Get(VersionOptions versionOptions);
|
||||
|
@@ -29,18 +29,16 @@ namespace Orchard.Blogs.Services {
|
||||
private readonly IContentManager _contentManager;
|
||||
private readonly IAuthorizationService _authorizationService;
|
||||
private readonly IMembershipService _membershipService;
|
||||
private readonly IRoutableService _routableService;
|
||||
private readonly RouteCollection _routeCollection;
|
||||
|
||||
public XmlRpcHandler(IBlogService blogService, IBlogPostService blogPostService, IContentManager contentManager,
|
||||
IAuthorizationService authorizationService, IMembershipService membershipService, IRoutableService routableService,
|
||||
IAuthorizationService authorizationService, IMembershipService membershipService,
|
||||
RouteCollection routeCollection) {
|
||||
_blogService = blogService;
|
||||
_blogPostService = blogPostService;
|
||||
_contentManager = contentManager;
|
||||
_authorizationService = authorizationService;
|
||||
_membershipService = membershipService;
|
||||
_routableService = routableService;
|
||||
_routeCollection = routeCollection;
|
||||
Logger = NullLogger.Instance;
|
||||
T = NullLocalizer.Instance;
|
||||
@@ -205,12 +203,15 @@ namespace Orchard.Blogs.Services {
|
||||
blogPost.As<ICommonPart>().Container = blog;
|
||||
}
|
||||
|
||||
//RoutePart
|
||||
if (blogPost.Is<RoutePart>()) {
|
||||
blogPost.As<RoutePart>().Title = HttpUtility.HtmlDecode(title);
|
||||
blogPost.As<RoutePart>().Slug = slug;
|
||||
_routableService.FillSlugFromTitle(blogPost.As<RoutePart>());
|
||||
blogPost.As<RoutePart>().Path = blogPost.As<RoutePart>().GetPathWithSlug(blogPost.As<RoutePart>().Slug);
|
||||
//TitlePart
|
||||
if (blogPost.Is<TitlePart>()) {
|
||||
blogPost.As<TitlePart>().Title = HttpUtility.HtmlDecode(title);
|
||||
}
|
||||
|
||||
//AutoroutePart
|
||||
dynamic dBlogPost = blogPost;
|
||||
if (dBlogPost.AutoroutePart!=null){
|
||||
dBlogPost.AutoroutePart.Alias = slug;
|
||||
}
|
||||
|
||||
_contentManager.Create(blogPost, VersionOptions.Draft);
|
||||
@@ -286,12 +287,14 @@ namespace Orchard.Blogs.Services {
|
||||
blogPost.As<BodyPart>().Text = description;
|
||||
}
|
||||
|
||||
//RoutePart
|
||||
//TitlePart
|
||||
if (blogPost.Is<TitlePart>()) {
|
||||
blogPost.As<TitlePart>().Title = HttpUtility.HtmlDecode(title);
|
||||
blogPost.As<RoutePart>().Slug = slug;
|
||||
_routableService.FillSlugFromTitle(blogPost.As<RoutePart>());
|
||||
blogPost.As<RoutePart>().Path = blogPost.As<RoutePart>().GetPathWithSlug(blogPost.As<RoutePart>().Slug);
|
||||
}
|
||||
//AutoroutePart
|
||||
dynamic dBlogPost = blogPost;
|
||||
if (dBlogPost.AutoroutePart != null) {
|
||||
dBlogPost.AutoroutePart.Alias = slug;
|
||||
}
|
||||
|
||||
// try to get the UTC timezone by default
|
||||
@@ -360,10 +363,14 @@ namespace Orchard.Blogs.Services {
|
||||
var blogStruct = new XRpcStruct()
|
||||
.Set("postid", blogPostPart.Id)
|
||||
.Set("title", HttpUtility.HtmlEncode(blogPostPart.Title))
|
||||
.Set("wp_slug", blogPostPart.Slug)
|
||||
|
||||
.Set("description", blogPostPart.Text)
|
||||
.Set("link", url)
|
||||
.Set("permaLink", url);
|
||||
dynamic dBlogPost = blogPostPart;
|
||||
if (dBlogPost.AutoroutePart != null) {
|
||||
blogStruct.Set("wp_slug", dBlogPost.AutoroutePart.Alias);
|
||||
}
|
||||
|
||||
if (blogPostPart.PublishedUtc != null) {
|
||||
blogStruct.Set("dateCreated", blogPostPart.PublishedUtc);
|
||||
|
@@ -3,7 +3,7 @@ using Orchard.Blogs.Models;
|
||||
|
||||
namespace Orchard.Blogs.ViewModels {
|
||||
public class BlogArchivesViewModel {
|
||||
public string Slug { get; set; }
|
||||
public IEnumerable<BlogPart> Blogs { get; set; }
|
||||
public int BlogId { get; set; }
|
||||
}
|
||||
}
|
@@ -1,15 +1,14 @@
|
||||
@model Orchard.Blogs.ViewModels.BlogArchivesViewModel
|
||||
|
||||
@using Orchard.Blogs.Models;
|
||||
@using Orchard.Core.Routable.Models;
|
||||
@using Orchard.ContentManagement;
|
||||
|
||||
<fieldset>
|
||||
<div>
|
||||
@Html.LabelFor(m => m.Slug, T("For Blog"))
|
||||
<select id="@Html.FieldIdFor(m => m.Slug)" name="@Html.FieldNameFor(m => m.Slug)">
|
||||
@Html.LabelFor(m => m.BlogId, T("For Blog"))
|
||||
<select id="@Html.FieldIdFor(m => m.BlogId)" name="@Html.FieldNameFor(m => m.BlogId)">
|
||||
@foreach(BlogPart blog in Model.Blogs) {
|
||||
@Html.SelectOption(Model.Slug, blog.As<RoutePart>().Slug, blog.Name)
|
||||
@Html.SelectOption(Model.BlogId, blog.ContentItem.Id, blog.Name)
|
||||
}
|
||||
</select>
|
||||
<span class="hint">@T("Select which blog you want to display the archives for")</span>
|
||||
|
@@ -3,9 +3,9 @@ using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Aspects;
|
||||
using Orchard.Core.Common.Models;
|
||||
using Orchard.Core.Navigation.Models;
|
||||
using Orchard.Core.Routable.Models;
|
||||
using Orchard.Environment.Extensions;
|
||||
using Orchard.Security;
|
||||
using Orchard.Core.Title.Models;
|
||||
|
||||
namespace Orchard.Experimental.Commands {
|
||||
[OrchardFeature("Profiling")]
|
||||
@@ -26,9 +26,7 @@ namespace Orchard.Experimental.Commands {
|
||||
var pageName = "page" + index;
|
||||
var page = _contentManager.Create("Page", VersionOptions.Draft);
|
||||
page.As<ICommonPart>().Owner = admin;
|
||||
page.As<RoutePart>().Slug = pageName;
|
||||
page.As<RoutePart>().Path = pageName;
|
||||
page.As<RoutePart>().Title = pageName;
|
||||
page.As<TitlePart>().Title = pageName;
|
||||
page.As<BodyPart>().Text = pageName;
|
||||
page.As<MenuPart>().OnMainMenu = true;
|
||||
page.As<MenuPart>().MenuPosition = "5." + index;
|
||||
@@ -38,9 +36,7 @@ namespace Orchard.Experimental.Commands {
|
||||
var blogName = "blog" + index;
|
||||
var blog = _contentManager.New("Blog");
|
||||
blog.As<ICommonPart>().Owner = admin;
|
||||
blog.As<RoutePart>().Slug = blogName;
|
||||
blog.As<RoutePart>().Path = blogName;
|
||||
blog.As<RoutePart>().Title = blogName;
|
||||
blog.As<TitlePart>().Title = blogName;
|
||||
blog.As<MenuPart>().OnMainMenu = true;
|
||||
blog.As<MenuPart>().MenuPosition = "6." + index;
|
||||
blog.As<MenuPart>().MenuText = blogName;
|
||||
|
@@ -5,7 +5,6 @@ using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Aspects;
|
||||
using Orchard.Core.Contents.Controllers;
|
||||
using Orchard.Core.Contents.Settings;
|
||||
using Orchard.Core.Routable.Models;
|
||||
using Orchard.DisplayManagement;
|
||||
using Orchard.Localization.Models;
|
||||
using Orchard.Localization.Services;
|
||||
@@ -54,11 +53,12 @@ namespace Orchard.Localization.Controllers {
|
||||
?? _cultureManager.GetCurrentCulture(HttpContext); // could be null but the person doing the translating might be translating into their current culture
|
||||
|
||||
//todo: need a better solution for modifying some parts when translating - or go with a completely different experience
|
||||
/*
|
||||
if (contentItem.Has<RoutePart>()) {
|
||||
RoutePart routePart = contentItem.As<RoutePart>();
|
||||
routePart.Slug = string.Format("{0}{2}{1}", routePart.Slug, siteCultures.Any(s => string.Equals(s, selectedCulture, StringComparison.OrdinalIgnoreCase)) ? selectedCulture : "", !string.IsNullOrWhiteSpace(routePart.Slug) ? "-" : "");
|
||||
routePart.Path = null;
|
||||
}
|
||||
}*/
|
||||
|
||||
if (contentItem.As<LocalizationPart>().Culture != null)
|
||||
contentItem.As<LocalizationPart>().Culture.Culture = null;
|
||||
|
@@ -3,7 +3,6 @@ using Orchard.Commands;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Aspects;
|
||||
using Orchard.Core.Common.Models;
|
||||
using Orchard.Core.Routable.Models;
|
||||
using Orchard.Security;
|
||||
using Orchard.Settings;
|
||||
using Orchard.Core.Title.Models;
|
||||
|
@@ -1,35 +1,52 @@
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Routing;
|
||||
using Orchard.ContentManagement.Handlers;
|
||||
using Orchard.Core.Routable.Models;
|
||||
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 IAutorouteEventHandler : IEventHandler {
|
||||
void Routed(IContent content, String path, ICollection<Tuple<string, RouteValueDictionary>> aliases);
|
||||
}
|
||||
|
||||
[OrchardFeature("Orchard.Widgets.PageLayerHinting")]
|
||||
public class LayerHintHandler : ContentHandler {
|
||||
public class LayerHintHandler : IAutorouteEventHandler {
|
||||
public LayerHintHandler(IOrchardServices services, RequestContext requestContext) {
|
||||
T = NullLocalizer.Instance;
|
||||
|
||||
OnPublished<RoutePart>((context, part) => {
|
||||
// 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);
|
||||
var pathForLayer = "~/" + part.Path;
|
||||
services.Notifier.Information(T("Would you like to <a href=\"{0}\">add a widget layer</a> for \"{1}\"?",
|
||||
urlHelper.Action("AddLayer", "Admin", new {
|
||||
area = "Orchard.Widgets",
|
||||
name = part.Title,
|
||||
layerRule = string.Format("url \"{0}\"", pathForLayer),
|
||||
description = T("A widget layer for \"{0}\" at \"{1}\".", part.Title, pathForLayer)
|
||||
}),
|
||||
part.Title));
|
||||
});
|
||||
_requestContext = requestContext;
|
||||
Services = services;
|
||||
}
|
||||
|
||||
private readonly RequestContext _requestContext;
|
||||
public IOrchardServices Services { get; set; }
|
||||
public Localizer T { get; set; }
|
||||
|
||||
public void Routed(IContent content, string path, ICollection<Tuple<string, RouteValueDictionary>> aliases) {
|
||||
// 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 ideally we want to run this any time the route
|
||||
// has *changed*.
|
||||
if (!(content.ContentItem.ContentType == "Page"))
|
||||
return;
|
||||
|
||||
var urlHelper = new UrlHelper(_requestContext);
|
||||
var pathForLayer = "~/" + path;
|
||||
var title = content.ContentItem.ContentManager.GetItemMetadata(content).DisplayText;
|
||||
|
||||
Services.Notifier.Information(T("Would you like to <a href=\"{0}\">add a widget layer</a> for \"{1}\"?",
|
||||
urlHelper.Action("AddLayer", "Admin", new {
|
||||
area = "Orchard.Widgets",
|
||||
name = title,
|
||||
layerRule = string.Format("url \"{0}\"", pathForLayer),
|
||||
description = T("A widget layer for \"{0}\" at \"{1}\".", title, pathForLayer)
|
||||
}),
|
||||
title));
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user