From 595e0ed25c9a8a356c6e6f6e96c0de27278df327 Mon Sep 17 00:00:00 2001 From: TheMonarch Date: Thu, 9 Feb 2012 12:47:19 -0800 Subject: [PATCH 1/7] #18408: Adding missing fields in widget import Work Item: 18408 --HG-- branch : 1.x --- .../Orchard.Widgets/Drivers/WidgetPartDriver.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Orchard.Web/Modules/Orchard.Widgets/Drivers/WidgetPartDriver.cs b/src/Orchard.Web/Modules/Orchard.Widgets/Drivers/WidgetPartDriver.cs index 809efff81..876abd05a 100644 --- a/src/Orchard.Web/Modules/Orchard.Widgets/Drivers/WidgetPartDriver.cs +++ b/src/Orchard.Web/Modules/Orchard.Widgets/Drivers/WidgetPartDriver.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using JetBrains.Annotations; using Orchard.ContentManagement; using Orchard.ContentManagement.Drivers; @@ -76,12 +77,24 @@ namespace Orchard.Widgets.Drivers { if (zone != null) { part.Zone = zone; } + + var renderTitle = context.Attribute(part.PartDefinition.Name, "RenderTitle"); + if (!string.IsNullOrWhiteSpace(renderTitle)) { + part.RenderTitle = Convert.ToBoolean(renderTitle); + } + + var name = context.Attribute(part.PartDefinition.Name, "Name"); + if (name != null) { + part.Name = name; + } } protected override void Exporting(WidgetPart part, ContentManagement.Handlers.ExportContentContext context) { context.Element(part.PartDefinition.Name).SetAttributeValue("Title", part.Title); context.Element(part.PartDefinition.Name).SetAttributeValue("Position", part.Position); context.Element(part.PartDefinition.Name).SetAttributeValue("Zone", part.Zone); + context.Element(part.PartDefinition.Name).SetAttributeValue("RenderTitle", part.RenderTitle); + context.Element(part.PartDefinition.Name).SetAttributeValue("Name", part.Name); } } } \ No newline at end of file From 22bd59410254d95debfcbf16ca27c1b46aaf8ded Mon Sep 17 00:00:00 2001 From: EddieDesk Date: Thu, 9 Feb 2012 13:01:24 -0800 Subject: [PATCH 2/7] #18414: Fixing BloggerPlus support in XmlRpc Work Item: 18414 --HG-- branch : 1.x --- .../Core/XmlRpc/Controllers/HomeController.cs | 8 ++++++-- .../Orchard.Media/Services/XmlRpcHandler.cs | 14 +++++++++++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/Orchard.Web/Core/XmlRpc/Controllers/HomeController.cs b/src/Orchard.Web/Core/XmlRpc/Controllers/HomeController.cs index 50fee0259..a56c62017 100644 --- a/src/Orchard.Web/Core/XmlRpc/Controllers/HomeController.cs +++ b/src/Orchard.Web/Core/XmlRpc/Controllers/HomeController.cs @@ -1,4 +1,6 @@ using System.Collections.Generic; +using System.IO; +using System.Text; using System.Web; using System.Web.Mvc; using Orchard.Core.XmlRpc.Models; @@ -29,8 +31,10 @@ namespace Orchard.Core.XmlRpc.Controllers { if (methodResponse == null) throw new HttpException(500, "TODO: xmlrpc fault"); - var content = _writer.MapMethodResponse(methodResponse).ToString(); - return Content(content, "text/xml"); + var content = new StringBuilder(); + _writer.MapMethodResponse(methodResponse).Save(new StringWriter(content)); + + return Content(content.ToString(), "text/xml"); } private XRpcMethodResponse Dispatch(XRpcMethodCall request) { diff --git a/src/Orchard.Web/Modules/Orchard.Media/Services/XmlRpcHandler.cs b/src/Orchard.Web/Modules/Orchard.Media/Services/XmlRpcHandler.cs index 0183f0a58..7a0759212 100644 --- a/src/Orchard.Web/Modules/Orchard.Media/Services/XmlRpcHandler.cs +++ b/src/Orchard.Web/Modules/Orchard.Media/Services/XmlRpcHandler.cs @@ -65,8 +65,13 @@ namespace Orchard.Media.Services { var name = file.Optional("name"); var bits = file.Optional("bits"); + string directoryName = Path.GetDirectoryName(name); + if (string.IsNullOrWhiteSpace(directoryName)) { // Some clients only pass in a name path that does not contain a directory component. + directoryName = "media"; + } + try { - // delete the file if it already exists, e.g. and updated image in a blog post + // delete the file if it already exists, e.g. an updated image in a blog post // it's safe to delete the file as each content item gets a specific folder _mediaService.DeleteFile(Path.GetDirectoryName(name), Path.GetFileName(name)); } @@ -74,8 +79,11 @@ namespace Orchard.Media.Services { // current way to delete a file if it exists } - string publicUrl = _mediaService.UploadMediaFile(Path.GetDirectoryName(name), Path.GetFileName(name), bits, false); - return new XRpcStruct().Set("url", url.MakeAbsolute(publicUrl)); + string publicUrl = _mediaService.UploadMediaFile(directoryName, Path.GetFileName(name), bits, true); + return new XRpcStruct() // Some clients require all optional attributes to be declared Wordpress responds in this way as well. + .Set("file", publicUrl) + .Set("url", url.MakeAbsolute(publicUrl)) + .Set("type", file.Optional("type")); } } } \ No newline at end of file From 629927ae745eed37de206aaccfc246ac773ca808 Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Thu, 9 Feb 2012 15:15:05 -0800 Subject: [PATCH 3/7] Removing unused references --HG-- branch : 1.x --- src/Orchard/Orchard.Framework.csproj | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/src/Orchard/Orchard.Framework.csproj b/src/Orchard/Orchard.Framework.csproj index 2cb0cbc40..c88f5bd5c 100644 --- a/src/Orchard/Orchard.Framework.csproj +++ b/src/Orchard/Orchard.Framework.csproj @@ -63,11 +63,6 @@ ..\..\lib\autofac\Autofac.Configuration.dll True - - False - ..\..\lib\autofac\Autofac.Integration.Web.dll - True - False ..\..\lib\Castle Windsor 2.0\bin\Castle.Core.dll @@ -78,10 +73,6 @@ ..\..\lib\Castle Windsor 2.0\bin\Castle.DynamicProxy2.dll True - - ..\..\lib\Castle Windsor 2.0\bin\Castle.Services.Logging.Log4netIntegration.dll - True - False ..\..\lib\claysharp\ClaySharp.dll @@ -98,9 +89,6 @@ True - - ..\..\lib\aspnetmvc\Microsoft.Web.Infrastructure.dll - False ..\..\lib\fluentnhibernate\NHibernate.dll @@ -112,7 +100,6 @@ True - 3.5 @@ -144,10 +131,6 @@ False ..\..\lib\aspnetmvc\System.Web.WebPages.dll - - False - ..\..\lib\aspnetmvc\System.Web.WebPages.Deployment.dll - ..\..\lib\aspnetmvc\System.Web.WebPages.Razor.dll From bbfbf0b927452fbf6dc4213d3495817f27c9d9f4 Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Thu, 9 Feb 2012 15:15:33 -0800 Subject: [PATCH 4/7] #18411: Fixing publishing on restricted roles Work Item: 18411 --HG-- branch : 1.x --- .../Core/Contents/Controllers/AdminController.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Orchard.Web/Core/Contents/Controllers/AdminController.cs b/src/Orchard.Web/Core/Contents/Controllers/AdminController.cs index ca7f64cd6..61af3f07e 100644 --- a/src/Orchard.Web/Core/Contents/Controllers/AdminController.cs +++ b/src/Orchard.Web/Core/Contents/Controllers/AdminController.cs @@ -213,7 +213,11 @@ namespace Orchard.Core.Contents.Controllers { [HttpPost, ActionName("Create")] [FormValueRequired("submit.Publish")] public ActionResult CreateAndPublishPOST(string id, string returnUrl) { - if (!Services.Authorizer.Authorize(Permissions.PublishContent, T("Couldn't create content"))) + + // pass a dummy content to the authorization check to check for "own" variations + var dummyContent = _contentManager.New(id); + + if (!Services.Authorizer.Authorize(Permissions.PublishContent, dummyContent, T("Couldn't create content"))) return new HttpUnauthorizedResult(); return CreatePOST(id, returnUrl, contentItem => _contentManager.Publish(contentItem)); From 016f464fd38da81ffe062ffd473a6144437435a1 Mon Sep 17 00:00:00 2001 From: kevink Date: Fri, 10 Feb 2012 11:35:20 -0800 Subject: [PATCH 5/7] Adding comment tokens --HG-- branch : 1.x --- .hgsubstate | 2 +- .../Orchard.Comments/Tokens/CommentTokens.cs | 45 +++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 src/Orchard.Web/Modules/Orchard.Comments/Tokens/CommentTokens.cs diff --git a/.hgsubstate b/.hgsubstate index 9f741571e..dc42b7d06 100644 --- a/.hgsubstate +++ b/.hgsubstate @@ -2,5 +2,5 @@ 6cd31f00d00d734408da2f2928220b0b7e59b293 src/Orchard.Web/Modules/Orchard.Projections 204bdef384f41bb5e463bed6b98a056945a7d839 src/Orchard.Web/Modules/Orchard.Rules ce578373f907c0a55fd91229a344f0755f290174 src/Orchard.Web/Modules/Orchard.TaskLease -cf73534c335f39e6d9695c2a0ce64c426d1be9f2 src/Orchard.Web/Modules/Orchard.Tokens +dfeb1f4ebcdc587267ab21bc6bbd1d5dde96e264 src/Orchard.Web/Modules/Orchard.Tokens 114e75928872042f092b0cc7cafa1a58c208d8ae src/orchard.web/modules/Orchard.Fields diff --git a/src/Orchard.Web/Modules/Orchard.Comments/Tokens/CommentTokens.cs b/src/Orchard.Web/Modules/Orchard.Comments/Tokens/CommentTokens.cs new file mode 100644 index 000000000..94b9dff2b --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.Comments/Tokens/CommentTokens.cs @@ -0,0 +1,45 @@ +using System; +using Orchard.Comments.Models; +using Orchard.ContentManagement; +using Orchard.Events; +using Orchard.Localization; + +namespace Orchard.Comments.Tokens { + public interface ITokenProvider : IEventHandler { + void Describe(dynamic context); + void Evaluate(dynamic context); + } + + public class CommentTokens : ITokenProvider { + private readonly IContentManager _contentManager; + + public CommentTokens(IContentManager contentManager) { + _contentManager = contentManager; + T = NullLocalizer.Instance; + } + + public Localizer T { get; set; } + + public void Describe(dynamic context) { + context.For("Content", T("Content Items"), T("Content Items")) + .Token("CommentedOn", T("Commented On"), T("The content item this comment was created on.")) + .Token("CommentMessage", T("Comment Message"), T("The text of the comment itself")) + .Token("CommentAuthor", T("Comment Author"), T("The author of the comment.")) + ; + } + + public void Evaluate(dynamic context) { + context.For("Content") + .Token("CommentedOn", (Func)(content => content.As().Record.CommentedOn)) + .Chain("CommentedOn", "Content", (Func)(content => _contentManager.Get(content.As().Record.CommentedOn))) + .Token("CommentMessage", (Func)(content => content.As().Record.CommentText)) + .Token("CommentAuthor", (Func)CommentAuthor) + ; + } + + private static string CommentAuthor(IContent comment) { + var commentPart = comment.As(); + return String.IsNullOrWhiteSpace(commentPart.Record.UserName) ? commentPart.Record.Author : commentPart.Record.UserName; + } + } +} \ No newline at end of file From a0a9933f6b9689555b26a74157ce75964efabc1a Mon Sep 17 00:00:00 2001 From: piedone Date: Fri, 10 Feb 2012 11:38:03 -0800 Subject: [PATCH 6/7] #18232: Hide dashboard link if not allowed Work Item: 18232 --HG-- branch : 1.x --- src/Orchard.Web/Core/Shapes/Views/User.cshtml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Orchard.Web/Core/Shapes/Views/User.cshtml b/src/Orchard.Web/Core/Shapes/Views/User.cshtml index cf576b199..5397b3862 100644 --- a/src/Orchard.Web/Core/Shapes/Views/User.cshtml +++ b/src/Orchard.Web/Core/Shapes/Views/User.cshtml @@ -7,7 +7,9 @@ } else { From d4c4db00fc48b39834d9305cc5736c801cf12405 Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Fri, 10 Feb 2012 14:36:49 -0800 Subject: [PATCH 7/7] Adding missing file --HG-- branch : 1.x --- src/Orchard.Web/Modules/Orchard.Comments/Orchard.Comments.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Orchard.Web/Modules/Orchard.Comments/Orchard.Comments.csproj b/src/Orchard.Web/Modules/Orchard.Comments/Orchard.Comments.csproj index 1d4375faa..da35c0986 100644 --- a/src/Orchard.Web/Modules/Orchard.Comments/Orchard.Comments.csproj +++ b/src/Orchard.Web/Modules/Orchard.Comments/Orchard.Comments.csproj @@ -83,6 +83,7 @@ +