mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-21 19:34:40 +08:00
Merge branch 'dev' into 1.10
Conflicts: src/Orchard/Orchard.Framework.csproj
This commit is contained in:
Binary file not shown.
@@ -24,7 +24,7 @@ namespace Orchard.Specs.Bindings {
|
||||
webApp.GivenIHaveACleanSiteWith(
|
||||
virtualDirectory,
|
||||
TableData(
|
||||
new { extension = "Module", names = "Lucene, Markdown, Orchard.Alias, Orchard.AntiSpam, Orchard.ArchiveLater, Orchard.Autoroute, Orchard.Azure, Orchard.Blogs, Orchard.Caching, Orchard.CodeGeneration, Orchard.Comments, Orchard.ContentPermissions, Orchard.ContentPicker, Orchard.ContentTypes, Orchard.CustomForms, Orchard.DesignerTools, Orchard.Email, Orchard.Fields, Orchard.Forms, Orchard.ImageEditor, Orchard.ImportExport, Orchard.Indexing, Orchard.JobsQueue, Orchard.Resources, Orchard.Layouts, Orchard.Lists, Orchard.Localization, Orchard.Media, Orchard.MediaLibrary, Orchard.MediaPicker, Orchard.MediaProcessing, Orchard.Migrations, Orchard.Modules, Orchard.MultiTenancy, Orchard.OutputCache, Orchard.Packaging, Orchard.Pages, Orchard.Projections, Orchard.PublishLater, Orchard.Recipes, Orchard.Roles, Orchard.Rules, Orchard.Scripting, Orchard.Scripting.CSharp, Orchard.Scripting.Dlr, Orchard.Search, Orchard.SecureSocketsLayer, Orchard.Setup, Orchard.Tags, Orchard.TaskLease, Orchard.Taxonomies, Orchard.Templates, Orchard.Themes, Orchard.Tokens, Orchard.Users, Orchard.Warmup, Orchard.Widgets, Orchard.Workflows, SysCache, TinyMce, Upgrade" },
|
||||
new { extension = "Module", names = "Lucene, Markdown, Orchard.Alias, Orchard.AntiSpam, Orchard.ArchiveLater, Orchard.Autoroute, Orchard.Azure, Orchard.Blogs, Orchard.Caching, Orchard.CodeGeneration, Orchard.Comments, Orchard.ContentPermissions, Orchard.ContentPicker, Orchard.ContentTypes, Orchard.CustomForms, Orchard.DesignerTools, Orchard.Email, Orchard.Fields, Orchard.Forms, Orchard.ImageEditor, Orchard.ImportExport, Orchard.Indexing, Orchard.JobsQueue, Orchard.Resources, Orchard.Layouts, Orchard.Lists, Orchard.Localization, Orchard.Media, Orchard.MediaLibrary, Orchard.MediaPicker, Orchard.MediaProcessing, Orchard.Migrations, Orchard.Modules, Orchard.MultiTenancy, Orchard.OutputCache, Orchard.Packaging, Orchard.Pages, Orchard.Projections, Orchard.PublishLater, Orchard.Recipes, Orchard.Roles, Orchard.Rules, Orchard.Scripting, Orchard.Scripting.CSharp, Orchard.Scripting.Dlr, Orchard.Search, Orchard.SecureSocketsLayer, Orchard.Setup, Orchard.Tags, Orchard.TaskLease, Orchard.Taxonomies, Orchard.Templates, Orchard.Themes, Orchard.Tokens, Orchard.Users, Orchard.Warmup, Orchard.Widgets, Orchard.Workflows, Orchard.Conditions, SysCache, TinyMce, Upgrade" },
|
||||
new { extension = "Core", names = "Common, Containers, Contents, Dashboard, Feeds, Navigation, Scheduling, Settings, Shapes, Title, XmlRpc" },
|
||||
new { extension = "Theme", names = "SafeMode, TheAdmin, TheThemeMachine" }));
|
||||
|
||||
|
@@ -96,6 +96,12 @@ namespace Orchard.Specs.Hosting {
|
||||
.DeepCopy("*.*", _tempSite.Combine("bin").Combine("amd64"));
|
||||
}
|
||||
|
||||
Log("Copy roslyn binaries");
|
||||
if (_orchardWebPath.Combine("bin").Combine("roslyn").IsDirectory) {
|
||||
_orchardWebPath.Combine("bin").Combine("roslyn")
|
||||
.DeepCopy("*.*", _tempSite.Combine("bin").Combine("roslyn"));
|
||||
}
|
||||
|
||||
// Copy binaries of this project, so that remote execution of lambda
|
||||
// can be achieved through serialization to the ASP.NET appdomain
|
||||
// (see Execute(Action) method)
|
||||
|
@@ -6,7 +6,7 @@ Feature: Setup
|
||||
Scenario: Root request shows setup form
|
||||
Given I have a clean site with
|
||||
| extension | names |
|
||||
| Module | Orchard.Setup, Orchard.Layouts, Orchard.Pages, Orchard.ContentPicker, Orchard.Blogs, Orchard.MediaLibrary, Orchard.Modules, Orchard.Packaging, Orchard.PublishLater, Orchard.Themes, Orchard.Scripting, Orchard.Widgets, Orchard.Users, Orchard.ContentTypes, Orchard.Roles, Orchard.Comments, Orchard.Resources, Orchard.Tags, TinyMce, Orchard.Recipes, Orchard.Warmup, Orchard.Alias, Orchard.Forms, Orchard.Tokens, Orchard.Autoroute, Orchard.Projections, Orchard.Fields, Orchard.MediaProcessing, Orchard.OutputCache, Orchard.Taxonomies, Orchard.Workflows, Orchard.Scripting.CSharp |
|
||||
| Module | Orchard.Setup, Orchard.Layouts, Orchard.Pages, Orchard.ContentPicker, Orchard.Blogs, Orchard.MediaLibrary, Orchard.Modules, Orchard.Packaging, Orchard.PublishLater, Orchard.Themes, Orchard.Scripting, Orchard.Widgets, Orchard.Users, Orchard.ContentTypes, Orchard.Roles, Orchard.Comments, Orchard.Resources, Orchard.Tags, TinyMce, Orchard.Recipes, Orchard.Warmup, Orchard.Alias, Orchard.Forms, Orchard.Tokens, Orchard.Autoroute, Orchard.Projections, Orchard.Fields, Orchard.MediaProcessing, Orchard.OutputCache, Orchard.Taxonomies, Orchard.Workflows, Orchard.Scripting.CSharp, Orchard.Conditions |
|
||||
| Core | Common, Containers, Dashboard, Feeds, Navigation, Contents, Scheduling, Settings, Shapes, XmlRpc, Title |
|
||||
| Theme | SafeMode |
|
||||
When I go to "/"
|
||||
@@ -17,7 +17,7 @@ Scenario: Root request shows setup form
|
||||
Scenario: Setup folder also shows setup form
|
||||
Given I have a clean site with
|
||||
| extension | names |
|
||||
| Module | Orchard.Setup, Orchard.Layouts, Orchard.Pages, Orchard.ContentPicker, Orchard.Blogs, Orchard.MediaLibrary, Orchard.Modules, Orchard.Packaging, Orchard.PublishLater, Orchard.Themes, Orchard.Scripting, Orchard.Widgets, Orchard.Users, Orchard.ContentTypes, Orchard.Roles, Orchard.Comments, Orchard.Resources, Orchard.Tags, TinyMce, Orchard.Recipes, Orchard.Warmup, Orchard.Alias, Orchard.Forms, Orchard.Tokens, Orchard.Autoroute, Orchard.Projections, Orchard.Fields, Orchard.MediaProcessing, Orchard.OutputCache, Orchard.Taxonomies, Orchard.Workflows, Orchard.Scripting.CSharp |
|
||||
| Module | Orchard.Setup, Orchard.Layouts, Orchard.Pages, Orchard.ContentPicker, Orchard.Blogs, Orchard.MediaLibrary, Orchard.Modules, Orchard.Packaging, Orchard.PublishLater, Orchard.Themes, Orchard.Scripting, Orchard.Widgets, Orchard.Users, Orchard.ContentTypes, Orchard.Roles, Orchard.Comments, Orchard.Resources, Orchard.Tags, TinyMce, Orchard.Recipes, Orchard.Warmup, Orchard.Alias, Orchard.Forms, Orchard.Tokens, Orchard.Autoroute, Orchard.Projections, Orchard.Fields, Orchard.MediaProcessing, Orchard.OutputCache, Orchard.Taxonomies, Orchard.Workflows, Orchard.Scripting.CSharp, Orchard.Conditions |
|
||||
| Core | Common, Containers, Dashboard, Feeds, Navigation, Contents, Scheduling, Settings, Shapes, XmlRpc, Title |
|
||||
| Theme | SafeMode |
|
||||
When I go to "/Setup"
|
||||
@@ -28,7 +28,7 @@ Scenario: Setup folder also shows setup form
|
||||
Scenario: Some of the initial form values are required
|
||||
Given I have a clean site with
|
||||
| extension | names |
|
||||
| Module | Orchard.Setup, Orchard.Layouts, Orchard.Pages, Orchard.ContentPicker, Orchard.Blogs, Orchard.MediaLibrary, Orchard.Modules, Orchard.Packaging, Orchard.PublishLater, Orchard.Themes, Orchard.Scripting, Orchard.Widgets, Orchard.Users, Orchard.ContentTypes, Orchard.Roles, Orchard.Comments, Orchard.Resources, Orchard.Tags, TinyMce, Orchard.Recipes, Orchard.Warmup, Orchard.Alias, Orchard.Forms, Orchard.Tokens, Orchard.Autoroute, Orchard.Projections, Orchard.Fields, Orchard.MediaProcessing, Orchard.OutputCache, Orchard.Taxonomies, Orchard.Workflows, Orchard.Scripting.CSharp |
|
||||
| Module | Orchard.Setup, Orchard.Layouts, Orchard.Pages, Orchard.ContentPicker, Orchard.Blogs, Orchard.MediaLibrary, Orchard.Modules, Orchard.Packaging, Orchard.PublishLater, Orchard.Themes, Orchard.Scripting, Orchard.Widgets, Orchard.Users, Orchard.ContentTypes, Orchard.Roles, Orchard.Comments, Orchard.Resources, Orchard.Tags, TinyMce, Orchard.Recipes, Orchard.Warmup, Orchard.Alias, Orchard.Forms, Orchard.Tokens, Orchard.Autoroute, Orchard.Projections, Orchard.Fields, Orchard.MediaProcessing, Orchard.OutputCache, Orchard.Taxonomies, Orchard.Workflows, Orchard.Scripting.CSharp, Orchard.Conditions |
|
||||
| Core | Common, Containers, Dashboard, Feeds, Navigation, Contents, Scheduling, Settings, Shapes, XmlRpc, Title |
|
||||
| Theme | SafeMode |
|
||||
When I go to "/Setup"
|
||||
@@ -40,7 +40,7 @@ Scenario: Some of the initial form values are required
|
||||
Scenario: Calling setup on a brand new install
|
||||
Given I have a clean site with
|
||||
| extension | names |
|
||||
| Module | Orchard.Setup, Orchard.Layouts, Orchard.Pages, Orchard.ContentPicker, Orchard.Blogs, Orchard.MediaLibrary, Orchard.Modules, Orchard.Packaging, Orchard.PublishLater, Orchard.Themes, Orchard.Scripting, Orchard.Widgets, Orchard.Users, Orchard.ContentTypes, Orchard.Roles, Orchard.Comments, Orchard.Resources, Orchard.Tags, TinyMce, Orchard.Recipes, Orchard.Warmup, Orchard.Alias, Orchard.Forms, Orchard.Tokens, Orchard.Autoroute, Orchard.Projections, Orchard.Fields, Orchard.MediaProcessing, Orchard.OutputCache, Orchard.Taxonomies, Orchard.Workflows, Orchard.Scripting.CSharp |
|
||||
| Module | Orchard.Setup, Orchard.Layouts, Orchard.Pages, Orchard.ContentPicker, Orchard.Blogs, Orchard.MediaLibrary, Orchard.Modules, Orchard.Packaging, Orchard.PublishLater, Orchard.Themes, Orchard.Scripting, Orchard.Widgets, Orchard.Users, Orchard.ContentTypes, Orchard.Roles, Orchard.Comments, Orchard.Resources, Orchard.Tags, TinyMce, Orchard.Recipes, Orchard.Warmup, Orchard.Alias, Orchard.Forms, Orchard.Tokens, Orchard.Autoroute, Orchard.Projections, Orchard.Fields, Orchard.MediaProcessing, Orchard.OutputCache, Orchard.Taxonomies, Orchard.Workflows, Orchard.Scripting.CSharp, Orchard.Conditions |
|
||||
| Core | Common, Containers, Dashboard, Feeds, Navigation, Contents, Scheduling, Settings, Shapes, XmlRpc, Title |
|
||||
| Theme | SafeMode, TheAdmin, TheThemeMachine |
|
||||
And I am on "/Setup"
|
||||
|
10
src/Orchard.Specs/Setup.feature.cs
generated
10
src/Orchard.Specs/Setup.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.34014
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
@@ -78,7 +78,7 @@ this.ScenarioSetup(scenarioInfo);
|
||||
"names"});
|
||||
table1.AddRow(new string[] {
|
||||
"Module",
|
||||
@"Orchard.Setup, Orchard.Layouts, Orchard.Pages, Orchard.ContentPicker, Orchard.Blogs, Orchard.MediaLibrary, Orchard.Modules, Orchard.Packaging, Orchard.PublishLater, Orchard.Themes, Orchard.Scripting, Orchard.Widgets, Orchard.Users, Orchard.ContentTypes, Orchard.Roles, Orchard.Comments, Orchard.Resources, Orchard.Tags, TinyMce, Orchard.Recipes, Orchard.Warmup, Orchard.Alias, Orchard.Forms, Orchard.Tokens, Orchard.Autoroute, Orchard.Projections, Orchard.Fields, Orchard.MediaProcessing, Orchard.OutputCache, Orchard.Taxonomies, Orchard.Workflows, Orchard.Scripting.CSharp"});
|
||||
@"Orchard.Setup, Orchard.Layouts, Orchard.Pages, Orchard.ContentPicker, Orchard.Blogs, Orchard.MediaLibrary, Orchard.Modules, Orchard.Packaging, Orchard.PublishLater, Orchard.Themes, Orchard.Scripting, Orchard.Widgets, Orchard.Users, Orchard.ContentTypes, Orchard.Roles, Orchard.Comments, Orchard.Resources, Orchard.Tags, TinyMce, Orchard.Recipes, Orchard.Warmup, Orchard.Alias, Orchard.Forms, Orchard.Tokens, Orchard.Autoroute, Orchard.Projections, Orchard.Fields, Orchard.MediaProcessing, Orchard.OutputCache, Orchard.Taxonomies, Orchard.Workflows, Orchard.Scripting.CSharp, Orchard.Conditions"});
|
||||
table1.AddRow(new string[] {
|
||||
"Core",
|
||||
"Common, Containers, Dashboard, Feeds, Navigation, Contents, Scheduling, Settings," +
|
||||
@@ -113,7 +113,7 @@ this.ScenarioSetup(scenarioInfo);
|
||||
"names"});
|
||||
table2.AddRow(new string[] {
|
||||
"Module",
|
||||
@"Orchard.Setup, Orchard.Layouts, Orchard.Pages, Orchard.ContentPicker, Orchard.Blogs, Orchard.MediaLibrary, Orchard.Modules, Orchard.Packaging, Orchard.PublishLater, Orchard.Themes, Orchard.Scripting, Orchard.Widgets, Orchard.Users, Orchard.ContentTypes, Orchard.Roles, Orchard.Comments, Orchard.Resources, Orchard.Tags, TinyMce, Orchard.Recipes, Orchard.Warmup, Orchard.Alias, Orchard.Forms, Orchard.Tokens, Orchard.Autoroute, Orchard.Projections, Orchard.Fields, Orchard.MediaProcessing, Orchard.OutputCache, Orchard.Taxonomies, Orchard.Workflows, Orchard.Scripting.CSharp"});
|
||||
@"Orchard.Setup, Orchard.Layouts, Orchard.Pages, Orchard.ContentPicker, Orchard.Blogs, Orchard.MediaLibrary, Orchard.Modules, Orchard.Packaging, Orchard.PublishLater, Orchard.Themes, Orchard.Scripting, Orchard.Widgets, Orchard.Users, Orchard.ContentTypes, Orchard.Roles, Orchard.Comments, Orchard.Resources, Orchard.Tags, TinyMce, Orchard.Recipes, Orchard.Warmup, Orchard.Alias, Orchard.Forms, Orchard.Tokens, Orchard.Autoroute, Orchard.Projections, Orchard.Fields, Orchard.MediaProcessing, Orchard.OutputCache, Orchard.Taxonomies, Orchard.Workflows, Orchard.Scripting.CSharp, Orchard.Conditions"});
|
||||
table2.AddRow(new string[] {
|
||||
"Core",
|
||||
"Common, Containers, Dashboard, Feeds, Navigation, Contents, Scheduling, Settings," +
|
||||
@@ -148,7 +148,7 @@ this.ScenarioSetup(scenarioInfo);
|
||||
"names"});
|
||||
table3.AddRow(new string[] {
|
||||
"Module",
|
||||
@"Orchard.Setup, Orchard.Layouts, Orchard.Pages, Orchard.ContentPicker, Orchard.Blogs, Orchard.MediaLibrary, Orchard.Modules, Orchard.Packaging, Orchard.PublishLater, Orchard.Themes, Orchard.Scripting, Orchard.Widgets, Orchard.Users, Orchard.ContentTypes, Orchard.Roles, Orchard.Comments, Orchard.Resources, Orchard.Tags, TinyMce, Orchard.Recipes, Orchard.Warmup, Orchard.Alias, Orchard.Forms, Orchard.Tokens, Orchard.Autoroute, Orchard.Projections, Orchard.Fields, Orchard.MediaProcessing, Orchard.OutputCache, Orchard.Taxonomies, Orchard.Workflows, Orchard.Scripting.CSharp"});
|
||||
@"Orchard.Setup, Orchard.Layouts, Orchard.Pages, Orchard.ContentPicker, Orchard.Blogs, Orchard.MediaLibrary, Orchard.Modules, Orchard.Packaging, Orchard.PublishLater, Orchard.Themes, Orchard.Scripting, Orchard.Widgets, Orchard.Users, Orchard.ContentTypes, Orchard.Roles, Orchard.Comments, Orchard.Resources, Orchard.Tags, TinyMce, Orchard.Recipes, Orchard.Warmup, Orchard.Alias, Orchard.Forms, Orchard.Tokens, Orchard.Autoroute, Orchard.Projections, Orchard.Fields, Orchard.MediaProcessing, Orchard.OutputCache, Orchard.Taxonomies, Orchard.Workflows, Orchard.Scripting.CSharp, Orchard.Conditions"});
|
||||
table3.AddRow(new string[] {
|
||||
"Core",
|
||||
"Common, Containers, Dashboard, Feeds, Navigation, Contents, Scheduling, Settings," +
|
||||
@@ -185,7 +185,7 @@ this.ScenarioSetup(scenarioInfo);
|
||||
"names"});
|
||||
table4.AddRow(new string[] {
|
||||
"Module",
|
||||
@"Orchard.Setup, Orchard.Layouts, Orchard.Pages, Orchard.ContentPicker, Orchard.Blogs, Orchard.MediaLibrary, Orchard.Modules, Orchard.Packaging, Orchard.PublishLater, Orchard.Themes, Orchard.Scripting, Orchard.Widgets, Orchard.Users, Orchard.ContentTypes, Orchard.Roles, Orchard.Comments, Orchard.Resources, Orchard.Tags, TinyMce, Orchard.Recipes, Orchard.Warmup, Orchard.Alias, Orchard.Forms, Orchard.Tokens, Orchard.Autoroute, Orchard.Projections, Orchard.Fields, Orchard.MediaProcessing, Orchard.OutputCache, Orchard.Taxonomies, Orchard.Workflows, Orchard.Scripting.CSharp"});
|
||||
@"Orchard.Setup, Orchard.Layouts, Orchard.Pages, Orchard.ContentPicker, Orchard.Blogs, Orchard.MediaLibrary, Orchard.Modules, Orchard.Packaging, Orchard.PublishLater, Orchard.Themes, Orchard.Scripting, Orchard.Widgets, Orchard.Users, Orchard.ContentTypes, Orchard.Roles, Orchard.Comments, Orchard.Resources, Orchard.Tags, TinyMce, Orchard.Recipes, Orchard.Warmup, Orchard.Alias, Orchard.Forms, Orchard.Tokens, Orchard.Autoroute, Orchard.Projections, Orchard.Fields, Orchard.MediaProcessing, Orchard.OutputCache, Orchard.Taxonomies, Orchard.Workflows, Orchard.Scripting.CSharp, Orchard.Conditions"});
|
||||
table4.AddRow(new string[] {
|
||||
"Core",
|
||||
"Common, Containers, Dashboard, Feeds, Navigation, Contents, Scheduling, Settings," +
|
||||
|
@@ -1,11 +1,11 @@
|
||||
using System;
|
||||
using Autofac;
|
||||
using NUnit.Framework;
|
||||
using Orchard.Conditions.Providers;
|
||||
using Orchard.Conditions.Services;
|
||||
using Orchard.Environment.Configuration;
|
||||
using Orchard.Mvc;
|
||||
using Orchard.Tests.Stubs;
|
||||
using Orchard.Widgets.RuleEngine;
|
||||
|
||||
namespace Orchard.Tests.Modules.Conditions.Providers {
|
||||
[TestFixture]
|
||||
|
@@ -82,20 +82,23 @@ namespace Orchard.AntiSpam.Drivers {
|
||||
ReCaptchaPartResponseModel responseModel = _jsonConverter.Deserialize<ReCaptchaPartResponseModel>(result);
|
||||
|
||||
if (!responseModel.Success) {
|
||||
for (int i = 0; i < responseModel.ErrorCodes.Length; i++) {
|
||||
if (responseModel.ErrorCodes[i] == "missing-input-response") {
|
||||
_notifier.Error(T("The Captcha field is required"));
|
||||
foreach (var errorCode in responseModel.ErrorCodes) {
|
||||
if(errorCode == "missing-input-response") {
|
||||
updater.AddModelError("", T("Please prove that you are not a bot."));
|
||||
_notifier.Error(T("Please prove that you are not a bot."));
|
||||
}
|
||||
else {
|
||||
_notifier.Error(T("There was an error with the Captcha please try again"));
|
||||
Logger.Information("Error occurred while submitting a reCaptcha: " + responseModel.ErrorCodes[i]);
|
||||
Logger.Information("An error occurred while submitting a reCaptcha: " + errorCode);
|
||||
updater.AddModelError("", T("An error occurred while submitting a reCaptcha."));
|
||||
_notifier.Error(T("An error occurred while submitting a reCaptcha."));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
Logger.Error(e, "An unexcepted error occurred while submitting a reCaptcha");
|
||||
updater.AddModelError("Parts_ReCaptcha_Fields", T("There was an error while validating the Captcha image"));
|
||||
Logger.Error(e, "An unexcepted error occurred while submitting a reCaptcha.");
|
||||
updater.AddModelError("", T("There was an error while validating the Captcha."));
|
||||
_notifier.Error(T("There was an error while validating the Captcha."));
|
||||
}
|
||||
|
||||
return Editor(part, shapeHelper);
|
||||
|
@@ -1,10 +1,9 @@
|
||||
using System;
|
||||
using System.Web;
|
||||
using Orchard.Conditions.Services;
|
||||
using Orchard.Environment.Configuration;
|
||||
using Orchard.Mvc;
|
||||
|
||||
namespace Orchard.Widgets.RuleEngine {
|
||||
namespace Orchard.Conditions.Providers {
|
||||
public class UrlCondition : IConditionProvider {
|
||||
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||
private readonly ShellSettings _shellSettings;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
Name: Orchard.ContentPicker
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardcontentpicker.codeplex.com
|
||||
Website: https://github.com/OrchardCMS/Orchard
|
||||
Version: 1.9.2
|
||||
OrchardVersion: 1.9
|
||||
Description: UI for selecting Content Items.
|
||||
@@ -9,4 +9,4 @@ Features:
|
||||
Orchard.ContentPicker:
|
||||
Description: UI for selecting Content Items.
|
||||
Dependencies: Contents, Navigation
|
||||
Category: Input Editor
|
||||
Category: Input Editor
|
||||
|
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
@@ -357,19 +358,23 @@ namespace Orchard.ContentTypes.Services {
|
||||
}
|
||||
|
||||
private static string VersionName(string name) {
|
||||
int version;
|
||||
var nameParts = name.Split(new[] { '-' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
var i = name.Length - 1;
|
||||
while (i >= 0 && char.IsDigit(name, i)) {
|
||||
i--;
|
||||
}
|
||||
|
||||
if (nameParts.Length > 1 && int.TryParse(nameParts.Last(), out version)) {
|
||||
var substring = i != name.Length - 1 ? name.Substring(i + 1) : string.Empty;
|
||||
int version;
|
||||
|
||||
if (int.TryParse(substring, out version)) {
|
||||
name = name.Remove(name.Length - substring.Length);
|
||||
version = version > 0 ? ++version : 2;
|
||||
//this could unintentionally chomp something that looks like a version
|
||||
name = string.Join("-", nameParts.Take(nameParts.Length - 1));
|
||||
}
|
||||
else {
|
||||
version = 2;
|
||||
}
|
||||
|
||||
return string.Format("{0}-{1}", name, version);
|
||||
return name + version;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,7 +1,7 @@
|
||||
Name: Custom Forms
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardcustomforms.codeplex.com
|
||||
Website: https://github.com/OrchardCMS/Orchard
|
||||
Version: 1.9.2
|
||||
OrchardVersion: 1.9
|
||||
LifecycleStatus: Deprecated
|
||||
|
@@ -1,7 +1,7 @@
|
||||
Name: Fields
|
||||
AntiForgery: enabled
|
||||
Author: Antoine Griffard, S<>bastien Ros
|
||||
Website: http://orchardfields.codeplex.com
|
||||
Website: https://github.com/OrchardCMS/Orchard
|
||||
Version: 1.9.2
|
||||
OrchardVersion: 1.9
|
||||
Description: Some content fields
|
||||
|
@@ -1,7 +1,7 @@
|
||||
Name: Forms
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardforms.codeplex.com
|
||||
Website: https://github.com/OrchardCMS/Orchard
|
||||
Version: 1.9.2
|
||||
OrchardVersion: 1.9
|
||||
Description: Provides a system to publish and alter html forms.
|
||||
@@ -9,4 +9,4 @@ Features:
|
||||
Orchard.Forms:
|
||||
Name: Forms
|
||||
Description: Provides a system to publish and alter html forms.
|
||||
Category: Developer
|
||||
Category: Developer
|
||||
|
@@ -9,6 +9,7 @@ using Orchard.Environment.Extensions;
|
||||
using Orchard.Layouts.Elements;
|
||||
using Orchard.Layouts.Framework.Display;
|
||||
using Orchard.Layouts.Framework.Drivers;
|
||||
using Orchard.Layouts.Helpers;
|
||||
using Orchard.Layouts.ViewModels;
|
||||
using Orchard.UI.Navigation;
|
||||
using Orchard.Utility.Extensions;
|
||||
@@ -19,11 +20,18 @@ namespace Orchard.Layouts.Drivers {
|
||||
private readonly IWorkContextAccessor _workContextAccessor;
|
||||
private readonly IMenuService _menuService;
|
||||
private readonly INavigationManager _navigationManager;
|
||||
private readonly IContentManager _contentManager;
|
||||
|
||||
public MenuElementDriver(IMenuService menuService, INavigationManager navigationManager, IWorkContextAccessor workContextAccessor, IShapeFactory shapeFactory) {
|
||||
public MenuElementDriver(
|
||||
IWorkContextAccessor workContextAccessor,
|
||||
IMenuService menuService,
|
||||
INavigationManager navigationManager,
|
||||
IContentManager contentManager,
|
||||
IShapeFactory shapeFactory) {
|
||||
_workContextAccessor = workContextAccessor;
|
||||
_menuService = menuService;
|
||||
_navigationManager = navigationManager;
|
||||
_contentManager = contentManager;
|
||||
New = shapeFactory;
|
||||
}
|
||||
|
||||
@@ -124,5 +132,23 @@ namespace Orchard.Layouts.Drivers {
|
||||
|
||||
context.ElementShape.Menu = menuShape;
|
||||
}
|
||||
|
||||
protected override void OnExporting(Menu element, ExportElementContext context) {
|
||||
var menu = _contentManager.Get(element.MenuContentItemId);
|
||||
var menuIdentity = menu != null ? _contentManager.GetItemMetadata(menu).Identity.ToString() : default(string);
|
||||
|
||||
if (menuIdentity != null)
|
||||
context.ExportableData["MenuId"] = menuIdentity;
|
||||
}
|
||||
|
||||
protected override void OnImporting(Menu element, ImportElementContext context) {
|
||||
var menuIdentity = context.ExportableData.Get("MenuId");
|
||||
var menu = menuIdentity != null ? context.Session.GetItemFromSession(menuIdentity) : default(ContentManagement.ContentItem);
|
||||
|
||||
if (menu == null)
|
||||
return;
|
||||
|
||||
element.MenuContentItemId = menu.Id;
|
||||
}
|
||||
}
|
||||
}
|
@@ -3,33 +3,36 @@ using System.Globalization;
|
||||
using System.Linq;
|
||||
using Orchard.Events;
|
||||
|
||||
namespace Orchard.Localization.RuleEngine {
|
||||
public interface IRuleProvider : IEventHandler {
|
||||
void Process(dynamic ruleContext);
|
||||
namespace Orchard.Localization.Conditions {
|
||||
|
||||
public interface IConditionProvider : IEventHandler {
|
||||
void Evaluate(dynamic evaluationContext);
|
||||
}
|
||||
|
||||
public class CultureRuleProvider : IRuleProvider {
|
||||
public class CultureConditionProvider : IConditionProvider
|
||||
{
|
||||
private readonly WorkContext _workContext;
|
||||
|
||||
public CultureRuleProvider(WorkContext workContext) {
|
||||
public CultureConditionProvider(WorkContext workContext) {
|
||||
_workContext = workContext;
|
||||
}
|
||||
|
||||
public void Process(dynamic ruleContext) {
|
||||
if (String.Equals(ruleContext.FunctionName, "culturecode", StringComparison.OrdinalIgnoreCase)) {
|
||||
ProcessCultureCode(ruleContext);
|
||||
|
||||
public void Evaluate(dynamic evaluationContext)
|
||||
{
|
||||
if (String.Equals(evaluationContext.FunctionName, "culturecode", StringComparison.OrdinalIgnoreCase)) {
|
||||
ProcessCultureCode(evaluationContext);
|
||||
}
|
||||
|
||||
if (String.Equals(ruleContext.FunctionName, "culturelcid", StringComparison.OrdinalIgnoreCase)) {
|
||||
ProcessCultureId(ruleContext);
|
||||
if (String.Equals(evaluationContext.FunctionName, "culturelcid", StringComparison.OrdinalIgnoreCase)) {
|
||||
ProcessCultureId(evaluationContext);
|
||||
}
|
||||
|
||||
if (String.Equals(ruleContext.FunctionName, "cultureisrtl", StringComparison.OrdinalIgnoreCase)) {
|
||||
ProcessCurrentCultureIsRtl(ruleContext);
|
||||
if (String.Equals(evaluationContext.FunctionName, "cultureisrtl", StringComparison.OrdinalIgnoreCase)) {
|
||||
ProcessCurrentCultureIsRtl(evaluationContext);
|
||||
}
|
||||
|
||||
if (String.Equals(ruleContext.FunctionName, "culturelang", StringComparison.OrdinalIgnoreCase)) {
|
||||
ProcessLanguageCode(ruleContext);
|
||||
if (String.Equals(evaluationContext.FunctionName, "culturelang", StringComparison.OrdinalIgnoreCase)) {
|
||||
ProcessLanguageCode(evaluationContext);
|
||||
}
|
||||
}
|
||||
|
@@ -101,7 +101,7 @@
|
||||
<Compile Include="Selectors\RouteCultureSelector.cs" />
|
||||
<Compile Include="Selectors\BrowserCultureSelector.cs" />
|
||||
<Compile Include="Providers\ICultureStorageProvider.cs" />
|
||||
<Compile Include="RuleEngine\CultureRuleProvider.cs" />
|
||||
<Compile Include="Conditions\CultureConditionProvider.cs" />
|
||||
<Compile Include="Services\AdminDirectionalityFactory.cs" />
|
||||
<Compile Include="Services\AdminCultureSelectorFactory.cs" />
|
||||
<Compile Include="Services\LocalizationCultureFilter.cs" />
|
||||
|
@@ -1,7 +1,7 @@
|
||||
Name: Projector
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardprojections.codeplex.com
|
||||
Website: https://github.com/OrchardCMS/Orchard
|
||||
Version: 1.9.2
|
||||
OrchardVersion: 1.9
|
||||
Description: Provides methods to control how lists of content items are filtered and displayed
|
||||
|
@@ -0,0 +1,36 @@
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.Events;
|
||||
using Orchard.Roles.Models;
|
||||
using Orchard.Security;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace Orchard.Roles.Conditions {
|
||||
public interface IConditionProvider : IEventHandler {
|
||||
void Evaluate(dynamic evaluationContext);
|
||||
}
|
||||
|
||||
public class RoleConditionProvider : IConditionProvider {
|
||||
private readonly IAuthenticationService _authenticationService;
|
||||
|
||||
public RoleConditionProvider(IAuthenticationService authenticationService) {
|
||||
_authenticationService = authenticationService;
|
||||
}
|
||||
|
||||
public void Evaluate(dynamic evaluationContext) {
|
||||
if (!String.Equals(evaluationContext.FunctionName, "role", StringComparison.OrdinalIgnoreCase)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var user = _authenticationService.GetAuthenticatedUser();
|
||||
if (user == null) {
|
||||
evaluationContext.Result = false;
|
||||
return;
|
||||
}
|
||||
|
||||
var roles = ((object[])evaluationContext.Arguments).Cast<string>();
|
||||
var userRoles = user.As<IUserRoles>();
|
||||
evaluationContext.Result = userRoles != null && userRoles.Roles.Intersect(roles).Any();
|
||||
}
|
||||
}
|
||||
}
|
@@ -125,7 +125,7 @@
|
||||
<Compile Include="Models\UserRolesPartRecord.cs" />
|
||||
<Compile Include="Permissions.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="RuleEngine\RoleRuleProvider.cs" />
|
||||
<Compile Include="Conditions\RoleCondition.cs" />
|
||||
<Compile Include="Services\IRoleService.cs" />
|
||||
<Compile Include="Services\RolesBasedAuthorizationService.cs" />
|
||||
<Compile Include="Services\RoleService.cs" />
|
||||
|
@@ -1,36 +0,0 @@
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.Events;
|
||||
using Orchard.Roles.Models;
|
||||
using Orchard.Security;
|
||||
using System;
|
||||
using System.Linq;
|
||||
|
||||
namespace Orchard.Roles.RuleEngine {
|
||||
public interface IRuleProvider : IEventHandler {
|
||||
void Process(dynamic ruleContext);
|
||||
}
|
||||
|
||||
public class RoleRuleProvider : IRuleProvider {
|
||||
private readonly IAuthenticationService _authenticationService;
|
||||
|
||||
public RoleRuleProvider(IAuthenticationService authenticationService) {
|
||||
_authenticationService = authenticationService;
|
||||
}
|
||||
|
||||
public void Process(dynamic ruleContext) {
|
||||
if (!String.Equals(ruleContext.FunctionName, "role", StringComparison.OrdinalIgnoreCase)) {
|
||||
return;
|
||||
}
|
||||
|
||||
var user = _authenticationService.GetAuthenticatedUser();
|
||||
if (user == null) {
|
||||
ruleContext.Result = false;
|
||||
return;
|
||||
}
|
||||
|
||||
var roles = ((object[])ruleContext.Arguments).Cast<string>();
|
||||
var userRoles = user.As<IUserRoles>();
|
||||
ruleContext.Result = userRoles != null ? userRoles.Roles.Intersect(roles).Count() > 0 : false;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,7 +1,7 @@
|
||||
Name: Rules
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardrules.codeplex.com
|
||||
Website: https://github.com/OrchardCMS/Orchard
|
||||
Version: 1.8
|
||||
OrchardVersion: 1.9
|
||||
LifecycleStatus: Deprecated
|
||||
|
@@ -54,8 +54,8 @@
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Mono.CSharp, Version=4.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\mono\Mono.CSharp.dll</HintPath>
|
||||
<HintPath>..\..\..\packages\Mono.CSharp.4.0.0.143\lib\4.5\Mono.CSharp.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
|
@@ -4,4 +4,5 @@
|
||||
<package id="Microsoft.AspNet.Razor" version="3.2.3" targetFramework="net451" />
|
||||
<package id="Microsoft.AspNet.WebPages" version="3.2.3" targetFramework="net451" />
|
||||
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net451" />
|
||||
<package id="Mono.CSharp" version="4.0.0.143" targetFramework="net452" />
|
||||
</packages>
|
@@ -1,7 +1,7 @@
|
||||
Name: Task Lease
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardtasklease.codeplex.com
|
||||
Website: https://github.com/OrchardCMS/Orchard
|
||||
Version: 1.9.2
|
||||
OrchardVersion: 1.9
|
||||
LifecycleStatus: Deprecated
|
||||
|
@@ -1,7 +1,7 @@
|
||||
Name: Tokens
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardtokens.codeplex.com
|
||||
Website: https://github.com/OrchardCMS/Orchard
|
||||
Version: 1.9.2
|
||||
OrchardVersion: 1.9
|
||||
Description: Provides a system for performing string replacements with common site values.
|
||||
|
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using Orchard.Conditions.Services;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Widgets.Services;
|
||||
|
||||
namespace Orchard.Widgets.Conditions {
|
||||
/// <summary>
|
||||
/// Evaluates rules implementing the deprecated IRuleProvider (third party modules).
|
||||
/// </summary>
|
||||
[Obsolete("This is here for backwards compatibility during the deprecation period.")]
|
||||
public class LegacyRulesEvaluator : IConditionProvider {
|
||||
private readonly IRuleProvider _ruleProviders;
|
||||
|
||||
public LegacyRulesEvaluator(IRuleProvider ruleProviders)
|
||||
{
|
||||
_ruleProviders = ruleProviders;
|
||||
T = NullLocalizer.Instance;
|
||||
}
|
||||
|
||||
public Localizer T { get; set; }
|
||||
|
||||
public void Evaluate(ConditionEvaluationContext evaluationContext) {
|
||||
var ruleContext = new RuleContext {
|
||||
FunctionName = evaluationContext.FunctionName,
|
||||
Arguments = evaluationContext.Arguments,
|
||||
Result = evaluationContext.Result
|
||||
};
|
||||
|
||||
_ruleProviders.Process(ruleContext);
|
||||
evaluationContext.Result = ruleContext.Result;
|
||||
}
|
||||
}
|
||||
}
|
@@ -93,6 +93,7 @@
|
||||
<Compile Include="AdminMenu.cs" />
|
||||
<Compile Include="Commands\LayerCommands.cs" />
|
||||
<Compile Include="Commands\WidgetCommands.cs" />
|
||||
<Compile Include="Conditions\LegacyRulesEvaluator.cs" />
|
||||
<Compile Include="Controllers\AdminController.cs" />
|
||||
<Compile Include="ControlWrapper.cs" />
|
||||
<Compile Include="Drivers\LayerPartDriver.cs" />
|
||||
|
@@ -1 +1,4 @@
|
||||
<div class="credits"><span class="poweredby">@T("Powered by <a href=\"{0}\" target=\"_blank\">Orchard</a>", "http://www.orchardproject.net")</span> <span class="copyright">@T($"© The Theme Machine {DateTime.Now.Year}.")</span></div>
|
||||
@{
|
||||
var clock = WorkContext.Resolve<Orchard.Services.IClock>();
|
||||
}
|
||||
<div class="credits"><span class="poweredby">@T("Powered by <a href=\"{0}\" target=\"_blank\">Orchard</a>", "http://www.orchardproject.net")</span> <span class="copyright">@T("© The Theme Machine {0}.", clock.UtcNow.Year)</span></div>
|
@@ -76,6 +76,8 @@ namespace Orchard.ContentManagement {
|
||||
((IShape)itemShape).Metadata.Alternates.Add(actualShapeType + "__" + content.ContentItem.ContentType);
|
||||
|
||||
var context = new BuildEditorContext(itemShape, content, groupId, _shapeFactory);
|
||||
var workContext = _workContextAccessor.GetContext(_requestContext.HttpContext);
|
||||
context.Layout = workContext.Layout;
|
||||
BindPlacement(context, null, stereotype);
|
||||
|
||||
_handlers.Value.Invoke(handler => handler.BuildEditor(context), Logger);
|
||||
@@ -104,6 +106,7 @@ namespace Orchard.ContentManagement {
|
||||
((IShape)itemShape).Metadata.Alternates.Add(actualShapeType + "__" + content.ContentItem.ContentType);
|
||||
|
||||
var context = new UpdateEditorContext(itemShape, content, updater, groupInfoId, _shapeFactory, shapeTable, GetPath());
|
||||
context.Layout = workContext.Layout;
|
||||
BindPlacement(context, null, stereotype);
|
||||
|
||||
_handlers.Value.Invoke(handler => handler.UpdateEditor(context), Logger);
|
||||
|
@@ -44,14 +44,23 @@ namespace Orchard.ContentManagement.Drivers {
|
||||
|
||||
DriverResult IContentFieldDriver.UpdateEditorShape(UpdateEditorContext context) {
|
||||
return Process(context.ContentItem, (part, field) => {
|
||||
DriverResult result = Editor(part, field, context.Updater, context.New);
|
||||
// Checking if the editor needs to be updated (e.g. if any of the shapes were not hidden).
|
||||
DriverResult editor = Editor(part, field, context.New);
|
||||
IEnumerable<ContentShapeResult> contentShapeResults = editor.GetShapeResults();
|
||||
|
||||
if (result != null) {
|
||||
result.ContentPart = part;
|
||||
result.ContentField = field;
|
||||
if (contentShapeResults.Any(contentShapeResult =>
|
||||
contentShapeResult == null || contentShapeResult.WasDisplayed(context))) {
|
||||
DriverResult result = Editor(part, field, context.Updater, context.New);
|
||||
|
||||
if (result != null) {
|
||||
result.ContentPart = part;
|
||||
result.ContentField = field;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
return editor;
|
||||
}, context.Logger);
|
||||
}
|
||||
|
||||
|
@@ -6,7 +6,6 @@ using Orchard.ContentManagement.FieldStorage.InfosetStorage;
|
||||
using Orchard.ContentManagement.Handlers;
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
using Orchard.DisplayManagement;
|
||||
using Orchard.DisplayManagement.Descriptors;
|
||||
using Orchard.DisplayManagement.Shapes;
|
||||
using System.Linq;
|
||||
|
||||
@@ -59,44 +58,12 @@ namespace Orchard.ContentManagement.Drivers {
|
||||
return null;
|
||||
}
|
||||
|
||||
// checking if the editor needs to be updated (e.g. if any of the shapes were not hidden)
|
||||
// Checking if the editor needs to be updated (e.g. if any of the shapes were not hidden).
|
||||
DriverResult editor = Editor(part, context.New);
|
||||
IEnumerable<ContentShapeResult> contentShapeResults = GetShapeResults(editor);
|
||||
IEnumerable<ContentShapeResult> contentShapeResults = editor.GetShapeResults();
|
||||
|
||||
if (contentShapeResults.Any(contentShapeResult => {
|
||||
if (contentShapeResult == null) return true;
|
||||
|
||||
ShapeDescriptor descriptor;
|
||||
if (context.ShapeTable.Descriptors.TryGetValue(contentShapeResult.GetShapeType(), out descriptor)) {
|
||||
var placementContext = new ShapePlacementContext {
|
||||
Content = part.ContentItem,
|
||||
ContentType = part.ContentItem.ContentType,
|
||||
Differentiator = contentShapeResult.GetDifferentiator(),
|
||||
DisplayType = null,
|
||||
Path = context.Path
|
||||
};
|
||||
|
||||
var placementInfo = descriptor.Placement(placementContext);
|
||||
|
||||
var location = placementInfo.Location;
|
||||
|
||||
if (String.IsNullOrEmpty(location) || location == "-") {
|
||||
return false;
|
||||
}
|
||||
|
||||
var editorGroup = contentShapeResult.GetGroup();
|
||||
if (string.IsNullOrEmpty(editorGroup)) {
|
||||
editorGroup = placementInfo.GetGroup() ?? "";
|
||||
}
|
||||
var contextGroup = context.GroupId ?? "";
|
||||
|
||||
if (!String.Equals(editorGroup, contextGroup, StringComparison.OrdinalIgnoreCase)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
})) {
|
||||
if (contentShapeResults.Any(contentShapeResult =>
|
||||
contentShapeResult == null || contentShapeResult.WasDisplayed(context))) {
|
||||
DriverResult result = Editor(part, context.Updater, context.New);
|
||||
|
||||
if (result != null) {
|
||||
@@ -109,14 +76,6 @@ namespace Orchard.ContentManagement.Drivers {
|
||||
return editor;
|
||||
}
|
||||
|
||||
private static IEnumerable<ContentShapeResult> GetShapeResults(DriverResult driverResult) {
|
||||
if (driverResult is CombinedResult) {
|
||||
return ((CombinedResult)driverResult).GetResults().Select(result => result as ContentShapeResult);
|
||||
}
|
||||
|
||||
return new[] { driverResult as ContentShapeResult };
|
||||
}
|
||||
|
||||
void IContentPartDriver.Importing(ImportContentContext context) {
|
||||
var part = context.ContentItem.As<TContent>();
|
||||
if (part != null)
|
||||
|
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.ContentManagement.Handlers;
|
||||
using Orchard.DisplayManagement.Shapes;
|
||||
using Orchard.DisplayManagement.Descriptors;
|
||||
|
||||
namespace Orchard.ContentManagement.Drivers {
|
||||
public class ContentShapeResult : DriverResult {
|
||||
@@ -127,5 +128,39 @@ namespace Orchard.ContentManagement.Drivers {
|
||||
public string GetShapeType() {
|
||||
return _shapeType;
|
||||
}
|
||||
|
||||
public bool WasDisplayed(UpdateEditorContext context) {
|
||||
ShapeDescriptor descriptor;
|
||||
if (context.ShapeTable.Descriptors.TryGetValue(_shapeType, out descriptor)) {
|
||||
var placementContext = new ShapePlacementContext {
|
||||
Content = context.ContentItem,
|
||||
ContentType = context.ContentItem.ContentType,
|
||||
Differentiator = _differentiator,
|
||||
DisplayType = null,
|
||||
Path = context.Path
|
||||
};
|
||||
|
||||
var placementInfo = descriptor.Placement(placementContext);
|
||||
|
||||
var location = placementInfo.Location;
|
||||
|
||||
if (String.IsNullOrEmpty(location) || location == "-") {
|
||||
return false;
|
||||
}
|
||||
|
||||
var editorGroup = _groupId;
|
||||
if (String.IsNullOrEmpty(editorGroup)) {
|
||||
editorGroup = placementInfo.GetGroup() ?? "";
|
||||
}
|
||||
|
||||
var contextGroup = context.GroupId ?? "";
|
||||
|
||||
if (!String.Equals(editorGroup, contextGroup, StringComparison.OrdinalIgnoreCase)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,15 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Orchard.ContentManagement.Drivers
|
||||
{
|
||||
internal static class DriverResultExtensions {
|
||||
public static IEnumerable<ContentShapeResult> GetShapeResults(this DriverResult driverResult) {
|
||||
if (driverResult is CombinedResult) {
|
||||
return ((CombinedResult)driverResult).GetResults().Select(result => result as ContentShapeResult);
|
||||
}
|
||||
|
||||
return new[] { driverResult as ContentShapeResult };
|
||||
}
|
||||
}
|
||||
}
|
@@ -168,6 +168,7 @@
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ContentManagement\Extensions\DriverResultExtensions.cs" />
|
||||
<Compile Include="ContentManagement\Handlers\CloneContentContext.cs" />
|
||||
<Compile Include="Environment\Configuration\ExtensionLocations.cs" />
|
||||
<Compile Include="DisplayManagement\IPositioned.cs" />
|
||||
|
Reference in New Issue
Block a user