diff --git a/src/Orchard.Web/Modules/Orchard.Resources/Bootstrap.cs b/src/Orchard.Web/Modules/Orchard.Resources/Bootstrap.cs index 072d17dff..a5c828e04 100644 --- a/src/Orchard.Web/Modules/Orchard.Resources/Bootstrap.cs +++ b/src/Orchard.Web/Modules/Orchard.Resources/Bootstrap.cs @@ -4,8 +4,8 @@ namespace Orchard.Resources { public class Bootstrap : IResourceManifestProvider { public void BuildManifests(ResourceManifestBuilder builder) { var manifest = builder.Add(); - manifest.DefineStyle("Bootstrap").SetUrl("bootstrap.min.css", "bootstrap.css").SetVersion("3.3.5").SetCdn("//ajax.aspnetcdn.com/ajax/bootstrap/3.3.5/css/bootstrap.min.css", "//ajax.aspnetcdn.com/ajax/bootstrap/3.3.5/css/bootstrap.css", true); - manifest.DefineScript("Bootstrap").SetUrl("bootstrap.min.js", "bootstrap.js").SetVersion("3.3.5").SetDependencies("jQuery").SetCdn("//ajax.aspnetcdn.com/ajax/bootstrap/3.3.5/bootstrap.min.js", "//ajax.aspnetcdn.com/ajax/bootstrap/3.3.5/bootstrap.js", true); + manifest.DefineStyle("Bootstrap").SetUrl("bootstrap.min.css", "bootstrap.css").SetVersion("3.3.5").SetCdn("//ajax.aspnetcdn.com/ajax/bootstrap/3.3.5/css/bootstrap.min.css", "//ajax.aspnetcdn.com/ajax/bootstrap/3.3.5/css/bootstrap.css"); + manifest.DefineScript("Bootstrap").SetUrl("bootstrap.min.js", "bootstrap.js").SetVersion("3.3.5").SetDependencies("jQuery").SetCdn("//ajax.aspnetcdn.com/ajax/bootstrap/3.3.5/bootstrap.min.js", "//ajax.aspnetcdn.com/ajax/bootstrap/3.3.5/bootstrap.js"); } } } diff --git a/src/Orchard.Web/Modules/Orchard.Resources/FontAwesome.cs b/src/Orchard.Web/Modules/Orchard.Resources/FontAwesome.cs index 87ee54cfa..e622ba6d9 100644 --- a/src/Orchard.Web/Modules/Orchard.Resources/FontAwesome.cs +++ b/src/Orchard.Web/Modules/Orchard.Resources/FontAwesome.cs @@ -4,7 +4,7 @@ namespace Orchard.Resources { public class FontAwesome : IResourceManifestProvider { public void BuildManifests(ResourceManifestBuilder builder) { var manifest = builder.Add(); - manifest.DefineStyle("FontAwesome").SetUrl("font-awesome.min.css", "font-awesome.css").SetVersion("4.4.0").SetCdn("//maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css", "//maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.css", true); + manifest.DefineStyle("FontAwesome").SetUrl("font-awesome.min.css", "font-awesome.css").SetVersion("4.4.0").SetCdn("//maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css", "//maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.css"); } } } \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Resources/jQuery.cs b/src/Orchard.Web/Modules/Orchard.Resources/jQuery.cs index c3de11f8c..1aee40b3e 100644 --- a/src/Orchard.Web/Modules/Orchard.Resources/jQuery.cs +++ b/src/Orchard.Web/Modules/Orchard.Resources/jQuery.cs @@ -6,10 +6,10 @@ namespace Orchard.Resources { var manifest = builder.Add(); // jQuery. - manifest.DefineScript("jQuery").SetUrl("jquery.min.js", "jquery.js").SetVersion("2.1.4").SetCdn("//ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.4.min.js", "//ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.4.js", true); + manifest.DefineScript("jQuery").SetUrl("jquery.min.js", "jquery.js").SetVersion("2.1.4").SetCdn("//ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.4.min.js", "//ajax.aspnetcdn.com/ajax/jQuery/jquery-2.1.4.js"); // jQuery UI (full package). - manifest.DefineScript("jQueryUI").SetUrl("jquery-ui.min.js", "jquery-ui.js").SetVersion("1.11.4").SetDependencies("jQuery").SetCdn("//ajax.aspnetcdn.com/ajax/jquery.ui/1.11.4/jquery-ui.min.js", "//ajax.aspnetcdn.com/ajax/jquery.ui/1.11.4/jquery-ui.js", true); + manifest.DefineScript("jQueryUI").SetUrl("jquery-ui.min.js", "jquery-ui.js").SetVersion("1.11.4").SetDependencies("jQuery").SetCdn("//ajax.aspnetcdn.com/ajax/jquery.ui/1.11.4/jquery-ui.min.js", "//ajax.aspnetcdn.com/ajax/jquery.ui/1.11.4/jquery-ui.js"); manifest.DefineStyle("jQueryUI").SetUrl("jquery-ui.min.css", "jquery-ui.css").SetVersion("1.11.4"); manifest.DefineStyle("jQueryUI_Orchard").SetDependencies("jQueryUI"); // Right now no customization in the styles, but the resource might be used later. diff --git a/src/Orchard.Web/Modules/Orchard.jQuery/ResourceManifest.cs b/src/Orchard.Web/Modules/Orchard.jQuery/ResourceManifest.cs index 17bfa8080..727771df7 100644 --- a/src/Orchard.Web/Modules/Orchard.jQuery/ResourceManifest.cs +++ b/src/Orchard.Web/Modules/Orchard.jQuery/ResourceManifest.cs @@ -4,11 +4,11 @@ namespace Orchard.jQuery { public class ResourceManifest : IResourceManifestProvider { public void BuildManifests(ResourceManifestBuilder builder) { var manifest = builder.Add(); - manifest.DefineScript("jQuery").SetUrl("jquery-1.11.1.min.js", "jquery-1.11.1.js").SetVersion("1.11.1").SetCdn("//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.11.1.min.js", "//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.11.1.js", true); - manifest.DefineScript("jQueryMigrate").SetUrl("jquery-migrate-1.2.1.min.js", "jquery-migrate-1.2.1.js").SetVersion("1.2.1").SetCdn("//ajax.aspnetcdn.com/ajax/jquery.migrate/jquery-migrate-1.2.1.min.js", "//ajax.aspnetcdn.com/ajax/jquery.migrate/jquery-migrate-1.2.1.js", true); + manifest.DefineScript("jQuery").SetUrl("jquery-1.11.1.min.js", "jquery-1.11.1.js").SetVersion("1.11.1").SetCdn("//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.11.1.min.js", "//ajax.aspnetcdn.com/ajax/jQuery/jquery-1.11.1.js"); + manifest.DefineScript("jQueryMigrate").SetUrl("jquery-migrate-1.2.1.min.js", "jquery-migrate-1.2.1.js").SetVersion("1.2.1").SetCdn("//ajax.aspnetcdn.com/ajax/jquery.migrate/jquery-migrate-1.2.1.min.js", "//ajax.aspnetcdn.com/ajax/jquery.migrate/jquery-migrate-1.2.1.js"); // Full jQuery UI package. - manifest.DefineScript("jQueryUI").SetUrl("ui/jquery-ui.min.js", "ui/jquery-ui.js").SetVersion("1.11.2").SetDependencies("jQuery").SetCdn("//ajax.aspnetcdn.com/ajax/jquery.ui/1.11.2/jquery-ui.min.js", "//ajax.aspnetcdn.com/ajax/jquery.ui/1.11.2/jquery-ui.js", true); + manifest.DefineScript("jQueryUI").SetUrl("ui/jquery-ui.min.js", "ui/jquery-ui.js").SetVersion("1.11.2").SetDependencies("jQuery").SetCdn("//ajax.aspnetcdn.com/ajax/jquery.ui/1.11.2/jquery-ui.min.js", "//ajax.aspnetcdn.com/ajax/jquery.ui/1.11.2/jquery-ui.js"); manifest.DefineStyle("jQueryUI").SetUrl("jquery-ui.min.css", "jquery-ui.css").SetVersion("1.11.2"); manifest.DefineStyle("jQueryUI_Structure").SetUrl("jquery-ui.structure.min.css", "jquery-ui.structure.css").SetVersion("1.11.2"); manifest.DefineStyle("jQueryUI_Theme").SetUrl("jquery-ui.theme.min.css", "jquery-ui.theme.css").SetVersion("1.11.2"); diff --git a/src/Orchard/UI/Resources/ResourceDefinition.cs b/src/Orchard/UI/Resources/ResourceDefinition.cs index ebaae011f..5a871cba8 100644 --- a/src/Orchard/UI/Resources/ResourceDefinition.cs +++ b/src/Orchard/UI/Resources/ResourceDefinition.cs @@ -15,7 +15,7 @@ namespace Orchard.UI.Resources { { "script", "src" }, { "link", "href" } }; - private static readonly Dictionary> _resourceAttributes = new Dictionary> { + private static readonly Dictionary> _resourceAttributes = new Dictionary> { { "script", new Dictionary { {"type", "text/javascript"} } }, { "stylesheet", new Dictionary { {"type", "text/css"}, {"rel", "stylesheet"} } } }; @@ -39,7 +39,7 @@ namespace Orchard.UI.Resources { TagRenderMode = _fileTagRenderModes.ContainsKey(TagBuilder.TagName) ? _fileTagRenderModes[TagBuilder.TagName] : TagRenderMode.Normal; Dictionary attributes; if (_resourceAttributes.TryGetValue(type, out attributes)) { - foreach(var pair in attributes) { + foreach (var pair in attributes) { TagBuilder.Attributes[pair.Key] = pair.Value; } } @@ -72,7 +72,7 @@ namespace Orchard.UI.Resources { } return null; } - + public IResourceManifest Manifest { get; private set; } public string TagName { get { return TagBuilder.TagName; } @@ -98,6 +98,7 @@ namespace Orchard.UI.Resources { public string UrlCdn { get; private set; } public string UrlCdnDebug { get; private set; } public string[] Cultures { get; private set; } + [Obsolete("This parameter has no effect on the resource URL.")] public bool CdnSupportsSsl { get; private set; } public IEnumerable Dependencies { get; private set; } public string FilePathAttributeName { get; private set; } @@ -134,25 +135,22 @@ namespace Orchard.UI.Resources { } public ResourceDefinition SetCdn(string cdnUrl) { - return SetCdn(cdnUrl, null, null); + return SetCdn(cdnUrl, null); } public ResourceDefinition SetCdn(string cdnUrl, string cdnUrlDebug) { - return SetCdn(cdnUrl, cdnUrlDebug, null); + if (string.IsNullOrWhiteSpace(cdnUrl)) throw new ArgumentNullException("cdnUrl"); + + UrlCdn = cdnUrl; + + if (!string.IsNullOrWhiteSpace(cdnUrlDebug)) UrlCdnDebug = cdnUrlDebug; + + return this; } - public ResourceDefinition SetCdn(string cdnUrl, string cdnUrlDebug, bool? cdnSupportsSsl) { - if (String.IsNullOrEmpty(cdnUrl)) { - throw new ArgumentNullException("cdnUrl"); - } - UrlCdn = cdnUrl; - if (cdnUrlDebug != null) { - UrlCdnDebug = cdnUrlDebug; - } - if (cdnSupportsSsl.HasValue) { - CdnSupportsSsl = cdnSupportsSsl.Value; - } - return this; + [Obsolete("Use SetCdn without the \"cdnSupportsSsl\" parameter instead as it has no effect.")] + public ResourceDefinition SetCdn(string cdnUrl, string cdnUrlDebug, bool cdnSupportsSsl) { + return SetCdn(cdnUrl, cdnUrlDebug); } /// @@ -204,8 +202,8 @@ namespace Orchard.UI.Resources { url = VirtualPathUtility.Combine(BasePath, url); } if (VirtualPathUtility.IsAppRelative(url)) { - url = applicationPath != null - ? VirtualPathUtility.ToAbsolute(url, applicationPath) + url = applicationPath != null + ? VirtualPathUtility.ToAbsolute(url, applicationPath) : VirtualPathUtility.ToAbsolute(url); } _urlResolveCache[settings] = url;