Replacing Module/Theme/Core strings.

--HG--
branch : dev
This commit is contained in:
Andre Rodrigues 2010-12-01 17:37:11 -08:00
parent 3c9b2c8489
commit f3f518b0db
35 changed files with 104 additions and 108 deletions

View File

@ -2,6 +2,7 @@
using Orchard.Environment.Configuration;
using Orchard.Environment.Descriptor;
using Orchard.Environment.Descriptor.Models;
using Orchard.Environment.Extensions.Models;
using Orchard.Specs.Hosting.Orchard.Web;
using TechTalk.SpecFlow;
@ -20,9 +21,9 @@ namespace Orchard.Specs.Bindings {
webApp.GivenIHaveACleanSiteWith(
virtualDirectory,
TableData(
new { extension = "module", names = "Orchard.Setup, Orchard.Pages, Orchard.Blogs, Orchard.Messaging, Orchard.Modules, Orchard.Packaging, Orchard.PublishLater, Orchard.Themes, Orchard.Scripting, Orchard.Widgets, Orchard.Users, Orchard.Roles, Orchard.Comments, Orchard.jQuery, Orchard.Tags, TinyMce" },
new { extension = "core", names = "Common, Dashboard, Feeds, HomePage, Navigation, Contents, Routable, Scheduling, Settings, Shapes, XmlRpc" },
new { extension = "theme", names = "SafeMode, TheAdmin, TheThemeMachine" }));
new { extension = 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 = DefaultExtensionTypes.Core, names = "Common, Dashboard, Feeds, HomePage, Navigation, Contents, Routable, Scheduling, Settings, Shapes, XmlRpc" },
new { extension = DefaultExtensionTypes.Theme, names = "SafeMode, TheAdmin, TheThemeMachine" }));
webApp.WhenIGoTo("Setup");

View File

@ -7,6 +7,7 @@ using HtmlAgilityPack;
using log4net.Appender;
using log4net.Core;
using NUnit.Framework;
using Orchard.Environment.Extensions.Models;
using Orchard.Specs.Hosting;
using TechTalk.SpecFlow;
using Path = Bleroy.FluentPath.Path;
@ -140,13 +141,13 @@ namespace Orchard.Specs.Bindings {
foreach (var row in table.Rows) {
foreach (var name in row["names"].Split(',').Select(x => x.Trim())) {
switch (row["extension"]) {
case "core":
case DefaultExtensionTypes.Core:
GivenIHaveCore(name);
break;
case "module":
case DefaultExtensionTypes.Module:
GivenIHaveModule(name);
break;
case "theme":
case DefaultExtensionTypes.Theme:
GivenIHaveTheme(name);
break;
default:

View File

@ -6,9 +6,9 @@ Feature: Setup
Scenario: Root request shows setup form
Given I have a clean site with
| extension | names |
| 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 |
| theme | SafeMode |
| 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 |
| Theme | SafeMode |
When I go to "/Default.aspx"
Then I should see "Welcome to Orchard"
And I should see "Finish Setup"
@ -17,9 +17,9 @@ 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.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 |
| theme | SafeMode |
| 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 |
| Theme | SafeMode |
When I go to "/Setup"
Then I should see "Welcome to Orchard"
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
Given I have a clean site with
| extension | names |
| 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 |
| theme | SafeMode |
| 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 |
| Theme | SafeMode |
When I go to "/Setup"
And I hit "Finish Setup"
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
Given I have a clean site with
| 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 |
| core | Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, Settings, Shapes, XmlRpc |
| theme | SafeMode, TheThemeMachine |
| 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 |
| Theme | SafeMode, TheThemeMachine |
And I am on "/Setup"
When I fill in
| name | value |

View File

@ -65,15 +65,15 @@ this.ScenarioSetup(scenarioInfo);
"extension",
"names"});
table1.AddRow(new string[] {
"module",
"Module",
"Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Messaging, Or" +
"chard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce"});
table1.AddRow(new string[] {
"core",
"Core",
"Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, S" +
"ettings, Shapes, XmlRpc"});
table1.AddRow(new string[] {
"theme",
"Theme",
"SafeMode"});
#line 7
testRunner.Given("I have a clean site with", ((string)(null)), table1);
@ -101,15 +101,15 @@ this.ScenarioSetup(scenarioInfo);
"extension",
"names"});
table2.AddRow(new string[] {
"module",
"Module",
"Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Messaging, Or" +
"chard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce"});
table2.AddRow(new string[] {
"core",
"Core",
"Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, S" +
"ettings, Shapes, XmlRpc"});
table2.AddRow(new string[] {
"theme",
"Theme",
"SafeMode"});
#line 18
testRunner.Given("I have a clean site with", ((string)(null)), table2);
@ -137,15 +137,15 @@ this.ScenarioSetup(scenarioInfo);
"extension",
"names"});
table3.AddRow(new string[] {
"module",
"Module",
"Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Messaging, Or" +
"chard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard.jQuery, TinyMce"});
table3.AddRow(new string[] {
"core",
"Core",
"Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, S" +
"ettings, Shapes, XmlRpc"});
table3.AddRow(new string[] {
"theme",
"Theme",
"SafeMode"});
#line 29
testRunner.Given("I have a clean site with", ((string)(null)), table3);
@ -175,16 +175,16 @@ this.ScenarioSetup(scenarioInfo);
"extension",
"names"});
table4.AddRow(new string[] {
"module",
"Module",
"Orchard.Setup, Orchard.Pages, Orchard.Users, Orchard.Roles, Orchard.Messaging, Or" +
"chard.Scripting, Orchard.Comments, Orchard.PublishLater, Orchard.Themes, Orchard" +
".Modules, Orchard.Widgets, Orchard.jQuery, TinyMce"});
table4.AddRow(new string[] {
"core",
"Core",
"Common, Contents, Dashboard, Feeds, HomePage, Navigation, Routable, Scheduling, S" +
"ettings, Shapes, XmlRpc"});
table4.AddRow(new string[] {
"theme",
"Theme",
"SafeMode, TheThemeMachine"});
#line 40
testRunner.Given("I have a clean site with", ((string)(null)), table4);

View File

@ -123,7 +123,7 @@ Features:
public IEnumerable<ExtensionDescriptor> AvailableExtensions() {
foreach (var e in Manifests) {
string name = e.Key;
yield return ExtensionFolders.GetDescriptorForExtension("~/", name, "Module", Manifests[name]);
yield return ExtensionFolders.GetDescriptorForExtension("~/", name, DefaultExtensionTypes.Module, Manifests[name]);
}
}
}

View File

@ -1,12 +1,8 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Packaging;
using System.Linq;
using System.Text;
using Autofac;
using NUnit.Framework;
using Orchard.Environment.Extensions;
using Orchard.Environment.Extensions.Models;
using Orchard.FileSystems.WebSite;
using Orchard.Packaging.Services;
@ -30,7 +26,7 @@ namespace Orchard.Tests.Modules.Packaging {
}
return packageBuilder.BuildPackage(new ExtensionDescriptor {
ExtensionType = "Module",
ExtensionType = DefaultExtensionTypes.Module,
Id = "Hello.World",
Version = "1.0",
Description = "a",

View File

@ -1,12 +1,6 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Packaging;
using System.Linq;
using System.Text;
using System.IO;
using Autofac;
using NUnit.Framework;
using Orchard.Environment.Extensions;
using Orchard.Environment.Extensions.Models;
using Orchard.FileSystems.VirtualPath;
using Orchard.FileSystems.WebSite;
@ -27,7 +21,7 @@ namespace Orchard.Tests.Modules.Packaging {
private Stream BuildHelloWorld(IPackageBuilder packageBuilder) {
return packageBuilder.BuildPackage(new ExtensionDescriptor {
ExtensionType = "Module",
ExtensionType = DefaultExtensionTypes.Module,
Id = "Hello.World",
Version = "1.0",
Description = "a",

View File

@ -90,7 +90,7 @@ namespace Orchard.Tests.DataMigration {
public IEnumerable<ExtensionDescriptor> AvailableExtensions() {
foreach (var e in Manifests) {
string name = e.Key;
yield return ExtensionFolders.GetDescriptorForExtension("~/", name, "Module", Manifests[name]);
yield return ExtensionFolders.GetDescriptorForExtension("~/", name, DefaultExtensionTypes.Module, Manifests[name]);
}
}
}

View File

@ -21,14 +21,14 @@ namespace Orchard.Tests.DisplayManagement.Descriptors {
Id = "Theme1",
Extension = new ExtensionDescriptor {
Id = "Theme1",
ExtensionType = "Theme"
ExtensionType = DefaultExtensionTypes.Theme
}
},
new FeatureDescriptor {
Id = "DerivedTheme",
Extension = new ExtensionDescriptor {
Id = "DerivedTheme",
ExtensionType = "Theme",
ExtensionType = DefaultExtensionTypes.Theme,
BaseTheme = "BaseTheme"
}
},
@ -36,7 +36,7 @@ namespace Orchard.Tests.DisplayManagement.Descriptors {
Id = "BaseTheme",
Extension = new ExtensionDescriptor {
Id = "BaseTheme",
ExtensionType = "Theme"
ExtensionType = DefaultExtensionTypes.Theme
}
}
};
@ -69,7 +69,7 @@ namespace Orchard.Tests.DisplayManagement.Descriptors {
Dependencies = Enumerable.Empty<string>(),
Extension = new ExtensionDescriptor {
Id = "Testing",
ExtensionType = "Module",
ExtensionType = DefaultExtensionTypes.Module,
}
}
};

View File

@ -19,7 +19,7 @@ namespace Orchard.Tests.DisplayManagement.Descriptors {
public class ShapeAttributeBindingStrategyTests : ContainerTestBase {
private Feature _testFeature;
protected override void Register([NotNull] Autofac.ContainerBuilder builder) {
protected override void Register([NotNull] ContainerBuilder builder) {
if (builder == null) {
throw new ArgumentNullException("builder");
}
@ -29,7 +29,7 @@ namespace Orchard.Tests.DisplayManagement.Descriptors {
Id = "Testing",
Extension = new ExtensionDescriptor {
Id = "Testing",
ExtensionType = "Module",
ExtensionType = DefaultExtensionTypes.Module,
}
}
};

View File

@ -28,7 +28,7 @@ namespace Orchard.Tests.DisplayManagement {
Extension = new ExtensionDescriptor
{
Id = "Testing",
ExtensionType = "Module",
ExtensionType = DefaultExtensionTypes.Module,
}
}
};

View File

@ -23,7 +23,7 @@ namespace Orchard.Tests.Environment.Extensions {
[SetUp]
public void Init() {
var builder = new ContainerBuilder();
_folders = new StubFolders("Module");
_folders = new StubFolders(DefaultExtensionTypes.Module);
builder.RegisterInstance(_folders).As<IExtensionFolders>();
builder.RegisterType<ExtensionManager>().As<IExtensionManager>();
builder.RegisterType<StubCacheManager>().As<ICacheManager>();
@ -254,7 +254,7 @@ Features:
[Test]
public void ExtensionManagerShouldLoadFeatures() {
var extensionLoader = new StubLoaders();
var extensionFolder = new StubFolders("Module");
var extensionFolder = new StubFolders(DefaultExtensionTypes.Module);
extensionFolder.Manifests.Add("TestModule", @"
Name: TestModule
@ -280,7 +280,7 @@ Features:
[Test]
public void ExtensionManagerFeaturesContainNonAbstractClasses() {
var extensionLoader = new StubLoaders();
var extensionFolder = new StubFolders("Module");
var extensionFolder = new StubFolders(DefaultExtensionTypes.Module);
extensionFolder.Manifests.Add("TestModule", @"
Name: TestModule
@ -315,7 +315,7 @@ Features:
[Test]
public void ExtensionManagerTestFeatureAttribute() {
var extensionLoader = new StubLoaders();
var extensionFolder = new StubFolders("Module");
var extensionFolder = new StubFolders(DefaultExtensionTypes.Module);
extensionFolder.Manifests.Add("TestModule", @"
Name: TestModule
@ -345,7 +345,7 @@ Features:
[Test]
public void ExtensionManagerLoadFeatureReturnsTypesFromSpecificFeaturesWithFeatureAttribute() {
var extensionLoader = new StubLoaders();
var extensionFolder = new StubFolders("Module");
var extensionFolder = new StubFolders(DefaultExtensionTypes.Module);
extensionFolder.Manifests.Add("TestModule", @"
Name: TestModule
@ -373,7 +373,7 @@ Features:
[Test]
public void ExtensionManagerLoadFeatureDoesNotReturnTypesFromNonMatchingFeatures() {
var extensionLoader = new StubLoaders();
var extensionFolder = new StubFolders("Module");
var extensionFolder = new StubFolders(DefaultExtensionTypes.Module);
extensionFolder.Manifests.Add("TestModule", @"
Name: TestModule
@ -402,7 +402,7 @@ Features:
[Test]
public void ModuleNameIsIntroducedAsFeatureImplicitly() {
var extensionLoader = new StubLoaders();
var extensionFolder = new StubFolders("Module");
var extensionFolder = new StubFolders(DefaultExtensionTypes.Module);
extensionFolder.Manifests.Add("Minimalistic", @"
Name: Minimalistic
@ -421,7 +421,7 @@ OrchardVersion: 1
[Test]
public void ThemeNameIsIntroducedAsFeatureImplicitly() {
var extensionLoader = new StubLoaders();
var extensionFolder = new StubFolders("Theme");
var extensionFolder = new StubFolders(DefaultExtensionTypes.Theme);
extensionFolder.Manifests.Add("Minimalistic", @"
Name: Minimalistic

View File

@ -41,7 +41,7 @@ namespace Orchard.Tests.Environment.Extensions {
}
public StubFolders()
: this("Module") {
: this(DefaultExtensionTypes.Module) {
}
public IDictionary<string, string> Manifests { get; set; }
@ -459,7 +459,7 @@ Features:
public void FeatureDescriptorsShouldBeLoadedInThemes() {
var extensionLoader = new StubLoaders();
var moduleExtensionFolder = new StubFolders();
var themeExtensionFolder = new StubFolders("Theme");
var themeExtensionFolder = new StubFolders(DefaultExtensionTypes.Theme);
moduleExtensionFolder.Manifests.Add("Alpha", @"
Name: Alpha
@ -499,7 +499,7 @@ OrchardVersion: 1
public void ThemeFeatureDescriptorsShouldBeAbleToDependOnModules() {
var extensionLoader = new StubLoaders();
var moduleExtensionFolder = new StubFolders();
var themeExtensionFolder = new StubFolders("Theme");
var themeExtensionFolder = new StubFolders(DefaultExtensionTypes.Theme);
moduleExtensionFolder.Manifests.Add("Alpha", @"
Name: Alpha

View File

@ -4,13 +4,12 @@ using System.Globalization;
using System.IO;
using System.Linq;
using System.Web.Hosting;
using Orchard.CodeGeneration.Services;
using Orchard.Commands;
using Orchard.Data.Migration.Generator;
using Orchard.CodeGeneration.Services;
using Orchard.Data.Migration.Schema;
using Orchard.Environment.Extensions;
using Orchard.Environment.Extensions.Models;
using Orchard.Localization;
namespace Orchard.CodeGeneration.Commands {
@ -52,7 +51,7 @@ namespace Orchard.CodeGeneration.Commands {
public bool CreateDataMigration(string 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)));
if (extensionDescriptor == null) {
@ -137,7 +136,7 @@ namespace Orchard.CodeGeneration.Commands {
else {
if (!string.IsNullOrEmpty(BasedOn)) {
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))) {
Context.Output.WriteLine(T("Creating Theme {0} failed: base theme named {1} was not found.", themeName, BasedOn));
return;
@ -153,7 +152,7 @@ namespace Orchard.CodeGeneration.Commands {
public void CreateController(string moduleName, string controllerName) {
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));
if (extensionDescriptor == null) {

View File

@ -4,6 +4,7 @@ using System.Web.Mvc;
using Orchard.Data.Migration;
using Orchard.Environment.Descriptor.Models;
using Orchard.Environment.Extensions;
using Orchard.Environment.Extensions.Models;
using Orchard.Environment.Features;
using Orchard.Localization;
using Orchard.Modules.Services;
@ -46,7 +47,7 @@ namespace Orchard.Modules.Controllers {
if (!Services.Authorizer.Authorize(Permissions.ManageModules, T("Not allowed to manage modules")))
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 {
Modules = modules,
@ -60,7 +61,7 @@ namespace Orchard.Modules.Controllers {
var featuresThatNeedUpdate = _dataMigrationManager.GetFeaturesThatNeedUpdate();
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,
IsEnabled=_shellDescriptor.Features.Any(sf=>sf.Name==f.Id),
NeedsUpdate=featuresThatNeedUpdate.Contains(f.Id)})

View File

@ -19,20 +19,16 @@ namespace Orchard.Modules.Services {
}
public class ModuleService : IModuleService {
private const string ModuleExtensionType = "module";
private readonly IExtensionManager _extensionManager;
private readonly IShellDescriptorManager _shellDescriptorManager;
private readonly IWorkContextAccessor _workContextAccessor;
public ModuleService(
IOrchardServices orchardServices,
IExtensionManager extensionManager,
IShellDescriptorManager shellDescriptorManager,
IWorkContextAccessor workContextAccessor) {
IShellDescriptorManager shellDescriptorManager) {
Services = orchardServices;
_extensionManager = extensionManager;
_shellDescriptorManager = shellDescriptorManager;
_workContextAccessor = workContextAccessor;
T = NullLocalizer.Instance;
}

View File

@ -47,7 +47,7 @@ namespace Orchard.Packaging.Services {
EmbedProjectFiles(context, "Compile", "Content", "None", "EmbeddedResource");
EmbedReferenceFiles(context);
}
else if (extensionDescriptor.ExtensionType == "Theme") {
else if (extensionDescriptor.ExtensionType == DefaultExtensionTypes.Theme) {
// this is a simple theme with no csproj
EmbedThemeFiles(context);
}
@ -141,7 +141,7 @@ namespace Orchard.Packaging.Services {
private static void EstablishPaths(CreateContext context, IWebSiteFolder webSiteFolder, string locationPath, string moduleName, string moduleType) {
context.SourceFolder = webSiteFolder;
if (moduleType == "Theme") {
if (moduleType == DefaultExtensionTypes.Theme) {
context.SourcePath = "~/Themes/" + moduleName + "/";
context.TargetPath = "\\Content\\Themes\\" + moduleName + "\\";
}

View File

@ -2,6 +2,7 @@ using System;
using System.IO;
using NuGet;
using Orchard.Environment.Extensions;
using Orchard.Environment.Extensions.Models;
using Orchard.FileSystems.AppData;
using Orchard.Localization;
using Orchard.UI.Notify;
@ -94,7 +95,7 @@ namespace Orchard.Packaging.Services {
{
ExtensionName = package.Title ?? package.Id,
ExtensionVersion = package.Version.ToString(),
ExtensionType = package.Id.StartsWith("Orchard.Theme") ? "Theme" : "Module",
ExtensionType = package.Id.StartsWith("Orchard.Theme") ? DefaultExtensionTypes.Theme : DefaultExtensionTypes.Module,
ExtensionPath = applicationPath
};
}

View File

@ -5,6 +5,7 @@ using System.Web.Mvc;
using Orchard.Data.Migration;
using Orchard.Environment.Descriptor.Models;
using Orchard.Environment.Extensions;
using Orchard.Environment.Extensions.Models;
using Orchard.Environment.Features;
using Orchard.Localization;
using Orchard.Reports.Services;
@ -58,7 +59,7 @@ namespace Orchard.Themes.Controllers {
var featuresThatNeedUpdate = _dataMigrationManager.GetFeaturesThatNeedUpdate();
var themes = _extensionManager.AvailableExtensions()
.Where(d => d.ExtensionType == "Theme")
.Where(d => d.ExtensionType == DefaultExtensionTypes.Theme)
.Select(d => new ThemeEntry {
Descriptor = d,
NeedsUpdate = featuresThatNeedUpdate.Contains(d.Id),

View File

@ -1,25 +1,22 @@
using System.Linq;
using System.Web.Mvc;
using Orchard.DisplayManagement;
using Orchard.Environment.Extensions.Models;
using Orchard.Environment.Features;
using Orchard.Mvc.Filters;
using Orchard.Themes.ViewModels;
namespace Orchard.Themes.Preview {
public class PreviewThemeFilter : FilterProvider, IResultFilter {
private readonly IThemeManager _themeManager;
private readonly IPreviewTheme _previewTheme;
private readonly IWorkContextAccessor _workContextAccessor;
private readonly dynamic _shapeFactory;
private readonly IFeatureManager _featureManager;
public PreviewThemeFilter(
IThemeManager themeManager,
IPreviewTheme previewTheme,
IWorkContextAccessor workContextAccessor,
IShapeFactory shapeFactory,
IFeatureManager featureManager) {
_themeManager = themeManager;
_previewTheme = previewTheme;
_workContextAccessor = workContextAccessor;
_shapeFactory = shapeFactory;
@ -33,7 +30,7 @@ namespace Orchard.Themes.Preview {
var installedThemes = _featureManager.GetEnabledFeatures()
.Select(x => x.Extension)
.Where(x => x.ExtensionType == "Theme")
.Where(x => x.ExtensionType == DefaultExtensionTypes.Theme)
.Distinct();
var themeListItems = installedThemes

View File

@ -110,7 +110,7 @@ namespace Orchard.Themes.Services {
var themes = new List<ExtensionDescriptor>();
foreach (var descriptor in extensions) {
if (!string.Equals(descriptor.ExtensionType, "Theme", StringComparison.OrdinalIgnoreCase)) {
if (!string.Equals(descriptor.ExtensionType, DefaultExtensionTypes.Theme, StringComparison.OrdinalIgnoreCase)) {
continue;
}

View File

@ -2,4 +2,4 @@
public interface IRuleManager : IDependency {
bool Matches(string expression);
}
}
}

View File

@ -2,5 +2,4 @@
public interface IRuleProvider : IDependency {
void Process(RuleContext ruleContext);
}
}
}

View File

@ -4,4 +4,4 @@
public object[] Arguments { get; set; }
public object Result { get; set; }
}
}
}

View File

@ -3,6 +3,7 @@ using System.Linq;
using JetBrains.Annotations;
using Orchard.ContentManagement;
using Orchard.ContentManagement.Aspects;
using Orchard.Environment.Extensions.Models;
using Orchard.Environment.Features;
using Orchard.Widgets.Models;
@ -42,7 +43,7 @@ namespace Orchard.Widgets.Services {
public IEnumerable<string> GetZones() {
return _featureManager.GetEnabledFeatures()
.Select(x => x.Extension)
.Where(x => x.ExtensionType == "Theme")
.Where(x => x.ExtensionType == DefaultExtensionTypes.Theme)
.SelectMany(x => x.Zones.Split(','))
.Distinct()
.Select(x => x.Trim())

View File

@ -66,12 +66,11 @@ namespace Orchard.DisplayManagement.Descriptors {
}
var extensionType = alteration.Feature.Descriptor.Extension.ExtensionType;
if (extensionType == "Module") {
if (extensionType == DefaultExtensionTypes.Module) {
return true;
}
if (extensionType == "Theme") {
if (extensionType == DefaultExtensionTypes.Theme) {
// alterations from themes must be from the given theme or a base theme
var featureName = alteration.Feature.Descriptor.Id;
return featureName == themeName || IsBaseTheme(featureName, themeName);

View File

@ -102,7 +102,7 @@ namespace Orchard.DisplayManagement.Descriptors.ShapePlacementStrategy {
}
private bool FeatureIsTheme(FeatureDescriptor fd) {
return fd.Extension.ExtensionType == "Theme";
return fd.Extension.ExtensionType == DefaultExtensionTypes.Theme;
}
private bool FeatureIsEnabled(FeatureDescriptor fd) {

View File

@ -87,7 +87,7 @@ namespace Orchard.DisplayManagement.Descriptors.ShapeTemplateStrategy {
}
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);
}

View File

@ -156,7 +156,7 @@ namespace Orchard.Environment.Extensions {
private ExtensionLoadingContext CreateLoadingContext() {
var availableExtensions = _extensionManager
.AvailableExtensions()
.Where(d => d.ExtensionType == "Module" || d.ExtensionType == "Theme")
.Where(d => d.ExtensionType == DefaultExtensionTypes.Module || d.ExtensionType == DefaultExtensionTypes.Theme)
.OrderBy(d => d.Id)
.ToList();
@ -293,7 +293,7 @@ namespace Orchard.Environment.Extensions {
monitor(_virtualPathMonitor.WhenPathChanges("~/Themes"));
// 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 loader in _loaders) {
loader.Monitor(extension, monitor);
@ -301,4 +301,4 @@ namespace Orchard.Environment.Extensions {
}
}
}
}
}

View File

@ -49,13 +49,14 @@ namespace Orchard.Environment.Extensions {
/// <param name="subject"></param>
/// <returns></returns>
internal static bool HasDependency(FeatureDescriptor item, FeatureDescriptor subject) {
if (item.Extension.ExtensionType == "Theme") {
// Themes implicitly depend on modules to ensure build and override ordering
if (subject.Extension.ExtensionType == "Module") {
if (item.Extension.ExtensionType == DefaultExtensionTypes.Theme) {
if (subject.Extension.ExtensionType == DefaultExtensionTypes.Module) {
// Themes implicitly depend on modules to ensure build and override ordering
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;
}
}

View File

@ -25,7 +25,7 @@ namespace Orchard.Environment.Extensions.Folders {
IWebSiteFolder webSiteFolder) {
_paths = paths;
_manifestName = manifestName;
_extensionType = manifestName == "Theme.txt" ? "Theme" : "Module";
_extensionType = manifestName == "Theme.txt" ? DefaultExtensionTypes.Theme : DefaultExtensionTypes.Module;
_manifestIsOptional = manifestIsOptional;
_cacheManager = cacheManager;
_webSiteFolder = webSiteFolder;

View File

@ -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";
}
}

View File

@ -13,7 +13,7 @@ namespace Orchard.Environment.Extensions.Models {
public string Id { get; set; }
/// <summary>
/// "Theme" or "Module"
/// The extension type.
/// </summary>
public string ExtensionType { get; set; }
@ -26,7 +26,7 @@ namespace Orchard.Environment.Extensions.Models {
public string WebSite { get; set; }
public string Tags { get; set; }
public string AntiForgery { get; set; }
public string Zones { get; set; }
public string Zones { get; set; }
public string BaseTheme { get; set; }
public IEnumerable<FeatureDescriptor> Features { get; set; }

View File

@ -6,6 +6,7 @@ using System.Text;
using Orchard.Caching;
using Orchard.Environment.Configuration;
using Orchard.Environment.Extensions;
using Orchard.Environment.Extensions.Models;
using Orchard.FileSystems.WebSite;
namespace Orchard.Localization.Services {
@ -112,7 +113,7 @@ namespace Orchard.Localization.Services {
}
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);
text = _webSiteFolder.ReadFile(modulePath);
if (text != null) {
@ -123,7 +124,7 @@ namespace Orchard.Localization.Services {
}
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);
text = _webSiteFolder.ReadFile(themePath);
if (text != null) {

View File

@ -153,6 +153,7 @@
<Compile Include="DisplayManagement\Implementation\IShapeDisplayEvents.cs" />
<Compile Include="DisplayManagement\Implementation\IShapeFactoryEvents.cs" />
<Compile Include="DisplayManagement\Shapes\ITagBuilderFactory.cs" />
<Compile Include="Environment\Extensions\Models\DefaultExtensionTypes.cs" />
<Compile Include="Environment\HostEnvironment.cs" />
<Compile Include="Environment\DefaultHostEnvironment.cs" />
<Compile Include="Environment\Extensions\Loaders\RawThemeExtensionLoader.cs" />