mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-19 10:07:55 +08:00
Midway through template refactoring. CURRENTLY BROKEN.
--HG-- extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4044388
This commit is contained in:
@@ -8,7 +8,7 @@ using Orchard.Models.ViewModels;
|
|||||||
namespace Orchard.Core.Common.Providers {
|
namespace Orchard.Core.Common.Providers {
|
||||||
public class BodyAspectHandler : ContentHandler {
|
public class BodyAspectHandler : ContentHandler {
|
||||||
private const string TemplatePrefix = "Body";
|
private const string TemplatePrefix = "Body";
|
||||||
private const string TemplateName = "BodyAspect";
|
private const string TemplateName = "Parts/Common.Body";
|
||||||
private const string DefaultTextEditorTemplate = "TinyMceTextEditor";
|
private const string DefaultTextEditorTemplate = "TinyMceTextEditor";
|
||||||
|
|
||||||
public BodyAspectHandler(IRepository<BodyRecord> bodyRepository) {
|
public BodyAspectHandler(IRepository<BodyRecord> bodyRepository) {
|
||||||
|
@@ -102,7 +102,7 @@ namespace Orchard.Core.Common.Providers {
|
|||||||
if (instance.Owner != null)
|
if (instance.Owner != null)
|
||||||
viewModel.Owner = instance.Owner.UserName;
|
viewModel.Owner = instance.Owner.UserName;
|
||||||
|
|
||||||
context.AddEditor(new TemplateViewModel(viewModel, "CommonAspect") { Position = "9" });
|
context.AddEditor(new TemplateViewModel(viewModel, "CommonAspect") { TemplateName="Parts/Common.Owner", Position = "9" });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -132,7 +132,7 @@ namespace Orchard.Core.Common.Providers {
|
|||||||
instance.Owner = newOwner;
|
instance.Owner = newOwner;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
context.AddEditor(new TemplateViewModel(viewModel, "CommonAspect") { Position = "9" });
|
context.AddEditor(new TemplateViewModel(viewModel, "CommonAspect") { TemplateName = "Parts/Common.Owner", Position = "9" });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -127,7 +127,6 @@
|
|||||||
<Content Include="Settings\Views\Web.config" />
|
<Content Include="Settings\Views\Web.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="Settings\Views\Admin\EditorTemplates\SettingsIndexViewModel.ascx" />
|
|
||||||
<Content Include="XmlRpc\Views\Web.config" />
|
<Content Include="XmlRpc\Views\Web.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
@@ -136,9 +135,9 @@
|
|||||||
<Content Include="Themes\Views\Admin\Index.aspx" />
|
<Content Include="Themes\Views\Admin\Index.aspx" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="Common\Views\Shared\DisplayTemplates\BodyAspect.ascx" />
|
<Content Include="Common\Views\DisplayTemplates\Parts\Common.Body.ascx" />
|
||||||
<Content Include="Common\Views\Shared\EditorTemplates\BodyAspect.ascx" />
|
<Content Include="Common\Views\EditorTemplates\Parts\Common.Body.ascx" />
|
||||||
<Content Include="Common\Views\Shared\EditorTemplates\OwnerEditorViewModel.ascx" />
|
<Content Include="Common\Views\EditorTemplates\Parts\Common.Owner.ascx" />
|
||||||
<Content Include="Themes\Styles\site.css" />
|
<Content Include="Themes\Styles\site.css" />
|
||||||
<Content Include="Themes\Views\Admin\Install.aspx" />
|
<Content Include="Themes\Views\Admin\Install.aspx" />
|
||||||
<Content Include="Themes\Views\document.aspx" />
|
<Content Include="Themes\Views\document.aspx" />
|
||||||
|
@@ -1,20 +0,0 @@
|
|||||||
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<SettingsIndexViewModel>" %>
|
|
||||||
<%@ Import Namespace="Orchard.Core.Settings.ViewModels"%>
|
|
||||||
<%@ Import Namespace="Orchard.Utility" %>
|
|
||||||
<fieldset>
|
|
||||||
<legend>Global Settings</legend>
|
|
||||||
<fieldset>
|
|
||||||
<%=Html.LabelFor(x=>x.SiteName) %>
|
|
||||||
<%=Html.EditorFor(x=>x.SiteName) %>
|
|
||||||
<%=Html.ValidationMessage("SiteName", "*") %>
|
|
||||||
</fieldset>
|
|
||||||
<fieldset>
|
|
||||||
<%=Html.LabelFor(x => x.SuperUser) %>
|
|
||||||
<%=Html.EditorFor(x=>x.SuperUser) %>
|
|
||||||
<%=Html.ValidationMessage("SuperUser", "*") %>
|
|
||||||
</fieldset>
|
|
||||||
<%=Html.EditorFor(s=>s.Id) %>
|
|
||||||
</fieldset>
|
|
||||||
<% foreach(var e in Model.EditorModel.Editors) { %>
|
|
||||||
<%=Html.EditorFor(m => e.Model, e.TemplateName, e.Prefix)%>
|
|
||||||
<% } %>
|
|
@@ -71,6 +71,7 @@
|
|||||||
<%=Html.Encode(display.Prefix)%></span>
|
<%=Html.Encode(display.Prefix)%></span>
|
||||||
<%=Html.Encode(display.Model.GetType().Name)%>
|
<%=Html.Encode(display.Model.GetType().Name)%>
|
||||||
(<%=Html.Encode(display.Model.GetType().Namespace)%>)
|
(<%=Html.Encode(display.Model.GetType().Namespace)%>)
|
||||||
|
Template:<%=Html.Encode(display.TemplateName ?? "(null)")%>
|
||||||
Prefix:<%=Html.Encode(display.Prefix ?? "(null)")%>
|
Prefix:<%=Html.Encode(display.Prefix ?? "(null)")%>
|
||||||
Zone:<%=Html.Encode(display.ZoneName ?? "(null)")%>
|
Zone:<%=Html.Encode(display.ZoneName ?? "(null)")%>
|
||||||
Position:<%=Html.Encode(display.Position ?? "(null)")%>
|
Position:<%=Html.Encode(display.Position ?? "(null)")%>
|
||||||
@@ -90,6 +91,7 @@
|
|||||||
<%=Html.Encode(editor.Prefix) %></span>
|
<%=Html.Encode(editor.Prefix) %></span>
|
||||||
<%=Html.Encode(editor.Model.GetType().Name) %>
|
<%=Html.Encode(editor.Model.GetType().Name) %>
|
||||||
(<%=Html.Encode(editor.Model.GetType().Namespace) %>)
|
(<%=Html.Encode(editor.Model.GetType().Namespace) %>)
|
||||||
|
Template:<%=Html.Encode(editor.TemplateName ?? "(null)")%>
|
||||||
Prefix:<%=Html.Encode(editor.Prefix ?? "(null)")%>
|
Prefix:<%=Html.Encode(editor.Prefix ?? "(null)")%>
|
||||||
Zone:<%=Html.Encode(editor.ZoneName ?? "(null)")%>
|
Zone:<%=Html.Encode(editor.ZoneName ?? "(null)")%>
|
||||||
Position:<%=Html.Encode(editor.Position??"(null)") %>
|
Position:<%=Html.Encode(editor.Position??"(null)") %>
|
||||||
|
@@ -45,7 +45,7 @@ namespace Orchard.Sandbox.Models {
|
|||||||
});
|
});
|
||||||
|
|
||||||
OnGetDisplayViewModel<SandboxPage>((context, page) =>
|
OnGetDisplayViewModel<SandboxPage>((context, page) =>
|
||||||
context.AddDisplay(new TemplateViewModel(page) { TemplateName = "ContentItemTitle", ZoneName = "title" }));
|
context.AddDisplay(new TemplateViewModel(page) { TemplateName = "Parts/Sandbox.Page.Title", ZoneName = "title" }));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@@ -79,9 +79,9 @@
|
|||||||
<Content Include="Views\Page\Create.aspx" />
|
<Content Include="Views\Page\Create.aspx" />
|
||||||
<Content Include="Views\Page\Show.aspx" />
|
<Content Include="Views\Page\Show.aspx" />
|
||||||
<Content Include="Views\Page\Index.aspx" />
|
<Content Include="Views\Page\Index.aspx" />
|
||||||
<Content Include="Views\Shared\DisplayTemplates\ContentItemTitle.ascx" />
|
<Content Include="Views\DisplayTemplates\Parts\Sandbox.Page.Title.ascx" />
|
||||||
<Content Include="Views\Shared\DisplayTemplates\SandboxPage.ascx" />
|
<Content Include="Views\DisplayTemplates\Items\Sandbox.Page.ascx" />
|
||||||
<Content Include="Views\Shared\DisplayTemplates\SandboxPageSummary.ascx" />
|
<Content Include="Views\DisplayTemplates\Items\Sandbox.Page.Summary.ascx" />
|
||||||
<Content Include="Views\Shared\EditorTemplates\SandboxPage.ascx" />
|
<Content Include="Views\Shared\EditorTemplates\SandboxPage.ascx" />
|
||||||
<Content Include="Views\Shared\EditorTemplates\SandboxSettingsRecord.ascx" />
|
<Content Include="Views\Shared\EditorTemplates\SandboxSettingsRecord.ascx" />
|
||||||
<Content Include="Web.config" />
|
<Content Include="Web.config" />
|
||||||
@@ -101,6 +101,8 @@
|
|||||||
<Folder Include="App_Data\" />
|
<Folder Include="App_Data\" />
|
||||||
<Folder Include="Content\" />
|
<Folder Include="Content\" />
|
||||||
<Folder Include="Scripts\" />
|
<Folder Include="Scripts\" />
|
||||||
|
<Folder Include="Views\EditorTemplates\" />
|
||||||
|
<Folder Include="Views\Shared\DisplayTemplates\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" />
|
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||||
|
@@ -2,38 +2,10 @@
|
|||||||
|
|
||||||
<%@ Import Namespace="Orchard.Sandbox.ViewModels" %>
|
<%@ Import Namespace="Orchard.Sandbox.ViewModels" %>
|
||||||
<%@ Import Namespace="Orchard.Mvc.Html" %>
|
<%@ Import Namespace="Orchard.Mvc.Html" %>
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
<h3>
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
Create Page</h3>
|
||||||
<head>
|
<%using (Html.BeginForm()) { %>
|
||||||
<title>TwoColumns</title>
|
|
||||||
<link href="<%=ResolveUrl("~/Content/Site2.css") %>" rel="stylesheet" type="text/css" />
|
<%=Html.LabelFor(x => x.Name)%><%=Html.EditorFor(x => x.Name)%>
|
||||||
</head>
|
<input type="submit" name="submit" value="Create" />
|
||||||
<body>
|
<%} %>
|
||||||
<div id="header">
|
|
||||||
<div id="innerheader">
|
|
||||||
<% Html.Include("header"); %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="page">
|
|
||||||
<div id="sideBar">
|
|
||||||
<% Html.Include("Navigation"); %>
|
|
||||||
</div>
|
|
||||||
<div id="main">
|
|
||||||
<% Html.RenderPartial("Messages", Model.Messages); %>
|
|
||||||
<h3>
|
|
||||||
Create Page</h3>
|
|
||||||
<%using (Html.BeginForm()) { %>
|
|
||||||
<ul>
|
|
||||||
<li>
|
|
||||||
<%=Html.LabelFor(x => x.Name)%><%=Html.EditorFor(x => x.Name)%></li>
|
|
||||||
<li>
|
|
||||||
<input type="submit" name="submit" value="Create" /></li>
|
|
||||||
</ul>
|
|
||||||
<%} %>
|
|
||||||
</div>
|
|
||||||
<div id="footer">
|
|
||||||
<% Html.Include("footer"); %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
@@ -2,33 +2,9 @@
|
|||||||
|
|
||||||
<%@ Import Namespace="Orchard.Sandbox.ViewModels" %>
|
<%@ Import Namespace="Orchard.Sandbox.ViewModels" %>
|
||||||
<%@ Import Namespace="Orchard.Mvc.Html" %>
|
<%@ Import Namespace="Orchard.Mvc.Html" %>
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
<h3>
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
Edit Page</h3>
|
||||||
<head>
|
<%using (Html.BeginForm()) { %>
|
||||||
<title>TwoColumns</title>
|
<%=Html.EditorForItem(Model.Page) %>
|
||||||
<link href="<%=ResolveUrl("~/Content/Site2.css") %>" rel="stylesheet" type="text/css" />
|
<input type="submit" name="submit" value="Save" />
|
||||||
</head>
|
<%} %>
|
||||||
<body>
|
|
||||||
<div id="header">
|
|
||||||
<div id="innerheader">
|
|
||||||
<% Html.Include("header"); %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="page">
|
|
||||||
<div id="sideBar">
|
|
||||||
<% Html.Include("Navigation"); %>
|
|
||||||
</div>
|
|
||||||
<div id="main">
|
|
||||||
<% Html.RenderPartial("Messages", Model.Messages); %>
|
|
||||||
<h3>Edit Page</h3>
|
|
||||||
<%using (Html.BeginForm()) { %>
|
|
||||||
<%=Html.EditorForItem(m=>m.Page) %>
|
|
||||||
<input type="submit" name="submit" value="Save" />
|
|
||||||
<%} %>
|
|
||||||
</div>
|
|
||||||
<div id="footer">
|
|
||||||
<% Html.Include("footer"); %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
@@ -2,38 +2,10 @@
|
|||||||
|
|
||||||
<%@ Import Namespace="Orchard.Sandbox.ViewModels" %>
|
<%@ Import Namespace="Orchard.Sandbox.ViewModels" %>
|
||||||
<%@ Import Namespace="Orchard.Mvc.Html" %>
|
<%@ Import Namespace="Orchard.Mvc.Html" %>
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
<h3>
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
Sandbox Pages</h3>
|
||||||
<head>
|
<p>
|
||||||
<title>TwoColumns</title>
|
<%=Html.ActionLink("Create new page", "create") %></p>
|
||||||
<link href="<%=ResolveUrl("~/Content/Site2.css") %>" rel="stylesheet" type="text/css" />
|
<%foreach (var item in Model.Pages) {%>
|
||||||
</head>
|
<%=Html.DisplayForItem(item) %>
|
||||||
<body>
|
<%}%>
|
||||||
<div id="header">
|
|
||||||
<div id="innerheader">
|
|
||||||
<% Html.Include("header"); %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="page">
|
|
||||||
<div id="sideBar">
|
|
||||||
<% Html.Include("Navigation"); %>
|
|
||||||
</div>
|
|
||||||
<div id="main">
|
|
||||||
<% Html.RenderPartial("Messages", Model.Messages); %>
|
|
||||||
<h3>
|
|
||||||
Sandbox Pages</h3>
|
|
||||||
|
|
||||||
<p><%=Html.ActionLink("Create new page", "create") %></p>
|
|
||||||
|
|
||||||
|
|
||||||
<%foreach (var item in Model.Pages) {%>
|
|
||||||
<%=Html.DisplayForItem(x=>item) %>
|
|
||||||
<%}%>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
<div id="footer">
|
|
||||||
<% Html.Include("footer"); %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
@@ -2,29 +2,4 @@
|
|||||||
|
|
||||||
<%@ Import Namespace="Orchard.Sandbox.ViewModels" %>
|
<%@ Import Namespace="Orchard.Sandbox.ViewModels" %>
|
||||||
<%@ Import Namespace="Orchard.Mvc.Html" %>
|
<%@ Import Namespace="Orchard.Mvc.Html" %>
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
<%= Html.DisplayForItem(Model.Page) %>
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
||||||
<head>
|
|
||||||
<title>TwoColumns</title>
|
|
||||||
<link href="<%=ResolveUrl("~/Content/Site2.css") %>" rel="stylesheet" type="text/css" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="header">
|
|
||||||
<div id="innerheader">
|
|
||||||
<% Html.Include("header"); %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="page">
|
|
||||||
<div id="sideBar">
|
|
||||||
<% Html.Include("Navigation"); %>
|
|
||||||
</div>
|
|
||||||
<div id="main">
|
|
||||||
<% Html.RenderPartial("Messages", Model.Messages); %>
|
|
||||||
<%= Html.DisplayForItem(m => m.Page) %>
|
|
||||||
</div>
|
|
||||||
<div id="footer">
|
|
||||||
<% Html.Include("footer"); %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
|
@@ -1,16 +1,20 @@
|
|||||||
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<BaseViewModel>" %>
|
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<BaseViewModel>" %>
|
||||||
<%@ Import Namespace="Orchard.Mvc.ViewModels"%>
|
<%@ Import Namespace="Orchard.Mvc.ViewModels" %>
|
||||||
<%@ Import Namespace="Orchard.Mvc.Html" %>
|
<%@ Import Namespace="Orchard.Mvc.Html" %>
|
||||||
|
|
||||||
<% Html.RegisterStyle(ResolveUrl("~/Themes/BlueSky/Styles/site.css")); %>
|
<% Html.RegisterStyle(ResolveUrl("~/Themes/BlueSky/Styles/site.css")); %>
|
||||||
|
|
||||||
<div class="page">
|
<div class="page">
|
||||||
<div id="header">
|
<div id="header">
|
||||||
<div id="title"><h1>My MVC Application</h1></div>
|
<div id="title">
|
||||||
|
<h1>
|
||||||
|
My MVC Application</h1>
|
||||||
|
</div>
|
||||||
<%Html.Zone("header"); Html.Zone("menu"); %>
|
<%Html.Zone("header"); Html.Zone("menu"); %>
|
||||||
</div>
|
</div>
|
||||||
<div id="main">
|
<div id="main">
|
||||||
<%Html.Zone("content", () => Html.RenderBody() );%>
|
<div id="messages">
|
||||||
<div id="footer"><%Html.Zone("footer");%></div>
|
<%Html.RenderPartial("messages", Model.Messages); %></div>
|
||||||
|
<%Html.Zone("content", () => Html.RenderBody());%>
|
||||||
|
<div id="footer">
|
||||||
|
<%Html.Zone("footer");%></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@@ -37,9 +37,9 @@ namespace Orchard.Environment {
|
|||||||
shell.Activate();
|
shell.Activate();
|
||||||
_current = shell;
|
_current = shell;
|
||||||
|
|
||||||
ViewEngines.Engines.Insert(0, new LayoutViewEngine(null));
|
ViewEngines.Engines.Insert(0, LayoutViewEngine.CreateShim());
|
||||||
_controllerBuilder.SetControllerFactory(new OrchardControllerFactory());
|
_controllerBuilder.SetControllerFactory(new OrchardControllerFactory());
|
||||||
ServiceLocator.SetLocator(t=>_containerProvider.RequestContainer.Resolve(t));
|
ServiceLocator.SetLocator(t => _containerProvider.RequestContainer.Resolve(t));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void EndRequest() {
|
protected virtual void EndRequest() {
|
||||||
@@ -65,10 +65,10 @@ namespace Orchard.Environment {
|
|||||||
foreach (var interfaceType in serviceType.GetInterfaces())
|
foreach (var interfaceType in serviceType.GetInterfaces())
|
||||||
if (typeof(IDependency).IsAssignableFrom(interfaceType)) {
|
if (typeof(IDependency).IsAssignableFrom(interfaceType)) {
|
||||||
var registrar = addingModulesAndServices.Register(serviceType).As(interfaceType);
|
var registrar = addingModulesAndServices.Register(serviceType).As(interfaceType);
|
||||||
if (typeof(ISingletonDependency).IsAssignableFrom(interfaceType)){
|
if (typeof(ISingletonDependency).IsAssignableFrom(interfaceType)) {
|
||||||
registrar.SingletonScoped();
|
registrar.SingletonScoped();
|
||||||
}
|
}
|
||||||
else if (typeof(ITransientDependency).IsAssignableFrom(interfaceType)){
|
else if (typeof(ITransientDependency).IsAssignableFrom(interfaceType)) {
|
||||||
registrar.FactoryScoped();
|
registrar.FactoryScoped();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using Orchard.Mvc.ViewModels;
|
using Orchard.Mvc.ViewModels;
|
||||||
@@ -12,11 +13,6 @@ namespace Orchard.Mvc.ViewEngines {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public ViewEngineResult FindPartialView(ControllerContext controllerContext, string partialViewName, bool useCache) {
|
public ViewEngineResult FindPartialView(ControllerContext controllerContext, string partialViewName, bool useCache) {
|
||||||
var scope = Scope.From(controllerContext);
|
|
||||||
if (scope != null && scope.LayoutViewEngine != null) {
|
|
||||||
return scope.LayoutViewEngine._viewEngines.FindPartialView(controllerContext, partialViewName);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new ViewEngineResult(Enumerable.Empty<string>());
|
return new ViewEngineResult(Enumerable.Empty<string>());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -27,11 +23,11 @@ namespace Orchard.Mvc.ViewEngines {
|
|||||||
bool useCache) {
|
bool useCache) {
|
||||||
|
|
||||||
var skipLayoutViewEngine = false;
|
var skipLayoutViewEngine = false;
|
||||||
if (string.IsNullOrEmpty(masterName)==false)
|
if (string.IsNullOrEmpty(masterName) == false)
|
||||||
skipLayoutViewEngine = true;
|
skipLayoutViewEngine = true;
|
||||||
if (!(controllerContext.Controller.ViewData.Model is BaseViewModel))
|
if (!(controllerContext.Controller.ViewData.Model is BaseViewModel))
|
||||||
skipLayoutViewEngine = true;
|
skipLayoutViewEngine = true;
|
||||||
if (_viewEngines == null || _viewEngines.Count== 0)
|
if (_viewEngines == null || _viewEngines.Count == 0)
|
||||||
skipLayoutViewEngine = true;
|
skipLayoutViewEngine = true;
|
||||||
if (skipLayoutViewEngine)
|
if (skipLayoutViewEngine)
|
||||||
return new ViewEngineResult(Enumerable.Empty<string>());
|
return new ViewEngineResult(Enumerable.Empty<string>());
|
||||||
@@ -92,6 +88,50 @@ namespace Orchard.Mvc.ViewEngines {
|
|||||||
return (Scope)context.HttpContext.Items[typeof(Scope)];
|
return (Scope)context.HttpContext.Items[typeof(Scope)];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static IViewEngine CreateShim() {
|
||||||
|
return new Shim();
|
||||||
|
}
|
||||||
|
|
||||||
|
class Shim : IViewEngine {
|
||||||
|
public ViewEngineResult FindPartialView(ControllerContext controllerContext, string partialViewName, bool useCache) {
|
||||||
|
var scope = Scope.From(controllerContext);
|
||||||
|
if (scope != null && scope.LayoutViewEngine != null) {
|
||||||
|
var result = scope.LayoutViewEngine._viewEngines.FindPartialView(controllerContext, partialViewName);
|
||||||
|
Monitor(result, partialViewName);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new ViewEngineResult(Enumerable.Empty<string>());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public ViewEngineResult FindView(ControllerContext controllerContext, string viewName, string masterName, bool useCache) {
|
||||||
|
var scope = Scope.From(controllerContext);
|
||||||
|
if (scope != null && scope.LayoutViewEngine != null) {
|
||||||
|
var result = scope.LayoutViewEngine._viewEngines.FindView(controllerContext, viewName, masterName);
|
||||||
|
Monitor(result, viewName);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
return new ViewEngineResult(Enumerable.Empty<string>());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static void Monitor(ViewEngineResult result, string viewName) {
|
||||||
|
if (result.View == null) {
|
||||||
|
Trace.WriteLine("Unable to find " + viewName);
|
||||||
|
foreach (var search in result.SearchedLocations) {
|
||||||
|
Trace.WriteLine(" location " + search);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ReleaseView(ControllerContext controllerContext, IView view) {
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -57,11 +57,12 @@ namespace Orchard.Mvc.ViewEngines {
|
|||||||
var requestViewEngines = new ViewEngineCollection(
|
var requestViewEngines = new ViewEngineCollection(
|
||||||
themeViewEngines
|
themeViewEngines
|
||||||
.Concat(packageViewEngines)
|
.Concat(packageViewEngines)
|
||||||
|
.Concat(_viewEngines.Where(x => x.GetType().Assembly != typeof(LayoutViewEngine).Assembly))
|
||||||
.ToArray());
|
.ToArray());
|
||||||
|
|
||||||
var layoutViewEngine = new LayoutViewEngine(requestViewEngines);
|
var layoutViewEngine = new LayoutViewEngine(requestViewEngines);
|
||||||
|
|
||||||
viewResultBase.ViewEngineCollection = new ViewEngineCollection();
|
viewResultBase.ViewEngineCollection = new ViewEngineCollection(_viewEngines.ToList());
|
||||||
viewResultBase.ViewEngineCollection.Insert(0, layoutViewEngine);
|
viewResultBase.ViewEngineCollection.Insert(0, layoutViewEngine);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user