mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-07-16 01:44:26 +08:00
Replacing Module/Theme/Core strings.
--HG-- branch : dev
This commit is contained in:
parent
3c9b2c8489
commit
f3f518b0db
@ -2,6 +2,7 @@
|
|||||||
using Orchard.Environment.Configuration;
|
using Orchard.Environment.Configuration;
|
||||||
using Orchard.Environment.Descriptor;
|
using Orchard.Environment.Descriptor;
|
||||||
using Orchard.Environment.Descriptor.Models;
|
using Orchard.Environment.Descriptor.Models;
|
||||||
|
using Orchard.Environment.Extensions.Models;
|
||||||
using Orchard.Specs.Hosting.Orchard.Web;
|
using Orchard.Specs.Hosting.Orchard.Web;
|
||||||
using TechTalk.SpecFlow;
|
using TechTalk.SpecFlow;
|
||||||
|
|
||||||
@ -20,9 +21,9 @@ namespace Orchard.Specs.Bindings {
|
|||||||
webApp.GivenIHaveACleanSiteWith(
|
webApp.GivenIHaveACleanSiteWith(
|
||||||
virtualDirectory,
|
virtualDirectory,
|
||||||
TableData(
|
TableData(
|
||||||
new { extension = "module", names = "Orchard.Setup, Orchard.Pages, Orchard.Blogs, Orchard.Messaging, Orchard.Modules, Orchard.Packaging, Orchard.PublishLater, Orchard.Themes, Orchard.Scripting, Orchard.Widgets, Orchard.Users, Orchard.Roles, Orchard.Comments, Orchard.jQuery, Orchard.Tags, TinyMce" },
|
new { extension = DefaultExtensionTypes.Module, names = "Orchard.Setup, Orchard.Pages, Orchard.Blogs, Orchard.Messaging, Orchard.Modules, Orchard.Packaging, Orchard.PublishLater, Orchard.Themes, Orchard.Scripting, Orchard.Widgets, Orchard.Users, Orchard.Roles, Orchard.Comments, Orchard.jQuery, Orchard.Tags, TinyMce" },
|
||||||
new { extension = "core", names = "Common, Dashboard, Feeds, HomePage, Navigation, Contents, Routable, Scheduling, Settings, Shapes, XmlRpc" },
|
new { extension = DefaultExtensionTypes.Core, names = "Common, Dashboard, Feeds, HomePage, Navigation, Contents, Routable, Scheduling, Settings, Shapes, XmlRpc" },
|
||||||
new { extension = "theme", names = "SafeMode, TheAdmin, TheThemeMachine" }));
|
new { extension = DefaultExtensionTypes.Theme, names = "SafeMode, TheAdmin, TheThemeMachine" }));
|
||||||
|
|
||||||
webApp.WhenIGoTo("Setup");
|
webApp.WhenIGoTo("Setup");
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@ using HtmlAgilityPack;
|
|||||||
using log4net.Appender;
|
using log4net.Appender;
|
||||||
using log4net.Core;
|
using log4net.Core;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
|
using Orchard.Environment.Extensions.Models;
|
||||||
using Orchard.Specs.Hosting;
|
using Orchard.Specs.Hosting;
|
||||||
using TechTalk.SpecFlow;
|
using TechTalk.SpecFlow;
|
||||||
using Path = Bleroy.FluentPath.Path;
|
using Path = Bleroy.FluentPath.Path;
|
||||||
@ -140,13 +141,13 @@ namespace Orchard.Specs.Bindings {
|
|||||||
foreach (var row in table.Rows) {
|
foreach (var row in table.Rows) {
|
||||||
foreach (var name in row["names"].Split(',').Select(x => x.Trim())) {
|
foreach (var name in row["names"].Split(',').Select(x => x.Trim())) {
|
||||||
switch (row["extension"]) {
|
switch (row["extension"]) {
|
||||||
case "core":
|
case DefaultExtensionTypes.Core:
|
||||||
GivenIHaveCore(name);
|
GivenIHaveCore(name);
|
||||||
break;
|
break;
|
||||||
case "module":
|
case DefaultExtensionTypes.Module:
|
||||||
GivenIHaveModule(name);
|
GivenIHaveModule(name);
|
||||||
break;
|
break;
|
||||||
case "theme":
|
case DefaultExtensionTypes.Theme:
|
||||||
GivenIHaveTheme(name);
|
GivenIHaveTheme(name);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -6,9 +6,9 @@ Feature: Setup
|
|||||||
Scenario: Root request shows setup form
|
Scenario: Root request shows setup form
|
||||||
Given I have a clean site with
|
Given I have a clean site with
|
||||||
| extension | names |
|
| extension | names |
|
||||||
| module | Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Messaging, Orchard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce |
|
| Module | Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Messaging, Orchard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce |
|
||||||
| core | Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, Settings, Shapes, XmlRpc |
|
| Core | Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, Settings, Shapes, XmlRpc |
|
||||||
| theme | SafeMode |
|
| Theme | SafeMode |
|
||||||
When I go to "/Default.aspx"
|
When I go to "/Default.aspx"
|
||||||
Then I should see "Welcome to Orchard"
|
Then I should see "Welcome to Orchard"
|
||||||
And I should see "Finish Setup"
|
And I should see "Finish Setup"
|
||||||
@ -17,9 +17,9 @@ Scenario: Root request shows setup form
|
|||||||
Scenario: Setup folder also shows setup form
|
Scenario: Setup folder also shows setup form
|
||||||
Given I have a clean site with
|
Given I have a clean site with
|
||||||
| extension | names |
|
| extension | names |
|
||||||
| module | Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Messaging, Orchard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce |
|
| Module | Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Messaging, Orchard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce |
|
||||||
| core | Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, Settings, Shapes, XmlRpc |
|
| Core | Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, Settings, Shapes, XmlRpc |
|
||||||
| theme | SafeMode |
|
| Theme | SafeMode |
|
||||||
When I go to "/Setup"
|
When I go to "/Setup"
|
||||||
Then I should see "Welcome to Orchard"
|
Then I should see "Welcome to Orchard"
|
||||||
And I should see "Finish Setup"
|
And I should see "Finish Setup"
|
||||||
@ -28,9 +28,9 @@ Scenario: Setup folder also shows setup form
|
|||||||
Scenario: Some of the initial form values are required
|
Scenario: Some of the initial form values are required
|
||||||
Given I have a clean site with
|
Given I have a clean site with
|
||||||
| extension | names |
|
| extension | names |
|
||||||
| module | Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Messaging, Orchard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce |
|
| Module | Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Messaging, Orchard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce |
|
||||||
| core | Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, Settings, Shapes, XmlRpc |
|
| Core | Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, Settings, Shapes, XmlRpc |
|
||||||
| theme | SafeMode |
|
| Theme | SafeMode |
|
||||||
When I go to "/Setup"
|
When I go to "/Setup"
|
||||||
And I hit "Finish Setup"
|
And I hit "Finish Setup"
|
||||||
Then I should see "<input autofocus="autofocus" class="input-validation-error" id="SiteName" name="SiteName" type="text" value="" />"
|
Then I should see "<input autofocus="autofocus" class="input-validation-error" id="SiteName" name="SiteName" type="text" value="" />"
|
||||||
@ -39,9 +39,9 @@ Scenario: Some of the initial form values are required
|
|||||||
Scenario: Calling setup on a brand new install
|
Scenario: Calling setup on a brand new install
|
||||||
Given I have a clean site with
|
Given I have a clean site with
|
||||||
| extension | names |
|
| extension | names |
|
||||||
| module | Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Messaging, Orchard.Scripting, Orchard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.Modules, Orchard.Widgets, Orchard.jQuery, TinyMce |
|
| Module | Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Messaging, Orchard.Scripting, Orchard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.Modules, Orchard.Widgets, Orchard.jQuery, TinyMce |
|
||||||
| core | Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, Settings, Shapes, XmlRpc |
|
| Core | Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, Settings, Shapes, XmlRpc |
|
||||||
| theme | SafeMode, TheThemeMachine |
|
| Theme | SafeMode, TheThemeMachine |
|
||||||
And I am on "/Setup"
|
And I am on "/Setup"
|
||||||
When I fill in
|
When I fill in
|
||||||
| name | value |
|
| name | value |
|
||||||
|
24
src/Orchard.Specs/Setup.feature.cs
generated
24
src/Orchard.Specs/Setup.feature.cs
generated
@ -65,15 +65,15 @@ this.ScenarioSetup(scenarioInfo);
|
|||||||
"extension",
|
"extension",
|
||||||
"names"});
|
"names"});
|
||||||
table1.AddRow(new string[] {
|
table1.AddRow(new string[] {
|
||||||
"module",
|
"Module",
|
||||||
"Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Messaging, Or" +
|
"Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Messaging, Or" +
|
||||||
"chard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce"});
|
"chard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce"});
|
||||||
table1.AddRow(new string[] {
|
table1.AddRow(new string[] {
|
||||||
"core",
|
"Core",
|
||||||
"Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, S" +
|
"Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, S" +
|
||||||
"ettings, Shapes, XmlRpc"});
|
"ettings, Shapes, XmlRpc"});
|
||||||
table1.AddRow(new string[] {
|
table1.AddRow(new string[] {
|
||||||
"theme",
|
"Theme",
|
||||||
"SafeMode"});
|
"SafeMode"});
|
||||||
#line 7
|
#line 7
|
||||||
testRunner.Given("I have a clean site with", ((string)(null)), table1);
|
testRunner.Given("I have a clean site with", ((string)(null)), table1);
|
||||||
@ -101,15 +101,15 @@ this.ScenarioSetup(scenarioInfo);
|
|||||||
"extension",
|
"extension",
|
||||||
"names"});
|
"names"});
|
||||||
table2.AddRow(new string[] {
|
table2.AddRow(new string[] {
|
||||||
"module",
|
"Module",
|
||||||
"Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Messaging, Or" +
|
"Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Messaging, Or" +
|
||||||
"chard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce"});
|
"chard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce"});
|
||||||
table2.AddRow(new string[] {
|
table2.AddRow(new string[] {
|
||||||
"core",
|
"Core",
|
||||||
"Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, S" +
|
"Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, S" +
|
||||||
"ettings, Shapes, XmlRpc"});
|
"ettings, Shapes, XmlRpc"});
|
||||||
table2.AddRow(new string[] {
|
table2.AddRow(new string[] {
|
||||||
"theme",
|
"Theme",
|
||||||
"SafeMode"});
|
"SafeMode"});
|
||||||
#line 18
|
#line 18
|
||||||
testRunner.Given("I have a clean site with", ((string)(null)), table2);
|
testRunner.Given("I have a clean site with", ((string)(null)), table2);
|
||||||
@ -137,15 +137,15 @@ this.ScenarioSetup(scenarioInfo);
|
|||||||
"extension",
|
"extension",
|
||||||
"names"});
|
"names"});
|
||||||
table3.AddRow(new string[] {
|
table3.AddRow(new string[] {
|
||||||
"module",
|
"Module",
|
||||||
"Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Messaging, Or" +
|
"Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Messaging, Or" +
|
||||||
"chard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce"});
|
"chard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce"});
|
||||||
table3.AddRow(new string[] {
|
table3.AddRow(new string[] {
|
||||||
"core",
|
"Core",
|
||||||
"Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, S" +
|
"Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, S" +
|
||||||
"ettings, Shapes, XmlRpc"});
|
"ettings, Shapes, XmlRpc"});
|
||||||
table3.AddRow(new string[] {
|
table3.AddRow(new string[] {
|
||||||
"theme",
|
"Theme",
|
||||||
"SafeMode"});
|
"SafeMode"});
|
||||||
#line 29
|
#line 29
|
||||||
testRunner.Given("I have a clean site with", ((string)(null)), table3);
|
testRunner.Given("I have a clean site with", ((string)(null)), table3);
|
||||||
@ -175,16 +175,16 @@ this.ScenarioSetup(scenarioInfo);
|
|||||||
"extension",
|
"extension",
|
||||||
"names"});
|
"names"});
|
||||||
table4.AddRow(new string[] {
|
table4.AddRow(new string[] {
|
||||||
"module",
|
"Module",
|
||||||
"Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Messaging, Or" +
|
"Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Messaging, Or" +
|
||||||
"chard.Scripting, Orchard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard" +
|
"chard.Scripting, Orchard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard" +
|
||||||
".Modules, Orchard.Widgets, Orchard.jQuery, TinyMce"});
|
".Modules, Orchard.Widgets, Orchard.jQuery, TinyMce"});
|
||||||
table4.AddRow(new string[] {
|
table4.AddRow(new string[] {
|
||||||
"core",
|
"Core",
|
||||||
"Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, S" +
|
"Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, S" +
|
||||||
"ettings, Shapes, XmlRpc"});
|
"ettings, Shapes, XmlRpc"});
|
||||||
table4.AddRow(new string[] {
|
table4.AddRow(new string[] {
|
||||||
"theme",
|
"Theme",
|
||||||
"SafeMode, TheThemeMachine"});
|
"SafeMode, TheThemeMachine"});
|
||||||
#line 40
|
#line 40
|
||||||
testRunner.Given("I have a clean site with", ((string)(null)), table4);
|
testRunner.Given("I have a clean site with", ((string)(null)), table4);
|
||||||
|
@ -123,7 +123,7 @@ Features:
|
|||||||
public IEnumerable<ExtensionDescriptor> AvailableExtensions() {
|
public IEnumerable<ExtensionDescriptor> AvailableExtensions() {
|
||||||
foreach (var e in Manifests) {
|
foreach (var e in Manifests) {
|
||||||
string name = e.Key;
|
string name = e.Key;
|
||||||
yield return ExtensionFolders.GetDescriptorForExtension("~/", name, "Module", Manifests[name]);
|
yield return ExtensionFolders.GetDescriptorForExtension("~/", name, DefaultExtensionTypes.Module, Manifests[name]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.IO.Packaging;
|
using System.IO.Packaging;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using Autofac;
|
using Autofac;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Orchard.Environment.Extensions;
|
|
||||||
using Orchard.Environment.Extensions.Models;
|
using Orchard.Environment.Extensions.Models;
|
||||||
using Orchard.FileSystems.WebSite;
|
using Orchard.FileSystems.WebSite;
|
||||||
using Orchard.Packaging.Services;
|
using Orchard.Packaging.Services;
|
||||||
@ -30,7 +26,7 @@ namespace Orchard.Tests.Modules.Packaging {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return packageBuilder.BuildPackage(new ExtensionDescriptor {
|
return packageBuilder.BuildPackage(new ExtensionDescriptor {
|
||||||
ExtensionType = "Module",
|
ExtensionType = DefaultExtensionTypes.Module,
|
||||||
Id = "Hello.World",
|
Id = "Hello.World",
|
||||||
Version = "1.0",
|
Version = "1.0",
|
||||||
Description = "a",
|
Description = "a",
|
||||||
|
@ -1,12 +1,6 @@
|
|||||||
using System;
|
using System.IO;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
|
||||||
using System.IO.Packaging;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using Autofac;
|
using Autofac;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Orchard.Environment.Extensions;
|
|
||||||
using Orchard.Environment.Extensions.Models;
|
using Orchard.Environment.Extensions.Models;
|
||||||
using Orchard.FileSystems.VirtualPath;
|
using Orchard.FileSystems.VirtualPath;
|
||||||
using Orchard.FileSystems.WebSite;
|
using Orchard.FileSystems.WebSite;
|
||||||
@ -27,7 +21,7 @@ namespace Orchard.Tests.Modules.Packaging {
|
|||||||
|
|
||||||
private Stream BuildHelloWorld(IPackageBuilder packageBuilder) {
|
private Stream BuildHelloWorld(IPackageBuilder packageBuilder) {
|
||||||
return packageBuilder.BuildPackage(new ExtensionDescriptor {
|
return packageBuilder.BuildPackage(new ExtensionDescriptor {
|
||||||
ExtensionType = "Module",
|
ExtensionType = DefaultExtensionTypes.Module,
|
||||||
Id = "Hello.World",
|
Id = "Hello.World",
|
||||||
Version = "1.0",
|
Version = "1.0",
|
||||||
Description = "a",
|
Description = "a",
|
||||||
|
@ -90,7 +90,7 @@ namespace Orchard.Tests.DataMigration {
|
|||||||
public IEnumerable<ExtensionDescriptor> AvailableExtensions() {
|
public IEnumerable<ExtensionDescriptor> AvailableExtensions() {
|
||||||
foreach (var e in Manifests) {
|
foreach (var e in Manifests) {
|
||||||
string name = e.Key;
|
string name = e.Key;
|
||||||
yield return ExtensionFolders.GetDescriptorForExtension("~/", name, "Module", Manifests[name]);
|
yield return ExtensionFolders.GetDescriptorForExtension("~/", name, DefaultExtensionTypes.Module, Manifests[name]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,14 +21,14 @@ namespace Orchard.Tests.DisplayManagement.Descriptors {
|
|||||||
Id = "Theme1",
|
Id = "Theme1",
|
||||||
Extension = new ExtensionDescriptor {
|
Extension = new ExtensionDescriptor {
|
||||||
Id = "Theme1",
|
Id = "Theme1",
|
||||||
ExtensionType = "Theme"
|
ExtensionType = DefaultExtensionTypes.Theme
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new FeatureDescriptor {
|
new FeatureDescriptor {
|
||||||
Id = "DerivedTheme",
|
Id = "DerivedTheme",
|
||||||
Extension = new ExtensionDescriptor {
|
Extension = new ExtensionDescriptor {
|
||||||
Id = "DerivedTheme",
|
Id = "DerivedTheme",
|
||||||
ExtensionType = "Theme",
|
ExtensionType = DefaultExtensionTypes.Theme,
|
||||||
BaseTheme = "BaseTheme"
|
BaseTheme = "BaseTheme"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -36,7 +36,7 @@ namespace Orchard.Tests.DisplayManagement.Descriptors {
|
|||||||
Id = "BaseTheme",
|
Id = "BaseTheme",
|
||||||
Extension = new ExtensionDescriptor {
|
Extension = new ExtensionDescriptor {
|
||||||
Id = "BaseTheme",
|
Id = "BaseTheme",
|
||||||
ExtensionType = "Theme"
|
ExtensionType = DefaultExtensionTypes.Theme
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -69,7 +69,7 @@ namespace Orchard.Tests.DisplayManagement.Descriptors {
|
|||||||
Dependencies = Enumerable.Empty<string>(),
|
Dependencies = Enumerable.Empty<string>(),
|
||||||
Extension = new ExtensionDescriptor {
|
Extension = new ExtensionDescriptor {
|
||||||
Id = "Testing",
|
Id = "Testing",
|
||||||
ExtensionType = "Module",
|
ExtensionType = DefaultExtensionTypes.Module,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -19,7 +19,7 @@ namespace Orchard.Tests.DisplayManagement.Descriptors {
|
|||||||
public class ShapeAttributeBindingStrategyTests : ContainerTestBase {
|
public class ShapeAttributeBindingStrategyTests : ContainerTestBase {
|
||||||
private Feature _testFeature;
|
private Feature _testFeature;
|
||||||
|
|
||||||
protected override void Register([NotNull] Autofac.ContainerBuilder builder) {
|
protected override void Register([NotNull] ContainerBuilder builder) {
|
||||||
if (builder == null) {
|
if (builder == null) {
|
||||||
throw new ArgumentNullException("builder");
|
throw new ArgumentNullException("builder");
|
||||||
}
|
}
|
||||||
@ -29,7 +29,7 @@ namespace Orchard.Tests.DisplayManagement.Descriptors {
|
|||||||
Id = "Testing",
|
Id = "Testing",
|
||||||
Extension = new ExtensionDescriptor {
|
Extension = new ExtensionDescriptor {
|
||||||
Id = "Testing",
|
Id = "Testing",
|
||||||
ExtensionType = "Module",
|
ExtensionType = DefaultExtensionTypes.Module,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -28,7 +28,7 @@ namespace Orchard.Tests.DisplayManagement {
|
|||||||
Extension = new ExtensionDescriptor
|
Extension = new ExtensionDescriptor
|
||||||
{
|
{
|
||||||
Id = "Testing",
|
Id = "Testing",
|
||||||
ExtensionType = "Module",
|
ExtensionType = DefaultExtensionTypes.Module,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -23,7 +23,7 @@ namespace Orchard.Tests.Environment.Extensions {
|
|||||||
[SetUp]
|
[SetUp]
|
||||||
public void Init() {
|
public void Init() {
|
||||||
var builder = new ContainerBuilder();
|
var builder = new ContainerBuilder();
|
||||||
_folders = new StubFolders("Module");
|
_folders = new StubFolders(DefaultExtensionTypes.Module);
|
||||||
builder.RegisterInstance(_folders).As<IExtensionFolders>();
|
builder.RegisterInstance(_folders).As<IExtensionFolders>();
|
||||||
builder.RegisterType<ExtensionManager>().As<IExtensionManager>();
|
builder.RegisterType<ExtensionManager>().As<IExtensionManager>();
|
||||||
builder.RegisterType<StubCacheManager>().As<ICacheManager>();
|
builder.RegisterType<StubCacheManager>().As<ICacheManager>();
|
||||||
@ -254,7 +254,7 @@ Features:
|
|||||||
[Test]
|
[Test]
|
||||||
public void ExtensionManagerShouldLoadFeatures() {
|
public void ExtensionManagerShouldLoadFeatures() {
|
||||||
var extensionLoader = new StubLoaders();
|
var extensionLoader = new StubLoaders();
|
||||||
var extensionFolder = new StubFolders("Module");
|
var extensionFolder = new StubFolders(DefaultExtensionTypes.Module);
|
||||||
|
|
||||||
extensionFolder.Manifests.Add("TestModule", @"
|
extensionFolder.Manifests.Add("TestModule", @"
|
||||||
Name: TestModule
|
Name: TestModule
|
||||||
@ -280,7 +280,7 @@ Features:
|
|||||||
[Test]
|
[Test]
|
||||||
public void ExtensionManagerFeaturesContainNonAbstractClasses() {
|
public void ExtensionManagerFeaturesContainNonAbstractClasses() {
|
||||||
var extensionLoader = new StubLoaders();
|
var extensionLoader = new StubLoaders();
|
||||||
var extensionFolder = new StubFolders("Module");
|
var extensionFolder = new StubFolders(DefaultExtensionTypes.Module);
|
||||||
|
|
||||||
extensionFolder.Manifests.Add("TestModule", @"
|
extensionFolder.Manifests.Add("TestModule", @"
|
||||||
Name: TestModule
|
Name: TestModule
|
||||||
@ -315,7 +315,7 @@ Features:
|
|||||||
[Test]
|
[Test]
|
||||||
public void ExtensionManagerTestFeatureAttribute() {
|
public void ExtensionManagerTestFeatureAttribute() {
|
||||||
var extensionLoader = new StubLoaders();
|
var extensionLoader = new StubLoaders();
|
||||||
var extensionFolder = new StubFolders("Module");
|
var extensionFolder = new StubFolders(DefaultExtensionTypes.Module);
|
||||||
|
|
||||||
extensionFolder.Manifests.Add("TestModule", @"
|
extensionFolder.Manifests.Add("TestModule", @"
|
||||||
Name: TestModule
|
Name: TestModule
|
||||||
@ -345,7 +345,7 @@ Features:
|
|||||||
[Test]
|
[Test]
|
||||||
public void ExtensionManagerLoadFeatureReturnsTypesFromSpecificFeaturesWithFeatureAttribute() {
|
public void ExtensionManagerLoadFeatureReturnsTypesFromSpecificFeaturesWithFeatureAttribute() {
|
||||||
var extensionLoader = new StubLoaders();
|
var extensionLoader = new StubLoaders();
|
||||||
var extensionFolder = new StubFolders("Module");
|
var extensionFolder = new StubFolders(DefaultExtensionTypes.Module);
|
||||||
|
|
||||||
extensionFolder.Manifests.Add("TestModule", @"
|
extensionFolder.Manifests.Add("TestModule", @"
|
||||||
Name: TestModule
|
Name: TestModule
|
||||||
@ -373,7 +373,7 @@ Features:
|
|||||||
[Test]
|
[Test]
|
||||||
public void ExtensionManagerLoadFeatureDoesNotReturnTypesFromNonMatchingFeatures() {
|
public void ExtensionManagerLoadFeatureDoesNotReturnTypesFromNonMatchingFeatures() {
|
||||||
var extensionLoader = new StubLoaders();
|
var extensionLoader = new StubLoaders();
|
||||||
var extensionFolder = new StubFolders("Module");
|
var extensionFolder = new StubFolders(DefaultExtensionTypes.Module);
|
||||||
|
|
||||||
extensionFolder.Manifests.Add("TestModule", @"
|
extensionFolder.Manifests.Add("TestModule", @"
|
||||||
Name: TestModule
|
Name: TestModule
|
||||||
@ -402,7 +402,7 @@ Features:
|
|||||||
[Test]
|
[Test]
|
||||||
public void ModuleNameIsIntroducedAsFeatureImplicitly() {
|
public void ModuleNameIsIntroducedAsFeatureImplicitly() {
|
||||||
var extensionLoader = new StubLoaders();
|
var extensionLoader = new StubLoaders();
|
||||||
var extensionFolder = new StubFolders("Module");
|
var extensionFolder = new StubFolders(DefaultExtensionTypes.Module);
|
||||||
|
|
||||||
extensionFolder.Manifests.Add("Minimalistic", @"
|
extensionFolder.Manifests.Add("Minimalistic", @"
|
||||||
Name: Minimalistic
|
Name: Minimalistic
|
||||||
@ -421,7 +421,7 @@ OrchardVersion: 1
|
|||||||
[Test]
|
[Test]
|
||||||
public void ThemeNameIsIntroducedAsFeatureImplicitly() {
|
public void ThemeNameIsIntroducedAsFeatureImplicitly() {
|
||||||
var extensionLoader = new StubLoaders();
|
var extensionLoader = new StubLoaders();
|
||||||
var extensionFolder = new StubFolders("Theme");
|
var extensionFolder = new StubFolders(DefaultExtensionTypes.Theme);
|
||||||
|
|
||||||
extensionFolder.Manifests.Add("Minimalistic", @"
|
extensionFolder.Manifests.Add("Minimalistic", @"
|
||||||
Name: Minimalistic
|
Name: Minimalistic
|
||||||
|
@ -41,7 +41,7 @@ namespace Orchard.Tests.Environment.Extensions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public StubFolders()
|
public StubFolders()
|
||||||
: this("Module") {
|
: this(DefaultExtensionTypes.Module) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public IDictionary<string, string> Manifests { get; set; }
|
public IDictionary<string, string> Manifests { get; set; }
|
||||||
@ -459,7 +459,7 @@ Features:
|
|||||||
public void FeatureDescriptorsShouldBeLoadedInThemes() {
|
public void FeatureDescriptorsShouldBeLoadedInThemes() {
|
||||||
var extensionLoader = new StubLoaders();
|
var extensionLoader = new StubLoaders();
|
||||||
var moduleExtensionFolder = new StubFolders();
|
var moduleExtensionFolder = new StubFolders();
|
||||||
var themeExtensionFolder = new StubFolders("Theme");
|
var themeExtensionFolder = new StubFolders(DefaultExtensionTypes.Theme);
|
||||||
|
|
||||||
moduleExtensionFolder.Manifests.Add("Alpha", @"
|
moduleExtensionFolder.Manifests.Add("Alpha", @"
|
||||||
Name: Alpha
|
Name: Alpha
|
||||||
@ -499,7 +499,7 @@ OrchardVersion: 1
|
|||||||
public void ThemeFeatureDescriptorsShouldBeAbleToDependOnModules() {
|
public void ThemeFeatureDescriptorsShouldBeAbleToDependOnModules() {
|
||||||
var extensionLoader = new StubLoaders();
|
var extensionLoader = new StubLoaders();
|
||||||
var moduleExtensionFolder = new StubFolders();
|
var moduleExtensionFolder = new StubFolders();
|
||||||
var themeExtensionFolder = new StubFolders("Theme");
|
var themeExtensionFolder = new StubFolders(DefaultExtensionTypes.Theme);
|
||||||
|
|
||||||
moduleExtensionFolder.Manifests.Add("Alpha", @"
|
moduleExtensionFolder.Manifests.Add("Alpha", @"
|
||||||
Name: Alpha
|
Name: Alpha
|
||||||
|
@ -4,13 +4,12 @@ using System.Globalization;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web.Hosting;
|
using System.Web.Hosting;
|
||||||
|
using Orchard.CodeGeneration.Services;
|
||||||
using Orchard.Commands;
|
using Orchard.Commands;
|
||||||
using Orchard.Data.Migration.Generator;
|
using Orchard.Data.Migration.Generator;
|
||||||
using Orchard.CodeGeneration.Services;
|
|
||||||
using Orchard.Data.Migration.Schema;
|
using Orchard.Data.Migration.Schema;
|
||||||
using Orchard.Environment.Extensions;
|
using Orchard.Environment.Extensions;
|
||||||
using Orchard.Environment.Extensions.Models;
|
using Orchard.Environment.Extensions.Models;
|
||||||
using Orchard.Localization;
|
|
||||||
|
|
||||||
namespace Orchard.CodeGeneration.Commands {
|
namespace Orchard.CodeGeneration.Commands {
|
||||||
|
|
||||||
@ -52,7 +51,7 @@ namespace Orchard.CodeGeneration.Commands {
|
|||||||
public bool CreateDataMigration(string featureName) {
|
public bool CreateDataMigration(string featureName) {
|
||||||
Context.Output.WriteLine(T("Creating Data Migration for {0}", featureName));
|
Context.Output.WriteLine(T("Creating Data Migration for {0}", featureName));
|
||||||
|
|
||||||
ExtensionDescriptor extensionDescriptor = _extensionManager.AvailableExtensions().FirstOrDefault(extension => extension.ExtensionType == "Module" &&
|
ExtensionDescriptor extensionDescriptor = _extensionManager.AvailableExtensions().FirstOrDefault(extension => extension.ExtensionType == DefaultExtensionTypes.Module &&
|
||||||
extension.Features.Any(feature => String.Equals(feature.Id, featureName, StringComparison.OrdinalIgnoreCase)));
|
extension.Features.Any(feature => String.Equals(feature.Id, featureName, StringComparison.OrdinalIgnoreCase)));
|
||||||
|
|
||||||
if (extensionDescriptor == null) {
|
if (extensionDescriptor == null) {
|
||||||
@ -137,7 +136,7 @@ namespace Orchard.CodeGeneration.Commands {
|
|||||||
else {
|
else {
|
||||||
if (!string.IsNullOrEmpty(BasedOn)) {
|
if (!string.IsNullOrEmpty(BasedOn)) {
|
||||||
if (!_extensionManager.AvailableExtensions().Any(extension =>
|
if (!_extensionManager.AvailableExtensions().Any(extension =>
|
||||||
string.Equals(extension.ExtensionType, "Theme", StringComparison.OrdinalIgnoreCase) &&
|
string.Equals(extension.ExtensionType, DefaultExtensionTypes.Theme, StringComparison.OrdinalIgnoreCase) &&
|
||||||
string.Equals(BasedOn, extension.Id, StringComparison.OrdinalIgnoreCase))) {
|
string.Equals(BasedOn, extension.Id, StringComparison.OrdinalIgnoreCase))) {
|
||||||
Context.Output.WriteLine(T("Creating Theme {0} failed: base theme named {1} was not found.", themeName, BasedOn));
|
Context.Output.WriteLine(T("Creating Theme {0} failed: base theme named {1} was not found.", themeName, BasedOn));
|
||||||
return;
|
return;
|
||||||
@ -153,7 +152,7 @@ namespace Orchard.CodeGeneration.Commands {
|
|||||||
public void CreateController(string moduleName, string controllerName) {
|
public void CreateController(string moduleName, string controllerName) {
|
||||||
Context.Output.WriteLine(T("Creating Controller {0} in Module {1}", controllerName, moduleName));
|
Context.Output.WriteLine(T("Creating Controller {0} in Module {1}", controllerName, moduleName));
|
||||||
|
|
||||||
ExtensionDescriptor extensionDescriptor = _extensionManager.AvailableExtensions().FirstOrDefault(extension => extension.ExtensionType == "Module" &&
|
ExtensionDescriptor extensionDescriptor = _extensionManager.AvailableExtensions().FirstOrDefault(extension => extension.ExtensionType == DefaultExtensionTypes.Module &&
|
||||||
string.Equals(moduleName, extension.Name, StringComparison.OrdinalIgnoreCase));
|
string.Equals(moduleName, extension.Name, StringComparison.OrdinalIgnoreCase));
|
||||||
|
|
||||||
if (extensionDescriptor == null) {
|
if (extensionDescriptor == null) {
|
||||||
|
@ -4,6 +4,7 @@ using System.Web.Mvc;
|
|||||||
using Orchard.Data.Migration;
|
using Orchard.Data.Migration;
|
||||||
using Orchard.Environment.Descriptor.Models;
|
using Orchard.Environment.Descriptor.Models;
|
||||||
using Orchard.Environment.Extensions;
|
using Orchard.Environment.Extensions;
|
||||||
|
using Orchard.Environment.Extensions.Models;
|
||||||
using Orchard.Environment.Features;
|
using Orchard.Environment.Features;
|
||||||
using Orchard.Localization;
|
using Orchard.Localization;
|
||||||
using Orchard.Modules.Services;
|
using Orchard.Modules.Services;
|
||||||
@ -46,7 +47,7 @@ namespace Orchard.Modules.Controllers {
|
|||||||
if (!Services.Authorizer.Authorize(Permissions.ManageModules, T("Not allowed to manage modules")))
|
if (!Services.Authorizer.Authorize(Permissions.ManageModules, T("Not allowed to manage modules")))
|
||||||
return new HttpUnauthorizedResult();
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
var modules = _extensionManager.AvailableExtensions().Where(x => x.ExtensionType == "Module");
|
var modules = _extensionManager.AvailableExtensions().Where(x => x.ExtensionType == DefaultExtensionTypes.Module);
|
||||||
|
|
||||||
return View(new ModulesIndexViewModel {
|
return View(new ModulesIndexViewModel {
|
||||||
Modules = modules,
|
Modules = modules,
|
||||||
@ -60,7 +61,7 @@ namespace Orchard.Modules.Controllers {
|
|||||||
var featuresThatNeedUpdate = _dataMigrationManager.GetFeaturesThatNeedUpdate();
|
var featuresThatNeedUpdate = _dataMigrationManager.GetFeaturesThatNeedUpdate();
|
||||||
|
|
||||||
var features = _featureManager.GetAvailableFeatures()
|
var features = _featureManager.GetAvailableFeatures()
|
||||||
.Where(f => !f.Extension.ExtensionType.Equals("Theme", StringComparison.OrdinalIgnoreCase))
|
.Where(f => !f.Extension.ExtensionType.Equals(DefaultExtensionTypes.Theme, StringComparison.OrdinalIgnoreCase))
|
||||||
.Select(f=>new ModuleFeature{Descriptor=f,
|
.Select(f=>new ModuleFeature{Descriptor=f,
|
||||||
IsEnabled=_shellDescriptor.Features.Any(sf=>sf.Name==f.Id),
|
IsEnabled=_shellDescriptor.Features.Any(sf=>sf.Name==f.Id),
|
||||||
NeedsUpdate=featuresThatNeedUpdate.Contains(f.Id)})
|
NeedsUpdate=featuresThatNeedUpdate.Contains(f.Id)})
|
||||||
|
@ -19,20 +19,16 @@ namespace Orchard.Modules.Services {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class ModuleService : IModuleService {
|
public class ModuleService : IModuleService {
|
||||||
private const string ModuleExtensionType = "module";
|
|
||||||
private readonly IExtensionManager _extensionManager;
|
private readonly IExtensionManager _extensionManager;
|
||||||
private readonly IShellDescriptorManager _shellDescriptorManager;
|
private readonly IShellDescriptorManager _shellDescriptorManager;
|
||||||
private readonly IWorkContextAccessor _workContextAccessor;
|
|
||||||
|
|
||||||
public ModuleService(
|
public ModuleService(
|
||||||
IOrchardServices orchardServices,
|
IOrchardServices orchardServices,
|
||||||
IExtensionManager extensionManager,
|
IExtensionManager extensionManager,
|
||||||
IShellDescriptorManager shellDescriptorManager,
|
IShellDescriptorManager shellDescriptorManager) {
|
||||||
IWorkContextAccessor workContextAccessor) {
|
|
||||||
Services = orchardServices;
|
Services = orchardServices;
|
||||||
_extensionManager = extensionManager;
|
_extensionManager = extensionManager;
|
||||||
_shellDescriptorManager = shellDescriptorManager;
|
_shellDescriptorManager = shellDescriptorManager;
|
||||||
_workContextAccessor = workContextAccessor;
|
|
||||||
T = NullLocalizer.Instance;
|
T = NullLocalizer.Instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,7 +47,7 @@ namespace Orchard.Packaging.Services {
|
|||||||
EmbedProjectFiles(context, "Compile", "Content", "None", "EmbeddedResource");
|
EmbedProjectFiles(context, "Compile", "Content", "None", "EmbeddedResource");
|
||||||
EmbedReferenceFiles(context);
|
EmbedReferenceFiles(context);
|
||||||
}
|
}
|
||||||
else if (extensionDescriptor.ExtensionType == "Theme") {
|
else if (extensionDescriptor.ExtensionType == DefaultExtensionTypes.Theme) {
|
||||||
// this is a simple theme with no csproj
|
// this is a simple theme with no csproj
|
||||||
EmbedThemeFiles(context);
|
EmbedThemeFiles(context);
|
||||||
}
|
}
|
||||||
@ -141,7 +141,7 @@ namespace Orchard.Packaging.Services {
|
|||||||
|
|
||||||
private static void EstablishPaths(CreateContext context, IWebSiteFolder webSiteFolder, string locationPath, string moduleName, string moduleType) {
|
private static void EstablishPaths(CreateContext context, IWebSiteFolder webSiteFolder, string locationPath, string moduleName, string moduleType) {
|
||||||
context.SourceFolder = webSiteFolder;
|
context.SourceFolder = webSiteFolder;
|
||||||
if (moduleType == "Theme") {
|
if (moduleType == DefaultExtensionTypes.Theme) {
|
||||||
context.SourcePath = "~/Themes/" + moduleName + "/";
|
context.SourcePath = "~/Themes/" + moduleName + "/";
|
||||||
context.TargetPath = "\\Content\\Themes\\" + moduleName + "\\";
|
context.TargetPath = "\\Content\\Themes\\" + moduleName + "\\";
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ using System;
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using NuGet;
|
using NuGet;
|
||||||
using Orchard.Environment.Extensions;
|
using Orchard.Environment.Extensions;
|
||||||
|
using Orchard.Environment.Extensions.Models;
|
||||||
using Orchard.FileSystems.AppData;
|
using Orchard.FileSystems.AppData;
|
||||||
using Orchard.Localization;
|
using Orchard.Localization;
|
||||||
using Orchard.UI.Notify;
|
using Orchard.UI.Notify;
|
||||||
@ -94,7 +95,7 @@ namespace Orchard.Packaging.Services {
|
|||||||
{
|
{
|
||||||
ExtensionName = package.Title ?? package.Id,
|
ExtensionName = package.Title ?? package.Id,
|
||||||
ExtensionVersion = package.Version.ToString(),
|
ExtensionVersion = package.Version.ToString(),
|
||||||
ExtensionType = package.Id.StartsWith("Orchard.Theme") ? "Theme" : "Module",
|
ExtensionType = package.Id.StartsWith("Orchard.Theme") ? DefaultExtensionTypes.Theme : DefaultExtensionTypes.Module,
|
||||||
ExtensionPath = applicationPath
|
ExtensionPath = applicationPath
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@ using System.Web.Mvc;
|
|||||||
using Orchard.Data.Migration;
|
using Orchard.Data.Migration;
|
||||||
using Orchard.Environment.Descriptor.Models;
|
using Orchard.Environment.Descriptor.Models;
|
||||||
using Orchard.Environment.Extensions;
|
using Orchard.Environment.Extensions;
|
||||||
|
using Orchard.Environment.Extensions.Models;
|
||||||
using Orchard.Environment.Features;
|
using Orchard.Environment.Features;
|
||||||
using Orchard.Localization;
|
using Orchard.Localization;
|
||||||
using Orchard.Reports.Services;
|
using Orchard.Reports.Services;
|
||||||
@ -58,7 +59,7 @@ namespace Orchard.Themes.Controllers {
|
|||||||
var featuresThatNeedUpdate = _dataMigrationManager.GetFeaturesThatNeedUpdate();
|
var featuresThatNeedUpdate = _dataMigrationManager.GetFeaturesThatNeedUpdate();
|
||||||
|
|
||||||
var themes = _extensionManager.AvailableExtensions()
|
var themes = _extensionManager.AvailableExtensions()
|
||||||
.Where(d => d.ExtensionType == "Theme")
|
.Where(d => d.ExtensionType == DefaultExtensionTypes.Theme)
|
||||||
.Select(d => new ThemeEntry {
|
.Select(d => new ThemeEntry {
|
||||||
Descriptor = d,
|
Descriptor = d,
|
||||||
NeedsUpdate = featuresThatNeedUpdate.Contains(d.Id),
|
NeedsUpdate = featuresThatNeedUpdate.Contains(d.Id),
|
||||||
|
@ -1,25 +1,22 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using Orchard.DisplayManagement;
|
using Orchard.DisplayManagement;
|
||||||
|
using Orchard.Environment.Extensions.Models;
|
||||||
using Orchard.Environment.Features;
|
using Orchard.Environment.Features;
|
||||||
using Orchard.Mvc.Filters;
|
using Orchard.Mvc.Filters;
|
||||||
using Orchard.Themes.ViewModels;
|
|
||||||
|
|
||||||
namespace Orchard.Themes.Preview {
|
namespace Orchard.Themes.Preview {
|
||||||
public class PreviewThemeFilter : FilterProvider, IResultFilter {
|
public class PreviewThemeFilter : FilterProvider, IResultFilter {
|
||||||
private readonly IThemeManager _themeManager;
|
|
||||||
private readonly IPreviewTheme _previewTheme;
|
private readonly IPreviewTheme _previewTheme;
|
||||||
private readonly IWorkContextAccessor _workContextAccessor;
|
private readonly IWorkContextAccessor _workContextAccessor;
|
||||||
private readonly dynamic _shapeFactory;
|
private readonly dynamic _shapeFactory;
|
||||||
private readonly IFeatureManager _featureManager;
|
private readonly IFeatureManager _featureManager;
|
||||||
|
|
||||||
public PreviewThemeFilter(
|
public PreviewThemeFilter(
|
||||||
IThemeManager themeManager,
|
|
||||||
IPreviewTheme previewTheme,
|
IPreviewTheme previewTheme,
|
||||||
IWorkContextAccessor workContextAccessor,
|
IWorkContextAccessor workContextAccessor,
|
||||||
IShapeFactory shapeFactory,
|
IShapeFactory shapeFactory,
|
||||||
IFeatureManager featureManager) {
|
IFeatureManager featureManager) {
|
||||||
_themeManager = themeManager;
|
|
||||||
_previewTheme = previewTheme;
|
_previewTheme = previewTheme;
|
||||||
_workContextAccessor = workContextAccessor;
|
_workContextAccessor = workContextAccessor;
|
||||||
_shapeFactory = shapeFactory;
|
_shapeFactory = shapeFactory;
|
||||||
@ -33,7 +30,7 @@ namespace Orchard.Themes.Preview {
|
|||||||
|
|
||||||
var installedThemes = _featureManager.GetEnabledFeatures()
|
var installedThemes = _featureManager.GetEnabledFeatures()
|
||||||
.Select(x => x.Extension)
|
.Select(x => x.Extension)
|
||||||
.Where(x => x.ExtensionType == "Theme")
|
.Where(x => x.ExtensionType == DefaultExtensionTypes.Theme)
|
||||||
.Distinct();
|
.Distinct();
|
||||||
|
|
||||||
var themeListItems = installedThemes
|
var themeListItems = installedThemes
|
||||||
|
@ -110,7 +110,7 @@ namespace Orchard.Themes.Services {
|
|||||||
var themes = new List<ExtensionDescriptor>();
|
var themes = new List<ExtensionDescriptor>();
|
||||||
foreach (var descriptor in extensions) {
|
foreach (var descriptor in extensions) {
|
||||||
|
|
||||||
if (!string.Equals(descriptor.ExtensionType, "Theme", StringComparison.OrdinalIgnoreCase)) {
|
if (!string.Equals(descriptor.ExtensionType, DefaultExtensionTypes.Theme, StringComparison.OrdinalIgnoreCase)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,4 +3,3 @@
|
|||||||
void Process(RuleContext ruleContext);
|
void Process(RuleContext ruleContext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ using System.Linq;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Orchard.ContentManagement;
|
using Orchard.ContentManagement;
|
||||||
using Orchard.ContentManagement.Aspects;
|
using Orchard.ContentManagement.Aspects;
|
||||||
|
using Orchard.Environment.Extensions.Models;
|
||||||
using Orchard.Environment.Features;
|
using Orchard.Environment.Features;
|
||||||
using Orchard.Widgets.Models;
|
using Orchard.Widgets.Models;
|
||||||
|
|
||||||
@ -42,7 +43,7 @@ namespace Orchard.Widgets.Services {
|
|||||||
public IEnumerable<string> GetZones() {
|
public IEnumerable<string> GetZones() {
|
||||||
return _featureManager.GetEnabledFeatures()
|
return _featureManager.GetEnabledFeatures()
|
||||||
.Select(x => x.Extension)
|
.Select(x => x.Extension)
|
||||||
.Where(x => x.ExtensionType == "Theme")
|
.Where(x => x.ExtensionType == DefaultExtensionTypes.Theme)
|
||||||
.SelectMany(x => x.Zones.Split(','))
|
.SelectMany(x => x.Zones.Split(','))
|
||||||
.Distinct()
|
.Distinct()
|
||||||
.Select(x => x.Trim())
|
.Select(x => x.Trim())
|
||||||
|
@ -66,12 +66,11 @@ namespace Orchard.DisplayManagement.Descriptors {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var extensionType = alteration.Feature.Descriptor.Extension.ExtensionType;
|
var extensionType = alteration.Feature.Descriptor.Extension.ExtensionType;
|
||||||
|
if (extensionType == DefaultExtensionTypes.Module) {
|
||||||
if (extensionType == "Module") {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (extensionType == "Theme") {
|
if (extensionType == DefaultExtensionTypes.Theme) {
|
||||||
// alterations from themes must be from the given theme or a base theme
|
// alterations from themes must be from the given theme or a base theme
|
||||||
var featureName = alteration.Feature.Descriptor.Id;
|
var featureName = alteration.Feature.Descriptor.Id;
|
||||||
return featureName == themeName || IsBaseTheme(featureName, themeName);
|
return featureName == themeName || IsBaseTheme(featureName, themeName);
|
||||||
|
@ -102,7 +102,7 @@ namespace Orchard.DisplayManagement.Descriptors.ShapePlacementStrategy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private bool FeatureIsTheme(FeatureDescriptor fd) {
|
private bool FeatureIsTheme(FeatureDescriptor fd) {
|
||||||
return fd.Extension.ExtensionType == "Theme";
|
return fd.Extension.ExtensionType == DefaultExtensionTypes.Theme;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool FeatureIsEnabled(FeatureDescriptor fd) {
|
private bool FeatureIsEnabled(FeatureDescriptor fd) {
|
||||||
|
@ -87,7 +87,7 @@ namespace Orchard.DisplayManagement.Descriptors.ShapeTemplateStrategy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private bool FeatureIsEnabled(FeatureDescriptor fd) {
|
private bool FeatureIsEnabled(FeatureDescriptor fd) {
|
||||||
return (fd.Extension.ExtensionType == "Theme" && (fd.Id == "TheAdmin" || fd.Id == "SafeMode")) ||
|
return (fd.Extension.ExtensionType == DefaultExtensionTypes.Theme && (fd.Id == "TheAdmin" || fd.Id == "SafeMode")) ||
|
||||||
_shellDescriptor.Features.Any(sf => sf.Name == fd.Id);
|
_shellDescriptor.Features.Any(sf => sf.Name == fd.Id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ namespace Orchard.Environment.Extensions {
|
|||||||
private ExtensionLoadingContext CreateLoadingContext() {
|
private ExtensionLoadingContext CreateLoadingContext() {
|
||||||
var availableExtensions = _extensionManager
|
var availableExtensions = _extensionManager
|
||||||
.AvailableExtensions()
|
.AvailableExtensions()
|
||||||
.Where(d => d.ExtensionType == "Module" || d.ExtensionType == "Theme")
|
.Where(d => d.ExtensionType == DefaultExtensionTypes.Module || d.ExtensionType == DefaultExtensionTypes.Theme)
|
||||||
.OrderBy(d => d.Id)
|
.OrderBy(d => d.Id)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
@ -293,7 +293,7 @@ namespace Orchard.Environment.Extensions {
|
|||||||
monitor(_virtualPathMonitor.WhenPathChanges("~/Themes"));
|
monitor(_virtualPathMonitor.WhenPathChanges("~/Themes"));
|
||||||
|
|
||||||
// Give loaders a chance to monitor any additional changes
|
// Give loaders a chance to monitor any additional changes
|
||||||
var extensions = _extensionManager.AvailableExtensions().Where(d => d.ExtensionType == "Module" || d.ExtensionType == "Theme").ToList();
|
var extensions = _extensionManager.AvailableExtensions().Where(d => d.ExtensionType == DefaultExtensionTypes.Module || d.ExtensionType == DefaultExtensionTypes.Theme).ToList();
|
||||||
foreach (var extension in extensions) {
|
foreach (var extension in extensions) {
|
||||||
foreach (var loader in _loaders) {
|
foreach (var loader in _loaders) {
|
||||||
loader.Monitor(extension, monitor);
|
loader.Monitor(extension, monitor);
|
||||||
|
@ -49,13 +49,14 @@ namespace Orchard.Environment.Extensions {
|
|||||||
/// <param name="subject"></param>
|
/// <param name="subject"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
internal static bool HasDependency(FeatureDescriptor item, FeatureDescriptor subject) {
|
internal static bool HasDependency(FeatureDescriptor item, FeatureDescriptor subject) {
|
||||||
if (item.Extension.ExtensionType == "Theme") {
|
if (item.Extension.ExtensionType == DefaultExtensionTypes.Theme) {
|
||||||
|
if (subject.Extension.ExtensionType == DefaultExtensionTypes.Module) {
|
||||||
// Themes implicitly depend on modules to ensure build and override ordering
|
// Themes implicitly depend on modules to ensure build and override ordering
|
||||||
if (subject.Extension.ExtensionType == "Module") {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (subject.Extension.ExtensionType == "Theme") {
|
|
||||||
// theme depends on another if it is its base theme
|
if (subject.Extension.ExtensionType == DefaultExtensionTypes.Theme) {
|
||||||
|
// Theme depends on another if it is its base theme
|
||||||
return item.Extension.BaseTheme == subject.Id;
|
return item.Extension.BaseTheme == subject.Id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ namespace Orchard.Environment.Extensions.Folders {
|
|||||||
IWebSiteFolder webSiteFolder) {
|
IWebSiteFolder webSiteFolder) {
|
||||||
_paths = paths;
|
_paths = paths;
|
||||||
_manifestName = manifestName;
|
_manifestName = manifestName;
|
||||||
_extensionType = manifestName == "Theme.txt" ? "Theme" : "Module";
|
_extensionType = manifestName == "Theme.txt" ? DefaultExtensionTypes.Theme : DefaultExtensionTypes.Module;
|
||||||
_manifestIsOptional = manifestIsOptional;
|
_manifestIsOptional = manifestIsOptional;
|
||||||
_cacheManager = cacheManager;
|
_cacheManager = cacheManager;
|
||||||
_webSiteFolder = webSiteFolder;
|
_webSiteFolder = webSiteFolder;
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
namespace Orchard.Environment.Extensions.Models {
|
||||||
|
public static class DefaultExtensionTypes {
|
||||||
|
public const string Module = "Module";
|
||||||
|
public const string Theme = "Theme";
|
||||||
|
public const string Core = "Core";
|
||||||
|
}
|
||||||
|
}
|
@ -13,7 +13,7 @@ namespace Orchard.Environment.Extensions.Models {
|
|||||||
public string Id { get; set; }
|
public string Id { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// "Theme" or "Module"
|
/// The extension type.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ExtensionType { get; set; }
|
public string ExtensionType { get; set; }
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ using System.Text;
|
|||||||
using Orchard.Caching;
|
using Orchard.Caching;
|
||||||
using Orchard.Environment.Configuration;
|
using Orchard.Environment.Configuration;
|
||||||
using Orchard.Environment.Extensions;
|
using Orchard.Environment.Extensions;
|
||||||
|
using Orchard.Environment.Extensions.Models;
|
||||||
using Orchard.FileSystems.WebSite;
|
using Orchard.FileSystems.WebSite;
|
||||||
|
|
||||||
namespace Orchard.Localization.Services {
|
namespace Orchard.Localization.Services {
|
||||||
@ -112,7 +113,7 @@ namespace Orchard.Localization.Services {
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach (var module in _extensionManager.AvailableExtensions()) {
|
foreach (var module in _extensionManager.AvailableExtensions()) {
|
||||||
if (String.Equals(module.ExtensionType, "Module")) {
|
if (String.Equals(module.ExtensionType, DefaultExtensionTypes.Module)) {
|
||||||
string modulePath = string.Format(ModulesLocalizationFilePathFormat, module.Id, culture);
|
string modulePath = string.Format(ModulesLocalizationFilePathFormat, module.Id, culture);
|
||||||
text = _webSiteFolder.ReadFile(modulePath);
|
text = _webSiteFolder.ReadFile(modulePath);
|
||||||
if (text != null) {
|
if (text != null) {
|
||||||
@ -123,7 +124,7 @@ namespace Orchard.Localization.Services {
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach (var theme in _extensionManager.AvailableExtensions()) {
|
foreach (var theme in _extensionManager.AvailableExtensions()) {
|
||||||
if (String.Equals(theme.ExtensionType, "Theme")) {
|
if (String.Equals(theme.ExtensionType, DefaultExtensionTypes.Theme)) {
|
||||||
string themePath = string.Format(ThemesLocalizationFilePathFormat, theme.Id, culture);
|
string themePath = string.Format(ThemesLocalizationFilePathFormat, theme.Id, culture);
|
||||||
text = _webSiteFolder.ReadFile(themePath);
|
text = _webSiteFolder.ReadFile(themePath);
|
||||||
if (text != null) {
|
if (text != null) {
|
||||||
|
@ -153,6 +153,7 @@
|
|||||||
<Compile Include="DisplayManagement\Implementation\IShapeDisplayEvents.cs" />
|
<Compile Include="DisplayManagement\Implementation\IShapeDisplayEvents.cs" />
|
||||||
<Compile Include="DisplayManagement\Implementation\IShapeFactoryEvents.cs" />
|
<Compile Include="DisplayManagement\Implementation\IShapeFactoryEvents.cs" />
|
||||||
<Compile Include="DisplayManagement\Shapes\ITagBuilderFactory.cs" />
|
<Compile Include="DisplayManagement\Shapes\ITagBuilderFactory.cs" />
|
||||||
|
<Compile Include="Environment\Extensions\Models\DefaultExtensionTypes.cs" />
|
||||||
<Compile Include="Environment\HostEnvironment.cs" />
|
<Compile Include="Environment\HostEnvironment.cs" />
|
||||||
<Compile Include="Environment\DefaultHostEnvironment.cs" />
|
<Compile Include="Environment\DefaultHostEnvironment.cs" />
|
||||||
<Compile Include="Environment\Extensions\Loaders\RawThemeExtensionLoader.cs" />
|
<Compile Include="Environment\Extensions\Loaders\RawThemeExtensionLoader.cs" />
|
||||||
|
Loading…
Reference in New Issue
Block a user