From cded3fa060b76d3de3ac250c3ef57d102b89d7a4 Mon Sep 17 00:00:00 2001 From: "agrath@gmail.com" Date: Mon, 11 Jun 2012 16:44:31 -0100 Subject: [PATCH] Change DeepLink class so it can return internal or external links and add GetAnchor method (renaming Get to GetUrl) --- umbraco/cms/helpers/DeepLink.cs | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/umbraco/cms/helpers/DeepLink.cs b/umbraco/cms/helpers/DeepLink.cs index f5ed0c6f82..e66a458146 100644 --- a/umbraco/cms/helpers/DeepLink.cs +++ b/umbraco/cms/helpers/DeepLink.cs @@ -23,7 +23,23 @@ namespace umbraco.cms.helpers string sPath = string.Join(",", treePath.ToArray()); return sPath; } - public static string Get(DeepLinkType type, string idOrFilePath) + public static string GetAnchor(DeepLinkType type, string idOrFilePath, bool useJavascript) + { + string url = GetUrl(type, idOrFilePath, useJavascript); + if (!string.IsNullOrEmpty(url)) + { + if (!useJavascript) + { + return string.Format("Edit >", url); + } + else + { + return string.Format("Edit >", url); + } + } + return null; + } + public static string GetUrl(DeepLinkType type, string idOrFilePath, bool useJavascript) { string basePath = "/umbraco/umbraco.aspx"; @@ -98,7 +114,15 @@ namespace umbraco.cms.helpers 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)); + if (!useJavascript) + { + string rightActionEncoded = HttpContext.Current.Server.UrlEncode(rightAction); + return string.Format("{0}?app={1}&rightAction={2}#{1}", basePath, section, rightActionEncoded); + } + else + { + return string.Format("javascript:UmbClientMgr.contentFrameAndSection('{0}','{1}');", section, rightAction); + } } } }