From 91c5ae420454a3b9efd40b1c8477f89977dcb2c8 Mon Sep 17 00:00:00 2001 From: hartvig Date: Wed, 13 Oct 2010 10:20:14 +0000 Subject: [PATCH] Implements 29156 [TFS Changeset #78363] --- .../presentation/umbraco/config/lang/en.xml | 1 + .../presentation/umbraco/dashboard.aspx.cs | 36 +++++++++++++++++++ .../umbraco_client/ui/default.css | 8 +++++ 3 files changed, 45 insertions(+) diff --git a/umbraco/presentation/umbraco/config/lang/en.xml b/umbraco/presentation/umbraco/config/lang/en.xml index 2943c94635..ec52b6521b 100644 --- a/umbraco/presentation/umbraco/config/lang/en.xml +++ b/umbraco/presentation/umbraco/config/lang/en.xml @@ -164,6 +164,7 @@ Restart Browse your website Visit + Click to hide this in the future Content diff --git a/umbraco/presentation/umbraco/dashboard.aspx.cs b/umbraco/presentation/umbraco/dashboard.aspx.cs index c6f2a1d284..ea64545bd6 100644 --- a/umbraco/presentation/umbraco/dashboard.aspx.cs +++ b/umbraco/presentation/umbraco/dashboard.aspx.cs @@ -13,6 +13,8 @@ using System.Xml; using System.Xml.XPath; using umbraco.uicontrols; using umbraco.IO; +using umbraco.cms.helpers; +using umbraco.BusinessLogic; namespace umbraco.cms.presentation { @@ -87,6 +89,7 @@ namespace umbraco.cms.presentation Control c = LoadControl(path); //resolving files from dashboard config which probably does not map to a virtual fi + tab.Controls.Add(AddShowOnceLink(uc)); tab.Controls.Add(c); } catch (Exception ee) @@ -133,6 +136,17 @@ namespace umbraco.cms.presentation } } + private LiteralControl AddShowOnceLink(XmlNode node) + { + LiteralControl onceLink = new LiteralControl(); + if (node.Attributes.GetNamedItem("showOnce") != null && + node.Attributes.GetNamedItem("showOnce").Value.ToLower() == "true") + { + onceLink.Text = "" + ui.Text("dashboard", "dontShowAgain") + ""; + } + return onceLink; + } + private string getFirstText(XmlNode node) { foreach (XmlNode n in node.ChildNodes) @@ -144,8 +158,30 @@ namespace umbraco.cms.presentation return ""; } + private string generateCookieKey(XmlNode node) + { + string key = String.Empty; + if (node.Name.ToLower() == "control") + { + key = node.FirstChild.Value + "_" + generateCookieKey(node.ParentNode); + } + else if (node.Name.ToLower() == "tab") + { + key = node.Attributes.GetNamedItem("caption").Value; + } + + return Casing.SafeAlias(key.ToLower()); + } + private bool validateAccess(XmlNode node) { + // check if this area should be shown at all + string onlyOnceValue = StateHelper.GetCookieValue(generateCookieKey(node)); + if (!String.IsNullOrEmpty(onlyOnceValue)) + { + return false; + } + // the root user can always see everything if (CurrentUser.IsRoot()) { diff --git a/umbraco/presentation/umbraco_client/ui/default.css b/umbraco/presentation/umbraco_client/ui/default.css index 3a012ab093..907874348b 100644 --- a/umbraco/presentation/umbraco_client/ui/default.css +++ b/umbraco/presentation/umbraco_client/ui/default.css @@ -562,4 +562,12 @@ guiEditor { { padding:5px; background-color:White; +} + +/* DASHBOARD */ +.dashboardHideLink +{ + float: right; + color: #fff; + text-decoration: none; } \ No newline at end of file