diff --git a/src/Umbraco.Core/Configuration/BaseRest/BaseRestSection.cs b/src/Umbraco.Core/Configuration/BaseRest/BaseRestSection.cs index 0ca638402f..24e7c12e03 100644 --- a/src/Umbraco.Core/Configuration/BaseRest/BaseRestSection.cs +++ b/src/Umbraco.Core/Configuration/BaseRest/BaseRestSection.cs @@ -3,7 +3,7 @@ using System.Configuration; namespace Umbraco.Core.Configuration.BaseRest { - [ConfigurationKey("BaseRestExtensions")] + internal class BaseRestSection : UmbracoConfigurationSection, IBaseRestSection { private const string KeyEnabled = "enabled"; diff --git a/src/Umbraco.Core/Configuration/ConfigurationKeyAttribute.cs b/src/Umbraco.Core/Configuration/ConfigurationKeyAttribute.cs deleted file mode 100644 index 90eb0884e2..0000000000 --- a/src/Umbraco.Core/Configuration/ConfigurationKeyAttribute.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Umbraco.Core.Configuration -{ - /// - /// Indicates the configuration key for a section or a group. - /// - [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] - public sealed class ConfigurationKeyAttribute : Attribute - { - /// - /// Initializes a new instance of the class with a configuration key. - /// - /// The configurationkey. - public ConfigurationKeyAttribute(string configurationKey) - { - ConfigurationKey = configurationKey; - } - - /// - /// Gets or sets the configuration key. - /// - public string ConfigurationKey { get; private set; } - } -} diff --git a/src/Umbraco.Core/Configuration/Dashboard/AccessElement.cs b/src/Umbraco.Core/Configuration/Dashboard/AccessElement.cs new file mode 100644 index 0000000000..bb798467b9 --- /dev/null +++ b/src/Umbraco.Core/Configuration/Dashboard/AccessElement.cs @@ -0,0 +1,34 @@ +using System.Collections.Generic; +using System.Linq; +using System.Xml.Linq; + +namespace Umbraco.Core.Configuration.Dashboard +{ + internal class AccessElement : RawXmlConfigurationElement, IAccess + { + public AccessElement() + { + + } + + public AccessElement(XElement rawXml) + :base(rawXml) + { + } + + public IEnumerable Rules + { + get + { + var result = new List(); + if (RawXml != null) + { + result.AddRange(RawXml.Elements("deny").Select(x => new AccessItem {Action = AccessType.Deny, Value = x.Value })); + result.AddRange(RawXml.Elements("grant").Select(x => new AccessItem { Action = AccessType.Grant, Value = x.Value })); + result.AddRange(RawXml.Elements("grantBySection").Select(x => new AccessItem { Action = AccessType.GrantBySection, Value = x.Value })); + } + return result; + } + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/Dashboard/AccessItem.cs b/src/Umbraco.Core/Configuration/Dashboard/AccessItem.cs new file mode 100644 index 0000000000..65ae6299d6 --- /dev/null +++ b/src/Umbraco.Core/Configuration/Dashboard/AccessItem.cs @@ -0,0 +1,15 @@ +namespace Umbraco.Core.Configuration.Dashboard +{ + internal class AccessItem : IAccessItem + { + /// + /// This can be grant, deny or grantBySection + /// + public AccessType Action { get; set; } + + /// + /// The value of the action + /// + public string Value { get; set; } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/Dashboard/AccessType.cs b/src/Umbraco.Core/Configuration/Dashboard/AccessType.cs new file mode 100644 index 0000000000..115d416010 --- /dev/null +++ b/src/Umbraco.Core/Configuration/Dashboard/AccessType.cs @@ -0,0 +1,9 @@ +namespace Umbraco.Core.Configuration.Dashboard +{ + public enum AccessType + { + Grant, + Deny, + GrantBySection + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/Dashboard/AreasElement.cs b/src/Umbraco.Core/Configuration/Dashboard/AreasElement.cs new file mode 100644 index 0000000000..8ab27f6387 --- /dev/null +++ b/src/Umbraco.Core/Configuration/Dashboard/AreasElement.cs @@ -0,0 +1,18 @@ +using System.Configuration; + +namespace Umbraco.Core.Configuration.Dashboard +{ + internal class AreasElement : ConfigurationElement, IArea + { + [ConfigurationProperty("area", IsRequired = true)] + public InnerTextConfigurationElement AreaName + { + get { return (InnerTextConfigurationElement)this["area"]; } + } + + string IArea.AreaName + { + get { return AreaName; } + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/Dashboard/ControlCollection.cs b/src/Umbraco.Core/Configuration/Dashboard/ControlCollection.cs new file mode 100644 index 0000000000..3ba0dd4c95 --- /dev/null +++ b/src/Umbraco.Core/Configuration/Dashboard/ControlCollection.cs @@ -0,0 +1,37 @@ +using System.Collections; +using System.Collections.Generic; +using System.Configuration; + +namespace Umbraco.Core.Configuration.Dashboard +{ + internal class ControlCollection : ConfigurationElementCollection, IEnumerable + { + internal void Add(ControlElement c) + { + BaseAdd(c); + } + + protected override ConfigurationElement CreateNewElement() + { + return new ControlElement(); + } + + protected override object GetElementKey(ConfigurationElement element) + { + return ((ControlElement)element).ControlPath; + } + + IEnumerator IEnumerable.GetEnumerator() + { + for (var i = 0; i < Count; i++) + { + yield return BaseGet(i) as IDashboardControl; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/Dashboard/ControlElement.cs b/src/Umbraco.Core/Configuration/Dashboard/ControlElement.cs new file mode 100644 index 0000000000..ac5c01ddeb --- /dev/null +++ b/src/Umbraco.Core/Configuration/Dashboard/ControlElement.cs @@ -0,0 +1,74 @@ +using System; +using System.Configuration; +using System.Linq; +using System.Xml.Linq; + +namespace Umbraco.Core.Configuration.Dashboard +{ + + internal class ControlElement : RawXmlConfigurationElement, IDashboardControl + { + public bool ShowOnce + { + get + { + return RawXml.Attribute("showOnce") == null + ? false + : bool.Parse(RawXml.Attribute("showOnce").Value); + } + } + + public bool AddPanel + { + get + { + return RawXml.Attribute("addPanel") == null + ? true + : bool.Parse(RawXml.Attribute("addPanel").Value); + } + } + + public string PanelCaption + { + get + { + return RawXml.Attribute("panelCaption") == null + ? "" + : RawXml.Attribute("panelCaption").Value; + } + } + + public AccessElement Access + { + get + { + var access = RawXml.Element("access"); + if (access == null) + { + return new AccessElement(); + } + return new AccessElement(access); + } + } + + public string ControlPath + { + get + { + //we need to return the first (and only) text element of the children (wtf... who designed this configuration ! :P ) + var txt = RawXml.Nodes().OfType().FirstOrDefault(); + if (txt == null) + { + throw new ConfigurationErrorsException("The control element must contain a text node indicating the control path"); + } + return txt.Value.Trim(); + } + } + + + IAccess IDashboardControl.AccessRights + { + get { return Access; } + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/Dashboard/DashboardSection.cs b/src/Umbraco.Core/Configuration/Dashboard/DashboardSection.cs new file mode 100644 index 0000000000..12bf0522e0 --- /dev/null +++ b/src/Umbraco.Core/Configuration/Dashboard/DashboardSection.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Configuration; +using System.Text; +using System.Threading.Tasks; + +namespace Umbraco.Core.Configuration.Dashboard +{ + internal class DashboardSection : ConfigurationSection, IDashboardSection + { + [ConfigurationCollection(typeof(SectionCollection), AddItemName = "section")] + [ConfigurationProperty("", IsDefaultCollection = true)] + public SectionCollection SectionCollection + { + get { return (SectionCollection)base[""]; } + set { base[""] = value; } + } + + IEnumerable IDashboardSection.Sections + { + get { return SectionCollection; } + } + } +} diff --git a/src/Umbraco.Core/Configuration/Dashboard/IAccess.cs b/src/Umbraco.Core/Configuration/Dashboard/IAccess.cs new file mode 100644 index 0000000000..9fee2f80e1 --- /dev/null +++ b/src/Umbraco.Core/Configuration/Dashboard/IAccess.cs @@ -0,0 +1,9 @@ +using System.Collections.Generic; + +namespace Umbraco.Core.Configuration.Dashboard +{ + public interface IAccess + { + IEnumerable Rules { get; } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/Dashboard/IAccessItem.cs b/src/Umbraco.Core/Configuration/Dashboard/IAccessItem.cs new file mode 100644 index 0000000000..7583d46306 --- /dev/null +++ b/src/Umbraco.Core/Configuration/Dashboard/IAccessItem.cs @@ -0,0 +1,15 @@ +namespace Umbraco.Core.Configuration.Dashboard +{ + public interface IAccessItem + { + /// + /// This can be grant, deny or grantBySection + /// + AccessType Action { get; set; } + + /// + /// The value of the action + /// + string Value { get; set; } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/Dashboard/IArea.cs b/src/Umbraco.Core/Configuration/Dashboard/IArea.cs new file mode 100644 index 0000000000..08775ee12f --- /dev/null +++ b/src/Umbraco.Core/Configuration/Dashboard/IArea.cs @@ -0,0 +1,7 @@ +namespace Umbraco.Core.Configuration.Dashboard +{ + public interface IArea + { + string AreaName { get; } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/Dashboard/IDashboardControl.cs b/src/Umbraco.Core/Configuration/Dashboard/IDashboardControl.cs new file mode 100644 index 0000000000..d5812ca5e9 --- /dev/null +++ b/src/Umbraco.Core/Configuration/Dashboard/IDashboardControl.cs @@ -0,0 +1,15 @@ +namespace Umbraco.Core.Configuration.Dashboard +{ + public interface IDashboardControl + { + bool ShowOnce { get; } + + bool AddPanel { get; } + + string PanelCaption { get; } + + string ControlPath { get; } + + IAccess AccessRights { get; } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/Dashboard/IDashboardSection.cs b/src/Umbraco.Core/Configuration/Dashboard/IDashboardSection.cs new file mode 100644 index 0000000000..555c9b7439 --- /dev/null +++ b/src/Umbraco.Core/Configuration/Dashboard/IDashboardSection.cs @@ -0,0 +1,9 @@ +using System.Collections.Generic; + +namespace Umbraco.Core.Configuration.Dashboard +{ + public interface IDashboardSection + { + IEnumerable Sections { get; } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/Dashboard/IDashboardTab.cs b/src/Umbraco.Core/Configuration/Dashboard/IDashboardTab.cs new file mode 100644 index 0000000000..0a03e81da4 --- /dev/null +++ b/src/Umbraco.Core/Configuration/Dashboard/IDashboardTab.cs @@ -0,0 +1,13 @@ +using System.Collections.Generic; + +namespace Umbraco.Core.Configuration.Dashboard +{ + public interface IDashboardTab + { + string Caption { get; } + + IEnumerable Controls { get; } + + IAccess AccessRights { get; } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/Dashboard/ISection.cs b/src/Umbraco.Core/Configuration/Dashboard/ISection.cs new file mode 100644 index 0000000000..f841b71e40 --- /dev/null +++ b/src/Umbraco.Core/Configuration/Dashboard/ISection.cs @@ -0,0 +1,15 @@ +using System.Collections.Generic; + +namespace Umbraco.Core.Configuration.Dashboard +{ + public interface ISection + { + string Alias { get; } + + string Area { get; } + + IEnumerable Tabs { get; } + + IAccess AccessRights { get; } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/Dashboard/SectionCollection.cs b/src/Umbraco.Core/Configuration/Dashboard/SectionCollection.cs new file mode 100644 index 0000000000..395ce7f623 --- /dev/null +++ b/src/Umbraco.Core/Configuration/Dashboard/SectionCollection.cs @@ -0,0 +1,37 @@ +using System.Collections; +using System.Collections.Generic; +using System.Configuration; + +namespace Umbraco.Core.Configuration.Dashboard +{ + internal class SectionCollection : ConfigurationElementCollection, IEnumerable + { + internal void Add(SectionElement c) + { + BaseAdd(c); + } + + protected override ConfigurationElement CreateNewElement() + { + return new SectionElement(); + } + + protected override object GetElementKey(ConfigurationElement element) + { + return ((SectionElement)element).Alias; + } + + IEnumerator IEnumerable.GetEnumerator() + { + for (var i = 0; i < Count; i++) + { + yield return BaseGet(i) as ISection; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/Dashboard/SectionElement.cs b/src/Umbraco.Core/Configuration/Dashboard/SectionElement.cs new file mode 100644 index 0000000000..b2be96712b --- /dev/null +++ b/src/Umbraco.Core/Configuration/Dashboard/SectionElement.cs @@ -0,0 +1,49 @@ +using System.Collections.Generic; +using System.Configuration; + +namespace Umbraco.Core.Configuration.Dashboard +{ + internal class SectionElement : ConfigurationElement, ISection + { + [ConfigurationProperty("alias", IsRequired = true)] + public string Alias + { + get { return (string) this["alias"]; } + } + + [ConfigurationProperty("areas", IsRequired = true)] + public AreasElement Area + { + get { return (AreasElement)this["areas"]; } + } + + [ConfigurationProperty("access")] + public AccessElement Access + { + get { return (AccessElement)this["access"]; } + } + + [ConfigurationCollection(typeof(SectionCollection), AddItemName = "tab")] + [ConfigurationProperty("", IsDefaultCollection = true)] + public TabCollection TabCollection + { + get { return (TabCollection)base[""]; } + set { base[""] = value; } + } + + IEnumerable ISection.Tabs + { + get { return TabCollection; } + } + + string ISection.Area + { + get { return Area.AreaName; } + } + + IAccess ISection.AccessRights + { + get { return Access; } + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/Dashboard/TabCollection.cs b/src/Umbraco.Core/Configuration/Dashboard/TabCollection.cs new file mode 100644 index 0000000000..6f0e018a40 --- /dev/null +++ b/src/Umbraco.Core/Configuration/Dashboard/TabCollection.cs @@ -0,0 +1,37 @@ +using System.Collections; +using System.Collections.Generic; +using System.Configuration; + +namespace Umbraco.Core.Configuration.Dashboard +{ + internal class TabCollection : ConfigurationElementCollection, IEnumerable + { + internal void Add(TabElement c) + { + BaseAdd(c); + } + + protected override ConfigurationElement CreateNewElement() + { + return new TabElement(); + } + + protected override object GetElementKey(ConfigurationElement element) + { + return ((TabElement)element).Caption; + } + + IEnumerator IEnumerable.GetEnumerator() + { + for (var i = 0; i < Count; i++) + { + yield return BaseGet(i) as IDashboardTab; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/Dashboard/TabElement.cs b/src/Umbraco.Core/Configuration/Dashboard/TabElement.cs new file mode 100644 index 0000000000..2d83a7f5bb --- /dev/null +++ b/src/Umbraco.Core/Configuration/Dashboard/TabElement.cs @@ -0,0 +1,38 @@ +using System.Collections.Generic; +using System.Configuration; + +namespace Umbraco.Core.Configuration.Dashboard +{ + internal class TabElement : ConfigurationElement, IDashboardTab + { + [ConfigurationProperty("caption", IsRequired = true)] + public string Caption + { + get { return (string)this["caption"]; } + } + + [ConfigurationProperty("access")] + public AccessElement Access + { + get { return (AccessElement)this["access"]; } + } + + [ConfigurationCollection(typeof(ControlCollection), AddItemName = "control")] + [ConfigurationProperty("", IsDefaultCollection = true)] + public ControlCollection ControlCollection + { + get { return (ControlCollection)base[""]; } + set { base[""] = value; } + } + + IEnumerable IDashboardTab.Controls + { + get { return ControlCollection; } + } + + IAccess IDashboardTab.AccessRights + { + get { return Access; } + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/InnerTextConfigurationElement.cs b/src/Umbraco.Core/Configuration/InnerTextConfigurationElement.cs index 5363893971..0bc94bb157 100644 --- a/src/Umbraco.Core/Configuration/InnerTextConfigurationElement.cs +++ b/src/Umbraco.Core/Configuration/InnerTextConfigurationElement.cs @@ -25,8 +25,8 @@ namespace Umbraco.Core.Configuration //now validate and set the raw value if (RawXml.HasElements) throw new InvalidOperationException("An InnerTextConfigurationElement cannot contain any child elements, only attributes and a value"); - RawValue = RawXml.Value; - + RawValue = RawXml.Value.Trim(); + //RawValue = reader.ReadElementContentAsString(); } diff --git a/src/Umbraco.Core/Configuration/UmbracoConfig.cs b/src/Umbraco.Core/Configuration/UmbracoConfig.cs index 4bdadc0a29..27f8b9b6a0 100644 --- a/src/Umbraco.Core/Configuration/UmbracoConfig.cs +++ b/src/Umbraco.Core/Configuration/UmbracoConfig.cs @@ -5,6 +5,7 @@ using System.Configuration; using System.Linq; using System.Threading; using Umbraco.Core.Configuration.BaseRest; +using Umbraco.Core.Configuration.Dashboard; using Umbraco.Core.Configuration.UmbracoSettings; using Umbraco.Core.Logging; @@ -31,7 +32,7 @@ namespace Umbraco.Core.Configuration /// private UmbracoConfig() { - if (UmbracoSettings() == null) + if (_umbracoSettings == null) { var umbracoSettings = ConfigurationManager.GetSection("umbracoConfiguration/settings") as IUmbracoSettingsSection; if (umbracoSettings == null) @@ -41,7 +42,7 @@ namespace Umbraco.Core.Configuration SetUmbracoSettings(umbracoSettings); } - if (BaseRestExtensions() == null) + if (_baseRestExtensions == null) { var baseRestExtensions = ConfigurationManager.GetSection("umbracoConfiguration/BaseRestExtensions") as IBaseRestSection; if (baseRestExtensions == null) @@ -50,6 +51,16 @@ namespace Umbraco.Core.Configuration } SetBaseRestExtensions(baseRestExtensions); } + + if (_dashboardSection == null) + { + var dashboardConfig = ConfigurationManager.GetSection("umbracoConfiguration/dashBoard") as IDashboardSection; + if (dashboardConfig == null) + { + LogHelper.Warn("Could not load the " + typeof(IDashboardSection) + " from config file!"); + } + SetDashboardSettings(dashboardConfig); + } } /// @@ -57,13 +68,31 @@ namespace Umbraco.Core.Configuration /// /// /// - public UmbracoConfig(IUmbracoSettingsSection umbracoSettings, IBaseRestSection baseRestSettings) + /// + public UmbracoConfig(IUmbracoSettingsSection umbracoSettings, IBaseRestSection baseRestSettings, IDashboardSection dashboardSettings) { SetUmbracoSettings(umbracoSettings); SetBaseRestExtensions(baseRestSettings); + SetDashboardSettings(dashboardSettings); } + private IDashboardSection _dashboardSection; private IUmbracoSettingsSection _umbracoSettings; + private IBaseRestSection _baseRestExtensions; + + /// + /// Gets the IDashboardSection + /// + public IDashboardSection DashboardSettings() + { + return _dashboardSection; + } + + //ONLY for unit testing + internal void SetDashboardSettings(IDashboardSection value) + { + _dashboardSection = value; + } //ONLY for unit testing internal void SetUmbracoSettings(IUmbracoSettingsSection value) @@ -78,9 +107,7 @@ namespace Umbraco.Core.Configuration { return _umbracoSettings; } - - private IBaseRestSection _baseRestExtensions; - + //ONLY for unit testing public void SetBaseRestExtensions(IBaseRestSection value) { diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/ContentElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentElement.cs index 1403617fd7..ecafd9adb3 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/ContentElement.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentElement.cs @@ -3,7 +3,7 @@ using System.Configuration; namespace Umbraco.Core.Configuration.UmbracoSettings { - [ConfigurationKey("umbracoConfiguration/settings/content")] + internal class ContentElement : ConfigurationElement, IContentSection { [ConfigurationProperty("imaging")] diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/UmbracoSettingsSection.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/UmbracoSettingsSection.cs index a84055f8a8..dd6fed5cd5 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/UmbracoSettingsSection.cs +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/UmbracoSettingsSection.cs @@ -4,7 +4,7 @@ using System.Linq; namespace Umbraco.Core.Configuration.UmbracoSettings { - [ConfigurationKey("umbracoConfiguration/settings")] + public class UmbracoSettingsSection : ConfigurationSection, IUmbracoSettingsSection { [ConfigurationProperty("content")] diff --git a/src/Umbraco.Core/Profiling/ProfilingView.cs b/src/Umbraco.Core/Profiling/ProfilingView.cs new file mode 100644 index 0000000000..110ab14925 --- /dev/null +++ b/src/Umbraco.Core/Profiling/ProfilingView.cs @@ -0,0 +1,28 @@ +using System.IO; +using System.Web.Mvc; + +namespace Umbraco.Core.Profiling +{ + public class ProfilingView : IView + { + private readonly IView _inner; + private readonly string _name; + private readonly string _viewPath; + + public ProfilingView(IView inner) + { + _inner = inner; + _name = inner.GetType().Name; + var razorView = inner as RazorView; + _viewPath = razorView != null ? razorView.ViewPath : "Unknown"; + } + + public void Render(ViewContext viewContext, TextWriter writer) + { + using (ProfilerResolver.Current.Profiler.Step(string.Format("{0}.Render: {1}", _name, _viewPath))) + { + _inner.Render(viewContext, writer); + } + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Profiling/ProfilingViewEngine.cs b/src/Umbraco.Core/Profiling/ProfilingViewEngine.cs new file mode 100644 index 0000000000..5df2b6f811 --- /dev/null +++ b/src/Umbraco.Core/Profiling/ProfilingViewEngine.cs @@ -0,0 +1,48 @@ +using System.Web.Mvc; + +namespace Umbraco.Core.Profiling +{ + public class ProfilingViewEngine: IViewEngine + { + private readonly IViewEngine _inner; + private readonly string _name; + + public ProfilingViewEngine(IViewEngine inner) + { + _inner = inner; + _name = inner.GetType().Name; + } + + public ViewEngineResult FindPartialView(ControllerContext controllerContext, string partialViewName, bool useCache) + { + using (ProfilerResolver.Current.Profiler.Step(string.Format("{0}.FindPartialView, {1}, {2}", _name, partialViewName, useCache))) + { + return WrapResult(_inner.FindPartialView(controllerContext, partialViewName, useCache)); + } + } + + public ViewEngineResult FindView(ControllerContext controllerContext, string viewName, string masterName, bool useCache) + { + using (ProfilerResolver.Current.Profiler.Step(string.Format("{0}.FindView, {1}, {2}, {3}", _name, viewName, masterName, useCache))) + { + return WrapResult(_inner.FindView(controllerContext, viewName, masterName, useCache)); + } + } + + private static ViewEngineResult WrapResult(ViewEngineResult innerResult) + { + var profiledResult = innerResult.View != null ? + new ViewEngineResult(new ProfilingView(innerResult.View), innerResult.ViewEngine) : + new ViewEngineResult(innerResult.SearchedLocations); + return profiledResult; + } + + public void ReleaseView(ControllerContext controllerContext, IView view) + { + using (ProfilerResolver.Current.Profiler.Step(string.Format("{0}.ReleaseView, {1}", _name, view.GetType().Name))) + { + _inner.ReleaseView(controllerContext, view); + } + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/PropertyEditors/PreValueEditor.cs b/src/Umbraco.Core/PropertyEditors/PreValueEditor.cs index c99ea744b8..96741cccad 100644 --- a/src/Umbraco.Core/PropertyEditors/PreValueEditor.cs +++ b/src/Umbraco.Core/PropertyEditors/PreValueEditor.cs @@ -139,6 +139,10 @@ namespace Umbraco.Core.PropertyEditors // about the Id, just the value so ignore the id. defaultPreVals[item.Key] = item.Value.Value; } + //now we're going to try to see if any of the values are JSON, if they are we'll convert them to real JSON objects + // so they can be consumed as real json in angular! + ConvertItemsToJsonIfDetected(defaultPreVals); + return defaultPreVals; } @@ -150,8 +154,40 @@ namespace Umbraco.Core.PropertyEditors //each item is of type PreValue but we don't want the ID, just the value so ignore the ID result.Add(i.ToInvariantString(), asArray[i].Value); } + + //now we're going to try to see if any of the values are JSON, if they are we'll convert them to real JSON objects + // so they can be consumed as real json in angular! + ConvertItemsToJsonIfDetected(result); + return result; - } + } + + private void ConvertItemsToJsonIfDetected(IDictionary result) + { + //now we're going to try to see if any of the values are JSON, if they are we'll convert them to real JSON objects + // so they can be consumed as real json in angular! + + var keys = result.Keys.ToArray(); + for (var i = 0; i < keys.Length; i++) + { + if (result[keys[i]] is string) + { + var asString = result[keys[i]].ToString(); + if (asString.DetectIsJson()) + { + try + { + var json = JsonConvert.DeserializeObject(asString); + result[keys[i]] = json; + } + catch + { + //swallow this exception, we thought it was json but it really isn't so continue returning a string + } + } + } + } + } } } \ No newline at end of file diff --git a/src/Umbraco.Core/PropertyEditors/PropertyValueEditor.cs b/src/Umbraco.Core/PropertyEditors/PropertyValueEditor.cs index 6616fc612a..303c34956a 100644 --- a/src/Umbraco.Core/PropertyEditors/PropertyValueEditor.cs +++ b/src/Umbraco.Core/PropertyEditors/PropertyValueEditor.cs @@ -197,7 +197,23 @@ namespace Umbraco.Core.PropertyEditors switch (GetDatabaseType()) { case DataTypeDatabaseType.Ntext: - case DataTypeDatabaseType.Nvarchar: + case DataTypeDatabaseType.Nvarchar: + //if it is a string type, we will attempt to see if it is json stored data, if it is we'll try to convert + //to a real json object so we can pass the true json object directly to angular! + var asString = dbValue.ToString(); + if (asString.DetectIsJson()) + { + try + { + var json = JsonConvert.DeserializeObject(asString); + return json; + } + catch + { + //swallow this exception, we thought it was json but it really isn't so continue returning a string + } + } + return dbValue.ToString(); case DataTypeDatabaseType.Integer: //we can just ToString() any of these types return dbValue.ToString(); diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index 1965910bff..cb6f535eaf 100644 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -154,11 +154,28 @@ - + + + + + + + + + + + + + + + + + + @@ -745,6 +762,8 @@ + + diff --git a/src/Umbraco.Tests/Configurations/DashboardSettings/Dashboard.config b/src/Umbraco.Tests/Configurations/DashboardSettings/Dashboard.config new file mode 100644 index 0000000000..fc8750f67b --- /dev/null +++ b/src/Umbraco.Tests/Configurations/DashboardSettings/Dashboard.config @@ -0,0 +1,113 @@ + + + +
+ + settings + + + + views/dashboard/settings/settingsdashboardintro.html + + + views/dashboard/settings/settingsdashboardvideos.html + + +
+ +
+ + developer + + + + views/dashboard/developer/developerdashboardintro.html + + + views/dashboard/developer/developerdashboardvideos.html + + + + /umbraco/dashboard/ExamineManagement.ascx + +
+ +
+ + media + + + + views/dashboard/media/mediafolderbrowser.html + + + + + admin + + + views/dashboard/media/mediadashboardintro.html + + + views/dashboard/media/desktopmediauploader.html + + + views/dashboard/media/mediadashboardvideos.html + + +
+ +
+ + translator + hello + world + + + content + + + + admin + + + views/dashboard/default/startupdashboardintro.html + + + views/dashboard/default/startupdashboardkits.html + + editor + writer + + + + views/dashboard/default/startupdashboardvideos.html + + + + /umbraco/dashboard/latestEdits.ascx + + + + views/dashboard/changepassword.html + + +
+ +
+ + member + + + + views/dashboard/members/membersdashboardintro.html + + + /umbraco/members/membersearch.ascx + + + views/dashboard/members/membersdashboardvideos.html + + +
+
\ No newline at end of file diff --git a/src/Umbraco.Tests/Configurations/DashboardSettings/DashboardSettingsTests.cs b/src/Umbraco.Tests/Configurations/DashboardSettings/DashboardSettingsTests.cs new file mode 100644 index 0000000000..3130ec47ca --- /dev/null +++ b/src/Umbraco.Tests/Configurations/DashboardSettings/DashboardSettingsTests.cs @@ -0,0 +1,115 @@ +using System.Configuration; +using System.IO; +using System.Linq; +using NUnit.Framework; +using Umbraco.Core.Configuration.Dashboard; +using Umbraco.Core.Configuration.UmbracoSettings; +using Umbraco.Tests.TestHelpers; + +namespace Umbraco.Tests.Configurations.DashboardSettings +{ + [TestFixture] + public class DashboardSettingsTests + { + [SetUp] + public void Init() + { + var config = new FileInfo(TestHelper.MapPathForTest("~/Configurations/DashboardSettings/web.config")); + + var fileMap = new ExeConfigurationFileMap() { ExeConfigFilename = config.FullName }; + var configuration = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None); + + SettingsSection = configuration.GetSection("umbracoConfiguration/dashBoard") as DashboardSection; + + Assert.IsNotNull(SettingsSection); + } + + protected IDashboardSection SettingsSection { get; private set; } + + [Test] + public void Test_Sections() + { + Assert.AreEqual(5, SettingsSection.Sections.Count()); + + Assert.AreEqual("StartupSettingsDashboardSection", SettingsSection.Sections.ElementAt(0).Alias); + Assert.AreEqual("StartupDeveloperDashboardSection", SettingsSection.Sections.ElementAt(1).Alias); + Assert.AreEqual("StartupMediaDashboardSection", SettingsSection.Sections.ElementAt(2).Alias); + Assert.AreEqual("StartupDashboardSection", SettingsSection.Sections.ElementAt(3).Alias); + Assert.AreEqual("StartupMemberDashboardSection", SettingsSection.Sections.ElementAt(4).Alias); + } + + [Test] + public void Test_Section_Area() + { + Assert.AreEqual("settings", SettingsSection.Sections.ElementAt(0).Area); + Assert.AreEqual("developer", SettingsSection.Sections.ElementAt(1).Area); + Assert.AreEqual("media", SettingsSection.Sections.ElementAt(2).Area); + Assert.AreEqual("content", SettingsSection.Sections.ElementAt(3).Area); + Assert.AreEqual("member", SettingsSection.Sections.ElementAt(4).Area); + } + + [Test] + public void Test_Section_Access() + { + + Assert.AreEqual(3, SettingsSection.Sections.ElementAt(3).AccessRights.Rules.Count()); + + Assert.AreEqual("translator", SettingsSection.Sections.ElementAt(3).AccessRights.Rules.ElementAt(0).Value); + Assert.AreEqual(AccessType.Deny, SettingsSection.Sections.ElementAt(3).AccessRights.Rules.ElementAt(0).Action); + Assert.AreEqual("hello", SettingsSection.Sections.ElementAt(3).AccessRights.Rules.ElementAt(1).Value); + Assert.AreEqual(AccessType.Grant, SettingsSection.Sections.ElementAt(3).AccessRights.Rules.ElementAt(1).Action); + Assert.AreEqual("world", SettingsSection.Sections.ElementAt(3).AccessRights.Rules.ElementAt(2).Value); + Assert.AreEqual(AccessType.GrantBySection, SettingsSection.Sections.ElementAt(3).AccessRights.Rules.ElementAt(2).Action); + } + + [Test] + public void Test_Section_Tabs() + { + Assert.AreEqual(1, SettingsSection.Sections.ElementAt(0).Tabs.Count()); + Assert.AreEqual(2, SettingsSection.Sections.ElementAt(1).Tabs.Count()); + Assert.AreEqual(3, SettingsSection.Sections.ElementAt(3).Tabs.Count()); + + } + + [Test] + public void Test_Tab() + { + Assert.AreEqual("Get Started", SettingsSection.Sections.ElementAt(0).Tabs.ElementAt(0).Caption); + Assert.AreEqual(2, SettingsSection.Sections.ElementAt(0).Tabs.ElementAt(0).Controls.Count()); + } + + [Test] + public void Test_Tab_Access() + { + Assert.AreEqual(1, SettingsSection.Sections.ElementAt(2).Tabs.ElementAt(1).AccessRights.Rules.Count()); + Assert.AreEqual(AccessType.Grant, SettingsSection.Sections.ElementAt(2).Tabs.ElementAt(1).AccessRights.Rules.ElementAt(0).Action); + Assert.AreEqual("admin", SettingsSection.Sections.ElementAt(2).Tabs.ElementAt(1).AccessRights.Rules.ElementAt(0).Value); + } + + [Test] + public void Test_Control() + { + Assert.AreEqual(true, SettingsSection.Sections.ElementAt(0).Tabs.ElementAt(0).Controls.ElementAt(0).ShowOnce); + Assert.AreEqual(true, SettingsSection.Sections.ElementAt(0).Tabs.ElementAt(0).Controls.ElementAt(0).AddPanel); + Assert.AreEqual("hello", SettingsSection.Sections.ElementAt(0).Tabs.ElementAt(0).Controls.ElementAt(0).PanelCaption); + Assert.AreEqual("views/dashboard/settings/settingsdashboardintro.html", + SettingsSection.Sections.ElementAt(0).Tabs.ElementAt(0).Controls.ElementAt(0).ControlPath); + + Assert.AreEqual(false, SettingsSection.Sections.ElementAt(0).Tabs.ElementAt(0).Controls.ElementAt(1).ShowOnce); + Assert.AreEqual(false, SettingsSection.Sections.ElementAt(0).Tabs.ElementAt(0).Controls.ElementAt(1).AddPanel); + Assert.AreEqual("", SettingsSection.Sections.ElementAt(0).Tabs.ElementAt(0).Controls.ElementAt(1).PanelCaption); + Assert.AreEqual("views/dashboard/settings/settingsdashboardvideos.html", + SettingsSection.Sections.ElementAt(0).Tabs.ElementAt(0).Controls.ElementAt(1).ControlPath); + } + + [Test] + public void Test_Control_Access() + { + Assert.AreEqual(2, SettingsSection.Sections.ElementAt(3).Tabs.ElementAt(0).Controls.ElementAt(1).AccessRights.Rules.Count()); + Assert.AreEqual(AccessType.Deny, SettingsSection.Sections.ElementAt(3).Tabs.ElementAt(0).Controls.ElementAt(1).AccessRights.Rules.ElementAt(0).Action); + Assert.AreEqual("editor", SettingsSection.Sections.ElementAt(3).Tabs.ElementAt(0).Controls.ElementAt(1).AccessRights.Rules.ElementAt(0).Value); + Assert.AreEqual(AccessType.Deny, SettingsSection.Sections.ElementAt(3).Tabs.ElementAt(0).Controls.ElementAt(1).AccessRights.Rules.ElementAt(1).Action); + Assert.AreEqual("writer", SettingsSection.Sections.ElementAt(3).Tabs.ElementAt(0).Controls.ElementAt(1).AccessRights.Rules.ElementAt(1).Value); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Tests/Configurations/DashboardSettings/web.config b/src/Umbraco.Tests/Configurations/DashboardSettings/web.config new file mode 100644 index 0000000000..8cf262cbff --- /dev/null +++ b/src/Umbraco.Tests/Configurations/DashboardSettings/web.config @@ -0,0 +1,14 @@ + + + + + +
+ + + + + + + + \ No newline at end of file diff --git a/src/Umbraco.Tests/PropertyEditors/PropertyEditorValueEditorTests.cs b/src/Umbraco.Tests/PropertyEditors/PropertyEditorValueEditorTests.cs index 4c86f754f6..463e2ac3cb 100644 --- a/src/Umbraco.Tests/PropertyEditors/PropertyEditorValueEditorTests.cs +++ b/src/Umbraco.Tests/PropertyEditors/PropertyEditorValueEditorTests.cs @@ -8,6 +8,21 @@ namespace Umbraco.Tests.PropertyEditors [TestFixture] public class PropertyEditorValueEditorTests { + [TestCase("{prop1: 'val1', prop2: 'val2'}", true)] + [TestCase("{1,2,3,4}", false)] + [TestCase("[1,2,3,4]", true)] + [TestCase("hello world", false)] + public void Value_Editor_Can_Convert_To_Json_Object_For_Editor(string value, bool isOk) + { + var valueEditor = new PropertyValueEditor + { + ValueType = "STRING" + }; + + var result = valueEditor.FormatDataForEditor(value); + Assert.AreEqual(isOk, !(result is string)); + } + [TestCase("STRING", "hello", "hello")] [TestCase("TEXT", "hello", "hello")] [TestCase("INT", "123", 123)] diff --git a/src/Umbraco.Tests/Routing/UmbracoModuleTests.cs b/src/Umbraco.Tests/Routing/UmbracoModuleTests.cs index d31e6dbec8..ea62370655 100644 --- a/src/Umbraco.Tests/Routing/UmbracoModuleTests.cs +++ b/src/Umbraco.Tests/Routing/UmbracoModuleTests.cs @@ -10,7 +10,7 @@ using Umbraco.Tests.TestHelpers; using Umbraco.Web; using Umbraco.Web.Routing; using umbraco.BusinessLogic; -using umbraco.IO; +using Umbraco.Core.IO; using umbraco.cms.businesslogic.cache; using umbraco.cms.businesslogic.template; diff --git a/src/Umbraco.Tests/Umbraco.Tests.csproj b/src/Umbraco.Tests/Umbraco.Tests.csproj index 4d866e720f..218cd5673b 100644 --- a/src/Umbraco.Tests/Umbraco.Tests.csproj +++ b/src/Umbraco.Tests/Umbraco.Tests.csproj @@ -208,6 +208,7 @@ + @@ -478,6 +479,14 @@ Designer + + Designer + Always + + + Designer + Always + Designer Always diff --git a/src/Umbraco.Web.UI.Client/docs/src/tutorials/Creating-Editors-Trees.ngdoc b/src/Umbraco.Web.UI.Client/docs/src/tutorials/Creating-Editors-Trees.ngdoc new file mode 100644 index 0000000000..095719b05f --- /dev/null +++ b/src/Umbraco.Web.UI.Client/docs/src/tutorials/Creating-Editors-Trees.ngdoc @@ -0,0 +1,165 @@ +@ngdoc overview +@name Creating a custom tree with an editor and dialog +@description + +##Overview + +This guide will explain how to create a simple custom tree an angular editor & dialog using standard conventions. This guide does not go into detail about how to persist data in your editors, it is a simple tutorial defining how routing interacts with your views and where your views need to be stored. + +So all the steps we will go through: + +- Creating a tree with a menu item +- Create an editor +- Create a dialog for the menu item + +##Create a tree + +First you need to define a tree class that inherits from `Umbraco.Web.Trees.TreeController` + + public class MyCustomTreeController : TreeController + { + } + +The name of your tree must be suffixed with the term 'Controller'. + +Next we need to add some attributes to the tree. The first one defines the section it belongs to, the tree alias and it's name. Ensure your tree alias is unique, tree aliases cannot overlap. + + [Tree("settings", "myTree", "My Tree")] + +The 2nd attribute does 2 things - Tells Umbraco how to route the tree and tells Umbraco where to find the view files. This attribute is not required but if you do not specify it then the view location conventions will not work. + + [PluginController("MyPackage")] + +There are 2 methods that need to be overriden from the TreeController class: `GetTreeNodes` & `GetMenuForNode`. This example will create 3 nodes underneath the root node: + + protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings) + { + //check if we're rendering the root node's children + if (id == Constants.System.Root.ToInvariantString()) + { + var tree = new TreeNodeCollection + { + CreateTreeNode("1", queryStrings, "My Node 1"), + CreateTreeNode("2", queryStrings, "My Node 2"), + CreateTreeNode("3", queryStrings, "My Node 3") + }; + return tree; + } + //this tree doesn't suport rendering more than 1 level + throw new NotSupportedException(); + } + +Next we'll create a menu item for each node, in this case its a 'Create' menu item + + protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings) + { + var menu = new MenuItemCollection(); + menu.AddMenuItem(new MenuItem("create", "Create")); + return menu; + } + +That's it, the whole tree looks like this: + + [Tree("settings", "myTree", "My Tree")] + [PluginController("MyPackage")] + public class MyCustomTreeController : TreeController + { + protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings) + { + //check if we're rendering the root node's children + if (id == Constants.System.Root.ToInvariantString()) + { + var tree = new TreeNodeCollection + { + CreateTreeNode("1", queryStrings, "My Node 1"), + CreateTreeNode("2", queryStrings, "My Node 2"), + CreateTreeNode("3", queryStrings, "My Node 3") + }; + return tree; + } + //this tree doesn't suport rendering more than 1 level + throw new NotSupportedException(); + } + protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings) + { + var menu = new MenuItemCollection(); + menu.AddMenuItem(new MenuItem("create", "Create")); + return menu; + } + } + +##View path conventions + +Now that we've created our tree it is important to understand Umbraco conventions and where it will look for your views for editors and dialogs. + +###Angular editor routes + +The main angular route to load in editors is */:section/:tree/:method/:id* + +Umbraco will load in views for this route based on these conventions: + + * If it is a core tree - views will be loaded from: */umbraco/views/{treetype}/{method}.html* + * If it is a custom (package) tree - views will be loaded from: */App_Plugins/{mypackage}/umbraco/{treetype}/{method}.html* + +###Editor locations + +By default each tree node's 'method' is assigned as 'edit' therefore these are the view paths for an editor when a tree node is clicked: + + * If it is a core tree - views will be loaded from: */umbraco/views/{treetype}/edit.html* + * If it is a custom (package) tree - views will be loaded from: */App_Plugins/{mypackage}/umbraco/{treetype}/edit.html* + +Developers can specify a custom `RoutePath` for any tree node which will cause umbraco to route to that specific location. + +###Dialog locations + +Dialog view path locations are similar to editors: + + * If it is a core tree - views will be loaded from: umbraco/views/{treetype}/{action}.html + * If it is a custom (package) tree - views will be loaded from: /App_Plugins/{mypackage}/umbraco/{treetype}/{action}.html + +'action' is the alias of your menu item, for example in the menu item in the example above this would be 'create'. + +##Create an editor + +An editor is simply an angular view (html file) so you can really do whatever you'd like! This tutorial will simply create a hello world editor showing the id of the item being edited. + +###Create a controller + +First thing we'll do is create an angular controller for the editor, this controller will be contained in a file found beside the view - *the file naming conventions are based on the controller file naming conventions in the Umbraco core*. + +/App_Plugins/MyPackage/Umbraco/MyTree/mypackage.mytree.edit.controller.js + +The controller is super simple, at it is going to do is assign a property to the $scope which shows the current item id being edited: + + 'use strict'; + (function () { + //create the controller + function myTreeEditController($scope, $routeParams) { + //set a property on the scope equal to the current route id + $scope.id = $routeParams.id; + }; + //register the controller + angular.module("umbraco").controller('MyPackage.MyTree.EditController', myTreeEditController); + })(); + +###Create a view + +As per the conventions above our editor view will need to be located at: + +/App_Plugins/MyPackage/Umbraco/MyTree/edit.html + +The view is simple, it is just going to show the current id being edited + +
+

Hello world!

+

+ You are current editing an item with id {{id}} +

+
+ +##Create a dialog + +This is the same principle as an editor, you just need to follow conventions. Based on the above conventions the 'create' dialog view will be located here: + +/App_Plugins/MyPackage/Umbraco/MyTree/create.html + diff --git a/src/Umbraco.Web.UI.Client/src/common/mocks/umbraco.servervariables.js b/src/Umbraco.Web.UI.Client/src/common/mocks/umbraco.servervariables.js index 32bb9b084c..d4fe75e80c 100644 --- a/src/Umbraco.Web.UI.Client/src/common/mocks/umbraco.servervariables.js +++ b/src/Umbraco.Web.UI.Client/src/common/mocks/umbraco.servervariables.js @@ -20,7 +20,13 @@ Umbraco.Sys.ServerVariables = { }, umbracoSettings: { "umbracoPath": "/umbraco", + "appPluginsPath" : "/App_Plugins", "imageFileTypes": "jpeg,jpg,gif,bmp,png,tiff,tif" }, + umbracoPlugins: { + trees: [ + { alias: "myTree", packageFolder: "MyPackage" } + ] + }, isDebuggingEnabled: true }; \ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/common/services/navigation.service.js b/src/Umbraco.Web.UI.Client/src/common/services/navigation.service.js index ff47aec1da..70d7dc577c 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/navigation.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/navigation.service.js @@ -324,6 +324,9 @@ angular.module('umbraco.services') if (!args.action) { throw "The args parameter must have an 'action' property as the clicked menu action object"; } + if (!args.node) { + throw "The args parameter must have a 'node' as the active tree node"; + } //ensure the current dialog is cleared before creating another! if (this.ui.currentDialog) { @@ -348,11 +351,7 @@ angular.module('umbraco.services') var templateUrl; var iframe; - //TODO: fix hardcoded hack for content/media... once these trees are converted over to - // new c# trees we won't need to do this any longer. - var isCreateForContent = args.action.alias === "create" && (this.ui.currentSection === "content" || this.ui.currentSection === "media"); - - if (args.action.metaData["actionUrl"] && !isCreateForContent) { + if (args.action.metaData["actionUrl"]) { templateUrl = args.action.metaData["actionUrl"]; iframe = true; } @@ -361,7 +360,25 @@ angular.module('umbraco.services') iframe = false; } else { - templateUrl = "views/" + this.ui.currentSection + "/" + args.action.alias + ".html"; + + //by convention we will look into the /views/{treetype}/{action}.html + // for example: /views/content/create.html + + //we will also check for a 'packageName' for the current tree, if it exists then the convention will be: + // for example: /App_Plugins/{mypackage}/umbraco/{treetype}/create.html + + var treeAlias = treeService.getTreeAlias(args.node); + var packageTreeFolder = treeService.getTreePackageFolder(treeAlias); + + if (packageTreeFolder) { + templateUrl = Umbraco.Sys.ServerVariables.umbracoSettings.appPluginsPath + + "/" + packageTreeFolder + + "/umbraco/" + treeAlias + "/" + args.action.alias + ".html"; + } + else { + templateUrl = "views/" + treeAlias + "/" + args.action.alias + ".html"; + } + iframe = false; } diff --git a/src/Umbraco.Web.UI.Client/src/common/services/tree.service.js b/src/Umbraco.Web.UI.Client/src/common/services/tree.service.js index f241ea6cab..b34cd72c79 100644 --- a/src/Umbraco.Web.UI.Client/src/common/services/tree.service.js +++ b/src/Umbraco.Web.UI.Client/src/common/services/tree.service.js @@ -58,6 +58,33 @@ function treeService($q, treeResource, iconHelper, notificationsService, $rootSc } }, + /** + * @ngdoc method + * @name umbraco.services.treeService#getTreePackageFolder + * @methodOf umbraco.services.treeService + * @function + * + * @description + * Determines if the current tree is a plugin tree and if so returns the package folder it has declared + * so we know where to find it's views, otherwise it will just return undefined. + * + * @param {String} treeAlias The tree alias to check + */ + getTreePackageFolder: function(treeAlias) { + //we determine this based on the server variables + if (Umbraco.Sys.ServerVariables.umbracoPlugins && + Umbraco.Sys.ServerVariables.umbracoPlugins.trees && + angular.isArray(Umbraco.Sys.ServerVariables.umbracoPlugins.trees)) { + + var found = _.find(Umbraco.Sys.ServerVariables.umbracoPlugins.trees, function(item) { + return item.alias === treeAlias; + }); + + return found ? found.packageFolder : undefined; + } + return undefined; + }, + /** clears the tree cache */ clearCache: function() { treeArray = []; diff --git a/src/Umbraco.Web.UI.Client/src/less/tree.less b/src/Umbraco.Web.UI.Client/src/less/tree.less index 40cee95c94..78aca06998 100644 --- a/src/Umbraco.Web.UI.Client/src/less/tree.less +++ b/src/Umbraco.Web.UI.Client/src/less/tree.less @@ -304,8 +304,8 @@ li.root > div > a.umb-options { } .umb-actions-child i { font-size: 32px; - vertical-align: top; } + .umb-actions-child li.add { margin-top: 20px; border-top: 1px solid #e9e9e9; @@ -346,6 +346,7 @@ width:100%; height:1px; overflow:hidden; } + .umb-tree li div.l div, div.umb-loader{ background-color: @blue; margin-top:0; @@ -365,7 +366,7 @@ margin-left:-100%; -o-animation-name:bounce_loadingProgressG; -o-animation-duration:1s; -o-animation-iteration-count:infinite; --o-animation-timing-function:linear; +-o-animationtiming-function:linear; animation-name:bounce_loadingProgressG; animation-duration:1s; animation-iteration-count:infinite; @@ -374,6 +375,7 @@ width:100%; height:1px; } + @-moz-keyframes bounce_loadingProgressG{ 0%{ margin-left:-100%; @@ -422,11 +424,14 @@ height:1px; 0%{ margin-left:-100%; } - 100%{ margin-left:100%; } } +//loader defaults +.umb-loader{ + height: 10px; margin: 10px 10px 10px 10px; +} body.touch .umb-tree .icon{font-size: 17px;} diff --git a/src/Umbraco.Web.UI.Client/src/routes.js b/src/Umbraco.Web.UI.Client/src/routes.js index bbda26b835..94ec046e81 100644 --- a/src/Umbraco.Web.UI.Client/src/routes.js +++ b/src/Umbraco.Web.UI.Client/src/routes.js @@ -84,15 +84,34 @@ app.config(function ($routeProvider) { resolve: checkAuth(true) }) .when('/:section/:tree/:method/:id', { - templateUrl: function (rp) { - if (!rp.tree || !rp.method) { - return "views/common/dashboard.html"; + //This allows us to dynamically change the template for this route since you cannot inject services into the templateUrl method. + template: "
", + //This controller will execute for this route, then we replace the template dynamnically based on the current tree. + controller: function ($scope, $route, $routeParams, treeService) { + + if (!$routeParams.tree || !$routeParams.method) { + $scope.templateUrl = "views/common/dashboard.html"; } - - //we don't need to put views into section folders since theoretically trees - // could be moved among sections, we only need folders for specific trees. - return 'views/' + rp.tree + '/' + rp.method + '.html'; - }, + + // Here we need to figure out if this route is for a package tree and if so then we need + // to change it's convention view path to: + // /App_Plugins/{mypackage}/umbraco/{treetype}/{method}.html + + // otherwise if it is a core tree we use the core paths: + // views/{treetype}/{method}.html + + var packageTreeFolder = treeService.getTreePackageFolder($routeParams.tree); + + if (packageTreeFolder) { + $scope.templateUrl = Umbraco.Sys.ServerVariables.umbracoSettings.appPluginsPath + + "/" + packageTreeFolder + + "/umbraco/" + $routeParams.tree + "/" + $routeParams.method + ".html"; + } + else { + $scope.templateUrl = 'views/' + $routeParams.tree + '/' + $routeParams.method + '.html'; + } + + }, resolve: checkAuth(true) }) .otherwise({ redirectTo: '/login' }); diff --git a/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/rte.controller.js b/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/rte.controller.js new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/rte.html b/src/Umbraco.Web.UI.Client/src/views/prevalueeditors/rte.html new file mode 100644 index 0000000000..e69de29bb2 diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/relatedlinks/relatedlinks.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/relatedlinks/relatedlinks.controller.js new file mode 100644 index 0000000000..7a56fe947e --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/relatedlinks/relatedlinks.controller.js @@ -0,0 +1,80 @@ +angular.module("umbraco") + .controller("Umbraco.Editors.RelatedLinksController", + function ($rootScope, $scope, dialogService, $routeParams, contentResource, contentTypeResource, editorContextService, notificationsService) { + + $scope.newCaption = ''; + $scope.newLink = 'http://'; + $scope.newNewWindow = false; + $scope.newInternal = null; + $scope.newInternalName = ''; + $scope.addExternal = true; + + $scope.relatedLinks = [ + { caption: 'Google', link: "http://google.com", newWindow: false, edit:false }, + { caption: 'Umbraco', link: "http://umbraco.com", newWindow: false, edit: false }, + { caption: 'Nibble', link: "http://nibble.be", newWindow: false, edit: false } + ]; + + $scope.internal = function ($event) { + var d = dialogService.contentPicker({ scope: $scope, multipicker: false, callback: select }); + + $event.preventDefault(); + }; + + $scope.edit = function (idx) { + for (var i = 0; i < $scope.relatedLinks.length; i++) { + $scope.relatedLinks[i].edit = false; + } + $scope.relatedLinks[idx].edit = true; + }; + + $scope.cancelEdit = function(idx) { + $scope.relatedLinks[idx].edit = false; + }; + + $scope.delete = function (idx) { + + $scope.relatedLinks.splice($scope.relatedLinks[idx], 1); + + }; + + $scope.add = function () { + + if ($scope.addExternal) { + var newExtLink = new function() { + this.caption = $scope.newCaption; + this.link = $scope.newLink; + this.newWindow = $scope.newNewWindow; + }; + $scope.relatedLinks.push(newExtLink); + } else { + var newIntLink = new function () { + this.caption = $scope.newCaption; + this.link = $scope.newLink; + this.newWindow = $scope.newNewWindow; + this.internal = $scope.newInternal; + }; + $scope.relatedLinks.push(newIntLink); + } + $scope.newCaption = ''; + $scope.newLink = 'http://'; + $scope.newNewWindow = false; + $scope.newInternal = null; + $scope.newInternalName = ''; + + + }; + + $scope.switch = function ($event) { + $scope.addExternal = !$scope.addExternal; + $event.preventDefault(); + }; + + function select(data) { + $scope.newInternal = data.id; + $scope.newInternalName = data.name; + } + + + + }); \ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/relatedlinks/relatedlinks.html b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/relatedlinks/relatedlinks.html new file mode 100644 index 0000000000..cc05a78cf5 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/relatedlinks/relatedlinks.html @@ -0,0 +1,64 @@ + \ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/test/unit/common/services/tree-service.spec.js b/src/Umbraco.Web.UI.Client/test/unit/common/services/tree-service.spec.js index f5ed2935a4..230a5ad015 100644 --- a/src/Umbraco.Web.UI.Client/test/unit/common/services/tree-service.spec.js +++ b/src/Umbraco.Web.UI.Client/test/unit/common/services/tree-service.spec.js @@ -40,7 +40,23 @@ describe('tree service tests', function () { beforeEach(inject(function ($injector) { treeService = $injector.get('treeService'); - })); + })); + + describe('lookup plugin based trees', function() { + + it('can find a plugin based tree', function () { + //we know this exists in the mock umbraco server vars + var found = treeService.getTreePackageFolder("myTree"); + expect(found).toBe("MyPackage"); + }); + + it('returns undefined for a not found tree', function () { + //we know this exists in the mock umbraco server vars + var found = treeService.getTreePackageFolder("asdfasdf"); + expect(found).not.toBeDefined(); + }); + + }); describe('query existing node structure of the tree', function () { diff --git a/src/Umbraco.Web.UI/App_Plugins/MyPackage/Common/Js/MyPackage.js b/src/Umbraco.Web.UI/App_Plugins/MyPackage/Common/Js/MyPackage.js deleted file mode 100644 index 9e84ccb37d..0000000000 --- a/src/Umbraco.Web.UI/App_Plugins/MyPackage/Common/Js/MyPackage.js +++ /dev/null @@ -1,59 +0,0 @@ -'use strict'; - -(function () { - - angular.module("myPackage.directives", []); - angular.module("myPackage.controllers", []); - - angular.module("myPackage.directives").directive('valPostcode', function () { - - /// - /// A custom directive to validate for postcodes - /// - - return { - require: 'ngModel', - link: function (scope, elm, attrs, ctrl) { - - if (!attrs.valPostcode) - throw "valPostcode requires an attribute value specifying the country for the postcode"; - - var patternValidator = function (viewValue) { - //NOTE: we don't validate on empty values, use required validator for that - if (viewValue) { - var country = scope.$eval(attrs.valPostcode); - switch (country) { - case "Australia": - if (/^\d{4}$/.test(viewValue)) { - ctrl.$setValidity('valPostcode', true); - //reset the error msg - ctrl.errorMsg = ""; - return viewValue; - } - else { - // it is invalid, return undefined (no model update) - ctrl.$setValidity('valPostcode', false); - //assign an error msg property to the current validator - ctrl.errorMsg = "Australian postcodes must be a 4 digit number"; - return undefined; - } - - default: - throw "The country specified does not have validation logic applied"; - } - } - else { - // there is no value to validate so return that it is valid. - ctrl.$setValidity('valPostcode', true); - return viewValue; - } - }; - - ctrl.$formatters.push(patternValidator); - ctrl.$parsers.push(patternValidator); - } - }; - }); - - -})(); \ No newline at end of file diff --git a/src/Umbraco.Web.UI/App_Plugins/MyPackage/Controllers/ServerSidePropertyEditorsController.cs b/src/Umbraco.Web.UI/App_Plugins/MyPackage/Controllers/ServerSidePropertyEditorsController.cs deleted file mode 100644 index 5671a9a870..0000000000 --- a/src/Umbraco.Web.UI/App_Plugins/MyPackage/Controllers/ServerSidePropertyEditorsController.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System.Web.Mvc; - -namespace Umbraco.Web.UI.App_Plugins.MyPackage.Controllers -{ - - public class ServerSidePropertyEditorsController : Controller - { - [HttpGet] - public ActionResult ServerEnvironment() - { - return View(); - } - - } -} diff --git a/src/Umbraco.Web.UI/App_Plugins/MyPackage/Package.manifest b/src/Umbraco.Web.UI/App_Plugins/MyPackage/Package.manifest index bdc8d9f211..fea8c5ef4d 100644 --- a/src/Umbraco.Web.UI/App_Plugins/MyPackage/Package.manifest +++ b/src/Umbraco.Web.UI/App_Plugins/MyPackage/Package.manifest @@ -42,12 +42,25 @@ } } } - } + }, + { + alias: "MyPackage.CustomJson", + name: "Custom editor", + editor: { + view: "~/App_Plugins/MyPackage/PropertyEditors/Views/CustomJson.html" + }, + prevalues: { + fields: [ + { + label: "Json preval", + key: "value", + view: "~/App_Plugins/MyPackage/PropertyEditors/Views/CustomJson.html" + } + ] + } + } ], javascript: [ - '~/App_Plugins/MyPackage/Common/Js/MyPackage.js', - '~/App_Plugins/MyPackage/PropertyEditors/Js/CsvEditor.js', - '~/App_Plugins/MyPackage/PropertyEditors/Js/PostcodeEditor.js', - '~/App_Plugins/MyPackage/PropertyEditors/Js/RegexEditor.js' + '~/App_Plugins/MyPackage/PropertyEditors/Js/propertyeditors.controller.js' ] } \ No newline at end of file diff --git a/src/Umbraco.Web.UI/App_Plugins/MyPackage/PropertyEditors/Js/CsvEditor.js b/src/Umbraco.Web.UI/App_Plugins/MyPackage/PropertyEditors/Js/CsvEditor.js deleted file mode 100644 index 2a45197e4a..0000000000 --- a/src/Umbraco.Web.UI/App_Plugins/MyPackage/PropertyEditors/Js/CsvEditor.js +++ /dev/null @@ -1,43 +0,0 @@ -'use strict'; - -(function() { - - function csvEditorController($scope, $http, $filter) { - - var values = []; - - //this will be comma delimited - if ($scope.model.value && (typeof $scope.model.value == "string")) { - var splitVals = $scope.model.value.split(","); - //set the values of our object - for (var i = 0; i < splitVals.length; i++) { - values.push({ - index: i, - value: splitVals[i].trim() - }); - } - } - - //if there was no data then initialize with 5 values... we should configure that in pre-vals - if (values.length == 0) { - for (var x = 0; x < 5; x++) { - values.push({ index: x, value: "" }); - } - } - - //set the scope values to bind on our view to the new object. - $scope.values = values; - - //set up listeners for the object to write back to our comma delimited property value - $scope.$watch('values', function (newValue, oldValue) { - var csv = []; - for (var v in newValue) { - csv.push(newValue[v].value); - } - //write the csv value back to the property - $scope.model.value = csv.join(); - }, true); - }; - - angular.module("umbraco").controller('MyPackage.PropertyEditors.CsvEditorController', csvEditorController); -})(); \ No newline at end of file diff --git a/src/Umbraco.Web.UI/App_Plugins/MyPackage/PropertyEditors/Js/PostcodeEditor.js b/src/Umbraco.Web.UI/App_Plugins/MyPackage/PropertyEditors/Js/PostcodeEditor.js deleted file mode 100644 index 93cd8d7654..0000000000 --- a/src/Umbraco.Web.UI/App_Plugins/MyPackage/PropertyEditors/Js/PostcodeEditor.js +++ /dev/null @@ -1,12 +0,0 @@ -'use strict'; - -(function() { - - function postcodeEditor($scope, $http, $filter) { - //change the config json model into something usable - $scope.model.config = { country: $scope.model.config[0] }; - }; - - angular.module("umbraco").controller('MyPackage.PropertyEditors.PostcodeEditor', postcodeEditor); - -})(); \ No newline at end of file diff --git a/src/Umbraco.Web.UI/App_Plugins/MyPackage/PropertyEditors/Js/RegexEditor.js b/src/Umbraco.Web.UI/App_Plugins/MyPackage/PropertyEditors/Js/RegexEditor.js deleted file mode 100644 index d691edcf6b..0000000000 --- a/src/Umbraco.Web.UI/App_Plugins/MyPackage/PropertyEditors/Js/RegexEditor.js +++ /dev/null @@ -1,11 +0,0 @@ -'use strict'; - -(function() { - - function regexEditor($scope, $http, $filter) { - var asdf = ""; - }; - - angular.module("umbraco").controller('MyPackage.PropertyEditors.RegexEditor', regexEditor); - -})(); \ No newline at end of file diff --git a/src/Umbraco.Web.UI/App_Plugins/MyPackage/System/MyStartupHandler.cs b/src/Umbraco.Web.UI/App_Plugins/MyPackage/System/MyStartupHandler.cs deleted file mode 100644 index 00d9904919..0000000000 --- a/src/Umbraco.Web.UI/App_Plugins/MyPackage/System/MyStartupHandler.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System.Collections.Generic; -using System.Web; -using System.Web.Mvc; -using System.Web.Routing; -using Umbraco.Core; -using Umbraco.Web.UI.JavaScript; - -namespace Umbraco.Web.UI.App_Plugins.MyPackage.System -{ - public class MyStartupHandler : ApplicationEventHandler - { - protected override void ApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) - { - base.ApplicationStarted(umbracoApplication, applicationContext); - - //create a custom server variable to be exposed in JS - ServerVariablesParser.Parsing += (sender, dictionary) => - { - - var httpContext = HttpContext.Current; - if (httpContext == null) return; - - var urlHelper = new UrlHelper(new RequestContext(new HttpContextWrapper(httpContext), new RouteData())); - - dictionary.Add("MyPackage", new Dictionary() - { - {"serverEnvironmentView", urlHelper.Action("ServerEnvironment", "ServerSidePropertyEditors", new {area = "MyPackage"})} - }); - }; - - //For testing for now we'll route to /Belle/Main - var route = RouteTable.Routes.MapRoute( - "umbraco-server-side-property-editors", - "Belle/PropertyEditors/{controller}/{action}/{id}", - new { controller = "ServerSidePropertyEditors", action = "Index", id = UrlParameter.Optional }); - //assign it to an area so that the plugin view engine looks for us - route.DataTokens.Add("area", "MyPackage"); - } - - } -} \ No newline at end of file diff --git a/src/Umbraco.Web.UI/App_Plugins/MyPackage/Trees/LegacyTestTree.cs b/src/Umbraco.Web.UI/App_Plugins/MyPackage/Trees/LegacyTestTree.cs index 0cd5d43d8a..bfc0583813 100644 --- a/src/Umbraco.Web.UI/App_Plugins/MyPackage/Trees/LegacyTestTree.cs +++ b/src/Umbraco.Web.UI/App_Plugins/MyPackage/Trees/LegacyTestTree.cs @@ -1,11 +1,47 @@ -using System.Text; +using System; +using System.Net.Http.Formatting; +using System.Text; +using Umbraco.Core; +using Umbraco.Web.Mvc; +using Umbraco.Web.Trees; +using Umbraco.Web.Trees.Menu; using umbraco.cms.presentation.Trees; +using Constants = Umbraco.Core.Constants; namespace Umbraco.Web.UI.App_Plugins.MyPackage.Trees { + [Tree("settings", "myTree", "My Tree")] + [PluginController("MyPackage")] + public class MyCustomTreeController : TreeController + { + protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings) + { + //check if we're rendering the root node's children + if (id == Constants.System.Root.ToInvariantString()) + { + var tree = new TreeNodeCollection + { + CreateTreeNode("1", queryStrings, "My Node 1"), + CreateTreeNode("2", queryStrings, "My Node 2"), + CreateTreeNode("3", queryStrings, "My Node 3") + }; + return tree; + } + //this tree doesn't suport rendering more than 1 level + throw new NotSupportedException(); + } + protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings) + { + var menu = new MenuItemCollection(); + menu.Items.Add(new MenuItem("create", "Create")); + return menu; + } + } + public class LegacyTestTree : BaseTree { - public LegacyTestTree(string application) : base(application) + public LegacyTestTree(string application) + : base(application) { } @@ -17,10 +53,10 @@ namespace Umbraco.Web.UI.App_Plugins.MyPackage.Trees public override int StartNodeID { get { return -1; } - } + } public override void RenderJS(ref StringBuilder javascript) - { + { } public override void Render(ref XmlTree tree) @@ -35,7 +71,7 @@ namespace Umbraco.Web.UI.App_Plugins.MyPackage.Trees protected override void CreateRootNode(ref XmlTreeNode rootNode) { - + } } } \ No newline at end of file diff --git a/src/Umbraco.Web.UI/App_Plugins/MyPackage/Views/ServerSidePropertyEditors/ServerEnvironment.cshtml b/src/Umbraco.Web.UI/App_Plugins/MyPackage/Views/ServerSidePropertyEditors/ServerEnvironment.cshtml deleted file mode 100644 index f949999089..0000000000 --- a/src/Umbraco.Web.UI/App_Plugins/MyPackage/Views/ServerSidePropertyEditors/ServerEnvironment.cshtml +++ /dev/null @@ -1,9 +0,0 @@ -@model dynamic - - -

- Computer Name@Environment.MachineName -

-

- Computer Time@DateTime.Now -

\ No newline at end of file diff --git a/src/Umbraco.Web.UI/App_Plugins/MyPackage/Views/Web.config b/src/Umbraco.Web.UI/App_Plugins/MyPackage/Views/Web.config deleted file mode 100644 index f179ab8806..0000000000 --- a/src/Umbraco.Web.UI/App_Plugins/MyPackage/Views/Web.config +++ /dev/null @@ -1,58 +0,0 @@ - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 2e2b2089e2..ef6c9ad5a8 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -107,6 +107,14 @@ {07fbc26b-2927-4a22-8d96-d644c667fecc} UmbracoExamine + + False + ..\packages\AutoMapper.3.0.0\lib\net40\AutoMapper.dll + + + False + ..\packages\AutoMapper.3.0.0\lib\net40\AutoMapper.Net4.dll + False ..\packages\ClientDependency.1.7.0.4\lib\ClientDependency.Core.dll @@ -292,11 +300,9 @@ Properties\SolutionInfo.cs - - default.aspx @@ -588,12 +594,10 @@ treeInit.aspx + - - - - + @@ -615,8 +619,6 @@ - - 404handlers.config @@ -2540,8 +2542,6 @@ - - diff --git a/src/Umbraco.Web.UI/config/trees.config b/src/Umbraco.Web.UI/config/trees.config index 46a523ce38..acafac91f1 100644 --- a/src/Umbraco.Web.UI/config/trees.config +++ b/src/Umbraco.Web.UI/config/trees.config @@ -39,4 +39,5 @@ + \ No newline at end of file diff --git a/src/Umbraco.Web.UI/packages.config b/src/Umbraco.Web.UI/packages.config index 0e8d39bbe0..b4df6b2899 100644 --- a/src/Umbraco.Web.UI/packages.config +++ b/src/Umbraco.Web.UI/packages.config @@ -1,5 +1,6 @@  + diff --git a/src/Umbraco.Web.UI/umbraco/Search/QuickSearch.ascx b/src/Umbraco.Web.UI/umbraco/Search/QuickSearch.ascx index c3a8df1f7d..e6dc8ebb85 100644 --- a/src/Umbraco.Web.UI/umbraco/Search/QuickSearch.ascx +++ b/src/Umbraco.Web.UI/umbraco/Search/QuickSearch.ascx @@ -6,7 +6,7 @@ #propertyMapping thead tr th{border-bottom:1px solid #ccc; padding: 4px; padding-right: 25px; - background-image: url(<%= umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco_client) %>/tableSorting/img/bg.gif); + background-image: url(<%= Umbraco.Core.IO.IOHelper.ResolveUrl(Umbraco.Core.IO.SystemDirectories.UmbracoClient) %>/tableSorting/img/bg.gif); cursor: pointer; font-weight: bold; background-repeat: no-repeat; diff --git a/src/Umbraco.Web.UI/umbraco/dialogs/cruds.aspx b/src/Umbraco.Web.UI/umbraco/dialogs/cruds.aspx index d8e3131a6f..fd7621f677 100644 --- a/src/Umbraco.Web.UI/umbraco/dialogs/cruds.aspx +++ b/src/Umbraco.Web.UI/umbraco/dialogs/cruds.aspx @@ -8,21 +8,18 @@ - - - - - - - - - -
- -   or   - <%=umbraco.ui.Text("general", "cancel", this.getUser())%> - -
+
+ + + + + + +
+
\ No newline at end of file diff --git a/src/Umbraco.Web.UI/umbraco/dialogs/rollBack.aspx b/src/Umbraco.Web.UI/umbraco/dialogs/rollBack.aspx index db2b592305..62d7d9492b 100644 --- a/src/Umbraco.Web.UI/umbraco/dialogs/rollBack.aspx +++ b/src/Umbraco.Web.UI/umbraco/dialogs/rollBack.aspx @@ -1,68 +1,98 @@ <%@ Page Language="c#" Codebehind="rollBack.aspx.cs" MasterPageFile="../masterpages/umbracoDialog.Master"AutoEventWireup="True" Inherits="umbraco.presentation.dialogs.rollBack" %> + <%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %> <%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %> - + var functionsFrame = this; + var tabFrame = this; + var isDialog = true; + var submitOnEnter = true; + + - + .diff { + margin-top: 10px; + height: 100%; + overflow: auto; + border-top: 1px solid #efefef; + padding: 5px; + } + + .diff table td { + border-bottom: 1px solid #ccc; + padding: 3px; + } + + .diff del { + background: rgb(255, 230, 230) none repeat scroll 0%; + -moz-background-clip: -moz-initial; + -moz-background-origin: -moz-initial; + -moz-background-inline-policy: -moz-initial; + } + + .diff ins { + background: rgb(230, 255, 230) none repeat scroll 0%; + -moz-background-clip: -moz-initial; + -moz-background-origin: -moz-initial; + -moz-background-inline-policy: -moz-initial; + } + + .diff .diffnotice { + text-align: center; + margin-bottom: 10px; + } + + - +
+ - + - - () - - - - - Diff - Html - - - - + + + + () + + + - -
-
-

- -

-
- - - -
-
- -

- -   <%=umbraco.ui.Text("general", "or", this.getUser())%>   - <%=umbraco.ui.Text("general", "cancel", this.getUser())%> -

-
- - + + + + Diff + Html + + + +
+ + +
+
+

+ +

+
+ + + +
+
+
+
+ +
- \ No newline at end of file diff --git a/src/Umbraco.Web.UI/umbraco/plugins/uGoLive/Dashboard.ascx b/src/Umbraco.Web.UI/umbraco/plugins/uGoLive/Dashboard.ascx index 94b056f296..a5ee2d2ba5 100644 --- a/src/Umbraco.Web.UI/umbraco/plugins/uGoLive/Dashboard.ascx +++ b/src/Umbraco.Web.UI/umbraco/plugins/uGoLive/Dashboard.ascx @@ -1,6 +1,6 @@ <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Dashboard.ascx.cs" Inherits="Our.Umbraco.uGoLive.Web.Umbraco.Plugins.uGoLive.Dashboard" %> -<%@ Import Namespace="umbraco.IO" %> <%@ Import Namespace="Our.Umbraco.uGoLive.Web" %> +<%@ Import Namespace="Umbraco.Core.IO" %> <%@ Register Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" TagPrefix="cdf" %> diff --git a/src/Umbraco.Web.UI/umbraco/settings/editTemplate.aspx b/src/Umbraco.Web.UI/umbraco/settings/editTemplate.aspx index a6f25da43e..4c65d01255 100644 --- a/src/Umbraco.Web.UI/umbraco/settings/editTemplate.aspx +++ b/src/Umbraco.Web.UI/umbraco/settings/editTemplate.aspx @@ -63,10 +63,10 @@ var templateCode = UmbEditor.GetCode(); var selectedTemplate = templateDropDown.options[templateDropDown.selectedIndex].id; - var masterTemplate = "<%= umbraco.IO.SystemDirectories.Masterpages%>/" + selectedTemplate + ".master"; + var masterTemplate = "<%= Umbraco.Core.IO.SystemDirectories.Masterpages%>/" + selectedTemplate + ".master"; if (selectedTemplate == "") - masterTemplate = "<%= umbraco.IO.SystemDirectories.Umbraco%>/masterpages/default.master"; + masterTemplate = "<%= Umbraco.Core.IO.SystemDirectories.Umbraco%>/masterpages/default.master"; var regex = /MasterPageFile=[~a-z0-9/._"-]+/im; diff --git a/src/Umbraco.Web.UI/web.Template.Debug.config b/src/Umbraco.Web.UI/web.Template.Debug.config index 1cc428f95a..4e5907116b 100644 --- a/src/Umbraco.Web.UI/web.Template.Debug.config +++ b/src/Umbraco.Web.UI/web.Template.Debug.config @@ -31,6 +31,7 @@
+
@@ -42,6 +43,7 @@ + diff --git a/src/Umbraco.Web.UI/web.Template.config b/src/Umbraco.Web.UI/web.Template.config index 2185fda80e..9944507d18 100644 --- a/src/Umbraco.Web.UI/web.Template.config +++ b/src/Umbraco.Web.UI/web.Template.config @@ -11,6 +11,7 @@
+
@@ -18,6 +19,7 @@ + diff --git a/src/Umbraco.Web/Editors/BackOfficeController.cs b/src/Umbraco.Web/Editors/BackOfficeController.cs index a8a5dc2a63..dabbd6b12c 100644 --- a/src/Umbraco.Web/Editors/BackOfficeController.cs +++ b/src/Umbraco.Web/Editors/BackOfficeController.cs @@ -1,8 +1,10 @@ using System.Collections.Generic; using System.IO; +using System.Linq; using System.Text; using System.Web.Mvc; using Umbraco.Core.Configuration; +using Umbraco.Core.IO; using Umbraco.Core.Manifest; using Umbraco.Core; using Umbraco.Web.Mvc; @@ -79,16 +81,50 @@ namespace Umbraco.Web.Editors "umbracoSettings", new Dictionary { {"umbracoPath", GlobalSettings.Path}, + {"appPluginsPath", IOHelper.ResolveUrl(SystemDirectories.AppPlugins).TrimEnd('/')}, {"imageFileTypes", string.Join(",",UmbracoConfig.For.UmbracoSettings().Content.ImageFileTypes)}, } }, + { + "umbracoPlugins", new Dictionary + { + {"trees", GetTreePluginsMetaData()} + } + }, { "isDebuggingEnabled", HttpContext.IsDebuggingEnabled } }; return JavaScript(ServerVariablesParser.Parse(d)); } + private IEnumerable> GetTreePluginsMetaData() + { + var treeTypes = PluginManager.Current.ResolveAttributedTreeControllers(); + //get all plugin trees with their attributes + var treesWithAttributes = treeTypes.Select(x => new + { + tree = x, attributes = + x.GetCustomAttributes(false) + }).ToArray(); + + var pluginTreesWithAttributes = treesWithAttributes + //don't resolve any tree decorated with CoreTreeAttribute + .Where(x => x.attributes.All(a => (a is CoreTreeAttribute) == false)) + //we only care about trees with the PluginControllerAttribute + .Where(x => x.attributes.Any(a => a is PluginControllerAttribute)) + .ToArray(); + + return (from p in pluginTreesWithAttributes + let treeAttr = p.attributes.OfType().Single() + let pluginAttr = p.attributes.OfType().Single() + select new Dictionary + { + {"alias", treeAttr.Alias}, {"packageFolder", pluginAttr.AreaName} + }).ToArray(); + + } + /// /// Returns the JavaScript blocks for any legacy trees declared /// diff --git a/src/Umbraco.Web/Editors/DashboardController.cs b/src/Umbraco.Web/Editors/DashboardController.cs index 4f7140a797..c93fc65a17 100644 --- a/src/Umbraco.Web/Editors/DashboardController.cs +++ b/src/Umbraco.Web/Editors/DashboardController.cs @@ -1,25 +1,11 @@ -using System; -using System.Collections.Generic; -using System.Web.Http; -using System.Web.Http.Controllers; -using System.Web.Http.ModelBinding; -using AutoMapper; -using Newtonsoft.Json; -using Umbraco.Core.Logging; -using Umbraco.Core.Services; +using System.Collections.Generic; +using Umbraco.Core; +using Umbraco.Core.Configuration; using Umbraco.Web.Models.ContentEditing; using Umbraco.Web.Mvc; -using Umbraco.Web.WebApi; using System.Linq; -using Umbraco.Core.Models.EntityBase; -using Umbraco.Core.Models; -using Umbraco.Web.WebApi.Filters; - -using Constants = Umbraco.Core.Constants; - using System.Xml; using Umbraco.Core.IO; -using Umbraco.Core.Models.Membership; namespace Umbraco.Web.Editors { @@ -30,188 +16,64 @@ namespace Umbraco.Web.Editors public class DashboardController : UmbracoAuthorizedJsonController { - public IEnumerable> GetDashboard(string section) + public IEnumerable> GetDashboard(string section) { - return GetDashboardFromXml(section); + var tabs = new List>(); - //return Mapper.Map(Services.EntityService.Get(id, UmbracoObjectTypes.Document)); - } - - //TODO migrate this into a more managed class - private IEnumerable> GetDashboardFromXml(string section) - { - - XmlDocument dashBoardXml = new XmlDocument(); - dashBoardXml.Load(IOHelper.MapPath(SystemFiles.DashboardConfig)); - var user = UmbracoContext.Security.CurrentUser; - var tabs = new List>(); - - // test for new tab interface - foreach (XmlNode dashboard in dashBoardXml.DocumentElement.SelectNodes("//section [areas/area = '" + section.ToLower() + "']")) + var dashboardSection = UmbracoConfig.For.DashboardSettings() + .Sections.FirstOrDefault(x => x.Area.InvariantEquals(section)); + + //if we cannot find it for whatever reason just return an empty one. + if (dashboardSection == null) { - if (dashboard != null) + return tabs; + } + + //we need to validate access to this section + if (DashboardSecurity.AuthorizeAccess(dashboardSection, Security.CurrentUser, Services.SectionService) == false) + { + //return empty collection + return tabs; + } + + var i = 1; + foreach (var dashTab in dashboardSection.Tabs) + { + //we need to validate access to this tab + if (DashboardSecurity.AuthorizeAccess(dashTab, Security.CurrentUser, Services.SectionService)) { - var i = 0; - - foreach (XmlNode entry in dashboard.SelectNodes("./tab")) + var props = new List(); + + foreach (var dashCtrl in dashTab.Controls) { - - if (ValidateAccess(entry, user)) + if (DashboardSecurity.AuthorizeAccess(dashCtrl, Security.CurrentUser, Services.SectionService)) { - i++; - - Tab tab = new Tab(); - tab.Label = entry.Attributes.GetNamedItem("caption").Value; - var props = new List(); - tab.Id = i; - tab.Alias = tab.Label.ToLower().Replace(" ", "_"); - tab.IsActive = i == 1; - - foreach (XmlNode uc in entry.SelectNodes("./control")) + var ctrl = new DashboardControl(); + var controlPath = dashCtrl.ControlPath.Trim(' ', '\r', '\n'); + ctrl.Path = IOHelper.FindFile(controlPath); + if (controlPath.ToLower().EndsWith(".ascx")) { - if (ValidateAccess(uc, user)) - { - Control ctrl = new Control(); - - string control = Core.XmlHelper.GetNodeValue(uc).Trim(' ', '\r', '\n'); - ctrl.Path = IOHelper.FindFile(control); - if (control.ToLower().EndsWith(".ascx")) - ctrl.ServerSide = true; - - props.Add(ctrl); - - /* - try - { - Control c = LoadControl(path); - - // set properties - Type type = c.GetType(); - if (type != null) - { - foreach (XmlAttribute att in uc.Attributes) - { - string attributeName = att.Name; - string attributeValue = parseControlValues(att.Value).ToString(); - // parse special type of values - - - PropertyInfo prop = type.GetProperty(attributeName); - if (prop == null) - { - continue; - } - - prop.SetValue(c, Convert.ChangeType(attributeValue, prop.PropertyType), - null); - - } - } - - //resolving files from dashboard config which probably does not map to a virtual fi - tab.Controls.Add(AddPanel(uc, c)); - } - catch (Exception ee) - { - tab.Controls.Add( - new LiteralControl( - "

Could not load control: '" + path + - "'.
Error message: " + - ee.ToString() + "

")); - }*/ - } + ctrl.ServerSide = true; } - tab.Properties = props; - tabs.Add(tab); + props.Add(ctrl); } - - } + + tabs.Add(new Tab + { + Id = i, + Alias = dashTab.Caption.ToSafeAlias(), + IsActive = i == 1, + Label = dashTab.Caption, + Properties = props + }); + i++; } - } return tabs; } - - //TODO: This has to go away, jesus - //for now I'm just returning true, this is likely to change anyway - private bool ValidateAccess(XmlNode node, IUser currentUser) - { - return true; - - /* - // 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()) - { - return true; - } - else if (node != null) - { - XmlNode accessRules = node.SelectSingleNode("access"); - bool retVal = true; - if (accessRules != null && accessRules.HasChildNodes) - { - string currentUserType = CurrentUser.UserType.Alias.ToLowerInvariant(); - - //Update access rules so we'll be comparing lower case to lower case always - - var denies = accessRules.SelectNodes("deny"); - foreach (XmlNode deny in denies) - { - deny.InnerText = deny.InnerText.ToLowerInvariant(); - } - - var grants = accessRules.SelectNodes("grant"); - foreach (XmlNode grant in grants) - { - grant.InnerText = grant.InnerText.ToLowerInvariant(); - } - - string allowedSections = ","; - foreach (BusinessLogic.Application app in CurrentUser.Applications) - { - allowedSections += app.alias.ToLower() + ","; - } - XmlNodeList grantedTypes = accessRules.SelectNodes("grant"); - XmlNodeList grantedBySectionTypes = accessRules.SelectNodes("grantBySection"); - XmlNodeList deniedTypes = accessRules.SelectNodes("deny"); - - // if there's a grant type, everyone who's not granted is automatically denied - if (grantedTypes.Count > 0 || grantedBySectionTypes.Count > 0) - { - retVal = false; - if (grantedBySectionTypes.Count > 0 && accessRules.SelectSingleNode(String.Format("grantBySection [contains('{0}', concat(',',.,','))]", allowedSections)) != null) - { - retVal = true; - } - else if (grantedTypes.Count > 0 && accessRules.SelectSingleNode(String.Format("grant [. = '{0}']", currentUserType)) != null) - { - retVal = true; - } - } - // if the current type of user is denied we'll say nay - if (deniedTypes.Count > 0 && accessRules.SelectSingleNode(String.Format("deny [. = '{0}']", currentUserType)) != null) - { - retVal = false; - } - - } - - return retVal; - } - return false; - * */ - } - } } diff --git a/src/Umbraco.Web/Editors/DashboardSecurity.cs b/src/Umbraco.Web/Editors/DashboardSecurity.cs new file mode 100644 index 0000000000..ea6d46c514 --- /dev/null +++ b/src/Umbraco.Web/Editors/DashboardSecurity.cs @@ -0,0 +1,108 @@ +using System; +using System.Linq; +using Umbraco.Core; +using Umbraco.Core.Configuration.Dashboard; +using Umbraco.Core.Models.Membership; +using Umbraco.Core.Services; + +namespace Umbraco.Web.Editors +{ + /// + /// A utility class for determine dashboard security + /// + internal class DashboardSecurity + { + //TODO: Unit test all this!!! :/ + + public static bool AuthorizeAccess(ISection dashboardSection, IUser user, SectionService sectionService) + { + if (user.Id.ToString() == 0.ToInvariantString()) + { + return true; + } + + var denyTypes = dashboardSection.AccessRights.Rules.Where(x => x.Action == AccessType.Deny).ToArray(); + var grantedTypes = dashboardSection.AccessRights.Rules.Where(x => x.Action == AccessType.Grant).ToArray(); + var grantedBySectionTypes = dashboardSection.AccessRights.Rules.Where(x => x.Action == AccessType.GrantBySection).ToArray(); + + return CheckUserAccessByRules(user, sectionService, denyTypes, grantedTypes, grantedBySectionTypes); + } + + public static bool AuthorizeAccess(IDashboardTab dashboardTab, IUser user, SectionService sectionService) + { + if (user.Id.ToString() == Constants.System.Root.ToInvariantString()) + { + return true; + } + + var denyTypes = dashboardTab.AccessRights.Rules.Where(x => x.Action == AccessType.Deny).ToArray(); + var grantedTypes = dashboardTab.AccessRights.Rules.Where(x => x.Action == AccessType.Grant).ToArray(); + var grantedBySectionTypes = dashboardTab.AccessRights.Rules.Where(x => x.Action == AccessType.GrantBySection).ToArray(); + + return CheckUserAccessByRules(user, sectionService, denyTypes, grantedTypes, grantedBySectionTypes); + } + + public static bool AuthorizeAccess(IDashboardControl dashboardTab, IUser user, SectionService sectionService) + { + if (user.Id.ToString() == Constants.System.Root.ToInvariantString()) + { + return true; + } + + var denyTypes = dashboardTab.AccessRights.Rules.Where(x => x.Action == AccessType.Deny).ToArray(); + var grantedTypes = dashboardTab.AccessRights.Rules.Where(x => x.Action == AccessType.Grant).ToArray(); + var grantedBySectionTypes = dashboardTab.AccessRights.Rules.Where(x => x.Action == AccessType.GrantBySection).ToArray(); + + return CheckUserAccessByRules(user, sectionService, denyTypes, grantedTypes, grantedBySectionTypes); + } + + public static bool CheckUserAccessByRules(IUser user, SectionService sectionService, IAccessItem[] denyTypes, IAccessItem[] grantedTypes, IAccessItem[] grantedBySectionTypes) + { + var allowedSoFar = false; + + //Check if this item as any grant-by-section arguments, if so check if the user has access to any of the sections approved, if so they will + // be allowed to see it (so far) + if (grantedBySectionTypes.Any()) + { + var allowedApps = sectionService.GetAllowedSections(Convert.ToInt32(user.Id)) + .Select(x => x.Alias) + .ToArray(); + + var allApprovedSections = grantedBySectionTypes.SelectMany(g => g.Value.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)).ToArray(); + if (allApprovedSections.Any(allowedApps.Contains)) + { + allowedSoFar = true; + } + } + + //Check if this item as any grant arguments, if so check if the user is one of the user types approved, if so they will + // be allowed to see it (so far) + if (grantedTypes.Any()) + { + var allApprovedUserTypes = grantedTypes.SelectMany(g => g.Value.Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries)).ToArray(); + if (allApprovedUserTypes.InvariantContains(user.UserType.Alias)) + { + allowedSoFar = true; + } + } + else + { + //if there are not explicit grant types then everyone is allowed so far and we'll only disallow on a deny basis + allowedSoFar = true; + } + + //Check if this item as any deny arguments, if so check if the user is one of the user types approved, if so they will + // be denied to see it no matter what + if (denyTypes.Any()) + { + var allDeniedUserTypes = denyTypes.SelectMany(g => g.Value.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries)).ToArray(); + if (allDeniedUserTypes.InvariantContains(user.UserType.Alias)) + { + allowedSoFar = false; + } + } + + return allowedSoFar; + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Web/Media/ThumbnailProviders/FileExtensionIconThumbnailProvider.cs b/src/Umbraco.Web/Media/ThumbnailProviders/FileExtensionIconThumbnailProvider.cs index a96eea0475..4d6489cb2c 100644 --- a/src/Umbraco.Web/Media/ThumbnailProviders/FileExtensionIconThumbnailProvider.cs +++ b/src/Umbraco.Web/Media/ThumbnailProviders/FileExtensionIconThumbnailProvider.cs @@ -4,7 +4,7 @@ using System.IO; using System.Linq; using System.Text; using Umbraco.Core.ObjectResolution; -using umbraco.IO; +using Umbraco.Core.IO; namespace Umbraco.Web.Media.ThumbnailProviders { diff --git a/src/Umbraco.Web/Media/ThumbnailProviders/ImageThumbnailProvider.cs b/src/Umbraco.Web/Media/ThumbnailProviders/ImageThumbnailProvider.cs index 8b5aeaf318..a2777c0137 100644 --- a/src/Umbraco.Web/Media/ThumbnailProviders/ImageThumbnailProvider.cs +++ b/src/Umbraco.Web/Media/ThumbnailProviders/ImageThumbnailProvider.cs @@ -6,7 +6,7 @@ using System.Text; using Umbraco.Core; using Umbraco.Core.IO; using Umbraco.Core.ObjectResolution; -using umbraco.IO; +using Umbraco.Core.IO; namespace Umbraco.Web.Media.ThumbnailProviders { diff --git a/src/Umbraco.Web/Media/ThumbnailProviders/MediaTypeIconThumbnailProvider.cs b/src/Umbraco.Web/Media/ThumbnailProviders/MediaTypeIconThumbnailProvider.cs index ce6ee054a4..be1e6b4b42 100644 --- a/src/Umbraco.Web/Media/ThumbnailProviders/MediaTypeIconThumbnailProvider.cs +++ b/src/Umbraco.Web/Media/ThumbnailProviders/MediaTypeIconThumbnailProvider.cs @@ -4,7 +4,7 @@ using System.IO; using System.Linq; using System.Text; using Umbraco.Core.ObjectResolution; -using umbraco.IO; +using Umbraco.Core.IO; namespace Umbraco.Web.Media.ThumbnailProviders { diff --git a/src/Umbraco.Web/Models/ContentEditing/Control.cs b/src/Umbraco.Web/Models/ContentEditing/DashboardControl.cs similarity index 92% rename from src/Umbraco.Web/Models/ContentEditing/Control.cs rename to src/Umbraco.Web/Models/ContentEditing/DashboardControl.cs index 6525400466..d51084fb16 100644 --- a/src/Umbraco.Web/Models/ContentEditing/Control.cs +++ b/src/Umbraco.Web/Models/ContentEditing/DashboardControl.cs @@ -1,28 +1,28 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.Serialization; -using System.Text; -using System.Threading.Tasks; - -namespace Umbraco.Web.Models.ContentEditing -{ - [DataContract(Name = "control", Namespace = "")] - public class Control - { - [DataMember(Name = "showOnce")] - public bool ShowOnce { get; set; } - - [DataMember(Name = "addPanel")] - public bool AddPanel { get; set; } - - [DataMember(Name = "serverSide")] - public bool ServerSide { get; set; } - - [DataMember(Name = "path")] - public string Path { get; set; } - - [DataMember(Name = "caption")] - public string Caption { get; set; } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.Serialization; +using System.Text; +using System.Threading.Tasks; + +namespace Umbraco.Web.Models.ContentEditing +{ + [DataContract(Name = "control", Namespace = "")] + public class DashboardControl + { + [DataMember(Name = "showOnce")] + public bool ShowOnce { get; set; } + + [DataMember(Name = "addPanel")] + public bool AddPanel { get; set; } + + [DataMember(Name = "serverSide")] + public bool ServerSide { get; set; } + + [DataMember(Name = "path")] + public string Path { get; set; } + + [DataMember(Name = "caption")] + public string Caption { get; set; } + } +} diff --git a/src/Umbraco.Web/Mvc/PluginViewEngine.cs b/src/Umbraco.Web/Mvc/PluginViewEngine.cs index fe39978b6e..96f393920e 100644 --- a/src/Umbraco.Web/Mvc/PluginViewEngine.cs +++ b/src/Umbraco.Web/Mvc/PluginViewEngine.cs @@ -7,7 +7,7 @@ using Umbraco.Core.IO; namespace Umbraco.Web.Mvc { /// - /// A view engine to look into the App_Plugins/Packages folder for views for packaged controllers + /// A view engine to look into the App_Plugins folder for views for packaged controllers /// public class PluginViewEngine : FixedRazorViewEngine { diff --git a/src/Umbraco.Web/PluginManagerExtensions.cs b/src/Umbraco.Web/PluginManagerExtensions.cs index ab0846f530..bda4b3a95f 100644 --- a/src/Umbraco.Web/PluginManagerExtensions.cs +++ b/src/Umbraco.Web/PluginManagerExtensions.cs @@ -25,8 +25,7 @@ namespace Umbraco.Web /// internal static IEnumerable ResolveAttributedTreeControllers(this PluginManager resolver) { - //don't cache the result of this because it is only used once during app startup, caching will just add a bit more mem overhead for no reason - return resolver.ResolveTypesWithAttribute(cacheResult: false); + return resolver.ResolveTypesWithAttribute(); } internal static IEnumerable ResolveSurfaceControllers(this PluginManager resolver) diff --git a/src/Umbraco.Web/PropertyEditors/RelatedLinksPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/RelatedLinksPropertyEditor.cs new file mode 100644 index 0000000000..df801f2d61 --- /dev/null +++ b/src/Umbraco.Web/PropertyEditors/RelatedLinksPropertyEditor.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Umbraco.Core; +using Umbraco.Core.PropertyEditors; + +namespace Umbraco.Web.PropertyEditors +{ + [PropertyEditor(Constants.PropertyEditors.RelatedLinksAlias, "Related links", "relatedlinks")] + public class RelatedLinksPropertyEditor : PropertyEditor + { + } +} diff --git a/src/Umbraco.Web/Trees/ApplicationTreeRegistrar.cs b/src/Umbraco.Web/Trees/ApplicationTreeRegistrar.cs index 2cdd43be38..6666936c70 100644 --- a/src/Umbraco.Web/Trees/ApplicationTreeRegistrar.cs +++ b/src/Umbraco.Web/Trees/ApplicationTreeRegistrar.cs @@ -7,6 +7,9 @@ using umbraco.businesslogic; namespace Umbraco.Web.Trees { + //TODO: Is there any way to get this to execute lazily when needed? + // i.e. When the back office loads so that this doesn't execute on startup for a content request. + /// /// A startup handler for putting the tree config in the config file based on attributes found /// diff --git a/src/Umbraco.Web/Trees/ContentTreeController.cs b/src/Umbraco.Web/Trees/ContentTreeController.cs index ffa35655e1..0e7aef2a2d 100644 --- a/src/Umbraco.Web/Trees/ContentTreeController.cs +++ b/src/Umbraco.Web/Trees/ContentTreeController.cs @@ -22,6 +22,7 @@ namespace Umbraco.Web.Trees [LegacyBaseTree(typeof(loadContent))] [Tree(Constants.Applications.Content, Constants.Trees.Content, "Content")] [PluginController("UmbracoTrees")] + [CoreTree] public class ContentTreeController : ContentTreeControllerBase { protected override TreeNode CreateRootNode(FormDataCollection queryStrings) @@ -106,26 +107,21 @@ namespace Umbraco.Web.Trees .Select(x => new MenuItem(x)); //these two are the standard items - menu.AddMenuItem(); - menu.AddMenuItem(true).ConvertLegacyMenuItem(null, "content", "content"); + menu.Items.Add(ui.Text("actions", ActionNew.Instance.Alias)); + menu.Items.Add(ui.Text("actions", ActionSort.Instance.Alias), true).ConvertLegacyMenuItem(null, "content", "content"); //filter the standard items FilterUserAllowedMenuItems(menu, nodeActions); - if (menu.MenuItems.Any()) + if (menu.Items.Any()) { - menu.MenuItems.Last().SeperatorBefore = true; + menu.Items.Last().SeperatorBefore = true; } // add default actions for *all* users - menu.AddMenuItem().ConvertLegacyMenuItem(null, "content", "content"); - menu.AddMenuItem(true); - - foreach (var menuItem in menu.MenuItems) - { - menuItem.Name = ui.Text("actions", menuItem.Alias); - } - + menu.Items.Add(ui.Text("actions", ActionRePublish.Instance.Alias)).ConvertLegacyMenuItem(null, "content", "content"); + menu.Items.Add(ui.Text("actions", ActionRefresh.Instance.Alias), true); + return menu; } @@ -150,10 +146,6 @@ namespace Umbraco.Web.Trees //set the default to create nodeMenu.DefaultMenuAlias = ActionNew.Instance.Alias; - foreach (var menuItem in nodeMenu.MenuItems) - { - menuItem.Name = ui.Text("actions", menuItem.Alias); - } return nodeMenu; } @@ -170,26 +162,26 @@ namespace Umbraco.Web.Trees protected MenuItemCollection GetAllNodeMenuItems(IUmbracoEntity item) { var menu = new MenuItemCollection(); - menu.AddMenuItem(); - menu.AddMenuItem(true); + menu.Items.Add(ui.Text("actions", ActionNew.Instance.Alias)); + menu.Items.Add(ui.Text("actions", ActionDelete.Instance.Alias)); //need to ensure some of these are converted to the legacy system - until we upgrade them all to be angularized. - menu.AddMenuItem(true); - menu.AddMenuItem(); - - menu.AddMenuItem(true).ConvertLegacyMenuItem(item, "content", "content"); + menu.Items.Add(ui.Text("actions", ActionMove.Instance.Alias), true); + menu.Items.Add(ui.Text("actions", ActionCopy.Instance.Alias)); - menu.AddMenuItem().ConvertLegacyMenuItem(item, "content", "content"); - menu.AddMenuItem(true).ConvertLegacyMenuItem(item, "content", "content"); - menu.AddMenuItem().ConvertLegacyMenuItem(item, "content", "content"); - menu.AddMenuItem().ConvertLegacyMenuItem(item, "content", "content"); - menu.AddMenuItem().ConvertLegacyMenuItem(item, "content", "content"); - menu.AddMenuItem(true).ConvertLegacyMenuItem(item, "content", "content"); - menu.AddMenuItem(true).ConvertLegacyMenuItem(item, "content", "content"); - menu.AddMenuItem(true).ConvertLegacyMenuItem(item, "content", "content"); - menu.AddMenuItem().ConvertLegacyMenuItem(item, "content", "content"); + menu.Items.Add(ui.Text("actions", ActionSort.Instance.Alias), true).ConvertLegacyMenuItem(item, "content", "content"); - menu.AddMenuItem(true); + menu.Items.Add(ui.Text("actions", ActionRollback.Instance.Alias)).ConvertLegacyMenuItem(item, "content", "content"); + menu.Items.Add(ui.Text("actions", ActionPublish.Instance.Alias), true).ConvertLegacyMenuItem(item, "content", "content"); + menu.Items.Add(ui.Text("actions", ActionToPublish.Instance.Alias)).ConvertLegacyMenuItem(item, "content", "content"); + menu.Items.Add(ui.Text("actions", ActionAssignDomain.Instance.Alias)).ConvertLegacyMenuItem(item, "content", "content"); + menu.Items.Add(ui.Text("actions", ActionRights.Instance.Alias)).ConvertLegacyMenuItem(item, "content", "content"); + menu.Items.Add(ui.Text("actions", ActionProtect.Instance.Alias), true).ConvertLegacyMenuItem(item, "content", "content"); + menu.Items.Add(ui.Text("actions", ActionUnPublish.Instance.Alias), true).ConvertLegacyMenuItem(item, "content", "content"); + menu.Items.Add(ui.Text("actions", ActionNotify.Instance.Alias), true).ConvertLegacyMenuItem(item, "content", "content"); + menu.Items.Add(ui.Text("actions", ActionSendToTranslate.Instance.Alias)).ConvertLegacyMenuItem(item, "content", "content"); + + menu.Items.Add(ui.Text("actions", ActionRefresh.Instance.Alias), true); return menu; } diff --git a/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs b/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs index a1e646e70a..c97c586e10 100644 --- a/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs +++ b/src/Umbraco.Web/Trees/ContentTreeControllerBase.cs @@ -96,8 +96,8 @@ namespace Umbraco.Web.Trees if (RecycleBinId.ToInvariantString() == id) { var menu = new MenuItemCollection(); - menu.AddMenuItem(); - menu.AddMenuItem(true); + menu.Items.Add(ui.Text("actions", ActionEmptyTranscan.Instance.Alias)); + menu.Items.Add(ui.Text("actions", ActionRefresh.Instance.Alias), true); return menu; } return PerformGetMenuForNode(id, queryStrings); @@ -113,7 +113,7 @@ namespace Umbraco.Web.Trees { var userAllowedActions = userAllowedMenuItems.Where(x => x.Action != null).Select(x => x.Action).ToArray(); - var notAllowed = menuWithAllItems.MenuItems.Where( + var notAllowed = menuWithAllItems.Items.Where( a => (a.Action != null && a.Action.CanBePermissionAssigned && (a.Action.CanBePermissionAssigned == false || userAllowedActions.Contains(a.Action) == false))) @@ -122,7 +122,7 @@ namespace Umbraco.Web.Trees //remove the ones that aren't allowed. foreach (var m in notAllowed) { - menuWithAllItems.RemoveMenuItem(m); + menuWithAllItems.Items.Remove(m); } } diff --git a/src/Umbraco.Web/Trees/DataTypeTreeController.cs b/src/Umbraco.Web/Trees/DataTypeTreeController.cs index 278b4a188b..c627de0bc4 100644 --- a/src/Umbraco.Web/Trees/DataTypeTreeController.cs +++ b/src/Umbraco.Web/Trees/DataTypeTreeController.cs @@ -7,6 +7,7 @@ using System.Web.Http; using Umbraco.Core; using Umbraco.Web.Mvc; using Umbraco.Web.Trees.Menu; +using umbraco; using umbraco.BusinessLogic.Actions; using Constants = Umbraco.Core.Constants; @@ -14,6 +15,7 @@ namespace Umbraco.Web.Trees { [Tree(Constants.Applications.Developer, Constants.Trees.DataTypes, "Data Types")] [PluginController("UmbracoTrees")] + [CoreTree] public class DataTypeTreeController : TreeController { protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings) @@ -45,13 +47,13 @@ namespace Umbraco.Web.Trees if (id == Constants.System.Root.ToInvariantString()) { // root actions - menu.AddMenuItem(); - menu.AddMenuItem(true); + menu.Items.Add(ui.Text("actions", ActionNew.Instance.Alias)); + menu.Items.Add(ui.Text("actions", ActionRefresh.Instance.Alias), true); return menu; } - + //only have delete for each node - menu.AddMenuItem(); + menu.Items.Add(ui.Text("actions", ActionDelete.Instance.Alias)); return menu; } } diff --git a/src/Umbraco.Web/Trees/LegacyTreeController.cs b/src/Umbraco.Web/Trees/LegacyTreeController.cs index 4fa7d35edf..cdb6958570 100644 --- a/src/Umbraco.Web/Trees/LegacyTreeController.cs +++ b/src/Umbraco.Web/Trees/LegacyTreeController.cs @@ -75,7 +75,7 @@ namespace Umbraco.Web.Trees throw new ApplicationException(msg); } - foreach (var menuItem in attempt.Result.MenuItems) + foreach (var menuItem in attempt.Result.Items) { menuItem.Name = global::umbraco.ui.Text("actions", menuItem.Alias); } @@ -90,7 +90,7 @@ namespace Umbraco.Web.Trees LogHelper.Error(msg, attempt.Exception); throw new ApplicationException(msg); } - foreach (var menuItem in attempt.Result.MenuItems) + foreach (var menuItem in attempt.Result.Items) { menuItem.Name = global::umbraco.ui.Text("actions", menuItem.Alias); } diff --git a/src/Umbraco.Web/Trees/LegacyTreeDataConverter.cs b/src/Umbraco.Web/Trees/LegacyTreeDataConverter.cs index d7fb72d053..f0400712ea 100644 --- a/src/Umbraco.Web/Trees/LegacyTreeDataConverter.cs +++ b/src/Umbraco.Web/Trees/LegacyTreeDataConverter.cs @@ -143,11 +143,11 @@ namespace Umbraco.Web.Trees if (t is ContextMenuSeperator && numAdded > 0) { //store the index for which the seperator should be placed - seperators.Add(collection.MenuItems.Count()); + seperators.Add(collection.Items.Count()); } else { - var menuItem = collection.AddMenuItem(t); + var menuItem = collection.Items.Add(t, ui.Text("actions", t.Alias)); var currentAction = t; @@ -164,12 +164,12 @@ namespace Umbraco.Web.Trees numAdded++; } } - var length = collection.MenuItems.Count(); + var length = collection.Items.Count(); foreach (var s in seperators) { if (length >= s) { - collection.MenuItems.ElementAt(s).SeperatorBefore = true; + collection.Items.ElementAt(s).SeperatorBefore = true; } } diff --git a/src/Umbraco.Web/Trees/MediaTreeController.cs b/src/Umbraco.Web/Trees/MediaTreeController.cs index e4ebb5a5e0..247337ff3d 100644 --- a/src/Umbraco.Web/Trees/MediaTreeController.cs +++ b/src/Umbraco.Web/Trees/MediaTreeController.cs @@ -18,6 +18,7 @@ namespace Umbraco.Web.Trees [LegacyBaseTree(typeof(loadMedia))] [Tree(Constants.Applications.Media, Constants.Trees.Media, "Media")] [PluginController("UmbracoTrees")] + [CoreTree] public class MediaTreeController : ContentTreeControllerBase { protected override TreeNode CreateRootNode(FormDataCollection queryStrings) @@ -76,9 +77,9 @@ namespace Umbraco.Web.Trees } // root actions - menu.AddMenuItem(); - menu.AddMenuItem(true).ConvertLegacyMenuItem(null, "media", "media"); - menu.AddMenuItem(true); + menu.Items.Add(ui.Text("actions", ActionNew.Instance.Alias)); + menu.Items.Add(ui.Text("actions", ActionSort.Instance.Alias), true).ConvertLegacyMenuItem(null, "media", "media"); + menu.Items.Add(ui.Text("actions", ActionRefresh.Instance.Alias), true); return menu; } @@ -93,11 +94,11 @@ namespace Umbraco.Web.Trees throw new HttpResponseException(HttpStatusCode.NotFound); } //return a normal node menu: - menu.AddMenuItem(); - menu.AddMenuItem(); - menu.AddMenuItem(); - menu.AddMenuItem().ConvertLegacyMenuItem(null, "media", "media"); - menu.AddMenuItem(true); + menu.Items.Add(ui.Text("actions", ActionNew.Instance.Alias)); + menu.Items.Add(ui.Text("actions", ActionMove.Instance.Alias)); + menu.Items.Add(ui.Text("actions", ActionDelete.Instance.Alias)); + menu.Items.Add(ui.Text("actions", ActionSort.Instance.Alias)).ConvertLegacyMenuItem(null, "media", "media"); + menu.Items.Add(ui.Text("actions", ActionRefresh.Instance.Alias), true); return menu; } diff --git a/src/Umbraco.Web/Trees/MemberTreeController.cs b/src/Umbraco.Web/Trees/MemberTreeController.cs index 081f7c8c33..d4920cd9c4 100644 --- a/src/Umbraco.Web/Trees/MemberTreeController.cs +++ b/src/Umbraco.Web/Trees/MemberTreeController.cs @@ -17,6 +17,7 @@ namespace Umbraco.Web.Trees [LegacyBaseTree(typeof (loadMembers))] [Tree(Constants.Applications.Members, Constants.Trees.Members, "Members")] [PluginController("UmbracoTrees")] + [CoreTree] public class MemberTreeController : TreeController { protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings) @@ -79,13 +80,13 @@ namespace Umbraco.Web.Trees menu.DefaultMenuAlias = ActionNew.Instance.Alias; // root actions - menu.AddMenuItem(); - menu.AddMenuItem(true); + menu.Items.Add(ui.Text("actions", ActionNew.Instance.Alias)); + menu.Items.Add(ui.Text("actions", ActionRefresh.Instance.Alias), true); return menu; } - menu.AddMenuItem(); - menu.AddMenuItem(true); + menu.Items.Add(ui.Text("actions", ActionDelete.Instance.Alias)); + menu.Items.Add(ui.Text("actions", ActionRefresh.Instance.Alias), true); return menu; } } diff --git a/src/Umbraco.Web/Trees/Menu/MenuItem.cs b/src/Umbraco.Web/Trees/Menu/MenuItem.cs index a417a0043c..031c585930 100644 --- a/src/Umbraco.Web/Trees/Menu/MenuItem.cs +++ b/src/Umbraco.Web/Trees/Menu/MenuItem.cs @@ -2,6 +2,7 @@ using System.Runtime.Serialization; using umbraco.interfaces; using System.Collections.Generic; +using Umbraco.Core; namespace Umbraco.Web.Trees.Menu { @@ -14,12 +15,20 @@ namespace Umbraco.Web.Trees.Menu public MenuItem() { AdditionalData = new Dictionary(); + Icon = "folder"; } - public MenuItem(IAction legacyMenu) + public MenuItem(string alias, string name) : this() { - Name = legacyMenu.Alias; + Alias = alias; + Name = name; + } + + public MenuItem(IAction legacyMenu, string name = "") + : this() + { + Name = name.IsNullOrWhiteSpace() ? legacyMenu.Alias : name; Alias = legacyMenu.Alias; SeperatorBefore = false; Icon = legacyMenu.Icon; diff --git a/src/Umbraco.Web/Trees/Menu/MenuItemCollection.cs b/src/Umbraco.Web/Trees/Menu/MenuItemCollection.cs index 6f88ddfdb6..ea57fb7a07 100644 --- a/src/Umbraco.Web/Trees/Menu/MenuItemCollection.cs +++ b/src/Umbraco.Web/Trees/Menu/MenuItemCollection.cs @@ -1,29 +1,26 @@ -using System; -using System.Collections; +using System.Collections; using System.Collections.Generic; using System.Runtime.Serialization; -using Umbraco.Core; -using umbraco.BusinessLogic.Actions; -using umbraco.interfaces; namespace Umbraco.Web.Trees.Menu { - + /// + /// A menu item collection for a given tree node + /// [DataContract(Name = "menuItems", Namespace = "")] - public class MenuItemCollection + public class MenuItemCollection { - private readonly List _menuItems; + private readonly MenuItemList _menuItems = new MenuItemList(); public MenuItemCollection() - { - _menuItems = new List(); + { } public MenuItemCollection(IEnumerable items) { - _menuItems = new List(items); + _menuItems = new MenuItemList(items); } - + /// /// Sets the default menu item alias to be shown when the menu is launched - this is optional and if not set then the menu will just be shown normally. /// @@ -33,163 +30,16 @@ namespace Umbraco.Web.Trees.Menu /// /// The list of menu items /// + /// + /// We require this so the json serialization works correctly + /// [DataMember(Name = "menuItems")] - public IEnumerable MenuItems + public MenuItemList Items { get { return _menuItems; } } - /// - /// Adds a menu item - /// - internal MenuItem AddMenuItem(IAction action) - { - var item = new MenuItem(action); - - DetectLegacyActionMenu(action.GetType(), item); - - _menuItems.Add(item); - return item; - } - - /// - /// Removes a menu item - /// - /// - public void RemoveMenuItem(MenuItem item) - { - _menuItems.Remove(item); - } - - /// - /// Adds a menu item - /// - public void AddMenuItem(MenuItem item) - { - _menuItems.Add(item); - } - - //TODO: Implement more overloads for MenuItem with dictionary vals - - public TMenuItem AddMenuItem(bool hasSeparator = false, IDictionary additionalData = null) - where TAction : IAction - where TMenuItem : MenuItem, new() - { - var item = CreateMenuItem(hasSeparator, additionalData); - if (item == null) return null; - - var customMenuItem = new TMenuItem - { - Name = item.Alias, - Alias = item.Alias, - SeperatorBefore = hasSeparator, - Icon = item.Icon, - Action = item.Action - }; - - _menuItems.Add(customMenuItem); - - return customMenuItem; - } - - /// - /// Adds a menu item - /// - /// - public MenuItem AddMenuItem() - where T : IAction - { - return AddMenuItem(false, null); - } - - /// - /// Adds a menu item with a key value pair which is merged to the AdditionalData bag - /// - /// - /// - /// - /// - public MenuItem AddMenuItem(string key, string value, bool hasSeparator = false) - where T : IAction - { - return AddMenuItem(hasSeparator, new Dictionary { { key, value } }); - } - - internal MenuItem CreateMenuItem(bool hasSeparator = false, IDictionary additionalData = null) - where T : IAction - { - var item = ActionsResolver.Current.GetAction(); - if (item != null) - { - var menuItem = new MenuItem(item) - { - SeperatorBefore = hasSeparator - }; - - if (additionalData != null) - { - foreach (var i in additionalData) - { - menuItem.AdditionalData[i.Key] = i.Value; - } - } - - DetectLegacyActionMenu(typeof (T), menuItem); - - //TODO: Once we implement 'real' menu items, not just IActions we can implement this since - // people may need to pass specific data to their menu items - - ////validate the data in the meta data bag - //item.ValidateRequiredData(AdditionalData); - - return menuItem; - } - return null; - } - - /// - /// Adds a menu item with a dictionary which is merged to the AdditionalData bag - /// - /// - /// - /// - public MenuItem AddMenuItem(bool hasSeparator = false, IDictionary additionalData = null) - where T : IAction - { - var item = CreateMenuItem(hasSeparator, additionalData); - if (item != null) - { - _menuItems.Add(item); - return item; - } - return null; - } - - /// - /// Checks if the IAction type passed in is attributed with LegacyActionMenuItemAttribute and if so - /// ensures that the correct action metadata is added. - /// - /// - /// - private void DetectLegacyActionMenu(Type actionType, MenuItem menuItem) - { - //This checks for legacy IActions that have the LegacyActionMenuItemAttribute which is a legacy hack - // to make old IAction actions work in v7 by mapping to the JS used by the new menu items - var attribute = actionType.GetCustomAttribute(false); - if (attribute != null) - { - //add the current type to the metadata - if (attribute.MethodName.IsNullOrWhiteSpace()) - { - //if no method name is supplied we will assume that the menu action is the type name of the current menu class - menuItem.AdditionalData.Add("jsAction", string.Format("{0}.{1}", attribute.ServiceName, this.GetType().Name)); - } - else - { - menuItem.AdditionalData.Add("jsAction", string.Format("{0}.{1}", attribute.ServiceName, attribute.MethodName)); - } - } - } + } } \ No newline at end of file diff --git a/src/Umbraco.Web/Trees/Menu/MenuItemExtensions.cs b/src/Umbraco.Web/Trees/Menu/MenuItemExtensions.cs index 0576991eac..32dfecc13a 100644 --- a/src/Umbraco.Web/Trees/Menu/MenuItemExtensions.cs +++ b/src/Umbraco.Web/Trees/Menu/MenuItemExtensions.cs @@ -10,12 +10,25 @@ namespace Umbraco.Web.Trees.Menu /// Used as a key for the AdditionalData to specify a specific dialog title instead of the menu title /// internal const string DialogTitleKey = "dialogTitle"; + + /// + /// Used to specify the URL that the dialog will launch to in an iframe + /// internal const string ActionUrlKey = "actionUrl"; + + //TODO: some action's want to launch a new window like live editing, we support this in the menu item's metadata with + // a key called: "actionUrlMethod" which can be set to either: Dialog, BlankWindow. Normally this is always set to Dialog + // if a URL is specified in the "actionUrl" metadata. For now I'm not going to implement launching in a blank window, + // though would be v-easy, just not sure we want to ever support that? internal const string ActionUrlMethodKey = "actionUrlMethod"; + + /// + /// Used to specify the angular view that the dialog will launch + /// internal const string ActionViewKey = "actionView"; /// - /// Sets the menu item to display a dialog based on a view path + /// Sets the menu item to display a dialog based on an angular view path /// /// /// @@ -27,7 +40,7 @@ namespace Umbraco.Web.Trees.Menu } /// - /// Sets the menu item to display a dialog based on a url path + /// Sets the menu item to display a dialog based on a url path in an iframe /// /// /// diff --git a/src/Umbraco.Web/Trees/Menu/MenuItemList.cs b/src/Umbraco.Web/Trees/Menu/MenuItemList.cs new file mode 100644 index 0000000000..60c32b02e0 --- /dev/null +++ b/src/Umbraco.Web/Trees/Menu/MenuItemList.cs @@ -0,0 +1,181 @@ +using System; +using System.Collections.Generic; +using Umbraco.Core; +using umbraco.BusinessLogic.Actions; +using umbraco.interfaces; + +namespace Umbraco.Web.Trees.Menu +{ + /// + /// A custom menu list + /// + /// + /// NOTE: We need a sub collection to the MenuItemCollection object due to how json serialization works. + /// + public class MenuItemList : List + { + public MenuItemList() + { + } + + public MenuItemList(IEnumerable items) + : base(items) + { + } + + /// + /// Adds a menu item + /// + /// + /// The text to display for the menu item, will default to the IAction alias if not specified + internal MenuItem Add(IAction action, string name) + { + var item = new MenuItem(action); + + DetectLegacyActionMenu(action.GetType(), item); + + Add(item); + return item; + } + + /// + /// Adds a menu item + /// + /// + /// + /// + /// The text to display for the menu item, will default to the IAction alias if not specified + /// + /// + public TMenuItem Add(string name, bool hasSeparator = false, IDictionary additionalData = null) + where TAction : IAction + where TMenuItem : MenuItem, new() + { + var item = CreateMenuItem(name, hasSeparator, additionalData); + if (item == null) return null; + + var customMenuItem = new TMenuItem + { + Name = item.Alias, + Alias = item.Alias, + SeperatorBefore = hasSeparator, + Icon = item.Icon, + Action = item.Action + }; + + Add(customMenuItem); + + return customMenuItem; + } + + /// + /// Adds a menu item + /// + /// The text to display for the menu item, will default to the IAction alias if not specified + /// + public MenuItem Add(string name) + where T : IAction + { + return Add(name, false, null); + } + + /// + /// Adds a menu item with a key value pair which is merged to the AdditionalData bag + /// + /// + /// + /// + /// The text to display for the menu item, will default to the IAction alias if not specified + /// + public MenuItem Add(string name, string key, string value, bool hasSeparator = false) + where T : IAction + { + return Add(name, hasSeparator, new Dictionary { { key, value } }); + } + + /// + /// Adds a menu item with a dictionary which is merged to the AdditionalData bag + /// + /// + /// + /// /// The text to display for the menu item, will default to the IAction alias if not specified + /// + public MenuItem Add(string name, bool hasSeparator = false, IDictionary additionalData = null) + where T : IAction + { + var item = CreateMenuItem(name, hasSeparator, additionalData); + if (item != null) + { + Add(item); + return item; + } + return null; + } + + /// + /// + /// + /// + /// + /// The text to display for the menu item, will default to the IAction alias if not specified + /// + /// + internal MenuItem CreateMenuItem(string name, bool hasSeparator = false, IDictionary additionalData = null) + where T : IAction + { + var item = ActionsResolver.Current.GetAction(); + if (item != null) + { + var menuItem = new MenuItem(item, name) + { + SeperatorBefore = hasSeparator + }; + + if (additionalData != null) + { + foreach (var i in additionalData) + { + menuItem.AdditionalData[i.Key] = i.Value; + } + } + + DetectLegacyActionMenu(typeof(T), menuItem); + + //TODO: Once we implement 'real' menu items, not just IActions we can implement this since + // people may need to pass specific data to their menu items + + ////validate the data in the meta data bag + //item.ValidateRequiredData(AdditionalData); + + return menuItem; + } + return null; + } + + /// + /// Checks if the IAction type passed in is attributed with LegacyActionMenuItemAttribute and if so + /// ensures that the correct action metadata is added. + /// + /// + /// + private void DetectLegacyActionMenu(Type actionType, MenuItem menuItem) + { + //This checks for legacy IActions that have the LegacyActionMenuItemAttribute which is a legacy hack + // to make old IAction actions work in v7 by mapping to the JS used by the new menu items + var attribute = actionType.GetCustomAttribute(false); + if (attribute != null) + { + //add the current type to the metadata + if (attribute.MethodName.IsNullOrWhiteSpace()) + { + //if no method name is supplied we will assume that the menu action is the type name of the current menu class + menuItem.AdditionalData.Add("jsAction", string.Format("{0}.{1}", attribute.ServiceName, this.GetType().Name)); + } + else + { + menuItem.AdditionalData.Add("jsAction", string.Format("{0}.{1}", attribute.ServiceName, attribute.MethodName)); + } + } + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Web/Trees/MenuRenderingEventArgs.cs b/src/Umbraco.Web/Trees/MenuRenderingEventArgs.cs new file mode 100644 index 0000000000..72e203f2e0 --- /dev/null +++ b/src/Umbraco.Web/Trees/MenuRenderingEventArgs.cs @@ -0,0 +1,25 @@ +using System.Net.Http.Formatting; +using Umbraco.Web.Trees.Menu; + +namespace Umbraco.Web.Trees +{ + public class MenuRenderingEventArgs : TreeRenderingEventArgs + { + /// + /// The tree node id that the menu is rendering for + /// + public string NodeId { get; private set; } + + /// + /// The menu being rendered + /// + public MenuItemCollection Menu { get; private set; } + + public MenuRenderingEventArgs(string nodeId, MenuItemCollection menu, FormDataCollection queryStrings) + : base(queryStrings) + { + NodeId = nodeId; + Menu = menu; + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Web/Trees/TreeAttribute.cs b/src/Umbraco.Web/Trees/TreeAttribute.cs index 72ae4044e9..5acf367738 100644 --- a/src/Umbraco.Web/Trees/TreeAttribute.cs +++ b/src/Umbraco.Web/Trees/TreeAttribute.cs @@ -2,6 +2,18 @@ namespace Umbraco.Web.Trees { + /// + /// Indicates that a tree is a core tree and shouldn't be treated as a plugin tree + /// + /// + /// This ensures that umbraco will look in the umbraco folders for views for this tree + /// + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)] + internal class CoreTreeAttribute : Attribute + { + + } + /// /// Identifies an application tree /// diff --git a/src/Umbraco.Web/Trees/TreeController.cs b/src/Umbraco.Web/Trees/TreeController.cs index e6ea6abe75..374e251763 100644 --- a/src/Umbraco.Web/Trees/TreeController.cs +++ b/src/Umbraco.Web/Trees/TreeController.cs @@ -1,11 +1,15 @@ using System; +using System.Collections.Concurrent; using System.Globalization; using System.Linq; using System.Net.Http.Formatting; using Umbraco.Core; +using Umbraco.Core.Events; +using Umbraco.Web.Mvc; using Umbraco.Web.Trees.Menu; using Umbraco.Web.WebApi; using Umbraco.Web.WebApi.Filters; +using Constants = Umbraco.Core.Constants; namespace Umbraco.Web.Trees { @@ -42,7 +46,7 @@ namespace Umbraco.Web.Trees //assign the properties of this object to those of the metadata attribute _attribute = treeAttributes.First(); } - + /// /// The method called to render the contents of the tree structure /// @@ -161,7 +165,10 @@ namespace Umbraco.Web.Trees public MenuItemCollection GetMenu(string id, FormDataCollection queryStrings) { if (queryStrings == null) queryStrings = new FormDataCollection(""); - return GetMenuForNode(id, queryStrings); + var menu = GetMenuForNode(id, queryStrings); + //raise the event + OnMenuRendering(this, new MenuRenderingEventArgs(id, menu, queryStrings)); + return menu; } /// @@ -300,7 +307,15 @@ namespace Umbraco.Web.Trees #endregion - public static event EventHandler TreeNodesRendering; + #region Events + + /// + /// An event that allows developers to modify the tree node collection that is being rendered + /// + /// + /// Developers can add/remove/replace/insert/update/etc... any of the tree items in the collection. + /// + public static event TypedEventHandler TreeNodesRendering; private static void OnTreeNodesRendering(TreeController instance, TreeNodesRenderingEventArgs e) { @@ -308,12 +323,32 @@ namespace Umbraco.Web.Trees if (handler != null) handler(instance, e); } - public static event EventHandler RootNodeRendering; + /// + /// An event that allows developer to modify the root tree node that is being rendered + /// + public static event TypedEventHandler RootNodeRendering; private static void OnRootNodeRendering(TreeController instance, TreeNodeRenderingEventArgs e) { var handler = RootNodeRendering; if (handler != null) handler(instance, e); } + + /// + /// An event that allows developers to modify the meun that is being rendered + /// + /// + /// Developers can add/remove/replace/insert/update/etc... any of the tree items in the collection. + /// + public static event TypedEventHandler MenuRendering; + + private static void OnMenuRendering(TreeController instance, MenuRenderingEventArgs e) + { + var handler = MenuRendering; + if (handler != null) handler(instance, e); + } + + #endregion + } } diff --git a/src/Umbraco.Web/Trees/TreeNodeRenderingEventArgs.cs b/src/Umbraco.Web/Trees/TreeNodeRenderingEventArgs.cs index 67af3959dc..883579a964 100644 --- a/src/Umbraco.Web/Trees/TreeNodeRenderingEventArgs.cs +++ b/src/Umbraco.Web/Trees/TreeNodeRenderingEventArgs.cs @@ -6,7 +6,7 @@ namespace Umbraco.Web.Trees { public TreeNode Node { get; private set; } - public TreeNodeRenderingEventArgs(TreeNode node, FormDataCollection queryStrings) + public TreeNodeRenderingEventArgs(TreeNode node, FormDataCollection queryStrings) : base(queryStrings) { Node = node; diff --git a/src/Umbraco.Web/UI/Controls/FolderBrowser.cs b/src/Umbraco.Web/UI/Controls/FolderBrowser.cs index 08d9cbc4de..97512dff17 100644 --- a/src/Umbraco.Web/UI/Controls/FolderBrowser.cs +++ b/src/Umbraco.Web/UI/Controls/FolderBrowser.cs @@ -5,7 +5,7 @@ using System.Web.UI; using System.Web.UI.WebControls; using ClientDependency.Core; using umbraco.BasePages; -using umbraco.IO; +using Umbraco.Core.IO; namespace Umbraco.Web.UI.Controls { diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index b5f73b1be8..372781d7be 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -308,6 +308,7 @@ + @@ -327,13 +328,14 @@ + - + @@ -372,7 +374,9 @@ + + ASPXCodeBehind @@ -1845,7 +1849,9 @@ ASPXCodeBehind - + + ASPXCodeBehind + @@ -1862,7 +1868,9 @@ ASPXCodeBehind - + + ASPXCodeBehind + diff --git a/src/Umbraco.Web/WebBootManager.cs b/src/Umbraco.Web/WebBootManager.cs index ddaf08c9b2..0549dfc819 100644 --- a/src/Umbraco.Web/WebBootManager.cs +++ b/src/Umbraco.Web/WebBootManager.cs @@ -29,6 +29,7 @@ using Umbraco.Web.Routing; using Umbraco.Web.Security; using Umbraco.Web.WebApi; using umbraco.BusinessLogic; +using ProfilingViewEngine = Umbraco.Core.Profiling.ProfilingViewEngine; namespace Umbraco.Web @@ -74,9 +75,9 @@ namespace Umbraco.Web new MasterControllerFactory(FilteredControllerFactoriesResolver.Current)); //set the render view engine - ViewEngines.Engines.Add(new ProfilingViewEngine(new RenderViewEngine())); + ViewEngines.Engines.Add(new RenderViewEngine()); //set the plugin view engine - ViewEngines.Engines.Add(new ProfilingViewEngine(new PluginViewEngine())); + ViewEngines.Engines.Add(new PluginViewEngine()); //set model binder ModelBinders.Binders.Add(new KeyValuePair(typeof(RenderModel), new RenderModelBinder())); @@ -130,7 +131,16 @@ namespace Umbraco.Web /// public override IBootManager Complete(Action afterComplete) { - //set routes + //Wrap viewengines in the profiling engine + IViewEngine[] engines = ViewEngines.Engines.Select(e => e).ToArray(); + ViewEngines.Engines.Clear(); + foreach (var engine in engines) + { + var wrappedEngine = engine is ProfilingViewEngine ? engine : new ProfilingViewEngine(engine); + ViewEngines.Engines.Add(wrappedEngine); + } + + //set routes CreateRoutes(); base.Complete(afterComplete); diff --git a/src/Umbraco.Web/umbraco.presentation/NotFoundHandlers.cs b/src/Umbraco.Web/umbraco.presentation/NotFoundHandlers.cs index 032f08586a..ecfa83b1ae 100644 --- a/src/Umbraco.Web/umbraco.presentation/NotFoundHandlers.cs +++ b/src/Umbraco.Web/umbraco.presentation/NotFoundHandlers.cs @@ -11,7 +11,7 @@ using umbraco.cms.businesslogic.member; using umbraco.cms.businesslogic.template; using umbraco.cms.businesslogic.web; using umbraco.interfaces; -using umbraco.IO; +using Umbraco.Core.IO; using umbraco.NodeFactory; namespace umbraco { diff --git a/src/Umbraco.Web/umbraco.presentation/UmbracoServerUtility.cs b/src/Umbraco.Web/umbraco.presentation/UmbracoServerUtility.cs index b50fddc254..1e0a77f273 100644 --- a/src/Umbraco.Web/umbraco.presentation/UmbracoServerUtility.cs +++ b/src/Umbraco.Web/umbraco.presentation/UmbracoServerUtility.cs @@ -1,7 +1,7 @@ using System; using System.Web; using System.Xml.Linq; -using umbraco.IO; +using Umbraco.Core.IO; using umbraco.presentation.preview; using umbraco.BusinessLogic; using System.Xml; diff --git a/src/Umbraco.Web/umbraco.presentation/library.cs b/src/Umbraco.Web/umbraco.presentation/library.cs index 0430fb5940..629fd9eb8b 100644 --- a/src/Umbraco.Web/umbraco.presentation/library.cs +++ b/src/Umbraco.Web/umbraco.presentation/library.cs @@ -29,7 +29,7 @@ using umbraco.cms.helpers; using umbraco.scripting; using umbraco.DataLayer; using umbraco.cms.businesslogic.language; -using umbraco.IO; +using Umbraco.Core.IO; using UmbracoContext = umbraco.presentation.UmbracoContext; namespace umbraco @@ -1123,7 +1123,7 @@ namespace umbraco /// public static void AddJquery() { - RegisterJavaScriptFile("jQuery", String.Format("{0}/ui/jquery.js", IOHelper.ResolveUrl(SystemDirectories.Umbraco_client))); + RegisterJavaScriptFile("jQuery", String.Format("{0}/ui/jquery.js", IOHelper.ResolveUrl(SystemDirectories.UmbracoClient))); } diff --git a/src/Umbraco.Web/umbraco.presentation/python.cs b/src/Umbraco.Web/umbraco.presentation/python.cs index 61bda0c142..80b80c78a6 100644 --- a/src/Umbraco.Web/umbraco.presentation/python.cs +++ b/src/Umbraco.Web/umbraco.presentation/python.cs @@ -1,5 +1,5 @@ using System; -using umbraco.IO; +using Umbraco.Core.IO; namespace umbraco.scripting { diff --git a/src/Umbraco.Web/umbraco.presentation/requestModule.cs b/src/Umbraco.Web/umbraco.presentation/requestModule.cs index 14fe89193e..6be1737545 100644 --- a/src/Umbraco.Web/umbraco.presentation/requestModule.cs +++ b/src/Umbraco.Web/umbraco.presentation/requestModule.cs @@ -11,7 +11,7 @@ using umbraco.BusinessLogic.Utils; using umbraco.businesslogic; using umbraco.cms.businesslogic.cache; using System.Web.Caching; -using umbraco.IO; +using Umbraco.Core.IO; using umbraco.interfaces; diff --git a/src/Umbraco.Web/umbraco.presentation/template.cs b/src/Umbraco.Web/umbraco.presentation/template.cs index 1b51a735ca..40a786325a 100644 --- a/src/Umbraco.Web/umbraco.presentation/template.cs +++ b/src/Umbraco.Web/umbraco.presentation/template.cs @@ -16,7 +16,7 @@ using Umbraco.Web; using Umbraco.Web.Cache; using umbraco.DataLayer; using umbraco.BusinessLogic; -using umbraco.IO; +using Umbraco.Core.IO; using System.Web; namespace umbraco diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/BaseTree.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/BaseTree.cs index 74c040aec5..5abe5dee1c 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/BaseTree.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/BaseTree.cs @@ -7,6 +7,7 @@ using System.Xml; using Umbraco.Core; using Umbraco.Core.Models.EntityBase; using Umbraco.Core.Services; +using Umbraco.Web.Trees; using umbraco.BusinessLogic; using umbraco.BusinessLogic.Actions; using umbraco.cms.businesslogic.media; @@ -18,7 +19,7 @@ namespace umbraco.cms.presentation.Trees /// /// All ITree's should inherit from BaseTree. /// - public abstract class BaseTree : ITree, ITreeService + public abstract class BaseTree : ITree, ITreeService //, IApplicationEventHandler { public BaseTree(string application) @@ -580,9 +581,75 @@ namespace umbraco.cms.presentation.Trees } #endregion + + //void IApplicationEventHandler.OnApplicationInitialized(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) + //{ + //} + + //void IApplicationEventHandler.OnApplicationStarting(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) + //{ + //} + + //void IApplicationEventHandler.OnApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext) + //{ + // TreeController.TreeNodesRendering += TreeController_TreeNodesRendering; + //} - + //static void TreeController_TreeNodesRendering(TreeController sender, TreeNodesRenderingEventArgs e) + //{ + // var baseTree = new NullTree(""); + // var legacyTree = new XmlTree(); + // var toRemove = new List(); + + // foreach (var node in e.Nodes) + // { + // //make the legacy node + // var xNode = XmlTreeNode.Create(baseTree); + // xNode.HasChildren = node.HasChildren; + // xNode.IconClass = node.Icon; + // xNode.NodeID = node.NodeId; + // xNode.NodeType = sender.TreeAlias; + // xNode.Text = node.Title; + // xNode.TreeType = sender.TreeAlias; + // //we cannot support this + // //xNode.OpenIcon = node.Icon; + // //xNode.Menu = ?? + + // baseTree.OnBeforeNodeRender(ref legacyTree, ref xNode, new EventArgs()); + // //if the user has nulled this item, then we need to remove it + // if (xNode == null) + // { + // toRemove.Add(node); + // } + // else + // { + // //add to the legacy tree - this mimics what normally happened in legacy trees + // legacyTree.Add(xNode); + + // //now fire the after event + // baseTree.OnAfterNodeRender(ref legacyTree, ref xNode, new EventArgs()); + + // //ok now we need to determine if we need to map any changes back to the real node + // // these are the only properties that can be mapped back. + // node.HasChildren = xNode.HasChildren; + // node.Icon = xNode.IconClass; + // if (xNode.Icon.IsNullOrWhiteSpace() == false) + // { + // node.Icon = xNode.Icon; + // } + // node.NodeType = xNode.NodeType; + // node.Title = xNode.Text; + // } + // } + + // //now remove the nodes that were removed + // foreach (var r in toRemove) + // { + // e.Nodes.Remove(r); + // } + //} } + } \ No newline at end of file diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/TreeService.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/TreeService.cs index 458798dd38..8e7098e3d1 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/TreeService.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/TreeService.cs @@ -21,7 +21,7 @@ using umbraco.cms.businesslogic.web; using umbraco.interfaces; using umbraco.DataLayer; using System.Collections.Specialized; -using umbraco.IO; +using Umbraco.Core.IO; using umbraco.uicontrols; namespace umbraco.cms.presentation.Trees diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/XmlTree.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/XmlTree.cs index 5d71a2f606..85f769a251 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/XmlTree.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/XmlTree.cs @@ -9,7 +9,7 @@ using System.Web.Script.Serialization; using System.Text; using umbraco.businesslogic.Utils; using umbraco.BasePages; -using umbraco.IO; +using Umbraco.Core.IO; namespace umbraco.cms.presentation.Trees { diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadDLRScripts.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadDLRScripts.cs index def06a2292..c64e044400 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadDLRScripts.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadDLRScripts.cs @@ -22,7 +22,7 @@ using umbraco.interfaces; using umbraco.DataLayer; using umbraco.BusinessLogic.Utils; using umbraco.cms.presentation.Trees; -using umbraco.IO; +using Umbraco.Core.IO; namespace umbraco diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadPython.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadPython.cs index a91a748bf9..168f17b60a 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadPython.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadPython.cs @@ -23,7 +23,7 @@ using umbraco.interfaces; using umbraco.DataLayer; using umbraco.BusinessLogic.Utils; using umbraco.cms.presentation.Trees; -using umbraco.IO; +using Umbraco.Core.IO; using Umbraco.Core; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadScripts.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadScripts.cs index 605ca14946..0b86c90e2a 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadScripts.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadScripts.cs @@ -26,7 +26,7 @@ using umbraco.DataLayer; using umbraco.BusinessLogic.Utils; using umbraco.cms.presentation.Trees; using umbraco.BusinessLogic.Actions; -using umbraco.IO; +using Umbraco.Core.IO; using Umbraco.Core; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadTemplates.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadTemplates.cs index 5056d970e7..386cc0b3a2 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadTemplates.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadTemplates.cs @@ -9,6 +9,7 @@ using System.Xml; using System.Configuration; using Umbraco.Core; using Umbraco.Core.Configuration; +using Umbraco.Core.IO; using umbraco.BasePages; using umbraco.BusinessLogic; using umbraco.businesslogic; @@ -81,11 +82,11 @@ namespace umbraco private void RenderTemplateFolderItems(string folder, string folderPath, ref XmlTree tree) { - string relPath = IO.SystemDirectories.Masterpages + "/" + folder; + string relPath = SystemDirectories.Masterpages + "/" + folder; if (!string.IsNullOrEmpty(folderPath)) relPath += folderPath; - string fullPath = IO.IOHelper.MapPath(relPath); + string fullPath = IOHelper.MapPath(relPath); foreach (string dir in System.IO.Directory.GetDirectories(fullPath)) { @@ -155,7 +156,7 @@ namespace umbraco { if (base.m_id == -1) { - foreach (string s in Directory.GetDirectories(IO.IOHelper.MapPath(IO.SystemDirectories.Masterpages))) + foreach (string s in Directory.GetDirectories(IOHelper.MapPath(SystemDirectories.Masterpages))) { var _s = Path.GetFileNameWithoutExtension(s); diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadXslt.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadXslt.cs index 812083da84..49c54554c2 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadXslt.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadXslt.cs @@ -24,7 +24,7 @@ using umbraco.DataLayer; using umbraco.cms.presentation.Trees; using umbraco.BusinessLogic.Utils; using umbraco.BusinessLogic.Actions; -using umbraco.IO; +using Umbraco.Core.IO; using Umbraco.Core; namespace umbraco diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/actions/preview.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/actions/preview.aspx.cs index 4cad4cae4b..08d33ed969 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/actions/preview.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/actions/preview.aspx.cs @@ -8,7 +8,7 @@ using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using umbraco.cms.businesslogic.web; -using umbraco.IO; +using Umbraco.Core.IO; namespace umbraco.presentation.actions { @@ -28,7 +28,7 @@ namespace umbraco.presentation.actions protected void Page_Load(object sender, EventArgs e) { Document doc = new Document(int.Parse(helper.Request("id"))); - Response.Redirect(IOHelper.ResolveUrl(string.Format("{0}/dialogs/preview.aspx?id= {1}", IO.SystemDirectories.Umbraco, doc.Id))); + Response.Redirect(IOHelper.ResolveUrl(string.Format("{0}/dialogs/preview.aspx?id= {1}", SystemDirectories.Umbraco, doc.Id))); } } } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/channels/UmbracoMetaWeblogAPI.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/channels/UmbracoMetaWeblogAPI.cs index c048ada53b..56b8a9000e 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/channels/UmbracoMetaWeblogAPI.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/channels/UmbracoMetaWeblogAPI.cs @@ -20,7 +20,7 @@ using Post = CookComputing.MetaWeblog.Post; using System.Collections.Generic; using System.Web.Security; -using umbraco.IO; +using Umbraco.Core.IO; using Umbraco.Core; namespace umbraco.presentation.channels diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/channels/config.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/channels/config.cs index 2a6610b4c7..3cb25cb765 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/channels/config.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/channels/config.cs @@ -3,7 +3,7 @@ using System.IO; using System.Web; using System.Xml; using umbraco.BusinessLogic; -using umbraco.IO; +using Umbraco.Core.IO; namespace umbraco.presentation.channels.businesslogic { diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentTypeControl.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentTypeControl.cs index a3c93bcc1d..5a8b0b616e 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentTypeControl.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentTypeControl.cs @@ -3,7 +3,7 @@ using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Collections; using System.IO; -using umbraco.IO; +using Umbraco.Core.IO; using System.Linq; namespace umbraco.controls diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/GenericProperties/GenericProperty.ascx b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/GenericProperties/GenericProperty.ascx index b99e16d8fc..4cdad45578 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/GenericProperties/GenericProperty.ascx +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/GenericProperties/GenericProperty.ascx @@ -10,7 +10,7 @@

- + @@ -21,7 +21,7 @@

- + Edit ""

diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/GenericProperties/GenericPropertyWrapper.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/GenericProperties/GenericPropertyWrapper.cs index 81a3bf2e50..4cd8d046a9 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/GenericProperties/GenericPropertyWrapper.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/GenericProperties/GenericPropertyWrapper.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using umbraco.IO; +using Umbraco.Core.IO; using umbraco.cms.businesslogic.propertytype; namespace umbraco.controls.GenericProperties diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Images/ImageViewerUpdater.asmx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Images/ImageViewerUpdater.asmx.cs index a93108357a..d03a2a668b 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Images/ImageViewerUpdater.asmx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Images/ImageViewerUpdater.asmx.cs @@ -42,7 +42,7 @@ namespace umbraco.controls.Images //load the control with the specified properties and render the output as a string and return it Page page = new Page(); - string path = umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + "/controls/Images/ImageViewer.ascx"; + string path = Umbraco.Core.IO.IOHelper.ResolveUrl(Umbraco.Core.IO.SystemDirectories.Umbraco) + "/controls/Images/ImageViewer.ascx"; ImageViewer imageViewer = page.LoadControl(path) as ImageViewer; imageViewer.MediaId = mediaId; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ProgressBar.ascx b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ProgressBar.ascx index 42dce282c0..2d5ef2d26f 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ProgressBar.ascx +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ProgressBar.ascx @@ -1,2 +1,2 @@ <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ProgressBar.ascx.cs" Inherits="umbraco.presentation.umbraco.controls.ProgressBar" %> -<%#umbraco.ui.Text("publish", "inProgress", null)%>
\ No newline at end of file +<%#umbraco.ui.Text("publish", "inProgress", null)%>
diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/SaveClickEventArgs.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/SaveClickEventArgs.cs index 3e19d63189..b318919a3f 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/SaveClickEventArgs.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/SaveClickEventArgs.cs @@ -8,7 +8,7 @@ using System.Web.UI.HtmlControls; using System.Collections; using System.Web.UI; using ClientDependency.Core; -using umbraco.IO; +using Umbraco.Core.IO; using umbraco.presentation; using System.Collections.Generic; using System.Linq; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/CustomTreeControl.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/CustomTreeControl.cs index 89eeaa74d2..42f7ad8c9b 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/CustomTreeControl.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/CustomTreeControl.cs @@ -4,7 +4,7 @@ using System.Web.UI; using System.Web.UI.HtmlControls; using ClientDependency.Core; using umbraco.controls.Tree; -using umbraco.IO; +using Umbraco.Core.IO; namespace umbraco.controls.Tree { 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..41ac545d6f 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/TreeControl.ascx +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/Tree/TreeControl.ascx @@ -44,8 +44,8 @@ jQuery(document).ready(function() { functionToCall : functionToCall, nodeKey : nodeKey, treeMode: "<%#Mode.ToString().ToLower()%>", - 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"}); + 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"}); //add event handler for ajax errors, this will refresh the whole application var mainTree = UmbClientMgr.mainTree(); diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/CreatedPackageTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/CreatedPackageTasks.cs index 6a156f9099..8c2f9ca837 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/CreatedPackageTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/CreatedPackageTasks.cs @@ -6,7 +6,7 @@ using Umbraco.Web.UI; using umbraco.BusinessLogic; using umbraco.DataLayer; using umbraco.BasePages; -using umbraco.IO; +using Umbraco.Core.IO; using umbraco.cms.businesslogic.member; namespace umbraco diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/DLRScripting.ascx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/DLRScripting.ascx.cs index c64dfb947a..49275e0902 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/DLRScripting.ascx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/DLRScripting.ascx.cs @@ -11,6 +11,7 @@ using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using Umbraco.Core; +using Umbraco.Core.IO; using Umbraco.Web.UI; using umbraco.cms.businesslogic.macro; using umbraco.scripting; @@ -63,8 +64,8 @@ namespace umbraco.presentation.create private void _loadTemplates(ListBox list, string scriptType) { - string path = IO.SystemDirectories.Umbraco + "/scripting/templates/" + scriptType + "/"; - string abPath = IO.IOHelper.MapPath(path); + string path = SystemDirectories.Umbraco + "/scripting/templates/" + scriptType + "/"; + string abPath = IOHelper.MapPath(path); list.Items.Clear(); // always add the option of an empty one diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/DataTypeTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/DataTypeTasks.cs index fcde3d2e43..cc3192cc1c 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/DataTypeTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/DataTypeTasks.cs @@ -5,7 +5,7 @@ using Umbraco.Web.UI; using umbraco.BusinessLogic; using umbraco.DataLayer; using umbraco.BasePages; -using umbraco.IO; +using Umbraco.Core.IO; using umbraco.cms.businesslogic.member; namespace umbraco diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/MemberGroupTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/MemberGroupTasks.cs index ac51e788aa..38912b7f4f 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/MemberGroupTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/MemberGroupTasks.cs @@ -5,7 +5,7 @@ using Umbraco.Web.UI; using umbraco.BusinessLogic; using umbraco.DataLayer; using umbraco.BasePages; -using umbraco.IO; +using Umbraco.Core.IO; using umbraco.cms.businesslogic.member; namespace umbraco diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/MemberTypeTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/MemberTypeTasks.cs index 0f74ff4496..f871f55ea0 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/MemberTypeTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/MemberTypeTasks.cs @@ -5,7 +5,7 @@ using Umbraco.Web.UI; using umbraco.BusinessLogic; using umbraco.DataLayer; using umbraco.BasePages; -using umbraco.IO; +using Umbraco.Core.IO; using umbraco.cms.businesslogic.member; namespace umbraco diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/NewMemberUIEventArgs.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/NewMemberUIEventArgs.cs index 743b81f780..8e7eab0984 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/NewMemberUIEventArgs.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/NewMemberUIEventArgs.cs @@ -4,7 +4,7 @@ using System.Web.Security; using umbraco.BusinessLogic; using umbraco.DataLayer; using umbraco.BasePages; -using umbraco.IO; +using Umbraco.Core.IO; using umbraco.cms.businesslogic.member; namespace umbraco diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/PythonTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/PythonTasks.cs index defba78e19..595090828f 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/PythonTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/PythonTasks.cs @@ -4,7 +4,7 @@ using System.Web.Security; using umbraco.BusinessLogic; using umbraco.DataLayer; using umbraco.BasePages; -using umbraco.IO; +using Umbraco.Core.IO; using umbraco.cms.businesslogic.member; namespace umbraco diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/StylesheetTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/StylesheetTasks.cs index 594ae2b039..5d7be690e8 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/StylesheetTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/StylesheetTasks.cs @@ -5,7 +5,7 @@ using Umbraco.Web.UI; using umbraco.BusinessLogic; using umbraco.DataLayer; using umbraco.BasePages; -using umbraco.IO; +using Umbraco.Core.IO; using umbraco.cms.businesslogic.member; namespace umbraco diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/contentItemTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/contentItemTasks.cs index 1e18d40910..851faaf616 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/contentItemTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/contentItemTasks.cs @@ -5,7 +5,7 @@ using Umbraco.Web.UI; using umbraco.BusinessLogic; using umbraco.DataLayer; using umbraco.BasePages; -using umbraco.IO; +using Umbraco.Core.IO; using umbraco.cms.businesslogic.member; namespace umbraco diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/contentItemTypeTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/contentItemTypeTasks.cs index 12de0b4efb..17041f635a 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/contentItemTypeTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/contentItemTypeTasks.cs @@ -5,7 +5,7 @@ using Umbraco.Web.UI; using umbraco.BusinessLogic; using umbraco.DataLayer; using umbraco.BasePages; -using umbraco.IO; +using Umbraco.Core.IO; using umbraco.cms.businesslogic.member; namespace umbraco diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/dictionaryTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/dictionaryTasks.cs index 8e3f60cc25..fc2244a418 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/dictionaryTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/dictionaryTasks.cs @@ -6,7 +6,7 @@ using Umbraco.Web.UI; using umbraco.BusinessLogic; using umbraco.DataLayer; using umbraco.BasePages; -using umbraco.IO; +using Umbraco.Core.IO; using umbraco.cms.businesslogic.member; namespace umbraco diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/languageTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/languageTasks.cs index 19d50a1228..05ab623caa 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/languageTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/languageTasks.cs @@ -6,7 +6,7 @@ using Umbraco.Web.UI; using umbraco.BusinessLogic; using umbraco.DataLayer; using umbraco.BasePages; -using umbraco.IO; +using Umbraco.Core.IO; using umbraco.cms.businesslogic.member; namespace umbraco diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/macroTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/macroTasks.cs index c0f5de6943..5ad5999eb7 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/macroTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/macroTasks.cs @@ -5,7 +5,7 @@ using Umbraco.Web.UI; using umbraco.BusinessLogic; using umbraco.DataLayer; using umbraco.BasePages; -using umbraco.IO; +using Umbraco.Core.IO; using umbraco.cms.businesslogic.member; namespace umbraco diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/memberTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/memberTasks.cs index 0b5928d0ad..24df854710 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/memberTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/memberTasks.cs @@ -6,7 +6,7 @@ using Umbraco.Web.UI; using umbraco.BusinessLogic; using umbraco.DataLayer; using umbraco.BasePages; -using umbraco.IO; +using Umbraco.Core.IO; using umbraco.cms.businesslogic.member; namespace umbraco diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/nodetypeTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/nodetypeTasks.cs index 253d7a0b7c..a156ec9cdd 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/nodetypeTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/nodetypeTasks.cs @@ -9,7 +9,7 @@ using Umbraco.Web.UI; using umbraco.BusinessLogic; using umbraco.DataLayer; using umbraco.BasePages; -using umbraco.IO; +using Umbraco.Core.IO; using umbraco.cms.businesslogic.member; namespace umbraco diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/script.ascx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/script.ascx.cs index 2d96c9d563..def558135f 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/script.ascx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/script.ascx.cs @@ -13,7 +13,7 @@ using Umbraco.Core.Configuration; using Umbraco.Web.UI; using umbraco.cms.helpers; using umbraco.BasePages; -using umbraco.IO; +using Umbraco.Core.IO; namespace umbraco.presentation.umbraco.create { diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/stylesheetPropertyTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/stylesheetPropertyTasks.cs index ef00c4902a..dbf0f8e249 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/stylesheetPropertyTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/stylesheetPropertyTasks.cs @@ -5,7 +5,7 @@ using Umbraco.Web.UI; using umbraco.BusinessLogic; using umbraco.DataLayer; using umbraco.BasePages; -using umbraco.IO; +using Umbraco.Core.IO; using umbraco.cms.businesslogic.member; namespace umbraco diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/templateTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/templateTasks.cs index b84a7479a3..63a4d10e4a 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/templateTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/templateTasks.cs @@ -7,7 +7,7 @@ using Umbraco.Web.UI; using umbraco.BusinessLogic; using umbraco.DataLayer; using umbraco.BasePages; -using umbraco.IO; +using Umbraco.Core.IO; using umbraco.cms.businesslogic.member; namespace umbraco diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/userTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/userTasks.cs index bd9443fb3a..436aabc97f 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/userTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/userTasks.cs @@ -7,7 +7,7 @@ using Umbraco.Web.UI; using umbraco.BusinessLogic; using umbraco.DataLayer; using umbraco.BasePages; -using umbraco.IO; +using Umbraco.Core.IO; using umbraco.cms.businesslogic.member; namespace umbraco diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dashboard/FeedProxy.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dashboard/FeedProxy.aspx.cs index b62b6d0bc3..8317f8ab5d 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dashboard/FeedProxy.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dashboard/FeedProxy.aspx.cs @@ -9,7 +9,7 @@ namespace dashboardUtilities using umbraco; using umbraco.BasePages; using umbraco.BusinessLogic; - using umbraco.IO; + using Umbraco.Core.IO; public partial class FeedProxy : UmbracoEnsuredPage { diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dashboard/LatestEdits.ascx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dashboard/LatestEdits.ascx.cs index 8286a74cae..fe2dc67250 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dashboard/LatestEdits.ascx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dashboard/LatestEdits.ascx.cs @@ -1,6 +1,6 @@ using umbraco.BusinessLogic; using System; -using umbraco.IO; +using Umbraco.Core.IO; using umbraco.cms.businesslogic.web; namespace dashboardUtilities diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/BrowseRepository.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/BrowseRepository.aspx.cs index 6085caeb48..3f2b466345 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/BrowseRepository.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/BrowseRepository.aspx.cs @@ -11,7 +11,7 @@ using System.Web.UI.HtmlControls; using System.Xml; using System.Xml.XPath; using Umbraco.Core.Configuration; -using umbraco.IO; +using Umbraco.Core.IO; namespace umbraco.presentation.developer.packages { public partial class BrowseRepository : BasePages.UmbracoEnsuredPage { diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/editPackage.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/editPackage.aspx.cs index 4975783f97..0be95f6fa1 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/editPackage.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/editPackage.aspx.cs @@ -12,7 +12,7 @@ using umbraco.cms.businesslogic.template; using umbraco.cms.businesslogic.web; using umbraco.cms.presentation.Trees; using umbraco.controls; -using umbraco.IO; +using Umbraco.Core.IO; namespace umbraco.presentation.developer.packages { @@ -226,7 +226,7 @@ namespace umbraco.presentation.developer.packages if (!string.IsNullOrEmpty(pack.PackagePath)) { - packageUmbFile.Text = "   Download"; + packageUmbFile.Text = "   Download"; this.ClientTools.ShowSpeechBubble(BasePages.BasePage.speechBubbleIcon.success, "Package saved and published", ""); } else { diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Xslt/getXsltStatus.asmx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Xslt/getXsltStatus.asmx.cs index 61d03e9515..39a734a158 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Xslt/getXsltStatus.asmx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Xslt/getXsltStatus.asmx.cs @@ -7,7 +7,7 @@ using System.Web; using System.Web.Services; using System.Xml; using System.IO; -using umbraco.IO; +using Umbraco.Core.IO; using umbraco.presentation.webservices; namespace umbraco.developer diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Xslt/xsltVisualize.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Xslt/xsltVisualize.aspx.cs index b8ba3f7d9e..f76bff3d2c 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Xslt/xsltVisualize.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Xslt/xsltVisualize.aspx.cs @@ -7,7 +7,7 @@ using System.Web.UI.WebControls; using System.Text; using System.Xml; using System.IO; -using umbraco.IO; +using Umbraco.Core.IO; namespace umbraco.presentation.umbraco.developer.Xslt { diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/cruds.aspx b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/cruds.aspx index d8e3131a6f..fd7621f677 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/cruds.aspx +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/cruds.aspx @@ -8,21 +8,18 @@ - - - - - - - - - -
- -   or   - <%=umbraco.ui.Text("general", "cancel", this.getUser())%> - -
+
+ + + + + + +
+
\ No newline at end of file diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/cruds.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/cruds.aspx.cs index 7a96b7ae3e..0759b77783 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/cruds.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/cruds.aspx.cs @@ -8,6 +8,7 @@ using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; +using System.Collections.Generic; namespace umbraco.dialogs { @@ -41,36 +42,46 @@ namespace umbraco.dialogs node = new cms.businesslogic.CMSNode(int.Parse(helper.Request("id"))); - HtmlTable ht = new HtmlTable(); - ht.CellPadding = 4; + HtmlTable ht = new HtmlTable(); + ht.Attributes.Add("class", "table"); + + HtmlTableRow names = new HtmlTableRow(); + + var corner = new HtmlTableCell("th"); + corner.Style.Add("border", "none"); + names.Cells.Add(corner); - HtmlTableRow captions = new HtmlTableRow(); - captions.Cells.Add(new HtmlTableCell()); ArrayList actionList = BusinessLogic.Actions.Action.GetAll(); + Dictionary permissions = new Dictionary(); + + foreach (interfaces.IAction a in actionList) { if (a.CanBePermissionAssigned) { - HtmlTableCell hc = new HtmlTableCell(); - hc.Attributes.Add("class", "guiDialogTinyMark"); - hc.Controls.Add(new LiteralControl(ui.Text("actions", a.Alias))); - captions.Cells.Add(hc); + + HtmlTableRow permission = new HtmlTableRow(); + HtmlTableCell label = new HtmlTableCell(); + label.InnerText = ui.Text("actions", a.Alias); + permission.Cells.Add(label); + permissions.Add(a.Alias, permission); } } - ht.Rows.Add(captions); + + ht.Rows.Add(names); + foreach (BusinessLogic.User u in BusinessLogic.User.getAll()) { // Not disabled users and not system account if (!u.Disabled && u.Id > 0) { - HtmlTableRow hr = new HtmlTableRow(); - - HtmlTableCell hc = new HtmlTableCell(); - hc.Attributes.Add("class", "guiDialogTinyMark"); - hc.Controls.Add(new LiteralControl(u.Name)); - hr.Cells.Add(hc); + HtmlTableCell hc = new HtmlTableCell("th"); + hc.InnerText = u.Name; + hc.Style.Add("text-align", "center"); + hc.Style.Add("border", "none"); + names.Cells.Add(hc); foreach (interfaces.IAction a in BusinessLogic.Actions.Action.GetAll()) { @@ -80,17 +91,22 @@ namespace umbraco.dialogs { if (u.GetPermissions(node.Path).IndexOf(a.Letter) > -1) c.Checked = true; - HtmlTableCell cell = new HtmlTableCell(); + + HtmlTableCell cell = new HtmlTableCell(); cell.Style.Add("text-align", "center"); cell.Controls.Add(c); - permissions.Add(c); - hr.Cells.Add(cell); + + permissions[a.Alias].Cells.Add(cell); } } - ht.Rows.Add(hr); } } + + //add all collected rows + foreach (var perm in permissions.Values) + ht.Rows.Add(perm); + PlaceHolder1.Controls.Add(ht); } @@ -128,7 +144,7 @@ namespace umbraco.dialogs //FeedBackMessage.Text = "
" + ui.Text("rights") + " " + ui.Text("ok") + "
"; feedback1.type = umbraco.uicontrols.Feedback.feedbacktype.success; feedback1.Text = ui.Text("rights") + " " + ui.Text("ok"); - pane_form.Visible = false; + PlaceHolder1.Visible = false; panel_buttons.Visible = false; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/cruds.aspx.designer.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/cruds.aspx.designer.cs index 633eb38373..0c8fa6d2d0 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/cruds.aspx.designer.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/cruds.aspx.designer.cs @@ -1,10 +1,9 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:2.0.50727.4200 // // Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// the code is regenerated. // //------------------------------------------------------------------------------ @@ -13,15 +12,6 @@ namespace umbraco.dialogs { public partial class cruds { - /// - /// feedback1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::umbraco.uicontrols.Feedback feedback1; - /// /// pane_form control. /// @@ -31,6 +21,15 @@ namespace umbraco.dialogs { /// protected global::umbraco.uicontrols.Pane pane_form; + /// + /// feedback1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::umbraco.uicontrols.Feedback feedback1; + /// /// PlaceHolder1 control. /// @@ -47,7 +46,7 @@ namespace umbraco.dialogs { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.Panel panel_buttons; + protected global::System.Web.UI.HtmlControls.HtmlGenericControl panel_buttons; /// /// Button1 control. diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/imageViewer.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/imageViewer.aspx.cs index 9a2c7a9baa..3a2917f24f 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/imageViewer.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/imageViewer.aspx.cs @@ -11,7 +11,7 @@ using System.Web.UI.HtmlControls; using System.IO; using umbraco.BusinessLogic; -using umbraco.IO; +using Umbraco.Core.IO; using Umbraco.Core; namespace umbraco.dialogs diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/rollBack.aspx b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/rollBack.aspx index db2b592305..1fd831bedc 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/rollBack.aspx +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/rollBack.aspx @@ -1,68 +1,99 @@ -<%@ Page Language="c#" Codebehind="rollBack.aspx.cs" MasterPageFile="../masterpages/umbracoDialog.Master"AutoEventWireup="True" Inherits="umbraco.presentation.dialogs.rollBack" %> +<%@ Page Language="c#" CodeBehind="rollBack.aspx.cs" MasterPageFile="../masterpages/umbracoDialog.Master" AutoEventWireup="True" Inherits="umbraco.presentation.dialogs.rollBack" %> + <%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %> <%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %> - + var functionsFrame = this; + var tabFrame = this; + var isDialog = true; + var submitOnEnter = true; + + - + .diff { + margin-top: 10px; + height: 100%; + overflow: auto; + border-top: 1px solid #ccc; + border-top: 1px solid #ccc; + padding: 5px; + } + + .diff table td { + border-bottom: 1px solid #ccc; + padding: 3px; + } + + .diff del { + background: rgb(255, 230, 230) none repeat scroll 0%; + -moz-background-clip: -moz-initial; + -moz-background-origin: -moz-initial; + -moz-background-inline-policy: -moz-initial; + } + + .diff ins { + background: rgb(230, 255, 230) none repeat scroll 0%; + -moz-background-clip: -moz-initial; + -moz-background-origin: -moz-initial; + -moz-background-inline-policy: -moz-initial; + } + + .diff .diffnotice { + text-align: center; + margin-bottom: 10px; + } + + - +
+ - + - - () - - - - - Diff - Html - - - - + + + + () + + + - -
-
-

- -

-
- - - -
-
- -

- -   <%=umbraco.ui.Text("general", "or", this.getUser())%>   - <%=umbraco.ui.Text("general", "cancel", this.getUser())%> -

-
- - + + + + Diff + Html + + + +
+ + +
+
+

+ +

+
+ + + +
+
+
+
+ +
- \ No newline at end of file diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/rollBack.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/rollBack.aspx.cs index 88e9933945..0d4e739cdc 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/rollBack.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/rollBack.aspx.cs @@ -28,10 +28,11 @@ namespace umbraco.presentation.dialogs protected void version_load(object sender, EventArgs e) { - if (allVersions.SelectedValue != "") { + if (allVersions.SelectedValue != "") + { diffPanel.Visible = true; Document rollback = new Document(currentDoc.Id, new Guid(allVersions.SelectedValue)); - + propertiesCompare.Text = "" + ui.Text("general", "name") + ":" + rollback.Text + ""; propertiesCompare.Text += "" + ui.Text("content", "createDate") + ":" + rollback.VersionDate.ToLongDateString() + " " + rollback.VersionDate.ToLongTimeString() + ui.Text("general", "by") + ": " + rollback.User.Name + ""; @@ -42,50 +43,63 @@ namespace umbraco.presentation.dialogs var props = rollback.GenericProperties; - foreach (Property p in props) { - try { + foreach (Property p in props) + { + try + { - if (p.Value != null) { + if (p.Value != null) + { //new property value... string thevalue = p.Value.ToString(); - if (rbl_mode.SelectedValue == "diff") { - + if (rbl_mode.SelectedValue == "diff") + { + //if display mode is set to diff... thevalue = library.StripHtml(p.Value.ToString()); Property cP = currentDoc.getProperty(p.PropertyType); - if (cP != null && cP.Value != null) { + if (cP != null && cP.Value != null) + { string cThevalue = library.StripHtml(cP.Value.ToString()); propertiesCompare.Text += "" + p.PropertyType.Name + ":" + library.ReplaceLineBreaks(cms.businesslogic.utilities.Diff.Diff2Html(cThevalue, thevalue)) + ""; - - } else { + + } + else + { //If no current version of the value... display with no diff. propertiesCompare.Text += "" + p.PropertyType.Name + ":" + thevalue + ""; } - - } else { + + } + else + { //If display mode is html propertiesCompare.Text += "" + p.PropertyType.Name + ":" + thevalue + ""; } - - //previewVersionContent.Controls.Add(new LiteralControl("

" + p.PropertyType.Name + "
")); - //previewVersionContent.Controls.Add(new LiteralControl(thevalue)); - + + //previewVersionContent.Controls.Add(new LiteralControl("

" + p.PropertyType.Name + "
")); + //previewVersionContent.Controls.Add(new LiteralControl(thevalue)); + } //previewVersionContent.Controls.Add(new LiteralControl("

")); - } catch { } + } + catch { } } - doRollback.Enabled = true; - doRollback.Attributes.Add("onclick", "return confirm('" + ui.Text("areyousure") + "');"); - - }else + pl_buttons.Visible = true; + + } + else + { diffPanel.Visible = false; + pl_buttons.Visible = false; + } } @@ -105,50 +119,8 @@ namespace umbraco.presentation.dialogs foreach (DocumentVersionList dl in currentDoc.GetVersions()) { allVersions.Items.Add(new ListItem(dl.Text + " (" + ui.Text("content", "createDate") + ": " + dl.Date.ToShortDateString() + " " + dl.Date.ToShortTimeString() + ")", dl.Version.ToString())); } - doRollback.Text = ui.Text("actions", "rollback"); + Button1.Text = ui.Text("actions", "rollback"); } - - /* - foreach(Property p in d.getProperties) - { - string thevalue = p.Value.ToString(); - if (CheckBoxHtml.Checked) - thevalue = Server.HtmlEncode(thevalue); - currentVersionContent.Controls.Add(new LiteralControl("

" + p.PropertyType.Name + "
" + thevalue + "

")); - } - - if (allVersions.SelectedValue != "") - { - Document rollback = new Document(d.Id, new Guid(allVersions.SelectedValue)); - previewVersionTitle.Text = rollback.Text; - previewVersionDetails.Text = "Created at: " + rollback.VersionDate.ToLongDateString() + " " + rollback.VersionDate.ToLongTimeString() + " by: " + rollback.User.Name; - foreach(Property p in rollback.getProperties) - { - try - { - previewVersionContent.Controls.Add(new LiteralControl("

" + p.PropertyType.Name + "
")); - if (p.Value != null) - { - string thevalue = p.Value.ToString(); - if (CheckBoxHtml.Checked) - thevalue = Server.HtmlEncode(thevalue); - previewVersionContent.Controls.Add(new LiteralControl(thevalue)); - } - previewVersionContent.Controls.Add(new LiteralControl("

")); - } - catch {} - } - doRollback.Enabled = true; - doRollback.Attributes.Add("onClick", "return confirm('" + ui.Text("areyousure") + "');"); - } - else - { - doRollback.Enabled = false; - previewVersionTitle.Text = "No version selected..."; - } - - - */ } #region Web Form Designer generated code @@ -182,8 +154,10 @@ namespace umbraco.presentation.dialogs Document rollback = new Document(d.Id, new Guid(allVersions.SelectedValue)); feedBackMsg.type = global::umbraco.uicontrols.Feedback.feedbacktype.success; string[] vars = {rollback.Text, rollback.VersionDate.ToLongDateString()}; + feedBackMsg.Text = ui.Text("rollback", "documentRolledBack", vars, new global::umbraco.BusinessLogic.User(0)) + "

" + ui.Text("closeThisWindow") + ""; - diffPanel.Height = new Unit(200, UnitType.Pixel); + diffPanel.Visible = false; + pl_buttons.Visible = false; ClientTools.ChangeContentFrameUrl("editContent.aspx?Id=" + d.Id.ToString()); } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/rollBack.aspx.designer.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/rollBack.aspx.designer.cs index c78e06b6d9..ff4420468b 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/rollBack.aspx.designer.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/rollBack.aspx.designer.cs @@ -1,10 +1,9 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:2.0.50727.4200 // // Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. +// the code is regenerated. // //------------------------------------------------------------------------------ @@ -131,12 +130,21 @@ namespace umbraco.presentation.dialogs { protected global::System.Web.UI.WebControls.Literal propertiesCompare; ///

- /// doRollback control. + /// pl_buttons control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.Button doRollback; + protected global::System.Web.UI.HtmlControls.HtmlGenericControl pl_buttons; + + /// + /// Button1 control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Button Button1; } } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/uploadImage.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/uploadImage.aspx.cs index 86aabc6589..f5b9415f85 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/uploadImage.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/uploadImage.aspx.cs @@ -11,7 +11,7 @@ using System.Web.UI.HtmlControls; using System.Xml; using umbraco.BusinessLogic; -using umbraco.IO; +using Umbraco.Core.IO; namespace umbraco.dialogs { diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/masterpages/umbracoDialog.Master.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/masterpages/umbracoDialog.Master.cs index 9ffee7ba1c..a5b0cd39ef 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/masterpages/umbracoDialog.Master.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/masterpages/umbracoDialog.Master.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; +using Umbraco.Core.IO; namespace umbraco.presentation.masterpages { @@ -16,7 +17,7 @@ namespace umbraco.presentation.masterpages protected void Page_Load(object sender, EventArgs e) { ClientLoader.DataBind(); - ScriptManager.RegisterStartupScript(Page, Page.GetType(), "setRoot", "UmbClientMgr.setUmbracoPath(\"" + IO.IOHelper.ResolveUrl(IO.SystemDirectories.Umbraco) + "\");", true); + ScriptManager.RegisterStartupScript(Page, Page.GetType(), "setRoot", "UmbClientMgr.setUmbracoPath(\"" + IOHelper.ResolveUrl(SystemDirectories.Umbraco) + "\");", true); FireOnLoad(e); } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/plugins/tinymce3/GzipModule.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/plugins/tinymce3/GzipModule.cs index 390de21e89..51cfddbaad 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/plugins/tinymce3/GzipModule.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/plugins/tinymce3/GzipModule.cs @@ -10,7 +10,7 @@ using System.Web; using System.Text.RegularExpressions; using System.IO; using Umbraco.Core.Logging; -using umbraco.IO; +using Umbraco.Core.IO; namespace umbraco.presentation.plugins.tinymce3 { @@ -39,7 +39,7 @@ namespace umbraco.presentation.plugins.tinymce3 // UMBRACO: Populate the configsection if it's empty configSection.Add("GzipEnabled", "true"); - configSection.Add("InstallPath", IOHelper.ResolveUrl(SystemDirectories.Umbraco_client) + "/tinymce3"); + configSection.Add("InstallPath", IOHelper.ResolveUrl(SystemDirectories.UmbracoClient) + "/tinymce3"); configSection.Add("GzipExpiresOffset", TimeSpan.FromDays(10).Ticks.ToString()); // Setup cache diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.cs index b6165ac86c..5c48b5745f 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/EditDictionaryItem.aspx.cs @@ -9,7 +9,7 @@ using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using umbraco.cms.presentation.Trees; -using umbraco.IO; +using Umbraco.Core.IO; namespace umbraco.settings { diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/scripts/editScript.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/scripts/editScript.aspx.cs index 850cc5eb33..8340d97dac 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/scripts/editScript.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/scripts/editScript.aspx.cs @@ -146,7 +146,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.Core.IO.IOHelper.ResolveUrl(Umbraco.Core.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"); diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/templateControls/ItemRenderer.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/templateControls/ItemRenderer.cs index 6fc4e32ea5..9676f1d184 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/templateControls/ItemRenderer.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/templateControls/ItemRenderer.cs @@ -21,7 +21,7 @@ using Umbraco.Web.Templates; using umbraco.cms.businesslogic; using umbraco.cms.businesslogic.property; using umbraco.cms.businesslogic.web; -using umbraco.IO; +using Umbraco.Core.IO; namespace umbraco.presentation.templateControls { diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/translation/default.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/translation/default.aspx.cs index 8064dd3627..9a9ccbd467 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/translation/default.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/translation/default.aspx.cs @@ -18,7 +18,7 @@ using ICSharpCode.SharpZipLib.Zip; using ICSharpCode.SharpZipLib.Zip.Compression; using ICSharpCode.SharpZipLib.Zip.Compression.Streams; using ICSharpCode.SharpZipLib.GZip; -using umbraco.IO; +using Umbraco.Core.IO; using System.Collections.Generic; namespace umbraco.presentation.translation diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/translation/xml.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/translation/xml.aspx.cs index cd070e0a5a..c7199313ec 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/translation/xml.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/translation/xml.aspx.cs @@ -16,7 +16,7 @@ using Umbraco.Core.Configuration; using umbraco.BusinessLogic; using umbraco.cms.businesslogic.task; using umbraco.cms.businesslogic.web; -using umbraco.IO; +using Umbraco.Core.IO; namespace umbraco.presentation.translation { diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUser.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUser.aspx.cs index cc26cdbd91..b02cdb0862 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUser.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUser.aspx.cs @@ -19,7 +19,7 @@ using umbraco.presentation.channels.businesslogic; using umbraco.uicontrols; using umbraco.providers; using umbraco.cms.presentation.Trees; -using umbraco.IO; +using Umbraco.Core.IO; using Umbraco.Core; namespace umbraco.cms.presentation.user diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUserType.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUserType.aspx.cs index b41df24988..b6796e45fa 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUserType.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUserType.aspx.cs @@ -15,7 +15,7 @@ using umbraco.BusinessLogic.Actions; using umbraco.BusinessLogic; using umbraco.uicontrols; using umbraco.cms.presentation.Trees; -using umbraco.IO; +using Umbraco.Core.IO; namespace umbraco.cms.presentation.user { diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/users/PermissionEditor.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/users/PermissionEditor.aspx.cs index 995860e65f..1a8a0a37cc 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/users/PermissionEditor.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/users/PermissionEditor.aspx.cs @@ -19,7 +19,7 @@ using umbraco.BusinessLogic.Actions; using umbraco.interfaces; using umbraco.cms.presentation.Trees; using System.Xml.XPath; -using umbraco.IO; +using Umbraco.Core.IO; namespace umbraco.cms.presentation.user { diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/users/PermissionsHandler.asmx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/users/PermissionsHandler.asmx.cs index 05044c6e3b..7813e7e5cb 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/users/PermissionsHandler.asmx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/users/PermissionsHandler.asmx.cs @@ -14,7 +14,7 @@ using umbraco.BasePages; using System.Collections.Generic; using umbraco.interfaces; using umbraco.BusinessLogic.Actions; -using umbraco.IO; +using Umbraco.Core.IO; namespace umbraco.cms.presentation.user { diff --git a/src/umbraco.MacroEngines/RazorCore/RazorMacroEngine.cs b/src/umbraco.MacroEngines/RazorCore/RazorMacroEngine.cs index 83304f7ab2..0eb1f8ce30 100644 --- a/src/umbraco.MacroEngines/RazorCore/RazorMacroEngine.cs +++ b/src/umbraco.MacroEngines/RazorCore/RazorMacroEngine.cs @@ -9,7 +9,7 @@ using System.Web.WebPages; using Umbraco.Core; using umbraco.cms.businesslogic.macro; using umbraco.interfaces; -using umbraco.IO; +using Umbraco.Core.IO; namespace umbraco.MacroEngines { diff --git a/src/umbraco.businesslogic/BasePages/ClientTools.cs b/src/umbraco.businesslogic/BasePages/ClientTools.cs index 45344ce412..f291f32844 100644 --- a/src/umbraco.businesslogic/BasePages/ClientTools.cs +++ b/src/umbraco.businesslogic/BasePages/ClientTools.cs @@ -4,7 +4,7 @@ using System.Text; using System.Web; using umbraco.BasePages; using System.Web.UI; -using umbraco.IO; +using Umbraco.Core.IO; using umbraco.BusinessLogic; namespace umbraco.BasePages diff --git a/src/umbraco.businesslogic/GlobalSettings.cs b/src/umbraco.businesslogic/GlobalSettings.cs index 2e5ec00903..5084be1d0b 100644 --- a/src/umbraco.businesslogic/GlobalSettings.cs +++ b/src/umbraco.businesslogic/GlobalSettings.cs @@ -9,7 +9,7 @@ using Umbraco.Core; using Umbraco.Core.Configuration; using umbraco.BusinessLogic; using umbraco.DataLayer; -using umbraco.IO; +using Umbraco.Core.IO; namespace umbraco { diff --git a/src/umbraco.businesslogic/xmlHelper.cs b/src/umbraco.businesslogic/xmlHelper.cs index 5eb07b5309..5d187dbfca 100644 --- a/src/umbraco.businesslogic/xmlHelper.cs +++ b/src/umbraco.businesslogic/xmlHelper.cs @@ -1,6 +1,6 @@ using System; using System.Xml; -using umbraco.IO; +using Umbraco.Core.IO; namespace umbraco { diff --git a/src/umbraco.cms/businesslogic/CMSNode.cs b/src/umbraco.cms/businesslogic/CMSNode.cs index b7218f6463..b337f6b97c 100644 --- a/src/umbraco.cms/businesslogic/CMSNode.cs +++ b/src/umbraco.cms/businesslogic/CMSNode.cs @@ -13,7 +13,7 @@ using umbraco.BusinessLogic; using System.IO; using System.Text.RegularExpressions; using System.ComponentModel; -using umbraco.IO; +using Umbraco.Core.IO; using System.Collections; using umbraco.cms.businesslogic.task; using umbraco.cms.businesslogic.workflow; @@ -58,7 +58,7 @@ namespace umbraco.cms.businesslogic #region Private static - private static readonly string DefaultIconCssFile = IOHelper.MapPath(SystemDirectories.Umbraco_client + "/Tree/treeIcons.css"); + private static readonly string DefaultIconCssFile = IOHelper.MapPath(SystemDirectories.UmbracoClient + "/Tree/treeIcons.css"); private static readonly List InternalDefaultIconClasses = new List(); private static readonly ReaderWriterLockSlim Locker = new ReaderWriterLockSlim(); diff --git a/src/umbraco.cms/businesslogic/CMSPreviewNode.cs b/src/umbraco.cms/businesslogic/CMSPreviewNode.cs index 5b3970821b..002c1acfe5 100644 --- a/src/umbraco.cms/businesslogic/CMSPreviewNode.cs +++ b/src/umbraco.cms/businesslogic/CMSPreviewNode.cs @@ -8,7 +8,7 @@ using umbraco.BusinessLogic; using System.IO; using System.Text.RegularExpressions; using System.ComponentModel; -using umbraco.IO; +using Umbraco.Core.IO; namespace umbraco.cms.businesslogic { diff --git a/src/umbraco.cms/businesslogic/Packager/Installer.cs b/src/umbraco.cms/businesslogic/Packager/Installer.cs index 867474f9be..cd6096eb60 100644 --- a/src/umbraco.cms/businesslogic/Packager/Installer.cs +++ b/src/umbraco.cms/businesslogic/Packager/Installer.cs @@ -963,10 +963,10 @@ namespace umbraco.cms.businesslogic.packager if (path.Contains("[$")) { //this is experimental and undocumented... - path = path.Replace("[$UMBRACO]", IO.SystemDirectories.Umbraco); - path = path.Replace("[$UMBRACOCLIENT]", IO.SystemDirectories.Umbraco_client); - path = path.Replace("[$CONFIG]", IO.SystemDirectories.Config); - path = path.Replace("[$DATA]", IO.SystemDirectories.Data); + path = path.Replace("[$UMBRACO]", SystemDirectories.Umbraco); + path = path.Replace("[$UMBRACOCLIENT]", SystemDirectories.UmbracoClient); + path = path.Replace("[$CONFIG]", SystemDirectories.Config); + path = path.Replace("[$DATA]", SystemDirectories.Data); } //to support virtual dirs we try to lookup the file... diff --git a/src/umbraco.cms/businesslogic/Packager/PackageActions/addDashboardSection.cs b/src/umbraco.cms/businesslogic/Packager/PackageActions/addDashboardSection.cs index 70cf3070e7..6025123bc4 100644 --- a/src/umbraco.cms/businesslogic/Packager/PackageActions/addDashboardSection.cs +++ b/src/umbraco.cms/businesslogic/Packager/PackageActions/addDashboardSection.cs @@ -1,6 +1,7 @@ using System; using System.Xml; -using umbraco.IO; +using Umbraco.Core; +using Umbraco.Core.IO; namespace umbraco.cms.businesslogic.packager.standardPackageActions { @@ -46,11 +47,11 @@ namespace umbraco.cms.businesslogic.packager.standardPackageActions string dbConfig = SystemFiles.DashboardConfig; XmlNode section = xmlData.SelectSingleNode("./section"); - XmlDocument dashboardFile = xmlHelper.OpenAsXmlDocument(dbConfig); + XmlDocument dashboardFile = XmlHelper.OpenAsXmlDocument(dbConfig); XmlNode importedSection = dashboardFile.ImportNode(section, true); - XmlAttribute alias = xmlHelper.addAttribute(dashboardFile, "alias", sectionAlias); + XmlAttribute alias = XmlHelper.AddAttribute(dashboardFile, "alias", sectionAlias); importedSection.Attributes.Append(alias); dashboardFile.DocumentElement.AppendChild(importedSection); @@ -74,7 +75,7 @@ namespace umbraco.cms.businesslogic.packager.standardPackageActions string sectionAlias = xmlData.Attributes["dashboardAlias"].Value; string dbConfig = SystemFiles.DashboardConfig; - XmlDocument dashboardFile = xmlHelper.OpenAsXmlDocument(dbConfig); + XmlDocument dashboardFile = XmlHelper.OpenAsXmlDocument(dbConfig); XmlNode section = dashboardFile.SelectSingleNode("//section [@alias = '" + sectionAlias + "']"); diff --git a/src/umbraco.cms/businesslogic/Packager/PackageActions/addProxyFeedHost.cs b/src/umbraco.cms/businesslogic/Packager/PackageActions/addProxyFeedHost.cs index 113ef2e014..2c718a1d41 100644 --- a/src/umbraco.cms/businesslogic/Packager/PackageActions/addProxyFeedHost.cs +++ b/src/umbraco.cms/businesslogic/Packager/PackageActions/addProxyFeedHost.cs @@ -1,5 +1,5 @@ using System.Xml; -using umbraco.IO; +using Umbraco.Core.IO; namespace umbraco.cms.businesslogic.packager.standardPackageActions { diff --git a/src/umbraco.cms/businesslogic/Packager/PackageInstance/CreatedPackage.cs b/src/umbraco.cms/businesslogic/Packager/PackageInstance/CreatedPackage.cs index 5e2d887030..3aff552bf8 100644 --- a/src/umbraco.cms/businesslogic/Packager/PackageInstance/CreatedPackage.cs +++ b/src/umbraco.cms/businesslogic/Packager/PackageInstance/CreatedPackage.cs @@ -7,7 +7,7 @@ using Umbraco.Core.Logging; using umbraco.cms.businesslogic.template; using umbraco.cms.businesslogic.web; using umbraco.cms.businesslogic.macro; -using umbraco.IO; +using Umbraco.Core.IO; namespace umbraco.cms.businesslogic.packager { @@ -104,7 +104,7 @@ namespace umbraco.cms.businesslogic.packager { int outInt = 0; //Path checking... - string localPath = IOHelper.MapPath(IO.SystemDirectories.Media + "/" + pack.Folder); + string localPath = IOHelper.MapPath(SystemDirectories.Media + "/" + pack.Folder); if (!System.IO.Directory.Exists(localPath)) System.IO.Directory.CreateDirectory(localPath); @@ -271,7 +271,7 @@ namespace umbraco.cms.businesslogic.packager { //string packPath = Settings.PackagerRoot.Replace(System.IO.Path.DirectorySeparatorChar.ToString(), "/") + "/" + pack.Name.Replace(' ', '_') + "_" + pack.Version.Replace(' ', '_') + "." + Settings.PackageFileExtension; // check if there's a packages directory below media - string packagesDirectory = IO.SystemDirectories.Media + "/created-packages"; + string packagesDirectory = SystemDirectories.Media + "/created-packages"; if (!System.IO.Directory.Exists(IOHelper.MapPath(packagesDirectory))) System.IO.Directory.CreateDirectory(IOHelper.MapPath(packagesDirectory)); diff --git a/src/umbraco.cms/businesslogic/Packager/PackageInstance/InstalledPackage.cs b/src/umbraco.cms/businesslogic/Packager/PackageInstance/InstalledPackage.cs index 94c523aeab..5351bda083 100644 --- a/src/umbraco.cms/businesslogic/Packager/PackageInstance/InstalledPackage.cs +++ b/src/umbraco.cms/businesslogic/Packager/PackageInstance/InstalledPackage.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using Umbraco.Core.Logging; -using umbraco.IO; +using Umbraco.Core.IO; namespace umbraco.cms.businesslogic.packager { public class InstalledPackage diff --git a/src/umbraco.cms/businesslogic/Packager/PackageInstance/utill.cs b/src/umbraco.cms/businesslogic/Packager/PackageInstance/utill.cs index 29d1f07b3e..fdebbc8e3c 100644 --- a/src/umbraco.cms/businesslogic/Packager/PackageInstance/utill.cs +++ b/src/umbraco.cms/businesslogic/Packager/PackageInstance/utill.cs @@ -18,7 +18,7 @@ using umbraco.cms.businesslogic.template; using umbraco.cms.businesslogic.web; using umbraco.cms.businesslogic.macro; using ICSharpCode.SharpZipLib.Zip; -using umbraco.IO; +using Umbraco.Core.IO; namespace umbraco.cms.businesslogic.packager { /// diff --git a/src/umbraco.cms/businesslogic/Packager/Repositories/Repository.cs b/src/umbraco.cms/businesslogic/Packager/Repositories/Repository.cs index d7165557fa..0ca3b50416 100644 --- a/src/umbraco.cms/businesslogic/Packager/Repositories/Repository.cs +++ b/src/umbraco.cms/businesslogic/Packager/Repositories/Repository.cs @@ -7,7 +7,7 @@ using System.IO; using System.Net; using Umbraco.Core.Configuration; using Umbraco.Core.Logging; -using umbraco.IO; +using Umbraco.Core.IO; namespace umbraco.cms.businesslogic.packager.repositories { diff --git a/src/umbraco.cms/businesslogic/Packager/Settings.cs b/src/umbraco.cms/businesslogic/Packager/Settings.cs index 67651e087b..e8136fc95e 100644 --- a/src/umbraco.cms/businesslogic/Packager/Settings.cs +++ b/src/umbraco.cms/businesslogic/Packager/Settings.cs @@ -8,7 +8,7 @@ using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.IO; -using umbraco.IO; +using Umbraco.Core.IO; namespace umbraco.cms.businesslogic.packager { diff --git a/src/umbraco.cms/businesslogic/Packager/data.cs b/src/umbraco.cms/businesslogic/Packager/data.cs index ceae03b0c3..6f0df33b4d 100644 --- a/src/umbraco.cms/businesslogic/Packager/data.cs +++ b/src/umbraco.cms/businesslogic/Packager/data.cs @@ -4,6 +4,7 @@ using System.Xml.XPath; using System.Collections.Generic; using System.IO; using Umbraco.Core; +using Umbraco.Core.IO; using Umbraco.Core.Logging; namespace umbraco.cms.businesslogic.packager @@ -25,17 +26,17 @@ namespace umbraco.cms.businesslogic.packager //do some error checking and create the folders/files if they don't exist if (!File.Exists(dataSource)) { - if (!Directory.Exists(IO.IOHelper.MapPath(Settings.PackagerRoot))) + if (!Directory.Exists(IOHelper.MapPath(Settings.PackagerRoot))) { - Directory.CreateDirectory(IO.IOHelper.MapPath(Settings.PackagerRoot)); + Directory.CreateDirectory(IOHelper.MapPath(Settings.PackagerRoot)); } - if (!Directory.Exists(IO.IOHelper.MapPath(Settings.PackagesStorage))) + if (!Directory.Exists(IOHelper.MapPath(Settings.PackagesStorage))) { - Directory.CreateDirectory(IO.IOHelper.MapPath(Settings.PackagesStorage)); + Directory.CreateDirectory(IOHelper.MapPath(Settings.PackagesStorage)); } - if (!Directory.Exists(IO.IOHelper.MapPath(Settings.InstalledPackagesStorage))) + if (!Directory.Exists(IOHelper.MapPath(Settings.InstalledPackagesStorage))) { - Directory.CreateDirectory(IO.IOHelper.MapPath(Settings.InstalledPackagesStorage)); + Directory.CreateDirectory(IOHelper.MapPath(Settings.InstalledPackagesStorage)); } StreamWriter sw = File.CreateText(dataSource); diff --git a/src/umbraco.cms/businesslogic/translation/Translation.cs b/src/umbraco.cms/businesslogic/translation/Translation.cs index ab0d0d9482..42ca56c574 100644 --- a/src/umbraco.cms/businesslogic/translation/Translation.cs +++ b/src/umbraco.cms/businesslogic/translation/Translation.cs @@ -8,7 +8,7 @@ using umbraco.cms.businesslogic.language; using umbraco.cms.businesslogic.property; using umbraco.cms.businesslogic.task; using umbraco.cms.businesslogic.web; -using umbraco.IO; +using Umbraco.Core.IO; namespace umbraco.cms.businesslogic.translation { diff --git a/src/umbraco.cms/businesslogic/web/Access.cs b/src/umbraco.cms/businesslogic/web/Access.cs index 64d43c8756..8f0cffd4b2 100644 --- a/src/umbraco.cms/businesslogic/web/Access.cs +++ b/src/umbraco.cms/businesslogic/web/Access.cs @@ -6,7 +6,7 @@ using System.Collections; using System.IO; using System.Web.Security; -using umbraco.IO; +using Umbraco.Core.IO; namespace umbraco.cms.businesslogic.web { diff --git a/src/umbraco.cms/businesslogic/web/DocumentVersionList.cs b/src/umbraco.cms/businesslogic/web/DocumentVersionList.cs index 5709d71295..994f3c3209 100644 --- a/src/umbraco.cms/businesslogic/web/DocumentVersionList.cs +++ b/src/umbraco.cms/businesslogic/web/DocumentVersionList.cs @@ -10,7 +10,7 @@ using umbraco.cms.businesslogic.property; using umbraco.cms.businesslogic.relation; using umbraco.cms.helpers; using umbraco.DataLayer; -using umbraco.IO; +using Umbraco.Core.IO; namespace umbraco.cms.businesslogic.web { diff --git a/src/umbraco.cms/businesslogic/workflow/Notification.cs b/src/umbraco.cms/businesslogic/workflow/Notification.cs index 4814eff551..9387ad4444 100644 --- a/src/umbraco.cms/businesslogic/workflow/Notification.cs +++ b/src/umbraco.cms/businesslogic/workflow/Notification.cs @@ -11,7 +11,7 @@ using umbraco.cms.businesslogic.property; using umbraco.cms.businesslogic.web; using umbraco.DataLayer; using umbraco.interfaces; -using umbraco.IO; +using Umbraco.Core.IO; namespace umbraco.cms.businesslogic.workflow { diff --git a/src/umbraco.controls/CodeArea.cs b/src/umbraco.controls/CodeArea.cs index 1d273e32f3..6cf048004c 100644 --- a/src/umbraco.controls/CodeArea.cs +++ b/src/umbraco.controls/CodeArea.cs @@ -12,7 +12,6 @@ using ClientDependency.Core; using System.Linq; using ClientDependency.Core.Controls; using Umbraco.Core.Configuration; -using umbraco.IO; namespace umbraco.uicontrols { diff --git a/src/umbraco.controls/ProgressBar.cs b/src/umbraco.controls/ProgressBar.cs index 5304e92fb5..d7b5f80f4f 100644 --- a/src/umbraco.controls/ProgressBar.cs +++ b/src/umbraco.controls/ProgressBar.cs @@ -3,11 +3,12 @@ using System.Collections.Generic; using System.Linq; using System.Text; using System.Web.UI.WebControls; +using Umbraco.Core.IO; namespace umbraco.uicontrols { [Obsolete("Use Umbraco.Web.UI.Controls.ProgressBar")] - public class ProgressBar : System.Web.UI.WebControls.Image + public class ProgressBar : System.Web.UI.WebControls.Panel { private string _title = umbraco.ui.Text("publish", "inProgress", null); public string Title { get; set; } @@ -17,9 +18,8 @@ namespace umbraco.uicontrols if(!string.IsNullOrEmpty(Title)) _title = Title; - base.ImageUrl = IO.SystemDirectories.Umbraco_client + "/images/progressBar.gif"; - base.AlternateText = _title; - + base.CssClass = "umb-loader"; + base.Render(writer); } } diff --git a/src/umbraco.controls/Splitter.cs b/src/umbraco.controls/Splitter.cs index 12424c8b61..fb42b00c28 100644 --- a/src/umbraco.controls/Splitter.cs +++ b/src/umbraco.controls/Splitter.cs @@ -1,6 +1,6 @@ using System.ComponentModel; using System.Web.UI; -using umbraco.IO; +using Umbraco.Core.IO; namespace umbraco.uicontrols { internal class Splitter : System.Web.UI.WebControls.Image { @@ -9,7 +9,7 @@ namespace umbraco.uicontrols { this.Height = System.Web.UI.WebControls.Unit.Pixel(21); this.Style.Add("border", "0px"); this.Attributes.Add("class", "editorIconSplit"); - this.ImageUrl = SystemDirectories.Umbraco_client + "/menuicon/images/split.gif"; + this.ImageUrl = SystemDirectories.UmbracoClient + "/menuicon/images/split.gif"; } } } \ No newline at end of file diff --git a/src/umbraco.controls/TreePicker/BaseTreePicker.cs b/src/umbraco.controls/TreePicker/BaseTreePicker.cs index a91a718e9b..6659e01e93 100644 --- a/src/umbraco.controls/TreePicker/BaseTreePicker.cs +++ b/src/umbraco.controls/TreePicker/BaseTreePicker.cs @@ -143,7 +143,7 @@ namespace umbraco.uicontrols.TreePicker ModalWidth.ToString(), ModalHeight.ToString(), ShowHeader.ToString().ToLower(), - umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco).TrimEnd('/') + Umbraco.Core.IO.IOHelper.ResolveUrl(Umbraco.Core.IO.SystemDirectories.Umbraco).TrimEnd('/') }); } diff --git a/src/umbraco.controls/TreeUrlGenerator.cs b/src/umbraco.controls/TreeUrlGenerator.cs index a136772028..0ca735cb4f 100644 --- a/src/umbraco.controls/TreeUrlGenerator.cs +++ b/src/umbraco.controls/TreeUrlGenerator.cs @@ -79,7 +79,7 @@ namespace umbraco.uicontrols /// Tree service url as a string public string GetServiceUrl() { - return umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + "/" + GetUrl(TREE_URL); + return Umbraco.Core.IO.IOHelper.ResolveUrl(Umbraco.Core.IO.SystemDirectories.Umbraco) + "/" + GetUrl(TREE_URL); } /// @@ -115,7 +115,7 @@ namespace umbraco.uicontrols /// public string GetInitUrl() { - return umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + "/" + GetUrl(INIT_URL); + return Umbraco.Core.IO.IOHelper.ResolveUrl(Umbraco.Core.IO.SystemDirectories.Umbraco) + "/" + GetUrl(INIT_URL); } /// @@ -161,7 +161,7 @@ namespace umbraco.uicontrols /// public string GetPickerUrl() { - return umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + "/dialogs/" + GetUrl(PICKER_URL); + return Umbraco.Core.IO.IOHelper.ResolveUrl(Umbraco.Core.IO.SystemDirectories.Umbraco) + "/dialogs/" + GetUrl(PICKER_URL); } [Obsolete("No longer used as useSubModal no longer has any relavence")] diff --git a/src/umbraco.editorControls/MultiNodeTreePicker/SelectedItemsTemplate.cs b/src/umbraco.editorControls/MultiNodeTreePicker/SelectedItemsTemplate.cs index f344fd0f4c..1c384dbcbf 100644 --- a/src/umbraco.editorControls/MultiNodeTreePicker/SelectedItemsTemplate.cs +++ b/src/umbraco.editorControls/MultiNodeTreePicker/SelectedItemsTemplate.cs @@ -4,7 +4,7 @@ using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using umbraco.controls.Images; -using umbraco.IO; +using Umbraco.Core.IO; namespace umbraco.editorControls.MultiNodeTreePicker { diff --git a/src/umbraco.editorControls/XmlData.cs b/src/umbraco.editorControls/XmlData.cs index 147080e4d2..e8883fec3f 100644 --- a/src/umbraco.editorControls/XmlData.cs +++ b/src/umbraco.editorControls/XmlData.cs @@ -1,4 +1,5 @@ using System.Xml; +using Umbraco.Core; using umbraco.cms.businesslogic.datatype; namespace umbraco.editorControls @@ -25,7 +26,7 @@ namespace umbraco.editorControls public override XmlNode ToXMl(XmlDocument data) { // check that the value isn't null and starts with an opening angle-bracket. - if (this.Value != null && xmlHelper.CouldItBeXml(this.Value.ToString())) + if (this.Value != null && XmlHelper.CouldItBeXml(this.Value.ToString())) { // load the value into an XML document. var xd = new XmlDocument(); diff --git a/src/umbraco.editorControls/colorpicker/colorPicker.cs b/src/umbraco.editorControls/colorpicker/colorPicker.cs index 5c6200acd6..509010554d 100644 --- a/src/umbraco.editorControls/colorpicker/colorPicker.cs +++ b/src/umbraco.editorControls/colorpicker/colorPicker.cs @@ -3,7 +3,7 @@ using System.Web.UI; using System.Web.UI.WebControls; using System.ComponentModel; using System.Collections; -using umbraco.IO; +using Umbraco.Core.IO; using System.Collections.Generic; namespace umbraco.editorControls diff --git a/src/umbraco.editorControls/imagecropper/ImageInfo.cs b/src/umbraco.editorControls/imagecropper/ImageInfo.cs index 08bdeab11b..c85292cc81 100644 --- a/src/umbraco.editorControls/imagecropper/ImageInfo.cs +++ b/src/umbraco.editorControls/imagecropper/ImageInfo.cs @@ -3,7 +3,7 @@ using System.Drawing; using System.IO; using System.Web; using umbraco.editorControls.imagecropper; -using umbraco.IO; +using Umbraco.Core.IO; namespace umbraco.editorControls.imagecropper { diff --git a/src/umbraco.editorControls/relatedlinks/RelatedLinksDataEditor.cs b/src/umbraco.editorControls/relatedlinks/RelatedLinksDataEditor.cs index f2c50e7818..aad1a2e2ca 100644 --- a/src/umbraco.editorControls/relatedlinks/RelatedLinksDataEditor.cs +++ b/src/umbraco.editorControls/relatedlinks/RelatedLinksDataEditor.cs @@ -10,7 +10,7 @@ using umbraco.interfaces; using umbraco.editorControls; using umbraco.cms.businesslogic; using umbraco.cms.businesslogic.datatype; -using umbraco.IO; +using Umbraco.Core.IO; namespace umbraco.editorControls.relatedlinks { diff --git a/src/umbraco.editorControls/simpleEditor/simpleEditor.cs b/src/umbraco.editorControls/simpleEditor/simpleEditor.cs index 3e0b6ee0b4..8a7843a012 100644 --- a/src/umbraco.editorControls/simpleEditor/simpleEditor.cs +++ b/src/umbraco.editorControls/simpleEditor/simpleEditor.cs @@ -3,7 +3,7 @@ using System.Web.UI; using System.Web.UI.WebControls; using System.ComponentModel; using System.Collections; -using umbraco.IO; +using Umbraco.Core.IO; namespace umbraco.editorControls.simpleEditor { @@ -88,13 +88,13 @@ namespace umbraco.editorControls.simpleEditor output.WriteLine("
"); output.WriteLine( "

" + - "" + + "" + "" + "" + - "" + + "" + "" + " " + - "" + + "" + "" + "

"); base.Render(output); diff --git a/src/umbraco.editorControls/tinyMCE3/TinyMCE.cs b/src/umbraco.editorControls/tinyMCE3/TinyMCE.cs index b9c5ace6c1..0edd0aad4c 100644 --- a/src/umbraco.editorControls/tinyMCE3/TinyMCE.cs +++ b/src/umbraco.editorControls/tinyMCE3/TinyMCE.cs @@ -12,7 +12,7 @@ using umbraco.editorControls.tinymce; using umbraco.editorControls.tinyMCE3.webcontrol; using umbraco.editorControls.wysiwyg; using umbraco.interfaces; -using umbraco.IO; +using Umbraco.Core.IO; using umbraco.presentation; using umbraco.uicontrols; @@ -263,7 +263,7 @@ namespace umbraco.editorControls.tinyMCE3 } } - //if (HttpContext.Current.Request.Path.IndexOf(umbraco.IO.SystemDirectories.Umbraco) > -1) + //if (HttpContext.Current.Request.Path.IndexOf(Umbraco.Core.IO.SystemDirectories.Umbraco) > -1) // config.Add("language", User.GetUser(BasePage.GetUserId(BasePage.umbracoUserContextID)).Language); //else // config.Add("language", System.Threading.Thread.CurrentThread.CurrentCulture.TwoLetterISOLanguageName); diff --git a/src/umbraco.editorControls/ultimatepicker/ultimatePickerDataEditor.cs b/src/umbraco.editorControls/ultimatepicker/ultimatePickerDataEditor.cs index ff3d89de26..3155fc7ba5 100644 --- a/src/umbraco.editorControls/ultimatepicker/ultimatePickerDataEditor.cs +++ b/src/umbraco.editorControls/ultimatepicker/ultimatePickerDataEditor.cs @@ -409,7 +409,7 @@ namespace umbraco.editorControls.ultimatepicker string autoCompleteScript = "jQuery(\"#" + childtxt.ClientID + "\").autocomplete(\"" - + umbraco.IO.IOHelper.ResolveUrl(umbraco.IO.SystemDirectories.Umbraco) + + Umbraco.Core.IO.IOHelper.ResolveUrl(Umbraco.Core.IO.SystemDirectories.Umbraco) + "/webservices/UltimatePickerAutoCompleteHandler.ashx\",{minChars: 2,max: 100, extraParams:{id:\"" + parentNodeId.ToString() + "\",showchildren:\"" + config[3] + "\",filter:\"" + config[2] + "\",rnd:\"" + DateTime.Now.Ticks + "\"}});"; diff --git a/src/umbraco.editorControls/userControlWrapper/usercontrolPrevalueEditor.cs b/src/umbraco.editorControls/userControlWrapper/usercontrolPrevalueEditor.cs index 34b4c1b568..096b708804 100644 --- a/src/umbraco.editorControls/userControlWrapper/usercontrolPrevalueEditor.cs +++ b/src/umbraco.editorControls/userControlWrapper/usercontrolPrevalueEditor.cs @@ -13,7 +13,7 @@ using umbraco.DataLayer; using umbraco.BusinessLogic; using umbraco.editorControls; -using umbraco.IO; +using Umbraco.Core.IO; using System.Collections.Generic; using umbraco.cms.businesslogic.datatype; @@ -68,7 +68,7 @@ namespace umbraco.editorControls.userControlGrapper // populate the usercontrol dropdown _dropdownlistUserControl.Items.Add(new ListItem(ui.Text("choose"), "")); - populateUserControls( IOHelper.MapPath( SystemDirectories.Usercontrols) ); + populateUserControls( IOHelper.MapPath( SystemDirectories.UserControls) ); } @@ -79,11 +79,11 @@ namespace umbraco.editorControls.userControlGrapper foreach (FileInfo uc in di.GetFiles("*.ascx")) { - string ucRoot = IOHelper.MapPath(SystemDirectories.Usercontrols); + string ucRoot = IOHelper.MapPath(SystemDirectories.UserControls); _dropdownlistUserControl.Items.Add( - - new ListItem( SystemDirectories.Usercontrols + + + new ListItem(SystemDirectories.UserControls + uc.FullName.Substring(ucRoot.Length).Replace(IOHelper.DirSepChar, '/')) /* diff --git a/src/umbraco.macroRenderings/content.cs b/src/umbraco.macroRenderings/content.cs index 6f2833b02f..06d71d5a4e 100644 --- a/src/umbraco.macroRenderings/content.cs +++ b/src/umbraco.macroRenderings/content.cs @@ -4,7 +4,7 @@ using Microsoft.ApplicationBlocks.Data; using System.Data.SqlClient; using System.Web.UI; using ClientDependency.Core; -using umbraco.IO; + using umbraco.interfaces; using umbraco.uicontrols.TreePicker; diff --git a/src/umbraco.macroRenderings/media.cs b/src/umbraco.macroRenderings/media.cs index 71755121ff..e447195a69 100644 --- a/src/umbraco.macroRenderings/media.cs +++ b/src/umbraco.macroRenderings/media.cs @@ -5,7 +5,6 @@ using System.Data.SqlClient; using System.Web.UI; using ClientDependency.Core; -using umbraco.IO; using umbraco.interfaces; using umbraco.uicontrols.TreePicker;