mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Merge branch '1.10.x' into dev
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Projections.Models;
|
||||
|
||||
namespace Orchard.Projections.FieldTypeEditors {
|
||||
/// <summary>
|
||||
|
||||
@@ -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; }
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
namespace Orchard.Projections {
|
||||
namespace Orchard.Projections.Models {
|
||||
public enum QueryVersionScopeOptions {
|
||||
Published,
|
||||
Latest,
|
||||
@@ -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" />
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Orchard.Projections.Descriptors.Filter;
|
||||
using Orchard.Projections.Models;
|
||||
|
||||
namespace Orchard.Projections.ViewModels {
|
||||
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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())));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user