From b85ac2ec9d7cb8755a1038688aaa11e73dbebda1 Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Mon, 22 Oct 2012 14:55:57 -0700 Subject: [PATCH 01/13] #19169: Fixing Custom Forms redirection scenarios Work Item: 19169 --HG-- branch : 1.x --- .../Orchard.CustomForms/Controllers/ItemController.cs | 6 ++++-- .../Orchard.CustomForms/Drivers/CustomFormPartDriver.cs | 3 +-- .../Views/Parts.CustomForm.Wrapper.cshtml | 3 +-- src/Orchard/Utility/Extensions/HttpRequestExtensions.cs | 4 ++++ 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.CustomForms/Controllers/ItemController.cs b/src/Orchard.Web/Modules/Orchard.CustomForms/Controllers/ItemController.cs index ad94a6a3f..5c3e14edf 100644 --- a/src/Orchard.Web/Modules/Orchard.CustomForms/Controllers/ItemController.cs +++ b/src/Orchard.Web/Modules/Orchard.CustomForms/Controllers/ItemController.cs @@ -131,8 +131,9 @@ namespace Orchard.CustomForms.Controllers { foreach (var error in ModelState.Values.SelectMany(m => m.Errors).Select(e => e.ErrorMessage)) { Services.Notifier.Error(T(error)); } + if (returnUrl != null) { - return Redirect(returnUrl); + return this.RedirectLocal(returnUrl); } } @@ -165,7 +166,8 @@ namespace Orchard.CustomForms.Controllers { } } - return this.RedirectLocal(returnUrl, () => Redirect(Request.RawUrl)); + var referrer = Request.UrlReferrer != null ? Request.UrlReferrer.ToString() : null; + return this.RedirectLocal(returnUrl, () => this.RedirectLocal(referrer, () => Redirect(Request.RawUrl))); } bool IUpdateModel.TryUpdateModel(TModel model, string prefix, string[] includeProperties, string[] excludeProperties) { diff --git a/src/Orchard.Web/Modules/Orchard.CustomForms/Drivers/CustomFormPartDriver.cs b/src/Orchard.Web/Modules/Orchard.CustomForms/Drivers/CustomFormPartDriver.cs index 85a163fde..f73a1d889 100644 --- a/src/Orchard.Web/Modules/Orchard.CustomForms/Drivers/CustomFormPartDriver.cs +++ b/src/Orchard.Web/Modules/Orchard.CustomForms/Drivers/CustomFormPartDriver.cs @@ -33,8 +33,7 @@ namespace Orchard.CustomForms.Drivers { return ContentShape("Parts_CustomForm_Wrapper", () => { return shapeHelper.Parts_CustomForm_Wrapper() .Editor(_orchardServices.ContentManager.BuildEditor(contentItem)) - .ContenItem(part) - .ReturnUrl(part.Redirect ? part.RedirectUrl : _orchardServices.WorkContext.HttpContext.Request.RawUrl); + .ContenItem(part); }); } diff --git a/src/Orchard.Web/Modules/Orchard.CustomForms/Views/Parts.CustomForm.Wrapper.cshtml b/src/Orchard.Web/Modules/Orchard.CustomForms/Views/Parts.CustomForm.Wrapper.cshtml index 04f86083d..1958370b6 100644 --- a/src/Orchard.Web/Modules/Orchard.CustomForms/Views/Parts.CustomForm.Wrapper.cshtml +++ b/src/Orchard.Web/Modules/Orchard.CustomForms/Views/Parts.CustomForm.Wrapper.cshtml @@ -2,7 +2,6 @@ @{ ContentItem customForm = Model.ContentItem; - string returnUrl = Model.ReturnUrl; // remove default Save/Publish buttons Model.Editor.Zones["Sidebar"].Items.Clear(); @@ -13,7 +12,7 @@ // Model is a Shape, calling Display() so that it is rendered using the most specific template for its Shape type @Display(Model.Editor) - @Html.Hidden("returnUrl", returnUrl); + @Html.Hidden("returnUrl", Request.RawUrl);
diff --git a/src/Orchard/Utility/Extensions/HttpRequestExtensions.cs b/src/Orchard/Utility/Extensions/HttpRequestExtensions.cs index a32881861..a02343224 100644 --- a/src/Orchard/Utility/Extensions/HttpRequestExtensions.cs +++ b/src/Orchard/Utility/Extensions/HttpRequestExtensions.cs @@ -72,6 +72,10 @@ namespace Orchard.Utility.Extensions { return false; } + if (url.StartsWith("~/")) { + return true; + } + if (url.StartsWith("//") || url.StartsWith("/\\")) { return false; } From 977fa88ef37db42f724771667c33b0d7f7461d97 Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Mon, 22 Oct 2012 14:59:48 -0700 Subject: [PATCH 02/13] #19168: Fixing Razor compilation in package update views Work Item: 19168 --HG-- branch : 1.x --- .../Views/GalleryUpdates/ModulesUpdates.cshtml | 2 +- .../Views/GalleryUpdates/ThemesUpdates.cshtml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.Packaging/Views/GalleryUpdates/ModulesUpdates.cshtml b/src/Orchard.Web/Modules/Orchard.Packaging/Views/GalleryUpdates/ModulesUpdates.cshtml index eb4863754..a488e89d0 100644 --- a/src/Orchard.Web/Modules/Orchard.Packaging/Views/GalleryUpdates/ModulesUpdates.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Packaging/Views/GalleryUpdates/ModulesUpdates.cshtml @@ -36,7 +36,7 @@ @foreach (var module in Model.Entries) {
  • @{ - string iconUrl = @module.NewVersionToInstall.IconUrl; + string iconUrl = module.NewVersionToInstall.IconUrl; if (string.IsNullOrWhiteSpace(iconUrl)) { iconUrl = Href("../../Content/Images/ModuleDefaultIcon.png"); } diff --git a/src/Orchard.Web/Modules/Orchard.Packaging/Views/GalleryUpdates/ThemesUpdates.cshtml b/src/Orchard.Web/Modules/Orchard.Packaging/Views/GalleryUpdates/ThemesUpdates.cshtml index ce0031b1f..5eb67610a 100644 --- a/src/Orchard.Web/Modules/Orchard.Packaging/Views/GalleryUpdates/ThemesUpdates.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Packaging/Views/GalleryUpdates/ThemesUpdates.cshtml @@ -37,9 +37,9 @@
  • @{ string extensionClass = "iconThumbnail"; - string iconUrl = @theme.NewVersionToInstall.IconUrl; + string iconUrl = theme.NewVersionToInstall.IconUrl; if (!string.IsNullOrWhiteSpace(@theme.NewVersionToInstall.FirstScreenshot)) { - iconUrl = @theme.NewVersionToInstall.FirstScreenshot; + iconUrl = theme.NewVersionToInstall.FirstScreenshot; extensionClass = "screenshotThumbnail"; } else if (string.IsNullOrWhiteSpace(iconUrl)) { iconUrl = Href("../../Content/Images/imagePlaceholder.png"); From 9e16f5d8e37d2d52227903e76f52bdca19b0e494 Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Mon, 22 Oct 2012 16:31:21 -0700 Subject: [PATCH 03/13] Fixing core modules version numbers --HG-- branch : 1.x --- src/Orchard.Web/Core/Common/Module.txt | 4 ++-- src/Orchard.Web/Core/Containers/Module.txt | 4 ++-- src/Orchard.Web/Core/Contents/Module.txt | 4 ++-- src/Orchard.Web/Core/Dashboard/Module.txt | 4 ++-- src/Orchard.Web/Core/Feeds/Module.txt | 4 ++-- src/Orchard.Web/Core/Navigation/Module.txt | 4 ++-- src/Orchard.Web/Core/Reports/Module.txt | 4 ++-- src/Orchard.Web/Core/Scheduling/Module.txt | 4 ++-- src/Orchard.Web/Core/Settings/Module.txt | 4 ++-- src/Orchard.Web/Core/Shapes/Module.txt | 4 ++-- src/Orchard.Web/Core/Title/Module.txt | 4 ++-- src/Orchard.Web/Core/XmlRpc/Module.txt | 4 ++-- 12 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/Orchard.Web/Core/Common/Module.txt b/src/Orchard.Web/Core/Common/Module.txt index eb92063b3..d8fb46e57 100644 --- a/src/Orchard.Web/Core/Common/Module.txt +++ b/src/Orchard.Web/Core/Common/Module.txt @@ -2,8 +2,8 @@ AntiForgery: enabled Author: The Orchard Team Website: http://orchardproject.net -Version: 1.5.1 -OrchardVersion: 1.5.1 +Version: 1.6 +OrchardVersion: 1.6 Description: The common module introduces content parts that are going to be used by most content types (common, body, identity). FeatureDescription: Core content parts. Dependencies: Settings diff --git a/src/Orchard.Web/Core/Containers/Module.txt b/src/Orchard.Web/Core/Containers/Module.txt index 466860152..ea75fada6 100644 --- a/src/Orchard.Web/Core/Containers/Module.txt +++ b/src/Orchard.Web/Core/Containers/Module.txt @@ -2,8 +2,8 @@ AntiForgery: enabled Author: The Orchard Team Website: http://orchardproject.net -Version: 1.5.1 -OrchardVersion: 1.5.1 +Version: 1.6 +OrchardVersion: 1.6 Description: The containers module introduces container and containable behaviors for content items. FeatureDescription: Container and containable parts to enable parent-child relationships between content items. Dependencies: Contents, Feeds diff --git a/src/Orchard.Web/Core/Contents/Module.txt b/src/Orchard.Web/Core/Contents/Module.txt index 733e34177..77730626d 100644 --- a/src/Orchard.Web/Core/Contents/Module.txt +++ b/src/Orchard.Web/Core/Contents/Module.txt @@ -2,8 +2,8 @@ AntiForgery: enabled Author: The Orchard Team Website: http://orchardproject.net -Version: 1.5.1 -OrchardVersion: 1.5.1 +Version: 1.6 +OrchardVersion: 1.6 Description: The contents module enables the creation of custom content types. Features: Contents diff --git a/src/Orchard.Web/Core/Dashboard/Module.txt b/src/Orchard.Web/Core/Dashboard/Module.txt index 06aba75a6..e9b411f0b 100644 --- a/src/Orchard.Web/Core/Dashboard/Module.txt +++ b/src/Orchard.Web/Core/Dashboard/Module.txt @@ -2,8 +2,8 @@ AntiForgery: enabled Author: The Orchard Team Website: http://orchardproject.net -Version: 1.5.1 -OrchardVersion: 1.5.1 +Version: 1.6 +OrchardVersion: 1.6 Description: The dashboard module is providing the dashboard screen of the admininstration UI of the application. FeatureDescription: Standard admin dashboard. Category: Core diff --git a/src/Orchard.Web/Core/Feeds/Module.txt b/src/Orchard.Web/Core/Feeds/Module.txt index 5a7fb3c2e..78200efd6 100644 --- a/src/Orchard.Web/Core/Feeds/Module.txt +++ b/src/Orchard.Web/Core/Feeds/Module.txt @@ -2,8 +2,8 @@ AntiForgery: enabled Author: The Orchard Team Website: http://orchardproject.net -Version: 1.5.1 -OrchardVersion: 1.5.1 +Version: 1.6 +OrchardVersion: 1.6 Description: The Feeds module is providing RSS feeds to content items. FeatureDescription: RSS feeds for content items. Category: Syndication diff --git a/src/Orchard.Web/Core/Navigation/Module.txt b/src/Orchard.Web/Core/Navigation/Module.txt index 4497c9d28..f3471b576 100644 --- a/src/Orchard.Web/Core/Navigation/Module.txt +++ b/src/Orchard.Web/Core/Navigation/Module.txt @@ -2,8 +2,8 @@ AntiForgery: enabled Author: The Orchard Team Website: http://orchardproject.net -Version: 1.5.1 -OrchardVersion: 1.5.1 +Version: 1.6 +OrchardVersion: 1.6 Description: The navigation module creates and manages a simple navigation menu for the front-end of the application and allows you to add content items to the admin menu. FeatureDescription: Menu management. Category: Core diff --git a/src/Orchard.Web/Core/Reports/Module.txt b/src/Orchard.Web/Core/Reports/Module.txt index 85e63ae8f..db1546685 100644 --- a/src/Orchard.Web/Core/Reports/Module.txt +++ b/src/Orchard.Web/Core/Reports/Module.txt @@ -2,8 +2,8 @@ AntiForgery: enabled Author: The Orchard Team Website: http://orchardproject.net -Version: 1.5.1 -OrchardVersion: 1.5.1 +Version: 1.6 +OrchardVersion: 1.6 Description: The dashboard module is providing the reports screen of the application. FeatureDescription: Reports management. Category: Core diff --git a/src/Orchard.Web/Core/Scheduling/Module.txt b/src/Orchard.Web/Core/Scheduling/Module.txt index 9e97b93ad..b861c5d12 100644 --- a/src/Orchard.Web/Core/Scheduling/Module.txt +++ b/src/Orchard.Web/Core/Scheduling/Module.txt @@ -2,8 +2,8 @@ AntiForgery: enabled Author: The Orchard Team Website: http://orchardproject.net -Version: 1.5.1 -OrchardVersion: 1.5.1 +Version: 1.6 +OrchardVersion: 1.6 Description: The scheduling module enables background task scheduling. FeatureDescription: Scheduled background tasks. Category: Core diff --git a/src/Orchard.Web/Core/Settings/Module.txt b/src/Orchard.Web/Core/Settings/Module.txt index 0d586f229..fade5a7f4 100644 --- a/src/Orchard.Web/Core/Settings/Module.txt +++ b/src/Orchard.Web/Core/Settings/Module.txt @@ -2,8 +2,8 @@ AntiForgery: enabled Author: The Orchard Team Website: http://orchardproject.net -Version: 1.5.1 -OrchardVersion: 1.5.1 +Version: 1.6 +OrchardVersion: 1.6 Description: The settings module creates site settings that other modules can contribute to. FeatureDescription: Site settings. Category: Core diff --git a/src/Orchard.Web/Core/Shapes/Module.txt b/src/Orchard.Web/Core/Shapes/Module.txt index d21b5315c..25cffec02 100644 --- a/src/Orchard.Web/Core/Shapes/Module.txt +++ b/src/Orchard.Web/Core/Shapes/Module.txt @@ -2,8 +2,8 @@ AntiForgery: enabled Author: The Orchard Team Website: http://orchardproject.net -Version: 1.5.1 -OrchardVersion: 1.5.1 +Version: 1.6 +OrchardVersion: 1.6 Description: The shapes module contains core shape templates and display hooks. FeatureDescription: Core shape templates and display hooks. Category: Core diff --git a/src/Orchard.Web/Core/Title/Module.txt b/src/Orchard.Web/Core/Title/Module.txt index 973124ea1..6cfd7fbfa 100644 --- a/src/Orchard.Web/Core/Title/Module.txt +++ b/src/Orchard.Web/Core/Title/Module.txt @@ -2,8 +2,8 @@ AntiForgery: enabled Author: The Orchard Team Website: http://orchardproject.net -Version: 1.5.1 -OrchardVersion: 1.5.1 +Version: 1.6 +OrchardVersion: 1.6 Description: The title module enables content items to have titles. FeatureDescription: Title content part. Category: Core diff --git a/src/Orchard.Web/Core/XmlRpc/Module.txt b/src/Orchard.Web/Core/XmlRpc/Module.txt index 7979e8aaa..132993858 100644 --- a/src/Orchard.Web/Core/XmlRpc/Module.txt +++ b/src/Orchard.Web/Core/XmlRpc/Module.txt @@ -2,8 +2,8 @@ AntiForgery: enabled Author: The Orchard Team Website: http://orchardproject.net -Version: 1.5.1 -OrchardVersion: 1.5.1 +Version: 1.6 +OrchardVersion: 1.6 Description: The XmlRpc module enables creation of contents from client applications such as LiveWriter. FeatureDescription: XML-RPC opt-in implementation. Category: Content Publishing From 293288928ccc1bb72d9c8aadefb8d62fb00f5175 Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Mon, 22 Oct 2012 16:34:06 -0700 Subject: [PATCH 04/13] #19140: Fixing condition to run custom configuration on Azure Cloud Services Work Item: 19140 --HG-- branch : 1.x --- src/Orchard.Azure/Orchard.Azure.Web/startup/ConfigureIIS.cmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Orchard.Azure/Orchard.Azure.Web/startup/ConfigureIIS.cmd b/src/Orchard.Azure/Orchard.Azure.Web/startup/ConfigureIIS.cmd index 9bb55e560..4b38bef3c 100644 --- a/src/Orchard.Azure/Orchard.Azure.Web/startup/ConfigureIIS.cmd +++ b/src/Orchard.Azure/Orchard.Azure.Web/startup/ConfigureIIS.cmd @@ -1,5 +1,5 @@ REM Check if this task is running on the compute emulator, if not then sets the Idle Timeout to zero -IF "%ComputeEmulatorRunning%" == "true" ( +IF "%ComputeEmulatorRunning%" == "false" ( %windir%\system32\inetsrv\appcmd set config -section:applicationPools -applicationPoolDefaults.processModel.idleTimeout:00:00:00 ) \ No newline at end of file From 4bb9b558d2b9ab4c0f4f4e78ecf67a363066c230 Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Mon, 22 Oct 2012 16:47:29 -0700 Subject: [PATCH 05/13] #19177: Adding "|" in the list of forbidden url characters Work Item: 19177 --HG-- branch : 1.x --- .../Modules/Orchard.Autoroute/Drivers/AutoroutePartDriver.cs | 2 +- .../Modules/Orchard.Autoroute/Services/AutorouteService.cs | 2 +- .../Modules/Orchard.Autoroute/Services/DefaultSlugService.cs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.Autoroute/Drivers/AutoroutePartDriver.cs b/src/Orchard.Web/Modules/Orchard.Autoroute/Drivers/AutoroutePartDriver.cs index db8932b1c..82c231b5c 100644 --- a/src/Orchard.Web/Modules/Orchard.Autoroute/Drivers/AutoroutePartDriver.cs +++ b/src/Orchard.Web/Modules/Orchard.Autoroute/Drivers/AutoroutePartDriver.cs @@ -98,7 +98,7 @@ namespace Orchard.Autoroute.Drivers { if (path.StartsWith(".") || path.EndsWith(".")) updater.AddModelError("CurrentUrl", T("The \".\" can't be used at either end of the permalink.")); else - updater.AddModelError("CurrentUrl", T("Please do not use any of the following characters in your permalink: \":\", \"?\", \"#\", \"[\", \"]\", \"@\", \"!\", \"$\", \"&\", \"'\", \"(\", \")\", \"*\", \"+\", \",\", \";\", \"=\", \", \"<\", \">\", \"\\\". No spaces are allowed (please use dashes or underscores instead).")); + updater.AddModelError("CurrentUrl", T("Please do not use any of the following characters in your permalink: \":\", \"?\", \"#\", \"[\", \"]\", \"@\", \"!\", \"$\", \"&\", \"'\", \"(\", \")\", \"*\", \"+\", \",\", \";\", \"=\", \", \"<\", \">\", \"\\\", \"|\". No spaces are allowed (please use dashes or underscores instead).")); } // if CurrentUrl is set, the handler won't try to create an alias for it diff --git a/src/Orchard.Web/Modules/Orchard.Autoroute/Services/AutorouteService.cs b/src/Orchard.Web/Modules/Orchard.Autoroute/Services/AutorouteService.cs index 7ec41f9f5..b30ab6b5d 100644 --- a/src/Orchard.Web/Modules/Orchard.Autoroute/Services/AutorouteService.cs +++ b/src/Orchard.Web/Modules/Orchard.Autoroute/Services/AutorouteService.cs @@ -166,7 +166,7 @@ namespace Orchard.Autoroute.Services { } public bool IsPathValid(string slug) { - return String.IsNullOrWhiteSpace(slug) || Regex.IsMatch(slug, @"^[^:?#\[\]@!$&'()*+,;=\s\""\<\>\\]+$") && !(slug.StartsWith(".") || slug.EndsWith(".")); + return String.IsNullOrWhiteSpace(slug) || Regex.IsMatch(slug, @"^[^:?#\[\]@!$&'()*+,;=\s\""\<\>\\\|]+$") && !(slug.StartsWith(".") || slug.EndsWith(".")); } public bool ProcessPath(AutoroutePart part) { diff --git a/src/Orchard.Web/Modules/Orchard.Autoroute/Services/DefaultSlugService.cs b/src/Orchard.Web/Modules/Orchard.Autoroute/Services/DefaultSlugService.cs index 40a6befdf..58ead540a 100644 --- a/src/Orchard.Web/Modules/Orchard.Autoroute/Services/DefaultSlugService.cs +++ b/src/Orchard.Web/Modules/Orchard.Autoroute/Services/DefaultSlugService.cs @@ -7,7 +7,7 @@ namespace Orchard.Autoroute.Services { public class DefaultSlugService : ISlugService { private readonly ISlugEventHandler _slugEventHandler; - + public DefaultSlugService( ISlugEventHandler slugEventHander ) { @@ -26,7 +26,7 @@ namespace Orchard.Autoroute.Services { if (!slugContext.Adjusted) { - var disallowed = new Regex(@"[/:?#\[\]@!$&'()*+,;=\s\""\<\>\\]+"); + var disallowed = new Regex(@"[/:?#\[\]@!$&'()*+,;=\s\""\<\>\\\|]+"); slugContext.Slug = disallowed.Replace(slugContext.Title, "-").Trim('-','.'); From e3c1e637833202f3dd5909228df6806c3bc412ff Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Tue, 23 Oct 2012 16:47:11 -0700 Subject: [PATCH 06/13] #19162: Excluding .hg files from Azure Package Work Item: 19162 --HG-- branch : 1.x --- AzurePackage.proj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AzurePackage.proj b/AzurePackage.proj index 1f23f7413..22cc98ba7 100644 --- a/AzurePackage.proj +++ b/AzurePackage.proj @@ -84,7 +84,7 @@ - + From aba27f6d7eb2bfb13f89bebfd5a48f586dc03662 Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Tue, 23 Oct 2012 17:11:56 -0700 Subject: [PATCH 07/13] #19181: Adding a unit test for IRepository on linq queries with Contains Work Item: 19181 --HG-- branch : 1.x --- src/Orchard.Tests/Data/RepositoryTests.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Orchard.Tests/Data/RepositoryTests.cs b/src/Orchard.Tests/Data/RepositoryTests.cs index 921a5f291..4b6ec34db 100644 --- a/src/Orchard.Tests/Data/RepositoryTests.cs +++ b/src/Orchard.Tests/Data/RepositoryTests.cs @@ -190,5 +190,17 @@ namespace Orchard.Tests.Data { Assert.That(one.Name, Is.EqualTo("one")); Assert.That(one.Timespan.Value.Millisecond, Is.EqualTo(489)); } + + + [Test] + public void RepositoryFetchTakesExistsPredicate() { + CreateThreeFoos(); + + var array = new[] { "one", "two" }; + + var result = _fooRepos.Fetch(f => array.Contains(f.Name)).ToList(); + + Assert.That(result.Count(), Is.EqualTo(2)); + } } } \ No newline at end of file From 779bb4947806e30550abf8e8b7b7ee24bea13faf Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Tue, 23 Oct 2012 17:35:40 -0700 Subject: [PATCH 08/13] #19176: Fixing placement encoding in Shape Tracing Work Item: 19176 --HG-- branch : 1.x --- .../Modules/Orchard.DesignerTools/Views/ShapeTracingMeta.cshtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Orchard.Web/Modules/Orchard.DesignerTools/Views/ShapeTracingMeta.cshtml b/src/Orchard.Web/Modules/Orchard.DesignerTools/Views/ShapeTracingMeta.cshtml index 35fd81c30..aec01fffc 100644 --- a/src/Orchard.Web/Modules/Orchard.DesignerTools/Views/ShapeTracingMeta.cshtml +++ b/src/Orchard.Web/Modules/Orchard.DesignerTools/Views/ShapeTracingMeta.cshtml @@ -67,7 +67,7 @@ shapeTracingMetadataHost[@Model.ShapeId].shape = { @if (!String.IsNullOrEmpty((string)Model.PlacementSource) && (WorkContext.HttpContext.Items[(string)Model.PlacementSource] == null)) { WorkContext.HttpContext.Items[(string)Model.PlacementSource] = new object(); -shapeTracingMetadataHost.placement['@Model.PlacementSource.ToString()'] = '@ShapeTracingFactory.FormatJsonValue((string)Model.PlacementContent)'; +shapeTracingMetadataHost.placement['@Model.PlacementSource.ToString()'] = '@HttpUtility.JavaScriptStringEncode((string)Model.PlacementContent)'; } From d01ff9df754c16d930d21f319a1bece544849c47 Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Wed, 24 Oct 2012 15:51:07 -0700 Subject: [PATCH 09/13] Fixing possible NRE in when a menu item's content doesn't exist --HG-- branch : 1.x --- .../Core/Navigation/Handlers/ContentMenuItemPartHandler.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Orchard.Web/Core/Navigation/Handlers/ContentMenuItemPartHandler.cs b/src/Orchard.Web/Core/Navigation/Handlers/ContentMenuItemPartHandler.cs index c0a833a11..6bfd7e71a 100644 --- a/src/Orchard.Web/Core/Navigation/Handlers/ContentMenuItemPartHandler.cs +++ b/src/Orchard.Web/Core/Navigation/Handlers/ContentMenuItemPartHandler.cs @@ -27,6 +27,12 @@ namespace Orchard.Core.Navigation.Handlers { var contentMenuItemPart = context.ContentItem.As(); // the display route for the menu item is the one for the referenced content item if(contentMenuItemPart != null) { + + // if the content doesn't exist anymore + if(contentMenuItemPart.Content == null) { + return; + } + context.Metadata.DisplayRouteValues = _contentManager.GetItemMetadata(contentMenuItemPart.Content).DisplayRouteValues; } } From 20a4a8f0191bbcec1a37b4f162b09b9702dc0c13 Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Wed, 24 Oct 2012 15:51:35 -0700 Subject: [PATCH 10/13] Cleaning Alias code --HG-- branch : 1.x --- .../Controllers/AdminController.cs | 27 ++++--- .../Modules/Orchard.Alias/IAliasService.cs | 8 +- .../Implementation/AliasRoute.cs | 36 ++++----- .../Implementation/Holder/AliasHolder.cs | 2 +- .../Implementation/Map/AliasMap.cs | 20 ++--- .../Implementation/Updater/AliasUpdater.cs | 21 ++---- .../Orchard.Alias/Implementation/Utils.cs | 74 +++++++------------ 7 files changed, 75 insertions(+), 113 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.Alias/Controllers/AdminController.cs b/src/Orchard.Web/Modules/Orchard.Alias/Controllers/AdminController.cs index 168f37e32..2ec60bb9f 100644 --- a/src/Orchard.Web/Modules/Orchard.Alias/Controllers/AdminController.cs +++ b/src/Orchard.Web/Modules/Orchard.Alias/Controllers/AdminController.cs @@ -22,7 +22,7 @@ namespace Orchard.Alias.Controllers { public AdminController( IAliasService aliasService, IOrchardServices orchardServices, - IAliasHolder aliasHolder ) { + IAliasHolder aliasHolder) { _aliasService = aliasService; _aliasHolder = aliasHolder; Services = orchardServices; @@ -65,7 +65,7 @@ namespace Orchard.Alias.Controllers { aliases = aliases.OrderBy(x => x.Path); break; } - + if (pager.PageSize != 0) { aliases = aliases.Skip(pager.GetStartIndex()).Take(pager.PageSize); } @@ -73,7 +73,7 @@ namespace Orchard.Alias.Controllers { var model = new AdminIndexViewModel { Options = options, Pager = pagerShape, - AliasEntries = aliases.Select(x => new AliasEntry() {Alias = x, IsChecked = false}).ToList() + AliasEntries = aliases.Select(x => new AliasEntry() { Alias = x, IsChecked = false }).ToList() }; return View(model); @@ -103,7 +103,7 @@ namespace Orchard.Alias.Controllers { throw new ArgumentOutOfRangeException(); } - return RedirectToAction("Index"); + return RedirectToAction("Index"); } public ActionResult Add() { @@ -118,7 +118,7 @@ namespace Orchard.Alias.Controllers { if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage aliases"))) return new HttpUnauthorizedResult(); - if(aliasPath == "/") { + if (aliasPath == "/") { aliasPath = String.Empty; } @@ -130,7 +130,7 @@ namespace Orchard.Alias.Controllers { ModelState.AddModelError("Route", T("Route can't be empty").Text); } - if(!ModelState.IsValid) { + if (!ModelState.IsValid) { return View(); } @@ -162,11 +162,11 @@ namespace Orchard.Alias.Controllers { var routeValues = _aliasService.Get(path); - if (routeValues==null) + if (routeValues == null) return HttpNotFound(); - var virtualPaths = _aliasService.LookupVirtualPaths(routeValues,HttpContext) - .Select(vpd=>vpd.VirtualPath); + var virtualPaths = _aliasService.LookupVirtualPaths(routeValues, HttpContext) + .Select(vpd => vpd.VirtualPath); ViewBag.AliasPath = path; ViewBag.RoutePath = virtualPaths.FirstOrDefault(); @@ -181,19 +181,18 @@ namespace Orchard.Alias.Controllers { // TODO: (PH:Autoroute) This could overwrite an existing Alias without warning, should handle this _aliasService.Set(aliasPath, routePath, "Custom"); - + // Remove previous alias - if (path != aliasPath) - { + if (path != aliasPath) { // TODO: (PH:Autoroute) Ability to fire an "AliasChanged" event so we make a redirect _aliasService.Delete(path); } Services.Notifier.Information(T("Alias {0} updated", path)); - + return RedirectToAction("Index"); } - + [HttpPost] public ActionResult Delete(string path) { if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not authorized to manage aliases"))) diff --git a/src/Orchard.Web/Modules/Orchard.Alias/IAliasService.cs b/src/Orchard.Web/Modules/Orchard.Alias/IAliasService.cs index aec3fcde1..6eb151cf2 100644 --- a/src/Orchard.Web/Modules/Orchard.Alias/IAliasService.cs +++ b/src/Orchard.Web/Modules/Orchard.Alias/IAliasService.cs @@ -2,10 +2,8 @@ using System.Collections.Generic; using System.Web.Routing; -namespace Orchard.Alias -{ - public interface IAliasService : IDependency - { +namespace Orchard.Alias { + public interface IAliasService : IDependency { RouteValueDictionary Get(string aliasPath); void Set(string aliasPath, RouteValueDictionary routeValues, string aliasSource); void Set(string aliasPath, string routePath, string aliasSource); @@ -24,7 +22,7 @@ namespace Orchard.Alias void Replace(string aliasPath, string routePath, string aliasSource); IEnumerable> List(); - IEnumerable> List(string sourceStartsWith); + IEnumerable> List(string sourceStartsWith); IEnumerable LookupVirtualPaths(RouteValueDictionary routeValues, System.Web.HttpContextBase HttpContext); } diff --git a/src/Orchard.Web/Modules/Orchard.Alias/Implementation/AliasRoute.cs b/src/Orchard.Web/Modules/Orchard.Alias/Implementation/AliasRoute.cs index 34bf1c6c2..2e7a3ace7 100644 --- a/src/Orchard.Web/Modules/Orchard.Alias/Implementation/AliasRoute.cs +++ b/src/Orchard.Web/Modules/Orchard.Alias/Implementation/AliasRoute.cs @@ -8,34 +8,33 @@ using System.Web.Routing; using Orchard.Alias.Implementation.Holder; using Orchard.Alias.Implementation.Map; -namespace Orchard.Alias.Implementation -{ - public class AliasRoute : RouteBase, IRouteWithArea - { +namespace Orchard.Alias.Implementation { + public class AliasRoute : RouteBase, IRouteWithArea { private readonly AliasMap _aliasMap; private readonly IRouteHandler _routeHandler; - public AliasRoute(IAliasHolder aliasHolder, string areaName, IRouteHandler routeHandler) - { + public AliasRoute(IAliasHolder aliasHolder, string areaName, IRouteHandler routeHandler) { Area = areaName; _aliasMap = aliasHolder.GetMap(areaName); _routeHandler = routeHandler; } - public override RouteData GetRouteData(HttpContextBase httpContext) - { + public override RouteData GetRouteData(HttpContextBase httpContext) { + // don't compute unnecessary virtual path if the map is empty + if (!_aliasMap.Any()) { + return null; + } + // Get the full inbound request path var virtualPath = httpContext.Request.AppRelativeCurrentExecutionFilePath.Substring(2) + httpContext.Request.PathInfo; // Attempt to lookup RouteValues in the alias map IDictionary routeValues; // TODO: Might as well have the lookup in AliasHolder... - if (_aliasMap.TryGetAlias(virtualPath, out routeValues)) - { + if (_aliasMap.TryGetAlias(virtualPath, out routeValues)) { // Construct RouteData from the route values var data = new RouteData(this, _routeHandler); - foreach (var routeValue in routeValues) - { + foreach (var routeValue in routeValues) { var key = routeValue.Key; if (key.EndsWith("-")) data.Values.Add(key.Substring(0, key.Length - 1), routeValue.Value); @@ -51,22 +50,19 @@ namespace Orchard.Alias.Implementation return null; } - public override VirtualPathData GetVirtualPath(RequestContext requestContext, RouteValueDictionary routeValues) - { + public override VirtualPathData GetVirtualPath(RequestContext requestContext, RouteValueDictionary routeValues) { // Lookup best match for route values in the expanded tree var match = _aliasMap.Locate(routeValues); - if (match != null) - { + if (match != null) { // Build any "spare" route values onto the Alias (so we correctly support any additional query parameters) var sb = new StringBuilder(match.Item2); var extra = 0; - foreach (var routeValue in routeValues) - { + foreach (var routeValue in routeValues) { // Ignore any we already have - if (match.Item1.ContainsKey(routeValue.Key)) - { + if (match.Item1.ContainsKey(routeValue.Key)) { continue; } + // Add a query string fragment sb.Append((extra++ == 0) ? '?' : '&'); sb.Append(Uri.EscapeDataString(routeValue.Key)); diff --git a/src/Orchard.Web/Modules/Orchard.Alias/Implementation/Holder/AliasHolder.cs b/src/Orchard.Web/Modules/Orchard.Alias/Implementation/Holder/AliasHolder.cs index 07697ab79..03157d3f1 100644 --- a/src/Orchard.Web/Modules/Orchard.Alias/Implementation/Holder/AliasHolder.cs +++ b/src/Orchard.Web/Modules/Orchard.Alias/Implementation/Holder/AliasHolder.cs @@ -25,7 +25,7 @@ namespace Orchard.Alias.Implementation.Holder { } public void SetAlias(AliasInfo alias) { - foreach(var map in _aliasMaps.Values) { + foreach (var map in _aliasMaps.Values) { map.Remove(alias); } diff --git a/src/Orchard.Web/Modules/Orchard.Alias/Implementation/Map/AliasMap.cs b/src/Orchard.Web/Modules/Orchard.Alias/Implementation/Map/AliasMap.cs index bb0a631f4..834da797a 100644 --- a/src/Orchard.Web/Modules/Orchard.Alias/Implementation/Map/AliasMap.cs +++ b/src/Orchard.Web/Modules/Orchard.Alias/Implementation/Map/AliasMap.cs @@ -53,6 +53,10 @@ namespace Orchard.Alias.Implementation.Map { CollapseTree(_root, info.Path, info.RouteValues); } + public bool Any() { + return _aliases.Any(); + } + private static void CollapseTree(Node root, string path, IDictionary routeValues) { foreach (var expanded in Expand(routeValues)) { var focus = root; @@ -96,14 +100,6 @@ namespace Orchard.Alias.Implementation.Map { return from item1 in source1 from item2 in source2 select produce(item1, item2); } - private static IEnumerable Single(T t) { - yield return t; - } - - private static IEnumerable Empty() { - return Enumerable.Empty(); - } - /// /// Expand the route values into all possible combinations of keys /// @@ -111,7 +107,7 @@ namespace Orchard.Alias.Implementation.Map { /// private static IEnumerable>> Expand(IDictionary routeValues) { var ordered = routeValues.OrderBy(kv => kv.Key, StringComparer.InvariantCultureIgnoreCase); - var empty = Empty>(); + var empty = Enumerable.Empty>(); // For each key/value pair, we want a list containing a single list with either the term, or the term and the "default" value var termSets = ordered.Select(term => { @@ -119,15 +115,15 @@ namespace Orchard.Alias.Implementation.Map { var termKey = term.Key.Substring(0, term.Key.Length - 1); return new[] { // This entry will auto-match in some cases because it was omitted from the route values - Single(new KeyValuePair(termKey, "\u0000")), - Single(new KeyValuePair(termKey, term.Value)) + new [] { new KeyValuePair(termKey, "\u0000") }, + new [] { new KeyValuePair(termKey, term.Value) } }; } return new[] {new[] {term}}; }); // Run each of those lists through an aggregation function, by taking the product of each set, so producting a tree of possibilities - var produced = termSets.Aggregate(Single(empty), (coords, termSet) => Product(coords, termSet, (coord, term) => coord.Concat(term))); + var produced = termSets.Aggregate(new[] { empty }.AsEnumerable(), (coords, termSet) => Product(coords, termSet, (coord, term) => coord.Concat(term))); return produced; } diff --git a/src/Orchard.Web/Modules/Orchard.Alias/Implementation/Updater/AliasUpdater.cs b/src/Orchard.Web/Modules/Orchard.Alias/Implementation/Updater/AliasUpdater.cs index fde8ae476..ec47459f0 100644 --- a/src/Orchard.Web/Modules/Orchard.Alias/Implementation/Updater/AliasUpdater.cs +++ b/src/Orchard.Web/Modules/Orchard.Alias/Implementation/Updater/AliasUpdater.cs @@ -9,38 +9,33 @@ using Orchard.Environment; using Orchard.Tasks; using Orchard.Logging; -namespace Orchard.Alias.Implementation.Updater -{ - public class AliasHolderUpdater : IOrchardShellEvents, IBackgroundTask - { +namespace Orchard.Alias.Implementation.Updater { + public class AliasHolderUpdater : IOrchardShellEvents, IBackgroundTask { private readonly IAliasHolder _aliasHolder; private readonly IAliasStorage _storage; public ILogger Logger { get; set; } - public AliasHolderUpdater(IAliasHolder aliasHolder, IAliasStorage storage) - { + public AliasHolderUpdater(IAliasHolder aliasHolder, IAliasStorage storage) { _aliasHolder = aliasHolder; _storage = storage; Logger = NullLogger.Instance; } - void IOrchardShellEvents.Activated() - { + void IOrchardShellEvents.Activated() { Refresh(); } - void IOrchardShellEvents.Terminating() - { + void IOrchardShellEvents.Terminating() { } private void Refresh() { try { var aliases = _storage.List(); - _aliasHolder.SetAliases(aliases.Select(alias=>new AliasInfo{Path = alias.Item1, Area = alias.Item2, RouteValues=alias.Item3})); + _aliasHolder.SetAliases(aliases.Select(alias => new AliasInfo { Path = alias.Item1, Area = alias.Item2, RouteValues = alias.Item3 })); } - catch(Exception ex) { - Logger.Error(ex,"Exception during Alias refresh"); + catch (Exception ex) { + Logger.Error(ex, "Exception during Alias refresh"); } } diff --git a/src/Orchard.Web/Modules/Orchard.Alias/Implementation/Utils.cs b/src/Orchard.Web/Modules/Orchard.Alias/Implementation/Utils.cs index c8c1a6681..1f680be89 100644 --- a/src/Orchard.Web/Modules/Orchard.Alias/Implementation/Utils.cs +++ b/src/Orchard.Web/Modules/Orchard.Alias/Implementation/Utils.cs @@ -8,15 +8,12 @@ using Orchard.Mvc.Extensions; using Orchard.Mvc.Routes; using Orchard.Mvc.Wrappers; -namespace Orchard.Alias.Implementation -{ - public static class Utils - { +namespace Orchard.Alias.Implementation { + public static class Utils { public static IDictionary LookupRouteValues - (HttpContextBase httpContext, IEnumerable - routeDescriptors, - string routePath) - { + (HttpContextBase httpContext, IEnumerable + routeDescriptors, + string routePath) { var queryStringIndex = routePath.IndexOf('?'); var routePathNoQueryString = queryStringIndex == -1 ? routePath : routePath.Substring(0, queryStringIndex); var queryString = queryStringIndex == -1 ? null : routePath.Substring(queryStringIndex + 1); @@ -51,8 +48,8 @@ namespace Orchard.Alias.Implementation public static IEnumerable LookupVirtualPaths( HttpContextBase httpContext, IEnumerable routeDescriptors, - string areaName, - IDictionary routeValues) { + string areaName, + IDictionary routeValues) { var routeValueDictionary = new RouteValueDictionary(routeValues.ToDictionary(kv => RemoveDash(kv.Key), kv => (object)kv.Value)); var virtualPathDatas = routeDescriptors.Where(r2 => r2.Route.GetAreaName() == areaName) @@ -68,26 +65,21 @@ namespace Orchard.Alias.Implementation } - private static Dictionary ToRouteValues(RouteData routeData, string queryString) - { + private static Dictionary ToRouteValues(RouteData routeData, string queryString) { var routeValues = routeData.Values - .Select(kv => - { + .Select(kv => { var value = Convert.ToString(kv.Value, CultureInfo.InvariantCulture); var defaultValue = FindDefault(routeData.Route, kv.Key); - if (defaultValue != null && string.Equals(defaultValue, value, StringComparison.InvariantCultureIgnoreCase)) - { + if (defaultValue != null && string.Equals(defaultValue, value, StringComparison.InvariantCultureIgnoreCase)) { return new { Key = kv.Key + "-", Value = value }; } return new { kv.Key, Value = value }; }) .ToDictionary(kv => kv.Key, kv => kv.Value); - if (queryString != null) - { + if (queryString != null) { foreach (var term in queryString .Split(new[] { "&" }, StringSplitOptions.RemoveEmptyEntries) - .Select(ParseTerm)) - { + .Select(ParseTerm)) { if (!routeValues.ContainsKey(term[0])) routeValues[term[0]] = term[1]; } @@ -95,75 +87,61 @@ namespace Orchard.Alias.Implementation return routeValues; } - private static string[] ParseTerm(string term) - { + private static string[] ParseTerm(string term) { var equalsIndex = term.IndexOf('='); - if (equalsIndex == -1) - { + if (equalsIndex == -1) { return new[] { Uri.UnescapeDataString(term), null }; } return new[] { Uri.UnescapeDataString(term.Substring(0, equalsIndex)), Uri.UnescapeDataString(term.Substring(equalsIndex + 1)) }; } - private static string FindDefault(RouteBase route, string key) - { + private static string FindDefault(RouteBase route, string key) { var route2 = route as Route; - if (route2 == null) - { + if (route2 == null) { return null; } object defaultValue; - if (!route2.Defaults.TryGetValue(key, out defaultValue)) - { + if (!route2.Defaults.TryGetValue(key, out defaultValue)) { return null; } return Convert.ToString(defaultValue, CultureInfo.InvariantCulture); } - public class LookupHttpContext : HttpContextBaseWrapper - { + public class LookupHttpContext : HttpContextBaseWrapper { private readonly string _path; public LookupHttpContext(HttpContextBase httpContext, string path) - : base(httpContext) - { + : base(httpContext) { _path = path; } - public override HttpRequestBase Request - { + public override HttpRequestBase Request { get { return new LookupHttpRequest(this, base.Request, _path); } } - private class LookupHttpRequest : HttpRequestBaseWrapper - { + private class LookupHttpRequest : HttpRequestBaseWrapper { private readonly string _path; public LookupHttpRequest(HttpContextBase httpContextBase, HttpRequestBase httpRequestBase, string path) - : base( /*httpContextBase,*/ httpRequestBase) - { + : base( /*httpContextBase,*/ httpRequestBase) { _path = path; } - public override string AppRelativeCurrentExecutionFilePath - { + public override string AppRelativeCurrentExecutionFilePath { get { return "~/" + _path; } } - public override string ApplicationPath - { + public override string ApplicationPath { get { return "/"; } } - public override string Path - { + public override string Path { get { return "/" + _path; } } - public override string PathInfo - { + public override string PathInfo { get { return ""; } } } From fe63c341e7cc2d2d906c4083797b1f0abfd0343b Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Thu, 25 Oct 2012 21:26:04 -0700 Subject: [PATCH 11/13] Preventing ProbingExtensionLoader from copying the asp.net temporarty assembly If loaded by name in the PrecompiledLoader then the Fusion engine threw an exception as the manifest name would not match the assembly name. Actually the ASP.NET temp folder is cached using the hash of the compilation unit which is the .csproj in our case, so it won't be rebuilt accross restarts, unless necessary. --HG-- branch : 1.x --- .../Loaders/ProbingExtensionLoader.cs | 69 +++---------------- 1 file changed, 9 insertions(+), 60 deletions(-) diff --git a/src/Orchard/Environment/Extensions/Loaders/ProbingExtensionLoader.cs b/src/Orchard/Environment/Extensions/Loaders/ProbingExtensionLoader.cs index 424747c2e..1073e093f 100644 --- a/src/Orchard/Environment/Extensions/Loaders/ProbingExtensionLoader.cs +++ b/src/Orchard/Environment/Extensions/Loaders/ProbingExtensionLoader.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Reflection; -using Orchard.Caching; using Orchard.Environment.Extensions.Compilers; using Orchard.Environment.Extensions.Models; using Orchard.FileSystems.Dependencies; @@ -13,8 +12,8 @@ using Orchard.Utility.Extensions; namespace Orchard.Environment.Extensions.Loaders { /// - /// In case is disabled, this loader will dynamically compile the assembly - /// and save a copy to the probing folder so that next restart doesn't need to compile it again. + /// In case is disabled, this loader will dynamically compile the assembly. + /// It won't monitor the filesystem. /// public class ProbingExtensionLoader : ExtensionLoaderBase { public static readonly string[] ExtensionsVirtualPathPrefixes = { "~/Modules/", "~/Themes/" }; @@ -23,13 +22,11 @@ namespace Orchard.Environment.Extensions.Loaders { private readonly IVirtualPathProvider _virtualPathProvider; private readonly IHostEnvironment _hostEnvironment; private readonly IAssemblyProbingFolder _assemblyProbingFolder; - private readonly IDependenciesFolder _dependenciesFolder; private readonly IProjectFileParser _projectFileParser; public ProbingExtensionLoader( IBuildManager buildManager, IVirtualPathProvider virtualPathProvider, - IVirtualPathMonitor virtualPathMonitor, IHostEnvironment hostEnvironment, IAssemblyProbingFolder assemblyProbingFolder, IDependenciesFolder dependenciesFolder, @@ -41,7 +38,6 @@ namespace Orchard.Environment.Extensions.Loaders { _hostEnvironment = hostEnvironment; _assemblyProbingFolder = assemblyProbingFolder; _projectFileParser = projectFileParser; - _dependenciesFolder = dependenciesFolder; Logger = NullLogger.Instance; } @@ -122,7 +118,7 @@ namespace Orchard.Environment.Extensions.Loaders { if (StringComparer.OrdinalIgnoreCase.Equals(Path.GetExtension(reference.VirtualPath), ".dll")) result = _assemblyProbingFolder.LoadAssembly(reference.Name); else { - result = ProbeAssembly(reference.Name, reference.VirtualPath); + result = CompileAssembly(reference.Name, reference.VirtualPath); } Logger.Information("Done loading reference '{0}'", reference.Name); @@ -163,7 +159,7 @@ namespace Orchard.Environment.Extensions.Loaders { if (projectPath == null) return null; - assembly = ProbeAssembly(descriptor.Id, projectPath); + assembly = CompileAssembly(descriptor.Id, projectPath); } if (assembly == null) @@ -178,60 +174,13 @@ namespace Orchard.Environment.Extensions.Loaders { }; } - private void AddDependencies(string projectPath, HashSet currentSet) { - // Skip files from locations other than "~/Modules" and "~/Themes" - if (string.IsNullOrEmpty(PrefixMatch(projectPath, ExtensionsVirtualPathPrefixes))) { - return; - } - - // Add project path - currentSet.Add(projectPath); - - // Add source file paths - var projectFile = _projectFileParser.Parse(projectPath); - string basePath = _virtualPathProvider.GetDirectoryName(projectPath); - currentSet.UnionWith(projectFile.SourceFilenames.Select(f => _virtualPathProvider.Combine(basePath, f))); - - // Add Project and Library references - if (projectFile.References != null) { - foreach (ReferenceDescriptor referenceDescriptor in projectFile.References.Where(reference => !string.IsNullOrEmpty(reference.Path))) { - string path = referenceDescriptor.ReferenceType == ReferenceType.Library - ? _virtualPathProvider.GetProjectReferenceVirtualPath(projectPath, referenceDescriptor.SimpleName, referenceDescriptor.Path) - : _virtualPathProvider.Combine(basePath, referenceDescriptor.Path); - - // Normalize the virtual path (avoid ".." in the path name) - if (!string.IsNullOrEmpty(path)) { - path = _virtualPathProvider.ToAppRelative(path); - } - - // Attempt to reference the project / library file - if (!string.IsNullOrEmpty(path) && !currentSet.Contains(path) && _virtualPathProvider.TryFileExists(path)) { - switch (referenceDescriptor.ReferenceType) { - case ReferenceType.Project: - AddDependencies(path, currentSet); - break; - case ReferenceType.Library: - currentSet.Add(path); - break; - } - } - } - } - } - - private Assembly ProbeAssembly(string moduleName, string virtualPath) { + private Assembly CompileAssembly(string moduleName, string virtualPath) { var assembly = _buildManager.GetCompiledAssembly(virtualPath); - if (assembly != null) { - _assemblyProbingFolder.StoreAssembly(moduleName, assembly.Location); - return assembly; - } + //if (assembly != null) { + // _assemblyProbingFolder.StoreAssembly(moduleName, assembly.Location); + //} - return null; - } - - private static string PrefixMatch(string virtualPath, params string[] prefixes) { - return prefixes - .FirstOrDefault(p => virtualPath.StartsWith(p, StringComparison.OrdinalIgnoreCase)); + return assembly; } private string GetProjectPath(ExtensionDescriptor descriptor) { From 1c707dc719b0f7f4701258d37787fe02ac517f9e Mon Sep 17 00:00:00 2001 From: fera Date: Fri, 26 Oct 2012 15:08:01 -0700 Subject: [PATCH 12/13] #19194: Fixing missing properties when updating a media picker field Work Item: 19194 --HG-- branch : 1.x --- .../Fields/MediaPicker.Edit.cshtml | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.Fields/Views/EditorTemplates/Fields/MediaPicker.Edit.cshtml b/src/Orchard.Web/Modules/Orchard.Fields/Views/EditorTemplates/Fields/MediaPicker.Edit.cshtml index 5dc9d3f53..7cae15dd6 100644 --- a/src/Orchard.Web/Modules/Orchard.Fields/Views/EditorTemplates/Fields/MediaPicker.Edit.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Fields/Views/EditorTemplates/Fields/MediaPicker.Edit.cshtml @@ -21,14 +21,13 @@ @Html.HiddenFor(m => m.Class) @Html.HiddenFor(m => m.Style) @Html.HiddenFor(m => m.Alignment) - @Html.HiddenFor(m => m.Alignment) @Html.HiddenFor(m => m.Width) @Html.HiddenFor(m => m.Height)
  • -@using (Script.Foot()) -{ +@using (Script.Foot()) { +