support for fetching a specific tree
This commit is contained in:
@@ -39,7 +39,7 @@ namespace Umbraco.Web.Trees
|
||||
/// <param name="queryStrings"></param>
|
||||
/// <returns></returns>
|
||||
[HttpQueryStringFilter("queryStrings")]
|
||||
public SectionRootNode GetApplicationTrees(string application, FormDataCollection queryStrings)
|
||||
public SectionRootNode GetApplicationTrees(string application, string tree, FormDataCollection queryStrings)
|
||||
{
|
||||
if (application == null) throw new ArgumentNullException("application");
|
||||
|
||||
@@ -47,24 +47,34 @@ namespace Umbraco.Web.Trees
|
||||
|
||||
//find all tree definitions that have the current application alias
|
||||
var appTrees = ApplicationContext.Current.Services.ApplicationTreeService.GetApplicationTrees(application, true).ToArray();
|
||||
if (appTrees.Count() == 1)
|
||||
|
||||
if (appTrees.Count() == 1 || !string.IsNullOrEmpty(tree) )
|
||||
{
|
||||
var tree = GetRootForSingleAppTree(
|
||||
appTrees.Single(),
|
||||
ApplicationTree apptree;
|
||||
|
||||
if (!string.IsNullOrEmpty(tree))
|
||||
apptree = appTrees.Where(x => x.Alias == tree).Single();
|
||||
else
|
||||
apptree = appTrees.Single();
|
||||
|
||||
|
||||
var result = GetRootForSingleAppTree(
|
||||
apptree,
|
||||
Constants.System.Root.ToString(CultureInfo.InvariantCulture),
|
||||
queryStrings,
|
||||
application);
|
||||
|
||||
//PP: should this be further down in the logic?
|
||||
tree.Title = ui.Text("sections", application);
|
||||
return tree;
|
||||
result.Title = ui.Text("sections", application);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
var collection = new TreeNodeCollection();
|
||||
foreach (var tree in appTrees)
|
||||
foreach (var apptree in appTrees)
|
||||
{
|
||||
//return the root nodes for each tree in the app
|
||||
var rootNode = GetRootForMultipleAppTree(tree, queryStrings);
|
||||
var rootNode = GetRootForMultipleAppTree(apptree, queryStrings);
|
||||
collection.Add(rootNode);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user