#18524: Fixing cross requests pager parameters

Work Item: 18524

--HG--
branch : 1.x
This commit is contained in:
Sebastien Ros
2012-03-12 14:25:12 -07:00
parent 46ce40359c
commit 9dd013555a
+17 -11
View File
@@ -408,9 +408,6 @@ namespace Orchard.Core.Shapes {
var lastText = LastText ?? T(">>"); var lastText = LastText ?? T(">>");
var gapText = GapText ?? T("..."); var gapText = GapText ?? T("...");
// workaround: get it from the shape instead of parameter
var RouteValues = (object)Shape.RouteValues;
var routeData = new RouteValueDictionary(Html.ViewContext.RouteData.Values); var routeData = new RouteValueDictionary(Html.ViewContext.RouteData.Values);
var queryString = _workContext.Value.HttpContext.Request.QueryString; var queryString = _workContext.Value.HttpContext.Request.QueryString;
if (queryString != null) { if (queryString != null) {
@@ -418,17 +415,26 @@ namespace Orchard.Core.Shapes {
routeData[key] = queryString[key]; routeData[key] = queryString[key];
} }
} }
if (Shape.RouteData != null) { // specific cross-requests route data can be passed to the shape directly (e.g., Orchard.Users)
var shapeRouteData = Shape.RouteData is RouteValueDictionary ? (RouteValueDictionary) RouteValues : new RouteValueDictionary(RouteValues); var shapeRoute = (object)Shape.RouteData;
foreach (var rd in shapeRouteData) {
shapeRouteData[rd.Key] = rd.Value; if (shapeRoute != null) {
var shapeRouteData = shapeRoute as RouteValueDictionary;
if (shapeRouteData == null) {
var route = shapeRoute as RouteData;
if (route != null) {
shapeRouteData = (route).Values;
}
}
if (shapeRouteData != null) {
foreach (var rd in shapeRouteData) {
routeData[rd.Key] = rd.Value;
}
} }
} }
//if (routeData.ContainsKey("id"))
// routeData.Remove("id");
// HACK: MVC 3 is adding a specific value in System.Web.Mvc.Html.ChildActionExtensions.ActionHelper // HACK: MVC 3 is adding a specific value in System.Web.Mvc.Html.ChildActionExtensions.ActionHelper
// when a content item is set as home page, it is rendered by using Html.RenderAction, and the routeData is altered // when a content item is set as home page, it is rendered by using Html.RenderAction, and the routeData is altered
// This code removes this extra route value // This code removes this extra route value