diff --git a/.gitignore b/.gitignore index fde5d2a963..8064045856 100644 --- a/.gitignore +++ b/.gitignore @@ -1,135 +1,136 @@ -*.obj -*.pdb -*.user -*.aps -*.pch -*.vspscc -.DS_Store -._.DS_Store -[Bb]in -[Db]ebug*/ -obj/ -[Rr]elease*/ -_ReSharper*/ -_NCrunch_*/ -*.ncrunchsolution -*.ncrunchsolution.user -*.ncrunchproject -*.crunchsolution.cache -[Tt]est[Rr]esult* -[Bb]uild[Ll]og.* -*.[Pp]ublish.xml -*.suo -[sS]ource -[sS]andbox -umbraco.config -*.vs10x -App_Data/TEMP/* -[Uu]mbraco/[Pp]resentation/[Uu]mbraco/[Pp]lugins/* -[Uu]mbraco/[Pp]resentation/[Uu]ser[Cc]ontrols/* -[Uu]mbraco/[Pp]resentation/[Ss]cripts/* -[Uu]mbraco/[Pp]resentation/[Ff]onts/* -[Uu]mbraco/[Pp]resentation/[Cc]ss/* - -src/Umbraco.Web.UI/[Cc]ss/* -src/Umbraco.Web.UI/App_Code/* -src/Umbraco.Web.UI/App_Data/* -src/Umbraco.Tests/App_Data/* -src/Umbraco.Web.UI/[Mm]edia/* -src/Umbraco.Web.UI/[Mm]aster[Pp]ages/* -src/Umbraco.Web.UI/[Mm]acro[Ss]cripts/* -!src/Umbraco.Web.UI/[Mm]acro[Ss]cripts/[Ww]eb.[Cc]onfig -src/Umbraco.Web.UI/[Xx]slt/* -src/Umbraco.Web.UI/[Ii]mages/* -src/Umbraco.Web.UI/[Ss]cripts/* -src/Umbraco.Web.UI/Web.*.config.transformed - -umbraco/presentation/umbraco/plugins/uComponents/uComponentsInstaller.ascx -umbraco/presentation/packages/uComponents/MultiNodePicker/CustomTreeService.asmx -_BuildOutput/* -*.ncrunchsolution -build/UmbracoCms.AllBinaries*zip -build/UmbracoCms.WebPI*zip -build/UmbracoCms*zip -build/UmbracoExamine.PDF*zip -build/*.nupkg -src/Umbraco.Tests/config/applications.config -src/Umbraco.Tests/config/trees.config -src/Umbraco.Web.UI/web.config -*.orig -src/Umbraco.Tests/config/404handlers.config -src/Umbraco.Web.UI/[Vv]iews/*.cshtml -src/Umbraco.Web.UI/[Vv]iews/*.vbhtml -src/Umbraco.Tests/[Cc]onfig/umbracoSettings.config -src/Umbraco.Web.UI/[Vv]iews/* -src/packages/ -src/packages/repositories.config - -src/Umbraco.Web.UI/[Ww]eb.config -*.transformed -webpihash.txt - -node_modules - -src/Umbraco.Web.UI/[Uu]mbraco/[Ll]ib/* -src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/umbraco.* -src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/routes.js -src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/app.dev.js -src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/loader.js -src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/loader.dev.js -src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/main.js -src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/app.js - -src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/tuning.panel.js -src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/tuning.palettes.js -src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/tuning.loader.js -src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/tuning.front.js -src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/tuning.config.js - -src/Umbraco.Web.UI/[Uu]mbraco/[Vv]iews/ -src/Umbraco.Web.UI/[Uu]mbraco/[Vv]iews/**/*.js -src/Umbraco.Web.UI/[Uu]mbraco/[Vv]iews/**/*.css -src/Umbraco.Web.UI/[Uu]mbraco/[Vv]iews/**/*.html -src/Umbraco.Web.UI/[Uu]mbraco/[Aa]ssets/* -src/Umbraco.Web.UI.Client/[Bb]uild/* -src/Umbraco.Web.UI.Client/[Bb]uild/[Bb]elle/ -src/Umbraco.Web.UI/[Uu]ser[Cc]ontrols/ -build/_BuildOutput/ -src/Umbraco.Web.UI.Client/src/[Ll]ess/*.css -tools/NDepend/ - -src/Umbraco.Web.UI/App_Plugins/* -src/*.psess -src/*.vspx -src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/routes.js.* -NDependOut/* -*.ndproj -QueryResult.htm -*.ndproj -src/Umbraco.Web.UI/[Uu]mbraco/[Aa]ssets/* -src/Umbraco.Web.UI/[Uu]mbraco/[Ll]ib/* -src/Umbraco.Web.UI/[Uu]mbraco/[Vv]iews/**/*.html -src/Umbraco.Web.UI/[Uu]mbraco/[Vv]iews/**/*.js - -src/Umbraco.Web.UI/[Cc]onfig/appSettings.config -src/Umbraco.Web.UI/[Cc]onfig/connectionStrings.config -src/Umbraco.Web.UI/umbraco/plugins/* -src/Umbraco.Web.UI/umbraco/js/init.js -build/ApiDocs/* -build/ApiDocs/Output/* -src/Umbraco.Web.UI.Client/bower_components/* -/src/Umbraco.Web.UI/Umbraco/preview - -#Ignore Rule for output of generated documentation files from Grunt docserve -src/Umbraco.Web.UI.Client/docs/api -src/*.boltdata/ -/src/Umbraco.Web.UI/Umbraco/Js/canvasdesigner.loader.js -/src/Umbraco.Web.UI/Umbraco/Js/canvasdesigner.palettes.js -/src/Umbraco.Web.UI/Umbraco/Js/canvasdesigner.panel.js -/src/Umbraco.Web.UI/Umbraco/Js/canvasdesigner.config.js -/src/Umbraco.Web.UI/Umbraco/Js/canvasdesigner.front.js -src/umbraco.sln.ide/* -build/UmbracoCms.*/ -src/.vs/ -src/Umbraco.Web.UI/umbraco/js/install.loader.js -src/Umbraco.Web.UI/js/* +*.obj +*.pdb +*.user +*.aps +*.pch +*.vspscc +.DS_Store +._.DS_Store +[Bb]in +[Db]ebug*/ +obj/ +[Rr]elease*/ +_ReSharper*/ +_NCrunch_*/ +*.ncrunchsolution +*.ncrunchsolution.user +*.ncrunchproject +*.crunchsolution.cache +[Tt]est[Rr]esult* +[Bb]uild[Ll]og.* +*.[Pp]ublish.xml +*.suo +[sS]ource +[sS]andbox +umbraco.config +*.vs10x +App_Data/TEMP/* +[Uu]mbraco/[Pp]resentation/[Uu]mbraco/[Pp]lugins/* +[Uu]mbraco/[Pp]resentation/[Uu]ser[Cc]ontrols/* +[Uu]mbraco/[Pp]resentation/[Ss]cripts/* +[Uu]mbraco/[Pp]resentation/[Ff]onts/* +[Uu]mbraco/[Pp]resentation/[Cc]ss/* + +src/Umbraco.Web.UI/[Cc]ss/* +src/Umbraco.Web.UI/App_Code/* +src/Umbraco.Web.UI/App_Data/* +src/Umbraco.Tests/App_Data/* +src/Umbraco.Web.UI/[Mm]edia/* +src/Umbraco.Web.UI/[Mm]aster[Pp]ages/* +src/Umbraco.Web.UI/[Mm]acro[Ss]cripts/* +!src/Umbraco.Web.UI/[Mm]acro[Ss]cripts/[Ww]eb.[Cc]onfig +src/Umbraco.Web.UI/[Xx]slt/* +src/Umbraco.Web.UI/[Ii]mages/* +src/Umbraco.Web.UI/[Ss]cripts/* +src/Umbraco.Web.UI/Web.*.config.transformed + +umbraco/presentation/umbraco/plugins/uComponents/uComponentsInstaller.ascx +umbraco/presentation/packages/uComponents/MultiNodePicker/CustomTreeService.asmx +_BuildOutput/* +*.ncrunchsolution +build/UmbracoCms.AllBinaries*zip +build/UmbracoCms.WebPI*zip +build/UmbracoCms*zip +build/UmbracoExamine.PDF*zip +build/*.nupkg +src/Umbraco.Tests/config/applications.config +src/Umbraco.Tests/config/trees.config +src/Umbraco.Web.UI/web.config +*.orig +src/Umbraco.Tests/config/404handlers.config +src/Umbraco.Web.UI/[Vv]iews/*.cshtml +src/Umbraco.Web.UI/[Vv]iews/*.vbhtml +src/Umbraco.Tests/[Cc]onfig/umbracoSettings.config +src/Umbraco.Web.UI/[Vv]iews/* +src/packages/ +src/packages/repositories.config + +src/Umbraco.Web.UI/[Ww]eb.config +*.transformed +webpihash.txt + +node_modules + +src/Umbraco.Web.UI/[Uu]mbraco/[Ll]ib/* +src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/umbraco.* +src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/routes.js +src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/app.dev.js +src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/loader.js +src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/loader.dev.js +src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/main.js +src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/app.js + +src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/tuning.panel.js +src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/tuning.palettes.js +src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/tuning.loader.js +src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/tuning.front.js +src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/tuning.config.js + +src/Umbraco.Web.UI/[Uu]mbraco/[Vv]iews/ +src/Umbraco.Web.UI/[Uu]mbraco/[Vv]iews/**/*.js +src/Umbraco.Web.UI/[Uu]mbraco/[Vv]iews/**/*.css +src/Umbraco.Web.UI/[Uu]mbraco/[Vv]iews/**/*.html +src/Umbraco.Web.UI/[Uu]mbraco/[Aa]ssets/* +src/Umbraco.Web.UI.Client/[Bb]uild/* +src/Umbraco.Web.UI.Client/[Bb]uild/[Bb]elle/ +src/Umbraco.Web.UI/[Uu]ser[Cc]ontrols/ +build/_BuildOutput/ +src/Umbraco.Web.UI.Client/src/[Ll]ess/*.css +tools/NDepend/ + +src/Umbraco.Web.UI/App_Plugins/* +src/*.psess +src/*.vspx +src/Umbraco.Web.UI/[Uu]mbraco/[Jj]s/routes.js.* +NDependOut/* +*.ndproj +QueryResult.htm +*.ndproj +src/Umbraco.Web.UI/[Uu]mbraco/[Aa]ssets/* +src/Umbraco.Web.UI/[Uu]mbraco/[Ll]ib/* +src/Umbraco.Web.UI/[Uu]mbraco/[Vv]iews/**/*.html +src/Umbraco.Web.UI/[Uu]mbraco/[Vv]iews/**/*.js + +src/Umbraco.Web.UI/[Cc]onfig/appSettings.config +src/Umbraco.Web.UI/[Cc]onfig/connectionStrings.config +src/Umbraco.Web.UI/umbraco/plugins/* +src/Umbraco.Web.UI/umbraco/js/init.js +build/ApiDocs/* +build/ApiDocs/Output/* +src/Umbraco.Web.UI.Client/bower_components/* +/src/Umbraco.Web.UI/Umbraco/preview + +#Ignore Rule for output of generated documentation files from Grunt docserve +src/Umbraco.Web.UI.Client/docs/api +src/*.boltdata/ +/src/Umbraco.Web.UI/Umbraco/Js/canvasdesigner.loader.js +/src/Umbraco.Web.UI/Umbraco/Js/canvasdesigner.palettes.js +/src/Umbraco.Web.UI/Umbraco/Js/canvasdesigner.panel.js +/src/Umbraco.Web.UI/Umbraco/Js/canvasdesigner.config.js +/src/Umbraco.Web.UI/Umbraco/Js/canvasdesigner.front.js +src/umbraco.sln.ide/* +build/UmbracoCms.*/ +src/.vs/ +src/Umbraco.Web.UI/umbraco/js/install.loader.js +src/Umbraco.Web.UI/js/* +src/Umbraco.Tests/media \ No newline at end of file diff --git a/build/NuSpecs/UmbracoCms.Core.nuspec b/build/NuSpecs/UmbracoCms.Core.nuspec index 72733c5800..5a57989579 100644 --- a/build/NuSpecs/UmbracoCms.Core.nuspec +++ b/build/NuSpecs/UmbracoCms.Core.nuspec @@ -21,7 +21,7 @@ - + @@ -29,44 +29,38 @@ - - + + + + + + - + + - - - - - - - - - - - @@ -76,24 +70,14 @@ - - - - - - - - - - diff --git a/build/NuSpecs/UmbracoCms.nuspec b/build/NuSpecs/UmbracoCms.nuspec index 783bb8ae5c..66e82ac488 100644 --- a/build/NuSpecs/UmbracoCms.nuspec +++ b/build/NuSpecs/UmbracoCms.nuspec @@ -17,7 +17,7 @@ - + diff --git a/src/SQLCE4Umbraco/app.config b/src/SQLCE4Umbraco/app.config index 1ec9d6e3d6..cb532bd57a 100644 --- a/src/SQLCE4Umbraco/app.config +++ b/src/SQLCE4Umbraco/app.config @@ -4,7 +4,7 @@ - + diff --git a/src/SolutionInfo.cs b/src/SolutionInfo.cs index 2e29693e9a..bcbd95ecd1 100644 --- a/src/SolutionInfo.cs +++ b/src/SolutionInfo.cs @@ -11,5 +11,5 @@ using System.Resources; [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyFileVersion("7.4.1")] -[assembly: AssemblyInformationalVersion("7.4.1")] \ No newline at end of file +[assembly: AssemblyFileVersion("7.4.3")] +[assembly: AssemblyInformationalVersion("7.4.3")] \ No newline at end of file diff --git a/src/Umbraco.Core/Cache/FullDataSetRepositoryCachePolicy.cs b/src/Umbraco.Core/Cache/FullDataSetRepositoryCachePolicy.cs index 9b37d1861f..49340f5aa5 100644 --- a/src/Umbraco.Core/Cache/FullDataSetRepositoryCachePolicy.cs +++ b/src/Umbraco.Core/Cache/FullDataSetRepositoryCachePolicy.cs @@ -163,17 +163,7 @@ namespace Umbraco.Core.Cache return entityCollection; } - - /// - /// For this type of caching policy, we don't cache individual items - /// - /// - /// - protected void SetCacheAction(string cacheKey, TEntity entity) - { - //No-op - } - + /// /// Sets the action to execute on disposal for an entity collection /// diff --git a/src/Umbraco.Core/Configuration/UmbracoSettings/CustomBooleanTypeConverter.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/CustomBooleanTypeConverter.cs deleted file mode 100644 index 4ad77f7bb6..0000000000 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/CustomBooleanTypeConverter.cs +++ /dev/null @@ -1,32 +0,0 @@ -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/LinkElement.cs b/src/Umbraco.Core/Configuration/UmbracoSettings/LinkElement.cs deleted file mode 100644 index 31b4aa3e93..0000000000 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/LinkElement.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System.Configuration; - -namespace Umbraco.Core.Configuration.UmbracoSettings -{ - internal class LinkElement : ConfigurationElement, ILink - { - [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"]; } - } - - string ILink.Application - { - get { return Application; } - } - - string ILink.ApplicationUrl - { - get { return ApplicationUrl; } - } - - string ILink.Language - { - get { return Language; } - } - - string ILink.UserType - { - get { return UserType; } - } - - string ILink.HelpUrl - { - get { return 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 deleted file mode 100644 index 5c317790cb..0000000000 --- a/src/Umbraco.Core/Configuration/UmbracoSettings/LinksCollection.cs +++ /dev/null @@ -1,34 +0,0 @@ -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 ILink; - } - } - - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - } -} \ No newline at end of file diff --git a/src/Umbraco.Core/Constants-Applications.cs b/src/Umbraco.Core/Constants-Applications.cs index 12f7076fc4..38dc22c473 100644 --- a/src/Umbraco.Core/Constants-Applications.cs +++ b/src/Umbraco.Core/Constants-Applications.cs @@ -107,6 +107,11 @@ public const string Languages = "languages"; + /// + /// alias for the user types tree. + /// + public const string UserTypes = "userTypes"; + //TODO: Fill in the rest! } } diff --git a/src/Umbraco.Core/Constants-Web.cs b/src/Umbraco.Core/Constants-Web.cs index f596820506..22df82367d 100644 --- a/src/Umbraco.Core/Constants-Web.cs +++ b/src/Umbraco.Core/Constants-Web.cs @@ -4,7 +4,7 @@ using System.ComponentModel; namespace Umbraco.Core { public static partial class Constants - { + { /// /// Defines the identifiers for Umbraco system nodes. /// @@ -54,5 +54,10 @@ namespace Umbraco.Core public const string SessionIdClaimType = "http://umbraco.org/2015/02/identity/claims/backoffice/sessionid"; } + + public static class IO + { + public const string MediaFileSystemProvider = "media"; + } } } \ No newline at end of file diff --git a/src/Umbraco.Core/ControlExtensions.cs b/src/Umbraco.Core/ControlExtensions.cs deleted file mode 100644 index 391c69159f..0000000000 --- a/src/Umbraco.Core/ControlExtensions.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Web.UI; - -namespace Umbraco.Core -{ - internal static class ControlExtensions - { - /// - /// Recursively finds a control with the specified identifier. - /// - /// - /// The type of control to be found. - /// - /// - /// The parent control from which the search will start. - /// - /// - /// The identifier of the control to be found. - /// - /// - /// The control with the specified identifier, otherwise if the control - /// is not found. - /// - public static T FindControlRecursive(this Control parent, string id) where T : Control - { - if ((parent is T) && (parent.ID == id)) - { - return (T)parent; - } - - foreach (Control control in parent.Controls) - { - var foundControl = FindControlRecursive(control, id); - if (foundControl != null) - { - return foundControl; - } - } - return default(T); - } - - } -} diff --git a/src/Umbraco.Core/CoreBootManager.cs b/src/Umbraco.Core/CoreBootManager.cs index cab8d0a75b..ba60925b11 100644 --- a/src/Umbraco.Core/CoreBootManager.cs +++ b/src/Umbraco.Core/CoreBootManager.cs @@ -28,6 +28,8 @@ using Umbraco.Core.PropertyEditors; using Umbraco.Core.Publishing; using Umbraco.Core.Macros; using Umbraco.Core.Manifest; +using Umbraco.Core.Models.Identity; +using Umbraco.Core.Models.Membership; using Umbraco.Core.Services; using Umbraco.Core.Sync; using Umbraco.Core.Strings; @@ -183,6 +185,9 @@ namespace Umbraco.Core //Data Services/ServiceContext/etc... container.RegisterFrom(); + //ModelMappers + container.RegisterFrom(); + container.RegisterSingleton(); container.RegisterSingleton(factory => PluginManager); @@ -221,22 +226,18 @@ namespace Umbraco.Core } /// - /// This method allows for configuration of model mappers - /// - /// - /// Model mappers MUST be defined on ApplicationEventHandler instances with the interface IMapperConfiguration. - /// This allows us to search for less types on startup. - /// + /// This method initializes all of the model mappers registered in the container + /// protected void InitializeModelMappers() { Mapper.Initialize(configuration => + { + //foreach (var m in ApplicationEventsResolver.Current.ApplicationEventHandlers.OfType()) + foreach (var m in Container.GetAllInstances()) { - //foreach (var m in ApplicationEventsResolver.Current.ApplicationEventHandlers.OfType()) - foreach (var m in _appStartupEvtContainer.GetAllInstances().OfType()) - { - m.ConfigureMappings(configuration, ApplicationContext); - } - }); + m.ConfigureMappings(configuration, ApplicationContext); + } + }); } /// diff --git a/src/Umbraco.Core/DependencyInjection/CoreModelMappersCompositionRoot.cs b/src/Umbraco.Core/DependencyInjection/CoreModelMappersCompositionRoot.cs new file mode 100644 index 0000000000..ae5a215521 --- /dev/null +++ b/src/Umbraco.Core/DependencyInjection/CoreModelMappersCompositionRoot.cs @@ -0,0 +1,13 @@ +using LightInject; +using Umbraco.Core.Models.Identity; + +namespace Umbraco.Core.DependencyInjection +{ + public sealed class CoreModelMappersCompositionRoot : ICompositionRoot + { + public void Compose(IServiceRegistry container) + { + container.Register(); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Core/DependencyInjection/ServicesCompositionRoot.cs b/src/Umbraco.Core/DependencyInjection/ServicesCompositionRoot.cs index 9eeefc5759..0326072447 100644 --- a/src/Umbraco.Core/DependencyInjection/ServicesCompositionRoot.cs +++ b/src/Umbraco.Core/DependencyInjection/ServicesCompositionRoot.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.IO; using System.Linq; using LightInject; diff --git a/src/Umbraco.Core/Dynamics/ExtensionMethods.cs b/src/Umbraco.Core/Dynamics/ExtensionMethods.cs deleted file mode 100644 index 8439278b2e..0000000000 --- a/src/Umbraco.Core/Dynamics/ExtensionMethods.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using Umbraco.Core.Models; - -namespace Umbraco.Core.Dynamics -{ - [Obsolete("This class should not be used, it is just referenced by already obsoleted code and will be removed in the future")] - internal static class ExtensionMethods - { - //public static IEnumerable Map( - // this IEnumerable source, - // Func selectorFunction, - // Func> getChildrenFunction) - //{ - // if (!source.Any()) - // { - // return source; - // } - // // Add what we have to the stack - // var flattenedList = source.Where(selectorFunction); - // // Go through the input enumerable looking for children, - // // and add those if we have them - // foreach (TSource element in source) - // { - // var secondInner = getChildrenFunction(element); - // if (secondInner.Any()) - // { - // secondInner = secondInner.Map(selectorFunction, getChildrenFunction); - // } - // flattenedList = flattenedList.Concat(secondInner); - // } - // return flattenedList; - //} - - [Obsolete("This method should not be used and will be removed in the future")] - public static bool ContainsAny(this string haystack, IEnumerable needles) - { - return StringExtensions.ContainsAny(haystack, needles); - } - [Obsolete("This method should not be used and will be removed in the future")] - public static bool ContainsAny(this string haystack, params string[] needles) - { - return StringExtensions.ContainsAny(haystack, needles); - } - [Obsolete("This method should not be used and will be removed in the future")] - public static bool ContainsAny(this string haystack, StringComparison comparison, IEnumerable needles) - { - return StringExtensions.ContainsAny(haystack, needles, comparison); - } - [Obsolete("This method should not be used and will be removed in the future")] - public static bool ContainsAny(this string haystack, StringComparison comparison, params string[] needles) - { - return StringExtensions.ContainsAny(haystack, needles, comparison); - } - [Obsolete("This method should not be used and will be removed in the future")] - public static bool ContainsInsensitive(this string haystack, string needle) - { - if (haystack == null) throw new ArgumentNullException("haystack"); - return haystack.IndexOf(needle, StringComparison.CurrentCultureIgnoreCase) >= 0; - } - [Obsolete("This method should not be used and will be removed in the future")] - public static bool HasValue(this string s) - { - return !string.IsNullOrWhiteSpace(s); - } - - } -} diff --git a/src/Umbraco.Core/IO/FileSystemProviderConstants.cs b/src/Umbraco.Core/IO/FileSystemProviderConstants.cs deleted file mode 100644 index a447c4df8e..0000000000 --- a/src/Umbraco.Core/IO/FileSystemProviderConstants.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Umbraco.Core.CodeAnnotations; - -namespace Umbraco.Core.IO -{ - internal class FileSystemProviderConstants - { - public const string Media = "media"; - } -} diff --git a/src/Umbraco.Core/IO/IOHelper.cs b/src/Umbraco.Core/IO/IOHelper.cs index cc58a8cc60..4da43d35bb 100644 --- a/src/Umbraco.Core/IO/IOHelper.cs +++ b/src/Umbraco.Core/IO/IOHelper.cs @@ -114,33 +114,6 @@ 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 (UmbracoConfig.For.UmbracoSettings().Content.ResolveUrlsFromTextString) - { - using (DisposableTimer.DebugDuration(typeof(IOHelper), "ResolveUrlsFromTextString starting", "ResolveUrlsFromTextString complete")) - { - // find all relative urls (ie. urls that contain ~) - var tags = ResolveUrlPattern.Matches(text); - - foreach (Match tag in tags) - { - string url = ""; - if (tag.Groups[1].Success) - url = tag.Groups[1].Value; - - if (String.IsNullOrEmpty(url) == false) - { - string resolvedUrl = (url.Substring(0, 1) == "/") ? ResolveUrl(url.Substring(1)) : ResolveUrl(url); - text = text.Replace(url, resolvedUrl); - } - } - } - } - return text; - } - public static string MapPath(string path, bool useHttpContext) { // Check if the path is already mapped @@ -254,20 +227,6 @@ namespace Umbraco.Core.IO return false; } - /// - /// Validates that the current filepath matches one of several directories where the user is allowed to edit a file. - /// - /// The filepath to validate. - /// The valid directories. - /// True, if the filepath is valid, else an exception is thrown. - /// The filepath is invalid. - internal static bool ValidateEditPath(string filePath, IEnumerable validDirs) - { - if (VerifyEditPath(filePath, validDirs) == false) - throw new FileSecurityException(String.Format("The filepath '{0}' is not within an allowed directory for this type of files", filePath.Replace(MapPath(SystemDirectories.Root), ""))); - return true; - } - /// /// Verifies that the current filepath has one of several authorized extensions. /// diff --git a/src/Umbraco.Core/IO/SystemFiles.cs b/src/Umbraco.Core/IO/SystemFiles.cs index 4ff65459d8..c4fc2e0dee 100644 --- a/src/Umbraco.Core/IO/SystemFiles.cs +++ b/src/Umbraco.Core/IO/SystemFiles.cs @@ -11,15 +11,6 @@ namespace Umbraco.Core.IO { public class SystemFiles { - [Obsolete("This file is no longer used and should not be accessed!")] - public static string AccessXml - { - get - { - return SystemDirectories.Data + "/access.config"; - } - } - public static string CreateUiXml { get @@ -71,11 +62,6 @@ namespace Umbraco.Core.IO return IOHelper.ReturnPath("umbracoContentXML", "~/App_Data/umbraco.config"); } } - - [Obsolete("Use GlobalSettings.ContentCacheXmlStoredInCodeGen instead")] - internal static bool ContentCacheXmlStoredInCodeGen - { - get { return GlobalSettings.ContentCacheXmlStoredInCodeGen; } - } + } } diff --git a/src/Umbraco.Core/IO/ViewHelper.cs b/src/Umbraco.Core/IO/ViewHelper.cs index 933a9d2956..e321bfa35c 100644 --- a/src/Umbraco.Core/IO/ViewHelper.cs +++ b/src/Umbraco.Core/IO/ViewHelper.cs @@ -20,30 +20,7 @@ namespace Umbraco.Core.IO internal bool ViewExists(ITemplate t) { return _viewFileSystem.FileExists(ViewPath(t.Alias)); - } - - [Obsolete("This is only used for legacy purposes and will be removed in future versions")] - internal string GetPhysicalFilePath(ITemplate t) - { - return _viewFileSystem.GetFullPath(ViewPath(t.Alias)); - } - - internal string GetFileContents(ITemplate t) - { - string viewContent = ""; - string path = ViewPath(t.Alias); - - if (_viewFileSystem.FileExists(path)) - { - using (var tr = new StreamReader(_viewFileSystem.OpenFile(path))) - { - viewContent = tr.ReadToEnd(); - tr.Close(); - } - } - - return viewContent; - } + } public string CreateView(ITemplate t, bool overWrite = false) { @@ -158,16 +135,6 @@ namespace Umbraco.Core.IO return t.Content; } - internal void RemoveViewFile(string alias) - { - if (string.IsNullOrWhiteSpace(alias) == false) - { - var file = ViewPath(alias); - if (_viewFileSystem.FileExists(file)) - _viewFileSystem.DeleteFile(file); - } - } - public string ViewPath(string alias) { return _viewFileSystem.GetRelativePath(alias.Replace(" ", "") + ".cshtml"); diff --git a/src/Umbraco.Core/Logging/Logger.cs b/src/Umbraco.Core/Logging/Logger.cs index ae8bb60fcd..a6ed064c01 100644 --- a/src/Umbraco.Core/Logging/Logger.cs +++ b/src/Umbraco.Core/Logging/Logger.cs @@ -37,28 +37,6 @@ namespace Umbraco.Core.Logging { return new Logger(); } - - /// - /// Returns a logger for the type specified - /// - /// - /// - internal ILog LoggerFor() - { - return LogManager.GetLogger(typeof(T)); - } - - /// - /// Returns a logger for the object's type - /// - /// - /// - internal ILog LoggerFor(object getTypeFromInstance) - { - if (getTypeFromInstance == null) throw new ArgumentNullException("getTypeFromInstance"); - - return LogManager.GetLogger(getTypeFromInstance.GetType()); - } public void Error(Type callingType, string message, Exception exception) { diff --git a/src/Umbraco.Core/Logging/LoggerResolver.cs b/src/Umbraco.Core/Logging/LoggerResolver.cs index 431700c67b..eb27639df0 100644 --- a/src/Umbraco.Core/Logging/LoggerResolver.cs +++ b/src/Umbraco.Core/Logging/LoggerResolver.cs @@ -14,16 +14,7 @@ namespace Umbraco.Core.Logging : base(logger) { - } - - /// - /// Method allowing to change the logger during startup - /// - /// - internal void SetLogger(ILogger profiler) - { - Value = profiler; - } + } /// /// Gets the current logger diff --git a/src/Umbraco.Core/Macros/PersistableMacroProperty.cs b/src/Umbraco.Core/Macros/PersistableMacroProperty.cs deleted file mode 100644 index db3f824e4b..0000000000 --- a/src/Umbraco.Core/Macros/PersistableMacroProperty.cs +++ /dev/null @@ -1,68 +0,0 @@ -using System; -using System.Collections; - -namespace Umbraco.Core.Macros -{ - /// - /// NOTE: This is legacy code, might require a cleanup - /// - [Serializable] - internal class PersistableMacroProperty - { - #region Private Fields - private string _name; - private string _alias; - private string _value; - private string _assemblyName; - private string _typeName; - #endregion - - #region Properties - /// - /// Macro Caption - /// - public string Name - { - get { return _name; } - set { _name = value; } - } - - /// - /// Macro Alias - /// - public string Alias - { - get { return _alias; } - set { _alias = value; } - } - - /// - /// Macro Value - /// - public string Value - { - get { return _value; } - set { _value = value; } - } - - /// - /// AssemblyName of the Property of teh Macro - /// - public string AssemblyName - { - get { return _assemblyName; } - set { _assemblyName = value; } - } - - /// - /// TypeName of the property of the macro - /// - public string TypeName - { - get { return _typeName; } - set { _typeName = value; } - } - #endregion - - } -} diff --git a/src/Umbraco.Core/Media/Exif/ExifExceptions.cs b/src/Umbraco.Core/Media/Exif/ExifExceptions.cs index 4dc1856903..b51d77e309 100644 --- a/src/Umbraco.Core/Media/Exif/ExifExceptions.cs +++ b/src/Umbraco.Core/Media/Exif/ExifExceptions.cs @@ -19,25 +19,7 @@ namespace Umbraco.Core.Media.Exif { ; } - } - - /// - /// The exception that is thrown when the IFD section ID could not be understood. - /// - internal class UnknownIFDSectionException : Exception - { - public UnknownIFDSectionException() - : base("Unknown IFD section.") - { - ; - } - - public UnknownIFDSectionException(string message) - : base(message) - { - ; - } - } + } /// /// The exception that is thrown when an invalid enum type is given to an @@ -57,22 +39,4 @@ namespace Umbraco.Core.Media.Exif ; } } - - /// - /// The exception that is thrown when the 0th IFD section does not contain any fields. - /// - internal class IFD0IsEmptyException : Exception - { - public IFD0IsEmptyException() - : base("0th IFD section cannot be empty.") - { - ; - } - - public IFD0IsEmptyException(string message) - : base(message) - { - ; - } - } } diff --git a/src/Umbraco.Core/Media/Exif/JPEGExceptions.cs b/src/Umbraco.Core/Media/Exif/JPEGExceptions.cs index 5e7195ab98..40b62b25cc 100644 --- a/src/Umbraco.Core/Media/Exif/JPEGExceptions.cs +++ b/src/Umbraco.Core/Media/Exif/JPEGExceptions.cs @@ -2,24 +2,6 @@ namespace Umbraco.Core.Media.Exif { - /// - /// The exception that is thrown when the format of the image file - /// could not be understood. - /// - internal class UnknownImageFormatException : Exception - { - public UnknownImageFormatException() - : base("Unkown image format.") - { - ; - } - - public UnknownImageFormatException(string message) - : base(message) - { - ; - } - } /// /// The exception that is thrown when the format of the image file diff --git a/src/Umbraco.Core/ModelMapperHelper.cs b/src/Umbraco.Core/ModelMapperHelper.cs deleted file mode 100644 index a76b68e7dd..0000000000 --- a/src/Umbraco.Core/ModelMapperHelper.cs +++ /dev/null @@ -1,15 +0,0 @@ -using AutoMapper; - -namespace Umbraco.Core -{ - /// - /// Helper class for static model mapping with automapper - /// - internal static class ModelMapperHelper - { - internal static IMappingExpression SelfMap(this IConfiguration config) - { - return config.CreateMap(); - } - } -} \ No newline at end of file diff --git a/src/Umbraco.Core/Models/IMacroPropertyType.cs b/src/Umbraco.Core/Models/IMacroPropertyType.cs deleted file mode 100644 index 7c4bc0057f..0000000000 --- a/src/Umbraco.Core/Models/IMacroPropertyType.cs +++ /dev/null @@ -1,28 +0,0 @@ -namespace Umbraco.Core.Models -{ - /// - /// Defines a PropertyType (plugin) for a Macro - /// - internal interface IMacroPropertyType - { - /// - /// Gets the unique Alias of the Property Type - /// - string Alias { get; } - - /// - /// Gets the name of the Assembly used to render the Property Type - /// - string RenderingAssembly { get; } - - /// - /// Gets the name of the Type used to render the Property Type - /// - string RenderingType { get; } - - /// - /// Gets the Base Type for storing the PropertyType (Int32, String, Boolean) - /// - MacroPropertyTypeBaseTypes BaseType { get; } - } -} \ No newline at end of file diff --git a/src/Umbraco.Core/Models/Identity/IdentityModelMappings.cs b/src/Umbraco.Core/Models/Identity/IdentityModelMappings.cs index 0dc95a8987..534b4367ff 100644 --- a/src/Umbraco.Core/Models/Identity/IdentityModelMappings.cs +++ b/src/Umbraco.Core/Models/Identity/IdentityModelMappings.cs @@ -1,21 +1,20 @@ using System; using System.Linq; using AutoMapper; - using Umbraco.Core.Models.Mapping; using Umbraco.Core.Models.Membership; using Umbraco.Core.Security; namespace Umbraco.Core.Models.Identity { - public class IdentityModelMappings : MapperConfiguration + public class IdentityModelMappings : ModelMapperConfiguration { - public override void ConfigureMappings(IConfiguration config, ApplicationContext applicationContext) + public override void ConfigureMappings(IMapperConfiguration config, ApplicationContext applicationContext) { config.CreateMap() .ForMember(user => user.Email, expression => expression.MapFrom(user => user.Email)) .ForMember(user => user.Id, expression => expression.MapFrom(user => user.Id)) - .ForMember(user => user.LockoutEndDateUtc, expression => expression.MapFrom(user => user.IsLockedOut ? DateTime.MaxValue.ToUniversalTime() : (DateTime?)null)) + .ForMember(user => user.LockoutEndDateUtc, expression => expression.MapFrom(user => user.IsLockedOut ? DateTime.MaxValue.ToUniversalTime() : (DateTime?) null)) .ForMember(user => user.UserName, expression => expression.MapFrom(user => user.Username)) .ForMember(user => user.PasswordHash, expression => expression.MapFrom(user => GetPasswordHash(user.RawPasswordValue))) .ForMember(user => user.Culture, expression => expression.MapFrom(user => user.GetUserCulture(applicationContext.Services.TextService))) @@ -24,7 +23,16 @@ namespace Umbraco.Core.Models.Identity .ForMember(user => user.StartContentId, expression => expression.MapFrom(user => user.StartContentId)) .ForMember(user => user.UserTypeAlias, expression => expression.MapFrom(user => user.UserType.Alias)) .ForMember(user => user.AccessFailedCount, expression => expression.MapFrom(user => user.FailedPasswordAttempts)) - .ForMember(user => user.AllowedSections, expression => expression.MapFrom(user => user.AllowedSections.ToArray())); + .ForMember(user => user.AllowedSections, expression => expression.MapFrom(user => user.AllowedSections.ToArray())) + .ForMember(user => user.LockoutEnabled, expression => expression.Ignore()) + .ForMember(user => user.Logins, expression => expression.Ignore()) + .ForMember(user => user.LoginsChanged, expression => expression.Ignore()) + .ForMember(user => user.EmailConfirmed, expression => expression.Ignore()) + .ForMember(user => user.PhoneNumber, expression => expression.Ignore()) + .ForMember(user => user.PhoneNumberConfirmed, expression => expression.Ignore()) + .ForMember(user => user.TwoFactorEnabled, expression => expression.Ignore()) + .ForMember(user => user.Roles, expression => expression.Ignore()) + .ForMember(user => user.Claims, expression => expression.Ignore()); config.CreateMap() .ConstructUsing((BackOfficeIdentityUser user) => new UserData(Guid.NewGuid().ToString("N"))) //this is the 'session id' diff --git a/src/Umbraco.Core/Models/MacroPropertyTypeBaseTypes.cs b/src/Umbraco.Core/Models/MacroPropertyTypeBaseTypes.cs deleted file mode 100644 index f997e90b57..0000000000 --- a/src/Umbraco.Core/Models/MacroPropertyTypeBaseTypes.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Runtime.Serialization; - -namespace Umbraco.Core.Models -{ - /// - /// Enum for the three allowed BaseTypes - /// - [Serializable] - [DataContract(IsReference = true)] - internal enum MacroPropertyTypeBaseTypes - { - [EnumMember] - Int32, - [EnumMember] - Boolean, - [EnumMember] - String - } -} \ No newline at end of file diff --git a/src/Umbraco.Core/Models/Mapping/IMapperConfiguration.cs b/src/Umbraco.Core/Models/Mapping/IMapperConfiguration.cs deleted file mode 100644 index f9c0c2cc1e..0000000000 --- a/src/Umbraco.Core/Models/Mapping/IMapperConfiguration.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using AutoMapper; - -namespace Umbraco.Core.Models.Mapping -{ - /// - /// This is used to explicitly decorate any ApplicationEventHandler class if there are - /// AutoMapper configurations defined. - /// - /// - /// All automapper configurations are done during startup - /// inside an Automapper Initialize call which is better for performance - /// - public interface IMapperConfiguration : IApplicationEventHandler - { - void ConfigureMappings(IConfiguration config, ApplicationContext applicationContext); - } -} diff --git a/src/Umbraco.Core/Models/Mapping/MappingExpressionExtensions.cs b/src/Umbraco.Core/Models/Mapping/MappingExpressionExtensions.cs deleted file mode 100644 index 570e51dbc3..0000000000 --- a/src/Umbraco.Core/Models/Mapping/MappingExpressionExtensions.cs +++ /dev/null @@ -1,20 +0,0 @@ -using AutoMapper; - -namespace Umbraco.Core.Models.Mapping -{ - internal static class MappingExpressionExtensions - { - /// - /// Ignores all unmapped members by default - Use with caution! - /// - /// - /// - /// - /// - public static IMappingExpression IgnoreAllUnmapped(this IMappingExpression expression) - { - expression.ForAllMembers(opt => opt.Ignore()); - return expression; - } - } -} \ No newline at end of file diff --git a/src/Umbraco.Core/Models/Mapping/MapperConfiguration.cs b/src/Umbraco.Core/Models/Mapping/ModelMapperConfiguration.cs similarity index 58% rename from src/Umbraco.Core/Models/Mapping/MapperConfiguration.cs rename to src/Umbraco.Core/Models/Mapping/ModelMapperConfiguration.cs index 046f4429b2..863ce60369 100644 --- a/src/Umbraco.Core/Models/Mapping/MapperConfiguration.cs +++ b/src/Umbraco.Core/Models/Mapping/ModelMapperConfiguration.cs @@ -1,17 +1,17 @@ -using AutoMapper; - -namespace Umbraco.Core.Models.Mapping -{ - /// - /// Used to declare a mapper configuration - /// - /// - /// Use this class if your mapper configuration isn't also explicitly an ApplicationEventHandler. - /// - public abstract class MapperConfiguration : ApplicationEventHandler, IMapperConfiguration - { - public abstract void ConfigureMappings(IConfiguration config, ApplicationContext applicationContext); - } - - +using AutoMapper; + +namespace Umbraco.Core.Models.Mapping +{ + /// + /// Used to declare a mapper configuration + /// + /// + /// Use this class if your mapper configuration isn't also explicitly an ApplicationEventHandler. + /// + public abstract class ModelMapperConfiguration + { + public abstract void ConfigureMappings(IMapperConfiguration config, ApplicationContext applicationContext); + } + + } \ No newline at end of file diff --git a/src/Umbraco.Core/Models/Membership/UserGroup.cs b/src/Umbraco.Core/Models/Membership/UserGroup.cs deleted file mode 100644 index b0f10d9ff1..0000000000 --- a/src/Umbraco.Core/Models/Membership/UserGroup.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Runtime.Serialization; -using Umbraco.Core.Models.EntityBase; - -namespace Umbraco.Core.Models.Membership -{ - /// - /// Represents a Group for a Backoffice User - /// - /// - /// Should be internal until a proper user/membership implementation - /// is part of the roadmap. - /// - [Serializable] - [DataContract(IsReference = true)] - internal class UserGroup : Entity - { - //Add UserCollection ? - } -} \ No newline at end of file diff --git a/src/Umbraco.Core/Packaging/PackageBuilding.cs b/src/Umbraco.Core/Packaging/PackageBuilding.cs deleted file mode 100644 index e8c09d12b8..0000000000 --- a/src/Umbraco.Core/Packaging/PackageBuilding.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Umbraco.Core.Services; - -namespace Umbraco.Core.Packaging -{ - internal interface IPackageBuilding - { - } - - internal class PackageBuilding : IPackageBuilding - { - private readonly IPackagingService _packagingService; - - public PackageBuilding(IPackagingService packagingService) - { - _packagingService = packagingService; - } - } -} \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/Factories/UserSectionFactory.cs b/src/Umbraco.Core/Persistence/Factories/UserSectionFactory.cs deleted file mode 100644 index 0e6a17594f..0000000000 --- a/src/Umbraco.Core/Persistence/Factories/UserSectionFactory.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using AutoMapper; -using Umbraco.Core.Models; -using Umbraco.Core.Models.Membership; -using Umbraco.Core.Models.Rdbms; - -namespace Umbraco.Core.Persistence.Factories -{ - internal class UserSectionFactory - { - private readonly IUser _user; - - public UserSectionFactory(IUser user) - { - _user = user; - } - - public IEnumerable BuildEntity(IEnumerable dto) - { - return dto.Select(x => x.AppAlias); - } - - public IEnumerable BuildDto(IEnumerable entity) - { - return entity.Select(x => new User2AppDto - { - //NOTE: We're force casting to int here! this might not work in the future - UserId = (int)_user.Id, - AppAlias = x - }); - } - - } -} \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/Migrations/Initial/BaseDataCreation.cs b/src/Umbraco.Core/Persistence/Migrations/Initial/BaseDataCreation.cs index 5e07a617d4..7e70adb10f 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Initial/BaseDataCreation.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Initial/BaseDataCreation.cs @@ -174,6 +174,7 @@ namespace Umbraco.Core.Persistence.Migrations.Initial _database.Insert("umbracoUser2app", "user", false, new User2AppDto { UserId = 0, AppAlias = Constants.Applications.Settings }); _database.Insert("umbracoUser2app", "user", false, new User2AppDto { UserId = 0, AppAlias = Constants.Applications.Users }); _database.Insert("umbracoUser2app", "user", false, new User2AppDto { UserId = 0, AppAlias = Constants.Applications.Forms }); + _database.Insert("umbracoUser2app", "user", false, new User2AppDto { UserId = 0, AppAlias = Constants.Applications.Translation }); } private void CreateCmsPropertyTypeGroupData() diff --git a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/MovePublicAccessXmlDataToDb.cs b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/MovePublicAccessXmlDataToDb.cs index d60385926b..de7c4e09aa 100644 --- a/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/MovePublicAccessXmlDataToDb.cs +++ b/src/Umbraco.Core/Persistence/Migrations/Upgrades/TargetVersionSevenThreeZero/MovePublicAccessXmlDataToDb.cs @@ -29,7 +29,7 @@ namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenThreeZe if (dataExists.Any()) return; } - var xmlFile = IOHelper.MapPath(SystemFiles.AccessXml); + var xmlFile = IOHelper.MapPath(SystemDirectories.Data + "/access.config"); if (File.Exists(xmlFile) == false) return; diff --git a/src/Umbraco.Core/Persistence/Repositories/Interfaces/INotificationsRepository.cs b/src/Umbraco.Core/Persistence/Repositories/Interfaces/INotificationsRepository.cs index 5db035ee8d..1f31a9bc80 100644 --- a/src/Umbraco.Core/Persistence/Repositories/Interfaces/INotificationsRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/Interfaces/INotificationsRepository.cs @@ -13,5 +13,6 @@ namespace Umbraco.Core.Persistence.Repositories int DeleteNotifications(IUser user, IEntity entity); IEnumerable GetEntityNotifications(IEntity entity); IEnumerable GetUserNotifications(IUser user); + IEnumerable SetNotifications(IUser user, IEntity entity, string[] actions); } } \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/Repositories/NotificationsRepository.cs b/src/Umbraco.Core/Persistence/Repositories/NotificationsRepository.cs index 4a7b0a808c..668fdf4b5b 100644 --- a/src/Umbraco.Core/Persistence/Repositories/NotificationsRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/NotificationsRepository.cs @@ -36,6 +36,18 @@ namespace Umbraco.Core.Persistence.Repositories return dtos.Select(d => new Notification(d.id, d.userId, d.action, d.nodeObjectType)).ToList(); } + public IEnumerable SetNotifications(IUser user, IEntity entity, string[] actions) + { + var notifications = new List(); + using (var t = _unitOfWork.Database.GetTransaction()) + { + DeleteNotifications(user, entity); + notifications.AddRange(actions.Select(action => CreateNotification(user, entity, action))); + t.Complete(); + } + return notifications; + } + public IEnumerable GetEntityNotifications(IEntity entity) { var sql = new Sql() diff --git a/src/Umbraco.Core/PluginManager.cs b/src/Umbraco.Core/PluginManager.cs index 44e9e362d4..6145fec8e2 100644 --- a/src/Umbraco.Core/PluginManager.cs +++ b/src/Umbraco.Core/PluginManager.cs @@ -524,16 +524,7 @@ namespace Umbraco.Core internal IEnumerable ResolveAssignedMapperTypes() { return ResolveTypesWithAttribute(); - } - - /// - /// Returns all SqlSyntaxProviders with the SqlSyntaxProviderAttribute - /// - /// - internal IEnumerable ResolveSqlSyntaxProviders() - { - return ResolveTypesWithAttribute(); - } + } /// /// Gets/sets which assemblies to scan when type finding, generally used for unit testing, if not explicitly set @@ -543,46 +534,7 @@ namespace Umbraco.Core { get { return _assemblies ?? (_assemblies = TypeFinder.GetAssembliesWithKnownExclusions()); } set { _assemblies = value; } - } - - /// - /// Used to resolve and create instances of the specified type based on the resolved/cached plugin types - /// - /// - /// set to true if an exception is to be thrown if there is an error during instantiation - /// - /// - /// - internal IEnumerable FindAndCreateInstances(bool throwException = false, bool cacheResult = true, IEnumerable specificAssemblies = null) - { - var types = ResolveTypes(cacheResult, specificAssemblies); - return CreateInstances(types, throwException); - } - - /// - /// Used to create instances of the specified type based on the resolved/cached plugin types - /// - /// - /// - /// set to true if an exception is to be thrown if there is an error during instantiation - /// - internal IEnumerable CreateInstances(IEnumerable types, bool throwException = false) - { - return _serviceProvider.CreateInstances(types, _logger.Logger, throwException); - } - - /// - /// Used to create an instance of the specified type based on the resolved/cached plugin types - /// - /// - /// - /// - /// - internal T CreateInstance(Type type, bool throwException = false) - { - var instances = CreateInstances(new[] { type }, throwException); - return instances.FirstOrDefault(); - } + } private IEnumerable ResolveTypes( Func> finder, diff --git a/src/Umbraco.Core/Security/AuthenticationExtensions.cs b/src/Umbraco.Core/Security/AuthenticationExtensions.cs index 524663c9c5..7bb54e6ef7 100644 --- a/src/Umbraco.Core/Security/AuthenticationExtensions.cs +++ b/src/Umbraco.Core/Security/AuthenticationExtensions.cs @@ -169,25 +169,7 @@ namespace Umbraco.Core.Security { if (http == null) throw new ArgumentNullException("http"); Logout(http, UmbracoConfig.For.UmbracoSettings().Security.AuthCookieName); - } - - /// - /// This clears the forms authentication cookie for webapi since cookies are handled differently - /// - /// - [Obsolete("Use OWIN IAuthenticationManager.SignOut instead", true)] - [EditorBrowsable(EditorBrowsableState.Never)] - public static void UmbracoLogoutWebApi(this HttpResponseMessage response) - { - throw new NotSupportedException("This method is not supported and should not be used, it has been removed in Umbraco 7.4"); - } - - [Obsolete("Use WebSecurity.SetPrincipalForRequest", true)] - [EditorBrowsable(EditorBrowsableState.Never)] - public static FormsAuthenticationTicket UmbracoLoginWebApi(this HttpResponseMessage response, IUser user) - { - throw new NotSupportedException("This method is not supported and should not be used, it has been removed in Umbraco 7.4"); - } + } /// /// This clears the forms authentication cookie diff --git a/src/Umbraco.Core/Services/INotificationService.cs b/src/Umbraco.Core/Services/INotificationService.cs index fce334141b..e508026a02 100644 --- a/src/Umbraco.Core/Services/INotificationService.cs +++ b/src/Umbraco.Core/Services/INotificationService.cs @@ -72,6 +72,17 @@ namespace Umbraco.Core.Services /// void DeleteNotifications(IUser user, IEntity entity); + /// + /// Sets the specific notifications for the user and entity + /// + /// + /// + /// + /// + /// This performs a full replace + /// + IEnumerable SetNotifications(IUser user, IEntity entity, string[] actions); + /// /// Creates a new notification /// diff --git a/src/Umbraco.Core/Services/NotificationService.cs b/src/Umbraco.Core/Services/NotificationService.cs index 4d676d66e9..4ac1b64a40 100644 --- a/src/Umbraco.Core/Services/NotificationService.cs +++ b/src/Umbraco.Core/Services/NotificationService.cs @@ -174,6 +174,22 @@ namespace Umbraco.Core.Services repository.DeleteNotifications(user, entity); } + /// + /// Sets the specific notifications for the user and entity + /// + /// + /// + /// + /// + /// This performs a full replace + /// + public IEnumerable SetNotifications(IUser user, IEntity entity, string[] actions) + { + var uow = _uowProvider.GetUnitOfWork(); + var repository = _repositoryFactory.CreateNotificationsRepository(uow); + return repository.SetNotifications(user, entity, actions); + } + /// /// Creates a new notification /// diff --git a/src/Umbraco.Core/Services/UserService.cs b/src/Umbraco.Core/Services/UserService.cs index 64dfc8f601..40007c5b90 100644 --- a/src/Umbraco.Core/Services/UserService.cs +++ b/src/Umbraco.Core/Services/UserService.cs @@ -146,9 +146,10 @@ namespace Umbraco.Core.Services IsLockedOut = false, IsApproved = true }; - //adding default sections content and media - user.AddAllowedSection("content"); - user.AddAllowedSection("media"); + //adding default sections content, media + translation + user.AddAllowedSection(Constants.Applications.Content); + user.AddAllowedSection(Constants.Applications.Media); + user.AddAllowedSection(Constants.Applications.Translation); if (SavingUser.IsRaisedEventCancelled(new SaveEventArgs(user), this)) return user; diff --git a/src/Umbraco.Core/TypeHelper.cs b/src/Umbraco.Core/TypeHelper.cs index f0b3a82961..a42449ce94 100644 --- a/src/Umbraco.Core/TypeHelper.cs +++ b/src/Umbraco.Core/TypeHelper.cs @@ -16,17 +16,7 @@ namespace Umbraco.Core private static readonly ConcurrentDictionary GetFieldsCache = new ConcurrentDictionary(); private static readonly ConcurrentDictionary, PropertyInfo[]> GetPropertiesCache = new ConcurrentDictionary, PropertyInfo[]>(); - - /// - /// Checks if the method is actually overriding a base method - /// - /// - /// - public static bool IsOverride(MethodInfo m) - { - return m.GetBaseDefinition().DeclaringType != m.DeclaringType; - } - + /// /// Find all assembly references that are referencing the assignTypeFrom Type's assembly found in the assemblyList /// @@ -167,24 +157,7 @@ namespace Umbraco.Core if (implementation == null) throw new ArgumentNullException("implementation"); return IsTypeAssignableFrom(implementation.GetType()); } - - /// - /// A method to determine whether represents a value type. - /// - /// The implementation. - public static bool IsValueType(Type implementation) - { - return implementation.IsValueType || implementation.IsPrimitive; - } - - /// - /// A method to determine whether is an implied value type (, or a string). - /// - /// The implementation. - public static bool IsImplicitValueType(Type implementation) - { - return IsValueType(implementation) || implementation.IsEnum || implementation == typeof (string); - } + /// /// Returns (and caches) a PropertyInfo from a type @@ -211,21 +184,6 @@ namespace Umbraco.Core }); } - /// - /// Gets (and caches) discoverable in the current for a given . - /// - /// The source. - /// - public static FieldInfo[] CachedDiscoverableFields(Type type) - { - return GetFieldsCache.GetOrAdd( - type, - x => type - .GetFields(BindingFlags.Public | BindingFlags.Instance) - .Where(y => !y.IsInitOnly) - .ToArray()); - } - /// /// Gets (and caches) discoverable in the current for a given . /// diff --git a/src/Umbraco.Core/Umbraco.Core.csproj b/src/Umbraco.Core/Umbraco.Core.csproj index 518c20af5e..ac36147368 100644 --- a/src/Umbraco.Core/Umbraco.Core.csproj +++ b/src/Umbraco.Core/Umbraco.Core.csproj @@ -37,8 +37,8 @@ false - - ..\packages\AutoMapper.4.1.1\lib\net45\AutoMapper.dll + + ..\packages\AutoMapper.4.2.1\lib\net45\AutoMapper.dll True @@ -48,8 +48,8 @@ ..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll - - ..\packages\LightInject.4.0.3\lib\net46\LightInject.dll + + ..\packages\LightInject.4.0.8\lib\net46\LightInject.dll True @@ -88,8 +88,8 @@ False ..\packages\MySql.Data.6.9.8\lib\net45\MySql.Data.dll - - ..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll + + ..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll True @@ -174,9 +174,9 @@ + - @@ -225,7 +225,6 @@ - @@ -253,8 +252,6 @@ - - @@ -281,13 +278,13 @@ - + @@ -362,7 +359,6 @@ - @@ -542,7 +538,6 @@ - @@ -593,7 +588,6 @@ - @@ -671,7 +665,6 @@ - @@ -679,13 +672,11 @@ - - - + @@ -710,7 +701,6 @@ - @@ -743,7 +733,6 @@ - @@ -1094,7 +1083,6 @@ - @@ -1185,7 +1173,6 @@ - @@ -1356,7 +1343,6 @@ - diff --git a/src/Umbraco.Core/Xml/XPath/MacroNavigator.cs b/src/Umbraco.Core/Xml/XPath/MacroNavigator.cs index b44b7d5f6e..aebfb906f7 100644 --- a/src/Umbraco.Core/Xml/XPath/MacroNavigator.cs +++ b/src/Umbraco.Core/Xml/XPath/MacroNavigator.cs @@ -971,10 +971,6 @@ namespace Umbraco.Core.Xml.XPath ParameterNavigator }; - // gets the state - // for unit tests only - internal State InternalState { get { return _state; } } - // represents the XPathNavigator state internal class State { diff --git a/src/Umbraco.Core/app.config b/src/Umbraco.Core/app.config index 1ec9d6e3d6..cb532bd57a 100644 --- a/src/Umbraco.Core/app.config +++ b/src/Umbraco.Core/app.config @@ -4,7 +4,7 @@ - + diff --git a/src/Umbraco.Core/packages.config b/src/Umbraco.Core/packages.config index bcfc44c229..d3aa7b8ba5 100644 --- a/src/Umbraco.Core/packages.config +++ b/src/Umbraco.Core/packages.config @@ -1,8 +1,8 @@  - + - + @@ -12,7 +12,7 @@ - + diff --git a/src/Umbraco.Tests/App.config b/src/Umbraco.Tests/App.config index f73055ef45..916277329e 100644 --- a/src/Umbraco.Tests/App.config +++ b/src/Umbraco.Tests/App.config @@ -124,7 +124,7 @@ - + diff --git a/src/Umbraco.Tests/Configurations/UmbracoSettings/umbracoSettings.minimal.config b/src/Umbraco.Tests/Configurations/UmbracoSettings/umbracoSettings.minimal.config index e7deb293cc..0848a893d6 100644 --- a/src/Umbraco.Tests/Configurations/UmbracoSettings/umbracoSettings.minimal.config +++ b/src/Umbraco.Tests/Configurations/UmbracoSettings/umbracoSettings.minimal.config @@ -60,9 +60,6 @@ - - - diff --git a/src/Umbraco.Tests/CoreXml/NavigableNavigatorTests.cs b/src/Umbraco.Tests/CoreXml/NavigableNavigatorTests.cs index 41414cb81a..f5175b2476 100644 --- a/src/Umbraco.Tests/CoreXml/NavigableNavigatorTests.cs +++ b/src/Umbraco.Tests/CoreXml/NavigableNavigatorTests.cs @@ -1002,25 +1002,7 @@ namespace Umbraco.Tests.CoreXml Root = new TestRootContent(type).WithChildren(1); } } - - class TestSource3 : TestSourceBase - { - public TestSource3() - { - LastAttributeIndex = 1; - - var prop1 = new TestPropertyType("prop1"); - var prop2 = new TestPropertyType("prop2"); - var prop3 = new TestPropertyType("prop3"); - var type = new TestRootContentType(this, prop1, prop2); - var type1 = type.CreateType("type1", prop3); - - Content[1] = new TestContent(type1, 1, 1).WithValues("1:p1", "1:p2", "1:p3").WithChildren(2); - Content[2] = new TestContent(type1, 2, 1).WithValues("2:p1", "2:p2", "2:p3"); - - Root = new TestRootContent(type).WithChildren(1); - } - } + class TestSource4 : TestSourceBase { diff --git a/src/Umbraco.Tests/IO/FileSystemProviderManagerTests.cs b/src/Umbraco.Tests/IO/FileSystemProviderManagerTests.cs index 56b487a82e..3350b8b65e 100644 --- a/src/Umbraco.Tests/IO/FileSystemProviderManagerTests.cs +++ b/src/Umbraco.Tests/IO/FileSystemProviderManagerTests.cs @@ -4,6 +4,7 @@ using System.IO; using System.Linq; using System.Text; using NUnit.Framework; +using Umbraco.Core; using Umbraco.Core.IO; using Umbraco.Tests.TestHelpers; @@ -23,7 +24,7 @@ namespace Umbraco.Tests.IO [Test] public void Can_Get_Base_File_System() { - var fs = FileSystemProviderManager.Current.GetUnderlyingFileSystemProvider(FileSystemProviderConstants.Media); + var fs = FileSystemProviderManager.Current.GetUnderlyingFileSystemProvider(Constants.IO.MediaFileSystemProvider); Assert.NotNull(fs); } diff --git a/src/Umbraco.Tests/Macros/MacroEngineFactoryTests.cs b/src/Umbraco.Tests/Macros/MacroEngineFactoryTests.cs deleted file mode 100644 index c7211e9fb0..0000000000 --- a/src/Umbraco.Tests/Macros/MacroEngineFactoryTests.cs +++ /dev/null @@ -1,136 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using Moq; -using NUnit.Framework; -using umbraco.cms.businesslogic.macro; -using Umbraco.Core; -using Umbraco.Core.Cache; -using Umbraco.Core.Logging; -using Umbraco.Core.Profiling; -using Umbraco.Core.Models; - -namespace Umbraco.Tests.Macros -{ - [TestFixture] - public class MacroEngineFactoryTests - { - [SetUp] - public void Initialize() - { - var logger = new ProfilingLogger(Mock.Of(), Mock.Of()); - - //this ensures its reset - PluginManager.Current = new PluginManager(new ActivatorServiceProvider(), new NullCacheProvider(), - logger, - false) - { - AssembliesToScan = new[] - { - this.GetType().Assembly - } - }; - - //for testing, we'll specify which assemblies are scanned for the PluginTypeResolver - } - - [TearDown] - public void TearDown() - { - PluginManager.Current = null; - } - - [Test] - public void Get_All() - { - var engines = MacroEngineFactory.GetAll(); - Assert.AreEqual(2, engines.Count); - } - - [Test] - public void Get_Engine() - { - var engine1 = MacroEngineFactory.GetEngine("MacroEngine1"); - Assert.IsNotNull(engine1); - } - - [Test] - public void Get_By_Filename() - { - var engine1 = MacroEngineFactory.GetByFilename("test.me1"); - var engine2 = MacroEngineFactory.GetByFilename("test.me2"); - Assert.IsNotNull(engine1); - Assert.IsNotNull(engine2); - Assert.Throws(() => MacroEngineFactory.GetByFilename("test.blah")); - - } - - [Test] - public void Get_By_Extension() - { - var engine1 = MacroEngineFactory.GetByExtension("me1"); - var engine2 = MacroEngineFactory.GetByExtension("me2"); - Assert.IsNotNull(engine1); - Assert.IsNotNull(engine2); - Assert.Throws(() => MacroEngineFactory.GetByExtension("blah")); - } - - #region Classes for tests - public class MacroEngine1 : IMacroEngine - { - public string Name - { - get { return "MacroEngine1"; } - } - - public IEnumerable SupportedExtensions - { - get { return new[] {"me1"}; } - } - - public IEnumerable SupportedUIExtensions - { - get { throw new NotImplementedException(); } - } - - public bool Validate(string code, string tempFileName, IPublishedContent currentPage, out string errorMessage) - { - throw new NotImplementedException(); - } - - public string Execute(MacroModel macro, IPublishedContent currentPage) - { - throw new NotImplementedException(); - } - } - - public class MacroEngine2 : IMacroEngine - { - public string Name - { - get { return "MacroEngine2"; } - } - - public IEnumerable SupportedExtensions - { - get { return new[] { "me2" }; } - } - - public IEnumerable SupportedUIExtensions - { - get { throw new NotImplementedException(); } - } - - public bool Validate(string code, string tempFileName, IPublishedContent currentPage, out string errorMessage) - { - throw new NotImplementedException(); - } - - public string Execute(MacroModel macro, IPublishedContent currentPage) - { - throw new NotImplementedException(); - } - } - #endregion - } -} \ No newline at end of file diff --git a/src/Umbraco.Tests/Models/Mapping/AutoMapperTests.cs b/src/Umbraco.Tests/Models/Mapping/AutoMapperTests.cs index f385bf4954..8bc09292c4 100644 --- a/src/Umbraco.Tests/Models/Mapping/AutoMapperTests.cs +++ b/src/Umbraco.Tests/Models/Mapping/AutoMapperTests.cs @@ -1,10 +1,12 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; using AutoMapper; using Moq; using NUnit.Framework; using Umbraco.Core.Logging; +using Umbraco.Core.Manifest; using Umbraco.Core.PropertyEditors; using Umbraco.Tests.TestHelpers; @@ -20,14 +22,15 @@ namespace Umbraco.Tests.Models.Mapping protected override void FreezeResolution() { Func> typeListProducerList = Enumerable.Empty; - var propertyEditorResolver = new Mock( - //ctor args - Mock.Of(), - Mock.Of(), + var propertyEditorResolver = new PropertyEditorResolver( + Container, + Logger, typeListProducerList, - Umbraco.Core.CacheHelper.CreateDisabledCacheHelper().RuntimeCache); + new ManifestBuilder( + Core.CacheHelper.CreateDisabledCacheHelper().RuntimeCache, + new ManifestParser(Logger, new DirectoryInfo(TestHelper.CurrentAssemblyDirectory), Core.CacheHelper.CreateDisabledCacheHelper().RuntimeCache))); - PropertyEditorResolver.Current = propertyEditorResolver.Object; + PropertyEditorResolver.Current = propertyEditorResolver; base.FreezeResolution(); } diff --git a/src/Umbraco.Tests/TestHelpers/BaseUmbracoApplicationTest.cs b/src/Umbraco.Tests/TestHelpers/BaseUmbracoApplicationTest.cs index 73a9bd1939..e6065e780d 100644 --- a/src/Umbraco.Tests/TestHelpers/BaseUmbracoApplicationTest.cs +++ b/src/Umbraco.Tests/TestHelpers/BaseUmbracoApplicationTest.cs @@ -30,6 +30,8 @@ using umbraco.BusinessLogic; using Umbraco.Core.DependencyInjection; using Umbraco.Core.Persistence.Mappers; using Umbraco.Core.Events; +using Umbraco.Core.Models.Identity; +using Umbraco.Web.DependencyInjection; using ObjectExtensions = Umbraco.Core.ObjectExtensions; namespace Umbraco.Tests.TestHelpers @@ -97,6 +99,10 @@ namespace Umbraco.Tests.TestHelpers { var settings = SettingsForTests.GetDefault(); + //register mappers + Container.RegisterFrom(); + Container.RegisterFrom(); + Container.Register(factory => Container); Container.Register(factory => PluginManager.Current); @@ -105,7 +111,7 @@ namespace Umbraco.Tests.TestHelpers //register basic stuff that might need to be there for some container resolvers to work, we can // add more to this in base classes in resolution freezing - Container.Register(factory => Logger); + Container.RegisterSingleton(factory => Logger); Container.Register(factory => CacheHelper); Container.Register(factory => ProfilingLogger); Container.RegisterSingleton(factory => SettingsForTests.GetDefault()); @@ -157,11 +163,7 @@ namespace Umbraco.Tests.TestHelpers { Mapper.Initialize(configuration => { - var mappers = PluginManager.Current.FindAndCreateInstances( - specificAssemblies: new[] - { - typeof(ContentModelMapper).Assembly - }); + var mappers = Container.GetAllInstances(); foreach (var mapper in mappers) { mapper.ConfigureMappings(configuration, ApplicationContext); diff --git a/src/Umbraco.Tests/Umbraco.Tests.csproj b/src/Umbraco.Tests/Umbraco.Tests.csproj index 53060d1274..d079b3bb83 100644 --- a/src/Umbraco.Tests/Umbraco.Tests.csproj +++ b/src/Umbraco.Tests/Umbraco.Tests.csproj @@ -51,8 +51,8 @@ false - - ..\packages\AutoMapper.4.1.1\lib\net45\AutoMapper.dll + + ..\packages\AutoMapper.4.2.1\lib\net45\AutoMapper.dll True @@ -63,8 +63,8 @@ False ..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll - - ..\packages\LightInject.4.0.3\lib\net46\LightInject.dll + + ..\packages\LightInject.4.0.8\lib\net46\LightInject.dll True @@ -90,8 +90,8 @@ ..\packages\Moq.4.1.1309.0919\lib\net40\Moq.dll - - ..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll + + ..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll True @@ -509,7 +509,6 @@ - diff --git a/src/Umbraco.Tests/Web/Mvc/RenderModelBinderTests.cs b/src/Umbraco.Tests/Web/Mvc/RenderModelBinderTests.cs index 5ec039a4dd..e69b3e114a 100644 --- a/src/Umbraco.Tests/Web/Mvc/RenderModelBinderTests.cs +++ b/src/Umbraco.Tests/Web/Mvc/RenderModelBinderTests.cs @@ -20,18 +20,22 @@ namespace Umbraco.Tests.Web.Mvc { var binder = new RenderModelBinder(); var found = binder.GetBinder(typeof (IPublishedContent)); - Assert.IsNotNull(found); - found = binder.GetBinder(typeof(IRenderModel)); - Assert.IsNotNull(found); + Assert.IsNotNull(found); found = binder.GetBinder(typeof(RenderModel)); Assert.IsNotNull(found); found = binder.GetBinder(typeof(DynamicPublishedContent)); Assert.IsNotNull(found); found = binder.GetBinder(typeof(MyContent)); Assert.IsNotNull(found); + found = binder.GetBinder(typeof(RenderModel)); + Assert.IsNotNull(found); found = binder.GetBinder(typeof(MyOtherContent)); Assert.IsNull(found); + found = binder.GetBinder(typeof(MyCustomRenderModel)); + Assert.IsNull(found); + found = binder.GetBinder(typeof(IRenderModel)); + Assert.IsNull(found); } [Test] @@ -142,6 +146,16 @@ namespace Umbraco.Tests.Web.Mvc Assert.AreEqual(content, result); } + public class MyCustomRenderModel : RenderModel + { + public MyCustomRenderModel(IPublishedContent content, CultureInfo culture) : base(content, culture) + { + } + public MyCustomRenderModel(IPublishedContent content) : base(content) + { + } + } + public class MyOtherContent { diff --git a/src/Umbraco.Tests/media/1001/sample.txt b/src/Umbraco.Tests/media/1001/sample.txt deleted file mode 100644 index c7e057d919..0000000000 --- a/src/Umbraco.Tests/media/1001/sample.txt +++ /dev/null @@ -1 +0,0 @@ -TestContent \ No newline at end of file diff --git a/src/Umbraco.Tests/packages.config b/src/Umbraco.Tests/packages.config index ae388fe4e5..7b5780daa2 100644 --- a/src/Umbraco.Tests/packages.config +++ b/src/Umbraco.Tests/packages.config @@ -1,9 +1,9 @@  - + - + @@ -18,7 +18,7 @@ - + diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.controller.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.controller.js index 5aade0cac0..59ea03aa91 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/listview/listview.controller.js @@ -59,6 +59,25 @@ function listViewController($rootScope, $scope, $routeParams, $injector, $cookie items: [] }; + $scope.currentNodePermissions = {} + + //Just ensure we do have an editorState + if (editorState.current) { + //Fetch current node allowed actions for the current user + //This is the current node & not each individual child node in the list + var currentUserPermissions = editorState.current.allowedActions; + + //Create a nicer model rather than the funky & hard to remember permissions strings + $scope.currentNodePermissions = { + "canCopy": _.contains(currentUserPermissions, 'O'), //Magic Char = O + "canCreate": _.contains(currentUserPermissions, 'C'), //Magic Char = C + "canDelete": _.contains(currentUserPermissions, 'D'), //Magic Char = D + "canMove": _.contains(currentUserPermissions, 'M'), //Magic Char = M + "canPublish": _.contains(currentUserPermissions, 'U'), //Magic Char = U + "canUnpublish": _.contains(currentUserPermissions, 'U'), //Magic Char = Z (however UI says it can't be set, so if we can publish 'U' we can unpublish) + }; + } + //when this is null, we don't check permissions $scope.buttonPermissions = null; diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index db21bd28c3..0b89ed19a5 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -108,8 +108,8 @@ {07fbc26b-2927-4a22-8d96-d644c667fecc} UmbracoExamine - - ..\packages\AutoMapper.4.1.1\lib\net45\AutoMapper.dll + + ..\packages\AutoMapper.4.2.1\lib\net45\AutoMapper.dll True @@ -193,8 +193,8 @@ False ..\packages\MySql.Data.6.9.8\lib\net45\MySql.Data.dll - - ..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll + + ..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll True @@ -318,8 +318,8 @@ Umbraco.Web - - ..\packages\Umbraco.ModelsBuilder.3.0.1\lib\Umbraco.ModelsBuilder.dll + + ..\packages\Umbraco.ModelsBuilder.3.0.2\lib\Umbraco.ModelsBuilder.dll True @@ -436,13 +436,6 @@ ChangeDocType.aspx - - moveOrCopy.aspx - ASPXCodeBehind - - - moveOrCopy.aspx - sort.aspx ASPXCodeBehind @@ -673,14 +666,12 @@ - - @@ -692,6 +683,7 @@ + @@ -723,8 +715,6 @@ - - @@ -766,7 +756,6 @@ - @@ -833,19 +822,15 @@ - - - - @@ -990,7 +975,6 @@ - @@ -1219,7 +1203,6 @@ Form - @@ -1235,21 +1218,11 @@ Form - - - Form - - - - Form - - - @@ -1274,21 +1247,6 @@ - - - - - - - - - - - - - - - @@ -1297,18 +1255,6 @@ - - - - - - - - - - - - @@ -1366,7 +1312,7 @@ xcopy "$(ProjectDir)"..\packages\SqlServerCE.4.0.0.1\x86\*.* "$(TargetDir)x86\" True True - 7410 + 8000 / http://localhost:8000 False diff --git a/src/Umbraco.Web.UI/Umbraco/config/lang/cs.xml b/src/Umbraco.Web.UI/Umbraco/config/lang/cs.xml index 62aeb85cc0..c1e806177a 100644 --- a/src/Umbraco.Web.UI/Umbraco/config/lang/cs.xml +++ b/src/Umbraco.Web.UI/Umbraco/config/lang/cs.xml @@ -963,6 +963,7 @@ Stylopisy Šablony XSLT soubory + Typy Uživatelů Nová aktualizace je připrvena diff --git a/src/Umbraco.Web.UI/Umbraco/config/lang/nb.xml b/src/Umbraco.Web.UI/Umbraco/config/lang/nb.xml index a02fa21219..0d527fe4d8 100644 --- a/src/Umbraco.Web.UI/Umbraco/config/lang/nb.xml +++ b/src/Umbraco.Web.UI/Umbraco/config/lang/nb.xml @@ -928,6 +928,7 @@ Vennlig hilsen Umbraco roboten Maler XSLT Filer Analytics + Brukertyper typer Ny oppdatering er klar diff --git a/src/Umbraco.Web.UI/config/trees.Release.config b/src/Umbraco.Web.UI/config/trees.Release.config index 45559086e3..11ac8ff7ba 100644 --- a/src/Umbraco.Web.UI/config/trees.Release.config +++ b/src/Umbraco.Web.UI/config/trees.Release.config @@ -11,16 +11,16 @@ - + - + - + - + + - @@ -39,6 +39,7 @@ + diff --git a/src/Umbraco.Web.UI/config/trees.config b/src/Umbraco.Web.UI/config/trees.config index 4093d87479..f38c998c2e 100644 --- a/src/Umbraco.Web.UI/config/trees.config +++ b/src/Umbraco.Web.UI/config/trees.config @@ -6,18 +6,17 @@ - + - + - - + + - @@ -26,13 +25,14 @@ - + + diff --git a/src/Umbraco.Web.UI/packages.config b/src/Umbraco.Web.UI/packages.config index 3b9519d1d7..43d9348b81 100644 --- a/src/Umbraco.Web.UI/packages.config +++ b/src/Umbraco.Web.UI/packages.config @@ -1,6 +1,6 @@  - + @@ -28,12 +28,12 @@ - + - + \ No newline at end of file diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/da.xml b/src/Umbraco.Web.UI/umbraco/config/lang/da.xml index 446796dd88..aad5e0d69b 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/da.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/da.xml @@ -986,7 +986,6 @@ Mange hilsner fra Umbraco robotten Medlemstype Dokumenttyper Dokumenttyper - Pakker Pakker Python @@ -999,6 +998,7 @@ Mange hilsner fra Umbraco robotten Skabeloner XSLT-filer Analytics + Bruger Typer Ny opdatering er klar diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/de.xml b/src/Umbraco.Web.UI/umbraco/config/lang/de.xml index 1dab89a922..158bb06287 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/de.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/de.xml @@ -946,6 +946,7 @@ Ihr freundlicher Umbraco-Robot Vorlagen XSLT-Dateien Auswertungen + Benutzertypen Neues Update verfügbar diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/en.xml b/src/Umbraco.Web.UI/umbraco/config/lang/en.xml index 0842755da3..f6d092ba31 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/en.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/en.xml @@ -1188,6 +1188,7 @@ To manage your website, simply open the Umbraco back office and start adding con Templates XSLT Files Analytics + User Types New update ready diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml b/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml index ce25e990c8..f89eb06b94 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml @@ -1192,6 +1192,7 @@ To manage your website, simply open the Umbraco back office and start adding con Templates XSLT Files Analytics + User Types New update ready diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/es.xml b/src/Umbraco.Web.UI/umbraco/config/lang/es.xml index c1478abbb1..ef67c6e6d4 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/es.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/es.xml @@ -850,6 +850,7 @@ Hojas de estilo Plantillas Archivos XSLT + Tipos de Usuarios Existe una nueva actualización diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/fr.xml b/src/Umbraco.Web.UI/umbraco/config/lang/fr.xml index a7b219618e..4045056567 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/fr.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/fr.xml @@ -839,43 +839,43 @@ Pour gérer votre site, ouvrez simplement le backoffice Umbraco et commencez à Modèle - Choose type of content - Choose a layout - Add a row - Add content - Drop content - Settings applied + Choisissez le type de contenu + Choisissez une mise en page + Ajouter une ligne + Ajouter du contenu + Contenu goutte + Paramètres appliqués - This content is not allowed here - This content is allowed here + Ce contenu est pas autorisée ici + Ce contenu est permis ici - Click to embed - Click to insert image - Image caption... - Write here... + Cliquez pour intégrer + Cliquez pour insérer l'image + Légende de l'image... + Ecrire ici... - Grid Layouts - Layouts are the overall work area for the grid editor, usually you only need one or two different layouts - Add Grid Layout - Adjust the layout by setting column widths and adding additional sections - Row configurations - Rows are predefined cells arranged horizontally - Add row configuration - Adjust the row by setting cell widths and adding additional cells + Layouts Grid + Layouts sont la superficie totale de travail pour l'éditeur de grille, en général, vous avez seulement besoin d'une ou deux configurations différentes + Ajouter Grid Layout + Ajustez la mise en page en définissant la largeur des colonnes et ajouter des sections supplémentaires + Configurations des lignes + Les lignes sont des cellules prédéfinies disposées horizontalement + Ajouter une configuration de la ligne + Ajustez la ligne en réglant la largeur des cellules et en ajoutant des cellules supplémentaires - Columns - Total combined number of columns in the grid layout + Colonnes + Nombre total combiné de colonnes dans la configuration de la grille - Settings - Configure what settings editors can change + Paramètres + Configurer quels paramètres éditeurs peuvent changer - Styles - Configure what styling editors can change + Modes + Configurer ce style éditeurs peuvent changer - Settings will only save if the entered json configuration is valid + Les réglages seulement économiser si la configuration du json saisi est valide - Allow all editors - Allow all row configurations + Autoriser tous les éditeurs + Autoriser toutes les configurations de lignes Champ alternatif @@ -984,6 +984,7 @@ Pour gérer votre site, ouvrez simplement le backoffice Umbraco et commencez à Feuilles de style Modèles Fichiers XSLT + Types d'utilisateurs Nouvelle mise à jour prête diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/he.xml b/src/Umbraco.Web.UI/umbraco/config/lang/he.xml index 4b006e8524..8722008a2e 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/he.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/he.xml @@ -869,6 +869,7 @@ To manage your website, simply open the Umbraco back office and start adding con גיליונות סגנון תבניות קבצי XSLT + משתמש מקליד עידכון חדש זמין diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/it.xml b/src/Umbraco.Web.UI/umbraco/config/lang/it.xml index d07d0cb049..f4475cb23c 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/it.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/it.xml @@ -842,6 +842,7 @@ Per gestire il tuo sito web, è sufficiente aprire il back office di Umbraco e i Fogli di stile Templates Files XSLT + Tipi di Utente diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/ja.xml b/src/Umbraco.Web.UI/umbraco/config/lang/ja.xml index a59a020455..b92f17a57e 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/ja.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/ja.xml @@ -1172,6 +1172,7 @@ Runwayをインストールして作られた新しいウェブサイトがど テンプレート XSLT ファイル アナリティクス + ユーザータイプ 新しい更新があります diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/ko.xml b/src/Umbraco.Web.UI/umbraco/config/lang/ko.xml index ee8db9901c..9743954202 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/ko.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/ko.xml @@ -846,6 +846,7 @@ 스타일시트 템플릿 XSLT 파일 + 사용자 유형 새 업데이트가 준비되었습니다. diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/nl.xml b/src/Umbraco.Web.UI/umbraco/config/lang/nl.xml index 9c8f587ca2..9cf8e76337 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/nl.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/nl.xml @@ -951,6 +951,7 @@ Om een vertalingstaak te sluiten, ga aub naar het detailoverzicht en klik op de Stylesheets Sjablonen XSLT Bestanden + Gebruiker Types Nieuwe update beschikbaar diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/pl.xml b/src/Umbraco.Web.UI/umbraco/config/lang/pl.xml index 3c24885eb3..132f5ee65e 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/pl.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/pl.xml @@ -742,6 +742,7 @@ Miłego dnia!]]> Arkusze stylów Szablony Pliki XSLT + Typy Użytkowników Aktualizacja jest gotowa diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/pt.xml b/src/Umbraco.Web.UI/umbraco/config/lang/pt.xml index 4c039524ab..9cf9181c80 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/pt.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/pt.xml @@ -830,6 +830,7 @@ Para fechar a tarefa de tradução vá até os detalhes e clique no botão "Fech Stylesheets Modelos Arquivos XSLT + Tipos de Usuários Nova atualização pronta diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/ru.xml b/src/Umbraco.Web.UI/umbraco/config/lang/ru.xml index fec3e5f897..5075fd8eb9 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/ru.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/ru.xml @@ -1161,6 +1161,7 @@ Стили CSS Шаблоны Файлы XSLT + Типы пользователей Доступны обновления diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/sv.xml b/src/Umbraco.Web.UI/umbraco/config/lang/sv.xml index b620ecc168..3c7947ccee 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/sv.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/sv.xml @@ -851,6 +851,7 @@ Stilmallar Sidmallar XSLT-filer + Användartyper Ny uppdatering tillgänglig diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/zh.xml b/src/Umbraco.Web.UI/umbraco/config/lang/zh.xml index 6237bb4f07..9ced516644 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/zh.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/zh.xml @@ -920,6 +920,7 @@ 样式表 模板 XSLT文件 + 用户类型 有可用更新 diff --git a/src/Umbraco.Web.UI/umbraco/controls/Tree/TreeControl.ascx b/src/Umbraco.Web.UI/umbraco/controls/Tree/TreeControl.ascx index 8eaf286986..174b7c7d13 100644 --- a/src/Umbraco.Web.UI/umbraco/controls/Tree/TreeControl.ascx +++ b/src/Umbraco.Web.UI/umbraco/controls/Tree/TreeControl.ascx @@ -2,7 +2,6 @@ <%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %> <%@ Register TagPrefix="umbClient" Namespace="Umbraco.Web.UI.Bundles" Assembly="umbraco" %> - diff --git a/src/Umbraco.Web.UI/umbraco/dialogs/AssignDomain.aspx b/src/Umbraco.Web.UI/umbraco/dialogs/AssignDomain.aspx deleted file mode 100644 index 13bf9ddc13..0000000000 --- a/src/Umbraco.Web.UI/umbraco/dialogs/AssignDomain.aspx +++ /dev/null @@ -1,47 +0,0 @@ -<%@ Page Language="c#" MasterPageFile="../masterpages/umbracoDialog.Master" AutoEventWireup="True" Inherits="umbraco.dialogs.AssignDomain" %> -<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %> - - - - - - - - - - - - - - - - -
<%= Services.TextService.Localize("assignDomain/domainHelp") %> -
- - - - - - - - - -
- - - - - - - -

- <%= Services.TextService.Localize("defaultdialogs/closeThisWindow")%> -

-
\ No newline at end of file diff --git a/src/Umbraco.Web.UI/umbraco/dialogs/MoveOrCopy.aspx.cs b/src/Umbraco.Web.UI/umbraco/dialogs/MoveOrCopy.aspx.cs deleted file mode 100644 index 888bac63af..0000000000 --- a/src/Umbraco.Web.UI/umbraco/dialogs/MoveOrCopy.aspx.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; - -namespace Umbraco.Web.UI.Umbraco.Dialogs -{ - public partial class MoveOrCopy : global::umbraco.dialogs.moveOrCopy - { - } -} \ No newline at end of file diff --git a/src/Umbraco.Web.UI/umbraco/dialogs/MoveOrCopy.aspx.designer.cs b/src/Umbraco.Web.UI/umbraco/dialogs/MoveOrCopy.aspx.designer.cs deleted file mode 100644 index 328688dfa3..0000000000 --- a/src/Umbraco.Web.UI/umbraco/dialogs/MoveOrCopy.aspx.designer.cs +++ /dev/null @@ -1,15 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Umbraco.Web.UI.Umbraco.Dialogs { - - - public partial class MoveOrCopy { - } -} diff --git a/src/Umbraco.Web.UI/umbraco/dialogs/RegexWs.aspx b/src/Umbraco.Web.UI/umbraco/dialogs/RegexWs.aspx deleted file mode 100644 index a984a97baa..0000000000 --- a/src/Umbraco.Web.UI/umbraco/dialogs/RegexWs.aspx +++ /dev/null @@ -1,57 +0,0 @@ -<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="../masterpages/umbracoDialog.Master" CodeBehind="RegexWs.aspx.cs" Inherits="umbraco.presentation.dialogs.RegexWs" %> -<%@ Import Namespace="Umbraco.Web" %> -<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %> -<%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %> - - - - - - - -

- <%= Services.TextService.Localize("defaultdialogs/regexSearchHelp")%> -

-
- - - -
- - -
-

-

- -

-

-

-

-
-
-
-
-
-
-
- - -
- - - - - - - \ No newline at end of file diff --git a/src/Umbraco.Web.UI/umbraco/dialogs/emptyTrashcan.aspx b/src/Umbraco.Web.UI/umbraco/dialogs/emptyTrashcan.aspx deleted file mode 100644 index 31451e7a25..0000000000 --- a/src/Umbraco.Web.UI/umbraco/dialogs/emptyTrashcan.aspx +++ /dev/null @@ -1,83 +0,0 @@ -<%@ Page Language="C#" MasterPageFile="../masterpages/umbracoDialog.Master" AutoEventWireup="true" Inherits="umbraco.presentation.dialogs.emptyTrashcan" %> -<%@ Import Namespace="System.Globalization" %> -<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %> - - - - - - - - - - -
- - - - - - - -
-

<%= Services.TextService.Localize("defaultdialogs/recycleBinWarning")%>

- -
-
-
- -
-
- " class="guiInputButton" onclick="if ($get('confirmDelete').checked) {emptyRecycleBin();}" disabled="true" /> - <%= Services.TextService.Localize("or") %> - - <%=Services.TextService.Localize("cancel")%> - -
-
-
\ No newline at end of file diff --git a/src/Umbraco.Web.UI/umbraco/dialogs/moveOrCopy.aspx b/src/Umbraco.Web.UI/umbraco/dialogs/moveOrCopy.aspx deleted file mode 100644 index 24d91a8b08..0000000000 --- a/src/Umbraco.Web.UI/umbraco/dialogs/moveOrCopy.aspx +++ /dev/null @@ -1,92 +0,0 @@ -<%@ Page Language="c#" CodeBehind="moveOrCopy.aspx.cs" MasterPageFile="../masterpages/umbracoDialog.Master" AutoEventWireup="True" Inherits="Umbraco.Web.UI.Umbraco.Dialogs.MoveOrCopy" %> -<%@ Register TagPrefix="umb" Namespace="ClientDependency.Core.Controls" Assembly="ClientDependency.Core" %> -<%@ Import Namespace="Umbraco.Web" %> -<%@ Register TagPrefix="cc1" Namespace="umbraco.uicontrols" Assembly="controls" %> -<%@ Register Src="../controls/Tree/TreeControl.ascx" TagName="TreeControl" TagPrefix="umbraco" %> - - - - - - - - - - - - - - - - - - - - - - - -
-

- <%= Services.TextService.Localize("moveOrCopy/noNodeSelected") %>

-
-
- - - - - - * - - - -

- -   - <%=Services.TextService.Localize("general/or")%>   - <%=Services.TextService.Localize("general/cancel")%> -

-
-
diff --git a/src/Umbraco.Web.UI/umbraco/dialogs/protectPage.aspx b/src/Umbraco.Web.UI/umbraco/dialogs/protectPage.aspx index ce0241ede3..1a2325b894 100644 --- a/src/Umbraco.Web.UI/umbraco/dialogs/protectPage.aspx +++ b/src/Umbraco.Web.UI/umbraco/dialogs/protectPage.aspx @@ -5,11 +5,11 @@ - - - - \ No newline at end of file diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/RegexWs.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/RegexWs.aspx.cs deleted file mode 100644 index f3e3b5c9ef..0000000000 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/RegexWs.aspx.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System; -using System.Data; -using System.Web.UI.WebControls; -using Umbraco.Core; -using Umbraco.Core.Services; - -namespace umbraco.presentation.dialogs { - public partial class RegexWs : Umbraco.Web.UI.Pages.UmbracoEnsuredPage { - private DataSet ds = new DataSet(); - - public RegexWs() - { - CurrentApp = Constants.Applications.Settings.ToString(); - - } - - protected void Page_Load(object sender, EventArgs e) { - pp_search.Text = Services.TextService.Localize("general/search"); - bt_search.Text = Services.TextService.Localize("general/search"); - } - - protected void findRegex(object sender, EventArgs e) { - regexPanel.Visible = true; - - try { - - ds.Tables.Clear(); - - webservices.RegexComWebservice regexLib = new global::umbraco.presentation.webservices.RegexComWebservice(); - ds = regexLib.listRegExp(searchField.Text, "", 0, 10); - - results.DataSource = ds; - results.DataBind(); - - regexLib.Dispose(); - ds.Clear(); - ds.Dispose(); - } catch{ - Literal err = new Literal(); - err.Text = "

" + Services.TextService.Localize("defaultdialogs/regexSearchError") + "

"; - regexPanel.Controls.Clear(); - regexPanel.Controls.Add(err); - } - } - - protected void onRegexBind(object sender, RepeaterItemEventArgs e) { - if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { - DataRowView drw = (DataRowView)e.Item.DataItem; - - Literal _header = (Literal)e.Item.FindControl("header"); - Literal _desc = (Literal)e.Item.FindControl("desc"); - Literal _regex = (Literal)e.Item.FindControl("regex"); - - _header.Text = "" + drw["Title"].ToString() + ""; - _desc.Text = drw["description"].ToString(); - _regex.Text = drw["expression"].ToString().Trim(); - - } - } - - } -} diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/RegexWs.aspx.designer.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/RegexWs.aspx.designer.cs deleted file mode 100644 index 8a3748704b..0000000000 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/RegexWs.aspx.designer.cs +++ /dev/null @@ -1,79 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:2.0.50727.4200 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace umbraco.presentation.dialogs { - - - public partial class RegexWs { - - /// - /// JsInclude1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::ClientDependency.Core.Controls.JsInclude JsInclude1; - - /// - /// pane1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::umbraco.uicontrols.Pane pane1; - - /// - /// pp_search control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::umbraco.uicontrols.PropertyPanel pp_search; - - /// - /// searchField control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.TextBox searchField; - - /// - /// bt_search control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button bt_search; - - /// - /// regexPanel control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel regexPanel; - - /// - /// results control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Repeater results; - } -} diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/create.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/create.aspx.cs index b0aa4b4ad7..112e1fb378 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/create.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/create.aspx.cs @@ -83,8 +83,7 @@ namespace umbraco.dialogs protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); - - ScriptManager.GetCurrent(Page).Services.Add(new ServiceReference(IOHelper.ResolveUrl(SystemDirectories.WebServices) + "/cmsnode.asmx")); + ScriptManager.GetCurrent(Page).Services.Add(new ServiceReference(IOHelper.ResolveUrl(SystemDirectories.WebServices) + "/legacyAjaxCalls.asmx")); } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/emptyTrashcan.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/emptyTrashcan.aspx.cs deleted file mode 100644 index af547e2a86..0000000000 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/emptyTrashcan.aspx.cs +++ /dev/null @@ -1,66 +0,0 @@ -using System; -using System.Web.UI; -using Umbraco.Core; -using Umbraco.Web; -using umbraco.cms.businesslogic; -using Umbraco.Web.UI.Pages; - -namespace umbraco.presentation.dialogs -{ - public partial class emptyTrashcan : UmbracoEnsuredPage - { - private RecycleBin.RecycleBinType? _binType; - protected RecycleBin.RecycleBinType BinType - { - get - { - if (_binType == null) - { - _binType = Enum.Parse(Request.GetItemAsString("type"), true); - } - return _binType.Value; - } - } - - protected override void OnInit(EventArgs e) - { - base.OnInit(e); - - var recycleBinType = Request.GetItemAsString("type"); - if (Security.ValidateUserApp(recycleBinType) == false) - { - throw new InvalidOperationException("The user does not have access to the requested app"); - } - } - - protected void Page_Load(object sender, EventArgs e) - { - } - - protected override void OnPreRender(EventArgs e) - { - base.OnPreRender(e); - - ScriptManager.GetCurrent(Page).Services.Add(new ServiceReference("../webservices/trashcan.asmx")); - ScriptManager.GetCurrent(Page).Services.Add(new ServiceReference("../webservices/legacyAjaxCalls.asmx")); - } - - /// - /// pane_form control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::umbraco.uicontrols.Pane pane_form; - - /// - /// progbar control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::umbraco.uicontrols.ProgressBar progbar; - } -} \ No newline at end of file diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/moveOrCopy.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/moveOrCopy.aspx.cs deleted file mode 100644 index 9de531ed25..0000000000 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/moveOrCopy.aspx.cs +++ /dev/null @@ -1,443 +0,0 @@ -using System; -using System.Globalization; -using System.Web.UI; -using System.Web.UI.WebControls; -using Umbraco.Core; -using Umbraco.Core.IO; -using Umbraco.Core.Models; -using System.Linq; -using umbraco.cms.presentation.user; -using Umbraco.Web; -using Umbraco.Web.UI.Pages; -using Action = Umbraco.Web._Legacy.Actions.Action; -using Umbraco.Core.Services; -using Umbraco.Web._Legacy.Actions; - -namespace umbraco.dialogs -{ - /// - /// Summary description for moveOrCopy. - /// - public partial class moveOrCopy : UmbracoEnsuredPage - { - - protected override void OnInit(EventArgs e) - { - CurrentApp = Request["app"]; - - base.OnInit(e); - } - - protected void Page_Load(object sender, EventArgs e) - { - JTree.DataBind(); - - // Put user code to initialize the page here - if (IsPostBack == false) - { - pp_relate.Text = Services.TextService.Localize("moveOrCopy/relateToOriginal"); - - //Document Type copy Hack... - - if (CurrentApp == Constants.Applications.Settings) - { - pane_form.Visible = false; - pane_form_notice.Visible = false; - pane_settings.Visible = true; - - ok.Text = Services.TextService.Localize("general/ok"); - ok.Attributes.Add("style", "width: 60px"); - - var documentType = Services.ContentTypeService.GetContentType(int.Parse(Request.GetItemAsString("id"))); - - //Load master types... - masterType.Attributes.Add("style", "width: 350px;"); - masterType.Items.Add(new ListItem(Services.TextService.Localize("none") + "...", "0")); - - foreach (var docT in Services.ContentTypeService.GetAllContentTypes().OrderBy(x => x.Name)) - { - masterType.Items.Add(new ListItem(docT.Name, docT.Id.ToString(CultureInfo.InvariantCulture))); - } - - masterType.SelectedValue = (documentType.ParentId > 0 ? documentType.ParentId : 0).ToString(CultureInfo.InvariantCulture); - - rename.Text = documentType.Name + " (copy)"; - pane_settings.Text = "Make a copy of the document type '" + documentType.Name + "' and save it under a new name"; - - } - else - { - pane_form.Visible = true; - pane_form_notice.Visible = true; - - pane_settings.Visible = false; - - // Caption and properies on BUTTON - ok.Text = Services.TextService.Localize("general/ok"); - ok.Attributes.Add("style", "width: 60px"); - ok.Attributes.Add("disabled", "true"); - - IContentBase currContent; - if (CurrentApp == "content") - { - currContent = Services.ContentService.GetById(Request.GetItemAs("id")); - } - else - { - currContent = Services.MediaService.GetById(Request.GetItemAs("id")); - } - - // Preselect the parent of the seslected item. - if (currContent.ParentId > 0) - JTree.SelectedNodePath = currContent.Path.Substring(0, currContent.Path.LastIndexOf(',')); - - var validAction = true; - if (CurrentApp == Constants.Applications.Content && Umbraco.Core.Models.ContentExtensions.HasChildren(currContent, Services)) - { - validAction = ValidAction(currContent, Request.GetItemAsString("mode") == "cut" ? 'M' : 'O'); - } - - if (Request.GetItemAsString("mode") == "cut") - { - pane_form.Text = Services.TextService.Localize("moveOrCopy/moveTo", new[] { currContent.Name }); - pp_relate.Visible = false; - } - else - { - pane_form.Text = Services.TextService.Localize("moveOrCopy/copyTo", new[] { currContent.Name }); - pp_relate.Visible = true; - } - - if (validAction == false) - { - panel_buttons.Visible = false; - ScriptManager.RegisterStartupScript(this, GetType(), "notvalid", "notValid();", true); - } - } - } - - } - - private bool ValidAction(IContentBase cmsNode, char actionLetter) - { - var currentAction = Action.GetPermissionAssignable().First(a => a.Letter == actionLetter); - return CheckPermissions(cmsNode, currentAction); - } - - /// - /// Checks if the current user has permissions to execute this action against this node - /// - /// - /// - /// - /// - /// This used to do a recursive check for all descendent nodes but this is not required and is a massive CPU hog. - /// See: http://issues.umbraco.org/issue/U4-2632, https://groups.google.com/forum/?fromgroups=#!topic/umbraco-dev/L1D4LwVSP2Y - /// - private bool CheckPermissions(IContentBase node, IAction currentAction) - { - var currUserPermissions = new UserPermissions(Security.CurrentUser); - var lstCurrUserActions = currUserPermissions.GetExistingNodePermission(node.Id); - - return lstCurrUserActions.Contains(currentAction); - } - - private void HandleDocumentTypeCopy() - { - var contentTypeService = ApplicationContext.Current.Services.ContentTypeService; - var contentType = contentTypeService.GetContentType( - int.Parse(Request.GetItemAsString("id"))); - - //set the master - //http://issues.umbraco.org/issue/U4-2843 - //http://issues.umbraco.org/issue/U4-3552 - var parentId = int.Parse(masterType.SelectedValue); - - var alias = rename.Text.Trim().Replace("'", "''"); - var clone = contentTypeService.Copy(contentType, alias, rename.Text.Trim(), parentId); - - var returnUrl = string.Format("{0}/settings/editNodeTypeNew.aspx?id={1}", SystemDirectories.Umbraco, clone.Id); - - pane_settings.Visible = false; - panel_buttons.Visible = false; - - feedback.Text = "Document type copied"; - feedback.type = uicontrols.Feedback.feedbacktype.success; - - ClientTools.ChangeContentFrameUrl(returnUrl); - } - - public void HandleMoveOrCopy(object sender, EventArgs e) - { - if (CurrentApp == Constants.Applications.Settings) - HandleDocumentTypeCopy(); - else - HandleDocumentMoveOrCopy(); - } - - protected override void OnPreRender(EventArgs e) - { - base.OnPreRender(e); - ScriptManager.GetCurrent(Page).Services.Add(new ServiceReference("../webservices/cmsnode.asmx")); - ScriptManager.GetCurrent(Page).Services.Add(new ServiceReference("../webservices/legacyAjaxCalls.asmx")); - } - - private void HandleDocumentMoveOrCopy() - { - if (Request.GetItemAsString("copyTo") != "" && Request.GetItemAsString("id") != "") - { - // Check if the current node is allowed at new position - var nodeAllowed = false; - - IContentBase currContent; - IContentBase parentContent = null; - IContentTypeBase parentContentType = null; - if (CurrentApp == "content") - { - currContent = Services.ContentService.GetById(Request.GetItemAs("id")); - if (Request.GetItemAs("copyTo") != -1) - { - parentContent = Services.ContentService.GetById(Request.GetItemAs("copyTo")); - if (parentContent != null) - { - parentContentType = Services.ContentTypeService.GetContentType(parentContent.ContentTypeId); - } - } - } - else - { - currContent = Services.MediaService.GetById(Request.GetItemAs("id")); - if (Request.GetItemAs("copyTo") != -1) - { - parentContent = Services.MediaService.GetById(Request.GetItemAs("copyTo")); - if (parentContent != null) - { - parentContentType = Services.ContentTypeService.GetMediaType(parentContent.ContentTypeId); - } - } - } - - // Check on contenttypes - if (parentContentType == null) - { - //check if this is allowed at root - IContentTypeBase currContentType; - if (CurrentApp == "content") - { - currContentType = Services.ContentTypeService.GetContentType(currContent.ContentTypeId); - } - else - { - currContentType = Services.ContentTypeService.GetMediaType(currContent.ContentTypeId); - } - nodeAllowed = currContentType.AllowedAsRoot; - if (!nodeAllowed) - { - feedback.Text = Services.TextService.Localize("moveOrCopy/notAllowedAtRoot"); - feedback.type = uicontrols.Feedback.feedbacktype.error; - } - } - else - { - var allowedChildContentTypeIds = parentContentType.AllowedContentTypes.Select(x => x.Id).ToArray(); - if (allowedChildContentTypeIds.Any(x => x.Value == currContent.ContentTypeId)) - { - nodeAllowed = true; - } - - if (nodeAllowed == false) - { - feedback.Text = Services.TextService.Localize("moveOrCopy/notAllowedByContentType"); - feedback.type = uicontrols.Feedback.feedbacktype.error; - } - else - { - // Check on paths - if ((string.Format(",{0},", parentContent.Path)).IndexOf(string.Format(",{0},", currContent.Id)) > -1) - { - nodeAllowed = false; - feedback.Text = Services.TextService.Localize("moveOrCopy/notAllowedByPath"); - feedback.type = uicontrols.Feedback.feedbacktype.error; - } - } - } - - if (nodeAllowed) - { - pane_form.Visible = false; - pane_form_notice.Visible = false; - panel_buttons.Visible = false; - - var newNodeCaption = parentContent == null - ? Services.TextService.Localize(CurrentApp) - : parentContent.Name; - - string[] nodes = { currContent.Name, newNodeCaption }; - - if (Request["mode"] == "cut") - { - if (CurrentApp == Constants.Applications.Content) - { - var doc = (IContent)currContent; - var copyToId = Request.GetItemAs("copyTo"); - Services.ContentService.Move(doc, copyToId, Security.CurrentUser.Id); - - } - else - { - var media = (IMedia)currContent; - var copyToId = Request.GetItemAs("copyTo"); - Services.MediaService.Move(media, copyToId, Security.CurrentUser.Id); - } - - feedback.Text = Services.TextService.Localize("moveOrCopy/moveDone", nodes) + "

" + Services.TextService.Localize("closeThisWindow") + ""; - feedback.type = uicontrols.Feedback.feedbacktype.success; - - // refresh tree - ClientTools.MoveNode(currContent.Id.ToString(), currContent.Path); - } - else - { - //NOTE: We ONLY support Copy on content not media for some reason. - - var newContent = (IContent)currContent; - Services.ContentService.Copy(newContent, Request.GetItemAs("copyTo"), RelateDocuments.Checked, Security.CurrentUser.Id); - - feedback.Text = Services.TextService.Localize("moveOrCopy/copyDone", nodes) + "

" + Services.TextService.Localize("closeThisWindow") + ""; - feedback.type = uicontrols.Feedback.feedbacktype.success; - - // refresh tree - ClientTools.CopyNode(currContent.Id.ToString(), newContent.Path); - } - } - } - } - - ///

- /// JsInclude1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::ClientDependency.Core.Controls.JsInclude JsInclude1; - - /// - /// feedback control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::umbraco.uicontrols.Feedback feedback; - - /// - /// pane_form control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::umbraco.uicontrols.Pane pane_form; - - /// - /// JTree control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::umbraco.controls.Tree.TreeControl JTree; - - /// - /// pp_relate control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::umbraco.uicontrols.PropertyPanel pp_relate; - - /// - /// RelateDocuments control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.CheckBox RelateDocuments; - - /// - /// pane_form_notice control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.PlaceHolder pane_form_notice; - - /// - /// pane_settings control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::umbraco.uicontrols.Pane pane_settings; - - /// - /// PropertyPanel1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::umbraco.uicontrols.PropertyPanel PropertyPanel1; - - /// - /// masterType control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.ListBox masterType; - - /// - /// rename control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.TextBox rename; - - /// - /// RequiredFieldValidator1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1; - - /// - /// panel_buttons control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Panel panel_buttons; - - /// - /// ok control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.WebControls.Button ok; - - } -} diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/notifications.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/notifications.aspx.cs index 48420d34ee..0b5bebc114 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/notifications.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/notifications.aspx.cs @@ -2,16 +2,12 @@ using Umbraco.Core.Services; using System; using System.Collections; using System.Linq; -using System.Web.UI; -using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; -using umbraco.cms.businesslogic; -using umbraco.cms.businesslogic.workflow; using Umbraco.Core; +using Umbraco.Core.Models.EntityBase; using Umbraco.Web; using Umbraco.Web.UI.Pages; using Umbraco.Web._Legacy.Actions; -using Action = Umbraco.Web._Legacy.Actions.Action; namespace umbraco.dialogs { @@ -21,7 +17,7 @@ namespace umbraco.dialogs public partial class notifications : UmbracoEnsuredPage { private ArrayList actions = new ArrayList(); - private CMSNode node; + private IUmbracoEntity node; public notifications() { @@ -32,7 +28,7 @@ namespace umbraco.dialogs protected void Page_Load(object sender, EventArgs e) { Button1.Text = Services.TextService.Localize("update"); - pane_form.Text = Services.TextService.Localize("notifications/editNotifications", new[] { node.Text}); + pane_form.Text = Services.TextService.Localize("notifications/editNotifications", new[] { node.Name}); } #region Web Form Designer generated code @@ -45,7 +41,7 @@ namespace umbraco.dialogs InitializeComponent(); base.OnInit(e); - node = new cms.businesslogic.CMSNode(int.Parse(Request.GetItemAsString("id"))); + node = Services.EntityService.Get(int.Parse(Request.GetItemAsString("id"))); var actionList = ActionsResolver.Current.Actions; @@ -96,7 +92,8 @@ namespace umbraco.dialogs if (c.Checked) notifications += c.ID; } - Notification.UpdateNotifications(Security.CurrentUser, node, notifications); + + ApplicationContext.Current.Services.NotificationService.SetNotifications(Security.CurrentUser, node, notifications.ToCharArray().Select(x => x.ToString()).ToArray()); var feedback = new umbraco.uicontrols.Feedback(); feedback.Text = Services.TextService.Localize("notifications") + " " + Services.TextService.Localize("ok") + "

" + Services.TextService.Localize("closeThisWindow") + ""; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/viewAuditTrail.aspx b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/viewAuditTrail.aspx index ba28342018..0eecffa2ff 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/viewAuditTrail.aspx +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/viewAuditTrail.aspx @@ -9,7 +9,6 @@ .gridItem{border-color: #D9D7D7;} - diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/viewAuditTrail.aspx.designer.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/viewAuditTrail.aspx.designer.cs index 0a1d0f54a4..986351af0d 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/viewAuditTrail.aspx.designer.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/viewAuditTrail.aspx.designer.cs @@ -12,15 +12,6 @@ namespace umbraco.presentation.umbraco.dialogs { public partial class viewAuditTrail { - ///

- /// CssInclude3 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::ClientDependency.Core.Controls.CssInclude CssInclude3; - /// /// auditLog control. /// diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/publishStatus.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/publishStatus.aspx.cs deleted file mode 100644 index 26cdd17453..0000000000 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/publishStatus.aspx.cs +++ /dev/null @@ -1,78 +0,0 @@ -using System; -using System.Collections; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Web; -using System.Web.SessionState; -using System.Web.UI; -using System.Web.UI.WebControls; -using System.Web.UI.HtmlControls; -using Umbraco.Core; - -namespace umbraco.cms.presentation -{ - /// - /// Summary description for publishStatus. - /// - [Obsolete("This class is no longer used and will be removed from the codebase in future versions")] - public partial class publishStatus : Umbraco.Web.UI.Pages.UmbracoEnsuredPage - { - public publishStatus() - { - CurrentApp = Constants.Applications.Content.ToString(); - - } - - protected void Page_Load(object sender, System.EventArgs e) - { - // Put user code to initialize the page here - int totalNodes = cms.businesslogic.CMSNode.CountByObjectType(cms.businesslogic.web.Document._objectType); - if (library.IsPublishing) - { - Panel1.Controls.Add(new LiteralControl("Der er nu publiseret " + library.NodesPublished.ToString() + " ud af " + totalNodes.ToString() + " noder...")); - ClientTools.RefreshAdmin(2); - } - else - Panel1.Controls.Add(new LiteralControl("Færdig. Der er ialt publiseret " + library.NodesPublished.ToString() + " noder og det tog " + ((long)((System.DateTime.Now.Ticks - library.PublishStart.Ticks) / 10000000)).ToString() + " sekunder...")); - } - - #region Web Form Designer generated code - override protected void OnInit(EventArgs e) - { - // - // CODEGEN: This call is required by the ASP.NET Web Form Designer. - // - InitializeComponent(); - base.OnInit(e); - } - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - - } - #endregion - - /// - /// Form1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::System.Web.UI.HtmlControls.HtmlForm Form1; - - /// - /// Panel1 control. - /// - /// - /// Auto-generated field. - /// To modify move field declaration from designer file to code-behind file. - /// - protected global::umbraco.uicontrols.UmbracoPanel Panel1; - } -} diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUser.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUser.aspx.cs index 3a73db386f..bbae68379c 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUser.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUser.aspx.cs @@ -274,15 +274,7 @@ namespace umbraco.cms.presentation.user lapps.RepeatDirection = RepeatDirection.Vertical; } - protected override void OnPreRender(EventArgs e) - { - base.OnPreRender(e); - - ScriptManager.GetCurrent(Page).Services.Add(new ServiceReference("../webservices/CMSNode.asmx")); - // ScriptManager.GetCurrent(Page).Services.Add(new ServiceReference("../webservices/legacyAjaxCalls.asmx")); - - } - + /// /// This handles changing the password /// diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUserType.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUserType.aspx.cs index 24153c0270..740c6d2b3c 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUserType.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUserType.aspx.cs @@ -41,15 +41,14 @@ namespace umbraco.cms.presentation.user if (!int.TryParse(Request.QueryString["id"], out m_userTypeID)) return; - if (!IsPostBack) - { - BindActions(); - - ClientTools - .SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree().Tree.Alias) - .SyncTree(m_userTypeID.ToString(), false); - } + if (!IsPostBack) + { + BindActions(); + ClientTools + .SetActiveTreeType(Constants.Trees.UserTypes) + .SyncTree(m_userTypeID.ToString(), false); + } } void save_Click(object sender, EventArgs e) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/CMSNode.asmx b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/CMSNode.asmx deleted file mode 100644 index 2f46849377..0000000000 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/CMSNode.asmx +++ /dev/null @@ -1 +0,0 @@ -<%@ WebService Language="C#" CodeBehind="CMSNode.asmx.cs" Class="umbraco.presentation.webservices.CMSNode" %> diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/CMSNode.asmx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/CMSNode.asmx.cs deleted file mode 100644 index e71d405d62..0000000000 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/CMSNode.asmx.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using System.Data; -using System.Web; -using System.Collections; -using System.Web.Script.Services; -using System.Web.Services; -using System.Web.Services.Protocols; -using System.ComponentModel; -using Umbraco.Web.WebServices; -using umbraco.cms.businesslogic; -using umbraco.BusinessLogic; - -namespace umbraco.presentation.webservices -{ - /// - /// Summary description for CMSNode - /// - [WebService(Namespace = "http://umbraco.org/webservices/")] - [ScriptService] - public class CMSNode : UmbracoAuthorizedWebService - { - - [WebMethod] - public string GetNodeName(string ContextID, int NodeId) - { - return ValidateUserContextId(ContextID) - ? GetNodeName(NodeId) - : string.Empty; - } - - private string GetNodeName(int nodeId) - { - if (!AuthorizeRequest()) return string.Empty; - var n = new cms.businesslogic.CMSNode(nodeId); - return n.Text; - } - } -} diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/MacroContainerService.asmx b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/MacroContainerService.asmx deleted file mode 100644 index 593d4f5037..0000000000 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/MacroContainerService.asmx +++ /dev/null @@ -1 +0,0 @@ -<%@ WebService Language="C#" CodeBehind="MacroContainerService.asmx.cs" Class="umbraco.presentation.webservices.MacroContainerService" %> diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/MacroContainerService.asmx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/MacroContainerService.asmx.cs deleted file mode 100644 index 207995fbd6..0000000000 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/MacroContainerService.asmx.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.Services; -using System.Web.Script.Services; -using Umbraco.Web.WebServices; - -namespace umbraco.presentation.webservices -{ - /// - /// Summary description for MacroContainerService - /// - [WebService(Namespace = "http://umbraco.org/webservices")] - [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] - [System.ComponentModel.ToolboxItem(false)] - [ScriptService] - public class MacroContainerService : UmbracoAuthorizedWebService - { - - [WebMethod(EnableSession = true)] - [ScriptMethod] - public void SetSortOrder(string id, string sortorder) - { - if (AuthorizeRequest()) - { - HttpContext.Current.Session[id + "sortorder"] = sortorder; - } - } - } -} diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/RegexComWebservice.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/RegexComWebservice.cs deleted file mode 100644 index 4edd8a98ca..0000000000 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/RegexComWebservice.cs +++ /dev/null @@ -1,586 +0,0 @@ -using System; -using System.ComponentModel; -using System.Data; -using System.Diagnostics; -using System.Web.Services; -using System.Web.Services.Protocols; -using System.Xml.Serialization; - -// -// This source code was auto-generated by wsdl, Version=2.0.50727.42. -// - -namespace umbraco.presentation.webservices { - -/// -[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] -[System.Diagnostics.DebuggerStepThroughAttribute()] -[System.ComponentModel.DesignerCategoryAttribute("code")] -[System.Web.Services.WebServiceBindingAttribute(Name="WebservicesSoap", Namespace="http://regexlib.com/webservices.asmx")] -[System.Xml.Serialization.XmlIncludeAttribute(typeof(BaseDataObject))] -public partial class RegexComWebservice : System.Web.Services.Protocols.SoapHttpClientProtocol { - - private System.Threading.SendOrPostCallback getRegExpDetailsOperationCompleted; - - private System.Threading.SendOrPostCallback ListAllAsXmlOperationCompleted; - - private System.Threading.SendOrPostCallback listRegExpOperationCompleted; - - /// - public RegexComWebservice() { - this.Url = "http://regexlib.com/WebServices.asmx"; - } - - /// - public event getRegExpDetailsCompletedEventHandler getRegExpDetailsCompleted; - - /// - public event ListAllAsXmlCompletedEventHandler ListAllAsXmlCompleted; - - /// - public event listRegExpCompletedEventHandler listRegExpCompleted; - - /// - [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://regexlib.com/webservices.asmx/getRegExpDetails", RequestNamespace="http://regexlib.com/webservices.asmx", ResponseNamespace="http://regexlib.com/webservices.asmx", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - public RegExpDetails getRegExpDetails(int regexpId) { - object[] results = this.Invoke("getRegExpDetails", new object[] { - regexpId}); - return ((RegExpDetails)(results[0])); - } - - /// - public System.IAsyncResult BegingetRegExpDetails(int regexpId, System.AsyncCallback callback, object asyncState) { - return this.BeginInvoke("getRegExpDetails", new object[] { - regexpId}, callback, asyncState); - } - - /// - public RegExpDetails EndgetRegExpDetails(System.IAsyncResult asyncResult) { - object[] results = this.EndInvoke(asyncResult); - return ((RegExpDetails)(results[0])); - } - - /// - public void getRegExpDetailsAsync(int regexpId) { - this.getRegExpDetailsAsync(regexpId, null); - } - - /// - public void getRegExpDetailsAsync(int regexpId, object userState) { - if ((this.getRegExpDetailsOperationCompleted == null)) { - this.getRegExpDetailsOperationCompleted = new System.Threading.SendOrPostCallback(this.OngetRegExpDetailsOperationCompleted); - } - this.InvokeAsync("getRegExpDetails", new object[] { - regexpId}, this.getRegExpDetailsOperationCompleted, userState); - } - - private void OngetRegExpDetailsOperationCompleted(object arg) { - if ((this.getRegExpDetailsCompleted != null)) { - System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); - this.getRegExpDetailsCompleted(this, new getRegExpDetailsCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); - } - } - - /// - [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://regexlib.com/webservices.asmx/ListAllAsXml", RequestNamespace="http://regexlib.com/webservices.asmx", ResponseNamespace="http://regexlib.com/webservices.asmx", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - public Expression[] ListAllAsXml(int maxrows) { - object[] results = this.Invoke("ListAllAsXml", new object[] { - maxrows}); - return ((Expression[])(results[0])); - } - - /// - public System.IAsyncResult BeginListAllAsXml(int maxrows, System.AsyncCallback callback, object asyncState) { - return this.BeginInvoke("ListAllAsXml", new object[] { - maxrows}, callback, asyncState); - } - - /// - public Expression[] EndListAllAsXml(System.IAsyncResult asyncResult) { - object[] results = this.EndInvoke(asyncResult); - return ((Expression[])(results[0])); - } - - /// - public void ListAllAsXmlAsync(int maxrows) { - this.ListAllAsXmlAsync(maxrows, null); - } - - /// - public void ListAllAsXmlAsync(int maxrows, object userState) { - if ((this.ListAllAsXmlOperationCompleted == null)) { - this.ListAllAsXmlOperationCompleted = new System.Threading.SendOrPostCallback(this.OnListAllAsXmlOperationCompleted); - } - this.InvokeAsync("ListAllAsXml", new object[] { - maxrows}, this.ListAllAsXmlOperationCompleted, userState); - } - - private void OnListAllAsXmlOperationCompleted(object arg) { - if ((this.ListAllAsXmlCompleted != null)) { - System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); - this.ListAllAsXmlCompleted(this, new ListAllAsXmlCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); - } - } - - /// - [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://regexlib.com/webservices.asmx/listRegExp", RequestNamespace="http://regexlib.com/webservices.asmx", ResponseNamespace="http://regexlib.com/webservices.asmx", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)] - public System.Data.DataSet listRegExp(string keyword, string regexp_substring, int min_rating, int howmanyrows) { - object[] results = this.Invoke("listRegExp", new object[] { - keyword, - regexp_substring, - min_rating, - howmanyrows}); - return ((System.Data.DataSet)(results[0])); - } - - /// - public System.IAsyncResult BeginlistRegExp(string keyword, string regexp_substring, int min_rating, int howmanyrows, System.AsyncCallback callback, object asyncState) { - return this.BeginInvoke("listRegExp", new object[] { - keyword, - regexp_substring, - min_rating, - howmanyrows}, callback, asyncState); - } - - /// - public System.Data.DataSet EndlistRegExp(System.IAsyncResult asyncResult) { - object[] results = this.EndInvoke(asyncResult); - return ((System.Data.DataSet)(results[0])); - } - - /// - public void listRegExpAsync(string keyword, string regexp_substring, int min_rating, int howmanyrows) { - this.listRegExpAsync(keyword, regexp_substring, min_rating, howmanyrows, null); - } - - /// - public void listRegExpAsync(string keyword, string regexp_substring, int min_rating, int howmanyrows, object userState) { - if ((this.listRegExpOperationCompleted == null)) { - this.listRegExpOperationCompleted = new System.Threading.SendOrPostCallback(this.OnlistRegExpOperationCompleted); - } - this.InvokeAsync("listRegExp", new object[] { - keyword, - regexp_substring, - min_rating, - howmanyrows}, this.listRegExpOperationCompleted, userState); - } - - private void OnlistRegExpOperationCompleted(object arg) { - if ((this.listRegExpCompleted != null)) { - System.Web.Services.Protocols.InvokeCompletedEventArgs invokeArgs = ((System.Web.Services.Protocols.InvokeCompletedEventArgs)(arg)); - this.listRegExpCompleted(this, new listRegExpCompletedEventArgs(invokeArgs.Results, invokeArgs.Error, invokeArgs.Cancelled, invokeArgs.UserState)); - } - } - - /// - public new void CancelAsync(object userState) { - base.CancelAsync(userState); - } -} - -/// -[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] -[System.SerializableAttribute()] -[System.Diagnostics.DebuggerStepThroughAttribute()] -[System.ComponentModel.DesignerCategoryAttribute("code")] -[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://regexlib.com/webservices.asmx")] -public partial class RegExpDetails { - - private int user_idField; - - private int regexp_idField; - - private string regular_expressionField; - - private string matchesField; - - private string not_matchesField; - - private string sourceField; - - private string descriptionField; - - private System.DateTime create_dateField; - - private bool disableField; - - private int ratingField; - - /// - public int user_id { - get { - return this.user_idField; - } - set { - this.user_idField = value; - } - } - - /// - public int regexp_id { - get { - return this.regexp_idField; - } - set { - this.regexp_idField = value; - } - } - - /// - public string regular_expression { - get { - return this.regular_expressionField; - } - set { - this.regular_expressionField = value; - } - } - - /// - public string matches { - get { - return this.matchesField; - } - set { - this.matchesField = value; - } - } - - /// - public string not_matches { - get { - return this.not_matchesField; - } - set { - this.not_matchesField = value; - } - } - - /// - public string source { - get { - return this.sourceField; - } - set { - this.sourceField = value; - } - } - - /// - public string description { - get { - return this.descriptionField; - } - set { - this.descriptionField = value; - } - } - - /// - public System.DateTime create_date { - get { - return this.create_dateField; - } - set { - this.create_dateField = value; - } - } - - /// - public bool disable { - get { - return this.disableField; - } - set { - this.disableField = value; - } - } - - /// - public int rating { - get { - return this.ratingField; - } - set { - this.ratingField = value; - } - } -} - -/// -[System.Xml.Serialization.XmlIncludeAttribute(typeof(Expression))] -[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] -[System.SerializableAttribute()] -[System.Diagnostics.DebuggerStepThroughAttribute()] -[System.ComponentModel.DesignerCategoryAttribute("code")] -[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://regexlib.com/webservices.asmx")] -public abstract partial class BaseDataObject { - - private int idField; - - private System.DateTime dateCreatedField; - - private System.DateTime dateModifiedField; - - private bool isDirtyField; - - /// - public int Id { - get { - return this.idField; - } - set { - this.idField = value; - } - } - - /// - public System.DateTime DateCreated { - get { - return this.dateCreatedField; - } - set { - this.dateCreatedField = value; - } - } - - /// - public System.DateTime DateModified { - get { - return this.dateModifiedField; - } - set { - this.dateModifiedField = value; - } - } - - /// - public bool IsDirty { - get { - return this.isDirtyField; - } - set { - this.isDirtyField = value; - } - } -} - -/// -[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] -[System.SerializableAttribute()] -[System.Diagnostics.DebuggerStepThroughAttribute()] -[System.ComponentModel.DesignerCategoryAttribute("code")] -[System.Xml.Serialization.XmlTypeAttribute(Namespace="http://regexlib.com/webservices.asmx")] -public partial class Expression : BaseDataObject { - - private System.Guid authorIdField; - - private string authorNameField; - - private int providerIdField; - - private string titleField; - - private string patternField; - - private string matchingTextField; - - private string nonMatchingTextField; - - private bool enabledField; - - private int ratingField; - - private string sourceField; - - private string descriptionField; - - /// - public System.Guid AuthorId { - get { - return this.authorIdField; - } - set { - this.authorIdField = value; - } - } - - /// - public string AuthorName { - get { - return this.authorNameField; - } - set { - this.authorNameField = value; - } - } - - /// - public int ProviderId { - get { - return this.providerIdField; - } - set { - this.providerIdField = value; - } - } - - /// - public string Title { - get { - return this.titleField; - } - set { - this.titleField = value; - } - } - - /// - public string Pattern { - get { - return this.patternField; - } - set { - this.patternField = value; - } - } - - /// - public string MatchingText { - get { - return this.matchingTextField; - } - set { - this.matchingTextField = value; - } - } - - /// - public string NonMatchingText { - get { - return this.nonMatchingTextField; - } - set { - this.nonMatchingTextField = value; - } - } - - /// - public bool Enabled { - get { - return this.enabledField; - } - set { - this.enabledField = value; - } - } - - /// - public int Rating { - get { - return this.ratingField; - } - set { - this.ratingField = value; - } - } - - /// - public string Source { - get { - return this.sourceField; - } - set { - this.sourceField = value; - } - } - - /// - public string Description { - get { - return this.descriptionField; - } - set { - this.descriptionField = value; - } - } -} - -/// -[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] -public delegate void getRegExpDetailsCompletedEventHandler(object sender, getRegExpDetailsCompletedEventArgs e); - -/// -[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] -[System.Diagnostics.DebuggerStepThroughAttribute()] -[System.ComponentModel.DesignerCategoryAttribute("code")] -public partial class getRegExpDetailsCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { - - private object[] results; - - internal getRegExpDetailsCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : - base(exception, cancelled, userState) { - this.results = results; - } - - /// - public RegExpDetails Result { - get { - this.RaiseExceptionIfNecessary(); - return ((RegExpDetails)(this.results[0])); - } - } -} - -/// -[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] -public delegate void ListAllAsXmlCompletedEventHandler(object sender, ListAllAsXmlCompletedEventArgs e); - -/// -[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] -[System.Diagnostics.DebuggerStepThroughAttribute()] -[System.ComponentModel.DesignerCategoryAttribute("code")] -public partial class ListAllAsXmlCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { - - private object[] results; - - internal ListAllAsXmlCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : - base(exception, cancelled, userState) { - this.results = results; - } - - /// - public Expression[] Result { - get { - this.RaiseExceptionIfNecessary(); - return ((Expression[])(this.results[0])); - } - } -} - -/// -[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] -public delegate void listRegExpCompletedEventHandler(object sender, listRegExpCompletedEventArgs e); - -/// -[System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.42")] -[System.Diagnostics.DebuggerStepThroughAttribute()] -[System.ComponentModel.DesignerCategoryAttribute("code")] -public partial class listRegExpCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs { - - private object[] results; - - internal listRegExpCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) : - base(exception, cancelled, userState) { - this.results = results; - } - - /// - public System.Data.DataSet Result { - get { - this.RaiseExceptionIfNecessary(); - return ((System.Data.DataSet)(this.results[0])); - } - } -} -} \ No newline at end of file diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/Settings.asmx b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/Settings.asmx deleted file mode 100644 index 0b2a13a854..0000000000 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/Settings.asmx +++ /dev/null @@ -1 +0,0 @@ -<%@ WebService Language="c#" Codebehind="Settings.asmx.cs" Class="umbraco.webservices.Settings" %> diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/Settings.asmx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/Settings.asmx.cs deleted file mode 100644 index 4b5f90a681..0000000000 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/Settings.asmx.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System; -using System.Collections; -using System.ComponentModel; -using System.Data; -using System.Diagnostics; -using System.Web; -using System.Web.Services; -using System.Linq; -using System.Xml; -using Umbraco.Core; -using Umbraco.Web.WebServices; -using umbraco.BusinessLogic; - -namespace umbraco.webservices -{ - - public class Settings : UmbracoAuthorizedWebService - { - - [WebMethod] - public XmlNode GetTabs(string ContextID, int ContentTypeId) - { - if (!AuthorizeRequest(Constants.Applications.Settings.ToString())) - { - var xmlDoc = new XmlDocument(); - var tabs = xmlDoc.CreateElement("tabs"); - foreach (var t in new cms.businesslogic.ContentType(ContentTypeId).getVirtualTabs.ToList()) - { - var mXml = xmlDoc.CreateElement("tab"); - mXml.Attributes.Append(XmlHelper.AddAttribute(xmlDoc, "id", t.Id.ToString())); - mXml.Attributes.Append(XmlHelper.AddAttribute(xmlDoc, "caption", t.Caption)); - tabs.AppendChild(mXml); - } - return tabs; - } - - return null; - } - } -} diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/codeEditorSave.asmx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/codeEditorSave.asmx.cs index 082b98a6b9..8a17236944 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/codeEditorSave.asmx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/codeEditorSave.asmx.cs @@ -33,30 +33,6 @@ namespace umbraco.presentation.webservices [ScriptService] public class codeEditorSave : UmbracoAuthorizedWebService { - - [Obsolete("This method has been superceded by the REST service /Umbraco/RestServices/SaveFile/SaveStylesheet which is powered by the SaveFileController.")] - [WebMethod] - public string SaveCss(string fileName, string oldName, string fileContents, int fileID) - { - if (AuthorizeRequest(Constants.Applications.Settings.ToString())) - { - var stylesheet = Services.FileService.GetStylesheetByName(oldName.EnsureEndsWith(".css")); - if (stylesheet == null) throw new InvalidOperationException("No stylesheet found with name " + oldName); - - stylesheet.Content = fileContents; - if (fileName.InvariantEquals(oldName) == false) - { - //it's changed which means we need to change the path - stylesheet.Path = stylesheet.Path.TrimEnd(oldName.EnsureEndsWith(".css")) + fileName.EnsureEndsWith(".css"); - } - - Services.FileService.SaveStylesheet(stylesheet, Security.CurrentUser.Id); - - return "true"; - } - return "false"; - } - [WebMethod] public string SaveXslt(string fileName, string oldName, string fileContents, bool ignoreDebugging) { @@ -215,140 +191,5 @@ namespace umbraco.presentation.webservices } return "false"; } - - //[WebMethod] - //public string SavePartialView(string filename, string oldName, string contents) - //{ - // if (BasePage.ValidateUserContextID(BasePage.umbracoUserContextID)) - // { - // var folderPath = SystemDirectories.MvcViews + "/Partials/"; - - // // validate file - // IOHelper.ValidateEditPath(IOHelper.MapPath(folderPath + filename), folderPath); - // // validate extension - // IOHelper.ValidateFileExtension(IOHelper.MapPath(folderPath + filename), new[] {"cshtml"}.ToList()); - - - // var val = contents; - // string returnValue; - // var saveOldPath = oldName.StartsWith("~/") ? IOHelper.MapPath(oldName) : IOHelper.MapPath(folderPath + oldName); - // var savePath = filename.StartsWith("~/") ? IOHelper.MapPath(filename) : IOHelper.MapPath(folderPath + filename); - - // //Directory check.. only allow files in script dir and below to be edited - // if (savePath.StartsWith(IOHelper.MapPath(folderPath))) - // { - // //deletes the old file - // if (savePath != saveOldPath) - // { - // if (File.Exists(saveOldPath)) - // File.Delete(saveOldPath); - // } - // using (var sw = File.CreateText(savePath)) - // { - // sw.Write(val); - // } - // returnValue = "true"; - // } - // else - // { - // returnValue = "illegalPath"; - // } - - // return returnValue; - // } - // return "false"; - //} - - [Obsolete("This method has been superceded by the REST service /Umbraco/RestServices/SaveFile/SaveScript which is powered by the SaveFileController.")] - [WebMethod] - public string SaveScript(string filename, string oldName, string contents) - { - if (AuthorizeRequest(Constants.Applications.Settings.ToString())) - { - - // validate file - IOHelper.ValidateEditPath(IOHelper.MapPath(SystemDirectories.Scripts + "/" + filename), - SystemDirectories.Scripts); - // validate extension - IOHelper.ValidateFileExtension(IOHelper.MapPath(SystemDirectories.Scripts + "/" + filename), - UmbracoConfig.For.UmbracoSettings().Content.ScriptFileTypes.ToList()); - - - var val = contents; - string returnValue; - try - { - var saveOldPath = ""; - saveOldPath = oldName.StartsWith("~/") - ? IOHelper.MapPath(oldName) - : IOHelper.MapPath(SystemDirectories.Scripts + "/" + oldName); - - var savePath = ""; - savePath = filename.StartsWith("~/") - ? IOHelper.MapPath(filename) - : IOHelper.MapPath(SystemDirectories.Scripts + "/" + filename); - - //Directory check.. only allow files in script dir and below to be edited - if (savePath.StartsWith(IOHelper.MapPath(SystemDirectories.Scripts + "/")) || savePath.StartsWith(IOHelper.MapPath(SystemDirectories.Masterpages + "/"))) - { - //deletes the old file - if (savePath != saveOldPath) - { - if (File.Exists(saveOldPath)) - File.Delete(saveOldPath); - } - - //ensure the folder exists before saving - Directory.CreateDirectory(Path.GetDirectoryName(savePath)); - - using (var sw = File.CreateText(savePath)) - { - sw.Write(val); - sw.Close(); - } - - returnValue = "true"; - } - else - { - returnValue = "illegalPath"; - } - } - catch - { - returnValue = "false"; - } - - - return returnValue; - } - return "false"; - } - - [Obsolete("This method has been superceded by the REST service /Umbraco/RestServices/SaveFile/SaveTemplate which is powered by the SaveFileController.")] - [WebMethod] - public string SaveTemplate(string templateName, string templateAlias, string templateContents, int templateID, int masterTemplateID) - { - if (AuthorizeRequest(Constants.Applications.Settings.ToString())) - { - var _template = new Template(templateID); - string retVal = "false"; - - if (_template != null) - { - _template.Text = templateName; - _template.Alias = templateAlias; - _template.MasterTemplate = masterTemplateID; - _template.Design = templateContents; - - _template.Save(); - - retVal = "true"; - } - return retVal; - } - return "false"; - } - } } \ No newline at end of file diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/progressStatus.asmx b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/progressStatus.asmx deleted file mode 100644 index f18a82d386..0000000000 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/progressStatus.asmx +++ /dev/null @@ -1 +0,0 @@ -<%@ WebService Language="c#" Codebehind="progressStatus.asmx.cs" Class="presentation.umbraco.webservices.progressStatus" %> diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/progressStatus.asmx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/progressStatus.asmx.cs deleted file mode 100644 index c70b5df17e..0000000000 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/progressStatus.asmx.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System; -using System.Collections; -using System.ComponentModel; -using System.Data; -using System.Diagnostics; -using System.Web; -using System.Web.Services; -using Umbraco.Web.WebServices; - -namespace presentation.umbraco.webservices -{ - /// - /// Summary description for progressStatus. - /// - [WebService(Namespace="http://umbraco.org/webservices/")] - public class progressStatus : UmbracoAuthorizedWebService - { - - [WebMethod] - public int GetStatus(string key) - { - if (!AuthorizeRequest()) return 0; - - try - { - return int.Parse(Application[key].ToString()); - } - catch - { - return 0; - } - } - - } -} diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/publication.asmx b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/publication.asmx deleted file mode 100644 index 49626d763a..0000000000 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/publication.asmx +++ /dev/null @@ -1 +0,0 @@ -<%@ WebService Language="c#" Codebehind="publication.asmx.cs" Class="umbraco.webservices.publication" %> diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/publication.asmx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/publication.asmx.cs deleted file mode 100644 index 1a89a6d80d..0000000000 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/publication.asmx.cs +++ /dev/null @@ -1,87 +0,0 @@ -using System; -using System.ComponentModel; -using System.Web.Services; -using System.Web.Script.Services; -using Umbraco.Web.WebServices; -using umbraco.BusinessLogic; -using umbraco.presentation.webservices; -using Umbraco.Core; - -namespace umbraco.webservices -{ - /// - /// Summary description for publication. - /// - [WebService(Namespace="http://umbraco.org/webservices/")] - [ScriptService] - public class publication : UmbracoAuthorizedWebService - { - - [WebMethod] - [ScriptMethod] - public int GetPublicationStatus(string key) - { - if (!AuthorizeRequest(Constants.Applications.Content.ToString())) - return 0; - - try - { - return int.Parse(Application["publishDone" + key].ToString()); - } - catch - { - return 0; - } - } - - [WebMethod] - [ScriptMethod] - public int GetPublicationStatusMax(string key) - { - if (!AuthorizeRequest(Constants.Applications.Content.ToString())) - return 0; - - try - { - return int.Parse(Application["publishTotal" + key].ToString()); - } - catch - { - return 0; - } - } - - [WebMethod] - [ScriptMethod] - public int GetPublicationStatusMaxAll(string key) - { - if (!AuthorizeRequest(Constants.Applications.Content.ToString())) - return 0; - - try - { - return int.Parse(Application["publishTotalAll" + key].ToString()); - } - catch - { - return 0; - } - } - - [Obsolete("This doesn't do anything and will be removed in future versions")] - [WebMethod] - public void HandleReleaseAndExpireDates(Guid PublishingServiceKey) - { - } - - [Obsolete("This doesn't do anything and will be removed in future versions")] - [WebMethod] - public void SaveXmlCacheToDisk() - { - if (!AuthorizeRequest(Constants.Applications.Content.ToString())) - return; - } - - - } -} diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/tagService.asmx b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/tagService.asmx deleted file mode 100644 index c83c8c7a5c..0000000000 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/tagService.asmx +++ /dev/null @@ -1 +0,0 @@ -<%@ WebService Language="C#" CodeBehind="tagService.asmx.cs" Class="umbracoTags.webservice.tagService" %> diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/tagService.asmx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/tagService.asmx.cs deleted file mode 100644 index e7bfebdd5f..0000000000 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/tagService.asmx.cs +++ /dev/null @@ -1,126 +0,0 @@ -using System; -using System.Data; -using System.Web; -using System.Collections; -using System.Web.Services; -using System.Web.Services.Protocols; -using System.ComponentModel; - -using umbraco.DataLayer; - -namespace umbracoTags.webservice { - /// - /// Summary description for tagService - /// - [WebService(Namespace = "http://tempuri.org/")] - [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] - [ToolboxItem(false)] - [System.Web.Script.Services.ScriptService] - public class tagService : System.Web.Services.WebService { - - private static ISqlHelper _sqlHelper; - private static string _ConnString = umbraco.GlobalSettings.DbDSN; - - public static ISqlHelper SqlHelper - { - get - { - if (_sqlHelper == null) - { - try - { - _sqlHelper = DataLayerHelper.CreateSqlHelper(_ConnString); - } - catch { } - } - return _sqlHelper; - } - } - - - /// - /// Gets the tag list. - /// - /// The prefix text. - /// The count. - /// string array. - [WebMethod] - public string[] getTagList(string prefixText, int count) { - - IRecordsReader rr = SqlHelper.ExecuteReader("SELECT TOP 20 tag FROM cmsTags WHERE tag LIKE @prefix;", - SqlHelper.CreateParameter("@count", count), - SqlHelper.CreateParameter("@prefix", prefixText + "%" ) - ); - string result = ""; - - while (rr.Read()) { - result += rr.GetString("tag") + ","; - } - - return result.Trim(',').Split(','); - } - - /// - /// Gets the tag list. - /// - /// The prefix text. - /// The count. - /// The context key. - /// string array - [WebMethod] - public string[] getTagList(string prefixText, int count, string contextKey) - { - umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, prefixText + " " + count + " " + contextKey); - - string[] groupAndId = contextKey.Trim().Split('|'); - //fallback... - string sql; - - IRecordsReader rr; - - try { - //if all is correct - if (groupAndId.Length == 2) { - sql = @"SELECT TOP 20 tag FROM cmsTags WHERE tag LIKE @prefix AND cmsTags.id not in - (SELECT tagID FROM cmsTagRelationShip WHERE NodeId = @nodeId) AND cmstags.[group] = @group;"; - - rr = SqlHelper.ExecuteReader(sql, - SqlHelper.CreateParameter("@count", count), - SqlHelper.CreateParameter("@prefix", prefixText + "%"), - SqlHelper.CreateParameter("@nodeId", groupAndId[0]), - SqlHelper.CreateParameter("@group", groupAndId[1]) - ); - - - umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, "correct param " + groupAndId[1] + " " + groupAndId[0]); - - - } else { - //fallback... - sql = "SELECT TOP 20 tag FROM cmsTags WHERE tag LIKE @prefix"; - - rr = SqlHelper.ExecuteReader(sql, - SqlHelper.CreateParameter("@count", count), - SqlHelper.CreateParameter("@prefix", prefixText + "%") - ); - } - - string result = ""; - - while (rr.Read()) { - result += rr.GetString("tag") + ","; - } - - - umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, "result"); - return result.Trim(',').Split(','); - - } catch (Exception ex) { - umbraco.BusinessLogic.Log.Add(umbraco.BusinessLogic.LogTypes.Debug, -1, ex.ToString()); - } - - return ("jaxx,pik,hat").Split(','); - } - - } -} diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/templates.asmx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/templates.asmx.cs index 3a4d52c026..41eec94fda 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/templates.asmx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/templates.asmx.cs @@ -21,67 +21,7 @@ namespace umbraco.webservices [WebService(Namespace="http://umbraco.org/webservices/")] [ScriptService] public class templates : UmbracoAuthorizedWebService - { - - [WebMethod] - public XmlNode GetTemplates(string Login, string Password) - { - if (ValidateCredentials(Login, Password) && UserHasAppAccess(Constants.Applications.Settings.ToString(), Login)) - { - var xmlDoc = new XmlDocument(); - xmlDoc.LoadXml(""); - foreach (cms.businesslogic.template.Template t in cms.businesslogic.template.Template.GetAllAsList()) - { - var tt = xmlDoc.CreateElement("template"); - tt.Attributes.Append(XmlHelper.AddAttribute(xmlDoc, "id", t.Id.ToString())); - tt.Attributes.Append(XmlHelper.AddAttribute(xmlDoc, "name", t.Text)); - xmlDoc.DocumentElement.AppendChild(tt); - } - return xmlDoc.DocumentElement; - } - return null; - } - - [WebMethod] - public XmlNode GetTemplate(int Id, string Login, string Password) - { - if (ValidateCredentials(Login, Password) && UserHasAppAccess(Constants.Applications.Settings.ToString(), Login)) - { - var t = new cms.businesslogic.template.Template(Id); - var xmlDoc = new XmlDocument(); - var tXml = xmlDoc.CreateElement("template"); - tXml.Attributes.Append(XmlHelper.AddAttribute(xmlDoc, "id", t.Id.ToString())); - tXml.Attributes.Append(XmlHelper.AddAttribute(xmlDoc, "master", t.MasterTemplate.ToString())); - tXml.Attributes.Append(XmlHelper.AddAttribute(xmlDoc, "name", t.Text)); - tXml.AppendChild(XmlHelper.AddCDataNode(xmlDoc, "design", t.Design)); - return tXml; - } - return null; - } - - [WebMethod] - public bool UpdateTemplate(int Id, int Master, string Design, string Login, string Password) - { - if (ValidateCredentials(Login, Password) && UserHasAppAccess(Constants.Applications.Settings.ToString(), Login)) - { - try - { - var t = new cms.businesslogic.template.Template(Id) - { - MasterTemplate = Master, - Design = Design - }; - //ensure events are raised - t.Save(); - return true; - } - catch (ArgumentException) - { - return false; - } - } - return false; - } + { [WebMethod] [ScriptMethod] diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/trashcan.asmx b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/trashcan.asmx deleted file mode 100644 index f075057517..0000000000 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/trashcan.asmx +++ /dev/null @@ -1 +0,0 @@ -<%@ WebService Language="C#" CodeBehind="trashcan.asmx.cs" Class="umbraco.presentation.webservices.trashcan" %> diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/trashcan.asmx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/trashcan.asmx.cs deleted file mode 100644 index baa692ef34..0000000000 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/trashcan.asmx.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System; -using System.Web.Script.Services; -using System.Web.Services; -using System.ComponentModel; -using Umbraco.Web.WebServices; -using umbraco.cms.businesslogic; -using Umbraco.Core; - -namespace umbraco.presentation.webservices -{ - /// - /// Summary description for trashcan - /// - [WebService(Namespace = "http://umbraco.org/webservices")] - [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] - [ToolboxItem(false)] - [ScriptService] - public class trashcan : UmbracoAuthorizedWebService - { - [WebMethod] - public void EmptyTrashcan(RecycleBin.RecycleBinType type) - { - //validate against the app type! - switch (type) - { - case RecycleBin.RecycleBinType.Content: - if (!AuthorizeRequest(Constants.Applications.Content.ToString())) return; - break; - case RecycleBin.RecycleBinType.Media: - if (!AuthorizeRequest(Constants.Applications.Media.ToString())) return; - break; - default: - throw new ArgumentOutOfRangeException("type"); - } - - //TODO: This will never work in LB scenarios - Application["trashcanEmptyLeft"] = RecycleBin.Count(type).ToString(); - emptyTrashCanDo(type); - } - - [WebMethod] - public string GetTrashStatus() - { - //TODO: This will never work in LB scenarios - - if (AuthorizeRequest()) - { - return Application["trashcanEmptyLeft"] != null - ? Application["trashcanEmptyLeft"].ToString() - : ""; - } - - return "-"; - - } - - private void emptyTrashCanDo(RecycleBin.RecycleBinType type) - { - var trashCan = new RecycleBin(type); - - var callback = new Action(x => - { - Application.Lock(); - Application["trashcanEmptyLeft"] = x.ToString(); - Application.UnLock(); - }); - - trashCan.CallTheGarbageMan(callback); - - } - } -} diff --git a/src/UmbracoExamine/ExamineHelper.cs b/src/UmbracoExamine/ExamineHelper.cs deleted file mode 100644 index 2df27390cc..0000000000 --- a/src/UmbracoExamine/ExamineHelper.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Web; -using Examine; -using Examine.LuceneEngine.Config; -using Umbraco.Core; - -namespace UmbracoExamine -{ - internal class ExamineHelper - { - - public static IndexSet GetConfiguredIndexSet(string name, System.Collections.Specialized.NameValueCollection config, string matchingVerb, Func alreadyConfiguredCheck) - { - //Need to check if the index set or IndexerData is specified... - - if (config["indexSet"] == null && alreadyConfiguredCheck() == false) - { - //if we don't have either, then we'll try to set the index set by naming conventions - if (name.EndsWith(matchingVerb)) - { - var setNameByConvension = name.Remove(name.LastIndexOf(matchingVerb)) + "IndexSet"; - //check if we can assign the index set by naming convention - var set = IndexSets.Instance.Sets.Cast().SingleOrDefault(x => x.SetName == setNameByConvension); - - if (set != null) - { - //we've found an index set by naming conventions :) - return set; - } - } - - throw new ArgumentNullException("indexSet on LuceneExamineIndexer provider has not been set in configuration and/or the IndexerData property has not been explicitly set"); - } - - if (config["indexSet"] != null) - { - //if an index set is specified, ensure it exists and initialize the indexer based on the set - - if (IndexSets.Instance.Sets[config["indexSet"]] == null) - { - throw new ArgumentException("The indexSet specified for the LuceneExamineIndexer provider does not exist"); - } - var indexSetName = config["indexSet"]; - return IndexSets.Instance.Sets[indexSetName]; - } - - //it's already configured internally - return null; - } - } -} diff --git a/src/UmbracoExamine/LegacyLibrary.cs b/src/UmbracoExamine/LegacyLibrary.cs index 651c57b00e..58ea6319c0 100644 --- a/src/UmbracoExamine/LegacyLibrary.cs +++ b/src/UmbracoExamine/LegacyLibrary.cs @@ -35,18 +35,7 @@ namespace UmbracoExamine return _libraryType; } } - - internal static XPathNodeIterator GetXmlNodeById(string id) - { - var meth = LibraryType.GetMethod("GetXmlNodeById", BindingFlags.Public | BindingFlags.Static); - return (XPathNodeIterator)meth.Invoke(null, new object[] { id }); - } - - internal static XPathNodeIterator GetMember(int id) - { - var meth = LibraryType.GetMethod("GetMember", BindingFlags.Public | BindingFlags.Static); - return (XPathNodeIterator)meth.Invoke(null, new object[] { id }); - } + internal static XPathNodeIterator GetXmlNodeByXPath(string xpathQuery) { diff --git a/src/UmbracoExamine/UmbracoExamine.csproj b/src/UmbracoExamine/UmbracoExamine.csproj index ef8d87535d..7f137d11d0 100644 --- a/src/UmbracoExamine/UmbracoExamine.csproj +++ b/src/UmbracoExamine/UmbracoExamine.csproj @@ -121,7 +121,6 @@ - diff --git a/src/UmbracoExamine/app.config b/src/UmbracoExamine/app.config index 84d45d20fd..65f505d522 100644 --- a/src/UmbracoExamine/app.config +++ b/src/UmbracoExamine/app.config @@ -12,7 +12,7 @@ - + diff --git a/src/umbraco.cms/PluginManagerExtensions.cs b/src/umbraco.cms/PluginManagerExtensions.cs deleted file mode 100644 index 504a65d9ed..0000000000 --- a/src/umbraco.cms/PluginManagerExtensions.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; -using Umbraco.Core; -using umbraco.cms.businesslogic.macro; -using umbraco.cms.businesslogic.media; - -namespace umbraco.cms -{ - /// - /// Extension methods for the PluginTypeResolver - /// - public static class PluginManagerExtensions - { - - /// - /// Returns all available IDataType in application - /// - /// - /// - internal static IEnumerable ResolveMacroEngines(this PluginManager resolver) - { - return resolver.ResolveTypes(); - } - - } -} \ No newline at end of file diff --git a/src/umbraco.cms/app.config b/src/umbraco.cms/app.config index 84d45d20fd..65f505d522 100644 --- a/src/umbraco.cms/app.config +++ b/src/umbraco.cms/app.config @@ -12,7 +12,7 @@ - + diff --git a/src/umbraco.cms/businesslogic/CMSModuleI.cs b/src/umbraco.cms/businesslogic/CMSModuleI.cs deleted file mode 100644 index f0300becb1..0000000000 --- a/src/umbraco.cms/businesslogic/CMSModuleI.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; - -namespace umbraco.cms.businesslogic -{ - /// - /// Not implemented yet - /// - public interface CMSModuleI - { - /// - /// Not implemented yet - /// - Guid UniqueId {get;} - } -} \ No newline at end of file diff --git a/src/umbraco.cms/businesslogic/CMSNode.cs b/src/umbraco.cms/businesslogic/CMSNode.cs index 6ce141a2b5..9aada0acd6 100644 --- a/src/umbraco.cms/businesslogic/CMSNode.cs +++ b/src/umbraco.cms/businesslogic/CMSNode.cs @@ -18,7 +18,7 @@ using System.Collections; using umbraco.cms.businesslogic.task; using Umbraco.Core.Models.Membership; using File = System.IO.File; -using Notification = umbraco.cms.businesslogic.workflow.Notification; + using Task = umbraco.cms.businesslogic.task.Task; namespace umbraco.cms.businesslogic @@ -275,10 +275,7 @@ namespace umbraco.cms.businesslogic } - //event - NewEventArgs e = new NewEventArgs(); - retVal.FireAfterNew(e); - + return retVal; } @@ -326,11 +323,6 @@ namespace umbraco.cms.businesslogic { get { return LegacySqlHelper.SqlHelper; } } - - internal static UmbracoDatabase Database - { - get { return ApplicationContext.Current.DatabaseContext.Database; } - } #endregion #region Constructors @@ -452,10 +444,6 @@ namespace umbraco.cms.businesslogic public virtual XmlNode ToXml(XmlDocument xd, bool Deep) { throw new NotSupportedException("DO NOT USE THIS METHOD, THIS NEEDS TO BE REMOVED FROM THE CODEBASE, REFACTOR ANYTHING THAT IS USING THIS IF YOU GET THIS EXCEPTION"); - - XmlNode x = xd.CreateNode(XmlNodeType.Element, "node", ""); - XmlPopulate(xd, x, Deep); - return x; } public virtual XmlNode ToPreviewXml(XmlDocument xd) @@ -493,13 +481,7 @@ order by level,sortOrder"; ///
public virtual void Save() { - SaveEventArgs e = new SaveEventArgs(); - this.FireBeforeSave(e); - if (!e.Cancel) - { - //In the future there will be SQL stuff happening here... - this.FireAfterSave(e); - } + } public override string ToString() @@ -524,35 +506,26 @@ order by level,sortOrder"; ///
public virtual void delete() { - DeleteEventArgs e = new DeleteEventArgs(); - FireBeforeDelete(e); - if (!e.Cancel) + // remove relations + var rels = Relations; + foreach (relation.Relation rel in rels) { - // remove relations - var rels = Relations; - foreach (relation.Relation rel in rels) - { - rel.Delete(); - } - - //removes tasks - foreach (Task t in Tasks) - { - t.Delete(); - } - - //remove notifications - Notification.DeleteNotifications(this); - - //remove permissions - Permission.DeletePermissions(this); - - ////removes tag associations (i know the key is set to cascade but do it anyways) - //Tag.RemoveTagsFromNode(this.Id); - - SqlHelper.ExecuteNonQuery("DELETE FROM umbracoNode WHERE uniqueID= @uniqueId", SqlHelper.CreateParameter("@uniqueId", _uniqueID)); - FireAfterDelete(e); + rel.Delete(); } + + //removes tasks + foreach (Task t in Tasks) + { + t.Delete(); + } + + //remove permissions + Permission.DeletePermissions(this); + + ////removes tag associations (i know the key is set to cascade but do it anyways) + //Tag.RemoveTagsFromNode(this.Id); + + SqlHelper.ExecuteNonQuery("DELETE FROM umbracoNode WHERE uniqueID= @uniqueId", SqlHelper.CreateParameter("@uniqueId", _uniqueID)); } /// @@ -1069,160 +1042,6 @@ order by level,sortOrder"; #endregion - #region Private Methods - - private void XmlPopulate(XmlDocument xd, XmlNode x, bool Deep) - { - // attributes - x.Attributes.Append(XmlHelper.AddAttribute(xd, "id", this.Id.ToString())); - x.Attributes.Append(XmlHelper.AddAttribute(xd, "key", this.UniqueId.ToString())); - if (this.Level > 1) - x.Attributes.Append(XmlHelper.AddAttribute(xd, "parentID", this.ParentId.ToString())); - else - x.Attributes.Append(XmlHelper.AddAttribute(xd, "parentID", "-1")); - x.Attributes.Append(XmlHelper.AddAttribute(xd, "level", this.Level.ToString())); - x.Attributes.Append(XmlHelper.AddAttribute(xd, "writerID", this.User.Id.ToString())); - x.Attributes.Append(XmlHelper.AddAttribute(xd, "sortOrder", this.sortOrder.ToString())); - x.Attributes.Append(XmlHelper.AddAttribute(xd, "createDate", this.CreateDateTime.ToString("s"))); - x.Attributes.Append(XmlHelper.AddAttribute(xd, "nodeName", this.Text)); - x.Attributes.Append(XmlHelper.AddAttribute(xd, "path", this.Path)); - - if (Deep) - { - //store children array here because iterating over an Array property object is very inneficient. - var children = this.Children; - foreach (Content c in children) - x.AppendChild(c.ToXml(xd, true)); - } - } - - #endregion - - #region Events - /// - /// Calls the subscribers of a cancelable event handler, - /// stopping at the event handler which cancels the event (if any). - /// - /// Type of the event arguments. - /// The event to fire. - /// Sender of the event. - /// Event arguments. - protected virtual void FireCancelableEvent(EventHandler cancelableEvent, object sender, T eventArgs) where T : CancelEventArgs - { - if (cancelableEvent != null) - { - foreach (Delegate invocation in cancelableEvent.GetInvocationList()) - { - invocation.DynamicInvoke(sender, eventArgs); - if (eventArgs.Cancel) - break; - } - } - } - - /// - /// Occurs before a node is saved. - /// - public static event EventHandler BeforeSave; - - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected virtual void FireBeforeSave(SaveEventArgs e) - { - FireCancelableEvent(BeforeSave, this, e); - } - - /// - /// Occurs after a node is saved. - /// - public static event EventHandler AfterSave; - - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected virtual void FireAfterSave(SaveEventArgs e) - { - if (AfterSave != null) - AfterSave(this, e); - } - - /// - /// Occurs after a new node is created. - /// - public static event EventHandler AfterNew; - - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected virtual void FireAfterNew(NewEventArgs e) - { - if (AfterNew != null) - AfterNew(this, e); - } - - /// - /// Occurs before a node is deleted. - /// - public static event EventHandler BeforeDelete; - - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected virtual void FireBeforeDelete(DeleteEventArgs e) - { - FireCancelableEvent(BeforeDelete, this, e); - } - - /// - /// Occurs after a node is deleted. - /// - public static event EventHandler AfterDelete; - - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected virtual void FireAfterDelete(DeleteEventArgs e) - { - if (AfterDelete != null) - AfterDelete(this, e); - } - - /// - /// Occurs before a node is moved. - /// - public static event EventHandler BeforeMove; - - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected virtual void FireBeforeMove(MoveEventArgs e) - { - FireCancelableEvent(BeforeMove, this, e); - } - - /// - /// Occurs after a node is moved. - /// - public static event EventHandler AfterMove; - - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected virtual void FireAfterMove(MoveEventArgs e) - { - if (AfterMove != null) - AfterMove(this, e); - } - - #endregion } } \ No newline at end of file diff --git a/src/umbraco.cms/businesslogic/ContentType.cs b/src/umbraco.cms/businesslogic/ContentType.cs index 5237a1b2ee..12956efb8d 100644 --- a/src/umbraco.cms/businesslogic/ContentType.cs +++ b/src/umbraco.cms/businesslogic/ContentType.cs @@ -854,14 +854,7 @@ namespace umbraco.cms.businesslogic { return _description; } - /// - /// Used to persist object changes to the database. In Version3.0 it's just a stub for future compatibility - /// - public override void Save() - { - base.Save(); - } - + /// /// Retrieve a list of all ContentTypes /// @@ -1263,27 +1256,6 @@ namespace umbraco.cms.businesslogic */ } - private static void PopulateMasterContentTypes(PropertyType pt, int docTypeId) - { - foreach (var docType in DocumentType.GetAllAsList()) - { - //TODO: Check for multiple references (mixins) not causing endless loops! - if (docType.MasterContentTypes.Contains(docTypeId)) - { - PopulatePropertyData(pt, docType.Id); - PopulateMasterContentTypes(pt, docType.Id); - } - } - } - - private static void PopulatePropertyData(PropertyType pt, int contentTypeId) - { - // NH: PropertyTypeId inserted directly into SQL instead of as a parameter for SQL CE 4 compatibility - SqlHelper.ExecuteNonQuery( - "insert into cmsPropertyData (contentNodeId, versionId, propertyTypeId) select contentId, versionId, " + pt.Id + " from cmsContent inner join cmsContentVersion on cmsContent.nodeId = cmsContentVersion.contentId where contentType = @contentTypeId", - SqlHelper.CreateParameter("@contentTypeId", contentTypeId)); - } - #endregion #region Public TabI Interface @@ -1344,12 +1316,6 @@ namespace umbraco.cms.businesslogic /// void MoveUp(); - /// - /// Method for retrieving the original, non processed name from the db - /// - /// The original, non processed name from the db - string GetRawCaption(); - /// /// Method for moving the tab down /// diff --git a/src/umbraco.cms/businesslogic/Packager/PackageInstance/CreatedPackage.cs b/src/umbraco.cms/businesslogic/Packager/PackageInstance/CreatedPackage.cs index 7c85c5ac6c..32c406d100 100644 --- a/src/umbraco.cms/businesslogic/Packager/PackageInstance/CreatedPackage.cs +++ b/src/umbraco.cms/businesslogic/Packager/PackageInstance/CreatedPackage.cs @@ -35,34 +35,18 @@ namespace umbraco.cms.businesslogic.packager var pack = new CreatedPackage(); pack.Data = data.MakeNew(name, IOHelper.MapPath(Settings.CreatedPackagesSettings)); - var e = new NewEventArgs(); - pack.OnNew(e); return pack; } public void Save() { - var e = new SaveEventArgs(); - FireBeforeSave(e); - - if (!e.Cancel) - { - data.Save(this.Data, IOHelper.MapPath(Settings.CreatedPackagesSettings)); - FireAfterSave(e); - } + data.Save(this.Data, IOHelper.MapPath(Settings.CreatedPackagesSettings)); } public void Delete() { - var e = new DeleteEventArgs(); - FireBeforeDelete(e); - - if (!e.Cancel) - { - data.Delete(this.Data.Id, IOHelper.MapPath(Settings.CreatedPackagesSettings)); - FireAfterDelete(e); - } + data.Delete(this.Data.Id, IOHelper.MapPath(Settings.CreatedPackagesSettings)); } public PackageInstance Data { get; set; } @@ -108,272 +92,263 @@ namespace umbraco.cms.businesslogic.packager var package = this; var pack = package.Data; + + var outInt = 0; - var e = new PublishEventArgs(); - package.FireBeforePublish(e); + //Path checking... + var localPath = IOHelper.MapPath(SystemDirectories.Media + "/" + pack.Folder); - if (e.Cancel == false) + if (Directory.Exists(localPath) == false) + Directory.CreateDirectory(localPath); + + //Init package file... + CreatePackageManifest(); + //Info section.. + AppendElement(PackagerUtility.PackageInfo(pack, _packageManifest)); + + //Documents and tags... + var contentNodeId = 0; + if (string.IsNullOrEmpty(pack.ContentNodeId) == false && int.TryParse(pack.ContentNodeId, out contentNodeId)) { - var outInt = 0; - - //Path checking... - var localPath = IOHelper.MapPath(SystemDirectories.Media + "/" + pack.Folder); - - if (Directory.Exists(localPath) == false) - Directory.CreateDirectory(localPath); - - //Init package file... - CreatePackageManifest(); - //Info section.. - AppendElement(PackagerUtility.PackageInfo(pack, _packageManifest)); - - //Documents and tags... - var contentNodeId = 0; - if (string.IsNullOrEmpty(pack.ContentNodeId) == false && int.TryParse(pack.ContentNodeId, out contentNodeId)) + if (contentNodeId > 0) { - if (contentNodeId > 0) - { - //Create the Documents/DocumentSet node - XmlNode documents = _packageManifest.CreateElement("Documents"); - XmlNode documentSet = _packageManifest.CreateElement("DocumentSet"); - XmlAttribute importMode = _packageManifest.CreateAttribute("importMode", ""); - importMode.Value = "root"; - documentSet.Attributes.Append(importMode); - documents.AppendChild(documentSet); + //Create the Documents/DocumentSet node + XmlNode documents = _packageManifest.CreateElement("Documents"); + XmlNode documentSet = _packageManifest.CreateElement("DocumentSet"); + XmlAttribute importMode = _packageManifest.CreateAttribute("importMode", ""); + importMode.Value = "root"; + documentSet.Attributes.Append(importMode); + documents.AppendChild(documentSet); - //load content from umbraco. - var umbDocument = new Document(contentNodeId); + //load content from umbraco. + var umbDocument = new Document(contentNodeId); - documentSet.AppendChild(umbDocument.ToXml(_packageManifest, pack.ContentLoadChildNodes)); + documentSet.AppendChild(umbDocument.ToXml(_packageManifest, pack.ContentLoadChildNodes)); - AppendElement(documents); + AppendElement(documents); - ////Create the TagProperties node - this is used to store a definition for all - //// document properties that are tags, this ensures that we can re-import tags properly - //XmlNode tagProps = _packageManifest.CreateElement("TagProperties"); + ////Create the TagProperties node - this is used to store a definition for all + //// document properties that are tags, this ensures that we can re-import tags properly + //XmlNode tagProps = _packageManifest.CreateElement("TagProperties"); - ////before we try to populate this, we'll do a quick lookup to see if any of the documents - //// being exported contain published tags. - //var allExportedIds = documents.SelectNodes("//@id").Cast() - // .Select(x => x.Value.TryConvertTo()) - // .Where(x => x.Success) - // .Select(x => x.Result) - // .ToArray(); - //var allContentTags = new List(); - //foreach (var exportedId in allExportedIds) - //{ - // allContentTags.AddRange( - // ApplicationContext.Current.Services.TagService.GetTagsForEntity(exportedId)); - //} + ////before we try to populate this, we'll do a quick lookup to see if any of the documents + //// being exported contain published tags. + //var allExportedIds = documents.SelectNodes("//@id").Cast() + // .Select(x => x.Value.TryConvertTo()) + // .Where(x => x.Success) + // .Select(x => x.Result) + // .ToArray(); + //var allContentTags = new List(); + //foreach (var exportedId in allExportedIds) + //{ + // allContentTags.AddRange( + // ApplicationContext.Current.Services.TagService.GetTagsForEntity(exportedId)); + //} - ////This is pretty round-about but it works. Essentially we need to get the properties that are tagged - //// but to do that we need to lookup by a tag (string) - //var allTaggedEntities = new List(); - //foreach (var group in allContentTags.Select(x => x.Group).Distinct()) - //{ - // allTaggedEntities.AddRange( - // ApplicationContext.Current.Services.TagService.GetTaggedContentByTagGroup(group)); - //} + ////This is pretty round-about but it works. Essentially we need to get the properties that are tagged + //// but to do that we need to lookup by a tag (string) + //var allTaggedEntities = new List(); + //foreach (var group in allContentTags.Select(x => x.Group).Distinct()) + //{ + // allTaggedEntities.AddRange( + // ApplicationContext.Current.Services.TagService.GetTaggedContentByTagGroup(group)); + //} - ////Now, we have all property Ids/Aliases and their referenced document Ids and tags - //var allExportedTaggedEntities = allTaggedEntities.Where(x => allExportedIds.Contains(x.EntityId)) - // .DistinctBy(x => x.EntityId) - // .OrderBy(x => x.EntityId); + ////Now, we have all property Ids/Aliases and their referenced document Ids and tags + //var allExportedTaggedEntities = allTaggedEntities.Where(x => allExportedIds.Contains(x.EntityId)) + // .DistinctBy(x => x.EntityId) + // .OrderBy(x => x.EntityId); - //foreach (var taggedEntity in allExportedTaggedEntities) - //{ - // foreach (var taggedProperty in taggedEntity.TaggedProperties.Where(x => x.Tags.Any())) - // { - // XmlNode tagProp = _packageManifest.CreateElement("TagProperty"); - // var docId = _packageManifest.CreateAttribute("docId", ""); - // docId.Value = taggedEntity.EntityId.ToString(CultureInfo.InvariantCulture); - // tagProp.Attributes.Append(docId); + //foreach (var taggedEntity in allExportedTaggedEntities) + //{ + // foreach (var taggedProperty in taggedEntity.TaggedProperties.Where(x => x.Tags.Any())) + // { + // XmlNode tagProp = _packageManifest.CreateElement("TagProperty"); + // var docId = _packageManifest.CreateAttribute("docId", ""); + // docId.Value = taggedEntity.EntityId.ToString(CultureInfo.InvariantCulture); + // tagProp.Attributes.Append(docId); - // var propertyAlias = _packageManifest.CreateAttribute("propertyAlias", ""); - // propertyAlias.Value = taggedProperty.PropertyTypeAlias; - // tagProp.Attributes.Append(propertyAlias); + // var propertyAlias = _packageManifest.CreateAttribute("propertyAlias", ""); + // propertyAlias.Value = taggedProperty.PropertyTypeAlias; + // tagProp.Attributes.Append(propertyAlias); - // var group = _packageManifest.CreateAttribute("group", ""); - // group.Value = taggedProperty.Tags.First().Group; - // tagProp.Attributes.Append(group); + // var group = _packageManifest.CreateAttribute("group", ""); + // group.Value = taggedProperty.Tags.First().Group; + // tagProp.Attributes.Append(group); - // tagProp.AppendChild(_packageManifest.CreateCDataSection( - // JsonConvert.SerializeObject(taggedProperty.Tags.Select(x => x.Text).ToArray()))); + // tagProp.AppendChild(_packageManifest.CreateCDataSection( + // JsonConvert.SerializeObject(taggedProperty.Tags.Select(x => x.Text).ToArray()))); - // tagProps.AppendChild(tagProp); - // } - //} + // tagProps.AppendChild(tagProp); + // } + //} - //AppendElement(tagProps); + //AppendElement(tagProps); - } } - - //Document types.. - var dtl = new List(); - var docTypes = _packageManifest.CreateElement("DocumentTypes"); - foreach (var dtId in pack.Documenttypes) - { - if (int.TryParse(dtId, out outInt)) - { - DocumentType docT = new DocumentType(outInt); - - AddDocumentType(docT, ref dtl); - - } - } - - foreach (DocumentType d in dtl) - { - docTypes.AppendChild(d.ToXml(_packageManifest)); - } - - AppendElement(docTypes); - - //Templates - var templates = _packageManifest.CreateElement("Templates"); - foreach (var templateId in pack.Templates) - { - if (int.TryParse(templateId, out outInt)) - { - var t = new Template(outInt); - templates.AppendChild(t.ToXml(_packageManifest)); - } - } - AppendElement(templates); - - //Stylesheets - var stylesheets = _packageManifest.CreateElement("Stylesheets"); - foreach (var ssId in pack.Stylesheets) - { - if (int.TryParse(ssId, out outInt)) - { - var s = new StyleSheet(outInt); - stylesheets.AppendChild(s.ToXml(_packageManifest)); - } - } - AppendElement(stylesheets); - - //Macros - var macros = _packageManifest.CreateElement("Macros"); - foreach (var macroId in pack.Macros) - { - if (int.TryParse(macroId, out outInt)) - { - macros.AppendChild(PackagerUtility.Macro(int.Parse(macroId), true, localPath, _packageManifest)); - } - } - AppendElement(macros); - - //Dictionary Items - var dictionaryItems = _packageManifest.CreateElement("DictionaryItems"); - foreach (var dictionaryId in pack.DictionaryItems) - { - if (int.TryParse(dictionaryId, out outInt)) - { - var di = new Dictionary.DictionaryItem(outInt); - dictionaryItems.AppendChild(di.ToXml(_packageManifest)); - } - } - AppendElement(dictionaryItems); - - //Languages - var languages = _packageManifest.CreateElement("Languages"); - foreach (var langId in pack.Languages) - { - if (int.TryParse(langId, out outInt)) - { - var lang = new language.Language(outInt); - - languages.AppendChild(lang.ToXml(_packageManifest)); - } - } - AppendElement(languages); - - //TODO: Fix this! ... actually once we use the new packager we don't need to - - ////Datatypes - //var dataTypes = _packageManifest.CreateElement("DataTypes"); - //foreach (var dtId in pack.DataTypes) - //{ - // if (int.TryParse(dtId, out outInt)) - // { - // datatype.DataTypeDefinition dtd = new datatype.DataTypeDefinition(outInt); - // dataTypes.AppendChild(dtd.ToXml(_packageManifest)); - // } - //} - //AppendElement(dataTypes); - - //Files - foreach (var fileName in pack.Files) - { - PackagerUtility.AppendFileToManifest(fileName, localPath, _packageManifest); - } - - //Load control on install... - if (string.IsNullOrEmpty(pack.LoadControl) == false) - { - XmlNode control = _packageManifest.CreateElement("control"); - control.InnerText = pack.LoadControl; - PackagerUtility.AppendFileToManifest(pack.LoadControl, localPath, _packageManifest); - AppendElement(control); - } - - //Actions - if (string.IsNullOrEmpty(pack.Actions) == false) - { - try - { - var xdActions = new XmlDocument(); - xdActions.LoadXml("" + pack.Actions + ""); - var actions = xdActions.DocumentElement.SelectSingleNode("."); - - - if (actions != null) - { - actions = _packageManifest.ImportNode(actions, true).Clone(); - AppendElement(actions); - } - } - catch { } - } - - var manifestFileName = localPath + "/package.xml"; - - if (File.Exists(manifestFileName)) - File.Delete(manifestFileName); - - _packageManifest.Save(manifestFileName); - _packageManifest = null; - - - //string packPath = Settings.PackagerRoot.Replace(System.IO.Path.DirectorySeparatorChar.ToString(), "/") + "/" + pack.Name.Replace(' ', '_') + "_" + pack.Version.Replace(' ', '_') + "." + Settings.PackageFileExtension; - - // check if there's a packages directory below media - var packagesDirectory = SystemDirectories.Media + "/created-packages"; - if (Directory.Exists(IOHelper.MapPath(packagesDirectory)) == false) - { - Directory.CreateDirectory(IOHelper.MapPath(packagesDirectory)); - } - - - var packPath = packagesDirectory + "/" + (pack.Name + "_" + pack.Version).Replace(' ', '_') + "." + Settings.PackageFileExtension; - PackagerUtility.ZipPackage(localPath, IOHelper.MapPath(packPath)); - - pack.PackagePath = packPath; - - if (pack.PackageGuid.Trim() == "") - pack.PackageGuid = Guid.NewGuid().ToString(); - - package.Save(); - - //Clean up.. - File.Delete(localPath + "/package.xml"); - Directory.Delete(localPath, true); - - package.FireAfterPublish(e); } + //Document types.. + var dtl = new List(); + var docTypes = _packageManifest.CreateElement("DocumentTypes"); + foreach (var dtId in pack.Documenttypes) + { + if (int.TryParse(dtId, out outInt)) + { + DocumentType docT = new DocumentType(outInt); + + AddDocumentType(docT, ref dtl); + + } + } + + foreach (DocumentType d in dtl) + { + docTypes.AppendChild(d.ToXml(_packageManifest)); + } + + AppendElement(docTypes); + + //Templates + var templates = _packageManifest.CreateElement("Templates"); + foreach (var templateId in pack.Templates) + { + if (int.TryParse(templateId, out outInt)) + { + var t = new Template(outInt); + templates.AppendChild(t.ToXml(_packageManifest)); + } + } + AppendElement(templates); + + //Stylesheets + var stylesheets = _packageManifest.CreateElement("Stylesheets"); + foreach (var ssId in pack.Stylesheets) + { + if (int.TryParse(ssId, out outInt)) + { + var s = new StyleSheet(outInt); + stylesheets.AppendChild(s.ToXml(_packageManifest)); + } + } + AppendElement(stylesheets); + + //Macros + var macros = _packageManifest.CreateElement("Macros"); + foreach (var macroId in pack.Macros) + { + if (int.TryParse(macroId, out outInt)) + { + macros.AppendChild(PackagerUtility.Macro(int.Parse(macroId), true, localPath, _packageManifest)); + } + } + AppendElement(macros); + + //Dictionary Items + var dictionaryItems = _packageManifest.CreateElement("DictionaryItems"); + foreach (var dictionaryId in pack.DictionaryItems) + { + if (int.TryParse(dictionaryId, out outInt)) + { + var di = new Dictionary.DictionaryItem(outInt); + dictionaryItems.AppendChild(di.ToXml(_packageManifest)); + } + } + AppendElement(dictionaryItems); + + //Languages + var languages = _packageManifest.CreateElement("Languages"); + foreach (var langId in pack.Languages) + { + if (int.TryParse(langId, out outInt)) + { + var lang = new language.Language(outInt); + + languages.AppendChild(lang.ToXml(_packageManifest)); + } + } + AppendElement(languages); + + //TODO: Fix this! ... actually once we use the new packager we don't need to + + ////Datatypes + //var dataTypes = _packageManifest.CreateElement("DataTypes"); + //foreach (var dtId in pack.DataTypes) + //{ + // if (int.TryParse(dtId, out outInt)) + // { + // datatype.DataTypeDefinition dtd = new datatype.DataTypeDefinition(outInt); + // dataTypes.AppendChild(dtd.ToXml(_packageManifest)); + // } + //} + //AppendElement(dataTypes); + + //Files + foreach (var fileName in pack.Files) + { + PackagerUtility.AppendFileToManifest(fileName, localPath, _packageManifest); + } + + //Load control on install... + if (string.IsNullOrEmpty(pack.LoadControl) == false) + { + XmlNode control = _packageManifest.CreateElement("control"); + control.InnerText = pack.LoadControl; + PackagerUtility.AppendFileToManifest(pack.LoadControl, localPath, _packageManifest); + AppendElement(control); + } + + //Actions + if (string.IsNullOrEmpty(pack.Actions) == false) + { + try + { + var xdActions = new XmlDocument(); + xdActions.LoadXml("" + pack.Actions + ""); + var actions = xdActions.DocumentElement.SelectSingleNode("."); + + + if (actions != null) + { + actions = _packageManifest.ImportNode(actions, true).Clone(); + AppendElement(actions); + } + } + catch { } + } + + var manifestFileName = localPath + "/package.xml"; + + if (File.Exists(manifestFileName)) + File.Delete(manifestFileName); + + _packageManifest.Save(manifestFileName); + _packageManifest = null; + + + //string packPath = Settings.PackagerRoot.Replace(System.IO.Path.DirectorySeparatorChar.ToString(), "/") + "/" + pack.Name.Replace(' ', '_') + "_" + pack.Version.Replace(' ', '_') + "." + Settings.PackageFileExtension; + + // check if there's a packages directory below media + var packagesDirectory = SystemDirectories.Media + "/created-packages"; + if (Directory.Exists(IOHelper.MapPath(packagesDirectory)) == false) + { + Directory.CreateDirectory(IOHelper.MapPath(packagesDirectory)); + } + + + var packPath = packagesDirectory + "/" + (pack.Name + "_" + pack.Version).Replace(' ', '_') + "." + Settings.PackageFileExtension; + PackagerUtility.ZipPackage(localPath, IOHelper.MapPath(packPath)); + + pack.PackagePath = packPath; + + if (pack.PackageGuid.Trim() == "") + pack.PackageGuid = Guid.NewGuid().ToString(); + + package.Save(); + + //Clean up.. + File.Delete(localPath + "/package.xml"); + Directory.Delete(localPath, true); } private void AddDocumentType(DocumentType dt, ref List dtl) @@ -391,63 +366,6 @@ namespace umbraco.cms.businesslogic.packager } } - //EVENTS - public delegate void SaveEventHandler(CreatedPackage sender, SaveEventArgs e); - public delegate void NewEventHandler(CreatedPackage sender, NewEventArgs e); - public delegate void PublishEventHandler(CreatedPackage sender, PublishEventArgs e); - public delegate void DeleteEventHandler(CreatedPackage sender, DeleteEventArgs e); - - /// - /// Occurs when a macro is saved. - /// - public static event SaveEventHandler BeforeSave; - protected virtual void FireBeforeSave(SaveEventArgs e) - { - if (BeforeSave != null) - BeforeSave(this, e); - } - - public static event SaveEventHandler AfterSave; - protected virtual void FireAfterSave(SaveEventArgs e) - { - if (AfterSave != null) - AfterSave(this, e); - } - - public static event NewEventHandler New; - protected virtual void OnNew(NewEventArgs e) - { - if (New != null) - New(this, e); - } - - public static event DeleteEventHandler BeforeDelete; - protected virtual void FireBeforeDelete(DeleteEventArgs e) - { - if (BeforeDelete != null) - BeforeDelete(this, e); - } - - public static event DeleteEventHandler AfterDelete; - protected virtual void FireAfterDelete(DeleteEventArgs e) - { - if (AfterDelete != null) - AfterDelete(this, e); - } - - public static event PublishEventHandler BeforePublish; - protected virtual void FireBeforePublish(PublishEventArgs e) - { - if (BeforePublish != null) - BeforePublish(this, e); - } - - public static event PublishEventHandler AfterPublish; - protected virtual void FireAfterPublish(PublishEventArgs e) - { - if (AfterPublish != null) - AfterPublish(this, e); - } } diff --git a/src/umbraco.cms/businesslogic/Permission.cs b/src/umbraco.cms/businesslogic/Permission.cs index 1b775e2d58..3b3f9df2bf 100644 --- a/src/umbraco.cms/businesslogic/Permission.cs +++ b/src/umbraco.cms/businesslogic/Permission.cs @@ -1,17 +1,10 @@ -using System; -using System.Collections; -using System.Collections.Specialized; -using System.Data; using System.Linq; -using System.Runtime.CompilerServices; using Umbraco.Core; using Umbraco.Core.Events; -using umbraco.DataLayer; using umbraco.cms.businesslogic; using System.Collections.Generic; using Umbraco.Core.Models.Membership; using Umbraco.Core.Services; -using DeleteEventArgs = umbraco.cms.businesslogic.DeleteEventArgs; namespace umbraco.BusinessLogic { @@ -32,25 +25,16 @@ namespace umbraco.BusinessLogic public static void MakeNew(IUser User, CMSNode Node, char PermissionKey) { - MakeNew(User, Node, PermissionKey, true); + MakeNew(User, new[] { Node }, PermissionKey); } - private static void MakeNew(IUser user, IEnumerable nodes, char permissionKey, bool raiseEvents) + private static void MakeNew(IUser user, IEnumerable nodes, char permissionKey) { var asArray = nodes.ToArray(); ApplicationContext.Current.Services.UserService.AssignUserPermission(user.Id, permissionKey, asArray.Select(x => x.Id).ToArray()); - if (raiseEvents) - { - OnNew(new UserPermission(user, asArray, new[] { permissionKey }), new NewEventArgs()); - } - } - - private static void MakeNew(IUser User, CMSNode Node, char PermissionKey, bool raiseEvents) - { - MakeNew(User, new[] {Node}, PermissionKey, raiseEvents); - } + } /// /// Returns the permissions for a user @@ -100,19 +84,10 @@ namespace umbraco.BusinessLogic /// /// public static void DeletePermissions(IUser user, CMSNode node) - { - DeletePermissions(user, node, true); - } - - internal static void DeletePermissions(IUser user, CMSNode node, bool raiseEvents) { ApplicationContext.Current.Services.UserService.RemoveUserPermissions(user.Id, node.Id); - if (raiseEvents) - { - OnDeleted(new UserPermission(user, node, null), new DeleteEventArgs()); - } } - + /// /// deletes all permissions for the user /// @@ -121,14 +96,12 @@ namespace umbraco.BusinessLogic { ApplicationContext.Current.Services.UserService.RemoveUserPermissions(user.Id); - OnDeleted(new UserPermission(user, Enumerable.Empty(), null), new DeleteEventArgs()); } public static void DeletePermissions(int iUserID, int[] iNodeIDs) { ApplicationContext.Current.Services.UserService.RemoveUserPermissions(iUserID, iNodeIDs); - OnDeleted(new UserPermission(iUserID, iNodeIDs), new DeleteEventArgs()); } public static void DeletePermissions(int iUserID, int iNodeID) { @@ -143,7 +116,6 @@ namespace umbraco.BusinessLogic { ApplicationContext.Current.Services.ContentService.RemoveContentPermissions(node.Id); - OnDeleted(new UserPermission(null, node, null), new DeleteEventArgs()); } public static void UpdateCruds(IUser user, CMSNode node, string permissions) @@ -153,35 +125,9 @@ namespace umbraco.BusinessLogic permissions.ToCharArray(), node.Id); - OnUpdated(new UserPermission(user, node, permissions.ToCharArray()), new SaveEventArgs()); } - internal static event TypedEventHandler Deleted; - private static void OnDeleted(UserPermission permission, DeleteEventArgs args) - { - if (Deleted != null) - { - Deleted(permission, args); - } - } - - internal static event TypedEventHandler Updated; - private static void OnUpdated(UserPermission permission, SaveEventArgs args) - { - if (Updated != null) - { - Updated(permission, args); - } - } - - internal static event TypedEventHandler New; - private static void OnNew(UserPermission permission, NewEventArgs args) - { - if (New != null) - { - New(permission, args); - } - } + } @@ -189,32 +135,7 @@ namespace umbraco.BusinessLogic { private int? _userId; private readonly int[] _nodeIds; - - internal UserPermission(int userId) - { - _userId = userId; - } - - internal UserPermission(int userId, IEnumerable nodeIds) - { - _userId = userId; - _nodeIds = nodeIds.ToArray(); - } - - internal UserPermission(IUser user, CMSNode node, char[] permissionKeys) - { - User = user; - Nodes = new[] { node }; - PermissionKeys = permissionKeys; - } - - internal UserPermission(IUser user, IEnumerable nodes, char[] permissionKeys) - { - User = user; - Nodes = nodes; - PermissionKeys = permissionKeys; - } - + internal int UserId { get diff --git a/src/umbraco.cms/businesslogic/RecycleBin.cs b/src/umbraco.cms/businesslogic/RecycleBin.cs deleted file mode 100644 index 934506b204..0000000000 --- a/src/umbraco.cms/businesslogic/RecycleBin.cs +++ /dev/null @@ -1,182 +0,0 @@ -using System; -using System.Linq; -using Umbraco.Core; -using umbraco.DataLayer; -using umbraco.cms.businesslogic.web; -using umbraco.cms.businesslogic.media; - -namespace umbraco.cms.businesslogic -{ - - public class RecycleBin : CMSNode - { - /// - /// The types of Recycle Bins. - /// - /// - /// Each enum item represents the integer value of the node Id of the recycle bin in the database. - /// - public enum RecycleBinType - { - Content = Constants.System.RecycleBinContent, - Media = Constants.System.RecycleBinMedia - } - - private const string m_ChildCountSQL = @"select count(id) from umbracoNode where nodeObjectType = @nodeObjectType and path like '%,{0},%'"; - private const string m_ChildSQL = @"SELECT id, createDate, trashed, parentId, nodeObjectType, nodeUser, level, path, sortOrder, uniqueID, text FROM umbracoNode where ParentID = @parentId And nodeObjectType = @type order by sortOrder"; - private static object m_Locker = new object(); - - #region Private variables - - private Guid _nodeObjectType; - private RecycleBinType m_BinType; - - #endregion - - #region Constructors - /// - /// Constructor to create a new recycle bin - /// - /// - /// - [Obsolete("Use the simple constructor that has the RecycleBinType only parameter")] - public RecycleBin(Guid nodeObjectType, RecycleBinType type) - : base((int)type) - { - _nodeObjectType = nodeObjectType; - m_BinType = type; - } - - /// - /// Constructor to create a new recycle bin based on RecycleBinType - /// Will automatically update internal nodeObjectType based on the RecycleBinType enum - /// - /// - public RecycleBin(RecycleBinType type) - : base((int)type) - { - switch (type) - { - case RecycleBinType.Content: - _nodeObjectType = Document._objectType; - m_BinType = RecycleBinType.Content; - break; - case RecycleBinType.Media: - _nodeObjectType = Media._objectType; - m_BinType = RecycleBinType.Media; - break; - - } - } - - /// - /// Old constructor to create a content recycle bin - /// - /// - [Obsolete("Use the simple constructor that has the RecycleBinType only parameter")] - public RecycleBin(Guid nodeObjectType) - : this(nodeObjectType, RecycleBinType.Content) { } - #endregion - - #region Static methods - /// - /// Get the number of items in the Recycle Bin - /// - /// The number of all items in the Recycle Bin - [Obsolete("Create a RecycleBin object to get the count per recycle bin type", true)] - public static int Count() - { - return Count(RecycleBinType.Content); - } - - public static int Count(RecycleBinType type) - { - Guid objectType = Document._objectType; - - switch (type) - { - case RecycleBinType.Content: - objectType = Document._objectType; - break; - case RecycleBinType.Media: - objectType = Media._objectType; - break; - } - - string sql = String.Format(RecycleBin.m_ChildCountSQL, - (int) type); - - return SqlHelper.ExecuteScalar(sql, SqlHelper.CreateParameter("@nodeObjectType", objectType)); - } - #endregion - - #region Public methods - - /// - /// If I smell, I'm not empty - /// - public bool Smells() - { - return RecycleBin.Count(m_BinType) > 0; - } - - /// - /// Empties the trash can - /// - /// a function to call whenever an item is removed from the bin - public void CallTheGarbageMan(Action itemDeletedCallback) - { - lock (m_Locker) - { - var itemsInTheBin = Count(m_BinType); - itemDeletedCallback(itemsInTheBin); - - if (m_BinType == RecycleBinType.Media) - { - ApplicationContext.Current.Services.MediaService.EmptyRecycleBin(); - var trashedMedia = ApplicationContext.Current.Services.MediaService.GetMediaInRecycleBin(); - itemsInTheBin = trashedMedia.Count(); - } - else - { - ApplicationContext.Current.Services.ContentService.EmptyRecycleBin(); - var trashedContent = ApplicationContext.Current.Services.ContentService.GetContentInRecycleBin(); - itemsInTheBin = trashedContent.Count(); - } - - itemDeletedCallback(itemsInTheBin); - } - } - - #endregion - - #region Public properties - public override CMSNode[] Children - { - get - { - System.Collections.ArrayList tmp = new System.Collections.ArrayList(); - - using (IRecordsReader dr = SqlHelper.ExecuteReader(m_ChildSQL, - SqlHelper.CreateParameter("@parentId", this.Id), - SqlHelper.CreateParameter("@type", _nodeObjectType))) - { - while (dr.Read()) - { - tmp.Add(new CMSNode(dr)); - } - } - - CMSNode[] retval = new CMSNode[tmp.Count]; - - for (int i = 0; i < tmp.Count; i++) - { - retval[i] = (CMSNode)tmp[i]; - } - return retval; - } - } - #endregion - - } -} diff --git a/src/umbraco.cms/businesslogic/events/EventArgs.cs b/src/umbraco.cms/businesslogic/events/EventArgs.cs deleted file mode 100644 index 4f5b10efe2..0000000000 --- a/src/umbraco.cms/businesslogic/events/EventArgs.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Umbraco.Core; -using umbraco.cms.businesslogic.member; -using umbraco.cms.businesslogic.web; - -namespace umbraco.cms.businesslogic { - //Content Event args - public class PublishEventArgs : System.ComponentModel.CancelEventArgs { } - public class MoveEventArgs : System.ComponentModel.CancelEventArgs { } - - - public class UnPublishEventArgs : System.ComponentModel.CancelEventArgs { } - - - public class MoveToTrashEventArgs : System.ComponentModel.CancelEventArgs { } - - //Content Cache Event args - public class DocumentCacheEventArgs : System.ComponentModel.CancelEventArgs { } - public class RefreshContentEventArgs : System.ComponentModel.CancelEventArgs { } - - //Generel eventArgs - public class DeleteEventArgs : System.ComponentModel.CancelEventArgs { } - public class SaveEventArgs : System.ComponentModel.CancelEventArgs { } - public class NewEventArgs : System.ComponentModel.CancelEventArgs { } - - //Special Members Event args - public class AddToCacheEventArgs : GroupEventArgs { } - public class RemoveFromCacheEventArgs : GroupEventArgs { } - public class AddGroupEventArgs : GroupEventArgs { } - public class RemoveGroupEventArgs : GroupEventArgs { } - public class GroupEventArgs : System.ComponentModel.CancelEventArgs - { - public int GroupId{ get; set; } - } - - //Access event args - public class AddProtectionEventArgs : System.ComponentModel.CancelEventArgs { } - public class RemoveProtectionEventArgs : System.ComponentModel.CancelEventArgs { } - public class AddMemberShipRoleToDocumentEventArgs : System.ComponentModel.CancelEventArgs { } - public class RemoveMemberShipRoleFromDocumentEventArgs : System.ComponentModel.CancelEventArgs { } - public class RemoveMemberShipUserFromDocumentEventArgs : System.ComponentModel.CancelEventArgs { } - public class AddMembershipUserToDocumentEventArgs : System.ComponentModel.CancelEventArgs { } - - - public class ContentCacheLoadNodeEventArgs : System.ComponentModel.CancelEventArgs - { - public bool CancelChildren { get; set; } - } - - -} diff --git a/src/umbraco.cms/businesslogic/language/Language.cs b/src/umbraco.cms/businesslogic/language/Language.cs index 8a92bdfa84..71fbdd2c72 100644 --- a/src/umbraco.cms/businesslogic/language/Language.cs +++ b/src/umbraco.cms/businesslogic/language/Language.cs @@ -91,9 +91,7 @@ namespace umbraco.cms.businesslogic.language { CultureName = culture.DisplayName }; - ApplicationContext.Current.Services.LocalizationService.Save(lang); - var ct = new Language(lang); - ct.OnNew(new NewEventArgs()); + ApplicationContext.Current.Services.LocalizationService.Save(lang); } } @@ -230,16 +228,8 @@ namespace umbraco.cms.businesslogic.language /// public virtual void Save() { - var e = new SaveEventArgs(); - FireBeforeSave(e); - //Do the update! ApplicationContext.Current.Services.LocalizationService.Save(LanguageEntity); - - if (!e.Cancel) - { - FireAfterSave(e); - } } /// @@ -254,15 +244,7 @@ namespace umbraco.cms.businesslogic.language { if (ApplicationContext.Current.DatabaseContext.Database.ExecuteScalar("SELECT count(id) FROM umbracoDomains where domainDefaultLanguage = @id", new { id = id }) == 0) { - var e = new DeleteEventArgs(); - FireBeforeDelete(e); - - if (!e.Cancel) - { - ApplicationContext.Current.Services.LocalizationService.Delete(LanguageEntity); - - FireAfterDelete(e); - } + ApplicationContext.Current.Services.LocalizationService.Delete(LanguageEntity); } else { @@ -284,59 +266,5 @@ namespace umbraco.cms.businesslogic.language return xml.GetXmlNode(xd); } #endregion - - #region Events - - /// - /// The save event handler - /// - public delegate void SaveEventHandler(Language sender, SaveEventArgs e); - /// - /// The new event handler - /// - public delegate void NewEventHandler(Language sender, NewEventArgs e); - /// - /// The delete event handler - /// - public delegate void DeleteEventHandler(Language sender, DeleteEventArgs e); - - /// - /// Occurs when a language is saved. - /// - public static event SaveEventHandler BeforeSave; - protected virtual void FireBeforeSave(SaveEventArgs e) - { - if (BeforeSave != null) - BeforeSave(this, e); - } - - public static event SaveEventHandler AfterSave; - protected virtual void FireAfterSave(SaveEventArgs e) - { - if (AfterSave != null) - AfterSave(this, e); - } - - public static event NewEventHandler New; - protected virtual void OnNew(NewEventArgs e) - { - if (New != null) - New(this, e); - } - - public static event DeleteEventHandler BeforeDelete; - protected virtual void FireBeforeDelete(DeleteEventArgs e) - { - if (BeforeDelete != null) - BeforeDelete(this, e); - } - - public static event DeleteEventHandler AfterDelete; - protected virtual void FireAfterDelete(DeleteEventArgs e) - { - if (AfterDelete != null) - AfterDelete(this, e); - } - #endregion } } \ No newline at end of file diff --git a/src/umbraco.cms/businesslogic/macro/IMacroEngine.cs b/src/umbraco.cms/businesslogic/macro/IMacroEngine.cs deleted file mode 100644 index f79c422968..0000000000 --- a/src/umbraco.cms/businesslogic/macro/IMacroEngine.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Umbraco.Core.Models; - -namespace umbraco.cms.businesslogic.macro -{ - [Obsolete("Get rid of this!! move it and make it good")] - public interface IMacroEngine - { - string Name { get; } - IEnumerable SupportedExtensions { get; } - IEnumerable SupportedUIExtensions { get; } - - bool Validate(string code, string tempFileName, IPublishedContent currentPage, out string errorMessage); - string Execute(MacroModel macro, IPublishedContent currentPage); - } -} diff --git a/src/umbraco.cms/businesslogic/macro/Macro.cs b/src/umbraco.cms/businesslogic/macro/Macro.cs index da9aa6c83e..ec81b19fc3 100644 --- a/src/umbraco.cms/businesslogic/macro/Macro.cs +++ b/src/umbraco.cms/businesslogic/macro/Macro.cs @@ -210,34 +210,16 @@ namespace umbraco.cms.businesslogic.macro /// public virtual void Save() { - //event - var e = new SaveEventArgs(); - FireBeforeSave(e); - - if (e.Cancel == false) - { - ApplicationContext.Current.Services.MacroService.Save(MacroEntity); - - FireAfterSave(e); - } - } + ApplicationContext.Current.Services.MacroService.Save(MacroEntity); + } /// /// Deletes the current macro /// public void Delete() { - //event - var e = new DeleteEventArgs(); - FireBeforeDelete(e); - - if (e.Cancel == false) - { - ApplicationContext.Current.Services.MacroService.Delete(MacroEntity); - - FireAfterDelete(e); - } - } + ApplicationContext.Current.Services.MacroService.Delete(MacroEntity); + } //TODO: Fix this, this should wrap a new API! @@ -379,10 +361,6 @@ namespace umbraco.cms.businesslogic.macro var newMacro = new Macro(macro); - //fire new event - var e = new NewEventArgs(); - newMacro.OnNew(e); - return newMacro; } @@ -479,45 +457,7 @@ namespace umbraco.cms.businesslogic.macro #endregion - //Macro events - - //Delegates - public delegate void SaveEventHandler(Macro sender, SaveEventArgs e); - public delegate void NewEventHandler(Macro sender, NewEventArgs e); - public delegate void DeleteEventHandler(Macro sender, DeleteEventArgs e); - - /// - /// Occurs when a macro is saved. - /// - public static event SaveEventHandler BeforeSave; - protected virtual void FireBeforeSave(SaveEventArgs e) { - if (BeforeSave != null) - BeforeSave(this, e); - } - - public static event SaveEventHandler AfterSave; - protected virtual void FireAfterSave(SaveEventArgs e) { - if (AfterSave != null) - AfterSave(this, e); - } - - public static event NewEventHandler New; - protected virtual void OnNew(NewEventArgs e) { - if (New != null) - New(this, e); - } - - public static event DeleteEventHandler BeforeDelete; - protected virtual void FireBeforeDelete(DeleteEventArgs e) { - if (BeforeDelete != null) - BeforeDelete(this, e); - } - - public static event DeleteEventHandler AfterDelete; - protected virtual void FireAfterDelete(DeleteEventArgs e) { - if (AfterDelete != null) - AfterDelete(this, e); - } + #endregion } } diff --git a/src/umbraco.cms/businesslogic/macro/MacroEngineFactory.cs b/src/umbraco.cms/businesslogic/macro/MacroEngineFactory.cs deleted file mode 100644 index 46807bc352..0000000000 --- a/src/umbraco.cms/businesslogic/macro/MacroEngineFactory.cs +++ /dev/null @@ -1,131 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using Umbraco.Core; - -namespace umbraco.cms.businesslogic.macro -{ - - //TODO: This class needs to be changed to use the new MultipleResolverBase, doing this will require migrating and cleaning up - // a bunch of types so I have left it existing here under legacy code for now. The IMacroEngine interface also requires fixing - // considering the new macro types of SurfaceControllers. - - public class MacroEngineFactory - { - private static readonly List AllEngines = new List(); - private static readonly ReaderWriterLockSlim Lock = new ReaderWriterLockSlim(); - private static volatile bool _isInitialized = false; - - public MacroEngineFactory() - { - EnsureInitialize(); - } - - internal static void EnsureInitialize() - { - using (var lck = new UpgradeableReadLock(Lock)) - { - if (_isInitialized) - return; - - lck.UpgradeToWriteLock(); - - AllEngines.Clear(); - - AllEngines.AddRange( - PluginManager.Current.CreateInstances( - PluginManager.Current.ResolveMacroEngines())); - - _isInitialized = true; - } - } - - /// - /// Returns a collectino of MacroEngineLanguage objects, each of which describes a file extension and an associated macro engine that - /// supports file extension lookups. - /// - /// - /// - /// The PartialViewMacroEngine will never be returned in these results because it does not support searching by file extensions. See - /// the notes in the PartialViewMacroEngine regarding this. - /// - public static IEnumerable GetSupportedUILanguages() - { - var languages = new List(); - foreach (var engine in GetAll()) - { - foreach (string lang in engine.SupportedUIExtensions) - { - if (languages.All(t => t.Extension != lang)) - { - languages.Add(new MacroEngineLanguage(lang, engine.Name)); - } - } - } - return languages.OrderBy(s => s.Extension); - } - - public static List GetAll() - { - EnsureInitialize(); - return AllEngines; - } - - public static IMacroEngine GetEngine(string name) - { - EnsureInitialize(); - var engine = AllEngines.FirstOrDefault(x => x.Name == name); - return engine; - } - - public static IMacroEngine GetByFilename(string filename) - { - if (filename.Contains(".")) - { - string extension = filename.Substring(filename.LastIndexOf(".") + 1); - return GetByExtension(extension); - } - - throw new MacroEngineException(string.Format("No MacroEngine matches the file with extension '{0}'", filename)); - } - - public static IMacroEngine GetByExtension(string extension) - { - var engine = GetAll().Find(t => t.SupportedExtensions.Contains(extension)); - if (engine != null) - { - return engine; - } - - throw new MacroEngineException(string.Format("No MacroEngine found for extension '{0}'", extension)); - } - } - - public class MacroEngineException : Exception - { - public MacroEngineException() : base() { } - - public MacroEngineException(string msg) - : base(msg) - { - - } - } - - public class MacroEngineLanguage - { - public string Extension { get; set; } - public string EngineName { get; set; } - public MacroEngineLanguage() - { - - } - - public MacroEngineLanguage(string extension, string engineName) - { - Extension = extension; - EngineName = engineName; - } - } -} diff --git a/src/umbraco.cms/businesslogic/media/Media.cs b/src/umbraco.cms/businesslogic/media/Media.cs index 4936b4a484..27d5e06048 100644 --- a/src/umbraco.cms/businesslogic/media/Media.cs +++ b/src/umbraco.cms/businesslogic/media/Media.cs @@ -69,13 +69,6 @@ namespace umbraco.cms.businesslogic.media [Obsolete("Obsolete, Use Umbraco.Core.Services.MediaService.CreateMedia()", false)] public static Media MakeNew(string Name, MediaType dct, IUser u, int ParentId) { - var e = new NewEventArgs(); - OnNewing(e); - if (e.Cancel) - { - return null; - } - var media = ApplicationContext.Current.Services.MediaService.CreateMediaWithIdentity(Name, ParentId, dct.Alias, u.Id); //The media object will only have the 'WasCancelled' flag set to 'True' if the 'Creating' event has been cancelled if (((Entity)media).WasCancelled) @@ -83,8 +76,6 @@ namespace umbraco.cms.businesslogic.media var tmp = new Media(media); - tmp.OnNew(e); - return tmp; } @@ -309,27 +300,18 @@ namespace umbraco.cms.businesslogic.media [Obsolete("Obsolete, Use Umbraco.Core.Services.MediaService.Delete()", false)] private bool DeletePermanently() { - DeleteEventArgs e = new DeleteEventArgs(); - - FireBeforeDelete(e); - - if (!e.Cancel) + if (MediaItem != null) { - if (MediaItem != null) - { - ApplicationContext.Current.Services.MediaService.Delete(MediaItem); - } - else - { - var media = ApplicationContext.Current.Services.MediaService.GetById(Id); - ApplicationContext.Current.Services.MediaService.Delete(media); - } - - base.delete(); - - FireAfterDelete(e); + ApplicationContext.Current.Services.MediaService.Delete(MediaItem); } - return !e.Cancel; + else + { + var media = ApplicationContext.Current.Services.MediaService.GetById(Id); + ApplicationContext.Current.Services.MediaService.Delete(media); + } + + base.delete(); + return true; } /// @@ -339,161 +321,26 @@ namespace umbraco.cms.businesslogic.media [Obsolete("Obsolete, Use Umbraco.Core.Services.MediaService.MoveToRecycleBin()", false)] private bool MoveToTrash() { - MoveToTrashEventArgs e = new MoveToTrashEventArgs(); - FireBeforeMoveToTrash(e); - - if (!e.Cancel) + if (MediaItem != null) { - if (MediaItem != null) - { - ApplicationContext.Current.Services.MediaService.MoveToRecycleBin(MediaItem); - } - else - { - var media = ApplicationContext.Current.Services.MediaService.GetById(Id); - ApplicationContext.Current.Services.MediaService.MoveToRecycleBin(media); - } - - //Move((int)RecycleBin.RecycleBinType.Media); - - //TODO: Now that we've moved it to trash, we need to move the actual files so they are no longer accessible - //from the original URL. - - FireAfterMoveToTrash(e); + ApplicationContext.Current.Services.MediaService.MoveToRecycleBin(MediaItem); } - return !e.Cancel; - + else + { + var media = ApplicationContext.Current.Services.MediaService.GetById(Id); + ApplicationContext.Current.Services.MediaService.MoveToRecycleBin(media); + } + + //Move((int)RecycleBin.RecycleBinType.Media); + + //TODO: Now that we've moved it to trash, we need to move the actual files so they are no longer accessible + //from the original URL. + return true; + } #endregion - #region Events - - /// - /// The save event handler - /// - public delegate void SaveEventHandler(Media sender, SaveEventArgs e); - /// - /// The new event handler - /// - public delegate void NewEventHandler(Media sender, NewEventArgs e); - /// - /// The delete event handler - /// - public delegate void DeleteEventHandler(Media sender, DeleteEventArgs e); - - - /// - /// Occurs when [before save]. - /// - public new static event SaveEventHandler BeforeSave; - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected new virtual void FireBeforeSave(SaveEventArgs e) - { - if (BeforeSave != null) - BeforeSave(this, e); - } - - /// - /// Occurs when [after save]. - /// - public new static event SaveEventHandler AfterSave; - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected new virtual void FireAfterSave(SaveEventArgs e) - { - if (AfterSave != null) - AfterSave(this, e); - } - - /// - /// Occurs when [new]. - /// - public static event NewEventHandler New; - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected virtual void OnNew(NewEventArgs e) - { - if (New != null) - New(this, e); - } - - public static event EventHandler Newing; - protected static void OnNewing(NewEventArgs e) - { - if (Newing != null) - { - Newing(null, e); - } - } - - /// - /// Occurs when [before delete]. - /// - public new static event DeleteEventHandler BeforeDelete; - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected new virtual void FireBeforeDelete(DeleteEventArgs e) - { - if (BeforeDelete != null) - BeforeDelete(this, e); - } - - /// - /// Occurs when [after delete]. - /// - public new static event DeleteEventHandler AfterDelete; - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected new virtual void FireAfterDelete(DeleteEventArgs e) - { - if (AfterDelete != null) - AfterDelete(this, e); - } - - /// - /// The Move to trash event handler - /// - public delegate void MoveToTrashEventHandler(Media sender, MoveToTrashEventArgs e); - /// - /// Occurs when [before delete]. - /// - public static event MoveToTrashEventHandler BeforeMoveToTrash; - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected virtual void FireBeforeMoveToTrash(MoveToTrashEventArgs e) - { - if (BeforeMoveToTrash != null) - BeforeMoveToTrash(this, e); - } - - /// - /// Occurs when [after move to trash]. - /// - public static event MoveToTrashEventHandler AfterMoveToTrash; - /// - /// Fires the after move to trash. - /// - /// The instance containing the event data. - protected virtual void FireAfterMoveToTrash(MoveToTrashEventArgs e) - { - if (AfterMoveToTrash != null) - AfterMoveToTrash(this, e); - } - #endregion - + } } diff --git a/src/umbraco.cms/businesslogic/media/MediaType.cs b/src/umbraco.cms/businesslogic/media/MediaType.cs index f052edc849..25e47b4ea4 100644 --- a/src/umbraco.cms/businesslogic/media/MediaType.cs +++ b/src/umbraco.cms/businesslogic/media/MediaType.cs @@ -101,8 +101,6 @@ namespace umbraco.cms.businesslogic.media ApplicationContext.Current.Services.ContentTypeService.Save(mediaType, u.Id); var mt = new MediaType(mediaType.Id); - NewEventArgs e = new NewEventArgs(); - mt.OnNew(e); return mt; } @@ -114,19 +112,13 @@ namespace umbraco.cms.businesslogic.media /// public override void Save() { - SaveEventArgs e = new SaveEventArgs(); - FireBeforeSave(e); + var current = Thread.CurrentPrincipal != null ? Thread.CurrentPrincipal.Identity as UmbracoBackOfficeIdentity : null; + var userId = current == null ? Attempt.Fail() : current.Id.TryConvertTo(); + ApplicationContext.Current.Services.ContentTypeService.Save(MediaTypeItem, userId.Success ? userId.Result : 0); - if (!e.Cancel) - { - var current = Thread.CurrentPrincipal != null ? Thread.CurrentPrincipal.Identity as UmbracoBackOfficeIdentity : null; - var userId = current == null ? Attempt.Fail() : current.Id.TryConvertTo(); - ApplicationContext.Current.Services.ContentTypeService.Save(MediaTypeItem, userId.Success ? userId.Result : 0); + base.Save(); - base.Save(); - - FireAfterSave(e); - } + } /// @@ -134,21 +126,15 @@ namespace umbraco.cms.businesslogic.media /// public override void delete() { - DeleteEventArgs e = new DeleteEventArgs(); - FireBeforeDelete(e); - - if (!e.Cancel) + // check that no media types uses me as a master + if (GetAllAsList().Any(dt => dt.MasterContentTypes.Contains(this.Id))) { - // check that no media types uses me as a master - if (GetAllAsList().Any(dt => dt.MasterContentTypes.Contains(this.Id))) - { - throw new ArgumentException("Can't delete a Media Type used as a Master Content Type. Please remove all references first!"); - } - - ApplicationContext.Current.Services.ContentTypeService.Delete(MediaTypeItem); - - FireAfterDelete(e); + throw new ArgumentException("Can't delete a Media Type used as a Master Content Type. Please remove all references first!"); } + + ApplicationContext.Current.Services.ContentTypeService.Delete(MediaTypeItem); + + } #endregion @@ -174,92 +160,6 @@ namespace umbraco.cms.businesslogic.media } #endregion - #region Events - - /// - /// The save event handler - /// - public delegate void SaveEventHandler(MediaType sender, SaveEventArgs e); - /// - /// The new event handler - /// - public delegate void NewEventHandler(MediaType sender, NewEventArgs e); - /// - /// The delete event handler - /// - public delegate void DeleteEventHandler(MediaType sender, DeleteEventArgs e); - - - /// - /// Occurs when [before save]. - /// - public static new event SaveEventHandler BeforeSave; - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected override void FireBeforeSave(SaveEventArgs e) - { - if (BeforeSave != null) - BeforeSave(this, e); - } - - /// - /// Occurs when [after save]. - /// - public static new event SaveEventHandler AfterSave; - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected override void FireAfterSave(SaveEventArgs e) - { - if (AfterSave != null) - AfterSave(this, e); - } - - /// - /// Occurs when [new]. - /// - public static event NewEventHandler New; - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected virtual void OnNew(NewEventArgs e) - { - if (New != null) - New(this, e); - } - - /// - /// Occurs when [before delete]. - /// - public static new event DeleteEventHandler BeforeDelete; - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected override void FireBeforeDelete(DeleteEventArgs e) - { - if (BeforeDelete != null) - BeforeDelete(this, e); - } - - /// - /// Occurs when [after delete]. - /// - public static new event DeleteEventHandler AfterDelete; - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected override void FireAfterDelete(DeleteEventArgs e) - { - if (AfterDelete != null) - AfterDelete(this, e); - } - #endregion } } diff --git a/src/umbraco.cms/businesslogic/member/Member.cs b/src/umbraco.cms/businesslogic/member/Member.cs index 18b425dcf9..30bcd2e252 100644 --- a/src/umbraco.cms/businesslogic/member/Member.cs +++ b/src/umbraco.cms/businesslogic/member/Member.cs @@ -235,9 +235,6 @@ namespace umbraco.cms.businesslogic.member return null; var legacy = new Member(model); - var e = new NewEventArgs(); - - legacy.OnNew(e); legacy.Save(); @@ -602,26 +599,19 @@ namespace umbraco.cms.businesslogic.member [Obsolete("Obsolete, Use Umbraco.Core.Services.MemberService.Delete()", false)] public override void delete() { - var e = new DeleteEventArgs(); - FireBeforeDelete(e); - - if (!e.Cancel) + if (MemberItem != null) { - if (MemberItem != null) - { - ApplicationContext.Current.Services.MemberService.Delete(MemberItem); - } - else - { - var member = ApplicationContext.Current.Services.MemberService.GetById(Id); - ApplicationContext.Current.Services.MemberService.Delete(member); - } - - // Delete all content and cmsnode specific data! - base.delete(); - - FireAfterDelete(e); + ApplicationContext.Current.Services.MemberService.Delete(MemberItem); } + else + { + var member = ApplicationContext.Current.Services.MemberService.GetById(Id); + ApplicationContext.Current.Services.MemberService.Delete(member); + } + + // Delete all content and cmsnode specific data! + base.delete(); + } /// @@ -650,23 +640,15 @@ namespace umbraco.cms.businesslogic.member [MethodImpl(MethodImplOptions.Synchronized)] public void AddGroup(int GroupId) { - var e = new AddGroupEventArgs(); - e.GroupId = GroupId; - FireBeforeAddGroup(e); - - if (!e.Cancel) - { - var parameters = new IParameter[] { SqlHelper.CreateParameter("@id", Id), - SqlHelper.CreateParameter("@groupId", GroupId) }; - bool exists = SqlHelper.ExecuteScalar("SELECT COUNT(member) FROM cmsMember2MemberGroup WHERE member = @id AND memberGroup = @groupId", - parameters) > 0; - if (!exists) - SqlHelper.ExecuteNonQuery("INSERT INTO cmsMember2MemberGroup (member, memberGroup) values (@id, @groupId)", - parameters); - PopulateGroups(); - - FireAfterAddGroup(e); - } + var parameters = new IParameter[] { SqlHelper.CreateParameter("@id", Id), + SqlHelper.CreateParameter("@groupId", GroupId) }; + bool exists = SqlHelper.ExecuteScalar("SELECT COUNT(member) FROM cmsMember2MemberGroup WHERE member = @id AND memberGroup = @groupId", + parameters) > 0; + if (!exists) + SqlHelper.ExecuteNonQuery("INSERT INTO cmsMember2MemberGroup (member, memberGroup) values (@id, @groupId)", + parameters); + PopulateGroups(); + } /// @@ -675,18 +657,10 @@ namespace umbraco.cms.businesslogic.member /// The MemberGroup from which the Member is removed public void RemoveGroup(int GroupId) { - var e = new RemoveGroupEventArgs(); - e.GroupId = GroupId; - FireBeforeRemoveGroup(e); - - if (!e.Cancel) - { - SqlHelper.ExecuteNonQuery( - "delete from cmsMember2MemberGroup where member = @id and Membergroup = @groupId", - SqlHelper.CreateParameter("@id", Id), SqlHelper.CreateParameter("@groupId", GroupId)); - PopulateGroups(); - FireAfterRemoveGroup(e); - } + SqlHelper.ExecuteNonQuery( + "delete from cmsMember2MemberGroup where member = @id and Membergroup = @groupId", + SqlHelper.CreateParameter("@id", Id), SqlHelper.CreateParameter("@groupId", GroupId)); + PopulateGroups(); } #endregion @@ -733,34 +707,26 @@ namespace umbraco.cms.businesslogic.member if (m != null) { - var e = new AddToCacheEventArgs(); - m.FireBeforeAddToCache(e); + // Add cookie with member-id, guid and loginname + // zb-00035 #29931 : cleanup member state management + // NH 4.7.1: We'll no longer use legacy cookies to handle Umbraco Members + //SetMemberState(m); - if (!e.Cancel) - { - // Add cookie with member-id, guid and loginname - // zb-00035 #29931 : cleanup member state management - // NH 4.7.1: We'll no longer use legacy cookies to handle Umbraco Members - //SetMemberState(m); + FormsAuthentication.SetAuthCookie(m.LoginName, true); - FormsAuthentication.SetAuthCookie(m.LoginName, true); + //cache the member + var cachedMember = ApplicationContext.Current.ApplicationCache.RuntimeCache.GetCacheItem( + GetCacheKey(m.Id), + timeout: TimeSpan.FromMinutes(30), + getCacheItem: () => + { + // Debug information + HttpContext.Current.Trace.Write("member", + string.Format("Member added to cache: {0}/{1} ({2})", + m.Text, m.LoginName, m.Id)); - //cache the member - var cachedMember = ApplicationContext.Current.ApplicationCache.RuntimeCache.GetCacheItem( - GetCacheKey(m.Id), - timeout: TimeSpan.FromMinutes(30), - getCacheItem: () => - { - // Debug information - HttpContext.Current.Trace.Write("member", - string.Format("Member added to cache: {0}/{1} ({2})", - m.Text, m.LoginName, m.Id)); - - return m; - }); - - m.FireAfterAddToCache(e); - } + return m; + }); } } @@ -783,33 +749,25 @@ namespace umbraco.cms.businesslogic.member { if (m != null) { - var e = new AddToCacheEventArgs(); - m.FireBeforeAddToCache(e); + // zb-00035 #29931 : cleanup member state management + // NH 4.7.1: We'll no longer use Umbraco legacy cookies to handle members + //SetMemberState(m, UseSession, TimespanForCookie.TotalDays); - if (!e.Cancel) - { - // zb-00035 #29931 : cleanup member state management - // NH 4.7.1: We'll no longer use Umbraco legacy cookies to handle members - //SetMemberState(m, UseSession, TimespanForCookie.TotalDays); + FormsAuthentication.SetAuthCookie(m.LoginName, !UseSession); - FormsAuthentication.SetAuthCookie(m.LoginName, !UseSession); + //cache the member + var cachedMember = ApplicationContext.Current.ApplicationCache.RuntimeCache.GetCacheItem( + GetCacheKey(m.Id), + timeout: TimeSpan.FromMinutes(30), + getCacheItem: () => + { + // Debug information + HttpContext.Current.Trace.Write("member", + string.Format("Member added to cache: {0}/{1} ({2})", + m.Text, m.LoginName, m.Id)); - //cache the member - var cachedMember = ApplicationContext.Current.ApplicationCache.RuntimeCache.GetCacheItem( - GetCacheKey(m.Id), - timeout: TimeSpan.FromMinutes(30), - getCacheItem: () => - { - // Debug information - HttpContext.Current.Trace.Write("member", - string.Format("Member added to cache: {0}/{1} ({2})", - m.Text, m.LoginName, m.Id)); - - return m; - }); - - m.FireAfterAddToCache(e); - } + return m; + }); } } @@ -942,150 +900,6 @@ namespace umbraco.cms.businesslogic.member #endregion - #region Events - - /// - /// The save event handler - /// - public delegate void SaveEventHandler(Member sender, SaveEventArgs e); - - /// - /// The new event handler - /// - public delegate void NewEventHandler(Member sender, NewEventArgs e); - - /// - /// The delete event handler - /// - public delegate void DeleteEventHandler(Member sender, DeleteEventArgs e); - - /// - /// The add to cache event handler - /// - public delegate void AddingToCacheEventHandler(Member sender, AddToCacheEventArgs e); - - /// - /// The add group event handler - /// - public delegate void AddingGroupEventHandler(Member sender, AddGroupEventArgs e); - - /// - /// The remove group event handler - /// - public delegate void RemovingGroupEventHandler(Member sender, RemoveGroupEventArgs e); - - - /// - /// Occurs when [before save]. - /// - new public static event SaveEventHandler BeforeSave; - /// - /// Raises the event. - /// - /// The instance containing the event data. - new protected virtual void FireBeforeSave(SaveEventArgs e) - { - if (BeforeSave != null) - { - BeforeSave(this, e); - } - } - - - new public static event SaveEventHandler AfterSave; - new protected virtual void FireAfterSave(SaveEventArgs e) - { - if (AfterSave != null) - { - AfterSave(this, e); - } - } - - - public static event NewEventHandler New; - protected virtual void OnNew(NewEventArgs e) - { - if (New != null) - { - New(this, e); - } - } - - - public static event AddingGroupEventHandler BeforeAddGroup; - protected virtual void FireBeforeAddGroup(AddGroupEventArgs e) - { - if (BeforeAddGroup != null) - { - BeforeAddGroup(this, e); - } - } - public static event AddingGroupEventHandler AfterAddGroup; - protected virtual void FireAfterAddGroup(AddGroupEventArgs e) - { - if (AfterAddGroup != null) - { - AfterAddGroup(this, e); - } - } - - - public static event RemovingGroupEventHandler BeforeRemoveGroup; - protected virtual void FireBeforeRemoveGroup(RemoveGroupEventArgs e) - { - if (BeforeRemoveGroup != null) - { - BeforeRemoveGroup(this, e); - } - } - - public static event RemovingGroupEventHandler AfterRemoveGroup; - protected virtual void FireAfterRemoveGroup(RemoveGroupEventArgs e) - { - if (AfterRemoveGroup != null) - { - AfterRemoveGroup(this, e); - } - } - - - public static event AddingToCacheEventHandler BeforeAddToCache; - protected virtual void FireBeforeAddToCache(AddToCacheEventArgs e) - { - if (BeforeAddToCache != null) - { - BeforeAddToCache(this, e); - } - } - - - public static event AddingToCacheEventHandler AfterAddToCache; - protected virtual void FireAfterAddToCache(AddToCacheEventArgs e) - { - if (AfterAddToCache != null) - { - AfterAddToCache(this, e); - } - } - - new public static event DeleteEventHandler BeforeDelete; - new protected virtual void FireBeforeDelete(DeleteEventArgs e) - { - if (BeforeDelete != null) - { - BeforeDelete(this, e); - } - } - - new public static event DeleteEventHandler AfterDelete; - new protected virtual void FireAfterDelete(DeleteEventArgs e) - { - if (AfterDelete != null) - { - AfterDelete(this, e); - } - } - #endregion #region Membership helper class used for encryption methods /// diff --git a/src/umbraco.cms/businesslogic/member/MemberGroup.cs b/src/umbraco.cms/businesslogic/member/MemberGroup.cs index 222c3f0032..1c055b0f50 100644 --- a/src/umbraco.cms/businesslogic/member/MemberGroup.cs +++ b/src/umbraco.cms/businesslogic/member/MemberGroup.cs @@ -62,9 +62,6 @@ namespace umbraco.cms.businesslogic.member [Obsolete("Use System.Web.Security.Role.DeleteRole")] public override void delete() { - var e = new DeleteEventArgs(); - FireBeforeDelete(e); - if (e.Cancel) return; if (_memberGroupItem != null) { @@ -78,7 +75,6 @@ namespace umbraco.cms.businesslogic.member // Delete all content and cmsnode specific data! base.delete(); - FireAfterDelete(e); } @@ -87,13 +83,9 @@ namespace umbraco.cms.businesslogic.member /// public override void Save() { - var e = new SaveEventArgs(); - FireBeforeSave(e); - if (e.Cancel) return; ApplicationContext.Current.Services.MemberGroupService.Save(_memberGroupItem); - FireAfterSave(e); } /// @@ -163,8 +155,6 @@ namespace umbraco.cms.businesslogic.member ApplicationContext.Current.Services.MemberGroupService.Save(group); var mg = new MemberGroup(group); - var e = new NewEventArgs(); - mg.OnNew(e); return mg; } @@ -192,54 +182,6 @@ namespace umbraco.cms.businesslogic.member base.PopulateCMSNodeFromUmbracoEntity(_memberGroupItem, MemberGroupObjectType); } - //EVENTS - /// - /// The save event handler - /// - public delegate void SaveEventHandler(MemberGroup sender, SaveEventArgs e); - /// - /// The new event handler - /// - public delegate void NewEventHandler(MemberGroup sender, NewEventArgs e); - /// - /// The delete event handler - /// - public delegate void DeleteEventHandler(MemberGroup sender, DeleteEventArgs e); - - - /// - /// Occurs when a language is saved. - /// - public new static event SaveEventHandler BeforeSave; - protected override void FireBeforeSave(SaveEventArgs e) { - if (BeforeSave != null) - BeforeSave(this, e); - } - - public new static event SaveEventHandler AfterSave; - protected override void FireAfterSave(SaveEventArgs e) { - if (AfterSave != null) - AfterSave(this, e); - } - - public static event NewEventHandler New; - protected virtual void OnNew(NewEventArgs e) { - if (New != null) - New(this, e); - } - - public new static event DeleteEventHandler BeforeDelete; - protected override void FireBeforeDelete(DeleteEventArgs e) - { - if (BeforeDelete != null) - BeforeDelete(this, e); - } - - public new static event DeleteEventHandler AfterDelete; - protected override void FireAfterDelete(DeleteEventArgs e) - { - if (AfterDelete != null) - AfterDelete(this, e); - } + } } diff --git a/src/umbraco.cms/businesslogic/member/MemberType.cs b/src/umbraco.cms/businesslogic/member/MemberType.cs index 9a950b6506..065fee44b2 100644 --- a/src/umbraco.cms/businesslogic/member/MemberType.cs +++ b/src/umbraco.cms/businesslogic/member/MemberType.cs @@ -1,6 +1,7 @@ using System; using System.Linq; using Umbraco.Core; +using Umbraco.Core.Events; using Umbraco.Core.Models; using Umbraco.Core.Models.Membership; using PropertyType = umbraco.cms.businesslogic.propertytype.PropertyType; @@ -102,33 +103,17 @@ namespace umbraco.cms.businesslogic.member /// public override void delete() { - var e = new DeleteEventArgs(); + ApplicationContext.Current.Services.MemberTypeService.Delete(MemberTypeItem); - FireBeforeDelete(e); - - if (e.Cancel == false) { - - ApplicationContext.Current.Services.MemberTypeService.Delete(MemberTypeItem); - - // delete all documents of this type - FireAfterDelete(e); - } - } + } /// /// Used to persist object changes to the database /// public override void Save() { - var e = new SaveEventArgs(); - FireBeforeSave(e); - - if (e.Cancel == false) - { - ApplicationContext.Current.Services.MemberTypeService.Save(MemberTypeItem); - base.Save(); - FireAfterSave(e); - } + ApplicationContext.Current.Services.MemberTypeService.Save(MemberTypeItem); + base.Save(); } @@ -165,8 +150,6 @@ namespace umbraco.cms.businesslogic.member }; ApplicationContext.Current.Services.MemberTypeService.Save(mt); var legacy = new MemberType(mt); - var e = new NewEventArgs(); - legacy.OnNew(e); return legacy; } @@ -205,59 +188,5 @@ namespace umbraco.cms.businesslogic.member #endregion - #region Events - - /// - /// The save event handler - /// - public delegate void SaveEventHandler(MemberType sender, SaveEventArgs e); - /// - /// The new event handler - /// - public delegate void NewEventHandler(MemberType sender, NewEventArgs e); - /// - /// The delete event handler - /// - public delegate void DeleteEventHandler(MemberType sender, DeleteEventArgs e); - - - /// - /// Occurs when a language is saved. - /// - public new static event SaveEventHandler BeforeSave; - protected override void FireBeforeSave(SaveEventArgs e) - { - if (BeforeSave != null) - BeforeSave(this, e); - } - - public new static event SaveEventHandler AfterSave; - protected override void FireAfterSave(SaveEventArgs e) - { - if (AfterSave != null) - AfterSave(this, e); - } - - public static event NewEventHandler New; - protected virtual void OnNew(NewEventArgs e) - { - if (New != null) - New(this, e); - } - - public new static event DeleteEventHandler BeforeDelete; - protected override void FireBeforeDelete(DeleteEventArgs e) - { - if (BeforeDelete != null) - BeforeDelete(this, e); - } - - public new static event DeleteEventHandler AfterDelete; - protected override void FireAfterDelete(DeleteEventArgs e) - { - if (AfterDelete != null) - AfterDelete(this, e); - } - #endregion } } \ No newline at end of file diff --git a/src/umbraco.cms/businesslogic/template/Template.cs b/src/umbraco.cms/businesslogic/template/Template.cs index 6942c99502..e9aeedd2f4 100644 --- a/src/umbraco.cms/businesslogic/template/Template.cs +++ b/src/umbraco.cms/businesslogic/template/Template.cs @@ -35,32 +35,8 @@ namespace umbraco.cms.businesslogic.template public static readonly string UmbracoMasterTemplate = SystemDirectories.Umbraco + "/masterpages/default.master"; private static Hashtable _templateAliases = new Hashtable(); - #endregion + #endregion - [Obsolete("Use TemplateFilePath instead")] - public string MasterPageFile - { - get { return TemplateFilePath; } - } - - /// - /// Returns the file path for the current template - /// - public string TemplateFilePath - { - get - { - switch (ApplicationContext.Current.Services.FileService.DetermineTemplateRenderingEngine(TemplateEntity)) - { - case RenderingEngine.Mvc: - return _viewHelper.GetPhysicalFilePath(TemplateEntity); - case RenderingEngine.WebForms: - return _masterPageHelper.GetPhysicalFilePath(TemplateEntity); - default: - throw new ArgumentOutOfRangeException(); - } - } - } [Obsolete("This is not used at all, do not use this")] public static Hashtable TemplateAliases @@ -88,15 +64,7 @@ namespace umbraco.cms.businesslogic.template /// public override void Save() { - SaveEventArgs e = new SaveEventArgs(); - FireBeforeSave(e); - - if (!e.Cancel) - { - ApplicationContext.Current.Services.FileService.SaveTemplate(TemplateEntity); - //base.Save(); - FireAfterSave(e); - } + ApplicationContext.Current.Services.FileService.SaveTemplate(TemplateEntity); } public string GetRawText() @@ -299,8 +267,6 @@ namespace umbraco.cms.businesslogic.template var template = ApplicationContext.Current.Services.FileService.CreateTemplateWithIdentity(name, design, foundMaster, u.Id); var legacyTemplate = new Template(template); - var e = new NewEventArgs(); - legacyTemplate.OnNew(e); return legacyTemplate; } @@ -345,19 +311,13 @@ namespace umbraco.cms.businesslogic.template throw ex; } - DeleteEventArgs e = new DeleteEventArgs(); - FireBeforeDelete(e); - if (!e.Cancel) - { - //remove refs from documents - SqlHelper.ExecuteNonQuery("UPDATE cmsDocument SET templateId = NULL WHERE templateId = " + this.Id); + //remove refs from documents + SqlHelper.ExecuteNonQuery("UPDATE cmsDocument SET templateId = NULL WHERE templateId = " + this.Id); - ApplicationContext.Current.Services.FileService.DeleteTemplate(TemplateEntity.Alias); + ApplicationContext.Current.Services.FileService.DeleteTemplate(TemplateEntity.Alias); - FireAfterDelete(e); - } } [Obsolete("This method, doesnt actually do anything, as the file is created when the design is set", false)] @@ -530,92 +490,6 @@ namespace umbraco.cms.businesslogic.template } - #region Events - //EVENTS - /// - /// The save event handler - /// - public delegate void SaveEventHandler(Template sender, SaveEventArgs e); - /// - /// The new event handler - /// - public delegate void NewEventHandler(Template sender, NewEventArgs e); - /// - /// The delete event handler - /// - public delegate void DeleteEventHandler(Template sender, DeleteEventArgs e); - - - /// - /// Occurs when [before save]. - /// - public new static event SaveEventHandler BeforeSave; - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected override void FireBeforeSave(SaveEventArgs e) - { - if (BeforeSave != null) - BeforeSave(this, e); - } - - /// - /// Occurs when [after save]. - /// - public new static event SaveEventHandler AfterSave; - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected override void FireAfterSave(SaveEventArgs e) - { - if (AfterSave != null) - AfterSave(this, e); - } - - /// - /// Occurs when [new]. - /// - public static event NewEventHandler New; - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected virtual void OnNew(NewEventArgs e) - { - if (New != null) - New(this, e); - } - - /// - /// Occurs when [before delete]. - /// - public new static event DeleteEventHandler BeforeDelete; - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected override void FireBeforeDelete(DeleteEventArgs e) - { - if (BeforeDelete != null) - BeforeDelete(this, e); - } - - /// - /// Occurs when [after delete]. - /// - public new static event DeleteEventHandler AfterDelete; - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected override void FireAfterDelete(DeleteEventArgs e) - { - if (AfterDelete != null) - AfterDelete(this, e); - } - #endregion } } diff --git a/src/umbraco.cms/businesslogic/web/Document.cs b/src/umbraco.cms/businesslogic/web/Document.cs index 2b77b47284..79a52ea7d6 100644 --- a/src/umbraco.cms/businesslogic/web/Document.cs +++ b/src/umbraco.cms/businesslogic/web/Document.cs @@ -464,16 +464,7 @@ namespace umbraco.cms.businesslogic.web [Obsolete("Obsolete, Use Umbraco.Core.Services.ContentService.UnPublish()", false)] public void UnPublish() { - UnPublishEventArgs e = new UnPublishEventArgs(); - - FireBeforeUnPublish(e); - - if (!e.Cancel) - { - _published = ApplicationContext.Current.Services.ContentService.UnPublish(ContentEntity); - - FireAfterUnPublish(e); - } + _published = ApplicationContext.Current.Services.ContentService.UnPublish(ContentEntity); } @@ -603,28 +594,19 @@ namespace umbraco.cms.businesslogic.web [Obsolete("Obsolete, Use Umbraco.Core.Services.ContentService.Delete()", false)] private bool DeletePermanently() { - DeleteEventArgs e = new DeleteEventArgs(); - - FireBeforeDelete(e); - - if (!e.Cancel) + if (ContentEntity != null) { - if (ContentEntity != null) - { - ApplicationContext.Current.Services.ContentService.Delete(ContentEntity); - } - else - { - ContentEntity = ApplicationContext.Current.Services.ContentService.GetById(Id); - ApplicationContext.Current.Services.ContentService.Delete(ContentEntity); - } - - //Keeping the base.delete() as it looks to be clear 'private/internal cache' - base.delete(); - - FireAfterDelete(e); + ApplicationContext.Current.Services.ContentService.Delete(ContentEntity); } - return !e.Cancel; + else + { + ContentEntity = ApplicationContext.Current.Services.ContentService.GetById(Id); + ApplicationContext.Current.Services.ContentService.Delete(ContentEntity); + } + + //Keeping the base.delete() as it looks to be clear 'private/internal cache' + base.delete(); + return true; } /// @@ -634,138 +616,22 @@ namespace umbraco.cms.businesslogic.web [Obsolete("Obsolete, Use Umbraco.Core.Services.ContentService.MoveToRecycleBin()", false)] private bool MoveToTrash() { - MoveToTrashEventArgs e = new MoveToTrashEventArgs(); - FireBeforeMoveToTrash(e); - if (!e.Cancel) + UnPublish(); + if (ContentEntity != null) { - UnPublish(); - if (ContentEntity != null) - { - ApplicationContext.Current.Services.ContentService.MoveToRecycleBin(ContentEntity); - } - else - { - ContentEntity = ApplicationContext.Current.Services.ContentService.GetById(Id); - ApplicationContext.Current.Services.ContentService.MoveToRecycleBin(ContentEntity); - } - FireAfterMoveToTrash(e); + ApplicationContext.Current.Services.ContentService.MoveToRecycleBin(ContentEntity); } - return !e.Cancel; + else + { + ContentEntity = ApplicationContext.Current.Services.ContentService.GetById(Id); + ApplicationContext.Current.Services.ContentService.MoveToRecycleBin(ContentEntity); + } + return true; } #endregion - - #region Events - - /// - /// The delete event handler - /// - public delegate void DeleteEventHandler(Document sender, DeleteEventArgs e); - /// - /// The unpublish event handler - /// - public delegate void UnPublishEventHandler(Document sender, UnPublishEventArgs e); - - /// - /// The Move to trash event handler - /// - public delegate void MoveToTrashEventHandler(Document sender, MoveToTrashEventArgs e); - - - /// - /// Occurs when [before delete]. - /// - public new static event DeleteEventHandler BeforeDelete; - - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected new virtual void FireBeforeDelete(DeleteEventArgs e) - { - if (BeforeDelete != null) - BeforeDelete(this, e); - } - - /// - /// Occurs when [after delete]. - /// - public new static event DeleteEventHandler AfterDelete; - - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected new virtual void FireAfterDelete(DeleteEventArgs e) - { - if (AfterDelete != null) - AfterDelete(this, e); - } - - - /// - /// Occurs when [before delete]. - /// - public static event MoveToTrashEventHandler BeforeMoveToTrash; - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected virtual void FireBeforeMoveToTrash(MoveToTrashEventArgs e) - { - if (BeforeMoveToTrash != null) - BeforeMoveToTrash(this, e); - } - - - /// - /// Occurs when [after move to trash]. - /// - public static event MoveToTrashEventHandler AfterMoveToTrash; - /// - /// Fires the after move to trash. - /// - /// The instance containing the event data. - protected virtual void FireAfterMoveToTrash(MoveToTrashEventArgs e) - { - if (AfterMoveToTrash != null) - AfterMoveToTrash(this, e); - } - - - /// - /// Occurs when [before un publish]. - /// - public static event UnPublishEventHandler BeforeUnPublish; - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected virtual void FireBeforeUnPublish(UnPublishEventArgs e) - { - if (BeforeUnPublish != null) - BeforeUnPublish(this, e); - } - - /// - /// Occurs when [after un publish]. - /// - public static event UnPublishEventHandler AfterUnPublish; - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected virtual void FireAfterUnPublish(UnPublishEventArgs e) - { - if (AfterUnPublish != null) - AfterUnPublish(this, e); - } - - - #endregion - } } diff --git a/src/umbraco.cms/businesslogic/web/DocumentType.cs b/src/umbraco.cms/businesslogic/web/DocumentType.cs index 159d5f8737..5833b1d198 100644 --- a/src/umbraco.cms/businesslogic/web/DocumentType.cs +++ b/src/umbraco.cms/businesslogic/web/DocumentType.cs @@ -88,9 +88,6 @@ namespace umbraco.cms.businesslogic.web ApplicationContext.Current.Services.ContentTypeService.Save(contentType, u.Id); var newDt = new DocumentType(contentType); - //event - NewEventArgs e = new NewEventArgs(); - newDt.OnNew(e); return newDt; } @@ -347,23 +344,16 @@ namespace umbraco.cms.businesslogic.web [Obsolete("Obsolete, Use Umbraco.Core.Services.ContentTypeService.Delete()", false)] public override void delete() { - DeleteEventArgs e = new DeleteEventArgs(); - FireBeforeDelete(e); - - if (e.Cancel == false) + // check that no document types uses me as a master + if (GetAllAsList().Any(dt => dt.MasterContentTypes.Contains(this.Id))) { - // check that no document types uses me as a master - if (GetAllAsList().Any(dt => dt.MasterContentTypes.Contains(this.Id))) - { - throw new ArgumentException("Can't delete a Document Type used as a Master Content Type. Please remove all references first!"); - } - - ApplicationContext.Current.Services.ContentTypeService.Delete(ContentType); - - clearTemplates(); - - FireAfterDelete(e); + throw new ArgumentException("Can't delete a Document Type used as a Master Content Type. Please remove all references first!"); } + + ApplicationContext.Current.Services.ContentTypeService.Delete(ContentType); + + clearTemplates(); + } public void clearTemplates() @@ -404,18 +394,11 @@ namespace umbraco.cms.businesslogic.web [Obsolete("Obsolete, Use Umbraco.Core.Services.ContentTypeService.Save()", false)] public override void Save() { - var e = new SaveEventArgs(); - FireBeforeSave(e); + var current = Thread.CurrentPrincipal != null ? Thread.CurrentPrincipal.Identity as UmbracoBackOfficeIdentity : null; + var userId = current == null ? Attempt.Fail() : current.Id.TryConvertTo(); + ApplicationContext.Current.Services.ContentTypeService.Save(ContentType, userId.Success ? userId.Result : 0); - if (!e.Cancel) - { - var current = Thread.CurrentPrincipal != null ? Thread.CurrentPrincipal.Identity as UmbracoBackOfficeIdentity : null; - var userId = current == null ? Attempt.Fail() : current.Id.TryConvertTo(); - ApplicationContext.Current.Services.ContentTypeService.Save(ContentType, userId.Success ? userId.Result : 0); - - base.Save(); - FireAfterSave(e); - } + base.Save(); } #endregion @@ -466,94 +449,5 @@ namespace umbraco.cms.businesslogic.web } #endregion - #region Events - /// - /// The save event handler - /// - public delegate void SaveEventHandler(DocumentType sender, SaveEventArgs e); - /// - /// The New event handler - /// - public delegate void NewEventHandler(DocumentType sender, NewEventArgs e); - /// - /// The delete event handler - /// - public delegate void DeleteEventHandler(DocumentType sender, DeleteEventArgs e); - - /// - /// Occurs when [before save]. - /// - public new static event SaveEventHandler BeforeSave; - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected override void FireBeforeSave(SaveEventArgs e) - { - if (BeforeSave != null) - BeforeSave(this, e); - } - - /// - /// Occurs when [after save]. - /// - public new static event SaveEventHandler AfterSave; - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected override void FireAfterSave(SaveEventArgs e) - { - if (AfterSave != null) - { - var updated = this.ContentType == null - ? new DocumentType(this.Id) - : new DocumentType(this.ContentType); - AfterSave(updated, e); - } - } - - /// - /// Occurs when [new]. - /// - public static event NewEventHandler New; - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected virtual void OnNew(NewEventArgs e) - { - if (New != null) - New(this, e); - } - - /// - /// Occurs when [before delete]. - /// - public new static event DeleteEventHandler BeforeDelete; - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected override void FireBeforeDelete(DeleteEventArgs e) - { - if (BeforeDelete != null) - BeforeDelete(this, e); - } - - /// - /// Occurs when [after delete]. - /// - public new static event DeleteEventHandler AfterDelete; - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected override void FireAfterDelete(DeleteEventArgs e) - { - if (AfterDelete != null) - AfterDelete(this, e); - } - #endregion } } \ No newline at end of file diff --git a/src/umbraco.cms/businesslogic/web/Domain.cs b/src/umbraco.cms/businesslogic/web/Domain.cs index 4dfc4e28aa..4421291c94 100644 --- a/src/umbraco.cms/businesslogic/web/Domain.cs +++ b/src/umbraco.cms/businesslogic/web/Domain.cs @@ -80,28 +80,14 @@ namespace umbraco.cms.businesslogic.web public void Delete() { - var e = new DeleteEventArgs(); - FireBeforeDelete(e); + ApplicationContext.Current.Services.DomainService.Delete(DomainEntity); - if (!e.Cancel) - { - ApplicationContext.Current.Services.DomainService.Delete(DomainEntity); - - FireAfterDelete(e); - } } - public void Save(){ - var e = new SaveEventArgs(); - FireBeforeSave(e); + public void Save() + { + ApplicationContext.Current.Services.DomainService.Save(DomainEntity); - if (!e.Cancel) - { - if (ApplicationContext.Current.Services.DomainService.Save(DomainEntity)) - { - FireAfterSave(e); - } - } } #region Statics @@ -156,54 +142,12 @@ namespace umbraco.cms.businesslogic.web RootContentId = RootNodeId, LanguageId = LanguageId }; - if (ApplicationContext.Current.Services.DomainService.Save(domain)) - { - var e = new NewEventArgs(); - var legacyModel = new Domain(domain); - legacyModel.OnNew(e); - } - + ApplicationContext.Current.Services.DomainService.Save(domain); } #endregion - //EVENTS - public delegate void SaveEventHandler(Domain sender, SaveEventArgs e); - public delegate void NewEventHandler(Domain sender, NewEventArgs e); - public delegate void DeleteEventHandler(Domain sender, DeleteEventArgs e); - - /// - /// Occurs when a macro is saved. - /// - public static event SaveEventHandler BeforeSave; - protected virtual void FireBeforeSave(SaveEventArgs e) { - if (BeforeSave != null) - BeforeSave(this, e); - } - - public static event SaveEventHandler AfterSave; - protected virtual void FireAfterSave(SaveEventArgs e) { - if (AfterSave != null) - AfterSave(this, e); - } - - public static event NewEventHandler New; - protected virtual void OnNew(NewEventArgs e) { - if (New != null) - New(this, e); - } - - public static event DeleteEventHandler BeforeDelete; - protected virtual void FireBeforeDelete(DeleteEventArgs e) { - if (BeforeDelete != null) - BeforeDelete(this, e); - } - - public static event DeleteEventHandler AfterDelete; - protected virtual void FireAfterDelete(DeleteEventArgs e) { - if (AfterDelete != null) - AfterDelete(this, e); - } + #region Pipeline Refactoring diff --git a/src/umbraco.cms/businesslogic/web/StyleSheet.cs b/src/umbraco.cms/businesslogic/web/StyleSheet.cs index 7c7006b074..aa66d8bcc6 100644 --- a/src/umbraco.cms/businesslogic/web/StyleSheet.cs +++ b/src/umbraco.cms/businesslogic/web/StyleSheet.cs @@ -106,14 +106,8 @@ namespace umbraco.cms.businesslogic.web /// public override void Save() { - var e = new SaveEventArgs(); - FireBeforeSave(e); - if (!e.Cancel) - { - ApplicationContext.Current.Services.FileService.SaveStylesheet(StylesheetEntity); + ApplicationContext.Current.Services.FileService.SaveStylesheet(StylesheetEntity); - FireAfterSave(e); - } } /// @@ -150,8 +144,6 @@ namespace umbraco.cms.businesslogic.web ApplicationContext.Current.Services.FileService.SaveStylesheet(newSheet); var newCss = new StyleSheet(newSheet); - var e = new NewEventArgs(); - newCss.OnNew(e); return newCss; } @@ -175,15 +167,7 @@ namespace umbraco.cms.businesslogic.web public override void delete() { - var e = new DeleteEventArgs(); - FireBeforeDelete(e); - - if (!e.Cancel) - { - ApplicationContext.Current.Services.FileService.DeleteStylesheet(StylesheetEntity.Path); - - FireAfterDelete(e); - } + ApplicationContext.Current.Services.FileService.DeleteStylesheet(StylesheetEntity.Path); } @@ -255,113 +239,8 @@ namespace umbraco.cms.businesslogic.web } - //EVENTS - /// - /// The save event handler - /// - public delegate void SaveEventHandler(StyleSheet sender, SaveEventArgs e); - /// - /// The new event handler - /// - public delegate void NewEventHandler(StyleSheet sender, NewEventArgs e); - /// - /// The delete event handler - /// - public delegate void DeleteEventHandler(StyleSheet sender, DeleteEventArgs e); - - - /// - /// Occurs when [before save]. - /// - public new static event SaveEventHandler BeforeSave; - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected override void FireBeforeSave(SaveEventArgs e) - { - if (BeforeSave != null) - BeforeSave(this, e); - } - - /// - /// Occurs when [after save]. - /// - public new static event SaveEventHandler AfterSave; - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected override void FireAfterSave(SaveEventArgs e) - { - if (AfterSave != null) - AfterSave(this, e); - } - - /// - /// Occurs when [new]. - /// - public static event NewEventHandler New; - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected virtual void OnNew(NewEventArgs e) - { - if (New != null) - New(this, e); - } - - /// - /// Occurs when [before delete]. - /// - public new static event DeleteEventHandler BeforeDelete; - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected override void FireBeforeDelete(DeleteEventArgs e) - { - if (BeforeDelete != null) - BeforeDelete(this, e); - } - - /// - /// Occurs when [after delete]. - /// - public new static event DeleteEventHandler AfterDelete; - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected override void FireAfterDelete(DeleteEventArgs e) - { - if (AfterDelete != null) - AfterDelete(this, e); - } - } - [Obsolete("This is no longer used and will be removed from the codebase in future versions")] - public class StyleSheetComparer : IComparer - { - public StyleSheetComparer() - { - //default constructor - } - - public Int32 Compare(Object pFirstObject, Object pObjectToCompare) - { - if (pFirstObject is StyleSheet) - { - return String.Compare(((StyleSheet)pFirstObject).Text, ((StyleSheet)pObjectToCompare).Text); - } - else - { - return 0; - } - } - } } diff --git a/src/umbraco.cms/businesslogic/web/StylesheetProperty.cs b/src/umbraco.cms/businesslogic/web/StylesheetProperty.cs index fb815bc075..9ededabf0c 100644 --- a/src/umbraco.cms/businesslogic/web/StylesheetProperty.cs +++ b/src/umbraco.cms/businesslogic/web/StylesheetProperty.cs @@ -89,37 +89,19 @@ namespace umbraco.cms.businesslogic.web ApplicationContext.Current.Services.FileService.SaveStylesheet(sheet.StylesheetEntity); var ssp = new StylesheetProperty(sheet.StylesheetEntity, prop); - var e = new NewEventArgs(); - ssp.OnNew(e); return ssp; } public override void delete() { - var e = new DeleteEventArgs(); - FireBeforeDelete(e); + StylesheetItem.RemoveProperty(Text); + ApplicationContext.Current.Services.FileService.SaveStylesheet(StylesheetItem); - if (!e.Cancel) - { - - StylesheetItem.RemoveProperty(Text); - ApplicationContext.Current.Services.FileService.SaveStylesheet(StylesheetItem); - - FireAfterDelete(e); - } } public override void Save() { - var e = new SaveEventArgs(); - FireBeforeSave(e); - - if (!e.Cancel) - { - ApplicationContext.Current.Services.FileService.SaveStylesheet(StylesheetItem); - - FireAfterSave(e); - } + ApplicationContext.Current.Services.FileService.SaveStylesheet(StylesheetItem); } public override string ToString() @@ -133,85 +115,6 @@ namespace umbraco.cms.businesslogic.web web.StyleSheet.ThrowNotSupported(); return null; } - - // EVENTS - /// - /// The save event handler - /// - public delegate void SaveEventHandler(StylesheetProperty sender, SaveEventArgs e); - /// - /// The new event handler - /// - public delegate void NewEventHandler(StylesheetProperty sender, NewEventArgs e); - /// - /// The delete event handler - /// - public delegate void DeleteEventHandler(StylesheetProperty sender, DeleteEventArgs e); - - - /// - /// Occurs when [before save]. - /// - new public static event SaveEventHandler BeforeSave; - /// - /// Raises the event. - /// - /// The instance containing the event data. - new protected virtual void FireBeforeSave(SaveEventArgs e) { - if (BeforeSave != null) - BeforeSave(this, e); - } - - /// - /// Occurs when [after save]. - /// - new public static event SaveEventHandler AfterSave; - /// - /// Raises the event. - /// - /// The instance containing the event data. - new protected virtual void FireAfterSave(SaveEventArgs e) { - if (AfterSave != null) - AfterSave(this, e); - } - - /// - /// Occurs when [new]. - /// - public static event NewEventHandler New; - /// - /// Raises the event. - /// - /// The instance containing the event data. - protected virtual void OnNew(NewEventArgs e) { - if (New != null) - New(this, e); - } - - /// - /// Occurs when [before delete]. - /// - new public static event DeleteEventHandler BeforeDelete; - /// - /// Raises the event. - /// - /// The instance containing the event data. - new protected virtual void FireBeforeDelete(DeleteEventArgs e) { - if (BeforeDelete != null) - BeforeDelete(this, e); - } - - /// - /// Occurs when [after delete]. - /// - new public static event DeleteEventHandler AfterDelete; - /// - /// Raises the event. - /// - /// The instance containing the event data. - new protected virtual void FireAfterDelete(DeleteEventArgs e) { - if (AfterDelete != null) - AfterDelete(this, e); - } + } } diff --git a/src/umbraco.cms/businesslogic/workflow/Notification.cs b/src/umbraco.cms/businesslogic/workflow/Notification.cs deleted file mode 100644 index 860e55600c..0000000000 --- a/src/umbraco.cms/businesslogic/workflow/Notification.cs +++ /dev/null @@ -1,174 +0,0 @@ -using Umbraco.Core.Models; -using Umbraco.Core.Services; -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Web; -using Umbraco.Core; -using Umbraco.Core.Configuration; -using Umbraco.Core.Logging; -using umbraco.BusinessLogic; -using umbraco.cms.businesslogic.web; -using Umbraco.Core.Models.Rdbms; -using umbraco.DataLayer; -using Umbraco.Core.Models; -using Umbraco.Core.Models.Membership; - -namespace umbraco.cms.businesslogic.workflow -{ - //TODO: Update this to wrap new services/repo! - - /// - /// Notifications are a part of the umbraco workflow. - /// A notification is created every time an action on a node occurs and a umbraco user has subscribed to this specific action on this specific node. - /// Notifications generates an email, which is send to the subscribing users. - /// - public class Notification - { - /// - /// Private constructor as this object should not be allowed to be created currently - /// - private Notification() - { - } - - public int NodeId { get; private set; } - public int UserId { get; private set; } - public char ActionId { get; private set; } - - /// - /// Gets the SQL helper. - /// - /// The SQL helper. - [Obsolete("Obsolete, For querying the database use the new UmbracoDatabase object ApplicationContext.Current.DatabaseContext.Database", false)] - protected static ISqlHelper SqlHelper - { - get { return LegacySqlHelper.SqlHelper; } - } - - /// - /// Returns the notifications for a user - /// - /// - /// - public static IEnumerable GetUserNotifications(IUser user) - { - var items = new List(); - var dtos = ApplicationContext.Current.DatabaseContext.Database.Fetch( - "WHERE userId = @UserId ORDER BY nodeId", new { UserId = user.Id }); - - foreach (var dto in dtos) - { - items.Add(new Notification - { - NodeId = dto.NodeId, - ActionId = Convert.ToChar(dto.Action), - UserId = dto.UserId - }); - } - - return items; - } - - /// - /// Returns the notifications for a node - /// - /// - /// - public static IEnumerable GetNodeNotifications(CMSNode node) - { - var items = new List(); - var dtos = ApplicationContext.Current.DatabaseContext.Database.Fetch( - "WHERE userId = @UserId ORDER BY nodeId", new { nodeId = node.Id }); - - foreach (var dto in dtos) - { - items.Add(new Notification - { - NodeId = dto.NodeId, - ActionId = Convert.ToChar(dto.Action), - UserId = dto.UserId - }); - } - return items; - } - - /// - /// Deletes notifications by node - /// - /// - public static void DeleteNotifications(CMSNode node) - { - // delete all settings on the node for this node id - ApplicationContext.Current.DatabaseContext.Database.Delete("WHERE nodeId = @nodeId", - new {nodeId = node.Id}); - } - - /// - /// Delete notifications by user - /// - /// - public static void DeleteNotifications(IUser user) - { - // delete all settings on the node for this node id - ApplicationContext.Current.DatabaseContext.Database.Delete("WHERE userId = @userId", - new { userId = user.Id }); - } - - /// - /// Delete notifications by user and node - /// - /// - /// - public static void DeleteNotifications(IUser user, CMSNode node) - { - // delete all settings on the node for this user - ApplicationContext.Current.DatabaseContext.Database.Delete( - "WHERE userId = @userId AND nodeId = @nodeId", new {userId = user.Id, nodeId = node.Id}); - } - - /// - /// Creates a new notification - /// - /// The user. - /// The node. - /// The action letter. - [MethodImpl(MethodImplOptions.Synchronized)] - public static void MakeNew(IUser user, CMSNode node, char actionLetter) - { - bool exists = ApplicationContext.Current.DatabaseContext.Database.ExecuteScalar( - "SELECT COUNT(userId) FROM umbracoUser2nodeNotify WHERE userId = @userId AND nodeId = @nodeId AND action = @action", - new { userId = user.Id, nodeId = node.Id, action = actionLetter.ToString()}) > 0; - - if (exists == false) - { - ApplicationContext.Current.DatabaseContext.Database.Insert(new User2NodeNotifyDto - { - Action = actionLetter.ToString(), - NodeId = node.Id, - UserId = user.Id - }); - } - } - - /// - /// Updates the notifications. - /// - /// The user. - /// The node. - /// The notifications. - [MethodImpl(MethodImplOptions.Synchronized)] - public static void UpdateNotifications(IUser user, CMSNode node, string notifications) - { - // delete all settings on the node for this user - DeleteNotifications(user, node); - - // Loop through the permissions and create them - foreach (char c in notifications) - MakeNew(user, node, c); - } - - } -} \ No newline at end of file diff --git a/src/umbraco.cms/packages.config b/src/umbraco.cms/packages.config index 05f1a708b6..c00e2f0c3d 100644 --- a/src/umbraco.cms/packages.config +++ b/src/umbraco.cms/packages.config @@ -2,6 +2,6 @@ - + \ No newline at end of file diff --git a/src/umbraco.cms/umbraco.cms.csproj b/src/umbraco.cms/umbraco.cms.csproj index 1858e57393..492272eb1d 100644 --- a/src/umbraco.cms/umbraco.cms.csproj +++ b/src/umbraco.cms/umbraco.cms.csproj @@ -119,8 +119,8 @@ ..\packages\SharpZipLib.0.86.0\lib\20\ICSharpCode.SharpZipLib.dll - - ..\packages\Newtonsoft.Json.6.0.8\lib\net45\Newtonsoft.Json.dll + + ..\packages\Newtonsoft.Json.8.0.3\lib\net45\Newtonsoft.Json.dll True @@ -164,8 +164,6 @@ - - @@ -178,13 +176,9 @@ - Code - - Code - Code @@ -197,7 +191,6 @@ Code - Code @@ -247,7 +240,6 @@ Code - Code @@ -274,9 +266,6 @@ Code - - Code - diff --git a/src/umbraco.controls/DataAttributes.cs b/src/umbraco.controls/DataAttributes.cs index f600c12de1..4d4de193a3 100644 --- a/src/umbraco.controls/DataAttributes.cs +++ b/src/umbraco.controls/DataAttributes.cs @@ -10,21 +10,6 @@ namespace umbraco.uicontrols { internal class DataAttributes : Dictionary { - public DataAttributes() - { - - } - - public string Render() - { - var sb = new StringBuilder(); - foreach(var keyval in this) - { - sb.Append("data-" + keyval.Key + "='" + keyval.Value + "' "); - } - - return sb.ToString().Trim(); - } public void AppendTo(WebControl c) { diff --git a/src/umbraco.controls/MenuIcon.cs b/src/umbraco.controls/MenuIcon.cs index 53b21bc657..451d10d093 100644 --- a/src/umbraco.controls/MenuIcon.cs +++ b/src/umbraco.controls/MenuIcon.cs @@ -9,13 +9,7 @@ namespace umbraco.uicontrols { { private string _OnClickCommand = ""; private string _AltText = "init"; - - - public string ID1 { - get { return this.ID; } - set { this.ID = value; } - } - + public string AltText { get { return this.AlternateText; } set { diff --git a/src/umbraco.controls/MenuSplitButton.cs b/src/umbraco.controls/MenuSplitButton.cs index 64b553ee6b..ada1dfb3ef 100644 --- a/src/umbraco.controls/MenuSplitButton.cs +++ b/src/umbraco.controls/MenuSplitButton.cs @@ -15,14 +15,7 @@ namespace umbraco.uicontrols public string OnClientClick { get; set; } - public void AddLink(HtmlAnchor link) - { - if(HtmlAnchors == null) - HtmlAnchors = new List(); - - HtmlAnchors.Add(link); - } - + protected override void Render(System.Web.UI.HtmlTextWriter writer) { writer.Write(""); diff --git a/src/umbraco.controls/ScrollingMenu.cs b/src/umbraco.controls/ScrollingMenu.cs index 4cdbf88774..c1a9ef6182 100644 --- a/src/umbraco.controls/ScrollingMenu.cs +++ b/src/umbraco.controls/ScrollingMenu.cs @@ -29,13 +29,6 @@ namespace umbraco.uicontrols return icon; } - internal MenuSplitButton NewSplitButton() - { - var menu = new MenuSplitButton(); - Icons.Add(menu); - return menu; - } - public MenuButton NewButton(int index = -1) { MenuButton btn = new MenuButton(); diff --git a/src/umbraco.controls/app.config b/src/umbraco.controls/app.config index 84d45d20fd..65f505d522 100644 --- a/src/umbraco.controls/app.config +++ b/src/umbraco.controls/app.config @@ -12,7 +12,7 @@ - + diff --git a/src/umbraco.datalayer/app.config b/src/umbraco.datalayer/app.config index 1ec9d6e3d6..cb532bd57a 100644 --- a/src/umbraco.datalayer/app.config +++ b/src/umbraco.datalayer/app.config @@ -4,7 +4,7 @@ - +