mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 03:25:23 +08:00
More adjustments to namespace... Some planning...
--HG-- branch : mvc3p1
This commit is contained in:
@@ -5,6 +5,7 @@ using System.Text;
|
||||
using Autofac;
|
||||
using NUnit.Framework;
|
||||
using Orchard.DisplayManagement;
|
||||
using Orchard.DisplayManagement.Implementation;
|
||||
using Orchard.DisplayManagement.Shapes;
|
||||
|
||||
namespace Orchard.Tests.DisplayManagement {
|
||||
|
@@ -8,7 +8,6 @@ using Autofac;
|
||||
using NUnit.Framework;
|
||||
using Orchard.DisplayManagement;
|
||||
using Orchard.DisplayManagement.Implementation;
|
||||
using Orchard.DisplayManagement.Secondary;
|
||||
using Orchard.DisplayManagement.Shapes;
|
||||
|
||||
namespace Orchard.Tests.DisplayManagement {
|
||||
|
@@ -20,10 +20,10 @@ namespace Orchard.DevTools.Controllers {
|
||||
public HomeController(INotifier notifier, IShapeHelperFactory shapeHelperFactory) {
|
||||
_notifier = notifier;
|
||||
T = NullLocalizer.Instance;
|
||||
New = shapeHelperFactory.CreateHelper();
|
||||
Shape = shapeHelperFactory.CreateHelper();
|
||||
}
|
||||
|
||||
dynamic New { get; set; }
|
||||
dynamic Shape { get; set; }
|
||||
|
||||
public Localizer T { get; set; }
|
||||
|
||||
@@ -58,18 +58,18 @@ namespace Orchard.DevTools.Controllers {
|
||||
|
||||
public ActionResult UsingShapes() {
|
||||
|
||||
ViewModel.Page = New.Page()
|
||||
.Main(New.Zone(typeof (Array), Name: "Main"))
|
||||
.Messages(New.Zone(typeof (Array), Name: "Messages"))
|
||||
.Sidebar(New.Zone(typeof (Array), Name: "Sidebar"));
|
||||
ViewModel.Page = Shape.Page()
|
||||
.Main(Shape.Zone(typeof (Array), Name: "Main"))
|
||||
.Messages(Shape.Zone(typeof (Array), Name: "Messages"))
|
||||
.Sidebar(Shape.Zone(typeof (Array), Name: "Sidebar"));
|
||||
|
||||
ViewModel.Page.Add("Messages:5", New.Message(Content: T("This is a test"), Severity: "Really bad!!!"));
|
||||
//ViewModel.Page.Add("Messages:5", New.Message(Content: T("This is a test"), Severity: "Really bad!!!"));
|
||||
|
||||
ViewModel.Page.Messages.Add(
|
||||
New.Message(Content: T("This is a test"), Severity: "Really bad!!!"));
|
||||
Shape.Message(Content: T("This is a test"), Severity: "Really bad!!!"));
|
||||
|
||||
var model = New.Message(
|
||||
Content: New.Explosion(Height: 100, Width: 200),
|
||||
var model = Shape.Message(
|
||||
Content: Shape.Explosion(Height: 100, Width: 200),
|
||||
Severity: "Meh");
|
||||
|
||||
ViewModel.Page.Messages.Add(new HtmlString("<hr/>abuse<hr/>"));
|
||||
|
@@ -24,7 +24,7 @@ namespace Orchard.DevTools {
|
||||
tag.GenerateId("zone-" + Shape.Name);
|
||||
tag.AddCssClass("zone-" + Shape.Name);
|
||||
tag.AddCssClass("zone");
|
||||
tag.InnerHtml = Smash(DisplayAll(Display, Shape)).ToString();
|
||||
tag.InnerHtml = Combine(DisplayAll(Display, Shape).ToArray()).ToString();
|
||||
return new HtmlString(tag.ToString());
|
||||
}
|
||||
|
||||
@@ -32,7 +32,8 @@ namespace Orchard.DevTools {
|
||||
return Display(new HtmlString("<p class=\"message\">"), Severity ?? "Neutral", ": ", Content, new HtmlString("</p>"));
|
||||
}
|
||||
|
||||
private static IHtmlString Smash(IEnumerable<IHtmlString> contents) {
|
||||
|
||||
static IHtmlString Combine(IEnumerable<IHtmlString> contents) {
|
||||
return new HtmlString(contents.Aggregate("", (a, b) => a + b));
|
||||
}
|
||||
|
||||
|
@@ -13,7 +13,6 @@ using Orchard.Data.Providers;
|
||||
using Orchard.Data.Migration;
|
||||
using Orchard.DisplayManagement;
|
||||
using Orchard.DisplayManagement.Implementation;
|
||||
using Orchard.DisplayManagement.Secondary;
|
||||
using Orchard.DisplayManagement.Shapes;
|
||||
using Orchard.Environment.Extensions;
|
||||
using Orchard.Localization;
|
||||
|
@@ -1,5 +1,4 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace Orchard.DisplayManagement {
|
||||
/// <summary>
|
||||
|
@@ -1,7 +1,4 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
using Orchard.DisplayManagement.Shapes;
|
||||
|
||||
namespace Orchard.DisplayManagement {
|
||||
namespace Orchard.DisplayManagement {
|
||||
/// <summary>
|
||||
/// Interface present on dynamic shapes.
|
||||
/// May be used to access attributes in a strongly typed fashion.
|
||||
|
@@ -1,5 +1,4 @@
|
||||
using ClaySharp;
|
||||
using Orchard.DisplayManagement.Shapes;
|
||||
|
||||
namespace Orchard.DisplayManagement {
|
||||
/// <summary>
|
||||
|
@@ -3,21 +3,20 @@ using System.Dynamic;
|
||||
using System.Linq.Expressions;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using Microsoft.CSharp.RuntimeBinder;
|
||||
using Orchard.DisplayManagement.Implementation;
|
||||
using Orchard.DisplayManagement.Shapes;
|
||||
using Orchard.Localization;
|
||||
|
||||
namespace Orchard.DisplayManagement.Secondary {
|
||||
namespace Orchard.DisplayManagement.Implementation {
|
||||
public class DefaultDisplayManager : IDisplayManager {
|
||||
private readonly IShapeTableFactory _shapeTableFactory;
|
||||
|
||||
private static CallSite<Func<CallSite, object, IShape>> _convertAsShapeCallsite = CallSite<Func<CallSite, object, IShape>>.Create(
|
||||
// this need to be Shape instead of IShape - cast to interface throws error on clr types like HtmlString
|
||||
private static readonly CallSite<Func<CallSite, object, Shape>> _convertAsShapeCallsite = CallSite<Func<CallSite, object, Shape>>.Create(
|
||||
new ForgivingConvertBinder(
|
||||
(ConvertBinder)Binder.Convert(
|
||||
CSharpBinderFlags.ConvertExplicit | CSharpBinderFlags.CheckedContext,
|
||||
typeof(IShape),
|
||||
CSharpBinderFlags.ConvertExplicit,
|
||||
typeof(Shape),
|
||||
null/*typeof(DefaultDisplayManager)*/)));
|
||||
|
||||
public DefaultDisplayManager(IShapeTableFactory shapeTableFactory) {
|
||||
@@ -41,10 +40,13 @@ namespace Orchard.DisplayManagement.Secondary {
|
||||
return CoerceHtmlString(context.Value);
|
||||
|
||||
var shapeTable = _shapeTableFactory.CreateShapeTable();
|
||||
//preproc loop / event (alter shape, swapping type)
|
||||
|
||||
ShapeTable.Entry entry;
|
||||
if (shapeTable.Entries.TryGetValue(shapeAttributes.Type, out entry)) {
|
||||
return Process(entry, shape, context);
|
||||
}
|
||||
//postproc / content html alteration/wrapping/etc
|
||||
throw new OrchardException(T("Shape type {0} not found", shapeAttributes.Type));
|
||||
}
|
||||
|
||||
|
@@ -1,8 +1,9 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using ClaySharp;
|
||||
using Orchard.DisplayManagement.Shapes;
|
||||
|
||||
namespace Orchard.DisplayManagement.Shapes {
|
||||
namespace Orchard.DisplayManagement.Implementation {
|
||||
public class DefaultShapeFactory : IShapeFactory {
|
||||
public IShape Create(string shapeType, INamedEnumerable<object> parameters) {
|
||||
|
||||
|
@@ -1,12 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Web.Mvc;
|
||||
using Orchard.DisplayManagement.Shapes;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace Orchard.DisplayManagement {
|
||||
namespace Orchard.DisplayManagement.Implementation {
|
||||
public class DisplayContext {
|
||||
public DisplayHelper Display { get; set; }
|
||||
public ViewContext ViewContext { get; set; }
|
||||
|
@@ -1,13 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using ClaySharp;
|
||||
using Orchard.DisplayManagement.Implementation;
|
||||
using Orchard.DisplayManagement.Shapes;
|
||||
|
||||
namespace Orchard.DisplayManagement {
|
||||
namespace Orchard.DisplayManagement.Implementation {
|
||||
|
||||
/// <summary>
|
||||
/// Refactor: I this doesn't really need to exist, does it?
|
||||
|
@@ -1,10 +1,8 @@
|
||||
using System;
|
||||
using System.Web.Mvc;
|
||||
using ClaySharp;
|
||||
using Orchard.DisplayManagement.Implementation;
|
||||
using Orchard.DisplayManagement.Shapes;
|
||||
|
||||
namespace Orchard.DisplayManagement {
|
||||
namespace Orchard.DisplayManagement.Implementation {
|
||||
public class DisplayHelperFactory : IDisplayHelperFactory {
|
||||
static private readonly DisplayHelperBehavior[] _behaviors = new[] { new DisplayHelperBehavior() };
|
||||
private readonly IDisplayManager _displayManager;
|
||||
|
@@ -7,6 +7,7 @@ using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Web;
|
||||
using Microsoft.CSharp.RuntimeBinder;
|
||||
using Orchard.DisplayManagement.Implementation;
|
||||
using Binder = Microsoft.CSharp.RuntimeBinder.Binder;
|
||||
|
||||
namespace Orchard.DisplayManagement {
|
||||
|
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web;
|
||||
using Orchard.DisplayManagement.Implementation;
|
||||
|
||||
namespace Orchard.DisplayManagement {
|
||||
public class ShapeTable {
|
||||
|
Reference in New Issue
Block a user