--HG--
branch : autoroute
This commit is contained in:
Sebastien Ros
2012-02-03 15:13:22 -08:00
21 changed files with 658 additions and 64 deletions

View File

@@ -1,9 +1,9 @@
81cb672c85fd980dd3db0515544b79a918e5eb69 src/Orchard.Web/Modules/Orchard.Alias
240a2fcf69c5c94e8da6dfb1bc2c8e7d45e6554b src/Orchard.Web/Modules/Orchard.Autoroute
6cb350661c0ee4c85a9303715019df0430b4bf0f src/Orchard.Web/Modules/Orchard.Autoroute
c54cb640d6bc14c51b9fb9bd78231bb0facec067 src/Orchard.Web/Modules/Orchard.Forms
c27801666ed3e8f9b9c7979a837e7d770763352a src/Orchard.Web/Modules/Orchard.Projections
2bf79a49eea7006847fc142891d1956882c5e285 src/Orchard.Web/Modules/Orchard.Projections
a1ef39ba4e2d0cd78b3c91d6150e841793acb34b src/Orchard.Web/Modules/Orchard.Routable
204bdef384f41bb5e463bed6b98a056945a7d839 src/Orchard.Web/Modules/Orchard.Rules
ce578373f907c0a55fd91229a344f0755f290174 src/Orchard.Web/Modules/Orchard.TaskLease
5910b8af112fc7911456144bf83cb9a5d6ae8067 src/Orchard.Web/Modules/Orchard.Tokens
f85cb3ab7bfed57222de02993f3d6d89f5c66192 src/Orchard.Web/Modules/Orchard.Tokens
c47e38db47abfaca2585bc7a34dd6820233d9f87 src/orchard.web/modules/Orchard.Fields

View File

@@ -71,7 +71,7 @@ namespace Orchard.Specs.Bindings {
var contentTypeDefinition = new ContentTypeDefinition(name, name);
cdm.StoreTypeDefinition(contentTypeDefinition);
cdm.AlterTypeDefinition(name, cfg => cfg.WithPart("CommonPart").WithPart("BodyPart").WithPart("RoutePart").WithPart("ContainablePart").Creatable().Draftable());
cdm.AlterTypeDefinition(name, cfg => cfg.WithPart("CommonPart").WithPart("BodyPart").WithPart("AutoroutePart").WithPart("ContainablePart").Creatable().Draftable());
}
});
}

View File

@@ -291,18 +291,15 @@ namespace Orchard.Core.Contents.Controllers {
if (!Services.Authorizer.Authorize(Permissions.EditContent, contentItem, T("Couldn't edit content")))
return new HttpUnauthorizedResult();
// store the previous route in case a back redirection is requested
// TODO: (PH:Autoroute) This won't be needed if automatic redirect aliases are implemented; otherwise, needs fixing
/*
string previousRoute = null;
if(contentItem.Has<RoutePart>()
if(contentItem.Has<IAliasAspect>()
&&!string.IsNullOrWhiteSpace(returnUrl)
&& Url.IsLocalUrl(returnUrl)
// only if the original returnUrl is the content itself
&& String.Equals(returnUrl, Url.ItemDisplayUrl(contentItem), StringComparison.OrdinalIgnoreCase)
) {
previousRoute = contentItem.As<RoutePart>().Path;
}*/
previousRoute = contentItem.As<IAliasAspect>().Path;
}
dynamic model = _contentManager.UpdateEditor(contentItem, this);
if (!ModelState.IsValid) {
@@ -313,15 +310,12 @@ namespace Orchard.Core.Contents.Controllers {
conditionallyPublish(contentItem);
// did the route change ?
// TODO: (PH:Autoroute) This won't be needed if automatic redirect aliases are implemented; otherwise, needs fixing
/*
if (!string.IsNullOrWhiteSpace(returnUrl)
&& previousRoute != null
&& !String.Equals(contentItem.As<RoutePart>().Path, previousRoute, StringComparison.OrdinalIgnoreCase)) {
&& !String.Equals(contentItem.As<IAliasAspect>().Path, previousRoute, StringComparison.OrdinalIgnoreCase)) {
returnUrl = Url.ItemDisplayUrl(contentItem);
}
*/
Services.Notifier.Information(string.IsNullOrWhiteSpace(contentItem.TypeDefinition.DisplayName)
? T("Your content has been saved.")
: T("Your {0} has been saved.", contentItem.TypeDefinition.DisplayName));

View File

@@ -88,26 +88,5 @@ namespace Orchard.Blogs {
ContentDefinitionManager.AlterTypeDefinition("BlogPost", cfg => cfg.WithPart("CommonPart", p => p.WithSetting("DateEditorSettings.ShowDateEditor", "true")));
return 4;
}
public int UpdateFrom4() {
// TODO: (PH:Autoroute) SQL copy routes and titles and generate aliases for existing items
ContentDefinitionManager.AlterTypeDefinition("Blog",
cfg => cfg
.RemovePart("RoutePart")
.WithPart("TitlePart")
.WithPart("AutoroutePart")
);
ContentDefinitionManager.AlterTypeDefinition("BlogPost",
cfg => cfg
.RemovePart("RoutePart")
.WithPart("TitlePart")
.WithPart("AutoroutePart")
);
return 5;
}
}
}

View File

@@ -367,10 +367,9 @@ namespace Orchard.Blogs.Services {
.Set("description", blogPostPart.Text)
.Set("link", url)
.Set("permaLink", url);
dynamic dBlogPost = blogPostPart;
if (dBlogPost.AutoroutePart != null) {
blogStruct.Set("wp_slug", dBlogPost.AutoroutePart.Alias);
}
blogStruct.Set("wp_slug", blogPostPart.As<IAliasAspect>().Path);
if (blogPostPart.PublishedUtc != null) {
blogStruct.Set("dateCreated", blogPostPart.PublishedUtc);

View File

@@ -10,7 +10,7 @@ namespace Orchard.Experimental {
ContentDefinitionManager.AlterTypeDefinition("ListItem",
cfg => cfg
.WithPart("CommonPart")
.WithPart("RoutePart")
.WithPart("AutoroutePart")
.WithPart("BodyPart")
.WithPart("ContainablePart")
.Creatable()

View File

@@ -27,19 +27,5 @@ namespace Orchard.Lists {
ContentDefinitionManager.AlterTypeDefinition("List", cfg => cfg.WithPart("AdminMenuPart", p => p.WithSetting("AdminMenuPartTypeSettings.DefaultPosition", "2")));
return 3;
}
public int UpdateFrom3() {
// TODO: (PH:Autoroute) Copy paths, routes, etc.
ContentDefinitionManager.AlterTypeDefinition("List",
cfg => cfg
.RemovePart("RoutePart")
.WithPart("TitlePart")
.WithPart("AutoroutePart"));
return 4;
}
}
}

View File

@@ -22,14 +22,5 @@ namespace Orchard.Pages {
ContentDefinitionManager.AlterTypeDefinition("Page", cfg => cfg.WithPart("CommonPart", p => p.WithSetting("DateEditorSettings.ShowDateEditor", "true")));
return 2;
}
public int UpdateFrom2() {
// TODO: (PH:Autoroute) Copy routes/titles
ContentDefinitionManager.AlterTypeDefinition("Page", cfg => cfg
.RemovePart("RoutePart")
.WithPart("TitlePart")
.WithPart("AutoroutePart"));
return 3;
}
}
}

View File

@@ -0,0 +1,17 @@
using Orchard.Localization;
using Orchard.Security;
using Orchard.UI.Navigation;
namespace UpgradeTo14 {
public class AdminMenu : INavigationProvider {
public Localizer T { get; set; }
public string MenuName {
get { return "admin"; }
}
public void GetNavigation(NavigationBuilder builder) {
builder.Add(T("Migrate Routes"), "0", item => item.Action("Index", "Admin", new { area = "UpgradeTo14" }).Permission(StandardPermissions.SiteOwner));
}
}
}

View File

@@ -0,0 +1,143 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Transactions;
using System.Web.Mvc;
using Orchard;
using Orchard.Autoroute.Models;
using Orchard.Autoroute.Services;
using Orchard.ContentManagement;
using Orchard.ContentManagement.MetaData;
using Orchard.Core.Common.Models;
using Orchard.Core.Title.Models;
using Orchard.Data;
using Orchard.Environment.Configuration;
using Orchard.Localization;
using Orchard.Security;
using Orchard.UI.Notify;
using UpgradeTo14.ViewModels;
namespace UpgradeTo14.Controllers {
public class AdminController : Controller {
private readonly IContentDefinitionManager _contentDefinitionManager;
private readonly IOrchardServices _orchardServices;
private readonly ISessionFactoryHolder _sessionFactoryHolder;
private readonly ShellSettings _shellSettings;
private readonly IAutorouteService _autorouteService;
public AdminController(
IContentDefinitionManager contentDefinitionManager,
IOrchardServices orchardServices,
ISessionFactoryHolder sessionFactoryHolder,
ShellSettings shellSettings,
IAutorouteService autorouteService) {
_contentDefinitionManager = contentDefinitionManager;
_orchardServices = orchardServices;
_sessionFactoryHolder = sessionFactoryHolder;
_shellSettings = shellSettings;
_autorouteService = autorouteService;
}
public Localizer T { get; set; }
public ActionResult Index() {
var viewModel = new MigrateViewModel { ContentTypes = new List<ContentTypeEntry>() };
foreach (var contentType in _contentDefinitionManager.ListTypeDefinitions().OrderBy(c => c.Name)) {
// only display routeparts
if (contentType.Parts.Any(x => x.PartDefinition.Name == "RoutePart")) {
viewModel.ContentTypes.Add(new ContentTypeEntry {ContentTypeName = contentType.Name});
}
}
if(!viewModel.ContentTypes.Any()) {
_orchardServices.Notifier.Warning(T("There are no content types with RoutePart"));
}
return View(viewModel);
}
[HttpPost, ActionName("Index")]
public ActionResult IndexPOST() {
if (!_orchardServices.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not allowed to migrate routes.")))
return new HttpUnauthorizedResult();
var viewModel = new MigrateViewModel { ContentTypes = new List<ContentTypeEntry>() };
if(TryUpdateModel(viewModel)) {
var contentTypesToMigrate = viewModel.ContentTypes.Where(c => c.IsChecked).Select(c => c.ContentTypeName);
var sessionFactory = _sessionFactoryHolder.GetSessionFactory();
var session = sessionFactory.OpenSession();
foreach (var contentType in contentTypesToMigrate) {
// migrating pages
_contentDefinitionManager.AlterTypeDefinition(contentType,
builder => builder
.WithPart("AutoroutePart")
.WithPart("TitlePart"));
var count = 0;
var isContainable = false;
IEnumerable<ContentItem> contents;
do {
contents = _orchardServices.ContentManager.HqlQuery().ForType(contentType).Slice(count, 100);
foreach (dynamic content in contents) {
var autoroutePart = ((ContentItem) content).As<AutoroutePart>();
var titlePart = ((ContentItem) content).As<TitlePart>();
var commonPart = ((ContentItem) content).As<CommonPart>();
if(commonPart != null && commonPart.Container != null) {
isContainable = true;
}
using (new TransactionScope(TransactionScopeOption.Suppress)) {
var command = session.Connection.CreateCommand();
command.CommandText = string.Format("SELECT Title, Path FROM {0} WHERE ContentItemRecord_Id = {1}", GetPrefixedTableName("Routable_RoutePartRecord"), autoroutePart.ContentItem.Id);
var reader = command.ExecuteReader();
reader.Read();
var title = reader.GetString(0);
var path = reader.GetString(1);
reader.Close();
autoroutePart.DisplayAlias = path;
titlePart.Title = title;
}
_autorouteService.PublishAlias(autoroutePart);
count++;
}
_orchardServices.ContentManager.Flush();
// todo: _orchardServices.ContentManager.Clear();
} while (contents.Any());
_contentDefinitionManager.AlterTypeDefinition(contentType, builder => builder.RemovePart("RoutePart"));
var typeDefinition = _contentDefinitionManager.GetTypeDefinition(contentType);
if (isContainable || typeDefinition.Parts.Any(x => x.PartDefinition.Name == "ContainablePart")) {
_autorouteService.CreatePattern(contentType, "Container and Title", "{Content.Container.Path}/{Content.Slug}", "my-container/a-sample-title", true);
}
else {
_autorouteService.CreatePattern(contentType, "Title", "{Content.Slug}", "my-sample-title", true);
}
_orchardServices.Notifier.Information(T("{0} was migrated successfully", contentType));
}
}
return RedirectToAction("Index");
}
private string GetPrefixedTableName(string tableName) {
if (string.IsNullOrWhiteSpace(_shellSettings.DataTablePrefix)) {
return tableName;
}
return _shellSettings.DataTablePrefix + "_" + tableName;
}
}
}

View File

@@ -0,0 +1,131 @@
using System.Transactions;
using Orchard.Autoroute.Models;
using Orchard.Autoroute.Services;
using Orchard.ContentManagement;
using Orchard.ContentManagement.MetaData;
using Orchard.Core.Title.Models;
using Orchard.Data;
using Orchard.Data.Migration;
using Orchard.Environment.Configuration;
namespace UpgradeTo14 {
public class UpdateTo14DataMigration : DataMigrationImpl {
private readonly IContentManager _contentManager;
private readonly IAutorouteService _autorouteService;
private readonly ISessionFactoryHolder _sessionFactoryHolder;
private readonly ShellSettings _shellSettings;
public UpdateTo14DataMigration(
IContentManager contentManager,
IAutorouteService autorouteService,
ISessionFactoryHolder sessionFactoryHolder,
ShellSettings shellSettings) {
_contentManager = contentManager;
_autorouteService = autorouteService;
_sessionFactoryHolder = sessionFactoryHolder;
_shellSettings = shellSettings;
}
public int Create() {
return 1;
var sessionFactory = _sessionFactoryHolder.GetSessionFactory();
var session = sessionFactory.OpenSession();
// migrating pages
ContentDefinitionManager.AlterTypeDefinition("Page",
builder => builder
.WithPart("AutoroutePart")
.WithPart("TitlePart"));
var pages = _contentManager.HqlQuery().ForType("Page").List();
foreach(dynamic page in pages) {
var autoroutePart = ((ContentItem)page).As<AutoroutePart>();
var titlePart = ((ContentItem)page).As<TitlePart>();
using (new TransactionScope(TransactionScopeOption.Suppress)) {
var command = session.Connection.CreateCommand();
command.CommandText = string.Format("SELECT Title, Path FROM {0} WHERE ContentItemRecord_Id = {1}", GetPrefixedTableName("Routable_RoutePartRecord"), autoroutePart.ContentItem.Id);
var reader = command.ExecuteReader();
reader.Read();
var title = reader.GetString(0);
var path = reader.GetString(1);
reader.Close();
autoroutePart.DisplayAlias = path;
titlePart.Title = title;
}
_autorouteService.PublishAlias(autoroutePart);
}
ContentDefinitionManager.AlterTypeDefinition("Page", builder => builder.RemovePart("RoutePart"));
// migrating blogs
ContentDefinitionManager.AlterTypeDefinition("Blog", builder => builder.WithPart("AutoroutePart").WithPart("TitlePart"));
var blogs = _contentManager.HqlQuery().ForType("Blog").List();
foreach (dynamic blog in blogs) {
var autoroutePart = ((ContentItem)blog).As<AutoroutePart>();
var titlePart = ((ContentItem)blog).As<TitlePart>();
using (new TransactionScope(TransactionScopeOption.Suppress)) {
var command = session.Connection.CreateCommand();
command.CommandText = string.Format("SELECT Title, Path FROM {0} WHERE ContentItemRecord_Id = {1}", GetPrefixedTableName("Routable_RoutePartRecord"), autoroutePart.ContentItem.Id);
var reader = command.ExecuteReader();
reader.Read();
var title = reader.GetString(0);
var path = reader.GetString(1);
reader.Close();
autoroutePart.DisplayAlias = path;
titlePart.Title = title;
}
_autorouteService.PublishAlias(autoroutePart);
}
// migrating blog posts
ContentDefinitionManager.AlterTypeDefinition("BlogPost", builder => builder.WithPart("AutoroutePart").WithPart("TitlePart"));
var blogposts = _contentManager.HqlQuery().ForType("BlogPost").List();
foreach (dynamic blogpost in blogposts) {
var autoroutePart = ((ContentItem)blogpost).As<AutoroutePart>();
var titlePart = ((ContentItem)blogpost).As<TitlePart>();
using (new TransactionScope(TransactionScopeOption.Suppress)) {
var command = session.Connection.CreateCommand();
command.CommandText = string.Format("SELECT Title, Path FROM {0} WHERE ContentItemRecord_Id = {1}", GetPrefixedTableName("Routable_RoutePartRecord"), autoroutePart.ContentItem.Id);
var reader = command.ExecuteReader();
reader.Read();
var title = reader.GetString(0);
var path = reader.GetString(1);
reader.Close();
autoroutePart.DisplayAlias = path;
titlePart.Title = title;
}
_autorouteService.PublishAlias(autoroutePart);
}
// migrating containers/list
// todo
_autorouteService.CreatePattern("Page", "Title", "{Content.Slug}", "about-us", true);
_autorouteService.CreatePattern("Blog", "Title", "{Content.Slug}", "my-blog", true);
_autorouteService.CreatePattern("BlogPost", "Blog and Title", "{Content.Container.Path}/{Content.Slug}", "my-blog/a-blog-post", true);
return 1;
}
private string GetPrefixedTableName(string tableName) {
if(string.IsNullOrWhiteSpace(_shellSettings.DataTablePrefix)) {
return tableName;
}
return _shellSettings.DataTablePrefix + "_" + tableName;
}
}
}

View File

@@ -0,0 +1,11 @@
Name: UpgradeTo14
AntiForgery: enabled
Author: The Orchard Team
Website: http://orchardproject.net
Version: 1.0
OrchardVersion: 1.4
Description: Description for the module
Features:
UpgradeTo14:
Description: Description for feature UpgradeTo14.
Dependencies: Orchard.Autoroute

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("UpgradeTo14")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyProduct("Orchard")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("98a13f1d-a41f-498a-9de2-253ade7e0d92")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: SecurityTransparent]

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appSettings>
<add key="webpages:Enabled" value="false" />
</appSettings>
<system.web>
<httpHandlers>
<!-- iis6 - for any request in this location, return via managed static file handler -->
<add path="*" verb="*" type="System.Web.StaticFileHandler" />
</httpHandlers>
</system.web>
<system.webServer>
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="7.00:00:00" />
</staticContent>
<handlers accessPolicy="Script,Read">
<!--
iis7 - for any request to a file exists on disk, return it via native http module.
accessPolicy 'Script' is to allow for a managed 404 page.
-->
<add name="StaticFile" path="*" verb="*" modules="StaticFileModule" preCondition="integratedMode" resourceType="File" requireAccess="Read" />
</handlers>
</system.webServer>
</configuration>

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appSettings>
<add key="webpages:Enabled" value="false" />
</appSettings>
<system.web>
<httpHandlers>
<!-- iis6 - for any request in this location, return via managed static file handler -->
<add path="*" verb="*" type="System.Web.StaticFileHandler" />
</httpHandlers>
</system.web>
<system.webServer>
<staticContent>
<clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="7.00:00:00" />
</staticContent>
<handlers accessPolicy="Script,Read">
<!--
iis7 - for any request to a file exists on disk, return it via native http module.
accessPolicy 'Script' is to allow for a managed 404 page.
-->
<add name="StaticFile" path="*" verb="*" modules="StaticFileModule" preCondition="integratedMode" resourceType="File" requireAccess="Read" />
</handlers>
</system.webServer>
</configuration>

View File

@@ -0,0 +1,124 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>9.0.30729</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{8A9FDB57-342D-49C2-BAFC-D885AAE5CC7C}</ProjectGuid>
<ProjectTypeGuids>{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>UpgradeTo14</RootNamespace>
<AssemblyName>UpgradeTo14</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<MvcBuildViews>false</MvcBuildViews>
<FileUpgradeFlags>
</FileUpgradeFlags>
<OldToolsVersion>3.5</OldToolsVersion>
<UpgradeBackupLocation />
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="NHibernate">
<HintPath>..\..\..\..\lib\fluentnhibernate\NHibernate.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.ComponentModel.DataAnnotations">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Transactions" />
<Reference Include="System.Web.DynamicData" />
<Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Web.Abstractions" />
<Reference Include="System.Web.Routing" />
<Reference Include="System.Xml" />
<Reference Include="System.Configuration" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Content Include="Web.config" />
<Content Include="Views\Web.config" />
<Content Include="Scripts\Web.config" />
<Content Include="Styles\Web.config" />
<Content Include="Properties\AssemblyInfo.cs" />
<Content Include="Module.txt" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Orchard\Orchard.Framework.csproj">
<Project>{2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6}</Project>
<Name>Orchard.Framework</Name>
</ProjectReference>
<ProjectReference Include="..\..\Core\Orchard.Core.csproj">
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
<Name>Orchard.Core</Name>
</ProjectReference>
<ProjectReference Include="..\Orchard.Alias\Orchard.Alias.csproj">
<Project>{475B6C45-B27C-438B-8966-908B9D6D1077}</Project>
<Name>Orchard.Alias</Name>
</ProjectReference>
<ProjectReference Include="..\Orchard.Autoroute\Orchard.Autoroute.csproj">
<Project>{66FCCD76-2761-47E3-8D11-B45D0001DDAA}</Project>
<Name>Orchard.Autoroute</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="AdminMenu.cs" />
<Compile Include="Controllers\AdminController.cs" />
<Compile Include="Migrations.cs" />
<Compile Include="ViewModels\MigrateViewModel.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Models\" />
</ItemGroup>
<ItemGroup>
<None Include="Views\Admin\Index.cshtml" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.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.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target> -->
<Target Name="AfterBuild" DependsOnTargets="AfterBuildCompiler">
<PropertyGroup>
<AreasManifestDir>$(ProjectDir)\..\Manifests</AreasManifestDir>
</PropertyGroup>
<!-- If this is an area child project, uncomment the following line:
<CreateAreaManifest AreaName="$(AssemblyName)" AreaType="Child" AreaPath="$(ProjectDir)" ManifestPath="$(AreasManifestDir)" ContentFiles="@(Content)" />
-->
<!-- If this is an area parent project, uncomment the following lines:
<CreateAreaManifest AreaName="$(AssemblyName)" AreaType="Parent" AreaPath="$(ProjectDir)" ManifestPath="$(AreasManifestDir)" ContentFiles="@(Content)" />
<CopyAreaManifests ManifestPath="$(AreasManifestDir)" CrossCopy="false" RenameViews="true" />
-->
</Target>
<Target Name="AfterBuildCompiler" Condition="'$(MvcBuildViews)'=='true'">
<AspNetCompiler VirtualPath="temp" PhysicalPath="$(ProjectDir)\..\$(ProjectName)" />
</Target>
<ProjectExtensions />
</Project>

View File

@@ -0,0 +1,12 @@
using System.Collections.Generic;
namespace UpgradeTo14.ViewModels {
public class MigrateViewModel {
public IList<ContentTypeEntry> ContentTypes { get; set; }
}
public class ContentTypeEntry {
public string ContentTypeName { get; set; }
public bool IsChecked { get; set; }
}
}

View File

@@ -0,0 +1,26 @@
@using Orchard.Utility.Extensions
@model UpgradeTo14.ViewModels.MigrateViewModel
@{ Layout.Title = T("Migrate Routes").ToString(); }
@using (Html.BeginFormAntiForgeryPost()) {
Html.ValidationSummary();
<fieldset>
<legend>@T("Choose the types to migrate:")</legend>
<span class="hint">@T("The migration process will move the Route and Title properties by adding an Autoroute and a Title part to all the content items for the selected content types.")</span>
<ol>
@{ var contentTypeIndex = 0; }
@foreach (var contentTypeEntry in Model.ContentTypes) {
<li>
<input type="hidden" value="@Model.ContentTypes[contentTypeIndex].ContentTypeName" name="@Html.NameOf(m => m.ContentTypes[contentTypeIndex].ContentTypeName)"/>
<input type="checkbox" value="true" name="@Html.NameOf(m => m.ContentTypes[contentTypeIndex].IsChecked)" id="@Html.NameOf(m => m.ContentTypes[contentTypeIndex].IsChecked)" />
<label class="forcheckbox" for="@Html.NameOf(m => m.ContentTypes[contentTypeIndex].IsChecked)">@Model.ContentTypes[contentTypeIndex].ContentTypeName.CamelFriendly()</label>
</li>
contentTypeIndex = contentTypeIndex + 1;
}
</ol>
</fieldset>
<fieldset>
<button type="submit">@T("Migrate")</button>
</fieldset>
}

View File

@@ -0,0 +1,41 @@
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="webpages:Enabled" value="false" />
</appSettings>
<system.web>
<httpHandlers>
</httpHandlers>
<!--
Enabling request validation in view pages would cause validation to occur
after the input has already been processed by the controller. By default
MVC performs request validation before a controller processes the input.
To change this behavior apply the ValidateInputAttribute to a
controller or action.
-->
<pages
validateRequest="false"
pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"
pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL"
userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<controls>
<add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" namespace="System.Web.Mvc" tagPrefix="mvc" />
</controls>
</pages>
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<handlers>
</handlers>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="2.0.0.0" newVersion="3.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

View File

@@ -0,0 +1,41 @@
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<remove name="host" />
<remove name="pages" />
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
</sectionGroup>
</configSections>
<system.web.webPages.razor>
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<pages pageBaseType="Orchard.Mvc.ViewEngines.Razor.WebViewPage">
<namespaces>
<add namespace="System.Web.Mvc" />
<add namespace="System.Web.Mvc.Ajax" />
<add namespace="System.Web.Mvc.Html" />
<add namespace="System.Web.Routing" />
<add namespace="System.Web.WebPages" />
<add namespace="System.Linq"/>
<add namespace="System.Collections.Generic"/>
<add namespace="Orchard.Mvc.Html"/>
</namespaces>
</pages>
</system.web.webPages.razor>
<system.web>
<compilation targetFramework="4.0">
<assemblies>
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</assemblies>
</compilation>
</system.web>
</configuration>

View File

@@ -138,6 +138,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Alias", "Orchard.We
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Autoroute", "Orchard.Web\Modules\Orchard.Autoroute\Orchard.Autoroute.csproj", "{66FCCD76-2761-47E3-8D11-B45D0001DDAA}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "UpgradeTo14", "Orchard.Web\Modules\UpgradeTo14\UpgradeTo14.csproj", "{8A9FDB57-342D-49C2-BAFC-D885AAE5CC7C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
CodeCoverage|Any CPU = CodeCoverage|Any CPU
@@ -748,6 +750,16 @@ Global
{66FCCD76-2761-47E3-8D11-B45D0001DDAA}.FxCop|Any CPU.Build.0 = Release|Any CPU
{66FCCD76-2761-47E3-8D11-B45D0001DDAA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{66FCCD76-2761-47E3-8D11-B45D0001DDAA}.Release|Any CPU.Build.0 = Release|Any CPU
{8A9FDB57-342D-49C2-BAFC-D885AAE5CC7C}.CodeCoverage|Any CPU.ActiveCfg = Release|Any CPU
{8A9FDB57-342D-49C2-BAFC-D885AAE5CC7C}.CodeCoverage|Any CPU.Build.0 = Release|Any CPU
{8A9FDB57-342D-49C2-BAFC-D885AAE5CC7C}.Coverage|Any CPU.ActiveCfg = Release|Any CPU
{8A9FDB57-342D-49C2-BAFC-D885AAE5CC7C}.Coverage|Any CPU.Build.0 = Release|Any CPU
{8A9FDB57-342D-49C2-BAFC-D885AAE5CC7C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8A9FDB57-342D-49C2-BAFC-D885AAE5CC7C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8A9FDB57-342D-49C2-BAFC-D885AAE5CC7C}.FxCop|Any CPU.ActiveCfg = Release|Any CPU
{8A9FDB57-342D-49C2-BAFC-D885AAE5CC7C}.FxCop|Any CPU.Build.0 = Release|Any CPU
{8A9FDB57-342D-49C2-BAFC-D885AAE5CC7C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8A9FDB57-342D-49C2-BAFC-D885AAE5CC7C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -797,6 +809,7 @@ Global
{3787DDE5-E5C8-4841-BDA7-DCB325388064} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
{475B6C45-B27C-438B-8966-908B9D6D1077} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
{66FCCD76-2761-47E3-8D11-B45D0001DDAA} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
{8A9FDB57-342D-49C2-BAFC-D885AAE5CC7C} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
{ABC826D4-2FA1-4F2F-87DE-E6095F653810} = {74E681ED-FECC-4034-B9BD-01B0BB1BDECA}
{F112851D-B023-4746-B6B1-8D2E5AD8F7AA} = {74E681ED-FECC-4034-B9BD-01B0BB1BDECA}
{6CB3EB30-F725-45C0-9742-42599BA8E8D2} = {74E681ED-FECC-4034-B9BD-01B0BB1BDECA}