mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-11-28 17:32:44 +08:00
Removed PageRecord since it's no longer needed.
--HG-- extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4045370
This commit is contained in:
@@ -5,7 +5,7 @@ using Orchard.Core.Common.Models;
|
||||
using Orchard.Security;
|
||||
|
||||
namespace Orchard.Pages.Models {
|
||||
public class Page : ContentPart<PageRecord> {
|
||||
public class Page : ContentPart {
|
||||
[HiddenInput(DisplayValue = false)]
|
||||
public int Id { get { return ContentItem.Id; } }
|
||||
|
||||
|
||||
@@ -9,13 +9,12 @@ using Orchard.ContentManagement.Handlers;
|
||||
namespace Orchard.Pages.Models {
|
||||
[UsedImplicitly]
|
||||
public class PageHandler : ContentHandler {
|
||||
public PageHandler(IRepository<PageRecord> repository, IRepository<CommonVersionRecord> commonRepository) {
|
||||
public PageHandler(IRepository<CommonVersionRecord> commonRepository) {
|
||||
Filters.Add(new ActivatingFilter<Page>(PageDriver.ContentType.Name));
|
||||
Filters.Add(new ActivatingFilter<CommonAspect>(PageDriver.ContentType.Name));
|
||||
Filters.Add(new ActivatingFilter<ContentPart<CommonVersionRecord>>(PageDriver.ContentType.Name));
|
||||
Filters.Add(new ActivatingFilter<RoutableAspect>(PageDriver.ContentType.Name));
|
||||
Filters.Add(new ActivatingFilter<BodyAspect>(PageDriver.ContentType.Name));
|
||||
Filters.Add(new StorageFilter<PageRecord>(repository));
|
||||
Filters.Add(new StorageFilter<CommonVersionRecord>(commonRepository));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
using System;
|
||||
using Orchard.ContentManagement.Records;
|
||||
|
||||
namespace Orchard.Pages.Models {
|
||||
public class PageRecord : ContentPartRecord {
|
||||
public virtual DateTime? Published { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -80,7 +80,6 @@
|
||||
<Compile Include="Extensions\UriExtensions.cs" />
|
||||
<Compile Include="Models\Page.cs" />
|
||||
<Compile Include="Models\PageHandler.cs" />
|
||||
<Compile Include="Models\PageRecord.cs" />
|
||||
<Compile Include="Permissions.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Routes.cs" />
|
||||
|
||||
@@ -18,29 +18,30 @@ namespace Orchard.Pages.Services {
|
||||
}
|
||||
|
||||
public IEnumerable<Page> Get(PageStatus status) {
|
||||
IEnumerable<ContentItem> contentItems;
|
||||
|
||||
switch (status) {
|
||||
case PageStatus.All:
|
||||
return _contentManager.Query<Page, PageRecord>(VersionOptions.Latest).List();
|
||||
contentItems = _contentManager.Query(VersionOptions.Latest, "page").List();
|
||||
break;
|
||||
case PageStatus.Published:
|
||||
return _contentManager.Query<Page, PageRecord>(VersionOptions.Published).List();
|
||||
contentItems = _contentManager.Query(VersionOptions.Published, "page").List();
|
||||
break;
|
||||
case PageStatus.Offline:
|
||||
IEnumerable<Page> allPages = _contentManager.Query<Page, PageRecord>(VersionOptions.Latest).List();
|
||||
List<Page> offlinePages = new List<Page>();
|
||||
foreach (var page in allPages) {
|
||||
if (page.ContentItem.VersionRecord.Published == false) {
|
||||
offlinePages.Add(page);
|
||||
}
|
||||
}
|
||||
return offlinePages;
|
||||
contentItems = _contentManager.Query(VersionOptions.Latest, "page").List().Where(ci => !ci.VersionRecord.Published);
|
||||
break;
|
||||
default:
|
||||
return new List<Page>();
|
||||
contentItems = new List<Page>().Cast<ContentItem>();
|
||||
break;
|
||||
}
|
||||
|
||||
return contentItems.Select(ci => ci.As<Page>());
|
||||
}
|
||||
|
||||
public Page Get(string slug) {
|
||||
return _contentManager.Query<Page, PageRecord>()
|
||||
.Join<RoutableRecord>().Where(rr => rr.Slug == slug)
|
||||
.List().FirstOrDefault();
|
||||
return
|
||||
_contentManager.Query("page").Join<RoutableRecord>().Where(rr => rr.Slug == slug).List().FirstOrDefault
|
||||
().As<Page>();
|
||||
}
|
||||
|
||||
public Page GetLatest(int id) {
|
||||
@@ -48,9 +49,9 @@ namespace Orchard.Pages.Services {
|
||||
}
|
||||
|
||||
public Page GetLatest(string slug) {
|
||||
return _contentManager.Query<Page, PageRecord>(VersionOptions.Latest)
|
||||
.Join<RoutableRecord>().Where(rr => rr.Slug == slug)
|
||||
.Slice(0, 1).FirstOrDefault();
|
||||
return
|
||||
_contentManager.Query(VersionOptions.Latest, "page").Join<RoutableRecord>().Where(rr => rr.Slug == slug)
|
||||
.Slice(0, 1).FirstOrDefault().As<Page>();
|
||||
}
|
||||
|
||||
public Page GetPageOrDraft(string slug) {
|
||||
|
||||
Reference in New Issue
Block a user