2020-06-09 07:49:26 +02:00
|
|
|
|
using Microsoft.AspNetCore.Http;
|
2020-02-17 14:58:34 +01:00
|
|
|
|
using Umbraco.Core.Services;
|
2020-06-09 07:49:26 +02:00
|
|
|
|
using Umbraco.Web.BackOffice.Filters;
|
|
|
|
|
|
using Umbraco.Web.BackOffice.Trees;
|
|
|
|
|
|
using Umbraco.Web.Common.Attributes;
|
2018-10-02 14:14:25 +02:00
|
|
|
|
using Umbraco.Web.Models.Trees;
|
2020-06-09 07:49:26 +02:00
|
|
|
|
using Umbraco.Web.WebApi;
|
2019-11-05 13:45:42 +01:00
|
|
|
|
using Constants = Umbraco.Core.Constants;
|
2018-10-02 14:14:25 +02:00
|
|
|
|
|
|
|
|
|
|
namespace Umbraco.Web.Trees
|
|
|
|
|
|
{
|
|
|
|
|
|
[UmbracoTreeAuthorize(Constants.Trees.Packages)]
|
2019-01-22 09:31:47 +01:00
|
|
|
|
[Tree(Constants.Applications.Packages, Constants.Trees.Packages, SortOrder = 0, IsSingleNodeTree = true)]
|
2018-10-02 14:14:25 +02:00
|
|
|
|
[PluginController("UmbracoTrees")]
|
|
|
|
|
|
[CoreTree]
|
|
|
|
|
|
public class PackagesTreeController : TreeController
|
|
|
|
|
|
{
|
2020-02-17 14:58:34 +01:00
|
|
|
|
private readonly IMenuItemCollectionFactory _menuItemCollectionFactory;
|
|
|
|
|
|
|
|
|
|
|
|
public PackagesTreeController(
|
2020-06-09 07:49:26 +02:00
|
|
|
|
ILocalizedTextService localizedTextService,
|
|
|
|
|
|
UmbracoApiControllerTypeCollection umbracoApiControllerTypeCollection,
|
2020-02-17 14:58:34 +01:00
|
|
|
|
IMenuItemCollectionFactory menuItemCollectionFactory)
|
2020-06-09 07:49:26 +02:00
|
|
|
|
: base(localizedTextService, umbracoApiControllerTypeCollection)
|
2020-02-17 14:58:34 +01:00
|
|
|
|
{
|
|
|
|
|
|
_menuItemCollectionFactory = menuItemCollectionFactory;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-06-09 07:49:26 +02:00
|
|
|
|
|
2018-10-02 14:14:25 +02:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Helper method to create a root model for a tree
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <returns></returns>
|
2020-06-09 07:49:26 +02:00
|
|
|
|
protected override TreeNode CreateRootNode(FormCollection queryStrings)
|
2018-10-02 14:14:25 +02:00
|
|
|
|
{
|
|
|
|
|
|
var root = base.CreateRootNode(queryStrings);
|
2018-12-06 09:32:04 +00:00
|
|
|
|
|
|
|
|
|
|
//this will load in a custom UI instead of the dashboard for the root node
|
2019-11-05 13:45:42 +01:00
|
|
|
|
root.RoutePath = $"{Constants.Applications.Packages}/{Constants.Trees.Packages}/repo";
|
2018-10-02 14:14:25 +02:00
|
|
|
|
root.Icon = "icon-box";
|
2018-12-06 09:32:04 +00:00
|
|
|
|
|
|
|
|
|
|
root.HasChildren = false;
|
2018-10-02 14:14:25 +02:00
|
|
|
|
return root;
|
|
|
|
|
|
}
|
2018-12-06 09:32:04 +00:00
|
|
|
|
|
2019-01-09 20:57:02 +11:00
|
|
|
|
|
2020-06-09 07:49:26 +02:00
|
|
|
|
protected override TreeNodeCollection GetTreeNodes(string id, FormCollection queryStrings)
|
2018-10-02 14:14:25 +02:00
|
|
|
|
{
|
2018-12-06 09:32:04 +00:00
|
|
|
|
//full screen app without tree nodes
|
|
|
|
|
|
return TreeNodeCollection.Empty;
|
2018-10-02 14:14:25 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
2020-06-09 07:49:26 +02:00
|
|
|
|
protected override MenuItemCollection GetMenuForNode(string id, FormCollection queryStrings)
|
2018-10-02 14:14:25 +02:00
|
|
|
|
{
|
2018-12-06 09:32:04 +00:00
|
|
|
|
//doesn't have a menu, this is a full screen app without tree nodes
|
2020-02-17 14:58:34 +01:00
|
|
|
|
return _menuItemCollectionFactory.Create();
|
2018-10-02 14:14:25 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|