#19515: Moving ContentMenuItemPart to Content.Picker

Work Item: 19515

--HG--
branch : 1.x
This commit is contained in:
Sebastien Ros
2013-03-13 12:08:00 -07:00
parent 5cbbaca0dc
commit 875b28b6c5
32 changed files with 167 additions and 112 deletions

View File

@@ -23,7 +23,7 @@ namespace Orchard.Specs.Bindings {
webApp.GivenIHaveACleanSiteWith(
virtualDirectory,
TableData(
new { extension = "Module", names = "Orchard.Setup, Orchard.Pages, Orchard.Blogs, Orchard.Messaging, Orchard.Media, Orchard.MediaPicker, Orchard.ContentPicker, Orchard.Modules, Orchard.Packaging, Orchard.PublishLater, Orchard.Themes, Orchard.Scripting, Orchard.Widgets, Orchard.Users, Orchard.ContentTypes, Orchard.Roles, Orchard.Comments, Orchard.jQuery, Orchard.Tags, TinyMce, Orchard.Packaging, Orchard.Recipes, Orchard.Warmup, Orchard.Alias, Orchard.Forms, Orchard.Tokens, Orchard.Autoroute, Orchard.Projections, Orchard.Fields" },
new { extension = "Module", names = "Orchard.Setup, Orchard.Pages, Orchard.ContentPicker, Orchard.Blogs, Orchard.Messaging, Orchard.Media, Orchard.MediaPicker, Orchard.ContentPicker, Orchard.Modules, Orchard.Packaging, Orchard.PublishLater, Orchard.Themes, Orchard.Scripting, Orchard.Widgets, Orchard.Users, Orchard.ContentTypes, Orchard.Roles, Orchard.Comments, Orchard.jQuery, Orchard.Tags, TinyMce, Orchard.Packaging, Orchard.Recipes, Orchard.Warmup, Orchard.Alias, Orchard.Forms, Orchard.Tokens, Orchard.Autoroute, Orchard.Projections, Orchard.Fields" },
new { extension = "Core", names = "Common, Containers, Dashboard, Feeds, Navigation, Contents, Scheduling, Settings, Shapes, XmlRpc, Title, Reports" },
new { extension = "Theme", names = "SafeMode, TheAdmin, TheThemeMachine" }));

View File

@@ -6,7 +6,7 @@ Feature: Setup
Scenario: Root request shows setup form
Given I have a clean site with
| extension | names |
| Module | Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Messaging, Orchard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce |
| Module | Orchard.Setup, Orchard.Pages, Orchard.ContentPicker, Orchard.Users, Orchard.Roles, Orchard.Messaging, Orchard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce |
| Core | Common, Contents, Dashboard, Feeds, Navigation, Scheduling, Settings, Shapes, XmlRpc, Title |
| Theme | SafeMode |
When I go to "/"
@@ -17,7 +17,7 @@ Scenario: Root request shows setup form
Scenario: Setup folder also shows setup form
Given I have a clean site with
| extension | names |
| Module | Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Messaging, Orchard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce |
| Module | Orchard.Setup, Orchard.Pages, Orchard.ContentPicker, Orchard.Users, Orchard.Roles, Orchard.Messaging, Orchard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce |
| Core | Common, Contents, Dashboard, Feeds, Navigation, Scheduling, Settings, Shapes, XmlRpc, Title |
| Theme | SafeMode |
When I go to "/Setup"
@@ -28,7 +28,7 @@ Scenario: Setup folder also shows setup form
Scenario: Some of the initial form values are required
Given I have a clean site with
| extension | names |
| Module | Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Messaging, Orchard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce |
| Module | Orchard.Setup, Orchard.Pages, Orchard.ContentPicker, Orchard.Users, Orchard.Roles, Orchard.Messaging, Orchard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce |
| Core | Common, Contents, Dashboard, Feeds, Navigation, Scheduling, Settings, Shapes, XmlRpc, Title |
| Theme | SafeMode |
When I go to "/Setup"
@@ -39,7 +39,7 @@ Scenario: Some of the initial form values are required
Scenario: Calling setup on a brand new install
Given I have a clean site with
| extension | names |
| Module | Orchard.Setup, Orchard.Pages, Orchard.Blogs, Orchard.Messaging, Orchard.Media, Orchard.MediaPicker, Orchard.ContentPicker, Orchard.Modules, Orchard.Packaging, Orchard.PublishLater, Orchard.Themes, Orchard.Scripting, Orchard.Widgets, Orchard.Users, Orchard.ContentTypes, Orchard.Roles, Orchard.Comments, Orchard.jQuery, Orchard.Tags, TinyMce, Orchard.Packaging, Orchard.Recipes, Orchard.Warmup, Orchard.Alias, Orchard.Forms, Orchard.Tokens, Orchard.Autoroute, Orchard.Projections, Orchard.Fields |
| Module | Orchard.Setup, Orchard.Pages, Orchard.ContentPicker, Orchard.Blogs, Orchard.Messaging, Orchard.Media, Orchard.MediaPicker, Orchard.ContentPicker, Orchard.Modules, Orchard.Packaging, Orchard.PublishLater, Orchard.Themes, Orchard.Scripting, Orchard.Widgets, Orchard.Users, Orchard.ContentTypes, Orchard.Roles, Orchard.Comments, Orchard.jQuery, Orchard.Tags, TinyMce, Orchard.Packaging, Orchard.Recipes, Orchard.Warmup, Orchard.Alias, Orchard.Forms, Orchard.Tokens, Orchard.Autoroute, Orchard.Projections, Orchard.Fields |
| Core | Common, Containers, Dashboard, Feeds, Navigation, Contents, Scheduling, Settings, Shapes, XmlRpc, Title |
| Theme | SafeMode, TheAdmin, TheThemeMachine |
And I am on "/Setup"

View File

@@ -3,7 +3,7 @@
// This code was generated by SpecFlow (http://www.specflow.org/).
// SpecFlow Version:1.9.0.77
// SpecFlow Generator Version:1.9.0.0
// Runtime Version:4.0.30319.18003
// Runtime Version:4.0.30319.18010
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
@@ -78,8 +78,9 @@ this.ScenarioSetup(scenarioInfo);
"names"});
table1.AddRow(new string[] {
"Module",
"Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Messaging, Or" +
"chard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce"});
"Orchard.Setup, Orchard.Pages, Orchard.ContentPicker, Orchard.Users, Orchard.Roles" +
", Orchard.Messaging, Orchard.Comments, Orchard.PublishLater, Orchard.Themes, Orc" +
"hard.jQuery, TinyMce"});
table1.AddRow(new string[] {
"Core",
"Common, Contents, Dashboard, Feeds, Navigation, Scheduling, Settings, Shapes, Xml" +
@@ -114,8 +115,9 @@ this.ScenarioSetup(scenarioInfo);
"names"});
table2.AddRow(new string[] {
"Module",
"Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Messaging, Or" +
"chard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce"});
"Orchard.Setup, Orchard.Pages, Orchard.ContentPicker, Orchard.Users, Orchard.Roles" +
", Orchard.Messaging, Orchard.Comments, Orchard.PublishLater, Orchard.Themes, Orc" +
"hard.jQuery, TinyMce"});
table2.AddRow(new string[] {
"Core",
"Common, Contents, Dashboard, Feeds, Navigation, Scheduling, Settings, Shapes, Xml" +
@@ -150,8 +152,9 @@ this.ScenarioSetup(scenarioInfo);
"names"});
table3.AddRow(new string[] {
"Module",
"Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Messaging, Or" +
"chard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce"});
"Orchard.Setup, Orchard.Pages, Orchard.ContentPicker, Orchard.Users, Orchard.Roles" +
", Orchard.Messaging, Orchard.Comments, Orchard.PublishLater, Orchard.Themes, Orc" +
"hard.jQuery, TinyMce"});
table3.AddRow(new string[] {
"Core",
"Common, Contents, Dashboard, Feeds, Navigation, Scheduling, Settings, Shapes, Xml" +
@@ -188,7 +191,7 @@ this.ScenarioSetup(scenarioInfo);
"names"});
table4.AddRow(new string[] {
"Module",
@"Orchard.Setup, Orchard.Pages, Orchard.Blogs, Orchard.Messaging, Orchard.Media, Orchard.MediaPicker, Orchard.ContentPicker, Orchard.Modules, Orchard.Packaging, Orchard.PublishLater, Orchard.Themes, Orchard.Scripting, Orchard.Widgets, Orchard.Users, Orchard.ContentTypes, Orchard.Roles, Orchard.Comments, Orchard.jQuery, Orchard.Tags, TinyMce, Orchard.Packaging, Orchard.Recipes, Orchard.Warmup, Orchard.Alias, Orchard.Forms, Orchard.Tokens, Orchard.Autoroute, Orchard.Projections, Orchard.Fields"});
@"Orchard.Setup, Orchard.Pages, Orchard.ContentPicker, Orchard.Blogs, Orchard.Messaging, Orchard.Media, Orchard.MediaPicker, Orchard.ContentPicker, Orchard.Modules, Orchard.Packaging, Orchard.PublishLater, Orchard.Themes, Orchard.Scripting, Orchard.Widgets, Orchard.Users, Orchard.ContentTypes, Orchard.Roles, Orchard.Comments, Orchard.jQuery, Orchard.Tags, TinyMce, Orchard.Packaging, Orchard.Recipes, Orchard.Warmup, Orchard.Alias, Orchard.Forms, Orchard.Tokens, Orchard.Autoroute, Orchard.Projections, Orchard.Fields"});
table4.AddRow(new string[] {
"Core",
"Common, Containers, Dashboard, Feeds, Navigation, Contents, Scheduling, Settings," +

View File

@@ -10,11 +10,6 @@ namespace Orchard.Core.Navigation {
.Attachable()
.WithDescription("Provides an easy way to create a ContentMenuItem from the content editor."));
ContentDefinitionManager.AlterPartDefinition("NavigationPart", builder => builder
.Attachable()
.WithDescription("Allows the management of Content Menu Items associated with a Content Item."));
ContentDefinitionManager.AlterTypeDefinition("Page", cfg => cfg.WithPart("NavigationPart"));
SchemaBuilder.CreateTable("MenuItemPartRecord",
table => table
.ContentPartRecord()
@@ -84,22 +79,6 @@ namespace Orchard.Core.Navigation {
.Attachable()
.WithDescription("Adds a menu item to the Admin menu that links to this content item."));
SchemaBuilder.CreateTable("ContentMenuItemPartRecord",
table => table
.ContentPartRecord()
.Column<int>("ContentMenuItemRecord_id")
);
ContentDefinitionManager.AlterTypeDefinition("ContentMenuItem", cfg => cfg
.WithPart("MenuPart")
.WithPart("CommonPart")
.WithPart("IdentityPart")
.WithPart("ContentMenuItemPart")
.DisplayedAs("Content Menu Item")
.WithSetting("Description", "Adds a Content Item to the menu.")
.WithSetting("Stereotype", "MenuItem")
);
SchemaBuilder.CreateTable("ShapeMenuItemPartRecord",
table => table.ContentPartRecord()
.Column<string>("ShapeType")
@@ -179,24 +158,6 @@ namespace Orchard.Core.Navigation {
.WithSetting("Stereotype", "MenuItem")
);
ContentDefinitionManager.AlterPartDefinition("NavigationPart", builder => builder.Attachable());
SchemaBuilder.CreateTable("ContentMenuItemPartRecord",
table => table
.ContentPartRecord()
.Column<int>("ContentMenuItemRecord_id")
);
ContentDefinitionManager.AlterTypeDefinition("ContentMenuItem", cfg => cfg
.WithPart("MenuPart")
.WithPart("CommonPart")
.WithPart("IdentityPart")
.WithPart("ContentMenuItemPart")
.DisplayedAs("Content Menu Item")
.WithSetting("Description", "Adds a Content Item to the menu.")
.WithSetting("Stereotype", "MenuItem")
);
return 3;
}
@@ -223,9 +184,6 @@ namespace Orchard.Core.Navigation {
ContentDefinitionManager.AlterPartDefinition("MenuPart", builder => builder
.WithDescription("Provides an easy way to create a ContentMenuItem from the content editor."));
ContentDefinitionManager.AlterPartDefinition("NavigationPart", builder => builder
.WithDescription("Allows the management of Content Menu Items associated with a Content Item."));
ContentDefinitionManager.AlterPartDefinition("AdminMenuPart", builder => builder
.Attachable()
.WithDescription("Adds a menu item to the Admin menu that links to this content item."));

View File

@@ -7,4 +7,4 @@ OrchardVersion: 1.6
Description: The navigation module creates and manages a simple navigation menu for the front-end of the application and allows you to add content items to the admin menu.
FeatureDescription: Menu management.
Category: Core
Dependencies: Orchard.ContentPicker, Title
Dependencies: Title

View File

@@ -1,9 +1,7 @@
<Placement>
<Place Parts_Navigation_Menu_Edit="Content:9"/>
<Place Parts_Navigation_AdminMenu_Edit="Content:9.1"/>
<Place Parts_Navigation_Edit="Content:10"/>
<Place Parts_MenuItem_Edit="Content:10"/>
<Place Parts_ContentMenuItem_Edit="Content:10"/>
<Place Parts_MenuWidget_Edit="Content:10"/>
<Place Parts_MenuWidget="Content"/>
<Place Parts_ShapeMenuItemPart_Edit="Content:10"/>

View File

@@ -30,16 +30,6 @@ namespace Orchard.Core.Navigation.Services {
if (localized != null) {
culture = localized.Culture;
}
else {
// fetch the culture of the content menu item, if any
var contentMenuItemPart = part.As<ContentMenuItemPart>();
if (contentMenuItemPart != null) {
localized = contentMenuItemPart.Content.As<ILocalizableAspect>();
if (localized != null) {
culture = localized.Culture;
}
}
}
if (part.Is<MenuItemPart>())
builder.Add(new LocalizedString(HttpUtility.HtmlEncode(part.MenuText)), part.MenuPosition, item => item.Url(part.As<MenuItemPart>().Url).Content(part).Culture(culture).Permission(Contents.Permissions.ViewContent));

View File

@@ -132,26 +132,19 @@
<Compile Include="Dashboard\Services\CompilationErrorBanner.cs" />
<Compile Include="Navigation\Commands\MenuCommands.cs" />
<Compile Include="Navigation\Drivers\AdminMenuPartDriver.cs" />
<Compile Include="Navigation\Drivers\NavigationPartDriver.cs" />
<Compile Include="Navigation\Drivers\MenuItemPartDriver.cs" />
<Compile Include="Navigation\Drivers\MenuWidgetPartDriver.cs" />
<Compile Include="Navigation\Drivers\ShapeMenuItemPartDriver.cs" />
<Compile Include="Navigation\Handlers\AdminMenuPartHandler.cs" />
<Compile Include="Navigation\Handlers\ContentMenuItemPartHandler.cs" />
<Compile Include="Navigation\Handlers\NavigationPartHandler.cs" />
<Compile Include="Navigation\Handlers\MenuHandler.cs" />
<Compile Include="Navigation\Handlers\MenuWidgetPartHandler.cs" />
<Compile Include="Navigation\Handlers\ShapeMenuItemPartHandler.cs" />
<Compile Include="Navigation\Models\AdminMenuPart.cs" />
<Compile Include="Navigation\Models\AdminMenuPartRecord.cs" />
<Compile Include="Navigation\Models\ContentMenuItemPartRecord.cs" />
<Compile Include="Navigation\Models\ContentMenuItemPart.cs" />
<Compile Include="Navigation\Models\NavigationPart.cs" />
<Compile Include="Navigation\Models\MenuWidgetPartRecord.cs" />
<Compile Include="Navigation\Models\MenuWidgetPart.cs" />
<Compile Include="Navigation\Models\ShapeMenuItemPart.cs" />
<Compile Include="Navigation\Models\ShapeMenuItemPartRecord.cs" />
<Compile Include="Navigation\Security\ContentMenuItemAuthorizationEventHandler.cs" />
<Compile Include="Navigation\Services\AdminMenuNavigationProvider.cs" />
<Compile Include="Navigation\Services\DefaultMenuManager.cs" />
<Compile Include="Navigation\Services\IMenuManager.cs" />
@@ -160,8 +153,6 @@
<Compile Include="Navigation\Settings\AdminMenuPartTypeSettings.cs" />
<Compile Include="Contents\ViewModels\ListContentsViewModel.cs" />
<Compile Include="Contents\ViewModels\ListContentTypesViewModel.cs" />
<Compile Include="Navigation\ViewModels\ContentMenuItemEditViewModel.cs" />
<Compile Include="Navigation\ViewModels\NavigationPartViewModel.cs" />
<Compile Include="Navigation\ViewModels\MenuPartViewModel.cs" />
<Compile Include="Navigation\ViewModels\MenuWidgetViewModel.cs" />
<Compile Include="Reports\AdminMenu.cs" />
@@ -205,7 +196,6 @@
<Compile Include="Navigation\AdminMenu.cs" />
<Compile Include="Navigation\Controllers\AdminController.cs" />
<Compile Include="Navigation\Models\MenuItemPart.cs" />
<Compile Include="Navigation\Drivers\ContentMenuItemPartDriver.cs" />
<Compile Include="Navigation\Handlers\MenuItemPartHandler.cs" />
<Compile Include="Navigation\Models\MenuPart.cs" />
<Compile Include="Navigation\Drivers\MenuPartDriver.cs" />
@@ -542,15 +532,6 @@
<ItemGroup>
<Content Include="Navigation\Views\MenuItemLink-HtmlMenuItem.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Navigation\Views\EditorTemplates\Parts.ContentMenuItem.Edit.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Navigation\Views\MenuItemLink-ContentMenuItem.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Navigation\Views\EditorTemplates\Parts.Navigation.Edit.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Navigation\Views\Content-Menu.Edit.cshtml" />
</ItemGroup>

View File

@@ -5,6 +5,7 @@ using Orchard.Blogs.Models;
using Orchard.Commands;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Aspects;
using Orchard.ContentPicker.Models;
using Orchard.Core.Common.Models;
using Orchard.Core.Navigation.Models;
using Orchard.Security;

View File

@@ -12,5 +12,5 @@ Features:
Orchard.Blogs.RemotePublishing:
Name: Remote Blog Publishing
Description: Blog easier using a dedicated MetaWeblogAPI-compatible publishing tool.
Dependencies: XmlRpc, Orchard.Blogs, Orchard.Autoroute
Dependencies: XmlRpc, Orchard.Autoroute, Orchard.ContentPicker
Category: Content Publishing

View File

@@ -148,6 +148,10 @@
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
<Name>Orchard.Core</Name>
</ProjectReference>
<ProjectReference Include="..\Orchard.ContentPicker\Orchard.ContentPicker.csproj">
<Project>{f301ef7d-f19c-4d83-aa94-cb64f29c037d}</Project>
<Name>Orchard.ContentPicker</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="Placement.info">

View File

@@ -2,12 +2,15 @@
using Orchard.ContentManagement;
using Orchard.ContentManagement.Drivers;
using Orchard.ContentManagement.Handlers;
using Orchard.ContentPicker.Models;
using Orchard.ContentPicker.ViewModels;
using Orchard.Core.Navigation;
using Orchard.Core.Navigation.Models;
using Orchard.Core.Navigation.ViewModels;
using Orchard.Localization;
using Orchard.Security;
namespace Orchard.Core.Navigation.Drivers {
namespace Orchard.ContentPicker.Drivers {
[UsedImplicitly]
public class ContentMenuItemPartDriver : ContentPartDriver<ContentMenuItemPart> {
private readonly IContentManager _contentManager;

View File

@@ -1,5 +1,8 @@
using Orchard.ContentManagement;
using Orchard.ContentManagement.Drivers;
using Orchard.ContentPicker.Models;
using Orchard.ContentPicker.ViewModels;
using Orchard.Core.Navigation;
using Orchard.Core.Navigation.Models;
using Orchard.Core.Navigation.Services;
using Orchard.Core.Navigation.ViewModels;
@@ -8,7 +11,7 @@ using Orchard.Security;
using Orchard.UI.Navigation;
using Orchard.Utility;
namespace Orchard.Core.Navigation.Drivers {
namespace Orchard.ContentPicker.Drivers {
public class NavigationPartDriver : ContentPartDriver<NavigationPart> {
private readonly IAuthorizationService _authorizationService;

View File

@@ -1,10 +1,11 @@
using JetBrains.Annotations;
using Orchard.ContentManagement;
using Orchard.ContentPicker.Models;
using Orchard.Core.Navigation.Models;
using Orchard.Data;
using Orchard.ContentManagement.Handlers;
namespace Orchard.Core.Navigation.Handlers {
namespace Orchard.ContentPicker.Handlers {
[UsedImplicitly]
public class ContentMenuItemPartHandler : ContentHandler {
private readonly IContentManager _contentManager;

View File

@@ -1,10 +1,11 @@
using JetBrains.Annotations;
using Orchard.ContentManagement;
using Orchard.ContentPicker.Models;
using Orchard.Core.Navigation.Models;
using Orchard.Data;
using Orchard.ContentManagement.Handlers;
namespace Orchard.Core.Navigation.Handlers {
namespace Orchard.ContentPicker.Handlers {
[UsedImplicitly]
public class NavigationPartHandler : ContentHandler {
private readonly IContentManager _contentManager;

View File

@@ -0,0 +1,81 @@
using System;
using Orchard.ContentManagement.MetaData;
using Orchard.ContentManagement.Records;
using Orchard.ContentPicker.Models;
using Orchard.Core.Contents.Extensions;
using Orchard.Data;
using Orchard.Data.Migration;
using Orchard.Environment.Configuration;
using Orchard.Logging;
namespace Orchard.ContentPicker {
public class Migrations : DataMigrationImpl {
private readonly ISessionLocator _sessionLocator;
private readonly ShellSettings _shellSettings;
public Migrations(
ISessionLocator sessionLocator,
ShellSettings shellSettings) {
_sessionLocator = sessionLocator;
_shellSettings = shellSettings;
Logger = NullLogger.Instance;
}
public ILogger Logger { get; set; }
public int Create() {
SchemaBuilder.CreateTable("ContentMenuItemPartRecord",
table => table
.ContentPartRecord()
.Column<int>("ContentMenuItemRecord_id")
);
ContentDefinitionManager.AlterTypeDefinition("ContentMenuItem", cfg => cfg
.WithPart("MenuPart")
.WithPart("CommonPart")
.WithPart("IdentityPart")
.WithPart("ContentMenuItemPart")
.DisplayedAs("Content Menu Item")
.WithSetting("Description", "Adds a Content Item to the menu.")
.WithSetting("Stereotype", "MenuItem")
);
ContentDefinitionManager.AlterPartDefinition("NavigationPart", builder => builder
.Attachable()
.WithDescription("Allows the management of Content Menu Items associated with a Content Item."));
// copying records from previous version of ContentMenuItemPartRecord which was in Core
var session = _sessionLocator.For(typeof (ContentItemRecord));
var tablePrefix = String.IsNullOrEmpty(_shellSettings.DataTablePrefix) ? "" : _shellSettings.DataTablePrefix + "_";
try {
if (null != session.CreateSQLQuery("SELECT COUNT FROM " + tablePrefix + "Navigation_ContentMenuItemPartRecord").UniqueResult()) {
// if no exception is thrown, we need to upgrade previous data
var records = session.CreateSQLQuery("SELECT * FROM " + tablePrefix + "Navigation_ContentMenuItemPartRecord").List();
foreach (dynamic record in records) {
try {
session.CreateSQLQuery("INSERT INTO " + tablePrefix + "Orchard_ContentPicker_ContentMenuItemPartRecord (Id, ContentMenuItemRecord_id) VALUES (:id, :cid)")
.SetInt32("id", (int)record.Id)
.SetInt32("cid", (int)record.ContentMenuItemRecord_id)
.ExecuteUpdate();
}
catch (Exception e) {
Logger.Error(e, "Could not migrate ContentMenuItemRecord with Id: {0}", (int)record.Id);
}
}
}
}
catch {
// silently ignore exception as it means there is no content to migrate
}
return 1;
}
}
}

View File

@@ -1,7 +1,7 @@
using Orchard.ContentManagement;
using Orchard.ContentManagement.Utilities;
namespace Orchard.Core.Navigation.Models {
namespace Orchard.ContentPicker.Models {
public class ContentMenuItemPart : ContentPart<ContentMenuItemPartRecord> {
public readonly LazyField<ContentItem> _content = new LazyField<ContentItem>();

View File

@@ -1,6 +1,6 @@
using Orchard.ContentManagement.Records;
namespace Orchard.Core.Navigation.Models {
namespace Orchard.ContentPicker.Models {
public class ContentMenuItemPartRecord : ContentPartRecord {
public virtual ContentItemRecord ContentMenuItemRecord { get; set; }
}

View File

@@ -1,6 +1,6 @@
using Orchard.ContentManagement;
namespace Orchard.Core.Navigation.Models {
namespace Orchard.ContentPicker.Models {
/// <summary>
/// Allows the management of Content Menu Items associated with a Content Item
/// </summary>

View File

@@ -8,5 +8,5 @@ Description: UI for selecting Content Items.
Features:
Orchard.ContentPicker:
Description: UI for selecting Content Items.
Dependencies: Contents
Dependencies: Contents, Navigation
Category: Input Editor

View File

@@ -47,6 +47,10 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="NHibernate, Version=3.3.1.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\Orchard.Users\bin\NHibernate.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.ComponentModel.DataAnnotations">
@@ -65,6 +69,7 @@
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Compile Include="ViewModels\NavigationPartViewModel.cs" />
<Content Include="Scripts\ContentPicker.js" />
<Content Include="Styles\content-picker-admin.css" />
<Content Include="Styles\ContentPicker.css" />
@@ -73,6 +78,14 @@
<Content Include="Views\Web.config" />
<Content Include="Scripts\Web.config" />
<Content Include="Styles\Web.config" />
<Compile Include="Drivers\ContentMenuItemPartDriver.cs" />
<Compile Include="Drivers\NavigationPartDriver.cs" />
<Compile Include="Handlers\ContentMenuItemPartHandler.cs" />
<Compile Include="Handlers\NavigationPartHandler.cs" />
<Compile Include="Migrations.cs" />
<Compile Include="Models\ContentMenuItemPart.cs" />
<Compile Include="Models\ContentMenuItemPartRecord.cs" />
<Compile Include="Models\NavigationPart.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Content Include="Module.txt" />
</ItemGroup>
@@ -87,7 +100,6 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Models\" />
<Folder Include="Views\Admin\" />
</ItemGroup>
<ItemGroup>
@@ -96,11 +108,13 @@
<Compile Include="Fields\ContentPickerField.cs" />
<Compile Include="Handlers\ContentPickerFieldHandler.cs" />
<Compile Include="ResourceManifest.cs" />
<Compile Include="Security\ContentMenuItemAuthorizationEventHandler.cs" />
<Compile Include="Services\ContentPickerNavigationProvider.cs" />
<Compile Include="Services\ContentPickerShapes.cs" />
<Compile Include="Settings\ContentPickerFieldEditorEvents.cs" />
<Compile Include="Settings\ContentPickerFieldSettings.cs" />
<Compile Include="Tokens\FieldTokens.cs" />
<Compile Include="ViewModels\ContentMenuItemEditViewModel.cs" />
<Compile Include="ViewModels\ContentPickerFieldViewModel.cs" />
</ItemGroup>
<ItemGroup>
@@ -129,6 +143,15 @@
<SubType>Designer</SubType>
</Content>
</ItemGroup>
<ItemGroup>
<Content Include="Views\MenuItemLink-ContentMenuItem.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\EditorTemplates\Parts.ContentMenuItem.Edit.cshtml" />
</ItemGroup>
<ItemGroup>
<Content Include="Views\EditorTemplates\Parts.Navigation.Edit.cshtml" />
</ItemGroup>
<PropertyGroup>
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>

View File

@@ -1,5 +1,7 @@
<Placement>
<Place Fields_ContentPicker_Edit="Content:2.3"/>
<Place Parts_Navigation_Edit="Content:10"/>
<Place Parts_ContentMenuItem_Edit="Content:10"/>
<Match DisplayType="Detail">
<Place Fields_ContentPicker="Content:after"/>

View File

@@ -1,13 +1,8 @@
 using System;
using System.Collections.Generic;
using System.Linq;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Aspects;
using Orchard.Core.Common.Models;
using Orchard.Core.Navigation.Models;
using Orchard.Security;
using Orchard.ContentManagement;
using Orchard.ContentPicker.Models;
using Orchard.Security;
namespace Orchard.Core.Navigation.Security {
namespace Orchard.ContentPicker.Security {
public class ContentMenuItemAuthorizationEventHandler : IAuthorizationServiceEventHandler{
private readonly IAuthorizationService _authorizationService;

View File

@@ -1,6 +1,6 @@
using Orchard.Core.Navigation.Models;
using Orchard.ContentPicker.Models;
namespace Orchard.Core.Navigation.ViewModels {
namespace Orchard.ContentPicker.ViewModels {
public class ContentMenuItemEditViewModel {
public int ContentItemId { get; set; }
public ContentMenuItemPart Part { get; set; }

View File

@@ -1,8 +1,9 @@
using System.Collections.Generic;
using Orchard.ContentManagement;
using Orchard.ContentPicker.Models;
using Orchard.Core.Navigation.Models;
namespace Orchard.Core.Navigation.ViewModels {
namespace Orchard.ContentPicker.ViewModels {
public class NavigationPartViewModel {
public IEnumerable<MenuPart> ContentMenuItems { get; set; }
public NavigationPart Part { get; set; }

View File

@@ -1,4 +1,4 @@
@model Orchard.Core.Navigation.ViewModels.ContentMenuItemEditViewModel
@model Orchard.ContentPicker.ViewModels.ContentMenuItemEditViewModel
@{
Script.Require("ContentPicker").AtFoot();
var title = Model.Part.Content == null ? new HtmlString(T("Empty").Text) : Html.ItemDisplayText(Model.Part.Content);

View File

@@ -2,6 +2,7 @@
using Orchard.Commands;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Aspects;
using Orchard.ContentPicker.Models;
using Orchard.Core.Common.Models;
using Orchard.Core.Navigation.Models;
using Orchard.Core.Navigation.Services;

View File

@@ -6,5 +6,5 @@ Version: 1.6
OrchardVersion: 1.5
Description: Introduces a preconfigured page content type.
FeatureDescription: A basic page content type.
Dependencies: Contents
Dependencies: Contents, Orchard.ContentPicker
Category: Content

View File

@@ -19,6 +19,11 @@
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>4.0</OldToolsVersion>
<UseIISExpress>false</UseIISExpress>
<IISExpressSSLPort />
<IISExpressAnonymousAuthentication />
<IISExpressWindowsAuthentication />
<IISExpressUseClassicPipelineMode />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
@@ -60,6 +65,10 @@
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
<Name>Orchard.Core</Name>
</ProjectReference>
<ProjectReference Include="..\Orchard.ContentPicker\Orchard.ContentPicker.csproj">
<Project>{f301ef7d-f19c-4d83-aa94-cb64f29c037d}</Project>
<Name>Orchard.ContentPicker</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="Styles\menu.page-admin.css" />

View File

@@ -75,7 +75,7 @@ namespace Orchard.Setup.Services {
// Core
"Common", "Containers", "Contents", "Dashboard", "Feeds", "Navigation", "Reports", "Scheduling", "Settings", "Shapes", "Title",
// Modules
"Orchard.Pages", "Orchard.Themes", "Orchard.Users", "Orchard.Roles", "Orchard.Modules",
"Orchard.Pages", "Orchard.ContentPicker", "Orchard.Themes", "Orchard.Users", "Orchard.Roles", "Orchard.Modules",
"PackagingServices", "Orchard.Packaging", "Gallery", "Orchard.Recipes"
};