mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-27 04:19:04 +08:00
Merge branch '1.10.x' into issue/8684
# Conflicts: # src/Orchard/Orchard.Framework.csproj
This commit is contained in:
@@ -29,7 +29,7 @@ namespace TinyMce.Settings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override IEnumerable<TemplateViewModel> PartFieldEditorUpdate(ContentPartFieldDefinitionBuilder builder, IUpdateModel updateModel) {
|
public override IEnumerable<TemplateViewModel> PartFieldEditorUpdate(ContentPartFieldDefinitionBuilder builder, IUpdateModel updateModel) {
|
||||||
if (!_contentLinksDependenciesEnabled || !_htmlFields.Any(x => x.Equals(builder.Name, StringComparison.InvariantCultureIgnoreCase)))
|
if (!_contentLinksDependenciesEnabled || !_htmlFields.Any(x => x.Equals(builder.FieldType, StringComparison.InvariantCultureIgnoreCase)))
|
||||||
yield break;
|
yield break;
|
||||||
|
|
||||||
var model = new ContentLinksSettings();
|
var model = new ContentLinksSettings();
|
||||||
@@ -56,4 +56,4 @@ namespace TinyMce.Settings {
|
|||||||
yield return DefinitionTemplate(model);
|
yield return DefinitionTemplate(model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
18
src/Orchard/Data/MapAsRecordAttribute.cs
Normal file
18
src/Orchard/Data/MapAsRecordAttribute.cs
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Orchard.Data {
|
||||||
|
/// <summary>
|
||||||
|
/// Marks whether a class should be mapped as an NHibernate record
|
||||||
|
/// </summary>
|
||||||
|
public class MapAsRecordAttribute : Attribute {
|
||||||
|
private readonly bool _enabled;
|
||||||
|
|
||||||
|
public MapAsRecordAttribute() : this(true) { }
|
||||||
|
|
||||||
|
public MapAsRecordAttribute(bool enabled) {
|
||||||
|
_enabled = enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Enabled => _enabled;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@ using System.Web.Mvc;
|
|||||||
using Autofac.Core;
|
using Autofac.Core;
|
||||||
using Orchard.ContentManagement;
|
using Orchard.ContentManagement;
|
||||||
using Orchard.ContentManagement.Records;
|
using Orchard.ContentManagement.Records;
|
||||||
|
using Orchard.Data;
|
||||||
using Orchard.Environment.Configuration;
|
using Orchard.Environment.Configuration;
|
||||||
using Orchard.Environment.Descriptor.Models;
|
using Orchard.Environment.Descriptor.Models;
|
||||||
using Orchard.Environment.Extensions;
|
using Orchard.Environment.Extensions;
|
||||||
@@ -96,7 +97,7 @@ namespace Orchard.Environment.ShellBuilders {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var feature = availableFeatures[shellFeature];
|
var feature = availableFeatures[shellFeature];
|
||||||
|
|
||||||
foreach (var childDependency in ExpandDependenciesInternal(availableFeatures, feature.Dependencies, dependentFeatureDescriptor: feature))
|
foreach (var childDependency in ExpandDependenciesInternal(availableFeatures, feature.Dependencies, dependentFeatureDescriptor: feature))
|
||||||
yield return childDependency;
|
yield return childDependency;
|
||||||
|
|
||||||
@@ -197,7 +198,12 @@ namespace Orchard.Environment.ShellBuilders {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static bool IsRecord(Type type) {
|
private static bool IsRecord(Type type) {
|
||||||
return ((type.Namespace ?? "").EndsWith(".Models") || (type.Namespace ?? "").EndsWith(".Records")) &&
|
var mapAsRecordAttr = type.GetCustomAttributes(typeof(MapAsRecordAttribute), false)
|
||||||
|
.OfType<MapAsRecordAttribute>()
|
||||||
|
.FirstOrDefault();
|
||||||
|
|
||||||
|
return ((type.Namespace ?? "").EndsWith(".Models") || (type.Namespace ?? "").EndsWith(".Records") || mapAsRecordAttr?.Enabled == true) &&
|
||||||
|
mapAsRecordAttr?.Enabled != false &&
|
||||||
type.GetProperty("Id") != null &&
|
type.GetProperty("Id") != null &&
|
||||||
(type.GetProperty("Id").GetAccessors()).All(x => x.IsVirtual) &&
|
(type.GetProperty("Id").GetAccessors()).All(x => x.IsVirtual) &&
|
||||||
!type.IsSealed &&
|
!type.IsSealed &&
|
||||||
|
|||||||
@@ -62,12 +62,36 @@ namespace Orchard.Localization.Services {
|
|||||||
return _workContextAccessor.GetContext().CurrentCulture;
|
return _workContextAccessor.GetContext().CurrentCulture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected Dictionary<int, CultureRecord> GetAllCulturesById() {
|
||||||
|
return _cacheManager.Get("all_culture_records_by_id", true, context => {
|
||||||
|
context.Monitor(_signals.When("culturesChanged"));
|
||||||
|
|
||||||
|
return _cultureRepository.Table
|
||||||
|
.ToDictionary(cr => cr.Id);
|
||||||
|
});
|
||||||
|
}
|
||||||
public CultureRecord GetCultureById(int id) {
|
public CultureRecord GetCultureById(int id) {
|
||||||
return _cultureRepository.Get(id);
|
var cultures = GetAllCulturesById();
|
||||||
|
CultureRecord result;
|
||||||
|
cultures.TryGetValue(id, out result);
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected Dictionary<string, CultureRecord> GetAllCulturesByName() {
|
||||||
|
return _cacheManager.Get("all_culture_records_by_name", true, context => {
|
||||||
|
context.Monitor(_signals.When("culturesChanged"));
|
||||||
|
|
||||||
|
return _cultureRepository.Table
|
||||||
|
.ToDictionary(cr => cr.Culture);
|
||||||
|
});
|
||||||
|
}
|
||||||
public CultureRecord GetCultureByName(string cultureName) {
|
public CultureRecord GetCultureByName(string cultureName) {
|
||||||
return _cultureRepository.Get(cr => cr.Culture == cultureName);
|
var cultures = GetAllCulturesByName();
|
||||||
|
CultureRecord result;
|
||||||
|
cultures.TryGetValue(cultureName, out result);
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetSiteCulture() {
|
public string GetSiteCulture() {
|
||||||
|
|||||||
@@ -157,6 +157,7 @@
|
|||||||
<Compile Include="ContentManagement\Extensions\DriverResultExtensions.cs" />
|
<Compile Include="ContentManagement\Extensions\DriverResultExtensions.cs" />
|
||||||
<Compile Include="ContentManagement\Handlers\CloneContentContext.cs" />
|
<Compile Include="ContentManagement\Handlers\CloneContentContext.cs" />
|
||||||
<Compile Include="ContentManagement\IGlobalCriteriaProvider.cs" />
|
<Compile Include="ContentManagement\IGlobalCriteriaProvider.cs" />
|
||||||
|
<Compile Include="Data\MapAsRecordAttribute.cs" />
|
||||||
<Compile Include="Data\Migration\Interpreters\PostgreSqlCommandInterpreter.cs" />
|
<Compile Include="Data\Migration\Interpreters\PostgreSqlCommandInterpreter.cs" />
|
||||||
<Compile Include="Data\NoLockInterceptor.cs" />
|
<Compile Include="Data\NoLockInterceptor.cs" />
|
||||||
<Compile Include="Data\Providers\DefaultNoLockTableProvider.cs" />
|
<Compile Include="Data\Providers\DefaultNoLockTableProvider.cs" />
|
||||||
|
|||||||
Reference in New Issue
Block a user