From 4ecb35bc99bcfd82a85522a14ed7c572a7a99ecb Mon Sep 17 00:00:00 2001 From: Dave Reed Date: Mon, 29 Nov 2010 13:30:26 -0800 Subject: [PATCH 01/11] #16822: Display missing features in admin features view. --HG-- branch : dev --- .../Views/Admin/Features.cshtml | 10 ++++++++-- .../styles/orchard-modules-admin.css | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.Modules/Views/Admin/Features.cshtml b/src/Orchard.Web/Modules/Orchard.Modules/Views/Admin/Features.cshtml index 18999cd9c..61f660f70 100644 --- a/src/Orchard.Web/Modules/Orchard.Modules/Views/Admin/Features.cshtml +++ b/src/Orchard.Web/Modules/Orchard.Modules/Views/Admin/Features.cshtml @@ -44,10 +44,11 @@ } var dependencies = (from d in feature.Descriptor.Dependencies select (from f in Model.Features where f.Descriptor.Id == d select f).SingleOrDefault()).Where(f => f != null).OrderBy(f => f.Descriptor.Name); - @* todo: missingDependencies -- show them in a special way. Can be found like this: var missingDependencies = feature.Descriptor.Dependencies .Where(d => !Model.Features.Any(f => f.Descriptor.Id == d)); - *@ + if (showActions) { + showActions = missingDependencies.Count() == 0; + }
  • @@ -61,6 +62,11 @@ "dependency", "")
    } + @if (missingDependencies.Any()) { +
    +

    @T("Missing:")

    + @Html.UnorderedList(missingDependencies, (s, i) => MvcHtmlString.Create(s), "", "missingdependency", "") +
    }
    @if (showActions) { diff --git a/src/Orchard.Web/Modules/Orchard.Modules/styles/orchard-modules-admin.css b/src/Orchard.Web/Modules/Orchard.Modules/styles/orchard-modules-admin.css index da9f10cdf..ab5f8dbb5 100644 --- a/src/Orchard.Web/Modules/Orchard.Modules/styles/orchard-modules-admin.css +++ b/src/Orchard.Web/Modules/Orchard.Modules/styles/orchard-modules-admin.css @@ -107,6 +107,24 @@ .features .dependencies li:last-child::after { content:""; } +.features .missingdependencies { + font-size:.9em; + color:Red; + margin:.44em 0 0; +} +.features .missingdependencies>* { + display:inline; +} +.features .missingdependencies li { + display:inline; + margin-left:.5em; +} +.features .missingdependencies li::after { + content:", "; +} +.features .missingdependencies li:last-child::after { + content:""; +} .features .feature .actions { position:absolute; right:.4em; From a9e92b9d5ee2777ea41d6eb673ab1a0aa615cb46 Mon Sep 17 00:00:00 2001 From: Jonathan Wall Date: Mon, 29 Nov 2010 14:04:45 -0800 Subject: [PATCH 02/11] Updated CSS for hint text. Work Items: 16862 --HG-- branch : dev --- src/Orchard.Web/Themes/TheAdmin/Styles/site.css | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Orchard.Web/Themes/TheAdmin/Styles/site.css b/src/Orchard.Web/Themes/TheAdmin/Styles/site.css index fda69fb09..919893a56 100644 --- a/src/Orchard.Web/Themes/TheAdmin/Styles/site.css +++ b/src/Orchard.Web/Themes/TheAdmin/Styles/site.css @@ -477,6 +477,8 @@ label input { } .hint { display:block; + font-size:0.923em; + color:#7c7c7c; } /* todo: (heskew) try to get .text on stuff like .text-box */ select, textarea, input.text, input.textMedium, input.text-box { From 59a57413c582415f12a3da02c0c24f18af850c5c Mon Sep 17 00:00:00 2001 From: Dave Reed Date: Mon, 29 Nov 2010 14:16:26 -0800 Subject: [PATCH 03/11] #16800: Add a Condition property on RequireSettings. You can now say Require("foo").UseCondition("lte IE7") for example. --HG-- branch : dev --- src/Orchard.Web/Core/Shapes/CoreShapes.cs | 7 +++++++ src/Orchard/UI/Resources/RequireSettings.cs | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/src/Orchard.Web/Core/Shapes/CoreShapes.cs b/src/Orchard.Web/Core/Shapes/CoreShapes.cs index 53bb2abbd..72efafe06 100644 --- a/src/Orchard.Web/Core/Shapes/CoreShapes.cs +++ b/src/Orchard.Web/Core/Shapes/CoreShapes.cs @@ -225,7 +225,14 @@ namespace Orchard.Core.Shapes { foreach (var context in requiredResources.Where(r => (includeLocation.HasValue ? r.Settings.Location == includeLocation.Value : true) && (excludeLocation.HasValue ? r.Settings.Location != excludeLocation.Value : true))) { + var condition = context.Settings.Condition; + if (!string.IsNullOrEmpty(condition)) { + html.ViewContext.Writer.WriteLine(""); + } } } diff --git a/src/Orchard/UI/Resources/RequireSettings.cs b/src/Orchard/UI/Resources/RequireSettings.cs index 2648967ed..a945b4a84 100644 --- a/src/Orchard/UI/Resources/RequireSettings.cs +++ b/src/Orchard/UI/Resources/RequireSettings.cs @@ -9,6 +9,7 @@ namespace Orchard.UI.Resources { public bool DebugMode { get; set; } public bool CdnMode { get; set; } public ResourceLocation Location { get; set; } + public string Condition { get; set; } public Action InlineDefinition { get; set; } public RequireSettings AtHead() { @@ -55,6 +56,11 @@ namespace Orchard.UI.Resources { return this; } + public RequireSettings UseCondition(string condition) { + Condition = Condition ?? condition; + return this; + } + public RequireSettings Define(Action resourceDefinition) { InlineDefinition = resourceDefinition ?? InlineDefinition; return this; @@ -69,6 +75,7 @@ namespace Orchard.UI.Resources { .UseCdn(CdnMode).UseCdn(other.CdnMode) .UseDebugMode(DebugMode).UseDebugMode(other.DebugMode) .UseCulture(Culture).UseCulture(other.Culture) + .UseCondition(Condition).UseCondition(other.Condition) .Define(InlineDefinition).Define(other.InlineDefinition); } } From 7105848138f27329993d3122ff54694722ead66b Mon Sep 17 00:00:00 2001 From: Jonathan Wall Date: Mon, 29 Nov 2010 14:52:15 -0800 Subject: [PATCH 04/11] Added CSS for notifications in TheTemeMachine. Work Item: 16818 --HG-- branch : dev --- src/Orchard.Web/Themes/TheAdmin/Styles/site.css | 6 +++--- src/Orchard.Web/Themes/TheThemeMachine/Styles/Site.css | 8 +++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/Orchard.Web/Themes/TheAdmin/Styles/site.css b/src/Orchard.Web/Themes/TheAdmin/Styles/site.css index 919893a56..cb5ae51f7 100644 --- a/src/Orchard.Web/Themes/TheAdmin/Styles/site.css +++ b/src/Orchard.Web/Themes/TheAdmin/Styles/site.css @@ -425,7 +425,7 @@ span.message { border:1px solid #ffea9b; } .message-Error { - background:#e68585; /* green */ + background:#e68585; /* red */ border:1px solid #990808; color:#fff; }.debug.message { @@ -823,7 +823,7 @@ table.items th, table.items td { /* Core Modules -----------------------------------------------------------*/ +***************************************************************/ /* Routable */ .permalink input.text { background:transparent; @@ -899,7 +899,7 @@ fieldset.publish-later-datetime input { } /* Fields -----------------------------------------------------------*/ +***************************************************************/ /* TextField */ #main .summary p.text-field { margin:.5em 0; diff --git a/src/Orchard.Web/Themes/TheThemeMachine/Styles/Site.css b/src/Orchard.Web/Themes/TheThemeMachine/Styles/Site.css index e51a40030..100725b95 100644 --- a/src/Orchard.Web/Themes/TheThemeMachine/Styles/Site.css +++ b/src/Orchard.Web/Themes/TheThemeMachine/Styles/Site.css @@ -143,7 +143,7 @@ aside h6 { font-size: 1em; } /* Lists */ li ul, li ol { margin:0 1.5em; } -ul, ol { margin: 0 1.5em 1.5em 1.5em; } +ul, ol { margin: 1.5em; line-height: 1.538em; } ul { list-style-type: disc; } ol { list-style-type: decimal; } @@ -391,6 +391,12 @@ nav ul .search-results .blog-post .metadata .published { display: inline; margin: 0 6px 0 0; } .search-results .blog-post .metadata .commentcount { display: inline; } +/* Confirmations */ +.message, .validation-summary-errors { margin:10px 0 4px 0; padding:4px; } +.messages a { font-weight:bold; } +.message-Information { background:#e6f1c9; /* green */ border:1px solid #cfe493; color:#062232; } +.message-Warning { background:#fdf5bc; /* yellow */ border:1px solid #ffea9b; } +.critical.message, .validation-summary-errors, .message-Error { background:#e68585; /* red */ border:1px solid #990808; color:#fff; } /* Secondary From b1f88725b02209a1cf3fb3874e88aef6a698368c Mon Sep 17 00:00:00 2001 From: Dave Reed Date: Mon, 29 Nov 2010 15:00:04 -0800 Subject: [PATCH 05/11] #16692: Better stack trace when loading a module fails because the types cannot be exported. --HG-- branch : dev --- src/Orchard/Environment/Extensions/ExtensionManager.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Orchard/Environment/Extensions/ExtensionManager.cs b/src/Orchard/Environment/Extensions/ExtensionManager.cs index fe7d405a9..d5a55cf8c 100644 --- a/src/Orchard/Environment/Extensions/ExtensionManager.cs +++ b/src/Orchard/Environment/Extensions/ExtensionManager.cs @@ -77,7 +77,13 @@ namespace Orchard.Environment.Extensions { var featureId = featureDescriptor.Id; var extensionId = extensionDescriptor.Id; - var extensionEntry = _cacheManager.Get(extensionId, ctx => BuildEntry(extensionDescriptor)); + ExtensionEntry extensionEntry; + try { + extensionEntry = _cacheManager.Get(extensionId, ctx => BuildEntry(extensionDescriptor)); + } + catch (Exception ex) { + throw new OrchardException(T("Error while loading extension '{0}'.", extensionId), ex); + } if (extensionEntry == null) { // If the feature could not be compiled for some reason, // return a "null" feature, i.e. a feature with no exported types. From 49d446f645e2a0110252f0f544f09ff0b46f5437 Mon Sep 17 00:00:00 2001 From: BertrandLeRoy Date: Mon, 29 Nov 2010 15:51:08 -0800 Subject: [PATCH 06/11] Revising the post-setup homepage content. http://orchard.codeplex.com/workitem/16773 --HG-- branch : dev --- .../Orchard.Setup/Services/SetupService.cs | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/Orchard.Web/Modules/Orchard.Setup/Services/SetupService.cs b/src/Orchard.Web/Modules/Orchard.Setup/Services/SetupService.cs index 7c6e55376..149069d0e 100644 --- a/src/Orchard.Web/Modules/Orchard.Setup/Services/SetupService.cs +++ b/src/Orchard.Web/Modules/Orchard.Setup/Services/SetupService.cs @@ -283,7 +283,25 @@ namespace Orchard.Setup.Services { page.As().Title = T("Welcome to Orchard!").Text; page.As().Path = ""; page.As().Slug = ""; - page.As().Text = string.Format(CultureInfo.CurrentCulture, "

    You’ve successfully setup your Orchard Site and this is the homepage of your new site. Here are a few things you can look at to get familiar with the application. Once you feel confident you don’t need this anymore, you can remove this by going into editing mode and replacing it with whatever you want.

    First things first - You’ll probably want to manage your settings and configure Orchard to your liking. After that, you can head over to manage themes to change or install new themes and really make it your own. Once you’re happy with a look and feel, it’s time for some content. You can start creating new custom content types or start with some built-in ones by adding a page, creating a blog or managing your menus.

    Finally, Orchard has been designed to be extended. It comes with a few built-in modules such as pages and blogs or themes. If you’re looking to add additional functionality, you can do so by creating your own module or installing a new one that someone has made. Modules are created by other users of Orchard just like you so if you feel up to it, please consider participating. XOXO – The Orchard Team

    ", page.Id); + page.As().Text = string.Format(CultureInfo.CurrentCulture, +@"

    You've successfully setup your Orchard Site and this is the homepage of your new site. +Here are a few things you can look at to get familiar with the application. +Once you feel confident you don't need this anymore, you can +remove it by going into editing mode +and replacing it with whatever you want.

    +

    First things first - You'll probably want to manage your settings +and configure Orchard to your liking. After that, you can head over to +manage themes to change or install new themes +and really make it your own. Once you're happy with a look and feel, it's time for some content. +You can start creating new custom content types or start from the built-in ones by +adding a page, creating a blog +or managing your menus.

    +

    Finally, Orchard has been designed to be extended. It comes with a few built-in +modules such as pages and blogs or themes. If you're looking to add additional functionality, +you can do so by creating your own module or by installing one that somebody else built. +Modules are created by other users of Orchard just like you so if you feel up to it, +please consider participating. +Thanks for using Orchard – The Orchard Team

    ", page.Id); contentManager.Publish(page); siteSettings.Record.HomePage = "RoutableHomePageProvider;" + page.Id; From 106bb8322d853016622ff7e5bbe4647c391aba6e Mon Sep 17 00:00:00 2001 From: BertrandLeRoy Date: Mon, 29 Nov 2010 16:00:43 -0800 Subject: [PATCH 07/11] Small correction to the home page text post-setup, plus making it localizable. --HG-- branch : dev --- .../Modules/Orchard.Setup/Services/SetupService.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Orchard.Web/Modules/Orchard.Setup/Services/SetupService.cs b/src/Orchard.Web/Modules/Orchard.Setup/Services/SetupService.cs index 149069d0e..6bccec986 100644 --- a/src/Orchard.Web/Modules/Orchard.Setup/Services/SetupService.cs +++ b/src/Orchard.Web/Modules/Orchard.Setup/Services/SetupService.cs @@ -283,7 +283,7 @@ namespace Orchard.Setup.Services { page.As().Title = T("Welcome to Orchard!").Text; page.As().Path = ""; page.As().Slug = ""; - page.As().Text = string.Format(CultureInfo.CurrentCulture, + page.As().Text = T( @"

    You've successfully setup your Orchard Site and this is the homepage of your new site. Here are a few things you can look at to get familiar with the application. Once you feel confident you don't need this anymore, you can @@ -300,8 +300,8 @@ or managing your menus.

    modules such as pages and blogs or themes. If you're looking to add additional functionality, you can do so by creating your own module or by installing one that somebody else built. Modules are created by other users of Orchard just like you so if you feel up to it, -please consider participating. -Thanks for using Orchard – The Orchard Team

    ", page.Id); +please consider participating.

    +

    Thanks for using Orchard – The Orchard Team

    ", page.Id).Text; contentManager.Publish(page); siteSettings.Record.HomePage = "RoutableHomePageProvider;" + page.Id; From de949ccdfc26ddfd5c1ffc2131dfd9db7cc13621 Mon Sep 17 00:00:00 2001 From: Nathan Heskew Date: Mon, 29 Nov 2010 16:01:46 -0800 Subject: [PATCH 08/11] Adding some spec tests for the routeable part's slug prefix display in the editor (for blogs) --HG-- branch : dev --- .../Bindings/OrchardSiteFactory.cs | 8 +- src/Orchard.Specs/Bindings/WebAppHosting.cs | 15 +- src/Orchard.Specs/Blogs.feature | 24 +- src/Orchard.Specs/Blogs.feature.cs | 234 +++++++++++------- .../Hosting/RequestExtensions.cs | 11 +- src/Orchard.Specs/WebHosting.feature.cs | 82 +++--- 6 files changed, 240 insertions(+), 134 deletions(-) diff --git a/src/Orchard.Specs/Bindings/OrchardSiteFactory.cs b/src/Orchard.Specs/Bindings/OrchardSiteFactory.cs index a28c02932..972750f32 100644 --- a/src/Orchard.Specs/Bindings/OrchardSiteFactory.cs +++ b/src/Orchard.Specs/Bindings/OrchardSiteFactory.cs @@ -10,12 +10,18 @@ namespace Orchard.Specs.Bindings { public class OrchardSiteFactory : BindingBase { [Given(@"I have installed Orchard")] public void GivenIHaveInstalledOrchard() { + GivenIHaveInstalledOrchard("/"); + } + + [Given(@"I have installed Orchard at ""(.*)\""")] + public void GivenIHaveInstalledOrchard(string virtualDirectory) { var webApp = Binding(); webApp.GivenIHaveACleanSiteWith(TableData( new { extension = "module", names = "Orchard.Setup, Orchard.Pages, Orchard.Blogs, Orchard.Messaging, Orchard.Modules, Orchard.Packaging, Orchard.PublishLater, Orchard.Themes, Orchard.Scripting, Orchard.Widgets, Orchard.Users, Orchard.Roles, Orchard.Comments, Orchard.jQuery, Orchard.Tags, TinyMce" }, new { extension = "core", names = "Common, Dashboard, Feeds, HomePage, Navigation, Contents, Routable, Scheduling, Settings, Shapes, XmlRpc" }, - new { extension = "theme", names = "SafeMode, TheAdmin, TheThemeMachine" })); + new { extension = "theme", names = "SafeMode, TheAdmin, TheThemeMachine" }), + virtualDirectory); webApp.WhenIGoTo("Setup"); diff --git a/src/Orchard.Specs/Bindings/WebAppHosting.cs b/src/Orchard.Specs/Bindings/WebAppHosting.cs index 94bd33e4f..ce2712f31 100644 --- a/src/Orchard.Specs/Bindings/WebAppHosting.cs +++ b/src/Orchard.Specs/Bindings/WebAppHosting.cs @@ -60,8 +60,8 @@ namespace Orchard.Specs.Bindings { } [Given(@"I have a clean site")] - public void GivenIHaveACleanSite() { - GivenIHaveACleanSiteBasedOn("Orchard.Web"); + public void GivenIHaveACleanSite(string virtualDirectory = "/") { + GivenIHaveACleanSiteBasedOn("Orchard.Web", virtualDirectory); } [Given(@"I have chosen to deploy modules as source files only")] @@ -71,8 +71,13 @@ namespace Orchard.Specs.Bindings { [Given(@"I have a clean site based on (.*)")] public void GivenIHaveACleanSiteBasedOn(string siteFolder) { + GivenIHaveACleanSiteBasedOn(siteFolder, "/"); + } + + [Given(@"I have a clean site based on (.*) at ""(.*)\""")] + public void GivenIHaveACleanSiteBasedOn(string siteFolder, string virtualDirectory) { _webHost = new WebHost(_orchardTemp); - Host.Initialize(siteFolder, "/"); + Host.Initialize(siteFolder, virtualDirectory ?? "/"); var shuttle = new Shuttle(); Host.Execute(() => { log4net.Config.BasicConfigurator.Configure(new CastleAppender()); @@ -124,8 +129,8 @@ namespace Orchard.Specs.Bindings { } [Given(@"I have a clean site with")] - public void GivenIHaveACleanSiteWith(Table table) { - GivenIHaveACleanSite(); + public void GivenIHaveACleanSiteWith(Table table, string virtualDirectory = "/") { + GivenIHaveACleanSite(virtualDirectory); foreach (var row in table.Rows) { foreach (var name in row["names"].Split(',').Select(x => x.Trim())) { switch (row["extension"]) { diff --git a/src/Orchard.Specs/Blogs.feature b/src/Orchard.Specs/Blogs.feature index 4a14c4328..9dad395d7 100644 --- a/src/Orchard.Specs/Blogs.feature +++ b/src/Orchard.Specs/Blogs.feature @@ -125,4 +125,26 @@ Scenario: Enabling remote blog publishing inserts the appropriate metaweblogapi When I go to "/XmlRpc/LiveWriter/Manifest" Then the content type should be "\btext/xml\b" And I should see "" - And I should see "Metaweblog" \ No newline at end of file + And I should see "Metaweblog" + +Scenario: The virtual path of my installation when not at the root is reflected in the URL example for the slug field when creating a blog or blog post + Given I have installed Orchard at "/OrchardLocal" + When I go to "admin/blogs/create" + Then I should see "http\://localhost/OrchardLocal/" + When I fill in + | name | value | + | Routable.Title | My Blog | + And I hit "Save" + And I go to "admin/blogs/my-blog/posts/create" + Then I should see "http\://localhost/OrchardLocal/my-blog/" + +Scenario: The virtual path of my installation when at the root is reflected in the URL example for the slug field when creating a blog or blog post + Given I have installed Orchard at "/" + When I go to "admin/blogs/create" + Then I should see "http\://localhost/" + When I fill in + | name | value | + | Routable.Title | My Blog | + And I hit "Save" + And I go to "admin/blogs/my-blog/posts/create" + Then I should see "http\://localhost/my-blog/" \ No newline at end of file diff --git a/src/Orchard.Specs/Blogs.feature.cs b/src/Orchard.Specs/Blogs.feature.cs index 5e8c48583..b00e46221 100644 --- a/src/Orchard.Specs/Blogs.feature.cs +++ b/src/Orchard.Specs/Blogs.feature.cs @@ -1,7 +1,7 @@ // ------------------------------------------------------------------------------ // // This code was generated by SpecFlow (http://www.specflow.org/). -// SpecFlow Version:1.3.2.0 +// SpecFlow Version:1.4.0.0 // Runtime Version:4.0.30319.1 // // Changes to this file may cause incorrect behavior and will be lost if @@ -14,7 +14,7 @@ namespace Orchard.Specs using TechTalk.SpecFlow; - [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.3.2.0")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.4.0.0")] [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [NUnit.Framework.TestFixtureAttribute()] [NUnit.Framework.DescriptionAttribute("Blog")] @@ -31,7 +31,7 @@ namespace Orchard.Specs { testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner(); TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Blog", "In order to add blogs to my site\r\nAs an author\r\nI want to create blogs and create" + - ", publish and edit blog posts", ((string[])(null))); + ", publish and edit blog posts", GenerationTargetLanguage.CSharp, ((string[])(null))); testRunner.OnFeatureStart(featureInfo); } @@ -61,11 +61,11 @@ namespace Orchard.Specs #line 6 this.ScenarioSetup(scenarioInfo); #line 7 -testRunner.Given("I have installed Orchard"); + testRunner.Given("I have installed Orchard"); #line 8 -testRunner.When("I go to \"admin\""); + testRunner.When("I go to \"admin\""); #line 9 -testRunner.Then("I should see \"Blogs\""); + testRunner.Then("I should see \"Blogs\""); #line hidden testRunner.CollectScenarioErrors(); } @@ -78,9 +78,9 @@ testRunner.Then("I should see \"Blogs\""); #line 11 this.ScenarioSetup(scenarioInfo); #line 12 -testRunner.Given("I have installed Orchard"); + testRunner.Given("I have installed Orchard"); #line 13 -testRunner.When("I go to \"admin/blogs/create\""); + testRunner.When("I go to \"admin/blogs/create\""); #line hidden TechTalk.SpecFlow.Table table1 = new TechTalk.SpecFlow.Table(new string[] { "name", @@ -89,15 +89,15 @@ testRunner.When("I go to \"admin/blogs/create\""); "Routable.Title", "My Blog"}); #line 14 -testRunner.And("I fill in", ((string)(null)), table1); + testRunner.And("I fill in", ((string)(null)), table1); #line 17 -testRunner.And("I hit \"Save\""); + testRunner.And("I hit \"Save\""); #line 18 -testRunner.And("I go to \"my-blog\""); + testRunner.And("I go to \"my-blog\""); #line 19 -testRunner.Then("I should see \"]*>.*?My Blog.*?\""); + testRunner.Then("I should see \"]*>.*?My Blog.*?\""); #line 20 -testRunner.When("I go to \"admin/blogs/my-blog/posts/create\""); + testRunner.When("I go to \"admin/blogs/my-blog/posts/create\""); #line hidden TechTalk.SpecFlow.Table table2 = new TechTalk.SpecFlow.Table(new string[] { "name", @@ -109,15 +109,15 @@ testRunner.When("I go to \"admin/blogs/my-blog/posts/create\""); "Body.Text", "Hi there."}); #line 21 -testRunner.And("I fill in", ((string)(null)), table2); + testRunner.And("I fill in", ((string)(null)), table2); #line 25 -testRunner.And("I hit \"Publish Now\""); + testRunner.And("I hit \"Publish Now\""); #line 26 -testRunner.And("I go to \"my-blog/my-post\""); + testRunner.And("I go to \"my-blog/my-post\""); #line 27 -testRunner.Then("I should see \"]*>.*?My Post.*?\""); + testRunner.Then("I should see \"]*>.*?My Post.*?\""); #line 28 -testRunner.And("I should see \"Hi there.\""); + testRunner.And("I should see \"Hi there.\""); #line hidden testRunner.CollectScenarioErrors(); } @@ -132,9 +132,9 @@ testRunner.And("I should see \"Hi there.\""); #line 30 this.ScenarioSetup(scenarioInfo); #line 31 -testRunner.Given("I have installed Orchard"); + testRunner.Given("I have installed Orchard"); #line 32 -testRunner.When("I go to \"admin/blogs/create\""); + testRunner.When("I go to \"admin/blogs/create\""); #line hidden TechTalk.SpecFlow.Table table3 = new TechTalk.SpecFlow.Table(new string[] { "name", @@ -143,11 +143,11 @@ testRunner.When("I go to \"admin/blogs/create\""); "Routable.Title", "My Blog"}); #line 33 -testRunner.And("I fill in", ((string)(null)), table3); + testRunner.And("I fill in", ((string)(null)), table3); #line 36 -testRunner.And("I hit \"Save\""); + testRunner.And("I hit \"Save\""); #line 37 -testRunner.And("I go to \"admin/blogs/my-blog/posts/create\""); + testRunner.And("I go to \"admin/blogs/my-blog/posts/create\""); #line hidden TechTalk.SpecFlow.Table table4 = new TechTalk.SpecFlow.Table(new string[] { "name", @@ -159,17 +159,17 @@ testRunner.And("I go to \"admin/blogs/my-blog/posts/create\""); "Body.Text", "Hi there."}); #line 38 -testRunner.And("I fill in", ((string)(null)), table4); + testRunner.And("I fill in", ((string)(null)), table4); #line 42 -testRunner.And("I hit \"Publish Now\""); + testRunner.And("I hit \"Publish Now\""); #line 43 -testRunner.And("I go to \"my-blog/my-post\""); + testRunner.And("I go to \"my-blog/my-post\""); #line 44 -testRunner.Then("I should see \"]*>.*?My Post.*?\""); + testRunner.Then("I should see \"]*>.*?My Post.*?\""); #line 45 -testRunner.And("I should see \"Hi there.\""); + testRunner.And("I should see \"Hi there.\""); #line 46 -testRunner.When("I go to \"admin/blogs/my-blog/posts/create\""); + testRunner.When("I go to \"admin/blogs/my-blog/posts/create\""); #line hidden TechTalk.SpecFlow.Table table5 = new TechTalk.SpecFlow.Table(new string[] { "name", @@ -181,17 +181,17 @@ testRunner.When("I go to \"admin/blogs/my-blog/posts/create\""); "Body.Text", "Hi there, again."}); #line 47 -testRunner.And("I fill in", ((string)(null)), table5); + testRunner.And("I fill in", ((string)(null)), table5); #line 51 -testRunner.And("I hit \"Publish Now\""); + testRunner.And("I hit \"Publish Now\""); #line 52 -testRunner.And("I go to \"my-blog/my-post-2\""); + testRunner.And("I go to \"my-blog/my-post-2\""); #line 53 -testRunner.Then("I should see \"]*>.*?My Post.*?\""); + testRunner.Then("I should see \"]*>.*?My Post.*?\""); #line 54 -testRunner.And("I should see \"Hi there, again.\""); + testRunner.And("I should see \"Hi there, again.\""); #line 55 -testRunner.When("I go to \"admin/blogs/my-blog/posts/create\""); + testRunner.When("I go to \"admin/blogs/my-blog/posts/create\""); #line hidden TechTalk.SpecFlow.Table table6 = new TechTalk.SpecFlow.Table(new string[] { "name", @@ -206,15 +206,15 @@ testRunner.When("I go to \"admin/blogs/my-blog/posts/create\""); "Body.Text", "Are you still there?"}); #line 56 -testRunner.And("I fill in", ((string)(null)), table6); + testRunner.And("I fill in", ((string)(null)), table6); #line 61 -testRunner.And("I hit \"Publish Now\""); + testRunner.And("I hit \"Publish Now\""); #line 62 -testRunner.And("I go to \"my-blog/my-post-3\""); + testRunner.And("I go to \"my-blog/my-post-3\""); #line 63 -testRunner.Then("I should see \"]*>.*?My Post.*?\""); + testRunner.Then("I should see \"]*>.*?My Post.*?\""); #line 64 -testRunner.And("I should see \"Are you still there?\""); + testRunner.And("I should see \"Are you still there?\""); #line hidden testRunner.CollectScenarioErrors(); } @@ -229,9 +229,9 @@ testRunner.And("I should see \"Are you still there?\""); #line 66 this.ScenarioSetup(scenarioInfo); #line 67 -testRunner.Given("I have installed Orchard"); + testRunner.Given("I have installed Orchard"); #line 68 -testRunner.When("I go to \"admin/blogs/create\""); + testRunner.When("I go to \"admin/blogs/create\""); #line hidden TechTalk.SpecFlow.Table table7 = new TechTalk.SpecFlow.Table(new string[] { "name", @@ -240,15 +240,15 @@ testRunner.When("I go to \"admin/blogs/create\""); "Routable.Title", "My Blog"}); #line 69 -testRunner.And("I fill in", ((string)(null)), table7); + testRunner.And("I fill in", ((string)(null)), table7); #line 72 -testRunner.And("I hit \"Save\""); + testRunner.And("I hit \"Save\""); #line 73 -testRunner.And("I go to \"my-blog\""); + testRunner.And("I go to \"my-blog\""); #line 74 -testRunner.Then("I should see \"]*>.*?My Blog.*?\""); + testRunner.Then("I should see \"]*>.*?My Blog.*?\""); #line 75 -testRunner.When("I go to \"admin/blogs/my-blog/posts/create\""); + testRunner.When("I go to \"admin/blogs/my-blog/posts/create\""); #line hidden TechTalk.SpecFlow.Table table8 = new TechTalk.SpecFlow.Table(new string[] { "name", @@ -260,19 +260,19 @@ testRunner.When("I go to \"admin/blogs/my-blog/posts/create\""); "Body.Text", "Hi there."}); #line 76 -testRunner.And("I fill in", ((string)(null)), table8); + testRunner.And("I fill in", ((string)(null)), table8); #line 80 -testRunner.And("I hit \"Publish Now\""); + testRunner.And("I hit \"Publish Now\""); #line 81 -testRunner.And("I go to \"my-blog/my-post\""); + testRunner.And("I go to \"my-blog/my-post\""); #line 82 -testRunner.Then("I should see \"]*>.*?My Post.*?\""); + testRunner.Then("I should see \"]*>.*?My Post.*?\""); #line 83 -testRunner.And("I should see \"Hi there.\""); + testRunner.And("I should see \"Hi there.\""); #line 84 -testRunner.When("I go to \"admin/blogs/my-blog\""); + testRunner.When("I go to \"admin/blogs/my-blog\""); #line 85 -testRunner.And("I follow \"Blog Properties\""); + testRunner.And("I follow \"Blog Properties\""); #line hidden TechTalk.SpecFlow.Table table9 = new TechTalk.SpecFlow.Table(new string[] { "name", @@ -281,19 +281,19 @@ testRunner.And("I follow \"Blog Properties\""); "Routable.Slug", "my-other-blog"}); #line 86 -testRunner.And("I fill in", ((string)(null)), table9); + testRunner.And("I fill in", ((string)(null)), table9); #line 89 -testRunner.And("I hit \"Save\""); + testRunner.And("I hit \"Save\""); #line 90 -testRunner.And("I go to \"my-other-blog\""); + testRunner.And("I go to \"my-other-blog\""); #line 91 -testRunner.Then("I should see \"]*>.*?My Blog.*?\""); + testRunner.Then("I should see \"]*>.*?My Blog.*?\""); #line 92 -testRunner.When("I go to \"my-other-blog/my-post\""); + testRunner.When("I go to \"my-other-blog/my-post\""); #line 93 -testRunner.Then("I should see \"]*>.*?My Post.*?\""); + testRunner.Then("I should see \"]*>.*?My Post.*?\""); #line 94 -testRunner.And("I should see \"Hi there.\""); + testRunner.And("I should see \"Hi there.\""); #line hidden testRunner.CollectScenarioErrors(); } @@ -306,9 +306,9 @@ testRunner.And("I should see \"Hi there.\""); #line 96 this.ScenarioSetup(scenarioInfo); #line 97 -testRunner.Given("I have installed Orchard"); + testRunner.Given("I have installed Orchard"); #line 98 -testRunner.When("I go to \"admin/blogs/create\""); + testRunner.When("I go to \"admin/blogs/create\""); #line hidden TechTalk.SpecFlow.Table table10 = new TechTalk.SpecFlow.Table(new string[] { "name", @@ -317,11 +317,11 @@ testRunner.When("I go to \"admin/blogs/create\""); "Routable.Title", "My Blog"}); #line 99 -testRunner.And("I fill in", ((string)(null)), table10); + testRunner.And("I fill in", ((string)(null)), table10); #line 102 -testRunner.And("I hit \"Save\""); + testRunner.And("I hit \"Save\""); #line 103 -testRunner.And("I go to \"admin/blogs/my-blog/posts/create\""); + testRunner.And("I go to \"admin/blogs/my-blog/posts/create\""); #line hidden TechTalk.SpecFlow.Table table11 = new TechTalk.SpecFlow.Table(new string[] { "name", @@ -333,15 +333,15 @@ testRunner.And("I go to \"admin/blogs/my-blog/posts/create\""); "Body.Text", "Hi there."}); #line 104 -testRunner.And("I fill in", ((string)(null)), table11); + testRunner.And("I fill in", ((string)(null)), table11); #line 108 -testRunner.And("I hit \"Publish Now\""); + testRunner.And("I hit \"Publish Now\""); #line 109 -testRunner.And("I am redirected"); + testRunner.And("I am redirected"); #line 110 -testRunner.And("I go to \"my-blog/my-post\""); + testRunner.And("I go to \"my-blog/my-post\""); #line 111 -testRunner.Then("I should see \"\""); #line hidden testRunner.CollectScenarioErrors(); @@ -357,13 +357,13 @@ testRunner.Then("I should see \"\""); #line 125 -testRunner.When("I go to \"/XmlRpc/LiveWriter/Manifest\""); + testRunner.When("I go to \"/XmlRpc/LiveWriter/Manifest\""); #line 126 -testRunner.Then("the content type should be \"\\btext/xml\\b\""); + testRunner.Then("the content type should be \"\\btext/xml\\b\""); #line 127 -testRunner.And("I should see \"\""); #line 128 -testRunner.And("I should see \"Metaweblog\""); + testRunner.And("I should see \"Metaweblog\""); +#line hidden + testRunner.CollectScenarioErrors(); + } + + [NUnit.Framework.TestAttribute()] + [NUnit.Framework.DescriptionAttribute("The virtual path of my installation when not at the root is reflected in the URL " + + "example for the slug field when creating a blog or blog post")] + public virtual void TheVirtualPathOfMyInstallationWhenNotAtTheRootIsReflectedInTheURLExampleForTheSlugFieldWhenCreatingABlogOrBlogPost() + { + TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("The virtual path of my installation when not at the root is reflected in the URL " + + "example for the slug field when creating a blog or blog post", ((string[])(null))); +#line 130 +this.ScenarioSetup(scenarioInfo); +#line 131 + testRunner.Given("I have installed Orchard at \"/OrchardLocal\""); +#line 132 + testRunner.When("I go to \"admin/blogs/create\""); +#line 133 + testRunner.Then("I should see \"http\\://localhost/OrchardLocal/\""); +#line hidden + TechTalk.SpecFlow.Table table13 = new TechTalk.SpecFlow.Table(new string[] { + "name", + "value"}); + table13.AddRow(new string[] { + "Routable.Title", + "My Blog"}); +#line 134 + testRunner.When("I fill in", ((string)(null)), table13); +#line 137 + testRunner.And("I hit \"Save\""); +#line 138 + testRunner.And("I go to \"admin/blogs/my-blog/posts/create\""); +#line 139 + testRunner.Then("I should see \"http\\://localhost/OrchardLocal/my-blog/\""); +#line hidden + testRunner.CollectScenarioErrors(); + } + + [NUnit.Framework.TestAttribute()] + [NUnit.Framework.DescriptionAttribute("The virtual path of my installation when at the root is reflected in the URL exam" + + "ple for the slug field when creating a blog or blog post")] + public virtual void TheVirtualPathOfMyInstallationWhenAtTheRootIsReflectedInTheURLExampleForTheSlugFieldWhenCreatingABlogOrBlogPost() + { + TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("The virtual path of my installation when at the root is reflected in the URL exam" + + "ple for the slug field when creating a blog or blog post", ((string[])(null))); +#line 141 +this.ScenarioSetup(scenarioInfo); +#line 142 + testRunner.Given("I have installed Orchard at \"/\""); +#line 143 + testRunner.When("I go to \"admin/blogs/create\""); +#line 144 + testRunner.Then("I should see \"http\\://localhost/\""); +#line hidden + TechTalk.SpecFlow.Table table14 = new TechTalk.SpecFlow.Table(new string[] { + "name", + "value"}); + table14.AddRow(new string[] { + "Routable.Title", + "My Blog"}); +#line 145 + testRunner.When("I fill in", ((string)(null)), table14); +#line 148 + testRunner.And("I hit \"Save\""); +#line 149 + testRunner.And("I go to \"admin/blogs/my-blog/posts/create\""); +#line 150 + testRunner.Then("I should see \"http\\://localhost/my-blog/\""); #line hidden testRunner.CollectScenarioErrors(); } diff --git a/src/Orchard.Specs/Hosting/RequestExtensions.cs b/src/Orchard.Specs/Hosting/RequestExtensions.cs index d60c140c1..4a5ba60ce 100644 --- a/src/Orchard.Specs/Hosting/RequestExtensions.cs +++ b/src/Orchard.Specs/Hosting/RequestExtensions.cs @@ -6,8 +6,6 @@ using System.Linq; using System.Text; using System.Web; using System.Web.Hosting; -using HtmlAgilityPack; -using Orchard.Commands; using Orchard.Specs.Util; namespace Orchard.Specs.Hosting { @@ -16,12 +14,13 @@ namespace Orchard.Specs.Hosting { var physicalPath = Bleroy.FluentPath.Path.Get(webHost.PhysicalDirectory); + urlPath = StripVDir(urlPath, webHost.VirtualDirectory); var details = new RequestDetails { HostName = webHost.HostName, UrlPath = urlPath, Page = physicalPath .Combine(urlPath.TrimStart('/', '\\')) - .GetRelativePath(physicalPath), + .GetRelativePath(physicalPath) }; if (!string.IsNullOrEmpty(webHost.Cookies)) { @@ -52,6 +51,12 @@ namespace Orchard.Specs.Hosting { return details; } + private static string StripVDir(string urlPath, string virtualDirectory) { + return urlPath.StartsWith(virtualDirectory, StringComparison.OrdinalIgnoreCase) + ? urlPath.Substring(virtualDirectory.Length) + : urlPath; + } + public static RequestDetails SendRequest(this WebHost webHost, string urlPath) { return webHost.SendRequest(urlPath, null); } diff --git a/src/Orchard.Specs/WebHosting.feature.cs b/src/Orchard.Specs/WebHosting.feature.cs index 2f1c2e07b..d8c716192 100644 --- a/src/Orchard.Specs/WebHosting.feature.cs +++ b/src/Orchard.Specs/WebHosting.feature.cs @@ -1,7 +1,7 @@ // ------------------------------------------------------------------------------ // // This code was generated by SpecFlow (http://www.specflow.org/). -// SpecFlow Version:1.3.2.0 +// SpecFlow Version:1.4.0.0 // Runtime Version:4.0.30319.1 // // Changes to this file may cause incorrect behavior and will be lost if @@ -14,7 +14,7 @@ namespace Orchard.Specs using TechTalk.SpecFlow; - [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.3.2.0")] + [System.CodeDom.Compiler.GeneratedCodeAttribute("TechTalk.SpecFlow", "1.4.0.0")] [System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [NUnit.Framework.TestFixtureAttribute()] [NUnit.Framework.DescriptionAttribute("Web Hosting")] @@ -31,7 +31,7 @@ namespace Orchard.Specs { testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner(); TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Web Hosting", "In order to test orchard\r\nAs an integration runner\r\nI want to verify basic hostin" + - "g is working", ((string[])(null))); + "g is working", GenerationTargetLanguage.CSharp, ((string[])(null))); testRunner.OnFeatureStart(featureInfo); } @@ -61,13 +61,13 @@ namespace Orchard.Specs #line 6 this.ScenarioSetup(scenarioInfo); #line 7 -testRunner.Given("I have a clean site based on Simple.Web"); + testRunner.Given("I have a clean site based on Simple.Web"); #line 8 -testRunner.When("I go to \"Content/Static.txt\""); + testRunner.When("I go to \"Content/Static.txt\""); #line 9 -testRunner.Then("I should see \"Hello world!\""); + testRunner.Then("I should see \"Hello world!\""); #line 10 -testRunner.And("the status should be 200 \"OK\""); + testRunner.And("the status should be 200 \"OK\""); #line hidden testRunner.CollectScenarioErrors(); } @@ -80,13 +80,13 @@ testRunner.And("the status should be 200 \"OK\""); #line 12 this.ScenarioSetup(scenarioInfo); #line 13 -testRunner.Given("I have a clean site based on Simple.Web"); + testRunner.Given("I have a clean site based on Simple.Web"); #line 14 -testRunner.When("I go to \"Simple/Page.aspx\""); + testRunner.When("I go to \"Simple/Page.aspx\""); #line 15 -testRunner.Then("I should see \"Hello again\""); + testRunner.Then("I should see \"Hello again\""); #line 16 -testRunner.And("the status should be 200 \"OK\""); + testRunner.And("the status should be 200 \"OK\""); #line hidden testRunner.CollectScenarioErrors(); } @@ -99,13 +99,13 @@ testRunner.And("the status should be 200 \"OK\""); #line 18 this.ScenarioSetup(scenarioInfo); #line 19 -testRunner.Given("I have a clean site based on Simple.Web"); + testRunner.Given("I have a clean site based on Simple.Web"); #line 20 -testRunner.When("I go to \"hello-world\""); + testRunner.When("I go to \"hello-world\""); #line 21 -testRunner.Then("the status should be 200 \"OK\""); + testRunner.Then("the status should be 200 \"OK\""); #line 22 -testRunner.And("I should see \"Hello yet again\""); + testRunner.And("I should see \"Hello yet again\""); #line hidden testRunner.CollectScenarioErrors(); } @@ -118,15 +118,15 @@ testRunner.And("I should see \"Hello yet again\""); #line 24 this.ScenarioSetup(scenarioInfo); #line 25 -testRunner.Given("I have a clean site based on Simple.Web"); + testRunner.Given("I have a clean site based on Simple.Web"); #line 26 -testRunner.When("I go to \"/simple/page.aspx\""); + testRunner.When("I go to \"/simple/page.aspx\""); #line 27 -testRunner.And("I follow \"next page\""); + testRunner.And("I follow \"next page\""); #line 28 -testRunner.Then("the status should be 200 \"OK\""); + testRunner.Then("the status should be 200 \"OK\""); #line 29 -testRunner.And("I should see \"Hello yet again\""); + testRunner.And("I should see \"Hello yet again\""); #line hidden testRunner.CollectScenarioErrors(); } @@ -139,9 +139,9 @@ testRunner.And("I should see \"Hello yet again\""); #line 31 this.ScenarioSetup(scenarioInfo); #line 32 -testRunner.Given("I have a clean site based on Simple.Web"); + testRunner.Given("I have a clean site based on Simple.Web"); #line 33 -testRunner.And("I am on \"/simple/page.aspx\""); + testRunner.And("I am on \"/simple/page.aspx\""); #line hidden TechTalk.SpecFlow.Table table1 = new TechTalk.SpecFlow.Table(new string[] { "name", @@ -150,15 +150,15 @@ testRunner.And("I am on \"/simple/page.aspx\""); "input1", "gamma"}); #line 34 -testRunner.When("I fill in", ((string)(null)), table1); + testRunner.When("I fill in", ((string)(null)), table1); #line 37 -testRunner.And("I hit \"Go!\""); + testRunner.And("I hit \"Go!\""); #line 38 -testRunner.Then("I should see \"passthrough1:alpha\""); + testRunner.Then("I should see \"passthrough1:alpha\""); #line 39 -testRunner.And("I should see \"passthrough2:beta\""); + testRunner.And("I should see \"passthrough2:beta\""); #line 40 -testRunner.And("I should see \"input1:gamma\""); + testRunner.And("I should see \"input1:gamma\""); #line hidden testRunner.CollectScenarioErrors(); } @@ -171,13 +171,13 @@ testRunner.And("I should see \"input1:gamma\""); #line 42 this.ScenarioSetup(scenarioInfo); #line 43 -testRunner.Given("I have a clean site based on Simple.Web"); + testRunner.Given("I have a clean site based on Simple.Web"); #line 44 -testRunner.When("I go to \"/simple/cookie-set.aspx\""); + testRunner.When("I go to \"/simple/cookie-set.aspx\""); #line 45 -testRunner.And("I go to \"/simple/cookie-show.aspx\""); + testRunner.And("I go to \"/simple/cookie-show.aspx\""); #line 46 -testRunner.Then("I should see \"foo:bar\""); + testRunner.Then("I should see \"foo:bar\""); #line hidden testRunner.CollectScenarioErrors(); } @@ -190,13 +190,13 @@ testRunner.Then("I should see \"foo:bar\""); #line 48 this.ScenarioSetup(scenarioInfo); #line 49 -testRunner.Given("I have a clean site based on Simple.Web"); + testRunner.Given("I have a clean site based on Simple.Web"); #line 50 -testRunner.When("I go to \"/simple/redir.aspx\""); + testRunner.When("I go to \"/simple/redir.aspx\""); #line 51 -testRunner.And("I am redirected"); + testRunner.And("I am redirected"); #line 52 -testRunner.Then("I should see \"Hello again\""); + testRunner.Then("I should see \"Hello again\""); #line hidden testRunner.CollectScenarioErrors(); } @@ -209,11 +209,11 @@ testRunner.Then("I should see \"Hello again\""); #line 54 this.ScenarioSetup(scenarioInfo); #line 55 -testRunner.Given("I have a clean site based on Simple.Web"); + testRunner.Given("I have a clean site based on Simple.Web"); #line 56 -testRunner.When("I go to \"/Modules/Orchard.Blogs/module.txt\""); + testRunner.When("I go to \"/Modules/Orchard.Blogs/module.txt\""); #line 57 -testRunner.Then("the status should be 404 \"Not Found\""); + testRunner.Then("the status should be 404 \"Not Found\""); #line hidden testRunner.CollectScenarioErrors(); } @@ -226,11 +226,11 @@ testRunner.Then("the status should be 404 \"Not Found\""); #line 59 this.ScenarioSetup(scenarioInfo); #line 60 -testRunner.Given("I have a clean site based on Simple.Web"); + testRunner.Given("I have a clean site based on Simple.Web"); #line 61 -testRunner.When("I go to \"/Themes/Classic/theme.txt\""); + testRunner.When("I go to \"/Themes/Classic/theme.txt\""); #line 62 -testRunner.Then("the status should be 404 \"Not Found\""); + testRunner.Then("the status should be 404 \"Not Found\""); #line hidden testRunner.CollectScenarioErrors(); } From a30374780eca7ad4d38a5d332138070733b29512 Mon Sep 17 00:00:00 2001 From: Nathan Heskew Date: Mon, 29 Nov 2010 16:07:12 -0800 Subject: [PATCH 09/11] Updating the RoutePart slug prefix display in the editor to cope with not being in a vdir. Related to #16496 which was already fixed a w/ another bug a little earlier but a double '/' appears when the app is not in a vdir. work item: 16496 --HG-- branch : dev --- .../Core/Routable/Drivers/RoutePartDriver.cs | 16 +++++++++++----- .../ViewModels/RoutableEditorViewModel.cs | 5 ++--- .../Parts/Routable.RoutePart.cshtml | 2 +- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/Orchard.Web/Core/Routable/Drivers/RoutePartDriver.cs b/src/Orchard.Web/Core/Routable/Drivers/RoutePartDriver.cs index d3b6b8b8c..706eaec36 100644 --- a/src/Orchard.Web/Core/Routable/Drivers/RoutePartDriver.cs +++ b/src/Orchard.Web/Core/Routable/Drivers/RoutePartDriver.cs @@ -8,17 +8,24 @@ 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; private readonly IHomePageProvider _routableHomePageProvider; - public RoutePartDriver(IOrchardServices services, IRoutableService routableService, IEnumerable homePageProviders) { + public RoutePartDriver(IOrchardServices services, + IRoutableService routableService, + IEnumerable homePageProviders, + IHttpContextAccessor httpContextAccessor) { _services = services; _routableService = routableService; + _httpContextAccessor = httpContextAccessor; _routableHomePageProvider = homePageProviders.SingleOrDefault(p => p.GetProviderName() == RoutableHomePageProvider.Name); T = NullLocalizer.Instance; } @@ -59,10 +66,9 @@ namespace Orchard.Core.Routable.Drivers { ContainerId = GetContainerId(part), }; - var containerPath = part.GetContainerPath(); - model.DisplayLeadingPath = !string.IsNullOrWhiteSpace(containerPath) - ? string.Format("{0}/", containerPath) - : ""; + var request = _httpContextAccessor.Current().Request; + var containerUrl = new UriBuilder(request.ToRootUrlString()) { Path = (request.ApplicationPath ?? "").TrimEnd('/') + "/" + (part.GetContainerPath() ?? "") }; + model.ContainerAbsoluteUrl = containerUrl.Uri.ToString().TrimEnd('/'); model.PromoteToHomePage = model.Id != 0 && part.Path != null && _routableHomePageProvider != null && _services.WorkContext.CurrentSite.HomePage == _routableHomePageProvider.GetSettingValue(model.Id); return ContentShape("Parts_Routable_Edit", diff --git a/src/Orchard.Web/Core/Routable/ViewModels/RoutableEditorViewModel.cs b/src/Orchard.Web/Core/Routable/ViewModels/RoutableEditorViewModel.cs index 4bdefc198..8f6b4e043 100644 --- a/src/Orchard.Web/Core/Routable/ViewModels/RoutableEditorViewModel.cs +++ b/src/Orchard.Web/Core/Routable/ViewModels/RoutableEditorViewModel.cs @@ -1,5 +1,4 @@ -using System; -using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations; namespace Orchard.Core.Routable.ViewModels { public class RoutableEditorViewModel { @@ -15,6 +14,6 @@ namespace Orchard.Core.Routable.ViewModels { public int? ContainerId { get; set; } public bool PromoteToHomePage { get; set; } - public string DisplayLeadingPath { 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 index 51c226dde..195d54bf6 100644 --- a/src/Orchard.Web/Core/Routable/Views/EditorTemplates/Parts/Routable.RoutePart.cshtml +++ b/src/Orchard.Web/Core/Routable/Views/EditorTemplates/Parts/Routable.RoutePart.cshtml @@ -7,7 +7,7 @@ @Html.TextBoxFor(m => m.Title, new { @class = "large text" })