From 0404f4939db2ce5a449ce13045d2d5f67541a5ac Mon Sep 17 00:00:00 2001 From: leekelleher Date: Mon, 11 Jun 2012 09:06:53 -0100 Subject: [PATCH 01/21] fix for the RelationTypes tree namespace --- .../umbraco/Trees/RelationTypes/RegisterRelationTypeTree.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/umbraco/presentation/umbraco/Trees/RelationTypes/RegisterRelationTypeTree.cs b/umbraco/presentation/umbraco/Trees/RelationTypes/RegisterRelationTypeTree.cs index bdd0355ad5..f196346f54 100644 --- a/umbraco/presentation/umbraco/Trees/RelationTypes/RegisterRelationTypeTree.cs +++ b/umbraco/presentation/umbraco/Trees/RelationTypes/RegisterRelationTypeTree.cs @@ -18,7 +18,7 @@ namespace umbraco.cms.presentation.Trees.RelationTypes { Application developerSection = Application.getByAlias("developer"); - ApplicationTree relationTypesApplicationTree = new ApplicationTree(false, true, 1, "developer", "relationTypesTree", "Relation Types", ".sprTreeFolder", ".sprTreeFolder_0", "Umbraco.RelationTypes", "RelationTypeTree", null); + ApplicationTree relationTypesApplicationTree = new ApplicationTree(false, true, 3, "developer", "relationTypesTree", "Relation Types", ".sprTreeFolder", ".sprTreeFolder_0", "umbraco", "cms.presentation.Trees.RelationTypes.RelationTypeTree", null); TreeDefinition relationTypesTreeDefinition = new TreeDefinition(typeof(umbraco.cms.presentation.Trees.RelationTypes.RelationTypeTree), relationTypesApplicationTree, developerSection); From 9456abe36e38938d35a99a575b00752e9b96a7f0 Mon Sep 17 00:00:00 2001 From: leekelleher Date: Mon, 11 Jun 2012 09:10:44 -0100 Subject: [PATCH 02/21] commented out obsolete GetDepth method --- .../umbraco/uQuery/MediaExtensions.cs | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/umbraco/presentation/umbraco/uQuery/MediaExtensions.cs b/umbraco/presentation/umbraco/uQuery/MediaExtensions.cs index 7bddbf5662..74d7103396 100644 --- a/umbraco/presentation/umbraco/uQuery/MediaExtensions.cs +++ b/umbraco/presentation/umbraco/uQuery/MediaExtensions.cs @@ -125,16 +125,16 @@ namespace umbraco } } - /// - /// Extension method on Meia obj to get it's depth - /// - /// an umbraco.cms.businesslogic.media.Media object - /// an int representing the depth of the Media object in the tree - [Obsolete("Use .Level instead")] - public static int GetDepth(this Media media) - { - return media.Path.Split(',').ToList().Count; - } + /////// + /////// Extension method on Meia obj to get it's depth + /////// + /////// an umbraco.cms.businesslogic.media.Media object + /////// an int representing the depth of the Media object in the tree + ////[Obsolete("Use .Level instead")] + ////public static int GetDepth(this Media media) + ////{ + //// return media.Path.Split(',').ToList().Count; + ////} /// /// Tell me the level of this node (0 = root) From a9cd8aec79c849c2b6d7fd9fdbd744fb6f2f23de Mon Sep 17 00:00:00 2001 From: Hendy Date: Mon, 11 Jun 2012 09:57:48 -0100 Subject: [PATCH 03/21] uQuery: Standardising method signatures, from List to IEnumerable --- .../XPathCheckBoxListPreValueEditor.cs | 3 ++- .../XPathDropDownListPreValueEditor.cs | 3 ++- .../presentation/umbraco/uQuery/NodeExtensions.cs | 12 ------------ .../presentation/umbraco/uQuery/uQuery-Document.cs | 6 +++--- .../presentation/umbraco/uQuery/uQuery-Media.cs | 12 ++++++------ .../presentation/umbraco/uQuery/uQuery-Members.cs | 10 +++++----- .../presentation/umbraco/uQuery/uQuery-Nodes.cs | 14 +++++++------- 7 files changed, 25 insertions(+), 35 deletions(-) diff --git a/components/editorControls/XPathCheckBoxList/XPathCheckBoxListPreValueEditor.cs b/components/editorControls/XPathCheckBoxList/XPathCheckBoxListPreValueEditor.cs index cd07ceeae3..bd1c4c51cd 100644 --- a/components/editorControls/XPathCheckBoxList/XPathCheckBoxListPreValueEditor.cs +++ b/components/editorControls/XPathCheckBoxList/XPathCheckBoxListPreValueEditor.cs @@ -3,6 +3,7 @@ using System.Web.UI; using System.Web.UI.WebControls; using System.Xml.XPath; using umbraco.cms.businesslogic.datatype; +using System.Linq; namespace umbraco.editorControls.XPathCheckBoxList { @@ -139,7 +140,7 @@ namespace umbraco.editorControls.XPathCheckBoxList try { - if (uQuery.GetNodesByXPath(xPath).Count >= 0) + if (uQuery.GetNodesByXPath(xPath).Count() >= 0) { isValid = true; } diff --git a/components/editorControls/XPathDropDownList/XPathDropDownListPreValueEditor.cs b/components/editorControls/XPathDropDownList/XPathDropDownListPreValueEditor.cs index cb67106f07..66adf19e3d 100644 --- a/components/editorControls/XPathDropDownList/XPathDropDownListPreValueEditor.cs +++ b/components/editorControls/XPathDropDownList/XPathDropDownListPreValueEditor.cs @@ -1,4 +1,5 @@ using System; +using System.Linq; using System.Web.UI; using System.Web.UI.WebControls; using System.Xml.XPath; @@ -119,7 +120,7 @@ namespace umbraco.editorControls.XPathDropDownList try { - if (uQuery.GetNodesByXPath(xPath).Count >= 0) + if (uQuery.GetNodesByXPath(xPath).Count() >= 0) { isValid = true; } diff --git a/umbraco/presentation/umbraco/uQuery/NodeExtensions.cs b/umbraco/presentation/umbraco/uQuery/NodeExtensions.cs index 70cca1338c..85232ee16f 100644 --- a/umbraco/presentation/umbraco/uQuery/NodeExtensions.cs +++ b/umbraco/presentation/umbraco/uQuery/NodeExtensions.cs @@ -576,18 +576,6 @@ namespace umbraco return node.NiceUrl.Replace(library.RequestServerVariables("HTTP_HOST"), string.Concat((ssl ? "https://" : "http://"), domain.Name)); } - /// - /// Determines whether [the specified node] [is hidden from navigation]. - /// - /// The node. - /// - /// true if [the specified node] [is hidden from navigation]; otherwise, false. - /// - public static bool IsHiddenFromNavigation(this Node node) - { - // TODO: [OA] Document on Codeplex. Is this one really necessary? - [HR] this one could be confusing as depends on default naming convention - return node.GetProperty("umbracoNaviHide"); - } #pragma warning disable 0618 /// diff --git a/umbraco/presentation/umbraco/uQuery/uQuery-Document.cs b/umbraco/presentation/umbraco/uQuery/uQuery-Document.cs index 608fbd142e..894acebc79 100644 --- a/umbraco/presentation/umbraco/uQuery/uQuery-Document.cs +++ b/umbraco/presentation/umbraco/uQuery/uQuery-Document.cs @@ -10,7 +10,7 @@ namespace umbraco /// /// string csv of IDs /// collection or emtpy collection - public static List GetDocumentsByCsv(string csv) + public static IEnumerable GetDocumentsByCsv(string csv) { var documents = new List(); var ids = uQuery.GetCsvIds(csv); @@ -35,7 +35,7 @@ namespace umbraco /// /// The XML. /// - public static List GetDocumentsByXml(string xml) + public static IEnumerable GetDocumentsByXml(string xml) { var documents = new List(); var ids = uQuery.GetXmlIds(xml); @@ -130,7 +130,7 @@ namespace umbraco /// /// generic list of Document objects /// a collection of document IDs and their text fields - public static Dictionary ToNameIds(this List documents) + public static Dictionary ToNameIds(this IEnumerable documents) { var dictionary = new Dictionary(); diff --git a/umbraco/presentation/umbraco/uQuery/uQuery-Media.cs b/umbraco/presentation/umbraco/uQuery/uQuery-Media.cs index 97acaacca2..c56b086012 100644 --- a/umbraco/presentation/umbraco/uQuery/uQuery-Media.cs +++ b/umbraco/presentation/umbraco/uQuery/uQuery-Media.cs @@ -10,7 +10,7 @@ namespace umbraco /// /// XPath expression /// collection or empty collection - public static List GetMediaByXPath(string xPath) + public static IEnumerable GetMediaByXPath(string xPath) { var media = new List(); var xmlDocument = uQuery.GetPublishedXml(UmbracoObjectType.Media); @@ -34,7 +34,7 @@ namespace umbraco /// /// string csv of IDs /// collection or emtpy collection - public static List GetMediaByCsv(string csv) + public static IEnumerable GetMediaByCsv(string csv) { var media = new List(); var ids = uQuery.GetCsvIds(csv); @@ -59,7 +59,7 @@ namespace umbraco /// /// The XML. /// - public static List GetMediaByXml(string xml) + public static IEnumerable GetMediaByXml(string xml) { var media = new List(); var ids = uQuery.GetXmlIds(xml); @@ -84,7 +84,7 @@ namespace umbraco /// /// name of node to look for /// list of nodes, or empty list - public static List GetMediaByName(string name) + public static IEnumerable GetMediaByName(string name) { return uQuery.GetMediaByXPath(string.Concat("descendant::*[@nodeName='", name, "']")); } @@ -94,7 +94,7 @@ namespace umbraco /// /// The media type alias /// list of media, or empty list - public static List GetMediaByType(string mediaTypeAlias) + public static IEnumerable GetMediaByType(string mediaTypeAlias) { // Both XML schema versions have this attribute return uQuery.GetMediaByXPath(string.Concat("descendant::*[@nodeTypeAlias='", mediaTypeAlias, "']")); @@ -143,7 +143,7 @@ namespace umbraco /// /// generic list of Media objects /// a collection of mediaIDs and their text fields - public static Dictionary ToNameIds(this List media) + public static Dictionary ToNameIds(this IEnumerable media) { var dictionary = new Dictionary(); diff --git a/umbraco/presentation/umbraco/uQuery/uQuery-Members.cs b/umbraco/presentation/umbraco/uQuery/uQuery-Members.cs index 5453e384bf..1a99a2bde2 100644 --- a/umbraco/presentation/umbraco/uQuery/uQuery-Members.cs +++ b/umbraco/presentation/umbraco/uQuery/uQuery-Members.cs @@ -10,7 +10,7 @@ namespace umbraco /// /// XPath expression /// collection or empty collection - public static List GetMembersByXPath(string xPath) + public static IEnumerable GetMembersByXPath(string xPath) { var members = new List(); var xmlDocument = uQuery.GetPublishedXml(UmbracoObjectType.Member); @@ -34,7 +34,7 @@ namespace umbraco /// /// string csv of IDs /// collection or emtpy collection - public static List GetMembersByCsv(string csv) + public static IEnumerable GetMembersByCsv(string csv) { var members = new List(); var ids = uQuery.GetCsvIds(csv); @@ -59,7 +59,7 @@ namespace umbraco /// /// The XML. /// - public static List GetMembersByXml(string xml) + public static IEnumerable GetMembersByXml(string xml) { var members = new List(); var ids = uQuery.GetXmlIds(xml); @@ -81,7 +81,7 @@ namespace umbraco /// /// The member type alias /// list of members, or empty list - public static List GetMembersByType(string memberTypeAlias) + public static IEnumerable GetMembersByType(string memberTypeAlias) { // Both XML schema versions have this attribute return uQuery.GetMembersByXPath(string.Concat("descendant::*[@nodeTypeAlias='", memberTypeAlias, "']")); @@ -131,7 +131,7 @@ namespace umbraco /// /// generic list of Member objects /// a collection of memberIDs and their login names - public static Dictionary ToNameIds(this List members) + public static Dictionary ToNameIds(this IEnumerable members) { var dictionary = new Dictionary(); diff --git a/umbraco/presentation/umbraco/uQuery/uQuery-Nodes.cs b/umbraco/presentation/umbraco/uQuery/uQuery-Nodes.cs index cba1e99acd..d1e14a3417 100644 --- a/umbraco/presentation/umbraco/uQuery/uQuery-Nodes.cs +++ b/umbraco/presentation/umbraco/uQuery/uQuery-Nodes.cs @@ -23,7 +23,7 @@ namespace umbraco /// XPath expression to get Nodes, can use $ancestorOrSelf which will use the current Node if published, else it'll use the nearest published parent /// $currentPage will be depreciated /// an empty collection or a collection of nodes - public static List GetNodesByXPath(string xpath) + public static IEnumerable GetNodesByXPath(string xpath) { var nodes = new List(); @@ -72,7 +72,7 @@ namespace umbraco /// /// string csv of Ids /// an empty collection or a collection or Nodes - public static List GetNodesByCsv(string csv) + public static IEnumerable GetNodesByCsv(string csv) { var nodes = new List(); var ids = uQuery.GetCsvIds(csv); @@ -104,7 +104,7 @@ namespace umbraco /// " /// /// an empty list or a list of nodes - public static List GetNodesByXml(string xml) + public static IEnumerable GetNodesByXml(string xml) { var nodes = new List(); var ids = uQuery.GetXmlIds(xml); @@ -129,7 +129,7 @@ namespace umbraco /// /// name of node to look for /// list of nodes, or empty list - public static List GetNodesByName(string name) + public static IEnumerable GetNodesByName(string name) { return uQuery.GetNodesByXPath(string.Concat("descendant::*[@nodeName='", name, "']")); } @@ -139,7 +139,7 @@ namespace umbraco /// /// The document type alias /// list of nodes, or empty list - public static List GetNodesByType(string documentTypeAlias) + public static IEnumerable GetNodesByType(string documentTypeAlias) { if (uQuery.IsLegacyXmlSchema()) { @@ -156,7 +156,7 @@ namespace umbraco /// /// The document type id. /// - public static List GetNodesByType(int documentTypeId) + public static IEnumerable GetNodesByType(int documentTypeId) { return uQuery.GetNodesByXPath(string.Concat("descendant::*[@nodeType='", documentTypeId, "']")); } @@ -346,7 +346,7 @@ namespace umbraco /// /// generic list of node objects /// a collection of nodeIDs and their names - public static Dictionary ToNameIds(this List nodes) + public static Dictionary ToNameIds(this IEnumerable nodes) { var dictionary = new Dictionary(); From 851c1c8eac90f7ac20b54766493f0f850fd7e7ff Mon Sep 17 00:00:00 2001 From: "agrath@gmail.com" Date: Mon, 11 Jun 2012 11:05:29 -0100 Subject: [PATCH 04/21] Add enumeration for deep linking types --- umbraco/cms/helpers/DeepLinkType.cs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 umbraco/cms/helpers/DeepLinkType.cs diff --git a/umbraco/cms/helpers/DeepLinkType.cs b/umbraco/cms/helpers/DeepLinkType.cs new file mode 100644 index 0000000000..b686627fda --- /dev/null +++ b/umbraco/cms/helpers/DeepLinkType.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace umbraco.cms.helpers +{ + public enum DeepLinkType + { + Template, + DocumentType, + Content, + Media, + MediaType, + XSLT, + RazorScript, + Css, + Javascript, + Macro, + DataType + } +} From a660bbf552f45550bc416f35cbdc3aa93bfb0d26 Mon Sep 17 00:00:00 2001 From: "agrath@gmail.com" Date: Mon, 11 Jun 2012 11:05:59 -0100 Subject: [PATCH 05/21] Add timeout to UmbracoClientManager contentFrame for deep linking when not logged in --- .../Application/UmbracoClientManager.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/umbraco/presentation/umbraco_client/Application/UmbracoClientManager.js b/umbraco/presentation/umbraco_client/Application/UmbracoClientManager.js index c13ca60716..2f277a9c00 100644 --- a/umbraco/presentation/umbraco_client/Application/UmbracoClientManager.js +++ b/umbraco/presentation/umbraco_client/Application/UmbracoClientManager.js @@ -121,13 +121,14 @@ Umbraco.Sys.registerNamespace("Umbraco.Application"); } this._debug("contentFrame: parsed location: " + strLocation); - - if (typeof this.mainWindow().right != "undefined") { - this.mainWindow().right.location.href = strLocation; - } - else { - this.mainWindow().location.href = strLocation; //set the current windows location if the right frame doesn't exist int he current context - } + window.setTimeout(function(){ + if (typeof this.mainWindow().right != "undefined") { + this.mainWindow().right.location.href = strLocation; + } + else { + this.mainWindow().location.href = strLocation; //set the current windows location if the right frame doesn't exist int he current context + } + },200); } }, openModalWindow: function(url, name, showHeader, width, height, top, leftOffset, closeTriggers, onCloseCallback) { From 4d1feed86fd02e8ac693982a471e7677d128d55f Mon Sep 17 00:00:00 2001 From: "agrath@gmail.com" Date: Mon, 11 Jun 2012 11:06:49 -0100 Subject: [PATCH 06/21] Add timeout to umbraco.aspx for deep linking when not logged in --- umbraco/presentation/umbraco/umbraco.aspx | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/umbraco/presentation/umbraco/umbraco.aspx b/umbraco/presentation/umbraco/umbraco.aspx index 609ae50a9f..9418f921a1 100644 --- a/umbraco/presentation/umbraco/umbraco.aspx +++ b/umbraco/presentation/umbraco/umbraco.aspx @@ -148,7 +148,13 @@ var initApp = '<%=umbraco.presentation.UmbracoContext.Current.Request.QueryString["app"]%>'; var rightAction = '<%=umbraco.presentation.UmbracoContext.Current.Request.QueryString["rightAction"]%>'; var rightActionId = '<%=umbraco.presentation.UmbracoContext.Current.Request.QueryString["id"]%>'; - + var base = '<%=string.Format("{0}/", umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco))%>'; + var url = '' + if (rightActionId && rightActionId != '') { + url = base + rightAction + ".aspx?id=" + rightActionId + } else { + url = base + rightAction; + } jQuery(document).ready(function () { UmbClientMgr.setUmbracoPath("<%=umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) %>"); @@ -175,7 +181,13 @@ UmbClientMgr.historyManager().addHistory(initApp != "" ? initApp : UmbClientMgr.historyManager().getCurrent() != "" ? UmbClientMgr.historyManager().getCurrent() : "<%=DefaultApp%>", true); - UmbClientMgr.contentFrame(rightAction + ".aspx?id=" + rightActionId); + + //use a small timeout to handle load delays + //ref: http://our.umbraco.org/forum/developers/api-questions/32249-Direct-link-to-back-office-page + var timer = setTimeout(function () { + UmbClientMgr.contentFrame(url); + }, 200); + } else { UmbClientMgr.historyManager().addHistory(initApp != "" ? initApp : From 6c0847eb214baf6b8c7eec5bd548a37cf9fbb0a1 Mon Sep 17 00:00:00 2001 From: "agrath@gmail.com" Date: Mon, 11 Jun 2012 11:07:46 -0100 Subject: [PATCH 07/21] Add DeepLink class to Umbraco.Cms.Helpers to generate DeepLink links for the backoffice for the various types of item --- umbraco/cms/helpers/DeepLink.cs | 108 ++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 umbraco/cms/helpers/DeepLink.cs diff --git a/umbraco/cms/helpers/DeepLink.cs b/umbraco/cms/helpers/DeepLink.cs new file mode 100644 index 0000000000..f5ed0c6f82 --- /dev/null +++ b/umbraco/cms/helpers/DeepLink.cs @@ -0,0 +1,108 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using umbraco.BusinessLogic; +using System.Web; + +namespace umbraco.cms.helpers +{ + public class DeepLink + { + public static string GetTreePathFromFilePath(string filePath) + { + List treePath = new List(); + treePath.Add("-1"); + treePath.Add("init"); + string[] pathPaths = filePath.Split('/'); + pathPaths.Reverse(); + for (int p = 0; p < pathPaths.Length; p++) + { + treePath.Add(string.Join("/", pathPaths.Take(p + 1).ToArray())); + } + string sPath = string.Join(",", treePath.ToArray()); + return sPath; + } + public static string Get(DeepLinkType type, string idOrFilePath) + { + string basePath = "/umbraco/umbraco.aspx"; + + string section = string.Empty; + string editorUrl = string.Empty; + string idKey = string.Empty; + + switch (type) + { + case DeepLinkType.Content: + section = "content"; + editorUrl = "editContent.aspx"; + idKey = "id"; + break; + case DeepLinkType.Css: + section = "settings"; + editorUrl = "settings/stylesheet/editStylesheet.aspx"; + idKey = "id"; + break; + case DeepLinkType.DataType: + section = "developer"; + editorUrl = "developer/datatypes/editDataType.aspx"; + idKey = "id"; + break; + case DeepLinkType.DocumentType: + section = "settings"; + editorUrl = "settings/editNodeTypeNew.aspx"; + idKey = "id"; + break; + case DeepLinkType.Javascript: + section = "settings"; + editorUrl = "settings/scripts/editScript.aspx"; + idKey = "file"; + break; + case DeepLinkType.Macro: + section = "developer"; + editorUrl = "developer/macros/editMacro.aspx"; + idKey = "macroID"; + break; + case DeepLinkType.Media: + section = "media"; + editorUrl = "editMedia.aspx"; + idKey = "id"; + break; + case DeepLinkType.MediaType: + section = "settings"; + editorUrl = "settings/editMediaType.aspx"; + idKey = "id"; + break; + case DeepLinkType.RazorScript: + section = "developer"; + editorUrl = "developer/python/editPython.aspx"; + idKey = "file"; + break; + case DeepLinkType.Template: + section = "settings"; + editorUrl = "settings/editTemplate.aspx"; + idKey = "templateId"; + break; + case DeepLinkType.XSLT: + section = "developer"; + editorUrl = "developer/xslt/editXslt.aspx"; + idKey = "file"; + break; + } + if (section != string.Empty) + { + User currentUser = User.GetCurrent(); + if (currentUser != null) + { + //does the current user have access to this section + if (currentUser.Applications.Any(app => app.alias == section)) + { + string rightAction = string.Format("{0}?{1}={2}", editorUrl, idKey, idOrFilePath); + return string.Format("{0}?app={1}&rightAction={2}#{1}", basePath, section, HttpContext.Current.Server.UrlEncode(rightAction)); + } + } + } + return null; + } + } +} From fa426643ed0559031294d80fdbbada1315142fec Mon Sep 17 00:00:00 2001 From: "agrath@gmail.com" Date: Mon, 11 Jun 2012 11:08:19 -0100 Subject: [PATCH 08/21] Add DeepLink.cs and DeepLinkType.cs to umbraco.cms --- umbraco/cms/umbraco.cms.csproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/umbraco/cms/umbraco.cms.csproj b/umbraco/cms/umbraco.cms.csproj index 8582d789cd..db1a99cda0 100644 --- a/umbraco/cms/umbraco.cms.csproj +++ b/umbraco/cms/umbraco.cms.csproj @@ -255,6 +255,8 @@ + + Code From 5f1725e807bbca4e4ff71e9bcd56a6a17292a924 Mon Sep 17 00:00:00 2001 From: "agrath@gmail.com" Date: Mon, 11 Jun 2012 11:08:51 -0100 Subject: [PATCH 09/21] Override Path property on Templates to reflect the TreePath for deep linking --- .../cms/businesslogic/template/Template.cs | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/umbraco/cms/businesslogic/template/Template.cs b/umbraco/cms/businesslogic/template/Template.cs index da13c421fe..f5c6585d80 100644 --- a/umbraco/cms/businesslogic/template/Template.cs +++ b/umbraco/cms/businesslogic/template/Template.cs @@ -159,6 +159,41 @@ namespace umbraco.cms.businesslogic.template return masterpageContent; } + public new string Path + { + get + { + List path = new List(); + Template working = this; + while (working != null) + { + path.Add(working.Id); + try + { + if (working.MasterTemplate != 0) + { + working = new Template(working.MasterTemplate); + } + else + { + working = null; + } + } + catch (ArgumentException) + { + working = null; + } + } + path.Add(-1); + path.Reverse(); + string sPath = string.Join(",", path.ConvertAll(item => item.ToString()).ToArray()); + return sPath; + } + set + { + base.Path = value; + } + } public string Alias { From 65888b039e4e2fe51e4e37d282f1a36e8f456a2b Mon Sep 17 00:00:00 2001 From: "agrath@gmail.com" Date: Mon, 11 Jun 2012 11:09:13 -0100 Subject: [PATCH 10/21] Override Path property on DocumentTypes to reflect the TreePath for deep linking --- umbraco/cms/businesslogic/web/DocumentType.cs | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/umbraco/cms/businesslogic/web/DocumentType.cs b/umbraco/cms/businesslogic/web/DocumentType.cs index 326fab6111..f4ed811c9e 100644 --- a/umbraco/cms/businesslogic/web/DocumentType.cs +++ b/umbraco/cms/businesslogic/web/DocumentType.cs @@ -255,6 +255,42 @@ namespace umbraco.cms.businesslogic.web } } } + + public new string Path + { + get + { + List path = new List(); + DocumentType working = this; + while (working != null) + { + path.Add(working.Id); + try + { + if (working.MasterContentType != 0) + { + working = new DocumentType(working.MasterContentType); + } + else + { + working = null; + } + } + catch (ArgumentException) + { + working = null; + } + } + path.Add(-1); + path.Reverse(); + string sPath = string.Join(",", path.ConvertAll(item => item.ToString()).ToArray()); + return sPath; + } + set + { + base.Path = value; + } + } #endregion #region Public Methods From eea60fc63c97a5817d96ae6f2df740ff7e25cfef Mon Sep 17 00:00:00 2001 From: "agrath@gmail.com" Date: Mon, 11 Jun 2012 11:10:06 -0100 Subject: [PATCH 11/21] SyncTree for DataType deeplink --- .../developer/DataTypes/editDatatype.aspx.cs | 158 +++++++++--------- 1 file changed, 81 insertions(+), 77 deletions(-) diff --git a/umbraco/presentation/umbraco/developer/DataTypes/editDatatype.aspx.cs b/umbraco/presentation/umbraco/developer/DataTypes/editDatatype.aspx.cs index dca6316300..b583a7cd76 100644 --- a/umbraco/presentation/umbraco/developer/DataTypes/editDatatype.aspx.cs +++ b/umbraco/presentation/umbraco/developer/DataTypes/editDatatype.aspx.cs @@ -13,34 +13,35 @@ using umbraco.IO; namespace umbraco.cms.presentation.developer { - public partial class editDatatype : BasePages.UmbracoEnsuredPage - { - public editDatatype() - { + public partial class editDatatype : BasePages.UmbracoEnsuredPage + { + public editDatatype() + { CurrentApp = BusinessLogic.DefaultApps.developer.ToString(); - } - protected ImageButton save; - private cms.businesslogic.datatype.DataTypeDefinition dt; - cms.businesslogic.datatype.controls.Factory f; - private int _id = 0; - private interfaces.IDataPrevalue _prevalue; + } + protected ImageButton save; + private cms.businesslogic.datatype.DataTypeDefinition dt; + cms.businesslogic.datatype.controls.Factory f; + private int _id = 0; + private interfaces.IDataPrevalue _prevalue; - protected void Page_Load(object sender, System.EventArgs e) - { + protected void Page_Load(object sender, System.EventArgs e) + { pp_name.Text = ui.Text("name"); pp_renderControl.Text = ui.Text("renderControl"); pane_settings.Text = ui.Text("settings"); - pp_guid.Text = ui.Text("guid"); + pp_guid.Text = ui.Text("guid"); - _id = int.Parse(Request.QueryString["id"]); - dt = cms.businesslogic.datatype.DataTypeDefinition.GetDataTypeDefinition(_id); - - - f = new cms.businesslogic.datatype.controls.Factory(); + _id = int.Parse(Request.QueryString["id"]); + dt = cms.businesslogic.datatype.DataTypeDefinition.GetDataTypeDefinition(_id); - if (!IsPostBack) { + + f = new cms.businesslogic.datatype.controls.Factory(); + + if (!IsPostBack) + { txtName.Text = dt.Text; SortedList datatypes = new SortedList(); @@ -51,57 +52,60 @@ namespace umbraco.cms.presentation.developer IDictionaryEnumerator ide = datatypes.GetEnumerator(); string datatTypeId = dt.DataType != null ? dt.DataType.Id.ToString() : String.Empty; - while (ide.MoveNext()) { + while (ide.MoveNext()) + { ListItem li = new ListItem(); li.Text = ide.Key.ToString().Substring(0, ide.Key.ToString().IndexOf("|")); li.Value = ide.Value.ToString(); - + if (!String.IsNullOrEmpty(datatTypeId) && li.Value.ToString() == datatTypeId) li.Selected = true; - ddlRenderControl.Items.Add(li); + ddlRenderControl.Items.Add(li); } - ClientTools - .SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree().Tree.Alias) - .SyncTree(_id.ToString(), false); - + ClientTools + .SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree().Tree.Alias) + .SyncTree("-1,init," + _id.ToString(), false); + } if (dt.DataType != null) - litGuid.Text = dt.DataType.Id.ToString(); + litGuid.Text = dt.DataType.Id.ToString(); Panel1.Text = umbraco.ui.Text("edit") + " datatype: " + dt.Text; - insertPrevalueEditor(); - } + insertPrevalueEditor(); + } + + private void insertPrevalueEditor() + { + try + { + if (ddlRenderControl.SelectedIndex >= 0) + { + interfaces.IDataType o = f.DataType(new Guid(ddlRenderControl.SelectedValue)); + + o.DataTypeDefinitionId = dt.Id; + _prevalue = o.PrevalueEditor; - private void insertPrevalueEditor() { - try - { - if (ddlRenderControl.SelectedIndex >= 0) - { - interfaces.IDataType o = f.DataType(new Guid(ddlRenderControl.SelectedValue)); - - o.DataTypeDefinitionId = dt.Id; - _prevalue = o.PrevalueEditor; - if (o.PrevalueEditor.Editor != null) - plcEditorPrevalueControl.Controls.Add(o.PrevalueEditor.Editor); - } - else - { - plcEditorPrevalueControl.Controls.Add(new LiteralControl("No editor control selected")); - } - } - catch {} - - } + plcEditorPrevalueControl.Controls.Add(o.PrevalueEditor.Editor); + } + else + { + plcEditorPrevalueControl.Controls.Add(new LiteralControl("No editor control selected")); + } + } + catch { } - protected void save_click(object sender, System.Web.UI.ImageClickEventArgs e) { - // save prevalues; - if (_prevalue != null) - _prevalue.Save(); + } - dt.Text = txtName.Text; - - dt.DataType = f.DataType(new Guid(ddlRenderControl.SelectedValue)); + protected void save_click(object sender, System.Web.UI.ImageClickEventArgs e) + { + // save prevalues; + if (_prevalue != null) + _prevalue.Save(); + + dt.Text = txtName.Text; + + dt.DataType = f.DataType(new Guid(ddlRenderControl.SelectedValue)); System.Web.HttpRuntime.Cache.Remove(string.Format("UmbracoDataTypeDefinition{0}", dt.UniqueId)); @@ -109,36 +113,36 @@ namespace umbraco.cms.presentation.developer this.speechBubble(BasePages.BasePage.speechBubbleIcon.save, ui.Text("speechBubbles", "dataTypeSaved", null), ""); //Response.Redirect("editDataType.aspx?id=" + _id); - } + } - #region Web Form Designer generated code + #region Web Form Designer generated code - override protected void OnInit(EventArgs e) - { + override protected void OnInit(EventArgs e) + { save = Panel1.Menu.NewImageButton(); save.ID = "save"; save.Click += new System.Web.UI.ImageClickEventHandler(save_click); save.ImageUrl = SystemDirectories.Umbraco + "/images/editor/save.gif"; Panel1.hasMenu = true; - - // - // CODEGEN: This call is required by the ASP.NET Web Form Designer. - // - InitializeComponent(); - base.OnInit(e); - } - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - } - #endregion - } + // + // CODEGEN: This call is required by the ASP.NET Web Form Designer. + // + InitializeComponent(); + base.OnInit(e); + } + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + + } + #endregion + } } From c1ce79ef97735ae31c1abb8c85aed0a8723c69f2 Mon Sep 17 00:00:00 2001 From: "agrath@gmail.com" Date: Mon, 11 Jun 2012 11:10:26 -0100 Subject: [PATCH 12/21] SyncTree for Macro deeplink --- .../umbraco/developer/Macros/editMacro.aspx.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/umbraco/presentation/umbraco/developer/Macros/editMacro.aspx.cs b/umbraco/presentation/umbraco/developer/Macros/editMacro.aspx.cs index 11bc90ff4d..09d2242bbc 100644 --- a/umbraco/presentation/umbraco/developer/Macros/editMacro.aspx.cs +++ b/umbraco/presentation/umbraco/developer/Macros/editMacro.aspx.cs @@ -43,8 +43,8 @@ namespace umbraco.cms.presentation.developer { ClientTools - .SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree().Tree.Alias) - .SyncTree(m_macro.Id.ToString(), false); + .SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree().Tree.Alias) + .SyncTree("-1,init," + m_macro.Id.ToString(), false); macroName.Text = m_macro.Name; macroAlias.Text = m_macro.Alias; @@ -92,7 +92,7 @@ namespace umbraco.cms.presentation.developer populatePythonFiles(); // Load usercontrols - populateUserControls(IOHelper.MapPath(SystemDirectories.Usercontrols) ); + populateUserControls(IOHelper.MapPath(SystemDirectories.Usercontrols)); userControlList.Items.Insert(0, new ListItem("Browse usercontrols on server...", string.Empty)); userControlList.Attributes.Add("onChange", "document.getElementById('" + macroUserControl.ClientID + "').value = this[this.selectedIndex].value;"); @@ -307,12 +307,12 @@ namespace umbraco.cms.presentation.developer { DirectoryInfo di = new DirectoryInfo(path); - string rootDir = IOHelper.MapPath( SystemDirectories.Root ); - + string rootDir = IOHelper.MapPath(SystemDirectories.Root); + foreach (FileInfo uc in di.GetFiles("*.ascx")) { userControlList.Items.Add( - new ListItem( + new ListItem( uc.FullName.Substring(rootDir.Length).Replace(IOHelper.DirSepChar, '/'))); /* uc.FullName.IndexOf(usercontrolsDir), @@ -363,5 +363,5 @@ namespace umbraco.cms.presentation.developer #endregion } - + } From 2ceb50832270dc7087d4dd95eed87ceb4e39c14e Mon Sep 17 00:00:00 2001 From: "agrath@gmail.com" Date: Mon, 11 Jun 2012 11:10:42 -0100 Subject: [PATCH 13/21] SyncTree for Razor deeplink --- .../presentation/umbraco/developer/Python/editPython.aspx.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/umbraco/presentation/umbraco/developer/Python/editPython.aspx.cs b/umbraco/presentation/umbraco/developer/Python/editPython.aspx.cs index b50e3da7c3..b23a922c67 100644 --- a/umbraco/presentation/umbraco/developer/Python/editPython.aspx.cs +++ b/umbraco/presentation/umbraco/developer/Python/editPython.aspx.cs @@ -16,6 +16,7 @@ using System.Text.RegularExpressions; using umbraco.cms.businesslogic.macro; using umbraco.cms.presentation.Trees; using umbraco.IO; +using umbraco.cms.helpers; namespace umbraco.cms.presentation.developer { @@ -37,9 +38,11 @@ namespace umbraco.cms.presentation.developer if (!IsPostBack) { + string file = Request.QueryString["file"]; + string path = DeepLink.GetTreePathFromFilePath(file); ClientTools .SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree().Tree.Alias) - .SyncTree(Request.QueryString["file"], false); + .SyncTree(path, false); } } From 85860b5a9bcc83777e14e3838e0d18439d06f926 Mon Sep 17 00:00:00 2001 From: "agrath@gmail.com" Date: Mon, 11 Jun 2012 11:11:00 -0100 Subject: [PATCH 14/21] SyncTree for XSLT deeplink --- umbraco/presentation/umbraco/developer/Xslt/editXslt.aspx.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/umbraco/presentation/umbraco/developer/Xslt/editXslt.aspx.cs b/umbraco/presentation/umbraco/developer/Xslt/editXslt.aspx.cs index 80b6e55f12..a5f3dfac9b 100644 --- a/umbraco/presentation/umbraco/developer/Xslt/editXslt.aspx.cs +++ b/umbraco/presentation/umbraco/developer/Xslt/editXslt.aspx.cs @@ -12,6 +12,7 @@ using umbraco.uicontrols; using System.Net; using umbraco.cms.presentation.Trees; using umbraco.IO; +using umbraco.cms.helpers; namespace umbraco.cms.presentation.developer { @@ -33,9 +34,11 @@ namespace umbraco.cms.presentation.developer { if (!IsPostBack) { + string file = Request.QueryString["file"]; + string path = DeepLink.GetTreePathFromFilePath(file); ClientTools .SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree().Tree.Alias) - .SyncTree(Request.QueryString["file"], false); + .SyncTree(path, false); } From d554c098e3b607f3272cc4f93003326395c63b57 Mon Sep 17 00:00:00 2001 From: "agrath@gmail.com" Date: Mon, 11 Jun 2012 11:11:20 -0100 Subject: [PATCH 15/21] SyncTree for MediaType deeplink --- .../umbraco/settings/EditMediaType.aspx.cs | 110 ++++++++++-------- 1 file changed, 59 insertions(+), 51 deletions(-) diff --git a/umbraco/presentation/umbraco/settings/EditMediaType.aspx.cs b/umbraco/presentation/umbraco/settings/EditMediaType.aspx.cs index 752881d8d9..08bb6aabba 100644 --- a/umbraco/presentation/umbraco/settings/EditMediaType.aspx.cs +++ b/umbraco/presentation/umbraco/settings/EditMediaType.aspx.cs @@ -12,75 +12,83 @@ using umbraco.cms.presentation.Trees; namespace umbraco.cms.presentation.settings { - /// - /// Summary description for EditMediaType. - /// - public partial class EditMediaType : BasePages.UmbracoEnsuredPage - { + /// + /// Summary description for EditMediaType. + /// + public partial class EditMediaType : BasePages.UmbracoEnsuredPage + { - public EditMediaType() - { + public EditMediaType() + { CurrentApp = BusinessLogic.DefaultApps.settings.ToString(); - } - protected void Page_Load(object sender, System.EventArgs e) - { - if (!IsPostBack) - { - ClientTools - .SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree().Tree.Alias) - .SyncTree(helper.Request("id"), false); - } - } - protected void tmp_OnSave(object sender, System.EventArgs e) - { - - } + } + protected void Page_Load(object sender, System.EventArgs e) + { + if (!IsPostBack) + { + ClientTools + .SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree().Tree.Alias) + .SyncTree("-1,init," + helper.Request("id"), false); + } + } + protected void tmp_OnSave(object sender, System.EventArgs e) + { - protected override bool OnBubbleEvent(object source, EventArgs e) { + } - if (e is controls.SaveClickEventArgs) { + protected override bool OnBubbleEvent(object source, EventArgs e) + { + + if (e is controls.SaveClickEventArgs) + { controls.SaveClickEventArgs sce = (controls.SaveClickEventArgs)e; - if (sce.Message == "Saved") { + if (sce.Message == "Saved") + { int mtid = 0; speechBubble(speechBubbleIcon.save, "Mediatype saved", "Mediatype was successfully saved"); if (int.TryParse(Request.QueryString["id"], out mtid)) new cms.businesslogic.media.MediaType(mtid).Save(); - } else if (sce.Message.Contains("Tab")) { - speechBubble(speechBubbleIcon.info, "Tab added", sce.Message); - } else - { - base.speechBubble(sce.IconType, sce.Message, ""); } - + else if (sce.Message.Contains("Tab")) + { + speechBubble(speechBubbleIcon.info, "Tab added", sce.Message); + } + else + { + base.speechBubble(sce.IconType, sce.Message, ""); + } + return true; - } else { + } + else + { return false; } - + } - #region Web Form Designer generated code - override protected void OnInit(EventArgs e) - { - // - // CODEGEN: This call is required by the ASP.NET Web Form Designer. - // - InitializeComponent(); - base.OnInit(e); - } - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { + #region Web Form Designer generated code + override protected void OnInit(EventArgs e) + { + // + // CODEGEN: This call is required by the ASP.NET Web Form Designer. + // + InitializeComponent(); + base.OnInit(e); + } - } - #endregion - } + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + + } + #endregion + } } From a18639301bbeddfb83769a05e4482f9eb31a2fdc Mon Sep 17 00:00:00 2001 From: "agrath@gmail.com" Date: Mon, 11 Jun 2012 11:11:36 -0100 Subject: [PATCH 16/21] SyncTree for DocumentType deeplink --- .../umbraco/settings/EditNodeTypeNew.aspx.cs | 225 +++++++++--------- 1 file changed, 114 insertions(+), 111 deletions(-) diff --git a/umbraco/presentation/umbraco/settings/EditNodeTypeNew.aspx.cs b/umbraco/presentation/umbraco/settings/EditNodeTypeNew.aspx.cs index 5b83318f53..d113683502 100644 --- a/umbraco/presentation/umbraco/settings/EditNodeTypeNew.aspx.cs +++ b/umbraco/presentation/umbraco/settings/EditNodeTypeNew.aspx.cs @@ -13,19 +13,19 @@ using umbraco.cms.businesslogic.web; namespace umbraco.settings { - public partial class EditContentTypeNew : BasePages.UmbracoEnsuredPage - { - public EditContentTypeNew() - { + public partial class EditContentTypeNew : BasePages.UmbracoEnsuredPage + { + public EditContentTypeNew() + { CurrentApp = BusinessLogic.DefaultApps.settings.ToString(); - } + } - protected controls.ContentTypeControlNew ContentTypeControlNew1; - cms.businesslogic.web.DocumentType dt; - + protected controls.ContentTypeControlNew ContentTypeControlNew1; + cms.businesslogic.web.DocumentType dt; - private DataTable dtTemplates = new DataTable(); + + private DataTable dtTemplates = new DataTable(); override protected void OnInit(EventArgs e) { @@ -33,128 +33,131 @@ namespace umbraco.settings base.OnInit(e); } - protected void Page_Load(object sender, System.EventArgs e) - { - dt = new DocumentType(int.Parse(Request.QueryString["id"])); - if (!Page.IsPostBack) - { - bindTemplates(); + protected void Page_Load(object sender, System.EventArgs e) + { + dt = new DocumentType(int.Parse(Request.QueryString["id"])); + if (!Page.IsPostBack) + { + bindTemplates(); - ClientTools - .SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree().Tree.Alias) - .SyncTree(dt.Id.ToString(), false); + ClientTools + .SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree().Tree.Alias) + .SyncTree("-1,init," + dt.Path.Replace("-1,", ""), false); - } - + } - } - private void bindTemplates() { - cms.businesslogic.template.Template[] selectedTemplates = dt.allowedTemplates; + } - DataTable dtAllowedTemplates = new DataTable(); - dtTemplates.Columns.Add("name"); - dtTemplates.Columns.Add("id"); - dtTemplates.Columns.Add("selected"); + private void bindTemplates() + { + cms.businesslogic.template.Template[] selectedTemplates = dt.allowedTemplates; - - ddlTemplates.Items.Add(new ListItem("Ingen template","0")); - foreach (cms.businesslogic.template.Template t in cms.businesslogic.template.Template.GetAllAsList()) - { - DataRow dr = dtTemplates.NewRow(); - dr["name"] = t.Text; - dr["id"] = t.Id; - dr["selected"] = false; - foreach (cms.businesslogic.template.Template t1 in selectedTemplates) - if (t1 != null && t1.Id==t.Id) - dr["selected"] = true; - - dtTemplates.Rows.Add(dr); - - } - - templateList.Items.Clear(); + DataTable dtAllowedTemplates = new DataTable(); + dtTemplates.Columns.Add("name"); + dtTemplates.Columns.Add("id"); + dtTemplates.Columns.Add("selected"); - foreach (DataRow dr in dtTemplates.Rows) - { - ListItem li = new ListItem(dr["name"].ToString(),dr["id"].ToString()); - if (bool.Parse(dr["selected"].ToString())) - li.Selected = true; - templateList.Items.Add(li); - } - - ddlTemplates.Items.Clear(); - foreach (DataRow dr in dtTemplates.Rows) - { - ListItem li = new ListItem(dr["name"].ToString(),dr["id"].ToString()); - if (li.Value == dt.DefaultTemplate.ToString()) - li.Selected = true; - if (bool.Parse(dr["selected"].ToString())) - ddlTemplates.Items.Add(li); - } - if (ddlTemplates.Items.Count > 0) ddlTemplates.Enabled = true; - else ddlTemplates.Enabled = false; - // Add choose to ddlTemplates - ddlTemplates.Items.Insert(0, new ListItem(ui.Text("choose") + "...", "0")); + ddlTemplates.Items.Add(new ListItem("Ingen template", "0")); + foreach (cms.businesslogic.template.Template t in cms.businesslogic.template.Template.GetAllAsList()) + { + DataRow dr = dtTemplates.NewRow(); + dr["name"] = t.Text; + dr["id"] = t.Id; + dr["selected"] = false; + foreach (cms.businesslogic.template.Template t1 in selectedTemplates) + if (t1 != null && t1.Id == t.Id) + dr["selected"] = true; - } + dtTemplates.Rows.Add(dr); - - protected override bool OnBubbleEvent(object source, EventArgs args) - { - bool handled = false; - if (args is controls.SaveClickEventArgs) - { - controls.SaveClickEventArgs e = (controls.SaveClickEventArgs) args; - if (e.Message == "Saved") - { + } + + templateList.Items.Clear(); + + foreach (DataRow dr in dtTemplates.Rows) + { + ListItem li = new ListItem(dr["name"].ToString(), dr["id"].ToString()); + if (bool.Parse(dr["selected"].ToString())) + li.Selected = true; + templateList.Items.Add(li); + } + + ddlTemplates.Items.Clear(); + foreach (DataRow dr in dtTemplates.Rows) + { + ListItem li = new ListItem(dr["name"].ToString(), dr["id"].ToString()); + if (li.Value == dt.DefaultTemplate.ToString()) + li.Selected = true; + if (bool.Parse(dr["selected"].ToString())) + ddlTemplates.Items.Add(li); + } + if (ddlTemplates.Items.Count > 0) ddlTemplates.Enabled = true; + else ddlTemplates.Enabled = false; + + // Add choose to ddlTemplates + ddlTemplates.Items.Insert(0, new ListItem(ui.Text("choose") + "...", "0")); + + } + + + protected override bool OnBubbleEvent(object source, EventArgs args) + { + bool handled = false; + if (args is controls.SaveClickEventArgs) + { + controls.SaveClickEventArgs e = (controls.SaveClickEventArgs)args; + if (e.Message == "Saved") + { int dtid = 0; if (int.TryParse(Request.QueryString["id"], out dtid)) new cms.businesslogic.web.DocumentType(dtid).Save(); - base.speechBubble(e.IconType, ui.Text("contentTypeSavedHeader"),""); + base.speechBubble(e.IconType, ui.Text("contentTypeSavedHeader"), ""); - ArrayList tmp = new ArrayList(); + ArrayList tmp = new ArrayList(); - foreach (ListItem li in templateList.Items) { - if (li.Selected) tmp.Add(new cms.businesslogic.template.Template(int.Parse(li.Value))); - } + foreach (ListItem li in templateList.Items) + { + if (li.Selected) tmp.Add(new cms.businesslogic.template.Template(int.Parse(li.Value))); + } - cms.businesslogic.template.Template[] tt = new cms.businesslogic.template.Template[tmp.Count]; - for(int i = 0; i < tt.Length;i++) { - tt[i] = (cms.businesslogic.template.Template) tmp[i]; - } - - dt.allowedTemplates = tt; + cms.businesslogic.template.Template[] tt = new cms.businesslogic.template.Template[tmp.Count]; + for (int i = 0; i < tt.Length; i++) + { + tt[i] = (cms.businesslogic.template.Template)tmp[i]; + } + + dt.allowedTemplates = tt; - if (dt.allowedTemplates.Length > 0 && ddlTemplates.SelectedIndex >= 0) - { - dt.DefaultTemplate = int.Parse(ddlTemplates.SelectedValue); - } - else - dt.RemoveDefaultTemplate(); + if (dt.allowedTemplates.Length > 0 && ddlTemplates.SelectedIndex >= 0) + { + dt.DefaultTemplate = int.Parse(ddlTemplates.SelectedValue); + } + else + dt.RemoveDefaultTemplate(); - bindTemplates(); - } - else - { - base.speechBubble(e.IconType,e.Message,""); - } - handled = true; - } - return handled; - } + bindTemplates(); + } + else + { + base.speechBubble(e.IconType, e.Message, ""); + } + handled = true; + } + return handled; + } - protected void dgTemplate_itemdatabound(object sender,DataGridItemEventArgs e) - { - if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) - { - ((CheckBox)e.Item.FindControl("ckbAllowTemplate")).Checked = true; - } - } + protected void dgTemplate_itemdatabound(object sender, DataGridItemEventArgs e) + { + if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) + { + ((CheckBox)e.Item.FindControl("ckbAllowTemplate")).Checked = true; + } + } - - } + + } } From d9eb2e07f1972bf9c85d674baa7a1a65de72209a Mon Sep 17 00:00:00 2001 From: "agrath@gmail.com" Date: Mon, 11 Jun 2012 11:11:51 -0100 Subject: [PATCH 17/21] SyncTree for Template deeplink --- umbraco/presentation/umbraco/settings/editTemplate.aspx.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/umbraco/presentation/umbraco/settings/editTemplate.aspx.cs b/umbraco/presentation/umbraco/settings/editTemplate.aspx.cs index 342aaf55f9..bf7088258e 100644 --- a/umbraco/presentation/umbraco/settings/editTemplate.aspx.cs +++ b/umbraco/presentation/umbraco/settings/editTemplate.aspx.cs @@ -73,7 +73,7 @@ namespace umbraco.cms.presentation.settings ClientTools .SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree().Tree.Alias) - .SyncTree(_template.Id.ToString(), false); + .SyncTree("-1,init," + _template.Path.Replace("-1,", ""), false); LoadScriptingTemplates(); LoadMacros(); From 35fc307ca618a193403d8a4ac0124856ab48767e Mon Sep 17 00:00:00 2001 From: "agrath@gmail.com" Date: Mon, 11 Jun 2012 11:12:10 -0100 Subject: [PATCH 18/21] Synctree for Javascript deeplink --- .../settings/scripts/editScript.aspx.cs | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/umbraco/presentation/umbraco/settings/scripts/editScript.aspx.cs b/umbraco/presentation/umbraco/settings/scripts/editScript.aspx.cs index b3782a372e..b8fcaa6d86 100644 --- a/umbraco/presentation/umbraco/settings/scripts/editScript.aspx.cs +++ b/umbraco/presentation/umbraco/settings/scripts/editScript.aspx.cs @@ -13,6 +13,7 @@ using System.IO; using umbraco.cms.presentation.Trees; using umbraco.IO; using System.Linq; +using umbraco.cms.helpers; namespace umbraco.cms.presentation.settings.scripts { @@ -41,15 +42,15 @@ namespace umbraco.cms.presentation.settings.scripts NameTxt.Text = file; - + string path = ""; if (file.StartsWith("~/")) path = IOHelper.ResolveUrl(file); else path = IOHelper.ResolveUrl(SystemDirectories.Scripts + "/" + file); - - + + lttPath.Text = "" + path + ""; // validate file @@ -59,25 +60,26 @@ namespace umbraco.cms.presentation.settings.scripts StreamReader SR; string S; - SR = File.OpenText( IOHelper.MapPath( path )); + SR = File.OpenText(IOHelper.MapPath(path)); S = SR.ReadToEnd(); SR.Close(); - + editorSource.Text = S; - + Panel1.Text = ui.Text("editscript", base.getUser()); pp_name.Text = ui.Text("name", base.getUser()); pp_path.Text = ui.Text("path", base.getUser()); - if (!IsPostBack) - { - ClientTools - .SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree().Tree.Alias) - .SyncTree(file, false); - } + if (!IsPostBack) + { + string sPath = DeepLink.GetTreePathFromFilePath(file); + ClientTools + .SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree().Tree.Alias) + .SyncTree(sPath, false); + } } - + #region Web Form Designer generated code override protected void OnInit(EventArgs e) @@ -121,7 +123,7 @@ namespace umbraco.cms.presentation.settings.scripts Panel1.Menu.InsertSplitter(); uicontrols.MenuIconI helpIcon = Panel1.Menu.NewIcon(); - helpIcon.OnClickCommand = umbraco.BasePages.ClientTools.Scripts.OpenModalWindow(umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + "/settings/modals/showumbracotags.aspx?alias=" , ui.Text("template", "quickGuide"), 600, 580); + helpIcon.OnClickCommand = umbraco.BasePages.ClientTools.Scripts.OpenModalWindow(umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + "/settings/modals/showumbracotags.aspx?alias=", ui.Text("template", "quickGuide"), 600, 580); helpIcon.ImageURL = UmbracoPath + "/images/editor/help.png"; helpIcon.AltText = ui.Text("template", "quickGuide"); @@ -145,7 +147,8 @@ namespace umbraco.cms.presentation.settings.scripts - protected override void OnPreRender(EventArgs e) { + protected override void OnPreRender(EventArgs e) + { base.OnPreRender(e); ScriptManager.GetCurrent(Page).Services.Add(new ServiceReference("../webservices/codeEditorSave.asmx")); ScriptManager.GetCurrent(Page).Services.Add(new ServiceReference("../webservices/legacyAjaxCalls.asmx")); From ada7a7ff746109e9452a4851e8b9e9c3716cce44 Mon Sep 17 00:00:00 2001 From: "agrath@gmail.com" Date: Mon, 11 Jun 2012 11:12:35 -0100 Subject: [PATCH 19/21] Synctree for Css/Stylesheet deeplink --- .../umbraco/settings/stylesheet/editstylesheet.aspx.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/umbraco/presentation/umbraco/settings/stylesheet/editstylesheet.aspx.cs b/umbraco/presentation/umbraco/settings/stylesheet/editstylesheet.aspx.cs index 9388593bac..85c7f07b34 100644 --- a/umbraco/presentation/umbraco/settings/stylesheet/editstylesheet.aspx.cs +++ b/umbraco/presentation/umbraco/settings/stylesheet/editstylesheet.aspx.cs @@ -34,7 +34,7 @@ namespace umbraco.cms.presentation.settings.stylesheet ClientTools .SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree().Tree.Alias) - .SyncTree(helper.Request("id"), false); + .SyncTree("-1,init," + helper.Request("id"), false); } MenuIconI save = Panel1.Menu.NewIcon(); From ffdcc780a511eb42d5b28209511b96209a0e4f48 Mon Sep 17 00:00:00 2001 From: "agrath@gmail.com" Date: Mon, 11 Jun 2012 14:47:38 -0100 Subject: [PATCH 20/21] Add ReleaseNotes.txt - Please update when making changes in Core; will form public release notes with release --- umbraco.sln | 1 + 1 file changed, 1 insertion(+) diff --git a/umbraco.sln b/umbraco.sln index 18ca4aca3a..869917319a 100644 --- a/umbraco.sln +++ b/umbraco.sln @@ -6,6 +6,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution build.xml = build.xml default.build = default.build INDIGO64.testrunconfig = INDIGO64.testrunconfig + ReleaseNotes.txt = ReleaseNotes.txt SHANDEMVAIO.testrunconfig = SHANDEMVAIO.testrunconfig SHOCKING.testrunconfig = SHOCKING.testrunconfig umbraco weekly.build = umbraco weekly.build From 41bdf3d8b73d63d3aac3206b836e700cc3da0b1a Mon Sep 17 00:00:00 2001 From: "agrath@gmail.com" Date: Mon, 11 Jun 2012 14:47:56 -0100 Subject: [PATCH 21/21] File for above --- ReleaseNotes.txt | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 ReleaseNotes.txt diff --git a/ReleaseNotes.txt b/ReleaseNotes.txt new file mode 100644 index 0000000000..66ecaccbd0 --- /dev/null +++ b/ReleaseNotes.txt @@ -0,0 +1,14 @@ +##################################################################################################################################### +This document is intended to keep track of the changes that are made to the solution in each release. +Rather than a summary of work items fixed or the actual commit messages; these should be high level, user-facing +statements that describe what each commit/block of work actually changed with respect to the user. +For example (fake): Fixes work item #1234 is not as good as "Changes the behaviour of NodeFactory so GetProperty doesn't access the database" +Please group your changes into versions and tag them with your name so we know who to contact for code reviews etc. +These notes will form the release notes that go out with each public release +##################################################################################################################################### + +[Version 4.8] +GE 11/06/2012: + Fixed deep linking to Content,Media,DocumentType,MediaType,DataType,Css,Javascript,Razor,XSLT and + added a umbraco.cms.helpers.DeepLink.get class to return valid links based on type and + id (or file path in the case of js/xslt/razor) \ No newline at end of file