Merge branch '1.10.x' into dev

# Conflicts:
#	src/Orchard.Web/Modules/Orchard.ContentTypes/Views/DisplayTemplates/EditTypeViewModel.cshtml
#	src/Orchard.Web/Modules/Orchard.Recipes/Views/Admin/Index.cshtml
#	src/Orchard.Web/Modules/Orchard.Resources/Bootstrap.cs
#	src/Orchard.Web/Modules/Orchard.Resources/jQuery.cs
#	src/Orchard/UI/Resources/ResourceDefinition.cs
This commit is contained in:
Lombiq
2019-08-29 23:34:49 +02:00
committed by Benedek Farkas
9 changed files with 54 additions and 40 deletions

View File

@@ -180,7 +180,9 @@ namespace Orchard.Autoroute.Services {
}
public void RemoveAliases(AutoroutePart part) {
_aliasService.Delete(part.Path, AliasSource);
if (part != null) {
_aliasService.Delete(part.Path, AliasSource);
}
}
public string GenerateUniqueSlug(AutoroutePart part, IEnumerable<string> existingPaths) {

View File

@@ -4,7 +4,7 @@
@Html.EditorFor(m => m.Creatable)
<label for="@Html.FieldIdFor(m => m.Creatable)" class="forcheckbox">@T("Creatable")</label>
@Html.ValidationMessageFor(m => m.Creatable)
<span class="hint">@T("Determines if an instance of this content type can be created through the UI.")</span>
<span class="hint">@T("Determines if this type is listed among the types creatable through the UI. This setting doesn't affect security.")</span>
</fieldset>
<fieldset>

View File

@@ -1,22 +1,26 @@
@model Orchard.ContentTypes.ViewModels.EditTypeViewModel
@using Orchard.Core.Contents.Settings;
@{
var settings = Model.Settings.GetModel<ContentTypeSettings>();
var creatable = settings.Creatable;
var stereotype = Model.Settings.ContainsKey("Stereotype") ? Model.Settings["Stereotype"] : default(string);
var stereotype = Model.Settings.ContainsKey("Stereotype") ? Model.Settings["Stereotype"] : "";
}
<div class="summary">
<div class="properties">
<h3>@Model.DisplayName</h3> @if (!string.IsNullOrWhiteSpace(stereotype)) { <text><span class="stereotype" title="Stereotype">- @stereotype</span></text>}
@if (creatable) {
<p class="pageStatus">@Html.ActionLink(T("Create New {0}", Html.Raw(Model.DisplayName)).Text, "Create", new {area = "Contents", id = Model.Name})</p>
<h3>@Model.DisplayName</h3>
@if (!string.IsNullOrWhiteSpace(stereotype)) { <text><span class="stereotype" title="Stereotype">- @stereotype</span></text> }
@if (settings.Creatable) {
<p class="pageStatus">@Html.ActionLink(T("Create New {0}", Html.Raw(Model.DisplayName)).Text, "Create", new {area = "Contents", id = Model.Name})</p>
}
</div>
<div class="related">
<ul class="action-links">
@if (creatable) {
@if (settings.Listable) {
<li class="action-link">
@Html.ActionLink(T("List Items").ToString(), "List", new { area = "Contents", id = Model.Name })
@Html.ActionLink(T("List Items").Text, "List", new { area = "Contents", id = Model.Name })
</li>
}
<li class="action-link">

View File

@@ -10,16 +10,26 @@
if (Model.Modules.Any()) {
<ul class="contentItems">
@foreach (var module in Model.Modules.OrderBy(m => m.Descriptor.Name)) {
var descriptor = module.Descriptor;
if (string.IsNullOrWhiteSpace(descriptor.Version)) {
descriptor.Version = "1.0";
}
<li>
<div class="summary">
<div class="properties">
<h2>@module.Descriptor.Name<span> - @T("Version: {0}", !string.IsNullOrEmpty(module.Descriptor.Version) ? module.Descriptor.Version : T("1.0").ToString())</span></h2>
<h2>@descriptor.Name<span> - @T("Version: {0}", descriptor.Version)</span></h2>
@foreach (var recipe in module.Recipes) {
if (string.IsNullOrWhiteSpace(recipe.Description)) {
recipe.Description = T("No description.").Text;
}
<br />
<div>
<h4>@recipe.Name.CamelFriendly() - @Html.ActionLink(T("Execute").Text, "Recipes", "Admin", new { area = "Orchard.Recipes", moduleId = module.Descriptor.Id, name = recipe.Name }, new { itemprop = "UnsafeUrl" })</h4>
<p>@(!string.IsNullOrEmpty(recipe.Description) ? recipe.Description : T("No description").ToString())</p>
<h4>@recipe.Name - @Html.ActionLink(T("Execute").Text, "Recipes", "Admin", new { area = "Orchard.Recipes", moduleId = descriptor.Id, name = recipe.Name }, new { itemprop = "UnsafeUrl" })</h4>
<p>@recipe.Description</p>
</div>
}
</div>
@@ -29,6 +39,6 @@
</ul>
}
else {
<p>@T("No modules available").ToString()</p>
<p>@T("No modules available").Text</p>
}
}

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("4.3.1").SetCdn("//ajax.aspnetcdn.com/ajax/bootstrap/4.3.1/css/bootstrap.min.css", "//ajax.aspnetcdn.com/ajax/bootstrap/4.3.1/css/bootstrap.css", true);
manifest.DefineScript("Bootstrap").SetUrl("bootstrap.min.js", "bootstrap.js").SetVersion("4.3.1").SetDependencies("jQuery").SetCdn("//ajax.aspnetcdn.com/ajax/bootstrap/4.3.1/bootstrap.bundle.min.js", "//ajax.aspnetcdn.com/ajax/bootstrap/4.3.1/bootstrap.bundle.js", true);
manifest.DefineStyle("Bootstrap").SetUrl("bootstrap.min.css", "bootstrap.css").SetVersion("4.3.1").SetCdn("//ajax.aspnetcdn.com/ajax/bootstrap/4.3.1/css/bootstrap.min.css", "//ajax.aspnetcdn.com/ajax/bootstrap/4.3.1/css/bootstrap.css");
manifest.DefineScript("Bootstrap").SetUrl("bootstrap.min.js", "bootstrap.js").SetVersion("4.3.1").SetDependencies("jQuery").SetCdn("//ajax.aspnetcdn.com/ajax/bootstrap/4.3.1/bootstrap.bundle.min.js", "//ajax.aspnetcdn.com/ajax/bootstrap/4.3.1/bootstrap.bundle.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("3.3.1").SetCdn("//ajax.aspnetcdn.com/ajax/jQuery/jquery-3.3.1.min.js", "//ajax.aspnetcdn.com/ajax/jQuery/jquery-3.3.1.js", true);
manifest.DefineScript("jQuery").SetUrl("jquery.min.js", "jquery.js").SetVersion("3.3.1").SetCdn("//ajax.aspnetcdn.com/ajax/jQuery/jquery-3.3.1.min.js", "//ajax.aspnetcdn.com/ajax/jQuery/jquery-3.3.1.js");
// jQuery UI (full package).
manifest.DefineScript("jQueryUI").SetUrl("jquery-ui.min.js", "jquery-ui.js").SetVersion("1.12.1").SetDependencies("jQuery").SetCdn("//ajax.aspnetcdn.com/ajax/jquery.ui/1.12.1/jquery-ui.min.js", "//ajax.aspnetcdn.com/ajax/jquery.ui/1.12.1/jquery-ui.js", true);
manifest.DefineScript("jQueryUI").SetUrl("jquery-ui.min.js", "jquery-ui.js").SetVersion("1.12.1").SetDependencies("jQuery").SetCdn("//ajax.aspnetcdn.com/ajax/jquery.ui/1.12.1/jquery-ui.min.js", "//ajax.aspnetcdn.com/ajax/jquery.ui/1.12.1/jquery-ui.js");
manifest.DefineStyle("jQueryUI").SetUrl("jquery-ui.min.css", "jquery-ui.css").SetVersion("1.12.1");
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

@@ -16,7 +16,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"} } }
};
@@ -41,7 +41,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;
}
}
@@ -65,7 +65,7 @@ namespace Orchard.UI.Resources {
_resourceTypeDirectories.TryGetValue(resourceType, out path);
return path ?? "";
}
private static string Coalesce(params string[] strings) {
foreach (var str in strings) {
if (!String.IsNullOrEmpty(str)) {
@@ -74,7 +74,7 @@ namespace Orchard.UI.Resources {
}
return null;
}
public IResourceManifest Manifest { get; private set; }
public string TagName {
get { return TagBuilder.TagName; }
@@ -120,6 +120,7 @@ namespace Orchard.UI.Resources {
}
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; }
@@ -156,30 +157,27 @@ 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");
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;
}
if (!string.IsNullOrWhiteSpace(cdnUrlDebug)) UrlCdnDebug = cdnUrlDebug;
else {
CdnSupportsSsl = cdnUrl.StartsWith("https", StringComparison.OrdinalIgnoreCase);
}
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);
}
public ResourceDefinition SetPhysicalPath(string physicalPath) {
return SetPhysicalPath(physicalPath, null);
}
@@ -259,8 +257,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);
}
if (settings.FileHashMode && !String.IsNullOrEmpty(physicalPath) && File.Exists(physicalPath)) {