From 6e485a5873482216e65d477c8a20270aa6cf931d Mon Sep 17 00:00:00 2001 From: neTp9c Date: Tue, 1 Dec 2015 01:56:10 +0300 Subject: [PATCH 01/14] fix --- .../Drivers/ContentPermissionsPartDriver.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Orchard.Web/Modules/Orchard.ContentPermissions/Drivers/ContentPermissionsPartDriver.cs b/src/Orchard.Web/Modules/Orchard.ContentPermissions/Drivers/ContentPermissionsPartDriver.cs index 57c44e46e..c6bed1487 100644 --- a/src/Orchard.Web/Modules/Orchard.ContentPermissions/Drivers/ContentPermissionsPartDriver.cs +++ b/src/Orchard.Web/Modules/Orchard.ContentPermissions/Drivers/ContentPermissionsPartDriver.cs @@ -120,6 +120,11 @@ namespace Orchard.ContentPermissions.Drivers { protected override DriverResult Editor(ContentPermissionsPart part, IUpdateModel updater, dynamic shapeHelper) { + // ensure the current user is allowed to define permissions + if (!_authorizer.Authorize(Permissions.GrantPermission)) { + return null; + } + var allRoles = _roleService.GetRoles().Select(x => x.Name).OrderBy(x => x).ToList(); var model = new ContentPermissionsPartViewModel(); From 19faeecc9a3140903da8cb196e38e97bfdaf2e94 Mon Sep 17 00:00:00 2001 From: Thierry Fleury Date: Tue, 1 Dec 2015 17:23:53 +0100 Subject: [PATCH 02/14] Fixes #6113 : Anchor custom link on homepage produces bad href --- .../Navigation/Services/NavigationManager.cs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/Orchard.Web/Core/Navigation/Services/NavigationManager.cs b/src/Orchard.Web/Core/Navigation/Services/NavigationManager.cs index 93a2a3096..c36f7d9ae 100644 --- a/src/Orchard.Web/Core/Navigation/Services/NavigationManager.cs +++ b/src/Orchard.Web/Core/Navigation/Services/NavigationManager.cs @@ -93,16 +93,15 @@ namespace Orchard.Core.Navigation.Services { var schemes = new[] { "http", "https", "tel", "mailto" }; if (!string.IsNullOrEmpty(url) && _urlHelper.RequestContext.HttpContext != null && !(url.StartsWith("/") || schemes.Any(scheme => url.StartsWith(scheme + ":")))) { - if (url.StartsWith("~/")) { - - if (!String.IsNullOrEmpty(_shellSettings.RequestUrlPrefix)) { - url = _shellSettings.RequestUrlPrefix + "/" + url.Substring(2); - } - else { - url = url.Substring(2); - } - } if (!url.StartsWith("#")) { + if (url.StartsWith("~/")) { + if (!String.IsNullOrEmpty(_shellSettings.RequestUrlPrefix)) { + url = _shellSettings.RequestUrlPrefix + "/" + url.Substring(2); + } + else { + url = url.Substring(2); + } + } var appPath = _urlHelper.RequestContext.HttpContext.Request.ApplicationPath; if (appPath == "/") appPath = ""; From 117dd09f8c089a22ff2e9911477e5e8dbcf3be15 Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Fri, 4 Dec 2015 11:11:32 -0800 Subject: [PATCH 03/14] Improving monitors usage for output cache --- .../Filters/OutputCacheFilter.cs | 68 ++++++++++++------- 1 file changed, 43 insertions(+), 25 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs b/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs index f273a1b57..56be73b56 100644 --- a/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs +++ b/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.Specialized; using System.Globalization; @@ -24,11 +23,10 @@ using Orchard.UI.Admin; using Orchard.Utility.Extensions; namespace Orchard.OutputCache.Filters { - public class OutputCacheFilter : FilterProvider, IActionFilter, IResultFilter { + public class OutputCacheFilter : FilterProvider, IActionFilter, IResultFilter, IDisposable { private static string _refreshKey = "__r"; private static long _epoch = new DateTime(2014, DateTimeKind.Utc).Ticks; - private static readonly ConcurrentDictionary _cacheKeyLocks = new ConcurrentDictionary(); // Dependencies. private readonly ICacheManager _cacheManager; @@ -41,6 +39,8 @@ namespace Orchard.OutputCache.Filters { private readonly ICacheService _cacheService; private readonly ISignals _signals; private readonly ShellSettings _shellSettings; + private bool _isDisposed = false; + public ILogger Logger { get; set; } public OutputCacheFilter( @@ -96,15 +96,11 @@ namespace Orchard.OutputCache.Filters { return; // Computing the cache key after we know that the request is cacheable means that we are only performing this calculation on requests that require it - _cacheKey = ComputeCacheKey(filterContext, GetCacheKeyParameters(filterContext)); + _cacheKey = String.Intern(ComputeCacheKey(filterContext, GetCacheKeyParameters(filterContext))); _invariantCacheKey = ComputeCacheKey(filterContext, null); Logger.Debug("Cache key '{0}' was created.", _cacheKey); - // The cache key lock for a given cache key is used to synchronize requests to - // ensure only a single request is regenerating the item. - var cacheKeyLock = _cacheKeyLocks.GetOrAdd(_cacheKey, x => new object()); - try { // Is there a cached item, and are we allowed to serve it? @@ -118,7 +114,7 @@ namespace Orchard.OutputCache.Filters { if (cacheItem.IsInGracePeriod(_now)) { // Render the content unless another request is already doing so. - if (Monitor.TryEnter(cacheKeyLock)) { + if (Monitor.TryEnter(_cacheKey)) { Logger.Debug("Item '{0}' is in grace period and not currently being rendered; rendering item...", _cacheKey); BeginRenderItem(filterContext); return; @@ -135,7 +131,7 @@ namespace Orchard.OutputCache.Filters { // No cached item found, or client doesn't want it; acquire the cache key // lock to render the item. Logger.Debug("Item '{0}' was not found in cache or client refuses it. Acquiring cache key lock...", _cacheKey); - if (Monitor.TryEnter(cacheKeyLock, TimeSpan.FromSeconds(20))) { + if (Monitor.TryEnter(_cacheKey)) { Logger.Debug("Cache key lock for item '{0}' was acquired.", _cacheKey); // Item might now have been rendered and cached by another request; if so serve it from cache. @@ -143,7 +139,7 @@ namespace Orchard.OutputCache.Filters { cacheItem = GetCacheItem(_cacheKey); if (cacheItem != null) { Logger.Debug("Item '{0}' was now found; releasing cache key lock and serving from cache.", _cacheKey); - Monitor.Exit(cacheKeyLock); + Monitor.Exit(_cacheKey); ServeCachedItem(filterContext, cacheItem); return; } @@ -159,8 +155,7 @@ namespace Orchard.OutputCache.Filters { catch { // Remember to release the cache key lock in the event of an exception! Logger.Debug("Exception occurred for item '{0}'; releasing any acquired lock.", _cacheKey); - if (Monitor.IsEntered(cacheKeyLock)) - Monitor.Exit(cacheKeyLock); + ReleaseCacheKeyLock(); throw; } } @@ -177,11 +172,11 @@ namespace Orchard.OutputCache.Filters { var captureHandlerIsAttached = false; try { - + // This filter is not reentrant (multiple executions within the same request are // not supported) so child actions are ignored completely. if (filterContext.IsChildAction || !_isCachingRequest) - return; + return; Logger.Debug("Item '{0}' was rendered.", _cacheKey); @@ -358,7 +353,7 @@ namespace Orchard.OutputCache.Filters { protected virtual IDictionary GetCacheKeyParameters(ActionExecutingContext filterContext) { var result = new Dictionary(); - + // Vary by action parameters. foreach (var p in filterContext.ActionParameters) result.Add("PARAM:" + p.Key, p.Value); @@ -381,7 +376,7 @@ namespace Orchard.OutputCache.Filters { result["HEADER:" + varyByRequestHeader] = requestHeaders[varyByRequestHeader]; } - + // Vary by request culture if configured. if (CacheSettings.VaryByCulture) { result["culture"] = _workContext.CurrentCulture.ToLowerInvariant(); @@ -472,7 +467,7 @@ namespace Orchard.OutputCache.Filters { var response = filterContext.HttpContext.Response; // Fix for missing charset in response headers - response.Charset = response.Charset; + response.Charset = response.Charset; // Adds some caching information to the output if requested. if (CacheSettings.DebugMode) { @@ -538,12 +533,10 @@ namespace Orchard.OutputCache.Filters { } private void ReleaseCacheKeyLock() { - if (_cacheKey != null) { - object cacheKeyLock; - if (_cacheKeyLocks.TryGetValue(_cacheKey, out cacheKeyLock) && Monitor.IsEntered(cacheKeyLock)) { - Logger.Debug("Releasing cache key lock for item '{0}'.", _cacheKey); - Monitor.Exit(cacheKeyLock); - } + if (_cacheKey != null && Monitor.IsEntered(_cacheKey)) { + Logger.Debug("Releasing cache key lock for item '{0}'.", _cacheKey); + Monitor.Exit(_cacheKey); + _cacheKey = null; } } @@ -597,12 +590,37 @@ namespace Orchard.OutputCache.Filters { var cacheItem = _cacheStorageProvider.GetCacheItem(key); return cacheItem; } - catch(Exception e) { + catch (Exception e) { Logger.Error(e, "An unexpected error occured while reading a cache entry"); } return null; } + + public void Dispose() { + Dispose(true); + GC.SuppressFinalize(this); + } + + protected virtual void Dispose(bool disposing) { + if (!_isDisposed) { + if (disposing) { + // Free other state (managed objects). + } + + if (_cacheKey != null && Monitor.IsEntered(_cacheKey)) { + Monitor.Exit(_cacheKey); + } + + _isDisposed = true; + } + } + + ~OutputCacheFilter() { + // Ensure locks are released even after an unexpected exception + Dispose(false); + } + } public class ViewDataContainer : IViewDataContainer { From ea5ce6c865c290bba7a07b58d42d144d0de4404e Mon Sep 17 00:00:00 2001 From: Thierry Fleury Date: Wed, 16 Dec 2015 18:33:43 +0100 Subject: [PATCH 04/14] Fixes 6189 : TextAreaElement throwing on null ProcessedValue --- .../Orchard.DynamicForms/Views/Elements/TextArea.cshtml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Orchard.Web/Modules/Orchard.DynamicForms/Views/Elements/TextArea.cshtml b/src/Orchard.Web/Modules/Orchard.DynamicForms/Views/Elements/TextArea.cshtml index a83544ce6..af64c27d5 100644 --- a/src/Orchard.Web/Modules/Orchard.DynamicForms/Views/Elements/TextArea.cshtml +++ b/src/Orchard.Web/Modules/Orchard.DynamicForms/Views/Elements/TextArea.cshtml @@ -22,7 +22,9 @@ tagBuilder.AddCssClass("input-validation-error"); } - tagBuilder.SetInnerText(Model.ProcessedValue); + if (!String.IsNullOrWhiteSpace((string)Model.ProcessedValue)) { + tagBuilder.SetInnerText(Model.ProcessedValue); + } } @if (element.ShowLabel) { From c45da04455c04460d2aaff85188dacc85ef96615 Mon Sep 17 00:00:00 2001 From: Thierry Fleury Date: Sun, 20 Dec 2015 19:54:21 +0100 Subject: [PATCH 05/14] Close #2027 : Add role rule in Orchard.Widgets module --- .../Orchard.Roles/Orchard.Roles.csproj | 2 ++ .../RuleEngine/RoleRuleProvider.cs | 36 +++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 src/Orchard.Web/Modules/Orchard.Roles/RuleEngine/RoleRuleProvider.cs diff --git a/src/Orchard.Web/Modules/Orchard.Roles/Orchard.Roles.csproj b/src/Orchard.Web/Modules/Orchard.Roles/Orchard.Roles.csproj index 516473eb4..dcbfecd74 100644 --- a/src/Orchard.Web/Modules/Orchard.Roles/Orchard.Roles.csproj +++ b/src/Orchard.Web/Modules/Orchard.Roles/Orchard.Roles.csproj @@ -25,6 +25,7 @@ + true @@ -101,6 +102,7 @@ + diff --git a/src/Orchard.Web/Modules/Orchard.Roles/RuleEngine/RoleRuleProvider.cs b/src/Orchard.Web/Modules/Orchard.Roles/RuleEngine/RoleRuleProvider.cs new file mode 100644 index 000000000..ce3b6a398 --- /dev/null +++ b/src/Orchard.Web/Modules/Orchard.Roles/RuleEngine/RoleRuleProvider.cs @@ -0,0 +1,36 @@ +using Orchard.ContentManagement; +using Orchard.Events; +using Orchard.Roles.Models; +using Orchard.Security; +using System; +using System.Linq; + +namespace Orchard.Roles.RuleEngine { + public interface IRuleProvider : IEventHandler { + void Process(dynamic ruleContext); + } + + public class RoleRuleProvider : IRuleProvider { + private readonly IAuthenticationService _authenticationService; + + public RoleRuleProvider(IAuthenticationService authenticationService) { + _authenticationService = authenticationService; + } + + public void Process(dynamic ruleContext) { + if (!String.Equals(ruleContext.FunctionName, "role", StringComparison.OrdinalIgnoreCase)) { + return; + } + + var user = _authenticationService.GetAuthenticatedUser(); + if (user == null) { + ruleContext.Result = false; + return; + } + + var roles = ((object[])ruleContext.Arguments).Cast(); + var userRoles = user.As(); + ruleContext.Result = userRoles != null ? userRoles.Roles.Intersect(roles).Count() > 0 : false; + } + } +} \ No newline at end of file From 28e2e8f695bf1bca6d4411addf56f58352d0ac52 Mon Sep 17 00:00:00 2001 From: Chris Payne Date: Tue, 22 Dec 2015 16:44:24 +0000 Subject: [PATCH 06/14] Use Display Name to show validation messages --- .../Drivers/MediaLibraryPickerFieldDriver.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.MediaLibrary/Drivers/MediaLibraryPickerFieldDriver.cs b/src/Orchard.Web/Modules/Orchard.MediaLibrary/Drivers/MediaLibraryPickerFieldDriver.cs index ad82199fa..f46206029 100644 --- a/src/Orchard.Web/Modules/Orchard.MediaLibrary/Drivers/MediaLibraryPickerFieldDriver.cs +++ b/src/Orchard.Web/Modules/Orchard.MediaLibrary/Drivers/MediaLibraryPickerFieldDriver.cs @@ -65,7 +65,7 @@ namespace Orchard.MediaLibrary.Drivers { } if (settings.Required && field.Ids.Length == 0) { - updater.AddModelError("Id", T("The field {0} is mandatory", field.Name.CamelFriendly())); + updater.AddModelError("Id", T("The field {0} is mandatory", field.DisplayName)); } return Editor(part, field, shapeHelper); @@ -99,4 +99,4 @@ namespace Orchard.MediaLibrary.Drivers { .Member(null, typeof(string), T("Ids"), T("A formatted list of the ids, e.g., {1},{42}")); } } -} \ No newline at end of file +} From 37b97eaa2655abfca97ff8f0efe931ee81eb055b Mon Sep 17 00:00:00 2001 From: Lombiq Date: Tue, 22 Dec 2015 21:57:25 +0100 Subject: [PATCH 07/14] Move Mono DLL from the Orchard.Scripting.CSharp module to the root lib folder --- .gitignore | 1 - .../Lib => lib/mono}/Mono.CSharp.dll | Bin .../Orchard.Scripting.CSharp.csproj | 5 +++-- src/Rebracer.xml | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) rename {src/Orchard.Web/Modules/Orchard.Scripting.CSharp/Lib => lib/mono}/Mono.CSharp.dll (100%) diff --git a/.gitignore b/.gitignore index bb7b6a923..ba367b249 100644 --- a/.gitignore +++ b/.gitignore @@ -187,5 +187,4 @@ src/Orchard.Azure/Orchard.Azure.CloudService/Staging/ #enable all /lib artifacts !lib/**/*.* -!src/Orchard.Web/Modules/Orchard.Scripting.CSharp/Lib/*.* */.vs/* diff --git a/src/Orchard.Web/Modules/Orchard.Scripting.CSharp/Lib/Mono.CSharp.dll b/lib/mono/Mono.CSharp.dll similarity index 100% rename from src/Orchard.Web/Modules/Orchard.Scripting.CSharp/Lib/Mono.CSharp.dll rename to lib/mono/Mono.CSharp.dll diff --git a/src/Orchard.Web/Modules/Orchard.Scripting.CSharp/Orchard.Scripting.CSharp.csproj b/src/Orchard.Web/Modules/Orchard.Scripting.CSharp/Orchard.Scripting.CSharp.csproj index 1de86925b..8f276050e 100644 --- a/src/Orchard.Web/Modules/Orchard.Scripting.CSharp/Orchard.Scripting.CSharp.csproj +++ b/src/Orchard.Web/Modules/Orchard.Scripting.CSharp/Orchard.Scripting.CSharp.csproj @@ -49,8 +49,9 @@ - - Lib\Mono.CSharp.dll + + False + ..\..\..\..\lib\mono\Mono.CSharp.dll diff --git a/src/Rebracer.xml b/src/Rebracer.xml index 74e830830..f297d32dd 100644 --- a/src/Rebracer.xml +++ b/src/Rebracer.xml @@ -10,8 +10,8 @@ - HACK:2 - TODO:2 + TODO:2 + HACK:2 UNDONE:2 UnresolvedMergeConflict:3 From 66963d1845dfd2d09ad2ec61943e520e455e2f1c Mon Sep 17 00:00:00 2001 From: Thierry Fleury Date: Mon, 28 Dec 2015 10:27:36 +0100 Subject: [PATCH 08/14] Remove duplicate Logger assignation --- src/Orchard.Web/Modules/Lucene/Services/LuceneIndexProvider.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Orchard.Web/Modules/Lucene/Services/LuceneIndexProvider.cs b/src/Orchard.Web/Modules/Lucene/Services/LuceneIndexProvider.cs index ae535e0ec..32f858829 100644 --- a/src/Orchard.Web/Modules/Lucene/Services/LuceneIndexProvider.cs +++ b/src/Orchard.Web/Modules/Lucene/Services/LuceneIndexProvider.cs @@ -41,8 +41,6 @@ namespace Lucene.Services { // TODO: (sebros) Find a common way to get where tenant's specific files should go. "Sites/Tenant" is hard coded in multiple places _basePath = _appDataFolder.Combine("Sites", shellSettings.Name, "Indexes"); - Logger = NullLogger.Instance; - // Ensures the directory exists EnsureDirectoryExists(); From 1a7eae5dc14a74415df5911f989221ead129f0b3 Mon Sep 17 00:00:00 2001 From: Thierry Fleury Date: Thu, 31 Dec 2015 14:10:25 +0100 Subject: [PATCH 09/14] Fix media-library-picker.js --- .../Scripts/media-library-picker.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.MediaLibrary/Scripts/media-library-picker.js b/src/Orchard.Web/Modules/Orchard.MediaLibrary/Scripts/media-library-picker.js index f8004e84b..de4d6ef0c 100644 --- a/src/Orchard.Web/Modules/Orchard.MediaLibrary/Scripts/media-library-picker.js +++ b/src/Orchard.Web/Modules/Orchard.MediaLibrary/Scripts/media-library-picker.js @@ -21,12 +21,15 @@ var refreshIds = function() { var id = element.find('.selected-ids'); - id.val(''); - element.find(".media-library-picker-item").each(function() { - id.val(id.val() + "," + $(this).attr("data-id")); + var ids = []; + + element.find(".media-library-picker-item").each(function () { + ids.push($(this).attr("data-id")); }); - var itemsCount = element.find(".media-library-picker-item").length; + id.val(ids.join()); + + var itemsCount = ids.length; if(!multiple && itemsCount > 0) { addButton.hide(); From 79b0b809ca57b7299daee37226b009f2f4c3bd8a Mon Sep 17 00:00:00 2001 From: Lombiq Date: Wed, 6 Jan 2016 14:49:57 +0100 Subject: [PATCH 10/14] Fixing that when editing blog posts permissions were mistakenly checked for the blog instead of the post --- .../Orchard.Blogs/Controllers/BlogPostAdminController.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogPostAdminController.cs b/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogPostAdminController.cs index 18dfee578..bc389815a 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogPostAdminController.cs +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Controllers/BlogPostAdminController.cs @@ -44,7 +44,7 @@ namespace Orchard.Blogs.Controllers { var blogPost = Services.ContentManager.New("BlogPost"); blogPost.BlogPart = blog; - if (!Services.Authorizer.Authorize(Permissions.EditBlogPost, blog, T("Not allowed to create blog post"))) + if (!Services.Authorizer.Authorize(Permissions.EditBlogPost, blogPost, T("Not allowed to create blog post"))) return new HttpUnauthorizedResult(); var model = Services.ContentManager.BuildEditor(blogPost); @@ -76,7 +76,7 @@ namespace Orchard.Blogs.Controllers { var blogPost = Services.ContentManager.New("BlogPost"); blogPost.BlogPart = blog; - if (!Services.Authorizer.Authorize(Permissions.EditBlogPost, blog, T("Couldn't create blog post"))) + if (!Services.Authorizer.Authorize(Permissions.EditBlogPost, blogPost, T("Couldn't create blog post"))) return new HttpUnauthorizedResult(); Services.ContentManager.Create(blogPost, VersionOptions.Draft); @@ -88,7 +88,7 @@ namespace Orchard.Blogs.Controllers { } if (publish) { - if (!Services.Authorizer.Authorize(Permissions.PublishBlogPost, blog.ContentItem, T("Couldn't publish blog post"))) + if (!Services.Authorizer.Authorize(Permissions.PublishBlogPost, blogPost.ContentItem, T("Couldn't publish blog post"))) return new HttpUnauthorizedResult(); Services.ContentManager.Publish(blogPost.ContentItem); From ee54d4237fcac355536fc3f513564cee10ab3bd1 Mon Sep 17 00:00:00 2001 From: armanforghani Date: Mon, 11 Jan 2016 16:03:35 +0330 Subject: [PATCH 11/14] Update LayoutEditor.cshtml. Wrapped strings in T delegate. Fixes #6269 --- .../Views/EditorTemplates/LayoutEditor.cshtml | 104 +++++++++--------- 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.Layouts/Views/EditorTemplates/LayoutEditor.cshtml b/src/Orchard.Web/Modules/Orchard.Layouts/Views/EditorTemplates/LayoutEditor.cshtml index 48bb3c63d..64e552e4f 100644 --- a/src/Orchard.Web/Modules/Orchard.Layouts/Views/EditorTemplates/LayoutEditor.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Layouts/Views/EditorTemplates/LayoutEditor.cshtml @@ -88,7 +88,7 @@
  1. - Clipboard, keyboard shortcuts, etc. + @T("Clipboard, keyboard shortcuts, etc.")
  2. @if (Model.Templates.Any()) { var options = Model.Templates.Select(x => new SelectListItem { Text = Html.ItemDisplayText(x).ToString(), Value = x.Id.ToString(CultureInfo.InvariantCulture), Selected = x.Id == Model.TemplateId }); @@ -107,125 +107,125 @@ @Display.DialogTemplate(Name: "Layout") -
    +
    -

    Clipboard

    +

    @T("Clipboard")

    -

    Elements (including containers) can be cut, copied and pasted using the standard clipboard shortcuts (Ctrl+X / Ctrl+C / Ctrl-V on Windows, ⌘+X / ⌘+C / ⌘+V on Mac OS).

    -

    On browsers that support native clipboard events, clipboard operations can be performed across different layout editor instances, in different tabs or browser windows. Text content can also be pasted into other applications.

    -

    On other browsers, clipboard operations work only within the same layout editor instance.

    +

    @T("Elements (including containers) can be cut, copied and pasted using the standard clipboard shortcuts (Ctrl+X / Ctrl+C / Ctrl-V on Windows, ⌘+X / ⌘+C / ⌘+V on Mac OS).")

    +

    @T("On browsers that support native clipboard events, clipboard operations can be performed across different layout editor instances, in different tabs or browser windows. Text content can also be pasted into other applications.")

    +

    @T("On other browsers, clipboard operations work only within the same layout editor instance.")

    -

    Keyboard shortcuts

    +

    @T("Keyboard shortcuts")

    -

    Resizing columns

    +

    @T("Resizing columns")

    - - + + - - + + - - + + - - + +
    Alt+LeftMoves the left edge of the focused column left@T("Alt+Left")@T("Moves the left edge of the focused column left")
    Alt+RightMoves the left edge of the focused column right@T("Alt+Right")@T("Moves the left edge of the focused column right")
    Shift+LeftMoves the right edge of the focused column left@T("Shift+Left")@T("Moves the right edge of the focused column left")
    Shift+RightMoves the right edge of the focused column right@T("Shift+Right")@T("Moves the right edge of the focused column right")
    -

    The Alt and Shift keys can also be combined to move both edges simultaneously.

    +

    @T("The Alt and Shift keys can also be combined to move both edges simultaneously.")

    -

    Focus

    +

    @T("Focus")

    - - + + - - + + - - + + - - + + - - + + - - + +
    UpMoves focus to the previous element (above)@T("Up")@T("Moves focus to the previous element (above)")
    DownMoves focus to the next element (below)@T("Down")@T("Moves focus to the next element (below)")
    LeftMoves focus to the previous column (to the left)@T("Left")@T("Moves focus to the previous column (to the left)")
    RightMoves focus to the next column (to the right)@T("Right")@T("Moves focus to the next column (to the right)")
    Alt+UpMoves focus to the parent element@T("Alt+Up")@T("Moves focus to the parent element")
    Alt+DownMoves focus to the first child element@T("Alt+Down")@T("Moves focus to the first child element")
    -

    Editing

    +

    @T("Editing")

    - - + + - - + + - - + + - - + +
    EnterOpens the content editor of the focused element@T("Enter")@T("Opens the content editor of the focused element")
    SpaceOpens the properties popup of the focused element@T("Space")@T("Opens the properties popup of the focused element")
    EscCloses the properties popup of the focused element@T("Esc")@T("Closes the properties popup of the focused element")
    DelDeletes the focused element@T("Del")@T("Deletes the focused element")
    -

    Moving

    +

    @T("Moving")

    - - + + - - + + - - + + - - + +
    Ctrl+UpMoves (reorders) the focused element up@T("Ctrl+Up")@T("Moves (reorders) the focused element up")
    Ctrl+DownMoves (reorders) the focused element down@T("Ctrl+Down")@T("Moves (reorders) the focused element down")
    Ctrl+LeftMoves (reorders) the focused column left@T("Ctrl+Left")@T("Moves (reorders) the focused column left")
    Ctrl+RightMoves (reorders) the focused column right@T("Ctrl+Right")@T("Moves (reorders) the focused column right")
    -

    Drag and drop

    +

    @T("Drag and drop")

    -

    Drag any existing element to reorder within its parent.

    -

    Drag a new element from the toolbox and drop it within a compatible container.

    -

    Drag the left and right edges of a focused column to resize the column. By default any adjacent column will be attached and resized accordingly; holding down the Alt key while resizing unattaches from the adjacent column and instead modifies the offset between.

    +

    @T("Drag any existing element to reorder within its parent.")

    +

    @T("Drag a new element from the toolbox and drop it within a compatible container.")

    +

    @T("Drag the left and right edges of a focused column to resize the column. By default any adjacent column will be attached and resized accordingly; holding down the Alt key while resizing unattaches from the adjacent column and instead modifies the offset between.")

    From 112f13bf392563eee49837340d89f25dd650abb5 Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Wed, 13 Jan 2016 13:03:46 -0800 Subject: [PATCH 12/14] [Fixes #5969] Listing unlistable types in Contents/List --- src/Orchard.Web/Core/Contents/Controllers/AdminController.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Orchard.Web/Core/Contents/Controllers/AdminController.cs b/src/Orchard.Web/Core/Contents/Controllers/AdminController.cs index 495f3eaeb..4437ab0e1 100644 --- a/src/Orchard.Web/Core/Contents/Controllers/AdminController.cs +++ b/src/Orchard.Web/Core/Contents/Controllers/AdminController.cs @@ -90,7 +90,10 @@ namespace Orchard.Core.Contents.Controllers { model.TypeDisplayName = !string.IsNullOrWhiteSpace(contentTypeDefinition.DisplayName) ? contentTypeDefinition.DisplayName : contentTypeDefinition.Name; - query = query.ForType(model.TypeName); + + // We display a specific type even if it's not listable so that admin pages + // can reuse the Content list page for specific types. + query = _contentManager.Query(versionOptions, model.TypeName); } switch (model.Options.OrderBy) { From a55ba9f06bfef1218ac386308b2a57660dc6cebf Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Wed, 13 Jan 2016 13:06:39 -0800 Subject: [PATCH 13/14] [Fixes #5951] Fixing NRE when exporting media items --- .../Orchard.ContentPicker/Drivers/ContentPickerFieldDriver.cs | 1 + .../Drivers/MediaLibraryPickerFieldDriver.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/src/Orchard.Web/Modules/Orchard.ContentPicker/Drivers/ContentPickerFieldDriver.cs b/src/Orchard.Web/Modules/Orchard.ContentPicker/Drivers/ContentPickerFieldDriver.cs index b548deb0b..ab2c1d60d 100644 --- a/src/Orchard.Web/Modules/Orchard.ContentPicker/Drivers/ContentPickerFieldDriver.cs +++ b/src/Orchard.Web/Modules/Orchard.ContentPicker/Drivers/ContentPickerFieldDriver.cs @@ -90,6 +90,7 @@ namespace Orchard.ContentPicker.Drivers { if (field.Ids.Any()) { var contentItemIds = field.Ids .Select(x => _contentManager.Get(x)) + .Where(x => x != null) .Select(x => _contentManager.GetItemMetadata(x).Identity.ToString()) .ToArray(); diff --git a/src/Orchard.Web/Modules/Orchard.MediaLibrary/Drivers/MediaLibraryPickerFieldDriver.cs b/src/Orchard.Web/Modules/Orchard.MediaLibrary/Drivers/MediaLibraryPickerFieldDriver.cs index f46206029..1d7baa065 100644 --- a/src/Orchard.Web/Modules/Orchard.MediaLibrary/Drivers/MediaLibraryPickerFieldDriver.cs +++ b/src/Orchard.Web/Modules/Orchard.MediaLibrary/Drivers/MediaLibraryPickerFieldDriver.cs @@ -87,6 +87,7 @@ namespace Orchard.MediaLibrary.Drivers { if (field.Ids.Any()) { var contentItemIds = field.Ids .Select(x => _contentManager.Get(x)) + .Where(x => x != null) .Select(x => _contentManager.GetItemMetadata(x).Identity.ToString()) .ToArray(); From e907334b6cfab120acf79e6bd2487145450cfe04 Mon Sep 17 00:00:00 2001 From: Sebastien Ros Date: Wed, 13 Jan 2016 15:30:52 -0800 Subject: [PATCH 14/14] Fixing object dumper unit tests --- .../Services/ObjectDumper.cs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.DesignerTools/Services/ObjectDumper.cs b/src/Orchard.Web/Modules/Orchard.DesignerTools/Services/ObjectDumper.cs index da2699e6a..0debbe6db 100644 --- a/src/Orchard.Web/Modules/Orchard.DesignerTools/Services/ObjectDumper.cs +++ b/src/Orchard.Web/Modules/Orchard.DesignerTools/Services/ObjectDumper.cs @@ -141,13 +141,15 @@ namespace Orchard.DesignerTools.Services { } foreach (var member in members) { - if ((o is ContentItem && (member.Name == "ContentManager" - || member.Name == "Parts" - || member.Name == "Record" - || member.Name == "VersionRecord" - || member.Name == "TypeDefinition" - || member.Name == "TypePartDefinition" - || member.Name == "PartDefinition")) + if ((o is ContentItem && ( + member.Name == "Content" || + member.Name == "ContentManager" || + member.Name == "Parts" || + member.Name == "Record" || + member.Name == "VersionRecord" || + member.Name == "TypeDefinition" || + member.Name == "TypePartDefinition" || + member.Name == "PartDefinition")) || o is Delegate || o is Type ) {