mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-04-05 21:01:35 +08:00
Merge branch '1.8.x' into 1.x
This commit is contained in:
commit
b714088187
src/Orchard.Web/Modules
Orchard.Autoroute/Services
Orchard.Blogs
@ -24,7 +24,7 @@ namespace Orchard.Autoroute.Services {
|
||||
return null;
|
||||
}
|
||||
|
||||
return _contentManager.Get(autorouteRecord.Id).As<AutoroutePart>();
|
||||
return _contentManager.Get(autorouteRecord.ContentItemRecord.Id).As<AutoroutePart>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -153,6 +153,10 @@
|
||||
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
|
||||
<Name>Orchard.Core</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Orchard.Alias\Orchard.Alias.csproj">
|
||||
<Project>{475b6c45-b27c-438b-8966-908b9d6d1077}</Project>
|
||||
<Name>Orchard.Alias</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Orchard.Autoroute\Orchard.Autoroute.csproj">
|
||||
<Project>{66fccd76-2761-47e3-8d11-b45d0001ddaa}</Project>
|
||||
<Name>Orchard.Autoroute</Name>
|
||||
|
@ -1,16 +1,16 @@
|
||||
using Orchard.Alias.Implementation.Holder;
|
||||
using Orchard.Blogs.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web;
|
||||
using System.Web.Routing;
|
||||
using Orchard.Autoroute.Services;
|
||||
using Orchard.Blogs.Models;
|
||||
using Orchard.ContentManagement;
|
||||
|
||||
namespace Orchard.Blogs.Routing {
|
||||
public class ArchiveConstraint : IArchiveConstraint {
|
||||
private readonly IPathResolutionService _pathResolutionService;
|
||||
private readonly IAliasHolder _aliasHolder;
|
||||
|
||||
public ArchiveConstraint(IPathResolutionService pathResolutionService) {
|
||||
_pathResolutionService = pathResolutionService;
|
||||
public ArchiveConstraint(IAliasHolder aliasHolder) {
|
||||
_aliasHolder = aliasHolder;
|
||||
}
|
||||
|
||||
public bool Match(HttpContextBase httpContext, Route route, string parameterName, RouteValueDictionary values, RouteDirection routeDirection) {
|
||||
@ -37,9 +37,21 @@ namespace Orchard.Blogs.Routing {
|
||||
return false;
|
||||
}
|
||||
|
||||
var autoroute = _pathResolutionService.GetPath(path);
|
||||
IDictionary<string, string> routeValues;
|
||||
if (!_aliasHolder.GetMap("Orchard.Blogs").TryGetAlias(path, out routeValues)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return autoroute != null && autoroute.Is<BlogPart>();
|
||||
var isBlog =
|
||||
//routeValues.ContainsKey("area") &&
|
||||
//routeValues["area"] == "Orchard.Blogs" &&
|
||||
routeValues.ContainsKey("controller") &&
|
||||
routeValues["controller"] == "Blog" &&
|
||||
routeValues.ContainsKey("action") &&
|
||||
routeValues["action"] == "Item"
|
||||
;
|
||||
|
||||
return isBlog;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -1,16 +1,15 @@
|
||||
using Orchard.Alias.Implementation.Holder;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web;
|
||||
using System.Web.Routing;
|
||||
using Orchard.Autoroute.Services;
|
||||
using Orchard.Blogs.Models;
|
||||
using Orchard.ContentManagement;
|
||||
|
||||
namespace Orchard.Blogs.Routing {
|
||||
public class RsdConstraint : IRsdConstraint {
|
||||
private readonly IPathResolutionService _pathResolutionService;
|
||||
private readonly IAliasHolder _aliasHolder;
|
||||
|
||||
public RsdConstraint(IPathResolutionService pathResolutionService) {
|
||||
_pathResolutionService = pathResolutionService;
|
||||
public RsdConstraint(IAliasHolder aliasHolder) {
|
||||
_aliasHolder = aliasHolder;
|
||||
}
|
||||
|
||||
public bool Match(HttpContextBase httpContext, Route route, string parameterName, RouteValueDictionary values, RouteDirection routeDirection) {
|
||||
@ -26,9 +25,20 @@ namespace Orchard.Blogs.Routing {
|
||||
return false;
|
||||
}
|
||||
|
||||
var autoroute = _pathResolutionService.GetPath(path);
|
||||
IDictionary<string, string> routeValues;
|
||||
if (!_aliasHolder.GetMap("Orchard.Blogs").TryGetAlias(path, out routeValues)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var isBlog =
|
||||
//routeValues.ContainsKey("area") &&
|
||||
//routeValues["area"] == "Orchard.Blogs" &&
|
||||
routeValues.ContainsKey("controller") &&
|
||||
routeValues["area"] == "Blog" &&
|
||||
routeValues.ContainsKey("action") &&
|
||||
routeValues["area"] == "Item"
|
||||
;
|
||||
|
||||
return autoroute != null && autoroute.Is<BlogPart>();
|
||||
}
|
||||
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user