mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-08-24 05:41:44 +08:00
Merge
--HG-- branch : 1.x
This commit is contained in:
commit
e39a034091
10
Orchard.proj
10
Orchard.proj
@ -276,13 +276,18 @@
|
||||
$(StageFolder)\**\Modules\Lucene\**;
|
||||
$(StageFolder)\**\Modules\Orchard.ArchiveLater\**;
|
||||
$(StageFolder)\**\Modules\Orchard.CodeGeneration\**;
|
||||
$(StageFolder)\**\Modules\Orchard.DesignerTools\**;
|
||||
$(StageFolder)\**\Modules\Orchard.Email\**;
|
||||
$(StageFolder)\**\Modules\Orchard.Experimental\**;
|
||||
$(StageFolder)\**\Modules\Orchard.ImportExport\**;
|
||||
$(StageFolder)\**\Modules\Orchard.Indexing\**;
|
||||
$(StageFolder)\**\Modules\Orchard.MediaPicker\**;
|
||||
$(StageFolder)\**\Modules\Orchard.Migrations\**;
|
||||
$(StageFolder)\**\Modules\Orchard.MultiTenancy\**;
|
||||
$(StageFolder)\**\Modules\Orchard.Recipes\**;
|
||||
$(StageFolder)\**\Modules\Orchard.Scripting.Dlr\**;
|
||||
$(StageFolder)\**\Modules\Orchard.Search\**;
|
||||
$(StageFolder)\**\Modules\Orchard.Warmup\**;
|
||||
" />
|
||||
|
||||
<MsDeploy-Folder-Input Include="$(StageFolder)\**\*" Exclude="$(StageFolder)\**\bin\**\*.xml;@(MsDeploy-Exclude-Modules)" />
|
||||
@ -375,13 +380,18 @@
|
||||
<Exec Command=""$(GalleryFolder)\bin\Orchard.exe" package create Lucene "$(GalleryArtifactFolder)"" WorkingDirectory="$(GalleryFolder)"/>
|
||||
<Exec Command=""$(GalleryFolder)\bin\Orchard.exe" package create Orchard.ArchiveLater "$(GalleryArtifactFolder)"" WorkingDirectory="$(GalleryFolder)"/>
|
||||
<Exec Command=""$(GalleryFolder)\bin\Orchard.exe" package create Orchard.CodeGeneration "$(GalleryArtifactFolder)"" WorkingDirectory="$(GalleryFolder)"/>
|
||||
<Exec Command=""$(GalleryFolder)\bin\Orchard.exe" package create Orchard.DesignerTools "$(GalleryArtifactFolder)"" WorkingDirectory="$(GalleryFolder)"/>
|
||||
<Exec Command=""$(GalleryFolder)\bin\Orchard.exe" package create Orchard.Email "$(GalleryArtifactFolder)"" WorkingDirectory="$(GalleryFolder)"/>
|
||||
<Exec Command=""$(GalleryFolder)\bin\Orchard.exe" package create Orchard.Experimental "$(GalleryArtifactFolder)"" WorkingDirectory="$(GalleryFolder)"/>
|
||||
<Exec Command=""$(GalleryFolder)\bin\Orchard.exe" package create Orchard.ImportExport "$(GalleryArtifactFolder)"" WorkingDirectory="$(GalleryFolder)"/>
|
||||
<Exec Command=""$(GalleryFolder)\bin\Orchard.exe" package create Orchard.Indexing "$(GalleryArtifactFolder)"" WorkingDirectory="$(GalleryFolder)"/>
|
||||
<Exec Command=""$(GalleryFolder)\bin\Orchard.exe" package create Orchard.MediaPicker "$(GalleryArtifactFolder)"" WorkingDirectory="$(GalleryFolder)"/>
|
||||
<Exec Command=""$(GalleryFolder)\bin\Orchard.exe" package create Orchard.Migrations "$(GalleryArtifactFolder)"" WorkingDirectory="$(GalleryFolder)"/>
|
||||
<Exec Command=""$(GalleryFolder)\bin\Orchard.exe" package create Orchard.MultiTenancy "$(GalleryArtifactFolder)"" WorkingDirectory="$(GalleryFolder)"/>
|
||||
<Exec Command=""$(GalleryFolder)\bin\Orchard.exe" package create Orchard.Recipes "$(GalleryArtifactFolder)"" WorkingDirectory="$(GalleryFolder)"/>
|
||||
<Exec Command=""$(GalleryFolder)\bin\Orchard.exe" package create Orchard.Scripting.Dlr "$(GalleryArtifactFolder)"" WorkingDirectory="$(GalleryFolder)"/>
|
||||
<Exec Command=""$(GalleryFolder)\bin\Orchard.exe" package create Orchard.Search "$(GalleryArtifactFolder)"" WorkingDirectory="$(GalleryFolder)"/>
|
||||
<Exec Command=""$(GalleryFolder)\bin\Orchard.exe" package create Orchard.Warmup "$(GalleryArtifactFolder)"" WorkingDirectory="$(GalleryFolder)"/>
|
||||
</Target>
|
||||
|
||||
<!-- ValidateProjectFiles-->
|
||||
|
11
src/Orchard.Specs/Bindings/HtmlNodeExtensions.cs
Normal file
11
src/Orchard.Specs/Bindings/HtmlNodeExtensions.cs
Normal file
@ -0,0 +1,11 @@
|
||||
using HtmlAgilityPack;
|
||||
|
||||
namespace Orchard.Specs.Bindings {
|
||||
public static class HtmlNodeExtensions {
|
||||
public static string GetOptionValue(this HtmlNode node) {
|
||||
return node.Attributes.Contains("value")
|
||||
? node.GetAttributeValue("value", "")
|
||||
: node.NextSibling != null && node.NextSibling.NodeType == HtmlNodeType.Text ? node.NextSibling.InnerText : "";
|
||||
}
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Web;
|
||||
using Castle.Core.Logging;
|
||||
using HtmlAgilityPack;
|
||||
@ -181,21 +182,21 @@ namespace Orchard.Specs.Bindings {
|
||||
Host.HostName = host;
|
||||
Details = Host.SendRequest(urlPath);
|
||||
_doc = new HtmlDocument();
|
||||
_doc.Load(new StringReader(Details.ResponseText));
|
||||
_doc.Load(new StringReader(Regex.Replace(Details.ResponseText, @">\s+<", "><")));
|
||||
}
|
||||
|
||||
[When(@"I go to ""(.*)""")]
|
||||
public void WhenIGoTo(string urlPath) {
|
||||
Details = Host.SendRequest(urlPath);
|
||||
_doc = new HtmlDocument();
|
||||
_doc.Load(new StringReader(Details.ResponseText));
|
||||
_doc.Load(new StringReader(Regex.Replace(Details.ResponseText, @">\s+<", "><")));
|
||||
}
|
||||
|
||||
[When(@"I follow ""([^""]*)""")]
|
||||
public void WhenIFollow(string linkText) {
|
||||
var link = _doc.DocumentNode
|
||||
.SelectNodes("//a")
|
||||
.SingleOrDefault(elt => elt.InnerText == linkText)
|
||||
.SingleOrDefault(elt => elt.InnerHtml == linkText)
|
||||
?? _doc.DocumentNode
|
||||
.SelectSingleNode(string.Format("//a[@title='{0}']", linkText));
|
||||
|
||||
@ -208,7 +209,7 @@ namespace Orchard.Specs.Bindings {
|
||||
public void WhenIFollow(string linkText, string hrefFilter) {
|
||||
var link = _doc.DocumentNode
|
||||
.SelectNodes("//a[@href]").Where(elt =>
|
||||
(elt.InnerText == linkText ||
|
||||
(elt.InnerHtml == linkText ||
|
||||
(elt.Attributes["title"] != null && elt.Attributes["title"].Value == linkText)) &&
|
||||
elt.Attributes["href"].Value.IndexOf(hrefFilter, StringComparison.OrdinalIgnoreCase) != -1).SingleOrDefault();
|
||||
|
||||
@ -280,9 +281,9 @@ namespace Orchard.Specs.Bindings {
|
||||
break;
|
||||
default:
|
||||
if (string.Equals(input.Name, "select", StringComparison.OrdinalIgnoreCase)) {
|
||||
var options = input.ChildNodes;
|
||||
var options = input.Descendants("option");
|
||||
foreach (var option in options) {
|
||||
if (option.GetAttributeValue("value", "") == row["value"])
|
||||
if (option.GetAttributeValue("value", "") == row["value"] || (option.NextSibling.NodeType == HtmlNodeType.Text && option.NextSibling.InnerText == row["value"]))
|
||||
option.Attributes.Add("selected", "selected");
|
||||
else if (option.Attributes.Contains("selected"))
|
||||
option.Attributes.Remove("selected");
|
||||
@ -303,7 +304,7 @@ namespace Orchard.Specs.Bindings {
|
||||
.SelectSingleNode(string.Format("(//input[@type='submit'][@value='{0}']|//button[@type='submit'][text()='{0}'])", submitText));
|
||||
|
||||
var form = Form.LocateAround(submit);
|
||||
var urlPath = form.Start.GetAttributeValue("action", Details.UrlPath);
|
||||
var urlPath = HttpUtility.HtmlDecode(form.Start.GetAttributeValue("action", Details.UrlPath));
|
||||
|
||||
|
||||
var inputs = form.Children
|
||||
@ -316,18 +317,18 @@ namespace Orchard.Specs.Bindings {
|
||||
// select all <select> elements
|
||||
form.Children.SelectMany(elt => elt.DescendantsAndSelf("select")).Where(elt => elt.Name.Equals("select", StringComparison.OrdinalIgnoreCase))
|
||||
// group them by their name with value that comes from first of:
|
||||
// (1) value of option with 'selected' attribute,
|
||||
// (1) value of option with 'selecturlPath.Replace("127.0.0.1", "localhost")ed' attribute,
|
||||
// (2) value of first option (none have 'selected'),
|
||||
// (3) empty value (e.g. select with no options)
|
||||
.GroupBy(
|
||||
sel => sel.GetAttributeValue("name", sel.GetAttributeValue("id", "")),
|
||||
sel => (sel.Descendants("option").SingleOrDefault(opt => opt.Attributes["selected"] != null) ?? sel.Descendants("option").FirstOrDefault() ?? new HtmlNode(HtmlNodeType.Element, _doc, 0)).GetAttributeValue("value", "")))
|
||||
sel => (sel.Descendants("option").SingleOrDefault(opt => opt.Attributes["selected"] != null) ?? sel.Descendants("option").FirstOrDefault() ?? new HtmlNode(HtmlNodeType.Element, _doc, 0)).GetOptionValue()))
|
||||
.ToDictionary(elt => elt.Key, elt => (IEnumerable<string>)elt);
|
||||
|
||||
if (submit.Attributes.Contains("name"))
|
||||
inputs.Add(submit.GetAttributeValue("name", ""), new[] {submit.GetAttributeValue("value", "yes")});
|
||||
|
||||
Details = Host.SendRequest(urlPath, inputs);
|
||||
|
||||
Details = Host.SendRequest(urlPath, inputs, form.Start.GetAttributeValue("method", "GET").ToUpperInvariant());
|
||||
_doc = new HtmlDocument();
|
||||
_doc.Load(new StringReader(Details.ResponseText));
|
||||
}
|
||||
@ -336,10 +337,10 @@ namespace Orchard.Specs.Bindings {
|
||||
public void WhenIAmRedirected() {
|
||||
var urlPath = "";
|
||||
if (Details.ResponseHeaders.TryGetValue("Location", out urlPath)) {
|
||||
WhenIGoTo(urlPath);
|
||||
WhenIGoTo(urlPath.Replace("http://127.0.0.1/", ""));
|
||||
}
|
||||
else {
|
||||
Assert.Fail("No Location header returned");
|
||||
Assert.Fail("Expected to be redirected but no Location header returned");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Web;
|
||||
@ -11,7 +12,7 @@ using Orchard.Specs.Util;
|
||||
|
||||
namespace Orchard.Specs.Hosting {
|
||||
public static class RequestExtensions {
|
||||
public static RequestDetails SendRequest(this WebHost webHost, string urlPath, IDictionary<string, IEnumerable<string>> postData) {
|
||||
public static RequestDetails SendRequest(this WebHost webHost, string urlPath, IDictionary<string, IEnumerable<string>> postData, string requestMethod = null) {
|
||||
|
||||
var physicalPath = Bleroy.FluentPath.Path.Get(webHost.PhysicalDirectory);
|
||||
|
||||
@ -22,15 +23,15 @@ namespace Orchard.Specs.Hosting {
|
||||
|
||||
var details = new RequestDetails {
|
||||
HostName = webHost.HostName,
|
||||
UrlPath = urlPath,
|
||||
UrlPath = urlPath.Replace('\\', '/'),
|
||||
};
|
||||
|
||||
int queryIndex = urlPath.IndexOf('?');
|
||||
if (queryIndex >= 0) {
|
||||
details.UrlPath = urlPath.Substring(0, queryIndex);
|
||||
details.Query = HttpUtility.UrlDecode(urlPath.Substring(queryIndex + 1));
|
||||
details.UrlPath = urlPath.Substring(0, queryIndex).Replace('\\', '/');
|
||||
details.Query = urlPath.Substring(queryIndex + 1);
|
||||
}
|
||||
details.Page = (isHomepage ? "" : physicalPath.Combine(details.UrlPath.TrimStart('/', '\\')).GetRelativePath(physicalPath).ToString());
|
||||
details.Page = (isHomepage ? "" : physicalPath.Combine(details.UrlPath.TrimStart('/', '\\')).GetRelativePath(physicalPath).ToString()).Replace('\\','/');
|
||||
|
||||
if (!string.IsNullOrEmpty(webHost.Cookies)) {
|
||||
details.RequestHeaders.Add("Cookie", webHost.Cookies);
|
||||
@ -41,7 +42,11 @@ namespace Orchard.Specs.Hosting {
|
||||
.SelectMany(kv => kv.Value.Select(v => new { k = kv.Key, v }))
|
||||
.Select((kv, n) => new { p = HttpUtility.UrlEncode(kv.k) + "=" + HttpUtility.UrlEncode(kv.v), n })
|
||||
.Aggregate("", (a, x) => a + (x.n == 0 ? "" : "&") + x.p);
|
||||
details.PostData = Encoding.Default.GetBytes(requestBodyText);
|
||||
|
||||
if (requestMethod == "POST")
|
||||
details.PostData = Encoding.Default.GetBytes(requestBodyText);
|
||||
else
|
||||
details.Query = requestBodyText;
|
||||
}
|
||||
|
||||
webHost.Execute(() => {
|
||||
|
@ -131,6 +131,7 @@
|
||||
<Compile Include="Bindings\BindingBase.cs" />
|
||||
<Compile Include="Bindings\CommandLine.cs" />
|
||||
<Compile Include="Bindings\ContentRights.cs" />
|
||||
<Compile Include="Bindings\HtmlNodeExtensions.cs" />
|
||||
<Compile Include="Bindings\OrchardSiteFactory.cs" />
|
||||
<Compile Include="Bindings\UsersPermissionsAndRoles.cs" />
|
||||
<Compile Include="Blogs.feature.cs">
|
||||
|
@ -41,3 +41,25 @@ Scenario: I can delete a layer
|
||||
And I am redirected
|
||||
Then I should see "Layer was successfully deleted"
|
||||
And I should not see "<option[^>]*>Default</option>"
|
||||
|
||||
Scenario: I can add a widget to a specific zone in a specific layer
|
||||
Given I have installed Orchard
|
||||
When I go to "admin/widgets"
|
||||
And I fill in
|
||||
| name | value |
|
||||
| layerId | Disabled |
|
||||
And I hit "Show"
|
||||
Then I should see "<option[^>]*selected[^>]*>Disabled"
|
||||
When I follow "Add" where href has "zone=Header"
|
||||
Then I should see "<h1[^>]*>Choose A Widget</h1>"
|
||||
When I follow "<h2>Html Widget</h2>"
|
||||
Then I should see "<h1[^>]*>Add Widget</h1>"
|
||||
When I fill in
|
||||
| name | value |
|
||||
| Title | Flashy HTML Widget |
|
||||
| Body.Text | <p><blink>hi</blink></p> |
|
||||
And I hit "Save"
|
||||
And I am redirected
|
||||
Then I should see "Your Html Widget has been added."
|
||||
And I should see "<option[^>]*selected[^>]*>Disabled"
|
||||
And I should see "<li[^>]*class="[^"]*widgets-this-layer[^"]*"[^>]*>\s*<form[^>]*>\s*<h3[^>]*>\s*<a[^>]*>Flashy HTML Widget</a>\s*</h3>"
|
||||
|
59
src/Orchard.Specs/Widgets.feature.cs
generated
59
src/Orchard.Specs/Widgets.feature.cs
generated
@ -158,6 +158,65 @@ this.ScenarioSetup(scenarioInfo);
|
||||
testRunner.Then("I should see \"Layer was successfully deleted\"");
|
||||
#line 43
|
||||
testRunner.And("I should not see \"<option[^>]*>Default</option>\"");
|
||||
#line hidden
|
||||
testRunner.CollectScenarioErrors();
|
||||
}
|
||||
|
||||
[NUnit.Framework.TestAttribute()]
|
||||
[NUnit.Framework.DescriptionAttribute("I can add a widget to a specific zone in a specific layer")]
|
||||
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");
|
||||
#line 47
|
||||
testRunner.When("I go to \"admin/widgets\"");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table3 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
"name",
|
||||
"value"});
|
||||
table3.AddRow(new string[] {
|
||||
"layerId",
|
||||
"Disabled"});
|
||||
#line 48
|
||||
testRunner.And("I fill in", ((string)(null)), table3);
|
||||
#line 51
|
||||
testRunner.And("I hit \"Show\"");
|
||||
#line 52
|
||||
testRunner.Then("I should see \"<option[^>]*selected[^>]*>Disabled\"");
|
||||
#line 53
|
||||
testRunner.When("I follow \"Add\" where href has \"zone=Header\"");
|
||||
#line 54
|
||||
testRunner.Then("I should see \"<h1[^>]*>Choose A Widget</h1>\"");
|
||||
#line 55
|
||||
testRunner.When("I follow \"<h2>Html Widget</h2>\"");
|
||||
#line 56
|
||||
testRunner.Then("I should see \"<h1[^>]*>Add Widget</h1>\"");
|
||||
#line hidden
|
||||
TechTalk.SpecFlow.Table table4 = new TechTalk.SpecFlow.Table(new string[] {
|
||||
"name",
|
||||
"value"});
|
||||
table4.AddRow(new string[] {
|
||||
"Title",
|
||||
"Flashy HTML Widget"});
|
||||
table4.AddRow(new string[] {
|
||||
"Body.Text",
|
||||
"<p><blink>hi</blink></p>"});
|
||||
#line 57
|
||||
testRunner.When("I fill in", ((string)(null)), table4);
|
||||
#line 61
|
||||
testRunner.And("I hit \"Save\"");
|
||||
#line 62
|
||||
testRunner.And("I am redirected");
|
||||
#line 63
|
||||
testRunner.Then("I should see \"Your Html Widget has been added.\"");
|
||||
#line 64
|
||||
testRunner.And("I should see \"<option[^>]*selected[^>]*>Disabled\"");
|
||||
#line 65
|
||||
testRunner.And("I should see \"<li[^>]*class=\"[^\"]*widgets-this-layer[^\"]*\"[^>]*>\\s*<form[^>]*>\\s*" +
|
||||
"<h3[^>]*>\\s*<a[^>]*>Flashy HTML Widget</a>\\s*</h3>\"");
|
||||
#line hidden
|
||||
testRunner.CollectScenarioErrors();
|
||||
}
|
||||
|
@ -273,6 +273,7 @@
|
||||
<Compile Include="Stubs\StubVirtualPathMonitor.cs" />
|
||||
<Compile Include="Stubs\StubCacheManager.cs" />
|
||||
<Compile Include="Stubs\StubWebSiteFolder.cs" />
|
||||
<Compile Include="UI\Resources\ResourceManagerTests.cs" />
|
||||
<Compile Include="UI\ShapeTests.cs" />
|
||||
<Compile Include="Utility\ContainerExtensions.cs" />
|
||||
<Compile Include="Environment\TestDependencies\TestDependency.cs" />
|
||||
|
133
src/Orchard.Tests/UI/Resources/ResourceManagerTests.cs
Normal file
133
src/Orchard.Tests/UI/Resources/ResourceManagerTests.cs
Normal file
@ -0,0 +1,133 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using Autofac;
|
||||
using NUnit.Framework;
|
||||
using Orchard.DisplayManagement.Implementation;
|
||||
using Orchard.Tests.Stubs;
|
||||
using Orchard.UI.Admin;
|
||||
using Orchard.UI.Resources;
|
||||
|
||||
namespace Orchard.Tests.UI.Resources {
|
||||
[TestFixture]
|
||||
public class ResourceManagerTests {
|
||||
private IContainer _container;
|
||||
private IResourceManager _resourceManager;
|
||||
private TestManifestProvider _testManifest;
|
||||
private string _appPath = "/AppPath/";
|
||||
|
||||
private class TestManifestProvider : IResourceManifestProvider {
|
||||
public Action<ResourceManifest> DefineManifest { get; set; }
|
||||
|
||||
public TestManifestProvider() {
|
||||
|
||||
}
|
||||
public void BuildManifests(ResourceManifestBuilder builder) {
|
||||
var manifest = builder.Add();
|
||||
if (DefineManifest != null) {
|
||||
DefineManifest(manifest);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void VerifyPaths(string resourceType, RequireSettings defaultSettings, string expectedPaths) {
|
||||
defaultSettings = defaultSettings ?? new RequireSettings();
|
||||
var requiredResources = _resourceManager.BuildRequiredResources(resourceType);
|
||||
var renderedResources = string.Join(",", requiredResources.Select(context => context.GetResourceUrl(defaultSettings, _appPath)).ToArray());
|
||||
Assert.That(renderedResources, Is.EqualTo(expectedPaths));
|
||||
}
|
||||
|
||||
[SetUp]
|
||||
public void Init() {
|
||||
var builder = new ContainerBuilder();
|
||||
builder.RegisterType<ResourceManager>().As<IResourceManager>();
|
||||
builder.RegisterType<TestManifestProvider>().As<IResourceManifestProvider>().SingleInstance();
|
||||
_container = builder.Build();
|
||||
_resourceManager = _container.Resolve<IResourceManager>();
|
||||
_testManifest = _container.Resolve<IResourceManifestProvider>() as TestManifestProvider;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ReleasePathIsTheDefaultPath() {
|
||||
_testManifest.DefineManifest = m => {
|
||||
m.DefineResource("script", "Script1").SetUrl("script1.min.js", "script1.js");
|
||||
};
|
||||
_resourceManager.Require("script", "Script1");
|
||||
VerifyPaths("script", null, "script1.min.js");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DebugPathIsUsedWithDebugMode() {
|
||||
_testManifest.DefineManifest = m => {
|
||||
m.DefineResource("script", "Script1").SetUrl("script1.min.js", "script1.js");
|
||||
};
|
||||
_resourceManager.Require("script", "Script1");
|
||||
VerifyPaths("script", new RequireSettings { DebugMode = true }, "script1.js");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ReleasePathIsUsedWhenNoDebugPath() {
|
||||
_testManifest.DefineManifest = m => {
|
||||
m.DefineResource("script", "Script1").SetUrl("script1.min.js");
|
||||
};
|
||||
_resourceManager.Require("script", "Script1");
|
||||
VerifyPaths("script", new RequireSettings { DebugMode = true }, "script1.min.js");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DefaultSettingsAreOverriddenByUseDebugMode() {
|
||||
_testManifest.DefineManifest = m => {
|
||||
m.DefineResource("script", "Script1").SetUrl("script1.min.js", "script1.js");
|
||||
};
|
||||
_resourceManager.Require("script", "Script1").UseDebugMode();
|
||||
VerifyPaths("script", new RequireSettings { DebugMode = false }, "script1.js");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CdnPathIsUsedInCdnMode() {
|
||||
_testManifest.DefineManifest = m => {
|
||||
m.DefineResource("script", "Script1").SetUrl("script1.js").SetCdn("http://cdn/script1.min.js");
|
||||
};
|
||||
_resourceManager.Require("script", "Script1");
|
||||
VerifyPaths("script", new RequireSettings { CdnMode = true }, "http://cdn/script1.min.js");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CdnDebugPathIsUsedInCdnModeAndDebugMode() {
|
||||
_testManifest.DefineManifest = m => {
|
||||
m.DefineResource("script", "Script1").SetUrl("script1.js").SetCdn("http://cdn/script1.min.js", "http://cdn/script1.js");
|
||||
};
|
||||
_resourceManager.Require("script", "Script1");
|
||||
VerifyPaths("script", new RequireSettings { CdnMode = true, DebugMode = true }, "http://cdn/script1.js");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DebugPathIsUsedInCdnModeAndDebugModeAndThereIsNoCdnDebugPath() {
|
||||
_testManifest.DefineManifest = m => {
|
||||
m.DefineResource("script", "Script1").SetUrl("script1.min.js", "script1.js").SetCdn("http://cdn/script1.min.js");
|
||||
};
|
||||
_resourceManager.Require("script", "Script1");
|
||||
VerifyPaths("script", new RequireSettings { CdnMode = true, DebugMode = true }, "script1.js");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DependenciesAreAutoIncluded() {
|
||||
_testManifest.DefineManifest = m => {
|
||||
m.DefineResource("script", "Script1").SetUrl("script1.min.js");
|
||||
m.DefineResource("script", "Script2").SetUrl("script2.min.js").SetDependencies("Script1");
|
||||
};
|
||||
_resourceManager.Require("script", "Script2");
|
||||
VerifyPaths("script", null, "script1.min.js,script2.min.js");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DependenciesAssumeTheirParentUseDebugModeSetting() {
|
||||
_testManifest.DefineManifest = m => {
|
||||
m.DefineResource("script", "Script1").SetUrl("script1.min.js", "script1.js");
|
||||
m.DefineResource("script", "Script2").SetUrl("script2.min.js", "script2.js").SetDependencies("Script1");
|
||||
};
|
||||
_resourceManager.Require("script", "Script2").UseDebugMode();
|
||||
VerifyPaths("script", new RequireSettings { DebugMode = false }, "script1.js,script2.js");
|
||||
}
|
||||
}
|
||||
}
|
@ -4,6 +4,7 @@ using System.Web.Mvc;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Aspects;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.Core.Common.Models;
|
||||
using Orchard.Core.Containers.Models;
|
||||
using Orchard.Core.Containers.ViewModels;
|
||||
using Orchard.Localization;
|
||||
@ -27,7 +28,7 @@ namespace Orchard.Core.Containers.Drivers {
|
||||
return ContentShape(
|
||||
"Parts_Containable_Edit",
|
||||
() => {
|
||||
var commonPart = part.As<ICommonPart>();
|
||||
var commonPart = part.As<CommonPart>();
|
||||
|
||||
var model = new ContainableViewModel();
|
||||
if (commonPart != null && commonPart.Container != null) {
|
||||
@ -37,10 +38,12 @@ namespace Orchard.Core.Containers.Drivers {
|
||||
if (updater != null) {
|
||||
var oldContainerId = model.ContainerId;
|
||||
updater.TryUpdateModel(model, "Containable", null, null);
|
||||
if (oldContainerId != model.ContainerId)
|
||||
if (oldContainerId != model.ContainerId) {
|
||||
if (commonPart != null) {
|
||||
commonPart.Container = _contentManager.Get(model.ContainerId, VersionOptions.Latest);
|
||||
var containerItem = _contentManager.Get(model.ContainerId, VersionOptions.Latest);
|
||||
commonPart.Record.Container = containerItem == null ? null : containerItem.Record;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// note: string.isnullorempty not being recognized by linq-to-nhibernate hence the inline or
|
||||
|
@ -1,4 +1,9 @@
|
||||
@Display(Model.ContentItems)
|
||||
@{
|
||||
IEnumerable<object> items = Model.ContentItems;
|
||||
Model.ContentItems.Classes.Add("content-items");
|
||||
Model.ContentItems.Classes.Add("list-items");
|
||||
}
|
||||
@Display(items)
|
||||
@if (Model.ShowPager) {
|
||||
@Display(Model.Pager)
|
||||
}
|
@ -1 +1,6 @@
|
||||
@Display(Model.ContentItems)
|
||||
@{
|
||||
IEnumerable<object> items = Model.ContentItems;
|
||||
Model.ContentItems.Classes.Add("content-items");
|
||||
Model.ContentItems.Classes.Add("list-items");
|
||||
}
|
||||
@Display(items)
|
@ -8,9 +8,9 @@ background-position:0 -30px !important;
|
||||
background-image:url(images/menu.content.png);
|
||||
}
|
||||
/* subnav */
|
||||
#menu .menu-admin .selected .menuItems a {
|
||||
#menu .menu-admin .section-new .menuItems a {
|
||||
background-position:0 4px;
|
||||
}
|
||||
#menu .menu-admin .selected .menuItems a:hover, #menu .menu-admin .selected .menuItems .selected a {
|
||||
#menu .menu-admin .section-new .menuItems a:hover, #menu .menu-admin .section-new .menuItems .selected a {
|
||||
background-position:0 -28px;
|
||||
}
|
@ -24,9 +24,13 @@
|
||||
<h2 class="contribute">Contribute back.</h2>
|
||||
<p>Help grow Orchard. We encourage contributions of all sorts, including code submissions, documentation, translations, feature recommendations, and more.Here are some ways to <a href="http://orchardproject.net/contribution" target="_blank">give back to the project</a>.</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<h2 class="advisory">@T("Advisory from <a href=\"{0}\">{0}</a>", "http://www.orchardproject.net/advisory")</h2>
|
||||
<iframe id="advisory" src="http://www.orchardproject.net/advisory" frameborder="0" height="40" width="100%" scrolling="no">
|
||||
<div class="help-item">
|
||||
<h2 class="advisory">@T("Stay up to date.")</h2>
|
||||
<iframe id="advisory" src="http://www.orchardproject.net/advisory" frameborder="0" height="100%" width="100%" scrolling="no">
|
||||
<p>@T("Your browser does not support iframes. You can't see advisory messages.")</p>
|
||||
</iframe>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
ViewData.TemplateInfo.GetFullHtmlFieldId(fieldNameStart + "IsSelected"),
|
||||
partSelection.PartDisplayName,
|
||||
Html.Hidden(fieldNameStart + "PartName", partSelection.PartName)));
|
||||
|
||||
},
|
||||
"available-parts")
|
||||
</fieldset>
|
||||
|
@ -192,7 +192,7 @@ namespace Orchard.DesignerTools.Services {
|
||||
|
||||
private static string FormatJsonValue(string value) {
|
||||
// replace " by \" in json strings
|
||||
return value.Replace(@"\", @"\\").Replace("\"", @"\""").Replace("\r\n", @"\n").Replace("\n", @"\n");
|
||||
return value.Replace(@"\", @"\\").Replace("\"", @"\""").Replace("\r\n", @"\n").Replace("\r", @"\n").Replace("\n", @"\n");
|
||||
}
|
||||
|
||||
private static string FormatShapeFilename(string shape, string shapeType, string displayType, string themePrefix, string extension) {
|
||||
|
@ -38,20 +38,19 @@ namespace Orchard.Packaging.Services {
|
||||
}
|
||||
|
||||
public override IQueryable<IPackage> GetPackages() {
|
||||
IEnumerable<IPackage> repositoryPackages = SourceRepository.GetPackages().ToList();
|
||||
IEnumerable<IPackage> packages = from extension in _extensionManager.AvailableExtensions()
|
||||
let id = PackageBuilder.BuildPackageId(extension.Id, extension.ExtensionType)
|
||||
let version = Version.Parse(extension.Version)
|
||||
let package = SourceRepository.FindPackage(id, version)
|
||||
let package = repositoryPackages.FirstOrDefault(p => p.Id == id && p.Version == version)
|
||||
where package != null
|
||||
select package;
|
||||
|
||||
return packages.AsQueryable();
|
||||
}
|
||||
|
||||
public override void AddPackage(IPackage package) {
|
||||
}
|
||||
public override void AddPackage(IPackage package) {}
|
||||
|
||||
public override void RemovePackage(IPackage package) {
|
||||
}
|
||||
public override void RemovePackage(IPackage package) {}
|
||||
}
|
||||
}
|
||||
|
@ -73,22 +73,15 @@ namespace Orchard.Packaging.Services {
|
||||
.SelectMany(
|
||||
source => {
|
||||
var galleryFeedContext = new GalleryFeedContext(new Uri(source.FeedUrl));
|
||||
IQueryable<PublishedPackage> packages = galleryFeedContext.Packages;
|
||||
|
||||
IQueryable<PublishedPackage> packages = includeScreenshots
|
||||
? galleryFeedContext.Packages.Expand("Screenshots")
|
||||
: galleryFeedContext.Packages;
|
||||
|
||||
if (query != null) {
|
||||
packages = query(packages);
|
||||
}
|
||||
|
||||
return packages.ToList().Select(
|
||||
p => {
|
||||
PublishedScreenshot firstScreenshot = includeScreenshots
|
||||
? galleryFeedContext.Screenshots
|
||||
.Where(s => s.PublishedPackageId == p.Id && s.PublishedPackageVersion == p.Version)
|
||||
.ToList()
|
||||
.FirstOrDefault()
|
||||
: null;
|
||||
return CreatePackageEntry(p, firstScreenshot, packagingSource, galleryFeedContext.GetReadStreamUri(p));
|
||||
});
|
||||
return packages.ToList().Select(p => CreatePackageEntry(p, packagingSource, galleryFeedContext.GetReadStreamUri(p)));
|
||||
}
|
||||
);
|
||||
}
|
||||
@ -116,12 +109,14 @@ namespace Orchard.Packaging.Services {
|
||||
|
||||
#endregion
|
||||
|
||||
private static PackagingEntry CreatePackageEntry(PublishedPackage package, PublishedScreenshot screenshot, PackagingSource source, Uri downloadUri) {
|
||||
private static PackagingEntry CreatePackageEntry(PublishedPackage package, PackagingSource source, Uri downloadUri) {
|
||||
Uri baseUri = new Uri(string.Format("{0}://{1}:{2}/",
|
||||
downloadUri.Scheme,
|
||||
downloadUri.Host,
|
||||
downloadUri.Port));
|
||||
|
||||
PublishedScreenshot screenshot = package.Screenshots != null ? package.Screenshots.FirstOrDefault() : null;
|
||||
|
||||
string iconUrl = GetAbsoluteUri(package.IconUrl, baseUri);
|
||||
string firstScreenshot = screenshot != null ? GetAbsoluteUri(screenshot.ScreenshotUri, baseUri) : string.Empty;
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
Script.Require("Switchable");
|
||||
Style.Require("Switchable");
|
||||
IEnumerable<LayerPart> layers = Model.Layers;
|
||||
var returnUrl = ViewContext.RequestContext.HttpContext.Request.ToUrlString();
|
||||
var returnUrl = Request.RawUrl;
|
||||
}
|
||||
<div id="widgets-layers-control" class="widgets-container">
|
||||
@if (layers.Count() > 0) {
|
||||
|
@ -3,7 +3,7 @@
|
||||
@{
|
||||
Style.Require("WidgetsAdmin");
|
||||
IEnumerable<WidgetPart> widgets = Model.OrphanWidgets;
|
||||
var returnUrl = ViewContext.RequestContext.HttpContext.Request.ToUrlString();
|
||||
var returnUrl = Request.RawUrl;
|
||||
}
|
||||
@if (widgets.Count() > 0) {
|
||||
<div id="widgets-orphans" class="widgets-container widgets-listed message-Warning">
|
||||
|
@ -4,7 +4,7 @@
|
||||
Style.Require("WidgetsAdmin");
|
||||
IEnumerable<WidgetPart> widgets = Model.Widgets;
|
||||
IEnumerable<string> zones = Model.Zones;
|
||||
var returnUrl = ViewContext.RequestContext.HttpContext.Request.ToUrlString();
|
||||
var returnUrl = Request.RawUrl;
|
||||
}
|
||||
<ol>
|
||||
@foreach (string zone in zones) {
|
||||
|
@ -5,7 +5,7 @@
|
||||
IEnumerable<WidgetPart> widgets = Model.Widgets;
|
||||
IEnumerable<string> zones = Model.Zones;
|
||||
IEnumerable<string> orphanZones = Model.OrphanZones;
|
||||
var returnUrl = ViewContext.RequestContext.HttpContext.Request.ToUrlString();
|
||||
var returnUrl = Request.RawUrl;
|
||||
}
|
||||
<div id="widgets-placement">
|
||||
<div id="widgets-layers" class="widgets-container detail-view switchable">
|
||||
|
BIN
src/Orchard.Web/Themes/TheAdmin/Styles/images/icon-advisory.png
Normal file
BIN
src/Orchard.Web/Themes/TheAdmin/Styles/images/icon-advisory.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 764 B |
@ -119,7 +119,8 @@ body {
|
||||
padding:0;
|
||||
}
|
||||
|
||||
iframe {border:1px solid #eee;}
|
||||
/*Hide shape tracing*/
|
||||
#shape-tracing-container {display:none;}
|
||||
|
||||
/* Headings */
|
||||
h1,h2,h3,h4,h5,h6 { font-weight: normal;}
|
||||
@ -1085,14 +1086,9 @@ fieldset.delete-button {
|
||||
|
||||
.dashboard .help-item h2
|
||||
{
|
||||
background-color: #dee0e1;
|
||||
padding: 6px;
|
||||
font-size: 16px;
|
||||
}
|
||||
.dashboard h2.advisory
|
||||
{
|
||||
font-size: 16px;
|
||||
}
|
||||
.dashboard .help-item h2.gallery
|
||||
{
|
||||
background: #f1f1f2 url('images/icon-gallery.png') no-repeat 5px 50%;
|
||||
@ -1123,6 +1119,11 @@ fieldset.delete-button {
|
||||
padding-left: 40px;
|
||||
}
|
||||
|
||||
.dashboard .help-item h2.advisory
|
||||
{
|
||||
background: #f1f1f2 url('images/icon-advisory.png') no-repeat 5px 50%;
|
||||
padding-left: 40px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -55,6 +55,12 @@
|
||||
<Content Include="TheAdmin\Styles\ie7.css" />
|
||||
<Content Include="TheAdmin\Styles\ie8.css" />
|
||||
<Content Include="TheAdmin\Styles\images\adminNavBackground.gif" />
|
||||
<Content Include="TheAdmin\Styles\images\icon-advisory.png" />
|
||||
<Content Include="TheAdmin\Styles\images\icon-contribute.png" />
|
||||
<Content Include="TheAdmin\Styles\images\icon-docs.png" />
|
||||
<Content Include="TheAdmin\Styles\images\icon-friends.png" />
|
||||
<Content Include="TheAdmin\Styles\images\icon-gallery.png" />
|
||||
<Content Include="TheAdmin\Styles\images\icon-settings.png" />
|
||||
<Content Include="TheAdmin\Styles\images\info.gif" />
|
||||
<Content Include="TheAdmin\Styles\images\menu-default.png" />
|
||||
<Content Include="TheAdmin\Styles\images\menu-glyph.png" />
|
||||
|
Loading…
Reference in New Issue
Block a user