Merge branch '1.10.x' into dev

This commit is contained in:
Lombiq
2019-05-21 16:32:04 +02:00
committed by Benedek Farkas
9 changed files with 22 additions and 11 deletions

View File

@@ -1,6 +1,6 @@
using Orchard.ContentManagement;
namespace Orchard.Projections {
namespace Orchard.Projections.Models {
public static class QueryVersionScopeOptionsExtensions {
public static VersionOptions ToVersionOptions(this QueryVersionScopeOptions scope) {
switch (scope) {

View File

@@ -1,6 +1,7 @@
using System;
using Orchard.ContentManagement;
using Orchard.Localization;
using Orchard.Projections.Models;
namespace Orchard.Projections.FieldTypeEditors {
/// <summary>

View File

@@ -6,7 +6,7 @@ namespace Orchard.Projections.Models {
public class QueryPart : ContentPart<QueryPartRecord> {
public string Name {
get { return this.As<TitlePart>().Title; }
get { return this.As<TitlePart>().Title; }
set { this.As<TitlePart>().Title = value; }
}

View File

@@ -1,4 +1,4 @@
namespace Orchard.Projections {
namespace Orchard.Projections.Models {
public enum QueryVersionScopeOptions {
Published,
Latest,

View File

@@ -188,7 +188,7 @@
<Compile Include="Providers\Layouts\ShapeLayoutForms.cs" />
<Compile Include="Providers\Properties\CustomValueProperties.cs" />
<Compile Include="Navigation\NavigationQueryProvider.cs" />
<Compile Include="QueryVersionScopeOptions.cs" />
<Compile Include="Models\QueryVersionScopeOptions.cs" />
<Compile Include="Services\DraftFieldIndexService.cs" />
<Compile Include="Services\IDraftFieldIndexService.cs" />
<Compile Include="Shapes.cs" />

View File

@@ -1,4 +1,5 @@
using Orchard.Projections.Descriptors.Filter;
using Orchard.Projections.Models;
namespace Orchard.Projections.ViewModels {

View File

@@ -1,7 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Orchard.Projections.Models;
namespace Orchard.Projections.ViewModels {
public class QueryViewModel {

View File

@@ -1,8 +1,10 @@
@model Orchard.Projections.ViewModels.QueryViewModel
@using Orchard.Projections;
@using Orchard.Projections.Models;
@using Orchard.Projections.ViewModels;
@model QueryViewModel
<fieldset>
@Html.LabelFor(m => m.VersionScope, T("Content's version"))
@Html.DropDownListFor(m=>m.VersionScope, new SelectList(Enum.GetValues(typeof(QueryVersionScopeOptions)), Model.VersionScope))
@Html.DropDownListFor(m => m.VersionScope, new SelectList(Enum.GetValues(typeof(QueryVersionScopeOptions)), Model.VersionScope))
<span class="hint">@T("The content's version to query.")</span>
</fieldset>

View File

@@ -286,6 +286,11 @@ namespace Orchard.ContentManagement {
}
public IEnumerable<T> GetMany<T>(IEnumerable<int> ids, VersionOptions options, QueryHints hints) where T : class, IContent {
if (!ids.Any()) {
// since there are no ids, I have to get no item, so it makes
// sense to not do anything at all
return Enumerable.Empty<T>();
}
var contentItemVersionRecords = GetManyImplementation(hints, (contentItemCriteria, contentItemVersionCriteria) => {
contentItemCriteria.Add(Restrictions.In("Id", ids.ToArray()));
if (options.IsPublished) {
@@ -318,6 +323,11 @@ namespace Orchard.ContentManagement {
public IEnumerable<ContentItem> GetManyByVersionId(IEnumerable<int> versionRecordIds, QueryHints hints) {
if (!versionRecordIds.Any()) {
// since there are no ids, I have to get no item, so it makes
// sense to not do anything at all
return Enumerable.Empty<ContentItem>();
}
var contentItemVersionRecords = GetManyImplementation(hints, (contentItemCriteria, contentItemVersionCriteria) =>
contentItemVersionCriteria.Add(Restrictions.In("Id", versionRecordIds.ToArray())));