From ad2764e3acf7a1ea0e4393abfd766fb93bee48ef Mon Sep 17 00:00:00 2001 From: Jeremy Pyne Date: Mon, 24 Jun 2013 14:51:52 -0400 Subject: [PATCH 1/5] Added code to select the parent node when doing Move/Copy operations. This will save lots of time for users. This code can also be added to other places that use the TreeControl to pre-select the currently selected item(media pickers for example) so that changing content will be quicker. --- .../umbraco/controls/Tree/TreeControl.ascx | 6 ++++++ .../umbraco/controls/Tree/TreeControl.ascx.cs | 10 ++++++++++ .../umbraco/dialogs/moveOrCopy.aspx.cs | 4 ++++ 3 files changed, 20 insertions(+) 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 c7fa6aa5d5..3d379f68d8 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,12 @@ jQuery(document).ready(function() { dataUrl: "<%#umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco)%>/webservices/TreeDataService.ashx", serviceUrl: "<%#umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco)%>/webservices/TreeClientService.asmx/GetInitAppTreeData"}); + <%if(!String.IsNullOrEmpty(this.SelectedNodePath)) {%> + setTimeout(function() { + jQuery("#<%=ClientID%>").UmbracoTreeAPI().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 ebad6f2151..d80500870c 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/moveOrCopy.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/moveOrCopy.aspx.cs @@ -80,6 +80,10 @@ namespace umbraco.dialogs var cmsNode = new CMSNode(int.Parse(Request.GetItemAsString("id"))); + // Preselect the parent of the seslected item. + if(cmsNode.ParentId > 0) + JTree.SelectedNodePath = cmsNode.Parent.Path; + var validAction = true; if (CurrentApp == Constants.Applications.Content && cmsNode.HasChildren) validAction = ValidAction(Request.GetItemAsString("mode") == "cut" ? 'M' : 'O'); From fe23502e67c431d3a31b73246c038db7a8a29aaf Mon Sep 17 00:00:00 2001 From: Jeremy Pyne Date: Tue, 25 Jun 2013 15:48:16 -0400 Subject: [PATCH 2/5] Added code to actually pre-select the parent node instead of just locating it in the tree. This seams keeps the Ui in a sane state. Updated control code in Umbraco.Web.Ui from Umbraco.Web. --- .../umbraco/controls/Tree/TreeControl.ascx | 15 +++++++++++++++ .../umbraco/controls/Tree/TreeControl.ascx | 11 ++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/Umbraco.Web.UI/umbraco/controls/Tree/TreeControl.ascx b/src/Umbraco.Web.UI/umbraco/controls/Tree/TreeControl.ascx index c7fa6aa5d5..fb4fac1e2d 100644 --- a/src/Umbraco.Web.UI/umbraco/controls/Tree/TreeControl.ascx +++ b/src/Umbraco.Web.UI/umbraco/controls/Tree/TreeControl.ascx @@ -47,6 +47,21 @@ jQuery(document).ready(function() { dataUrl: "<%#umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco)%>/webservices/TreeDataService.ashx", serviceUrl: "<%#umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco)%>/webservices/TreeClientService.asmx/GetInitAppTreeData"}); + <%if(!String.IsNullOrEmpty(this.SelectedNodePath)) {%> + setTimeout(function() { + treeApi = jQuery("#<%=ClientID%>").UmbracoTreeAPI(); + treeApi.syncTree('<%=this.SelectedNodePath%>', true, true); + + // select the parent node once found. + var iv = setInterval(function() { + var node = treeApi.findNode('<%=this.SelectedNodePath%>'.split(',').pop(), true); + if(node != false) { + treeApi.selectNode(node, false, true); + clearInterval(iv); + } + }, 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 b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/TreeControl.ascx index 3d379f68d8..fb4fac1e2d 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/TreeControl.ascx +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/TreeControl.ascx @@ -49,7 +49,16 @@ jQuery(document).ready(function() { <%if(!String.IsNullOrEmpty(this.SelectedNodePath)) {%> setTimeout(function() { - jQuery("#<%=ClientID%>").UmbracoTreeAPI().syncTree('<%=this.SelectedNodePath%>', true, true); + treeApi = jQuery("#<%=ClientID%>").UmbracoTreeAPI(); + treeApi.syncTree('<%=this.SelectedNodePath%>', true, true); + + // select the parent node once found. + var iv = setInterval(function() { + var node = treeApi.findNode('<%=this.SelectedNodePath%>'.split(',').pop(), true); + if(node != false) { + treeApi.selectNode(node, false, true); + clearInterval(iv); + } }, 500); <% } %> From 7a2a4445793d680222c72cec196f31dd02e3f28e Mon Sep 17 00:00:00 2001 From: Jeremy Pyne Date: Wed, 7 Aug 2013 15:28:41 -0400 Subject: [PATCH 3/5] Fix for select parent o move or copy in 6.1.3. --- src/Umbraco.Web/Umbraco.Web.csproj | 11 +++++++---- .../umbraco/dialogs/moveOrCopy.aspx.cs | 4 ++-- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 67d9b6335d..2986b64059 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -291,7 +291,7 @@ - + @@ -1871,7 +1871,8 @@ - + + @@ -1935,7 +1936,9 @@ - + + ASPXCodeBehind + @@ -2058,4 +2061,4 @@ - \ No newline at end of file + 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 3069d9485d..a66dd8634c 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/moveOrCopy.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/moveOrCopy.aspx.cs @@ -90,8 +90,8 @@ namespace umbraco.dialogs } // Preselect the parent of the seslected item. - if(cmsNode.ParentId > 0) - JTree.SelectedNodePath = cmsNode.Parent.Path; + 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)) From e65a71a05a265bda0cccfda129377cbe73602299 Mon Sep 17 00:00:00 2001 From: Jeremy Pyne Date: Thu, 29 Aug 2013 11:00:15 -0400 Subject: [PATCH 4/5] Added code to pre-select the current node in content tree pickers based on the location of the document in the tree. This is a HUGE time saver with an even moderately complex site hierarchy. --- src/Umbraco.Web.UI/umbraco/controls/Tree/TreeControl.ascx | 8 -------- .../umbraco/controls/Tree/TreeControl.ascx | 8 -------- .../umbraco/dialogs/treePicker.aspx.cs | 6 ++++++ src/umbraco.controls/TreePicker/SimpleContentPicker.cs | 4 ++++ src/umbraco.editorControls/pagepicker/pagePicker.cs | 4 ++++ 5 files changed, 14 insertions(+), 16 deletions(-) diff --git a/src/Umbraco.Web.UI/umbraco/controls/Tree/TreeControl.ascx b/src/Umbraco.Web.UI/umbraco/controls/Tree/TreeControl.ascx index fb4fac1e2d..2d143e6153 100644 --- a/src/Umbraco.Web.UI/umbraco/controls/Tree/TreeControl.ascx +++ b/src/Umbraco.Web.UI/umbraco/controls/Tree/TreeControl.ascx @@ -51,14 +51,6 @@ jQuery(document).ready(function() { setTimeout(function() { treeApi = jQuery("#<%=ClientID%>").UmbracoTreeAPI(); treeApi.syncTree('<%=this.SelectedNodePath%>', true, true); - - // select the parent node once found. - var iv = setInterval(function() { - var node = treeApi.findNode('<%=this.SelectedNodePath%>'.split(',').pop(), true); - if(node != false) { - treeApi.selectNode(node, false, true); - clearInterval(iv); - } }, 500); <% } %> 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 fb4fac1e2d..2d143e6153 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/TreeControl.ascx +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/TreeControl.ascx @@ -51,14 +51,6 @@ jQuery(document).ready(function() { setTimeout(function() { treeApi = jQuery("#<%=ClientID%>").UmbracoTreeAPI(); treeApi.syncTree('<%=this.SelectedNodePath%>', true, true); - - // select the parent node once found. - var iv = setInterval(function() { - var node = treeApi.findNode('<%=this.SelectedNodePath%>'.split(',').pop(), true); - if(node != false) { - treeApi.selectNode(node, false, true); - clearInterval(iv); - } }, 500); <% } %> 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"); } } From 8656d3e4b985cda7f83b742ebd8294be59acfc89 Mon Sep 17 00:00:00 2001 From: Shannon Date: Thu, 19 Dec 2013 11:35:53 +1100 Subject: [PATCH 5/5] adds some null checks, removes old unused webforms files for tree control --- .../umbraco/controls/Tree/TreeControl.ascx | 6 +- .../umbraco/controls/Tree/TreeControl.ascx | 77 ------- .../umbraco/controls/Tree/TreeControl.ascx.cs | 188 ++++++++++++++++-- .../Tree/TreeControl.ascx.designer.cs | 159 --------------- .../TreePicker/SimpleContentPicker.cs | 5 +- .../pagepicker/pagePicker.cs | 9 +- 6 files changed, 179 insertions(+), 265 deletions(-) delete mode 100644 src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/TreeControl.ascx delete mode 100644 src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/TreeControl.ascx.designer.cs diff --git a/src/Umbraco.Web.UI/umbraco/controls/Tree/TreeControl.ascx b/src/Umbraco.Web.UI/umbraco/controls/Tree/TreeControl.ascx index 027bd1286a..671d9f2530 100644 --- a/src/Umbraco.Web.UI/umbraco/controls/Tree/TreeControl.ascx +++ b/src/Umbraco.Web.UI/umbraco/controls/Tree/TreeControl.ascx @@ -1,4 +1,4 @@ -<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="TreeControl.ascx.cs" Inherits="umbraco.controls.Tree.TreeControl" %> +<%@ Control Language="C#" AutoEventWireup="true" Inherits="umbraco.controls.Tree.TreeControl" %> <%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %> @@ -47,10 +47,10 @@ 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)) {%> + <%if(string.IsNullOrEmpty(SelectedNodePath) == false) {%> setTimeout(function() { treeApi = jQuery("#<%=ClientID%>").UmbracoTreeAPI(); - treeApi.syncTree('<%=this.SelectedNodePath%>', true, true); + treeApi.syncTree('<%=SelectedNodePath%>', true, true); }, 500); <% } %> diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/TreeControl.ascx b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/TreeControl.ascx deleted file mode 100644 index 027bd1286a..0000000000 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/TreeControl.ascx +++ /dev/null @@ -1,77 +0,0 @@ -<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="TreeControl.ascx.cs" Inherits="umbraco.controls.Tree.TreeControl" %> -<%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %> - - - - - - - - - - - - - - - - - - - - - - -
-
-
-
\ No newline at end of file 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 c9d4cc8f74..8573ae471d 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 @@ -325,29 +325,29 @@ namespace umbraco.controls.Tree public string GetLegacyIActionJavascript() { StringBuilder js = new StringBuilder(); - foreach (IAction a in global::umbraco.BusinessLogic.Actions.Action.GetAll()) - { - // NH: Added a try/catch block to this as an error in a 3rd party action can crash the whole menu initialization - try - { - if (!string.IsNullOrEmpty(a.Alias) && (!string.IsNullOrEmpty(a.JsFunctionName) || !string.IsNullOrEmpty(a.JsSource))) - { - // if the action is using invalid javascript we need to do something about this - if (!umbraco.BusinessLogic.Actions.Action.ValidateActionJs(a)) - { - js.AppendLine("function IActionProxy_" + umbraco.cms.helpers.Casing.SafeAlias(a.Alias) + "() {"); - js.AppendLine(umbraco.BusinessLogic.Actions.Action.ConvertLegacyJs(a.JsFunctionName)); // .Replace("openModal", "UmbClientMgr.openModalWindow")); - js.AppendLine("}"); - } - } - } - catch (Exception ee) - { - LogHelper.Error("Error initializing tree action", ee); - } - } + foreach (IAction a in global::umbraco.BusinessLogic.Actions.Action.GetAll()) + { + // NH: Added a try/catch block to this as an error in a 3rd party action can crash the whole menu initialization + try + { + if (!string.IsNullOrEmpty(a.Alias) && (!string.IsNullOrEmpty(a.JsFunctionName) || !string.IsNullOrEmpty(a.JsSource))) + { + // if the action is using invalid javascript we need to do something about this + if (!umbraco.BusinessLogic.Actions.Action.ValidateActionJs(a)) + { + js.AppendLine("function IActionProxy_" + umbraco.cms.helpers.Casing.SafeAlias(a.Alias) + "() {"); + js.AppendLine(umbraco.BusinessLogic.Actions.Action.ConvertLegacyJs(a.JsFunctionName)); // .Replace("openModal", "UmbClientMgr.openModalWindow")); + js.AppendLine("}"); + } + } + } + catch (Exception ee) + { + LogHelper.Error("Error initializing tree action", ee); + } + } - if (js.Length != 0) + if (js.Length != 0) { js.Insert(0, "// This javascript is autogenerated by Umbraco to ensure legacy compatiblity with old context menu items\n\n"); } @@ -450,5 +450,149 @@ namespace umbraco.controls.Tree //if everything is null then return the default app return DEFAULT_APP; } + + /// + /// CssInclude2 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::ClientDependency.Core.Controls.CssInclude CssInclude2; + + /// + /// CssInclude3 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::ClientDependency.Core.Controls.CssInclude CssInclude3; + + /// + /// CssInclude1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::ClientDependency.Core.Controls.CssInclude CssInclude1; + + /// + /// JsInclude1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::ClientDependency.Core.Controls.JsInclude JsInclude1; + + /// + /// JsInclude2 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::ClientDependency.Core.Controls.JsInclude JsInclude2; + + /// + /// JsInclude3 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::ClientDependency.Core.Controls.JsInclude JsInclude3; + + /// + /// JsInclude4 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::ClientDependency.Core.Controls.JsInclude JsInclude4; + + /// + /// JsInclude5 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::ClientDependency.Core.Controls.JsInclude JsInclude5; + + /// + /// JsInclude6 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::ClientDependency.Core.Controls.JsInclude JsInclude6; + + /// + /// JsInclude8 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::ClientDependency.Core.Controls.JsInclude JsInclude8; + + /// + /// JsInclude11 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::ClientDependency.Core.Controls.JsInclude JsInclude11; + + /// + /// JsInclude7 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::ClientDependency.Core.Controls.JsInclude JsInclude7; + + /// + /// JsInclude12 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::ClientDependency.Core.Controls.JsInclude JsInclude12; + + /// + /// JsInclude9 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::ClientDependency.Core.Controls.JsInclude JsInclude9; + + /// + /// JsInclude10 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::ClientDependency.Core.Controls.JsInclude JsInclude10; + + /// + /// TreeContainer control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.HtmlControls.HtmlGenericControl TreeContainer; } } \ No newline at end of file diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/TreeControl.ascx.designer.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/TreeControl.ascx.designer.cs deleted file mode 100644 index 829bf5312d..0000000000 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/TreeControl.ascx.designer.cs +++ /dev/null @@ -1,159 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace umbraco.controls.Tree { - - - public partial class TreeControl { - - /// - /// CssInclude2 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::ClientDependency.Core.Controls.CssInclude CssInclude2; - - /// - /// CssInclude3 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::ClientDependency.Core.Controls.CssInclude CssInclude3; - - /// - /// CssInclude1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::ClientDependency.Core.Controls.CssInclude CssInclude1; - - /// - /// JsInclude1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::ClientDependency.Core.Controls.JsInclude JsInclude1; - - /// - /// JsInclude2 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::ClientDependency.Core.Controls.JsInclude JsInclude2; - - /// - /// JsInclude3 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::ClientDependency.Core.Controls.JsInclude JsInclude3; - - /// - /// JsInclude4 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::ClientDependency.Core.Controls.JsInclude JsInclude4; - - /// - /// JsInclude5 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::ClientDependency.Core.Controls.JsInclude JsInclude5; - - /// - /// JsInclude6 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::ClientDependency.Core.Controls.JsInclude JsInclude6; - - /// - /// JsInclude8 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::ClientDependency.Core.Controls.JsInclude JsInclude8; - - /// - /// JsInclude11 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::ClientDependency.Core.Controls.JsInclude JsInclude11; - - /// - /// JsInclude7 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::ClientDependency.Core.Controls.JsInclude JsInclude7; - - /// - /// JsInclude12 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::ClientDependency.Core.Controls.JsInclude JsInclude12; - - /// - /// JsInclude9 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::ClientDependency.Core.Controls.JsInclude JsInclude9; - - /// - /// JsInclude10 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::ClientDependency.Core.Controls.JsInclude JsInclude10; - - /// - /// TreeContainer control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.HtmlControls.HtmlGenericControl TreeContainer; - } -} diff --git a/src/umbraco.controls/TreePicker/SimpleContentPicker.cs b/src/umbraco.controls/TreePicker/SimpleContentPicker.cs index 3d70cbbef4..21adda53a6 100644 --- a/src/umbraco.controls/TreePicker/SimpleContentPicker.cs +++ b/src/umbraco.controls/TreePicker/SimpleContentPicker.cs @@ -13,8 +13,11 @@ namespace umbraco.uicontrols.TreePicker { get { - if (HttpContext.Current.Request.QueryString["id"] != null) + if (HttpContext.Current != null && 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 791bb20352..932fe4fb40 100644 --- a/src/umbraco.editorControls/pagepicker/pagePicker.cs +++ b/src/umbraco.editorControls/pagepicker/pagePicker.cs @@ -10,6 +10,7 @@ using umbraco.interfaces; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using umbraco.editorControls.pagepicker; +using umbraco.uicontrols; using umbraco.uicontrols.TreePicker; namespace umbraco.editorControls { @@ -27,10 +28,12 @@ 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"]; + if (HttpContext.Current != null && HttpContext.Current.Request.QueryString["id"] != null) + { + return TreeUrlGenerator.GetPickerUrl(Umbraco.Core.Constants.Applications.Content, "content") + "&selected=" + HttpContext.Current.Request.QueryString["id"]; + } - return TreeService.GetPickerUrl(Umbraco.Core.Constants.Applications.Content, "content"); + return TreeUrlGenerator.GetPickerUrl(Umbraco.Core.Constants.Applications.Content, "content"); } }