From e1b9eb60bd8a9e472db16fb459690431eaf9e282 Mon Sep 17 00:00:00 2001 From: Nathan Heskew Date: Thu, 2 Jun 2011 15:43:53 -0700 Subject: [PATCH] Updating the Common feature's XmlRpcHandler to set CreatedUtc to the posted date (when/if it's given) --HG-- branch : 1.x --- .../Core/Common/Services/XmlRpcHandler.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Orchard.Web/Core/Common/Services/XmlRpcHandler.cs b/src/Orchard.Web/Core/Common/Services/XmlRpcHandler.cs index b4a9ff5b9..936ae0876 100644 --- a/src/Orchard.Web/Core/Common/Services/XmlRpcHandler.cs +++ b/src/Orchard.Web/Core/Common/Services/XmlRpcHandler.cs @@ -22,7 +22,7 @@ namespace Orchard.Core.Common.Services { public void Process(XmlRpcContext context) { switch (context.Request.MethodName) { case "metaWeblog.newPost": - MetaWeblogSetCustomPublishedDate( + MetaWeblogSetCustomCreatedDate( GetId(context.Response), Convert.ToString(context.Request.Params[0].Value), Convert.ToString(context.Request.Params[1].Value), @@ -32,7 +32,7 @@ namespace Orchard.Core.Common.Services { context._drivers); break; case "metaWeblog.editPost": - MetaWeblogSetCustomPublishedDate( + MetaWeblogSetCustomCreatedDate( GetId(context.Response), Convert.ToString(context.Request.Params[0].Value), Convert.ToString(context.Request.Params[1].Value), @@ -44,12 +44,12 @@ namespace Orchard.Core.Common.Services { } } - private void MetaWeblogSetCustomPublishedDate(int contentItemId, string appKey, string userName, string password, XRpcStruct content, bool publish, ICollection drivers) { + private void MetaWeblogSetCustomCreatedDate(int contentItemId, string appKey, string userName, string password, XRpcStruct content, bool publish, ICollection drivers) { if (!publish) return; - var publishedUtc = content.Optional("dateCreated"); - if (publishedUtc == null || publishedUtc > DateTime.UtcNow) // only pre-dating of content with the CommonPart + var createdUtc = content.Optional("dateCreated"); + if (createdUtc == null || createdUtc > DateTime.UtcNow) return; var driver = new XmlRpcDriver(item => { @@ -58,10 +58,10 @@ namespace Orchard.Core.Common.Services { var id = (int)item; var contentItem = _contentManager.Get(id, VersionOptions.Latest); - if (contentItem == null || !contentItem.Is()) + if (contentItem == null || !contentItem.Is()) // only pre-dating of content with the CommonPart (obviously) return; - contentItem.As().PublishedUtc = publishedUtc; + contentItem.As().CreatedUtc = createdUtc; }); if (contentItemId > 0)