/// <summary> /// Returns the an XmlTree based on the current http request /// </summary> /// <returns></returns> public XmlTree GetXmlTree(HttpContext context) { var treeParams = TreeRequestParams.FromQueryStrings(); //validate the current user for the request app! AuthorizeRequest(treeParams.Application, true); if (string.IsNullOrEmpty(treeParams.TreeType)) { if (!string.IsNullOrEmpty(treeParams.Application)) { LoadAppTrees(treeParams, context); } else { return(new XmlTree()); //returns an empty tree } } else { LoadTree(treeParams, context); } return(_xTree); }
/// <summary> /// Initializes the control and looks up the tree structures that are required to be rendered. /// Properties of the control (or SetTreeService) need to be set before pre render or calling /// GetJSONContextMenu or GetJSONNode /// </summary> protected void Initialize() { //use the query strings if the TreeParams isn't explicitly set if (m_TreeService == null) { m_TreeService = TreeRequestParams.FromQueryStrings().CreateTreeService(); } m_TreeService.App = GetCurrentApp(); // Validate permissions if (!BasePages.BasePage.ValidateUserContextID(BasePages.BasePage.umbracoUserContextID)) { return; } UmbracoEnsuredPage page = new UmbracoEnsuredPage(); if (!page.ValidateUserApp(GetCurrentApp())) { throw new ArgumentException("The current user doesn't have access to this application. Please contact the system administrator."); } //find all tree definitions that have the current application alias that are ACTIVE. //if an explicit tree has been requested, then only load that tree in. //m_ActiveTreeDefs = TreeDefinitionCollection.Instance.FindActiveTrees(GetCurrentApp()); m_ActiveTreeDefs = Services.ApplicationTreeService.GetApplicationTrees(GetCurrentApp(), true).ToList(); if (!string.IsNullOrEmpty(this.TreeType)) { m_ActiveTreeDefs = m_ActiveTreeDefs .Where(x => x.Alias == this.TreeType) .ToList(); //this will only return 1 } //find all tree defs that exists for the current application regardless of if they are active var appTreeDefs = Services.ApplicationTreeService.GetApplicationTrees(GetCurrentApp()).ToList(); //Create the BaseTree's based on the tree definitions found foreach (var treeDef in appTreeDefs) { //create the tree and initialize it var bTree = LegacyTreeDataConverter.GetLegacyTreeForLegacyServices(treeDef); //BaseTree bTree = treeDef.CreateInstance(); bTree.SetTreeParameters(m_TreeService); //store the created tree m_AllAppTrees.Add(bTree); if (treeDef.Initialize) { m_ActiveTrees.Add(bTree); } } m_IsInit = true; }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); TreeParams = TreeRequestParams.FromQueryStrings().CreateTreeService(); DataBind(); if (Request.QueryString["selected"] != null && TreeParams.TreeType == "content") { var currContent = Services.ContentService.GetById(int.Parse(Request.QueryString["selected"])); if (currContent != null) { if (currContent.ParentId > 0) { DialogTree.SelectedNodePath = currContent.Path; } } } }
/// <summary> /// Returns the an XmlTree based on the current http request /// </summary> /// <returns></returns> public XmlTree GetXmlTree() { TreeRequestParams treeParams = TreeRequestParams.FromQueryStrings(); if (string.IsNullOrEmpty(treeParams.TreeType)) { if (!string.IsNullOrEmpty(treeParams.Application)) { LoadAppTrees(treeParams); } else { return(new XmlTree()); //returns an empty tree } } else { LoadTree(treeParams); } return(xTree); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); TreeParams = TreeRequestParams.FromQueryStrings().CreateTreeService(); DataBind(); }