From 48a115fb81ab55f7638ae916ad6ae69d3b1f4558 Mon Sep 17 00:00:00 2001 From: Suha Can Date: Mon, 18 Oct 2010 15:33:27 -0700 Subject: [PATCH 1/7] - Refactoring UT to fit concept it's validating. --HG-- branch : dev --- .../Commands/CommandHandlerDescriptorBuilderTests.cs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/Orchard.Tests/Commands/CommandHandlerDescriptorBuilderTests.cs b/src/Orchard.Tests/Commands/CommandHandlerDescriptorBuilderTests.cs index 234e787fa..2de1b3c75 100644 --- a/src/Orchard.Tests/Commands/CommandHandlerDescriptorBuilderTests.cs +++ b/src/Orchard.Tests/Commands/CommandHandlerDescriptorBuilderTests.cs @@ -45,11 +45,13 @@ namespace Orchard.Tests.Commands { var builder = new CommandHandlerDescriptorBuilder(); var descriptor = builder.Build(typeof(PublicMethodsOnly)); Assert.That(descriptor, Is.Not.Null); - Assert.That(descriptor.Commands.Count(), Is.EqualTo(3)); + Assert.That(descriptor.Commands.Count(), Is.EqualTo(1)); Assert.That(descriptor.Commands.Single(d => d.Name == "Method"), Is.Not.Null); } +#pragma warning disable 660,661 public class PublicMethodsOnly { +#pragma warning restore 660,661 public bool Bar { get; set; } // no accessors public bool Field = true; // no field @@ -70,14 +72,6 @@ namespace Orchard.Tests.Commands { return false; } - public override int GetHashCode() { - throw new NotImplementedException(); - } - - public override bool Equals(Object obj) { - throw new NotImplementedException(); - } - public void Method() { } } From 63a2356ecbcce1cb13a28a97d402db7759b12f86 Mon Sep 17 00:00:00 2001 From: Louis DeJardin Date: Mon, 18 Oct 2010 12:49:03 -0700 Subject: [PATCH 2/7] Fixing an overloaded version of ContentShape --HG-- branch : dev extra : rebase_source : 99f13a351b9fd5ca3fc4fa294adc7994ae3a9ce7 --- src/Orchard/ContentManagement/Drivers/ContentPartDriver.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Orchard/ContentManagement/Drivers/ContentPartDriver.cs b/src/Orchard/ContentManagement/Drivers/ContentPartDriver.cs index 146fce428..7506aa975 100644 --- a/src/Orchard/ContentManagement/Drivers/ContentPartDriver.cs +++ b/src/Orchard/ContentManagement/Drivers/ContentPartDriver.cs @@ -42,11 +42,11 @@ namespace Orchard.ContentManagement.Drivers { } public ContentShapeResult ContentShape(string shapeType, Func factory) { - return ContentShapeImplementation(shapeType, null, ctx=>factory(CreateShape(ctx, shapeType))); + return ContentShapeImplementation(shapeType, null, ctx => factory(CreateShape(ctx, shapeType))); } public ContentShapeResult ContentShape(string shapeType, string defaultLocation, Func factory) { - return ContentShapeImplementation(shapeType, defaultLocation, factory); + return ContentShapeImplementation(shapeType, defaultLocation, ctx => factory(CreateShape(ctx, shapeType))); } private ContentShapeResult ContentShapeImplementation(string shapeType, string defaultLocation, Func shapeBuilder) { From 299b2621f7ff3efbf820bea1a12e8f1e7680d616 Mon Sep 17 00:00:00 2001 From: Louis DeJardin Date: Mon, 18 Oct 2010 15:50:06 -0700 Subject: [PATCH 3/7] Fix: Exceptions in commands do cancel transactions (same thing in background tasks) Components that control using() scope for work context will also indicate transaction cancelled when an exception passes out of that scope See http://orchard.codeplex.com/workitem/16604 --HG-- branch : dev extra : rebase_source : 2d53cdbea1e9dd7ceb022f781621b01bb1f95a87 --- src/Orchard/Commands/CommandHostAgent.cs | 14 +++++++++++++- src/Orchard/Tasks/SweepGenerator.cs | 18 +++++++++++++++--- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/src/Orchard/Commands/CommandHostAgent.cs b/src/Orchard/Commands/CommandHostAgent.cs index 05799f2f1..ad19d8655 100644 --- a/src/Orchard/Commands/CommandHostAgent.cs +++ b/src/Orchard/Commands/CommandHostAgent.cs @@ -6,6 +6,7 @@ using System.Web.Mvc; using System.Web.Routing; using Autofac; using Orchard.Caching; +using Orchard.Data; using Orchard.Environment; using Orchard.Environment.Configuration; using Orchard.Environment.State; @@ -48,6 +49,8 @@ namespace Orchard.Commands { tenant = tenant ?? "Default"; using (var env = CreateStandaloneEnvironment(tenant)) { + var commandManager = env.Resolve(); + var transactionManager = env.Resolve(); var parameters = new CommandParameters { Arguments = args, @@ -56,7 +59,16 @@ namespace Orchard.Commands { Output = output }; - env.Resolve().Execute(parameters); + try { + commandManager.Execute(parameters); + } + catch { + // any database changes in this using(env) scope are invalidated + transactionManager.Cancel(); + + // exception handling performed below + throw; + } } // in effect "pump messages" see PostMessage circa 1980 diff --git a/src/Orchard/Tasks/SweepGenerator.cs b/src/Orchard/Tasks/SweepGenerator.cs index 627838b9a..bd1a25076 100644 --- a/src/Orchard/Tasks/SweepGenerator.cs +++ b/src/Orchard/Tasks/SweepGenerator.cs @@ -1,6 +1,7 @@ using System; using System.Timers; using Autofac; +using Orchard.Data; using Orchard.Environment; using Orchard.Logging; @@ -57,9 +58,20 @@ namespace Orchard.Tasks { public void DoWork() { // makes an inner container, similar to the per-request container using (var scope = _workContextAccessor.CreateWorkContextScope()) { - // resolve the manager and invoke it - var manager = scope.Resolve(); - manager.Sweep(); + var transactionManager = scope.Resolve(); + + try { + // resolve the manager and invoke it + var manager = scope.Resolve(); + manager.Sweep(); + } + catch { + // any database changes in this using scope are invalidated + transactionManager.Cancel(); + + // pass exception along to actual handler + throw; + } } } From f3b66f298862109d02cd11972df04fc274d6ce9d Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Mon, 18 Oct 2010 15:52:54 -0700 Subject: [PATCH 4/7] Fixed display of gallery feeds in drop down filters - http://orchardqa.codeplex.com/workitem/86 --HG-- branch : dev --- .../Modules/Orchard.Packaging/Views/Gallery/Modules.cshtml | 2 +- .../Modules/Orchard.Packaging/Views/Gallery/Themes.cshtml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.Packaging/Views/Gallery/Modules.cshtml b/src/Orchard.Web/Modules/Orchard.Packaging/Views/Gallery/Modules.cshtml index cc1fc43c5..8a4d3068b 100644 --- a/src/Orchard.Web/Modules/Orchard.Packaging/Views/Gallery/Modules.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Packaging/Views/Gallery/Modules.cshtml @@ -10,7 +10,7 @@ diff --git a/src/Orchard.Web/Modules/Orchard.Packaging/Views/Gallery/Themes.cshtml b/src/Orchard.Web/Modules/Orchard.Packaging/Views/Gallery/Themes.cshtml index 2f3257c25..ad1922be1 100644 --- a/src/Orchard.Web/Modules/Orchard.Packaging/Views/Gallery/Themes.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Packaging/Views/Gallery/Themes.cshtml @@ -13,7 +13,7 @@ From c1e32eee36f72cb8421fe534592915ef2c4cc1b9 Mon Sep 17 00:00:00 2001 From: Dave Reed Date: Mon, 18 Oct 2010 16:39:47 -0700 Subject: [PATCH 5/7] Convert Localization (partially working) --HG-- branch : dev --- .../Core/Localization/Drivers/LocalizationPartDriver.cs | 5 +++-- src/Orchard.Web/Core/Localization/Placement.info | 3 ++- ...n.cshtml => Localization.ContentTranslations.Edit.cshtml} | 0 src/Orchard.Web/Core/Orchard.Core.csproj | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) rename src/Orchard.Web/Core/Localization/Views/EditorTemplates/Parts/{Localization.Translation.cshtml => Localization.ContentTranslations.Edit.cshtml} (100%) diff --git a/src/Orchard.Web/Core/Localization/Drivers/LocalizationPartDriver.cs b/src/Orchard.Web/Core/Localization/Drivers/LocalizationPartDriver.cs index 060054c92..51216e8c1 100644 --- a/src/Orchard.Web/Core/Localization/Drivers/LocalizationPartDriver.cs +++ b/src/Orchard.Web/Core/Localization/Drivers/LocalizationPartDriver.cs @@ -42,8 +42,9 @@ namespace Orchard.Core.Localization.Drivers { ContentLocalizations = new ContentLocalizationsViewModel(part) { Localizations = localizations } }; - // TODO: andrerod convert to new shape API. Location code kept for reference. - return ContentPartTemplate(model, "Parts/Localization.Translation", TemplatePrefix); //.Location(part.GetLocation("Editor")); + return ContentShape("Parts_Localization_ContentTranslations_Edit", () => { + return shapeHelper.EditorTemplate(TemplateName: "Parts/Localization.ContentTranslations.Edit", Model: model, Prefix: TemplatePrefix); + }); } protected override DriverResult Editor(LocalizationPart part, IUpdateModel updater, dynamic shapeHelper) { diff --git a/src/Orchard.Web/Core/Localization/Placement.info b/src/Orchard.Web/Core/Localization/Placement.info index 94d16bb1b..882598dd0 100644 --- a/src/Orchard.Web/Core/Localization/Placement.info +++ b/src/Orchard.Web/Core/Localization/Placement.info @@ -1,6 +1,7 @@  + @@ -8,6 +9,6 @@ - + \ No newline at end of file diff --git a/src/Orchard.Web/Core/Localization/Views/EditorTemplates/Parts/Localization.Translation.cshtml b/src/Orchard.Web/Core/Localization/Views/EditorTemplates/Parts/Localization.ContentTranslations.Edit.cshtml similarity index 100% rename from src/Orchard.Web/Core/Localization/Views/EditorTemplates/Parts/Localization.Translation.cshtml rename to src/Orchard.Web/Core/Localization/Views/EditorTemplates/Parts/Localization.ContentTranslations.Edit.cshtml diff --git a/src/Orchard.Web/Core/Orchard.Core.csproj b/src/Orchard.Web/Core/Orchard.Core.csproj index a89816130..e18393e31 100644 --- a/src/Orchard.Web/Core/Orchard.Core.csproj +++ b/src/Orchard.Web/Core/Orchard.Core.csproj @@ -256,7 +256,7 @@ - + From e85de1b8841c8c3c7857a8c93255d64fba91e5ff Mon Sep 17 00:00:00 2001 From: Nathan Heskew Date: Mon, 18 Oct 2010 17:05:29 -0700 Subject: [PATCH 6/7] Making the admin menu collapsible once again --HG-- branch : dev --- .../Themes/TheAdmin/Views/Menu.ascx_ | 33 --------------- .../Themes/TheAdmin/Views/Menu.cshtml | 42 ++++++++++++++++--- src/Orchard.Web/Themes/Themes.csproj | 1 + 3 files changed, 37 insertions(+), 39 deletions(-) delete mode 100644 src/Orchard.Web/Themes/TheAdmin/Views/Menu.ascx_ diff --git a/src/Orchard.Web/Themes/TheAdmin/Views/Menu.ascx_ b/src/Orchard.Web/Themes/TheAdmin/Views/Menu.ascx_ deleted file mode 100644 index 37db5707c..000000000 --- a/src/Orchard.Web/Themes/TheAdmin/Views/Menu.ascx_ +++ /dev/null @@ -1,33 +0,0 @@ -<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl" %> -<%@ Import Namespace="Orchard.Mvc.ViewModels"%> - -<%--//todo: get the settings from the cookie to class-ify parts of the menu that should be closed on load--%> -<%-- -<% using (this.Capture("end-of-page-scripts")) { %> - -<% } %>--%> \ No newline at end of file diff --git a/src/Orchard.Web/Themes/TheAdmin/Views/Menu.cshtml b/src/Orchard.Web/Themes/TheAdmin/Views/Menu.cshtml index c234a20ee..9812eeb5e 100644 --- a/src/Orchard.Web/Themes/TheAdmin/Views/Menu.cshtml +++ b/src/Orchard.Web/Themes/TheAdmin/Views/Menu.cshtml @@ -1,14 +1,44 @@ - +@using(Script.Foot()) { + +} \ No newline at end of file diff --git a/src/Orchard.Web/Themes/Themes.csproj b/src/Orchard.Web/Themes/Themes.csproj index 221d200dd..8f2bf8452 100644 --- a/src/Orchard.Web/Themes/Themes.csproj +++ b/src/Orchard.Web/Themes/Themes.csproj @@ -68,6 +68,7 @@ Designer + From 9205dd3b9249b552c1211332d5339a01cf6513c7 Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Mon, 18 Oct 2010 17:13:53 -0700 Subject: [PATCH 7/7] Adding Version information to feed items in the Gallery feed - Renaming to "Orchard Exntensions Gallery" --HG-- branch : dev --- .../Modules/Orchard.Packaging/Views/Gallery/Modules.cshtml | 4 +++- .../Controllers/FeedController.cs | 4 ++++ src/Tools/PackageIndexReferenceImplementation/Web.config | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.Packaging/Views/Gallery/Modules.cshtml b/src/Orchard.Web/Modules/Orchard.Packaging/Views/Gallery/Modules.cshtml index 8a4d3068b..1ae31e8cc 100644 --- a/src/Orchard.Web/Modules/Orchard.Packaging/Views/Gallery/Modules.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Packaging/Views/Gallery/Modules.cshtml @@ -1,4 +1,6 @@ @model Orchard.Packaging.ViewModels.PackagingModulesViewModel +@using System.Linq; + @{ Style.Require("PackagingAdmin"); }

@Html.TitleForPage(T("Browse Gallery - Modules").ToString())

@@ -23,7 +25,7 @@ @foreach (var item in Model.Modules) {
  • -

    @(item.SyndicationItem.Title == null ? T("(No title)").Text : item.SyndicationItem.Title.Text) - @T("Version: {0}", "1.0")

    +

    @(item.SyndicationItem.Title == null ? T("(No title)").Text : item.SyndicationItem.Title.Text) - @T("Version: {0}", item.SyndicationItem.ElementExtensions.ReadElementExtensions("Version", "http://orchardproject.net").FirstOrDefault() ?? T("N/A").Text)