mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-07-15 19:49:51 +08:00
Merge
--HG-- branch : dev
This commit is contained in:
commit
3c9b2c8489
@ -7,20 +7,14 @@ using Orchard.ContentManagement.Drivers;
|
|||||||
using Orchard.Core.Containers.Models;
|
using Orchard.Core.Containers.Models;
|
||||||
using Orchard.Core.Containers.ViewModels;
|
using Orchard.Core.Containers.ViewModels;
|
||||||
using Orchard.Core.Routable.Models;
|
using Orchard.Core.Routable.Models;
|
||||||
using Orchard.Core.Routable.Services;
|
|
||||||
using Orchard.Localization;
|
using Orchard.Localization;
|
||||||
using Orchard.UI.Notify;
|
|
||||||
|
|
||||||
namespace Orchard.Core.Containers.Drivers {
|
namespace Orchard.Core.Containers.Drivers {
|
||||||
public class ContainablePartDriver : ContentPartDriver<ContainablePart> {
|
public class ContainablePartDriver : ContentPartDriver<ContainablePart> {
|
||||||
private readonly IContentManager _contentManager;
|
private readonly IContentManager _contentManager;
|
||||||
private readonly IRoutableService _routableService;
|
|
||||||
private readonly IOrchardServices _services;
|
|
||||||
|
|
||||||
public ContainablePartDriver(IContentManager contentManager, IRoutableService routableService, IOrchardServices services) {
|
public ContainablePartDriver(IContentManager contentManager) {
|
||||||
_contentManager = contentManager;
|
_contentManager = contentManager;
|
||||||
_routableService = routableService;
|
|
||||||
_services = services;
|
|
||||||
T = NullLocalizer.Instance;
|
T = NullLocalizer.Instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,17 +1,50 @@
|
|||||||
using Orchard.ContentManagement;
|
using System.Linq;
|
||||||
|
using Orchard.ContentManagement;
|
||||||
using Orchard.ContentManagement.Drivers;
|
using Orchard.ContentManagement.Drivers;
|
||||||
using Orchard.ContentManagement.Handlers;
|
using Orchard.ContentManagement.Handlers;
|
||||||
|
using Orchard.ContentManagement.MetaData;
|
||||||
using Orchard.Core.Common.Models;
|
using Orchard.Core.Common.Models;
|
||||||
using Orchard.Core.Containers.Models;
|
using Orchard.Core.Containers.Models;
|
||||||
using Orchard.Core.Containers.Settings;
|
using Orchard.Core.Containers.Settings;
|
||||||
using Orchard.Data;
|
using Orchard.Data;
|
||||||
|
using Orchard.Localization;
|
||||||
|
using Orchard.UI.Notify;
|
||||||
|
|
||||||
namespace Orchard.Core.Containers.Drivers {
|
namespace Orchard.Core.Containers.Drivers {
|
||||||
public class ContainerPartDriver : ContentPartDriver<ContainerPart> {
|
public class ContainerPartDriver : ContentPartDriver<ContainerPart> {
|
||||||
|
private readonly IContentDefinitionManager _contentDefinitionManager;
|
||||||
|
|
||||||
|
public ContainerPartDriver(IContentDefinitionManager contentDefinitionManager, IOrchardServices orchardServices) {
|
||||||
|
_contentDefinitionManager = contentDefinitionManager;
|
||||||
|
Services = orchardServices;
|
||||||
|
T = NullLocalizer.Instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IOrchardServices Services { get; private set; }
|
||||||
|
public Localizer T { get; set; }
|
||||||
|
|
||||||
|
protected override DriverResult Display(ContainerPart part, string displayType, dynamic shapeHelper) {
|
||||||
|
return Combined(
|
||||||
|
ContentShape("Parts_Container_Contained",
|
||||||
|
() => shapeHelper.Parts_Container_Contained(ContentPart: part)),
|
||||||
|
ContentShape("Parts_Container_Contained_Summary",
|
||||||
|
() => shapeHelper.Parts_Container_Contained_Summary(ContentPart: part)),
|
||||||
|
ContentShape("Parts_Container_Contained_SummaryAdmin",
|
||||||
|
() => shapeHelper.Parts_Container_Contained_SummaryAdmin(ContentPart: part))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
protected override DriverResult Editor(ContainerPart part, dynamic shapeHelper) {
|
protected override DriverResult Editor(ContainerPart part, dynamic shapeHelper) {
|
||||||
return Editor(part, null, shapeHelper);
|
return Editor(part, null, shapeHelper);
|
||||||
}
|
}
|
||||||
protected override DriverResult Editor(ContainerPart part, ContentManagement.IUpdateModel updater, dynamic shapeHelper) {
|
|
||||||
|
protected override DriverResult Editor(ContainerPart part, IUpdateModel updater, dynamic shapeHelper) {
|
||||||
|
// if there are no containable items then show a nice little warning
|
||||||
|
if (!_contentDefinitionManager.ListTypeDefinitions()
|
||||||
|
.Where(typeDefinition => typeDefinition.Parts.Any(partDefinition => partDefinition.PartDefinition.Name == "ContainablePart")).Any()) {
|
||||||
|
Services.Notifier.Warning(T("There are no content types in the system with a Containable part attached. Consider adding a Containable part to some content type, existing or new, in order to relate items to this (Container enabled) item."));
|
||||||
|
}
|
||||||
|
|
||||||
return ContentShape(
|
return ContentShape(
|
||||||
"Parts_Container_Edit",
|
"Parts_Container_Edit",
|
||||||
() => {
|
() => {
|
||||||
@ -24,7 +57,7 @@ namespace Orchard.Core.Containers.Drivers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class ContainerPartHandler : ContentHandler {
|
public class ContainerPartHandler : ContentHandler {
|
||||||
public ContainerPartHandler(IRepository<ContainerPartRecord> repository, IOrchardServices orchardServices) {
|
public ContainerPartHandler(IRepository<ContainerPartRecord> repository) {
|
||||||
Filters.Add(StorageFilter.For(repository));
|
Filters.Add(StorageFilter.For(repository));
|
||||||
OnInitializing<ContainerPart>((context, part) => {
|
OnInitializing<ContainerPart>((context, part) => {
|
||||||
part.Record.PageSize = part.Settings.GetModel<ContainerTypePartSettings>().PageSizeDefault
|
part.Record.PageSize = part.Settings.GetModel<ContainerTypePartSettings>().PageSizeDefault
|
||||||
|
@ -1,8 +1,17 @@
|
|||||||
<Placement>
|
<Placement>
|
||||||
|
<!-- available display shapes -->
|
||||||
|
<!--
|
||||||
|
Parts_Container_Contained
|
||||||
|
Parts_Container_Contained_Summary
|
||||||
|
Parts_Container_Contained_SummaryAdmin
|
||||||
|
-->
|
||||||
<Place Parts_Containable_Edit="Content:before.3"/>
|
<Place Parts_Containable_Edit="Content:before.3"/>
|
||||||
<Place Parts_Container_Edit="Content:5"/>
|
<Place Parts_Container_Edit="Content:5"/>
|
||||||
<Place Parts_ContainerCustom_Edit="Content:5"/>
|
<Place Parts_ContainerCustom_Edit="Content:5"/>
|
||||||
<Place Parts_ContainerWidget_Edit="Content:5"/>
|
<Place Parts_ContainerWidget_Edit="Content:5"/>
|
||||||
<Place Parts_Container_SiteSettings="Content:10"/>
|
<Place Parts_Container_SiteSettings="Content:10"/>
|
||||||
<Place Parts_ContainerWidget="Content"/>
|
<Place Parts_ContainerWidget="Content"/>
|
||||||
|
<Match DisplayType="SummaryAdmin">
|
||||||
|
<Place Parts_Container_Contained_SummaryAdmin="Actions:10"/>
|
||||||
|
</Match>
|
||||||
</Placement>
|
</Placement>
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
@using Orchard.ContentManagement;
|
||||||
|
@using Orchard.Core.Containers.Models;
|
||||||
|
@using Orchard.Utility.Extensions;
|
||||||
|
@{
|
||||||
|
ContentPart contentPart = Model.ContentPart;
|
||||||
|
}
|
||||||
|
@if (contentPart.Is<ContainerPart>()) {
|
||||||
|
@Html.Link(T("Contained Items").Text, Url.Action("List", "Admin", new { area = "Contents", containerId = contentPart.Id }))@T(" | ")
|
||||||
|
}
|
@ -8,7 +8,6 @@ using Orchard.ContentManagement;
|
|||||||
using Orchard.ContentManagement.Aspects;
|
using Orchard.ContentManagement.Aspects;
|
||||||
using Orchard.ContentManagement.MetaData;
|
using Orchard.ContentManagement.MetaData;
|
||||||
using Orchard.ContentManagement.MetaData.Models;
|
using Orchard.ContentManagement.MetaData.Models;
|
||||||
using Orchard.ContentManagement.Records;
|
|
||||||
using Orchard.Core.Common.Models;
|
using Orchard.Core.Common.Models;
|
||||||
using Orchard.Core.Contents.Settings;
|
using Orchard.Core.Contents.Settings;
|
||||||
using Orchard.Core.Contents.ViewModels;
|
using Orchard.Core.Contents.ViewModels;
|
||||||
@ -62,9 +61,10 @@ namespace Orchard.Core.Contents.Controllers {
|
|||||||
: contentTypeDefinition.Name;
|
: contentTypeDefinition.Name;
|
||||||
query = query.ForType(model.TypeName);
|
query = query.ForType(model.TypeName);
|
||||||
}
|
}
|
||||||
|
// content type and container filters are mutually exclusive
|
||||||
if (model.ContainerId != null)
|
else if (model.ContainerId != null) {
|
||||||
query = query.Join<CommonPartRecord>().Where(cr => cr.Container.Id == model.ContainerId);
|
query = query.Join<CommonPartRecord>().Where(cr => cr.Container.Id == model.ContainerId);
|
||||||
|
}
|
||||||
|
|
||||||
switch (model.Options.OrderBy) {
|
switch (model.Options.OrderBy) {
|
||||||
case ContentsOrder.Modified:
|
case ContentsOrder.Modified:
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
<!-- available display shapes -->
|
<!-- available display shapes -->
|
||||||
<!--
|
<!--
|
||||||
Parts_Contents_Publish
|
Parts_Contents_Publish
|
||||||
|
Parts_Contents_Publish_Summary
|
||||||
Parts_Contents_Publish_SummaryAdmin
|
Parts_Contents_Publish_SummaryAdmin
|
||||||
-->
|
-->
|
||||||
<!-- edit "shape" -->
|
<!-- edit "shape" -->
|
||||||
|
@ -5,8 +5,6 @@ using Orchard.Mvc.Routes;
|
|||||||
|
|
||||||
namespace Orchard.Core.Contents {
|
namespace Orchard.Core.Contents {
|
||||||
public class Routes : IRouteProvider {
|
public class Routes : IRouteProvider {
|
||||||
#region IRouteProvider Members
|
|
||||||
|
|
||||||
public void GetRoutes(ICollection<RouteDescriptor> routes) {
|
public void GetRoutes(ICollection<RouteDescriptor> routes) {
|
||||||
foreach (RouteDescriptor routeDescriptor in GetRoutes()) {
|
foreach (RouteDescriptor routeDescriptor in GetRoutes()) {
|
||||||
routes.Add(routeDescriptor);
|
routes.Add(routeDescriptor);
|
||||||
@ -18,7 +16,7 @@ namespace Orchard.Core.Contents {
|
|||||||
new RouteDescriptor {
|
new RouteDescriptor {
|
||||||
Priority = 5,
|
Priority = 5,
|
||||||
Route = new Route(
|
Route = new Route(
|
||||||
"Admin/Contents/List/{id}/InContainer/{containerId}",
|
"Admin/Contents/List/InContainer/{containerId}",
|
||||||
new RouteValueDictionary {
|
new RouteValueDictionary {
|
||||||
{"area", "Contents"},
|
{"area", "Contents"},
|
||||||
{"controller", "Admin"},
|
{"controller", "Admin"},
|
||||||
@ -32,7 +30,5 @@ namespace Orchard.Core.Contents {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -370,6 +370,9 @@
|
|||||||
<Content Include="Routable\Views\Parts\RoutableTitle_Summary.cshtml" />
|
<Content Include="Routable\Views\Parts\RoutableTitle_Summary.cshtml" />
|
||||||
<Content Include="Routable\Views\Parts\RoutableTitle_SummaryAdmin.cshtml" />
|
<Content Include="Routable\Views\Parts\RoutableTitle_SummaryAdmin.cshtml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Content Include="Containers\Views\Parts\Container.Contained.SummaryAdmin.cshtml" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
32
src/Orchard.Web/Modules/Orchard.Lists/AdminMenu.cs
Normal file
32
src/Orchard.Web/Modules/Orchard.Lists/AdminMenu.cs
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
using Orchard.ContentManagement;
|
||||||
|
using Orchard.Localization;
|
||||||
|
using Orchard.UI.Navigation;
|
||||||
|
|
||||||
|
namespace Orchard.Lists {
|
||||||
|
public class AdminMenu : INavigationProvider {
|
||||||
|
private const string ListContentTypeName = "List";
|
||||||
|
private readonly IContentManager _contentManager;
|
||||||
|
|
||||||
|
public AdminMenu(IContentManager contentManager) {
|
||||||
|
_contentManager = contentManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Localizer T { get; set; }
|
||||||
|
|
||||||
|
public string MenuName { get { return "admin"; } }
|
||||||
|
|
||||||
|
public void GetNavigation(NavigationBuilder builder) {
|
||||||
|
builder.Add(T("Lists"), "3", BuildMenu);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void BuildMenu(NavigationItemBuilder menu) {
|
||||||
|
menu.Add(T("Manage Lists"), "1.0",
|
||||||
|
item => item.Action("List", "Admin", new { area = "Contents", id = ListContentTypeName }));
|
||||||
|
|
||||||
|
var ci = _contentManager.New(ListContentTypeName);
|
||||||
|
var metadata = _contentManager.GetItemMetadata(ci);
|
||||||
|
menu.Add(T("Create New List"), "1.5",
|
||||||
|
item => item.Action(metadata.CreateRouteValues["Action"] as string, metadata.CreateRouteValues["Controller"] as string, metadata.CreateRouteValues));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -46,6 +46,7 @@
|
|||||||
<Reference Include="System.Web" />
|
<Reference Include="System.Web" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="AdminMenu.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Content Include="Module.txt" />
|
<Content Include="Module.txt" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
@ -62,7 +63,12 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Migrations.cs" />
|
<Compile Include="Migrations.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup />
|
<ItemGroup>
|
||||||
|
<Content Include="Views\Items\Content-List.SummaryAdmin.cshtml" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="Placement.info" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
7
src/Orchard.Web/Modules/Orchard.Lists/Placement.info
Normal file
7
src/Orchard.Web/Modules/Orchard.Lists/Placement.info
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
<Placement>
|
||||||
|
<Match ContentType="List">
|
||||||
|
<Match DisplayType="SummaryAdmin">
|
||||||
|
<Place Parts_Container_Contained_SummaryAdmin="-"/>
|
||||||
|
</Match>
|
||||||
|
</Match>
|
||||||
|
</Placement>
|
@ -0,0 +1,28 @@
|
|||||||
|
@using Orchard.ContentManagement;
|
||||||
|
@using Orchard.Utility.Extensions;
|
||||||
|
@{
|
||||||
|
ContentItem contentItem = Model.ContentItem;
|
||||||
|
string returnUrl = ViewContext.RequestContext.HttpContext.Request.ToUrlString();
|
||||||
|
ContentItemMetadata contentItemMetadata = contentItem.ContentManager.GetItemMetadata(contentItem);
|
||||||
|
}
|
||||||
|
<div class="summary" itemscope="itemscope" itemid="@contentItem.Id" itemtype="http://orchardproject.net/data/ContentItem">
|
||||||
|
<div class="properties">
|
||||||
|
<input type="checkbox" value="@contentItem.Id" name="itemIds"/>
|
||||||
|
<h3>@Html.Link(contentItemMetadata.DisplayText, Url.Action("List", "Admin", new { area = "Contents", containerId = contentItem.Id }))</h3>
|
||||||
|
@if (Model.Header != null) {
|
||||||
|
<div class="header">@Display(Model.Header)</div>
|
||||||
|
}
|
||||||
|
@if (Model.Meta != null) {
|
||||||
|
<div class="metadata">@Display(Model.Meta)</div>
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
<div class="related">
|
||||||
|
@Display(Model.Actions)
|
||||||
|
@Html.Link(T("List Items").Text, Url.Action("List", "Admin", new { area = "Contents", containerId = contentItem.Id }))@T(" | ")
|
||||||
|
@Html.ItemEditLink(T("Edit").Text, contentItem) @T(" | ")
|
||||||
|
@Html.Link(T("Remove").Text, Url.Action("Remove", "Admin", new { area = "Contents", id = contentItem.Id, returnUrl }), new { itemprop = "RemoveUrl UnsafeUrl" })
|
||||||
|
</div>
|
||||||
|
@if (Model.Content != null) {
|
||||||
|
<div class="primary">@Display(Model.Content)</div>
|
||||||
|
}
|
||||||
|
</div>
|
Loading…
Reference in New Issue
Block a user