From ae27eb1e210b73d12c9e27064ac77d5f287c2e25 Mon Sep 17 00:00:00 2001 From: randompete Date: Thu, 29 Dec 2011 14:36:57 +0000 Subject: [PATCH] Remove Routable module --HG-- branch : autoroute --- .../Routable/Services/RoutableServiceTests.cs | 315 ------------------ src/Orchard.Web/Core/Orchard.Core.csproj | 29 -- .../Routable/Controllers/ItemController.cs | 94 ------ .../Core/Routable/Drivers/RoutePartDriver.cs | 118 ------- .../Core/Routable/Events/ISlugEventHandler.cs | 17 - .../Routable/Handlers/RoutePartHandler.cs | 127 ------- .../Core/Routable/IRoutablePathConstraint.cs | 11 - src/Orchard.Web/Core/Routable/Migrations.cs | 22 -- .../Core/Routable/Models/RoutePart.cs | 23 -- .../Core/Routable/Models/RoutePartRecord.cs | 15 - src/Orchard.Web/Core/Routable/Module.txt | 10 - src/Orchard.Web/Core/Routable/Placement.info | 15 - .../Core/Routable/ResourceManifest.cs | 9 - src/Orchard.Web/Core/Routable/Routes.cs | 56 ---- .../Core/Routable/Scripts/Web.config | 21 -- .../Core/Routable/Scripts/jquery.slugify.js | 24 -- .../Routable/Services/IRoutableService.cs | 30 -- .../Services/RoutablePathConstraint.cs | 69 ---- .../Services/RoutablePathConstraintUpdator.cs | 36 -- .../Core/Routable/Services/RoutableService.cs | 186 ----------- .../ViewModels/RoutableDisplayViewModel.cs | 8 - .../ViewModels/RoutableEditorViewModel.cs | 19 -- .../Parts.Routable.RoutePart.cshtml | 37 -- .../Routable/Views/Parts.RoutableTitle.cshtml | 1 - .../Views/Parts.RoutableTitle_Summary.cshtml | 6 - .../Parts.RoutableTitle_SummaryAdmin.cshtml | 6 - .../Core/Routable/Views/Web.config | 41 --- 27 files changed, 1345 deletions(-) delete mode 100644 src/Orchard.Core.Tests/Routable/Services/RoutableServiceTests.cs delete mode 100644 src/Orchard.Web/Core/Routable/Controllers/ItemController.cs delete mode 100644 src/Orchard.Web/Core/Routable/Drivers/RoutePartDriver.cs delete mode 100644 src/Orchard.Web/Core/Routable/Events/ISlugEventHandler.cs delete mode 100644 src/Orchard.Web/Core/Routable/Handlers/RoutePartHandler.cs delete mode 100644 src/Orchard.Web/Core/Routable/IRoutablePathConstraint.cs delete mode 100644 src/Orchard.Web/Core/Routable/Migrations.cs delete mode 100644 src/Orchard.Web/Core/Routable/Models/RoutePart.cs delete mode 100644 src/Orchard.Web/Core/Routable/Models/RoutePartRecord.cs delete mode 100644 src/Orchard.Web/Core/Routable/Module.txt delete mode 100644 src/Orchard.Web/Core/Routable/Placement.info delete mode 100644 src/Orchard.Web/Core/Routable/ResourceManifest.cs delete mode 100644 src/Orchard.Web/Core/Routable/Routes.cs delete mode 100644 src/Orchard.Web/Core/Routable/Scripts/Web.config delete mode 100644 src/Orchard.Web/Core/Routable/Scripts/jquery.slugify.js delete mode 100644 src/Orchard.Web/Core/Routable/Services/IRoutableService.cs delete mode 100644 src/Orchard.Web/Core/Routable/Services/RoutablePathConstraint.cs delete mode 100644 src/Orchard.Web/Core/Routable/Services/RoutablePathConstraintUpdator.cs delete mode 100644 src/Orchard.Web/Core/Routable/Services/RoutableService.cs delete mode 100644 src/Orchard.Web/Core/Routable/ViewModels/RoutableDisplayViewModel.cs delete mode 100644 src/Orchard.Web/Core/Routable/ViewModels/RoutableEditorViewModel.cs delete mode 100644 src/Orchard.Web/Core/Routable/Views/EditorTemplates/Parts.Routable.RoutePart.cshtml delete mode 100644 src/Orchard.Web/Core/Routable/Views/Parts.RoutableTitle.cshtml delete mode 100644 src/Orchard.Web/Core/Routable/Views/Parts.RoutableTitle_Summary.cshtml delete mode 100644 src/Orchard.Web/Core/Routable/Views/Parts.RoutableTitle_SummaryAdmin.cshtml delete mode 100644 src/Orchard.Web/Core/Routable/Views/Web.config diff --git a/src/Orchard.Core.Tests/Routable/Services/RoutableServiceTests.cs b/src/Orchard.Core.Tests/Routable/Services/RoutableServiceTests.cs deleted file mode 100644 index 58d47fed0..000000000 --- a/src/Orchard.Core.Tests/Routable/Services/RoutableServiceTests.cs +++ /dev/null @@ -1,315 +0,0 @@ -using System; -using System.Collections.Generic; -using Autofac; -using JetBrains.Annotations; -using Moq; -using NUnit.Framework; -using Orchard.ContentManagement; -using Orchard.ContentManagement.Aspects; -using Orchard.ContentManagement.Handlers; -using Orchard.ContentManagement.MetaData; -using Orchard.ContentManagement.Records; -using Orchard.Core.Common.Models; -using Orchard.Core.Routable; -using Orchard.Core.Routable.Handlers; -using Orchard.Core.Routable.Models; -using Orchard.Core.Routable.Services; -using Orchard.Data; -using Orchard.DisplayManagement; -using Orchard.DisplayManagement.Descriptors; -using Orchard.DisplayManagement.Implementation; -using Orchard.Environment; -using Orchard.Environment.Extensions; -using Orchard.Mvc; -using Orchard.Security; -using Orchard.Tests.Modules; -using System.Web.Mvc; -using System.Web.Routing; -using Orchard.Tests.Stubs; -using Orchard.UI.Notify; - -namespace Orchard.Core.Tests.Routable.Services { - - // TODO: (PH) - [TestFixture] - public class RoutableServiceTests : DatabaseEnabledTestsBase { - [SetUp] - public override void Init() { - base.Init(); - _routableService = _container.Resolve(); - _contentManager = _container.Resolve(); - } - - public override void Register(ContainerBuilder builder) { - builder.RegisterType().As(); - builder.RegisterType().As(); - builder.RegisterInstance(new Mock().Object); - builder.RegisterInstance(new Mock().Object); - builder.RegisterInstance(new Mock().Object); - builder.RegisterInstance(new Mock().Object); - builder.RegisterInstance(new Mock().Object); - builder.RegisterType().As(); - builder.RegisterType().As(); - builder.RegisterType().As(); - - builder.RegisterType().As(); - builder.RegisterType().As(); - builder.RegisterType().As(); - builder.RegisterType().As(); - builder.RegisterType().As(); - builder.RegisterType().As(); - builder.RegisterType().As(); - - builder.RegisterType().As(); - builder.RegisterInstance(new UrlHelper(new RequestContext(new StubHttpContext("~/"), new RouteData()))).As(); - builder.RegisterType().As(); - - builder.RegisterType().As(); - builder.RegisterType().As(); - } - - private IRoutableService _routableService; - private IContentManager _contentManager; - - [Test] - public void InvalidCharactersShouldBeReplacedByADash() { - var thing = _contentManager.Create("thing", t => { - t.As().Record = new RoutePartRecord(); - t.Title = "Please do not use any of the following characters in your permalink: \":\", \"?\", \"#\", \"[\", \"]\", \"@\", \"!\", \"$\", \"&\", \"'\", \"(\", \")\", \"*\", \"+\", \",\", \";\", \"=\", \"\"\", \"<\", \">\", \"\\\""; - }); - - _routableService.FillSlugFromTitle(thing.As()); - - Assert.That(thing.Slug, Is.EqualTo("please-do-not-use-any-of-the-following-characters-in-your-permalink")); - } - - [Test] - public void SpacesSlugShouldBeTreatedAsEmpty() { - var contentManager = _container.Resolve(); - - var thing = contentManager.Create("thing", t => { - t.As().Record = new RoutePartRecord(); - t.Title = "My Title"; - t.Slug = " "; - }); - - _routableService.FillSlugFromTitle(thing.As()); - - Assert.That(thing.Slug, Is.EqualTo("my-title")); - } - - - [Test] - public void SlashInSlugIsAllowed() { - Assert.That(_routableService.IsSlugValid("some/page"), Is.True); - } - - [Test] - public void DotsAroundSlugAreAllowed() { - Assert.That(_routableService.IsSlugValid(".slug"), Is.False); - Assert.That(_routableService.IsSlugValid("slug."), Is.False); - Assert.That(_routableService.IsSlugValid("slug.slug"), Is.True); - } - - [Test] - public void EmptySlugsShouldBeConsideredValid() { - // so that automatic generation on Publish occurs - Assert.That(_routableService.IsSlugValid(null), Is.True); - Assert.That(_routableService.IsSlugValid(String.Empty), Is.True); - Assert.That(_routableService.IsSlugValid(" "), Is.True); - } - - [Test] - public void InvalidCharacterShouldBeRefusedInSlugs() { - Assert.That(_routableService.IsSlugValid("aaaa-_aaaa"), Is.True); - - foreach (var c in @":?#[]@!$&'()*+,;= \") { - Assert.That(_routableService.IsSlugValid("a" + c + "b"), Is.False); - } - } - - [Test] - public void VeryLongStringTruncatedTo1000Chars() { - var veryVeryLongTitle = "this is a very long title..."; - for (var i = 0; i < 100; i++) - veryVeryLongTitle += "aaaaaaaaaa"; - - var thing = CreateRoutePartFromScratch(veryVeryLongTitle); - _routableService.FillSlugFromTitle(thing); - - Assert.That(veryVeryLongTitle.Length, Is.AtLeast(1001)); - Assert.That(thing.Slug.Length, Is.EqualTo(1000)); - } - - [Test] - public void NoExistingLikeSlugsGeneratesSameSlug() { - string slug = _routableService.GenerateUniqueSlug(CreateRoutePartFromScratch("woohoo"), null); - Assert.That(slug, Is.EqualTo("woohoo")); - } - - [Test] - public void ExistingSingleLikeSlugThatsAConflictGeneratesADash2() { - string slug = _routableService.GenerateUniqueSlug(CreateRoutePartFromScratch("woohoo"), new List { "woohoo" }); - Assert.That(slug, Is.EqualTo("woohoo-2")); - } - - [Test] - public void ExistingSingleLikeSlugThatsNotAConflictGeneratesSameSlug() { - string slug = _routableService.GenerateUniqueSlug(CreateRoutePartFromScratch("woohoo"), new List { "woohoo-2" }); - Assert.That(slug, Is.EqualTo("woohoo")); - } - - [Test] - public void ExistingLikeSlugsWithAConflictGeneratesADashVNext() { - string slug = _routableService.GenerateUniqueSlug(CreateRoutePartFromScratch("woohoo"), new List { "woohoo", "woohoo-2" }); - Assert.That(slug, Is.EqualTo("woohoo-3")); - } - - [Test] - public void ExistingSlugsWithVersionGapsAndNoMatchGeneratesSameSlug() { - string slug = _routableService.GenerateUniqueSlug(CreateRoutePartFromScratch("woohoo"), new List { "woohoo-2", "woohoo-4", "woohoo-5" }); - Assert.That(slug, Is.EqualTo("woohoo")); - } - - [Test] - public void ExistingSlugsWithVersionGapsAndAMatchGeneratesADash2() { - string slug = _routableService.GenerateUniqueSlug(CreateRoutePartFromScratch("woohoo-2"), new List { "woohoo-2", "woohoo-4", "woohoo-5" }); - Assert.That(slug, Is.EqualTo("woohoo-2-2")); - } - - [Test] - public void SlugIsGeneratedLowerCased() { - var thing = CreateRoutePartFromScratch("This Is Some Interesting Title"); - _routableService.FillSlugFromTitle(thing); - Assert.That(thing.Slug, Is.EqualTo("this-is-some-interesting-title")); - } - - [Test] - public void SlugInConflictWithAnExistingItemsPathIsVersioned() { - CreateRoutePartFromScratch("bar", "bar", "foo"); - _contentManager.Flush(); - - var thing2 = CreateRoutePartFromScratch("fooslashbar", "foo/bar"); - Assert.That(thing2.Path, Is.EqualTo("foo/bar-2")); - } - - [Test] - public void GeneratedSlugInConflictInSameContaierPathIsVersioned() { - var thing1 = CreateRoutePartFromScratch("Foo", "", "bar"); - _contentManager.Flush(); - var thing2 = CreateRoutePartWithExistingContainer("Foo", thing1.As().Container); - Assert.That(thing2.Path, Is.EqualTo("bar/foo-2")); - Assert.That(thing2.Slug, Is.EqualTo("foo-2")); - } - - [Test] - public void GivenSlugInConflictInSameContaierPathIsVersioned() { - var thing1 = CreateRoutePartFromScratch("Hi", "foo", "bar"); - _contentManager.Flush(); - var thing2 = CreateRoutePartWithExistingContainer("There", thing1.As().Container, "foo"); - Assert.That(thing2.Path, Is.EqualTo("bar/foo-2")); - Assert.That(thing2.Slug, Is.EqualTo("foo-2")); - } - - [Test] - public void GeneratedSlugInConflictInDifferentContaierPathIsNotVersioned() { - var thing1 = CreateRoutePartFromScratch("Foo", "", "rab"); - var thing2 = CreateRoutePartFromScratch("Foo", "", "bar"); - Assert.That(thing1.Path, Is.EqualTo("rab/foo")); - Assert.That(thing2.Path, Is.EqualTo("bar/foo")); - Assert.That(thing1.Slug, Is.EqualTo("foo")); - Assert.That(thing2.Slug, Is.EqualTo("foo")); - } - - private RoutePart CreateRoutePartWithExistingContainer(string title, IContent container, string slug = "") { - var contentManager = _container.Resolve(); - return contentManager.Create("thing", t => { - t.As().Record = new RoutePartRecord(); - t.Title = title; - - if (!string.IsNullOrWhiteSpace(slug)) - t.As().Slug = slug; - - if (container != null) - t.As().Container = container; - }).As(); - } - - private RoutePart CreateRoutePartFromScratch(string title, string slug = "", string containerPath = "") { - var contentManager = _container.Resolve(); - return contentManager.Create("thing", t => { - t.As().Record = new RoutePartRecord(); - - if (!string.IsNullOrWhiteSpace(slug)) - t.As().Slug = slug; - - t.Title = title; - if (!string.IsNullOrWhiteSpace(containerPath)) { - t.As().Container = contentManager.Create("thing", tt => { - tt.As().Path = containerPath; - tt.As().Slug = containerPath; - tt.As().Title = "Test Container"; - }); - } - }).As(); - } - - - protected override IEnumerable DatabaseTypes { - get { - return new[] { - typeof(RoutePartRecord), - typeof(ContentTypeRecord), - typeof(ContentItemRecord), - typeof(ContentItemVersionRecord), - typeof(CommonPartRecord), - typeof(CommonPartVersionRecord), - }; - } - } - - [UsedImplicitly] - public class ThingHandler : ContentHandler { - public ThingHandler() { - Filters.Add(new ActivatingFilter("thing")); - Filters.Add(new ActivatingFilter>("thing")); - Filters.Add(new ActivatingFilter("thing")); - Filters.Add(new ActivatingFilter("thing")); - } - } - - public class Thing : ContentPart { - public string Title { - get { return this.As().Title; } - set { this.As().Title = value; } - } - - public string Slug { - get { return this.As().Slug; } - set { this.As().Slug = value; } - } - } - - [UsedImplicitly] - public class StuffHandler : ContentHandler { - public StuffHandler() { - Filters.Add(new ActivatingFilter("stuff")); - Filters.Add(new ActivatingFilter>("stuff")); - Filters.Add(new ActivatingFilter("stuff")); - Filters.Add(new ActivatingFilter("stuff")); - } - } - - public class Stuff : ContentPart { - public string Title { - get { return this.As().Title; } - set { this.As().Title = value; } - } - - public string Slug { - get { return this.As().Slug; } - set { this.As().Slug = value; } - } - } - } -} \ No newline at end of file diff --git a/src/Orchard.Web/Core/Orchard.Core.csproj b/src/Orchard.Web/Core/Orchard.Core.csproj index 05e85dbb3..9bb366070 100644 --- a/src/Orchard.Web/Core/Orchard.Core.csproj +++ b/src/Orchard.Web/Core/Orchard.Core.csproj @@ -130,8 +130,6 @@ - - @@ -140,12 +138,6 @@ - - - - - - @@ -197,14 +189,6 @@ - - - - - - - - @@ -294,9 +278,6 @@ - - - @@ -304,9 +285,6 @@ - - Designer - @@ -369,7 +347,6 @@ - @@ -387,7 +364,6 @@ - @@ -397,9 +373,6 @@ Designer - - Designer - Designer @@ -411,8 +384,6 @@ - - diff --git a/src/Orchard.Web/Core/Routable/Controllers/ItemController.cs b/src/Orchard.Web/Core/Routable/Controllers/ItemController.cs deleted file mode 100644 index e32890b4c..000000000 --- a/src/Orchard.Web/Core/Routable/Controllers/ItemController.cs +++ /dev/null @@ -1,94 +0,0 @@ -using System.Linq; -using System.Web.Mvc; -using Orchard.ContentManagement; -using Orchard.ContentManagement.Aspects; -using Orchard.Core.Contents; -using Orchard.Core.Routable.Models; -using Orchard.Core.Routable.Services; -using Orchard.Data; -using Orchard.Localization; -using Orchard.Mvc; -using Orchard.Themes; - -namespace Orchard.Core.Routable.Controllers { - [ValidateInput(false)] - public class ItemController : Controller, IUpdateModel { - private readonly ITransactionManager _transactionManager; - private readonly IRoutablePathConstraint _routablePathConstraint; - - public ItemController( - ITransactionManager transactionManager, - IRoutablePathConstraint routablePathConstraint, - IOrchardServices services - ) { - _transactionManager = transactionManager; - _routablePathConstraint = routablePathConstraint; - Services = services; - T = NullLocalizer.Instance; - } - - public Localizer T { get; set; } - public IOrchardServices Services { get; private set; } - - [Themed] - public ActionResult Display(string path) { - var matchedPath = _routablePathConstraint.FindPath(path); - - if (matchedPath == null) { - return HttpNotFound(T("Should not have passed path constraint").Text); - } - - var hits = Services.ContentManager - .Query(VersionOptions.Published) - .Where(r => r.Path == matchedPath) - .Slice(0, 2) - .ToList(); - - if (hits.Count() == 0) { - return HttpNotFound(T("Should not have passed path constraint").Text); - } - - if (hits.Count() != 1) { - return HttpNotFound(T("Ambiguous content").Text); - } - - dynamic model = Services.ContentManager.BuildDisplay(hits.Single()); - return new ShapeResult(this, model); - } - - public ActionResult Slugify(string contentType, int? id, int? containerId) { - const string slug = ""; - ContentItem contentItem = null; - - if (string.IsNullOrEmpty(contentType)) - return Json(slug); - - if (id != null) - contentItem = Services.ContentManager.Get((int)id, VersionOptions.Latest); - - if (contentItem == null) { - contentItem = Services.ContentManager.Create(contentType, VersionOptions.Draft); - - if (containerId != null) { - var containerItem = Services.ContentManager.Get((int)containerId); - contentItem.As().Container = containerItem; - } - } - - Services.ContentManager.UpdateEditor(contentItem, this); - Services.ContentManager.Publish(contentItem); - _transactionManager.Cancel(); - - return Json(contentItem.As().GetEffectiveSlug() ?? slug); - } - - - bool IUpdateModel.TryUpdateModel(TModel model, string prefix, string[] includeProperties, string[] excludeProperties) { - return TryUpdateModel(model, prefix, includeProperties, excludeProperties); - } - - void IUpdateModel.AddModelError(string key, LocalizedString errorMessage) { - ModelState.AddModelError(key, errorMessage.ToString()); - } - } -} \ No newline at end of file diff --git a/src/Orchard.Web/Core/Routable/Drivers/RoutePartDriver.cs b/src/Orchard.Web/Core/Routable/Drivers/RoutePartDriver.cs deleted file mode 100644 index cd285045f..000000000 --- a/src/Orchard.Web/Core/Routable/Drivers/RoutePartDriver.cs +++ /dev/null @@ -1,118 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using Orchard.ContentManagement; -using Orchard.ContentManagement.Aspects; -using Orchard.ContentManagement.Drivers; -using Orchard.ContentManagement.Handlers; -using Orchard.Core.Routable.Models; -using Orchard.Core.Routable.Services; -using Orchard.Core.Routable.ViewModels; -using Orchard.Localization; -using Orchard.Mvc; -using Orchard.Services; -using Orchard.Utility.Extensions; - -namespace Orchard.Core.Routable.Drivers { - public class RoutePartDriver : ContentPartDriver { - private readonly IOrchardServices _services; - private readonly IRoutableService _routableService; - private readonly IHttpContextAccessor _httpContextAccessor; - - public RoutePartDriver(IOrchardServices services, - IRoutableService routableService, - IHttpContextAccessor httpContextAccessor) { - _services = services; - _routableService = routableService; - _httpContextAccessor = httpContextAccessor; - T = NullLocalizer.Instance; - } - - private const string TemplateName = "Parts.Routable.RoutePart"; - - public Localizer T { get; set; } - - protected override string Prefix { - get { return "Routable"; } - } - - static int? GetContainerId(IContent item) { - var commonPart = item.As(); - if (commonPart != null && commonPart.Container != null) { - return commonPart.Container.ContentItem.Id; - } - return null; - } - - protected override DriverResult Display(RoutePart part, string displayType, dynamic shapeHelper) { - return Combined( - ContentShape("Parts_RoutableTitle", - () => shapeHelper.Parts_RoutableTitle(ContentPart: part, Title: part.Title, Path: part.Path)), - ContentShape("Parts_RoutableTitle_Summary", - () => shapeHelper.Parts_RoutableTitle_Summary(ContentPart: part, Title: part.Title, Path: part.Path)), - ContentShape("Parts_RoutableTitle_SummaryAdmin", - () => shapeHelper.Parts_RoutableTitle_SummaryAdmin(ContentPart: part, Title: part.Title, Path: part.Path)) - ); - } - - protected override DriverResult Editor(RoutePart part, dynamic shapeHelper) { - var model = new RoutableEditorViewModel { - ContentType = part.ContentItem.ContentType, - Id = part.ContentItem.Id, - Slug = part.Slug, - Title = part.Title, - ContainerId = GetContainerId(part), - }; - - var request = _httpContextAccessor.Current().Request; - var containerUrl = new UriBuilder(request.ToRootUrlString()) { Path = (request.ApplicationPath ?? "").TrimEnd('/') + "/" + (part.GetContainerPath() ?? "") }; - model.ContainerAbsoluteUrl = containerUrl.Uri.ToString().TrimEnd('/'); - - return ContentShape("Parts_Routable_Edit", - () => shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: model, Prefix: Prefix)); - } - - protected override DriverResult Editor(RoutePart part, IUpdateModel updater, dynamic shapeHelper) { - var model = new RoutableEditorViewModel(); - updater.TryUpdateModel(model, Prefix, null, null); - - part.Title = model.Title; - part.Slug = model.Slug; - part.PromoteToHomePage = model.PromoteToHomePage; - - if ( !_routableService.IsSlugValid(part.Slug) ) { - var slug = (part.Slug ?? String.Empty); - if ( slug.StartsWith(".") || slug.EndsWith(".") ) - updater.AddModelError("Routable.Slug", T("The \".\" can't be used at either end of the permalink.")); - else - updater.AddModelError("Routable.Slug", T("Please do not use any of the following characters in your permalink: \":\", \"?\", \"#\", \"[\", \"]\", \"@\", \"!\", \"$\", \"&\", \"'\", \"(\", \")\", \"*\", \"+\", \",\", \";\", \"=\", \", \"<\", \">\", \"\\\". No spaces are allowed (please use dashes or underscores instead).")); - } - - return Editor(part, shapeHelper); - } - - protected override void Importing(RoutePart part, ImportContentContext context) { - var title = context.Attribute(part.PartDefinition.Name, "Title"); - if (title != null) { - part.Title = title; - } - - var slug = context.Attribute(part.PartDefinition.Name, "Slug"); - if (slug != null) { - part.Slug = slug; - } - - var path = context.Attribute(part.PartDefinition.Name, "Path"); - if (path != null) { - part.Path = path; - } - - } - - protected override void Exporting(RoutePart part, ExportContentContext context) { - context.Element(part.PartDefinition.Name).SetAttributeValue("Title", part.Title); - context.Element(part.PartDefinition.Name).SetAttributeValue("Slug", part.Slug); - context.Element(part.PartDefinition.Name).SetAttributeValue("Path", part.Path); - } - } -} \ No newline at end of file diff --git a/src/Orchard.Web/Core/Routable/Events/ISlugEventHandler.cs b/src/Orchard.Web/Core/Routable/Events/ISlugEventHandler.cs deleted file mode 100644 index a178aed71..000000000 --- a/src/Orchard.Web/Core/Routable/Events/ISlugEventHandler.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Orchard.Events; - -namespace Orchard.Core.Routable.Events { - public interface ISlugEventHandler : IEventHandler { - void FillingSlugFromTitle(FillSlugContext context); - void FilledSlugFromTitle(FillSlugContext context); - } - - public class FillSlugContext { - public FillSlugContext(string slug) { - Slug = slug; - } - - public string Slug { get; set; } - public bool Adjusted { get; set; } - } -} \ No newline at end of file diff --git a/src/Orchard.Web/Core/Routable/Handlers/RoutePartHandler.cs b/src/Orchard.Web/Core/Routable/Handlers/RoutePartHandler.cs deleted file mode 100644 index 13cfa7f6a..000000000 --- a/src/Orchard.Web/Core/Routable/Handlers/RoutePartHandler.cs +++ /dev/null @@ -1,127 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web.Routing; -using Orchard.ContentManagement; -using Orchard.ContentManagement.Handlers; -using Orchard.Core.Routable.Models; -using Orchard.Core.Routable.Services; -using Orchard.Data; -using Orchard.Localization; -using Orchard.Services; -using Orchard.UI.Notify; - -namespace Orchard.Core.Routable.Handlers { - public class RoutePartHandler : ContentHandler { - private readonly IOrchardServices _services; - private readonly IRoutablePathConstraint _routablePathConstraint; - private readonly IRoutableService _routableService; - private readonly IContentManager _contentManager; - private readonly IWorkContextAccessor _workContextAccessor; - - public RoutePartHandler( - IOrchardServices services, - IRepository repository, - IRoutablePathConstraint routablePathConstraint, - IRoutableService routableService, - IContentManager contentManager, - IWorkContextAccessor workContextAccessor) { - _services = services; - _routablePathConstraint = routablePathConstraint; - _routableService = routableService; - _contentManager = contentManager; - _workContextAccessor = workContextAccessor; - T = NullLocalizer.Instance; - - Filters.Add(StorageFilter.For(repository)); - - Action processSlug = ( - routable => { - if (!_routableService.ProcessSlug(routable)) - _services.Notifier.Warning(T("Permalinks in conflict. \"{0}\" is already set for a previously created {2} so now it has the slug \"{1}\"", - routable.Slug, routable.GetEffectiveSlug(), routable.ContentItem.ContentType)); - }); - - OnGetDisplayShape(SetModelProperties); - OnGetEditorShape(SetModelProperties); - OnUpdateEditorShape(SetModelProperties); - - Action handler = (context, route) => { - FinalizePath(route, context, processSlug); - }; - - OnPublished(handler); - OnUnpublished(handler); - - OnRemoved((context, route) => { - if (!string.IsNullOrWhiteSpace(route.Path)) - _routablePathConstraint.RemovePath(route.Path); - }); - - OnIndexing((context, part) => context.DocumentIndex.Add("title", part.Record.Title).RemoveTags().Analyze()); - } - - protected override void GetItemMetadata(GetContentItemMetadataContext context) { - var part = context.ContentItem.As(); - - if (part != null) { - context.Metadata.Identity.Add("Route.Slug", part.Slug); - } - } - - private void FinalizePath(RoutePart route, PublishContentContext context, Action processSlug) { - var path = route.Path; - route.Path = route.GetPathWithSlug(route.Slug); - - if (context.PublishingItemVersionRecord != null) - processSlug(route); - - // if the path has changed by having the slug changed on the way in (e.g. user input) or to avoid conflict - // then update and publish all contained items - if (path != route.Path) { - _routablePathConstraint.RemovePath(path); - _routableService.FixContainedPaths(route); - } - - if (!string.IsNullOrWhiteSpace(route.Path)) - _routablePathConstraint.AddPath(route.Path); - } - - private static void SetModelProperties(BuildShapeContext context, RoutePart routable) { - var item = context.Shape; - item.Title = routable.Title; - item.Slug = routable.Slug; - item.Path = routable.Path; - } - - public Localizer T { get; set; } - } - - public class RoutePartHandlerBase : ContentHandlerBase { - private readonly IWorkContextAccessor _workContextAccessor; - - public RoutePartHandlerBase(IWorkContextAccessor workContextAccessor) { - _workContextAccessor = workContextAccessor; - } - - public override void GetContentItemMetadata(GetContentItemMetadataContext context) { - var routable = context.ContentItem.As(); - - if (routable == null) - return; - - // set the display route values if it hasn't been set or only has been set by the Contents module. - // allows other modules to set their own display. probably not common enough to warrant some priority implementation - if (context.Metadata.DisplayRouteValues == null || context.Metadata.DisplayRouteValues["Area"] as string == "Contents") { - var itemPath = routable.Path; - - context.Metadata.DisplayRouteValues = new RouteValueDictionary { - {"Area", "Routable"}, - {"Controller", "Item"}, - {"Action", "Display"}, - {"path", itemPath} - }; - } - } - } -} diff --git a/src/Orchard.Web/Core/Routable/IRoutablePathConstraint.cs b/src/Orchard.Web/Core/Routable/IRoutablePathConstraint.cs deleted file mode 100644 index fd20e37e5..000000000 --- a/src/Orchard.Web/Core/Routable/IRoutablePathConstraint.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System.Collections.Generic; -using System.Web.Routing; - -namespace Orchard.Core.Routable { - public interface IRoutablePathConstraint : IRouteConstraint, ISingletonDependency { - void SetPaths(IEnumerable paths); - string FindPath(string path); - void AddPath(string path); - void RemovePath(string path); - } -} diff --git a/src/Orchard.Web/Core/Routable/Migrations.cs b/src/Orchard.Web/Core/Routable/Migrations.cs deleted file mode 100644 index 22e6f5c2d..000000000 --- a/src/Orchard.Web/Core/Routable/Migrations.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Orchard.ContentManagement.MetaData; -using Orchard.Core.Contents.Extensions; -using Orchard.Data.Migration; - -namespace Orchard.Core.Routable { - public class Migrations : DataMigrationImpl { - - public int Create() { - SchemaBuilder.CreateTable("RoutePartRecord", - table => table - .ContentPartVersionRecord() - .Column("Title", column => column.WithLength(1024)) - .Column("Slug", column => column.WithLength(1024)) - .Column("Path", column => column.WithLength(2048)) - ); - - ContentDefinitionManager.AlterPartDefinition("RoutePart", builder => builder.Attachable()); - - return 1; - } - } -} \ No newline at end of file diff --git a/src/Orchard.Web/Core/Routable/Models/RoutePart.cs b/src/Orchard.Web/Core/Routable/Models/RoutePart.cs deleted file mode 100644 index 5ccb9f277..000000000 --- a/src/Orchard.Web/Core/Routable/Models/RoutePart.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Orchard.ContentManagement; -using Orchard.ContentManagement.Aspects; - -namespace Orchard.Core.Routable.Models { - public class RoutePart : ContentPart, IRoutableAspect { - public string Title { - get { return Record.Title; } - set { Record.Title = value; } - } - - public string Slug { - get { return Record.Slug; } - set { Record.Slug = value; } - } - - public string Path { - get { return Record.Path; } - set { Record.Path = value; } - } - - public bool PromoteToHomePage { get; set; } - } -} \ No newline at end of file diff --git a/src/Orchard.Web/Core/Routable/Models/RoutePartRecord.cs b/src/Orchard.Web/Core/Routable/Models/RoutePartRecord.cs deleted file mode 100644 index 1097d8885..000000000 --- a/src/Orchard.Web/Core/Routable/Models/RoutePartRecord.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using Orchard.ContentManagement.Records; - -namespace Orchard.Core.Routable.Models { - public class RoutePartRecord : ContentPartVersionRecord { - [StringLength(1024)] - public virtual string Title { get; set; } - - [StringLength(1024)] - public virtual string Slug { get; set; } - - [StringLength(2048)] - public virtual string Path { get; set; } - } -} diff --git a/src/Orchard.Web/Core/Routable/Module.txt b/src/Orchard.Web/Core/Routable/Module.txt deleted file mode 100644 index 02f100c36..000000000 --- a/src/Orchard.Web/Core/Routable/Module.txt +++ /dev/null @@ -1,10 +0,0 @@ -Name: Routable -AntiForgery: enabled -Author: The Orchard Team -Website: http://orchardproject.net -Version: 1.3.0 -OrchardVersion: 1.3.0 -Description: The routable module enables content items to be accessed through a friendly human-readable URL. -FeatureDescription: Routable content part. -Dependencies: Settings -Category: Core diff --git a/src/Orchard.Web/Core/Routable/Placement.info b/src/Orchard.Web/Core/Routable/Placement.info deleted file mode 100644 index 135e04ec0..000000000 --- a/src/Orchard.Web/Core/Routable/Placement.info +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/src/Orchard.Web/Core/Routable/ResourceManifest.cs b/src/Orchard.Web/Core/Routable/ResourceManifest.cs deleted file mode 100644 index 6d3e833d0..000000000 --- a/src/Orchard.Web/Core/Routable/ResourceManifest.cs +++ /dev/null @@ -1,9 +0,0 @@ -using Orchard.UI.Resources; - -namespace Orchard.Core.Routable { - public class ResourceManifest : IResourceManifestProvider { - public void BuildManifests(ResourceManifestBuilder builder) { - builder.Add().DefineScript("Slugify").SetUrl("jquery.slugify.js").SetDependencies("jQuery"); - } - } -} diff --git a/src/Orchard.Web/Core/Routable/Routes.cs b/src/Orchard.Web/Core/Routable/Routes.cs deleted file mode 100644 index 5c533c5ad..000000000 --- a/src/Orchard.Web/Core/Routable/Routes.cs +++ /dev/null @@ -1,56 +0,0 @@ -using System.Collections.Generic; -using System.Web.Mvc; -using System.Web.Routing; -using Orchard.Mvc.Routes; - -namespace Orchard.Core.Routable { - public class Routes : IRouteProvider { - private readonly IRoutablePathConstraint _routablePathConstraint; - - public Routes(IRoutablePathConstraint routablePathConstraint) { - _routablePathConstraint = routablePathConstraint; - } - - public void GetRoutes(ICollection routes) { - foreach (var routeDescriptor in GetRoutes()) - routes.Add(routeDescriptor); - } - - public IEnumerable GetRoutes() { - return new[] { - new RouteDescriptor { - Route = new Route( - "Admin/Common/Routable/Slugify", - new RouteValueDictionary { - {"area", "Routable"}, - {"controller", "Item"}, - {"action", "Slugify"} - }, - new RouteValueDictionary(), - new RouteValueDictionary { - {"area", "Routable"} - }, - new MvcRouteHandler()) - }, - new RouteDescriptor { - Priority = 10, - Route = new Route( - "{*path}", - new RouteValueDictionary { - {"area", "Routable"}, - {"controller", "Item"}, - {"action", "Display"} - }, - new RouteValueDictionary { - {"path", _routablePathConstraint} - }, - new RouteValueDictionary { - {"area", "Routable"} - }, - new MvcRouteHandler()) - } - }; - } - - } -} \ No newline at end of file diff --git a/src/Orchard.Web/Core/Routable/Scripts/Web.config b/src/Orchard.Web/Core/Routable/Scripts/Web.config deleted file mode 100644 index df1c33504..000000000 --- a/src/Orchard.Web/Core/Routable/Scripts/Web.config +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/src/Orchard.Web/Core/Routable/Scripts/jquery.slugify.js b/src/Orchard.Web/Core/Routable/Scripts/jquery.slugify.js deleted file mode 100644 index 070202125..000000000 --- a/src/Orchard.Web/Core/Routable/Scripts/jquery.slugify.js +++ /dev/null @@ -1,24 +0,0 @@ -jQuery.fn.extend({ - slugify: function(options) { - //todo: (heskew) need messaging system - if (!options.target || !options.url) - return; - - var args = { - "contentType": options.contentType, - "id": options.id, - "containerId": options.containerId, - __RequestVerificationToken: $("input[name=__RequestVerificationToken]").val() - }; - args[$(this).attr("name")] = $(this).val(); - - jQuery.post( - options.url, - args, - function(data) { - options.target.val(data); - }, - "json" - ); - } -}); \ No newline at end of file diff --git a/src/Orchard.Web/Core/Routable/Services/IRoutableService.cs b/src/Orchard.Web/Core/Routable/Services/IRoutableService.cs deleted file mode 100644 index f73cb2ce0..000000000 --- a/src/Orchard.Web/Core/Routable/Services/IRoutableService.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Collections.Generic; -using Orchard.ContentManagement.Aspects; - -namespace Orchard.Core.Routable.Services { - public interface IRoutableService : IDependency { - void FillSlugFromTitle(TModel model) where TModel : IRoutableAspect; - string GenerateUniqueSlug(IRoutableAspect part, IEnumerable existingPaths); - - /// - /// Returns any content item with similar path - /// - IEnumerable GetSimilarPaths(string path); - - /// - /// Validates the given slug - /// - bool IsSlugValid(string slug); - - /// - /// Defines the slug of a RoutableAspect and validate its unicity - /// - /// True if the slug has been created, False if a conflict occured - bool ProcessSlug(IRoutableAspect part); - - /// - /// Updated the paths of all contained items to reflect the current path of this item - /// - void FixContainedPaths(IRoutableAspect part); - } -} \ No newline at end of file diff --git a/src/Orchard.Web/Core/Routable/Services/RoutablePathConstraint.cs b/src/Orchard.Web/Core/Routable/Services/RoutablePathConstraint.cs deleted file mode 100644 index feb868b59..000000000 --- a/src/Orchard.Web/Core/Routable/Services/RoutablePathConstraint.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.Routing; -using JetBrains.Annotations; -using Orchard.Logging; - -namespace Orchard.Core.Routable.Services { - [UsedImplicitly] - public class RoutablePathConstraint : IRoutablePathConstraint { - /// - /// Singleton object, per Orchard Shell instance. We need to protect concurrent access to the dictionary. - /// - private readonly object _syncLock = new object(); - private IDictionary _paths = new Dictionary(); - - public RoutablePathConstraint() { - Logger = NullLogger.Instance; - } - - public ILogger Logger { get; set; } - - public void SetPaths(IEnumerable paths) { - // Make a copy to avoid performing potential lazy computation inside the lock - var slugsArray = paths.ToArray(); - - lock (_syncLock) { - _paths = slugsArray.Distinct(StringComparer.OrdinalIgnoreCase).ToDictionary(value => value, StringComparer.OrdinalIgnoreCase); - } - } - - public string FindPath(string path) { - lock (_syncLock) { - string actual; - return _paths.TryGetValue(path, out actual) ? actual : path; - } - } - - public void AddPath(string path) { - lock (_syncLock) { - _paths[path] = path; - } - } - - public void RemovePath(string path) { - lock (_syncLock) { - if (path != null && _paths.ContainsKey(path)) - _paths.Remove(path); - } - } - - public bool Match(HttpContextBase httpContext, Route route, string parameterName, RouteValueDictionary values, RouteDirection routeDirection) { - if (routeDirection == RouteDirection.UrlGeneration) - return true; - - object value; - if (values.TryGetValue(parameterName, out value)) { - var parameterValue = Convert.ToString(value); - - lock (_syncLock) { - return _paths.ContainsKey(parameterValue); - } - } - - return false; - } - } -} \ No newline at end of file diff --git a/src/Orchard.Web/Core/Routable/Services/RoutablePathConstraintUpdator.cs b/src/Orchard.Web/Core/Routable/Services/RoutablePathConstraintUpdator.cs deleted file mode 100644 index 1716c88ec..000000000 --- a/src/Orchard.Web/Core/Routable/Services/RoutablePathConstraintUpdator.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Linq; -using JetBrains.Annotations; -using Orchard.Core.Routable.Models; -using Orchard.Data; -using Orchard.Environment; -using Orchard.Tasks; - -namespace Orchard.Core.Routable.Services { - [UsedImplicitly] - public class RoutablePathConstraintUpdator : IOrchardShellEvents, IBackgroundTask { - private readonly IRoutablePathConstraint _pageSlugConstraint; - private readonly IRepository _repository; - - public RoutablePathConstraintUpdator(IRoutablePathConstraint pageSlugConstraint, IRepository repository) { - _pageSlugConstraint = pageSlugConstraint; - _repository = repository; - } - - void IOrchardShellEvents.Activated() { - Refresh(); - } - - void IOrchardShellEvents.Terminating() { - } - - void IBackgroundTask.Sweep() { - Refresh(); - } - - private void Refresh() { - var slugs = _repository.Fetch(r => r.ContentItemVersionRecord.Published && r.Path != "" && r.Path != null).Select(r => r.Path); - - _pageSlugConstraint.SetPaths(slugs); - } - } -} diff --git a/src/Orchard.Web/Core/Routable/Services/RoutableService.cs b/src/Orchard.Web/Core/Routable/Services/RoutableService.cs deleted file mode 100644 index 7f537098f..000000000 --- a/src/Orchard.Web/Core/Routable/Services/RoutableService.cs +++ /dev/null @@ -1,186 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text.RegularExpressions; -using Orchard.ContentManagement; -using Orchard.ContentManagement.Aspects; -using Orchard.Core.Common.Models; -using Orchard.Core.Routable.Events; -using Orchard.Core.Routable.Models; -using Orchard.Utility.Extensions; - -namespace Orchard.Core.Routable.Services { - public class RoutableService : IRoutableService { - private readonly IContentManager _contentManager; - private readonly IEnumerable _slugEventHandlers; - private readonly IRoutablePathConstraint _routablePathConstraint; - - public RoutableService(IContentManager contentManager, IEnumerable slugEventHandlers, IRoutablePathConstraint routablePathConstraint) { - _contentManager = contentManager; - _slugEventHandlers = slugEventHandlers; - _routablePathConstraint = routablePathConstraint; - } - - public void FixContainedPaths(IRoutableAspect part) { - var items = _contentManager.Query(VersionOptions.Published) - .Join().Where(cr => cr.Container.Id == part.Id) - .List() - .Select(item => item.As()).Where(item => item != null); - - foreach (var itemRoute in items) { - var route = itemRoute.As(); - - if(route == null) { - continue; - } - - var path = route.Path; - route.Path = route.GetPathWithSlug(route.Slug); - - // if the path has changed by having the slug changed on the way in (e.g. user input) or to avoid conflict - // then update and publish all contained items - if (path != route.Path) { - _routablePathConstraint.RemovePath(path); - FixContainedPaths(route); - } - - if (!string.IsNullOrWhiteSpace(route.Path)) - _routablePathConstraint.AddPath(route.Path); - - } - } - - public void FillSlugFromTitle(TModel model) where TModel : IRoutableAspect { - if ((model.Slug != null && !string.IsNullOrEmpty(model.Slug.Trim())) || string.IsNullOrEmpty(model.Title)) - return; - - var slugContext = new FillSlugContext(model.Title); - - foreach (ISlugEventHandler slugEventHandler in _slugEventHandlers) { - slugEventHandler.FillingSlugFromTitle(slugContext); - } - - if (!slugContext.Adjusted) { - var disallowed = new Regex(@"[/:?#\[\]@!$&'()*+,;=\s\""\<\>\\]+"); - - slugContext.Slug = disallowed.Replace(slugContext.Slug, "-").Trim('-'); - - if (slugContext.Slug.Length > 1000) - slugContext.Slug = slugContext.Slug.Substring(0, 1000); - - // dots are not allowed at the begin and the end of routes - slugContext.Slug = StringExtensions.RemoveDiacritics(slugContext.Slug.Trim('.').ToLower()); - } - - foreach (ISlugEventHandler slugEventHandler in _slugEventHandlers) { - slugEventHandler.FilledSlugFromTitle(slugContext); - } - - model.Slug = slugContext.Slug; - } - - public string GenerateUniqueSlug(IRoutableAspect part, IEnumerable existingPaths) { - - if (existingPaths == null) { - return part.Slug; - } - - // materializing the enumeration - existingPaths = existingPaths.ToArray(); - - if(!existingPaths.Contains(part.Path)) { - return part.Slug; - } - - int? version = existingPaths.Select(s => GetSlugVersion(part.Path, s)).OrderBy(i => i).LastOrDefault(); - - return version != null - ? string.Format("{0}-{1}", part.Slug, version) - : part.Slug; - } - - private static int? GetSlugVersion(string path, string potentialConflictingPath) { - int v; - string[] slugParts = potentialConflictingPath.Split(new[] { path }, StringSplitOptions.RemoveEmptyEntries); - - if (slugParts.Length == 0) - return 2; - - return int.TryParse(slugParts[0].TrimStart('-'), out v) - ? (int?)++v - : null; - } - - public IEnumerable GetSimilarPaths(string path) { - return - _contentManager.Query() - .Where(routable => routable.Path != null && routable.Path.StartsWith(path, StringComparison.OrdinalIgnoreCase)) - .List() - .Select(i => i.As()) - .ToArray(); - } - - public bool IsSlugValid(string slug) { - return String.IsNullOrWhiteSpace(slug) || Regex.IsMatch(slug, @"^[^:?#\[\]@!$&'()*+,;=\s\""\<\>\\]+$") && !(slug.StartsWith(".") || slug.EndsWith(".")); - } - - public bool ProcessSlug(IRoutableAspect part) { - FillSlugFromTitle(part); - - if (string.IsNullOrEmpty(part.Slug)) - return true; - - part.Path = part.GetPathWithSlug(part.Slug); - var pathsLikeThis = GetSimilarPaths(part.Path).ToArray(); - - // Don't include *this* part in the list - // of slugs to consider for conflict detection - pathsLikeThis = pathsLikeThis.Where(p => p.ContentItem.Id != part.ContentItem.Id).ToArray(); - - if (pathsLikeThis.Any()) { - var originalSlug = part.Slug; - var newSlug = GenerateUniqueSlug(part, pathsLikeThis.Select(p => p.Path)); - part.Path = part.GetPathWithSlug(newSlug); - part.Slug = newSlug; - - if (originalSlug != newSlug) - return false; - } - - return true; - } - } - - public static class RoutableAspectExtensions { - public static string GetContainerPath(this IRoutableAspect routableAspect) { - var commonAspect = routableAspect.As(); - if (commonAspect != null && commonAspect.Container != null) { - var routable = commonAspect.Container.As(); - if (routable != null) - return routable.Path; - } - return null; - } - - public static string GetPathWithSlug(this IRoutableAspect routableAspect, string slug) { - var containerPath = routableAspect.GetContainerPath(); - return !string.IsNullOrEmpty(containerPath) - ? string.Format("{0}/{1}", containerPath, slug) - : slug; - } - - public static string GetChildPath(this IRoutableAspect routableAspect, string slug) { - return string.Format("{0}/{1}", routableAspect.Path, slug); - } - - public static string GetEffectiveSlug(this IRoutableAspect routableAspect) { - var containerPath = routableAspect.GetContainerPath(); - - if (string.IsNullOrWhiteSpace(routableAspect.Path)) - return ""; - - var slugParts = routableAspect.Path.Split(new []{string.Format("{0}/", containerPath)}, StringSplitOptions.RemoveEmptyEntries); - return slugParts.FirstOrDefault(); - } - } -} \ No newline at end of file diff --git a/src/Orchard.Web/Core/Routable/ViewModels/RoutableDisplayViewModel.cs b/src/Orchard.Web/Core/Routable/ViewModels/RoutableDisplayViewModel.cs deleted file mode 100644 index a242b55f1..000000000 --- a/src/Orchard.Web/Core/Routable/ViewModels/RoutableDisplayViewModel.cs +++ /dev/null @@ -1,8 +0,0 @@ -using Orchard.Core.Routable.Models; - -namespace Orchard.Core.Routable.ViewModels { - public class RoutableDisplayViewModel { - public string Title { get { return RoutePart.Title; } } - public RoutePart RoutePart { get; set; } - } -} \ No newline at end of file diff --git a/src/Orchard.Web/Core/Routable/ViewModels/RoutableEditorViewModel.cs b/src/Orchard.Web/Core/Routable/ViewModels/RoutableEditorViewModel.cs deleted file mode 100644 index 8f6b4e043..000000000 --- a/src/Orchard.Web/Core/Routable/ViewModels/RoutableEditorViewModel.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.ComponentModel.DataAnnotations; - -namespace Orchard.Core.Routable.ViewModels { - public class RoutableEditorViewModel { - - public int Id { get; set; } - public string ContentType { get; set; } - - [Required] - [StringLength(1024)] - public string Title { get; set; } - [StringLength(1024)] - public string Slug { get; set; } - public int? ContainerId { get; set; } - public bool PromoteToHomePage { get; set; } - - public string ContainerAbsoluteUrl { get; set; } - } -} \ No newline at end of file diff --git a/src/Orchard.Web/Core/Routable/Views/EditorTemplates/Parts.Routable.RoutePart.cshtml b/src/Orchard.Web/Core/Routable/Views/EditorTemplates/Parts.Routable.RoutePart.cshtml deleted file mode 100644 index 195d54bf6..000000000 --- a/src/Orchard.Web/Core/Routable/Views/EditorTemplates/Parts.Routable.RoutePart.cshtml +++ /dev/null @@ -1,37 +0,0 @@ -@model Orchard.Core.Routable.ViewModels.RoutableEditorViewModel -@using Orchard.Utility.Extensions; -@{ Script.Require("Slugify"); } - -
- @Html.LabelFor(m => m.Title, T("Title")) - @Html.TextBoxFor(m => m.Title, new { @class = "large text" }) -
- -@using(Script.Foot()){ - -} \ No newline at end of file diff --git a/src/Orchard.Web/Core/Routable/Views/Parts.RoutableTitle.cshtml b/src/Orchard.Web/Core/Routable/Views/Parts.RoutableTitle.cshtml deleted file mode 100644 index 6024082e2..000000000 --- a/src/Orchard.Web/Core/Routable/Views/Parts.RoutableTitle.cshtml +++ /dev/null @@ -1 +0,0 @@ -

@Model.Title

\ No newline at end of file diff --git a/src/Orchard.Web/Core/Routable/Views/Parts.RoutableTitle_Summary.cshtml b/src/Orchard.Web/Core/Routable/Views/Parts.RoutableTitle_Summary.cshtml deleted file mode 100644 index a1e1e7ed0..000000000 --- a/src/Orchard.Web/Core/Routable/Views/Parts.RoutableTitle_Summary.cshtml +++ /dev/null @@ -1,6 +0,0 @@ -@{ - Orchard.ContentManagement.ContentItem contentItem = Model.ContentPart.ContentItem; - string title = Model.Title.ToString(); -} - -

@Html.ItemDisplayLink(title, contentItem)

\ No newline at end of file diff --git a/src/Orchard.Web/Core/Routable/Views/Parts.RoutableTitle_SummaryAdmin.cshtml b/src/Orchard.Web/Core/Routable/Views/Parts.RoutableTitle_SummaryAdmin.cshtml deleted file mode 100644 index 552cf4c0c..000000000 --- a/src/Orchard.Web/Core/Routable/Views/Parts.RoutableTitle_SummaryAdmin.cshtml +++ /dev/null @@ -1,6 +0,0 @@ -@{ - Orchard.ContentManagement.ContentItem contentItem = Model.ContentPart.ContentItem; - string title = Model.Title.ToString(); -} - -

@Html.ItemEditLink(title, contentItem)

\ No newline at end of file diff --git a/src/Orchard.Web/Core/Routable/Views/Web.config b/src/Orchard.Web/Core/Routable/Views/Web.config deleted file mode 100644 index b7d215131..000000000 --- a/src/Orchard.Web/Core/Routable/Views/Web.config +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -