Move features

- Introduced IUmbracoFeature
Move Install
Move Tree Items
 - Introduced IMenuItemCollectionFactory - to insure injection of ActionCollection
This commit is contained in:
Bjarke Berg
2020-02-17 14:58:34 +01:00
parent 7a6ded2f6e
commit 43b33f9e6b
74 changed files with 492 additions and 198 deletions

View File

@@ -4,14 +4,46 @@ using System.Linq;
using System.Net.Http.Formatting;
using System.Web;
using Umbraco.Core;
using Umbraco.Core.Cache;
using Umbraco.Core.Configuration;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.Mapping;
using Umbraco.Core.Persistence;
using Umbraco.Core.Services;
using Umbraco.Web.Actions;
using Umbraco.Web.Composing;
using Umbraco.Web.Models.Trees;
using Umbraco.Web.Routing;
namespace Umbraco.Web.Trees
{
public abstract class FileSystemTreeController : TreeController
{
private readonly IMenuItemCollectionFactory _menuItemCollectionFactory;
protected FileSystemTreeController()
{
_menuItemCollectionFactory = Current.MenuItemCollectionFactory;
}
protected FileSystemTreeController(
IGlobalSettings globalSettings,
IUmbracoContextAccessor umbracoContextAccessor,
ISqlContext sqlContext,
ServiceContext services,
AppCaches appCaches,
IProfilingLogger logger,
IRuntimeState runtimeState,
UmbracoHelper umbracoHelper,
UmbracoMapper umbracoMapper,
IPublishedUrlProvider publishedUrlProvider,
IMenuItemCollectionFactory menuItemCollectionFactory)
: base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper, umbracoMapper, publishedUrlProvider)
{
_menuItemCollectionFactory = menuItemCollectionFactory;
}
protected abstract IFileSystem FileSystem { get; }
protected abstract string[] Extensions { get; }
protected abstract string FileIcon { get; }
@@ -88,7 +120,7 @@ namespace Umbraco.Web.Trees
protected virtual MenuItemCollection GetMenuForRootNode(FormDataCollection queryStrings)
{
var menu = new MenuItemCollection();
var menu = _menuItemCollectionFactory.Create();
//set the default to create
menu.DefaultMenuAlias = ActionNew.ActionAlias;
@@ -102,7 +134,7 @@ namespace Umbraco.Web.Trees
protected virtual MenuItemCollection GetMenuForFolder(string path, FormDataCollection queryStrings)
{
var menu = new MenuItemCollection();
var menu = _menuItemCollectionFactory.Create();
//set the default to create
menu.DefaultMenuAlias = ActionNew.ActionAlias;
@@ -126,7 +158,7 @@ namespace Umbraco.Web.Trees
protected virtual MenuItemCollection GetMenuForFile(string path, FormDataCollection queryStrings)
{
var menu = new MenuItemCollection();
var menu = _menuItemCollectionFactory.Create();
//if it's not a directory then we only allow to delete the item
menu.Items.Add<ActionDelete>(Services.TextService, opensDialog: true);
@@ -142,7 +174,7 @@ namespace Umbraco.Web.Trees
return GetMenuForRootNode(queryStrings);
}
var menu = new MenuItemCollection();
var menu = _menuItemCollectionFactory.Create();
var path = string.IsNullOrEmpty(id) == false && id != Constants.System.RootString
? HttpUtility.UrlDecode(id).TrimStart("/")