mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Replacing Module/Theme/Core strings.
--HG-- branch : dev
This commit is contained in:
@@ -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) {
|
||||
|
@@ -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)})
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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 + "\\";
|
||||
}
|
||||
|
@@ -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
|
||||
};
|
||||
}
|
||||
|
@@ -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),
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -2,4 +2,4 @@
|
||||
public interface IRuleManager : IDependency {
|
||||
bool Matches(string expression);
|
||||
}
|
||||
}
|
||||
}
|
@@ -2,5 +2,4 @@
|
||||
public interface IRuleProvider : IDependency {
|
||||
void Process(RuleContext ruleContext);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -4,4 +4,4 @@
|
||||
public object[] Arguments { get; set; }
|
||||
public object Result { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
@@ -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())
|
||||
|
Reference in New Issue
Block a user