diff --git a/src/Orchard.Web/Modules/Orchard.ContentPicker/Views/ContentPicker.cshtml b/src/Orchard.Web/Modules/Orchard.ContentPicker/Views/ContentPicker.cshtml index 5646e4086..d0cb29bb6 100644 --- a/src/Orchard.Web/Modules/Orchard.ContentPicker/Views/ContentPicker.cshtml +++ b/src/Orchard.Web/Modules/Orchard.ContentPicker/Views/ContentPicker.cshtml @@ -4,7 +4,7 @@ Style.Require("jQueryUI_Orchard").AtHead(); Script.Require("jQueryUI_Tabs").AtHead(); - SetMeta("X-UA-Compatible", "IE=edge,chrome=1"); + SetMeta("IE=edge,chrome=1", httpEquiv: "X-UA-Compatible"); Style.Include("~/themes/theadmin/styles/site.css"); Style.Include("~/themes/theadmin/styles/ie.css").UseCondition("lte IE 8").SetAttribute("media", "screen, projection"); Style.Include("~/themes/theadmin/styles/ie6.css").UseCondition("lte IE 6").SetAttribute("media", "screen, projection"); diff --git a/src/Orchard.Web/Modules/Orchard.MediaPicker/Views/Admin/Index.cshtml b/src/Orchard.Web/Modules/Orchard.MediaPicker/Views/Admin/Index.cshtml index 255f81e0b..d3369ea89 100644 --- a/src/Orchard.Web/Modules/Orchard.MediaPicker/Views/Admin/Index.cshtml +++ b/src/Orchard.Web/Modules/Orchard.MediaPicker/Views/Admin/Index.cshtml @@ -1,5 +1,4 @@ -@model Orchard.Media.ViewModels.MediaFolderEditViewModel -@using Orchard.Media.Extensions; +@using Orchard.Media.Extensions; @using Orchard.Media.Helpers; @using Orchard.Media.Services; @using Orchard.Media.Models; @@ -11,7 +10,7 @@ Script.Require("jQueryUI_Tabs").AtHead(); Script.Include("MediaBrowser.js").AtHead(); - SetMeta("X-UA-Compatible", "IE=edge,chrome=1"); + SetMeta("IE=edge,chrome=1", httpEquiv: "X-UA-Compatible"); Style.Include("~/themes/theadmin/styles/site.css"); Style.Include("~/themes/theadmin/styles/ie.css").UseCondition("lte IE 8").SetAttribute("media", "screen, projection"); Style.Include("~/themes/theadmin/styles/ie6.css").UseCondition("lte IE 6").SetAttribute("media", "screen, projection"); diff --git a/src/Orchard.Web/Modules/Orchard.Workflows/Views/Admin/EditActivity.cshtml b/src/Orchard.Web/Modules/Orchard.Workflows/Views/Admin/EditActivity.cshtml index 8c6811d1e..877add946 100644 --- a/src/Orchard.Web/Modules/Orchard.Workflows/Views/Admin/EditActivity.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Workflows/Views/Admin/EditActivity.cshtml @@ -1,6 +1,5 @@ - -@{ - SetMeta("X-UA-Compatible", "IE=edge,chrome=1"); +@{ + SetMeta("IE=edge,chrome=1", httpEquiv: "X-UA-Compatible"); Style.Include("~/themes/theadmin/styles/site.css"); Style.Include("~/themes/theadmin/styles/ie.css").UseCondition("lte IE 8").SetAttribute("media", "screen, projection"); Style.Include("~/themes/theadmin/styles/ie6.css").UseCondition("lte IE 6").SetAttribute("media", "screen, projection"); diff --git a/src/Orchard.Web/Themes/TheThemeMachine/Views/Layout.cshtml b/src/Orchard.Web/Themes/TheThemeMachine/Views/Layout.cshtml index 34cdfd5de..74376eb90 100644 --- a/src/Orchard.Web/Themes/TheThemeMachine/Views/Layout.cshtml +++ b/src/Orchard.Web/Themes/TheThemeMachine/Views/Layout.cshtml @@ -9,8 +9,8 @@ @{ /* Global includes for the theme ***************************************************************/ - - SetMeta("X-UA-Compatible", "IE=edge,chrome=1"); + + SetMeta(httpEquiv: "X-UA-Compatible", content: "IE=edge,chrome=1"); Style.Include("http://fonts.googleapis.com/css?family=Lobster&subset=latin"); Style.Include("site.css"); diff --git a/src/Orchard/Mvc/IOrchardViewPage.cs b/src/Orchard/Mvc/IOrchardViewPage.cs index 0d75c2f9b..a26fffd57 100644 --- a/src/Orchard/Mvc/IOrchardViewPage.cs +++ b/src/Orchard/Mvc/IOrchardViewPage.cs @@ -20,7 +20,7 @@ namespace Orchard.Mvc { IDisposable Capture(Action callback); void RegisterLink(LinkEntry link); - void SetMeta(string name, string content); + void SetMeta(string name, string content, string httpEquiv, string charset); void SetMeta(MetaEntry meta); void AppendMeta(string name, string content, string contentSeparator); void AppendMeta(MetaEntry meta, string contentSeparator); diff --git a/src/Orchard/Mvc/ViewEngines/Razor/WebViewPage.cs b/src/Orchard/Mvc/ViewEngines/Razor/WebViewPage.cs index 0f8245098..eecf3fcf1 100644 --- a/src/Orchard/Mvc/ViewEngines/Razor/WebViewPage.cs +++ b/src/Orchard/Mvc/ViewEngines/Razor/WebViewPage.cs @@ -126,8 +126,26 @@ namespace Orchard.Mvc.ViewEngines.Razor { ResourceManager.RegisterLink(link); } - public void SetMeta(string name, string content) { - SetMeta(new MetaEntry { Name = name, Content = content }); + public void SetMeta(string name = null, string content = null, string httpEquiv = null, string charset = null) { + var metaEntry = new MetaEntry(); + + if (!String.IsNullOrEmpty(name)) { + metaEntry.Name = name; + } + + if (!String.IsNullOrEmpty(content)) { + metaEntry.Content = content; + } + + if (!String.IsNullOrEmpty(httpEquiv)) { + metaEntry.HttpEquiv = httpEquiv; + } + + if (!String.IsNullOrEmpty(charset)) { + metaEntry.Charset = charset; + } + + SetMeta(metaEntry); } public virtual void SetMeta(MetaEntry meta) { diff --git a/src/Orchard/Mvc/ViewPage.cs b/src/Orchard/Mvc/ViewPage.cs index fe2b42a4b..e3c9c2fb7 100644 --- a/src/Orchard/Mvc/ViewPage.cs +++ b/src/Orchard/Mvc/ViewPage.cs @@ -77,8 +77,26 @@ namespace Orchard.Mvc { Html.GetWorkContext().Resolve().RegisterLink(link); } - public void SetMeta(string name, string content) { - SetMeta(new MetaEntry { Name = name, Content = content }); + public void SetMeta(string name = null, string content = null, string httpEquiv = null, string charset = null) { + var metaEntry = new MetaEntry(); + + if (!String.IsNullOrEmpty(name)) { + metaEntry.Name = name; + } + + if (!String.IsNullOrEmpty(content)) { + metaEntry.Content = content; + } + + if (!String.IsNullOrEmpty(httpEquiv)) { + metaEntry.HttpEquiv = httpEquiv; + } + + if (!String.IsNullOrEmpty(charset)) { + metaEntry.Charset = charset; + } + + SetMeta(metaEntry); } public virtual void SetMeta(MetaEntry meta) { diff --git a/src/Orchard/Mvc/ViewUserControl.cs b/src/Orchard/Mvc/ViewUserControl.cs index b425cfa1e..8f0b35a4b 100644 --- a/src/Orchard/Mvc/ViewUserControl.cs +++ b/src/Orchard/Mvc/ViewUserControl.cs @@ -66,8 +66,26 @@ namespace Orchard.Mvc { Html.GetWorkContext().Resolve().RegisterLink(link); } - public void SetMeta(string name, string content) { - SetMeta(new MetaEntry { Name = name, Content = content }); + public void SetMeta(string name = null, string content = null, string httpEquiv = null, string charset = null) { + var metaEntry = new MetaEntry(); + + if (!String.IsNullOrEmpty(name)) { + metaEntry.Name = name; + } + + if (!String.IsNullOrEmpty(content)) { + metaEntry.Content = content; + } + + if (!String.IsNullOrEmpty(httpEquiv)) { + metaEntry.HttpEquiv = httpEquiv; + } + + if (!String.IsNullOrEmpty(charset)) { + metaEntry.Charset = charset; + } + + SetMeta(metaEntry); } public virtual void SetMeta(MetaEntry meta) { diff --git a/src/Orchard/UI/Resources/ResourceManager.cs b/src/Orchard/UI/Resources/ResourceManager.cs index 7fa8ee080..4d3c3ee00 100644 --- a/src/Orchard/UI/Resources/ResourceManager.cs +++ b/src/Orchard/UI/Resources/ResourceManager.cs @@ -300,21 +300,31 @@ namespace Orchard.UI.Resources { } public void SetMeta(MetaEntry meta) { - if (meta == null || String.IsNullOrEmpty(meta.Name)) { + if (meta == null) { return; } - _metas[meta.Name] = meta; + + var index = meta.Name ?? meta.HttpEquiv ?? "charset"; + + _metas[index] = meta; } public void AppendMeta(MetaEntry meta, string contentSeparator) { - if (meta == null || String.IsNullOrEmpty(meta.Name)) { + if (meta == null) { return; } + + var index = meta.Name ?? meta.HttpEquiv; + + if (String.IsNullOrEmpty(index)) { + return; + } + MetaEntry existingMeta; - if (_metas.TryGetValue(meta.Name, out existingMeta)) { + if (_metas.TryGetValue(index, out existingMeta)) { meta = MetaEntry.Combine(existingMeta, meta, contentSeparator); } - _metas[meta.Name] = meta; + _metas[index] = meta; } }