diff --git a/.hgsubstate b/.hgsubstate index 9c4128ce0..29052549a 100644 --- a/.hgsubstate +++ b/.hgsubstate @@ -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 diff --git a/src/Orchard.Specs/Bindings/OrchardSiteFactory.cs b/src/Orchard.Specs/Bindings/OrchardSiteFactory.cs index 8be6d6b6f..d5448e480 100644 --- a/src/Orchard.Specs/Bindings/OrchardSiteFactory.cs +++ b/src/Orchard.Specs/Bindings/OrchardSiteFactory.cs @@ -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()); } }); } diff --git a/src/Orchard.Web/Core/Contents/Controllers/AdminController.cs b/src/Orchard.Web/Core/Contents/Controllers/AdminController.cs index 2b670e9c8..6ecca93ba 100644 --- a/src/Orchard.Web/Core/Contents/Controllers/AdminController.cs +++ b/src/Orchard.Web/Core/Contents/Controllers/AdminController.cs @@ -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() + if(contentItem.Has() &&!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().Path; - }*/ + previousRoute = contentItem.As().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().Path, previousRoute, StringComparison.OrdinalIgnoreCase)) { + && !String.Equals(contentItem.As().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)); diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Migrations.cs b/src/Orchard.Web/Modules/Orchard.Blogs/Migrations.cs index 1a8cbff1b..b298cb36f 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Migrations.cs +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Migrations.cs @@ -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; - } } } \ No newline at end of file diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Services/XmlRpcHandler.cs b/src/Orchard.Web/Modules/Orchard.Blogs/Services/XmlRpcHandler.cs index 78c5a4fa0..4b23c0826 100644 --- a/src/Orchard.Web/Modules/Orchard.Blogs/Services/XmlRpcHandler.cs +++ b/src/Orchard.Web/Modules/Orchard.Blogs/Services/XmlRpcHandler.cs @@ -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().Path); + if (blogPostPart.PublishedUtc != null) { blogStruct.Set("dateCreated", blogPostPart.PublishedUtc); diff --git a/src/Orchard.Web/Modules/Orchard.Experimental/Migrations.cs b/src/Orchard.Web/Modules/Orchard.Experimental/Migrations.cs index aeae9f3b5..a769d0fca 100644 --- a/src/Orchard.Web/Modules/Orchard.Experimental/Migrations.cs +++ b/src/Orchard.Web/Modules/Orchard.Experimental/Migrations.cs @@ -10,7 +10,7 @@ namespace Orchard.Experimental { ContentDefinitionManager.AlterTypeDefinition("ListItem", cfg => cfg .WithPart("CommonPart") - .WithPart("RoutePart") + .WithPart("AutoroutePart") .WithPart("BodyPart") .WithPart("ContainablePart") .Creatable() diff --git a/src/Orchard.Web/Modules/Orchard.Lists/Migrations.cs b/src/Orchard.Web/Modules/Orchard.Lists/Migrations.cs index 8edb18120..7699b7454 100644 --- a/src/Orchard.Web/Modules/Orchard.Lists/Migrations.cs +++ b/src/Orchard.Web/Modules/Orchard.Lists/Migrations.cs @@ -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; - } - } } diff --git a/src/Orchard.Web/Modules/Orchard.Pages/Migrations.cs b/src/Orchard.Web/Modules/Orchard.Pages/Migrations.cs index c0eaee5e8..40fdae464 100644 --- a/src/Orchard.Web/Modules/Orchard.Pages/Migrations.cs +++ b/src/Orchard.Web/Modules/Orchard.Pages/Migrations.cs @@ -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; - } } } diff --git a/src/Orchard.Web/Modules/UpgradeTo14/AdminMenu.cs b/src/Orchard.Web/Modules/UpgradeTo14/AdminMenu.cs new file mode 100644 index 000000000..fed43f05f --- /dev/null +++ b/src/Orchard.Web/Modules/UpgradeTo14/AdminMenu.cs @@ -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)); + } + } +} diff --git a/src/Orchard.Web/Modules/UpgradeTo14/Controllers/AdminController.cs b/src/Orchard.Web/Modules/UpgradeTo14/Controllers/AdminController.cs new file mode 100644 index 000000000..b932444b3 --- /dev/null +++ b/src/Orchard.Web/Modules/UpgradeTo14/Controllers/AdminController.cs @@ -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() }; + 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() }; + + 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 contents; + + do { + contents = _orchardServices.ContentManager.HqlQuery().ForType(contentType).Slice(count, 100); + + foreach (dynamic content in contents) { + var autoroutePart = ((ContentItem) content).As(); + var titlePart = ((ContentItem) content).As(); + var commonPart = ((ContentItem) content).As(); + + 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; + } + } +} diff --git a/src/Orchard.Web/Modules/UpgradeTo14/Migrations.cs b/src/Orchard.Web/Modules/UpgradeTo14/Migrations.cs new file mode 100644 index 000000000..b0553721a --- /dev/null +++ b/src/Orchard.Web/Modules/UpgradeTo14/Migrations.cs @@ -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(); + var titlePart = ((ContentItem)page).As(); + + 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(); + var titlePart = ((ContentItem)blog).As(); + + 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(); + var titlePart = ((ContentItem)blogpost).As(); + + 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; + } + } +} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/UpgradeTo14/Module.txt b/src/Orchard.Web/Modules/UpgradeTo14/Module.txt new file mode 100644 index 000000000..d60ce6a0b --- /dev/null +++ b/src/Orchard.Web/Modules/UpgradeTo14/Module.txt @@ -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 \ No newline at end of file diff --git a/src/Orchard.Web/Modules/UpgradeTo14/Properties/AssemblyInfo.cs b/src/Orchard.Web/Modules/UpgradeTo14/Properties/AssemblyInfo.cs new file mode 100644 index 000000000..024f8a2ac --- /dev/null +++ b/src/Orchard.Web/Modules/UpgradeTo14/Properties/AssemblyInfo.cs @@ -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] diff --git a/src/Orchard.Web/Modules/UpgradeTo14/Scripts/Web.config b/src/Orchard.Web/Modules/UpgradeTo14/Scripts/Web.config new file mode 100644 index 000000000..770adfab5 --- /dev/null +++ b/src/Orchard.Web/Modules/UpgradeTo14/Scripts/Web.config @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Orchard.Web/Modules/UpgradeTo14/Styles/Web.config b/src/Orchard.Web/Modules/UpgradeTo14/Styles/Web.config new file mode 100644 index 000000000..770adfab5 --- /dev/null +++ b/src/Orchard.Web/Modules/UpgradeTo14/Styles/Web.config @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Orchard.Web/Modules/UpgradeTo14/UpgradeTo14.csproj b/src/Orchard.Web/Modules/UpgradeTo14/UpgradeTo14.csproj new file mode 100644 index 000000000..beddb8d55 --- /dev/null +++ b/src/Orchard.Web/Modules/UpgradeTo14/UpgradeTo14.csproj @@ -0,0 +1,124 @@ + + + + Debug + AnyCPU + 9.0.30729 + 2.0 + {8A9FDB57-342D-49C2-BAFC-D885AAE5CC7C} + {fae04ec0-301f-11d3-bf4b-00c04f79efbc} + Library + Properties + UpgradeTo14 + UpgradeTo14 + v4.0 + false + + + 3.5 + + + + + true + full + false + bin\ + DEBUG;TRACE + prompt + 4 + AllRules.ruleset + + + pdbonly + true + bin\ + TRACE + prompt + 4 + AllRules.ruleset + + + + + ..\..\..\..\lib\fluentnhibernate\NHibernate.dll + + + + + 3.5 + + + + + False + ..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll + + + + + + + + + + + + + + + + + + + {2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6} + Orchard.Framework + + + {9916839C-39FC-4CEB-A5AF-89CA7E87119F} + Orchard.Core + + + {475B6C45-B27C-438B-8966-908B9D6D1077} + Orchard.Alias + + + {66FCCD76-2761-47E3-8D11-B45D0001DDAA} + Orchard.Autoroute + + + + + + + + + + + + + + + + + + + + $(ProjectDir)\..\Manifests + + + + + + + + + \ No newline at end of file diff --git a/src/Orchard.Web/Modules/UpgradeTo14/ViewModels/MigrateViewModel.cs b/src/Orchard.Web/Modules/UpgradeTo14/ViewModels/MigrateViewModel.cs new file mode 100644 index 000000000..71537ffd9 --- /dev/null +++ b/src/Orchard.Web/Modules/UpgradeTo14/ViewModels/MigrateViewModel.cs @@ -0,0 +1,12 @@ +using System.Collections.Generic; + +namespace UpgradeTo14.ViewModels { + public class MigrateViewModel { + public IList ContentTypes { get; set; } + } + + public class ContentTypeEntry { + public string ContentTypeName { get; set; } + public bool IsChecked { get; set; } + } +} diff --git a/src/Orchard.Web/Modules/UpgradeTo14/Views/Admin/Index.cshtml b/src/Orchard.Web/Modules/UpgradeTo14/Views/Admin/Index.cshtml new file mode 100644 index 000000000..210bb5b47 --- /dev/null +++ b/src/Orchard.Web/Modules/UpgradeTo14/Views/Admin/Index.cshtml @@ -0,0 +1,26 @@ +@using Orchard.Utility.Extensions +@model UpgradeTo14.ViewModels.MigrateViewModel + +@{ Layout.Title = T("Migrate Routes").ToString(); } + +@using (Html.BeginFormAntiForgeryPost()) { + Html.ValidationSummary(); +
+ @T("Choose the types to migrate:") + @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.") +
    + @{ var contentTypeIndex = 0; } + @foreach (var contentTypeEntry in Model.ContentTypes) { +
  1. + + + +
  2. + contentTypeIndex = contentTypeIndex + 1; + } +
+
+
+ +
+} \ No newline at end of file diff --git a/src/Orchard.Web/Modules/UpgradeTo14/Views/Web.config b/src/Orchard.Web/Modules/UpgradeTo14/Views/Web.config new file mode 100644 index 000000000..b7d215131 --- /dev/null +++ b/src/Orchard.Web/Modules/UpgradeTo14/Views/Web.config @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Orchard.Web/Modules/UpgradeTo14/Web.config b/src/Orchard.Web/Modules/UpgradeTo14/Web.config new file mode 100644 index 000000000..88b84a792 --- /dev/null +++ b/src/Orchard.Web/Modules/UpgradeTo14/Web.config @@ -0,0 +1,41 @@ + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Orchard.sln b/src/Orchard.sln index 53e72af06..7a05f141f 100644 --- a/src/Orchard.sln +++ b/src/Orchard.sln @@ -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}