mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Merge branch '1.x' into feature/audittrail
This commit is contained in:
@@ -104,6 +104,8 @@ namespace Orchard.Specs.Bindings {
|
||||
using (var environment = MvcApplication.CreateStandaloneEnvironment("Default")) {
|
||||
environment.Resolve<IShellSettingsManager>().SaveSettings(shellSettings);
|
||||
}
|
||||
|
||||
MvcApplication.RestartTenant(shellName);
|
||||
});
|
||||
|
||||
webApp.WhenIGoToPathOnHost("Setup", hostName);
|
||||
|
||||
@@ -43,21 +43,14 @@ Scenario: HTML markup in any given comment is encoded
|
||||
Then I should see "This is<br id="bad-anon-br" />a <a href"
|
||||
And I should not see "<br id="bad-anon-br" />"
|
||||
|
||||
Scenario: Moderated comments are not displayed
|
||||
Given I have installed Orchard
|
||||
When I go to "admin/blogs/create"
|
||||
# Moderated comments are not displayed
|
||||
When I go to "users/account/logon"
|
||||
And I fill in
|
||||
| name | value |
|
||||
| Title.Title | My Blog |
|
||||
And I hit "Save"
|
||||
And I go to "admin/blogs"
|
||||
And I follow "My Blog"
|
||||
And I follow "New Post" where class name has "primaryAction"
|
||||
And I fill in
|
||||
| name | value |
|
||||
| Title.Title | My Post |
|
||||
| Body.Text | Hi there. |
|
||||
And I hit "Publish Now"
|
||||
| userNameOrEmail | admin |
|
||||
| password | 6655321 |
|
||||
And I hit "Sign In"
|
||||
And I am redirected
|
||||
And I go to "admin/settings/comments"
|
||||
And I fill in
|
||||
| name | value |
|
||||
|
||||
88
src/Orchard.Specs/Comments.feature.cs
generated
88
src/Orchard.Specs/Comments.feature.cs
generated
@@ -154,94 +154,66 @@ this.ScenarioSetup(scenarioInfo);
|
||||
testRunner.Then("I should see \"This is<br id="bad-anon-br" />a <a href\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
#line 44
|
||||
testRunner.And("I should not see \"<br id=\"bad-anon-br\" />\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line hidden
|
||||
this.ScenarioCleanup();
|
||||
}
|
||||
|
||||
[NUnit.Framework.TestAttribute()]
|
||||
[NUnit.Framework.DescriptionAttribute("Moderated comments are not displayed")]
|
||||
public virtual void ModeratedCommentsAreNotDisplayed()
|
||||
{
|
||||
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Moderated comments are not displayed", ((string[])(null)));
|
||||
#line 46
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 47
|
||||
testRunner.Given("I have installed Orchard", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
|
||||
#line 48
|
||||
testRunner.When("I go to \"admin/blogs/create\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
|
||||
testRunner.When("I go to \"users/account/logon\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table5 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
"name",
|
||||
"value"});
|
||||
table5.AddRow(new string[] {
|
||||
"Title.Title",
|
||||
"My Blog"});
|
||||
#line 49
|
||||
"userNameOrEmail",
|
||||
"admin"});
|
||||
table5.AddRow(new string[] {
|
||||
"password",
|
||||
"6655321"});
|
||||
#line 48
|
||||
testRunner.And("I fill in", ((string)(null)), table5, "And ");
|
||||
#line 52
|
||||
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
testRunner.And("I hit \"Sign In\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 53
|
||||
testRunner.And("I go to \"admin/blogs\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 54
|
||||
testRunner.And("I follow \"My Blog\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 55
|
||||
testRunner.And("I follow \"New Post\" where class name has \"primaryAction\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
testRunner.And("I go to \"admin/settings/comments\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table6 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
"name",
|
||||
"value"});
|
||||
table6.AddRow(new string[] {
|
||||
"Title.Title",
|
||||
"My Post"});
|
||||
table6.AddRow(new string[] {
|
||||
"Body.Text",
|
||||
"Hi there."});
|
||||
#line 56
|
||||
testRunner.And("I fill in", ((string)(null)), table6, "And ");
|
||||
"CommentSettings.ModerateComments",
|
||||
"true"});
|
||||
#line 55
|
||||
testRunner.And("I fill in", ((string)(null)), table6, "And ");
|
||||
#line 58
|
||||
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 59
|
||||
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 60
|
||||
testRunner.And("I hit \"Publish Now\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
testRunner.Then("I should see \"Settings updated\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
#line 61
|
||||
testRunner.And("I go to \"admin/settings/comments\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
testRunner.When("I go to \"users/account/logoff\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
|
||||
#line 62
|
||||
testRunner.And("I go to \"my-blog/my-post\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table7 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
"name",
|
||||
"value"});
|
||||
table7.AddRow(new string[] {
|
||||
"CommentSettings.ModerateComments",
|
||||
"true"});
|
||||
#line 62
|
||||
testRunner.And("I fill in", ((string)(null)), table7, "And ");
|
||||
#line 65
|
||||
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 66
|
||||
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 67
|
||||
testRunner.Then("I should see \"Settings updated\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
#line 68
|
||||
testRunner.When("I go to \"users/account/logoff\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
|
||||
#line 69
|
||||
testRunner.And("I go to \"my-blog/my-post\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table8 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
"name",
|
||||
"value"});
|
||||
table8.AddRow(new string[] {
|
||||
"Comments.Author",
|
||||
"Bill"});
|
||||
table8.AddRow(new string[] {
|
||||
table7.AddRow(new string[] {
|
||||
"Comments.CommentText",
|
||||
"This is a moderated comment."});
|
||||
#line 70
|
||||
testRunner.And("I fill in", ((string)(null)), table8, "And ");
|
||||
#line 74
|
||||
#line 63
|
||||
testRunner.And("I fill in", ((string)(null)), table7, "And ");
|
||||
#line 67
|
||||
testRunner.And("I hit \"Submit Comment\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 75
|
||||
#line 68
|
||||
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 77
|
||||
#line 70
|
||||
testRunner.And("I go to \"my-blog/my-post\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 78
|
||||
#line 71
|
||||
testRunner.Then("I should see \"Hi there\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
#line 79
|
||||
#line 72
|
||||
testRunner.And("I should not see \"This is a moderated comment\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line hidden
|
||||
this.ScenarioCleanup();
|
||||
|
||||
@@ -36,20 +36,20 @@ Scenario: Creating and using Date fields
|
||||
Then I should see "Date of the event"
|
||||
When I fill in
|
||||
| name | value |
|
||||
| Event.EventDate.Date | 31/01/2012 |
|
||||
| Event.EventDate.Time | 12:00 AM |
|
||||
| Event.EventDate.Editor.Date | 31/01/2012 |
|
||||
| Event.EventDate.Editor.Time | 12:00 AM |
|
||||
And I hit "Save"
|
||||
Then I should see "Date of the event is an invalid date and time"
|
||||
Then I should see "Date of the event could not be parsed as a valid date and time"
|
||||
|
||||
# Creating an Event content item
|
||||
When I go to "Admin/Contents/Create/Event"
|
||||
Then I should see "Date of the event"
|
||||
When I fill in
|
||||
| name | value |
|
||||
| Event.EventDate.Date | 01/31/2012 |
|
||||
| Event.EventDate.Editor.Date | 01/31/2012 |
|
||||
And I fill in
|
||||
| name | value |
|
||||
| Event.EventDate.Time | 12:00 AM |
|
||||
| Event.EventDate.Editor.Time | 12:00 AM |
|
||||
And I hit "Save"
|
||||
And I am redirected
|
||||
Then I should see "Your Event has been created."
|
||||
@@ -73,8 +73,8 @@ Scenario: Creating and using Date fields
|
||||
| Fields[0].DateTimeFieldSettings.Display | DateOnly |
|
||||
And I hit "Save"
|
||||
And I go to "Admin/Contents/Create/Event"
|
||||
Then I should see "Event.EventDate.Date"
|
||||
And I should not see "Event.EventDate.Time"
|
||||
Then I should see "Event.EventDate.Editor.Date"
|
||||
And I should not see "Event.EventDate.Editor.Time"
|
||||
|
||||
# Display = TimeOnly
|
||||
When I go to "Admin/ContentTypes/Edit/Event"
|
||||
@@ -83,8 +83,8 @@ Scenario: Creating and using Date fields
|
||||
| Fields[0].DateTimeFieldSettings.Display | TimeOnly |
|
||||
And I hit "Save"
|
||||
And I go to "Admin/Contents/Create/Event"
|
||||
Then I should see "Event.EventDate.Time"
|
||||
And I should not see "Event.EventDate.Date"
|
||||
Then I should see "Event.EventDate.Editor.Time"
|
||||
And I should not see "Event.EventDate.Editor.Date"
|
||||
|
||||
# Required & Date and Time
|
||||
When I go to "Admin/ContentTypes/Edit/Event"
|
||||
@@ -94,24 +94,24 @@ Scenario: Creating and using Date fields
|
||||
| Fields[0].DateTimeFieldSettings.Required | true |
|
||||
And I hit "Save"
|
||||
And I go to "Admin/Contents/Create/Event"
|
||||
Then I should see "Event.EventDate.Date"
|
||||
Then I should see "Event.EventDate.Editor.Date"
|
||||
When I fill in
|
||||
| name | value |
|
||||
| Event.EventDate.Date | 01/31/2012 |
|
||||
| Event.EventDate.Time | 12:00 AM |
|
||||
| Event.EventDate.Editor.Date | 01/31/2012 |
|
||||
| Event.EventDate.Editor.Time | 12:00 AM |
|
||||
And I hit "Save"
|
||||
And I am redirected
|
||||
Then I should see "Your Event has been created."
|
||||
When I go to "Admin/Contents/Create/Event"
|
||||
And I fill in
|
||||
| name | value |
|
||||
| Event.EventDate.Date | 01/31/2012 |
|
||||
| Event.EventDate.Editor.Date | 01/31/2012 |
|
||||
And I hit "Save"
|
||||
Then I should see "Date of the event is required."
|
||||
When I go to "Admin/Contents/Create/Event"
|
||||
And I fill in
|
||||
| name | value |
|
||||
| Event.EventDate.Time | 12:00 AM |
|
||||
| Event.EventDate.Editor.Time | 12:00 AM |
|
||||
And I hit "Save"
|
||||
Then I should see "Date of the event is required."
|
||||
|
||||
@@ -123,7 +123,7 @@ Scenario: Creating and using Date fields
|
||||
| Fields[0].DateTimeFieldSettings.Required | true |
|
||||
And I hit "Save"
|
||||
And I go to "Admin/Contents/Create/Event"
|
||||
Then I should see "Event.EventDate.Date"
|
||||
Then I should see "Event.EventDate.Editor.Date"
|
||||
When I hit "Save"
|
||||
Then I should see "Date of the event is required."
|
||||
|
||||
@@ -135,7 +135,7 @@ Scenario: Creating and using Date fields
|
||||
| Fields[0].DateTimeFieldSettings.Required | true |
|
||||
And I hit "Save"
|
||||
And I go to "Admin/Contents/Create/Event"
|
||||
Then I should see "Event.EventDate.Date"
|
||||
Then I should see "Event.EventDate.Editor.Date"
|
||||
When I hit "Save"
|
||||
Then I should see "Date of the event is required."
|
||||
|
||||
@@ -179,15 +179,15 @@ Scenario: Creating and using date time fields in another culture
|
||||
When I go to "Admin/Contents/Create/Event"
|
||||
And I fill in
|
||||
| name | value |
|
||||
| Event.EventDate.Date | 01/31/2012 |
|
||||
| Event.EventDate.Time | 12:00 AM |
|
||||
| Event.EventDate.Editor.Date | 01/31/2012 |
|
||||
| Event.EventDate.Editor.Time | 12:00 AM |
|
||||
And I hit "Save"
|
||||
Then I should see "Date of the event is an invalid date and time"
|
||||
Then I should see "Date of the event could not be parsed as a valid date and time"
|
||||
When I go to "Admin/Contents/Create/Event"
|
||||
And I fill in
|
||||
| name | value |
|
||||
| Event.EventDate.Date | 31/01/2012 |
|
||||
| Event.EventDate.Time | 18:00 |
|
||||
| Event.EventDate.Editor.Date | 31/01/2012 |
|
||||
| Event.EventDate.Editor.Time | 18:00 |
|
||||
And I hit "Save"
|
||||
And I am redirected
|
||||
Then I should see "Your Event has been created."
|
||||
|
||||
44
src/Orchard.Specs/DateTime.feature.cs
generated
44
src/Orchard.Specs/DateTime.feature.cs
generated
@@ -3,7 +3,7 @@
|
||||
// This code was generated by SpecFlow (http://www.specflow.org/).
|
||||
// SpecFlow Version:1.9.0.77
|
||||
// SpecFlow Generator Version:1.9.0.0
|
||||
// Runtime Version:4.0.30319.33440
|
||||
// Runtime Version:4.0.30319.34014
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
@@ -134,17 +134,17 @@ this.ScenarioSetup(scenarioInfo);
|
||||
"name",
|
||||
"value"});
|
||||
table3.AddRow(new string[] {
|
||||
"Event.EventDate.Date",
|
||||
"Event.EventDate.Editor.Date",
|
||||
"31/01/2012"});
|
||||
table3.AddRow(new string[] {
|
||||
"Event.EventDate.Time",
|
||||
"Event.EventDate.Editor.Time",
|
||||
"12:00 AM"});
|
||||
#line 37
|
||||
testRunner.When("I fill in", ((string)(null)), table3, "When ");
|
||||
#line 41
|
||||
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 42
|
||||
testRunner.Then("I should see \"Date of the event is an invalid date and time\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
testRunner.Then("I should see \"Date of the event could not be parsed as a valid date and time\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
#line 45
|
||||
testRunner.When("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
|
||||
#line 46
|
||||
@@ -154,7 +154,7 @@ this.ScenarioSetup(scenarioInfo);
|
||||
"name",
|
||||
"value"});
|
||||
table4.AddRow(new string[] {
|
||||
"Event.EventDate.Date",
|
||||
"Event.EventDate.Editor.Date",
|
||||
"01/31/2012"});
|
||||
#line 47
|
||||
testRunner.When("I fill in", ((string)(null)), table4, "When ");
|
||||
@@ -163,7 +163,7 @@ this.ScenarioSetup(scenarioInfo);
|
||||
"name",
|
||||
"value"});
|
||||
table5.AddRow(new string[] {
|
||||
"Event.EventDate.Time",
|
||||
"Event.EventDate.Editor.Time",
|
||||
"12:00 AM"});
|
||||
#line 50
|
||||
testRunner.And("I fill in", ((string)(null)), table5, "And ");
|
||||
@@ -212,9 +212,9 @@ this.ScenarioSetup(scenarioInfo);
|
||||
#line 75
|
||||
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 76
|
||||
testRunner.Then("I should see \"Event.EventDate.Date\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
testRunner.Then("I should see \"Event.EventDate.Editor.Date\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
#line 77
|
||||
testRunner.And("I should not see \"Event.EventDate.Time\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
testRunner.And("I should not see \"Event.EventDate.Editor.Time\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 80
|
||||
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
|
||||
#line hidden
|
||||
@@ -231,9 +231,9 @@ this.ScenarioSetup(scenarioInfo);
|
||||
#line 85
|
||||
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 86
|
||||
testRunner.Then("I should see \"Event.EventDate.Time\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
testRunner.Then("I should see \"Event.EventDate.Editor.Time\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
#line 87
|
||||
testRunner.And("I should not see \"Event.EventDate.Date\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
testRunner.And("I should not see \"Event.EventDate.Editor.Date\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 90
|
||||
testRunner.When("I go to \"Admin/ContentTypes/Edit/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
|
||||
#line hidden
|
||||
@@ -253,16 +253,16 @@ this.ScenarioSetup(scenarioInfo);
|
||||
#line 96
|
||||
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 97
|
||||
testRunner.Then("I should see \"Event.EventDate.Date\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
testRunner.Then("I should see \"Event.EventDate.Editor.Date\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table10 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
"name",
|
||||
"value"});
|
||||
table10.AddRow(new string[] {
|
||||
"Event.EventDate.Date",
|
||||
"Event.EventDate.Editor.Date",
|
||||
"01/31/2012"});
|
||||
table10.AddRow(new string[] {
|
||||
"Event.EventDate.Time",
|
||||
"Event.EventDate.Editor.Time",
|
||||
"12:00 AM"});
|
||||
#line 98
|
||||
testRunner.When("I fill in", ((string)(null)), table10, "When ");
|
||||
@@ -279,7 +279,7 @@ this.ScenarioSetup(scenarioInfo);
|
||||
"name",
|
||||
"value"});
|
||||
table11.AddRow(new string[] {
|
||||
"Event.EventDate.Date",
|
||||
"Event.EventDate.Editor.Date",
|
||||
"01/31/2012"});
|
||||
#line 106
|
||||
testRunner.And("I fill in", ((string)(null)), table11, "And ");
|
||||
@@ -294,7 +294,7 @@ this.ScenarioSetup(scenarioInfo);
|
||||
"name",
|
||||
"value"});
|
||||
table12.AddRow(new string[] {
|
||||
"Event.EventDate.Time",
|
||||
"Event.EventDate.Editor.Time",
|
||||
"12:00 AM"});
|
||||
#line 112
|
||||
testRunner.And("I fill in", ((string)(null)), table12, "And ");
|
||||
@@ -321,7 +321,7 @@ this.ScenarioSetup(scenarioInfo);
|
||||
#line 125
|
||||
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 126
|
||||
testRunner.Then("I should see \"Event.EventDate.Date\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
testRunner.Then("I should see \"Event.EventDate.Editor.Date\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
#line 127
|
||||
testRunner.When("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
|
||||
#line 128
|
||||
@@ -345,7 +345,7 @@ this.ScenarioSetup(scenarioInfo);
|
||||
#line 137
|
||||
testRunner.And("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 138
|
||||
testRunner.Then("I should see \"Event.EventDate.Date\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
testRunner.Then("I should see \"Event.EventDate.Editor.Date\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
#line 139
|
||||
testRunner.When("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
|
||||
#line 140
|
||||
@@ -442,17 +442,17 @@ this.ScenarioSetup(scenarioInfo);
|
||||
"name",
|
||||
"value"});
|
||||
table18.AddRow(new string[] {
|
||||
"Event.EventDate.Date",
|
||||
"Event.EventDate.Editor.Date",
|
||||
"01/31/2012"});
|
||||
table18.AddRow(new string[] {
|
||||
"Event.EventDate.Time",
|
||||
"Event.EventDate.Editor.Time",
|
||||
"12:00 AM"});
|
||||
#line 180
|
||||
testRunner.And("I fill in", ((string)(null)), table18, "And ");
|
||||
#line 184
|
||||
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 185
|
||||
testRunner.Then("I should see \"Date of the event is an invalid date and time\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
testRunner.Then("I should see \"Date of the event could not be parsed as a valid date and time\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
#line 186
|
||||
testRunner.When("I go to \"Admin/Contents/Create/Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
|
||||
#line hidden
|
||||
@@ -460,10 +460,10 @@ this.ScenarioSetup(scenarioInfo);
|
||||
"name",
|
||||
"value"});
|
||||
table19.AddRow(new string[] {
|
||||
"Event.EventDate.Date",
|
||||
"Event.EventDate.Editor.Date",
|
||||
"31/01/2012"});
|
||||
table19.AddRow(new string[] {
|
||||
"Event.EventDate.Time",
|
||||
"Event.EventDate.Editor.Time",
|
||||
"18:00"});
|
||||
#line 187
|
||||
testRunner.And("I fill in", ((string)(null)), table19, "And ");
|
||||
|
||||
@@ -181,7 +181,7 @@ namespace Orchard.Specs.Hosting {
|
||||
}
|
||||
|
||||
public override void SendUnknownResponseHeader(string name, string value) {
|
||||
_details.ResponseHeaders.Add(name, value);
|
||||
_details.ResponseHeaders[name] = value;
|
||||
|
||||
base.SendUnknownResponseHeader(name, value);
|
||||
}
|
||||
|
||||
@@ -6,34 +6,30 @@
|
||||
Scenario: I can create a new list
|
||||
Given I have installed Orchard
|
||||
And I have installed "Orchard.Lists"
|
||||
When I go to "Admin/Contents/Create/List"
|
||||
When I go to "Admin/ContentTypes"
|
||||
And I go to "Admin/ContentTypes/Create"
|
||||
And I fill in
|
||||
| name | value |
|
||||
| Title.Title | MyList |
|
||||
And I hit "Save"
|
||||
And I go to "Admin/Contents/List/List"
|
||||
Then I should see "MyList"
|
||||
| name | value |
|
||||
| DisplayName | Event |
|
||||
| Name | Event |
|
||||
And I hit "Create"
|
||||
And I am redirected
|
||||
And I fill in
|
||||
| name | value |
|
||||
| PartSelections[5].IsSelected | True |
|
||||
And I hit "Save"
|
||||
And I go to "Admin/ContentTypes/"
|
||||
Then I should see "Event"
|
||||
|
||||
Scenario: I can add content items to a list
|
||||
Given I have installed Orchard
|
||||
And I have installed "Orchard.Lists"
|
||||
And I have a containable content type "MyType"
|
||||
When I go to "Admin/Contents/Create/List"
|
||||
And I fill in
|
||||
| name | value |
|
||||
| Title.Title | MyList |
|
||||
| name | value |
|
||||
| Title.Title | MyList |
|
||||
| Container.SelectedItemContentTypes | Event |
|
||||
And I hit "Save"
|
||||
And I go to "Admin/Contents/List/List"
|
||||
And I am redirected
|
||||
Then I should see "Your List has been created"
|
||||
When I go to "Admin/Lists"
|
||||
Then I should see "MyList"
|
||||
When I follow "Contained Items"
|
||||
Then I should see "The 'MyList' List has no content items."
|
||||
When I follow "Create New Content" where href has "ReturnUrl"
|
||||
Then I should see "MyType"
|
||||
When I follow "MyType" where href has "ReturnUrl"
|
||||
And I fill in
|
||||
| name | value |
|
||||
| Title.Title | MyContentItem |
|
||||
And I hit "Save"
|
||||
And I am redirected
|
||||
Then I should see "Manage MyList"
|
||||
And I should see "MyContentItem"
|
||||
When I follow "Contained Items (0)"
|
||||
Then I should see "'MyList' has no content items"
|
||||
|
||||
99
src/Orchard.Specs/Lists.feature.cs
generated
99
src/Orchard.Specs/Lists.feature.cs
generated
@@ -3,7 +3,7 @@
|
||||
// This code was generated by SpecFlow (http://www.specflow.org/).
|
||||
// SpecFlow Version:1.9.0.77
|
||||
// SpecFlow Generator Version:1.9.0.0
|
||||
// Runtime Version:4.0.30319.33440
|
||||
// Runtime Version:4.0.30319.34014
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
@@ -77,83 +77,68 @@ this.ScenarioSetup(scenarioInfo);
|
||||
#line 8
|
||||
testRunner.And("I have installed \"Orchard.Lists\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 9
|
||||
testRunner.When("I go to \"Admin/Contents/Create/List\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
|
||||
testRunner.When("I go to \"Admin/ContentTypes\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
|
||||
#line 10
|
||||
testRunner.And("I go to \"Admin/ContentTypes/Create\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table1 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
"name",
|
||||
"value"});
|
||||
table1.AddRow(new string[] {
|
||||
"Title.Title",
|
||||
"MyList"});
|
||||
#line 10
|
||||
"DisplayName",
|
||||
"Event"});
|
||||
table1.AddRow(new string[] {
|
||||
"Name",
|
||||
"Event"});
|
||||
#line 11
|
||||
testRunner.And("I fill in", ((string)(null)), table1, "And ");
|
||||
#line 13
|
||||
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 14
|
||||
testRunner.And("I go to \"Admin/Contents/List/List\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 15
|
||||
testRunner.Then("I should see \"MyList\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
#line hidden
|
||||
this.ScenarioCleanup();
|
||||
}
|
||||
|
||||
[NUnit.Framework.TestAttribute()]
|
||||
[NUnit.Framework.DescriptionAttribute("I can add content items to a list")]
|
||||
public virtual void ICanAddContentItemsToAList()
|
||||
{
|
||||
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("I can add content items to a list", ((string[])(null)));
|
||||
#line 17
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 18
|
||||
testRunner.Given("I have installed Orchard", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
|
||||
#line 19
|
||||
testRunner.And("I have installed \"Orchard.Lists\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 20
|
||||
testRunner.And("I have a containable content type \"MyType\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 21
|
||||
testRunner.When("I go to \"Admin/Contents/Create/List\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
|
||||
testRunner.And("I hit \"Create\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 16
|
||||
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table2 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
"name",
|
||||
"value"});
|
||||
table2.AddRow(new string[] {
|
||||
"Title.Title",
|
||||
"MyList"});
|
||||
#line 22
|
||||
"PartSelections[5].IsSelected",
|
||||
"True"});
|
||||
#line 17
|
||||
testRunner.And("I fill in", ((string)(null)), table2, "And ");
|
||||
#line 25
|
||||
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 26
|
||||
testRunner.And("I go to \"Admin/Contents/List/List\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 27
|
||||
testRunner.Then("I should see \"MyList\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
#line 28
|
||||
testRunner.When("I follow \"Contained Items\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
|
||||
#line 29
|
||||
testRunner.Then("I should see \"The \'MyList\' List has no content items.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
#line 30
|
||||
testRunner.When("I follow \"Create New Content\" where href has \"ReturnUrl\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
|
||||
#line 31
|
||||
testRunner.Then("I should see \"MyType\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
#line 32
|
||||
testRunner.When("I follow \"MyType\" where href has \"ReturnUrl\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
|
||||
#line 20
|
||||
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 21
|
||||
testRunner.And("I go to \"Admin/ContentTypes/\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 22
|
||||
testRunner.Then("I should see \"Event\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
#line 24
|
||||
testRunner.When("I go to \"Admin/Contents/Create/List\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table3 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
"name",
|
||||
"value"});
|
||||
table3.AddRow(new string[] {
|
||||
"Title.Title",
|
||||
"MyContentItem"});
|
||||
#line 33
|
||||
"MyList"});
|
||||
table3.AddRow(new string[] {
|
||||
"Container.SelectedItemContentTypes",
|
||||
"Event"});
|
||||
#line 25
|
||||
testRunner.And("I fill in", ((string)(null)), table3, "And ");
|
||||
#line 36
|
||||
#line 29
|
||||
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 37
|
||||
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 38
|
||||
testRunner.Then("I should see \"Manage MyList\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
#line 39
|
||||
testRunner.And("I should see \"MyContentItem\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 30
|
||||
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 31
|
||||
testRunner.Then("I should see \"Your List has been created\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
#line 32
|
||||
testRunner.When("I go to \"Admin/Lists\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
|
||||
#line 33
|
||||
testRunner.Then("I should see \"MyList\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
#line 34
|
||||
testRunner.When("I follow \"Contained Items (0)\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
|
||||
#line 35
|
||||
testRunner.Then("I should see \"\'MyList\' has no content items\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
#line hidden
|
||||
this.ScenarioCleanup();
|
||||
}
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
Scenario: I can edit a default layer
|
||||
Given I have installed Orchard
|
||||
When I go to "Admin/Widgets"
|
||||
And I follow "Edit"
|
||||
Then I should see "<h1[^>]*>Widgets[^>]*>"
|
||||
When I follow "Edit"
|
||||
Then I should see "<input[^>]*name="LayerPart.Name"[^>]*value="Default"[^>]*>"
|
||||
When I fill in
|
||||
| name | value |
|
||||
|
||||
90
src/Orchard.Specs/Widgets.feature.cs
generated
90
src/Orchard.Specs/Widgets.feature.cs
generated
@@ -3,7 +3,7 @@
|
||||
// This code was generated by SpecFlow (http://www.specflow.org/).
|
||||
// SpecFlow Version:1.9.0.77
|
||||
// SpecFlow Generator Version:1.9.0.0
|
||||
// Runtime Version:4.0.30319.33440
|
||||
// Runtime Version:4.0.30319.34014
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
@@ -77,8 +77,10 @@ this.ScenarioSetup(scenarioInfo);
|
||||
#line 8
|
||||
testRunner.When("I go to \"Admin/Widgets\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
|
||||
#line 9
|
||||
testRunner.And("I follow \"Edit\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
testRunner.Then("I should see \"<h1[^>]*>Widgets[^>]*>\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
#line 10
|
||||
testRunner.When("I follow \"Edit\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
|
||||
#line 11
|
||||
testRunner.Then("I should see \"<input[^>]*name=\"LayerPart.Name\"[^>]*value=\"Default\"[^>]*>\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table1 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
@@ -87,17 +89,17 @@ this.ScenarioSetup(scenarioInfo);
|
||||
table1.AddRow(new string[] {
|
||||
"LayerPart.Description",
|
||||
"This is the default layer."});
|
||||
#line 11
|
||||
#line 12
|
||||
testRunner.When("I fill in", ((string)(null)), table1, "When ");
|
||||
#line 14
|
||||
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 15
|
||||
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 16
|
||||
testRunner.Then("I should see \"Your Layer has been saved\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 17
|
||||
testRunner.When("I follow \"Edit\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
|
||||
testRunner.Then("I should see \"Your Layer has been saved\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
#line 18
|
||||
testRunner.When("I follow \"Edit\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
|
||||
#line 19
|
||||
testRunner.Then("I should see \"<textarea[^>]*>\\s*This is the default layer.\\s*</textarea>\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
#line hidden
|
||||
this.ScenarioCleanup();
|
||||
@@ -110,15 +112,15 @@ this.ScenarioSetup(scenarioInfo);
|
||||
{
|
||||
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("I can add a new layer and that layer is active when I\'m redirected to the widget " +
|
||||
"management page", ((string[])(null)));
|
||||
#line 20
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 21
|
||||
testRunner.Given("I have installed Orchard", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 22
|
||||
testRunner.When("I go to \"Admin/Widgets\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
|
||||
testRunner.Given("I have installed Orchard", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
|
||||
#line 23
|
||||
testRunner.And("I follow \"Add a new layer...\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
testRunner.When("I go to \"Admin/Widgets\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
|
||||
#line 24
|
||||
testRunner.And("I follow \"Add a new layer...\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 25
|
||||
testRunner.Then("I should see \"<h1[^>]*>Add Layer</h1>\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table2 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
@@ -130,15 +132,15 @@ this.ScenarioSetup(scenarioInfo);
|
||||
table2.AddRow(new string[] {
|
||||
"LayerPart.LayerRule",
|
||||
"url \"~/awesome*\""});
|
||||
#line 25
|
||||
#line 26
|
||||
testRunner.When("I fill in", ((string)(null)), table2, "When ");
|
||||
#line 29
|
||||
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 30
|
||||
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 31
|
||||
testRunner.Then("I should see \"Your Layer has been created.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 32
|
||||
testRunner.Then("I should see \"Your Layer has been created.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
#line 33
|
||||
testRunner.And("I should see \"<option[^>]+selected=\"selected\"[^>]+value=\"\\d+\">For awesome stuff</" +
|
||||
"option>\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line hidden
|
||||
@@ -150,25 +152,25 @@ this.ScenarioSetup(scenarioInfo);
|
||||
public virtual void ICanDeleteALayer()
|
||||
{
|
||||
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("I can delete a layer", ((string[])(null)));
|
||||
#line 34
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 35
|
||||
testRunner.Given("I have installed Orchard", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 36
|
||||
testRunner.When("I go to \"Admin/Widgets\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
|
||||
testRunner.Given("I have installed Orchard", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
|
||||
#line 37
|
||||
testRunner.Then("I should see \"<option[^>]*>Default</option>\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
testRunner.When("I go to \"Admin/Widgets\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
|
||||
#line 38
|
||||
testRunner.When("I follow \"Edit\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
|
||||
testRunner.Then("I should see \"<option[^>]*>Default</option>\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
#line 39
|
||||
testRunner.Then("I should see \"<input[^>]*name=\"LayerPart.Name\"[^>]*value=\"Default\"[^>]*>\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
testRunner.When("I follow \"Edit\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
|
||||
#line 40
|
||||
testRunner.When("I hit \"Delete\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
|
||||
testRunner.Then("I should see \"<input[^>]*name=\"LayerPart.Name\"[^>]*value=\"Default\"[^>]*>\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
#line 41
|
||||
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
testRunner.When("I hit \"Delete\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
|
||||
#line 42
|
||||
testRunner.Then("I should see \"Layer was successfully deleted\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 43
|
||||
testRunner.Then("I should see \"Layer was successfully deleted\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
#line 44
|
||||
testRunner.And("I should not see \"<option[^>]*>Default</option>\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line hidden
|
||||
this.ScenarioCleanup();
|
||||
@@ -179,11 +181,11 @@ this.ScenarioSetup(scenarioInfo);
|
||||
public virtual void ICanAddAWidgetToASpecificZoneInASpecificLayer()
|
||||
{
|
||||
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("I can add a widget to a specific zone in a specific layer", ((string[])(null)));
|
||||
#line 45
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 46
|
||||
testRunner.Given("I have installed Orchard", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
|
||||
this.ScenarioSetup(scenarioInfo);
|
||||
#line 47
|
||||
testRunner.Given("I have installed Orchard", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Given ");
|
||||
#line 48
|
||||
testRunner.When("I go to \"Admin/Widgets\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table3 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
@@ -192,19 +194,19 @@ this.ScenarioSetup(scenarioInfo);
|
||||
table3.AddRow(new string[] {
|
||||
"layerId",
|
||||
"Disabled"});
|
||||
#line 48
|
||||
#line 49
|
||||
testRunner.And("I fill in", ((string)(null)), table3, "And ");
|
||||
#line 51
|
||||
testRunner.And("I hit \"Show\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 52
|
||||
testRunner.Then("I should see \"<option[^>]*selected[^>]*>Disabled\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
testRunner.And("I hit \"Show\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 53
|
||||
testRunner.When("I follow \"Add\" where href has \"zone=Header\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
|
||||
testRunner.Then("I should see \"<option[^>]*selected[^>]*>Disabled\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
#line 54
|
||||
testRunner.Then("I should see \"<h1[^>]*>Choose A Widget</h1>\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
testRunner.When("I follow \"Add\" where href has \"zone=Header\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
|
||||
#line 55
|
||||
testRunner.When("I follow \"<h2>Html Widget</h2>\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
|
||||
testRunner.Then("I should see \"<h1[^>]*>Choose A Widget</h1>\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
#line 56
|
||||
testRunner.When("I follow \"<h2>Html Widget</h2>\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "When ");
|
||||
#line 57
|
||||
testRunner.Then("I should see \"<h1[^>]*>Add Widget</h1>\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table4 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
@@ -216,17 +218,17 @@ this.ScenarioSetup(scenarioInfo);
|
||||
table4.AddRow(new string[] {
|
||||
"Body.Text",
|
||||
"<p><blink>hi</blink></p>"});
|
||||
#line 57
|
||||
#line 58
|
||||
testRunner.When("I fill in", ((string)(null)), table4, "When ");
|
||||
#line 61
|
||||
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 62
|
||||
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
testRunner.And("I hit \"Save\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 63
|
||||
testRunner.Then("I should see \"Your Html Widget has been added.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
testRunner.And("I am redirected", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 64
|
||||
testRunner.And("I should see \"<option[^>]*selected[^>]*>Disabled\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
testRunner.Then("I should see \"Your Html Widget has been added.\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "Then ");
|
||||
#line 65
|
||||
testRunner.And("I should see \"<option[^>]*selected[^>]*>Disabled\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line 66
|
||||
testRunner.And("I should see \"<li[^>]*class=\"[^\"]*widgets-this-layer[^\"]*\"[^>]*>\\s*<form[^>]*>\\s*" +
|
||||
"<h3[^>]*>\\s*<a[^>]*>Flashy HTML Widget</a>\\s*</h3>\"", ((string)(null)), ((TechTalk.SpecFlow.Table)(null)), "And ");
|
||||
#line hidden
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="FluentNHibernate, Version=1.3.0.733, Culture=neutral, PublicKeyToken=8aa435e3cb308880, processorArchitecture=MSIL">
|
||||
<Reference Include="FluentNHibernate">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\nhibernate\FluentNHibernate.dll</HintPath>
|
||||
</Reference>
|
||||
@@ -56,17 +56,17 @@
|
||||
<HintPath>..\..\..\..\lib\htmlagilitypack\HtmlAgilityPack.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="Microsoft.Data.Edm, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Reference Include="Microsoft.Data.Edm">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\windowsazure\Microsoft.Data.Edm.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Data.OData, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Reference Include="Microsoft.Data.OData">
|
||||
<HintPath>..\..\..\..\lib\windowsazure\Microsoft.Data.OData.dll</HintPath>
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Data.Services.Client, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Reference Include="Microsoft.Data.Services.Client">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\windowsazure\Microsoft.Data.Services.Client.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
@@ -74,27 +74,27 @@
|
||||
<Reference Include="Microsoft.Practices.TransientFaultHandling.Core">
|
||||
<HintPath>..\..\..\..\lib\windowsazure\Microsoft.Practices.TransientFaultHandling.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.WindowsAzure.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Reference Include="Microsoft.WindowsAzure.Configuration">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\windowsazure\Microsoft.WindowsAzure.Configuration.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.WindowsAzure.Diagnostics, Version=2.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Reference Include="Microsoft.WindowsAzure.Diagnostics">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\windowsazure\Microsoft.WindowsAzure.Diagnostics.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.WindowsAzure.MediaServices.Client">
|
||||
<HintPath>..\..\..\..\lib\windowsazure\Microsoft.WindowsAzure.MediaServices.Client.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.WindowsAzure.Storage, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Reference Include="Microsoft.WindowsAzure.Storage">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\windowsazure\Microsoft.WindowsAzure.Storage.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Newtonsoft.Json, Version=4.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\newtonsoft.json\Newtonsoft.Json.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="NHibernate, Version=3.3.1.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
|
||||
<Reference Include="NHibernate">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\nhibernate\NHibernate.dll</HintPath>
|
||||
</Reference>
|
||||
@@ -104,7 +104,7 @@
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Spatial, Version=5.6.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Reference Include="System.Spatial">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\windowsazure\System.Spatial.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
@@ -113,30 +113,30 @@
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
<Reference Include="System.Web.Entity" />
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
<Reference Include="System.Web.Helpers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Reference Include="System.Web.Helpers">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.Helpers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Reference Include="System.Web.Mvc">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Abstractions" />
|
||||
<Reference Include="System.Web.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Reference Include="System.Web.Razor">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.Razor.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Routing" />
|
||||
<Reference Include="System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Reference Include="System.Web.WebPages">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.WebPages.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.WebPages.Deployment, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Reference Include="System.Web.WebPages.Deployment">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.WebPages.Deployment.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Reference Include="System.Web.WebPages.Razor">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.WebPages.Razor.dll</HintPath>
|
||||
</Reference>
|
||||
|
||||
@@ -21,6 +21,8 @@ using Orchard.Themes;
|
||||
using Orchard.UI.Admin;
|
||||
using Orchard.Utility.Extensions;
|
||||
using System.Collections.Specialized;
|
||||
using Orchard.OutputCache.ViewModels;
|
||||
using Orchard.UI.Admin.Notification;
|
||||
|
||||
namespace Orchard.OutputCache.Filters {
|
||||
public class OutputCacheFilter : FilterProvider, IActionFilter, IResultFilter {
|
||||
@@ -36,7 +38,10 @@ namespace Orchard.OutputCache.Filters {
|
||||
private readonly ISignals _signals;
|
||||
private readonly ShellSettings _shellSettings;
|
||||
private readonly ICacheControlStrategy _cacheControlStrategy;
|
||||
private Stream _previousFilter;
|
||||
private readonly INotificationManager _notificationManager;
|
||||
|
||||
TextWriter _originalWriter;
|
||||
StringWriter _cachingWriter;
|
||||
|
||||
private static string RefreshKey = "__r";
|
||||
private static long Epoch = new DateTime(2014, DateTimeKind.Utc).Ticks;
|
||||
@@ -52,7 +57,8 @@ namespace Orchard.OutputCache.Filters {
|
||||
ICacheService cacheService,
|
||||
ISignals signals,
|
||||
ShellSettings shellSettings,
|
||||
ICacheControlStrategy cacheControlStrategy
|
||||
ICacheControlStrategy cacheControlStrategy,
|
||||
INotificationManager notificationManager
|
||||
) {
|
||||
_cacheManager = cacheManager;
|
||||
_cacheStorageProvider = cacheStorageProvider;
|
||||
@@ -65,6 +71,7 @@ namespace Orchard.OutputCache.Filters {
|
||||
_signals = signals;
|
||||
_shellSettings = shellSettings;
|
||||
_cacheControlStrategy = cacheControlStrategy;
|
||||
_notificationManager = notificationManager;
|
||||
|
||||
Logger = NullLogger.Instance;
|
||||
}
|
||||
@@ -83,8 +90,8 @@ namespace Orchard.OutputCache.Filters {
|
||||
private bool _transformRedirect;
|
||||
|
||||
private WorkContext _workContext;
|
||||
private CapturingResponseFilter _filter;
|
||||
private CacheItem _cacheItem;
|
||||
private Func<ControllerContext, string> _completeResponse;
|
||||
|
||||
public ILogger Logger { get; set; }
|
||||
|
||||
@@ -95,6 +102,8 @@ namespace Orchard.OutputCache.Filters {
|
||||
var controllerAttributes = filterContext.ActionDescriptor.ControllerDescriptor.GetCustomAttributes(typeof(OutputCacheAttribute), true);
|
||||
var outputCacheAttribute = actionAttributes.Concat(controllerAttributes).Cast<OutputCacheAttribute>().FirstOrDefault();
|
||||
|
||||
_workContext = _workContextAccessor.GetContext();
|
||||
|
||||
if (outputCacheAttribute != null) {
|
||||
if (outputCacheAttribute.Duration <= 0 || outputCacheAttribute.NoStore) {
|
||||
Logger.Debug("Request ignored based on OutputCache attribute");
|
||||
@@ -128,8 +137,6 @@ namespace Orchard.OutputCache.Filters {
|
||||
return;
|
||||
}
|
||||
|
||||
_workContext = _workContextAccessor.GetContext();
|
||||
|
||||
// don't return any cached content, or cache any content, if the user is authenticated
|
||||
if (_workContext.CurrentUser != null) {
|
||||
Logger.Debug("Request ignored on Authenticated user");
|
||||
@@ -285,140 +292,66 @@ namespace Orchard.OutputCache.Filters {
|
||||
ApplyCacheControl(_cacheItem, response);
|
||||
|
||||
// no cache content available, intercept the execution results for caching
|
||||
_previousFilter = response.Filter;
|
||||
response.Filter = _filter = new CapturingResponseFilter();
|
||||
_cachingWriter = new StringWriter(CultureInfo.InvariantCulture);
|
||||
_originalWriter = filterContext.HttpContext.Response.Output;
|
||||
filterContext.HttpContext.Response.Output = _cachingWriter;
|
||||
|
||||
_completeResponse = CaptureResponse;
|
||||
}
|
||||
|
||||
public void OnActionExecuted(ActionExecutedContext filterContext) {
|
||||
// this means the cache module is not applied in this context
|
||||
if (_workContext == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// handle redirections
|
||||
_transformRedirect = TransformRedirect(filterContext);
|
||||
}
|
||||
|
||||
public void OnResultExecuted(ResultExecutedContext filterContext) {
|
||||
|
||||
// this means the cache module is not applied in this context
|
||||
if (_workContext == null) {
|
||||
return;
|
||||
string capturedResponse = null;
|
||||
if (_completeResponse != null) {
|
||||
capturedResponse = _completeResponse(filterContext);
|
||||
}
|
||||
|
||||
var response = filterContext.HttpContext.Response;
|
||||
|
||||
if (!_cacheControlStrategy.IsCacheable(filterContext.Result, response)) {
|
||||
_filter = null;
|
||||
if (_previousFilter != null) {
|
||||
response.Filter = _previousFilter;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// ignore error results from cache
|
||||
if (response.StatusCode != (int)HttpStatusCode.OK) {
|
||||
if (response.StatusCode != (int)HttpStatusCode.OK ||
|
||||
_transformRedirect) {
|
||||
|
||||
// Never cache non-200 responses.
|
||||
filterContext.HttpContext.Response.Cache.SetCacheability(HttpCacheability.NoCache);
|
||||
filterContext.HttpContext.Response.Cache.SetNoStore();
|
||||
filterContext.HttpContext.Response.Cache.SetMaxAge(new TimeSpan(0));
|
||||
|
||||
_filter = null;
|
||||
if (_previousFilter != null) {
|
||||
response.Filter = _previousFilter;
|
||||
}
|
||||
|
||||
// if the result of a POST is a Redirect, remove any Cache Item for this url
|
||||
// so that the redirected client gets a fresh result
|
||||
// i.e., Comment creation
|
||||
if (filterContext.HttpContext.Request.HttpMethod.Equals("POST", StringComparison.OrdinalIgnoreCase) &&
|
||||
!String.IsNullOrWhiteSpace(filterContext.HttpContext.Response.RedirectLocation)) {
|
||||
|
||||
var url = filterContext.HttpContext.Response.RedirectLocation;
|
||||
if (!VirtualPathUtility.IsAbsolute(url)) {
|
||||
var applicationRoot = new UrlHelper(filterContext.HttpContext.Request.RequestContext).MakeAbsolute("/");
|
||||
if (url.StartsWith(applicationRoot, StringComparison.OrdinalIgnoreCase)) {
|
||||
url = url.Substring(applicationRoot.Length);
|
||||
}
|
||||
}
|
||||
|
||||
var redirectionInvariantCacheKey = ComputeCacheKey(_shellSettings.Name, url, () => _workContext.CurrentCulture, _themeManager.GetRequestTheme(filterContext.RequestContext).Id, null);
|
||||
|
||||
_cacheService.RemoveByTag(redirectionInvariantCacheKey);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// ignore in admin
|
||||
if (AdminFilter.IsApplied(new RequestContext(filterContext.HttpContext, new RouteData()))) {
|
||||
_filter = null;
|
||||
if (_previousFilter != null) {
|
||||
response.Filter = _previousFilter;
|
||||
}
|
||||
if (capturedResponse == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
_workContext = _workContextAccessor.GetContext();
|
||||
|
||||
// ignore authenticated requests
|
||||
if (_workContext.CurrentUser != null) {
|
||||
_filter = null;
|
||||
if (_previousFilter != null) {
|
||||
response.Filter = _previousFilter;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// save the result only if the content can be intercepted
|
||||
if (_filter == null) return;
|
||||
|
||||
// flush here to force the Filter to get the rendered content
|
||||
if (response.IsClientConnected)
|
||||
response.Flush();
|
||||
|
||||
var output = _filter.GetContents(response.ContentEncoding);
|
||||
|
||||
if (String.IsNullOrWhiteSpace(output)) {
|
||||
return;
|
||||
}
|
||||
|
||||
response.Filter = null;
|
||||
response.Write(output);
|
||||
|
||||
// check if there is a specific rule not to cache the whole route
|
||||
RouteConfiguration configuration = null;
|
||||
var configurations = _cacheService.GetRouteConfigurations();
|
||||
var route = filterContext.Controller.ControllerContext.RouteData.Route;
|
||||
var key = _cacheService.GetRouteDescriptorKey(filterContext.HttpContext, route);
|
||||
var configuration = configurations.FirstOrDefault(c => c.RouteKey == key);
|
||||
|
||||
if (configurations.Any()) {
|
||||
var route = filterContext.Controller.ControllerContext.RouteData.Route;
|
||||
var key = _cacheService.GetRouteDescriptorKey(filterContext.HttpContext, route);
|
||||
configuration = configurations.FirstOrDefault(c => c.RouteKey == key);
|
||||
}
|
||||
|
||||
// do not cache ?
|
||||
if (configuration != null && configuration.Duration == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// don't cache the result of a POST redirection as it could contain notifications
|
||||
if (_transformRedirect) {
|
||||
return;
|
||||
}
|
||||
|
||||
// don't cache the result if there were some notifications
|
||||
var messagesZone = _workContextAccessor.GetContext(filterContext).Layout.Zones["Messages"];
|
||||
var hasNotifications = messagesZone != null && ((IEnumerable<dynamic>)messagesZone).Any();
|
||||
if (hasNotifications) {
|
||||
if (_notificationManager.GetNotifications().Any()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// default duration of specific one ?
|
||||
var cacheDuration = configuration != null && configuration.Duration.HasValue ? configuration.Duration.Value : _cacheDuration;
|
||||
|
||||
if (cacheDuration <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// include each of the content item ids as tags for the cache entry
|
||||
var contentItemIds = _displayedContentItemHandler.GetDisplayed().Select(x => x.ToString(CultureInfo.InvariantCulture)).ToArray();
|
||||
|
||||
@@ -431,7 +364,7 @@ namespace Orchard.OutputCache.Filters {
|
||||
_cacheItem.CachedOnUtc = _now;
|
||||
_cacheItem.ValidFor = cacheDuration;
|
||||
_cacheItem.QueryString = filterContext.HttpContext.Request.Url.Query;
|
||||
_cacheItem.Output = output;
|
||||
_cacheItem.Output = capturedResponse;
|
||||
_cacheItem.CacheKey = _cacheKey;
|
||||
_cacheItem.InvariantCacheKey = _invariantCacheKey;
|
||||
_cacheItem.Tenant = _shellSettings.Name;
|
||||
@@ -450,7 +383,14 @@ namespace Orchard.OutputCache.Filters {
|
||||
foreach (var tag in _cacheItem.Tags) {
|
||||
_tagCache.Tag(tag, _cacheKey);
|
||||
}
|
||||
}
|
||||
|
||||
private string CaptureResponse(ControllerContext filterContext) {
|
||||
filterContext.HttpContext.Response.Output = _originalWriter;
|
||||
|
||||
string capturedText = _cachingWriter.ToString();
|
||||
filterContext.HttpContext.Response.Write(capturedText);
|
||||
return capturedText;
|
||||
}
|
||||
|
||||
private bool TransformRedirect(ActionExecutedContext filterContext) {
|
||||
@@ -461,6 +401,10 @@ namespace Orchard.OutputCache.Filters {
|
||||
throw new ArgumentNullException();
|
||||
}
|
||||
|
||||
if (AdminFilter.IsApplied(new RequestContext(filterContext.HttpContext, new RouteData()))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var redirectResult = filterContext.Result as RedirectResult;
|
||||
|
||||
// status code can't be tested at this point, so test the result type instead
|
||||
@@ -470,7 +414,7 @@ namespace Orchard.OutputCache.Filters {
|
||||
}
|
||||
|
||||
Logger.Debug("Redirect on POST");
|
||||
var redirectUrl = redirectResult.Url ;
|
||||
var redirectUrl = redirectResult.Url;
|
||||
|
||||
if (!VirtualPathUtility.IsAbsolute(redirectUrl)) {
|
||||
var applicationRoot = new UrlHelper(filterContext.HttpContext.Request.RequestContext).MakeAbsolute("/");
|
||||
@@ -543,10 +487,12 @@ namespace Orchard.OutputCache.Filters {
|
||||
response.Cache.SetMaxAge(maxAge);
|
||||
}
|
||||
|
||||
response.Cache.VaryByParams["*"] = true;
|
||||
response.DisableUserCache();
|
||||
|
||||
// keeping this examples for later usage
|
||||
// response.Cache.VaryByParams["*"] = true;
|
||||
// response.DisableUserCache();
|
||||
// response.DisableKernelCache();
|
||||
// response.Cache.SetOmitVaryStar(true);
|
||||
|
||||
// an ETag is a string that uniquely identifies a specific version of a component.
|
||||
// we use the cache item to detect if it's a new one
|
||||
@@ -556,8 +502,6 @@ namespace Orchard.OutputCache.Filters {
|
||||
}
|
||||
}
|
||||
|
||||
response.Cache.SetOmitVaryStar(true);
|
||||
|
||||
if (_varyQueryStringParameters != null) {
|
||||
foreach (var queryStringParam in _varyQueryStringParameters) {
|
||||
response.Cache.VaryByParams[queryStringParam] = true;
|
||||
@@ -574,7 +518,8 @@ namespace Orchard.OutputCache.Filters {
|
||||
if (!VirtualPathUtility.IsAbsolute(url)) {
|
||||
var applicationRoot = new UrlHelper(controllerContext.HttpContext.Request.RequestContext).MakeAbsolute("/");
|
||||
if (url.StartsWith(applicationRoot, StringComparison.OrdinalIgnoreCase)) {
|
||||
url = url.Substring(applicationRoot.Length);
|
||||
url = "~/" + url.Substring(applicationRoot.Length);
|
||||
url = VirtualPathUtility.ToAbsolute(url);
|
||||
}
|
||||
}
|
||||
return ComputeCacheKey(_shellSettings.Name, url, () => _workContext.CurrentCulture, _themeManager.GetRequestTheme(controllerContext.RequestContext).Id, parameters);
|
||||
@@ -654,82 +599,7 @@ namespace Orchard.OutputCache.Filters {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Captures the response stream while writing to it
|
||||
/// </summary>
|
||||
public class CapturingResponseFilter : Stream {
|
||||
private readonly MemoryStream _mem;
|
||||
|
||||
public CapturingResponseFilter() {
|
||||
_mem = new MemoryStream();
|
||||
}
|
||||
|
||||
// The following members of Stream must be overriden.
|
||||
public override bool CanRead {
|
||||
get { return true; }
|
||||
}
|
||||
|
||||
public override bool CanSeek {
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public override bool CanWrite {
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public override long Length {
|
||||
get { return 0; }
|
||||
}
|
||||
|
||||
public override long Position { get; set; }
|
||||
|
||||
public override long Seek(long offset, SeekOrigin direction) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public override void SetLength(long length) {
|
||||
}
|
||||
|
||||
public override void Close() {
|
||||
_mem.Close();
|
||||
}
|
||||
|
||||
public override void Flush() {
|
||||
}
|
||||
|
||||
public override int Read(byte[] buffer, int offset, int count) {
|
||||
return count;
|
||||
}
|
||||
|
||||
// Override the Write method to filter Response to a file.
|
||||
public override void Write(byte[] buffer, int offset, int count) {
|
||||
|
||||
//Write out the response to the file.
|
||||
_mem.Write(buffer, 0, count);
|
||||
}
|
||||
|
||||
public string GetContents(Encoding enc) {
|
||||
var buffer = new byte[_mem.Length];
|
||||
_mem.Position = 0;
|
||||
_mem.Read(buffer, 0, buffer.Length);
|
||||
return enc.GetString(buffer, 0, buffer.Length);
|
||||
}
|
||||
|
||||
public byte[] GetContents() {
|
||||
return _mem.ToArray();
|
||||
}
|
||||
|
||||
protected override void Dispose(bool disposing) {
|
||||
if (disposing) {
|
||||
_mem.Dispose();
|
||||
}
|
||||
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public class ViewDataContainer : IViewDataContainer {
|
||||
public ViewDataDictionary ViewData { get; set; }
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ namespace Orchard.Templates.Controllers {
|
||||
public ActionResult Create(string id) {
|
||||
var types = GetShapeTypes();
|
||||
var typeName = String.IsNullOrWhiteSpace(id) ? types.Count() == 1 ? types.First().Name : null : id;
|
||||
return String.IsNullOrEmpty(typeName) ? CreatableTypeList() : RedirectToAction("Create", "Admin", new {area = "Contents", id = typeName});
|
||||
return String.IsNullOrEmpty(typeName) ? CreatableTypeList() : RedirectToAction("Create", "Admin", new { area = "Contents", id = typeName });
|
||||
}
|
||||
|
||||
private ActionResult CreatableTypeList() {
|
||||
|
||||
@@ -36,19 +36,19 @@ namespace Orchard.Templates.Drivers {
|
||||
Template = part.Template
|
||||
};
|
||||
|
||||
if (updater != null
|
||||
if (updater != null
|
||||
&& updater.TryUpdateModel(viewModel, Prefix, null, new[] { "AvailableLanguages" })
|
||||
&& ValidateShapeName(part, updater)) {
|
||||
part.Template = viewModel.Template;
|
||||
part.Template = viewModel.Template;
|
||||
|
||||
try {
|
||||
var processor = _processors.FirstOrDefault(x => String.Equals(x.Type, part.ProcessorName, StringComparison.OrdinalIgnoreCase)) ?? _processors.First();
|
||||
processor.Verify(part.Template);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
updater.AddModelError("", T("Template processing error: {0}", ex.Message));
|
||||
_transactions.Cancel();
|
||||
}
|
||||
try {
|
||||
var processor = _processors.FirstOrDefault(x => String.Equals(x.Type, part.ProcessorName, StringComparison.OrdinalIgnoreCase)) ?? _processors.First();
|
||||
processor.Verify(part.Template);
|
||||
}
|
||||
catch (Exception ex) {
|
||||
updater.AddModelError("", T("Template processing error: {0}", ex.Message));
|
||||
_transactions.Cancel();
|
||||
}
|
||||
}
|
||||
return ContentShape("Parts_Shape_Edit", () => shapeHelper.EditorTemplate(TemplateName: "Parts.Shape", Model: viewModel, Prefix: Prefix));
|
||||
}
|
||||
@@ -60,7 +60,7 @@ namespace Orchard.Templates.Drivers {
|
||||
protected override void Importing(ShapePart part, ImportContentContext context) {
|
||||
var shapeElement = context.Data.Element(part.PartDefinition.Name);
|
||||
|
||||
if(shapeElement != null)
|
||||
if (shapeElement != null)
|
||||
part.Template = shapeElement.Value;
|
||||
}
|
||||
|
||||
@@ -70,13 +70,13 @@ namespace Orchard.Templates.Drivers {
|
||||
return false;
|
||||
|
||||
var name = titleViewModel.Title;
|
||||
if (!string.IsNullOrWhiteSpace(name) &&
|
||||
name[0].IsLetter() &&
|
||||
name.All(c => c.IsLetter() || Char.IsDigit(c) || c == '.' || c == '-' )) {
|
||||
if (!String.IsNullOrWhiteSpace(name) &&
|
||||
name[0].IsLetter() &&
|
||||
name.All(c => c.IsLetter() || Char.IsDigit(c) || c == '_')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
updater.AddModelError("Title", T("{0} names can only contain alphanumerical, dot (.) or dash (-) characters and have to start with a letter.", part.ContentItem.TypeDefinition.DisplayName));
|
||||
updater.AddModelError("Title", T("{0} names can only contain alphanumerical or underscore (_) characters and have to start with a letter.", part.ContentItem.TypeDefinition.DisplayName));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,8 +14,7 @@ namespace Orchard.Templates {
|
||||
.WithPart("CommonPart")
|
||||
.WithPart("IdentityPart")
|
||||
.WithPart("TitlePart")
|
||||
.WithPart("ShapePart", p => p
|
||||
.WithSetting("ShapePartSettings.Processor", "Razor"))
|
||||
.WithPart("ShapePart")
|
||||
.Draftable());
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -4,10 +4,15 @@ Author: The Orchard Team
|
||||
Website: http://orchardproject.net
|
||||
Version: 1.8.1
|
||||
OrchardVersion: 1.8
|
||||
Description: Provides a Template type that can be used to store Razor code and used as a shape.
|
||||
Description: Provides a Template type that can be used to store template code and used as a shape.
|
||||
Features:
|
||||
Orchard.Templates:
|
||||
Name: Templates
|
||||
Description: Provides a Template type that represents a Razor template, stored as a content item.
|
||||
Description: Provides a Template type that represents a shape template, stored as a content item.
|
||||
Category: Content
|
||||
Dependencies: Contents, Orchard.Tokens
|
||||
Dependencies: Contents, Orchard.Tokens
|
||||
Orchard.Templates.Razor:
|
||||
Name: Razor Templates
|
||||
Description: Extends Templates with Razor templates.
|
||||
Category: Content
|
||||
Dependencies: Orchard.Templates
|
||||
@@ -167,8 +167,10 @@
|
||||
<Compile Include="Drivers\ShapePartDriver.cs" />
|
||||
<Compile Include="Models\ShapePart.cs" />
|
||||
<Compile Include="Migrations.cs" />
|
||||
<Compile Include="RazorMigrations.cs" />
|
||||
<Compile Include="Services\ITemplateProcessor.cs" />
|
||||
<Compile Include="Services\ITemplateService.cs" />
|
||||
<Compile Include="Services\NoTemplateProcessorBanner.cs" />
|
||||
<Compile Include="Services\Razor\IRazorCompiler.cs" />
|
||||
<Compile Include="Services\Razor\RazorCompiler.cs" />
|
||||
<Compile Include="Services\Razor\RazorTemplateBase.cs" />
|
||||
|
||||
19
src/Orchard.Web/Modules/Orchard.Templates/RazorMigrations.cs
Normal file
19
src/Orchard.Web/Modules/Orchard.Templates/RazorMigrations.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using Orchard.Data.Migration;
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
using Orchard.Environment.Extensions;
|
||||
|
||||
namespace Orchard.Templates {
|
||||
[OrchardFeature("Orchard.Templates.Razor")]
|
||||
public class RazorMigrations : DataMigrationImpl {
|
||||
public int Create() {
|
||||
ContentDefinitionManager.AlterTypeDefinition("Template", type => type
|
||||
.WithPart("ShapePart", p => p
|
||||
.WithSetting("ShapePartSettings.Processor", "Razor")));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using Orchard.Localization;
|
||||
using Orchard.UI.Admin.Notification;
|
||||
using Orchard.UI.Notify;
|
||||
|
||||
namespace Orchard.Templates.Services {
|
||||
public class NoTemplateProcessorBanner : INotificationProvider {
|
||||
private readonly IEnumerable<ITemplateProcessor> _processors;
|
||||
|
||||
public NoTemplateProcessorBanner(IEnumerable<ITemplateProcessor> processors) {
|
||||
_processors = processors;
|
||||
|
||||
T = NullLocalizer.Instance;
|
||||
}
|
||||
|
||||
public Localizer T { get; set; }
|
||||
|
||||
public IEnumerable<NotifyEntry> GetNotifications() {
|
||||
if (!_processors.Any()) {
|
||||
yield return new NotifyEntry { Message = T("To be able to use Templates enable a template processor like Razor Templates."), Type = NotifyType.Warning };
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Orchard.Templates.Compilation.Razor {
|
||||
public interface IRazorCompiler : IDependency {
|
||||
public interface IRazorCompiler : IDependency {
|
||||
IRazorTemplateBase<TModel> CompileRazor<TModel>(string code, string name, IDictionary<string, object> parameters);
|
||||
IRazorTemplateBase CompileRazor(string code, string name, IDictionary<string, object> parameters);
|
||||
}
|
||||
|
||||
@@ -10,10 +10,12 @@ using System.Text;
|
||||
using System.Web.Razor;
|
||||
using Microsoft.CSharp;
|
||||
using Orchard.Caching;
|
||||
using Orchard.Environment.Extensions;
|
||||
using Orchard.Logging;
|
||||
using Orchard.Utility.Extensions;
|
||||
|
||||
namespace Orchard.Templates.Compilation.Razor {
|
||||
[OrchardFeature("Orchard.Templates.Razor")]
|
||||
public class RazorCompiler : IRazorCompiler {
|
||||
private readonly ICacheManager _cache;
|
||||
private readonly ISignals _signals;
|
||||
@@ -46,7 +48,7 @@ namespace Orchard.Templates.Compilation.Razor {
|
||||
};
|
||||
|
||||
public RazorCompiler(
|
||||
ICacheManager cache,
|
||||
ICacheManager cache,
|
||||
ISignals signals) {
|
||||
_cache = cache;
|
||||
_signals = signals;
|
||||
@@ -56,15 +58,15 @@ namespace Orchard.Templates.Compilation.Razor {
|
||||
private ILogger Logger { get; set; }
|
||||
|
||||
public IRazorTemplateBase<TModel> CompileRazor<TModel>(string code, string name, IDictionary<string, object> parameters) {
|
||||
return (RazorTemplateBase<TModel>) Compile(code, name, typeof (TModel), parameters);
|
||||
return (RazorTemplateBase<TModel>)Compile(code, name, typeof(TModel), parameters);
|
||||
}
|
||||
|
||||
public IRazorTemplateBase CompileRazor(string code, string name, IDictionary<string, object> parameters) {
|
||||
return (IRazorTemplateBase) Compile(code, name, null, parameters);
|
||||
return (IRazorTemplateBase)Compile(code, name, null, parameters);
|
||||
}
|
||||
|
||||
private object Compile(string code, string name, Type modelType, IDictionary<string, object> parameters) {
|
||||
|
||||
|
||||
var cacheKey = (name ?? DynamicallyGeneratedClassName) + GetHash(code);
|
||||
var generatedClassName = name != null ? name.Strip(c => !c.IsLetter() && !Char.IsDigit(c)) : DynamicallyGeneratedClassName;
|
||||
|
||||
|
||||
@@ -3,8 +3,7 @@ using System.Web.Mvc;
|
||||
using System.Web.WebPages;
|
||||
|
||||
namespace Orchard.Templates.Compilation.Razor {
|
||||
public interface IRazorTemplateBase
|
||||
{
|
||||
public interface IRazorTemplateBase {
|
||||
dynamic Model { get; }
|
||||
WebPageContext WebPageContext { get; set; }
|
||||
ViewContext ViewContext { get; set; }
|
||||
@@ -15,8 +14,7 @@ namespace Orchard.Templates.Compilation.Razor {
|
||||
|
||||
}
|
||||
|
||||
public interface IRazorTemplateBase<TModel> : IRazorTemplateBase
|
||||
{
|
||||
public interface IRazorTemplateBase<TModel> : IRazorTemplateBase {
|
||||
new TModel Model { get; }
|
||||
new ViewDataDictionary<TModel> ViewData { get; set; }
|
||||
}
|
||||
|
||||
@@ -7,9 +7,12 @@ using System.Web.Mvc;
|
||||
using System.Web.UI;
|
||||
using System.Web.WebPages;
|
||||
using Orchard.DisplayManagement.Implementation;
|
||||
using Orchard.Environment.Extensions;
|
||||
using Orchard.Logging;
|
||||
using Orchard.Templates.Compilation.Razor;
|
||||
|
||||
namespace Orchard.Templates.Services {
|
||||
[OrchardFeature("Orchard.Templates.Razor")]
|
||||
public class RazorTemplateProcessor : TemplateProcessorImpl {
|
||||
private readonly IRazorCompiler _compiler;
|
||||
private readonly HttpContextBase _httpContextBase;
|
||||
@@ -19,7 +22,7 @@ namespace Orchard.Templates.Services {
|
||||
}
|
||||
|
||||
public RazorTemplateProcessor(
|
||||
IRazorCompiler compiler,
|
||||
IRazorCompiler compiler,
|
||||
HttpContextBase httpContextBase) {
|
||||
_compiler = compiler;
|
||||
_httpContextBase = httpContextBase;
|
||||
@@ -58,7 +61,7 @@ namespace Orchard.Templates.Services {
|
||||
obj.WebPageContext = new WebPageContext(displayContext.ViewContext.HttpContext, obj as WebPageRenderingBase, model);
|
||||
obj.ViewContext = shapeViewContext;
|
||||
|
||||
obj.ViewData = new ViewDataDictionary(displayContext.ViewDataContainer.ViewData) {Model = model};
|
||||
obj.ViewData = new ViewDataDictionary(displayContext.ViewDataContainer.ViewData) { Model = model };
|
||||
obj.InitHelpers();
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -15,8 +15,8 @@ namespace Orchard.Templates.Services {
|
||||
private IContentManager _contentManager;
|
||||
private ITemplateService _templateService;
|
||||
|
||||
public TemplateShapeDisplayEvent (
|
||||
ICacheManager cacheManager,
|
||||
public TemplateShapeDisplayEvent(
|
||||
ICacheManager cacheManager,
|
||||
ISignals signals,
|
||||
IContentManager contentManager,
|
||||
ITemplateService templateService
|
||||
@@ -41,7 +41,7 @@ namespace Orchard.Templates.Services {
|
||||
|
||||
public IDictionary<string, Func<dynamic, IHtmlString>> BuildShapeProcessors() {
|
||||
return _cacheManager.Get("Template.ShapeProcessors", ctx => {
|
||||
ctx.Monitor(_signals.When(DefaultTemplateService.TemplatesSignal));
|
||||
ctx.Monitor(_signals.When(DefaultTemplateService.TemplatesSignal));
|
||||
|
||||
var allTemplates = _contentManager.Query<ShapePart>().List();
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace Orchard.Templates.Settings {
|
||||
AvailableProcessors = _processors.ToArray()
|
||||
};
|
||||
|
||||
updateModel.TryUpdateModel(model, "ShapePartSettingsViewModel", new[] {"Processor"}, null);
|
||||
updateModel.TryUpdateModel(model, "ShapePartSettingsViewModel", new[] { "Processor" }, null);
|
||||
builder.WithSetting("ShapePartSettings.Processor", model.Processor);
|
||||
yield return DefinitionTemplate(model);
|
||||
}
|
||||
|
||||
@@ -99,7 +99,6 @@
|
||||
<validation validateIntegratedModeConfiguration="false" />
|
||||
|
||||
<modules runAllManagedModulesForAllRequests="false">
|
||||
<remove name="OutputCache" />
|
||||
<remove name="WarmupHttpModule"/>
|
||||
<add name="WarmupHttpModule" type="Orchard.WarmupStarter.WarmupHttpModule, Orchard.WarmupStarter, Version=1.8, Culture=neutral"/>
|
||||
</modules>
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Orchard.Caching {
|
||||
var entry = _entries.AddOrUpdate(key,
|
||||
// "Add" lambda
|
||||
k => AddEntry(k, acquire),
|
||||
// "Update" lamdba
|
||||
// "Update" lambda
|
||||
(k, currentEntry) => UpdateEntry(currentEntry, k, acquire));
|
||||
|
||||
return entry.Result;
|
||||
|
||||
Reference in New Issue
Block a user