diff --git a/src/Umbraco.Web.UI/umbraco/controls/Tree/TreeControl.ascx b/src/Umbraco.Web.UI/umbraco/controls/Tree/TreeControl.ascx index 41ac545d6f..027bd1286a 100644 --- a/src/Umbraco.Web.UI/umbraco/controls/Tree/TreeControl.ascx +++ b/src/Umbraco.Web.UI/umbraco/controls/Tree/TreeControl.ascx @@ -47,6 +47,13 @@ jQuery(document).ready(function() { dataUrl: "<%#Umbraco.Core.IO.IOHelper.ResolveUrl(Umbraco.Core.IO.SystemDirectories.Umbraco)%>/webservices/TreeDataService.ashx", serviceUrl: "<%#Umbraco.Core.IO.IOHelper.ResolveUrl(Umbraco.Core.IO.SystemDirectories.Umbraco)%>/webservices/TreeClientService.asmx/GetInitAppTreeData"}); + <%if(!String.IsNullOrEmpty(this.SelectedNodePath)) {%> + setTimeout(function() { + treeApi = jQuery("#<%=ClientID%>").UmbracoTreeAPI(); + treeApi.syncTree('<%=this.SelectedNodePath%>', true, true); + }, 500); + <% } %> + //add event handler for ajax errors, this will refresh the whole application var mainTree = UmbClientMgr.mainTree(); if (mainTree != null) { diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index d494e52178..1cec3bb6ec 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -1871,6 +1871,7 @@ + ASPXCodeBehind @@ -2059,4 +2060,4 @@ - \ No newline at end of file + diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/TreeControl.ascx b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/TreeControl.ascx index 41ac545d6f..027bd1286a 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/TreeControl.ascx +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/TreeControl.ascx @@ -47,6 +47,13 @@ jQuery(document).ready(function() { dataUrl: "<%#Umbraco.Core.IO.IOHelper.ResolveUrl(Umbraco.Core.IO.SystemDirectories.Umbraco)%>/webservices/TreeDataService.ashx", serviceUrl: "<%#Umbraco.Core.IO.IOHelper.ResolveUrl(Umbraco.Core.IO.SystemDirectories.Umbraco)%>/webservices/TreeClientService.asmx/GetInitAppTreeData"}); + <%if(!String.IsNullOrEmpty(this.SelectedNodePath)) {%> + setTimeout(function() { + treeApi = jQuery("#<%=ClientID%>").UmbracoTreeAPI(); + treeApi.syncTree('<%=this.SelectedNodePath%>', true, true); + }, 500); + <% } %> + //add event handler for ajax errors, this will refresh the whole application var mainTree = UmbClientMgr.mainTree(); if (mainTree != null) { diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/TreeControl.ascx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/TreeControl.ascx.cs index fd1b180005..c9d4cc8f74 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/TreeControl.ascx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/TreeControl.ascx.cs @@ -62,6 +62,7 @@ namespace umbraco.controls.Tree private TreeMode m_TreeType = TreeMode.Standard; private bool m_IsInit = false; private TreeService m_TreeService = new TreeService(); + private string m_SelectedNodePath; #region Public Properties @@ -100,6 +101,15 @@ namespace umbraco.controls.Tree } } + public string SelectedNodePath + { + get { return m_SelectedNodePath; } + set + { + m_SelectedNodePath = value; + } + } + public string TreeType { get { return m_TreeService.TreeType; } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/moveOrCopy.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/moveOrCopy.aspx.cs index ad8410da85..45388be075 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/moveOrCopy.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/moveOrCopy.aspx.cs @@ -89,6 +89,10 @@ namespace umbraco.dialogs currContent = Services.MediaService.GetById(Request.GetItemAs("id")); } + // Preselect the parent of the seslected item. + if (currContent.ParentId > 0) + JTree.SelectedNodePath = currContent.Path.Substring(0, currContent.Path.LastIndexOf(',')); + var validAction = true; if (CurrentApp == Constants.Applications.Content && Umbraco.Core.Models.ContentExtensions.HasChildren(currContent, Services)) { diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/treePicker.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/treePicker.aspx.cs index 4a60b0605b..38518804b4 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/treePicker.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/treePicker.aspx.cs @@ -20,6 +20,12 @@ namespace umbraco.dialogs 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.ParentId > 0) + DialogTree.SelectedNodePath = currContent.Path; + } } protected TreeService TreeParams { get; private set; } diff --git a/src/umbraco.controls/TreePicker/SimpleContentPicker.cs b/src/umbraco.controls/TreePicker/SimpleContentPicker.cs index de93637134..3d70cbbef4 100644 --- a/src/umbraco.controls/TreePicker/SimpleContentPicker.cs +++ b/src/umbraco.controls/TreePicker/SimpleContentPicker.cs @@ -1,4 +1,5 @@ using System; +using System.Web; using System.Collections.Generic; using System.Linq; using System.Text; @@ -12,6 +13,9 @@ namespace umbraco.uicontrols.TreePicker { get { + if (HttpContext.Current.Request.QueryString["id"] != null) + return TreeUrlGenerator.GetPickerUrl(Constants.Applications.Content, "content") + "&selected=" + HttpContext.Current.Request.QueryString["id"]; + return TreeUrlGenerator.GetPickerUrl(Constants.Applications.Content, "content"); } } diff --git a/src/umbraco.editorControls/pagepicker/pagePicker.cs b/src/umbraco.editorControls/pagepicker/pagePicker.cs index 16693194dd..791bb20352 100644 --- a/src/umbraco.editorControls/pagepicker/pagePicker.cs +++ b/src/umbraco.editorControls/pagepicker/pagePicker.cs @@ -1,4 +1,5 @@ using System; +using System.Web; using System.Web.UI; using umbraco.cms.presentation.Trees; @@ -26,6 +27,9 @@ namespace umbraco.editorControls { get { + if(HttpContext.Current.Request.QueryString["id"] != null) + return TreeService.GetPickerUrl(Umbraco.Core.Constants.Applications.Content, "content") + "&selected=" + HttpContext.Current.Request.QueryString["id"]; + return TreeService.GetPickerUrl(Umbraco.Core.Constants.Applications.Content, "content"); } }