From 7806762b807eba9d37fe06e75148c6fbbe395554 Mon Sep 17 00:00:00 2001 From: Shannon Date: Sat, 31 Aug 2013 11:28:19 +1000 Subject: [PATCH] Implemented a real .Net configuration section for umbracoSettings.config + unit tests for every property. NOTE: This isn't referenced in the codebase yet, going to start setting default values for most of the properties so that we can remove them from the config file for shipping (ship minimal config) then reference these settings in the codebase. --- ...coSettings.cs => LegacyUmbracoSettings.cs} | 3224 ++++++++--------- .../AppCodeFileExtensionsCollection.cs | 31 + .../AppCodeFileExtensionsElement.cs | 14 + .../UmbracoSettings/CharCollection.cs | 31 + .../UmbracoSettings/CharElement.cs | 10 + .../CommaDelimitedConfigurationElement.cs | 70 + .../UmbracoSettings/ContentElement.cs | 193 + .../ContentError404Collection.cs | 37 + .../ContentErrorPageElement.cs | 23 + .../UmbracoSettings/ContentErrorsElement.cs | 43 + ...tentImagingAutoFillPropertiesCollection.cs | 33 + ...ontentImagingAutoFillUploadFieldElement.cs | 37 + .../UmbracoSettings/ContentImagingElement.cs | 27 + .../ContentScriptEditorElement.cs | 25 + .../CustomBooleanTypeConverter.cs | 32 + .../UmbracoSettings/DeveloperElement.cs | 13 + .../DisabledLogTypesCollection.cs | 31 + .../UmbracoSettings/DistributedCallElement.cs | 26 + .../UmbracoSettings/ExternalLoggerElement.cs | 25 + .../UmbracoSettings/FileExtensionElement.cs | 7 + .../UmbracoSettings/HelpElement.cs | 20 + .../InnerTextConfigurationElement.cs | 69 + .../UmbracoSettings/LinkElement.cs | 37 + .../UmbracoSettings/LinksCollection.cs | 34 + .../UmbracoSettings/LogTypeElement.cs | 7 + .../UmbracoSettings/LoggingElement.cs | 68 + .../NotDynamicXmlDocumentElement.cs | 7 + .../NotDynamicXmlDocumentElementCollection.cs | 31 + .../UmbracoSettings/NotificationsElement.cs | 25 + .../UmbracoSettings/ObjectExtensions.cs | 210 ++ .../OptionalInnerTextConfigurationElement.cs | 23 + .../UmbracoSettings/ProvidersElement.cs | 13 + .../RawXmlConfigurationElement.cs | 30 + .../UmbracoSettings/RazorElement.cs | 21 + .../RazorStaticMappingCollection.cs | 34 + .../RazorStaticMappingElement.cs | 38 + .../UmbracoSettings/RepositoriesCollection.cs | 31 + .../UmbracoSettings/RepositoriesElement.cs | 14 + .../UmbracoSettings/RepositoryElement.cs | 21 + .../UmbracoSettings/RequestHandlerElement.cs | 25 + .../UmbracoSettings/ScheduledTaskElement.cs | 31 + .../ScheduledTasksCollection.cs | 31 + .../UmbracoSettings/ScheduledTasksElement.cs | 14 + .../UmbracoSettings/ScriptingElement.cs | 14 + .../UmbracoSettings/SecurityElement.cs | 43 + .../UmbracoSettings/ServerCollection.cs | 31 + .../UmbracoSettings/ServerElement.cs | 25 + .../UmbracoSettings/TemplatesElement.cs | 37 + .../UmbracoSettings/UmbracoSettingsSection.cs | 108 + .../UmbracoSettings/UrlReplacingElement.cs | 21 + .../UmbracoSettings/UserProviderElement.cs | 13 + .../ViewstateMoverModuleElement.cs | 13 + .../UmbracoSettings/WebRoutingElement.cs | 20 + .../UmbracoSettings/WebServicesElement.cs | 61 + src/Umbraco.Core/IO/IOHelper.cs | 2 +- src/Umbraco.Core/IO/MediaFileSystem.cs | 4 +- src/Umbraco.Core/IO/UmbracoMediaFile.cs | 2 +- src/Umbraco.Core/Models/ContentExtensions.cs | 8 +- src/Umbraco.Core/Models/PropertyExtensions.cs | 4 +- src/Umbraco.Core/Models/Script.cs | 2 +- src/Umbraco.Core/Models/Template.cs | 6 +- .../Repositories/ContentRepository.cs | 2 +- .../Repositories/MediaRepository.cs | 2 +- .../Repositories/RecycleBinRepository.cs | 2 +- .../Persistence/RepositoryFactory.cs | 4 +- src/Umbraco.Core/PublishedContentHelper.cs | 2 +- .../Security/AuthenticationExtensions.cs | 10 +- .../Services/ContentTypeService.cs | 2 +- src/Umbraco.Core/Services/PackagingService.cs | 4 +- src/Umbraco.Core/StringExtensions.cs | 4 +- .../Strings/DefaultShortStringHelper.cs | 4 +- .../Strings/LegacyShortStringHelper.cs | 8 +- .../Sync/ConfigServerRegistrar.cs | 2 +- .../Sync/DefaultServerMessenger.cs | 4 +- src/Umbraco.Core/Umbraco.Core.csproj | 55 +- src/Umbraco.Core/XmlHelper.cs | 2 +- src/Umbraco.Tests/CodeFirst/CodeFirstTests.cs | 2 +- .../ContentTypeDefinitionFactory.cs | 2 +- .../UmbracoSettings/ContentElementTests.cs | 120 + .../ContentErrorsElementTests.cs | 21 + .../ContentImagingElementTests.cs | 35 + .../ContentNotificationsElementTests.cs | 19 + .../ContentScriptEditorElementTests.cs | 25 + .../UmbracoSettings/DeveloperElementTests.cs | 16 + .../DistributedCallElementTests.cs | 31 + .../UmbracoSettings/HelpElementTests.cs | 31 + .../UmbracoSettings/LoggingElementTests.cs | 61 + .../PackageRepositoriesElementTests.cs | 20 + .../UmbracoSettings/ProvidersElementTests.cs | 14 + .../RequestHandlerElementTests.cs | 39 + .../ScheduledTasksElementTests.cs | 24 + .../UmbracoSettings/ScriptingElementTests.cs | 45 + .../UmbracoSettings/SecurityElementTests.cs | 29 + .../UmbracoSettings/TemplateElementTests.cs | 25 + .../UmbracoSettings/UmbracoSettingsTests.cs | 27 + .../ViewstateMoverModuleElementTests.cs | 14 + .../UmbracoSettings/WebRoutingElementTests.cs | 20 + .../WebServicesElementTests.cs | 67 + .../UmbracoSettings/umbracoSettings.config | 288 ++ .../Configurations/UmbracoSettings/web.config | 14 + .../PublishedContentCacheTests.cs | 6 +- .../Publishing/PublishingStrategyTests.cs | 2 +- .../TestHelpers/SettingsForTests.cs | 26 +- src/Umbraco.Tests/TestHelpers/TestHelper.cs | 2 +- src/Umbraco.Tests/Umbraco.Tests.csproj | 28 + src/Umbraco.Tests/UriUtilityTests.cs | 4 +- .../lib/slider/css/slider.css | 138 + .../lib/slider/js/bootstrap-slider.js | 388 ++ .../install/steps/DefaultUser.ascx.cs | 8 +- src/Umbraco.Web/BaseRest/BaseRestHandler.cs | 2 +- .../BaseRest/RestExtensionMethodInfo.cs | 2 +- src/Umbraco.Web/Configuration/WebRouting.cs | 4 +- .../Editors/BackOfficeController.cs | 2 +- src/Umbraco.Web/Models/XmlPublishedContent.cs | 6 +- .../Models/XmlPublishedContentProperty.cs | 2 +- src/Umbraco.Web/Mvc/UmbracoViewPage.cs | 2 +- .../FileUploadPropertyEditor.cs | 4 +- src/Umbraco.Web/Routing/DefaultUrlProvider.cs | 4 +- .../Routing/PublishedContentRequest.cs | 5 +- .../Routing/PublishedContentRequestEngine.cs | 5 +- src/Umbraco.Web/Routing/UrlProvider.cs | 4 +- src/Umbraco.Web/Security/WebSecurity.cs | 4 +- .../DataTypes/LegacyUploadFieldWorkaround.cs | 6 +- .../Templates/TemplateUtilities.cs | 4 +- src/Umbraco.Web/UmbracoModule.cs | 14 +- src/Umbraco.Web/WebBootManager.cs | 2 +- .../umbraco/Trees/loadTemplates.cs | 2 +- .../umbraco/create/templateTasks.cs | 2 +- .../settings/scripts/editScript.aspx.cs | 4 +- src/umbraco.businesslogic/UmbracoSettings.cs | 146 +- .../businesslogic/template/Template.cs | 6 +- 131 files changed, 5317 insertions(+), 1793 deletions(-) rename src/Umbraco.Core/Configuration/{UmbracoSettings.cs => LegacyUmbracoSettings.cs} (95%) create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/AppCodeFileExtensionsCollection.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/AppCodeFileExtensionsElement.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/CharCollection.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/CharElement.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/CommaDelimitedConfigurationElement.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/ContentElement.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/ContentError404Collection.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/ContentErrorPageElement.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/ContentErrorsElement.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/ContentImagingAutoFillPropertiesCollection.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/ContentImagingAutoFillUploadFieldElement.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/ContentImagingElement.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/ContentScriptEditorElement.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/CustomBooleanTypeConverter.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/DeveloperElement.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/DisabledLogTypesCollection.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/DistributedCallElement.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/ExternalLoggerElement.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/FileExtensionElement.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/HelpElement.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/InnerTextConfigurationElement.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/LinkElement.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/LinksCollection.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/LogTypeElement.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/LoggingElement.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/NotDynamicXmlDocumentElement.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/NotDynamicXmlDocumentElementCollection.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/NotificationsElement.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/ObjectExtensions.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/OptionalInnerTextConfigurationElement.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/ProvidersElement.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/RawXmlConfigurationElement.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/RazorElement.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/RazorStaticMappingCollection.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/RazorStaticMappingElement.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/RepositoriesCollection.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/RepositoriesElement.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/RepositoryElement.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/RequestHandlerElement.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/ScheduledTaskElement.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/ScheduledTasksCollection.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/ScheduledTasksElement.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/ScriptingElement.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/SecurityElement.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/ServerCollection.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/ServerElement.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/TemplatesElement.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/UmbracoSettingsSection.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/UrlReplacingElement.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/UserProviderElement.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/ViewstateMoverModuleElement.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/WebRoutingElement.cs create mode 100644 src/Umbraco.Core/Configuration/UmbracoSettings/WebServicesElement.cs create mode 100644 src/Umbraco.Tests/Configurations/UmbracoSettings/ContentElementTests.cs create mode 100644 src/Umbraco.Tests/Configurations/UmbracoSettings/ContentErrorsElementTests.cs create mode 100644 src/Umbraco.Tests/Configurations/UmbracoSettings/ContentImagingElementTests.cs create mode 100644 src/Umbraco.Tests/Configurations/UmbracoSettings/ContentNotificationsElementTests.cs create mode 100644 src/Umbraco.Tests/Configurations/UmbracoSettings/ContentScriptEditorElementTests.cs create mode 100644 src/Umbraco.Tests/Configurations/UmbracoSettings/DeveloperElementTests.cs create mode 100644 src/Umbraco.Tests/Configurations/UmbracoSettings/DistributedCallElementTests.cs create mode 100644 src/Umbraco.Tests/Configurations/UmbracoSettings/HelpElementTests.cs create mode 100644 src/Umbraco.Tests/Configurations/UmbracoSettings/LoggingElementTests.cs create mode 100644 src/Umbraco.Tests/Configurations/UmbracoSettings/PackageRepositoriesElementTests.cs create mode 100644 src/Umbraco.Tests/Configurations/UmbracoSettings/ProvidersElementTests.cs create mode 100644 src/Umbraco.Tests/Configurations/UmbracoSettings/RequestHandlerElementTests.cs create mode 100644 src/Umbraco.Tests/Configurations/UmbracoSettings/ScheduledTasksElementTests.cs create mode 100644 src/Umbraco.Tests/Configurations/UmbracoSettings/ScriptingElementTests.cs create mode 100644 src/Umbraco.Tests/Configurations/UmbracoSettings/SecurityElementTests.cs create mode 100644 src/Umbraco.Tests/Configurations/UmbracoSettings/TemplateElementTests.cs create mode 100644 src/Umbraco.Tests/Configurations/UmbracoSettings/UmbracoSettingsTests.cs create mode 100644 src/Umbraco.Tests/Configurations/UmbracoSettings/ViewstateMoverModuleElementTests.cs create mode 100644 src/Umbraco.Tests/Configurations/UmbracoSettings/WebRoutingElementTests.cs create mode 100644 src/Umbraco.Tests/Configurations/UmbracoSettings/WebServicesElementTests.cs create mode 100644 src/Umbraco.Tests/Configurations/UmbracoSettings/umbracoSettings.config create mode 100644 src/Umbraco.Tests/Configurations/UmbracoSettings/web.config create mode 100644 src/Umbraco.Web.UI.Client/lib/slider/css/slider.css create mode 100644 src/Umbraco.Web.UI.Client/lib/slider/js/bootstrap-slider.js diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings.cs b/src/Umbraco.Core/Configuration/LegacyUmbracoSettings.cs similarity index 95% rename from src/Umbraco.Core/Configuration/UmbracoSettings.cs rename to src/Umbraco.Core/Configuration/LegacyUmbracoSettings.cs index 9292fd21e9..e32d1d4b51 100644 --- a/src/Umbraco.Core/Configuration/UmbracoSettings.cs +++ b/src/Umbraco.Core/Configuration/LegacyUmbracoSettings.cs @@ -1,1613 +1,1613 @@ -using System; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Threading; -using System.Web; -using System.Web.Caching; -using System.Web.Security; -using System.Xml; -using System.Configuration; - -using System.Collections.Generic; -using Umbraco.Core.Logging; -using Umbraco.Core.CodeAnnotations; - - -namespace Umbraco.Core.Configuration -{ - //NOTE: Do not expose this class ever until we cleanup all configuration including removal of static classes, etc... - // we have this two tasks logged: - // http://issues.umbraco.org/issue/U4-58 - // http://issues.umbraco.org/issue/U4-115 - - //TODO: Re-enable logging !!!! - - //TODO: We need to convert this to a real section, it's currently using HttpRuntime.Cache to detect cahnges, this is real poor, especially in a console app - - /// - /// The UmbracoSettings Class contains general settings information for the entire Umbraco instance based on information from the /config/umbracoSettings.config file - /// - internal class UmbracoSettings - { - private static bool GetKeyValue(string key, bool defaultValue) - { - bool value; - string stringValue = GetKey(key); - - if (string.IsNullOrWhiteSpace(stringValue)) - return defaultValue; - if (bool.TryParse(stringValue, out value)) - return value; - return defaultValue; - } - - private static int GetKeyValue(string key, int defaultValue) - { - int value; - string stringValue = GetKey(key); - - if (string.IsNullOrWhiteSpace(stringValue)) - return defaultValue; - if (int.TryParse(stringValue, out value)) - return value; - return defaultValue; - } - - /// - /// Used in unit testing to reset all config items that were set with property setters (i.e. did not come from config) - /// - private static void ResetInternal() - { - _addTrailingSlash = null; - _forceSafeAliases = null; - _useLegacySchema = null; - _useDomainPrefixes = null; - _umbracoLibraryCacheDuration = null; - SettingsFilePath = null; - } - - internal const string TempFriendlyXmlChildContainerNodename = ""; // "children"; - - /// - /// Gets the umbraco settings document. - /// - /// The _umbraco settings. - internal static XmlDocument UmbracoSettingsXmlDoc - { - get - { - var us = (XmlDocument)HttpRuntime.Cache["umbracoSettingsFile"] ?? EnsureSettingsDocument(); - return us; - } - } - - private static string _path; - - /// - /// Gets/sets the settings file path, the setter can be used in unit tests - /// - internal static string SettingsFilePath - { - get { return _path ?? (_path = GlobalSettings.FullpathToRoot + Path.DirectorySeparatorChar + "config" + Path.DirectorySeparatorChar); } - set { _path = value; } - } - - internal const string Filename = "umbracoSettings.config"; - - internal static XmlDocument EnsureSettingsDocument() - { - var settingsFile = HttpRuntime.Cache["umbracoSettingsFile"]; - - // Check for language file in cache - if (settingsFile == null) - { - var temp = new XmlDocument(); - var settingsReader = new XmlTextReader(SettingsFilePath + Filename); - try - { - temp.Load(settingsReader); - HttpRuntime.Cache.Insert("umbracoSettingsFile", temp, - new CacheDependency(SettingsFilePath + Filename)); - } - catch (XmlException e) - { - throw new XmlException("Your umbracoSettings.config file fails to pass as valid XML. Refer to the InnerException for more information", e); - } - catch (Exception e) - { - LogHelper.Error("Error reading umbracoSettings file: " + e.ToString(), e); - } - settingsReader.Close(); - return temp; - } - else - return (XmlDocument)settingsFile; - } - - internal static void Save() - { - UmbracoSettingsXmlDoc.Save(SettingsFilePath + Filename); - } - - - /// - /// Selects a xml node in the umbraco settings config file. - /// - /// The xpath query to the specific node. - /// If found, it returns the specific configuration xml node. - internal static XmlNode GetKeyAsNode(string key) - { - if (key == null) - throw new ArgumentException("Key cannot be null"); - EnsureSettingsDocument(); - if (UmbracoSettingsXmlDoc == null || UmbracoSettingsXmlDoc.DocumentElement == null) - return null; - return UmbracoSettingsXmlDoc.DocumentElement.SelectSingleNode(key); - } - - /// - /// Gets the value of configuration xml node with the specified key. - /// - /// The key. - /// - internal static string GetKey(string key) - { - EnsureSettingsDocument(); - - string attrName = null; - var pos = key.IndexOf('@'); - if (pos > 0) - { - attrName = key.Substring(pos + 1); - key = key.Substring(0, pos - 1); - } - - var node = UmbracoSettingsXmlDoc.DocumentElement.SelectSingleNode(key); - if (node == null) - return string.Empty; - - if (pos < 0) - { - if (node.FirstChild == null || node.FirstChild.Value == null) - return string.Empty; - return node.FirstChild.Value; - } - else - { - var attr = node.Attributes[attrName]; - if (attr == null) - return string.Empty; - return attr.Value; - } - } - - /// - /// Gets a value indicating whether the media library will create new directories in the /media directory. - /// - /// - /// true if new directories are allowed otherwise, false. - /// - internal static bool UploadAllowDirectories - { - get { return bool.Parse(GetKey("/settings/content/UploadAllowDirectories")); } - } - - /// - /// THIS IS TEMPORARY until we fix up settings all together, this setting is actually not 'settable' but is - /// here for future purposes since we check for thsi settings in the module. - /// - internal static bool EnableBaseRestHandler - { - get { return true; } - } - - /// - /// THIS IS TEMPORARY until we fix up settings all together, this setting is actually not 'settable' but is - /// here for future purposes since we check for thsi settings in the module. - /// - internal static string BootSplashPage - { - get { return "~/config/splashes/booting.aspx"; } - } - - /// - /// Gets a value indicating whether logging is enabled in umbracoSettings.config (/settings/logging/enableLogging). - /// - /// true if logging is enabled; otherwise, false. - internal static bool EnableLogging - { - get - { - // We return true if no enable logging element is present in - // umbracoSettings (to enable default behaviour when upgrading) - var enableLogging = GetKey("/settings/logging/enableLogging"); - return String.IsNullOrEmpty(enableLogging) || bool.Parse(enableLogging); - } - } - - /// - /// Gets a value indicating whether logging happens async. - /// - /// true if async logging is enabled; otherwise, false. - internal static bool EnableAsyncLogging - { - get - { - string value = GetKey("/settings/logging/enableAsyncLogging"); - bool result; - if (!string.IsNullOrEmpty(value) && bool.TryParse(value, out result)) - return result; - return false; - } - } - - /// - /// Gets the assembly of an external logger that can be used to store log items in 3rd party systems - /// - internal static string ExternalLoggerAssembly - { - get - { - var value = GetKeyAsNode("/settings/logging/externalLogger"); - return value != null ? value.Attributes["assembly"].Value : ""; - } - } - - /// - /// Gets the type of an external logger that can be used to store log items in 3rd party systems - /// - internal static string ExternalLoggerType - { - get - { - var value = GetKeyAsNode("/settings/logging/externalLogger"); - return value != null ? value.Attributes["type"].Value : ""; - } - } - - /// - /// Long Audit Trail to external log too - /// - internal static bool ExternalLoggerLogAuditTrail - { - get - { - var value = GetKeyAsNode("/settings/logging/externalLogger"); - if (value != null) - { - var logAuditTrail = value.Attributes["logAuditTrail"].Value; - bool result; - if (!string.IsNullOrEmpty(logAuditTrail) && bool.TryParse(logAuditTrail, out result)) - return result; - } - return false; - } - } - - /// - /// Keep user alive as long as they have their browser open? Default is true - /// - internal static bool KeepUserLoggedIn - { - get - { - var value = GetKey("/settings/security/keepUserLoggedIn"); - bool result; - if (!string.IsNullOrEmpty(value) && bool.TryParse(value, out result)) - return result; - return true; - } - } - - internal static string AuthCookieName - { - get - { - var value = GetKey("/settings/security/authCookieName"); - if (string.IsNullOrEmpty(value) == false) - { - return value; - } - return "UMB_UCONTEXT"; - } - } - - internal static string AuthCookieDomain - { - get - { - var value = GetKey("/settings/security/authCookieDomain"); - if (string.IsNullOrEmpty(value) == false) - { - return value; - } - return FormsAuthentication.CookieDomain; - } - } - - /// - /// Enables the experimental canvas (live) editing on the frontend of the website - /// - internal static bool EnableCanvasEditing - { - get - { - var value = GetKey("/settings/content/EnableCanvasEditing"); - bool result; - if (!string.IsNullOrEmpty(value) && bool.TryParse(value, out result)) - return result; - return true; - } - } - - /// - /// Show disabled users in the tree in the Users section in the backoffice - /// - internal static bool HideDisabledUsersInBackoffice - { - get - { - string value = GetKey("/settings/security/hideDisabledUsersInBackoffice"); - bool result; - if (!string.IsNullOrEmpty(value) && bool.TryParse(value, out result)) - return result; - return false; - } - } - - /// - /// Gets a value indicating whether the logs will be auto cleaned - /// - /// true if logs are to be automatically cleaned; otherwise, false - internal static bool AutoCleanLogs - { - get - { - string value = GetKey("/settings/logging/autoCleanLogs"); - bool result; - if (!string.IsNullOrEmpty(value) && bool.TryParse(value, out result)) - return result; - return false; - } - } - - /// - /// Gets the value indicating the log cleaning frequency (in miliseconds) - /// - internal static int CleaningMiliseconds - { - get - { - string value = GetKey("/settings/logging/cleaningMiliseconds"); - int result; - if (!string.IsNullOrEmpty(value) && int.TryParse(value, out result)) - return result; - return -1; - } - } - - internal static int MaxLogAge - { - get - { - string value = GetKey("/settings/logging/maxLogAge"); - int result; - if (!string.IsNullOrEmpty(value) && int.TryParse(value, out result)) - return result; - return -1; - } - } - - /// - /// Gets the disabled log types. - /// - /// The disabled log types. - internal static XmlNode DisabledLogTypes - { - get { return GetKeyAsNode("/settings/logging/disabledLogTypes"); } - } - - /// - /// Gets the package server url. - /// - /// The package server url. - internal static string PackageServer - { - get { return "packages.umbraco.org"; } - } - - static bool? _useDomainPrefixes = null; - - /// - /// Gets a value indicating whether umbraco will use domain prefixes. - /// - /// true if umbraco will use domain prefixes; otherwise, false. - internal static bool UseDomainPrefixes - { - get - { - // default: false - return _useDomainPrefixes ?? GetKeyValue("/settings/requestHandler/useDomainPrefixes", false); - } - /*internal*/ set - { - // for unit tests only - _useDomainPrefixes = value; - } - } - - static bool? _addTrailingSlash = null; - - /// - /// This will add a trailing slash (/) to urls when in directory url mode - /// NOTICE: This will always return false if Directory Urls in not active - /// - internal static bool AddTrailingSlash - { - get - { - // default: false - return GlobalSettings.UseDirectoryUrls - && (_addTrailingSlash ?? GetKeyValue("/settings/requestHandler/addTrailingSlash", false)); - } - /*internal*/ set - { - // for unit tests only - _addTrailingSlash = value; - } - } - - /// - /// Gets a value indicating whether umbraco will use ASP.NET MasterPages for rendering instead of its propriatary templating system. - /// - /// true if umbraco will use ASP.NET MasterPages; otherwise, false. - internal static bool UseAspNetMasterPages - { - get - { - try - { - bool result; - if (bool.TryParse(GetKey("/settings/templates/useAspNetMasterPages"), out result)) - return result; - return false; - } - catch - { - return false; - } - } - } - - /// - /// Gets a value indicating whether umbraco will attempt to load any skins to override default template files - /// - /// true if umbraco will override templates with skins if present and configured false. - internal static bool EnableTemplateFolders - { - get - { - try - { - bool result; - if (bool.TryParse(GetKey("/settings/templates/enableTemplateFolders"), out result)) - return result; - return false; - } - catch - { - return false; - } - } - } - - //TODO: I"m not sure why we need this, need to ask Gareth what the deal is, pretty sure we can remove it or change it, seems like - // massive overkill. - - /// - /// razor DynamicNode typecasting detects XML and returns DynamicXml - Root elements that won't convert to DynamicXml - /// - internal static IEnumerable NotDynamicXmlDocumentElements - { - get - { - try - { - List items = new List(); - XmlNode root = GetKeyAsNode("/settings/scripting/razor/notDynamicXmlDocumentElements"); - foreach (XmlNode element in root.SelectNodes(".//element")) - { - items.Add(element.InnerText); - } - return items; - } - catch - { - return new List() { "p", "div" }; - } - } - } - - private static IEnumerable _razorDataTypeModelStaticMapping; - private static readonly ReaderWriterLockSlim Lock = new ReaderWriterLockSlim(); - - internal static IEnumerable RazorDataTypeModelStaticMapping - { - get - { - /* - - DigibizAdvancedMediaPicker.RazorModel.ModelBinder - DigibizAdvancedMediaPicker.RazorModel.ModelBinder - - */ - - using (var l = new UpgradeableReadLock(Lock)) - { - if (_razorDataTypeModelStaticMapping == null) - { - l.UpgradeToWriteLock(); - - List items = new List(); - XmlNode root = GetKeyAsNode("/settings/scripting/razor/dataTypeModelStaticMappings"); - if (root != null) - { - foreach (XmlNode element in root.SelectNodes(".//mapping")) - { - string propertyTypeAlias = null, nodeTypeAlias = null; - Guid? dataTypeGuid = null; - if (!string.IsNullOrEmpty(element.InnerText)) - { - if (element.Attributes["dataTypeGuid"] != null) - { - dataTypeGuid = (Guid?)new Guid(element.Attributes["dataTypeGuid"].Value); - } - if (element.Attributes["propertyTypeAlias"] != null && !string.IsNullOrEmpty(element.Attributes["propertyTypeAlias"].Value)) - { - propertyTypeAlias = element.Attributes["propertyTypeAlias"].Value; - } - if (element.Attributes["nodeTypeAlias"] != null && !string.IsNullOrEmpty(element.Attributes["nodeTypeAlias"].Value)) - { - nodeTypeAlias = element.Attributes["nodeTypeAlias"].Value; - } - items.Add(new RazorDataTypeModelStaticMappingItem() - { - DataTypeGuid = dataTypeGuid, - PropertyTypeAlias = propertyTypeAlias, - NodeTypeAlias = nodeTypeAlias, - TypeName = element.InnerText, - Raw = element.OuterXml - }); - } - } - } - - _razorDataTypeModelStaticMapping = items; - } - - return _razorDataTypeModelStaticMapping; - } - } - } - - /// - /// Gets a value indicating whether umbraco will clone XML cache on publish. - /// - /// - /// true if umbraco will clone XML cache on publish; otherwise, false. - /// - internal static bool CloneXmlCacheOnPublish - { - get - { - try - { - bool result; - if (bool.TryParse(GetKey("/settings/content/cloneXmlContent"), out result)) - return result; - return false; - } - catch - { - return false; - } - } - } - - /// - /// Gets a value indicating whether rich text editor content should be parsed by tidy. - /// - /// true if content is parsed; otherwise, false. - internal static bool TidyEditorContent - { - get { return bool.Parse(GetKey("/settings/content/TidyEditorContent")); } - } - - /// - /// Gets the encoding type for the tidyied content. - /// - /// The encoding type as string. - internal static string TidyCharEncoding - { - get - { - string encoding = GetKey("/settings/content/TidyCharEncoding"); - if (String.IsNullOrEmpty(encoding)) - { - encoding = "UTF8"; - } - return encoding; - } - } - - /// - /// Gets the property context help option, this can either be 'text', 'icon' or 'none' - /// - /// The property context help option. - internal static string PropertyContextHelpOption - { - get { return GetKey("/settings/content/PropertyContextHelpOption").ToLower(); } - } - - internal static string DefaultBackofficeProvider - { - get - { - string defaultProvider = GetKey("/settings/providers/users/DefaultBackofficeProvider"); - if (String.IsNullOrEmpty(defaultProvider)) - defaultProvider = "UsersMembershipProvider"; - - return defaultProvider; - } - } - - private static bool? _forceSafeAliases; - - /// - /// Whether to force safe aliases (no spaces, no special characters) at businesslogic level on contenttypes and propertytypes - /// - internal static bool ForceSafeAliases - { - get - { - // default: true - return _forceSafeAliases ?? GetKeyValue("/settings/content/ForceSafeAliases", true); - } - /*internal*/ set - { - // used for unit testing - _forceSafeAliases = value; - } - } - - /// - /// Gets a value indicating whether to try to skip IIS custom errors. - /// - [UmbracoWillObsolete("Use UmbracoSettings.For.TrySkipIisCustomErrors instead.")] - internal static bool TrySkipIisCustomErrors - { - get { return GetKeyValue("/settings/web.routing/@trySkipIisCustomErrors", false); } - } - - /// - /// Gets a value indicating whether internal redirect preserves the template. - /// - [UmbracoWillObsolete("Use UmbracoSettings.For.InternalRedirectPerservesTemplate instead.")] - internal static bool InternalRedirectPreservesTemplate - { - get { return GetKeyValue("/settings/web.routing/@internalRedirectPreservesTemplate", false); } - } - - /// - /// File types that will not be allowed to be uploaded via the content/media upload control - /// - public static IEnumerable DisallowedUploadFiles - { - get - { - var val = GetKey("/settings/content/disallowedUploadFiles"); - return val.Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries); - } - } - - /// - /// Gets the allowed image file types. - /// - /// The allowed image file types. - internal static string ImageFileTypes - { - get { return GetKey("/settings/content/imaging/imageFileTypes").ToLowerInvariant(); } - } - - /// - /// Gets the allowed script file types. - /// - /// The allowed script file types. - internal static string ScriptFileTypes - { - get { return GetKey("/settings/content/scripteditor/scriptFileTypes"); } - } - - private static int? _umbracoLibraryCacheDuration; - - /// - /// Gets the duration in seconds to cache queries to umbraco library member and media methods - /// Default is 1800 seconds (30 minutes) - /// - internal static int UmbracoLibraryCacheDuration - { - get - { - // default: 1800 - return _umbracoLibraryCacheDuration ?? GetKeyValue("/settings/content/UmbracoLibraryCacheDuration", 1800); - } - /*internal*/ set - { - // for unit tests only - _umbracoLibraryCacheDuration = value; - } - } - - /// - /// Gets the path to the scripts folder used by the script editor. - /// - /// The script folder path. - internal static string ScriptFolderPath - { - get { return GetKey("/settings/content/scripteditor/scriptFolderPath"); } - } - - /// - /// Enabled or disable the script/code editor - /// - internal static bool ScriptDisableEditor - { - get - { - string _tempValue = GetKey("/settings/content/scripteditor/scriptDisableEditor"); - if (_tempValue != String.Empty) - return bool.Parse(_tempValue); - else - return false; - } - } - - /// - /// Gets a value indicating whether umbraco will ensure unique node naming. - /// This will ensure that nodes cannot have the same url, but will add extra characters to a url. - /// ex: existingnodename.aspx would become existingnodename(1).aspx if a node with the same name is found - /// - /// true if umbraco ensures unique node naming; otherwise, false. - internal static bool EnsureUniqueNaming - { - get - { - try - { - return bool.Parse(GetKey("/settings/content/ensureUniqueNaming")); - } - catch - { - return false; - } - } - } - - /// - /// Gets the notification email sender. - /// - /// The notification email sender. - internal static string NotificationEmailSender - { - get { return GetKey("/settings/content/notifications/email"); } - } - - /// - /// Gets a value indicating whether notification-emails are HTML. - /// - /// - /// true if html notification-emails are disabled; otherwise, false. - /// - internal static bool NotificationDisableHtmlEmail - { - get - { - var tempValue = GetKey("/settings/content/notifications/disableHtmlEmail"); - return tempValue != String.Empty && bool.Parse(tempValue); - } - } - - /// - /// Gets the allowed attributes on images. - /// - /// The allowed attributes on images. - internal static string ImageAllowedAttributes - { - get { return GetKey("/settings/content/imaging/allowedAttributes"); } - } - - internal static XmlNode ImageAutoFillImageProperties - { - get { return GetKeyAsNode("/settings/content/imaging/autoFillImageProperties"); } - } - - /// - /// Gets the scheduled tasks as XML - /// - /// The scheduled tasks. - internal static XmlNode ScheduledTasks - { - get { return GetKeyAsNode("/settings/scheduledTasks"); } - } - - /// - /// Gets a list of characters that will be replaced when generating urls - /// - /// The URL replacement characters. - internal static XmlNode UrlReplaceCharacters - { - get { return GetKeyAsNode("/settings/requestHandler/urlReplacing"); } - } - - /// - /// Whether to replace double dashes from url (ie my--story----from--dash.aspx caused by multiple url replacement chars - /// - internal static bool RemoveDoubleDashesFromUrlReplacing - { - get - { - try - { - return bool.Parse(UrlReplaceCharacters.Attributes.GetNamedItem("removeDoubleDashes").Value); - } - catch - { - return false; - } - } - } - - /// - /// Gets a value indicating whether umbraco will use distributed calls. - /// This enables umbraco to share cache and content across multiple servers. - /// Used for load-balancing high-traffic sites. - /// - /// true if umbraco uses distributed calls; otherwise, false. - internal static bool UseDistributedCalls - { - get - { - try - { - return bool.Parse(GetKeyAsNode("/settings/distributedCall").Attributes.GetNamedItem("enable").Value); - } - catch - { - return false; - } - } - } - - - /// - /// Gets the ID of the user with access rights to perform the distributed calls. - /// - /// The distributed call user. - internal static int DistributedCallUser - { - get - { - try - { - return int.Parse(GetKey("/settings/distributedCall/user")); - } - catch - { - return -1; - } - } - } - - /// - /// Gets the html injected into a (x)html page if Umbraco is running in preview mode - /// - internal static string PreviewBadge - { - get - { - try - { - return GetKey("/settings/content/PreviewBadge"); - } - catch - { - return "In Preview Mode - click to end"; - } - } - } - - /// - /// Gets IP or hostnames of the distribution servers. - /// These servers will receive a call everytime content is created/deleted/removed - /// and update their content cache accordingly, ensuring a consistent cache on all servers - /// - /// The distribution servers. - internal static XmlNode DistributionServers - { - get - { - try - { - return GetKeyAsNode("/settings/distributedCall/servers"); - } - catch - { - return null; - } - } - } - - /// - /// Gets HelpPage configurations. - /// A help page configuration specify language, user type, application, application url and - /// the target help page url. - /// - internal static XmlNode HelpPages - { - get - { - try - { - return GetKeyAsNode("/settings/help"); - } - catch - { - return null; - } - } - } - - /// - /// Gets all repositories registered, and returns them as XmlNodes, containing name, alias and webservice url. - /// These repositories are used by the build-in package installer and uninstaller to install new packages and check for updates. - /// All repositories should have a unique alias. - /// All packages installed from a repository gets the repository alias included in the install information - /// - /// The repository servers. - internal static XmlNode Repositories - { - get - { - try - { - return GetKeyAsNode("/settings/repositories"); - } - catch - { - return null; - } - } - } - - /// - /// Gets a value indicating whether umbraco will use the viewstate mover module. - /// The viewstate mover will move all asp.net viewstate information to the bottom of the aspx page - /// to ensure that search engines will index text instead of javascript viewstate information. - /// - /// - /// true if umbraco will use the viewstate mover module; otherwise, false. - /// - internal static bool UseViewstateMoverModule - { - get - { - try - { - return - bool.Parse( - GetKeyAsNode("/settings/viewstateMoverModule").Attributes.GetNamedItem("enable").Value); - } - catch - { - return false; - } - } - } - - - /// - /// Tells us whether the Xml Content cache is disabled or not - /// Default is enabled - /// - internal static bool IsXmlContentCacheDisabled - { - get - { - try - { - bool xmlCacheEnabled; - string value = GetKey("/settings/content/XmlCacheEnabled"); - if (bool.TryParse(value, out xmlCacheEnabled)) - return !xmlCacheEnabled; - // Return default - return false; - } - catch - { - return false; - } - } - } - - /// - /// Check if there's changes to the umbraco.config xml file cache on disk on each request - /// Makes it possible to updates environments by syncing the umbraco.config file across instances - /// Relates to http://umbraco.codeplex.com/workitem/30722 - /// - internal static bool XmlContentCheckForDiskChanges - { - get - { - try - { - bool checkForDiskChanges; - string value = GetKey("/settings/content/XmlContentCheckForDiskChanges"); - if (bool.TryParse(value, out checkForDiskChanges)) - return checkForDiskChanges; - // Return default - return false; - } - catch - { - return false; - } - } - } - - /// - /// If this is enabled, all Umbraco objects will generate data in the preview table (cmsPreviewXml). - /// If disabled, only documents will generate data. - /// This feature is useful if anyone would like to see how data looked at a given time - /// - internal static bool EnableGlobalPreviewStorage - { - get - { - try - { - bool globalPreviewEnabled = false; - string value = GetKey("/settings/content/GlobalPreviewStorageEnabled"); - if (bool.TryParse(value, out globalPreviewEnabled)) - return !globalPreviewEnabled; - // Return default - return false; - } - catch - { - return false; - } - } - } - - private static bool? _useLegacySchema; - - /// - /// Whether to use the new 4.1 schema or the old legacy schema - /// - /// - /// true if yes, use the old node/data model; otherwise, false. - /// - internal static bool UseLegacyXmlSchema - { - get - { - // default: true - return _useLegacySchema ?? GetKeyValue("/settings/content/UseLegacyXmlSchema", false); - } - /*internal*/ set - { - // used for unit testing - _useLegacySchema = value; - } - } - - [Obsolete("This setting is not used anymore, the only file extensions that are supported are .cs and .vb files")] - internal static IEnumerable AppCodeFileExtensionsList - { - get - { - return (from XmlNode x in AppCodeFileExtensions - where !String.IsNullOrEmpty(x.InnerText) - select x.InnerText).ToList(); - } - } - - [Obsolete("This setting is not used anymore, the only file extensions that are supported are .cs and .vb files")] - internal static XmlNode AppCodeFileExtensions - { - get - { - XmlNode value = GetKeyAsNode("/settings/developer/appCodeFileExtensions"); - if (value != null) - { - return value; - } - - // default is .cs and .vb - value = UmbracoSettingsXmlDoc.CreateElement("appCodeFileExtensions"); - value.AppendChild(XmlHelper.AddTextNode(UmbracoSettingsXmlDoc, "ext", "cs")); - value.AppendChild(XmlHelper.AddTextNode(UmbracoSettingsXmlDoc, "ext", "vb")); - return value; - } - } - - /// - /// Tells us whether the Xml to always update disk cache, when changes are made to content - /// Default is enabled - /// - internal static bool ContinouslyUpdateXmlDiskCache - { - get - { - try - { - bool updateDiskCache; - string value = GetKey("/settings/content/ContinouslyUpdateXmlDiskCache"); - if (bool.TryParse(value, out updateDiskCache)) - return updateDiskCache; - // Return default - return false; - } - catch - { - return true; - } - } - } - - /// - /// Tells us whether to use a splash page while umbraco is initializing content. - /// If not, requests are queued while umbraco loads content. For very large sites (+10k nodes) it might be usefull to - /// have a splash page - /// Default is disabled - /// - internal static bool EnableSplashWhileLoading - { - get - { - try - { - bool updateDiskCache; - string value = GetKey("/settings/content/EnableSplashWhileLoading"); - if (bool.TryParse(value, out updateDiskCache)) - return updateDiskCache; - // Return default - return false; - } - catch - { - return false; - } - } - } - - private static bool? _resolveUrlsFromTextString; - internal static bool ResolveUrlsFromTextString - { - get - { - if (_resolveUrlsFromTextString == null) - { - try - { - bool enableDictionaryFallBack; - var value = GetKey("/settings/content/ResolveUrlsFromTextString"); - if (value != null) - if (bool.TryParse(value, out enableDictionaryFallBack)) - _resolveUrlsFromTextString = enableDictionaryFallBack; - } - catch (Exception ex) - { - Trace.WriteLine("Could not load /settings/content/ResolveUrlsFromTextString from umbracosettings.config:\r\n {0}", - ex.Message); - - // set url resolving to true (default (legacy) behavior) to ensure we don't keep writing to trace - _resolveUrlsFromTextString = true; - } - } - return _resolveUrlsFromTextString == true; - } - } - - - private static RenderingEngine? _defaultRenderingEngine; - - /// - /// Enables MVC, and at the same time disable webform masterpage templates. - /// This ensure views are automaticly created instead of masterpages. - /// Views are display in the tree instead of masterpages and a MVC template editor - /// is used instead of the masterpages editor - /// - /// true if umbraco defaults to using MVC views for templating, otherwise false. - internal static RenderingEngine DefaultRenderingEngine - { - get - { - if (_defaultRenderingEngine == null) - { - try - { - var engine = RenderingEngine.WebForms; - var value = GetKey("/settings/templates/defaultRenderingEngine"); - if (value != null) - { - Enum.TryParse(value, true, out engine); - } - _defaultRenderingEngine = engine; - } - catch (Exception ex) - { - LogHelper.Error("Could not load /settings/templates/defaultRenderingEngine from umbracosettings.config", ex); - _defaultRenderingEngine = RenderingEngine.WebForms; - } - } - return _defaultRenderingEngine.Value; - } - //internal set - //{ - // _defaultRenderingEngine = value; - // var node = UmbracoSettingsXmlDoc.DocumentElement.SelectSingleNode("/settings/templates/defaultRenderingEngine"); - // node.InnerText = value.ToString(); - //} - } - - private static MacroErrorBehaviour? _macroErrorBehaviour; - - /// - /// This configuration setting defines how to handle macro errors: - /// - Inline - Show error within macro as text (default and current Umbraco 'normal' behavior) - /// - Silent - Suppress error and hide macro - /// - Throw - Throw an exception and invoke the global error handler (if one is defined, if not you'll get a YSOD) - /// - /// MacroErrorBehaviour enum defining how to handle macro errors. - internal static MacroErrorBehaviour MacroErrorBehaviour - { - get - { - if (_macroErrorBehaviour == null) - { - try - { - var behaviour = MacroErrorBehaviour.Inline; - var value = GetKey("/settings/content/MacroErrors"); - if (value != null) - { - Enum.TryParse(value, true, out behaviour); - } - _macroErrorBehaviour = behaviour; - } - catch (Exception ex) - { - LogHelper.Error("Could not load /settings/content/MacroErrors from umbracosettings.config", ex); - _macroErrorBehaviour = MacroErrorBehaviour.Inline; - } - } - return _macroErrorBehaviour.Value; - } - } - - private static IconPickerBehaviour? _iconPickerBehaviour; - - /// - /// This configuration setting defines how to show icons in the document type editor. - /// - ShowDuplicates - Show duplicates in files and sprites. (default and current Umbraco 'normal' behaviour) - /// - HideSpriteDuplicates - Show files on disk and hide duplicates from the sprite - /// - HideFileDuplicates - Show files in the sprite and hide duplicates on disk - /// - /// MacroErrorBehaviour enum defining how to show icons in the document type editor. - internal static IconPickerBehaviour IconPickerBehaviour - { - get - { - if (_iconPickerBehaviour == null) - { - try - { - var behaviour = IconPickerBehaviour.ShowDuplicates; - var value = GetKey("/settings/content/DocumentTypeIconList"); - if (value != null) - { - Enum.TryParse(value, true, out behaviour); - } - _iconPickerBehaviour = behaviour; - } - catch (Exception ex) - { - LogHelper.Error("Could not load /settings/content/DocumentTypeIconList from umbracosettings.config", ex); - _iconPickerBehaviour = IconPickerBehaviour.ShowDuplicates; - } - } - return _iconPickerBehaviour.Value; - } - } - - /// - /// Gets the default document type property used when adding new properties through the back-office - /// - /// Configured text for the default document type property - /// If undefined, 'Textstring' is the default - public static string DefaultDocumentTypeProperty - { - get - { - var defaultDocumentTypeProperty = GetKey("/settings/content/defaultDocumentTypeProperty"); - if (string.IsNullOrEmpty(defaultDocumentTypeProperty)) - { - defaultDocumentTypeProperty = "Textstring"; - } - - return defaultDocumentTypeProperty; - } - } - - /// - /// Configuration regarding webservices - /// - /// Put in seperate class for more logik/seperation - internal class WebServices - { - /// - /// Gets a value indicating whether this is enabled. - /// - /// true if enabled; otherwise, false. - public static bool Enabled - { - get - { - try - { - return - bool.Parse(GetKeyAsNode("/settings/webservices").Attributes.GetNamedItem("enabled").Value); - } - catch - { - return false; - } - } - } - - #region "Webservice configuration" - - /// - /// Gets the document service users who have access to use the document web service - /// - /// The document service users. - public static string[] DocumentServiceUsers - { - get - { - try - { - return GetKey("/settings/webservices/documentServiceUsers").Split(','); - } - catch - { - return new string[0]; - } - } - } - - /// - /// Gets the file service users who have access to use the file web service - /// - /// The file service users. - public static string[] FileServiceUsers - { - get - { - try - { - return GetKey("/settings/webservices/fileServiceUsers").Split(','); - } - catch - { - return new string[0]; - } - } - } - - - /// - /// Gets the folders used by the file web service - /// - /// The file service folders. - public static string[] FileServiceFolders - { - get - { - try - { - return GetKey("/settings/webservices/fileServiceFolders").Split(','); - } - catch - { - return new string[0]; - } - } - } - - /// - /// Gets the member service users who have access to use the member web service - /// - /// The member service users. - public static string[] MemberServiceUsers - { - get - { - try - { - return GetKey("/settings/webservices/memberServiceUsers").Split(','); - } - catch - { - return new string[0]; - } - } - } - - /// - /// Gets the stylesheet service users who have access to use the stylesheet web service - /// - /// The stylesheet service users. - public static string[] StylesheetServiceUsers - { - get - { - try - { - return GetKey("/settings/webservices/stylesheetServiceUsers").Split(','); - } - catch - { - return new string[0]; - } - } - } - - /// - /// Gets the template service users who have access to use the template web service - /// - /// The template service users. - public static string[] TemplateServiceUsers - { - get - { - try - { - return GetKey("/settings/webservices/templateServiceUsers").Split(','); - } - catch - { - return new string[0]; - } - } - } - - /// - /// Gets the media service users who have access to use the media web service - /// - /// The media service users. - public static string[] MediaServiceUsers - { - get - { - try - { - return GetKey("/settings/webservices/mediaServiceUsers").Split(','); - } - catch - { - return new string[0]; - } - } - } - - - /// - /// Gets the maintenance service users who have access to use the maintance web service - /// - /// The maintenance service users. - public static string[] MaintenanceServiceUsers - { - get - { - try - { - return GetKey("/settings/webservices/maintenanceServiceUsers").Split(','); - } - catch - { - return new string[0]; - } - } - } - - #endregion - } - - #region Extensible settings - - /// - /// Resets settings that were set programmatically, to their initial values. - /// - /// To be used in unit tests. - internal static void Reset() - { - ResetInternal(); - - using (new WriteLock(SectionsLock)) - { - foreach (var section in Sections.Values) - section.ResetSection(); - } - } - - private static readonly ReaderWriterLockSlim SectionsLock = new ReaderWriterLockSlim(); - private static readonly Dictionary Sections = new Dictionary(); - - /// - /// Gets the specified UmbracoConfigurationSection. - /// - /// The type of the UmbracoConfigurationSectiont. - /// The UmbracoConfigurationSection of the specified type. - public static T For() - where T : UmbracoConfigurationSection, new() - { - var sectionType = typeof (T); - using (new WriteLock(SectionsLock)) - { - if (Sections.ContainsKey(sectionType)) return Sections[sectionType] as T; - - var attr = sectionType.GetCustomAttribute(false); - if (attr == null) - throw new InvalidOperationException(string.Format("Type \"{0}\" is missing attribute ConfigurationKeyAttribute.", sectionType.FullName)); - - var sectionKey = attr.ConfigurationKey; - if (string.IsNullOrWhiteSpace(sectionKey)) - throw new InvalidOperationException(string.Format("Type \"{0}\" ConfigurationKeyAttribute value is null or empty.", sectionType.FullName)); - - var section = GetSection(sectionType, sectionKey); - - Sections[sectionType] = section; - return section as T; - } - } - - private static UmbracoConfigurationSection GetSection(Type sectionType, string key) - { - if (!sectionType.Inherits()) - throw new ArgumentException(string.Format( - "Type \"{0}\" does not inherit from UmbracoConfigurationSection.", sectionType.FullName), "sectionType"); - - var section = ConfigurationManager.GetSection(key); - - if (section != null && section.GetType() != sectionType) - throw new InvalidCastException(string.Format("Section at key \"{0}\" is of type \"{1}\" and not \"{2}\".", - key, section.GetType().FullName, sectionType.FullName)); - - if (section != null) return section as UmbracoConfigurationSection; - - section = Activator.CreateInstance(sectionType) as UmbracoConfigurationSection; - - if (section == null) - throw new NullReferenceException(string.Format( - "Activator failed to create an instance of type \"{0}\" for key\"{1}\" and returned null.", - sectionType.FullName, key)); - - return section as UmbracoConfigurationSection; - } - - #endregion - } +using System; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Threading; +using System.Web; +using System.Web.Caching; +using System.Web.Security; +using System.Xml; +using System.Configuration; + +using System.Collections.Generic; +using Umbraco.Core.Logging; +using Umbraco.Core.CodeAnnotations; + + +namespace Umbraco.Core.Configuration +{ + //NOTE: Do not expose this class ever until we cleanup all configuration including removal of static classes, etc... + // we have this two tasks logged: + // http://issues.umbraco.org/issue/U4-58 + // http://issues.umbraco.org/issue/U4-115 + + //TODO: Re-enable logging !!!! + + //TODO: We need to convert this to a real section, it's currently using HttpRuntime.Cache to detect cahnges, this is real poor, especially in a console app + + /// + /// The UmbracoSettings Class contains general settings information for the entire Umbraco instance based on information from the /config/umbracoSettings.config file + /// + internal class LegacyUmbracoSettings + { + private static bool GetKeyValue(string key, bool defaultValue) + { + bool value; + string stringValue = GetKey(key); + + if (string.IsNullOrWhiteSpace(stringValue)) + return defaultValue; + if (bool.TryParse(stringValue, out value)) + return value; + return defaultValue; + } + + private static int GetKeyValue(string key, int defaultValue) + { + int value; + string stringValue = GetKey(key); + + if (string.IsNullOrWhiteSpace(stringValue)) + return defaultValue; + if (int.TryParse(stringValue, out value)) + return value; + return defaultValue; + } + + /// + /// Used in unit testing to reset all config items that were set with property setters (i.e. did not come from config) + /// + private static void ResetInternal() + { + _addTrailingSlash = null; + _forceSafeAliases = null; + _useLegacySchema = null; + _useDomainPrefixes = null; + _umbracoLibraryCacheDuration = null; + SettingsFilePath = null; + } + + internal const string TempFriendlyXmlChildContainerNodename = ""; // "children"; + + /// + /// Gets the umbraco settings document. + /// + /// The _umbraco settings. + internal static XmlDocument UmbracoSettingsXmlDoc + { + get + { + var us = (XmlDocument)HttpRuntime.Cache["umbracoSettingsFile"] ?? EnsureSettingsDocument(); + return us; + } + } + + private static string _path; + + /// + /// Gets/sets the settings file path, the setter can be used in unit tests + /// + internal static string SettingsFilePath + { + get { return _path ?? (_path = GlobalSettings.FullpathToRoot + Path.DirectorySeparatorChar + "config" + Path.DirectorySeparatorChar); } + set { _path = value; } + } + + internal const string Filename = "umbracoSettings.config"; + + internal static XmlDocument EnsureSettingsDocument() + { + var settingsFile = HttpRuntime.Cache["umbracoSettingsFile"]; + + // Check for language file in cache + if (settingsFile == null) + { + var temp = new XmlDocument(); + var settingsReader = new XmlTextReader(SettingsFilePath + Filename); + try + { + temp.Load(settingsReader); + HttpRuntime.Cache.Insert("umbracoSettingsFile", temp, + new CacheDependency(SettingsFilePath + Filename)); + } + catch (XmlException e) + { + throw new XmlException("Your umbracoSettings.config file fails to pass as valid XML. Refer to the InnerException for more information", e); + } + catch (Exception e) + { + LogHelper.Error("Error reading umbracoSettings file: " + e.ToString(), e); + } + settingsReader.Close(); + return temp; + } + else + return (XmlDocument)settingsFile; + } + + internal static void Save() + { + UmbracoSettingsXmlDoc.Save(SettingsFilePath + Filename); + } + + + /// + /// Selects a xml node in the umbraco settings config file. + /// + /// The xpath query to the specific node. + /// If found, it returns the specific configuration xml node. + internal static XmlNode GetKeyAsNode(string key) + { + if (key == null) + throw new ArgumentException("Key cannot be null"); + EnsureSettingsDocument(); + if (UmbracoSettingsXmlDoc == null || UmbracoSettingsXmlDoc.DocumentElement == null) + return null; + return UmbracoSettingsXmlDoc.DocumentElement.SelectSingleNode(key); + } + + /// + /// Gets the value of configuration xml node with the specified key. + /// + /// The key. + /// + internal static string GetKey(string key) + { + EnsureSettingsDocument(); + + string attrName = null; + var pos = key.IndexOf('@'); + if (pos > 0) + { + attrName = key.Substring(pos + 1); + key = key.Substring(0, pos - 1); + } + + var node = UmbracoSettingsXmlDoc.DocumentElement.SelectSingleNode(key); + if (node == null) + return string.Empty; + + if (pos < 0) + { + if (node.FirstChild == null || node.FirstChild.Value == null) + return string.Empty; + return node.FirstChild.Value; + } + else + { + var attr = node.Attributes[attrName]; + if (attr == null) + return string.Empty; + return attr.Value; + } + } + + /// + /// Gets a value indicating whether the media library will create new directories in the /media directory. + /// + /// + /// true if new directories are allowed otherwise, false. + /// + internal static bool UploadAllowDirectories + { + get { return bool.Parse(GetKey("/settings/content/UploadAllowDirectories")); } + } + + /// + /// THIS IS TEMPORARY until we fix up settings all together, this setting is actually not 'settable' but is + /// here for future purposes since we check for thsi settings in the module. + /// + internal static bool EnableBaseRestHandler + { + get { return true; } + } + + /// + /// THIS IS TEMPORARY until we fix up settings all together, this setting is actually not 'settable' but is + /// here for future purposes since we check for thsi settings in the module. + /// + internal static string BootSplashPage + { + get { return "~/config/splashes/booting.aspx"; } + } + + /// + /// Gets a value indicating whether logging is enabled in umbracoSettings.config (/settings/logging/enableLogging). + /// + /// true if logging is enabled; otherwise, false. + internal static bool EnableLogging + { + get + { + // We return true if no enable logging element is present in + // umbracoSettings (to enable default behaviour when upgrading) + var enableLogging = GetKey("/settings/logging/enableLogging"); + return String.IsNullOrEmpty(enableLogging) || bool.Parse(enableLogging); + } + } + + /// + /// Gets a value indicating whether logging happens async. + /// + /// true if async logging is enabled; otherwise, false. + internal static bool EnableAsyncLogging + { + get + { + string value = GetKey("/settings/logging/enableAsyncLogging"); + bool result; + if (!string.IsNullOrEmpty(value) && bool.TryParse(value, out result)) + return result; + return false; + } + } + + /// + /// Gets the assembly of an external logger that can be used to store log items in 3rd party systems + /// + internal static string ExternalLoggerAssembly + { + get + { + var value = GetKeyAsNode("/settings/logging/externalLogger"); + return value != null ? value.Attributes["assembly"].Value : ""; + } + } + + /// + /// Gets the type of an external logger that can be used to store log items in 3rd party systems + /// + internal static string ExternalLoggerType + { + get + { + var value = GetKeyAsNode("/settings/logging/externalLogger"); + return value != null ? value.Attributes["type"].Value : ""; + } + } + + /// + /// Long Audit Trail to external log too + /// + internal static bool ExternalLoggerLogAuditTrail + { + get + { + var value = GetKeyAsNode("/settings/logging/externalLogger"); + if (value != null) + { + var logAuditTrail = value.Attributes["logAuditTrail"].Value; + bool result; + if (!string.IsNullOrEmpty(logAuditTrail) && bool.TryParse(logAuditTrail, out result)) + return result; + } + return false; + } + } + + /// + /// Keep user alive as long as they have their browser open? Default is true + /// + internal static bool KeepUserLoggedIn + { + get + { + var value = GetKey("/settings/security/keepUserLoggedIn"); + bool result; + if (!string.IsNullOrEmpty(value) && bool.TryParse(value, out result)) + return result; + return true; + } + } + + internal static string AuthCookieName + { + get + { + var value = GetKey("/settings/security/authCookieName"); + if (string.IsNullOrEmpty(value) == false) + { + return value; + } + return "UMB_UCONTEXT"; + } + } + + internal static string AuthCookieDomain + { + get + { + var value = GetKey("/settings/security/authCookieDomain"); + if (string.IsNullOrEmpty(value) == false) + { + return value; + } + return FormsAuthentication.CookieDomain; + } + } + + /// + /// Enables the experimental canvas (live) editing on the frontend of the website + /// + internal static bool EnableCanvasEditing + { + get + { + var value = GetKey("/settings/content/EnableCanvasEditing"); + bool result; + if (!string.IsNullOrEmpty(value) && bool.TryParse(value, out result)) + return result; + return true; + } + } + + /// + /// Show disabled users in the tree in the Users section in the backoffice + /// + internal static bool HideDisabledUsersInBackoffice + { + get + { + string value = GetKey("/settings/security/hideDisabledUsersInBackoffice"); + bool result; + if (!string.IsNullOrEmpty(value) && bool.TryParse(value, out result)) + return result; + return false; + } + } + + /// + /// Gets a value indicating whether the logs will be auto cleaned + /// + /// true if logs are to be automatically cleaned; otherwise, false + internal static bool AutoCleanLogs + { + get + { + string value = GetKey("/settings/logging/autoCleanLogs"); + bool result; + if (!string.IsNullOrEmpty(value) && bool.TryParse(value, out result)) + return result; + return false; + } + } + + /// + /// Gets the value indicating the log cleaning frequency (in miliseconds) + /// + internal static int CleaningMiliseconds + { + get + { + string value = GetKey("/settings/logging/cleaningMiliseconds"); + int result; + if (!string.IsNullOrEmpty(value) && int.TryParse(value, out result)) + return result; + return -1; + } + } + + internal static int MaxLogAge + { + get + { + string value = GetKey("/settings/logging/maxLogAge"); + int result; + if (!string.IsNullOrEmpty(value) && int.TryParse(value, out result)) + return result; + return -1; + } + } + + /// + /// Gets the disabled log types. + /// + /// The disabled log types. + internal static XmlNode DisabledLogTypes + { + get { return GetKeyAsNode("/settings/logging/disabledLogTypes"); } + } + + /// + /// Gets the package server url. + /// + /// The package server url. + internal static string PackageServer + { + get { return "packages.umbraco.org"; } + } + + static bool? _useDomainPrefixes = null; + + /// + /// Gets a value indicating whether umbraco will use domain prefixes. + /// + /// true if umbraco will use domain prefixes; otherwise, false. + internal static bool UseDomainPrefixes + { + get + { + // default: false + return _useDomainPrefixes ?? GetKeyValue("/settings/requestHandler/useDomainPrefixes", false); + } + /*internal*/ set + { + // for unit tests only + _useDomainPrefixes = value; + } + } + + static bool? _addTrailingSlash = null; + + /// + /// This will add a trailing slash (/) to urls when in directory url mode + /// NOTICE: This will always return false if Directory Urls in not active + /// + internal static bool AddTrailingSlash + { + get + { + // default: false + return GlobalSettings.UseDirectoryUrls + && (_addTrailingSlash ?? GetKeyValue("/settings/requestHandler/addTrailingSlash", false)); + } + /*internal*/ set + { + // for unit tests only + _addTrailingSlash = value; + } + } + + /// + /// Gets a value indicating whether umbraco will use ASP.NET MasterPages for rendering instead of its propriatary templating system. + /// + /// true if umbraco will use ASP.NET MasterPages; otherwise, false. + internal static bool UseAspNetMasterPages + { + get + { + try + { + bool result; + if (bool.TryParse(GetKey("/settings/templates/useAspNetMasterPages"), out result)) + return result; + return false; + } + catch + { + return false; + } + } + } + + /// + /// Gets a value indicating whether umbraco will attempt to load any skins to override default template files + /// + /// true if umbraco will override templates with skins if present and configured false. + internal static bool EnableTemplateFolders + { + get + { + try + { + bool result; + if (bool.TryParse(GetKey("/settings/templates/enableTemplateFolders"), out result)) + return result; + return false; + } + catch + { + return false; + } + } + } + + //TODO: I"m not sure why we need this, need to ask Gareth what the deal is, pretty sure we can remove it or change it, seems like + // massive overkill. + + /// + /// razor DynamicNode typecasting detects XML and returns DynamicXml - Root elements that won't convert to DynamicXml + /// + internal static IEnumerable NotDynamicXmlDocumentElements + { + get + { + try + { + List items = new List(); + XmlNode root = GetKeyAsNode("/settings/scripting/razor/notDynamicXmlDocumentElements"); + foreach (XmlNode element in root.SelectNodes(".//element")) + { + items.Add(element.InnerText); + } + return items; + } + catch + { + return new List() { "p", "div" }; + } + } + } + + private static IEnumerable _razorDataTypeModelStaticMapping; + private static readonly ReaderWriterLockSlim Lock = new ReaderWriterLockSlim(); + + internal static IEnumerable RazorDataTypeModelStaticMapping + { + get + { + /* + + DigibizAdvancedMediaPicker.RazorModel.ModelBinder + DigibizAdvancedMediaPicker.RazorModel.ModelBinder + + */ + + using (var l = new UpgradeableReadLock(Lock)) + { + if (_razorDataTypeModelStaticMapping == null) + { + l.UpgradeToWriteLock(); + + List items = new List(); + XmlNode root = GetKeyAsNode("/settings/scripting/razor/dataTypeModelStaticMappings"); + if (root != null) + { + foreach (XmlNode element in root.SelectNodes(".//mapping")) + { + string propertyTypeAlias = null, nodeTypeAlias = null; + Guid? dataTypeGuid = null; + if (!string.IsNullOrEmpty(element.InnerText)) + { + if (element.Attributes["dataTypeGuid"] != null) + { + dataTypeGuid = (Guid?)new Guid(element.Attributes["dataTypeGuid"].Value); + } + if (element.Attributes["propertyTypeAlias"] != null && !string.IsNullOrEmpty(element.Attributes["propertyTypeAlias"].Value)) + { + propertyTypeAlias = element.Attributes["propertyTypeAlias"].Value; + } + if (element.Attributes["nodeTypeAlias"] != null && !string.IsNullOrEmpty(element.Attributes["nodeTypeAlias"].Value)) + { + nodeTypeAlias = element.Attributes["nodeTypeAlias"].Value; + } + items.Add(new RazorDataTypeModelStaticMappingItem() + { + DataTypeGuid = dataTypeGuid, + PropertyTypeAlias = propertyTypeAlias, + NodeTypeAlias = nodeTypeAlias, + TypeName = element.InnerText, + Raw = element.OuterXml + }); + } + } + } + + _razorDataTypeModelStaticMapping = items; + } + + return _razorDataTypeModelStaticMapping; + } + } + } + + /// + /// Gets a value indicating whether umbraco will clone XML cache on publish. + /// + /// + /// true if umbraco will clone XML cache on publish; otherwise, false. + /// + internal static bool CloneXmlCacheOnPublish + { + get + { + try + { + bool result; + if (bool.TryParse(GetKey("/settings/content/cloneXmlContent"), out result)) + return result; + return false; + } + catch + { + return false; + } + } + } + + /// + /// Gets a value indicating whether rich text editor content should be parsed by tidy. + /// + /// true if content is parsed; otherwise, false. + internal static bool TidyEditorContent + { + get { return bool.Parse(GetKey("/settings/content/TidyEditorContent")); } + } + + /// + /// Gets the encoding type for the tidyied content. + /// + /// The encoding type as string. + internal static string TidyCharEncoding + { + get + { + string encoding = GetKey("/settings/content/TidyCharEncoding"); + if (String.IsNullOrEmpty(encoding)) + { + encoding = "UTF8"; + } + return encoding; + } + } + + /// + /// Gets the property context help option, this can either be 'text', 'icon' or 'none' + /// + /// The property context help option. + internal static string PropertyContextHelpOption + { + get { return GetKey("/settings/content/PropertyContextHelpOption").ToLower(); } + } + + internal static string DefaultBackofficeProvider + { + get + { + string defaultProvider = GetKey("/settings/providers/users/DefaultBackofficeProvider"); + if (String.IsNullOrEmpty(defaultProvider)) + defaultProvider = "UsersMembershipProvider"; + + return defaultProvider; + } + } + + private static bool? _forceSafeAliases; + + /// + /// Whether to force safe aliases (no spaces, no special characters) at businesslogic level on contenttypes and propertytypes + /// + internal static bool ForceSafeAliases + { + get + { + // default: true + return _forceSafeAliases ?? GetKeyValue("/settings/content/ForceSafeAliases", true); + } + /*internal*/ set + { + // used for unit testing + _forceSafeAliases = value; + } + } + + /// + /// Gets a value indicating whether to try to skip IIS custom errors. + /// + [UmbracoWillObsolete("Use UmbracoSettings.For.TrySkipIisCustomErrors instead.")] + internal static bool TrySkipIisCustomErrors + { + get { return GetKeyValue("/settings/web.routing/@trySkipIisCustomErrors", false); } + } + + /// + /// Gets a value indicating whether internal redirect preserves the template. + /// + [UmbracoWillObsolete("Use UmbracoSettings.For.InternalRedirectPerservesTemplate instead.")] + internal static bool InternalRedirectPreservesTemplate + { + get { return GetKeyValue("/settings/web.routing/@internalRedirectPreservesTemplate", false); } + } + + /// + /// File types that will not be allowed to be uploaded via the content/media upload control + /// + public static IEnumerable DisallowedUploadFiles + { + get + { + var val = GetKey("/settings/content/disallowedUploadFiles"); + return val.Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries); + } + } + + /// + /// Gets the allowed image file types. + /// + /// The allowed image file types. + internal static string ImageFileTypes + { + get { return GetKey("/settings/content/imaging/imageFileTypes").ToLowerInvariant(); } + } + + /// + /// Gets the allowed script file types. + /// + /// The allowed script file types. + internal static string ScriptFileTypes + { + get { return GetKey("/settings/content/scripteditor/scriptFileTypes"); } + } + + private static int? _umbracoLibraryCacheDuration; + + /// + /// Gets the duration in seconds to cache queries to umbraco library member and media methods + /// Default is 1800 seconds (30 minutes) + /// + internal static int UmbracoLibraryCacheDuration + { + get + { + // default: 1800 + return _umbracoLibraryCacheDuration ?? GetKeyValue("/settings/content/UmbracoLibraryCacheDuration", 1800); + } + /*internal*/ set + { + // for unit tests only + _umbracoLibraryCacheDuration = value; + } + } + + /// + /// Gets the path to the scripts folder used by the script editor. + /// + /// The script folder path. + internal static string ScriptFolderPath + { + get { return GetKey("/settings/content/scripteditor/scriptFolderPath"); } + } + + /// + /// Enabled or disable the script/code editor + /// + internal static bool ScriptDisableEditor + { + get + { + string _tempValue = GetKey("/settings/content/scripteditor/scriptDisableEditor"); + if (_tempValue != String.Empty) + return bool.Parse(_tempValue); + else + return false; + } + } + + /// + /// Gets a value indicating whether umbraco will ensure unique node naming. + /// This will ensure that nodes cannot have the same url, but will add extra characters to a url. + /// ex: existingnodename.aspx would become existingnodename(1).aspx if a node with the same name is found + /// + /// true if umbraco ensures unique node naming; otherwise, false. + internal static bool EnsureUniqueNaming + { + get + { + try + { + return bool.Parse(GetKey("/settings/content/ensureUniqueNaming")); + } + catch + { + return false; + } + } + } + + /// + /// Gets the notification email sender. + /// + /// The notification email sender. + internal static string NotificationEmailSender + { + get { return GetKey("/settings/content/notifications/email"); } + } + + /// + /// Gets a value indicating whether notification-emails are HTML. + /// + /// + /// true if html notification-emails are disabled; otherwise, false. + /// + internal static bool NotificationDisableHtmlEmail + { + get + { + var tempValue = GetKey("/settings/content/notifications/disableHtmlEmail"); + return tempValue != String.Empty && bool.Parse(tempValue); + } + } + + /// + /// Gets the allowed attributes on images. + /// + /// The allowed attributes on images. + internal static string ImageAllowedAttributes + { + get { return GetKey("/settings/content/imaging/allowedAttributes"); } + } + + internal static XmlNode ImageAutoFillImageProperties + { + get { return GetKeyAsNode("/settings/content/imaging/autoFillImageProperties"); } + } + + /// + /// Gets the scheduled tasks as XML + /// + /// The scheduled tasks. + internal static XmlNode ScheduledTasks + { + get { return GetKeyAsNode("/settings/scheduledTasks"); } + } + + /// + /// Gets a list of characters that will be replaced when generating urls + /// + /// The URL replacement characters. + internal static XmlNode UrlReplaceCharacters + { + get { return GetKeyAsNode("/settings/requestHandler/urlReplacing"); } + } + + /// + /// Whether to replace double dashes from url (ie my--story----from--dash.aspx caused by multiple url replacement chars + /// + internal static bool RemoveDoubleDashesFromUrlReplacing + { + get + { + try + { + return bool.Parse(UrlReplaceCharacters.Attributes.GetNamedItem("removeDoubleDashes").Value); + } + catch + { + return false; + } + } + } + + /// + /// Gets a value indicating whether umbraco will use distributed calls. + /// This enables umbraco to share cache and content across multiple servers. + /// Used for load-balancing high-traffic sites. + /// + /// true if umbraco uses distributed calls; otherwise, false. + internal static bool UseDistributedCalls + { + get + { + try + { + return bool.Parse(GetKeyAsNode("/settings/distributedCall").Attributes.GetNamedItem("enable").Value); + } + catch + { + return false; + } + } + } + + + /// + /// Gets the ID of the user with access rights to perform the distributed calls. + /// + /// The distributed call user. + internal static int DistributedCallUser + { + get + { + try + { + return int.Parse(GetKey("/settings/distributedCall/user")); + } + catch + { + return -1; + } + } + } + + /// + /// Gets the html injected into a (x)html page if Umbraco is running in preview mode + /// + internal static string PreviewBadge + { + get + { + try + { + return GetKey("/settings/content/PreviewBadge"); + } + catch + { + return "In Preview Mode - click to end"; + } + } + } + + /// + /// Gets IP or hostnames of the distribution servers. + /// These servers will receive a call everytime content is created/deleted/removed + /// and update their content cache accordingly, ensuring a consistent cache on all servers + /// + /// The distribution servers. + internal static XmlNode DistributionServers + { + get + { + try + { + return GetKeyAsNode("/settings/distributedCall/servers"); + } + catch + { + return null; + } + } + } + + /// + /// Gets HelpPage configurations. + /// A help page configuration specify language, user type, application, application url and + /// the target help page url. + /// + internal static XmlNode HelpPages + { + get + { + try + { + return GetKeyAsNode("/settings/help"); + } + catch + { + return null; + } + } + } + + /// + /// Gets all repositories registered, and returns them as XmlNodes, containing name, alias and webservice url. + /// These repositories are used by the build-in package installer and uninstaller to install new packages and check for updates. + /// All repositories should have a unique alias. + /// All packages installed from a repository gets the repository alias included in the install information + /// + /// The repository servers. + internal static XmlNode Repositories + { + get + { + try + { + return GetKeyAsNode("/settings/repositories"); + } + catch + { + return null; + } + } + } + + /// + /// Gets a value indicating whether umbraco will use the viewstate mover module. + /// The viewstate mover will move all asp.net viewstate information to the bottom of the aspx page + /// to ensure that search engines will index text instead of javascript viewstate information. + /// + /// + /// true if umbraco will use the viewstate mover module; otherwise, false. + /// + internal static bool UseViewstateMoverModule + { + get + { + try + { + return + bool.Parse( + GetKeyAsNode("/settings/viewstateMoverModule").Attributes.GetNamedItem("enable").Value); + } + catch + { + return false; + } + } + } + + + /// + /// Tells us whether the Xml Content cache is disabled or not + /// Default is enabled + /// + internal static bool IsXmlContentCacheDisabled + { + get + { + try + { + bool xmlCacheEnabled; + string value = GetKey("/settings/content/XmlCacheEnabled"); + if (bool.TryParse(value, out xmlCacheEnabled)) + return !xmlCacheEnabled; + // Return default + return false; + } + catch + { + return false; + } + } + } + + /// + /// Check if there's changes to the umbraco.config xml file cache on disk on each request + /// Makes it possible to updates environments by syncing the umbraco.config file across instances + /// Relates to http://umbraco.codeplex.com/workitem/30722 + /// + internal static bool XmlContentCheckForDiskChanges + { + get + { + try + { + bool checkForDiskChanges; + string value = GetKey("/settings/content/XmlContentCheckForDiskChanges"); + if (bool.TryParse(value, out checkForDiskChanges)) + return checkForDiskChanges; + // Return default + return false; + } + catch + { + return false; + } + } + } + + /// + /// If this is enabled, all Umbraco objects will generate data in the preview table (cmsPreviewXml). + /// If disabled, only documents will generate data. + /// This feature is useful if anyone would like to see how data looked at a given time + /// + internal static bool EnableGlobalPreviewStorage + { + get + { + try + { + bool globalPreviewEnabled = false; + string value = GetKey("/settings/content/GlobalPreviewStorageEnabled"); + if (bool.TryParse(value, out globalPreviewEnabled)) + return !globalPreviewEnabled; + // Return default + return false; + } + catch + { + return false; + } + } + } + + private static bool? _useLegacySchema; + + /// + /// Whether to use the new 4.1 schema or the old legacy schema + /// + /// + /// true if yes, use the old node/data model; otherwise, false. + /// + internal static bool UseLegacyXmlSchema + { + get + { + // default: true + return _useLegacySchema ?? GetKeyValue("/settings/content/UseLegacyXmlSchema", false); + } + /*internal*/ set + { + // used for unit testing + _useLegacySchema = value; + } + } + + [Obsolete("This setting is not used anymore, the only file extensions that are supported are .cs and .vb files")] + internal static IEnumerable AppCodeFileExtensionsList + { + get + { + return (from XmlNode x in AppCodeFileExtensions + where !String.IsNullOrEmpty(x.InnerText) + select x.InnerText).ToList(); + } + } + + [Obsolete("This setting is not used anymore, the only file extensions that are supported are .cs and .vb files")] + internal static XmlNode AppCodeFileExtensions + { + get + { + XmlNode value = GetKeyAsNode("/settings/developer/appCodeFileExtensions"); + if (value != null) + { + return value; + } + + // default is .cs and .vb + value = UmbracoSettingsXmlDoc.CreateElement("appCodeFileExtensions"); + value.AppendChild(XmlHelper.AddTextNode(UmbracoSettingsXmlDoc, "ext", "cs")); + value.AppendChild(XmlHelper.AddTextNode(UmbracoSettingsXmlDoc, "ext", "vb")); + return value; + } + } + + /// + /// Tells us whether the Xml to always update disk cache, when changes are made to content + /// Default is enabled + /// + internal static bool ContinouslyUpdateXmlDiskCache + { + get + { + try + { + bool updateDiskCache; + string value = GetKey("/settings/content/ContinouslyUpdateXmlDiskCache"); + if (bool.TryParse(value, out updateDiskCache)) + return updateDiskCache; + // Return default + return false; + } + catch + { + return true; + } + } + } + + /// + /// Tells us whether to use a splash page while umbraco is initializing content. + /// If not, requests are queued while umbraco loads content. For very large sites (+10k nodes) it might be usefull to + /// have a splash page + /// Default is disabled + /// + internal static bool EnableSplashWhileLoading + { + get + { + try + { + bool updateDiskCache; + string value = GetKey("/settings/content/EnableSplashWhileLoading"); + if (bool.TryParse(value, out updateDiskCache)) + return updateDiskCache; + // Return default + return false; + } + catch + { + return false; + } + } + } + + private static bool? _resolveUrlsFromTextString; + internal static bool ResolveUrlsFromTextString + { + get + { + if (_resolveUrlsFromTextString == null) + { + try + { + bool enableDictionaryFallBack; + var value = GetKey("/settings/content/ResolveUrlsFromTextString"); + if (value != null) + if (bool.TryParse(value, out enableDictionaryFallBack)) + _resolveUrlsFromTextString = enableDictionaryFallBack; + } + catch (Exception ex) + { + Trace.WriteLine("Could not load /settings/content/ResolveUrlsFromTextString from umbracosettings.config:\r\n {0}", + ex.Message); + + // set url resolving to true (default (legacy) behavior) to ensure we don't keep writing to trace + _resolveUrlsFromTextString = true; + } + } + return _resolveUrlsFromTextString == true; + } + } + + + private static RenderingEngine? _defaultRenderingEngine; + + /// + /// Enables MVC, and at the same time disable webform masterpage templates. + /// This ensure views are automaticly created instead of masterpages. + /// Views are display in the tree instead of masterpages and a MVC template editor + /// is used instead of the masterpages editor + /// + /// true if umbraco defaults to using MVC views for templating, otherwise false. + internal static RenderingEngine DefaultRenderingEngine + { + get + { + if (_defaultRenderingEngine == null) + { + try + { + var engine = RenderingEngine.WebForms; + var value = GetKey("/settings/templates/defaultRenderingEngine"); + if (value != null) + { + Enum.TryParse(value, true, out engine); + } + _defaultRenderingEngine = engine; + } + catch (Exception ex) + { + LogHelper.Error("Could not load /settings/templates/defaultRenderingEngine from umbracosettings.config", ex); + _defaultRenderingEngine = RenderingEngine.WebForms; + } + } + return _defaultRenderingEngine.Value; + } + //internal set + //{ + // _defaultRenderingEngine = value; + // var node = UmbracoSettingsXmlDoc.DocumentElement.SelectSingleNode("/settings/templates/defaultRenderingEngine"); + // node.InnerText = value.ToString(); + //} + } + + private static MacroErrorBehaviour? _macroErrorBehaviour; + + /// + /// This configuration setting defines how to handle macro errors: + /// - Inline - Show error within macro as text (default and current Umbraco 'normal' behavior) + /// - Silent - Suppress error and hide macro + /// - Throw - Throw an exception and invoke the global error handler (if one is defined, if not you'll get a YSOD) + /// + /// MacroErrorBehaviour enum defining how to handle macro errors. + internal static MacroErrorBehaviour MacroErrorBehaviour + { + get + { + if (_macroErrorBehaviour == null) + { + try + { + var behaviour = MacroErrorBehaviour.Inline; + var value = GetKey("/settings/content/MacroErrors"); + if (value != null) + { + Enum.TryParse(value, true, out behaviour); + } + _macroErrorBehaviour = behaviour; + } + catch (Exception ex) + { + LogHelper.Error("Could not load /settings/content/MacroErrors from umbracosettings.config", ex); + _macroErrorBehaviour = MacroErrorBehaviour.Inline; + } + } + return _macroErrorBehaviour.Value; + } + } + + private static IconPickerBehaviour? _iconPickerBehaviour; + + /// + /// This configuration setting defines how to show icons in the document type editor. + /// - ShowDuplicates - Show duplicates in files and sprites. (default and current Umbraco 'normal' behaviour) + /// - HideSpriteDuplicates - Show files on disk and hide duplicates from the sprite + /// - HideFileDuplicates - Show files in the sprite and hide duplicates on disk + /// + /// MacroErrorBehaviour enum defining how to show icons in the document type editor. + internal static IconPickerBehaviour IconPickerBehaviour + { + get + { + if (_iconPickerBehaviour == null) + { + try + { + var behaviour = IconPickerBehaviour.ShowDuplicates; + var value = GetKey("/settings/content/DocumentTypeIconList"); + if (value != null) + { + Enum.TryParse(value, true, out behaviour); + } + _iconPickerBehaviour = behaviour; + } + catch (Exception ex) + { + LogHelper.Error("Could not load /settings/content/DocumentTypeIconList from umbracosettings.config", ex); + _iconPickerBehaviour = IconPickerBehaviour.ShowDuplicates; + } + } + return _iconPickerBehaviour.Value; + } + } + + /// + /// Gets the default document type property used when adding new properties through the back-office + /// + /// Configured text for the default document type property + /// If undefined, 'Textstring' is the default + public static string DefaultDocumentTypeProperty + { + get + { + var defaultDocumentTypeProperty = GetKey("/settings/content/defaultDocumentTypeProperty"); + if (string.IsNullOrEmpty(defaultDocumentTypeProperty)) + { + defaultDocumentTypeProperty = "Textstring"; + } + + return defaultDocumentTypeProperty; + } + } + + /// + /// Configuration regarding webservices + /// + /// Put in seperate class for more logik/seperation + internal class WebServices + { + /// + /// Gets a value indicating whether this is enabled. + /// + /// true if enabled; otherwise, false. + public static bool Enabled + { + get + { + try + { + return + bool.Parse(GetKeyAsNode("/settings/webservices").Attributes.GetNamedItem("enabled").Value); + } + catch + { + return false; + } + } + } + + #region "Webservice configuration" + + /// + /// Gets the document service users who have access to use the document web service + /// + /// The document service users. + public static string[] DocumentServiceUsers + { + get + { + try + { + return GetKey("/settings/webservices/documentServiceUsers").Split(','); + } + catch + { + return new string[0]; + } + } + } + + /// + /// Gets the file service users who have access to use the file web service + /// + /// The file service users. + public static string[] FileServiceUsers + { + get + { + try + { + return GetKey("/settings/webservices/fileServiceUsers").Split(','); + } + catch + { + return new string[0]; + } + } + } + + + /// + /// Gets the folders used by the file web service + /// + /// The file service folders. + public static string[] FileServiceFolders + { + get + { + try + { + return GetKey("/settings/webservices/fileServiceFolders").Split(','); + } + catch + { + return new string[0]; + } + } + } + + /// + /// Gets the member service users who have access to use the member web service + /// + /// The member service users. + public static string[] MemberServiceUsers + { + get + { + try + { + return GetKey("/settings/webservices/memberServiceUsers").Split(','); + } + catch + { + return new string[0]; + } + } + } + + /// + /// Gets the stylesheet service users who have access to use the stylesheet web service + /// + /// The stylesheet service users. + public static string[] StylesheetServiceUsers + { + get + { + try + { + return GetKey("/settings/webservices/stylesheetServiceUsers").Split(','); + } + catch + { + return new string[0]; + } + } + } + + /// + /// Gets the template service users who have access to use the template web service + /// + /// The template service users. + public static string[] TemplateServiceUsers + { + get + { + try + { + return GetKey("/settings/webservices/templateServiceUsers").Split(','); + } + catch + { + return new string[0]; + } + } + } + + /// + /// Gets the media service users who have access to use the media web service + /// + /// The media service users. + public static string[] MediaServiceUsers + { + get + { + try + { + return GetKey("/settings/webservices/mediaServiceUsers").Split(','); + } + catch + { + return new string[0]; + } + } + } + + + /// + /// Gets the maintenance service users who have access to use the maintance web service + /// + /// The maintenance service users. + public static string[] MaintenanceServiceUsers + { + get + { + try + { + return GetKey("/settings/webservices/maintenanceServiceUsers").Split(','); + } + catch + { + return new string[0]; + } + } + } + + #endregion + } + + #region Extensible settings + + /// + /// Resets settings that were set programmatically, to their initial values. + /// + /// To be used in unit tests. + internal static void Reset() + { + ResetInternal(); + + using (new WriteLock(SectionsLock)) + { + foreach (var section in Sections.Values) + section.ResetSection(); + } + } + + private static readonly ReaderWriterLockSlim SectionsLock = new ReaderWriterLockSlim(); + private static readonly Dictionary Sections = new Dictionary(); + + /// + /// Gets the specified UmbracoConfigurationSection. + /// + /// The type of the UmbracoConfigurationSectiont. + /// The UmbracoConfigurationSection of the specified type. + public static T For() + where T : UmbracoConfigurationSection, new() + { + var sectionType = typeof (T); + using (new WriteLock(SectionsLock)) + { + if (Sections.ContainsKey(sectionType)) return Sections[sectionType] as T; + + var attr = sectionType.GetCustomAttribute(false); + if (attr == null) + throw new InvalidOperationException(string.Format("Type \"{0}\" is missing attribute ConfigurationKeyAttribute.", sectionType.FullName)); + + var sectionKey = attr.ConfigurationKey; + if (string.IsNullOrWhiteSpace(sectionKey)) + throw new InvalidOperationException(string.Format("Type \"{0}\" ConfigurationKeyAttribute value is null or empty.", sectionType.FullName)); + + var section = GetSection(sectionType, sectionKey); + + Sections[sectionType] = section; + return section as T; + } + } + + private static UmbracoConfigurationSection GetSection(Type sectionType, string key) + { + if (!sectionType.Inherits()) + throw new ArgumentException(string.Format( + "Type \"{0}\" does not inherit from UmbracoConfigurationSection.", sectionType.FullName), "sectionType"); + + var section = ConfigurationManager.GetSection(key); + + if (section != null && section.GetType() != sectionType) + throw new InvalidCastException(string.Format("Section at key \"{0}\" is of type \"{1}\" and not \"{2}\".", + key, section.GetType().FullName, sectionType.FullName)); + + if (section != null) return section as UmbracoConfigurationSection; + + section = Activator.CreateInstance(sectionType) as UmbracoConfigurationSection; + + if (section == null) + throw new NullReferenceException(string.Format( + "Activator failed to create an instance of type \"{0}\" for key\"{1}\" and returned null.", + sectionType.FullName, key)); + + return section as UmbracoConfigurationSection; + } + + #endregion + } } \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/AppCodeFileExtensionsCollection.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/AppCodeFileExtensionsCollection.cs new file mode 100644 index 0000000000..ab4e51a946 --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/AppCodeFileExtensionsCollection.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; +using System.Configuration; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + internal class AppCodeFileExtensionsCollection : ConfigurationElementCollection, IEnumerable + { + protected override ConfigurationElement CreateNewElement() + { + return new FileExtensionElement(); + } + + protected override object GetElementKey(ConfigurationElement element) + { + return ((FileExtensionElement)element).Value; + } + + IEnumerator IEnumerable.GetEnumerator() + { + for (var i = 0; i < Count; i++) + { + yield return BaseGet(i) as FileExtensionElement; + } + } + + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/AppCodeFileExtensionsElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/AppCodeFileExtensionsElement.cs new file mode 100644 index 0000000000..707b83d638 --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/AppCodeFileExtensionsElement.cs @@ -0,0 +1,14 @@ +using System.Configuration; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + internal class AppCodeFileExtensionsElement : ConfigurationElement + { + [ConfigurationCollection(typeof(AppCodeFileExtensionsCollection), AddItemName = "ext")] + [ConfigurationProperty("", IsDefaultCollection = true)] + public AppCodeFileExtensionsCollection AppCodeFileExtensionsCollection + { + get { return (AppCodeFileExtensionsCollection)base[""]; } + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/CharCollection.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/CharCollection.cs new file mode 100644 index 0000000000..bdc69754c3 --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/CharCollection.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; +using System.Configuration; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + internal class CharCollection : ConfigurationElementCollection, IEnumerable + { + protected override ConfigurationElement CreateNewElement() + { + return new CharElement(); + } + + protected override object GetElementKey(ConfigurationElement element) + { + return ((CharElement)element).Char; + } + + IEnumerator IEnumerable.GetEnumerator() + { + for (var i = 0; i < Count; i++) + { + yield return BaseGet(i) as CharElement; + } + } + + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/CharElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/CharElement.cs new file mode 100644 index 0000000000..e94f015974 --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/CharElement.cs @@ -0,0 +1,10 @@ +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + internal class CharElement : InnerTextConfigurationElement + { + internal string Char + { + get { return RawXml.Attribute("org").Value; } + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/CommaDelimitedConfigurationElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/CommaDelimitedConfigurationElement.cs new file mode 100644 index 0000000000..514a0ab37a --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/CommaDelimitedConfigurationElement.cs @@ -0,0 +1,70 @@ +using System.Collections; +using System.Collections.Generic; +using System.Collections.Specialized; +using System.Configuration; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + /// + /// Defines a configuration section that contains inner text that is comma delimited + /// + internal class CommaDelimitedConfigurationElement : InnerTextConfigurationElement, IEnumerable + { + public override CommaDelimitedStringCollection Value + { + get + { + var converter = new CommaDelimitedStringCollectionConverter(); + return (CommaDelimitedStringCollection) converter.ConvertFrom(RawValue); + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return new InnerEnumerator(Value.GetEnumerator()); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return new InnerEnumerator(Value.GetEnumerator()); + } + + /// + /// A wrapper for StringEnumerator since it doesn't explicitly implement IEnumerable + /// + private class InnerEnumerator : IEnumerator + { + private readonly StringEnumerator _stringEnumerator; + + public InnerEnumerator(StringEnumerator stringEnumerator) + { + _stringEnumerator = stringEnumerator; + } + + public bool MoveNext() + { + return _stringEnumerator.MoveNext(); + } + + public void Reset() + { + _stringEnumerator.Reset(); + } + + string IEnumerator.Current + { + get { return _stringEnumerator.Current; } + } + + public object Current + { + get { return _stringEnumerator.Current; } + } + + public void Dispose() + { + _stringEnumerator.DisposeIfDisposable(); + } + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/ContentElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentElement.cs new file mode 100644 index 0000000000..aa36f3e670 --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentElement.cs @@ -0,0 +1,193 @@ +using System.Configuration; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + internal class ContentElement : ConfigurationElement + { + [ConfigurationProperty("imaging")] + internal ContentImagingElement Imaging + { + get { return (ContentImagingElement)this["imaging"]; } + } + + [ConfigurationProperty("scripteditor")] + internal ContentScriptEditorElement ScriptEditor + { + get { return (ContentScriptEditorElement)this["scripteditor"]; } + } + + [ConfigurationProperty("EnableCanvasEditing")] + internal InnerTextConfigurationElement EnableCanvasEditing + { + get + { + return new OptionalInnerTextConfigurationElement( + (InnerTextConfigurationElement)this["EnableCanvasEditing"], + //set the default + false); + } + } + + [ConfigurationProperty("ResolveUrlsFromTextString")] + internal InnerTextConfigurationElement ResolveUrlsFromTextString + { + get + { + return new OptionalInnerTextConfigurationElement( + (InnerTextConfigurationElement)this["ResolveUrlsFromTextString"], + //set the default + true); + } + } + + [ConfigurationProperty("UploadAllowDirectories")] + internal InnerTextConfigurationElement UploadAllowDirectories + { + get { return (InnerTextConfigurationElement)this["UploadAllowDirectories"]; } + } + + [ConfigurationProperty("errors")] + public ContentErrorsElement Errors + { + get { return (ContentErrorsElement)base["errors"]; } + } + + [ConfigurationProperty("notifications")] + public NotificationsElement Notifications + { + get { return (NotificationsElement)base["notifications"]; } + } + + [ConfigurationProperty("ensureUniqueNaming")] + public InnerTextConfigurationElement EnsureUniqueNaming + { + get { return (InnerTextConfigurationElement)base["ensureUniqueNaming"]; } + } + + [ConfigurationProperty("TidyEditorContent")] + public InnerTextConfigurationElement TidyEditorContent + { + get { return (InnerTextConfigurationElement)base["TidyEditorContent"]; } + } + + [ConfigurationProperty("TidyCharEncoding")] + public InnerTextConfigurationElement TidyCharEncoding + { + get + { + return new OptionalInnerTextConfigurationElement( + (InnerTextConfigurationElement)this["TidyCharEncoding"], + //set the default + "Raw"); + } + } + + [ConfigurationProperty("XmlCacheEnabled")] + public InnerTextConfigurationElement XmlCacheEnabled + { + get { return (InnerTextConfigurationElement)base["XmlCacheEnabled"]; } + } + + [ConfigurationProperty("ContinouslyUpdateXmlDiskCache")] + public InnerTextConfigurationElement ContinouslyUpdateXmlDiskCache + { + get { return (InnerTextConfigurationElement)base["ContinouslyUpdateXmlDiskCache"]; } + } + + [ConfigurationProperty("XmlContentCheckForDiskChanges")] + public InnerTextConfigurationElement XmlContentCheckForDiskChanges + { + get { return (InnerTextConfigurationElement)base["XmlContentCheckForDiskChanges"]; } + } + + [ConfigurationProperty("EnableSplashWhileLoading")] + public InnerTextConfigurationElement EnableSplashWhileLoading + { + get { return (InnerTextConfigurationElement)base["EnableSplashWhileLoading"]; } + } + + [ConfigurationProperty("PropertyContextHelpOption")] + public InnerTextConfigurationElement PropertyContextHelpOption + { + get { return (InnerTextConfigurationElement)base["PropertyContextHelpOption"]; } + } + + [ConfigurationProperty("UseLegacyXmlSchema")] + public InnerTextConfigurationElement UseLegacyXmlSchema + { + get { return (InnerTextConfigurationElement)base["UseLegacyXmlSchema"]; } + } + + [ConfigurationProperty("ForceSafeAliases")] + public InnerTextConfigurationElement ForceSafeAliases + { + get { return (InnerTextConfigurationElement)base["ForceSafeAliases"]; } + } + + [ConfigurationProperty("PreviewBadge")] + public InnerTextConfigurationElement PreviewBadge + { + get { return (InnerTextConfigurationElement)base["PreviewBadge"]; } + } + + [ConfigurationProperty("UmbracoLibraryCacheDuration")] + public InnerTextConfigurationElement UmbracoLibraryCacheDuration + { + get { return (InnerTextConfigurationElement)base["UmbracoLibraryCacheDuration"]; } + } + + [ConfigurationProperty("MacroErrors")] + public InnerTextConfigurationElement MacroErrors + { + get { return (InnerTextConfigurationElement)base["MacroErrors"]; } + } + + [ConfigurationProperty("DocumentTypeIconList")] + public InnerTextConfigurationElement DocumentTypeIconList + { + get { return (InnerTextConfigurationElement)base["DocumentTypeIconList"]; } + } + + [ConfigurationProperty("disallowedUploadFiles")] + public CommaDelimitedConfigurationElement DisallowedUploadFiles + { + get { return (CommaDelimitedConfigurationElement)base["disallowedUploadFiles"]; } + } + + [ConfigurationProperty("cloneXmlContent")] + internal InnerTextConfigurationElement CloneXmlContent + { + get + { + return new OptionalInnerTextConfigurationElement( + (InnerTextConfigurationElement)this["cloneXmlContent"], + //set the default + true); + } + } + + [ConfigurationProperty("GlobalPreviewStorageEnabled")] + internal InnerTextConfigurationElement GlobalPreviewStorageEnabled + { + get + { + return new OptionalInnerTextConfigurationElement( + (InnerTextConfigurationElement)this["GlobalPreviewStorageEnabled"], + //set the default + false); + } + } + + [ConfigurationProperty("defaultDocumentTypeProperty")] + internal InnerTextConfigurationElement DefaultDocumentTypeProperty + { + get + { + return new OptionalInnerTextConfigurationElement( + (InnerTextConfigurationElement)this["defaultDocumentTypeProperty"], + //set the default + "Textstring"); + } + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/ContentError404Collection.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentError404Collection.cs new file mode 100644 index 0000000000..5d9591997f --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentError404Collection.cs @@ -0,0 +1,37 @@ +using System.Collections.Generic; +using System.Configuration; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + internal class ContentError404Collection : ConfigurationElementCollection, IEnumerable + { + internal void Add(ContentErrorPageElement element) + { + BaseAdd(element); + } + + protected override ConfigurationElement CreateNewElement() + { + return new ContentErrorPageElement(); + } + + protected override object GetElementKey(ConfigurationElement element) + { + return ((ContentErrorPageElement)element).Culture + + ((ContentErrorPageElement)element).Value; + } + + IEnumerator IEnumerable.GetEnumerator() + { + for (var i = 0; i < Count; i++) + { + yield return BaseGet(i) as ContentErrorPageElement; + } + } + + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/ContentErrorPageElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentErrorPageElement.cs new file mode 100644 index 0000000000..7054c90194 --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentErrorPageElement.cs @@ -0,0 +1,23 @@ +using System.Xml.Linq; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + internal class ContentErrorPageElement : InnerTextConfigurationElement + { + public ContentErrorPageElement(XElement rawXml) + : base(rawXml) + { + } + + public ContentErrorPageElement() + { + + } + + internal string Culture + { + get { return (string) RawXml.Attribute("culture"); } + set { RawXml.Attribute("culture").Value = value; } + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/ContentErrorsElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentErrorsElement.cs new file mode 100644 index 0000000000..5b45df1608 --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentErrorsElement.cs @@ -0,0 +1,43 @@ +using System.Linq; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + internal class ContentErrorsElement : RawXmlConfigurationElement + { + + public ContentError404Collection Error404Collection + { + get + { + var result = new ContentError404Collection(); + if (RawXml != null) + { + var e404 = RawXml.Elements("error404").First(); + var ePages = e404.Elements("errorPage").ToArray(); + if (ePages.Any()) + { + //there are multiple + foreach (var e in ePages) + { + result.Add(new ContentErrorPageElement(e) + { + Culture = (string)e.Attribute("culture"), + RawValue = e.Value + }); + } + } + else + { + //there's only one defined + result.Add(new ContentErrorPageElement(e404) + { + RawValue = e404.Value + }); + } + } + return result; + } + } + + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/ContentImagingAutoFillPropertiesCollection.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentImagingAutoFillPropertiesCollection.cs new file mode 100644 index 0000000000..b77d85e585 --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentImagingAutoFillPropertiesCollection.cs @@ -0,0 +1,33 @@ +using System.Collections.Generic; +using System.Configuration; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + internal class ContentImagingAutoFillPropertiesCollection : ConfigurationElementCollection, IEnumerable + { + + protected override ConfigurationElement CreateNewElement() + { + return new ContentImagingAutoFillUploadFieldElement(); + } + + protected override object GetElementKey(ConfigurationElement element) + { + return ((ContentImagingAutoFillUploadFieldElement)element).Alias; + } + + + IEnumerator IEnumerable.GetEnumerator() + { + for (var i = 0; i < Count; i++) + { + yield return BaseGet(i) as ContentImagingAutoFillUploadFieldElement; + } + } + + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/ContentImagingAutoFillUploadFieldElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentImagingAutoFillUploadFieldElement.cs new file mode 100644 index 0000000000..9ec8ff21c1 --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentImagingAutoFillUploadFieldElement.cs @@ -0,0 +1,37 @@ +using System.Configuration; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + internal class ContentImagingAutoFillUploadFieldElement : ConfigurationElement + { + [ConfigurationProperty("alias", IsKey = true)] + internal string Alias + { + get { return (string)this["alias"]; } + } + + [ConfigurationProperty("widthFieldAlias")] + internal InnerTextConfigurationElement WidthFieldAlias + { + get { return (InnerTextConfigurationElement)this["widthFieldAlias"]; } + } + + [ConfigurationProperty("heightFieldAlias")] + internal InnerTextConfigurationElement HeightFieldAlias + { + get { return (InnerTextConfigurationElement)this["heightFieldAlias"]; } + } + + [ConfigurationProperty("lengthFieldAlias")] + internal InnerTextConfigurationElement LengthFieldAlias + { + get { return (InnerTextConfigurationElement)this["lengthFieldAlias"]; } + } + + [ConfigurationProperty("extensionFieldAlias")] + internal InnerTextConfigurationElement ExtensionFieldAlias + { + get { return (InnerTextConfigurationElement)this["extensionFieldAlias"]; } + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/ContentImagingElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentImagingElement.cs new file mode 100644 index 0000000000..6b639f81b6 --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentImagingElement.cs @@ -0,0 +1,27 @@ +using System.Configuration; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + internal class ContentImagingElement : ConfigurationElement + { + [ConfigurationProperty("imageFileTypes")] + internal CommaDelimitedConfigurationElement ImageFileTypes + { + get { return (CommaDelimitedConfigurationElement)this["imageFileTypes"]; } + } + + [ConfigurationProperty("allowedAttributes")] + internal CommaDelimitedConfigurationElement AllowedAttributes + { + get { return (CommaDelimitedConfigurationElement)this["allowedAttributes"]; } + } + + [ConfigurationCollection(typeof(ContentImagingAutoFillPropertiesCollection), AddItemName = "uploadField")] + [ConfigurationProperty("autoFillImageProperties", IsDefaultCollection = true)] + public ContentImagingAutoFillPropertiesCollection ImageAutoFillProperties + { + get { return (ContentImagingAutoFillPropertiesCollection)base["autoFillImageProperties"]; } + } + + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/ContentScriptEditorElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentScriptEditorElement.cs new file mode 100644 index 0000000000..0ef94906b2 --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/ContentScriptEditorElement.cs @@ -0,0 +1,25 @@ +using System.Configuration; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + internal class ContentScriptEditorElement : ConfigurationElement + { + [ConfigurationProperty("scriptFolderPath")] + internal InnerTextConfigurationElement ScriptFolderPath + { + get { return (InnerTextConfigurationElement)this["scriptFolderPath"]; } + } + + [ConfigurationProperty("scriptFileTypes")] + internal CommaDelimitedConfigurationElement ScriptFileTypes + { + get { return (CommaDelimitedConfigurationElement)this["scriptFileTypes"]; } + } + + [ConfigurationProperty("scriptDisableEditor")] + internal InnerTextConfigurationElement DisableScriptEditor + { + get { return (InnerTextConfigurationElement)this["scriptDisableEditor"]; } + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/CustomBooleanTypeConverter.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/CustomBooleanTypeConverter.cs new file mode 100644 index 0000000000..b066b4a876 --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/CustomBooleanTypeConverter.cs @@ -0,0 +1,32 @@ +using System; +using System.ComponentModel; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + /// + /// Allows for converting string representations of 0 and 1 to boolean + /// + internal class CustomBooleanTypeConverter : BooleanConverter + { + public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) + { + if (sourceType == typeof(string)) + { + return true; + } + return base.CanConvertFrom(context, sourceType); + } + + public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value) + { + if (value is string) + { + var str = (string)value; + if (str == "1") return true; + if (str == "0" || str == "") return false; + } + + return base.ConvertFrom(context, culture, value); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/DeveloperElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/DeveloperElement.cs new file mode 100644 index 0000000000..b18375cbd7 --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/DeveloperElement.cs @@ -0,0 +1,13 @@ +using System.Configuration; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + internal class DeveloperElement : ConfigurationElement + { + [ConfigurationProperty("appCodeFileExtensions")] + internal AppCodeFileExtensionsElement AppCodeFileExtensions + { + get { return (AppCodeFileExtensionsElement)this["appCodeFileExtensions"]; } + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/DisabledLogTypesCollection.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/DisabledLogTypesCollection.cs new file mode 100644 index 0000000000..545ee70622 --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/DisabledLogTypesCollection.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; +using System.Configuration; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + internal class DisabledLogTypesCollection : ConfigurationElementCollection, IEnumerable + { + protected override ConfigurationElement CreateNewElement() + { + return new LogTypeElement(); + } + + protected override object GetElementKey(ConfigurationElement element) + { + return ((LogTypeElement)element).Value; + } + + IEnumerator IEnumerable.GetEnumerator() + { + for (var i = 0; i < Count; i++) + { + yield return BaseGet(i) as LogTypeElement; + } + } + + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/DistributedCallElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/DistributedCallElement.cs new file mode 100644 index 0000000000..2295ffdc94 --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/DistributedCallElement.cs @@ -0,0 +1,26 @@ +using System.Configuration; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + internal class DistributedCallElement : ConfigurationElement + { + [ConfigurationProperty("enable")] + public bool Enabled + { + get { return (bool)base["enable"]; } + } + + [ConfigurationProperty("user")] + internal InnerTextConfigurationElement UserId + { + get { return (InnerTextConfigurationElement)this["user"]; } + } + + [ConfigurationCollection(typeof(ServerCollection), AddItemName = "server")] + [ConfigurationProperty("servers", IsDefaultCollection = true)] + public ServerCollection Servers + { + get { return (ServerCollection)base["servers"]; } + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/ExternalLoggerElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/ExternalLoggerElement.cs new file mode 100644 index 0000000000..231941b49f --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/ExternalLoggerElement.cs @@ -0,0 +1,25 @@ +using System.Configuration; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + internal class ExternalLoggerElement : ConfigurationElement + { + [ConfigurationProperty("assembly")] + internal string Assembly + { + get { return (string)base["assembly"]; } + } + + [ConfigurationProperty("type")] + internal string Type + { + get { return (string)base["type"]; } + } + + [ConfigurationProperty("logAuditTrail")] + internal bool LogAuditTrail + { + get { return (bool)base["logAuditTrail"]; } + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/FileExtensionElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/FileExtensionElement.cs new file mode 100644 index 0000000000..85249c3718 --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/FileExtensionElement.cs @@ -0,0 +1,7 @@ +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + internal class FileExtensionElement : InnerTextConfigurationElement + { + + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/HelpElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/HelpElement.cs new file mode 100644 index 0000000000..d6b448555a --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/HelpElement.cs @@ -0,0 +1,20 @@ +using System.Configuration; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + internal class HelpElement : ConfigurationElement + { + [ConfigurationProperty("defaultUrl")] + public string DefaultUrl + { + get { return (string) base["defaultUrl"]; } + } + + [ConfigurationCollection(typeof (LinksCollection), AddItemName = "link")] + [ConfigurationProperty("", IsDefaultCollection = true)] + public LinksCollection Links + { + get { return (LinksCollection) base[""]; } + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/InnerTextConfigurationElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/InnerTextConfigurationElement.cs new file mode 100644 index 0000000000..e074d181cb --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/InnerTextConfigurationElement.cs @@ -0,0 +1,69 @@ +using System; +using System.Xml; +using System.Xml.Linq; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + /// + /// A full config section is required for any full element and we have some elements that are defined like this: + /// {element}MyValue{/element} instead of as attribute values. + /// + /// + internal class InnerTextConfigurationElement : RawXmlConfigurationElement + { + public InnerTextConfigurationElement() + { + } + + public InnerTextConfigurationElement(XElement rawXml) : base(rawXml) + { + } + + protected override void DeserializeElement(XmlReader reader, bool serializeCollectionKey) + { + base.DeserializeElement(reader, serializeCollectionKey); + //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 = reader.ReadElementContentAsString(); + } + + public virtual T Value + { + get + { + var converted = RawValue.TryConvertTo(); + if (converted.Success == false) + throw new InvalidCastException("Could not convert value " + RawValue + " to type " + typeof(T)); + return converted.Result; + } + } + + /// + /// Exposes the raw string value + /// + internal string RawValue { get; set; } + + /// + /// Implicit operator so we don't need to use the 'Value' property explicitly + /// + /// + /// + public static implicit operator T(InnerTextConfigurationElement m) + { + return m.Value; + } + + /// + /// Return the string value of Value + /// + /// + public override string ToString() + { + return string.Format("{0}", Value); + } + + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/LinkElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/LinkElement.cs new file mode 100644 index 0000000000..f0c1e40451 --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/LinkElement.cs @@ -0,0 +1,37 @@ +using System.Configuration; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + internal class LinkElement : ConfigurationElement + { + [ConfigurationProperty("application")] + internal string Application + { + get { return (string)base["application"]; } + } + + [ConfigurationProperty("applicationUrl")] + internal string ApplicationUrl + { + get { return (string)base["applicationUrl"]; } + } + + [ConfigurationProperty("language")] + internal string Language + { + get { return (string)base["language"]; } + } + + [ConfigurationProperty("userType")] + internal string UserType + { + get { return (string)base["userType"]; } + } + + [ConfigurationProperty("helpUrl")] + internal string HelpUrl + { + get { return (string)base["helpUrl"]; } + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/LinksCollection.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/LinksCollection.cs new file mode 100644 index 0000000000..94d399b97e --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/LinksCollection.cs @@ -0,0 +1,34 @@ +using System.Collections.Generic; +using System.Configuration; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + internal class LinksCollection : ConfigurationElementCollection, IEnumerable + { + protected override ConfigurationElement CreateNewElement() + { + return new LinkElement(); + } + + protected override object GetElementKey(ConfigurationElement element) + { + return ((LinkElement)element).Application + + ((LinkElement)element).ApplicationUrl + + ((LinkElement)element).Language + + ((LinkElement)element).UserType; + } + + IEnumerator IEnumerable.GetEnumerator() + { + for (var i = 0; i < Count; i++) + { + yield return BaseGet(i) as LinkElement; + } + } + + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/LogTypeElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/LogTypeElement.cs new file mode 100644 index 0000000000..9dbee14e07 --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/LogTypeElement.cs @@ -0,0 +1,7 @@ +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + internal class LogTypeElement : InnerTextConfigurationElement + { + + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/LoggingElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/LoggingElement.cs new file mode 100644 index 0000000000..61ad7a3d33 --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/LoggingElement.cs @@ -0,0 +1,68 @@ +using System.Configuration; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + internal class LoggingElement : ConfigurationElement + { + [ConfigurationProperty("autoCleanLogs")] + internal InnerTextConfigurationElement AutoCleanLogs + { + get + { + return new OptionalInnerTextConfigurationElement( + (InnerTextConfigurationElement)this["autoCleanLogs"], + //set the default + false); + } + } + + [ConfigurationProperty("enableLogging")] + internal InnerTextConfigurationElement EnableLogging + { + get { return (InnerTextConfigurationElement)this["enableLogging"]; } + } + + [ConfigurationProperty("enableAsyncLogging")] + internal InnerTextConfigurationElement EnableAsyncLogging + { + get { return (InnerTextConfigurationElement)this["enableAsyncLogging"]; } + } + + [ConfigurationProperty("cleaningMiliseconds")] + internal InnerTextConfigurationElement CleaningMiliseconds + { + get + { + return new OptionalInnerTextConfigurationElement( + (InnerTextConfigurationElement)this["cleaningMiliseconds"], + //set the default + -1); + } + } + + [ConfigurationProperty("maxLogAge")] + internal InnerTextConfigurationElement MaxLogAge + { + get + { + return new OptionalInnerTextConfigurationElement( + (InnerTextConfigurationElement)this["maxLogAge"], + //set the default + -1); + } + } + + [ConfigurationCollection(typeof(DisabledLogTypesCollection), AddItemName = "logTypeAlias")] + [ConfigurationProperty("disabledLogTypes", IsDefaultCollection = true)] + public DisabledLogTypesCollection DisabledLogTypes + { + get { return (DisabledLogTypesCollection)base["disabledLogTypes"]; } + } + + [ConfigurationProperty("externalLogger")] + internal ExternalLoggerElement ExternalLogger + { + get { return (ExternalLoggerElement)this["externalLogger"]; } + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/NotDynamicXmlDocumentElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/NotDynamicXmlDocumentElement.cs new file mode 100644 index 0000000000..200cc50aef --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/NotDynamicXmlDocumentElement.cs @@ -0,0 +1,7 @@ +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + internal class NotDynamicXmlDocumentElement : InnerTextConfigurationElement + { + + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/NotDynamicXmlDocumentElementCollection.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/NotDynamicXmlDocumentElementCollection.cs new file mode 100644 index 0000000000..075db3f074 --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/NotDynamicXmlDocumentElementCollection.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; +using System.Configuration; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + internal class NotDynamicXmlDocumentElementCollection : ConfigurationElementCollection, IEnumerable + { + protected override ConfigurationElement CreateNewElement() + { + return new NotDynamicXmlDocumentElement(); + } + + protected override object GetElementKey(ConfigurationElement element) + { + return ((NotDynamicXmlDocumentElement) element).Value; + } + + IEnumerator IEnumerable.GetEnumerator() + { + for (var i = 0; i < Count; i++) + { + yield return BaseGet(i) as NotDynamicXmlDocumentElement; + } + } + + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/NotificationsElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/NotificationsElement.cs new file mode 100644 index 0000000000..51178cc21e --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/NotificationsElement.cs @@ -0,0 +1,25 @@ +using System.Configuration; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + internal class NotificationsElement : ConfigurationElement + { + [ConfigurationProperty("email")] + internal InnerTextConfigurationElement EmailAddress + { + get { return (InnerTextConfigurationElement)this["email"]; } + } + + [ConfigurationProperty("disableHtmlEmail")] + internal InnerTextConfigurationElement DisableHtmlEmail + { + get + { + return new OptionalInnerTextConfigurationElement( + (InnerTextConfigurationElement) this["disableHtmlEmail"], + //set the default + false); + } + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/ObjectExtensions.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/ObjectExtensions.cs new file mode 100644 index 0000000000..46fbc3b17a --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/ObjectExtensions.cs @@ -0,0 +1,210 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + + internal static class ObjectExtensions + { + + //private static readonly ConcurrentDictionary> ObjectFactoryCache = new ConcurrentDictionary>(); + + public static IEnumerable AsEnumerableOfOne(this T input) + { + return Enumerable.Repeat(input, 1); + } + + public static void DisposeIfDisposable(this object input) + { + var disposable = input as IDisposable; + if (disposable != null) disposable.Dispose(); + } + + /// + /// Provides a shortcut way of safely casting an input when you cannot guarantee the is an instance type (i.e., when the C# AS keyword is not applicable) + /// + /// + /// The input. + /// + public static T SafeCast(this object input) + { + if (ReferenceEquals(null, input) || ReferenceEquals(default(T), input)) return default(T); + if (input is T) return (T)input; + return default(T); + } + + /// + /// Tries to convert the input object to the output type using TypeConverters + /// + /// + /// + /// + public static Attempt TryConvertTo(this object input) + { + var result = TryConvertTo(input, typeof(T)); + if (!result.Success) + { + //just try a straight up conversion + try + { + var converted = (T)input; + return new Attempt(true, converted); + } + catch (Exception e) + { + return new Attempt(e); + } + } + return !result.Success ? Attempt.False : new Attempt(true, (T)result.Result); + } + + /// + /// Tries to convert the input object to the output type using TypeConverters. If the destination type is a superclass of the input type, + /// if will use . + /// + /// The input. + /// Type of the destination. + /// + public static Attempt TryConvertTo(this object input, Type destinationType) + { + if (input == null) return Attempt.False; + + if (destinationType == typeof(object)) return new Attempt(true, input); + + if (input.GetType() == destinationType) return new Attempt(true, input); + + if (input is string && destinationType.IsEnum) + { + try + { + var output = Enum.Parse(destinationType, (string)input, true); + return new Attempt(true, output); + } + catch (Exception e) + { + return new Attempt(e); + } + } + + if (!destinationType.IsGenericType || destinationType.GetGenericTypeDefinition() != typeof(Nullable<>)) + { + //TODO: Do a check for destination type being IEnumerable and source type implementing IEnumerable with + // the same 'T', then we'd have to find the extension method for the type AsEnumerable() and execute it. + + if (TypeHelper.IsTypeAssignableFrom(destinationType, input.GetType()) + && TypeHelper.IsTypeAssignableFrom(input)) + { + try + { + var casted = Convert.ChangeType(input, destinationType); + return new Attempt(true, casted); + } + catch (Exception e) + { + return new Attempt(e); + } + } + } + + var inputConverter = TypeDescriptor.GetConverter(input); + if (inputConverter.CanConvertTo(destinationType)) + { + try + { + var converted = inputConverter.ConvertTo(input, destinationType); + return new Attempt(true, converted); + } + catch (Exception e) + { + return new Attempt(e); + } + } + + if (destinationType == typeof(bool)) + { + var boolConverter = new CustomBooleanTypeConverter(); + if (boolConverter.CanConvertFrom(input.GetType())) + { + try + { + var converted = boolConverter.ConvertFrom(input); + return new Attempt(true, converted); + } + catch (Exception e) + { + return new Attempt(e); + } + } + } + + var outputConverter = TypeDescriptor.GetConverter(destinationType); + if (outputConverter.CanConvertFrom(input.GetType())) + { + try + { + var converted = outputConverter.ConvertFrom(input); + return new Attempt(true, converted); + } + catch (Exception e) + { + return new Attempt(e); + } + } + + + if (TypeHelper.IsTypeAssignableFrom(input)) + { + try + { + var casted = Convert.ChangeType(input, destinationType); + return new Attempt(true, casted); + } + catch (Exception e) + { + return new Attempt(e); + } + } + + return Attempt.False; + } + + public static void CheckThrowObjectDisposed(this IDisposable disposable, bool isDisposed, string objectname) + { + //TODO: Localise this exception + if (isDisposed) + throw new ObjectDisposedException(objectname); + } + + /// + /// Turns object into dictionary + /// + /// + /// Properties to ignore + /// + public static IDictionary ToDictionary(this object o, params string[] ignoreProperties) + { + if (o != null) + { + var props = TypeDescriptor.GetProperties(o); + var d = new Dictionary(); + foreach (var prop in props.Cast().Where(x => !ignoreProperties.Contains(x.Name))) + { + var val = prop.GetValue(o); + if (val != null) + { + d.Add(prop.Name, (TVal)val); + } + } + return d; + } + return new Dictionary(); + } + + + + + + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/OptionalInnerTextConfigurationElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/OptionalInnerTextConfigurationElement.cs new file mode 100644 index 0000000000..9514d40025 --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/OptionalInnerTextConfigurationElement.cs @@ -0,0 +1,23 @@ +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + /// + /// This is used to supply optional/default values when using InnerTextConfigurationElement + /// + /// + internal class OptionalInnerTextConfigurationElement : InnerTextConfigurationElement + { + private readonly InnerTextConfigurationElement _wrapped; + private readonly T _defaultValue; + + public OptionalInnerTextConfigurationElement(InnerTextConfigurationElement wrapped, T defaultValue) + { + _wrapped = wrapped; + _defaultValue = defaultValue; + } + + public override T Value + { + get { return string.IsNullOrEmpty(_wrapped.RawValue) ? _defaultValue : _wrapped.Value; } + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/ProvidersElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/ProvidersElement.cs new file mode 100644 index 0000000000..c15c5f0f41 --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/ProvidersElement.cs @@ -0,0 +1,13 @@ +using System.Configuration; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + internal class ProvidersElement : ConfigurationElement + { + [ConfigurationProperty("users")] + public UserProviderElement Users + { + get { return (UserProviderElement)base["users"]; } + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/RawXmlConfigurationElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/RawXmlConfigurationElement.cs new file mode 100644 index 0000000000..c2d8d5001b --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/RawXmlConfigurationElement.cs @@ -0,0 +1,30 @@ +using System.Configuration; +using System.Xml; +using System.Xml.Linq; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + /// + /// A configuration section that simply exposes the entire raw xml of the section itself which inheritors can use + /// to do with as they please. + /// + internal abstract class RawXmlConfigurationElement : ConfigurationElement + { + protected RawXmlConfigurationElement() + { + + } + + protected RawXmlConfigurationElement(XElement rawXml) + { + RawXml = rawXml; + } + + protected override void DeserializeElement(XmlReader reader, bool serializeCollectionKey) + { + RawXml = (XElement)XNode.ReadFrom(reader); + } + + protected XElement RawXml { get; private set; } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/RazorElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/RazorElement.cs new file mode 100644 index 0000000000..240d193a2d --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/RazorElement.cs @@ -0,0 +1,21 @@ +using System.Configuration; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + internal class RazorElement : ConfigurationElement + { + [ConfigurationCollection(typeof (NotDynamicXmlDocumentElementCollection), AddItemName = "element")] + [ConfigurationProperty("notDynamicXmlDocumentElements", IsDefaultCollection = true)] + public NotDynamicXmlDocumentElementCollection NotDynamicXmlDocumentElements + { + get { return (NotDynamicXmlDocumentElementCollection) base["notDynamicXmlDocumentElements"]; } + } + + [ConfigurationCollection(typeof (RazorStaticMappingCollection), AddItemName = "mapping")] + [ConfigurationProperty("dataTypeModelStaticMappings", IsDefaultCollection = true)] + public RazorStaticMappingCollection DataTypeModelStaticMappings + { + get { return (RazorStaticMappingCollection) base["dataTypeModelStaticMappings"]; } + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/RazorStaticMappingCollection.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/RazorStaticMappingCollection.cs new file mode 100644 index 0000000000..6d0b45c89d --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/RazorStaticMappingCollection.cs @@ -0,0 +1,34 @@ +using System.Collections.Generic; +using System.Configuration; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + internal class RazorStaticMappingCollection : ConfigurationElementCollection, IEnumerable + { + protected override ConfigurationElement CreateNewElement() + { + return new RazorStaticMappingElement(); + } + + protected override object GetElementKey(ConfigurationElement element) + { + return ((RazorStaticMappingElement) element).DataTypeGuid + + ((RazorStaticMappingElement) element).NodeTypeAlias + + ((RazorStaticMappingElement) element).DocumentTypeAlias; + } + + + IEnumerator IEnumerable.GetEnumerator() + { + for (var i = 0; i < Count; i++) + { + yield return BaseGet(i) as RazorStaticMappingElement; + } + } + + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/RazorStaticMappingElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/RazorStaticMappingElement.cs new file mode 100644 index 0000000000..acc4dba831 --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/RazorStaticMappingElement.cs @@ -0,0 +1,38 @@ +using System; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + internal class RazorStaticMappingElement : InnerTextConfigurationElement + { + internal Guid DataTypeGuid + { + get + { + return RawXml.Attribute("dataTypeGuid") == null + ? default(Guid) + : Guid.Parse(RawXml.Attribute("dataTypeGuid").Value); + } + } + + internal string NodeTypeAlias + { + get + { + return RawXml.Attribute("nodeTypeAlias") == null + ? null + : RawXml.Attribute("nodeTypeAlias").Value; + } + } + + internal string DocumentTypeAlias + { + get + { + return RawXml.Attribute("documentTypeAlias") == null + ? null + : RawXml.Attribute("documentTypeAlias").Value; + } + } + + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/RepositoriesCollection.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/RepositoriesCollection.cs new file mode 100644 index 0000000000..763747542a --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/RepositoriesCollection.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; +using System.Configuration; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + internal class RepositoriesCollection : ConfigurationElementCollection, IEnumerable + { + protected override ConfigurationElement CreateNewElement() + { + return new RepositoryElement(); + } + + protected override object GetElementKey(ConfigurationElement element) + { + return ((RepositoryElement)element).Id; + } + + IEnumerator IEnumerable.GetEnumerator() + { + for (var i = 0; i < Count; i++) + { + yield return BaseGet(i) as RepositoryElement; + } + } + + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/RepositoriesElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/RepositoriesElement.cs new file mode 100644 index 0000000000..7a1fc2f496 --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/RepositoriesElement.cs @@ -0,0 +1,14 @@ +using System.Configuration; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + internal class RepositoriesElement : ConfigurationElement + { + [ConfigurationCollection(typeof(RepositoriesCollection), AddItemName = "repository")] + [ConfigurationProperty("", IsDefaultCollection = true)] + public RepositoriesCollection Repositories + { + get { return (RepositoriesCollection)base[""]; } + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/RepositoryElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/RepositoryElement.cs new file mode 100644 index 0000000000..4af5de2644 --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/RepositoryElement.cs @@ -0,0 +1,21 @@ +using System; +using System.Configuration; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + internal class RepositoryElement : ConfigurationElement + { + [ConfigurationProperty("name")] + internal string Name + { + get { return (string)base["name"]; } + } + + [ConfigurationProperty("guid")] + internal Guid Id + { + get { return (Guid)base["guid"]; } + } + + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/RequestHandlerElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/RequestHandlerElement.cs new file mode 100644 index 0000000000..68a0719e5d --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/RequestHandlerElement.cs @@ -0,0 +1,25 @@ +using System.Configuration; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + internal class RequestHandlerElement : ConfigurationElement + { + [ConfigurationProperty("useDomainPrefixes")] + internal InnerTextConfigurationElement UseDomainPrefixes + { + get { return (InnerTextConfigurationElement)this["useDomainPrefixes"]; } + } + + [ConfigurationProperty("addTrailingSlash")] + internal InnerTextConfigurationElement AddTrailingSlash + { + get { return (InnerTextConfigurationElement)this["addTrailingSlash"]; } + } + + [ConfigurationProperty("urlReplacing")] + internal UrlReplacingElement UrlReplacing + { + get { return (UrlReplacingElement)this["urlReplacing"]; } + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/ScheduledTaskElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/ScheduledTaskElement.cs new file mode 100644 index 0000000000..9edd8ea925 --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/ScheduledTaskElement.cs @@ -0,0 +1,31 @@ +using System.Configuration; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + internal class ScheduledTaskElement : ConfigurationElement + { + [ConfigurationProperty("alias")] + internal string Alias + { + get { return (string)base["alias"]; } + } + + [ConfigurationProperty("log")] + internal bool Log + { + get { return (bool)base["log"]; } + } + + [ConfigurationProperty("interval")] + internal int Interval + { + get { return (int)base["interval"]; } + } + + [ConfigurationProperty("url")] + internal string Url + { + get { return (string)base["url"]; } + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/ScheduledTasksCollection.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/ScheduledTasksCollection.cs new file mode 100644 index 0000000000..0b8412f817 --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/ScheduledTasksCollection.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; +using System.Configuration; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + internal class ScheduledTasksCollection : ConfigurationElementCollection, IEnumerable + { + protected override ConfigurationElement CreateNewElement() + { + return new ScheduledTaskElement(); + } + + protected override object GetElementKey(ConfigurationElement element) + { + return ((ScheduledTaskElement)element).Alias; + } + + IEnumerator IEnumerable.GetEnumerator() + { + for (var i = 0; i < Count; i++) + { + yield return BaseGet(i) as ScheduledTaskElement; + } + } + + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/ScheduledTasksElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/ScheduledTasksElement.cs new file mode 100644 index 0000000000..59d22e983b --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/ScheduledTasksElement.cs @@ -0,0 +1,14 @@ +using System.Configuration; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + internal class ScheduledTasksElement : ConfigurationElement + { + [ConfigurationCollection(typeof(ScheduledTasksCollection), AddItemName = "task")] + [ConfigurationProperty("", IsDefaultCollection = true)] + public ScheduledTasksCollection Tasks + { + get { return (ScheduledTasksCollection)base[""]; } + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/ScriptingElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/ScriptingElement.cs new file mode 100644 index 0000000000..ee66d59a18 --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/ScriptingElement.cs @@ -0,0 +1,14 @@ +using System.Configuration; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + internal class ScriptingElement : ConfigurationElement + { + [ConfigurationProperty("razor")] + public RazorElement Razor + { + get { return (RazorElement) base["razor"]; } + } + + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/SecurityElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/SecurityElement.cs new file mode 100644 index 0000000000..e24aafa30c --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/SecurityElement.cs @@ -0,0 +1,43 @@ +using System.Configuration; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + internal class SecurityElement : ConfigurationElement + { + [ConfigurationProperty("keepUserLoggedIn")] + internal InnerTextConfigurationElement KeepUserLoggedIn + { + get { return (InnerTextConfigurationElement)this["keepUserLoggedIn"]; } + } + + [ConfigurationProperty("hideDisabledUsersInBackoffice")] + internal InnerTextConfigurationElement HideDisabledUsersInBackoffice + { + get { return (InnerTextConfigurationElement)this["hideDisabledUsersInBackoffice"]; } + } + + [ConfigurationProperty("authCookieName")] + internal InnerTextConfigurationElement AuthCookieName + { + get + { + return new OptionalInnerTextConfigurationElement( + (InnerTextConfigurationElement)this["authCookieName"], + //set the default + "UMB_UCONTEXT"); + } + } + + [ConfigurationProperty("authCookieDomain")] + internal InnerTextConfigurationElement AuthCookieDomain + { + get + { + return new OptionalInnerTextConfigurationElement( + (InnerTextConfigurationElement)this["authCookieDomain"], + //set the default + null); + } + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/ServerCollection.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/ServerCollection.cs new file mode 100644 index 0000000000..039d5919e1 --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/ServerCollection.cs @@ -0,0 +1,31 @@ +using System.Collections.Generic; +using System.Configuration; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + internal class ServerCollection : ConfigurationElementCollection, IEnumerable + { + protected override ConfigurationElement CreateNewElement() + { + return new ServerElement(); + } + + protected override object GetElementKey(ConfigurationElement element) + { + return ((ServerElement)element).Value; + } + + IEnumerator IEnumerable.GetEnumerator() + { + for (var i = 0; i < Count; i++) + { + yield return BaseGet(i) as ServerElement; + } + } + + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/ServerElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/ServerElement.cs new file mode 100644 index 0000000000..c912865241 --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/ServerElement.cs @@ -0,0 +1,25 @@ +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + internal class ServerElement : InnerTextConfigurationElement + { + internal string ForcePortnumber + { + get + { + return RawXml.Attribute("forcePortnumber") == null + ? null + : RawXml.Attribute("forcePortnumber").Value; + } + } + + internal string ForceProtocol + { + get + { + return RawXml.Attribute("forceProtocol") == null + ? null + : RawXml.Attribute("forceProtocol").Value; + } + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/TemplatesElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/TemplatesElement.cs new file mode 100644 index 0000000000..6b0d045914 --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/TemplatesElement.cs @@ -0,0 +1,37 @@ +using System.Configuration; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + internal class TemplatesElement : ConfigurationElement + { + [ConfigurationProperty("useAspNetMasterPages")] + internal InnerTextConfigurationElement UseAspNetMasterPages + { + get { return (InnerTextConfigurationElement)this["useAspNetMasterPages"]; } + } + + [ConfigurationProperty("enableSkinSupport")] + internal InnerTextConfigurationElement EnableSkinSupport + { + get { return (InnerTextConfigurationElement)this["enableSkinSupport"]; } + } + + [ConfigurationProperty("defaultRenderingEngine")] + internal InnerTextConfigurationElement DefaultRenderingEngine + { + get { return (InnerTextConfigurationElement)this["defaultRenderingEngine"]; } + } + + [ConfigurationProperty("enableTemplateFolders")] + internal InnerTextConfigurationElement EnableTemplateFolders + { + get + { + return new OptionalInnerTextConfigurationElement( + (InnerTextConfigurationElement)this["enableTemplateFolders"], + //set the default + false); + } + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/UmbracoSettingsSection.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/UmbracoSettingsSection.cs new file mode 100644 index 0000000000..067c8d3785 --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/UmbracoSettingsSection.cs @@ -0,0 +1,108 @@ +using System.Configuration; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + public class UmbracoSettingsSection : ConfigurationSection + { + + ///// + ///// Get the current settings + ///// + //public static UmbracoSettings Current + //{ + // get { return (UmbracoSettings) ConfigurationManager.GetSection("umbracoConfiguration/settings"); } + + //} + + [ConfigurationProperty("content")] + internal ContentElement Content + { + get { return (ContentElement)this["content"]; } + } + + [ConfigurationProperty("security")] + internal SecurityElement Security + { + get { return (SecurityElement)this["security"]; } + } + + [ConfigurationProperty("requestHandler")] + internal RequestHandlerElement RequestHandler + { + get { return (RequestHandlerElement)this["requestHandler"]; } + } + + [ConfigurationProperty("templates")] + internal TemplatesElement Templates + { + get { return (TemplatesElement)this["templates"]; } + } + + [ConfigurationProperty("developer")] + internal DeveloperElement Developer + { + get { return (DeveloperElement)this["developer"]; } + } + + [ConfigurationProperty("viewstateMoverModule")] + internal ViewstateMoverModuleElement ViewstateMoverModule + { + get { return (ViewstateMoverModuleElement)this["viewstateMoverModule"]; } + } + + [ConfigurationProperty("logging")] + internal LoggingElement Logging + { + get { return (LoggingElement)this["logging"]; } + } + + [ConfigurationProperty("scheduledTasks")] + internal ScheduledTasksElement ScheduledTasks + { + get { return (ScheduledTasksElement)this["scheduledTasks"]; } + } + + [ConfigurationProperty("distributedCall")] + internal DistributedCallElement DistributedCall + { + get { return (DistributedCallElement)this["distributedCall"]; } + } + + [ConfigurationProperty("webservices")] + internal WebServicesElement WebServices + { + get { return (WebServicesElement)this["webservices"]; } + } + + [ConfigurationProperty("repositories")] + internal RepositoriesElement PackageRepositories + { + get { return (RepositoriesElement)this["repositories"]; } + } + + [ConfigurationProperty("providers")] + internal ProvidersElement Providers + { + get { return (ProvidersElement)this["providers"]; } + } + + [ConfigurationProperty("help")] + internal HelpElement Help + { + get { return (HelpElement)this["help"]; } + } + + [ConfigurationProperty("web.routing")] + internal WebRoutingElement WebRouting + { + get { return (WebRoutingElement)this["web.routing"]; } + } + + [ConfigurationProperty("scripting")] + internal ScriptingElement Scripting + { + get { return (ScriptingElement)this["scripting"]; } + } + + } +} diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/UrlReplacingElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/UrlReplacingElement.cs new file mode 100644 index 0000000000..16fe8a74bb --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/UrlReplacingElement.cs @@ -0,0 +1,21 @@ +using System.Configuration; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + internal class UrlReplacingElement : ConfigurationElement + { + [ConfigurationProperty("removeDoubleDashes")] + internal bool RemoveDoubleDashes + { + get { return (bool) base["removeDoubleDashes"]; } + } + + [ConfigurationCollection(typeof(CharCollection), AddItemName = "char")] + [ConfigurationProperty("", IsDefaultCollection = true)] + public CharCollection CharCollection + { + get { return (CharCollection)base[""]; } + } + + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/UserProviderElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/UserProviderElement.cs new file mode 100644 index 0000000000..fd28415f49 --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/UserProviderElement.cs @@ -0,0 +1,13 @@ +using System.Configuration; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + internal class UserProviderElement : ConfigurationElement + { + [ConfigurationProperty("DefaultBackofficeProvider")] + internal InnerTextConfigurationElement DefaultBackOfficeProvider + { + get { return (InnerTextConfigurationElement)this["DefaultBackofficeProvider"]; } + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/ViewstateMoverModuleElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/ViewstateMoverModuleElement.cs new file mode 100644 index 0000000000..214f788e77 --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/ViewstateMoverModuleElement.cs @@ -0,0 +1,13 @@ +using System.Configuration; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + internal class ViewstateMoverModuleElement : ConfigurationElement + { + [ConfigurationProperty("enable")] + internal bool Enable + { + get { return (bool)base["enable"]; } + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/WebRoutingElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/WebRoutingElement.cs new file mode 100644 index 0000000000..0a9518bb6e --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/WebRoutingElement.cs @@ -0,0 +1,20 @@ +using System.Configuration; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + internal class WebRoutingElement : ConfigurationElement + { + [ConfigurationProperty("trySkipIisCustomErrors")] + public bool TrySkipIisCustomErrors + { + get { return (bool) base["trySkipIisCustomErrors"]; } + } + + [ConfigurationProperty("internalRedirectPreservesTemplate")] + public bool InternalRedirectPreservesTemplate + { + get { return (bool) base["internalRedirectPreservesTemplate"]; } + } + + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/WebServicesElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/WebServicesElement.cs new file mode 100644 index 0000000000..312ce154fb --- /dev/null +++ b/src/Umbraco.Core/Configuration/UmbracoSettings/WebServicesElement.cs @@ -0,0 +1,61 @@ +using System.Configuration; + +namespace Umbraco.Core.Configuration.UmbracoSettings +{ + internal class WebServicesElement : ConfigurationElement + { + [ConfigurationProperty("enabled")] + internal bool Enabled + { + get { return (bool)base["enabled"]; } + } + + [ConfigurationProperty("documentServiceUsers")] + internal CommaDelimitedConfigurationElement DocumentServiceUsers + { + get { return (CommaDelimitedConfigurationElement)this["documentServiceUsers"]; } + } + + [ConfigurationProperty("fileServiceUsers")] + internal CommaDelimitedConfigurationElement FileServiceUsers + { + get { return (CommaDelimitedConfigurationElement)this["fileServiceUsers"]; } + } + + [ConfigurationProperty("fileServiceFolders")] + internal CommaDelimitedConfigurationElement FileServiceFolders + { + get { return (CommaDelimitedConfigurationElement)this["fileServiceFolders"]; } + } + + [ConfigurationProperty("stylesheetServiceUsers")] + internal CommaDelimitedConfigurationElement StylesheetServiceUsers + { + get { return (CommaDelimitedConfigurationElement)this["stylesheetServiceUsers"]; } + } + + [ConfigurationProperty("memberServiceUsers")] + internal CommaDelimitedConfigurationElement MemberServiceUsers + { + get { return (CommaDelimitedConfigurationElement)this["memberServiceUsers"]; } + } + + [ConfigurationProperty("mediaServiceUsers")] + internal CommaDelimitedConfigurationElement MediaServiceUsers + { + get { return (CommaDelimitedConfigurationElement) this["mediaServiceUsers"]; } + } + + [ConfigurationProperty("templateServiceUsers")] + internal CommaDelimitedConfigurationElement TemplateServiceUsers + { + get { return (CommaDelimitedConfigurationElement)this["templateServiceUsers"]; } + } + + [ConfigurationProperty("maintenanceServiceUsers")] + internal CommaDelimitedConfigurationElement MaintenanceServiceUsers + { + get { return (CommaDelimitedConfigurationElement)this["maintenanceServiceUsers"]; } + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/IO/IOHelper.cs b/src/Umbraco.Core/IO/IOHelper.cs index 22dc0814d5..d37c90f298 100644 --- a/src/Umbraco.Core/IO/IOHelper.cs +++ b/src/Umbraco.Core/IO/IOHelper.cs @@ -54,7 +54,7 @@ namespace Umbraco.Core.IO [Obsolete("Use Umbraco.Web.Templates.TemplateUtilities.ResolveUrlsFromTextString instead, this method on this class will be removed in future versions")] internal static string ResolveUrlsFromTextString(string text) { - if (UmbracoSettings.ResolveUrlsFromTextString) + if (LegacyUmbracoSettings.ResolveUrlsFromTextString) { using (var timer = DisposableTimer.DebugDuration(typeof(IOHelper), "ResolveUrlsFromTextString starting", "ResolveUrlsFromTextString complete")) { diff --git a/src/Umbraco.Core/IO/MediaFileSystem.cs b/src/Umbraco.Core/IO/MediaFileSystem.cs index de795303af..0ef1895003 100644 --- a/src/Umbraco.Core/IO/MediaFileSystem.cs +++ b/src/Umbraco.Core/IO/MediaFileSystem.cs @@ -18,7 +18,7 @@ namespace Umbraco.Core.IO public string GetRelativePath(int propertyId, string fileName) { - var seperator = UmbracoSettings.UploadAllowDirectories + var seperator = LegacyUmbracoSettings.UploadAllowDirectories ? Path.DirectorySeparatorChar : '-'; @@ -27,7 +27,7 @@ namespace Umbraco.Core.IO public string GetRelativePath(string subfolder, string fileName) { - var seperator = UmbracoSettings.UploadAllowDirectories + var seperator = LegacyUmbracoSettings.UploadAllowDirectories ? Path.DirectorySeparatorChar : '-'; diff --git a/src/Umbraco.Core/IO/UmbracoMediaFile.cs b/src/Umbraco.Core/IO/UmbracoMediaFile.cs index dc8632d4c7..c6b233ee0e 100644 --- a/src/Umbraco.Core/IO/UmbracoMediaFile.cs +++ b/src/Umbraco.Core/IO/UmbracoMediaFile.cs @@ -120,7 +120,7 @@ namespace Umbraco.Core.IO { get { - return ("," + UmbracoSettings.ImageFileTypes + ",").Contains(string.Format(",{0},", Extension)); + return ("," + LegacyUmbracoSettings.ImageFileTypes + ",").Contains(string.Format(",{0},", Extension)); } } diff --git a/src/Umbraco.Core/Models/ContentExtensions.cs b/src/Umbraco.Core/Models/ContentExtensions.cs index ad46932690..6026171a31 100644 --- a/src/Umbraco.Core/Models/ContentExtensions.cs +++ b/src/Umbraco.Core/Models/ContentExtensions.cs @@ -423,7 +423,7 @@ namespace Umbraco.Core.Models return; var numberedFolder = MediaSubfolderCounter.Current.Increment(); - var fileName = UmbracoSettings.UploadAllowDirectories + var fileName = LegacyUmbracoSettings.UploadAllowDirectories ? Path.Combine(numberedFolder.ToString(CultureInfo.InvariantCulture), name) : numberedFolder + "-" + name; @@ -436,16 +436,16 @@ namespace Umbraco.Core.Models fs.AddFile(fileName, fileStream); //Check if file supports resizing and create thumbnails - var supportsResizing = ("," + UmbracoSettings.ImageFileTypes + ",").Contains(string.Format(",{0},", extension)); + var supportsResizing = ("," + LegacyUmbracoSettings.ImageFileTypes + ",").Contains(string.Format(",{0},", extension)); //the config section used to auto-fill properties XmlNode uploadFieldConfigNode = null; //Check for auto fill of additional properties - if (UmbracoSettings.ImageAutoFillImageProperties != null) + if (LegacyUmbracoSettings.ImageAutoFillImageProperties != null) { uploadFieldConfigNode = - UmbracoSettings.ImageAutoFillImageProperties.SelectSingleNode( + LegacyUmbracoSettings.ImageAutoFillImageProperties.SelectSingleNode( string.Format("uploadField [@alias = \"{0}\"]", propertyTypeAlias)); } diff --git a/src/Umbraco.Core/Models/PropertyExtensions.cs b/src/Umbraco.Core/Models/PropertyExtensions.cs index 3aa62ae00f..01bd0d2c1b 100644 --- a/src/Umbraco.Core/Models/PropertyExtensions.cs +++ b/src/Umbraco.Core/Models/PropertyExtensions.cs @@ -22,13 +22,13 @@ namespace Umbraco.Core.Models internal static XElement ToXml(this Property property, IDataTypeService dataTypeService) { - var nodeName = UmbracoSettings.UseLegacyXmlSchema ? "data" : property.Alias.ToSafeAlias(); + var nodeName = LegacyUmbracoSettings.UseLegacyXmlSchema ? "data" : property.Alias.ToSafeAlias(); var xd = new XmlDocument(); var xmlNode = xd.CreateNode(XmlNodeType.Element, nodeName, ""); //Add the property alias to the legacy schema - if (UmbracoSettings.UseLegacyXmlSchema) + if (LegacyUmbracoSettings.UseLegacyXmlSchema) { var alias = xd.CreateAttribute("alias"); alias.Value = property.Alias.ToSafeAlias(); diff --git a/src/Umbraco.Core/Models/Script.cs b/src/Umbraco.Core/Models/Script.cs index 56912a26ab..d6405477e0 100644 --- a/src/Umbraco.Core/Models/Script.cs +++ b/src/Umbraco.Core/Models/Script.cs @@ -33,7 +33,7 @@ namespace Umbraco.Core.Models //into 4 private methods. //See codeEditorSave.asmx.cs for reference. - var exts = UmbracoSettings.ScriptFileTypes.Split(',').ToList(); + var exts = LegacyUmbracoSettings.ScriptFileTypes.Split(',').ToList(); /*if (UmbracoSettings.DefaultRenderingEngine == RenderingEngine.Mvc) { exts.Add("cshtml"); diff --git a/src/Umbraco.Core/Models/Template.cs b/src/Umbraco.Core/Models/Template.cs index c032e290b1..4cdb48b05d 100644 --- a/src/Umbraco.Core/Models/Template.cs +++ b/src/Umbraco.Core/Models/Template.cs @@ -157,18 +157,18 @@ namespace Umbraco.Core.Models public override bool IsValid() { var exts = new List(); - if (UmbracoSettings.DefaultRenderingEngine == RenderingEngine.Mvc) + if (LegacyUmbracoSettings.DefaultRenderingEngine == RenderingEngine.Mvc) { exts.Add("cshtml"); exts.Add("vbhtml"); } else { - exts.Add(UmbracoSettings.UseAspNetMasterPages ? "master" : "aspx"); + exts.Add(LegacyUmbracoSettings.UseAspNetMasterPages ? "master" : "aspx"); } var dirs = SystemDirectories.Masterpages; - if (UmbracoSettings.DefaultRenderingEngine == RenderingEngine.Mvc) + if (LegacyUmbracoSettings.DefaultRenderingEngine == RenderingEngine.Mvc) dirs += "," + SystemDirectories.MvcViews; //Validate file diff --git a/src/Umbraco.Core/Persistence/Repositories/ContentRepository.cs b/src/Umbraco.Core/Persistence/Repositories/ContentRepository.cs index 86c177fa91..e57459092e 100644 --- a/src/Umbraco.Core/Persistence/Repositories/ContentRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/ContentRepository.cs @@ -422,7 +422,7 @@ namespace Umbraco.Core.Persistence.Repositories var parentDirectory = System.IO.Path.GetDirectoryName(relativeFilePath); // don't want to delete the media folder if not using directories. - if (UmbracoSettings.UploadAllowDirectories && parentDirectory != fs.GetRelativePath("/")) + if (LegacyUmbracoSettings.UploadAllowDirectories && parentDirectory != fs.GetRelativePath("/")) { //issue U4-771: if there is a parent directory the recursive parameter should be true fs.DeleteDirectory(parentDirectory, String.IsNullOrEmpty(parentDirectory) == false); diff --git a/src/Umbraco.Core/Persistence/Repositories/MediaRepository.cs b/src/Umbraco.Core/Persistence/Repositories/MediaRepository.cs index e27fac1ba3..97d8ee59a0 100644 --- a/src/Umbraco.Core/Persistence/Repositories/MediaRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/MediaRepository.cs @@ -339,7 +339,7 @@ namespace Umbraco.Core.Persistence.Repositories var parentDirectory = System.IO.Path.GetDirectoryName(relativeFilePath); // don't want to delete the media folder if not using directories. - if (UmbracoSettings.UploadAllowDirectories && parentDirectory != fs.GetRelativePath("/")) + if (LegacyUmbracoSettings.UploadAllowDirectories && parentDirectory != fs.GetRelativePath("/")) { //issue U4-771: if there is a parent directory the recursive parameter should be true fs.DeleteDirectory(parentDirectory, String.IsNullOrEmpty(parentDirectory) == false); diff --git a/src/Umbraco.Core/Persistence/Repositories/RecycleBinRepository.cs b/src/Umbraco.Core/Persistence/Repositories/RecycleBinRepository.cs index 2b4728da5f..fef9170b9a 100644 --- a/src/Umbraco.Core/Persistence/Repositories/RecycleBinRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/RecycleBinRepository.cs @@ -132,7 +132,7 @@ namespace Umbraco.Core.Persistence.Repositories var fs = FileSystemProviderManager.Current.GetFileSystemProvider(); Parallel.ForEach(files, file => { - if (UmbracoSettings.UploadAllowDirectories) + if (LegacyUmbracoSettings.UploadAllowDirectories) { var relativeFilePath = fs.GetRelativePath(file); var parentDirectory = System.IO.Path.GetDirectoryName(relativeFilePath); diff --git a/src/Umbraco.Core/Persistence/RepositoryFactory.cs b/src/Umbraco.Core/Persistence/RepositoryFactory.cs index 36d035244e..bbf9237a5d 100644 --- a/src/Umbraco.Core/Persistence/RepositoryFactory.cs +++ b/src/Umbraco.Core/Persistence/RepositoryFactory.cs @@ -15,7 +15,7 @@ namespace Umbraco.Core.Persistence uow, RuntimeCacheProvider.Current, CreateContentTypeRepository(uow), - CreateTemplateRepository(uow)) { EnsureUniqueNaming = Umbraco.Core.Configuration.UmbracoSettings.EnsureUniqueNaming }; + CreateTemplateRepository(uow)) { EnsureUniqueNaming = Umbraco.Core.Configuration.LegacyUmbracoSettings.EnsureUniqueNaming }; } public virtual IContentTypeRepository CreateContentTypeRepository(IDatabaseUnitOfWork uow) @@ -53,7 +53,7 @@ namespace Umbraco.Core.Persistence return new MediaRepository( uow, RuntimeCacheProvider.Current, - CreateMediaTypeRepository(uow)) { EnsureUniqueNaming = Umbraco.Core.Configuration.UmbracoSettings.EnsureUniqueNaming }; + CreateMediaTypeRepository(uow)) { EnsureUniqueNaming = Umbraco.Core.Configuration.LegacyUmbracoSettings.EnsureUniqueNaming }; } public virtual IMediaTypeRepository CreateMediaTypeRepository(IDatabaseUnitOfWork uow) diff --git a/src/Umbraco.Core/PublishedContentHelper.cs b/src/Umbraco.Core/PublishedContentHelper.cs index 86513ede02..beb2bf1d14 100644 --- a/src/Umbraco.Core/PublishedContentHelper.cs +++ b/src/Umbraco.Core/PublishedContentHelper.cs @@ -144,7 +144,7 @@ namespace Umbraco.Core var documentElement = e.Name.LocalName; //TODO: See note against this setting, pretty sure we don't need this - if (!UmbracoSettings.NotDynamicXmlDocumentElements.Any( + if (!LegacyUmbracoSettings.NotDynamicXmlDocumentElements.Any( tag => string.Equals(tag, documentElement, StringComparison.CurrentCultureIgnoreCase))) { return new Attempt(true, new DynamicXml(e)); diff --git a/src/Umbraco.Core/Security/AuthenticationExtensions.cs b/src/Umbraco.Core/Security/AuthenticationExtensions.cs index 330cf2b4e6..73d59bc72c 100644 --- a/src/Umbraco.Core/Security/AuthenticationExtensions.cs +++ b/src/Umbraco.Core/Security/AuthenticationExtensions.cs @@ -26,7 +26,7 @@ namespace Umbraco.Core.Security /// public static void UmbracoLogout(this HttpContextBase http) { - Logout(http, UmbracoSettings.AuthCookieName); + Logout(http, LegacyUmbracoSettings.AuthCookieName); } internal static void UmbracoLogout(this HttpContext http) @@ -42,7 +42,7 @@ namespace Umbraco.Core.Security /// public static bool RenewUmbracoAuthTicket(this HttpContextBase http, int timeoutInMinutes = 60) { - return RenewAuthTicket(http, UmbracoSettings.AuthCookieName, UmbracoSettings.AuthCookieDomain, timeoutInMinutes); + return RenewAuthTicket(http, LegacyUmbracoSettings.AuthCookieName, LegacyUmbracoSettings.AuthCookieDomain, timeoutInMinutes); } internal static bool RenewUmbracoAuthTicket(this HttpContext http, int timeoutInMinutes = 60) @@ -66,8 +66,8 @@ namespace Umbraco.Core.Security //Umbraco has always persisted it's original cookie for 1 day so we'll keep it that way 1440, "/", - UmbracoSettings.AuthCookieName, - UmbracoSettings.AuthCookieDomain); + LegacyUmbracoSettings.AuthCookieName, + LegacyUmbracoSettings.AuthCookieDomain); } internal static void CreateUmbracoAuthTicket(this HttpContext http, UserData userdata) @@ -82,7 +82,7 @@ namespace Umbraco.Core.Security /// public static FormsAuthenticationTicket GetUmbracoAuthTicket(this HttpContextBase http) { - return GetAuthTicket(http, UmbracoSettings.AuthCookieName); + return GetAuthTicket(http, LegacyUmbracoSettings.AuthCookieName); } internal static FormsAuthenticationTicket GetUmbracoAuthTicket(this HttpContext http) diff --git a/src/Umbraco.Core/Services/ContentTypeService.cs b/src/Umbraco.Core/Services/ContentTypeService.cs index 9d0a8265b6..a0413c619d 100644 --- a/src/Umbraco.Core/Services/ContentTypeService.cs +++ b/src/Umbraco.Core/Services/ContentTypeService.cs @@ -567,7 +567,7 @@ namespace Umbraco.Core.Services public string GetContentTypesDtd() { var dtd = new StringBuilder(); - if (UmbracoSettings.UseLegacyXmlSchema) + if (LegacyUmbracoSettings.UseLegacyXmlSchema) { dtd.AppendLine(" "); } diff --git a/src/Umbraco.Core/Services/PackagingService.cs b/src/Umbraco.Core/Services/PackagingService.cs index b53cedfd0c..fb7a3252cd 100644 --- a/src/Umbraco.Core/Services/PackagingService.cs +++ b/src/Umbraco.Core/Services/PackagingService.cs @@ -102,7 +102,7 @@ namespace Umbraco.Core.Services internal XElement Export(IContent content, bool deep = false) { //nodeName should match Casing.SafeAliasWithForcingCheck(content.ContentType.Alias); - var nodeName = UmbracoSettings.UseLegacyXmlSchema ? "node" : content.ContentType.Alias.ToSafeAliasWithForcingCheck(); + var nodeName = LegacyUmbracoSettings.UseLegacyXmlSchema ? "node" : content.ContentType.Alias.ToSafeAliasWithForcingCheck(); var xml = Export(content, nodeName); xml.Add(new XAttribute("nodeType", content.ContentType.Id)); @@ -813,7 +813,7 @@ namespace Umbraco.Core.Services internal XElement Export(IMedia media, bool deep = false) { //nodeName should match Casing.SafeAliasWithForcingCheck(content.ContentType.Alias); - var nodeName = UmbracoSettings.UseLegacyXmlSchema ? "node" : media.ContentType.Alias.ToSafeAliasWithForcingCheck(); + var nodeName = LegacyUmbracoSettings.UseLegacyXmlSchema ? "node" : media.ContentType.Alias.ToSafeAliasWithForcingCheck(); var xml = Export(media, nodeName); xml.Add(new XAttribute("nodeType", media.ContentType.Id)); diff --git a/src/Umbraco.Core/StringExtensions.cs b/src/Umbraco.Core/StringExtensions.cs index 4feed19a23..b0dc53c22f 100644 --- a/src/Umbraco.Core/StringExtensions.cs +++ b/src/Umbraco.Core/StringExtensions.cs @@ -947,7 +947,7 @@ namespace Umbraco.Core /// Checks UmbracoSettings.ForceSafeAliases to determine whether it should filter the text. public static string ToSafeAliasWithForcingCheck(this string alias) { - return UmbracoSettings.ForceSafeAliases ? alias.ToSafeAlias() : alias; + return LegacyUmbracoSettings.ForceSafeAliases ? alias.ToSafeAlias() : alias; } /// @@ -959,7 +959,7 @@ namespace Umbraco.Core /// Checks UmbracoSettings.ForceSafeAliases to determine whether it should filter the text. public static string ToSafeAliasWithForcingCheck(this string alias, CultureInfo culture) { - return UmbracoSettings.ForceSafeAliases ? alias.ToSafeAlias(culture) : alias; + return LegacyUmbracoSettings.ForceSafeAliases ? alias.ToSafeAlias(culture) : alias; } // note: LegacyShortStringHelper will produce a 100% backward-compatible output for ToUmbracoAlias. diff --git a/src/Umbraco.Core/Strings/DefaultShortStringHelper.cs b/src/Umbraco.Core/Strings/DefaultShortStringHelper.cs index c3845e7318..52d6087c75 100644 --- a/src/Umbraco.Core/Strings/DefaultShortStringHelper.cs +++ b/src/Umbraco.Core/Strings/DefaultShortStringHelper.cs @@ -57,7 +57,7 @@ namespace Umbraco.Core.Strings static void InitializeLegacyUrlReplaceCharacters() { - var replaceChars = UmbracoSettings.UrlReplaceCharacters; + var replaceChars = LegacyUmbracoSettings.UrlReplaceCharacters; if (replaceChars == null) return; var nodes = replaceChars.SelectNodes("char"); if (nodes == null) return; @@ -234,7 +234,7 @@ function validateSafeAlias(id, value, immediate, callback) {{ public string GetShortStringServicesJavaScript(string controllerPath) { return string.Format(SssjsFormat, - UmbracoSettings.ForceSafeAliases ? "true" : "false", controllerPath); + LegacyUmbracoSettings.ForceSafeAliases ? "true" : "false", controllerPath); } #endregion diff --git a/src/Umbraco.Core/Strings/LegacyShortStringHelper.cs b/src/Umbraco.Core/Strings/LegacyShortStringHelper.cs index c2721c49c8..97354c17d6 100644 --- a/src/Umbraco.Core/Strings/LegacyShortStringHelper.cs +++ b/src/Umbraco.Core/Strings/LegacyShortStringHelper.cs @@ -94,7 +94,7 @@ function isValidAlias(alias) {{ public string GetShortStringServicesJavaScript(string controllerPath) { return string.Format(SssjsFormat, - UmbracoSettings.ForceSafeAliases ? "true" : "false", SssjsValidCharacters, SssjsInvalidFirstCharacters); + LegacyUmbracoSettings.ForceSafeAliases ? "true" : "false", SssjsValidCharacters, SssjsInvalidFirstCharacters); } #endregion @@ -205,7 +205,7 @@ function isValidAlias(alias) {{ var ext = filePath.Substring(filePath.LastIndexOf('.')); //Because the file usually is downloadable as well we check characters against 'UmbracoSettings.UrlReplaceCharacters' - XmlNode replaceChars = UmbracoSettings.UrlReplaceCharacters; + XmlNode replaceChars = LegacyUmbracoSettings.UrlReplaceCharacters; foreach (XmlNode n in replaceChars.SelectNodes("char")) { if (n.Attributes.GetNamedItem("org") != null && n.Attributes.GetNamedItem("org").Value != "") @@ -469,7 +469,7 @@ function isValidAlias(alias) {{ public string LegacyFormatUrl(string url) { var newUrl = url.ToLowerInvariant(); - var replaceChars = UmbracoSettings.UrlReplaceCharacters; + var replaceChars = LegacyUmbracoSettings.UrlReplaceCharacters; foreach (XmlNode n in replaceChars.SelectNodes("char")) { if (n.Attributes.GetNamedItem("org") != null && n.Attributes.GetNamedItem("org").Value != "") @@ -477,7 +477,7 @@ function isValidAlias(alias) {{ } // check for double dashes - if (UmbracoSettings.RemoveDoubleDashesFromUrlReplacing) + if (LegacyUmbracoSettings.RemoveDoubleDashesFromUrlReplacing) { newUrl = Regex.Replace(newUrl, @"[-]{2,}", "-"); } diff --git a/src/Umbraco.Core/Sync/ConfigServerRegistrar.cs b/src/Umbraco.Core/Sync/ConfigServerRegistrar.cs index 5c1a8c2784..3c0cfaa807 100644 --- a/src/Umbraco.Core/Sync/ConfigServerRegistrar.cs +++ b/src/Umbraco.Core/Sync/ConfigServerRegistrar.cs @@ -16,7 +16,7 @@ namespace Umbraco.Core.Sync private readonly XmlNode _xmlServers; public ConfigServerRegistrar() - : this(UmbracoSettings.DistributionServers) + : this(LegacyUmbracoSettings.DistributionServers) { } diff --git a/src/Umbraco.Core/Sync/DefaultServerMessenger.cs b/src/Umbraco.Core/Sync/DefaultServerMessenger.cs index 66609d5c56..4aa8c1652c 100644 --- a/src/Umbraco.Core/Sync/DefaultServerMessenger.cs +++ b/src/Umbraco.Core/Sync/DefaultServerMessenger.cs @@ -39,7 +39,7 @@ namespace Umbraco.Core.Sync /// /// internal DefaultServerMessenger(string login, string password) - : this(login, password, UmbracoSettings.UseDistributedCalls) + : this(login, password, LegacyUmbracoSettings.UseDistributedCalls) { } @@ -226,7 +226,7 @@ namespace Umbraco.Core.Sync { Login = result.Item1; Password = result.Item2; - _useDistributedCalls = UmbracoSettings.UseDistributedCalls; + _useDistributedCalls = LegacyUmbracoSettings.UseDistributedCalls; } } catch (Exception ex) diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index 6cb9ca7629..3b6c693803 100644 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -151,6 +151,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -697,7 +750,7 @@ - + diff --git a/src/Umbraco.Core/XmlHelper.cs b/src/Umbraco.Core/XmlHelper.cs index c6249c8774..cf76c4a032 100644 --- a/src/Umbraco.Core/XmlHelper.cs +++ b/src/Umbraco.Core/XmlHelper.cs @@ -78,7 +78,7 @@ namespace Umbraco.Core if (xml == null) return false; xml = xml.Trim(); if (xml.StartsWith("<") == false || xml.EndsWith(">") == false || xml.Contains('/') == false) return false; - if (UmbracoSettings.NotDynamicXmlDocumentElements.Any(x => x.InvariantEquals(alias))) return false; + if (LegacyUmbracoSettings.NotDynamicXmlDocumentElements.Any(x => x.InvariantEquals(alias))) return false; return TryCreateXPathDocument(xml, out doc); } diff --git a/src/Umbraco.Tests/CodeFirst/CodeFirstTests.cs b/src/Umbraco.Tests/CodeFirst/CodeFirstTests.cs index d8b0909312..7cad61dd43 100644 --- a/src/Umbraco.Tests/CodeFirst/CodeFirstTests.cs +++ b/src/Umbraco.Tests/CodeFirst/CodeFirstTests.cs @@ -20,7 +20,7 @@ namespace Umbraco.Tests.CodeFirst [SetUp] public override void Initialize() { - UmbracoSettings.SettingsFilePath = IOHelper.MapPath(SystemDirectories.Config + Path.DirectorySeparatorChar, false); + LegacyUmbracoSettings.SettingsFilePath = IOHelper.MapPath(SystemDirectories.Config + Path.DirectorySeparatorChar, false); base.Initialize(); diff --git a/src/Umbraco.Tests/CodeFirst/Definitions/ContentTypeDefinitionFactory.cs b/src/Umbraco.Tests/CodeFirst/Definitions/ContentTypeDefinitionFactory.cs index eb1d9ee8fd..14f40660dd 100644 --- a/src/Umbraco.Tests/CodeFirst/Definitions/ContentTypeDefinitionFactory.cs +++ b/src/Umbraco.Tests/CodeFirst/Definitions/ContentTypeDefinitionFactory.cs @@ -311,7 +311,7 @@ namespace Umbraco.Tests.CodeFirst.Definitions private static IEnumerable AllowedTemplatesConvention(IEnumerable templateNames) { var templates = new List(); - var engine = UmbracoSettings.DefaultRenderingEngine; + var engine = LegacyUmbracoSettings.DefaultRenderingEngine; foreach (var templateName in templateNames) { var @alias = engine == RenderingEngine.Mvc diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/ContentElementTests.cs b/src/Umbraco.Tests/Configurations/UmbracoSettings/ContentElementTests.cs new file mode 100644 index 0000000000..67698243d4 --- /dev/null +++ b/src/Umbraco.Tests/Configurations/UmbracoSettings/ContentElementTests.cs @@ -0,0 +1,120 @@ +using System.Collections.Generic; +using System.Linq; +using System.Net.Configuration; +using System.Text; +using System.Threading.Tasks; +using NUnit.Framework; +using Umbraco.Core; + +namespace Umbraco.Tests.Configurations.UmbracoSettings +{ + [TestFixture] + public class ContentElementTests : UmbracoSettingsTests + { + [Test] + public void ScriptFolderPath() + { + Assert.IsTrue(Section.Content.UploadAllowDirectories == true); + } + [Test] + public void DefaultDocumentTypeProperty() + { + Assert.IsTrue(Section.Content.DefaultDocumentTypeProperty == "Textstring"); + } + [Test] + public void GlobalPreviewStorageEnabled() + { + Assert.IsTrue(Section.Content.GlobalPreviewStorageEnabled == false); + } + [Test] + public void CloneXmlContent() + { + Assert.IsTrue(Section.Content.CloneXmlContent == true); + } + [Test] + public void EnsureUniqueNaming() + { + Assert.IsTrue(Section.Content.EnsureUniqueNaming == true); + } + [Test] + public void TidyEditorContent() + { + Assert.IsTrue(Section.Content.TidyEditorContent == false); + } + [Test] + public void TidyCharEncoding() + { + Assert.IsTrue(Section.Content.TidyCharEncoding == "Raw"); + } + [Test] + public void UseLegacyXmlSchema() + { + Assert.IsTrue(Section.Content.UseLegacyXmlSchema == false); + } + [Test] + public void ForceSafeAliases() + { + Assert.IsTrue(Section.Content.ForceSafeAliases == true); + } + [Test] + public void XmlCacheEnabled() + { + Assert.IsTrue(Section.Content.XmlCacheEnabled == true); + } + [Test] + public void ContinouslyUpdateXmlDiskCache() + { + Assert.IsTrue(Section.Content.ContinouslyUpdateXmlDiskCache == true); + } + [Test] + public void XmlContentCheckForDiskChanges() + { + Assert.IsTrue(Section.Content.XmlContentCheckForDiskChanges == true); + } + [Test] + public void EnableSplashWhileLoading() + { + Assert.IsTrue(Section.Content.EnableSplashWhileLoading == false); + } + [Test] + public void PropertyContextHelpOption() + { + Assert.IsTrue(Section.Content.PropertyContextHelpOption == "text"); + } + [Test] + public void EnableCanvasEditing() + { + Assert.IsTrue(Section.Content.EnableCanvasEditing == false); + } + [Test] + public void PreviewBadge() + { + Assert.IsTrue(Section.Content.PreviewBadge == @"In Preview Mode - click to end"); + } + [Test] + public void UmbracoLibraryCacheDuration() + { + Assert.IsTrue(Section.Content.UmbracoLibraryCacheDuration == 1800); + } + [Test] + public void ResolveUrlsFromTextString() + { + Assert.IsTrue(Section.Content.ResolveUrlsFromTextString); + } + [Test] + public void MacroErrors() + { + Assert.IsTrue(Section.Content.MacroErrors == "inline"); + } + [Test] + public void DocumentTypeIconList() + { + Assert.IsTrue(Section.Content.DocumentTypeIconList == IconPickerBehaviour.HideFileDuplicates); + } + [Test] + public void DisallowedUploadFiles() + { + Assert.IsTrue(Section.Content.DisallowedUploadFiles.All(x => "ashx,aspx,ascx,config,cshtml,vbhtml,asmx,air,axd".Split(',').Contains(x))); + } + } +} diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/ContentErrorsElementTests.cs b/src/Umbraco.Tests/Configurations/UmbracoSettings/ContentErrorsElementTests.cs new file mode 100644 index 0000000000..38ef872899 --- /dev/null +++ b/src/Umbraco.Tests/Configurations/UmbracoSettings/ContentErrorsElementTests.cs @@ -0,0 +1,21 @@ +using System.Linq; +using NUnit.Framework; + +namespace Umbraco.Tests.Configurations.UmbracoSettings +{ + [TestFixture] + public class ContentErrorsElementTests : UmbracoSettingsTests + { + [Test] + public void Can_Set_Multiple() + { + Assert.IsTrue(Section.Content.Errors.Error404Collection.Count == 3); + Assert.IsTrue(Section.Content.Errors.Error404Collection.ElementAt(0).Culture == "default"); + Assert.IsTrue(Section.Content.Errors.Error404Collection.ElementAt(0).Value == 1047); + Assert.IsTrue(Section.Content.Errors.Error404Collection.ElementAt(1).Culture == "en-US"); + Assert.IsTrue(Section.Content.Errors.Error404Collection.ElementAt(1).Value == 1048); + Assert.IsTrue(Section.Content.Errors.Error404Collection.ElementAt(2).Culture == "en-UK"); + Assert.IsTrue(Section.Content.Errors.Error404Collection.ElementAt(2).Value == 1049); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/ContentImagingElementTests.cs b/src/Umbraco.Tests/Configurations/UmbracoSettings/ContentImagingElementTests.cs new file mode 100644 index 0000000000..e60b554c1a --- /dev/null +++ b/src/Umbraco.Tests/Configurations/UmbracoSettings/ContentImagingElementTests.cs @@ -0,0 +1,35 @@ +using System.Linq; +using NUnit.Framework; + +namespace Umbraco.Tests.Configurations.UmbracoSettings +{ + [TestFixture] + public class ContentImagingElementTests : UmbracoSettingsTests + { + [Test] + public void ImageFileTypes() + { + Assert.IsTrue(Section.Content.Imaging.ImageFileTypes.All(x => "jpeg,jpg,gif,bmp,png,tiff,tif".Split(',').Contains(x))); + } + [Test] + public void AllowedAttributes() + { + Assert.IsTrue(Section.Content.Imaging.AllowedAttributes.All(x => "src,alt,border,class,style,align,id,name,onclick,usemap".Split(',').Contains(x))); + } + [Test] + public void ImageAutoFillProperties() + { + Assert.IsTrue(Section.Content.Imaging.ImageAutoFillProperties.Count == 2); + Assert.IsTrue(Section.Content.Imaging.ImageAutoFillProperties.ElementAt(0).Alias == "umbracoFile"); + Assert.IsTrue(Section.Content.Imaging.ImageAutoFillProperties.ElementAt(0).WidthFieldAlias == "umbracoWidth"); + Assert.IsTrue(Section.Content.Imaging.ImageAutoFillProperties.ElementAt(0).HeightFieldAlias == "umbracoHeight"); + Assert.IsTrue(Section.Content.Imaging.ImageAutoFillProperties.ElementAt(0).LengthFieldAlias == "umbracoBytes"); + Assert.IsTrue(Section.Content.Imaging.ImageAutoFillProperties.ElementAt(0).ExtensionFieldAlias == "umbracoExtension"); + Assert.IsTrue(Section.Content.Imaging.ImageAutoFillProperties.ElementAt(1).Alias == "umbracoFile2"); + Assert.IsTrue(Section.Content.Imaging.ImageAutoFillProperties.ElementAt(1).WidthFieldAlias == "umbracoWidth2"); + Assert.IsTrue(Section.Content.Imaging.ImageAutoFillProperties.ElementAt(1).HeightFieldAlias == "umbracoHeight2"); + Assert.IsTrue(Section.Content.Imaging.ImageAutoFillProperties.ElementAt(1).LengthFieldAlias == "umbracoBytes2"); + Assert.IsTrue(Section.Content.Imaging.ImageAutoFillProperties.ElementAt(1).ExtensionFieldAlias == "umbracoExtension2"); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/ContentNotificationsElementTests.cs b/src/Umbraco.Tests/Configurations/UmbracoSettings/ContentNotificationsElementTests.cs new file mode 100644 index 0000000000..80ecea1b22 --- /dev/null +++ b/src/Umbraco.Tests/Configurations/UmbracoSettings/ContentNotificationsElementTests.cs @@ -0,0 +1,19 @@ +using NUnit.Framework; + +namespace Umbraco.Tests.Configurations.UmbracoSettings +{ + [TestFixture] + public class ContentNotificationsElementTests : UmbracoSettingsTests + { + [Test] + public void EmailAddress() + { + Assert.IsTrue(Section.Content.Notifications.EmailAddress == "robot@umbraco.dk"); + } + [Test] + public void DisableHtmlEmail() + { + Assert.IsTrue(Section.Content.Notifications.DisableHtmlEmail == false); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/ContentScriptEditorElementTests.cs b/src/Umbraco.Tests/Configurations/UmbracoSettings/ContentScriptEditorElementTests.cs new file mode 100644 index 0000000000..cbc42eecfc --- /dev/null +++ b/src/Umbraco.Tests/Configurations/UmbracoSettings/ContentScriptEditorElementTests.cs @@ -0,0 +1,25 @@ +using System.Linq; +using NUnit.Framework; + +namespace Umbraco.Tests.Configurations.UmbracoSettings +{ + [TestFixture] + public class ContentScriptEditorElementTests : UmbracoSettingsTests + { + [Test] + public void ScriptFolderPath() + { + Assert.IsTrue(Section.Content.ScriptEditor.ScriptFolderPath.Value == "/scripts"); + } + [Test] + public void ScriptFileTypes() + { + Assert.IsTrue(Section.Content.ScriptEditor.ScriptFileTypes.All(x => "js,xml".Split(',').Contains(x))); + } + [Test] + public void DisableScriptEditor() + { + Assert.IsTrue(Section.Content.ScriptEditor.DisableScriptEditor.Value == false); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/DeveloperElementTests.cs b/src/Umbraco.Tests/Configurations/UmbracoSettings/DeveloperElementTests.cs new file mode 100644 index 0000000000..9cb0dd2bd8 --- /dev/null +++ b/src/Umbraco.Tests/Configurations/UmbracoSettings/DeveloperElementTests.cs @@ -0,0 +1,16 @@ +using System.Linq; +using NUnit.Framework; + +namespace Umbraco.Tests.Configurations.UmbracoSettings +{ + [TestFixture] + public class DeveloperElementTests : UmbracoSettingsTests + { + [Test] + public void AppCodeFileExtensions() + { + Assert.IsTrue(Section.Developer.AppCodeFileExtensions.AppCodeFileExtensionsCollection.All( + x => "cs,vb".Split(',').Contains(x.Value))); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/DistributedCallElementTests.cs b/src/Umbraco.Tests/Configurations/UmbracoSettings/DistributedCallElementTests.cs new file mode 100644 index 0000000000..77e40fa92f --- /dev/null +++ b/src/Umbraco.Tests/Configurations/UmbracoSettings/DistributedCallElementTests.cs @@ -0,0 +1,31 @@ +using System.Linq; +using NUnit.Framework; + +namespace Umbraco.Tests.Configurations.UmbracoSettings +{ + [TestFixture] + public class DistributedCallElementTests : UmbracoSettingsTests + { + [Test] + public void Enabled() + { + Assert.IsTrue(Section.DistributedCall.Enabled == true); + + } + [Test] + public void UserId() + { + Assert.IsTrue(Section.DistributedCall.UserId == 0); + + } + [Test] + public void Servers() + { + Assert.IsTrue(Section.DistributedCall.Servers.Count == 2); + Assert.IsTrue(Section.DistributedCall.Servers.ElementAt(0).Value == "127.0.0.1"); + Assert.IsTrue(Section.DistributedCall.Servers.ElementAt(1).Value == "127.0.0.2"); + Assert.IsTrue(Section.DistributedCall.Servers.ElementAt(1).ForceProtocol == "https"); + Assert.IsTrue(Section.DistributedCall.Servers.ElementAt(1).ForcePortnumber == "443"); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/HelpElementTests.cs b/src/Umbraco.Tests/Configurations/UmbracoSettings/HelpElementTests.cs new file mode 100644 index 0000000000..0f460d3076 --- /dev/null +++ b/src/Umbraco.Tests/Configurations/UmbracoSettings/HelpElementTests.cs @@ -0,0 +1,31 @@ +using System.Linq; +using NUnit.Framework; + +namespace Umbraco.Tests.Configurations.UmbracoSettings +{ + [TestFixture] + public class HelpElementTests : UmbracoSettingsTests + { + [Test] + public void DefaultUrl() + { + Assert.IsTrue(Section.Help.DefaultUrl == "http://our.umbraco.org/wiki/umbraco-help/{0}/{1}"); + } + + [Test] + public void Links() + { + Assert.IsTrue(Section.Help.Links.Count == 2); + Assert.IsTrue(Section.Help.Links.ElementAt(0).Application == "content"); + Assert.IsTrue(Section.Help.Links.ElementAt(0).ApplicationUrl == "dashboard.aspx"); + Assert.IsTrue(Section.Help.Links.ElementAt(0).Language == "en"); + Assert.IsTrue(Section.Help.Links.ElementAt(0).UserType == "Administrators"); + Assert.IsTrue(Section.Help.Links.ElementAt(0).HelpUrl == "http://www.xyz.no?{0}/{1}/{2}/{3}"); + Assert.IsTrue(Section.Help.Links.ElementAt(1).Application == "media"); + Assert.IsTrue(Section.Help.Links.ElementAt(1).ApplicationUrl == "dashboard2.aspx"); + Assert.IsTrue(Section.Help.Links.ElementAt(1).Language == "ch"); + Assert.IsTrue(Section.Help.Links.ElementAt(1).UserType == "Writers"); + Assert.IsTrue(Section.Help.Links.ElementAt(1).HelpUrl == "http://www.abc.no?{0}/{1}/{2}/{3}"); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/LoggingElementTests.cs b/src/Umbraco.Tests/Configurations/UmbracoSettings/LoggingElementTests.cs new file mode 100644 index 0000000000..e03ad18e18 --- /dev/null +++ b/src/Umbraco.Tests/Configurations/UmbracoSettings/LoggingElementTests.cs @@ -0,0 +1,61 @@ +using System.Linq; +using NUnit.Framework; + +namespace Umbraco.Tests.Configurations.UmbracoSettings +{ + [TestFixture] + public class LoggingElementTests : UmbracoSettingsTests + { + [Test] + public void EnableLogging() + { + Assert.IsTrue(Section.Logging.EnableLogging == true); + } + [Test] + public void EnableAsyncLogging() + { + Assert.IsTrue(Section.Logging.EnableAsyncLogging == true); + } + [Test] + public void DisabledLogTypes() + { + Assert.IsTrue(Section.Logging.DisabledLogTypes.Count == 2); + Assert.IsTrue(Section.Logging.DisabledLogTypes.ElementAt(0) == "[alias-of-log-type-in-lowercase]"); + Assert.IsTrue(Section.Logging.DisabledLogTypes.ElementAt(1) == "anotherlogalias"); + } + [Test] + public void Assembly() + { + Assert.IsTrue(Section.Logging.ExternalLogger.Assembly == "~/bin/assemblyFileName.dll"); + } + [Test] + public void Type() + { + Assert.IsTrue(Section.Logging.ExternalLogger.Type == "fully.qualified.namespace.and.type"); + } + [Test] + public void LogAuditTrail() + { + Assert.IsTrue(Section.Logging.ExternalLogger.LogAuditTrail == false); + } + [Test] + public void AutoCleanLogs() + { + Assert.IsTrue(Section.Logging.AutoCleanLogs == false); + } + + [Test] + public void CleaningMiliseconds() + { + Assert.IsTrue(Section.Logging.CleaningMiliseconds == 86400); + + } + [Test] + public void MaxLogAge() + { + Assert.IsTrue(Section.Logging.MaxLogAge == 1440); + + } + + } +} \ No newline at end of file diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/PackageRepositoriesElementTests.cs b/src/Umbraco.Tests/Configurations/UmbracoSettings/PackageRepositoriesElementTests.cs new file mode 100644 index 0000000000..57d9b7f78d --- /dev/null +++ b/src/Umbraco.Tests/Configurations/UmbracoSettings/PackageRepositoriesElementTests.cs @@ -0,0 +1,20 @@ +using System; +using System.Linq; +using NUnit.Framework; + +namespace Umbraco.Tests.Configurations.UmbracoSettings +{ + [TestFixture] + public class PackageRepositoriesElementTests : UmbracoSettingsTests + { + [Test] + public void Repositories() + { + Assert.IsTrue(Section.PackageRepositories.Repositories.Count == 2); + Assert.IsTrue(Section.PackageRepositories.Repositories.ElementAt(0).Id == Guid.Parse("65194810-1f85-11dd-bd0b-0800200c9a66")); + Assert.IsTrue(Section.PackageRepositories.Repositories.ElementAt(0).Name == "Umbraco package Repository"); + Assert.IsTrue(Section.PackageRepositories.Repositories.ElementAt(1).Id == Guid.Parse("163245E0-CD22-44B6-841A-1B9B9D2E955F")); + Assert.IsTrue(Section.PackageRepositories.Repositories.ElementAt(1).Name == "Test Repo"); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/ProvidersElementTests.cs b/src/Umbraco.Tests/Configurations/UmbracoSettings/ProvidersElementTests.cs new file mode 100644 index 0000000000..190f532e16 --- /dev/null +++ b/src/Umbraco.Tests/Configurations/UmbracoSettings/ProvidersElementTests.cs @@ -0,0 +1,14 @@ +using NUnit.Framework; + +namespace Umbraco.Tests.Configurations.UmbracoSettings +{ + [TestFixture] + public class ProvidersElementTests : UmbracoSettingsTests + { + [Test] + public void Users() + { + Assert.IsTrue(Section.Providers.Users.DefaultBackOfficeProvider == "UsersMembershipProvider"); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/RequestHandlerElementTests.cs b/src/Umbraco.Tests/Configurations/UmbracoSettings/RequestHandlerElementTests.cs new file mode 100644 index 0000000000..322ba6055f --- /dev/null +++ b/src/Umbraco.Tests/Configurations/UmbracoSettings/RequestHandlerElementTests.cs @@ -0,0 +1,39 @@ +using System.Linq; +using NUnit.Framework; + +namespace Umbraco.Tests.Configurations.UmbracoSettings +{ + [TestFixture] + public class RequestHandlerElementTests : UmbracoSettingsTests + { + [Test] + public void UseDomainPrefixes() + { + Assert.IsTrue(Section.RequestHandler.UseDomainPrefixes == false); + + } + [Test] + public void AddTrailingSlash() + { + Assert.IsTrue(Section.RequestHandler.AddTrailingSlash == true); + } + [Test] + public void RemoveDoubleDashes() + { + Assert.IsTrue(Section.RequestHandler.UrlReplacing.RemoveDoubleDashes == true); + + } + [Test] + public void CharCollection() + { + Assert.IsTrue(Section.RequestHandler.UrlReplacing.CharCollection.Count == 26); + var chars = @" ,"",',%,.,;,/,\,:,#,+,*,&,?,æ,ø,å,ä,ö,ü,ß,Ä,Ö,|,<,>"; + Assert.IsTrue(Section.RequestHandler.UrlReplacing.CharCollection + .All(x => chars.Split(',').Contains(x.Char))); + var vals = @"-,plus,star,ae,oe,aa,ae,oe,ue,ss,ae,oe"; + Assert.IsTrue(Section.RequestHandler.UrlReplacing.CharCollection + .All(x => string.IsNullOrEmpty(x.Value) || vals.Split(',').Contains(x.Value))); + } + + } +} \ No newline at end of file diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/ScheduledTasksElementTests.cs b/src/Umbraco.Tests/Configurations/UmbracoSettings/ScheduledTasksElementTests.cs new file mode 100644 index 0000000000..7dbd468a47 --- /dev/null +++ b/src/Umbraco.Tests/Configurations/UmbracoSettings/ScheduledTasksElementTests.cs @@ -0,0 +1,24 @@ +using System.Linq; +using NUnit.Framework; + +namespace Umbraco.Tests.Configurations.UmbracoSettings +{ + [TestFixture] + public class ScheduledTasksElementTests : UmbracoSettingsTests + { + [Test] + public void Tasks() + { + Assert.IsTrue(Section.ScheduledTasks.Tasks.Count == 2); + Assert.IsTrue(Section.ScheduledTasks.Tasks.ElementAt(0).Alias == "test60"); + Assert.IsTrue(Section.ScheduledTasks.Tasks.ElementAt(0).Log == true); + Assert.IsTrue(Section.ScheduledTasks.Tasks.ElementAt(0).Interval == 60); + Assert.IsTrue(Section.ScheduledTasks.Tasks.ElementAt(0).Url == "http://localhost/umbraco/test.aspx"); + Assert.IsTrue(Section.ScheduledTasks.Tasks.ElementAt(1).Alias == "testtest"); + Assert.IsTrue(Section.ScheduledTasks.Tasks.ElementAt(1).Log == false); + Assert.IsTrue(Section.ScheduledTasks.Tasks.ElementAt(1).Interval == 61); + Assert.IsTrue(Section.ScheduledTasks.Tasks.ElementAt(1).Url == "http://localhost/umbraco/test1.aspx"); + } + + } +} \ No newline at end of file diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/ScriptingElementTests.cs b/src/Umbraco.Tests/Configurations/UmbracoSettings/ScriptingElementTests.cs new file mode 100644 index 0000000000..e5db045f09 --- /dev/null +++ b/src/Umbraco.Tests/Configurations/UmbracoSettings/ScriptingElementTests.cs @@ -0,0 +1,45 @@ +using System; +using System.Linq; +using NUnit.Framework; + +namespace Umbraco.Tests.Configurations.UmbracoSettings +{ + [TestFixture] + public class ScriptingElementTests : UmbracoSettingsTests + { + [Test] + public void NotDynamicXmlDocumentElements() + { + Assert.IsTrue(Section.Scripting.Razor.NotDynamicXmlDocumentElements + .All(x => "p,div,ul,span".Split(',').Contains(x.Value))); + } + + [Test] + public void DataTypeModelStaticMappings() + { + var mappings = Section.Scripting.Razor.DataTypeModelStaticMappings.ToArray(); + Assert.IsTrue(mappings[0].DataTypeGuid == Guid.Parse("A3DB4034-BCB0-4E69-B3EE-DD4E6ECA74C2")); + Assert.IsTrue(mappings[0] == "MyName.1"); + + Assert.IsTrue(mappings[1].DocumentTypeAlias == "textPage2"); + Assert.IsTrue(mappings[1].NodeTypeAlias == "propertyAlias2"); + Assert.IsTrue(mappings[1] == "MyName.2"); + + Assert.IsTrue(mappings[2].DataTypeGuid == Guid.Parse("BD14E709-45BE-431C-B228-6255CDEDFCD5")); + Assert.IsTrue(mappings[2].DocumentTypeAlias == "textPage3"); + Assert.IsTrue(mappings[2].NodeTypeAlias == "propertyAlias3"); + Assert.IsTrue(mappings[2] == "MyName.3"); + + Assert.IsTrue(mappings[3].DataTypeGuid == Guid.Parse("FCE8187E-0366-4833-953A-E5ECA11AA23A")); + Assert.IsTrue(mappings[3].DocumentTypeAlias == "textPage4"); + Assert.IsTrue(mappings[3] == "MyName.4"); + + Assert.IsTrue(mappings[4].DataTypeGuid == Guid.Parse("9139315A-6681-4C45-B89F-BE48D30F9AB9")); + Assert.IsTrue(mappings[4].NodeTypeAlias == "propertyAlias5"); + Assert.IsTrue(mappings[4] == "MyName.5"); + + Assert.IsTrue(mappings[5].NodeTypeAlias == "propertyAlias6"); + Assert.IsTrue(mappings[5] == "MyName.6"); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/SecurityElementTests.cs b/src/Umbraco.Tests/Configurations/UmbracoSettings/SecurityElementTests.cs new file mode 100644 index 0000000000..50f220118d --- /dev/null +++ b/src/Umbraco.Tests/Configurations/UmbracoSettings/SecurityElementTests.cs @@ -0,0 +1,29 @@ +using NUnit.Framework; + +namespace Umbraco.Tests.Configurations.UmbracoSettings +{ + [TestFixture] + public class SecurityElementTests : UmbracoSettingsTests + { + [Test] + public void KeepUserLoggedIn() + { + Assert.IsTrue(Section.Security.KeepUserLoggedIn == true); + } + [Test] + public void HideDisabledUsersInBackoffice() + { + Assert.IsTrue(Section.Security.HideDisabledUsersInBackoffice == false); + } + [Test] + public void AuthCookieDomain() + { + Assert.IsTrue(Section.Security.AuthCookieDomain.Value == null); + } + [Test] + public void AuthCookieName() + { + Assert.IsTrue(Section.Security.AuthCookieName.Value == "UMB_UCONTEXT"); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/TemplateElementTests.cs b/src/Umbraco.Tests/Configurations/UmbracoSettings/TemplateElementTests.cs new file mode 100644 index 0000000000..59f63426ce --- /dev/null +++ b/src/Umbraco.Tests/Configurations/UmbracoSettings/TemplateElementTests.cs @@ -0,0 +1,25 @@ +using NUnit.Framework; +using Umbraco.Core; + +namespace Umbraco.Tests.Configurations.UmbracoSettings +{ + [TestFixture] + public class TemplateElementTests : UmbracoSettingsTests + { + [Test] + public void UseAspNetMasterPages() + { + Assert.IsTrue(Section.Templates.UseAspNetMasterPages == true); + } + [Test] + public void DefaultRenderingEngine() + { + Assert.IsTrue(Section.Templates.DefaultRenderingEngine == RenderingEngine.Mvc); + } + [Test] + public void EnableTemplateFolders() + { + Assert.IsTrue(Section.Templates.EnableTemplateFolders == false); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/UmbracoSettingsTests.cs b/src/Umbraco.Tests/Configurations/UmbracoSettings/UmbracoSettingsTests.cs new file mode 100644 index 0000000000..861327ffe5 --- /dev/null +++ b/src/Umbraco.Tests/Configurations/UmbracoSettings/UmbracoSettingsTests.cs @@ -0,0 +1,27 @@ +using System.Configuration; +using System.IO; +using NUnit.Framework; +using Umbraco.Core.Configuration.UmbracoSettings; +using Umbraco.Tests.TestHelpers; + +namespace Umbraco.Tests.Configurations.UmbracoSettings +{ + public abstract class UmbracoSettingsTests + { + //TODO: Need to test defaults after all this is done. + + [SetUp] + public void Init() + { + var config = new FileInfo(TestHelper.MapPathForTest("~/Configurations/UmbracoSettings/web.config")); + + var fileMap = new ExeConfigurationFileMap() { ExeConfigFilename = config.FullName }; + var configuration = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None); + Section = configuration.GetSection("umbracoConfiguration/settings") as UmbracoSettingsSection; + + Assert.IsNotNull(Section); + } + + protected UmbracoSettingsSection Section { get; private set; } + } +} \ No newline at end of file diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/ViewstateMoverModuleElementTests.cs b/src/Umbraco.Tests/Configurations/UmbracoSettings/ViewstateMoverModuleElementTests.cs new file mode 100644 index 0000000000..013270f639 --- /dev/null +++ b/src/Umbraco.Tests/Configurations/UmbracoSettings/ViewstateMoverModuleElementTests.cs @@ -0,0 +1,14 @@ +using NUnit.Framework; + +namespace Umbraco.Tests.Configurations.UmbracoSettings +{ + [TestFixture] + public class ViewstateMoverModuleElementTests : UmbracoSettingsTests + { + [Test] + public void Enable() + { + Assert.IsTrue(Section.ViewstateMoverModule.Enable == false); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/WebRoutingElementTests.cs b/src/Umbraco.Tests/Configurations/UmbracoSettings/WebRoutingElementTests.cs new file mode 100644 index 0000000000..bc2c977ca4 --- /dev/null +++ b/src/Umbraco.Tests/Configurations/UmbracoSettings/WebRoutingElementTests.cs @@ -0,0 +1,20 @@ +using NUnit.Framework; + +namespace Umbraco.Tests.Configurations.UmbracoSettings +{ + [TestFixture] + public class WebRoutingElementTests : UmbracoSettingsTests + { + [Test] + public void TrySkipIisCustomErrors() + { + Assert.IsTrue(Section.WebRouting.TrySkipIisCustomErrors == false); + } + + [Test] + public void InternalRedirectPreservesTemplate() + { + Assert.IsTrue(Section.WebRouting.TrySkipIisCustomErrors == false); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/WebServicesElementTests.cs b/src/Umbraco.Tests/Configurations/UmbracoSettings/WebServicesElementTests.cs new file mode 100644 index 0000000000..9f00c46991 --- /dev/null +++ b/src/Umbraco.Tests/Configurations/UmbracoSettings/WebServicesElementTests.cs @@ -0,0 +1,67 @@ +using System.Linq; +using NUnit.Framework; + +namespace Umbraco.Tests.Configurations.UmbracoSettings +{ + [TestFixture] + public class WebServicesElementTests : UmbracoSettingsTests + { + [Test] + public void Enabled() + { + Assert.IsTrue(Section.WebServices.Enabled == true); + + } + [Test] + public void FileServiceFolders() + { + Assert.IsTrue(Section.WebServices.FileServiceFolders.First() == "css"); + Assert.IsTrue(Section.WebServices.FileServiceFolders.Last() == "xslt"); + + } + [Test] + public void DocumentServiceUsers() + { + Assert.IsTrue(Section.WebServices.DocumentServiceUsers.First() == "your-username1"); + + } + [Test] + public void FileServiceUsers() + { + Assert.IsTrue(Section.WebServices.FileServiceUsers.First() == "your-username2"); + + } + [Test] + public void StylesheetServiceUsers() + { + Assert.IsTrue(Section.WebServices.StylesheetServiceUsers.First() == "your-username3"); + + } + [Test] + public void MemberServiceUsers() + { + Assert.IsTrue(Section.WebServices.MemberServiceUsers.First() == "your-username4"); + + } + [Test] + public void TemplateServiceUsers() + { + Assert.IsTrue(Section.WebServices.TemplateServiceUsers.First() == "your-username5"); + + } + [Test] + public void MediaServiceUsers() + { + Assert.IsTrue(Section.WebServices.MediaServiceUsers.First() == "your-username6"); + + } + [Test] + public void MaintenanceServiceUsers() + { + Assert.IsTrue(Section.WebServices.MaintenanceServiceUsers.Any() == false); + + } + + + } +} \ No newline at end of file diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/umbracoSettings.config b/src/Umbraco.Tests/Configurations/UmbracoSettings/umbracoSettings.config new file mode 100644 index 0000000000..581fc29cb6 --- /dev/null +++ b/src/Umbraco.Tests/Configurations/UmbracoSettings/umbracoSettings.config @@ -0,0 +1,288 @@ + + + + + + jpeg,jpg,gif,bmp,png,tiff,tif + + src,alt,border,class,style,align,id,name,onclick,usemap + + + + umbracoWidth + umbracoHeight + umbracoBytes + umbracoExtension + + + umbracoWidth2 + umbracoHeight2 + umbracoBytes2 + umbracoExtension2 + + + + + + /scripts + + js,xml + + false + + + + True + + + + + 1047 + 1048 + 1049 + + + + + + robot@umbraco.dk + + + + True + + + False + + + Raw + + + True + + + True + + + True + + + False + + + text + + false + + true + + true + + In Preview Mode - click to end]]> + + + + 1800 + + + inline + + + HideFileDuplicates + + + ashx,aspx,ascx,config,cshtml,vbhtml,asmx,air,axd + + + Textstring + + + + + true + + + false + + + + + + false + + true + + - + + + + + + + + + + plus + star + + + ae + oe + aa + ae + oe + ue + ss + ae + oe + - + + + + + + + true + true + Mvc + + + + + + cs + vb + + + + + + + + p + div + ul + span + + + MyName.1 + MyName.2 + MyName.3 + MyName.4 + MyName.5 + MyName.6 + + + + + + + + false + true + true + + [alias-of-log-type-in-lowercase] + anotherlogalias + + 86400 + 1440 + + + + + + + + + + + + + + 0 + + + + 127.0.0.1 + 127.0.0.2 + + + + + + + + your-username5 + your-username1 + your-username2 + your-username3 + your-username4 + + your-username6 + + css,xslt + + + + + + + + + + + + + + UsersMembershipProvider + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/web.config b/src/Umbraco.Tests/Configurations/UmbracoSettings/web.config new file mode 100644 index 0000000000..e4553f36b4 --- /dev/null +++ b/src/Umbraco.Tests/Configurations/UmbracoSettings/web.config @@ -0,0 +1,14 @@ + + + + + +
+ + + + + + + + \ No newline at end of file diff --git a/src/Umbraco.Tests/PublishedCache/PublishedContentCacheTests.cs b/src/Umbraco.Tests/PublishedCache/PublishedContentCacheTests.cs index 41102d68c2..8b9eb6ede4 100644 --- a/src/Umbraco.Tests/PublishedCache/PublishedContentCacheTests.cs +++ b/src/Umbraco.Tests/PublishedCache/PublishedContentCacheTests.cs @@ -79,7 +79,7 @@ namespace Umbraco.Tests.PublishedCache //ensure the StateHelper is using our custom context StateHelper.HttpContext = _httpContextFactory.HttpContext; - UmbracoSettings.UseLegacyXmlSchema = false; + LegacyUmbracoSettings.UseLegacyXmlSchema = false; var cache = new PublishedContentCache { GetXmlDelegate = (context, preview) => @@ -101,7 +101,7 @@ namespace Umbraco.Tests.PublishedCache private void SetupForLegacy() { - Umbraco.Core.Configuration.UmbracoSettings.UseLegacyXmlSchema = true; + Umbraco.Core.Configuration.LegacyUmbracoSettings.UseLegacyXmlSchema = true; var cache = _umbracoContext.ContentCache.InnerCache as PublishedContentCache; if (cache == null) throw new Exception("Unsupported IPublishedContentCache, only the Xml one is supported."); @@ -117,7 +117,7 @@ namespace Umbraco.Tests.PublishedCache [TearDown] public void TearDown() { - UmbracoSettings.Reset(); + LegacyUmbracoSettings.Reset(); } [Test] diff --git a/src/Umbraco.Tests/Publishing/PublishingStrategyTests.cs b/src/Umbraco.Tests/Publishing/PublishingStrategyTests.cs index 85b6ec9fd0..105bd6bddc 100644 --- a/src/Umbraco.Tests/Publishing/PublishingStrategyTests.cs +++ b/src/Umbraco.Tests/Publishing/PublishingStrategyTests.cs @@ -26,7 +26,7 @@ namespace Umbraco.Tests.Publishing { base.Initialize(); - UmbracoSettings.SettingsFilePath = IOHelper.MapPath(SystemDirectories.Config + Path.DirectorySeparatorChar, false); + LegacyUmbracoSettings.SettingsFilePath = IOHelper.MapPath(SystemDirectories.Config + Path.DirectorySeparatorChar, false); } [TearDown] diff --git a/src/Umbraco.Tests/TestHelpers/SettingsForTests.cs b/src/Umbraco.Tests/TestHelpers/SettingsForTests.cs index e0b8bf0bae..ad5efc4b45 100644 --- a/src/Umbraco.Tests/TestHelpers/SettingsForTests.cs +++ b/src/Umbraco.Tests/TestHelpers/SettingsForTests.cs @@ -13,38 +13,38 @@ namespace Umbraco.Tests.TestHelpers public static int UmbracoLibraryCacheDuration { - get { return UmbracoSettings.UmbracoLibraryCacheDuration; } - set { UmbracoSettings.UmbracoLibraryCacheDuration = value; } + get { return LegacyUmbracoSettings.UmbracoLibraryCacheDuration; } + set { LegacyUmbracoSettings.UmbracoLibraryCacheDuration = value; } } public static bool UseLegacyXmlSchema { - get { return UmbracoSettings.UseLegacyXmlSchema; } - set { UmbracoSettings.UseLegacyXmlSchema = value; } + get { return LegacyUmbracoSettings.UseLegacyXmlSchema; } + set { LegacyUmbracoSettings.UseLegacyXmlSchema = value; } } public static bool AddTrailingSlash { - get { return UmbracoSettings.AddTrailingSlash; } - set { UmbracoSettings.AddTrailingSlash = value; } + get { return LegacyUmbracoSettings.AddTrailingSlash; } + set { LegacyUmbracoSettings.AddTrailingSlash = value; } } public static bool UseDomainPrefixes { - get { return UmbracoSettings.UseDomainPrefixes; } - set { UmbracoSettings.UseDomainPrefixes = value; } + get { return LegacyUmbracoSettings.UseDomainPrefixes; } + set { LegacyUmbracoSettings.UseDomainPrefixes = value; } } public static string SettingsFilePath { - get { return UmbracoSettings.SettingsFilePath; } - set { UmbracoSettings.SettingsFilePath = value; } + get { return LegacyUmbracoSettings.SettingsFilePath; } + set { LegacyUmbracoSettings.SettingsFilePath = value; } } public static bool ForceSafeAliases { - get { return UmbracoSettings.ForceSafeAliases; } - set { UmbracoSettings.ForceSafeAliases = value; } + get { return LegacyUmbracoSettings.ForceSafeAliases; } + set { LegacyUmbracoSettings.ForceSafeAliases = value; } } // from appSettings @@ -111,7 +111,7 @@ namespace Umbraco.Tests.TestHelpers public static void Reset() { - UmbracoSettings.Reset(); + LegacyUmbracoSettings.Reset(); GlobalSettings.Reset(); foreach (var kvp in SavedAppSettings) diff --git a/src/Umbraco.Tests/TestHelpers/TestHelper.cs b/src/Umbraco.Tests/TestHelpers/TestHelper.cs index c79d08cda3..b4e7f55a89 100644 --- a/src/Umbraco.Tests/TestHelpers/TestHelper.cs +++ b/src/Umbraco.Tests/TestHelpers/TestHelper.cs @@ -144,7 +144,7 @@ namespace Umbraco.Tests.TestHelpers Path.Combine(currDir.Parent.Parent.FullName, "config", "umbracoSettings.config"), true); - Core.Configuration.UmbracoSettings.SettingsFilePath = IOHelper.MapPath(SystemDirectories.Config + Path.DirectorySeparatorChar, false); + Core.Configuration.LegacyUmbracoSettings.SettingsFilePath = IOHelper.MapPath(SystemDirectories.Config + Path.DirectorySeparatorChar, false); } public static void CleanUmbracoSettingsConfig() diff --git a/src/Umbraco.Tests/Umbraco.Tests.csproj b/src/Umbraco.Tests/Umbraco.Tests.csproj index 576f7fd83a..e5b9ec7222 100644 --- a/src/Umbraco.Tests/Umbraco.Tests.csproj +++ b/src/Umbraco.Tests/Umbraco.Tests.csproj @@ -203,6 +203,26 @@ + + + + + + + + + + + + + + + + + + + + @@ -429,6 +449,10 @@ Designer + + Designer + Always + @@ -535,6 +559,10 @@ + + Designer + Always + diff --git a/src/Umbraco.Tests/UriUtilityTests.cs b/src/Umbraco.Tests/UriUtilityTests.cs index 9be7ac8a59..39f0d2e828 100644 --- a/src/Umbraco.Tests/UriUtilityTests.cs +++ b/src/Umbraco.Tests/UriUtilityTests.cs @@ -15,7 +15,7 @@ namespace Umbraco.Tests [TearDown] public void TearDown() { - UmbracoSettings.Reset(); + LegacyUmbracoSettings.Reset(); } // test normal urls @@ -83,7 +83,7 @@ namespace Umbraco.Tests public void Uri_From_Umbraco(string sourceUrl, string expectedUrl, bool directoryUrls, bool trailingSlash) { ConfigurationManager.AppSettings.Set("umbracoUseDirectoryUrls", directoryUrls ? "true" : "false"); - Umbraco.Core.Configuration.UmbracoSettings.AddTrailingSlash = trailingSlash; + Umbraco.Core.Configuration.LegacyUmbracoSettings.AddTrailingSlash = trailingSlash; UriUtility.SetAppDomainAppVirtualPath("/"); var expectedUri = NewUri(expectedUrl); diff --git a/src/Umbraco.Web.UI.Client/lib/slider/css/slider.css b/src/Umbraco.Web.UI.Client/lib/slider/css/slider.css new file mode 100644 index 0000000000..b527aa8686 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/lib/slider/css/slider.css @@ -0,0 +1,138 @@ +/*! + * Slider for Bootstrap + * + * Copyright 2012 Stefan Petre + * Licensed under the Apache License v2.0 + * http://www.apache.org/licenses/LICENSE-2.0 + * + */ +.slider { + display: inline-block; + vertical-align: middle; + position: relative; +} +.slider.slider-horizontal { + width: 210px; + height: 20px; +} +.slider.slider-horizontal .slider-track { + height: 10px; + width: 100%; + margin-top: -5px; + top: 50%; + left: 0; +} +.slider.slider-horizontal .slider-selection { + height: 100%; + top: 0; + bottom: 0; +} +.slider.slider-horizontal .slider-handle { + margin-left: -10px; + margin-top: -5px; +} +.slider.slider-horizontal .slider-handle.triangle { + border-width: 0 10px 10px 10px; + width: 0; + height: 0; + border-bottom-color: #0480be; + margin-top: 0; +} +.slider.slider-vertical { + height: 210px; + width: 20px; +} +.slider.slider-vertical .slider-track { + width: 10px; + height: 100%; + margin-left: -5px; + left: 50%; + top: 0; +} +.slider.slider-vertical .slider-selection { + width: 100%; + left: 0; + top: 0; + bottom: 0; +} +.slider.slider-vertical .slider-handle { + margin-left: -5px; + margin-top: -10px; +} +.slider.slider-vertical .slider-handle.triangle { + border-width: 10px 0 10px 10px; + width: 1px; + height: 1px; + border-left-color: #0480be; + margin-left: 0; +} +.slider input { + display: none; +} +.slider .tooltip-inner { + white-space: nowrap; +} +.slider-track { + position: absolute; + cursor: pointer; + background-color: #f7f7f7; + background-image: -moz-linear-gradient(top, #f5f5f5, #f9f9f9); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f5f5f5), to(#f9f9f9)); + background-image: -webkit-linear-gradient(top, #f5f5f5, #f9f9f9); + background-image: -o-linear-gradient(top, #f5f5f5, #f9f9f9); + background-image: linear-gradient(to bottom, #f5f5f5, #f9f9f9); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#fff9f9f9', GradientType=0); + -webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); + -moz-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); + box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1); + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; +} +.slider-selection { + position: absolute; + background-color: #f7f7f7; + background-image: -moz-linear-gradient(top, #f9f9f9, #f5f5f5); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#f9f9f9), to(#f5f5f5)); + background-image: -webkit-linear-gradient(top, #f9f9f9, #f5f5f5); + background-image: -o-linear-gradient(top, #f9f9f9, #f5f5f5); + background-image: linear-gradient(to bottom, #f9f9f9, #f5f5f5); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff9f9f9', endColorstr='#fff5f5f5', GradientType=0); + -webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15); + -moz-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15); + box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15); + -webkit-box-sizing: border-box; + -moz-box-sizing: border-box; + box-sizing: border-box; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; +} +.slider-handle { + position: absolute; + width: 20px; + height: 20px; + background-color: #0e90d2; + background-image: -moz-linear-gradient(top, #149bdf, #0480be); + background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#149bdf), to(#0480be)); + background-image: -webkit-linear-gradient(top, #149bdf, #0480be); + background-image: -o-linear-gradient(top, #149bdf, #0480be); + background-image: linear-gradient(to bottom, #149bdf, #0480be); + background-repeat: repeat-x; + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff149bdf', endColorstr='#ff0480be', GradientType=0); + -webkit-box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05); + -moz-box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05); + box-shadow: inset 0 1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.05); + opacity: 0.8; + border: 0px solid transparent; +} +.slider-handle.round { + -webkit-border-radius: 20px; + -moz-border-radius: 20px; + border-radius: 20px; +} +.slider-handle.triangle { + background: transparent none; +} \ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/lib/slider/js/bootstrap-slider.js b/src/Umbraco.Web.UI.Client/lib/slider/js/bootstrap-slider.js new file mode 100644 index 0000000000..0dcdf1a7ed --- /dev/null +++ b/src/Umbraco.Web.UI.Client/lib/slider/js/bootstrap-slider.js @@ -0,0 +1,388 @@ +/* ========================================================= + * bootstrap-slider.js v2.0.0 + * http://www.eyecon.ro/bootstrap-slider + * ========================================================= + * Copyright 2012 Stefan Petre + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ========================================================= */ + +!function( $ ) { + + var Slider = function(element, options) { + this.element = $(element); + this.picker = $('
'+ + '
'+ + '
'+ + '
'+ + '
'+ + '
'+ + '
'+ + '
') + .insertBefore(this.element) + .append(this.element); + this.id = this.element.data('slider-id')||options.id; + if (this.id) { + this.picker[0].id = this.id; + } + + if (typeof Modernizr !== 'undefined' && Modernizr.touch) { + this.touchCapable = true; + } + + var tooltip = this.element.data('slider-tooltip')||options.tooltip; + + this.tooltip = this.picker.find('.tooltip'); + this.tooltipInner = this.tooltip.find('div.tooltip-inner'); + + this.orientation = this.element.data('slider-orientation')||options.orientation; + switch(this.orientation) { + case 'vertical': + this.picker.addClass('slider-vertical'); + this.stylePos = 'top'; + this.mousePos = 'pageY'; + this.sizePos = 'offsetHeight'; + this.tooltip.addClass('right')[0].style.left = '100%'; + break; + default: + this.picker + .addClass('slider-horizontal') + .css('width', this.element.outerWidth()); + this.orientation = 'horizontal'; + this.stylePos = 'left'; + this.mousePos = 'pageX'; + this.sizePos = 'offsetWidth'; + this.tooltip.addClass('top')[0].style.top = -this.tooltip.outerHeight() - 14 + 'px'; + break; + } + + this.min = this.element.data('slider-min')||options.min; + this.max = this.element.data('slider-max')||options.max; + this.step = this.element.data('slider-step')||options.step; + this.value = this.element.data('slider-value')||options.value; + if (this.value[1]) { + this.range = true; + } + + this.selection = this.element.data('slider-selection')||options.selection; + this.selectionEl = this.picker.find('.slider-selection'); + if (this.selection === 'none') { + this.selectionEl.addClass('hide'); + } + this.selectionElStyle = this.selectionEl[0].style; + + + this.handle1 = this.picker.find('.slider-handle:first'); + this.handle1Stype = this.handle1[0].style; + this.handle2 = this.picker.find('.slider-handle:last'); + this.handle2Stype = this.handle2[0].style; + + var handle = this.element.data('slider-handle')||options.handle; + switch(handle) { + case 'round': + this.handle1.addClass('round'); + this.handle2.addClass('round'); + break + case 'triangle': + this.handle1.addClass('triangle'); + this.handle2.addClass('triangle'); + break + } + + if (this.range) { + this.value[0] = Math.max(this.min, Math.min(this.max, this.value[0])); + this.value[1] = Math.max(this.min, Math.min(this.max, this.value[1])); + } else { + this.value = [ Math.max(this.min, Math.min(this.max, this.value))]; + this.handle2.addClass('hide'); + if (this.selection == 'after') { + this.value[1] = this.max; + } else { + this.value[1] = this.min; + } + } + this.diff = this.max - this.min; + this.percentage = [ + (this.value[0]-this.min)*100/this.diff, + (this.value[1]-this.min)*100/this.diff, + this.step*100/this.diff + ]; + + this.offset = this.picker.offset(); + this.size = this.picker[0][this.sizePos]; + + this.formater = options.formater; + + this.layout(); + + if (this.touchCapable) { + // Touch: Bind touch events: + this.picker.on({ + touchstart: $.proxy(this.mousedown, this) + }); + } else { + this.picker.on({ + mousedown: $.proxy(this.mousedown, this) + }); + } + + if (tooltip === 'show') { + this.picker.on({ + mouseenter: $.proxy(this.showTooltip, this), + mouseleave: $.proxy(this.hideTooltip, this) + }); + } else { + this.tooltip.addClass('hide'); + } + }; + + Slider.prototype = { + constructor: Slider, + + over: false, + inDrag: false, + + showTooltip: function(){ + this.tooltip.addClass('in'); + //var left = Math.round(this.percent*this.width); + //this.tooltip.css('left', left - this.tooltip.outerWidth()/2); + this.over = true; + }, + + hideTooltip: function(){ + if (this.inDrag === false) { + this.tooltip.removeClass('in'); + } + this.over = false; + }, + + layout: function(){ + this.handle1Stype[this.stylePos] = this.percentage[0]+'%'; + this.handle2Stype[this.stylePos] = this.percentage[1]+'%'; + if (this.orientation == 'vertical') { + this.selectionElStyle.top = Math.min(this.percentage[0], this.percentage[1]) +'%'; + this.selectionElStyle.height = Math.abs(this.percentage[0] - this.percentage[1]) +'%'; + } else { + this.selectionElStyle.left = Math.min(this.percentage[0], this.percentage[1]) +'%'; + this.selectionElStyle.width = Math.abs(this.percentage[0] - this.percentage[1]) +'%'; + } + if (this.range) { + this.tooltipInner.text( + this.formater(this.value[0]) + + ' : ' + + this.formater(this.value[1]) + ); + this.tooltip[0].style[this.stylePos] = this.size * (this.percentage[0] + (this.percentage[1] - this.percentage[0])/2)/100 - (this.orientation === 'vertical' ? this.tooltip.outerHeight()/2 : this.tooltip.outerWidth()/2) +'px'; + } else { + this.tooltipInner.text( + this.formater(this.value[0]) + ); + this.tooltip[0].style[this.stylePos] = this.size * this.percentage[0]/100 - (this.orientation === 'vertical' ? this.tooltip.outerHeight()/2 : this.tooltip.outerWidth()/2) +'px'; + } + }, + + mousedown: function(ev) { + + // Touch: Get the original event: + if (this.touchCapable && ev.type === 'touchstart') { + ev = ev.originalEvent; + } + + this.offset = this.picker.offset(); + this.size = this.picker[0][this.sizePos]; + + var percentage = this.getPercentage(ev); + + if (this.range) { + var diff1 = Math.abs(this.percentage[0] - percentage); + var diff2 = Math.abs(this.percentage[1] - percentage); + this.dragged = (diff1 < diff2) ? 0 : 1; + } else { + this.dragged = 0; + } + + this.percentage[this.dragged] = percentage; + this.layout(); + + if (this.touchCapable) { + // Touch: Bind touch events: + $(document).on({ + touchmove: $.proxy(this.mousemove, this), + touchend: $.proxy(this.mouseup, this) + }); + } else { + $(document).on({ + mousemove: $.proxy(this.mousemove, this), + mouseup: $.proxy(this.mouseup, this) + }); + } + + this.inDrag = true; + var val = this.calculateValue(); + this.element.trigger({ + type: 'slideStart', + value: val + }).trigger({ + type: 'slide', + value: val + }); + return false; + }, + + mousemove: function(ev) { + + // Touch: Get the original event: + if (this.touchCapable && ev.type === 'touchmove') { + ev = ev.originalEvent; + } + + var percentage = this.getPercentage(ev); + if (this.range) { + if (this.dragged === 0 && this.percentage[1] < percentage) { + this.percentage[0] = this.percentage[1]; + this.dragged = 1; + } else if (this.dragged === 1 && this.percentage[0] > percentage) { + this.percentage[1] = this.percentage[0]; + this.dragged = 0; + } + } + this.percentage[this.dragged] = percentage; + this.layout(); + var val = this.calculateValue(); + this.element + .trigger({ + type: 'slide', + value: val + }) + .data('value', val) + .prop('value', val); + return false; + }, + + mouseup: function(ev) { + if (this.touchCapable) { + // Touch: Bind touch events: + $(document).off({ + touchmove: this.mousemove, + touchend: this.mouseup + }); + } else { + $(document).off({ + mousemove: this.mousemove, + mouseup: this.mouseup + }); + } + + this.inDrag = false; + if (this.over == false) { + this.hideTooltip(); + } + this.element; + var val = this.calculateValue(); + this.element + .trigger({ + type: 'slideStop', + value: val + }) + .data('value', val) + .prop('value', val); + return false; + }, + + calculateValue: function() { + var val; + if (this.range) { + val = [ + (this.min + Math.round((this.diff * this.percentage[0]/100)/this.step)*this.step), + (this.min + Math.round((this.diff * this.percentage[1]/100)/this.step)*this.step) + ]; + this.value = val; + } else { + val = (this.min + Math.round((this.diff * this.percentage[0]/100)/this.step)*this.step); + this.value = [val, this.value[1]]; + } + return val; + }, + + getPercentage: function(ev) { + if (this.touchCapable) { + ev = ev.touches[0]; + } + var percentage = (ev[this.mousePos] - this.offset[this.stylePos])*100/this.size; + percentage = Math.round(percentage/this.percentage[2])*this.percentage[2]; + return Math.max(0, Math.min(100, percentage)); + }, + + getValue: function() { + if (this.range) { + return this.value; + } + return this.value[0]; + }, + + setValue: function(val) { + this.value = val; + + if (this.range) { + this.value[0] = Math.max(this.min, Math.min(this.max, this.value[0])); + this.value[1] = Math.max(this.min, Math.min(this.max, this.value[1])); + } else { + this.value = [ Math.max(this.min, Math.min(this.max, this.value))]; + this.handle2.addClass('hide'); + if (this.selection == 'after') { + this.value[1] = this.max; + } else { + this.value[1] = this.min; + } + } + this.diff = this.max - this.min; + this.percentage = [ + (this.value[0]-this.min)*100/this.diff, + (this.value[1]-this.min)*100/this.diff, + this.step*100/this.diff + ]; + this.layout(); + } + }; + + $.fn.slider = function ( option, val ) { + return this.each(function () { + var $this = $(this), + data = $this.data('slider'), + options = typeof option === 'object' && option; + if (!data) { + $this.data('slider', (data = new Slider(this, $.extend({}, $.fn.slider.defaults,options)))); + } + if (typeof option == 'string') { + data[option](val); + } + }) + }; + + $.fn.slider.defaults = { + min: 0, + max: 10, + step: 1, + orientation: 'horizontal', + value: 5, + selection: 'before', + tooltip: 'show', + handle: 'round', + formater: function(value) { + return value; + } + }; + + $.fn.slider.Constructor = Slider; + +}( window.jQuery ); \ No newline at end of file diff --git a/src/Umbraco.Web.UI/install/steps/DefaultUser.ascx.cs b/src/Umbraco.Web.UI/install/steps/DefaultUser.ascx.cs index e8bbb29787..8f90392c79 100644 --- a/src/Umbraco.Web.UI/install/steps/DefaultUser.ascx.cs +++ b/src/Umbraco.Web.UI/install/steps/DefaultUser.ascx.cs @@ -22,16 +22,16 @@ namespace Umbraco.Web.UI.Install.Steps if (Page.IsValid) { var u = User.GetUser(0); - var user = Membership.Providers[UmbracoSettings.DefaultBackofficeProvider].GetUser(0, true); + var user = Membership.Providers[LegacyUmbracoSettings.DefaultBackofficeProvider].GetUser(0, true); user.ChangePassword(u.GetPassword(), tb_password.Text.Trim()); // Is it using the default membership provider - if (Membership.Providers[UmbracoSettings.DefaultBackofficeProvider] is UsersMembershipProvider) + if (Membership.Providers[LegacyUmbracoSettings.DefaultBackofficeProvider] is UsersMembershipProvider) { // Save user in membership provider var umbracoUser = user as UsersMembershipUser; umbracoUser.FullName = tb_name.Text.Trim(); - Membership.Providers[UmbracoSettings.DefaultBackofficeProvider].UpdateUser(umbracoUser); + Membership.Providers[LegacyUmbracoSettings.DefaultBackofficeProvider].UpdateUser(umbracoUser); // Save user details u.Email = tb_email.Text.Trim(); @@ -39,7 +39,7 @@ namespace Umbraco.Web.UI.Install.Steps else { u.Name = tb_name.Text.Trim(); - if (!(Membership.Providers[UmbracoSettings.DefaultBackofficeProvider] is ActiveDirectoryMembershipProvider)) Membership.Providers[UmbracoSettings.DefaultBackofficeProvider].UpdateUser(user); + if (!(Membership.Providers[LegacyUmbracoSettings.DefaultBackofficeProvider] is ActiveDirectoryMembershipProvider)) Membership.Providers[LegacyUmbracoSettings.DefaultBackofficeProvider].UpdateUser(user); } // we need to update the login name here as it's set to the old name when saving the user via the membership provider! diff --git a/src/Umbraco.Web/BaseRest/BaseRestHandler.cs b/src/Umbraco.Web/BaseRest/BaseRestHandler.cs index 1d3cfebb91..1ed35117e7 100644 --- a/src/Umbraco.Web/BaseRest/BaseRestHandler.cs +++ b/src/Umbraco.Web/BaseRest/BaseRestHandler.cs @@ -28,7 +28,7 @@ namespace Umbraco.Web.BaseRest /// A value indicating whether the specified Uri should be routed to the BaseRestHandler. public static bool IsBaseRestRequest(Uri uri) { - return Core.Configuration.UmbracoSettings.For().Enabled + return Core.Configuration.LegacyUmbracoSettings.For().Enabled && uri.AbsolutePath.ToLowerInvariant().StartsWith(BaseUrl); } diff --git a/src/Umbraco.Web/BaseRest/RestExtensionMethodInfo.cs b/src/Umbraco.Web/BaseRest/RestExtensionMethodInfo.cs index 176f804319..0b5fc66dbd 100644 --- a/src/Umbraco.Web/BaseRest/RestExtensionMethodInfo.cs +++ b/src/Umbraco.Web/BaseRest/RestExtensionMethodInfo.cs @@ -87,7 +87,7 @@ namespace Umbraco.Web.BaseRest // static RestExtensionMethodInfo GetFromConfiguration(string extensionAlias, string methodName, int paramsCount) { - var config = Core.Configuration.UmbracoSettings.For(); + var config = Core.Configuration.LegacyUmbracoSettings.For(); var configExtension = config.Items[extensionAlias]; if (configExtension == null) diff --git a/src/Umbraco.Web/Configuration/WebRouting.cs b/src/Umbraco.Web/Configuration/WebRouting.cs index aa32cd7746..6488e18bde 100644 --- a/src/Umbraco.Web/Configuration/WebRouting.cs +++ b/src/Umbraco.Web/Configuration/WebRouting.cs @@ -37,7 +37,7 @@ namespace Umbraco.Web.Configuration { return _trySkipIisCustomErrors ?? (IsPresent ? (bool)this[KeyTrySkipIisCustomErrors] - : UmbracoSettings.TrySkipIisCustomErrors); + : LegacyUmbracoSettings.TrySkipIisCustomErrors); } internal set { _trySkipIisCustomErrors = value; } } @@ -69,7 +69,7 @@ namespace Umbraco.Web.Configuration { return _internalRedirectPreservesTemplate ?? (IsPresent ? (bool)this[KeyInternalRedirectPreservesTemplate] - : UmbracoSettings.InternalRedirectPreservesTemplate); + : LegacyUmbracoSettings.InternalRedirectPreservesTemplate); } internal set { _internalRedirectPreservesTemplate = value; } } diff --git a/src/Umbraco.Web/Editors/BackOfficeController.cs b/src/Umbraco.Web/Editors/BackOfficeController.cs index ef9e571869..6e978f37cd 100644 --- a/src/Umbraco.Web/Editors/BackOfficeController.cs +++ b/src/Umbraco.Web/Editors/BackOfficeController.cs @@ -70,7 +70,7 @@ namespace Umbraco.Web.Editors "umbracoSettings", new Dictionary { {"umbracoPath", GlobalSettings.Path}, - {"imageFileTypes", UmbracoSettings.ImageFileTypes}, + {"imageFileTypes", LegacyUmbracoSettings.ImageFileTypes}, } }, { "isDebuggingEnabled", HttpContext.IsDebuggingEnabled } diff --git a/src/Umbraco.Web/Models/XmlPublishedContent.cs b/src/Umbraco.Web/Models/XmlPublishedContent.cs index 867fc8c144..7167a1fe7b 100644 --- a/src/Umbraco.Web/Models/XmlPublishedContent.cs +++ b/src/Umbraco.Web/Models/XmlPublishedContent.cs @@ -317,7 +317,7 @@ namespace Umbraco.Web.Models if (_pageXmlNode.Attributes.GetNamedItem("writerID") != null) _writerId = int.Parse(_pageXmlNode.Attributes.GetNamedItem("writerID").Value); - if (UmbracoSettings.UseLegacyXmlSchema) + if (LegacyUmbracoSettings.UseLegacyXmlSchema) { if (_pageXmlNode.Attributes.GetNamedItem("nodeTypeAlias") != null) _docTypeAlias = _pageXmlNode.Attributes.GetNamedItem("nodeTypeAlias").Value; @@ -343,12 +343,12 @@ namespace Umbraco.Web.Models } // load data - var dataXPath = UmbracoSettings.UseLegacyXmlSchema ? "data" : "* [not(@isDoc)]"; + var dataXPath = LegacyUmbracoSettings.UseLegacyXmlSchema ? "data" : "* [not(@isDoc)]"; foreach (XmlNode n in _pageXmlNode.SelectNodes(dataXPath)) _properties.Add(new XmlPublishedContentProperty(n)); // load children - var childXPath = UmbracoSettings.UseLegacyXmlSchema ? "node" : "* [@isDoc]"; + var childXPath = LegacyUmbracoSettings.UseLegacyXmlSchema ? "node" : "* [@isDoc]"; var nav = _pageXmlNode.CreateNavigator(); var expr = nav.Compile(childXPath); expr.AddSort("@sortOrder", XmlSortOrder.Ascending, XmlCaseOrder.None, "", XmlDataType.Number); diff --git a/src/Umbraco.Web/Models/XmlPublishedContentProperty.cs b/src/Umbraco.Web/Models/XmlPublishedContentProperty.cs index 386c75ec39..76c41387e7 100644 --- a/src/Umbraco.Web/Models/XmlPublishedContentProperty.cs +++ b/src/Umbraco.Web/Models/XmlPublishedContentProperty.cs @@ -66,7 +66,7 @@ namespace Umbraco.Web.Models // For backward compatibility with 2.x (the version attribute has been removed from 3.0 data nodes) if (propertyXmlData.Attributes.GetNamedItem("versionID") != null) _version = new Guid(propertyXmlData.Attributes.GetNamedItem("versionID").Value); - _alias = UmbracoSettings.UseLegacyXmlSchema ? + _alias = LegacyUmbracoSettings.UseLegacyXmlSchema ? propertyXmlData.Attributes.GetNamedItem("alias").Value : propertyXmlData.Name; _value = XmlHelper.GetNodeValue(propertyXmlData); diff --git a/src/Umbraco.Web/Mvc/UmbracoViewPage.cs b/src/Umbraco.Web/Mvc/UmbracoViewPage.cs index fa22cf419b..25641d3540 100644 --- a/src/Umbraco.Web/Mvc/UmbracoViewPage.cs +++ b/src/Umbraco.Web/Mvc/UmbracoViewPage.cs @@ -138,7 +138,7 @@ namespace Umbraco.Web.Mvc { // creating previewBadge markup markupToInject = - String.Format(UmbracoSettings.PreviewBadge, + String.Format(LegacyUmbracoSettings.PreviewBadge, IOHelper.ResolveUrl(SystemDirectories.Umbraco), IOHelper.ResolveUrl(SystemDirectories.UmbracoClient), Server.UrlEncode(UmbracoContext.Current.HttpContext.Request.Path)); diff --git a/src/Umbraco.Web/PropertyEditors/FileUploadPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/FileUploadPropertyEditor.cs index 4dc19dd85c..b4033d5871 100644 --- a/src/Umbraco.Web/PropertyEditors/FileUploadPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/FileUploadPropertyEditor.cs @@ -59,12 +59,12 @@ namespace Umbraco.Web.PropertyEditors static void AutoFillProperties(IContentBase model) { - if (UmbracoSettings.ImageAutoFillImageProperties != null) + if (LegacyUmbracoSettings.ImageAutoFillImageProperties != null) { foreach (var p in model.Properties) { var uploadFieldConfigNode = - UmbracoSettings.ImageAutoFillImageProperties.SelectSingleNode( + LegacyUmbracoSettings.ImageAutoFillImageProperties.SelectSingleNode( string.Format("uploadField [@alias = \"{0}\"]", p.Alias)); if (uploadFieldConfigNode != null) diff --git a/src/Umbraco.Web/Routing/DefaultUrlProvider.cs b/src/Umbraco.Web/Routing/DefaultUrlProvider.cs index a2285ddc74..0744ff6fe8 100644 --- a/src/Umbraco.Web/Routing/DefaultUrlProvider.cs +++ b/src/Umbraco.Web/Routing/DefaultUrlProvider.cs @@ -105,14 +105,14 @@ namespace Umbraco.Web.Routing if (mode == UrlProviderMode.AutoLegacy) { - mode = Core.Configuration.UmbracoSettings.UseDomainPrefixes + mode = Core.Configuration.LegacyUmbracoSettings.UseDomainPrefixes ? UrlProviderMode.Absolute : UrlProviderMode.Auto; } if (mode == UrlProviderMode.AutoLegacy) { - mode = Core.Configuration.UmbracoSettings.UseDomainPrefixes + mode = Core.Configuration.LegacyUmbracoSettings.UseDomainPrefixes ? UrlProviderMode.Absolute : UrlProviderMode.Auto; } diff --git a/src/Umbraco.Web/Routing/PublishedContentRequest.cs b/src/Umbraco.Web/Routing/PublishedContentRequest.cs index 6876f01606..fb99b8b976 100644 --- a/src/Umbraco.Web/Routing/PublishedContentRequest.cs +++ b/src/Umbraco.Web/Routing/PublishedContentRequest.cs @@ -1,11 +1,12 @@ using System; using System.Globalization; using Umbraco.Core; +using Umbraco.Core.Configuration; using Umbraco.Core.Models; -using UmbracoSettings = Umbraco.Core.Configuration.UmbracoSettings; using Umbraco.Web.Configuration; using umbraco; using umbraco.cms.businesslogic.web; +using RenderingEngine = Umbraco.Core.RenderingEngine; namespace Umbraco.Web.Routing { @@ -163,7 +164,7 @@ namespace Umbraco.Web.Routing IsInternalRedirectPublishedContent = isInternalRedirect; // must restore the template if it's an internal redirect & the config option is set - if (isInternalRedirect && UmbracoSettings.For().InternalRedirectPreservesTemplate) + if (isInternalRedirect && LegacyUmbracoSettings.For().InternalRedirectPreservesTemplate) { // restore _template = template; diff --git a/src/Umbraco.Web/Routing/PublishedContentRequestEngine.cs b/src/Umbraco.Web/Routing/PublishedContentRequestEngine.cs index 6fc59eb0ed..661570d151 100644 --- a/src/Umbraco.Web/Routing/PublishedContentRequestEngine.cs +++ b/src/Umbraco.Web/Routing/PublishedContentRequestEngine.cs @@ -5,15 +5,16 @@ using System.Globalization; using System.IO; using Umbraco.Core; +using Umbraco.Core.Configuration; using Umbraco.Core.IO; using Umbraco.Core.Logging; -using UmbracoSettings = Umbraco.Core.Configuration.UmbracoSettings; using Umbraco.Web.Configuration; using umbraco; using umbraco.cms.businesslogic.web; using umbraco.cms.businesslogic.language; using umbraco.cms.businesslogic.member; +using RenderingEngine = Umbraco.Core.RenderingEngine; namespace Umbraco.Web.Routing { @@ -532,7 +533,7 @@ namespace Umbraco.Web.Routing // does not apply // + optionnally, apply the alternate template on internal redirects var useAltTemplate = _pcr.IsInitialPublishedContent - || (UmbracoSettings.For().InternalRedirectPreservesTemplate && _pcr.IsInternalRedirectPublishedContent); + || (LegacyUmbracoSettings.For().InternalRedirectPreservesTemplate && _pcr.IsInternalRedirectPublishedContent); string altTemplate = useAltTemplate ? _routingContext.UmbracoContext.HttpContext.Request[Constants.Conventions.Url.AltTemplate] : null; diff --git a/src/Umbraco.Web/Routing/UrlProvider.cs b/src/Umbraco.Web/Routing/UrlProvider.cs index b8020ff04f..bad0a22e6b 100644 --- a/src/Umbraco.Web/Routing/UrlProvider.cs +++ b/src/Umbraco.Web/Routing/UrlProvider.cs @@ -1,8 +1,8 @@ using System; using System.Collections.Generic; using System.Linq; +using Umbraco.Core.Configuration; using Umbraco.Web.PublishedCache; -using UmbracoSettings = Umbraco.Core.Configuration.UmbracoSettings; namespace Umbraco.Web.Routing { @@ -22,7 +22,7 @@ namespace Umbraco.Web.Routing { _umbracoContext = umbracoContext; _urlProviders = urlProviders; - Mode = UmbracoSettings.For().UrlProviderMode; + Mode = LegacyUmbracoSettings.For().UrlProviderMode; } private readonly UmbracoContext _umbracoContext; diff --git a/src/Umbraco.Web/Security/WebSecurity.cs b/src/Umbraco.Web/Security/WebSecurity.cs index 8680f75db6..bc52399cae 100644 --- a/src/Umbraco.Web/Security/WebSecurity.cs +++ b/src/Umbraco.Web/Security/WebSecurity.cs @@ -6,6 +6,7 @@ using System.Web.Security; using Newtonsoft.Json.Linq; using Umbraco.Core; using Umbraco.Core.Cache; +using Umbraco.Core.Configuration; using Umbraco.Core.Logging; using Umbraco.Core.Models.Membership; using Umbraco.Core.Security; @@ -14,7 +15,6 @@ using umbraco.DataLayer; using umbraco.businesslogic.Exceptions; using GlobalSettings = Umbraco.Core.Configuration.GlobalSettings; using Member = umbraco.cms.businesslogic.member.Member; -using UmbracoSettings = Umbraco.Core.Configuration.UmbracoSettings; using User = umbraco.BusinessLogic.User; namespace Umbraco.Web.Security @@ -177,7 +177,7 @@ namespace Umbraco.Web.Security /// internal bool ValidateBackOfficeCredentials(string username, string password) { - var membershipProvider = Membership.Providers[UmbracoSettings.DefaultBackofficeProvider]; + var membershipProvider = Membership.Providers[LegacyUmbracoSettings.DefaultBackofficeProvider]; return membershipProvider != null && membershipProvider.ValidateUser(username, password); } diff --git a/src/Umbraco.Web/Strategies/DataTypes/LegacyUploadFieldWorkaround.cs b/src/Umbraco.Web/Strategies/DataTypes/LegacyUploadFieldWorkaround.cs index 65aebcce0b..bcb019c8f4 100644 --- a/src/Umbraco.Web/Strategies/DataTypes/LegacyUploadFieldWorkaround.cs +++ b/src/Umbraco.Web/Strategies/DataTypes/LegacyUploadFieldWorkaround.cs @@ -27,7 +27,7 @@ namespace Umbraco.Web.Strategies.DataTypes void DocumentBeforeSave(global::umbraco.cms.businesslogic.web.Document sender, global::umbraco.cms.businesslogic.SaveEventArgs e) { - if (UmbracoSettings.ImageAutoFillImageProperties != null) + if (LegacyUmbracoSettings.ImageAutoFillImageProperties != null) { var property = sender.GenericProperties.FirstOrDefault(x => x.PropertyType.DataTypeDefinition.DataType.Id == new Guid(Constants.PropertyEditors.UploadField)); if (property == null) @@ -40,7 +40,7 @@ namespace Umbraco.Web.Strategies.DataTypes void MediaBeforeSave(global::umbraco.cms.businesslogic.media.Media sender, global::umbraco.cms.businesslogic.SaveEventArgs e) { - if (UmbracoSettings.ImageAutoFillImageProperties != null) + if (LegacyUmbracoSettings.ImageAutoFillImageProperties != null) { var property = sender.GenericProperties.FirstOrDefault(x => x.PropertyType.DataTypeDefinition.DataType.Id == new Guid(Constants.PropertyEditors.UploadField)); if (property == null) @@ -76,7 +76,7 @@ namespace Umbraco.Web.Strategies.DataTypes ? fileSystem.GetExtension(path).Substring(1).ToLowerInvariant() : ""; - var isImageType = ("," + UmbracoSettings.ImageFileTypes + ",").Contains(string.Format(",{0},", extension)); + var isImageType = ("," + LegacyUmbracoSettings.ImageFileTypes + ",").Contains(string.Format(",{0},", extension)); var dimensions = isImageType ? GetDimensions(path, fileSystem) : null; // only add dimensions to web images diff --git a/src/Umbraco.Web/Templates/TemplateUtilities.cs b/src/Umbraco.Web/Templates/TemplateUtilities.cs index e25e75eb4a..8a87a0e571 100644 --- a/src/Umbraco.Web/Templates/TemplateUtilities.cs +++ b/src/Umbraco.Web/Templates/TemplateUtilities.cs @@ -1,9 +1,9 @@ using System; using System.Text.RegularExpressions; using Umbraco.Core; +using Umbraco.Core.Configuration; using Umbraco.Core.IO; using Umbraco.Core.Logging; -using UmbracoSettings = Umbraco.Core.Configuration.UmbracoSettings; namespace Umbraco.Web.Templates { @@ -56,7 +56,7 @@ namespace Umbraco.Web.Templates /// public static string ResolveUrlsFromTextString(string text) { - if (UmbracoSettings.ResolveUrlsFromTextString) + if (LegacyUmbracoSettings.ResolveUrlsFromTextString) { using (var timer = DisposableTimer.DebugDuration(typeof(IOHelper), "ResolveUrlsFromTextString starting", "ResolveUrlsFromTextString complete")) { diff --git a/src/Umbraco.Web/UmbracoModule.cs b/src/Umbraco.Web/UmbracoModule.cs index 4d568f1b6b..169405aae5 100644 --- a/src/Umbraco.Web/UmbracoModule.cs +++ b/src/Umbraco.Web/UmbracoModule.cs @@ -8,6 +8,7 @@ using System.Web; using System.Web.Routing; using Newtonsoft.Json; using Umbraco.Core; +using Umbraco.Core.Configuration; using Umbraco.Core.IO; using Umbraco.Core.Logging; using Umbraco.Core.Security; @@ -15,8 +16,9 @@ using Umbraco.Web.Routing; using Umbraco.Web.Security; using umbraco; using GlobalSettings = Umbraco.Core.Configuration.GlobalSettings; -using UmbracoSettings = Umbraco.Core.Configuration.UmbracoSettings; using Umbraco.Web.Configuration; +using ObjectExtensions = Umbraco.Core.ObjectExtensions; +using RenderingEngine = Umbraco.Core.RenderingEngine; namespace Umbraco.Web { @@ -317,7 +319,7 @@ namespace Umbraco.Web { LogHelper.Warn("Umbraco is not ready"); - if (!UmbracoSettings.EnableSplashWhileLoading) + if (!LegacyUmbracoSettings.EnableSplashWhileLoading) { // let requests pile up and wait for 10s then show the splash anyway ready = ApplicationContext.Current.WaitForReady(10 * 1000); @@ -327,7 +329,7 @@ namespace Umbraco.Web { httpContext.Response.StatusCode = 503; - var bootUrl = UmbracoSettings.BootSplashPage; + var bootUrl = LegacyUmbracoSettings.BootSplashPage; if (string.IsNullOrWhiteSpace(bootUrl)) bootUrl = "~/config/splashes/booting.aspx"; httpContext.RewritePath(UriUtility.ToAbsolute(bootUrl) + "?url=" + HttpUtility.UrlEncode(uri.ToString())); @@ -396,7 +398,7 @@ namespace Umbraco.Web else if (pcr.Is404) { response.StatusCode = 404; - response.TrySkipIisCustomErrors = UmbracoSettings.For().TrySkipIisCustomErrors; + response.TrySkipIisCustomErrors = LegacyUmbracoSettings.For().TrySkipIisCustomErrors; } if (pcr.ResponseStatusCode > 0) @@ -527,8 +529,8 @@ namespace Umbraco.Web { foreach (DictionaryEntry i in http.Items) { - i.Value.DisposeIfDisposable(); - i.Key.DisposeIfDisposable(); + ObjectExtensions.DisposeIfDisposable(i.Value); + ObjectExtensions.DisposeIfDisposable(i.Key); } } diff --git a/src/Umbraco.Web/WebBootManager.cs b/src/Umbraco.Web/WebBootManager.cs index f7ce77a825..914514376b 100644 --- a/src/Umbraco.Web/WebBootManager.cs +++ b/src/Umbraco.Web/WebBootManager.cs @@ -262,7 +262,7 @@ namespace Umbraco.Web { try { - var user = User.GetUser(UmbracoSettings.DistributedCallUser); + var user = User.GetUser(LegacyUmbracoSettings.DistributedCallUser); return new System.Tuple(user.LoginName, user.GetPassword()); } catch (Exception e) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadTemplates.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadTemplates.cs index aaa75f750d..7d3c23c7fd 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadTemplates.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadTemplates.cs @@ -194,7 +194,7 @@ namespace umbraco xNode.Source = GetTreeServiceUrl(t.Id); xNode.HasChildren = t.HasChildren; - if (Umbraco.Core.Configuration.UmbracoSettings.DefaultRenderingEngine == RenderingEngine.Mvc && ViewHelper.ViewExists(t)) + if (Umbraco.Core.Configuration.LegacyUmbracoSettings.DefaultRenderingEngine == RenderingEngine.Mvc && ViewHelper.ViewExists(t)) { xNode.Action = "javascript:openView(" + t.Id + ");"; xNode.Icon = "settingView.gif"; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/templateTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/templateTasks.cs index ea1feda139..119ac8abd5 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/templateTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/templateTasks.cs @@ -19,7 +19,7 @@ namespace umbraco var masterId = ParentID; var editor = "settings/editTemplate.aspx"; - if(Umbraco.Core.Configuration.UmbracoSettings.DefaultRenderingEngine == RenderingEngine.Mvc) + if(Umbraco.Core.Configuration.LegacyUmbracoSettings.DefaultRenderingEngine == RenderingEngine.Mvc) editor = "settings/views/editView.aspx"; if (masterId > 0) 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 0d7aec27d3..64712a396e 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 @@ -57,14 +57,14 @@ namespace umbraco.cms.presentation.settings.scripts lttPath.Text = "" + path + ""; var exts = UmbracoSettings.ScriptFileTypes.Split(',').ToList(); - if (Umbraco.Core.Configuration.UmbracoSettings.DefaultRenderingEngine == RenderingEngine.Mvc) + if (Umbraco.Core.Configuration.LegacyUmbracoSettings.DefaultRenderingEngine == RenderingEngine.Mvc) { exts.Add("cshtml"); exts.Add("vbhtml"); } var dirs = Umbraco.Core.IO.SystemDirectories.Scripts; - if (Umbraco.Core.Configuration.UmbracoSettings.DefaultRenderingEngine == RenderingEngine.Mvc) + if (Umbraco.Core.Configuration.LegacyUmbracoSettings.DefaultRenderingEngine == RenderingEngine.Mvc) dirs += "," + Umbraco.Core.IO.SystemDirectories.MvcViews; // validate file diff --git a/src/umbraco.businesslogic/UmbracoSettings.cs b/src/umbraco.businesslogic/UmbracoSettings.cs index 647ce1dd0a..ee0b34c617 100644 --- a/src/umbraco.businesslogic/UmbracoSettings.cs +++ b/src/umbraco.businesslogic/UmbracoSettings.cs @@ -20,7 +20,7 @@ namespace umbraco /// The _umbraco settings. public static XmlDocument _umbracoSettings { - get { return Umbraco.Core.Configuration.UmbracoSettings.UmbracoSettingsXmlDoc; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.UmbracoSettingsXmlDoc; } } /// @@ -28,8 +28,8 @@ namespace umbraco /// internal static string SettingsFilePath { - get { return Umbraco.Core.Configuration.UmbracoSettings.SettingsFilePath; } - set { Umbraco.Core.Configuration.UmbracoSettings.SettingsFilePath = value; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.SettingsFilePath; } + set { Umbraco.Core.Configuration.LegacyUmbracoSettings.SettingsFilePath = value; } } /// @@ -39,7 +39,7 @@ namespace umbraco /// If found, it returns the specific configuration xml node. public static XmlNode GetKeyAsNode(string Key) { - return Umbraco.Core.Configuration.UmbracoSettings.GetKeyAsNode(Key); + return Umbraco.Core.Configuration.LegacyUmbracoSettings.GetKeyAsNode(Key); } /// @@ -49,7 +49,7 @@ namespace umbraco /// public static string GetKey(string Key) { - return Umbraco.Core.Configuration.UmbracoSettings.GetKey(Key); + return Umbraco.Core.Configuration.LegacyUmbracoSettings.GetKey(Key); } /// @@ -60,7 +60,7 @@ namespace umbraco /// public static bool UploadAllowDirectories { - get { return Umbraco.Core.Configuration.UmbracoSettings.UploadAllowDirectories; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.UploadAllowDirectories; } } /// @@ -69,7 +69,7 @@ namespace umbraco /// true if logging is enabled; otherwise, false. public static bool EnableLogging { - get { return Umbraco.Core.Configuration.UmbracoSettings.EnableLogging; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.EnableLogging; } } /// @@ -78,7 +78,7 @@ namespace umbraco /// true if async logging is enabled; otherwise, false. public static bool EnableAsyncLogging { - get { return Umbraco.Core.Configuration.UmbracoSettings.EnableAsyncLogging; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.EnableAsyncLogging; } } /// @@ -86,14 +86,14 @@ namespace umbraco /// public static string ExternalLoggerAssembly { - get { return Umbraco.Core.Configuration.UmbracoSettings.ExternalLoggerAssembly; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.ExternalLoggerAssembly; } } /// /// Gets the type of an external logger that can be used to store log items in 3rd party systems /// public static string ExternalLoggerType { - get { return Umbraco.Core.Configuration.UmbracoSettings.ExternalLoggerType; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.ExternalLoggerType; } } /// @@ -101,7 +101,7 @@ namespace umbraco /// public static bool ExternalLoggerLogAuditTrail { - get { return Umbraco.Core.Configuration.UmbracoSettings.ExternalLoggerLogAuditTrail; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.ExternalLoggerLogAuditTrail; } } /// @@ -109,7 +109,7 @@ namespace umbraco /// public static bool KeepUserLoggedIn { - get { return Umbraco.Core.Configuration.UmbracoSettings.KeepUserLoggedIn; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.KeepUserLoggedIn; } } /// @@ -117,7 +117,7 @@ namespace umbraco /// public static bool EnableCanvasEditing { - get { return Umbraco.Core.Configuration.UmbracoSettings.EnableCanvasEditing; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.EnableCanvasEditing; } } /// @@ -125,7 +125,7 @@ namespace umbraco /// public static bool HideDisabledUsersInBackoffice { - get { return Umbraco.Core.Configuration.UmbracoSettings.HideDisabledUsersInBackoffice; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.HideDisabledUsersInBackoffice; } } /// @@ -134,7 +134,7 @@ namespace umbraco /// true if logs are to be automatically cleaned; otherwise, false public static bool AutoCleanLogs { - get { return Umbraco.Core.Configuration.UmbracoSettings.AutoCleanLogs; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.AutoCleanLogs; } } /// @@ -142,12 +142,12 @@ namespace umbraco /// public static int CleaningMiliseconds { - get { return Umbraco.Core.Configuration.UmbracoSettings.CleaningMiliseconds; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.CleaningMiliseconds; } } public static int MaxLogAge { - get { return Umbraco.Core.Configuration.UmbracoSettings.MaxLogAge; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.MaxLogAge; } } /// @@ -156,7 +156,7 @@ namespace umbraco /// The disabled log types. public static XmlNode DisabledLogTypes { - get { return Umbraco.Core.Configuration.UmbracoSettings.DisabledLogTypes; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.DisabledLogTypes; } } /// @@ -165,7 +165,7 @@ namespace umbraco /// The package server url. public static string PackageServer { - get { return Umbraco.Core.Configuration.UmbracoSettings.PackageServer; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.PackageServer; } } /// @@ -174,7 +174,7 @@ namespace umbraco /// true if umbraco will use domain prefixes; otherwise, false. public static bool UseDomainPrefixes { - get { return Umbraco.Core.Configuration.UmbracoSettings.UseDomainPrefixes; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.UseDomainPrefixes; } } /// @@ -183,7 +183,7 @@ namespace umbraco /// public static bool AddTrailingSlash { - get { return Umbraco.Core.Configuration.UmbracoSettings.AddTrailingSlash; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.AddTrailingSlash; } } /// @@ -192,7 +192,7 @@ namespace umbraco /// true if umbraco will use ASP.NET MasterPages; otherwise, false. public static bool UseAspNetMasterPages { - get { return Umbraco.Core.Configuration.UmbracoSettings.UseAspNetMasterPages; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.UseAspNetMasterPages; } } @@ -202,7 +202,7 @@ namespace umbraco /// true if umbraco will override templates with skins if present and configured false. public static bool EnableTemplateFolders { - get { return Umbraco.Core.Configuration.UmbracoSettings.EnableTemplateFolders; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.EnableTemplateFolders; } } /// @@ -210,14 +210,14 @@ namespace umbraco /// public static List NotDynamicXmlDocumentElements { - get { return Umbraco.Core.Configuration.UmbracoSettings.NotDynamicXmlDocumentElements.ToList(); } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.NotDynamicXmlDocumentElements.ToList(); } } public static List RazorDataTypeModelStaticMapping { get { - var mapping = Umbraco.Core.Configuration.UmbracoSettings.RazorDataTypeModelStaticMapping; + var mapping = Umbraco.Core.Configuration.LegacyUmbracoSettings.RazorDataTypeModelStaticMapping; //now we need to map to the old object until we can clean all this nonsense up return mapping.Select(x => new RazorDataTypeModelStaticMappingItem() @@ -239,7 +239,7 @@ namespace umbraco /// public static bool CloneXmlCacheOnPublish { - get { return Umbraco.Core.Configuration.UmbracoSettings.CloneXmlCacheOnPublish; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.CloneXmlCacheOnPublish; } } /// @@ -248,7 +248,7 @@ namespace umbraco /// true if content is parsed; otherwise, false. public static bool TidyEditorContent { - get { return Umbraco.Core.Configuration.UmbracoSettings.TidyEditorContent; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.TidyEditorContent; } } /// @@ -257,7 +257,7 @@ namespace umbraco /// The encoding type as string. public static string TidyCharEncoding { - get { return Umbraco.Core.Configuration.UmbracoSettings.TidyCharEncoding; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.TidyCharEncoding; } } /// @@ -266,12 +266,12 @@ namespace umbraco /// The property context help option. public static string PropertyContextHelpOption { - get { return Umbraco.Core.Configuration.UmbracoSettings.PropertyContextHelpOption; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.PropertyContextHelpOption; } } public static string DefaultBackofficeProvider { - get { return Umbraco.Core.Configuration.UmbracoSettings.DefaultBackofficeProvider; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.DefaultBackofficeProvider; } } /// @@ -279,7 +279,7 @@ namespace umbraco /// public static bool ForceSafeAliases { - get { return Umbraco.Core.Configuration.UmbracoSettings.ForceSafeAliases; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.ForceSafeAliases; } } /// @@ -287,7 +287,7 @@ namespace umbraco /// public static IEnumerable DisallowedUploadFiles { - get { return Umbraco.Core.Configuration.UmbracoSettings.DisallowedUploadFiles; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.DisallowedUploadFiles; } } /// @@ -296,7 +296,7 @@ namespace umbraco /// The allowed image file types. public static string ImageFileTypes { - get { return Umbraco.Core.Configuration.UmbracoSettings.ImageFileTypes; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.ImageFileTypes; } } /// @@ -305,7 +305,7 @@ namespace umbraco /// The allowed script file types. public static string ScriptFileTypes { - get { return Umbraco.Core.Configuration.UmbracoSettings.ScriptFileTypes; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.ScriptFileTypes; } } /// @@ -314,7 +314,7 @@ namespace umbraco /// public static int UmbracoLibraryCacheDuration { - get { return Umbraco.Core.Configuration.UmbracoSettings.UmbracoLibraryCacheDuration; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.UmbracoLibraryCacheDuration; } } /// @@ -323,7 +323,7 @@ namespace umbraco /// The script folder path. public static string ScriptFolderPath { - get { return Umbraco.Core.Configuration.UmbracoSettings.ScriptFolderPath; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.ScriptFolderPath; } } /// @@ -331,7 +331,7 @@ namespace umbraco /// public static bool ScriptDisableEditor { - get { return Umbraco.Core.Configuration.UmbracoSettings.ScriptDisableEditor; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.ScriptDisableEditor; } } /// @@ -342,7 +342,7 @@ namespace umbraco /// true if umbraco ensures unique node naming; otherwise, false. public static bool EnsureUniqueNaming { - get { return Umbraco.Core.Configuration.UmbracoSettings.EnsureUniqueNaming; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.EnsureUniqueNaming; } } /// @@ -351,7 +351,7 @@ namespace umbraco /// The notification email sender. public static string NotificationEmailSender { - get { return Umbraco.Core.Configuration.UmbracoSettings.NotificationEmailSender; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.NotificationEmailSender; } } /// @@ -362,7 +362,7 @@ namespace umbraco /// public static bool NotificationDisableHtmlEmail { - get { return Umbraco.Core.Configuration.UmbracoSettings.NotificationDisableHtmlEmail; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.NotificationDisableHtmlEmail; } } /// @@ -371,12 +371,12 @@ namespace umbraco /// The allowed attributes on images. public static string ImageAllowedAttributes { - get { return Umbraco.Core.Configuration.UmbracoSettings.ImageAllowedAttributes; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.ImageAllowedAttributes; } } public static XmlNode ImageAutoFillImageProperties { - get { return Umbraco.Core.Configuration.UmbracoSettings.ImageAutoFillImageProperties; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.ImageAutoFillImageProperties; } } /// @@ -385,7 +385,7 @@ namespace umbraco /// The scheduled tasks. public static XmlNode ScheduledTasks { - get { return Umbraco.Core.Configuration.UmbracoSettings.ScheduledTasks; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.ScheduledTasks; } } /// @@ -394,7 +394,7 @@ namespace umbraco /// The URL replacement characters. public static XmlNode UrlReplaceCharacters { - get { return Umbraco.Core.Configuration.UmbracoSettings.UrlReplaceCharacters; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.UrlReplaceCharacters; } } /// @@ -402,7 +402,7 @@ namespace umbraco /// public static bool RemoveDoubleDashesFromUrlReplacing { - get { return Umbraco.Core.Configuration.UmbracoSettings.RemoveDoubleDashesFromUrlReplacing; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.RemoveDoubleDashesFromUrlReplacing; } } /// @@ -413,7 +413,7 @@ namespace umbraco /// true if umbraco uses distributed calls; otherwise, false. public static bool UseDistributedCalls { - get { return Umbraco.Core.Configuration.UmbracoSettings.UseDistributedCalls; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.UseDistributedCalls; } } @@ -423,7 +423,7 @@ namespace umbraco /// The distributed call user. public static int DistributedCallUser { - get { return Umbraco.Core.Configuration.UmbracoSettings.DistributedCallUser; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.DistributedCallUser; } } /// @@ -431,7 +431,7 @@ namespace umbraco /// public static string PreviewBadge { - get { return Umbraco.Core.Configuration.UmbracoSettings.PreviewBadge; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.PreviewBadge; } } /// @@ -442,7 +442,7 @@ namespace umbraco /// The distribution servers. public static XmlNode DistributionServers { - get { return Umbraco.Core.Configuration.UmbracoSettings.DistributionServers; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.DistributionServers; } } /// @@ -452,7 +452,7 @@ namespace umbraco /// public static XmlNode HelpPages { - get { return Umbraco.Core.Configuration.UmbracoSettings.HelpPages; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.HelpPages; } } /// @@ -464,7 +464,7 @@ namespace umbraco /// The repository servers. public static XmlNode Repositories { - get { return Umbraco.Core.Configuration.UmbracoSettings.Repositories; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.Repositories; } } /// @@ -477,7 +477,7 @@ namespace umbraco /// public static bool UseViewstateMoverModule { - get { return Umbraco.Core.Configuration.UmbracoSettings.UseViewstateMoverModule; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.UseViewstateMoverModule; } } @@ -487,7 +487,7 @@ namespace umbraco /// public static bool isXmlContentCacheDisabled { - get { return Umbraco.Core.Configuration.UmbracoSettings.IsXmlContentCacheDisabled; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.IsXmlContentCacheDisabled; } } /// @@ -497,7 +497,7 @@ namespace umbraco /// public static bool XmlContentCheckForDiskChanges { - get { return Umbraco.Core.Configuration.UmbracoSettings.XmlContentCheckForDiskChanges; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.XmlContentCheckForDiskChanges; } } /// @@ -507,7 +507,7 @@ namespace umbraco /// public static bool EnableGlobalPreviewStorage { - get { return Umbraco.Core.Configuration.UmbracoSettings.EnableGlobalPreviewStorage; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.EnableGlobalPreviewStorage; } } /// @@ -518,18 +518,18 @@ namespace umbraco /// public static bool UseLegacyXmlSchema { - get { return Umbraco.Core.Configuration.UmbracoSettings.UseLegacyXmlSchema; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.UseLegacyXmlSchema; } } public static IEnumerable AppCodeFileExtensionsList { - get { return Umbraco.Core.Configuration.UmbracoSettings.AppCodeFileExtensionsList; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.AppCodeFileExtensionsList; } } [Obsolete("Use AppCodeFileExtensionsList instead")] public static XmlNode AppCodeFileExtensions { - get { return Umbraco.Core.Configuration.UmbracoSettings.AppCodeFileExtensions; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.AppCodeFileExtensions; } } /// @@ -538,7 +538,7 @@ namespace umbraco /// public static bool continouslyUpdateXmlDiskCache { - get { return Umbraco.Core.Configuration.UmbracoSettings.ContinouslyUpdateXmlDiskCache; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.ContinouslyUpdateXmlDiskCache; } } /// @@ -549,12 +549,12 @@ namespace umbraco /// public static bool EnableSplashWhileLoading { - get { return Umbraco.Core.Configuration.UmbracoSettings.EnableSplashWhileLoading; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.EnableSplashWhileLoading; } } public static bool ResolveUrlsFromTextString { - get { return Umbraco.Core.Configuration.UmbracoSettings.ResolveUrlsFromTextString; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.ResolveUrlsFromTextString; } } /// @@ -566,7 +566,7 @@ namespace umbraco /// MacroErrorBehaviour enum defining how to handle macro errors. public static MacroErrorBehaviour MacroErrorBehaviour { - get { return Umbraco.Core.Configuration.UmbracoSettings.MacroErrorBehaviour; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.MacroErrorBehaviour; } } /// @@ -578,7 +578,7 @@ namespace umbraco /// MacroErrorBehaviour enum defining how to show icons in the document type editor. public static IconPickerBehaviour IconPickerBehaviour { - get { return Umbraco.Core.Configuration.UmbracoSettings.IconPickerBehaviour; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.IconPickerBehaviour; } } /// @@ -588,7 +588,7 @@ namespace umbraco /// If undefined, 'Textstring' is the default public static string DefaultDocumentTypeProperty { - get { return Umbraco.Core.Configuration.UmbracoSettings.DefaultDocumentTypeProperty; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.DefaultDocumentTypeProperty; } } /// @@ -603,7 +603,7 @@ namespace umbraco /// true if enabled; otherwise, false. public static bool Enabled { - get { return Umbraco.Core.Configuration.UmbracoSettings.WebServices.Enabled; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.WebServices.Enabled; } } #region "Webservice configuration" @@ -614,7 +614,7 @@ namespace umbraco /// The document service users. public static string[] documentServiceUsers { - get { return Umbraco.Core.Configuration.UmbracoSettings.WebServices.DocumentServiceUsers; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.WebServices.DocumentServiceUsers; } } /// @@ -623,7 +623,7 @@ namespace umbraco /// The file service users. public static string[] fileServiceUsers { - get { return Umbraco.Core.Configuration.UmbracoSettings.WebServices.FileServiceUsers; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.WebServices.FileServiceUsers; } } @@ -633,7 +633,7 @@ namespace umbraco /// The file service folders. public static string[] fileServiceFolders { - get { return Umbraco.Core.Configuration.UmbracoSettings.WebServices.FileServiceFolders; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.WebServices.FileServiceFolders; } } /// @@ -642,7 +642,7 @@ namespace umbraco /// The member service users. public static string[] memberServiceUsers { - get { return Umbraco.Core.Configuration.UmbracoSettings.WebServices.MemberServiceUsers; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.WebServices.MemberServiceUsers; } } /// @@ -651,7 +651,7 @@ namespace umbraco /// The stylesheet service users. public static string[] stylesheetServiceUsers { - get { return Umbraco.Core.Configuration.UmbracoSettings.WebServices.StylesheetServiceUsers; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.WebServices.StylesheetServiceUsers; } } /// @@ -660,7 +660,7 @@ namespace umbraco /// The template service users. public static string[] templateServiceUsers { - get { return Umbraco.Core.Configuration.UmbracoSettings.WebServices.TemplateServiceUsers; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.WebServices.TemplateServiceUsers; } } /// @@ -669,7 +669,7 @@ namespace umbraco /// The media service users. public static string[] mediaServiceUsers { - get { return Umbraco.Core.Configuration.UmbracoSettings.WebServices.MediaServiceUsers; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.WebServices.MediaServiceUsers; } } @@ -679,7 +679,7 @@ namespace umbraco /// The maintenance service users. public static string[] maintenanceServiceUsers { - get { return Umbraco.Core.Configuration.UmbracoSettings.WebServices.MaintenanceServiceUsers; } + get { return Umbraco.Core.Configuration.LegacyUmbracoSettings.WebServices.MaintenanceServiceUsers; } } #endregion diff --git a/src/umbraco.cms/businesslogic/template/Template.cs b/src/umbraco.cms/businesslogic/template/Template.cs index 7f58d40953..1894df0a26 100644 --- a/src/umbraco.cms/businesslogic/template/Template.cs +++ b/src/umbraco.cms/businesslogic/template/Template.cs @@ -154,7 +154,7 @@ namespace umbraco.cms.businesslogic.template } dr.Close(); - if (Umbraco.Core.Configuration.UmbracoSettings.DefaultRenderingEngine == RenderingEngine.Mvc && ViewHelper.ViewExists(this)) + if (Umbraco.Core.Configuration.LegacyUmbracoSettings.DefaultRenderingEngine == RenderingEngine.Mvc && ViewHelper.ViewExists(this)) _design = ViewHelper.GetFileContents(this); else _design = MasterPageHelper.GetFileContents(this); @@ -265,7 +265,7 @@ namespace umbraco.cms.businesslogic.template _design = value.Trim(NewLineChars); //we only switch to MVC View editing if the template has a view file, and MVC editing is enabled - if (Umbraco.Core.Configuration.UmbracoSettings.DefaultRenderingEngine == RenderingEngine.Mvc && !MasterPageHelper.IsMasterPageSyntax(_design)) + if (Umbraco.Core.Configuration.LegacyUmbracoSettings.DefaultRenderingEngine == RenderingEngine.Mvc && !MasterPageHelper.IsMasterPageSyntax(_design)) { MasterPageHelper.RemoveMasterPageFile(this.Alias); MasterPageHelper.RemoveMasterPageFile(_oldAlias); @@ -351,7 +351,7 @@ namespace umbraco.cms.businesslogic.template /// private static RenderingEngine DetermineRenderingEngine(Template t, string design = null) { - var engine = Umbraco.Core.Configuration.UmbracoSettings.DefaultRenderingEngine; + var engine = Umbraco.Core.Configuration.LegacyUmbracoSettings.DefaultRenderingEngine; if (!design.IsNullOrWhiteSpace() && MasterPageHelper.IsMasterPageSyntax(design)) {