mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Some fixes* that had to be made to (begin to) get running as an IIS application. *Pretty much pathing fixes and including "TheAdmin" theme and the themes Web.config (to get themes to work and the admin to not look like...)
--HG-- extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4044465
This commit is contained in:
@@ -23,8 +23,8 @@ namespace Orchard.Core.Common.Mvc.Filters {
|
||||
{
|
||||
//todo: (heskew) get at the SiteUrl the "right" way. or is this the right way :|
|
||||
var siteUrl = _siteService.GetSiteSettings().ContentItem.As<SiteSettings>().Record.SiteUrl;
|
||||
|
||||
if (filterContext.HttpContext.Request.RawUrl.StartsWith(Path.Combine(siteUrl, "admin"), true, CultureInfo.InvariantCulture)
|
||||
//todo: (heskew) get at the admin path in a less hacky way
|
||||
if (filterContext.HttpContext.Request.RawUrl.StartsWith(Path.Combine(siteUrl, "admin").Replace("\\", "/"), true, CultureInfo.InvariantCulture)
|
||||
&& !_authorizer.Authorize(Permissions.AccessAdmin, "Can't access the admin")) {
|
||||
filterContext.Result = new HttpUnauthorizedResult();
|
||||
}
|
||||
|
@@ -17,8 +17,8 @@ namespace Orchard.Core.Themes.Services {
|
||||
public ThemeSelectorResult GetTheme(RequestContext context) {
|
||||
//todo: (heskew) get at the SiteUrl the "right" way. or is this the right way :|
|
||||
var siteUrl = _siteService.GetSiteSettings().ContentItem.As<SiteSettings>().Record.SiteUrl;
|
||||
|
||||
if (!context.HttpContext.Request.Path.StartsWith(Path.Combine(siteUrl, "admin"), true, CultureInfo.InvariantCulture))
|
||||
//todo: (heskew) get at the admin path in a less hacky way
|
||||
if (!context.HttpContext.Request.Path.StartsWith(Path.Combine(siteUrl, "admin").Replace("\\", "/"), true, CultureInfo.InvariantCulture))
|
||||
return null;
|
||||
|
||||
return new ThemeSelectorResult { Priority = 0, ThemeName = "TheAdmin" };
|
||||
|
@@ -165,10 +165,24 @@
|
||||
<Content Include="Themes\Orange\Theme.gif" />
|
||||
<Content Include="Themes\Orange\Theme.txt" />
|
||||
<Content Include="Themes\Orange\Views\layout.ascx" />
|
||||
<Content Include="Themes\TheAdmin\Styles\images\background_header.jpg" />
|
||||
<Content Include="Themes\TheAdmin\Styles\images\icons.png" />
|
||||
<Content Include="Themes\TheAdmin\Styles\images\orchardLogo.jpg" />
|
||||
<Content Include="Themes\TheAdmin\Styles\images\tableHeaderBackground.gif" />
|
||||
<Content Include="Themes\TheAdmin\Styles\images\tableHeaderBackgroundRed.gif" />
|
||||
<Content Include="Themes\TheAdmin\Styles\site.css" />
|
||||
<Content Include="Themes\TheAdmin\Theme.gif" />
|
||||
<Content Include="Themes\TheAdmin\Theme.txt" />
|
||||
<Content Include="Themes\TheAdmin\Views\layout.ascx" />
|
||||
<Content Include="Themes\TheAdmin\Views\Shared\document.aspx" />
|
||||
<Content Include="Views\Shared\Messages.ascx" />
|
||||
<Content Include="Views\Templates\ThreeColumns.aspx" />
|
||||
<Content Include="Views\Templates\TwoColumns.aspx" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Themes\TheAdmin\Styles\images\icons.psd" />
|
||||
<Content Include="Themes\Web.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="App_Data\" />
|
||||
</ItemGroup>
|
||||
|
@@ -110,13 +110,10 @@
|
||||
during the execution of a request. Specifically,
|
||||
it enables developers to configure html error pages
|
||||
to be displayed in place of a error stack trace.
|
||||
|
||||
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
|
||||
<error statusCode="403" redirect="NoAccess.htm" />
|
||||
<error statusCode="404" redirect="FileNotFound.htm" />
|
||||
</customErrors>
|
||||
-->
|
||||
|
||||
<customErrors mode="Off" />
|
||||
|
||||
<pages>
|
||||
<controls>
|
||||
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
|
@@ -14,6 +14,8 @@ namespace Orchard.Extensions {
|
||||
|
||||
public IEnumerable<string> ListNames() {
|
||||
foreach (var path in _paths) {
|
||||
if (!Directory.Exists(PathHelpers.GetPhysicalPath(path)))
|
||||
continue;
|
||||
foreach (var directoryName in Directory.GetDirectories(PathHelpers.GetPhysicalPath(path))) {
|
||||
if (File.Exists(Path.Combine(directoryName, "Package.txt")))
|
||||
yield return Path.GetFileName(directoryName);
|
||||
|
@@ -7,14 +7,16 @@ namespace Orchard.Mvc.Html {
|
||||
public class FileRegistrationContext : RequestContext {
|
||||
public FileRegistrationContext(ViewContext viewContext, IViewDataContainer viewDataContainer, string fileName)
|
||||
: base(viewContext.HttpContext, viewContext.RouteData) {
|
||||
TemplateControl container = viewDataContainer as TemplateControl;
|
||||
Container = viewDataContainer as TemplateControl;
|
||||
|
||||
if (container != null)
|
||||
ContainerVirtualPath = container.AppRelativeVirtualPath.Substring(0,
|
||||
container.AppRelativeVirtualPath.
|
||||
IndexOf("/Views",
|
||||
StringComparison.
|
||||
InvariantCultureIgnoreCase));
|
||||
if (Container != null)
|
||||
ContainerVirtualPath = Container.AppRelativeVirtualPath.Substring(
|
||||
0,
|
||||
Container.AppRelativeVirtualPath.IndexOf(
|
||||
"/Views",
|
||||
StringComparison.InvariantCultureIgnoreCase
|
||||
)
|
||||
);
|
||||
|
||||
FileName = fileName;
|
||||
}
|
||||
@@ -28,13 +30,15 @@ namespace Orchard.Mvc.Html {
|
||||
FileRegistrationContext incoming = obj as FileRegistrationContext;
|
||||
|
||||
return incoming != null &&
|
||||
string.Equals(ContainerVirtualPath, incoming.ContainerVirtualPath,
|
||||
StringComparison.InvariantCultureIgnoreCase) &&
|
||||
string.Equals(ContainerVirtualPath, incoming.ContainerVirtualPath, StringComparison.InvariantCultureIgnoreCase) &&
|
||||
string.Equals(FileName, incoming.FileName, StringComparison.InvariantCultureIgnoreCase);
|
||||
}
|
||||
|
||||
internal string GetFilePath(string containerRelativePath) {
|
||||
return ContainerVirtualPath.Replace("~/", "/") + containerRelativePath + FileName;
|
||||
//todo: (heskew) maybe not here but file paths for non-app locations need to be taken into account
|
||||
return Container != null
|
||||
? Container.ResolveUrl(ContainerVirtualPath + containerRelativePath + FileName)
|
||||
: (ContainerVirtualPath + containerRelativePath + FileName);
|
||||
}
|
||||
}
|
||||
}
|
@@ -13,7 +13,7 @@ namespace Orchard.Themes {
|
||||
public static string GetThemeLocation(this IExtensionManager extensionManager, ITheme theme) {
|
||||
ExtensionDescriptor descriptor = extensionManager.GetExtensionDescriptor("Theme", theme.ThemeName);
|
||||
|
||||
return descriptor != null ? Path.Combine(descriptor.Location, descriptor.Name) : null;
|
||||
return descriptor != null ? Path.Combine(descriptor.Location, descriptor.Name) : "~";
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user