Merge branch '1.8.x' into 1.x

This commit is contained in:
Sebastien Ros 2014-04-19 14:49:31 -07:00
commit b714088187
4 changed files with 43 additions and 17 deletions
src/Orchard.Web/Modules

View File

@ -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>();
}
}
}

View File

@ -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>

View File

@ -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;

View File

@ -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;