mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-01-22 21:02:08 +08:00
- Adding some debug logging of view search locations
- Making the Themes (Core) Package a theme as well so the default theme can be reactivated --HG-- extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4045306
This commit is contained in:
@@ -142,6 +142,8 @@
|
|||||||
<Content Include="Common\Views\EditorTemplates\Parts\Common.Body.ascx" />
|
<Content Include="Common\Views\EditorTemplates\Parts\Common.Body.ascx" />
|
||||||
<Content Include="Common\Views\EditorTemplates\Parts\Common.Owner.ascx" />
|
<Content Include="Common\Views\EditorTemplates\Parts\Common.Owner.ascx" />
|
||||||
<Content Include="Settings\Views\EditorTemplates\Items\Settings.Site.ascx" />
|
<Content Include="Settings\Views\EditorTemplates\Items\Settings.Site.ascx" />
|
||||||
|
<Content Include="Themes\Theme.gif" />
|
||||||
|
<Content Include="Themes\Theme.txt" />
|
||||||
<Content Include="Themes\Scripts\jquery-1.3.2-vsdoc.js" />
|
<Content Include="Themes\Scripts\jquery-1.3.2-vsdoc.js" />
|
||||||
<Content Include="Themes\Scripts\jquery-1.3.2.js" />
|
<Content Include="Themes\Scripts\jquery-1.3.2.js" />
|
||||||
<Content Include="Themes\Scripts\jquery-1.3.2.min-vsdoc.js" />
|
<Content Include="Themes\Scripts\jquery-1.3.2.min-vsdoc.js" />
|
||||||
|
|||||||
BIN
src/Orchard.Web/Core/Themes/Theme.gif
Normal file
BIN
src/Orchard.Web/Core/Themes/Theme.gif
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
6
src/Orchard.Web/Core/Themes/Theme.txt
Normal file
6
src/Orchard.Web/Core/Themes/Theme.txt
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
name: Blue (default)
|
||||||
|
author: Jonathan Wall
|
||||||
|
description: This is the default theme that has a resemblance to the default ASP.NET MVC web project style for some reason.
|
||||||
|
version: 1.0
|
||||||
|
tags: blue, default
|
||||||
|
homepage: http://www.orchardproject.net
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
<%@ Page Language="C#" Inherits="Orchard.Mvc.ViewPage<ThemesIndexViewModel>" %>
|
<%@ Page Language="C#" Inherits="Orchard.Mvc.ViewPage<ThemesIndexViewModel>" %>
|
||||||
|
<%@ Import Namespace="Orchard.Themes"%>
|
||||||
|
<%@ Import Namespace="Orchard.Extensions"%>
|
||||||
<%@ Import Namespace="Orchard.Core.Themes.ViewModels"%>
|
<%@ Import Namespace="Orchard.Core.Themes.ViewModels"%>
|
||||||
<h1><%=Html.TitleForPage(T("Manage Themes").ToString()) %></h1>
|
<h1><%=Html.TitleForPage(T("Manage Themes").ToString()) %></h1>
|
||||||
<h2><%=_Encoded("Current Theme")%></h2>
|
<h2><%=_Encoded("Current Theme")%></h2>
|
||||||
@@ -8,7 +10,7 @@
|
|||||||
} else {
|
} else {
|
||||||
%><h3><%=Html.Encode(Model.CurrentTheme.DisplayName) %></h3>
|
%><h3><%=Html.Encode(Model.CurrentTheme.DisplayName) %></h3>
|
||||||
<p>
|
<p>
|
||||||
<%=Html.Image(ResolveUrl("~/Themes/" + Model.CurrentTheme.ThemeName + "/Theme.gif"), Html.Encode(Model.CurrentTheme.DisplayName), null) %><br />
|
<%=Html.Image(ResolveUrl(Html.Resolve<IExtensionManager>().GetThemeLocation(Model.CurrentTheme) + "/Theme.gif"), Html.Encode(Model.CurrentTheme.DisplayName), null)%><br />
|
||||||
<%=_Encoded("By") %> <%=Html.Encode(Model.CurrentTheme.Author) %><br />
|
<%=_Encoded("By") %> <%=Html.Encode(Model.CurrentTheme.Author) %><br />
|
||||||
<%=Html.Encode(Model.CurrentTheme.Version) %><br />
|
<%=Html.Encode(Model.CurrentTheme.Version) %><br />
|
||||||
<%=Html.Encode(Model.CurrentTheme.Description) %><br />
|
<%=Html.Encode(Model.CurrentTheme.Description) %><br />
|
||||||
@@ -23,7 +25,7 @@
|
|||||||
%> <li>
|
%> <li>
|
||||||
<h3><%=Html.Encode(theme.DisplayName) %></h3>
|
<h3><%=Html.Encode(theme.DisplayName) %></h3>
|
||||||
<p>
|
<p>
|
||||||
<%=Html.Image(ResolveUrl("~/Themes/" + theme.ThemeName + "/Theme.gif"), Html.Encode(theme.DisplayName), null) %><br />
|
<%=Html.Image(ResolveUrl(Html.Resolve<IExtensionManager>().GetThemeLocation(theme) + "/Theme.gif"), Html.Encode(theme.DisplayName), null)%><br />
|
||||||
<%=_Encoded("By") %> <%=Html.Encode(theme.Author) %><br />
|
<%=_Encoded("By") %> <%=Html.Encode(theme.Author) %><br />
|
||||||
<%=Html.Encode(theme.Version) %><br />
|
<%=Html.Encode(theme.Version) %><br />
|
||||||
<%=Html.Encode(theme.Description) %><br />
|
<%=Html.Encode(theme.Description) %><br />
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using Orchard.Extensions;
|
using Orchard.Extensions;
|
||||||
|
using Orchard.Logging;
|
||||||
using Orchard.Mvc.Filters;
|
using Orchard.Mvc.Filters;
|
||||||
using Orchard.Themes;
|
using Orchard.Themes;
|
||||||
|
|
||||||
@@ -25,6 +26,8 @@ namespace Orchard.Mvc.ViewEngines {
|
|||||||
_viewEngineProviders = viewEngineProviders;
|
_viewEngineProviders = viewEngineProviders;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ILogger Logger { get; set; }
|
||||||
|
|
||||||
public void OnResultExecuting(ResultExecutingContext filterContext) {
|
public void OnResultExecuting(ResultExecutingContext filterContext) {
|
||||||
var viewResultBase = filterContext.Result as ViewResultBase;
|
var viewResultBase = filterContext.Result as ViewResultBase;
|
||||||
if (viewResultBase == null) {
|
if (viewResultBase == null) {
|
||||||
@@ -44,6 +47,7 @@ namespace Orchard.Mvc.ViewEngines {
|
|||||||
|
|
||||||
themeViewEngines = _viewEngineProviders
|
themeViewEngines = _viewEngineProviders
|
||||||
.Select(x => x.CreateThemeViewEngine(new CreateThemeViewEngineParams { VirtualPath = themeLocation }));
|
.Select(x => x.CreateThemeViewEngine(new CreateThemeViewEngineParams { VirtualPath = themeLocation }));
|
||||||
|
Logger.Debug("Theme location:\r\n\t-{0}", themeLocation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -53,6 +57,7 @@ namespace Orchard.Mvc.ViewEngines {
|
|||||||
var packageLocations = packages.Select(x => Path.Combine(x.Descriptor.Location, x.Descriptor.Name));
|
var packageLocations = packages.Select(x => Path.Combine(x.Descriptor.Location, x.Descriptor.Name));
|
||||||
var packageViewEngines = _viewEngineProviders
|
var packageViewEngines = _viewEngineProviders
|
||||||
.Select(x => x.CreatePackagesViewEngine(new CreatePackagesViewEngineParams { VirtualPaths = packageLocations }));
|
.Select(x => x.CreatePackagesViewEngine(new CreatePackagesViewEngineParams { VirtualPaths = packageLocations }));
|
||||||
|
Logger.Debug("Package locations:\r\n\t-{0}", string.Join("\r\n\t-", packageLocations.ToArray()));
|
||||||
|
|
||||||
var requestViewEngines = new ViewEngineCollection(
|
var requestViewEngines = new ViewEngineCollection(
|
||||||
themeViewEngines
|
themeViewEngines
|
||||||
|
|||||||
@@ -1,11 +1,14 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
|
using Orchard.Logging;
|
||||||
|
|
||||||
namespace Orchard.Mvc.ViewEngines {
|
namespace Orchard.Mvc.ViewEngines {
|
||||||
public class WebFormsViewEngineProvider : IViewEngineProvider {
|
public class WebFormsViewEngineProvider : IViewEngineProvider {
|
||||||
|
|
||||||
static string[] DisabledFormats = new[] { "~/Disabled" };
|
static string[] DisabledFormats = new[] { "~/Disabled" };
|
||||||
|
|
||||||
|
public ILogger Logger { get; set; }
|
||||||
|
|
||||||
public IViewEngine CreateThemeViewEngine(CreateThemeViewEngineParams parameters) {
|
public IViewEngine CreateThemeViewEngine(CreateThemeViewEngineParams parameters) {
|
||||||
// Area: if "area" in RouteData. Url hit for package...
|
// Area: if "area" in RouteData. Url hit for package...
|
||||||
// Area-Layout Paths - no-op because LayoutViewEngine uses multi-pass instead of layout paths
|
// Area-Layout Paths - no-op because LayoutViewEngine uses multi-pass instead of layout paths
|
||||||
@@ -34,6 +37,8 @@ namespace Orchard.Mvc.ViewEngines {
|
|||||||
parameters.VirtualPath + "/Views/{0}.aspx",
|
parameters.VirtualPath + "/Views/{0}.aspx",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Logger.Debug("PartialViewLocationFormats (theme): \r\n\t-{0}", string.Join("\r\n\t-", viewEngine.PartialViewLocationFormats));
|
||||||
|
|
||||||
// for "routed" request views...
|
// for "routed" request views...
|
||||||
// enable /Views/{area}/{controller}/{viewName}
|
// enable /Views/{area}/{controller}/{viewName}
|
||||||
viewEngine.AreaPartialViewLocationFormats = new[] {
|
viewEngine.AreaPartialViewLocationFormats = new[] {
|
||||||
@@ -41,6 +46,8 @@ namespace Orchard.Mvc.ViewEngines {
|
|||||||
parameters.VirtualPath + "/Views/{2}/{1}/{0}.aspx",
|
parameters.VirtualPath + "/Views/{2}/{1}/{0}.aspx",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Logger.Debug("AreaPartialViewLocationFormats (theme): \r\n\t-{0}", string.Join("\r\n\t-", viewEngine.AreaPartialViewLocationFormats));
|
||||||
|
|
||||||
return viewEngine;
|
return viewEngine;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,6 +59,8 @@ namespace Orchard.Mvc.ViewEngines {
|
|||||||
"~/Packages/{2}/Views/{1}/{0}.aspx",
|
"~/Packages/{2}/Views/{1}/{0}.aspx",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Logger.Debug("AreaFormats (package): \r\n\t-{0}", string.Join("\r\n\t-", areaFormats));
|
||||||
|
|
||||||
var universalFormats = parameters.VirtualPaths
|
var universalFormats = parameters.VirtualPaths
|
||||||
.SelectMany(x => new[] {
|
.SelectMany(x => new[] {
|
||||||
x + "/Views/{0}.ascx",
|
x + "/Views/{0}.ascx",
|
||||||
@@ -59,6 +68,8 @@ namespace Orchard.Mvc.ViewEngines {
|
|||||||
})
|
})
|
||||||
.ToArray();
|
.ToArray();
|
||||||
|
|
||||||
|
Logger.Debug("UniversalFormats (package): \r\n\t-{0}", string.Join("\r\n\t-", universalFormats));
|
||||||
|
|
||||||
var viewEngine = new WebFormViewEngine {
|
var viewEngine = new WebFormViewEngine {
|
||||||
MasterLocationFormats = DisabledFormats,
|
MasterLocationFormats = DisabledFormats,
|
||||||
ViewLocationFormats = universalFormats,
|
ViewLocationFormats = universalFormats,
|
||||||
|
|||||||
Reference in New Issue
Block a user