diff --git a/src/Orchard.Web/Core/Contents/ControlWrapper.cs b/src/Orchard.Web/Core/Contents/ControlWrapper.cs
new file mode 100644
index 000000000..b3021e08a
--- /dev/null
+++ b/src/Orchard.Web/Core/Contents/ControlWrapper.cs
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using Orchard.DisplayManagement.Descriptors;
+using Orchard.Environment.Extensions;
+
+namespace Orchard.Core.Contents {
+ [OrchardFeature("Contents.ControlWrapper")]
+ public class ControlWrapper : IShapeTableProvider {
+ public void Discover(ShapeTableBuilder builder) {
+ builder.Describe("Content").OnDisplaying(displaying => {
+ if (!displaying.ShapeMetadata.DisplayType.Contains("Admin")) {
+ displaying.ShapeMetadata.Wrappers.Add("Content_ControlWrapper");
+ }
+ });
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Orchard.Web/Core/Contents/Module.txt b/src/Orchard.Web/Core/Contents/Module.txt
index 7db853480..a9ee2346f 100644
--- a/src/Orchard.Web/Core/Contents/Module.txt
+++ b/src/Orchard.Web/Core/Contents/Module.txt
@@ -15,3 +15,8 @@ Features:
Description: Rules for the Contents modules
Category: Rules
Dependencies: Orchard.Rules, Contents
+ Contents.ControlWrapper:
+ Name: Content Control Wrapper
+ Description: Add an Edit button on the front-end for authenticated users
+ Category: Content
+ Dependencies: Contents
diff --git a/src/Orchard.Web/Core/Contents/Shapes.cs b/src/Orchard.Web/Core/Contents/Shapes.cs
index 688a6e8aa..abfbcfa9d 100644
--- a/src/Orchard.Web/Core/Contents/Shapes.cs
+++ b/src/Orchard.Web/Core/Contents/Shapes.cs
@@ -29,9 +29,6 @@ namespace Orchard.Core.Contents {
// Content_[DisplayType]__[Id] e.g. Content-42.Summary
displaying.ShapeMetadata.Alternates.Add("Content_" + displaying.ShapeMetadata.DisplayType + "__" + contentItem.Id);
-
- if ( !displaying.ShapeMetadata.DisplayType.Contains("Admin") )
- displaying.ShapeMetadata.Wrappers.Add("Content_ControlWrapper");
}
});
}
diff --git a/src/Orchard.Web/Core/Orchard.Core.csproj b/src/Orchard.Web/Core/Orchard.Core.csproj
index 88a201c7c..166876ffc 100644
--- a/src/Orchard.Web/Core/Orchard.Core.csproj
+++ b/src/Orchard.Web/Core/Orchard.Core.csproj
@@ -105,6 +105,7 @@
+
diff --git a/src/Orchard.Web/Modules/Orchard.Widgets/ControlWrapper.cs b/src/Orchard.Web/Modules/Orchard.Widgets/ControlWrapper.cs
new file mode 100644
index 000000000..acc0b8bca
--- /dev/null
+++ b/src/Orchard.Web/Modules/Orchard.Widgets/ControlWrapper.cs
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using Orchard.DisplayManagement.Descriptors;
+using Orchard.Environment.Extensions;
+
+namespace Orchard.Widgets {
+ [OrchardFeature("Orchard.Widgets.ControlWrapper")]
+ public class ControlWrapper : IShapeTableProvider {
+ public void Discover(ShapeTableBuilder builder) {
+ builder.Describe("Widget")
+ .Configure(descriptor => {
+ descriptor.Wrappers.Add("Widget_ControlWrapper");
+ });
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Orchard.Widgets/Module.txt b/src/Orchard.Web/Modules/Orchard.Widgets/Module.txt
index 0400b2918..50ac92121 100644
--- a/src/Orchard.Web/Modules/Orchard.Widgets/Module.txt
+++ b/src/Orchard.Web/Modules/Orchard.Widgets/Module.txt
@@ -14,3 +14,8 @@ Features:
Description: Adds a notification after creating a new Page with a direct link to create a Widget Layer for that specific page by URL.
Dependencies: Orchard.Widgets, Routable
Category: Widget
+ Orchard.Widgets.ControlWrapper:
+ Name: Widget Control Wrapper
+ Description: Add an Edit button on the front-end for authenticated users
+ Category: Widget
+ Dependencies: Orchard.Widgets
diff --git a/src/Orchard.Web/Modules/Orchard.Widgets/Orchard.Widgets.csproj b/src/Orchard.Web/Modules/Orchard.Widgets/Orchard.Widgets.csproj
index c66a256f5..83f116810 100644
--- a/src/Orchard.Web/Modules/Orchard.Widgets/Orchard.Widgets.csproj
+++ b/src/Orchard.Web/Modules/Orchard.Widgets/Orchard.Widgets.csproj
@@ -51,6 +51,7 @@
+
diff --git a/src/Orchard.Web/Modules/Orchard.Widgets/Shapes.cs b/src/Orchard.Web/Modules/Orchard.Widgets/Shapes.cs
index 4f85d1df1..f5fb75593 100644
--- a/src/Orchard.Web/Modules/Orchard.Widgets/Shapes.cs
+++ b/src/Orchard.Web/Modules/Orchard.Widgets/Shapes.cs
@@ -11,7 +11,6 @@ namespace Orchard.Widgets {
.Configure(descriptor => {
// todo: have "alternates" for chrome
descriptor.Wrappers.Add("Widget_Wrapper");
- descriptor.Wrappers.Add("Widget_ControlWrapper");
})
.OnCreated(created => {
var widget = created.Shape;
@@ -24,10 +23,11 @@ namespace Orchard.Widgets {
ContentItem contentItem = displaying.Shape.ContentItem;
if (contentItem != null) {
var widgetPart = contentItem.As();
- widget.Classes.Add("widget-" + contentItem.ContentType.HtmlClassify());
-
var zoneName = widgetPart.Zone;
+ widget.Classes.Add("widget-" + contentItem.ContentType.HtmlClassify());
+ widget.Classes.Add("widget-" + zoneName.HtmlClassify());
+
// Widget__[ZoneName] e.g. Widget-SideBar
displaying.ShapeMetadata.Alternates.Add("Widget__" + zoneName);
diff --git a/src/Orchard/Environment/DefaultOrchardHost.cs b/src/Orchard/Environment/DefaultOrchardHost.cs
index c85b9bf74..4d34576f8 100644
--- a/src/Orchard/Environment/DefaultOrchardHost.cs
+++ b/src/Orchard/Environment/DefaultOrchardHost.cs
@@ -273,7 +273,12 @@ namespace Orchard.Environment {
///
void IShellDescriptorManagerEventHandler.Changed(ShellDescriptor descriptor, string tenant) {
lock (_syncLock) {
- var context = _shellContexts.FirstOrDefault(x => x.Settings.Name == tenant);
+
+ if (_shellContexts == null) {
+ return;
+ }
+
+ var context =_shellContexts.FirstOrDefault(x => x.Settings.Name == tenant);
// some shells might need to be started, e.g. created by command line
if(context == null) {