mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Merge
--HG-- branch : dev
This commit is contained in:
@@ -207,10 +207,29 @@ namespace Orchard.Tests.Modules.Themes.Services {
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<ExtensionDescriptor> EnabledExtensions(ShellDescriptor descriptor) {
|
||||
var extensions = new[] {
|
||||
new ExtensionDescriptor {Name = "ThemeOne", ExtensionType = "Theme"},
|
||||
new ExtensionDescriptor {Name = "ThemeTwo", BaseTheme = "ThemeOne", ExtensionType = "Theme"},
|
||||
new ExtensionDescriptor {Name = "ThemeThree", BaseTheme = "TheThemeThatIsntThere", ExtensionType = "Theme"},
|
||||
new ExtensionDescriptor {Name = "ThemeFourBasedOnFive", BaseTheme = "ThemeFiveBasedOnFour", ExtensionType = "Theme"},
|
||||
new ExtensionDescriptor {Name = "ThemeFiveBasedOnFour", BaseTheme = "ThemeFourBasedOnFive", ExtensionType = "Theme"},
|
||||
};
|
||||
|
||||
foreach (var extension in extensions) {
|
||||
extension.Features = new[] { new FeatureDescriptor { Extension = extension, Name = extension.Name } };
|
||||
yield return extension;
|
||||
}
|
||||
}
|
||||
|
||||
public IEnumerable<FeatureDescriptor> AvailableFeatures() {
|
||||
return AvailableExtensions().SelectMany(ed => ed.Features);
|
||||
}
|
||||
|
||||
public IEnumerable<FeatureDescriptor> EnabledFeatures(ShellDescriptor descriptor) {
|
||||
return AvailableExtensions().SelectMany(ed => ed.Features);
|
||||
}
|
||||
|
||||
public IEnumerable<Feature> LoadFeatures(IEnumerable<FeatureDescriptor> featureDescriptors) {
|
||||
return featureDescriptors.Select(FrameworkFeature);
|
||||
}
|
||||
|
@@ -7,6 +7,7 @@ using NUnit.Framework;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.DisplayManagement.Descriptors;
|
||||
using Orchard.DisplayManagement.Implementation;
|
||||
using Orchard.Environment.Descriptor.Models;
|
||||
using Orchard.Environment.Extensions;
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
|
||||
@@ -86,10 +87,18 @@ namespace Orchard.Tests.DisplayManagement.Descriptors {
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public IEnumerable<ExtensionDescriptor> EnabledExtensions(ShellDescriptor descriptor) {
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public IEnumerable<FeatureDescriptor> AvailableFeatures() {
|
||||
return _availableFeautures;
|
||||
}
|
||||
|
||||
public IEnumerable<FeatureDescriptor> EnabledFeatures(ShellDescriptor descriptor) {
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public IEnumerable<Feature> LoadFeatures(IEnumerable<FeatureDescriptor> featureDescriptors) {
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
@@ -90,11 +90,19 @@ namespace Orchard.Tests.Environment {
|
||||
yield return ext;
|
||||
}
|
||||
|
||||
public IEnumerable<ExtensionDescriptor> EnabledExtensions(ShellDescriptor descriptor) {
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public IEnumerable<FeatureDescriptor> AvailableFeatures() {
|
||||
// note - doesn't order properly
|
||||
return AvailableExtensions().SelectMany(ed => ed.Features);
|
||||
}
|
||||
|
||||
public IEnumerable<FeatureDescriptor> EnabledFeatures(ShellDescriptor descriptor) {
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public IEnumerable<Feature> LoadFeatures(IEnumerable<FeatureDescriptor> featureDescriptors) {
|
||||
foreach (var descriptor in featureDescriptors) {
|
||||
if (descriptor.Name == "Orchard.Framework") {
|
||||
|
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web;
|
||||
using Orchard.Environment.Descriptor.Models;
|
||||
using Orchard.Environment.Extensions;
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
|
||||
@@ -10,10 +11,18 @@ namespace Orchard.Tests.Stubs {
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public IEnumerable<ExtensionDescriptor> EnabledExtensions(ShellDescriptor descriptor) {
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public IEnumerable<FeatureDescriptor> AvailableFeatures() {
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public IEnumerable<FeatureDescriptor> EnabledFeatures(ShellDescriptor descriptor) {
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public IEnumerable<Feature> LoadFeatures(IEnumerable<FeatureDescriptor> featureDescriptors) {
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
@@ -203,7 +203,7 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
var viewModel = Shape.ViewModel()
|
||||
.ContentTypes(list);
|
||||
|
||||
return View("CreatableTypeList", viewModel);
|
||||
return View(viewModel);
|
||||
}
|
||||
|
||||
public ActionResult Create(string id) {
|
||||
|
@@ -11,7 +11,7 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<iframe id="advisory" src="http://localhost:30320/OrchardLocal/Advisory.aspx" frameborder="0" height="0" width="100%" >
|
||||
<iframe id="advisory" src="http://www.orchardproject.net/advisory" frameborder="0" height="0" width="100%" >
|
||||
<p>Your browser does not support iframes.</p>
|
||||
</iframe>
|
||||
|
||||
|
@@ -43,6 +43,7 @@ namespace Orchard.Core.Navigation.Controllers {
|
||||
if (model.MenuItemEntries == null || model.MenuItemEntries.Count() < 1)
|
||||
model.MenuItemEntries = _menuService.Get().Select(CreateMenuItemEntries).OrderBy(menuPartEntry => menuPartEntry.MenuItem.Position, new PositionComparer()).ToList();
|
||||
|
||||
// need action name as this action is referenced from another action
|
||||
return View("Index", model);
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,37 @@
|
||||
using JetBrains.Annotations;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.Core.Navigation.Models;
|
||||
using Orchard.Localization;
|
||||
using Orchard.UI.Navigation;
|
||||
|
||||
namespace Orchard.Core.Navigation.Services {
|
||||
[UsedImplicitly]
|
||||
public class MainMenuNavigationProvider : INavigationProvider {
|
||||
private readonly IContentManager _contentManager;
|
||||
|
||||
public MainMenuNavigationProvider(IContentManager contentManager) {
|
||||
_contentManager = contentManager;
|
||||
}
|
||||
|
||||
public string MenuName { get { return "main"; } }
|
||||
|
||||
public void GetNavigation(NavigationBuilder builder) {
|
||||
var menuParts = _contentManager.Query<MenuPart, MenuPartRecord>().Where(x => x.OnMainMenu).List();
|
||||
foreach (var menuPart in menuParts) {
|
||||
if (menuPart != null ) {
|
||||
var part = menuPart;
|
||||
|
||||
if (part.Is<MenuItemPart>())
|
||||
builder.Add(
|
||||
menu => menu.Add(new LocalizedString(part.MenuText), part.MenuPosition, nib => nib.Url(part.As<MenuItemPart>().Url)));
|
||||
else
|
||||
builder.Add(
|
||||
menu =>
|
||||
menu.Add(new LocalizedString(part.MenuText), part.MenuPosition,
|
||||
nib =>
|
||||
nib.Action(_contentManager.GetItemMetadata(part.ContentItem).DisplayRouteValues)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -2,20 +2,16 @@
|
||||
using JetBrains.Annotations;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.Core.Navigation.Models;
|
||||
using Orchard.Localization;
|
||||
using Orchard.UI.Navigation;
|
||||
|
||||
namespace Orchard.Core.Navigation.Services {
|
||||
[UsedImplicitly]
|
||||
public class MainMenuService : INavigationProvider, IMenuService {
|
||||
public class MainMenuService : IMenuService {
|
||||
private readonly IContentManager _contentManager;
|
||||
|
||||
public MainMenuService(IContentManager contentManager) {
|
||||
_contentManager = contentManager;
|
||||
}
|
||||
|
||||
public string MenuName { get { return "main"; } }
|
||||
|
||||
public IEnumerable<MenuPart> Get() {
|
||||
return _contentManager.Query<MenuPart, MenuPartRecord>().Where(x => x.OnMainMenu).List();
|
||||
}
|
||||
@@ -27,24 +23,5 @@ namespace Orchard.Core.Navigation.Services {
|
||||
public void Delete(MenuPart menuPart) {
|
||||
_contentManager.Remove(menuPart.ContentItem);
|
||||
}
|
||||
|
||||
public void GetNavigation(NavigationBuilder builder) {
|
||||
var menuParts = _contentManager.Query<MenuPart, MenuPartRecord>().Where(x => x.OnMainMenu).List();
|
||||
foreach (var menuPart in menuParts) {
|
||||
if (menuPart != null ) {
|
||||
var part = menuPart;
|
||||
|
||||
if (part.Is<MenuItemPart>())
|
||||
builder.Add(
|
||||
menu => menu.Add(new LocalizedString(part.MenuText), part.MenuPosition, nib => nib.Url(part.As<MenuItemPart>().Url)));
|
||||
else
|
||||
builder.Add(
|
||||
menu =>
|
||||
menu.Add(new LocalizedString(part.MenuText), part.MenuPosition,
|
||||
nib =>
|
||||
nib.Action(_contentManager.GetItemMetadata(part.ContentItem).DisplayRouteValues)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -107,6 +107,7 @@
|
||||
<Compile Include="Messaging\Models\MessageSettingsPartRecord.cs" />
|
||||
<Compile Include="Messaging\Services\DefaultMessageManager.cs" />
|
||||
<Compile Include="Messaging\ViewModels\MessageSettingsPartViewModel.cs" />
|
||||
<Compile Include="Navigation\Services\MainMenuNavigationProvider.cs" />
|
||||
<Compile Include="PublishLater\ResourceManifest.cs" />
|
||||
<Compile Include="PublishLater\DataMigrations\PublishLaterDataMigration.cs" />
|
||||
<Compile Include="PublishLater\Drivers\PublishLaterPartDriver.cs" />
|
||||
|
@@ -27,7 +27,7 @@ namespace Orchard.ContentTypes.Controllers {
|
||||
#region Types
|
||||
|
||||
public ActionResult List() {
|
||||
return View("List", new ListContentTypesViewModel {
|
||||
return View(new ListContentTypesViewModel {
|
||||
Types = _contentDefinitionService.GetTypes()
|
||||
});
|
||||
}
|
||||
|
@@ -22,7 +22,7 @@ namespace Orchard.Experimental.Controllers {
|
||||
}
|
||||
|
||||
public ActionResult Execute() {
|
||||
return View("Execute", new CommandsExecuteViewModel());
|
||||
return View(new CommandsExecuteViewModel());
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
@@ -37,7 +37,7 @@ namespace Orchard.Experimental.Controllers {
|
||||
.Distinct()
|
||||
.ToArray();
|
||||
model.Results = writer.ToString();
|
||||
return View("Execute", model);
|
||||
return View(model);
|
||||
}
|
||||
|
||||
private static CommandParameters GetCommandParameters(string commandLine, StringWriter writer) {
|
||||
|
@@ -101,7 +101,7 @@ namespace Orchard.Experimental.Controllers {
|
||||
ViewModel.Page.Messages.Add(new HtmlString("<hr/>abuse<hr/>"));
|
||||
ViewModel.Page.Messages.Add("<hr/>encoded<hr/>");
|
||||
|
||||
return View("UsingShapes", model);
|
||||
return View(model);
|
||||
}
|
||||
|
||||
public static string Break(dynamic view) {
|
||||
|
@@ -13,7 +13,7 @@ namespace Orchard.Experimental.Controllers {
|
||||
}
|
||||
|
||||
public ActionResult ShapeTable(string themeName) {
|
||||
return View("ShapeTable", _shapeTableManager.GetShapeTable(themeName));
|
||||
return View(_shapeTableManager.GetShapeTable(themeName));
|
||||
}
|
||||
}
|
||||
}
|
@@ -43,7 +43,7 @@ namespace Orchard.Packaging.Controllers {
|
||||
}
|
||||
|
||||
public ActionResult Sources() {
|
||||
return View("Sources", new PackagingSourcesViewModel {
|
||||
return View(new PackagingSourcesViewModel {
|
||||
Sources = _packagingSourceManager.GetSources(),
|
||||
});
|
||||
}
|
||||
@@ -107,7 +107,7 @@ namespace Orchard.Packaging.Controllers {
|
||||
public ActionResult Modules(Guid? sourceId) {
|
||||
var selectedSource = _packagingSourceManager.GetSources().Where(s => s.Id == sourceId).FirstOrDefault();
|
||||
|
||||
return View("Modules", new PackagingModulesViewModel {
|
||||
return View(new PackagingModulesViewModel {
|
||||
Modules = _packagingSourceManager.GetModuleList(selectedSource).Where(p => p.SyndicationItem.Categories.All(c => c.Name == "Orchard Module" || c.Name != "Orchard Theme")),
|
||||
Sources = _packagingSourceManager.GetSources().OrderBy(s => s.FeedTitle),
|
||||
SelectedSource = selectedSource
|
||||
@@ -117,7 +117,7 @@ namespace Orchard.Packaging.Controllers {
|
||||
public ActionResult Themes(Guid? sourceId) {
|
||||
var selectedSource = _packagingSourceManager.GetSources().Where(s => s.Id == sourceId).FirstOrDefault();
|
||||
|
||||
return View("Themes", new PackagingModulesViewModel {
|
||||
return View(new PackagingModulesViewModel {
|
||||
Modules = _packagingSourceManager.GetModuleList(selectedSource).Where(p => p.SyndicationItem.Categories.Any(c => c.Name == "Orchard Theme")),
|
||||
Sources = _packagingSourceManager.GetSources().OrderBy(s => s.FeedTitle),
|
||||
SelectedSource = selectedSource
|
||||
@@ -131,7 +131,7 @@ namespace Orchard.Packaging.Controllers {
|
||||
}
|
||||
|
||||
public ActionResult Harvest(string extensionName, string feedUrl) {
|
||||
return View("Harvest", new PackagingHarvestViewModel {
|
||||
return View(new PackagingHarvestViewModel {
|
||||
ExtensionName = extensionName,
|
||||
FeedUrl = feedUrl,
|
||||
Sources = _packagingSourceManager.GetSources(),
|
||||
@@ -155,7 +155,7 @@ namespace Orchard.Packaging.Controllers {
|
||||
|
||||
if (!model.Sources.Any(src => src.FeedUrl == model.FeedUrl)) {
|
||||
ModelState.AddModelError("FeedUrl", T("May only push directly to one of the configured sources.").ToString());
|
||||
return View("Harvest", model);
|
||||
return View(model);
|
||||
}
|
||||
|
||||
_packageManager.Push(packageData, model.FeedUrl, model.User, model.Password);
|
||||
|
@@ -129,6 +129,8 @@ namespace Orchard.Setup {
|
||||
public void SetSiteTheme(string themeName) { }
|
||||
public ITheme GetRequestTheme(RequestContext requestContext) { return _theme; }
|
||||
public IEnumerable<ITheme> GetInstalledThemes() { return new[] { _theme }; }
|
||||
public IEnumerable<ITheme> GetEnabledThemes() { return new[] { _theme }; }
|
||||
|
||||
public void InstallTheme(HttpPostedFileBase file) { }
|
||||
public void UninstallTheme(string themeName) { }
|
||||
public void EnableTheme(string themeName) { }
|
||||
|
@@ -5,6 +5,7 @@ using System.Web;
|
||||
using System.Web.Routing;
|
||||
using JetBrains.Annotations;
|
||||
using Orchard.Environment.Descriptor;
|
||||
using Orchard.Environment.Descriptor.Models;
|
||||
using Orchard.Environment.Extensions;
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
using Orchard.Localization;
|
||||
@@ -21,6 +22,7 @@ namespace Orchard.Themes.Services {
|
||||
private readonly IEnumerable<IThemeSelector> _themeSelectors;
|
||||
private readonly IModuleService _moduleService;
|
||||
private readonly IWorkContextAccessor _workContextAccessor;
|
||||
private readonly ShellDescriptor _shellDescriptor;
|
||||
private readonly IShellDescriptorManager _shellDescriptorManager;
|
||||
|
||||
public ThemeService(
|
||||
@@ -28,12 +30,14 @@ namespace Orchard.Themes.Services {
|
||||
IExtensionManager extensionManager,
|
||||
IEnumerable<IThemeSelector> themeSelectors,
|
||||
IModuleService moduleService,
|
||||
IWorkContextAccessor workContextAccessor) {
|
||||
IWorkContextAccessor workContextAccessor,
|
||||
ShellDescriptor shellDescriptor) {
|
||||
_shellDescriptorManager = shellDescriptorManager;
|
||||
_extensionManager = extensionManager;
|
||||
_themeSelectors = themeSelectors;
|
||||
_moduleService = moduleService;
|
||||
_workContextAccessor = workContextAccessor;
|
||||
_shellDescriptor = shellDescriptor;
|
||||
Logger = NullLogger.Instance;
|
||||
T = NullLocalizer.Instance;
|
||||
}
|
||||
@@ -167,11 +171,22 @@ namespace Orchard.Themes.Services {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads only enabled themes
|
||||
/// Loads only installed themes
|
||||
/// </summary>
|
||||
public IEnumerable<ITheme> GetInstalledThemes() {
|
||||
return GetThemes(_extensionManager.AvailableExtensions());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Loads only enabled themes
|
||||
/// </summary>
|
||||
public IEnumerable<ITheme> GetEnabledThemes() {
|
||||
return GetThemes(_extensionManager.EnabledExtensions(_shellDescriptor));
|
||||
}
|
||||
|
||||
private IEnumerable<ITheme> GetThemes(IEnumerable<ExtensionDescriptor> extensions) {
|
||||
var themes = new List<ITheme>();
|
||||
foreach (var descriptor in _extensionManager.AvailableExtensions()) {
|
||||
foreach (var descriptor in extensions) {
|
||||
|
||||
if (!string.Equals(descriptor.ExtensionType, "Theme", StringComparison.OrdinalIgnoreCase)) {
|
||||
continue;
|
||||
|
@@ -56,7 +56,7 @@ namespace Orchard.Users.Controllers {
|
||||
if (_authenticationService.GetAuthenticatedUser() != null)
|
||||
return Redirect("~/");
|
||||
|
||||
return View("LogOn", new LogOnViewModel {Title = "Log On"});
|
||||
return View(new LogOnViewModel {Title = "Log On"});
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
@@ -65,7 +65,7 @@ namespace Orchard.Users.Controllers {
|
||||
public ActionResult LogOn(string userNameOrEmail, string password, bool rememberMe, string returnUrl) {
|
||||
var user = ValidateLogOn(userNameOrEmail, password);
|
||||
if (!ModelState.IsValid) {
|
||||
return View("LogOn", new LogOnViewModel {Title = "Log On"});
|
||||
return View(new LogOnViewModel {Title = "Log On"});
|
||||
}
|
||||
|
||||
_authenticationService.SignIn(user, rememberMe);
|
||||
|
@@ -42,7 +42,7 @@ namespace Orchard.Widgets.Services {
|
||||
public IEnumerable<string> GetZones() {
|
||||
HashSet<string> zones = new HashSet<string>();
|
||||
|
||||
foreach (var theme in _themeService.GetInstalledThemes().Where(theme => theme.Zones != null && !theme.Zones.Trim().Equals(string.Empty))) {
|
||||
foreach (var theme in _themeService.GetEnabledThemes().Where(theme => theme.Zones != null && !theme.Zones.Trim().Equals(string.Empty))) {
|
||||
foreach (string zone in theme.Zones.Split(',').Where(zone => !zones.Contains(zone))) {
|
||||
zones.Add(zone.Trim());
|
||||
}
|
||||
|
@@ -4,14 +4,13 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using ICSharpCode.SharpZipLib.Zip;
|
||||
using Orchard.Environment.Descriptor.Models;
|
||||
using Orchard.Environment.Extensions.Folders;
|
||||
using Orchard.Environment.Extensions.Helpers;
|
||||
using Orchard.Environment.Extensions.Loaders;
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Logging;
|
||||
using Orchard.Settings;
|
||||
using Orchard.Themes;
|
||||
using Orchard.Utility;
|
||||
using Orchard.Utility.Extensions;
|
||||
|
||||
@@ -36,12 +35,30 @@ namespace Orchard.Environment.Extensions {
|
||||
return _folders.SelectMany(folder => folder.AvailableExtensions());
|
||||
}
|
||||
|
||||
public IEnumerable<ExtensionDescriptor> EnabledExtensions(ShellDescriptor descriptor) {
|
||||
var enabledFeatures = EnabledFeatures(descriptor);
|
||||
return _folders.SelectMany(folder => folder.AvailableExtensions())
|
||||
.Where(extensionDescriptor =>
|
||||
extensionDescriptor.Features.Any(featureDescriptor =>
|
||||
enabledFeatures.Any(availableFeature => featureDescriptor.Name == availableFeature.Name)));
|
||||
}
|
||||
|
||||
public IEnumerable<FeatureDescriptor> AvailableFeatures() {
|
||||
var featureDescriptors = AvailableExtensions().SelectMany(ext => ext.Features);
|
||||
var featureDescriptorsOrdered = featureDescriptors.OrderByDependencies(HasDependency);
|
||||
return featureDescriptorsOrdered.ToReadOnlyCollection();
|
||||
}
|
||||
|
||||
public IEnumerable<FeatureDescriptor> EnabledFeatures(ShellDescriptor descriptor) {
|
||||
return AvailableExtensions()
|
||||
.SelectMany(extensionDescriptor => extensionDescriptor.Features)
|
||||
.Where(featureDescriptor => IsFeatureEnabledInDescriptor(featureDescriptor, descriptor));
|
||||
}
|
||||
|
||||
private static bool IsFeatureEnabledInDescriptor(FeatureDescriptor featureDescriptor, ShellDescriptor shellDescriptor) {
|
||||
return shellDescriptor.Features.Any(shellDescriptorFeature => shellDescriptorFeature.Name == featureDescriptor.Name);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if the item has an explicit or implicit dependency on the subject
|
||||
/// </summary>
|
||||
|
@@ -1,11 +1,14 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Web;
|
||||
using Orchard.Environment.Descriptor.Models;
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
|
||||
namespace Orchard.Environment.Extensions {
|
||||
public interface IExtensionManager {
|
||||
IEnumerable<ExtensionDescriptor> AvailableExtensions();
|
||||
IEnumerable<ExtensionDescriptor> EnabledExtensions(ShellDescriptor descriptor);
|
||||
IEnumerable<FeatureDescriptor> AvailableFeatures();
|
||||
IEnumerable<FeatureDescriptor> EnabledFeatures(ShellDescriptor descriptor);
|
||||
IEnumerable<Feature> LoadFeatures(IEnumerable<FeatureDescriptor> featureDescriptors);
|
||||
|
||||
void InstallExtension(string extensionType, HttpPostedFileBase extensionBundle);
|
||||
|
@@ -32,10 +32,7 @@ namespace Orchard.Environment.ShellBuilders {
|
||||
}
|
||||
|
||||
public ShellBlueprint Compose(ShellSettings settings, ShellDescriptor descriptor) {
|
||||
var enabledFeatures = _extensionManager.AvailableExtensions()
|
||||
.SelectMany(extensionDescriptor => extensionDescriptor.Features)
|
||||
.Where(featureDescriptor => IsFeatureEnabledInDescriptor(featureDescriptor, descriptor));
|
||||
|
||||
var enabledFeatures = _extensionManager.EnabledFeatures(descriptor);
|
||||
var features = _extensionManager.LoadFeatures(enabledFeatures);
|
||||
|
||||
if (descriptor.Features.Any(feature => feature.Name == "Orchard.Framework"))
|
||||
@@ -55,10 +52,6 @@ namespace Orchard.Environment.ShellBuilders {
|
||||
};
|
||||
}
|
||||
|
||||
private static bool IsFeatureEnabledInDescriptor(FeatureDescriptor featureDescriptor, ShellDescriptor shellDescriptor) {
|
||||
return shellDescriptor.Features.Any(shellDescriptorFeature => shellDescriptorFeature.Name == featureDescriptor.Name);
|
||||
}
|
||||
|
||||
private static IEnumerable<Feature> BuiltinFeatures() {
|
||||
yield return new Feature {
|
||||
Descriptor = new FeatureDescriptor {
|
||||
|
@@ -14,6 +14,7 @@ namespace Orchard.Themes {
|
||||
void DisableTheme(string themeName);
|
||||
|
||||
IEnumerable<ITheme> GetInstalledThemes();
|
||||
IEnumerable<ITheme> GetEnabledThemes();
|
||||
void InstallTheme(HttpPostedFileBase file);
|
||||
void UninstallTheme(string themeName);
|
||||
}
|
||||
|
@@ -21,7 +21,8 @@ namespace Orchard.UI.Navigation {
|
||||
protected virtual IUser CurrentUser { get; [UsedImplicitly] private set; }
|
||||
|
||||
public IEnumerable<MenuItem> BuildMenu(string menuName) {
|
||||
return FinishMenu(Crop(Reduce(Merge(AllSources(menuName)))).ToArray());
|
||||
var sources = GetSources(menuName);
|
||||
return FinishMenu(Crop(Reduce(Merge(sources))).ToArray());
|
||||
}
|
||||
|
||||
private IEnumerable<MenuItem> FinishMenu(IEnumerable<MenuItem> menuItems) {
|
||||
@@ -79,7 +80,7 @@ namespace Orchard.UI.Navigation {
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerable<IEnumerable<MenuItem>> AllSources(string menuName) {
|
||||
private IEnumerable<IEnumerable<MenuItem>> GetSources(string menuName) {
|
||||
foreach (var provider in _providers) {
|
||||
if (provider.MenuName == menuName) {
|
||||
var builder = new NavigationBuilder();
|
||||
|
Reference in New Issue
Block a user