Framework/UI/Resources: ResourceDefinition.CdnSupportsSsl is now obsolete

Discussion: https://github.com/OrchardCMS/Orchard/issues/6941
This commit is contained in:
Lombiq
2019-08-29 23:20:20 +02:00
committed by Benedek Farkas
parent e8f22a472c
commit ac60046468
5 changed files with 25 additions and 27 deletions

View File

@@ -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");
}
}
}

View File

@@ -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");
}
}
}

View File

@@ -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.

View File

@@ -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");

View File

@@ -15,7 +15,7 @@ namespace Orchard.UI.Resources {
{ "script", "src" },
{ "link", "href" }
};
private static readonly Dictionary<string, Dictionary<string,string>> _resourceAttributes = new Dictionary<string, Dictionary<string,string>> {
private static readonly Dictionary<string, Dictionary<string, string>> _resourceAttributes = new Dictionary<string, Dictionary<string, string>> {
{ "script", new Dictionary<string, string> { {"type", "text/javascript"} } },
{ "stylesheet", new Dictionary<string, string> { {"type", "text/css"}, {"rel", "stylesheet"} } }
};
@@ -39,7 +39,7 @@ namespace Orchard.UI.Resources {
TagRenderMode = _fileTagRenderModes.ContainsKey(TagBuilder.TagName) ? _fileTagRenderModes[TagBuilder.TagName] : TagRenderMode.Normal;
Dictionary<string, string> 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<string> 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);
}
/// <summary>
@@ -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;