--HG--
branch : dev
This commit is contained in:
Renaud Paquay
2010-05-19 13:42:14 -07:00
4 changed files with 45 additions and 0 deletions

View File

@@ -104,6 +104,10 @@ namespace Orchard.Core.Common.Drivers {
// Can be moved somewhere else once we have IoC enabled body text filters.
private static string BbcodeReplace(string bodyText) {
if ( string.IsNullOrEmpty(bodyText) )
return string.Empty;
Regex urlRegex = new Regex(@"\[url\]([^\]]+)\[\/url\]");
Regex urlRegexWithLink = new Regex(@"\[url=([^\]]+)\]([^\]]+)\[\/url\]");
Regex imgRegex = new Regex(@"\[img\]([^\]]+)\[\/img\]");

View File

@@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;
using System.Web.Caching;
using System.Web;
using System.Web.Hosting;
namespace Orchard.Mvc.ViewEngines {
public class ThemeViewLocationCache : IViewLocationCache {
private readonly string _requestTheme;
public ThemeViewLocationCache(string requestTheme) {
_requestTheme = requestTheme;
}
private string AlterKey(string key) {
return key + ":" + _requestTheme;
}
public string GetViewLocation(HttpContextBase httpContext, string key) {
if (httpContext == null) {
throw new ArgumentNullException("httpContext");
}
return (string)httpContext.Cache[AlterKey(key)];
}
public void InsertViewLocation(HttpContextBase httpContext, string key, string virtualPath) {
if (httpContext == null) {
throw new ArgumentNullException("httpContext");
}
httpContext.Cache.Insert(AlterKey(key), virtualPath, new CacheDependency(HostingEnvironment.MapPath("~/Themes")));
}
}
}

View File

@@ -31,6 +31,8 @@ namespace Orchard.Mvc.ViewEngines {
AreaPartialViewLocationFormats = DisabledFormats,
};
viewEngine.ViewLocationCache = new ThemeViewLocationCache(parameters.VirtualPath);
// enable /Views/{partialName}
// enable /Views/"DisplayTemplates/"+{templateName}
// enable /Views/"EditorTemplates/+{templateName}

View File

@@ -235,6 +235,7 @@
<Compile Include="Mvc\Routes\UrlPrefix.cs" />
<Compile Include="Mvc\Routes\UrlPrefixAdjustedHttpContext.cs" />
<Compile Include="Mvc\Routes\ShellRoute.cs" />
<Compile Include="Mvc\ViewEngines\ThemeViewLocationCache.cs" />
<Compile Include="Mvc\ViewModels\AdaptedViewModel.cs" />
<Compile Include="Mvc\ViewUserControl.cs">
<SubType>ASPXCodeBehind</SubType>