From 9cc218aa0ee5ab29322cc7a1cfe782c734ddd989 Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Tue, 2 Oct 2012 09:45:50 -0700 Subject: [PATCH 1/2] Fixing how tags are updated using XmlRpc --HG-- branch : 1.x --- .../Core/Common/Services/XmlRpcHandler.cs | 8 +++----- .../Modules/Orchard.Tags/Services/XmlRpcHandler.cs | 14 +++----------- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/src/Orchard.Web/Core/Common/Services/XmlRpcHandler.cs b/src/Orchard.Web/Core/Common/Services/XmlRpcHandler.cs index 936ae0876..d2a6fed55 100644 --- a/src/Orchard.Web/Core/Common/Services/XmlRpcHandler.cs +++ b/src/Orchard.Web/Core/Common/Services/XmlRpcHandler.cs @@ -23,8 +23,7 @@ namespace Orchard.Core.Common.Services { switch (context.Request.MethodName) { case "metaWeblog.newPost": MetaWeblogSetCustomCreatedDate( - GetId(context.Response), - Convert.ToString(context.Request.Params[0].Value), + Convert.ToInt32(context.Request.Params[0].Value), Convert.ToString(context.Request.Params[1].Value), Convert.ToString(context.Request.Params[2].Value), (XRpcStruct) context.Request.Params[3].Value, @@ -33,8 +32,7 @@ namespace Orchard.Core.Common.Services { break; case "metaWeblog.editPost": MetaWeblogSetCustomCreatedDate( - GetId(context.Response), - Convert.ToString(context.Request.Params[0].Value), + Convert.ToInt32(context.Request.Params[0].Value), Convert.ToString(context.Request.Params[1].Value), Convert.ToString(context.Request.Params[2].Value), (XRpcStruct) context.Request.Params[3].Value, @@ -44,7 +42,7 @@ namespace Orchard.Core.Common.Services { } } - private void MetaWeblogSetCustomCreatedDate(int contentItemId, string appKey, string userName, string password, XRpcStruct content, bool publish, ICollection drivers) { + private void MetaWeblogSetCustomCreatedDate(int contentItemId, string userName, string password, XRpcStruct content, bool publish, ICollection drivers) { if (!publish) return; diff --git a/src/Orchard.Web/Modules/Orchard.Tags/Services/XmlRpcHandler.cs b/src/Orchard.Web/Modules/Orchard.Tags/Services/XmlRpcHandler.cs index 8d2e31ac4..ce09470ad 100644 --- a/src/Orchard.Web/Modules/Orchard.Tags/Services/XmlRpcHandler.cs +++ b/src/Orchard.Web/Modules/Orchard.Tags/Services/XmlRpcHandler.cs @@ -60,8 +60,7 @@ namespace Orchard.Tags.Services { break; case "metaWeblog.newPost": MetaWeblogUpdateTags( - GetId(context.Response), - Convert.ToString(context.Request.Params[0].Value), + Convert.ToInt32(context.Request.Params[0].Value), Convert.ToString(context.Request.Params[1].Value), Convert.ToString(context.Request.Params[2].Value), (XRpcStruct)context.Request.Params[3].Value, @@ -70,8 +69,7 @@ namespace Orchard.Tags.Services { break; case "metaWeblog.editPost": MetaWeblogUpdateTags( - GetId(context.Response), - Convert.ToString(context.Request.Params[0].Value), + Convert.ToInt32(context.Request.Params[0].Value), Convert.ToString(context.Request.Params[1].Value), Convert.ToString(context.Request.Params[2].Value), (XRpcStruct)context.Request.Params[3].Value, @@ -113,12 +111,6 @@ namespace Orchard.Tags.Services { : null; } - private static int GetId(XRpcMethodResponse response) { - return response != null && response.Params.Count == 1 && response.Params[0].Value is int - ? Convert.ToInt32(response.Params[0].Value) - : 0; - } - private XRpcArray MetaWeblogGetTags(string appKey, string userName, string password) { var user = _membershipService.ValidateUser(userName, password); _authorizationService.CheckAccess(StandardPermissions.AccessAdminPanel, user, null); @@ -139,7 +131,7 @@ namespace Orchard.Tags.Services { return array; } - private void MetaWeblogUpdateTags(int contentItemId, string appKey, string userName, string password, XRpcStruct content, bool publish, ICollection drivers) { + private void MetaWeblogUpdateTags(int contentItemId, string userName, string password, XRpcStruct content, bool publish, ICollection drivers) { var user = _membershipService.ValidateUser(userName, password); var rawTags = content.Optional("mt_keywords"); From 21dd00d46caaf033fc651b2542d49adb67de9da8 Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Tue, 2 Oct 2012 10:50:14 -0700 Subject: [PATCH 2/2] #18977: Fixing tab rendering with query strings Work Item: 18977 --HG-- branch : 1.x --- src/Orchard/UI/Navigation/MenuFilter.cs | 12 +++++++++++- src/Orchard/UI/Navigation/NavigationHelper.cs | 12 +++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/Orchard/UI/Navigation/MenuFilter.cs b/src/Orchard/UI/Navigation/MenuFilter.cs index c396cad67..a7a9c0f52 100644 --- a/src/Orchard/UI/Navigation/MenuFilter.cs +++ b/src/Orchard/UI/Navigation/MenuFilter.cs @@ -1,6 +1,7 @@ using System.Collections.Generic; using System.Linq; using System.Web.Mvc; +using System.Web.Routing; using Orchard.DisplayManagement; using Orchard.Mvc.Filters; using Orchard.UI.Admin; @@ -35,8 +36,17 @@ namespace Orchard.UI.Navigation { IEnumerable menuItems = _navigationManager.BuildMenu(menuName); + // adding query string parameters + var routeData = new RouteValueDictionary(filterContext.RouteData.Values); + var queryString = workContext.HttpContext.Request.QueryString; + if (queryString != null) { + foreach (var key in from string key in queryString.Keys where key != null && !routeData.ContainsKey(key) let value = queryString[key] select key) { + routeData[key] = queryString[key]; + } + } + // Set the currently selected path - Stack selectedPath = NavigationHelper.SetSelectedPath(menuItems, filterContext.RouteData); + Stack selectedPath = NavigationHelper.SetSelectedPath(menuItems, routeData); // Populate main nav dynamic menuShape = _shapeFactory.Menu().MenuName(menuName); diff --git a/src/Orchard/UI/Navigation/NavigationHelper.cs b/src/Orchard/UI/Navigation/NavigationHelper.cs index 3d510b0e8..d58070c85 100644 --- a/src/Orchard/UI/Navigation/NavigationHelper.cs +++ b/src/Orchard/UI/Navigation/NavigationHelper.cs @@ -67,6 +67,16 @@ namespace Orchard.UI.Navigation { /// The current route data. /// A stack with the selection path being the last node the currently selected one. public static Stack SetSelectedPath(IEnumerable menuItems, RouteData currentRouteData) { + return SetSelectedPath(menuItems, currentRouteData.Values); + } + + /// + /// Identifies the currently selected path, starting from the selected node. + /// + /// All the menuitems in the navigation menu. + /// The current route data. + /// A stack with the selection path being the last node the currently selected one. + public static Stack SetSelectedPath(IEnumerable menuItems, RouteValueDictionary currentRouteData) { if (menuItems == null) return null; @@ -78,7 +88,7 @@ namespace Orchard.UI.Navigation { return selectedPath; } - if (RouteMatches(menuItem.RouteValues, currentRouteData.Values)) { + if (RouteMatches(menuItem.RouteValues, currentRouteData)) { menuItem.Selected = true; selectedPath = new Stack();