mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-27 04:19:04 +08:00
Merge 1.x
--HG-- branch : autoroute
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
Autofac IoC Container
|
Autofac IoC Container
|
||||||
Copyright (c) 2007-2008 Autofac Contributors
|
Copyright (c) 2007-2010 Autofac Contributors
|
||||||
http://code.google.com/p/autofac/wiki/Contributing
|
http://code.google.com/p/autofac/wiki/Contributing
|
||||||
|
|
||||||
Other software included in this distribution is owned and
|
Other software included in this distribution is owned and
|
||||||
|
|||||||
Binary file not shown.
BIN
lib/autofac/Autofac.Integration.Mvc.dll
Normal file
BIN
lib/autofac/Autofac.Integration.Mvc.dll
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@@ -28,7 +28,7 @@ namespace Orchard.Core.Tests.Scheduling {
|
|||||||
public override void Init() {
|
public override void Init() {
|
||||||
base.Init();
|
base.Init();
|
||||||
_repository = _container.Resolve<IRepository<ScheduledTaskRecord>>();
|
_repository = _container.Resolve<IRepository<ScheduledTaskRecord>>();
|
||||||
_executor = _container.Resolve<IBackgroundTask>("ScheduledTaskExecutor");
|
_executor = _container.ResolveNamed<IBackgroundTask>("ScheduledTaskExecutor");
|
||||||
}
|
}
|
||||||
public override void Register(ContainerBuilder builder) {
|
public override void Register(ContainerBuilder builder) {
|
||||||
_handler = new StubTaskHandler();
|
_handler = new StubTaskHandler();
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ namespace Orchard.Tests.ContentManagement.Handlers.Coordinators {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected override DriverResult Display(StubPart part, string displayType, dynamic shapeHelper) {
|
protected override DriverResult Display(StubPart part, string displayType, dynamic shapeHelper) {
|
||||||
var stub = shapeHelper.Stub(ContentPart: part, Foo: string.Join(",", part.Foo));
|
var stub = shapeHelper.Stub(Foo: string.Join(",", part.Foo));
|
||||||
if (!string.IsNullOrWhiteSpace(displayType))
|
if (!string.IsNullOrWhiteSpace(displayType))
|
||||||
stub.Metadata.Type = string.Format("{0}.{1}", stub.Metadata.Type, displayType);
|
stub.Metadata.Type = string.Format("{0}.{1}", stub.Metadata.Type, displayType);
|
||||||
return ContentShape(stub).Location("TopMeta");
|
return ContentShape(stub).Location("TopMeta");
|
||||||
|
|||||||
@@ -89,6 +89,10 @@ namespace Orchard.Tests.DisplayManagement.Descriptors {
|
|||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void DeleteFile(string virtualPath) {
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
public bool DirectoryExists(string virtualPath) {
|
public bool DirectoryExists(string virtualPath) {
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
@@ -97,6 +101,10 @@ namespace Orchard.Tests.DisplayManagement.Descriptors {
|
|||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual void DeleteDirectory(string virtualPath) {
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
public string GetDirectoryName(string virtualPath) {
|
public string GetDirectoryName(string virtualPath) {
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,6 +86,10 @@ namespace Orchard.Tests.DisplayManagement.Descriptors {
|
|||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void DeleteFile(string virtualPath) {
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
public bool DirectoryExists(string virtualPath) {
|
public bool DirectoryExists(string virtualPath) {
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
@@ -98,6 +102,10 @@ namespace Orchard.Tests.DisplayManagement.Descriptors {
|
|||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void DeleteDirectory(string virtualPath) {
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
public IEnumerable<string> ListFiles(string path) {
|
public IEnumerable<string> ListFiles(string path) {
|
||||||
return TestViewEngine.Keys.Select(o => o.ToString());
|
return TestViewEngine.Keys.Select(o => o.ToString());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ namespace Orchard.Tests.Environment {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
[Test]
|
[Test, Ignore("containers are disposed when calling BeginRequest, maybe by the StubVirtualPathMonitor")]
|
||||||
public void NormalDependenciesShouldBeUniquePerRequestContainer() {
|
public void NormalDependenciesShouldBeUniquePerRequestContainer() {
|
||||||
var host = _lifetime.Resolve<IOrchardHost>();
|
var host = _lifetime.Resolve<IOrchardHost>();
|
||||||
var container1 = host.CreateShellContainer_Obsolete();
|
var container1 = host.CreateShellContainer_Obsolete();
|
||||||
|
|||||||
@@ -78,6 +78,10 @@ namespace Orchard.Tests.Stubs {
|
|||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void DeleteFile(string virtualPath) {
|
||||||
|
_fileSystem.DeleteFile(ToFileSystemPath(virtualPath));
|
||||||
|
}
|
||||||
|
|
||||||
public bool DirectoryExists(string virtualPath) {
|
public bool DirectoryExists(string virtualPath) {
|
||||||
return _fileSystem.GetDirectoryEntry(ToFileSystemPath(virtualPath)) != null;
|
return _fileSystem.GetDirectoryEntry(ToFileSystemPath(virtualPath)) != null;
|
||||||
}
|
}
|
||||||
@@ -86,6 +90,10 @@ namespace Orchard.Tests.Stubs {
|
|||||||
_fileSystem.CreateDirectoryEntry(ToFileSystemPath(virtualPath));
|
_fileSystem.CreateDirectoryEntry(ToFileSystemPath(virtualPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void DeleteDirectory(string virtualPath) {
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
public string GetDirectoryName(string virtualPath) {
|
public string GetDirectoryName(string virtualPath) {
|
||||||
return Path.GetDirectoryName(virtualPath);
|
return Path.GetDirectoryName(virtualPath);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ namespace Orchard.Tests.Utility {
|
|||||||
|
|
||||||
public AutoMockSource(MockBehavior behavior) {
|
public AutoMockSource(MockBehavior behavior) {
|
||||||
_behavior = behavior;
|
_behavior = behavior;
|
||||||
|
Ignore<IStartable>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsAdapterForIndividualComponents {
|
public bool IsAdapterForIndividualComponents {
|
||||||
|
|||||||
@@ -38,12 +38,12 @@ namespace Orchard.Core.Common.Drivers {
|
|||||||
ContentShape("Parts_Common_Body",
|
ContentShape("Parts_Common_Body",
|
||||||
() => {
|
() => {
|
||||||
var bodyText = _htmlFilters.Aggregate(part.Text, (text, filter) => filter.ProcessContent(text, GetFlavor(part)));
|
var bodyText = _htmlFilters.Aggregate(part.Text, (text, filter) => filter.ProcessContent(text, GetFlavor(part)));
|
||||||
return shapeHelper.Parts_Common_Body(ContentPart: part, Html: new HtmlString(bodyText));
|
return shapeHelper.Parts_Common_Body(Html: new HtmlString(bodyText));
|
||||||
}),
|
}),
|
||||||
ContentShape("Parts_Common_Body_Summary",
|
ContentShape("Parts_Common_Body_Summary",
|
||||||
() => {
|
() => {
|
||||||
var bodyText = _htmlFilters.Aggregate(part.Text, (text, filter) => filter.ProcessContent(text, GetFlavor(part)));
|
var bodyText = _htmlFilters.Aggregate(part.Text, (text, filter) => filter.ProcessContent(text, GetFlavor(part)));
|
||||||
return shapeHelper.Parts_Common_Body_Summary(ContentPart: part, Html: new HtmlString(bodyText));
|
return shapeHelper.Parts_Common_Body_Summary(Html: new HtmlString(bodyText));
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,11 +38,11 @@ namespace Orchard.Core.Common.Drivers {
|
|||||||
protected override DriverResult Display(CommonPart part, string displayType, dynamic shapeHelper) {
|
protected override DriverResult Display(CommonPart part, string displayType, dynamic shapeHelper) {
|
||||||
return Combined(
|
return Combined(
|
||||||
ContentShape("Parts_Common_Metadata",
|
ContentShape("Parts_Common_Metadata",
|
||||||
() => shapeHelper.Parts_Common_Metadata(ContentPart: part)),
|
() => shapeHelper.Parts_Common_Metadata()),
|
||||||
ContentShape("Parts_Common_Metadata_Summary",
|
ContentShape("Parts_Common_Metadata_Summary",
|
||||||
() => shapeHelper.Parts_Common_Metadata_Summary(ContentPart: part)),
|
() => shapeHelper.Parts_Common_Metadata_Summary()),
|
||||||
ContentShape("Parts_Common_Metadata_SummaryAdmin",
|
ContentShape("Parts_Common_Metadata_SummaryAdmin",
|
||||||
() => shapeHelper.Parts_Common_Metadata_SummaryAdmin(ContentPart: part))
|
() => shapeHelper.Parts_Common_Metadata_SummaryAdmin())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ namespace Orchard.Core.Common.Drivers {
|
|||||||
|
|
||||||
protected override DriverResult Display(ContentPart part, TextField field, string displayType, dynamic shapeHelper) {
|
protected override DriverResult Display(ContentPart part, TextField field, string displayType, dynamic shapeHelper) {
|
||||||
return ContentShape("Fields_Common_Text", GetDifferentiator(field, part),
|
return ContentShape("Fields_Common_Text", GetDifferentiator(field, part),
|
||||||
() => shapeHelper.Fields_Common_Text(ContentPart: part, ContentField: field, Name: field.Name, Value: field.Value));
|
() => shapeHelper.Fields_Common_Text(Name: field.Name, Value: field.Value));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override DriverResult Editor(ContentPart part, TextField field, dynamic shapeHelper) {
|
protected override DriverResult Editor(ContentPart part, TextField field, dynamic shapeHelper) {
|
||||||
|
|||||||
@@ -8,11 +8,11 @@ namespace Orchard.Core.Contents.Drivers {
|
|||||||
protected override DriverResult Display(ContentPart part, string displayType, dynamic shapeHelper) {
|
protected override DriverResult Display(ContentPart part, string displayType, dynamic shapeHelper) {
|
||||||
return Combined(
|
return Combined(
|
||||||
ContentShape("Parts_Contents_Publish",
|
ContentShape("Parts_Contents_Publish",
|
||||||
() => shapeHelper.Parts_Contents_Publish(ContentPart: part)),
|
() => shapeHelper.Parts_Contents_Publish()),
|
||||||
ContentShape("Parts_Contents_Publish_Summary",
|
ContentShape("Parts_Contents_Publish_Summary",
|
||||||
() => shapeHelper.Parts_Contents_Publish_Summary(ContentPart: part)),
|
() => shapeHelper.Parts_Contents_Publish_Summary()),
|
||||||
ContentShape("Parts_Contents_Publish_SummaryAdmin",
|
ContentShape("Parts_Contents_Publish_SummaryAdmin",
|
||||||
() => shapeHelper.Parts_Contents_Publish_SummaryAdmin(ContentPart: part))
|
() => shapeHelper.Parts_Contents_Publish_SummaryAdmin())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
@T("Welcome, <strong>{0}</strong>!", new HtmlString(Html.ActionLink( WorkContext.CurrentUser.UserName, "ChangePassword", new { Controller = "Account", Area = "Orchard.Users" }).ToString()))
|
@T("Welcome, <strong>{0}</strong>!", new HtmlString(Html.ActionLink( WorkContext.CurrentUser.UserName, "ChangePassword", new { Controller = "Account", Area = "Orchard.Users" }).ToString()))
|
||||||
</span>
|
</span>
|
||||||
<span class="user-actions">
|
<span class="user-actions">
|
||||||
@Html.ActionLink(T("Sign Out").ToString(), "LogOff", new { Controller = "Account", Area = "Orchard.Users", ReturnUrl = Context.Request.RawUrl })
|
@Html.ActionLink(T("Sign Out").ToString(), "LogOff", new { Controller = "Account", Area = "Orchard.Users", ReturnUrl = Context.Request.RawUrl }, new { rel = "nofollow" })
|
||||||
@Html.ActionLink(T("Dashboard").ToString(), "Index", new { Area = "Dashboard", Controller = "Admin" })
|
@Html.ActionLink(T("Dashboard").ToString(), "Index", new { Area = "Dashboard", Controller = "Admin" })
|
||||||
</span>
|
</span>
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -18,11 +18,11 @@ namespace Orchard.Core.Title.Drivers {
|
|||||||
protected override DriverResult Display(TitlePart part, string displayType, dynamic shapeHelper) {
|
protected override DriverResult Display(TitlePart part, string displayType, dynamic shapeHelper) {
|
||||||
return Combined(
|
return Combined(
|
||||||
ContentShape("Parts_Title",
|
ContentShape("Parts_Title",
|
||||||
() => shapeHelper.Parts_Title(ContentPart: part, Title: part.Title)),
|
() => shapeHelper.Parts_Title(Title: part.Title)),
|
||||||
ContentShape("Parts_Title_Summary",
|
ContentShape("Parts_Title_Summary",
|
||||||
() => shapeHelper.Parts_Title_Summary(ContentPart: part, Title: part.Title)),
|
() => shapeHelper.Parts_Title_Summary(Title: part.Title)),
|
||||||
ContentShape("Parts_Title_SummaryAdmin",
|
ContentShape("Parts_Title_SummaryAdmin",
|
||||||
() => shapeHelper.Parts_Title_SummaryAdmin(ContentPart: part, Title: part.Title))
|
() => shapeHelper.Parts_Title_SummaryAdmin(Title: part.Title))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ namespace Orchard.Blogs.Drivers {
|
|||||||
if (blog == null)
|
if (blog == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return shapeHelper.Parts_Blogs_BlogArchives(ContentItem: part.ContentItem, Blog: blog, Archives: _blogPostService.GetArchives(blog));
|
return shapeHelper.Parts_Blogs_BlogArchives(Blog: blog, Archives: _blogPostService.GetArchives(blog));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,13 +11,13 @@ namespace Orchard.Blogs.Drivers {
|
|||||||
protected override DriverResult Display(BlogPart part, string displayType, dynamic shapeHelper) {
|
protected override DriverResult Display(BlogPart part, string displayType, dynamic shapeHelper) {
|
||||||
return Combined(
|
return Combined(
|
||||||
ContentShape("Parts_Blogs_Blog_Manage",
|
ContentShape("Parts_Blogs_Blog_Manage",
|
||||||
() => shapeHelper.Parts_Blogs_Blog_Manage(ContentPart: part)),
|
() => shapeHelper.Parts_Blogs_Blog_Manage()),
|
||||||
ContentShape("Parts_Blogs_Blog_Description",
|
ContentShape("Parts_Blogs_Blog_Description",
|
||||||
() => shapeHelper.Parts_Blogs_Blog_Description(ContentPart: part, Description: part.Description)),
|
() => shapeHelper.Parts_Blogs_Blog_Description(Description: part.Description)),
|
||||||
ContentShape("Parts_Blogs_Blog_SummaryAdmin",
|
ContentShape("Parts_Blogs_Blog_SummaryAdmin",
|
||||||
() => shapeHelper.Parts_Blogs_Blog_SummaryAdmin(ContentPart: part, ContentItem: part.ContentItem)),
|
() => shapeHelper.Parts_Blogs_Blog_SummaryAdmin()),
|
||||||
ContentShape("Parts_Blogs_Blog_BlogPostCount",
|
ContentShape("Parts_Blogs_Blog_BlogPostCount",
|
||||||
() => shapeHelper.Parts_Blogs_Blog_BlogPostCount(ContentPart: part, PostCount: part.PostCount))
|
() => shapeHelper.Parts_Blogs_Blog_BlogPostCount(PostCount: part.PostCount))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,24 +22,26 @@ namespace Orchard.Blogs.Drivers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected override DriverResult Display(RecentBlogPostsPart part, string displayType, dynamic shapeHelper) {
|
protected override DriverResult Display(RecentBlogPostsPart part, string displayType, dynamic shapeHelper) {
|
||||||
BlogPart blog = _blogService.Get(part.ForBlog,VersionOptions.Published).As<BlogPart>();
|
return ContentShape("Parts_Blogs_RecentBlogPosts", () => {
|
||||||
|
BlogPart blog = _blogService.Get(part.ForBlog);
|
||||||
|
|
||||||
if (blog == null) {
|
if (blog == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var blogPosts =_contentManager.Query(VersionOptions.Published, "BlogPost")
|
var blogPosts = _contentManager.Query(VersionOptions.Published, "BlogPost")
|
||||||
.Join<CommonPartRecord>().Where(cr => cr.Container == blog.Record.ContentItemRecord)
|
.Join<CommonPartRecord>().Where(cr => cr.Container == blog.Record.ContentItemRecord)
|
||||||
.OrderByDescending(cr => cr.CreatedUtc)
|
.OrderByDescending(cr => cr.CreatedUtc)
|
||||||
.Slice(0, part.Count)
|
.Slice(0, part.Count)
|
||||||
.Select(ci => ci.As<BlogPostPart>());
|
.Select(ci => ci.As<BlogPostPart>());
|
||||||
|
|
||||||
var list = shapeHelper.List();
|
var list = shapeHelper.List();
|
||||||
list.AddRange(blogPosts.Select(bp => _contentManager.BuildDisplay(bp, "Summary")));
|
list.AddRange(blogPosts.Select(bp => _contentManager.BuildDisplay(bp, "Summary")));
|
||||||
|
|
||||||
var blogPostList = shapeHelper.Parts_Blogs_BlogPost_List(ContentPart: part, ContentItems: list);
|
var blogPostList = shapeHelper.Parts_Blogs_BlogPost_List(ContentItems: list);
|
||||||
|
|
||||||
return ContentShape(shapeHelper.Parts_Blogs_RecentBlogPosts(ContentItem: part.ContentItem, ContentItems: blogPostList, Blog: blog));
|
return shapeHelper.Parts_Blogs_RecentBlogPosts(ContentItems: blogPostList, Blog: blog);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override DriverResult Editor(RecentBlogPostsPart part, dynamic shapeHelper) {
|
protected override DriverResult Editor(RecentBlogPostsPart part, dynamic shapeHelper) {
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using System;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Orchard.Comments.Models;
|
using Orchard.Comments.Models;
|
||||||
using Orchard.Comments.Services;
|
using Orchard.Comments.Services;
|
||||||
@@ -13,14 +14,16 @@ namespace Orchard.Comments.Drivers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected override DriverResult Display(CommentsContainerPart part, string displayType, dynamic shapeHelper) {
|
protected override DriverResult Display(CommentsContainerPart part, string displayType, dynamic shapeHelper) {
|
||||||
|
|
||||||
var commentsForCommentedContent = _commentService.GetCommentsForCommentedContent(part.ContentItem.Id);
|
var commentsForCommentedContent = _commentService.GetCommentsForCommentedContent(part.ContentItem.Id);
|
||||||
|
Func<int> pendingCount = () => commentsForCommentedContent.Where(x => x.Status == CommentStatus.Pending).Count();
|
||||||
|
|
||||||
return Combined(
|
return Combined(
|
||||||
|
|
||||||
ContentShape("Parts_Comments_Count",
|
ContentShape("Parts_Comments_Count",
|
||||||
() => shapeHelper.Parts_Comments_Count(ContentPart: part, CommentCount: commentsForCommentedContent.Count(), PendingCount: commentsForCommentedContent.Where(x => x.Status == CommentStatus.Pending).Count())),
|
() => shapeHelper.Parts_Comments_Count(CommentCount: commentsForCommentedContent.Count(), PendingCount: pendingCount)),
|
||||||
ContentShape("Parts_Comments_Count_SummaryAdmin",
|
ContentShape("Parts_Comments_Count_SummaryAdmin",
|
||||||
() => shapeHelper.Parts_Comments_Count_SummaryAdmin(ContentPart: part, CommentCount: commentsForCommentedContent.Count(), PendingCount: commentsForCommentedContent.Where(x => x.Status == CommentStatus.Pending).Count()))
|
() => shapeHelper.Parts_Comments_Count_SummaryAdmin(CommentCount: commentsForCommentedContent.Count(), PendingCount: pendingCount))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,11 +23,11 @@ namespace Orchard.Comments.Drivers {
|
|||||||
|
|
||||||
return Combined(
|
return Combined(
|
||||||
ContentShape("Parts_Comments",
|
ContentShape("Parts_Comments",
|
||||||
() => shapeHelper.Parts_Comments(ContentPart: part)),
|
() => shapeHelper.Parts_Comments()),
|
||||||
ContentShape("Parts_Comments_Count",
|
ContentShape("Parts_Comments_Count",
|
||||||
() => shapeHelper.Parts_Comments_Count(ContentPart: part, CommentCount: commentsForCommentedContent.Count(), PendingCount: pendingCount)),
|
() => shapeHelper.Parts_Comments_Count(CommentCount: commentsForCommentedContent.Count(), PendingCount: pendingCount)),
|
||||||
ContentShape("Parts_Comments_Count_SummaryAdmin",
|
ContentShape("Parts_Comments_Count_SummaryAdmin",
|
||||||
() => shapeHelper.Parts_Comments_Count_SummaryAdmin(ContentPart: part, CommentCount: commentsForCommentedContent.Count(), PendingCount: pendingCount))
|
() => shapeHelper.Parts_Comments_Count_SummaryAdmin(CommentCount: commentsForCommentedContent.Count(), PendingCount: pendingCount))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,13 +24,13 @@ namespace Orchard.DesignerTools.Services {
|
|||||||
private int _shapeId;
|
private int _shapeId;
|
||||||
|
|
||||||
public ShapeTracingFactory(
|
public ShapeTracingFactory(
|
||||||
WorkContext workContext,
|
IWorkContextAccessor workContextAccessor,
|
||||||
IShapeTableManager shapeTableManager,
|
IShapeTableManager shapeTableManager,
|
||||||
IThemeManager themeManager,
|
IThemeManager themeManager,
|
||||||
IWebSiteFolder webSiteFolder,
|
IWebSiteFolder webSiteFolder,
|
||||||
IAuthorizer authorizer
|
IAuthorizer authorizer
|
||||||
) {
|
) {
|
||||||
_workContext = workContext;
|
_workContext = workContextAccessor.GetContext();
|
||||||
_shapeTableManager = shapeTableManager;
|
_shapeTableManager = shapeTableManager;
|
||||||
_themeManager = themeManager;
|
_themeManager = themeManager;
|
||||||
_webSiteFolder = webSiteFolder;
|
_webSiteFolder = webSiteFolder;
|
||||||
|
|||||||
@@ -13,10 +13,10 @@ namespace Orchard.Email.Services
|
|||||||
private readonly IOrchardServices _orchardServices;
|
private readonly IOrchardServices _orchardServices;
|
||||||
private readonly WorkContext _workContext;
|
private readonly WorkContext _workContext;
|
||||||
|
|
||||||
public MissingSettingsBanner(IOrchardServices orchardServices, WorkContext workContext)
|
public MissingSettingsBanner(IOrchardServices orchardServices, IWorkContextAccessor workContextAccessor)
|
||||||
{
|
{
|
||||||
_orchardServices = orchardServices;
|
_orchardServices = orchardServices;
|
||||||
_workContext = workContext;
|
_workContext = workContextAccessor.GetContext();
|
||||||
T = NullLocalizer.Instance;
|
T = NullLocalizer.Instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,11 @@
|
|||||||
using System;
|
using Orchard.ContentManagement.Drivers;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Web;
|
|
||||||
using Orchard.ContentManagement.Drivers;
|
|
||||||
using Orchard.Core.Containers.Models;
|
using Orchard.Core.Containers.Models;
|
||||||
|
|
||||||
namespace Orchard.Lists.Drivers {
|
namespace Orchard.Lists.Drivers {
|
||||||
public class ContainerPartDriver : ContentPartDriver<ContainerPart>{
|
public class ContainerPartDriver : ContentPartDriver<ContainerPart>{
|
||||||
protected override DriverResult Display(ContainerPart part, string displayType, dynamic shapeHelper) {
|
protected override DriverResult Display(ContainerPart part, string displayType, dynamic shapeHelper) {
|
||||||
return ContentShape("Parts_Container_Contained_SummaryAdmin",
|
return ContentShape("Parts_Container_Contained_SummaryAdmin",
|
||||||
() => shapeHelper.Parts_Container_Contained_SummaryAdmin(ContentPart: part)
|
() => shapeHelper.Parts_Container_Contained_SummaryAdmin()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,11 +27,11 @@ namespace Orchard.Localization.Drivers {
|
|||||||
: part.Id;
|
: part.Id;
|
||||||
return Combined(
|
return Combined(
|
||||||
ContentShape("Parts_Localization_ContentTranslations",
|
ContentShape("Parts_Localization_ContentTranslations",
|
||||||
() => shapeHelper.Parts_Localization_ContentTranslations(ContentPart: part, MasterId: masterId, Localizations: GetDisplayLocalizations(part, VersionOptions.Published))),
|
() => shapeHelper.Parts_Localization_ContentTranslations(MasterId: masterId, Localizations: GetDisplayLocalizations(part, VersionOptions.Published))),
|
||||||
ContentShape("Parts_Localization_ContentTranslations_Summary",
|
ContentShape("Parts_Localization_ContentTranslations_Summary",
|
||||||
() => shapeHelper.Parts_Localization_ContentTranslations_Summary(ContentPart: part, MasterId: masterId, Localizations: GetDisplayLocalizations(part, VersionOptions.Published))),
|
() => shapeHelper.Parts_Localization_ContentTranslations_Summary(MasterId: masterId, Localizations: GetDisplayLocalizations(part, VersionOptions.Published))),
|
||||||
ContentShape("Parts_Localization_ContentTranslations_SummaryAdmin",
|
ContentShape("Parts_Localization_ContentTranslations_SummaryAdmin",
|
||||||
() => shapeHelper.Parts_Localization_ContentTranslations_SummaryAdmin(ContentPart: part, MasterId: masterId, Localizations: GetDisplayLocalizations(part, VersionOptions.Latest)))
|
() => shapeHelper.Parts_Localization_ContentTranslations_SummaryAdmin(MasterId: masterId, Localizations: GetDisplayLocalizations(part, VersionOptions.Latest)))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using System.Linq;
|
|||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using System.Web.Routing;
|
using System.Web.Routing;
|
||||||
using Orchard.Data.Migration;
|
using Orchard.Data.Migration;
|
||||||
|
using Orchard.Environment;
|
||||||
using Orchard.Environment.Extensions;
|
using Orchard.Environment.Extensions;
|
||||||
using Orchard.Localization;
|
using Orchard.Localization;
|
||||||
using Orchard.Modules.Extensions;
|
using Orchard.Modules.Extensions;
|
||||||
@@ -20,9 +21,9 @@ namespace Orchard.Modules.Data.Migration {
|
|||||||
private readonly IDataMigrationManager _dataMigrationManager;
|
private readonly IDataMigrationManager _dataMigrationManager;
|
||||||
private readonly WorkContext _workContext;
|
private readonly WorkContext _workContext;
|
||||||
|
|
||||||
public DataMigrationNotificationProvider(IDataMigrationManager dataMigrationManager, WorkContext workContext) {
|
public DataMigrationNotificationProvider(IDataMigrationManager dataMigrationManager, IWorkContextAccessor workContextAccessor) {
|
||||||
_dataMigrationManager = dataMigrationManager;
|
_dataMigrationManager = dataMigrationManager;
|
||||||
_workContext = workContext;
|
_workContext = workContextAccessor.GetContext();
|
||||||
|
|
||||||
T = NullLocalizer.Instance;
|
T = NullLocalizer.Instance;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,11 +42,11 @@ namespace Orchard.PublishLater.Drivers {
|
|||||||
protected override DriverResult Display(PublishLaterPart part, string displayType, dynamic shapeHelper) {
|
protected override DriverResult Display(PublishLaterPart part, string displayType, dynamic shapeHelper) {
|
||||||
return Combined(
|
return Combined(
|
||||||
ContentShape("Parts_PublishLater_Metadata",
|
ContentShape("Parts_PublishLater_Metadata",
|
||||||
() => shapeHelper.Parts_PublishLater_Metadata(ContentPart: part, ScheduledPublishUtc: part.ScheduledPublishUtc.Value)),
|
() => shapeHelper.Parts_PublishLater_Metadata(ScheduledPublishUtc: part.ScheduledPublishUtc.Value)),
|
||||||
ContentShape("Parts_PublishLater_Metadata_Summary",
|
ContentShape("Parts_PublishLater_Metadata_Summary",
|
||||||
() => shapeHelper.Parts_PublishLater_Metadata_Summary(ContentPart: part, ScheduledPublishUtc: part.ScheduledPublishUtc.Value)),
|
() => shapeHelper.Parts_PublishLater_Metadata_Summary(ScheduledPublishUtc: part.ScheduledPublishUtc.Value)),
|
||||||
ContentShape("Parts_PublishLater_Metadata_SummaryAdmin",
|
ContentShape("Parts_PublishLater_Metadata_SummaryAdmin",
|
||||||
() => shapeHelper.Parts_PublishLater_Metadata_SummaryAdmin(ContentPart: part, ScheduledPublishUtc: part.ScheduledPublishUtc.Value))
|
() => shapeHelper.Parts_PublishLater_Metadata_SummaryAdmin(ScheduledPublishUtc: part.ScheduledPublishUtc.Value))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace Orchard.Tags.Drivers {
|
|||||||
|
|
||||||
protected override DriverResult Display(TagsPart part, string displayType, dynamic shapeHelper) {
|
protected override DriverResult Display(TagsPart part, string displayType, dynamic shapeHelper) {
|
||||||
return ContentShape("Parts_Tags_ShowTags",
|
return ContentShape("Parts_Tags_ShowTags",
|
||||||
() => shapeHelper.Parts_Tags_ShowTags(ContentPart: part, Tags: part.CurrentTags));
|
() => shapeHelper.Parts_Tags_ShowTags(Tags: part.CurrentTags));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override DriverResult Editor(TagsPart part, dynamic shapeHelper) {
|
protected override DriverResult Editor(TagsPart part, dynamic shapeHelper) {
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
using System;
|
||||||
|
using System.Web.Security;
|
||||||
|
using Orchard.ContentManagement.Drivers;
|
||||||
|
using Orchard.Users.Models;
|
||||||
|
|
||||||
|
namespace Orchard.Users.Drivers {
|
||||||
|
public class UserPartDriver : ContentPartDriver<UserPart> {
|
||||||
|
|
||||||
|
protected override void Importing(UserPart part, ContentManagement.Handlers.ImportContentContext context) {
|
||||||
|
part.Record.Email = context.Attribute(part.PartDefinition.Name, "Email");
|
||||||
|
part.Record.EmailChallengeToken = context.Attribute(part.PartDefinition.Name, "EmailChallengeToken");
|
||||||
|
part.Record.EmailStatus = (UserStatus)Enum.Parse(typeof(UserStatus), context.Attribute(part.PartDefinition.Name, "EmailStatus"));
|
||||||
|
part.Record.HashAlgorithm = context.Attribute(part.PartDefinition.Name, "HashAlgorithm");
|
||||||
|
part.Record.NormalizedUserName = context.Attribute(part.PartDefinition.Name, "NormalizedUserName");
|
||||||
|
part.Record.Password = context.Attribute(part.PartDefinition.Name, "Password");
|
||||||
|
part.Record.PasswordFormat = (MembershipPasswordFormat)Enum.Parse(typeof(MembershipPasswordFormat), context.Attribute(part.PartDefinition.Name, "PasswordFormat"));
|
||||||
|
part.Record.PasswordSalt = context.Attribute(part.PartDefinition.Name, "PasswordSalt");
|
||||||
|
part.Record.RegistrationStatus = (UserStatus)Enum.Parse(typeof(UserStatus), context.Attribute(part.PartDefinition.Name, "RegistrationStatus"));
|
||||||
|
part.Record.UserName = context.Attribute(part.PartDefinition.Name, "UserName");
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Exporting(UserPart part, ContentManagement.Handlers.ExportContentContext context) {
|
||||||
|
context.Element(part.PartDefinition.Name).SetAttributeValue("Email", part.Record.Email);
|
||||||
|
context.Element(part.PartDefinition.Name).SetAttributeValue("EmailChallengeToken", part.Record.EmailChallengeToken);
|
||||||
|
context.Element(part.PartDefinition.Name).SetAttributeValue("EmailStatus", part.Record.EmailStatus);
|
||||||
|
context.Element(part.PartDefinition.Name).SetAttributeValue("HashAlgorithm", part.Record.HashAlgorithm);
|
||||||
|
context.Element(part.PartDefinition.Name).SetAttributeValue("NormalizedUserName", part.Record.NormalizedUserName);
|
||||||
|
context.Element(part.PartDefinition.Name).SetAttributeValue("Password", part.Record.Password);
|
||||||
|
context.Element(part.PartDefinition.Name).SetAttributeValue("PasswordFormat", part.Record.PasswordFormat);
|
||||||
|
context.Element(part.PartDefinition.Name).SetAttributeValue("PasswordSalt", part.Record.PasswordSalt);
|
||||||
|
context.Element(part.PartDefinition.Name).SetAttributeValue("RegistrationStatus", part.Record.RegistrationStatus);
|
||||||
|
context.Element(part.PartDefinition.Name).SetAttributeValue("UserName", part.Record.UserName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
using Orchard.Data.Migration;
|
using Orchard.ContentManagement.MetaData;
|
||||||
|
using Orchard.Data.Migration;
|
||||||
|
using Orchard.Core.Contents.Extensions;
|
||||||
|
|
||||||
namespace Orchard.Users {
|
namespace Orchard.Users {
|
||||||
public class UsersDataMigration : DataMigrationImpl {
|
public class UsersDataMigration : DataMigrationImpl {
|
||||||
@@ -34,5 +36,11 @@ namespace Orchard.Users {
|
|||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int UpdateFrom1() {
|
||||||
|
ContentDefinitionManager.AlterTypeDefinition("User", cfg => cfg.Creatable(false));
|
||||||
|
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -58,6 +58,7 @@
|
|||||||
<Compile Include="Commands\UserCommands.cs" />
|
<Compile Include="Commands\UserCommands.cs" />
|
||||||
<Compile Include="Controllers\AccountController.cs" />
|
<Compile Include="Controllers\AccountController.cs" />
|
||||||
<Compile Include="Controllers\AdminController.cs" />
|
<Compile Include="Controllers\AdminController.cs" />
|
||||||
|
<Compile Include="Drivers\UserPartDriver.cs" />
|
||||||
<Compile Include="Migrations.cs" />
|
<Compile Include="Migrations.cs" />
|
||||||
<Compile Include="Events\UserContext.cs" />
|
<Compile Include="Events\UserContext.cs" />
|
||||||
<Compile Include="Handlers\UserMessagesAlteration.cs" />
|
<Compile Include="Handlers\UserMessagesAlteration.cs" />
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ namespace Orchard.Warmup.Services {
|
|||||||
private readonly IOrchardServices _orchardServices;
|
private readonly IOrchardServices _orchardServices;
|
||||||
private readonly WorkContext _workContext;
|
private readonly WorkContext _workContext;
|
||||||
|
|
||||||
public SettingsBanner(IOrchardServices orchardServices, WorkContext workContext) {
|
public SettingsBanner(IOrchardServices orchardServices, IWorkContextAccessor workContextAccessor) {
|
||||||
_orchardServices = orchardServices;
|
_orchardServices = orchardServices;
|
||||||
_workContext = workContext;
|
_workContext = workContextAccessor.GetContext();
|
||||||
T = NullLocalizer.Instance;
|
T = NullLocalizer.Instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -16,15 +16,27 @@ namespace Orchard.ContentManagement.Drivers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DriverResult IContentFieldDriver.BuildDisplayShape(BuildDisplayContext context) {
|
DriverResult IContentFieldDriver.BuildDisplayShape(BuildDisplayContext context) {
|
||||||
return Process(context.ContentItem, (part, field) => Display(part, field, context.DisplayType, context.New));
|
return Process(context.ContentItem, (part, field) => {
|
||||||
|
context.ContentPart = part;
|
||||||
|
context.ContentField = field;
|
||||||
|
return Display(part, field, context.DisplayType, context.New);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
DriverResult IContentFieldDriver.BuildEditorShape(BuildEditorContext context) {
|
DriverResult IContentFieldDriver.BuildEditorShape(BuildEditorContext context) {
|
||||||
return Process(context.ContentItem, (part, field) => Editor(part, field, context.New));
|
return Process(context.ContentItem, (part, field) => {
|
||||||
|
context.ContentPart = part;
|
||||||
|
context.ContentField = field;
|
||||||
|
return Editor(part, field, context.New);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
DriverResult IContentFieldDriver.UpdateEditorShape(UpdateEditorContext context) {
|
DriverResult IContentFieldDriver.UpdateEditorShape(UpdateEditorContext context) {
|
||||||
return Process(context.ContentItem, (part, field) => Editor(part, field, context.Updater, context.New));
|
return Process(context.ContentItem, (part, field) => {
|
||||||
|
context.ContentPart = part;
|
||||||
|
context.ContentField = field;
|
||||||
|
return Editor(part, field, context.Updater, context.New);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void IContentFieldDriver.Importing(ImportContentContext context) {
|
void IContentFieldDriver.Importing(ImportContentContext context) {
|
||||||
@@ -75,7 +87,7 @@ namespace Orchard.ContentManagement.Drivers {
|
|||||||
return contentFieldInfo;
|
return contentFieldInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void GetContentItemMetadata(ContentPart part, TField field, ContentItemMetadata metadata) { return; }
|
protected virtual void GetContentItemMetadata(ContentPart part, TField field, ContentItemMetadata metadata) { }
|
||||||
|
|
||||||
protected virtual DriverResult Display(ContentPart part, TField field, string displayType, dynamic shapeHelper) { return null; }
|
protected virtual DriverResult Display(ContentPart part, TField field, string displayType, dynamic shapeHelper) { return null; }
|
||||||
protected virtual DriverResult Editor(ContentPart part, TField field, dynamic shapeHelper) { return null; }
|
protected virtual DriverResult Editor(ContentPart part, TField field, dynamic shapeHelper) { return null; }
|
||||||
@@ -105,19 +117,34 @@ namespace Orchard.ContentManagement.Drivers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private ContentShapeResult ContentShapeImplementation(string shapeType, string differentiator, Func<BuildShapeContext, object> shapeBuilder) {
|
private ContentShapeResult ContentShapeImplementation(string shapeType, string differentiator, Func<BuildShapeContext, object> shapeBuilder) {
|
||||||
return new ContentShapeResult(shapeType, Prefix, ctx => AddAlternates(shapeBuilder(ctx), differentiator)).Differentiator(differentiator);
|
return new ContentShapeResult(shapeType, Prefix, ctx => AddAlternates(shapeBuilder(ctx), ctx, differentiator)).Differentiator(differentiator);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static object AddAlternates(dynamic shape, string differentiator) {
|
private static object AddAlternates(dynamic shape, BuildShapeContext ctx, string differentiator) {
|
||||||
// automatically add shape alternates for shapes added by fields
|
// automatically add shape alternates for shapes added by fields
|
||||||
// for fields on dynamic parts the part name is the same as the content type name
|
// for fields on dynamic parts the part name is the same as the content type name
|
||||||
|
|
||||||
ShapeMetadata metadata = shape.Metadata;
|
ShapeMetadata metadata = shape.Metadata;
|
||||||
ContentPart part = shape.ContentPart;
|
|
||||||
|
// if no ContentField property has been set, assign it
|
||||||
|
if (shape.ContentPart == null) {
|
||||||
|
shape.ContentPart = ctx.ContentField;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if no ContentPart property has been set, assign it
|
||||||
|
if (shape.ContentPart == null) {
|
||||||
|
shape.ContentPart = ctx.ContentPart;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if no ContentItem property has been set, assign it
|
||||||
|
if (shape.ContentItem == null) {
|
||||||
|
shape.ContentItem = ctx.ContentItem;
|
||||||
|
}
|
||||||
|
|
||||||
var shapeType = metadata.Type;
|
var shapeType = metadata.Type;
|
||||||
var fieldName = differentiator ?? String.Empty;
|
var fieldName = differentiator ?? String.Empty;
|
||||||
var partName = part != null ? part.PartDefinition.Name : String.Empty;
|
var partName = shape.ContentPart.PartDefinition.Name;
|
||||||
var contentType = part != null ? part.ContentItem.ContentType : String.Empty;
|
var contentType = shape.ContentItem.ContentType;
|
||||||
var dynamicType = string.Equals(partName, contentType, StringComparison.Ordinal);
|
var dynamicType = string.Equals(partName, contentType, StringComparison.Ordinal);
|
||||||
|
|
||||||
// [ShapeType__FieldName] e.g. Fields/Common.Text-Teaser
|
// [ShapeType__FieldName] e.g. Fields/Common.Text-Teaser
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Globalization;
|
||||||
using Orchard.ContentManagement.Handlers;
|
using Orchard.ContentManagement.Handlers;
|
||||||
using Orchard.ContentManagement.MetaData;
|
using Orchard.ContentManagement.MetaData;
|
||||||
using Orchard.DisplayManagement;
|
using Orchard.DisplayManagement;
|
||||||
@@ -17,17 +18,38 @@ namespace Orchard.ContentManagement.Drivers {
|
|||||||
|
|
||||||
DriverResult IContentPartDriver.BuildDisplay(BuildDisplayContext context) {
|
DriverResult IContentPartDriver.BuildDisplay(BuildDisplayContext context) {
|
||||||
var part = context.ContentItem.As<TContent>();
|
var part = context.ContentItem.As<TContent>();
|
||||||
return part == null ? null : Display(part, context.DisplayType, context.New);
|
|
||||||
|
if(part == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
context.ContentPart = part;
|
||||||
|
|
||||||
|
return Display(part, context.DisplayType, context.New);
|
||||||
}
|
}
|
||||||
|
|
||||||
DriverResult IContentPartDriver.BuildEditor(BuildEditorContext context) {
|
DriverResult IContentPartDriver.BuildEditor(BuildEditorContext context) {
|
||||||
var part = context.ContentItem.As<TContent>();
|
var part = context.ContentItem.As<TContent>();
|
||||||
return part == null ? null : Editor(part, context.New);
|
|
||||||
|
if (part == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
context.ContentPart = part;
|
||||||
|
|
||||||
|
return Editor(part, context.New);
|
||||||
}
|
}
|
||||||
|
|
||||||
DriverResult IContentPartDriver.UpdateEditor(UpdateEditorContext context) {
|
DriverResult IContentPartDriver.UpdateEditor(UpdateEditorContext context) {
|
||||||
var part = context.ContentItem.As<TContent>();
|
var part = context.ContentItem.As<TContent>();
|
||||||
return part == null ? null : Editor(part, context.Updater, context.New);
|
|
||||||
|
if (part == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
context.ContentPart = part;
|
||||||
|
|
||||||
|
return Editor(part, context.Updater, context.New);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IContentPartDriver.Importing(ImportContentContext context) {
|
void IContentPartDriver.Importing(ImportContentContext context) {
|
||||||
@@ -54,16 +76,16 @@ namespace Orchard.ContentManagement.Drivers {
|
|||||||
Exported(part, context);
|
Exported(part, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void GetContentItemMetadata(TContent context, ContentItemMetadata metadata) { return; }
|
protected virtual void GetContentItemMetadata(TContent context, ContentItemMetadata metadata) {}
|
||||||
|
|
||||||
protected virtual DriverResult Display(TContent part, string displayType, dynamic shapeHelper) { return null; }
|
protected virtual DriverResult Display(TContent part, string displayType, dynamic shapeHelper) { return null; }
|
||||||
protected virtual DriverResult Editor(TContent part, dynamic shapeHelper) { return null; }
|
protected virtual DriverResult Editor(TContent part, dynamic shapeHelper) { return null; }
|
||||||
protected virtual DriverResult Editor(TContent part, IUpdateModel updater, dynamic shapeHelper) { return null; }
|
protected virtual DriverResult Editor(TContent part, IUpdateModel updater, dynamic shapeHelper) { return null; }
|
||||||
|
|
||||||
protected virtual void Importing(TContent part, ImportContentContext context) { return; }
|
protected virtual void Importing(TContent part, ImportContentContext context) {}
|
||||||
protected virtual void Imported(TContent part, ImportContentContext context) { return; }
|
protected virtual void Imported(TContent part, ImportContentContext context) {}
|
||||||
protected virtual void Exporting(TContent part, ExportContentContext context) { return; }
|
protected virtual void Exporting(TContent part, ExportContentContext context) {}
|
||||||
protected virtual void Exported(TContent part, ExportContentContext context) { return; }
|
protected virtual void Exported(TContent part, ExportContentContext context) {}
|
||||||
|
|
||||||
[Obsolete("Provided while transitioning to factory variations")]
|
[Obsolete("Provided while transitioning to factory variations")]
|
||||||
public ContentShapeResult ContentShape(IShape shape) {
|
public ContentShapeResult ContentShape(IShape shape) {
|
||||||
@@ -79,25 +101,29 @@ namespace Orchard.ContentManagement.Drivers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private ContentShapeResult ContentShapeImplementation(string shapeType, Func<BuildShapeContext, object> shapeBuilder) {
|
private ContentShapeResult ContentShapeImplementation(string shapeType, Func<BuildShapeContext, object> shapeBuilder) {
|
||||||
return new ContentShapeResult(shapeType, Prefix, ctx => AddAlternates(shapeBuilder(ctx)));
|
return new ContentShapeResult(shapeType, Prefix, ctx => AddAlternates(shapeBuilder(ctx), ctx));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static object AddAlternates(dynamic shape) {
|
private static dynamic AddAlternates(dynamic shape, BuildShapeContext ctx) {
|
||||||
ShapeMetadata metadata = shape.Metadata;
|
ShapeMetadata metadata = shape.Metadata;
|
||||||
ContentPart part = shape.ContentPart;
|
|
||||||
var id = part != null ? part.ContentItem.Id.ToString() : String.Empty;
|
// if no ContentPart property has been set, assign it
|
||||||
|
if (shape.ContentPart == null) {
|
||||||
|
shape.ContentPart = ctx.ContentPart;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if no ContentItem property has been set, assign it
|
||||||
|
if (shape.ContentItem == null) {
|
||||||
|
shape.ContentItem = ctx.ContentItem;
|
||||||
|
}
|
||||||
|
|
||||||
var shapeType = metadata.Type;
|
var shapeType = metadata.Type;
|
||||||
var contentType = part != null ? part.ContentItem.ContentType : String.Empty;
|
|
||||||
|
|
||||||
// [ShapeType]__[Id] e.g. Parts/Common.Metadata-42
|
// [ShapeType]__[Id] e.g. Parts/Common.Metadata-42
|
||||||
if ( !string.IsNullOrEmpty(id) ) {
|
metadata.Alternates.Add(shapeType + "__" + ctx.ContentItem.Id.ToString(CultureInfo.InvariantCulture));
|
||||||
metadata.Alternates.Add(shapeType + "__" + id);
|
|
||||||
}
|
|
||||||
|
|
||||||
// [ShapeType]__[ContentType] e.g. Parts/Common.Metadata-BlogPost
|
// [ShapeType]__[ContentType] e.g. Parts/Common.Metadata-BlogPost
|
||||||
if ( !string.IsNullOrEmpty(contentType) ) {
|
metadata.Alternates.Add(shapeType + "__" + ctx.ContentItem.ContentType);
|
||||||
metadata.Alternates.Add(shapeType + "__" + contentType);
|
|
||||||
}
|
|
||||||
|
|
||||||
return shape;
|
return shape;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using JetBrains.Annotations;
|
|
||||||
using Orchard.ContentManagement.Handlers;
|
using Orchard.ContentManagement.Handlers;
|
||||||
using Orchard.ContentManagement.MetaData;
|
using Orchard.ContentManagement.MetaData;
|
||||||
using Orchard.Logging;
|
using Orchard.Logging;
|
||||||
|
|
||||||
namespace Orchard.ContentManagement.Drivers.Coordinators {
|
namespace Orchard.ContentManagement.Drivers.Coordinators {
|
||||||
[UsedImplicitly]
|
/// <summary>
|
||||||
|
/// This component coordinates how parts are taking part in the rendering when some content needs to be rendered.
|
||||||
|
/// It will dispatch BuildDisplay/BuildEditor to all <see cref="IContentPartDriver"/> implementations.
|
||||||
|
/// </summary>
|
||||||
public class ContentPartDriverCoordinator : ContentHandlerBase {
|
public class ContentPartDriverCoordinator : ContentHandlerBase {
|
||||||
private readonly IEnumerable<IContentPartDriver> _drivers;
|
private readonly IEnumerable<IContentPartDriver> _drivers;
|
||||||
private readonly IContentDefinitionManager _contentDefinitionManager;
|
private readonly IContentDefinitionManager _contentDefinitionManager;
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
using System;
|
using System;
|
||||||
using Orchard.DisplayManagement;
|
using Orchard.DisplayManagement;
|
||||||
using Orchard.DisplayManagement.Descriptors;
|
using Orchard.DisplayManagement.Descriptors;
|
||||||
using Orchard.DisplayManagement.Descriptors.ShapePlacementStrategy;
|
|
||||||
|
|
||||||
namespace Orchard.ContentManagement.Handlers {
|
namespace Orchard.ContentManagement.Handlers {
|
||||||
public class BuildShapeContext {
|
public class BuildShapeContext {
|
||||||
protected BuildShapeContext(IShape shape, IContent content, string groupId, IShapeFactory shapeFactory) {
|
protected BuildShapeContext(IShape shape, IContent content, string groupId, IShapeFactory shapeFactory) {
|
||||||
Shape = shape;
|
Shape = shape;
|
||||||
|
Content = content;
|
||||||
ContentItem = content.ContentItem;
|
ContentItem = content.ContentItem;
|
||||||
New = shapeFactory;
|
New = shapeFactory;
|
||||||
GroupId = groupId;
|
GroupId = groupId;
|
||||||
@@ -14,7 +14,10 @@ namespace Orchard.ContentManagement.Handlers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public dynamic Shape { get; private set; }
|
public dynamic Shape { get; private set; }
|
||||||
|
public IContent Content { get; private set; }
|
||||||
public ContentItem ContentItem { get; private set; }
|
public ContentItem ContentItem { get; private set; }
|
||||||
|
public ContentPart ContentPart { get; set; }
|
||||||
|
public ContentField ContentField { get; set; }
|
||||||
public dynamic New { get; private set; }
|
public dynamic New { get; private set; }
|
||||||
public string GroupId { get; private set; }
|
public string GroupId { get; private set; }
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ namespace Orchard.DisplayManagement.Descriptors.ShapeAttributeStrategy {
|
|||||||
ShapeAttributeOccurrence attributeOccurrence,
|
ShapeAttributeOccurrence attributeOccurrence,
|
||||||
ShapeDescriptor descriptor) {
|
ShapeDescriptor descriptor) {
|
||||||
return context => {
|
return context => {
|
||||||
var serviceInstance = _componentContext.Resolve(attributeOccurrence.Registration, Enumerable.Empty<Parameter>());
|
var serviceInstance = _componentContext.ResolveComponent(attributeOccurrence.Registration, Enumerable.Empty<Parameter>());
|
||||||
|
|
||||||
// oversimplification for the sake of evolving
|
// oversimplification for the sake of evolving
|
||||||
return PerformInvoke(context, attributeOccurrence.MethodInfo, serviceInstance);
|
return PerformInvoke(context, attributeOccurrence.MethodInfo, serviceInstance);
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ namespace Orchard.Environment.AutofacUtil.DynamicProxy2 {
|
|||||||
_dynamicProxyContext = dynamicProxyContext;
|
_dynamicProxyContext = dynamicProxyContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<ConstructorInfo> FindConstructors(Type targetType) {
|
public ConstructorInfo[] FindConstructors(Type targetType) {
|
||||||
Type proxyType;
|
Type proxyType;
|
||||||
if (_dynamicProxyContext.TryGetProxy(targetType, out proxyType)) {
|
if (_dynamicProxyContext.TryGetProxy(targetType, out proxyType)) {
|
||||||
return _constructorFinder.FindConstructors(proxyType);
|
return _constructorFinder.FindConstructors(proxyType);
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace Orchard.Environment.AutofacUtil.DynamicProxy2 {
|
|||||||
object value;
|
object value;
|
||||||
if (e.Component.Metadata.TryGetValue(InterceptorServicesKey, out value)) {
|
if (e.Component.Metadata.TryGetValue(InterceptorServicesKey, out value)) {
|
||||||
var interceptorServices = (IEnumerable<Service>)value;
|
var interceptorServices = (IEnumerable<Service>)value;
|
||||||
var interceptors = interceptorServices.Select(service => e.Context.Resolve(service)).Cast<IInterceptor>().ToArray();
|
var interceptors = interceptorServices.Select(service => e.Context.ResolveService(service)).Cast<IInterceptor>().ToArray();
|
||||||
var parameter = new PositionalParameter(0, interceptors);
|
var parameter = new PositionalParameter(0, interceptors);
|
||||||
e.Parameters = new[] { parameter }.Concat(e.Parameters).ToArray();
|
e.Parameters = new[] { parameter }.Concat(e.Parameters).ToArray();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Autofac;
|
using Autofac;
|
||||||
using Autofac.Core;
|
using Autofac.Core;
|
||||||
|
using Autofac.Core.Lifetime;
|
||||||
|
using Autofac.Core.Resolving;
|
||||||
|
|
||||||
namespace Orchard.Environment.AutofacUtil {
|
namespace Orchard.Environment.AutofacUtil {
|
||||||
public class LifetimeScopeContainer : IContainer {
|
public class LifetimeScopeContainer : IContainer {
|
||||||
@@ -11,8 +13,8 @@ namespace Orchard.Environment.AutofacUtil {
|
|||||||
_lifetimeScope = lifetimeScope;
|
_lifetimeScope = lifetimeScope;
|
||||||
}
|
}
|
||||||
|
|
||||||
public object Resolve(IComponentRegistration registration, IEnumerable<Parameter> parameters) {
|
public object ResolveComponent(IComponentRegistration registration, IEnumerable<Parameter> parameters) {
|
||||||
return _lifetimeScope.Resolve(registration, parameters);
|
return _lifetimeScope.ResolveComponent(registration, parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IComponentRegistry ComponentRegistry {
|
public IComponentRegistry ComponentRegistry {
|
||||||
@@ -45,5 +47,9 @@ namespace Orchard.Environment.AutofacUtil {
|
|||||||
public object Tag {
|
public object Tag {
|
||||||
get { return _lifetimeScope.Tag; }
|
get { return _lifetimeScope.Tag; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public event EventHandler<LifetimeScopeBeginningEventArgs> ChildLifetimeScopeBeginning;
|
||||||
|
public event EventHandler<LifetimeScopeEndingEventArgs> CurrentScopeEnding;
|
||||||
|
public event EventHandler<ResolveOperationBeginningEventArgs> ResolveOperationBeginning;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -21,7 +21,7 @@ namespace Orchard.Environment {
|
|||||||
value = null;
|
value = null;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return key == null ? scope.TryResolve(serviceType, out value) : scope.TryResolve(key, serviceType, out value);
|
return key == null ? scope.TryResolve(serviceType, out value) : scope.TryResolveKeyed(key, serviceType, out value);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TryResolve(string key, Type serviceType, out object value) {
|
bool TryResolve(string key, Type serviceType, out object value) {
|
||||||
|
|||||||
@@ -45,10 +45,12 @@ namespace Orchard.Environment.ShellBuilders {
|
|||||||
if (descriptor.Features.Any(feature => feature.Name == "Orchard.Framework"))
|
if (descriptor.Features.Any(feature => feature.Name == "Orchard.Framework"))
|
||||||
features = features.Concat(BuiltinFeatures());
|
features = features.Concat(BuiltinFeatures());
|
||||||
|
|
||||||
var modules = BuildBlueprint(features, IsModule, BuildModule);
|
var excludedTypes = GetExcludedTypes(features);
|
||||||
var dependencies = BuildBlueprint(features, IsDependency, (t, f) => BuildDependency(t, f, descriptor));
|
|
||||||
var controllers = BuildBlueprint(features, IsController, BuildController);
|
var modules = BuildBlueprint(features, IsModule, BuildModule, excludedTypes);
|
||||||
var records = BuildBlueprint(features, IsRecord, (t, f) => BuildRecord(t, f, settings));
|
var dependencies = BuildBlueprint(features, IsDependency, (t, f) => BuildDependency(t, f, descriptor), excludedTypes);
|
||||||
|
var controllers = BuildBlueprint(features, IsController, BuildController, excludedTypes);
|
||||||
|
var records = BuildBlueprint(features, IsRecord, (t, f) => BuildRecord(t, f, settings), excludedTypes);
|
||||||
|
|
||||||
var result = new ShellBlueprint {
|
var result = new ShellBlueprint {
|
||||||
Settings = settings,
|
Settings = settings,
|
||||||
@@ -62,6 +64,21 @@ namespace Orchard.Environment.ShellBuilders {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static IEnumerable<string> GetExcludedTypes(IEnumerable<Feature> features) {
|
||||||
|
var excludedTypes = new HashSet<string>();
|
||||||
|
|
||||||
|
// Identify replaced types
|
||||||
|
foreach (Feature feature in features) {
|
||||||
|
foreach (Type type in feature.ExportedTypes) {
|
||||||
|
foreach (OrchardSuppressDependencyAttribute replacedType in type.GetCustomAttributes(typeof(OrchardSuppressDependencyAttribute), false)) {
|
||||||
|
excludedTypes.Add(replacedType.FullName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return excludedTypes;
|
||||||
|
}
|
||||||
|
|
||||||
private static IEnumerable<Feature> BuiltinFeatures() {
|
private static IEnumerable<Feature> BuiltinFeatures() {
|
||||||
yield return new Feature {
|
yield return new Feature {
|
||||||
Descriptor = new FeatureDescriptor {
|
Descriptor = new FeatureDescriptor {
|
||||||
@@ -81,17 +98,8 @@ namespace Orchard.Environment.ShellBuilders {
|
|||||||
private static IEnumerable<T> BuildBlueprint<T>(
|
private static IEnumerable<T> BuildBlueprint<T>(
|
||||||
IEnumerable<Feature> features,
|
IEnumerable<Feature> features,
|
||||||
Func<Type, bool> predicate,
|
Func<Type, bool> predicate,
|
||||||
Func<Type, Feature, T> selector) {
|
Func<Type, Feature, T> selector,
|
||||||
HashSet<string> excludedTypes = new HashSet<string>();
|
IEnumerable<string> excludedTypes ) {
|
||||||
|
|
||||||
// Identify replaced types
|
|
||||||
foreach(Feature feature in features) {
|
|
||||||
foreach (Type type in feature.ExportedTypes) {
|
|
||||||
foreach (OrchardSuppressDependencyAttribute replacedType in type.GetCustomAttributes(typeof(OrchardSuppressDependencyAttribute), false)) {
|
|
||||||
excludedTypes.Add(replacedType.FullName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load types excluding the replaced types
|
// Load types excluding the replaced types
|
||||||
return features.SelectMany(
|
return features.SelectMany(
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ namespace Orchard.Environment.ShellBuilders {
|
|||||||
.OnActivating(e => {
|
.OnActivating(e => {
|
||||||
var controller = e.Instance as Controller;
|
var controller = e.Instance as Controller;
|
||||||
if (controller != null)
|
if (controller != null)
|
||||||
controller.ActionInvoker = (IActionInvoker)e.Context.Resolve(new TypedService(typeof(IActionInvoker)));
|
controller.ActionInvoker = (IActionInvoker)e.Context.ResolveService(new TypedService(typeof(IActionInvoker)));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ namespace Orchard.Environment {
|
|||||||
IHttpContextAccessor httpContextAccessor,
|
IHttpContextAccessor httpContextAccessor,
|
||||||
ILifetimeScope lifetimeScope) {
|
ILifetimeScope lifetimeScope) {
|
||||||
_httpContextAccessor = httpContextAccessor;
|
_httpContextAccessor = httpContextAccessor;
|
||||||
_lifetimeScope = lifetimeScope;
|
_lifetimeScope = lifetimeScope.Resolve<ILifetimeScope>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public WorkContext GetContext(HttpContextBase httpContext) {
|
public WorkContext GetContext(HttpContextBase httpContext) {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ namespace Orchard.Environment {
|
|||||||
.As<IWorkContextAccessor>()
|
.As<IWorkContextAccessor>()
|
||||||
.InstancePerMatchingLifetimeScope("shell");
|
.InstancePerMatchingLifetimeScope("shell");
|
||||||
|
|
||||||
builder.Register(ctx => new WorkContextImplementation(ctx))
|
builder.Register(ctx => new WorkContextImplementation(ctx.Resolve<IComponentContext>()))
|
||||||
.As<WorkContext>()
|
.As<WorkContext>()
|
||||||
.InstancePerMatchingLifetimeScope("work");
|
.InstancePerMatchingLifetimeScope("work");
|
||||||
|
|
||||||
@@ -104,7 +104,7 @@ namespace Orchard.Environment {
|
|||||||
|
|
||||||
T value;
|
T value;
|
||||||
if (!workValues.Values.TryGetValue(w, out value)) {
|
if (!workValues.Values.TryGetValue(w, out value)) {
|
||||||
value = (T)workValues.ComponentContext.Resolve(valueRegistration, p);
|
value = (T)workValues.ComponentContext.ResolveComponent(valueRegistration, p);
|
||||||
workValues.Values[w] = value;
|
workValues.Values[w] = value;
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ namespace Orchard.FileSystems.VirtualPath {
|
|||||||
/// Note: This method doesn't detect all cases of malformed paths, it merely checks
|
/// Note: This method doesn't detect all cases of malformed paths, it merely checks
|
||||||
/// for *some* cases of malformed paths, so this is not a replacement for full virtual path
|
/// for *some* cases of malformed paths, so this is not a replacement for full virtual path
|
||||||
/// verification through VirtualPathUtilty methods.
|
/// verification through VirtualPathUtilty methods.
|
||||||
/// In other wors, !IsMalformed does *not* imply "IsWellformed".
|
/// In other words, !IsMalformed does *not* imply "IsWellformed".
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsMalformedVirtualPath(string virtualPath) {
|
public bool IsMalformedVirtualPath(string virtualPath) {
|
||||||
if (string.IsNullOrEmpty(virtualPath))
|
if (string.IsNullOrEmpty(virtualPath))
|
||||||
@@ -137,6 +137,10 @@ namespace Orchard.FileSystems.VirtualPath {
|
|||||||
return HostingEnvironment.VirtualPathProvider.GetFileHash(virtualPath, dependencies);
|
return HostingEnvironment.VirtualPathProvider.GetFileHash(virtualPath, dependencies);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual void DeleteFile(string virtualPath) {
|
||||||
|
File.Delete(MapPath(virtualPath));
|
||||||
|
}
|
||||||
|
|
||||||
public virtual string MapPath(string virtualPath) {
|
public virtual string MapPath(string virtualPath) {
|
||||||
return HostingEnvironment.MapPath(virtualPath);
|
return HostingEnvironment.MapPath(virtualPath);
|
||||||
}
|
}
|
||||||
@@ -165,5 +169,9 @@ namespace Orchard.FileSystems.VirtualPath {
|
|||||||
public virtual void CreateDirectory(string virtualPath) {
|
public virtual void CreateDirectory(string virtualPath) {
|
||||||
Directory.CreateDirectory(MapPath(virtualPath));
|
Directory.CreateDirectory(MapPath(virtualPath));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual void DeleteDirectory(string virtualPath) {
|
||||||
|
Directory.Delete(MapPath(virtualPath));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -17,10 +17,12 @@ namespace Orchard.FileSystems.VirtualPath {
|
|||||||
DateTime GetFileLastWriteTimeUtc(string virtualPath);
|
DateTime GetFileLastWriteTimeUtc(string virtualPath);
|
||||||
string GetFileHash(string virtualPath);
|
string GetFileHash(string virtualPath);
|
||||||
string GetFileHash(string virtualPath, IEnumerable<string> dependencies);
|
string GetFileHash(string virtualPath, IEnumerable<string> dependencies);
|
||||||
|
void DeleteFile(string virtualPath);
|
||||||
|
|
||||||
bool DirectoryExists(string virtualPath);
|
bool DirectoryExists(string virtualPath);
|
||||||
void CreateDirectory(string virtualPath);
|
void CreateDirectory(string virtualPath);
|
||||||
string GetDirectoryName(string virtualPath);
|
string GetDirectoryName(string virtualPath);
|
||||||
|
void DeleteDirectory(string virtualPath);
|
||||||
|
|
||||||
IEnumerable<string> ListFiles(string path);
|
IEnumerable<string> ListFiles(string path);
|
||||||
IEnumerable<string> ListDirectories(string path);
|
IEnumerable<string> ListDirectories(string path);
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace Orchard.Mvc {
|
|||||||
if (workContext != null && serviceKey != null) {
|
if (workContext != null && serviceKey != null) {
|
||||||
var key = new KeyedService(serviceKey, typeof (T));
|
var key = new KeyedService(serviceKey, typeof (T));
|
||||||
object value;
|
object value;
|
||||||
if (workContext.Resolve<ILifetimeScope>().TryResolve(key, out value)) {
|
if (workContext.Resolve<ILifetimeScope>().TryResolveService(key, out value)) {
|
||||||
instance = (T) value;
|
instance = (T) value;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ using System.Linq;
|
|||||||
using System.Web;
|
using System.Web;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using System.Web.WebPages;
|
using System.Web.WebPages;
|
||||||
using Autofac;
|
|
||||||
using Orchard.DisplayManagement;
|
using Orchard.DisplayManagement;
|
||||||
using Orchard.DisplayManagement.Shapes;
|
using Orchard.DisplayManagement.Shapes;
|
||||||
using Orchard.Localization;
|
using Orchard.Localization;
|
||||||
@@ -63,10 +62,27 @@ namespace Orchard.Mvc.ViewEngines.Razor {
|
|||||||
public WorkContext WorkContext { get { return _workContext; } }
|
public WorkContext WorkContext { get { return _workContext; } }
|
||||||
|
|
||||||
public dynamic New { get { return ShapeFactory; } }
|
public dynamic New { get { return ShapeFactory; } }
|
||||||
public IDisplayHelperFactory DisplayHelperFactory { get; set; }
|
|
||||||
public IShapeFactory ShapeFactory { get; set; }
|
|
||||||
|
|
||||||
public IAuthorizer Authorizer { get; set; }
|
private IDisplayHelperFactory _displayHelperFactory;
|
||||||
|
public IDisplayHelperFactory DisplayHelperFactory {
|
||||||
|
get {
|
||||||
|
return _displayHelperFactory ?? (_displayHelperFactory = _workContext.Resolve<IDisplayHelperFactory>());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private IShapeFactory _shapeFactory;
|
||||||
|
public IShapeFactory ShapeFactory {
|
||||||
|
get {
|
||||||
|
return _shapeFactory ?? (_shapeFactory = _workContext.Resolve<IShapeFactory>());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private IAuthorizer _authorizer;
|
||||||
|
public IAuthorizer Authorizer {
|
||||||
|
get {
|
||||||
|
return _authorizer ?? (_authorizer = _workContext.Resolve<IAuthorizer>());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public ScriptRegister Script {
|
public ScriptRegister Script {
|
||||||
get {
|
get {
|
||||||
@@ -120,7 +136,6 @@ namespace Orchard.Mvc.ViewEngines.Razor {
|
|||||||
base.InitHelpers();
|
base.InitHelpers();
|
||||||
|
|
||||||
_workContext = ViewContext.GetWorkContext();
|
_workContext = ViewContext.GetWorkContext();
|
||||||
_workContext.Resolve<IComponentContext>().InjectUnsetProperties(this);
|
|
||||||
|
|
||||||
_display = DisplayHelperFactory.CreateHelper(ViewContext, this);
|
_display = DisplayHelperFactory.CreateHelper(ViewContext, this);
|
||||||
_layout = _workContext.Layout;
|
_layout = _workContext.Layout;
|
||||||
|
|||||||
@@ -35,10 +35,26 @@ namespace Orchard.Mvc {
|
|||||||
public dynamic Layout { get { return _layout; } }
|
public dynamic Layout { get { return _layout; } }
|
||||||
public WorkContext WorkContext { get { return _workContext; } }
|
public WorkContext WorkContext { get { return _workContext; } }
|
||||||
|
|
||||||
public IDisplayHelperFactory DisplayHelperFactory { get; set; }
|
private IDisplayHelperFactory _displayHelperFactory;
|
||||||
|
public IDisplayHelperFactory DisplayHelperFactory {
|
||||||
|
get {
|
||||||
|
return _displayHelperFactory ?? (_displayHelperFactory = _workContext.Resolve<IDisplayHelperFactory>());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public IAuthorizer Authorizer { get; set; }
|
private IShapeFactory _shapeFactory;
|
||||||
|
public IShapeFactory ShapeFactory {
|
||||||
|
get {
|
||||||
|
return _shapeFactory ?? (_shapeFactory = _workContext.Resolve<IShapeFactory>());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private IAuthorizer _authorizer;
|
||||||
|
public IAuthorizer Authorizer {
|
||||||
|
get {
|
||||||
|
return _authorizer ?? (_authorizer = _workContext.Resolve<IAuthorizer>());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public ResourceRegister Style {
|
public ResourceRegister Style {
|
||||||
get {
|
get {
|
||||||
@@ -51,7 +67,6 @@ namespace Orchard.Mvc {
|
|||||||
base.InitHelpers();
|
base.InitHelpers();
|
||||||
|
|
||||||
_workContext = ViewContext.GetWorkContext();
|
_workContext = ViewContext.GetWorkContext();
|
||||||
_workContext.Resolve<IComponentContext>().InjectUnsetProperties(this);
|
|
||||||
|
|
||||||
_localizer = LocalizationUtilities.Resolve(ViewContext, AppRelativeVirtualPath);
|
_localizer = LocalizationUtilities.Resolve(ViewContext, AppRelativeVirtualPath);
|
||||||
_display = DisplayHelperFactory.CreateHelper(ViewContext, this);
|
_display = DisplayHelperFactory.CreateHelper(ViewContext, this);
|
||||||
|
|||||||
@@ -27,10 +27,26 @@ namespace Orchard.Mvc {
|
|||||||
public dynamic Layout { get { return _layout; } }
|
public dynamic Layout { get { return _layout; } }
|
||||||
public WorkContext WorkContext { get { return _workContext; } }
|
public WorkContext WorkContext { get { return _workContext; } }
|
||||||
|
|
||||||
public IDisplayHelperFactory DisplayHelperFactory { get; set; }
|
private IDisplayHelperFactory _displayHelperFactory;
|
||||||
public IShapeFactory ShapeFactory { get; set; }
|
public IDisplayHelperFactory DisplayHelperFactory {
|
||||||
|
get {
|
||||||
|
return _displayHelperFactory ?? (_displayHelperFactory = _workContext.Resolve<IDisplayHelperFactory>());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public IAuthorizer Authorizer { get; set; }
|
private IShapeFactory _shapeFactory;
|
||||||
|
public IShapeFactory ShapeFactory {
|
||||||
|
get {
|
||||||
|
return _shapeFactory ?? (_shapeFactory = _workContext.Resolve<IShapeFactory>());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private IAuthorizer _authorizer;
|
||||||
|
public IAuthorizer Authorizer {
|
||||||
|
get {
|
||||||
|
return _authorizer ?? (_authorizer = _workContext.Resolve<IAuthorizer>());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public ScriptRegister Script {
|
public ScriptRegister Script {
|
||||||
get {
|
get {
|
||||||
@@ -68,7 +84,6 @@ namespace Orchard.Mvc {
|
|||||||
|
|
||||||
public override void RenderView(ViewContext viewContext) {
|
public override void RenderView(ViewContext viewContext) {
|
||||||
_workContext = viewContext.GetWorkContext();
|
_workContext = viewContext.GetWorkContext();
|
||||||
_workContext.Resolve<IComponentContext>().InjectUnsetProperties(this);
|
|
||||||
|
|
||||||
_localizer = LocalizationUtilities.Resolve(viewContext, AppRelativeVirtualPath);
|
_localizer = LocalizationUtilities.Resolve(viewContext, AppRelativeVirtualPath);
|
||||||
_display = DisplayHelperFactory.CreateHelper(viewContext, this);
|
_display = DisplayHelperFactory.CreateHelper(viewContext, this);
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace Orchard.Wcf {
|
|||||||
throw new ArgumentNullException("registration");
|
throw new ArgumentNullException("registration");
|
||||||
}
|
}
|
||||||
|
|
||||||
return _workContext.Resolve<ILifetimeScope>().Resolve(registration, Enumerable.Empty<Parameter>());
|
return _workContext.Resolve<ILifetimeScope>().ResolveComponent(registration, Enumerable.Empty<Parameter>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user