/// <summary> /// Returns the JSON markup for the first node in the tree /// </summary> public string GetJSONInitNode() { if (!m_IsInit) { Initialize(); } //if there is only one tree to render, we don't want to have a node to hold sub trees, we just want the //stand alone tree, so we'll just add a TreeType to the TreeService and ensure that the right method gets loaded in tree.aspx if (m_ActiveTrees.Count == 1) { m_TreeService.TreeType = m_ActiveTreeDefs[0].Tree.Alias; //convert the menu to a string //string initActions = (TreeSvc.ShowContextMenu ? Action.ToString(m_ActiveTrees[0].RootNodeActions) : ""); //Since there's only 1 tree, render out the tree's RootNode properties XmlTree xTree = new XmlTree(); xTree.Add(m_ActiveTrees[0].RootNode); return(xTree.ToString()); } else { //If there is more than 1 tree for the application than render out a //container node labelled with the current application. XmlTree xTree = new XmlTree(); XmlTreeNode xNode = XmlTreeNode.CreateRoot(new NullTree(GetCurrentApp())); xNode.Text = ui.Text("sections", GetCurrentApp(), UmbracoEnsuredPage.CurrentUser); xNode.Source = m_TreeService.GetServiceUrl(); xNode.Action = "javascript:" + ClientTools.Scripts.OpenDashboard(GetCurrentApp()); xNode.NodeType = m_TreeService.App.ToLower(); xNode.NodeID = "-1"; xNode.Icon = ".sprTreeFolder"; xTree.Add(xNode); return(xTree.ToString()); } }