Gets data type folders working/creating, data types being able to be created in folders, tree syncing with data type paths, fixes up some localization stuff and fixes up some issues with media type folders with parent ids

This commit is contained in:
Shannon
2015-11-12 11:28:41 +01:00
parent 42a0697d60
commit d379b98c57
14 changed files with 80 additions and 50 deletions

View File

@@ -12,6 +12,7 @@ using Umbraco.Web.Mvc;
using Umbraco.Web.WebApi.Filters;
using umbraco;
using umbraco.BusinessLogic.Actions;
using Umbraco.Core.Models.EntityBase;
using Umbraco.Core.Services;
using Constants = Umbraco.Core.Constants;
@@ -32,7 +33,7 @@ namespace Umbraco.Web.Trees
//Folders first
nodes.AddRange(
Services.EntityService.GetChildren(intId.Result, UmbracoObjectTypes.MediaTypeContainer)
Services.EntityService.GetChildren(intId.Result, UmbracoObjectTypes.DataTypeContainer)
.OrderBy(entity => entity.Name)
.Select(dt =>
{
@@ -46,10 +47,20 @@ namespace Umbraco.Web.Trees
//Normal nodes
var sysIds = GetSystemIds();
nodes.AddRange(
Services.DataTypeService.GetAllDataTypeDefinitions()
.OrderBy(x => x.Name)
.Select(dt => CreateTreeNode(id, queryStrings, sysIds, dt)));
Services.EntityService.GetChildren(intId.Result, UmbracoObjectTypes.DataType)
.OrderBy(entity => entity.Name)
.Select(dt =>
{
var node = CreateTreeNode(dt.Id.ToInvariantString(), id, queryStrings, dt.Name, "icon-autofill", false);
node.Path = dt.Path;
if (sysIds.Contains(dt.Id))
{
node.Icon = "icon-thumbnail-list";
}
return node;
}));
return nodes;
}
@@ -64,25 +75,7 @@ namespace Umbraco.Web.Trees
};
return systemIds;
}
private TreeNode CreateTreeNode(string id, FormDataCollection queryStrings, IEnumerable<int> systemIds, IDataTypeDefinition dt)
{
var node = CreateTreeNode(
dt.Id.ToInvariantString(),
id,
queryStrings,
dt.Name,
"icon-autofill",
false);
if (systemIds.Contains(dt.Id))
{
node.Icon = "icon-thumbnail-list";
}
return node;
}
protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)
{
var menu = new MenuItemCollection();