diff --git a/lib/claysharp/ClaySharp.dll b/lib/claysharp/ClaySharp.dll deleted file mode 100644 index 51179ddad..000000000 Binary files a/lib/claysharp/ClaySharp.dll and /dev/null differ diff --git a/lib/claysharp/ClaySharp.pdb b/lib/claysharp/ClaySharp.pdb deleted file mode 100644 index 991b7fc80..000000000 Binary files a/lib/claysharp/ClaySharp.pdb and /dev/null differ diff --git a/src/Orchard.Core.Tests/Orchard.Core.Tests.csproj b/src/Orchard.Core.Tests/Orchard.Core.Tests.csproj index 3e0a67193..1abcf3f7e 100644 --- a/src/Orchard.Core.Tests/Orchard.Core.Tests.csproj +++ b/src/Orchard.Core.Tests/Orchard.Core.Tests.csproj @@ -59,9 +59,6 @@ False ..\..\lib\autofac\Autofac.dll - - ..\..\lib\claysharp\ClaySharp.dll - False ..\..\lib\nhibernate\FluentNHibernate.dll diff --git a/src/Orchard.Tests.Modules/Orchard.Tests.Modules.csproj b/src/Orchard.Tests.Modules/Orchard.Tests.Modules.csproj index 7048e937b..eb1f4fa23 100644 --- a/src/Orchard.Tests.Modules/Orchard.Tests.Modules.csproj +++ b/src/Orchard.Tests.Modules/Orchard.Tests.Modules.csproj @@ -62,9 +62,6 @@ ..\..\lib\Castle Windsor 2.0\bin\Castle.Core.dll - - ..\..\lib\claysharp\ClaySharp.dll - False ..\..\lib\nhibernate\FluentNHibernate.dll diff --git a/src/Orchard.Tests.Modules/Scripting.Dlr/ScriptingTests.cs b/src/Orchard.Tests.Modules/Scripting.Dlr/ScriptingTests.cs index 7f926a971..dbf09e961 100644 --- a/src/Orchard.Tests.Modules/Scripting.Dlr/ScriptingTests.cs +++ b/src/Orchard.Tests.Modules/Scripting.Dlr/ScriptingTests.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Diagnostics; using System.IO; using Autofac; -using ClaySharp; using NUnit.Framework; using Orchard.Scripting.Dlr.Services; using Path = Bleroy.FluentPath.Path; @@ -83,22 +82,6 @@ namespace Orchard.Tests.Modules.Scripting.Dlr { Assert.That(_scriptingManager.ExecuteExpression("f / 4"), Is.EqualTo(8)); } - - [Test] - public void CanDeclareCallbackOnGlobalMethod() { - _scriptingManager.SetVariable("x", new Clay(new ReturnMethodNameLengthBehavior())); - - Assert.That(_scriptingManager.ExecuteExpression("3 + x.foo()"), Is.EqualTo(6)); - } - - - public class ReturnMethodNameLengthBehavior : ClayBehavior { - public override object InvokeMemberMissing(Func proceed, object self, string name, INamedEnumerable args) { - Trace.WriteLine("Returning length of " + name); - return name.Length; - } - } - [Test] public void CanDeclareCallbackOnInstanceEvalWithFile() { var targetPath = _tempFolderName.Combine("CallbackOnInstanceEval.rb"); diff --git a/src/Orchard.Tests/DisplayManagement/ArgsUtility.cs b/src/Orchard.Tests/DisplayManagement/ArgsUtility.cs index 8c0eed77d..25d124717 100644 --- a/src/Orchard.Tests/DisplayManagement/ArgsUtility.cs +++ b/src/Orchard.Tests/DisplayManagement/ArgsUtility.cs @@ -1,8 +1,7 @@ using System.Collections.Generic; using System.Linq; using System.Web.Routing; -using ClaySharp; -using ClaySharp.Implementation; +using Orchard.DisplayManagement; namespace Orchard.Tests.DisplayManagement { public static class ArgsUtility { diff --git a/src/Orchard.Tests/DisplayManagement/CompositeTests.cs b/src/Orchard.Tests/DisplayManagement/CompositeTests.cs new file mode 100644 index 000000000..5fcba7567 --- /dev/null +++ b/src/Orchard.Tests/DisplayManagement/CompositeTests.cs @@ -0,0 +1,61 @@ +using NUnit.Framework; +using Orchard.DisplayManagement.Shapes; + +namespace Orchard.Tests.DisplayManagement { + [TestFixture] + public class CompositeTests { + + [Test] + public void CompositesShouldNotOverrideExistingMembers() { + var composite = new Animal {Color = "Pink"}; + + Assert.That(composite.Color, Is.EqualTo("Pink")); + } + + [Test] + public void CompositesShouldNotOverrideExistingMembersWhenUsedAsDynamic() { + dynamic composite = new Animal(); + + composite.Color = "Pink"; + Assert.That(composite.Color, Is.EqualTo("Pink")); + } + + [Test] + public void CompositesShouldAccessUnknownProperties() { + dynamic composite = new Animal(); + + composite.Fake = 42; + Assert.That(composite.Fake, Is.EqualTo(42)); + } + + [Test] + public void CompositesShouldAccessUnknownPropertiesByIndex() { + dynamic composite = new Animal(); + + composite["Fake"] = 42; + Assert.That(composite["Fake"], Is.EqualTo(42)); + } + + [Test] + public void CompositesShouldAccessKnownPropertiesByIndex() { + dynamic composite = new Animal(); + + composite["Pink"] = "Pink"; + Assert.That(composite["Pink"], Is.EqualTo("Pink")); + } + + [Test] + public void ChainProperties() { + dynamic foo = new Animal(); + foo.Bar("bar"); + + Assert.That(foo.Bar, Is.EqualTo("bar")); + Assert.That(foo.Bar == null, Is.False); + } + } + + public class Animal : Composite { + public string Kind { get; set; } + public string Color { get; set; } + } +} diff --git a/src/Orchard.Tests/DisplayManagement/ShapeFactoryTests.cs b/src/Orchard.Tests/DisplayManagement/ShapeFactoryTests.cs index 7ee8a5964..f85cbbbfb 100644 --- a/src/Orchard.Tests/DisplayManagement/ShapeFactoryTests.cs +++ b/src/Orchard.Tests/DisplayManagement/ShapeFactoryTests.cs @@ -37,7 +37,43 @@ namespace Orchard.Tests.DisplayManagement { [Test] public void CreateShapeWithNamedArguments() { var factory = _container.Resolve(); - var foo = factory.Create("Foo", ArgsUtility.Named(new { one = 1, two = "dos" })); + dynamic foo = factory.Create("Foo", ArgsUtility.Named(new { one = 1, two = "dos" })); + Assert.That(foo.one, Is.EqualTo(1)); + Assert.That(foo.two, Is.EqualTo("dos")); } + + [Test] + public void CallSyntax() { + dynamic factory = _container.Resolve(); + var foo = factory.Foo(); + ShapeMetadata metadata = foo.Metadata; + Assert.That(metadata.Type, Is.EqualTo("Foo")); + } + + [Test] + public void CallInitializer() { + dynamic factory = _container.Resolve(); + var bar = new {One = 1, Two = "two"}; + var foo = factory.Foo(bar); + + Assert.That(foo.One, Is.EqualTo(1)); + Assert.That(foo.Two, Is.EqualTo("two")); + } + + [Test] + public void CallInitializerWithBaseType() { + dynamic factory = _container.Resolve(); + var bar = new { One = 1, Two = "two" }; + var foo = factory.Foo(typeof(MyShape), bar); + + Assert.That(foo, Is.InstanceOf()); + Assert.That(foo.One, Is.EqualTo(1)); + Assert.That(foo.Two, Is.EqualTo("two")); + } + + public class MyShape : Shape { + public string Kind { get; set; } + } + } } diff --git a/src/Orchard.Tests/DisplayManagement/ZoneHoldingTests.cs b/src/Orchard.Tests/DisplayManagement/ZoneHoldingTests.cs new file mode 100644 index 000000000..ac3c4bff3 --- /dev/null +++ b/src/Orchard.Tests/DisplayManagement/ZoneHoldingTests.cs @@ -0,0 +1,88 @@ +using System; +using NUnit.Framework; +using Orchard.DisplayManagement.Shapes; +using Orchard.UI.Zones; + +namespace Orchard.Tests.DisplayManagement { + [TestFixture] + public class ZoneHoldingTests { + + [Test] + public void ZonesShouldReturn() { + Func factory = () => new Shape(); + + var foo = new ZoneHolding(factory); + Assert.That(foo.Zones, Is.InstanceOf()); + } + + [Test] + public void MemberShouldCreateAZone() { + Func factory = () => new Shape(); + + dynamic foo = new ZoneHolding(factory); + Assert.That(foo.Header, Is.InstanceOf()); + } + + [Test] + public void IndexShouldCreateAZone() { + Func factory = () => new Shape(); + + dynamic foo = new ZoneHolding(factory); + Assert.That(foo.Zones["Header"], Is.InstanceOf()); + } + + [Test] + public void ZonesMemberShouldCreateAZone() { + Func factory = () => new Shape(); + + dynamic foo = new ZoneHolding(factory); + Assert.That(foo.Zones.Header, Is.InstanceOf()); + } + + [Test] + public void ZonesShouldBeUnique() { + Func factory = () => new Shape(); + + dynamic foo = new ZoneHolding(factory); + var header = foo.Header; + + Assert.That(foo.Zones.Header, Is.EqualTo(header)); + Assert.That(foo.Zones["Header"], Is.EqualTo(header)); + Assert.That(foo.Header, Is.EqualTo(header)); + } + + + [Test] + public void EmptyZonesShouldBeNull() { + Func factory = () => new Shape(); + + dynamic foo = new ZoneHolding(factory); + + Assert.That(foo.Header == 1, Is.False); + Assert.That(foo.Header != 1, Is.True); + + dynamic header = foo.Header; + + Assert.That(header == null, Is.True); + Assert.That(header != null, Is.False); + + Assert.That(header == Nil.Instance, Is.True); + Assert.That(header != Nil.Instance, Is.False); + } + + [Test] + public void NoneEmptyZonesShouldBeNull() { + Func factory = () => new Shape(); + + dynamic foo = new ZoneHolding(factory); + foo.Header.Add("blah"); + + Assert.That(foo.Header == null, Is.False); + Assert.That(foo.Header != null, Is.True); + + Assert.That(foo.Header == Nil.Instance, Is.False); + Assert.That(foo.Header != Nil.Instance, Is.True); + } + + } +} diff --git a/src/Orchard.Tests/Orchard.Framework.Tests.csproj b/src/Orchard.Tests/Orchard.Framework.Tests.csproj index 0e2f29486..a2a640d29 100644 --- a/src/Orchard.Tests/Orchard.Framework.Tests.csproj +++ b/src/Orchard.Tests/Orchard.Framework.Tests.csproj @@ -71,10 +71,6 @@ False ..\..\lib\Castle Windsor 2.0\bin\Castle.DynamicProxy2.dll - - False - ..\..\lib\claysharp\ClaySharp.dll - False ..\..\lib\nhibernate\FluentNHibernate.dll @@ -220,6 +216,8 @@ + + diff --git a/src/Orchard.Tests/UI/ShapeTests.cs b/src/Orchard.Tests/UI/ShapeTests.cs index 202f2b59d..3e5ef2e7d 100644 --- a/src/Orchard.Tests/UI/ShapeTests.cs +++ b/src/Orchard.Tests/UI/ShapeTests.cs @@ -2,107 +2,98 @@ using System.Collections.Generic; using System.Linq; using Autofac; -using ClaySharp; using NUnit.Framework; +using Orchard.Core.Shapes; using Orchard.DisplayManagement; using Orchard.DisplayManagement.Descriptors; using Orchard.DisplayManagement.Implementation; -using Orchard.DisplayManagement.Shapes; -using Orchard.Environment; -using Orchard.Mvc; +using Orchard.Tests.DisplayManagement; using Orchard.UI.Zones; namespace Orchard.Tests.UI { [TestFixture] public class ShapeTests : ContainerTestBase { - private WorkContext _workContext; + dynamic _layout; protected override void Register(ContainerBuilder builder) { - builder.RegisterType().As(); - builder.RegisterType().As(); + var defaultShapeTable = new ShapeTable { + Descriptors = new Dictionary(StringComparer.OrdinalIgnoreCase), + Bindings = new Dictionary(StringComparer.OrdinalIgnoreCase) + }; + builder.Register(ctx => defaultShapeTable); + + builder.RegisterType().As(); builder.RegisterType().As(); builder.RegisterType().As(); builder.RegisterType().As(); - //builder.RegisterType().As(); - builder.RegisterType().As(); - - throw new NotImplementedException("this test fixture needs to move to modules tests now"); + builder.RegisterType().As(); + builder.RegisterType().As(); + builder.RegisterType().As(); + builder.RegisterType().As(); } protected override void Resolve(ILifetimeScope container) { - _workContext = container.Resolve().CreateWorkContextScope().WorkContext; + var shapeFactory = _container.Resolve(); + _layout = new ZoneHolding(() => shapeFactory.Create("Zone")); } - [Test, Ignore("implementation pending")] - public void WorkContextPageIsLayoutShape() { - var layout = _workContext.Layout; - ShapeMetadata pageMetadata = layout.Metadata; - Assert.That(pageMetadata.Type, Is.EqualTo("Layout")); - Assert.That(layout.Metadata.Type, Is.EqualTo("Layout")); - } - - [Test, Ignore("implementation pending")] + [Test] public void PagePropertiesAreNil() { - var layout = _workContext.Layout; - var pageFoo = layout.Foo; + + var pageFoo = _layout.Foo; Assert.That(pageFoo == null); } - [Test, Ignore("implementation pending")] + [Test] public void PageZonesPropertyIsNotNil() { - var layout = _workContext.Layout; - var pageZones = layout.Zones; + var pageZones = _layout.Zones; Assert.That(pageZones != null); Assert.That(pageZones.Foo == null); } - [Test, Ignore("implementation pending")] + [Test] public void AddingToZonePropertyMakesItExist() { - var layout = _workContext.Layout; - Assert.That(layout.Zones.Foo == null); + Assert.That(_layout.Zones.Foo == null); - var pageZonesFoo = layout.Zones.Foo; + var pageZonesFoo = _layout.Zones.Foo; pageZonesFoo.Add("hello"); - Assert.That(layout.Zones.Foo != null); - Assert.That(layout.Foo != null); - Assert.That(layout.Foo.Metadata.Type, Is.EqualTo("Zone")); + Assert.That(_layout.Zones.Foo != null); + Assert.That(_layout.Foo != null); + Assert.That(_layout.Foo.Metadata.Type, Is.EqualTo("Zone")); } - [Test, Ignore("implementation pending")] + [Test] public void AddingToZoneIndexedMakesItExist() { - var layout = _workContext.Layout; - Assert.That(layout.Zones["Foo"] == null); + Assert.That(_layout.Zones["Foo"] == null); - var pageZonesFoo = layout.Zones["Foo"]; + var pageZonesFoo = _layout.Zones["Foo"]; pageZonesFoo.Add("hello"); - Assert.That(layout.Zones["Foo"] != null); - Assert.That(layout["Foo"] != null); - Assert.That(layout["Foo"].Metadata.Type, Is.EqualTo("Zone")); + Assert.That(_layout.Zones["Foo"] != null); + Assert.That(_layout["Foo"] != null); + Assert.That(_layout["Foo"].Metadata.Type, Is.EqualTo("Zone")); } - [Test, Ignore("implementation pending")] + [Test] public void CallingAddOnNilPropertyMakesItBecomeZone() { - var layout = _workContext.Layout; - Assert.That(layout.Foo == null); + Assert.That(_layout.Foo == null); - layout.Foo.Add("hello"); + _layout.Foo.Add("hello"); - Assert.That(layout.Foo != null); - Assert.That(layout.Foo.Metadata.Type, Is.EqualTo("Zone")); + Assert.That(_layout.Foo != null); + Assert.That(_layout.Foo.Metadata.Type, Is.EqualTo("Zone")); } - [Test, Ignore("implementation pending")] + [Test] public void ZoneContentsAreEnumerable() { - var layout = _workContext.Layout; - Assert.That(layout.Foo == null); + Assert.That(_layout.Foo == null); - layout.Foo.Add("hello"); - layout.Foo.Add("world"); + _layout.Foo.Add("hello"); + _layout.Foo.Add("world"); var list = new List(); - foreach (var item in layout.Foo) { + foreach (var item in _layout.Foo) { list.Add(item); } @@ -111,27 +102,38 @@ namespace Orchard.Tests.UI { Assert.That(list.Last(), Is.EqualTo("world")); } + [Test] + public void ZoneContentsCastBeConvertedToEnunerableOfObject() { + Assert.That(_layout.Foo == null); - class NumberIsAlwaysFortyTwo : ShapeFactoryEvents { - public override void Creating(ShapeCreatingContext context) { - context.Behaviors.Add(new Behavior()); - } + _layout.Foo.Add("hello"); + _layout.Foo.Add("world"); - class Behavior : ClayBehavior { - public override object GetMember(Func proceed, object self, string name) { - return name == "Number" ? 42 : proceed(); - } - } + IEnumerable list = _layout.Foo; + + Assert.That(list.Count(), Is.EqualTo(2)); + Assert.That(list.First(), Is.EqualTo("hello")); + Assert.That(list.Last(), Is.EqualTo("world")); + + var first = ((IEnumerable)_layout.Foo).FirstOrDefault(); + Assert.That(first, Is.EqualTo("hello")); } - [Test, Ignore("implementation pending")] - public void NumberIsFortyTwo() { - var layout = _workContext.Layout; - Assert.That(layout.Number, Is.EqualTo(42)); - Assert.That(layout.Foo.Number == null); - layout.Foo.Add("yarg"); - Assert.That(layout.Foo.Number, Is.EqualTo(42)); + [Test] + public void ZoneContentsCastBeConvertedToEnunerableOfDynamics() { + Assert.That(_layout.Foo == null); + + _layout.Foo.Add("hello"); + _layout.Foo.Add("world"); + + IEnumerable list = _layout.Foo; + + Assert.That(list.Count(), Is.EqualTo(2)); + Assert.That(list.First(), Is.EqualTo("hello")); + Assert.That(list.Last(), Is.EqualTo("world")); + + var first = ((IEnumerable) _layout.Foo).FirstOrDefault(); + Assert.That(first, Is.EqualTo("hello")); } } - } diff --git a/src/Orchard.Web/Core/Orchard.Core.csproj b/src/Orchard.Web/Core/Orchard.Core.csproj index a3579ca58..a4b76040a 100644 --- a/src/Orchard.Web/Core/Orchard.Core.csproj +++ b/src/Orchard.Web/Core/Orchard.Core.csproj @@ -46,11 +46,6 @@ AllRules.ruleset - - False - ..\..\..\lib\claysharp\ClaySharp.dll - True - diff --git a/src/Orchard.Web/Core/Shapes/CoreShapes.cs b/src/Orchard.Web/Core/Shapes/CoreShapes.cs index 6c810015a..20627dc96 100644 --- a/src/Orchard.Web/Core/Shapes/CoreShapes.cs +++ b/src/Orchard.Web/Core/Shapes/CoreShapes.cs @@ -48,7 +48,7 @@ namespace Orchard.Core.Shapes { // and has an automatic zone creating behavior builder.Describe("Layout") .Configure(descriptor => descriptor.Wrappers.Add("Document")) - .OnCreating(creating => creating.Behaviors.Add(new ZoneHoldingBehavior(() => creating.New.Zone(), null))) + .OnCreating(creating => creating.Create = () => new ZoneHolding(() => creating.New.Zone())) .OnCreated(created => { var layout = created.Shape; @@ -68,7 +68,7 @@ namespace Orchard.Core.Shapes { // They have class="zone zone-{name}" // and the template can be specialized with "Zone-{Name}" base file name builder.Describe("Zone") - .OnCreating(creating => creating.BaseType = typeof(Zone)) + .OnCreating(creating => creating.Create = () => new Zone()) .OnDisplaying(displaying => { var zone = displaying.Shape; string zoneName = zone.ZoneName; diff --git a/src/Orchard.Web/Modules/Orchard.ContentTypes/Orchard.ContentTypes.csproj b/src/Orchard.Web/Modules/Orchard.ContentTypes/Orchard.ContentTypes.csproj index 997162bb1..aa7266286 100644 --- a/src/Orchard.Web/Modules/Orchard.ContentTypes/Orchard.ContentTypes.csproj +++ b/src/Orchard.Web/Modules/Orchard.ContentTypes/Orchard.ContentTypes.csproj @@ -21,6 +21,10 @@ 4.0 + + + + true @@ -41,7 +45,6 @@ 4 - diff --git a/src/Orchard.Web/Modules/Orchard.ContentTypes/Services/PlacementService.cs b/src/Orchard.Web/Modules/Orchard.ContentTypes/Services/PlacementService.cs index e0af18790..ddfaa1c31 100644 --- a/src/Orchard.Web/Modules/Orchard.ContentTypes/Services/PlacementService.cs +++ b/src/Orchard.Web/Modules/Orchard.ContentTypes/Services/PlacementService.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Routing; -using ClaySharp.Implementation; using Orchard.ContentManagement; using Orchard.ContentManagement.Drivers; using Orchard.ContentManagement.Handlers; @@ -215,8 +214,9 @@ namespace Orchard.ContentTypes.Services { } private dynamic CreateItemShape(string actualShapeType) { - var zoneHoldingBehavior = new ZoneHoldingBehavior((Func)(() => _shapeFactory.Create("ContentZone", Arguments.Empty())), _workContextAccessor.GetContext().Layout); - return _shapeFactory.Create(actualShapeType, Arguments.Empty(), new[] { zoneHoldingBehavior }); + var zoneHolding = new ZoneHolding(() => _shapeFactory.Create("ContentZone", Arguments.Empty())); + zoneHolding.Metadata.Type = actualShapeType; + return zoneHolding; } private void BindPlacement(BuildShapeContext context, string displayType, string stereotype) { diff --git a/src/Orchard.Web/Modules/Orchard.DesignerTools/Orchard.DesignerTools.csproj b/src/Orchard.Web/Modules/Orchard.DesignerTools/Orchard.DesignerTools.csproj index 513a9a638..e48d7db9e 100644 --- a/src/Orchard.Web/Modules/Orchard.DesignerTools/Orchard.DesignerTools.csproj +++ b/src/Orchard.Web/Modules/Orchard.DesignerTools/Orchard.DesignerTools.csproj @@ -21,6 +21,10 @@ false + + + + true @@ -42,10 +46,6 @@ AllRules.ruleset - - ..\..\..\..\lib\claysharp\ClaySharp.dll - True - diff --git a/src/Orchard.Web/Modules/Orchard.DesignerTools/Scripts/orchard-designertools-shapetracing.js b/src/Orchard.Web/Modules/Orchard.DesignerTools/Scripts/orchard-designertools-shapetracing.js index a6431a172..a90572c3e 100644 --- a/src/Orchard.Web/Modules/Orchard.DesignerTools/Scripts/orchard-designertools-shapetracing.js +++ b/src/Orchard.Web/Modules/Orchard.DesignerTools/Scripts/orchard-designertools-shapetracing.js @@ -550,7 +550,7 @@ jQuery(function ($) { var text = shapeNode.type; // add the hint to the tree node if available - if (shapeNode.hint != '') { + if (shapeNode.hint && shapeNode.hint != '') { text += ' [' + shapeNode.hint + ']'; } diff --git a/src/Orchard.Web/Modules/Orchard.DesignerTools/Services/ObjectDumper.cs b/src/Orchard.Web/Modules/Orchard.DesignerTools/Services/ObjectDumper.cs index 063294a35..7392d3b82 100644 --- a/src/Orchard.Web/Modules/Orchard.DesignerTools/Services/ObjectDumper.cs +++ b/src/Orchard.Web/Modules/Orchard.DesignerTools/Services/ObjectDumper.cs @@ -4,7 +4,6 @@ using System.Collections; using System.Linq; using System.Reflection; using System.Xml.Linq; -using ClaySharp; using Orchard.ContentManagement; using Orchard.DisplayManagement; using Orchard.DisplayManagement.Shapes; @@ -195,12 +194,19 @@ namespace Orchard.DesignerTools.Services { } private void DumpShape(IShape shape) { - var members = new Dictionary(); - ((IClayBehaviorProvider) (dynamic) shape).Behavior.GetMembers(() => null, shape, members); + var value = shape as Shape; - foreach (var key in members.Keys.Where(key => !key.StartsWith("_"))) { + if (value == null) { + return; + } + + foreach (DictionaryEntry entry in value.Properties) { // ignore private members (added dynamically by the shape wrapper) - Dump(members[key], key); + if (entry.Key.ToString().StartsWith("_")) { + continue; + } + + Dump(entry.Value, entry.Key.ToString()); } } diff --git a/src/Orchard.Web/Modules/Orchard.Forms/Orchard.Forms.csproj b/src/Orchard.Web/Modules/Orchard.Forms/Orchard.Forms.csproj index 9e3c10258..2e96b387d 100644 --- a/src/Orchard.Web/Modules/Orchard.Forms/Orchard.Forms.csproj +++ b/src/Orchard.Web/Modules/Orchard.Forms/Orchard.Forms.csproj @@ -46,9 +46,6 @@ AllRules.ruleset - - ..\..\..\..\lib\claysharp\ClaySharp.dll - ..\..\..\..\lib\newtonsoft.json\Newtonsoft.Json.dll diff --git a/src/Orchard.Web/Modules/Orchard.Forms/Shapes/EditorShapes.cs b/src/Orchard.Web/Modules/Orchard.Forms/Shapes/EditorShapes.cs index fc9a9c92f..42eebdfd1 100644 --- a/src/Orchard.Web/Modules/Orchard.Forms/Shapes/EditorShapes.cs +++ b/src/Orchard.Web/Modules/Orchard.Forms/Shapes/EditorShapes.cs @@ -26,8 +26,8 @@ namespace Orchard.Forms.Shapes { builder.Describe("Input").Configure(descriptor => descriptor.Wrappers.Add("InputWrapper")); builder.Describe("SelectList").Configure(descriptor => descriptor.Wrappers.Add("InputWrapper")); builder.Describe("Textarea").Configure(descriptor => descriptor.Wrappers.Add("InputWrapper")); - builder.Describe("Form").OnCreating(ctx => ctx.Behaviors.Add(new PropertiesAreItems())); - builder.Describe("Fieldset").OnCreating(ctx => ctx.Behaviors.Add(new PropertiesAreItems())); + builder.Describe("Form").OnCreating(ctx => ctx.Create = () => new PropertiesAreItems()); + builder.Describe("Fieldset").OnCreating(ctx => ctx.Create = () => new PropertiesAreItems()); } [Shape] diff --git a/src/Orchard.Web/Modules/Orchard.Forms/Shapes/PropertyItemsBehavior.cs b/src/Orchard.Web/Modules/Orchard.Forms/Shapes/PropertyItemsBehavior.cs index 1fa9691c6..4bc96cb48 100644 --- a/src/Orchard.Web/Modules/Orchard.Forms/Shapes/PropertyItemsBehavior.cs +++ b/src/Orchard.Web/Modules/Orchard.Forms/Shapes/PropertyItemsBehavior.cs @@ -1,26 +1,26 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using Orchard.DisplayManagement; -using ClaySharp; +using Orchard.DisplayManagement.Shapes; namespace Orchard.Forms.Shapes { - public class PropertiesAreItems : ClayBehavior { - public override object SetMember(Func proceed, dynamic self, string name, object value) { - Patch(self, name, value); - return proceed(); + public class PropertiesAreItems : Composite { + public override bool TrySetMember(System.Dynamic.SetMemberBinder binder, object value) { + Patch(this, binder.Name, value); + return base.TrySetMember(binder, value); } - public override object SetIndex(Func proceed, dynamic self, IEnumerable keys, object value) { - if (keys.Count() == 1 && keys.All(k => k is string)) - Patch(self, System.Convert.ToString(keys.Single()), value); - return proceed(); + public override bool TrySetIndex(System.Dynamic.SetIndexBinder binder, object[] indexes, object value) { + if (indexes.Count() == 1 && indexes.All(k => k is string)) + Patch(this, System.Convert.ToString(indexes.Single()), value); + return base.TrySetIndex(binder, indexes, value); } - public override object InvokeMember(Func proceed, dynamic self, string name, INamedEnumerable args) { - if (args.Count() == 1 && args.Named.Count() == 0) - Patch(self, name, args.Single()); - return proceed(); + public override bool TryInvokeMember(System.Dynamic.InvokeMemberBinder binder, object[] args, out object result) { + var arguments = Arguments.From(args, binder.CallInfo.ArgumentNames); + if (args.Count() == 1 && !arguments.Named.Any()) + Patch(this, binder.Name, args.Single()); + return base.TryInvokeMember(binder, args, out result); } readonly IDictionary _assigned = new Dictionary(); diff --git a/src/Orchard.Web/Modules/Orchard.Rules/Orchard.Rules.csproj b/src/Orchard.Web/Modules/Orchard.Rules/Orchard.Rules.csproj index 578960cf7..dabcc5317 100644 --- a/src/Orchard.Web/Modules/Orchard.Rules/Orchard.Rules.csproj +++ b/src/Orchard.Web/Modules/Orchard.Rules/Orchard.Rules.csproj @@ -21,6 +21,10 @@ false + + + + true @@ -42,7 +46,6 @@ AllRules.ruleset - diff --git a/src/Orchard.Web/Modules/Orchard.Setup/Orchard.Setup.csproj b/src/Orchard.Web/Modules/Orchard.Setup/Orchard.Setup.csproj index 3ca370a28..f0ba33f90 100644 --- a/src/Orchard.Web/Modules/Orchard.Setup/Orchard.Setup.csproj +++ b/src/Orchard.Web/Modules/Orchard.Setup/Orchard.Setup.csproj @@ -50,9 +50,6 @@ False ..\..\..\..\lib\autofac\Autofac.dll - - ..\..\..\..\lib\claysharp\ClaySharp.dll - diff --git a/src/Orchard.Web/Themes/TheAdmin/Views/Menu.cshtml b/src/Orchard.Web/Themes/TheAdmin/Views/Menu.cshtml index bcf5586d4..3ef9783e7 100644 --- a/src/Orchard.Web/Themes/TheAdmin/Views/Menu.cshtml +++ b/src/Orchard.Web/Themes/TheAdmin/Views/Menu.cshtml @@ -30,7 +30,11 @@ : null; IHtmlString sectionHeaderMarkup; - if (firstOfTheSecond != null && firstLevelMenuItem.LinkToFirstChild && (firstOfTheSecond.RouteValues != null || HasText(firstOfTheSecond.Url))) { + if (firstOfTheSecond != null + && firstLevelMenuItem.LinkToFirstChild + && ( + firstOfTheSecond.RouteValues != null + || HasText(firstOfTheSecond.Url))) { sectionHeaderMarkup = HasText(itemId) ? Html.Link(sectionHeaderText, (string)firstOfTheSecond.Href, new { @class = itemClassName, id = itemId }) : Html.Link(sectionHeaderText, (string)firstOfTheSecond.Href, new { @class = itemClassName }); @@ -72,7 +76,7 @@