Remove unused legacy code

--HG--
branch : dev
This commit is contained in:
Renaud Paquay
2010-12-09 18:01:36 -08:00
parent cd68f2430c
commit 8e7adc6ee2
6 changed files with 12 additions and 39 deletions

View File

@@ -24,7 +24,7 @@ namespace Orchard.Blogs.Drivers {
return null;
return shapeHelper.Parts_Blogs_BlogArchives(ContentItem: part.ContentItem, Blog: blog, Archives: _blogPostService.GetArchives(blog));
}).Location("Content");
});
}
protected override DriverResult Editor(BlogArchivesPart part, dynamic shapeHelper) {

View File

@@ -7,7 +7,7 @@ namespace Orchard.Search.Drivers {
protected override DriverResult Display(SearchFormPart part, string displayType, dynamic shapeHelper) {
var model = new SearchViewModel();
return ContentShape("Parts_Search_SearchForm", "Content:1",
return ContentShape("Parts_Search_SearchForm",
() => {
var shape = shapeHelper.Parts_Search_SearchForm();
shape.ContentPart = part;

View File

@@ -1,3 +1,4 @@
<Placement>
<Place Parts_Search_SiteSettings="Content:1"/>
<Place Parts_Search_SearchForm="Content:1"/>
</Placement>

View File

@@ -49,23 +49,15 @@ namespace Orchard.ContentManagement.Drivers {
protected virtual DriverResult Editor(ContentPart part, TField field, IUpdateModel updater, dynamic shapeHelper) { return null; }
public ContentShapeResult ContentShape(string shapeType, Func<dynamic> factory) {
return ContentShapeImplementation(shapeType, null, ctx => factory());
}
public ContentShapeResult ContentShape(string shapeType, string defaultLocation, Func<dynamic> factory) {
return ContentShapeImplementation(shapeType, defaultLocation, ctx => factory());
return ContentShapeImplementation(shapeType, ctx => factory());
}
public ContentShapeResult ContentShape(string shapeType, Func<dynamic, dynamic> factory) {
return ContentShapeImplementation(shapeType, null, ctx=>factory(CreateShape(ctx, shapeType)));
return ContentShapeImplementation(shapeType, ctx=>factory(CreateShape(ctx, shapeType)));
}
public ContentShapeResult ContentShape(string shapeType, string defaultLocation, Func<dynamic, dynamic> factory) {
return ContentShapeImplementation(shapeType, defaultLocation, factory);
}
private ContentShapeResult ContentShapeImplementation(string shapeType, string defaultLocation, Func<BuildShapeContext, object> shapeBuilder) {
return new ContentShapeResult(shapeType, Prefix, shapeBuilder).Location(defaultLocation);
private ContentShapeResult ContentShapeImplementation(string shapeType, Func<BuildShapeContext, object> shapeBuilder) {
return new ContentShapeResult(shapeType, Prefix, shapeBuilder);
}
private object CreateShape(BuildShapeContext context, string shapeType) {

View File

@@ -7,7 +7,6 @@ using Orchard.DisplayManagement;
namespace Orchard.ContentManagement.Drivers {
public abstract class ContentPartDriver<TContent> : IContentPartDriver where TContent : ContentPart, new() {
protected virtual string Prefix { get { return ""; } }
protected virtual string Zone { get { return "Content"; } }
DriverResult IContentPartDriver.BuildDisplay(BuildDisplayContext context) {
var part = context.ContentItem.As<TContent>();
@@ -30,27 +29,19 @@ namespace Orchard.ContentManagement.Drivers {
[Obsolete("Provided while transitioning to factory variations")]
public ContentShapeResult ContentShape(IShape shape) {
return ContentShapeImplementation(shape.Metadata.Type, Zone, ctx => shape);
return ContentShapeImplementation(shape.Metadata.Type, ctx => shape).Location("Content");
}
public ContentShapeResult ContentShape(string shapeType, Func<dynamic> factory) {
return ContentShapeImplementation(shapeType, null, ctx => factory());
}
public ContentShapeResult ContentShape(string shapeType, string defaultLocation, Func<dynamic> factory) {
return ContentShapeImplementation(shapeType, defaultLocation, ctx => factory());
return ContentShapeImplementation(shapeType, ctx => factory());
}
public ContentShapeResult ContentShape(string shapeType, Func<dynamic, dynamic> factory) {
return ContentShapeImplementation(shapeType, null, ctx => factory(CreateShape(ctx, shapeType)));
return ContentShapeImplementation(shapeType, ctx => factory(CreateShape(ctx, shapeType)));
}
public ContentShapeResult ContentShape(string shapeType, string defaultLocation, Func<dynamic, dynamic> factory) {
return ContentShapeImplementation(shapeType, defaultLocation, ctx => factory(CreateShape(ctx, shapeType)));
}
private ContentShapeResult ContentShapeImplementation(string shapeType, string defaultLocation, Func<BuildShapeContext, object> shapeBuilder) {
return new ContentShapeResult(shapeType, Prefix, shapeBuilder).Location(defaultLocation);
private ContentShapeResult ContentShapeImplementation(string shapeType, Func<BuildShapeContext, object> shapeBuilder) {
return new ContentShapeResult(shapeType, Prefix, shapeBuilder);
}
private object CreateShape(BuildShapeContext context, string shapeType) {

View File

@@ -49,16 +49,5 @@ namespace Orchard.ContentManagement.Drivers {
_defaultLocation = zone;
return this;
}
public ContentShapeResult Location(string zone, string position) {
_defaultLocation = zone + ":" + position;
return this;
}
public ContentShapeResult Location(ContentLocation location) {
return location.Position == null
? Location(location.Zone)
: Location(location.Zone, location.Position);
}
}
}