From aafb915892d986e2f1aaac429391e23024dc6c01 Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Fri, 26 Sep 2014 12:21:14 -0700 Subject: [PATCH 01/26] #20960: Fixing infinite loop when creating index tasks Work Item: 20960 --- .../Modules/Orchard.Indexing/Settings/EditorEvents.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Orchard.Web/Modules/Orchard.Indexing/Settings/EditorEvents.cs b/src/Orchard.Web/Modules/Orchard.Indexing/Settings/EditorEvents.cs index 03146cdab..00f21b85f 100644 --- a/src/Orchard.Web/Modules/Orchard.Indexing/Settings/EditorEvents.cs +++ b/src/Orchard.Web/Modules/Orchard.Indexing/Settings/EditorEvents.cs @@ -12,6 +12,8 @@ namespace Orchard.Indexing.Settings { private readonly IIndexingTaskManager _indexingTaskManager; private readonly IContentManager _contentManager; + private const int PageSize = 50; + public EditorEvents(IIndexingTaskManager indexingTaskManager, IContentManager contentManager){ _indexingTaskManager = indexingTaskManager; _contentManager = contentManager; @@ -70,13 +72,15 @@ namespace Orchard.Indexing.Settings { do { contentItemProcessed = false; - var contentItemsToIndex = _contentManager.Query(VersionOptions.Published, new [] { type }).Slice(index, 50); + var contentItemsToIndex = _contentManager.Query(VersionOptions.Published, new [] { type }).Slice(index, PageSize); foreach (var contentItem in contentItemsToIndex) { contentItemProcessed = true; _indexingTaskManager.CreateUpdateIndexTask(contentItem); } + index += PageSize; + } while (contentItemProcessed); } } From abed55164d8a8b853d42a19fcef35102ccba77b7 Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Fri, 26 Sep 2014 12:54:40 -0700 Subject: [PATCH 02/26] Fixing performance issue in OutputCache --- .../Orchard.Email/Services/MissingSettingsBanner.cs | 2 -- .../Orchard.OutputCache/Filters/OutputCacheFilter.cs | 10 +++++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.Email/Services/MissingSettingsBanner.cs b/src/Orchard.Web/Modules/Orchard.Email/Services/MissingSettingsBanner.cs index c91e66f85..9c627bbf8 100644 --- a/src/Orchard.Web/Modules/Orchard.Email/Services/MissingSettingsBanner.cs +++ b/src/Orchard.Web/Modules/Orchard.Email/Services/MissingSettingsBanner.cs @@ -22,8 +22,6 @@ namespace Orchard.Email.Services { var workContext = _orchardServices.WorkContext; var smtpSettings = workContext.CurrentSite.As(); - var smtpClient = new SmtpClient(); - if (smtpSettings == null || !smtpSettings.IsValid()) { var urlHelper = new UrlHelper(workContext.HttpContext.Request.RequestContext); var url = urlHelper.Action("Email", "Admin", new {Area = "Settings"}); diff --git a/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs b/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs index dbba938d6..f8033c3df 100644 --- a/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs +++ b/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs @@ -23,6 +23,7 @@ using Orchard.Utility.Extensions; using System.Collections.Specialized; using Orchard.OutputCache.ViewModels; using Orchard.UI.Admin.Notification; +using Orchard.DisplayManagement.Shapes; namespace Orchard.OutputCache.Filters { public class OutputCacheFilter : FilterProvider, IActionFilter, IResultFilter { @@ -38,7 +39,6 @@ namespace Orchard.OutputCache.Filters { private readonly ISignals _signals; private readonly ShellSettings _shellSettings; private readonly ICacheControlStrategy _cacheControlStrategy; - private readonly INotificationManager _notificationManager; TextWriter _originalWriter; StringWriter _cachingWriter; @@ -57,8 +57,7 @@ namespace Orchard.OutputCache.Filters { ICacheService cacheService, ISignals signals, ShellSettings shellSettings, - ICacheControlStrategy cacheControlStrategy, - INotificationManager notificationManager + ICacheControlStrategy cacheControlStrategy ) { _cacheManager = cacheManager; _cacheStorageProvider = cacheStorageProvider; @@ -71,7 +70,6 @@ namespace Orchard.OutputCache.Filters { _signals = signals; _shellSettings = shellSettings; _cacheControlStrategy = cacheControlStrategy; - _notificationManager = notificationManager; Logger = NullLogger.Instance; } @@ -345,7 +343,9 @@ namespace Orchard.OutputCache.Filters { } // don't cache the result if there were some notifications - if (_notificationManager.GetNotifications().Any()) { + // notifications can come from Notifier and NotificationProvider + var messagesZone = _workContextAccessor.GetContext(filterContext).Layout.Zones["Messages"] as Shape; + if (messagesZone != null && messagesZone.Items.Any()) { return; } From a40bbbab51623f63a624661a4943ee8daafe120a Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Sun, 28 Sep 2014 15:16:43 -0400 Subject: [PATCH 03/26] #18826: Preventing shared references to repository collections --- src/Orchard/Data/Repository.cs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/Orchard/Data/Repository.cs b/src/Orchard/Data/Repository.cs index 4f42f512a..eaf9b40de 100644 --- a/src/Orchard/Data/Repository.cs +++ b/src/Orchard/Data/Repository.cs @@ -1,4 +1,5 @@ using System; +using System.Collections; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; @@ -111,6 +112,27 @@ namespace Orchard.Data { Logger.Debug("Copy {0} {1}", source, target); var metadata = Session.SessionFactory.GetClassMetadata(typeof (T)); var values = metadata.GetPropertyValues(source, EntityMode.Poco); + + for (var index = 0; index < values.Length; index++) { + var value = values[index]; + if (value == null) + continue; + + var type = value.GetType(); + var isGenericList = type.GetInterfaces() + .Where(i => i.IsGenericType) + .Any(i => i.GetGenericTypeDefinition() == typeof(IList<>)); + + if(!isGenericList) + continue; + + var genericType = type.GetGenericArguments().First(); + var makeGenericType = typeof (List<>).MakeGenericType(new[] {genericType}); + + var listValues = ((IList)value); + values[index] = Activator.CreateInstance(makeGenericType, new[] { listValues }); + } + metadata.SetPropertyValues(target, values, EntityMode.Poco); } From 7403aff65cb3692d2736a391ec435eb9a11dc674 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Sun, 28 Sep 2014 15:51:47 -0400 Subject: [PATCH 04/26] #18826: Correcting variable names --- src/Orchard/Data/Repository.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Orchard/Data/Repository.cs b/src/Orchard/Data/Repository.cs index eaf9b40de..f48dc8f8a 100644 --- a/src/Orchard/Data/Repository.cs +++ b/src/Orchard/Data/Repository.cs @@ -126,11 +126,11 @@ namespace Orchard.Data { if(!isGenericList) continue; - var genericType = type.GetGenericArguments().First(); - var makeGenericType = typeof (List<>).MakeGenericType(new[] {genericType}); + var genericArgument = type.GetGenericArguments().First(); + var genericType = typeof(List<>).MakeGenericType(new[] { genericArgument }); var listValues = ((IList)value); - values[index] = Activator.CreateInstance(makeGenericType, new[] { listValues }); + values[index] = Activator.CreateInstance(genericType, new[] { listValues }); } metadata.SetPropertyValues(target, values, EntityMode.Poco); From d7a87893d7c20cff99783fbc6946f70cffec1e49 Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Mon, 29 Sep 2014 12:03:10 -0700 Subject: [PATCH 05/26] Ignoring new VS14 CTP solution files --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 18cf32456..747685453 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ *.suo *.user *.sln.docstates +*.sln.ide/ # Build results From fc21ebc891641e8053c5d8104220443d522ac7a8 Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Mon, 29 Sep 2014 14:40:04 -0700 Subject: [PATCH 06/26] Fixing HTML encoding for feed tokens --- .../Modules/Orchard.Tokens/Providers/RssPartFeedItemBuilder.cs | 2 +- .../Views/DefinitionTemplates/RssPartSettings.cshtml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.Tokens/Providers/RssPartFeedItemBuilder.cs b/src/Orchard.Web/Modules/Orchard.Tokens/Providers/RssPartFeedItemBuilder.cs index 0892c5a88..f7bbf5ecb 100644 --- a/src/Orchard.Web/Modules/Orchard.Tokens/Providers/RssPartFeedItemBuilder.cs +++ b/src/Orchard.Web/Modules/Orchard.Tokens/Providers/RssPartFeedItemBuilder.cs @@ -85,7 +85,7 @@ namespace Orchard.Tokens.Providers { FeedItem item = feedItem; context.Response.Contextualize(requestContext => { - description.Value = _tokenizer.Replace(settings.Description, new { Content = item.Item, Text = description.Value }); + description.Value = _tokenizer.Replace(settings.Description, new { Content = item.Item, Text = description.Value }, new ReplaceOptions { Encoding = ReplaceOptions.NoEncode }); }); } } diff --git a/src/Orchard.Web/Modules/Orchard.Tokens/Views/DefinitionTemplates/RssPartSettings.cshtml b/src/Orchard.Web/Modules/Orchard.Tokens/Views/DefinitionTemplates/RssPartSettings.cshtml index a3267ff01..9beb00838 100644 --- a/src/Orchard.Web/Modules/Orchard.Tokens/Views/DefinitionTemplates/RssPartSettings.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Tokens/Views/DefinitionTemplates/RssPartSettings.cshtml @@ -15,7 +15,7 @@
@Html.TextBoxFor(m => m.Description, new { @class = "tokenized text medium" }) - @T("The description field of the RSS item") + @T("The description field of the RSS item. The content needs to be raw HTML, i.e. not encoded.")
From 64689433bc6ce3b907f02dc68e8a83f6e33dcad9 Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Mon, 29 Sep 2014 15:45:58 -0700 Subject: [PATCH 07/26] Fixing build scripts Calls the environment variables initialization script in all cases. --- ClickToBuild.cmd | 9 ++++----- ClickToBuildAzurePackage.cmd | 11 ++++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/ClickToBuild.cmd b/ClickToBuild.cmd index fa64a26f8..5fc7ac469 100644 --- a/ClickToBuild.cmd +++ b/ClickToBuild.cmd @@ -1,9 +1,8 @@ -if "%WindowsSdkDir%" neq "" goto build -if exist "%ProgramFiles%\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" goto initialize2k8Dev12 -if exist "%ProgramFiles(x86)%\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" goto initialize2k8on64Dev12 -if exist "%ProgramFiles%\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" goto initialize2k8Dev11 -if exist "%ProgramFiles(x86)%\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" goto initialize2k8on64Dev11 +if exist "%ProgramFiles%\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" goto initialize2k8on64Dev12 +if exist "%ProgramFiles(x86)%\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" goto initialize2k8Dev12 +if exist "%ProgramFiles%\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" goto initialize2k8on64Dev11 +if exist "%ProgramFiles(x86)%\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" goto initialize2k8Dev11 echo "Unable to detect suitable environment. Build may not succeed." goto build diff --git a/ClickToBuildAzurePackage.cmd b/ClickToBuildAzurePackage.cmd index 004332e44..6995dc8ec 100644 --- a/ClickToBuildAzurePackage.cmd +++ b/ClickToBuildAzurePackage.cmd @@ -1,8 +1,9 @@ -if "%WindowsSdkDir%" neq "" goto build -if exist "%ProgramFiles(x86)%\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" goto initialize2k8on64Dev11 -if exist "%ProgramFiles%\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" goto initialize2k8Dev11 -if exist "%ProgramFiles(x86)%\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" goto initialize2k8on64Dev12 -if exist "%ProgramFiles%\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" goto initialize2k8Dev12 + +if exist "%ProgramFiles%\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" goto initialize2k8on64Dev12 +if exist "%ProgramFiles(x86)%\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" goto initialize2k8Dev12 +if exist "%ProgramFiles%\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" goto initialize2k8on64Dev11 +if exist "%ProgramFiles(x86)%\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" goto initialize2k8Dev11 + echo "Unable to detect suitable environment. Build may not succeed." goto build From 47a00df9d7c7b64bf967dc9a5b108cc86766fec3 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Mon, 29 Sep 2014 20:54:09 -0400 Subject: [PATCH 08/26] Adding comment to Repository --- src/Orchard/Data/Repository.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Orchard/Data/Repository.cs b/src/Orchard/Data/Repository.cs index f48dc8f8a..92bb29101 100644 --- a/src/Orchard/Data/Repository.cs +++ b/src/Orchard/Data/Repository.cs @@ -113,6 +113,9 @@ namespace Orchard.Data { var metadata = Session.SessionFactory.GetClassMetadata(typeof (T)); var values = metadata.GetPropertyValues(source, EntityMode.Poco); + //This method is currently only used by StorageVersionFilter<>.Versioning() + //In order to prevent shared references to the same collection instance + //Instances of IList<> need to be copied to a new collection instance for (var index = 0; index < values.Length; index++) { var value = values[index]; if (value == null) From 69d1ef8f868d79491201ccd1e54a08cdf58cba7f Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Tue, 30 Sep 2014 15:33:14 -0700 Subject: [PATCH 09/26] Improving output cache filter. - This change allows any shapes to be added to the Messages zone without causing the output cache to not kick in anymore. - Using INotifier instead of INotificationManager to prevent invocation of INotificationProvider implementations. --- .../Orchard.OutputCache/Filters/OutputCacheFilter.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs b/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs index f8033c3df..e2d1d40f6 100644 --- a/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs +++ b/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs @@ -19,6 +19,7 @@ using Orchard.Mvc.Filters; using Orchard.Services; using Orchard.Themes; using Orchard.UI.Admin; +using Orchard.UI.Notify; using Orchard.Utility.Extensions; using System.Collections.Specialized; using Orchard.OutputCache.ViewModels; @@ -39,6 +40,7 @@ namespace Orchard.OutputCache.Filters { private readonly ISignals _signals; private readonly ShellSettings _shellSettings; private readonly ICacheControlStrategy _cacheControlStrategy; + private readonly INotifier _notifier; TextWriter _originalWriter; StringWriter _cachingWriter; @@ -57,8 +59,9 @@ namespace Orchard.OutputCache.Filters { ICacheService cacheService, ISignals signals, ShellSettings shellSettings, - ICacheControlStrategy cacheControlStrategy - ) { + ICacheControlStrategy cacheControlStrategy, + INotifier notifier) { + _cacheManager = cacheManager; _cacheStorageProvider = cacheStorageProvider; _tagCache = tagCache; @@ -70,6 +73,7 @@ namespace Orchard.OutputCache.Filters { _signals = signals; _shellSettings = shellSettings; _cacheControlStrategy = cacheControlStrategy; + _notifier = notifier; Logger = NullLogger.Instance; } @@ -343,9 +347,7 @@ namespace Orchard.OutputCache.Filters { } // don't cache the result if there were some notifications - // notifications can come from Notifier and NotificationProvider - var messagesZone = _workContextAccessor.GetContext(filterContext).Layout.Zones["Messages"] as Shape; - if (messagesZone != null && messagesZone.Items.Any()) { + if (_notifier.List().Any()) { return; } From 2cdd3a3f1b60450e0366a0414f12ef9f5502a6e3 Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Wed, 1 Oct 2014 10:46:49 -0700 Subject: [PATCH 10/26] Refactoring building scripts --- ClickToBuild.cmd | 18 ++++++++++-------- ClickToBuildAzurePackage.cmd | 18 ++++++++++-------- build.cmd | 5 ++--- 3 files changed, 22 insertions(+), 19 deletions(-) diff --git a/ClickToBuild.cmd b/ClickToBuild.cmd index 5fc7ac469..3c0b68c2d 100644 --- a/ClickToBuild.cmd +++ b/ClickToBuild.cmd @@ -9,23 +9,25 @@ goto build :initialize2k8Dev12 -call "%ProgramFiles%\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86 -goto build - -:initialize2k8on64Dev12 call "%ProgramFiles(x86)%\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86 goto build -:initialize2k8Dev11 -call "%ProgramFiles%\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x86 +:initialize2k8on64Dev12 +call "%ProgramFiles%\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86 goto build -:initialize2k8on64Dev11 +:initialize2k8Dev11 call "%ProgramFiles(x86)%\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x86 goto build +:initialize2k8on64Dev11 +call "%ProgramFiles%\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x86 +goto build + :build -call build +if "%~1"=="" msbuild /t:Build Orchard.proj +msbuild /t:%~1 Orchard.proj + pause goto end diff --git a/ClickToBuildAzurePackage.cmd b/ClickToBuildAzurePackage.cmd index 6995dc8ec..89f5cba72 100644 --- a/ClickToBuildAzurePackage.cmd +++ b/ClickToBuildAzurePackage.cmd @@ -9,23 +9,25 @@ goto build :initialize2k8Dev12 -call "%ProgramFiles%\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86 -goto build - -:initialize2k8on64Dev12 call "%ProgramFiles(x86)%\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86 goto build -:initialize2k8Dev11 -call "%ProgramFiles%\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x86 +:initialize2k8on64Dev12 +call "%ProgramFiles%\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86 goto build -:initialize2k8on64Dev11 +:initialize2k8Dev11 call "%ProgramFiles(x86)%\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x86 goto build +:initialize2k8on64Dev11 +call "%ProgramFiles%\Microsoft Visual Studio 11.0\VC\vcvarsall.bat" x86 +goto build + :build -msbuild /t:Build AzurePackage.proj +if "%~1"=="" msbuild /t:Build AzurePackage.proj +msbuild /t:%~1 AzurePackage.proj + pause goto end diff --git a/build.cmd b/build.cmd index eeddd1991..97f51bea8 100644 --- a/build.cmd +++ b/build.cmd @@ -1,3 +1,2 @@ -if "%~1"=="" build Build -msbuild /t:%~1 Orchard.proj - +if "%~1"=="" call clicktobuild +call clicktobuild %~1 \ No newline at end of file From 772ba66622adef7df7be28e83d84cf03d0843c2b Mon Sep 17 00:00:00 2001 From: Lombiq Date: Fri, 3 Oct 2014 19:17:30 +0200 Subject: [PATCH 11/26] #20309: Surfacing method from PlacementFileParser to parse placement texts. Work Item: 20309 --- .../ShapePlacementStrategy/PlacementFileParser.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Orchard/DisplayManagement/Descriptors/ShapePlacementStrategy/PlacementFileParser.cs b/src/Orchard/DisplayManagement/Descriptors/ShapePlacementStrategy/PlacementFileParser.cs index 4b736d874..8725ded54 100644 --- a/src/Orchard/DisplayManagement/Descriptors/ShapePlacementStrategy/PlacementFileParser.cs +++ b/src/Orchard/DisplayManagement/Descriptors/ShapePlacementStrategy/PlacementFileParser.cs @@ -12,6 +12,7 @@ namespace Orchard.DisplayManagement.Descriptors.ShapePlacementStrategy { /// public interface IPlacementFileParser : IDependency { PlacementFile Parse(string virtualPath); + PlacementFile ParseText(string placementText); } @@ -37,11 +38,11 @@ namespace Orchard.DisplayManagement.Descriptors.ShapePlacementStrategy { } var placementText = _webSiteFolder.ReadFile(virtualPath); - return ParseImplementation(virtualPath, placementText); + return ParseText(placementText); }); } - private PlacementFile ParseImplementation(string virtualPath, string placementText) { + public PlacementFile ParseText(string placementText) { if (placementText == null) return null; From ecd1f2e1b0936084ecbdf4aeb1c0ca1efa291881 Mon Sep 17 00:00:00 2001 From: Lombiq Date: Wed, 8 Oct 2014 22:36:15 +0200 Subject: [PATCH 12/26] Fixing that a request to an RSS feed with the empty "projection" query string parameter caused exception. --- .../Orchard.Projections/StandardQueries/QueryFeedQuery.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Orchard.Web/Modules/Orchard.Projections/StandardQueries/QueryFeedQuery.cs b/src/Orchard.Web/Modules/Orchard.Projections/StandardQueries/QueryFeedQuery.cs index 2faaae7a9..f3a62c87e 100644 --- a/src/Orchard.Web/Modules/Orchard.Projections/StandardQueries/QueryFeedQuery.cs +++ b/src/Orchard.Web/Modules/Orchard.Projections/StandardQueries/QueryFeedQuery.cs @@ -39,7 +39,7 @@ namespace Orchard.Projections.StandardQueries { public void Execute(FeedContext context) { var projectionId = context.ValueProvider.GetValue("projection"); - if (projectionId == null) + if (projectionId == null || String.IsNullOrEmpty(projectionId.AttemptedValue)) return; var limitValue = context.ValueProvider.GetValue("limit"); From 0a38ab0a045710f5d5d09c8337ee77cf739ba7d7 Mon Sep 17 00:00:00 2001 From: Lombiq Date: Thu, 9 Oct 2014 13:07:53 +0200 Subject: [PATCH 13/26] Fixing that shapes resolved by Orchard.Templates could cause NRE because of ShapeDescriptor missing --- .../Services/TemplateShapeBindingResolver.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.Templates/Services/TemplateShapeBindingResolver.cs b/src/Orchard.Web/Modules/Orchard.Templates/Services/TemplateShapeBindingResolver.cs index a93ae29ea..9579ffadc 100644 --- a/src/Orchard.Web/Modules/Orchard.Templates/Services/TemplateShapeBindingResolver.cs +++ b/src/Orchard.Web/Modules/Orchard.Templates/Services/TemplateShapeBindingResolver.cs @@ -38,8 +38,9 @@ namespace Orchard.Templates.Services { BindingName = "Templates", Binding = ctx => CoerceHtmlString(_templateService.Execute( templateResult.Template, - templateResult.Name, - templateResult.Processor, ctx.Value)) + templateResult.Name, + templateResult.Processor, ctx.Value)), + ShapeDescriptor = new ShapeDescriptor { ShapeType = shapeType } }; return true; From e42ed577bfec0175fe1188160812f2ccb6a53119 Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Fri, 10 Oct 2014 12:46:56 -0700 Subject: [PATCH 14/26] Prevent cache of pages with notifications --- .../Filters/OutputCacheFilter.cs | 15 ++++++--------- .../Orchard.OutputCache/Services/CacheService.cs | 3 +++ .../Services/DefaultTagCache.cs | 5 +++++ .../Orchard.OutputCache/Services/ITagCache.cs | 1 + 4 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs b/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs index e2d1d40f6..2dbd2ffc8 100644 --- a/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs +++ b/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs @@ -40,7 +40,6 @@ namespace Orchard.OutputCache.Filters { private readonly ISignals _signals; private readonly ShellSettings _shellSettings; private readonly ICacheControlStrategy _cacheControlStrategy; - private readonly INotifier _notifier; TextWriter _originalWriter; StringWriter _cachingWriter; @@ -59,8 +58,7 @@ namespace Orchard.OutputCache.Filters { ICacheService cacheService, ISignals signals, ShellSettings shellSettings, - ICacheControlStrategy cacheControlStrategy, - INotifier notifier) { + ICacheControlStrategy cacheControlStrategy) { _cacheManager = cacheManager; _cacheStorageProvider = cacheStorageProvider; @@ -73,7 +71,6 @@ namespace Orchard.OutputCache.Filters { _signals = signals; _shellSettings = shellSettings; _cacheControlStrategy = cacheControlStrategy; - _notifier = notifier; Logger = NullLogger.Instance; } @@ -347,7 +344,9 @@ namespace Orchard.OutputCache.Filters { } // don't cache the result if there were some notifications - if (_notifier.List().Any()) { + var hasNotifications = !String.IsNullOrEmpty(Convert.ToString(filterContext.Controller.TempData["messages"])); + if (hasNotifications) { + Logger.Debug("Not caching: notifications present"); return; } @@ -375,10 +374,8 @@ namespace Orchard.OutputCache.Filters { Logger.Debug("Cache item added: " + _cacheItem.CacheKey); - // remove only the current version of the page - _cacheService.RemoveByTag(_cacheKey); - - // add data to cache + // update the cached data + _cacheStorageProvider.Remove(_cacheKey); _cacheStorageProvider.Set(_cacheKey, _cacheItem); // add to the tags index diff --git a/src/Orchard.Web/Modules/Orchard.OutputCache/Services/CacheService.cs b/src/Orchard.Web/Modules/Orchard.OutputCache/Services/CacheService.cs index 2be361bf9..493616818 100644 --- a/src/Orchard.Web/Modules/Orchard.OutputCache/Services/CacheService.cs +++ b/src/Orchard.Web/Modules/Orchard.OutputCache/Services/CacheService.cs @@ -40,6 +40,9 @@ namespace Orchard.OutputCache.Services { foreach(var key in _tagCache.GetTaggedItems(tag)) { _cacheStorageProvider.Remove(key); } + + // we no longer need the tag entry as the items have been removed + _tagCache.RemoveTag(tag); } public IEnumerable GetCacheItems() { diff --git a/src/Orchard.Web/Modules/Orchard.OutputCache/Services/DefaultTagCache.cs b/src/Orchard.Web/Modules/Orchard.OutputCache/Services/DefaultTagCache.cs index 45a4a9d71..49d44216a 100644 --- a/src/Orchard.Web/Modules/Orchard.OutputCache/Services/DefaultTagCache.cs +++ b/src/Orchard.Web/Modules/Orchard.OutputCache/Services/DefaultTagCache.cs @@ -37,5 +37,10 @@ namespace Orchard.OutputCache.Services { return Enumerable.Empty(); } + + public void RemoveTag(string tag) { + HashSet set; + _dictionary.TryRemove(tag, out set); + } } } \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.OutputCache/Services/ITagCache.cs b/src/Orchard.Web/Modules/Orchard.OutputCache/Services/ITagCache.cs index a0fcc46d0..1ad9de378 100644 --- a/src/Orchard.Web/Modules/Orchard.OutputCache/Services/ITagCache.cs +++ b/src/Orchard.Web/Modules/Orchard.OutputCache/Services/ITagCache.cs @@ -4,5 +4,6 @@ namespace Orchard.OutputCache.Services { public interface ITagCache : ISingletonDependency { void Tag(string tag, params string[] keys); IEnumerable GetTaggedItems(string tag); + void RemoveTag(string tag); } } \ No newline at end of file From 26b64d9076c31a1438d63387d05f061e86a58c84 Mon Sep 17 00:00:00 2001 From: Lombiq Date: Sat, 11 Oct 2014 00:21:00 +0200 Subject: [PATCH 15/26] Removing wrong dependency from Orchard.Templates --- src/Orchard.Web/Modules/Orchard.Templates/Module.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Orchard.Web/Modules/Orchard.Templates/Module.txt b/src/Orchard.Web/Modules/Orchard.Templates/Module.txt index 54db255a8..60176b8fd 100644 --- a/src/Orchard.Web/Modules/Orchard.Templates/Module.txt +++ b/src/Orchard.Web/Modules/Orchard.Templates/Module.txt @@ -10,7 +10,7 @@ Features: Name: Templates Description: Provides a Template type that represents a shape template, stored as a content item. Category: Content - Dependencies: Contents, Orchard.Tokens, Orchard.Core + Dependencies: Contents, Orchard.Tokens Orchard.Templates.Razor: Name: Razor Templates Description: Extends Templates with Razor templates. From 7f9fce290bc99e0b3ca18fc9c8264fd2a6b0f475 Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Mon, 13 Oct 2014 16:46:42 -0700 Subject: [PATCH 16/26] Fixing update feature functionality. This fixes an issue when for some reason a migration update step fails and the user wants to try again, but the migrations aren't executed for the selected features. --- .../Orchard.Modules/Controllers/AdminController.cs | 5 ++++- .../Orchard.Modules/Views/Admin/Features.cshtml | 1 + src/Orchard/Data/Migration/DataMigrationManager.cs | 11 ++++++----- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.Modules/Controllers/AdminController.cs b/src/Orchard.Web/Modules/Orchard.Modules/Controllers/AdminController.cs index 84a178432..8806abfdf 100644 --- a/src/Orchard.Web/Modules/Orchard.Modules/Controllers/AdminController.cs +++ b/src/Orchard.Web/Modules/Orchard.Modules/Controllers/AdminController.cs @@ -221,7 +221,10 @@ namespace Orchard.Modules.Controllers { _moduleService.DisableFeatures(enabledFeatures, force == true); break; case FeaturesBulkAction.Update: - foreach (var feature in selectedFeatures.Where(x => x.NeedsUpdate)) { + var featuresThatNeedUpdate = _dataMigrationManager.GetFeaturesThatNeedUpdate(); + var selectedFeaturesThatNeedUpdate = selectedFeatures.Where(x => featuresThatNeedUpdate.Contains(x.Descriptor.Id)); + + foreach (var feature in selectedFeaturesThatNeedUpdate) { var id = feature.Descriptor.Id; try { _reportsCoordinator.Register("Data Migration", "Upgrade " + id, "Orchard installation"); diff --git a/src/Orchard.Web/Modules/Orchard.Modules/Views/Admin/Features.cshtml b/src/Orchard.Web/Modules/Orchard.Modules/Views/Admin/Features.cshtml index c2cf94af1..75c33d277 100644 --- a/src/Orchard.Web/Modules/Orchard.Modules/Views/Admin/Features.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Modules/Views/Admin/Features.cshtml @@ -30,6 +30,7 @@ @Html.SelectOption(Model.BulkAction, FeaturesBulkAction.None, T("Choose action...").ToString()) @Html.SelectOption(Model.BulkAction, FeaturesBulkAction.Enable, T("Enable").ToString()) @Html.SelectOption(Model.BulkAction, FeaturesBulkAction.Disable, T("Disable").ToString()) + @Html.SelectOption(Model.BulkAction, FeaturesBulkAction.Update, T("Update").ToString()) @Html.SelectOption(Model.BulkAction, FeaturesBulkAction.Toggle, T("Toggle").ToString()) diff --git a/src/Orchard/Data/Migration/DataMigrationManager.cs b/src/Orchard/Data/Migration/DataMigrationManager.cs index 2ce65beab..e95fdf672 100644 --- a/src/Orchard/Data/Migration/DataMigrationManager.cs +++ b/src/Orchard/Data/Migration/DataMigrationManager.cs @@ -22,7 +22,7 @@ namespace Orchard.Data.Migration { private readonly IContentDefinitionManager _contentDefinitionManager; private readonly ITransactionManager _transactionManager; - private List _processedFeatures; + private readonly List _processedFeatures; public DataMigrationManager( IEnumerable dataMigrations, @@ -118,11 +118,11 @@ namespace Orchard.Data.Migration { while (lookupTable.ContainsKey(current)) { try { - Logger.Information("Applying migration for {0} from version {1}", feature, current); + Logger.Information("Applying migration for {0} from version {1}.", feature, current); current = (int)lookupTable[current].Invoke(migration, new object[0]); } catch (Exception ex) { - Logger.Error(ex, "An unexpected error occurred while applying migration on {0} from version {1}", feature, current); + Logger.Error(ex, "An unexpected error occurred while applying migration on {0} from version {1}.", feature, current); throw; } } @@ -139,15 +139,16 @@ namespace Orchard.Data.Migration { } } catch (Exception e) { - Logger.Error(e, "Error while running migration version {0} for {1}", current, feature); + Logger.Error(e, "Error while running migration version {0} for {1}.", current, feature); _transactionManager.Cancel(); + throw new OrchardException(T("Error while running migration version {0} for {1}.", current, feature), e); } } } public void Uninstall(string feature) { - Logger.Information("Uninstalling feature: {0}", feature); + Logger.Information("Uninstalling feature: {0}.", feature); var migrations = GetDataMigrations(feature); From 0491a38aea06d8b57e79f664024c7c4092dc1a9a Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Mon, 13 Oct 2014 18:13:31 -0700 Subject: [PATCH 17/26] Initializing T property with a default instance. --- src/Orchard/Data/Migration/DataMigrationManager.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Orchard/Data/Migration/DataMigrationManager.cs b/src/Orchard/Data/Migration/DataMigrationManager.cs index e95fdf672..1ef6e33d7 100644 --- a/src/Orchard/Data/Migration/DataMigrationManager.cs +++ b/src/Orchard/Data/Migration/DataMigrationManager.cs @@ -40,6 +40,7 @@ namespace Orchard.Data.Migration { _processedFeatures = new List(); Logger = NullLogger.Instance; + T = NullLocalizer.Instance; } public Localizer T { get; set; } public ILogger Logger { get; set; } From 60021d92f447c9892c7d7686cd9326540576de43 Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Mon, 13 Oct 2014 18:15:06 -0700 Subject: [PATCH 18/26] Adding test. This test asserts that a failing data migration throws an OrchardException. This exception is then handled by the controller to render the proper error message. --- .../DataMigration/DataMigrationTests.cs | 39 ++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/src/Orchard.Tests/DataMigration/DataMigrationTests.cs b/src/Orchard.Tests/DataMigration/DataMigrationTests.cs index 3837d5dd8..607139767 100644 --- a/src/Orchard.Tests/DataMigration/DataMigrationTests.cs +++ b/src/Orchard.Tests/DataMigration/DataMigrationTests.cs @@ -237,6 +237,24 @@ namespace Orchard.Tests.DataMigration { return 3; } } + + public class FailingDataMigration : DataMigrationImpl { + public override Feature Feature { + get { return new Feature() { Descriptor = new FeatureDescriptor { Id = "Feature4", Extension = new ExtensionDescriptor { Id = "Module4" } } }; } + } + + public int Create() { + SchemaBuilder.CreateTable("FOO", table => + table.Column("Id", DbType.Int32, column => + column.PrimaryKey().Identity())); + + return 1; + } + + public int UpdateFrom1() { + throw new Exception(); + } + } public class DataMigrationSimpleBuilder : DataMigrationImpl { public override Feature Feature { @@ -471,9 +489,28 @@ Features: Description: Feature "); - _dataMigrationManager.Update("Feature1"); + try {_dataMigrationManager.Update("Feature1"); } + catch (OrchardException) {} + Assert.That(_repository.Table.Count(), Is.EqualTo(0)); + _dataMigrationManager.Update("Feature1"); } + + [Test] + public void FailingDataMigrationShouldThrowOrchardException() { + Init(new[] { typeof(FailingDataMigration) }); + + _folders.Manifests.Add("Module4", @" +Name: Module4 +Version: 0.1 +OrchardVersion: 1 +Features: + Feature4: + Description: Feature +"); + + Assert.Throws(() => _dataMigrationManager.Update("Feature4")); + } } } \ No newline at end of file From 5adf1e7407e84f13122820b36eb92b0a945ca244 Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Tue, 14 Oct 2014 19:59:06 -0400 Subject: [PATCH 19/26] #20742: Query String Incorrectly Used in Cache Key WorkItem: 20742 --- .../Orchard.OutputCache/Filters/OutputCacheFilter.cs | 9 +-------- .../Orchard.OutputCache/Views/Statistics/Index.cshtml | 2 ++ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs b/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs index 2dbd2ffc8..4af3fbeb7 100644 --- a/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs +++ b/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs @@ -515,14 +515,7 @@ namespace Orchard.OutputCache.Filters { } private string ComputeCacheKey(ControllerContext controllerContext, IEnumerable> parameters) { - var url = controllerContext.HttpContext.Request.RawUrl; - if (!VirtualPathUtility.IsAbsolute(url)) { - var applicationRoot = new UrlHelper(controllerContext.HttpContext.Request.RequestContext).MakeAbsolute("/"); - if (url.StartsWith(applicationRoot, StringComparison.OrdinalIgnoreCase)) { - url = "~/" + url.Substring(applicationRoot.Length); - url = VirtualPathUtility.ToAbsolute(url); - } - } + var url = controllerContext.HttpContext.Request.Url.AbsolutePath; return ComputeCacheKey(_shellSettings.Name, url, () => _workContext.CurrentCulture, _themeManager.GetRequestTheme(controllerContext.RequestContext).Id, parameters); } diff --git a/src/Orchard.Web/Modules/Orchard.OutputCache/Views/Statistics/Index.cshtml b/src/Orchard.Web/Modules/Orchard.OutputCache/Views/Statistics/Index.cshtml index 8c3329281..548d763dc 100644 --- a/src/Orchard.Web/Modules/Orchard.OutputCache/Views/Statistics/Index.cshtml +++ b/src/Orchard.Web/Modules/Orchard.OutputCache/Views/Statistics/Index.cshtml @@ -15,6 +15,7 @@ @T("Url") + @T("Cache Key") @T("Cached On") @T("Cached Until")   @@ -23,6 +24,7 @@ @foreach (var cacheItem in Model.CacheItems) { @cacheItem.Url + @cacheItem.CacheKey @Display.DateTimeRelative(DateTimeUtc: cacheItem.CachedOnUtc) @cacheItem.ValidUntilUtc.ToLocalTime() @Html.ActionLink(T("Evict").Text, "Evict", new { Area = "Orchard.OutputCache", Controller = "Statistics", cacheKey = cacheItem.CacheKey }) From af011318798449a838a7c9ff44dc3d40158bd2ef Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Tue, 14 Oct 2014 20:01:21 -0400 Subject: [PATCH 20/26] #20976: Corectly Applying VaryByParams WorkItem: 20976 --- .../Orchard.OutputCache/Filters/OutputCacheFilter.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs b/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs index 4af3fbeb7..41dbff914 100644 --- a/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs +++ b/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs @@ -221,7 +221,8 @@ namespace Orchard.OutputCache.Filters { var parameters = new Dictionary(filterContext.ActionParameters); foreach (var key in queryString.AllKeys) { - if (key == null) continue; + if (key == null || (_varyQueryStringParameters != null + && !_varyQueryStringParameters.Contains(key))) continue; // ignore pages with the RefreshKey if (String.Equals(RefreshKey, key, StringComparison.OrdinalIgnoreCase)) { @@ -488,7 +489,6 @@ namespace Orchard.OutputCache.Filters { response.Cache.SetMaxAge(maxAge); } - response.Cache.VaryByParams["*"] = true; response.DisableUserCache(); // keeping this examples for later usage @@ -503,7 +503,10 @@ namespace Orchard.OutputCache.Filters { } } - if (_varyQueryStringParameters != null) { + if (_varyQueryStringParameters == null) { + response.Cache.VaryByParams["*"] = true; + } + else { foreach (var queryStringParam in _varyQueryStringParameters) { response.Cache.VaryByParams[queryStringParam] = true; } From 35823646cf6a379e322c93d9e9a0b100e1ec8e9c Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Tue, 14 Oct 2014 20:10:24 -0400 Subject: [PATCH 21/26] #20977: Correctly removing cacheItems by invariant tag WorkItem: 20977 --- .../Filters/OutputCacheFilter.cs | 33 +++++++++---------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs b/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs index 41dbff914..bfa517cc8 100644 --- a/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs +++ b/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs @@ -418,26 +418,23 @@ namespace Orchard.OutputCache.Filters { Logger.Debug("Redirect on POST"); var redirectUrl = redirectResult.Url; - if (!VirtualPathUtility.IsAbsolute(redirectUrl)) { - var applicationRoot = new UrlHelper(filterContext.HttpContext.Request.RequestContext).MakeAbsolute("/"); - if (redirectUrl.StartsWith(applicationRoot, StringComparison.OrdinalIgnoreCase)) { - redirectUrl = "~/" + redirectUrl.Substring(applicationRoot.Length); - redirectUrl = VirtualPathUtility.ToAbsolute(redirectUrl); - } + if (filterContext.HttpContext.Request.IsLocalUrl(redirectUrl)) { + var helper = new UrlHelper(filterContext.HttpContext.Request.RequestContext); + var absolutePath = new Uri(helper.MakeAbsolute(redirectUrl)).AbsolutePath; + + // querystring invariant key + var invariantCacheKey = ComputeCacheKey( + _shellSettings.Name, + absolutePath, + () => _workContext.CurrentCulture, + _themeManager.GetRequestTheme(filterContext.RequestContext).Id, + null + ); + + // remove all cached version of the same page + _cacheService.RemoveByTag(invariantCacheKey); } - // querystring invariant key - var invariantCacheKey = ComputeCacheKey( - _shellSettings.Name, - redirectUrl, - () => _workContext.CurrentCulture, - _themeManager.GetRequestTheme(filterContext.RequestContext).Id, - null - ); - - // remove all cached version of the same page - _cacheService.RemoveByTag(invariantCacheKey); - // adding a refresh key so that the redirection doesn't get restored // from a cached version on a proxy // this can happen when using public caching, we want to force the From a798d974f75bd06b2c406fa978b973aaa89381dc Mon Sep 17 00:00:00 2001 From: Lombiq Date: Fri, 17 Oct 2014 13:43:40 +0200 Subject: [PATCH 22/26] #20999: Handling returnUrl also on the LogOn page. WorkItem: 20999 --- .../Modules/Orchard.Users/Controllers/AccountController.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.Users/Controllers/AccountController.cs b/src/Orchard.Web/Modules/Orchard.Users/Controllers/AccountController.cs index d75d42e3b..067cbfdbb 100644 --- a/src/Orchard.Web/Modules/Orchard.Users/Controllers/AccountController.cs +++ b/src/Orchard.Web/Modules/Orchard.Users/Controllers/AccountController.cs @@ -64,9 +64,9 @@ namespace Orchard.Users.Controllers { } [AlwaysAccessible] - public ActionResult LogOn() { + public ActionResult LogOn(string returnUrl) { if (_authenticationService.GetAuthenticatedUser() != null) - return Redirect("~/"); + return this.RedirectLocal(returnUrl); var shape = _orchardServices.New.LogOn().Title(T("Log On").Text); return new ShapeResult(this, shape); From 0a8b55892bd4f6eefb10f36c6273d986d53b2c7b Mon Sep 17 00:00:00 2001 From: Lombiq Date: Sat, 18 Oct 2014 23:31:29 +0200 Subject: [PATCH 23/26] Untabify ImportExport template --- .../Orchard.ImportExport/Views/Admin/Export.cshtml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.ImportExport/Views/Admin/Export.cshtml b/src/Orchard.Web/Modules/Orchard.ImportExport/Views/Admin/Export.cshtml index 9c5a5dd8f..8f76081c1 100644 --- a/src/Orchard.Web/Modules/Orchard.ImportExport/Views/Admin/Export.cshtml +++ b/src/Orchard.Web/Modules/Orchard.ImportExport/Views/Admin/Export.cshtml @@ -5,10 +5,10 @@ @using (Html.BeginFormAntiForgeryPost()) { Html.ValidationSummary(); -
- @T("Choose the types to include in the export file:") -
    - @{var contentTypeIndex = 0;} +
    + @T("Choose the types to include in the export file:") +
      + @{var contentTypeIndex = 0;} @foreach (var contentTypeEntry in Model.ContentTypes) {
    1. @@ -17,7 +17,7 @@
    2. contentTypeIndex = contentTypeIndex + 1; } -
    +

From fa683f02d9cb9d1a4be51bb2b8ee1a35f07a7dfc Mon Sep 17 00:00:00 2001 From: Stanley Goldman Date: Sun, 19 Oct 2014 14:56:24 -0400 Subject: [PATCH 24/26] #21016: Adding Import/Export Functionality to TagCloudDriver WorkItem: 21016 --- .../Modules/Orchard.Tags/Drivers/TagCloudDriver.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Orchard.Web/Modules/Orchard.Tags/Drivers/TagCloudDriver.cs b/src/Orchard.Web/Modules/Orchard.Tags/Drivers/TagCloudDriver.cs index 9e815c0c9..345c8f576 100644 --- a/src/Orchard.Web/Modules/Orchard.Tags/Drivers/TagCloudDriver.cs +++ b/src/Orchard.Web/Modules/Orchard.Tags/Drivers/TagCloudDriver.cs @@ -1,5 +1,7 @@ -using Orchard.ContentManagement; +using System; +using Orchard.ContentManagement; using Orchard.ContentManagement.Drivers; +using Orchard.ContentManagement.Handlers; using Orchard.Environment.Extensions; using Orchard.Tags.Models; @@ -34,5 +36,15 @@ namespace Orchard.Tags.Drivers { updater.TryUpdateModel(part, Prefix, null, null); return Editor(part, shapeHelper); } + + protected override void Exporting(TagCloudPart part, ExportContentContext context) { + context.Element(part.PartDefinition.Name).SetAttributeValue("Slug", part.Slug); + context.Element(part.PartDefinition.Name).SetAttributeValue("Buckets", part.Buckets); + } + + protected override void Importing(TagCloudPart part, ImportContentContext context) { + part.Slug = context.Attribute(part.PartDefinition.Name, "Slug"); + part.Buckets = Convert.ToInt32(context.Attribute(part.PartDefinition.Name, "Buckets")); + } } } \ No newline at end of file From 9a44d09c5e131f034d3fc7f76427ac886cf4c874 Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Mon, 20 Oct 2014 12:39:12 -0700 Subject: [PATCH 25/26] #20962: Handling text field keypress events on bulk actions to trigger the expected action. Work Item: 20962 --- src/Orchard.Web/Themes/TheAdmin/Scripts/admin.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/Orchard.Web/Themes/TheAdmin/Scripts/admin.js b/src/Orchard.Web/Themes/TheAdmin/Scripts/admin.js index 39eca3ac1..8fbf492ff 100644 --- a/src/Orchard.Web/Themes/TheAdmin/Scripts/admin.js +++ b/src/Orchard.Web/Themes/TheAdmin/Scripts/admin.js @@ -74,6 +74,22 @@ $(".check-all").change(function () { $(this).parents("table.items").find(":checkbox:not(:disabled)").prop('checked', $(this).prop("checked")); }); + // Handle keypress events in bulk action fieldsets that are part of a single form. + // This will make sure the expected action executes when pressing "enter" on a text field. + $("form .bulk-actions").on("keypress", "input[type='text']", function (e) { + if (e.which != 13) + return; + + var sender = $(this); + var fieldset = sender.closest("fieldset.bulk-actions"); + var submitButton = fieldset.find("button[type='submit']"); + + if (submitButton.length == 0) + return; + + e.preventDefault(); + submitButton.click(); + }); })(jQuery); From d1f0eda6f46948b3effa167522540864873f8303 Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Tue, 21 Oct 2014 11:57:21 -0700 Subject: [PATCH 26/26] Fixing specflow test --- src/Orchard.Specs/Comments.feature | 1 + src/Orchard.Specs/Comments.feature.cs | 42 ++++++++++++++------------- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/src/Orchard.Specs/Comments.feature b/src/Orchard.Specs/Comments.feature index 7c27734a3..22ca0eb1b 100644 --- a/src/Orchard.Specs/Comments.feature +++ b/src/Orchard.Specs/Comments.feature @@ -39,6 +39,7 @@ Scenario: HTML markup in any given comment is encoded And I hit "Submit Comment" And I am redirected # because the ToUrlString extension method breaks in this specific (test) environment, the returnUrl is broken... + And I go to "my-blog/my-post" # And I go to "my-blog/my-post" Then I should see "This is<br id="bad-anon-br" />a <a href" And I should not see "
" diff --git a/src/Orchard.Specs/Comments.feature.cs b/src/Orchard.Specs/Comments.feature.cs index 268618841..4c48a16bb 100644 --- a/src/Orchard.Specs/Comments.feature.cs +++ b/src/Orchard.Specs/Comments.feature.cs @@ -3,7 +3,7 @@ // This code was generated by SpecFlow (http://www.specflow.org/). // SpecFlow Version:1.9.0.77 // SpecFlow Generator Version:1.9.0.0 -// Runtime Version:4.0.30319.34014 +// Runtime Version:4.0.30319.0 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -150,11 +150,13 @@ this.ScenarioSetup(scenarioInfo); testRunner.And("I hit \"Submit Comment\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line 40 testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line 43 - testRunner.Then("I should see \"This is<br id="bad-anon-br" />a <a href\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); +#line 42 + testRunner.And("I go to \"my-blog/my-post\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line 44 + testRunner.Then("I should see \"This is<br id="bad-anon-br" />a <a href\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); +#line 45 testRunner.And("I should not see \"
\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line 47 +#line 48 testRunner.When("I go to \"users/account/logon\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); #line hidden TechTalk.SpecFlow.Table table5 = new TechTalk.SpecFlow.Table(new string[] { @@ -166,13 +168,13 @@ this.ScenarioSetup(scenarioInfo); table5.AddRow(new string[] { "password", "6655321"}); -#line 48 +#line 49 testRunner.And("I fill in", ((string)(null)), table5, "And "); -#line 52 - testRunner.And("I hit \"Sign In\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line 53 - testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); + testRunner.And("I hit \"Sign In\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line 54 + testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 55 testRunner.And("I go to \"admin/settings/comments\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line hidden TechTalk.SpecFlow.Table table6 = new TechTalk.SpecFlow.Table(new string[] { @@ -181,17 +183,17 @@ this.ScenarioSetup(scenarioInfo); table6.AddRow(new string[] { "CommentSettings.ModerateComments", "true"}); -#line 55 +#line 56 testRunner.And("I fill in", ((string)(null)), table6, "And "); -#line 58 - testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line 59 - testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); + testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line 60 - testRunner.Then("I should see \"Settings updated\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); + testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line 61 - testRunner.When("I go to \"users/account/logoff\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); + testRunner.Then("I should see \"Settings updated\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); #line 62 + testRunner.When("I go to \"users/account/logoff\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When "); +#line 63 testRunner.And("I go to \"my-blog/my-post\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line hidden TechTalk.SpecFlow.Table table7 = new TechTalk.SpecFlow.Table(new string[] { @@ -203,17 +205,17 @@ this.ScenarioSetup(scenarioInfo); table7.AddRow(new string[] { "Comments.CommentText", "This is a moderated comment."}); -#line 63 +#line 64 testRunner.And("I fill in", ((string)(null)), table7, "And "); -#line 67 - testRunner.And("I hit \"Submit Comment\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line 68 + testRunner.And("I hit \"Submit Comment\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); +#line 69 testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); -#line 70 - testRunner.And("I go to \"my-blog/my-post\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line 71 - testRunner.Then("I should see \"Hi there\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); + testRunner.And("I go to \"my-blog/my-post\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line 72 + testRunner.Then("I should see \"Hi there\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then "); +#line 73 testRunner.And("I should not see \"This is a moderated comment\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And "); #line hidden this.ScenarioCleanup();