mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-18 17:47:54 +08:00
Merge
--HG-- branch : dev
This commit is contained in:
@@ -66,13 +66,71 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
if (model.ContainerId != null)
|
||||
query = query.Join<CommonRecord>().Where(cr => cr.Container.Id == model.ContainerId);
|
||||
|
||||
var contentItems = query.Slice(skip, pageSize);
|
||||
// Ordering
|
||||
//-- want something like
|
||||
//switch (model.Options.OrderBy) {
|
||||
// case ContentsOrder.Modified:
|
||||
// query = query.OrderByDescending<CommonRecord, DateTime?>(cr => cr.ModifiedUtc);
|
||||
// break;
|
||||
// case ContentsOrder.Published:
|
||||
// query = query.OrderByDescending<CommonRecord, DateTime?>(cr => cr.PublishedUtc);
|
||||
// break;
|
||||
// case ContentsOrder.Created:
|
||||
// query = query.OrderByDescending<CommonRecord, DateTime?>(cr => cr.CreatedUtc);
|
||||
// break;
|
||||
//}
|
||||
|
||||
//-- but resorting to
|
||||
|
||||
IEnumerable<ContentItem> contentItems = query.List();
|
||||
switch (model.Options.OrderBy) {
|
||||
case ContentsOrder.Modified:
|
||||
contentItems = contentItems.OrderByDescending(ci => ci.VersionRecord.Id);
|
||||
break;
|
||||
//case ContentsOrder.Published:
|
||||
// would be lying w/out a published date instead of a bool but that only comes with the common aspect
|
||||
// contentItems = contentItems.OrderByDescending(ci => ci.VersionRecord.Published/*Date*/);
|
||||
// break;
|
||||
case ContentsOrder.Created:
|
||||
contentItems = contentItems.OrderByDescending(ci => ci.Id);
|
||||
break;
|
||||
}
|
||||
|
||||
//-- for the moment
|
||||
//-- because I'd rather do this
|
||||
|
||||
//var contentItems = query.Slice(skip, pageSize);
|
||||
|
||||
//-- instead of this (having the ordering and skip/take after the query)
|
||||
|
||||
contentItems = contentItems.Skip(skip).Take(pageSize);
|
||||
|
||||
model.Entries = contentItems.Select(BuildEntry).ToList();
|
||||
model.Options.SelectedFilter = model.TypeName;
|
||||
model.Options.FilterOptions = _contentDefinitionManager.ListTypeDefinitions()
|
||||
.Select(ctd => new KeyValuePair<string, string>(ctd.Name, ctd.DisplayName))
|
||||
.ToList().OrderBy(kvp => kvp.Key);
|
||||
|
||||
return View("List", model);
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("List")]
|
||||
[FormValueRequired("submit.Filter")]
|
||||
public ActionResult ListFilterPOST(ContentOptions options) {
|
||||
var routeValues = ControllerContext.RouteData.Values;
|
||||
if (options != null) {
|
||||
routeValues["Options.OrderBy"] = options.OrderBy; //todo: don't hard-code the key
|
||||
if (_contentDefinitionManager.ListTypeDefinitions().Any(ctd => string.Equals(ctd.Name, options.SelectedFilter, StringComparison.OrdinalIgnoreCase))) {
|
||||
routeValues["id"] = options.SelectedFilter;
|
||||
}
|
||||
else {
|
||||
routeValues.Remove("id");
|
||||
}
|
||||
}
|
||||
|
||||
return RedirectToAction("List", routeValues);
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("List")]
|
||||
[FormValueRequired("submit.BulkEdit")]
|
||||
public ActionResult ListPOST(ContentOptions options, IEnumerable<int> itemIds, string returnUrl) {
|
||||
|
@@ -33,26 +33,19 @@ namespace Orchard.Core.Contents.ViewModels {
|
||||
|
||||
public class ContentOptions {
|
||||
public ContentOptions() {
|
||||
Filter = ContentsFilter.All;
|
||||
Order = ContentsOrder.Modified;
|
||||
OrderBy = ContentsOrder.Modified;
|
||||
BulkAction = ContentsBulkAction.None;
|
||||
}
|
||||
public ContentsFilter Filter { get; set; }
|
||||
public ContentsOrder Order { get; set; }
|
||||
public string SelectedFilter { get; set; }
|
||||
public IEnumerable<KeyValuePair<string, string>> FilterOptions { get; set; }
|
||||
public ContentsOrder OrderBy { get; set; }
|
||||
public ContentsBulkAction BulkAction { get; set; }
|
||||
}
|
||||
|
||||
public enum ContentsFilter {
|
||||
All,
|
||||
Page,
|
||||
BlogPost
|
||||
}
|
||||
|
||||
public enum ContentsOrder {
|
||||
Modified,
|
||||
Published,
|
||||
Created,
|
||||
Title
|
||||
Created
|
||||
}
|
||||
|
||||
public enum ContentsBulkAction {
|
||||
|
@@ -15,23 +15,23 @@ using (Html.BeginFormAntiForgeryPost()) { %>
|
||||
</select>
|
||||
<button type="submit" name="submit.BulkEdit" value="yes"><%:T("Apply") %></button>
|
||||
</fieldset>
|
||||
<%-- <fieldset class="bulk-actions">
|
||||
<label for="filterResults" class="bulk-filter"><%:T("Filter")%></label>
|
||||
<select id="filterResults" name="<%:Html.NameOf(m => m.Options.Filter) %>">
|
||||
<%:Html.SelectOption(Model.Options.Filter, ContentsFilter.All, T("All Content").ToString())%>
|
||||
<%:Html.SelectOption(Model.Options.Filter, ContentsFilter.Page, T("Page").ToString())%>
|
||||
<%:Html.SelectOption(Model.Options.Filter, ContentsFilter.BlogPost, T("Blog Post").ToString())%>
|
||||
<fieldset class="bulk-actions">
|
||||
<label for="filterResults" class="bulk-filter"><%:T("Show only of type")%></label>
|
||||
<select id="filterResults" name="<%:Html.NameOf(m => m.Options.SelectedFilter) %>">
|
||||
<%:Html.SelectOption(Model.Options.SelectedFilter, "", T("Any (show all)").ToString()) %>
|
||||
<% foreach(var filterOption in Model.Options.FilterOptions) { %>
|
||||
<%:Html.SelectOption(Model.Options.SelectedFilter, filterOption.Key, filterOption.Value) %><%
|
||||
} %>
|
||||
</select>
|
||||
<label for="orderResults" class="bulk-order"><%:T("Ordered by")%></label>
|
||||
<select id="orderResults" name="<%:Html.NameOf(m => m.Options.Order) %>">
|
||||
<%:Html.SelectOption(Model.Options.Order, ContentsOrder.Created, T("Date Created").ToString())%>
|
||||
<%:Html.SelectOption(Model.Options.Order, ContentsOrder.Modified, T("Date Modified").ToString())%>
|
||||
<%:Html.SelectOption(Model.Options.Order, ContentsOrder.Published, T("Date Published").ToString())%>
|
||||
<%:Html.SelectOption(Model.Options.Order, ContentsOrder.Title, T("Title").ToString())%>
|
||||
<select id="orderResults" name="<%:Html.NameOf(m => m.Options.OrderBy) %>">
|
||||
<%:Html.SelectOption(Model.Options.OrderBy, ContentsOrder.Created, T("most recently created").ToString())%>
|
||||
<%:Html.SelectOption(Model.Options.OrderBy, ContentsOrder.Modified, T("most recently modified").ToString())%>
|
||||
<%--<%:Html.SelectOption(Model.Options.OrderBy, ContentsOrder.Published, T("Date Published").ToString())%>--%>
|
||||
</select>
|
||||
<button type="submit" name="submit.Filter"><%:T("Apply") %></button>
|
||||
<button type="submit" name="submit.Filter" value="yes please"><%:T("Apply") %></button>
|
||||
</fieldset>
|
||||
--%> <fieldset class="contentItems bulk-items">
|
||||
<fieldset class="contentItems bulk-items">
|
||||
<%:Html.UnorderedList(
|
||||
Model.Entries,
|
||||
(entry, i) => Html.DisplayForItem(entry.ViewModel),
|
||||
|
@@ -33,7 +33,7 @@ namespace Orchard.Core.PublishLater.ViewModels {
|
||||
get { return IsPublished || ContentItem.ContentManager.Get(ContentItem.Id, VersionOptions.Published) != null; }
|
||||
}
|
||||
|
||||
public DateTime? VersionPublishedUtc { get { return ContentItem.As<CommonAspect>().VersionPublishedUtc; } }
|
||||
public DateTime? VersionPublishedUtc { get { return ContentItem.As<CommonAspect>() == null ? null : ContentItem.As<CommonAspect>().VersionPublishedUtc; } }
|
||||
|
||||
public DateTime? ScheduledPublishUtc { get; set; }
|
||||
|
||||
|
@@ -63,10 +63,10 @@ namespace Orchard.Core.Routable.Services {
|
||||
public IEnumerable<IsRoutable> GetSimilarSlugs(string contentType, string slug)
|
||||
{
|
||||
return
|
||||
_contentManager.Query(contentType).Join<RoutableRecord>()
|
||||
_contentManager.Query().Join<RoutableRecord>()
|
||||
.List()
|
||||
.Select(i => i.As<IsRoutable>())
|
||||
.Where(routable => routable.Path.Equals(slug, StringComparison.OrdinalIgnoreCase)) // todo: for some reason the filter doesn't work within the query, even without StringComparison or StartsWith
|
||||
.Where(routable => routable.Path != null && routable.Path.Equals(slug, StringComparison.OrdinalIgnoreCase)) // todo: for some reason the filter doesn't work within the query, even without StringComparison or StartsWith
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
|
@@ -89,7 +89,7 @@ namespace Orchard.Blogs.Drivers {
|
||||
}).ToList()
|
||||
},
|
||||
"Parts/Blogs.BlogPost.List",
|
||||
"").Location("primary"));
|
||||
"").LongestMatch(displayType, "DetailAdmin").Location("primary"));
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(Blog blog) {
|
||||
|
@@ -134,6 +134,7 @@
|
||||
<Content Include="Views\DisplayTemplates\Items\Blogs.Blog.ascx" />
|
||||
<Content Include="Views\DisplayTemplates\Parts\Blogs.Blog.Manage.ascx" />
|
||||
<Content Include="Views\DisplayTemplates\Parts\Blogs.BlogPost.List.ascx" />
|
||||
<Content Include="Views\DisplayTemplates\Parts\Blogs.BlogPost.List.DetailAdmin.ascx" />
|
||||
<Content Include="Views\DisplayTemplates\Items\Blogs.Blog.Summary.ascx" />
|
||||
<Content Include="Views\DisplayTemplates\Parts\Blogs.Blog.Description.ascx" />
|
||||
<Content Include="Views\DisplayTemplates\Parts\Blogs.Blog.Metadata.ascx" />
|
||||
|
@@ -0,0 +1,28 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<ListContentsViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.Core.Contents.ViewModels" %>
|
||||
<%@ Import Namespace="Orchard.Utility.Extensions" %>
|
||||
<%
|
||||
if (Model.Entries.Count() < 1) { %>
|
||||
<div class="info message"><%:T("There are no posts for this blog.") %></div><%
|
||||
}
|
||||
else {
|
||||
using (Html.BeginFormAntiForgeryPost(Url.Action("List", "Admin", new { area = "Contents", id = "" }))) { %>
|
||||
<fieldset class="bulk-actions">
|
||||
<label for="publishActions"><%:T("Actions:") %></label>
|
||||
<select id="publishActions" name="<%:Html.NameOf(m => m.Options.BulkAction) %>">
|
||||
<%:Html.SelectOption(Model.Options.BulkAction, ContentsBulkAction.None, T("Choose action...").ToString()) %>
|
||||
<%:Html.SelectOption(Model.Options.BulkAction, ContentsBulkAction.PublishNow, T("Publish Now").ToString()) %>
|
||||
<%:Html.SelectOption(Model.Options.BulkAction, ContentsBulkAction.Unpublish, T("Unpublish").ToString()) %>
|
||||
<%:Html.SelectOption(Model.Options.BulkAction, ContentsBulkAction.Remove, T("Remove").ToString()) %>
|
||||
</select>
|
||||
<%:Html.Hidden("returnUrl", ViewContext.RequestContext.HttpContext.Request.ToUrlString()) %>
|
||||
<button type="submit" name="submit.BulkEdit" value="yes"><%:T("Apply") %></button>
|
||||
</fieldset>
|
||||
<fieldset class="contentItems bulk-items">
|
||||
<%:Html.UnorderedList(
|
||||
Model.Entries,
|
||||
(entry, i) => Html.DisplayForItem(entry.ViewModel),
|
||||
"") %>
|
||||
</fieldset><%
|
||||
}
|
||||
} %>
|
@@ -1,28 +1,3 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<ListContentsViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.Core.Contents.ViewModels" %>
|
||||
<%@ Import Namespace="Orchard.Utility.Extensions" %>
|
||||
<%
|
||||
if (Model.Entries.Count() < 1) { %>
|
||||
<div class="info message"><%:T("There are no posts for this blog.") %></div><%
|
||||
}
|
||||
else {
|
||||
using (Html.BeginFormAntiForgeryPost(Url.Action("List", "Admin", new { area = "Contents", id = "" }))) { %>
|
||||
<fieldset class="bulk-actions">
|
||||
<label for="publishActions"><%:T("Actions:") %></label>
|
||||
<select id="publishActions" name="<%:Html.NameOf(m => m.Options.BulkAction) %>">
|
||||
<%:Html.SelectOption(Model.Options.BulkAction, ContentsBulkAction.None, T("Choose action...").ToString()) %>
|
||||
<%:Html.SelectOption(Model.Options.BulkAction, ContentsBulkAction.PublishNow, T("Publish Now").ToString()) %>
|
||||
<%:Html.SelectOption(Model.Options.BulkAction, ContentsBulkAction.Unpublish, T("Unpublish").ToString()) %>
|
||||
<%:Html.SelectOption(Model.Options.BulkAction, ContentsBulkAction.Remove, T("Remove").ToString()) %>
|
||||
</select>
|
||||
<%:Html.Hidden("returnUrl", ViewContext.RequestContext.HttpContext.Request.ToUrlString()) %>
|
||||
<button type="submit" name="submit.BulkEdit" value="yes"><%:T("Apply") %></button>
|
||||
</fieldset>
|
||||
<fieldset class="contentItems bulk-items">
|
||||
<%:Html.UnorderedList(
|
||||
Model.Entries,
|
||||
(entry, i) => Html.DisplayForItem(entry.ViewModel),
|
||||
"") %>
|
||||
</fieldset><%
|
||||
}
|
||||
} %>
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.Core.Contents.ViewModels.ListContentsViewModel>" %>
|
||||
<%: Html.UnorderedList(Model.Entries, (bp, i) => Html.DisplayForItem(bp.ViewModel), "blogPosts contentItems") %>
|
||||
<% if (Model.Entries.Count() < 1) { %><p><%: T("There are no posts for this blog.") %></p><% } %>
|
||||
|
@@ -8,6 +8,7 @@ using Orchard.Core.Common.Models;
|
||||
using Orchard.Core.Common.Settings;
|
||||
using Orchard.Core.Navigation.Models;
|
||||
using Orchard.Core.Routable.Models;
|
||||
using Orchard.Core.Settings.Descriptor.Records;
|
||||
using Orchard.Core.Settings.Models;
|
||||
using Orchard.Data;
|
||||
using Orchard.Data.Migration.Interpreters;
|
||||
@@ -108,14 +109,21 @@ namespace Orchard.Setup.Services {
|
||||
|
||||
// initialize database explicitly, and store shell descriptor
|
||||
var bootstrapLifetimeScope = _shellContainerFactory.CreateContainer(shellSettings, shellToplogy);
|
||||
using (var environment = new StandaloneEnvironment(bootstrapLifetimeScope)) {
|
||||
using ( var environment = new StandaloneEnvironment(bootstrapLifetimeScope) ) {
|
||||
|
||||
var schemaBuilder = new SchemaBuilder(environment.Resolve<IDataMigrationInterpreter>() );
|
||||
// check if the database is already created (in case an exception occured in the second phase)
|
||||
var shellDescriptorRepository = environment.Resolve<IRepository<ShellDescriptorRecord>>();
|
||||
try {
|
||||
shellDescriptorRepository.Get(x => true);
|
||||
}
|
||||
catch {
|
||||
var schemaBuilder = new SchemaBuilder(environment.Resolve<IDataMigrationInterpreter>());
|
||||
var reportsCoordinator = environment.Resolve<IReportsCoordinator>();
|
||||
|
||||
reportsCoordinator.Register("Data Migration", "Setup", "Orchard installation");
|
||||
|
||||
schemaBuilder.CreateTable("Orchard_Framework_DataMigrationRecord", table => table
|
||||
schemaBuilder.CreateTable("Orchard_Framework_DataMigrationRecord",
|
||||
table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey().Identity())
|
||||
.Column<string>("DataMigrationClass")
|
||||
.Column<int>("Version"));
|
||||
@@ -131,6 +139,7 @@ namespace Orchard.Setup.Services {
|
||||
shellDescriptor.Features,
|
||||
shellDescriptor.Parameters);
|
||||
}
|
||||
}
|
||||
|
||||
// in effect "pump messages" see PostMessage circa 1980
|
||||
while ( _processingEngine.AreTasksPending() )
|
||||
|
@@ -139,7 +139,6 @@
|
||||
<Content Include="Themes\ClassicDark\Views\DisplayTemplates\Items\Blogs.Blog.Summary.ascx" />
|
||||
<Content Include="Themes\ClassicDark\Views\DisplayTemplates\Items\Blogs.BlogPost.ascx" />
|
||||
<Content Include="Themes\ClassicDark\Views\DisplayTemplates\Items\Blogs.BlogPost.Summary.ascx" />
|
||||
<Content Include="Themes\ClassicDark\Views\DisplayTemplates\Parts\Blogs.BlogPost.List.ascx" />
|
||||
<Content Include="Themes\ClassicDark\Views\DisplayTemplates\Parts\Blogs.BlogPost.Metadata.ascx" />
|
||||
<Content Include="Themes\ClassicDark\Views\DisplayTemplates\Parts\Pages.Page.Metadata.ascx" />
|
||||
<Content Include="Themes\ClassicDark\Views\Footer.ascx" />
|
||||
@@ -157,7 +156,6 @@
|
||||
<Content Include="Themes\Classic\Views\DisplayTemplates\Items\Blogs.Blog.Summary.ascx" />
|
||||
<Content Include="Themes\Classic\Views\DisplayTemplates\Items\Blogs.BlogPost.ascx" />
|
||||
<Content Include="Themes\Classic\Views\DisplayTemplates\Items\Blogs.BlogPost.Summary.ascx" />
|
||||
<Content Include="Themes\Classic\Views\DisplayTemplates\Parts\Blogs.BlogPost.List.ascx" />
|
||||
<Content Include="Themes\Classic\Views\DisplayTemplates\Parts\Pages.Page.Metadata.ascx" />
|
||||
<Content Include="Themes\Classic\Views\Footer.ascx" />
|
||||
<Content Include="Themes\Classic\Views\Layout.ascx" />
|
||||
@@ -192,7 +190,6 @@
|
||||
<Content Include="Themes\Contoso\Views\DisplayTemplates\Items\Blogs.BlogPost.ascx" />
|
||||
<Content Include="Themes\Contoso\Views\DisplayTemplates\Items\Pages.Page.ascx" />
|
||||
<Content Include="Themes\Contoso\Views\DisplayTemplates\Items\Blogs.BlogPost.ListByArchive.ascx" />
|
||||
<Content Include="Themes\Contoso\Views\DisplayTemplates\Parts\Blogs.BlogPost.List.ascx" />
|
||||
<Content Include="Themes\Contoso\Views\DisplayTemplates\Parts\Comments.HasComments.ascx" />
|
||||
<Content Include="Themes\Contoso\Views\DisplayTemplates\Parts\Pages.Page.Metadata.ascx" />
|
||||
<Content Include="Themes\Contoso\Views\DisplayTemplates\Parts\Tags.ShowTags.ascx" />
|
||||
@@ -237,7 +234,6 @@
|
||||
<Content Include="Themes\Corporate\Views\DisplayTemplates\Items\Blogs.BlogPost.ascx" />
|
||||
<Content Include="Themes\Corporate\Views\DisplayTemplates\Items\Blogs.BlogPost.ListByArchive.ascx" />
|
||||
<Content Include="Themes\Corporate\Views\DisplayTemplates\Items\Pages.Page.ascx" />
|
||||
<Content Include="Themes\Corporate\Views\DisplayTemplates\Parts\Blogs.BlogPost.List.ascx" />
|
||||
<Content Include="Themes\Corporate\Views\DisplayTemplates\Parts\Comments.HasComments.ascx" />
|
||||
<Content Include="Themes\Corporate\Views\DisplayTemplates\Parts\Pages.Page.Metadata.ascx" />
|
||||
<Content Include="Themes\Corporate\Views\DisplayTemplates\Parts\Tags.ShowTags.ascx" />
|
||||
|
@@ -1,5 +0,0 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<IEnumerable<ContentItemViewModel<BlogPost>>>" %>
|
||||
<%@ Import Namespace="Orchard.Mvc.ViewModels"%>
|
||||
<%@ Import Namespace="Orchard.Blogs.Models"%>
|
||||
<%: Html.UnorderedList(Model, (bp, i) => Html.DisplayForItem(bp), "blogPosts contentItems") %>
|
||||
<% if (Model.Count() < 1) { %><p><%: T("There are no posts for this blog.") %></p><% } %>
|
@@ -1,5 +0,0 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<IEnumerable<ContentItemViewModel<BlogPost>>>" %>
|
||||
<%@ Import Namespace="Orchard.Mvc.ViewModels"%>
|
||||
<%@ Import Namespace="Orchard.Blogs.Models"%>
|
||||
<%: Html.UnorderedList(Model, (bp, i) => Html.DisplayForItem(bp), "blogPosts contentItems") %>
|
||||
<% if (Model.Count() < 1) { %><p><%: T("There are no posts for this blog.") %></p><% } %>
|
@@ -1,6 +0,0 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<IEnumerable<ContentItemViewModel<BlogPost>>>" %>
|
||||
<%@ Import Namespace="Orchard.Mvc.ViewModels"%>
|
||||
<%@ Import Namespace="Orchard.Blogs.Models"%>
|
||||
|
||||
<%: Html.UnorderedList(Model, (bp, i) => Html.DisplayForItem(bp), "blogPosts contentItems") %>
|
||||
<% if (Model.Count() < 1) { %><p><%: T("There are no posts for this blog.") %></p><% } %>
|
@@ -1,6 +0,0 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<IEnumerable<ContentItemViewModel<BlogPost>>>" %>
|
||||
<%@ Import Namespace="Orchard.Mvc.ViewModels"%>
|
||||
<%@ Import Namespace="Orchard.Blogs.Models"%>
|
||||
|
||||
<%: Html.UnorderedList(Model, (bp, i) => Html.DisplayForItem(bp), "blogPosts contentItems") %>
|
||||
<% if (Model.Count() < 1) { %><p><%: T("There are no posts for this blog.") %></p><% } %>
|
Reference in New Issue
Block a user