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:
ErikPorter
2010-01-13 23:51:07 +00:00
parent d195d2b231
commit 133220d976
5 changed files with 20 additions and 29 deletions

View File

@@ -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; } }

View File

@@ -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));
}
}

View File

@@ -1,8 +0,0 @@
using System;
using Orchard.ContentManagement.Records;
namespace Orchard.Pages.Models {
public class PageRecord : ContentPartRecord {
public virtual DateTime? Published { get; set; }
}
}

View File

@@ -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" />

View File

@@ -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) {