From de776f86a4263594b5b25fe7267b2c0b8093698c Mon Sep 17 00:00:00 2001 From: Shannon Date: Tue, 22 Dec 2015 19:25:10 +0100 Subject: [PATCH] Lots of code cleanup, lots of unused/obsolete classes & files removed. --- src/Umbraco.Core/IO/IOHelper.cs | 48 +- .../Repositories/DomainRepositoryTest.cs | 3 - .../Plugins/PluginManagerTests.cs | 8 - .../Routing/UmbracoModuleTests.cs | 7 - src/Umbraco.Tests/TestHelpers/BaseWebTest.cs | 18 - src/Umbraco.Tests/UI/LegacyDialogTests.cs | 30 +- .../UserControlProxy.aspx.designer.cs | 4 +- .../umbraco/TreeInit.aspx.designer.cs | 4 +- .../Packages/DirectoryBrowser.aspx.cs | 2 +- .../umbraco/settings/views/EditView.aspx.cs | 2 +- .../FileUploadPropertyEditor.cs | 1 - .../FileUploadPropertyValueEditor.cs | 6 - src/Umbraco.Web/Security/WebSecurity.cs | 6 +- .../Trees/ApplicationTreeRegistrar.cs | 19 +- .../UmbracoClientDependencyLoader.cs | 93 ++- src/Umbraco.Web/UI/LegacyDialogTask.cs | 2 - .../UI/Pages/UmbracoEnsuredPage.cs | 7 +- src/Umbraco.Web/Umbraco.Web.csproj | 2 + .../UmbracoAuthorizedHttpHandler.cs | 9 +- .../UmbracoAuthorizedWebService.cs | 11 +- .../umbraco.presentation/library.cs | 42 +- .../umbraco/Trees/TreeService.cs | 11 +- .../umbraco/Trees/TreeUrlGenerator.cs | 189 +++++ .../umbraco/Trees/UserPermissions.cs | 1 + .../umbraco/Trees/UserTypes.cs | 1 + .../umbraco/Trees/loadDictionary.cs | 4 +- .../umbraco/Trees/loadMacros.cs | 1 + .../umbraco/Trees/loadMemberGroups.cs | 1 + .../umbraco/Trees/loadPackager.cs | 1 + .../umbraco/Trees/loadPackages.cs | 1 + .../umbraco/Trees/loadRelationTypes.cs | 1 + .../umbraco/Trees/loadScripts.cs | 1 + .../umbraco/Trees/loadStylesheetProperty.cs | 1 + .../umbraco/Trees/loadStylesheets.cs | 1 + .../umbraco/Trees/loadUsers.cs | 1 + .../umbraco/Trees/loadXslt.cs | 1 + .../umbraco/actions/preview.aspx.cs | 3 +- .../umbraco/create/CreatedPackageTasks.cs | 3 +- .../umbraco/create/MemberGroupTasks.cs | 3 +- .../umbraco/create/PartialViewMacrosTasks.cs | 3 +- .../umbraco/create/PartialViewTasks.cs | 3 +- .../umbraco/create/ScriptTasks.cs | 2 +- .../umbraco/create/StylesheetTasks.cs | 2 +- .../umbraco/create/XsltTasks.cs | 2 +- .../umbraco/create/dictionaryTasks.cs | 3 +- .../umbraco/create/languageTasks.cs | 3 +- .../umbraco/create/macroTasks.cs | 3 +- .../umbraco/create/stylesheetPropertyTasks.cs | 2 +- .../umbraco/create/templateTasks.cs | 2 +- .../umbraco/create/userTasks.cs | 3 +- .../umbraco/dashboard/FeedProxy.aspx.cs | 5 +- .../developer/Macros/assemblyBrowser.aspx.cs | 2 +- .../developer/Macros/editMacro.aspx.cs | 2 +- .../Packages/BrowseRepository.aspx.cs | 3 +- .../developer/Packages/SubmitPackage.aspx.cs | 3 +- .../Packages/directoryBrowser.aspx.cs | 3 +- .../developer/Packages/editPackage.aspx.cs | 3 +- .../Packages/installedPackage.aspx.cs | 2 +- .../developer/Packages/installer.aspx.cs | 2 +- .../umbraco/developer/autoDoc.aspx.cs | 3 +- .../umbraco/dialogs/AssignDomain.aspx.cs | 3 +- .../umbraco/dialogs/Preview.aspx.cs | 3 +- .../umbraco/dialogs/RegexWs.aspx.cs | 3 +- .../umbraco/dialogs/SendPublish.aspx.cs | 3 +- .../umbraco/dialogs/cruds.aspx.cs | 2 +- .../dialogs/exportDocumenttype.aspx.cs | 3 +- .../dialogs/importDocumenttype.aspx.cs | 2 +- .../umbraco/dialogs/insertMacro.aspx.cs | 16 +- .../dialogs/insertMasterpageContent.aspx.cs | 3 +- .../insertMasterpagePlaceholder.aspx.cs | 3 +- .../umbraco/dialogs/notifications.aspx.cs | 3 +- .../umbraco/dialogs/protectPage.aspx.cs | 184 ++++- .../umbraco/dialogs/republish.aspx.cs | 2 +- .../umbraco/dialogs/rollBack.aspx.cs | 2 +- .../umbraco/dialogs/search.aspx.cs | 2 +- .../umbraco/dialogs/sendToTranslation.aspx.cs | 3 +- .../umbraco/dialogs/umbracoField.aspx.cs | 2 +- .../umbraco/dialogs/viewAuditTrail.aspx.cs | 3 +- .../masterpages/umbracoDialog.Master.cs | 3 +- .../umbraco/masterpages/umbracoPage.Master.cs | 3 +- .../umbraco/members/EditMemberGroup.aspx.cs | 3 +- .../umbraco/members/ViewMembers.aspx.cs | 3 +- .../umbraco/members/search.aspx.cs | 3 +- .../umbraco/publishStatus.aspx.cs | 3 +- .../umbraco/settings/editLanguage.aspx.cs | 2 +- .../umbraco/settings/editTemplate.aspx.cs | 2 +- .../settings/modals/ShowUmbracoTags.aspx.cs | 3 +- .../settings/scripts/editScript.aspx.cs | 2 +- .../stylesheet/editstylesheet.aspx.cs | 2 +- .../property/EditStyleSheetProperty.aspx.cs | 2 +- .../umbraco/translation/default.aspx.cs | 4 +- .../umbraco/translation/details.aspx.cs | 3 +- .../umbraco/translation/preview.aspx.cs | 3 +- .../umbraco/translation/xml.aspx.cs | 2 +- .../umbraco/treeInit.aspx.cs | 3 +- .../umbraco/users/EditUser.aspx.cs | 2 +- .../umbraco/users/EditUserType.aspx.cs | 3 +- .../umbraco/users/PermissionEditor.aspx.cs | 2 +- .../umbraco/users/UserTypeTasks.cs | 3 +- .../webservices/CacheRefresher.asmx.cs | 4 +- .../umbraco/webservices/Developer.asmx.cs | 4 +- .../umbraco/webservices/Settings.asmx.cs | 2 +- .../webservices/codeEditorSave.asmx.cs | 8 +- .../webservices/legacyAjaxCalls.asmx.cs | 24 +- .../umbraco/webservices/nodeSorter.asmx.cs | 4 +- .../umbraco/webservices/publication.asmx.cs | 9 +- .../umbraco/webservices/templates.asmx.cs | 8 +- .../umbraco/webservices/trashcan.asmx.cs | 5 +- .../BasePages/UmbracoEnsuredPage.cs | 7 +- src/umbraco.businesslogic/CacheHelper.cs | 31 - src/umbraco.businesslogic/DefaultApps.cs | 13 - .../Exceptions/FileSecurityException.cs | 23 - .../Exceptions/UserAuthorizationException.cs | 23 - src/umbraco.businesslogic/IconI.cs | 17 - .../PluginManagerExtensions.cs | 11 - src/umbraco.businesslogic/TreeAttribute.cs | 62 -- src/umbraco.businesslogic/Utils/fileHelper.cs | 37 - .../umbraco.businesslogic.csproj | 12 - src/umbraco.businesslogic/xmlHelper.cs | 119 ---- src/umbraco.cms/businesslogic/CMSNode.cs | 26 +- .../businesslogic/ContentItem/ContentItem.cs | 54 -- .../ContentItem/ContentItemType.cs | 67 -- src/umbraco.cms/businesslogic/ContentType.cs | 4 - src/umbraco.cms/businesslogic/Dictionary.cs | 2 +- src/umbraco.cms/businesslogic/Files/IFile.cs | 23 - .../Files/NotAnImageException.cs | 22 - .../businesslogic/Files/UmbracoFile.cs | 133 ---- .../businesslogic/ISaveHandlerContents.cs | 13 - .../{helper.cs => PackageHelper.cs} | 159 ++--- .../PackageActions/addApplicationTree.cs | 2 +- .../PackageActions/addProxyFeedHost.cs | 11 +- .../PackageActions/addStringToHtmlElement.cs | 23 +- .../businesslogic/Packager/data.cs | 58 +- src/umbraco.cms/businesslogic/ProviderBase.cs | 13 - src/umbraco.cms/businesslogic/RecycleBin.cs | 2 +- src/umbraco.cms/businesslogic/Tuple.cs | 38 - src/umbraco.cms/businesslogic/cache/Cache.cs | 124 ---- .../businesslogic/events/EventArgs.cs | 57 +- .../businesslogic/installer/IInstallerStep.cs | 14 - .../installer/InstallStepCollection.cs | 51 -- .../businesslogic/installer/InstallerStep.cs | 27 - .../businesslogic/member/Member.cs | 5 - .../businesslogic/template/Template.cs | 6 - .../businesslogic/utilities/Diff.cs | 655 ------------------ .../businesslogic/utilities/File.cs | 20 - .../businesslogic/utilities/Zip.cs | 59 -- src/umbraco.cms/businesslogic/web/Access.cs | 581 ---------------- src/umbraco.cms/businesslogic/web/Domain.cs | 10 - .../businesslogic/web/StyleSheet.cs | 20 +- .../businesslogic/web/StylesheetProperty.cs | 4 - .../businesslogic/workflow/Diff.cs | 522 -------------- src/umbraco.cms/umbraco.cms.csproj | 29 +- src/umbraco.controls/TreeUrlGenerator.cs | 202 ------ src/umbraco.controls/helper.cs | 49 -- src/umbraco.controls/umbraco.controls.csproj | 3 - 155 files changed, 823 insertions(+), 3591 deletions(-) rename src/{umbraco.controls => Umbraco.Web/UI/JavaScript}/UmbracoClientDependencyLoader.cs (75%) create mode 100644 src/Umbraco.Web/umbraco.presentation/umbraco/Trees/TreeUrlGenerator.cs delete mode 100644 src/umbraco.businesslogic/CacheHelper.cs delete mode 100644 src/umbraco.businesslogic/DefaultApps.cs delete mode 100644 src/umbraco.businesslogic/Exceptions/FileSecurityException.cs delete mode 100644 src/umbraco.businesslogic/Exceptions/UserAuthorizationException.cs delete mode 100644 src/umbraco.businesslogic/IconI.cs delete mode 100644 src/umbraco.businesslogic/TreeAttribute.cs delete mode 100644 src/umbraco.businesslogic/Utils/fileHelper.cs delete mode 100644 src/umbraco.businesslogic/xmlHelper.cs delete mode 100644 src/umbraco.cms/businesslogic/ContentItem/ContentItem.cs delete mode 100644 src/umbraco.cms/businesslogic/ContentItem/ContentItemType.cs delete mode 100644 src/umbraco.cms/businesslogic/Files/IFile.cs delete mode 100644 src/umbraco.cms/businesslogic/Files/NotAnImageException.cs delete mode 100644 src/umbraco.cms/businesslogic/Files/UmbracoFile.cs delete mode 100644 src/umbraco.cms/businesslogic/ISaveHandlerContents.cs rename src/umbraco.cms/businesslogic/Packager/PackageActions/{helper.cs => PackageHelper.cs} (89%) delete mode 100644 src/umbraco.cms/businesslogic/ProviderBase.cs delete mode 100644 src/umbraco.cms/businesslogic/Tuple.cs delete mode 100644 src/umbraco.cms/businesslogic/cache/Cache.cs delete mode 100644 src/umbraco.cms/businesslogic/installer/IInstallerStep.cs delete mode 100644 src/umbraco.cms/businesslogic/installer/InstallStepCollection.cs delete mode 100644 src/umbraco.cms/businesslogic/installer/InstallerStep.cs delete mode 100644 src/umbraco.cms/businesslogic/utilities/Diff.cs delete mode 100644 src/umbraco.cms/businesslogic/utilities/File.cs delete mode 100644 src/umbraco.cms/businesslogic/utilities/Zip.cs delete mode 100644 src/umbraco.cms/businesslogic/web/Access.cs delete mode 100644 src/umbraco.cms/businesslogic/workflow/Diff.cs delete mode 100644 src/umbraco.controls/TreeUrlGenerator.cs delete mode 100644 src/umbraco.controls/helper.cs diff --git a/src/Umbraco.Core/IO/IOHelper.cs b/src/Umbraco.Core/IO/IOHelper.cs index 286acf0285..cc58a8cc60 100644 --- a/src/Umbraco.Core/IO/IOHelper.cs +++ b/src/Umbraco.Core/IO/IOHelper.cs @@ -7,6 +7,7 @@ using System.Configuration; using System.Web; using System.Text.RegularExpressions; using System.Web.Hosting; +using ICSharpCode.SharpZipLib.Zip; using Umbraco.Core.Configuration; using Umbraco.Core.Logging; @@ -27,7 +28,52 @@ namespace Umbraco.Core.IO } } - //helper to try and match the old path to a new virtual one + internal static void UnZip(string zipFilePath, string unPackDirectory, bool deleteZipFile) + { + // Unzip + string tempDir = unPackDirectory; + Directory.CreateDirectory(tempDir); + + using (ZipInputStream s = new ZipInputStream(File.OpenRead(zipFilePath))) + { + ZipEntry theEntry; + while ((theEntry = s.GetNextEntry()) != null) + { + string directoryName = Path.GetDirectoryName(theEntry.Name); + string fileName = Path.GetFileName(theEntry.Name); + + if (fileName != String.Empty) + { + FileStream streamWriter = File.Create(tempDir + Path.DirectorySeparatorChar + fileName); + + int size = 2048; + byte[] data = new byte[2048]; + while (true) + { + size = s.Read(data, 0, data.Length); + if (size > 0) + { + streamWriter.Write(data, 0, size); + } + else + { + break; + } + } + + streamWriter.Close(); + + } + } + + // Clean up + s.Close(); + if (deleteZipFile) + File.Delete(zipFilePath); + } + } + + //helper to try and match the old path to a new virtual one public static string FindFile(string virtualPath) { string retval = virtualPath; diff --git a/src/Umbraco.Tests/Persistence/Repositories/DomainRepositoryTest.cs b/src/Umbraco.Tests/Persistence/Repositories/DomainRepositoryTest.cs index 9d3f9e696d..1b00f0089c 100644 --- a/src/Umbraco.Tests/Persistence/Repositories/DomainRepositoryTest.cs +++ b/src/Umbraco.Tests/Persistence/Repositories/DomainRepositoryTest.cs @@ -3,12 +3,9 @@ using System.Data; using System.Linq; using Moq; using NUnit.Framework; -using umbraco.cms.businesslogic.contentitem; -using Umbraco.Core; using Umbraco.Core.Configuration.UmbracoSettings; using Umbraco.Core.IO; using Umbraco.Core.Models; -using Umbraco.Core.Persistence.Querying; using Umbraco.Core.Persistence.Repositories; using Umbraco.Core.Persistence.UnitOfWork; using Umbraco.Tests.TestHelpers; diff --git a/src/Umbraco.Tests/Plugins/PluginManagerTests.cs b/src/Umbraco.Tests/Plugins/PluginManagerTests.cs index 330f871906..95d8be3ff2 100644 --- a/src/Umbraco.Tests/Plugins/PluginManagerTests.cs +++ b/src/Umbraco.Tests/Plugins/PluginManagerTests.cs @@ -274,14 +274,6 @@ namespace Umbraco.Tests.Plugins Assert.AreEqual(2, foundTypes1.Count()); } - [Test] - public void Resolves_Attributed_Trees() - { - var trees = _manager.ResolveAttributedTrees(); - // commit 6c5e35ec2cbfa31be6790d1228e0c2faf5f55bc8 brings the count down to 14 - Assert.AreEqual(14, trees.Count()); - } - [Test] public void Resolves_Actions() { diff --git a/src/Umbraco.Tests/Routing/UmbracoModuleTests.cs b/src/Umbraco.Tests/Routing/UmbracoModuleTests.cs index 3c3686aded..1bbf09f10d 100644 --- a/src/Umbraco.Tests/Routing/UmbracoModuleTests.cs +++ b/src/Umbraco.Tests/Routing/UmbracoModuleTests.cs @@ -1,18 +1,11 @@ using System; -using System.Configuration; using System.IO; -using System.Threading; -using System.Xml; using NUnit.Framework; using Umbraco.Core; using Umbraco.Core.Configuration; using Umbraco.Tests.TestHelpers; using Umbraco.Web; -using Umbraco.Web.Routing; -using umbraco.BusinessLogic; using Umbraco.Core.IO; -using umbraco.cms.businesslogic.cache; -using umbraco.cms.businesslogic.template; namespace Umbraco.Tests.Routing { diff --git a/src/Umbraco.Tests/TestHelpers/BaseWebTest.cs b/src/Umbraco.Tests/TestHelpers/BaseWebTest.cs index d3e5c070bc..49fb51c9d0 100644 --- a/src/Umbraco.Tests/TestHelpers/BaseWebTest.cs +++ b/src/Umbraco.Tests/TestHelpers/BaseWebTest.cs @@ -1,24 +1,6 @@ -using System; -using System.IO; -using System.Web.Routing; -using System.Xml; -using Moq; using NUnit.Framework; -using SQLCE4Umbraco; -using Umbraco.Core; -using Umbraco.Core.Configuration; -using Umbraco.Core.IO; using Umbraco.Core.Models.PublishedContent; -using Umbraco.Core.ObjectResolution; -using Umbraco.Core.Persistence; -using Umbraco.Core.Persistence.UnitOfWork; -using Umbraco.Core.Publishing; -using Umbraco.Core.Services; using Umbraco.Tests.PublishedContent; -using Umbraco.Web; -using Umbraco.Web.Routing; -using umbraco.BusinessLogic; -using umbraco.cms.businesslogic.cache; namespace Umbraco.Tests.TestHelpers { diff --git a/src/Umbraco.Tests/UI/LegacyDialogTests.cs b/src/Umbraco.Tests/UI/LegacyDialogTests.cs index 114d25b61d..af4571ea64 100644 --- a/src/Umbraco.Tests/UI/LegacyDialogTests.cs +++ b/src/Umbraco.Tests/UI/LegacyDialogTests.cs @@ -27,23 +27,23 @@ namespace Umbraco.Tests.UI } } - [TestCase(typeof(UserTypeTasks), DefaultApps.users)] - [TestCase(typeof(XsltTasks), DefaultApps.developer)] - [TestCase(typeof(userTasks), DefaultApps.users)] - [TestCase(typeof(templateTasks), DefaultApps.settings)] - [TestCase(typeof(StylesheetTasks), DefaultApps.settings)] - [TestCase(typeof(stylesheetPropertyTasks), DefaultApps.settings)] - [TestCase(typeof(ScriptTasks), DefaultApps.settings)] - [TestCase(typeof(MemberGroupTasks), DefaultApps.member)] - [TestCase(typeof(dictionaryTasks), DefaultApps.settings)] - [TestCase(typeof(macroTasks), DefaultApps.developer)] - [TestCase(typeof(languageTasks), DefaultApps.settings)] - [TestCase(typeof(CreatedPackageTasks), DefaultApps.developer)] - [TestCase(typeof(PartialViewTasks), DefaultApps.settings)] - public void Check_Assigned_Apps_For_Tasks(Type taskType, DefaultApps app) + [TestCase(typeof(UserTypeTasks), Constants.Applications.Users)] + [TestCase(typeof(XsltTasks), Constants.Applications.Developer)] + [TestCase(typeof(userTasks), Constants.Applications.Users)] + [TestCase(typeof(templateTasks), Constants.Applications.Settings)] + [TestCase(typeof(StylesheetTasks), Constants.Applications.Settings)] + [TestCase(typeof(stylesheetPropertyTasks), Constants.Applications.Settings)] + [TestCase(typeof(ScriptTasks), Constants.Applications.Settings)] + [TestCase(typeof(MemberGroupTasks), Constants.Applications.Members)] + [TestCase(typeof(dictionaryTasks), Constants.Applications.Settings)] + [TestCase(typeof(macroTasks), Constants.Applications.Developer)] + [TestCase(typeof(languageTasks), Constants.Applications.Settings)] + [TestCase(typeof(CreatedPackageTasks), Constants.Applications.Developer)] + [TestCase(typeof(PartialViewTasks), Constants.Applications.Settings)] + public void Check_Assigned_Apps_For_Tasks(Type taskType, string app) { var task = (LegacyDialogTask)Activator.CreateInstance(taskType); - Assert.AreEqual(task.AssignedApp, app.ToString()); + Assert.AreEqual(task.AssignedApp, app); } } diff --git a/src/Umbraco.Web.UI/Umbraco/dashboard/UserControlProxy.aspx.designer.cs b/src/Umbraco.Web.UI/Umbraco/dashboard/UserControlProxy.aspx.designer.cs index 19ac019a8f..d06b6c84e0 100644 --- a/src/Umbraco.Web.UI/Umbraco/dashboard/UserControlProxy.aspx.designer.cs +++ b/src/Umbraco.Web.UI/Umbraco/dashboard/UserControlProxy.aspx.designer.cs @@ -7,6 +7,8 @@ // //------------------------------------------------------------------------------ +using Umbraco.Web.UI.JavaScript; + namespace Umbraco.Web.UI.Umbraco.Dashboard { @@ -19,7 +21,7 @@ namespace Umbraco.Web.UI.Umbraco.Dashboard { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.UmbracoClientDependencyLoader ClientLoader; + protected UmbracoClientDependencyLoader ClientLoader; /// /// CssInclude1 control. diff --git a/src/Umbraco.Web.UI/umbraco/TreeInit.aspx.designer.cs b/src/Umbraco.Web.UI/umbraco/TreeInit.aspx.designer.cs index 754bf6ba81..b2909a2835 100644 --- a/src/Umbraco.Web.UI/umbraco/TreeInit.aspx.designer.cs +++ b/src/Umbraco.Web.UI/umbraco/TreeInit.aspx.designer.cs @@ -7,6 +7,8 @@ // //------------------------------------------------------------------------------ +using Umbraco.Web.UI.JavaScript; + namespace Umbraco.Web.UI.Umbraco { @@ -28,7 +30,7 @@ namespace Umbraco.Web.UI.Umbraco { /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.UmbracoClientDependencyLoader ClientLoader; + protected UmbracoClientDependencyLoader ClientLoader; /// /// CssInclude1 control. diff --git a/src/Umbraco.Web.UI/umbraco/developer/Packages/DirectoryBrowser.aspx.cs b/src/Umbraco.Web.UI/umbraco/developer/Packages/DirectoryBrowser.aspx.cs index c2995b6793..97283a2b72 100644 --- a/src/Umbraco.Web.UI/umbraco/developer/Packages/DirectoryBrowser.aspx.cs +++ b/src/Umbraco.Web.UI/umbraco/developer/Packages/DirectoryBrowser.aspx.cs @@ -17,7 +17,7 @@ namespace Umbraco.Web.UI.Umbraco.Developer.Packages { public DirectoryBrowser() { - CurrentApp = DefaultApps.developer.ToString(); + CurrentApp = Constants.Applications.Developer; } string _lsScriptName; diff --git a/src/Umbraco.Web.UI/umbraco/settings/views/EditView.aspx.cs b/src/Umbraco.Web.UI/umbraco/settings/views/EditView.aspx.cs index 823ee23296..2a44431028 100644 --- a/src/Umbraco.Web.UI/umbraco/settings/views/EditView.aspx.cs +++ b/src/Umbraco.Web.UI/umbraco/settings/views/EditView.aspx.cs @@ -26,7 +26,7 @@ namespace Umbraco.Web.UI.Umbraco.Settings.Views public EditView() { - CurrentApp = global::umbraco.BusinessLogic.DefaultApps.settings.ToString(); + CurrentApp = Constants.Applications.Settings; } /// diff --git a/src/Umbraco.Web/PropertyEditors/FileUploadPropertyEditor.cs b/src/Umbraco.Web/PropertyEditors/FileUploadPropertyEditor.cs index d4864c9243..9b4e722b30 100644 --- a/src/Umbraco.Web/PropertyEditors/FileUploadPropertyEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/FileUploadPropertyEditor.cs @@ -8,7 +8,6 @@ using System.Text.RegularExpressions; using System.Xml; using Newtonsoft.Json; using Newtonsoft.Json.Linq; -using umbraco.cms.businesslogic.Files; using Umbraco.Core; using Umbraco.Core.Configuration; using Umbraco.Core.Configuration.UmbracoSettings; diff --git a/src/Umbraco.Web/PropertyEditors/FileUploadPropertyValueEditor.cs b/src/Umbraco.Web/PropertyEditors/FileUploadPropertyValueEditor.cs index 4729b736d4..50cd5a5c2d 100644 --- a/src/Umbraco.Web/PropertyEditors/FileUploadPropertyValueEditor.cs +++ b/src/Umbraco.Web/PropertyEditors/FileUploadPropertyValueEditor.cs @@ -4,19 +4,13 @@ using System.Drawing; using System.Globalization; using System.IO; using System.Linq; -using Newtonsoft.Json; using Newtonsoft.Json.Linq; -using Umbraco.Core.Configuration; using Umbraco.Core.Configuration.UmbracoSettings; using Umbraco.Core.IO; -using Umbraco.Core.Logging; using Umbraco.Core.Media; using Umbraco.Core.Models.Editors; using Umbraco.Core.PropertyEditors; using Umbraco.Web.Models.ContentEditing; -using umbraco; -using umbraco.cms.businesslogic.Files; -using Umbraco.Core; namespace Umbraco.Web.PropertyEditors { diff --git a/src/Umbraco.Web/Security/WebSecurity.cs b/src/Umbraco.Web/Security/WebSecurity.cs index eb0a1eb66a..997383c254 100644 --- a/src/Umbraco.Web/Security/WebSecurity.cs +++ b/src/Umbraco.Web/Security/WebSecurity.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; -using System.ComponentModel; using System.Linq; +using System.Security; using System.Web; using System.Web.Security; using AutoMapper; @@ -11,8 +11,6 @@ using Umbraco.Core.Models.Membership; using Umbraco.Core.Security; using Microsoft.AspNet.Identity.Owin; using Microsoft.Owin; -using umbraco.businesslogic.Exceptions; -using Umbraco.Web.Models.ContentEditing; using GlobalSettings = Umbraco.Core.Configuration.GlobalSettings; using User = umbraco.BusinessLogic.User; @@ -398,7 +396,7 @@ namespace Umbraco.Web.Security // check for secure connection if (GlobalSettings.UseSSL && _httpContext.Request.IsSecureConnection == false) { - if (throwExceptions) throw new UserAuthorizationException("This installation requires a secure connection (via SSL). Please update the URL to include https://"); + if (throwExceptions) throw new SecurityException("This installation requires a secure connection (via SSL). Please update the URL to include https://"); return ValidateRequestAttempt.FailedNoSsl; } return ValidateCurrentUser(throwExceptions); diff --git a/src/Umbraco.Web/Trees/ApplicationTreeRegistrar.cs b/src/Umbraco.Web/Trees/ApplicationTreeRegistrar.cs index 60ea0aabd8..314cc9142e 100644 --- a/src/Umbraco.Web/Trees/ApplicationTreeRegistrar.cs +++ b/src/Umbraco.Web/Trees/ApplicationTreeRegistrar.cs @@ -48,24 +48,7 @@ namespace Umbraco.Web.Trees added.AddRange(items.Select(x => x.Alias)); - //find the legacy trees - var legacyTreeTypes = PluginManager.Current.ResolveAttributedTrees(); - //convert them to ApplicationTree instances - var legacyItems = legacyTreeTypes - .Select(x => - new Tuple( - x, - x.GetCustomAttributes(false).SingleOrDefault(), - x.GetCustomAttributes(false).SingleOrDefault())) - //ensure that the legacy tree attribute exists - .Where(x => x.Item2 != null) - //ensure that it's not obsoleted, any obsoleted tree will not be auto added to the config - .Where(x => x.Item3 == null) - //make sure the legacy tree isn't added on top of the controller tree! - .Where(x => added.InvariantContains(x.Item2.Alias) == false) - .Select(x => new ApplicationTree(x.Item2.Initialize, x.Item2.SortOrder, x.Item2.ApplicationAlias, x.Item2.Alias, x.Item2.Title, x.Item2.IconClosed, x.Item2.IconOpen, x.Item1.GetFullNameWithAssembly())); - - return items.Concat(legacyItems).ToArray(); + return items.ToArray(); }); } diff --git a/src/umbraco.controls/UmbracoClientDependencyLoader.cs b/src/Umbraco.Web/UI/JavaScript/UmbracoClientDependencyLoader.cs similarity index 75% rename from src/umbraco.controls/UmbracoClientDependencyLoader.cs rename to src/Umbraco.Web/UI/JavaScript/UmbracoClientDependencyLoader.cs index 8838bcf90b..e4eaaefc14 100644 --- a/src/umbraco.controls/UmbracoClientDependencyLoader.cs +++ b/src/Umbraco.Web/UI/JavaScript/UmbracoClientDependencyLoader.cs @@ -1,49 +1,44 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Web.UI; -using ClientDependency.Core.Controls; -using ClientDependency.Core.FileRegistration.Providers; -using Umbraco.Core.IO; - -namespace umbraco.uicontrols -{ - - /// - /// Used to load in all client dependencies for Umbraco. - /// Ensures that both UmbracoClient and UmbracoRoot paths are added to the loader. - /// - public class UmbracoClientDependencyLoader : ClientDependencyLoader - { - /// - /// Set the defaults - /// - public UmbracoClientDependencyLoader() - : base() - { - this.AddPath("UmbracoClient", IOHelper.ResolveUrl( SystemDirectories.UmbracoClient )); - this.AddPath("UmbracoRoot", IOHelper.ResolveUrl( SystemDirectories.Umbraco )); - this.ProviderName = LoaderControlProvider.DefaultName; - - } - - public static ClientDependencyLoader TryCreate(Control parent, out bool isNew) - { - if (ClientDependencyLoader.Instance == null) - { - var loader = new UmbracoClientDependencyLoader(); - parent.Controls.Add(loader); - isNew = true; - return loader; - } - else - { - isNew = false; - return ClientDependencyLoader.Instance; - } - - } - - } -} +using System.Web.UI; +using ClientDependency.Core.Controls; +using ClientDependency.Core.FileRegistration.Providers; +using Umbraco.Core.IO; + +namespace Umbraco.Web.UI.JavaScript +{ + /// + /// Used to load in all client dependencies for Umbraco. + /// Ensures that both UmbracoClient and UmbracoRoot paths are added to the loader. + /// + public class UmbracoClientDependencyLoader : ClientDependencyLoader + { + /// + /// Set the defaults + /// + public UmbracoClientDependencyLoader() + : base() + { + this.AddPath("UmbracoClient", IOHelper.ResolveUrl(SystemDirectories.UmbracoClient)); + this.AddPath("UmbracoRoot", IOHelper.ResolveUrl(SystemDirectories.Umbraco)); + this.ProviderName = LoaderControlProvider.DefaultName; + + } + + public static ClientDependencyLoader TryCreate(Control parent, out bool isNew) + { + if (ClientDependencyLoader.Instance == null) + { + var loader = new UmbracoClientDependencyLoader(); + parent.Controls.Add(loader); + isNew = true; + return loader; + } + else + { + isNew = false; + return ClientDependencyLoader.Instance; + } + + } + + } +} \ No newline at end of file diff --git a/src/Umbraco.Web/UI/LegacyDialogTask.cs b/src/Umbraco.Web/UI/LegacyDialogTask.cs index 1975021121..63a365872b 100644 --- a/src/Umbraco.Web/UI/LegacyDialogTask.cs +++ b/src/Umbraco.Web/UI/LegacyDialogTask.cs @@ -2,10 +2,8 @@ using System.Collections.Generic; using System.Linq; using System.Security.Authentication; -using System.Text; using Umbraco.Core; using umbraco.BusinessLogic; -using umbraco.businesslogic.Exceptions; using umbraco.interfaces; namespace Umbraco.Web.UI diff --git a/src/Umbraco.Web/UI/Pages/UmbracoEnsuredPage.cs b/src/Umbraco.Web/UI/Pages/UmbracoEnsuredPage.cs index c09fd0fa0c..881031306d 100644 --- a/src/Umbraco.Web/UI/Pages/UmbracoEnsuredPage.cs +++ b/src/Umbraco.Web/UI/Pages/UmbracoEnsuredPage.cs @@ -1,12 +1,9 @@ using System; -using System.Linq; +using System.Security; using System.Web; using Umbraco.Core.IO; using Umbraco.Core.Logging; -using Umbraco.Web.Security; -using umbraco; using umbraco.BusinessLogic; -using umbraco.businesslogic.Exceptions; using Umbraco.Core; using Umbraco.Core.Security; @@ -63,7 +60,7 @@ namespace Umbraco.Web.UI.Pages if (!Security.ValidateUserApp(CurrentApp)) { - var ex = new UserAuthorizationException(String.Format("The current user doesn't have access to the section/app '{0}'", CurrentApp)); + var ex = new SecurityException(String.Format("The current user doesn't have access to the section/app '{0}'", CurrentApp)); LogHelper.Error(String.Format("Tried to access '{0}'", CurrentApp), ex); throw ex; } diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 0f0f5c1a1a..a6dd129cd4 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -349,6 +349,8 @@ + + diff --git a/src/Umbraco.Web/WebServices/UmbracoAuthorizedHttpHandler.cs b/src/Umbraco.Web/WebServices/UmbracoAuthorizedHttpHandler.cs index 84f684ca50..79a5af8bf5 100644 --- a/src/Umbraco.Web/WebServices/UmbracoAuthorizedHttpHandler.cs +++ b/src/Umbraco.Web/WebServices/UmbracoAuthorizedHttpHandler.cs @@ -1,13 +1,8 @@ using System; -using System.Linq; -using System.Web; -using System.Web.Security; +using System.Security; using Umbraco.Core; using Umbraco.Web.Security; -using umbraco; -using umbraco.BasePages; using umbraco.BusinessLogic; -using umbraco.businesslogic.Exceptions; namespace Umbraco.Web.WebServices { @@ -64,7 +59,7 @@ namespace Umbraco.Web.WebServices } var hasAccess = UserHasAppAccess(app, UmbracoUser); if (!hasAccess && throwExceptions) - throw new UserAuthorizationException("The user does not have access to the required application"); + throw new SecurityException("The user does not have access to the required application"); return hasAccess; } diff --git a/src/Umbraco.Web/WebServices/UmbracoAuthorizedWebService.cs b/src/Umbraco.Web/WebServices/UmbracoAuthorizedWebService.cs index 8ad4e99ceb..f73a20dd11 100644 --- a/src/Umbraco.Web/WebServices/UmbracoAuthorizedWebService.cs +++ b/src/Umbraco.Web/WebServices/UmbracoAuthorizedWebService.cs @@ -1,15 +1,8 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Web; -using System.Web.Security; -using Umbraco.Core.Configuration; +using System.Security; using Umbraco.Web.Security; -using umbraco.BasePages; using umbraco.BusinessLogic; using Umbraco.Core; -using umbraco.businesslogic.Exceptions; namespace Umbraco.Web.WebServices { @@ -69,7 +62,7 @@ namespace Umbraco.Web.WebServices } var hasAccess = UserHasAppAccess(app, UmbracoUser); if (!hasAccess && throwExceptions) - throw new UserAuthorizationException("The user does not have access to the required application"); + throw new SecurityException("The user does not have access to the required application"); return hasAccess; } diff --git a/src/Umbraco.Web/umbraco.presentation/library.cs b/src/Umbraco.Web/umbraco.presentation/library.cs index 4c3fabe832..b659ea42cc 100644 --- a/src/Umbraco.Web/umbraco.presentation/library.cs +++ b/src/Umbraco.Web/umbraco.presentation/library.cs @@ -573,11 +573,21 @@ namespace umbraco { XmlDocument xd = new XmlDocument(); xd.LoadXml(""); - foreach (string role in Access.GetAccessingMembershipRoles(documentId, path)) - xd.DocumentElement.AppendChild(xmlHelper.addTextNode(xd, "role", role)); + foreach (string role in GetAccessingMembershipRoles(documentId, path)) + xd.DocumentElement.AppendChild(XmlHelper.AddTextNode(xd, "role", role)); return xd.CreateNavigator().Select("."); } + private static string[] GetAccessingMembershipRoles(int documentId, string path) + { + var entry = ApplicationContext.Current.Services.PublicAccessService.GetEntryForContent(path.EnsureEndsWith("," + documentId)); + if (entry == null) return new string[] { }; + + var memberGroupRoleRules = entry.Rules.Where(x => x.RuleType == Constants.Conventions.PublicAccess.MemberRoleRuleType); + return memberGroupRoleRules.Select(x => x.RuleValue).ToArray(); + + } + /// /// Check if a document object is protected by the "Protect Pages" functionality in umbraco /// @@ -1160,7 +1170,7 @@ namespace umbraco xd.LoadXml(""); foreach (string id in values) { - XmlNode node = xmlHelper.addTextNode(xd, "value", id); + XmlNode node = XmlHelper.AddTextNode(xd, "value", id); xd.DocumentElement.AppendChild(node); } XPathNavigator xp = xd.CreateNavigator(); @@ -1229,8 +1239,8 @@ namespace umbraco { while (dr.Read()) { - XmlNode n = xmlHelper.addTextNode(xd, "preValue", dr.GetString("value")); - n.Attributes.Append(xmlHelper.addAttribute(xd, "id", dr.GetInt("id").ToString())); + XmlNode n = XmlHelper.AddTextNode(xd, "preValue", dr.GetString("value")); + n.Attributes.Append(XmlHelper.AddAttribute(xd, "id", dr.GetInt("id").ToString())); xd.DocumentElement.AppendChild(n); } } @@ -1284,22 +1294,22 @@ namespace umbraco try { if (languageId != 0) - xe = xmlHelper.addTextNode(xd, "DictionaryItem", item.Value(languageId)); + xe = XmlHelper.AddTextNode(xd, "DictionaryItem", item.Value(languageId)); else - xe = xmlHelper.addTextNode(xd, "DictionaryItem", item.Value()); + xe = XmlHelper.AddTextNode(xd, "DictionaryItem", item.Value()); } catch { - xe = xmlHelper.addTextNode(xd, "DictionaryItem", string.Empty); + xe = XmlHelper.AddTextNode(xd, "DictionaryItem", string.Empty); } - xe.Attributes.Append(xmlHelper.addAttribute(xd, "key", item.key)); + xe.Attributes.Append(XmlHelper.AddAttribute(xd, "key", item.key)); xd.DocumentElement.AppendChild(xe); } } catch (Exception ee) { xd.DocumentElement.AppendChild( - xmlHelper.addTextNode(xd, "Error", ee.ToString())); + XmlHelper.AddTextNode(xd, "Error", ee.ToString())); } XPathNavigator xp = xd.CreateNavigator(); @@ -1783,12 +1793,12 @@ namespace umbraco foreach (Relation r in rels) { XmlElement n = xd.CreateElement("relation"); - n.AppendChild(xmlHelper.addCDataNode(xd, "comment", r.Comment)); - n.Attributes.Append(xmlHelper.addAttribute(xd, "typeId", r.RelType.Id.ToString())); - n.Attributes.Append(xmlHelper.addAttribute(xd, "typeName", r.RelType.Name)); - n.Attributes.Append(xmlHelper.addAttribute(xd, "createDate", r.CreateDate.ToString())); - n.Attributes.Append(xmlHelper.addAttribute(xd, "parentId", r.Parent.Id.ToString())); - n.Attributes.Append(xmlHelper.addAttribute(xd, "childId", r.Child.Id.ToString())); + n.AppendChild(XmlHelper.AddCDataNode(xd, "comment", r.Comment)); + n.Attributes.Append(XmlHelper.AddAttribute(xd, "typeId", r.RelType.Id.ToString())); + n.Attributes.Append(XmlHelper.AddAttribute(xd, "typeName", r.RelType.Name)); + n.Attributes.Append(XmlHelper.AddAttribute(xd, "createDate", r.CreateDate.ToString())); + n.Attributes.Append(XmlHelper.AddAttribute(xd, "parentId", r.Parent.Id.ToString())); + n.Attributes.Append(XmlHelper.AddAttribute(xd, "childId", r.Child.Id.ToString())); // Append the node that isn't the one we're getting the related nodes from if (NodeId == r.Child.Id) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/TreeService.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/TreeService.cs index 04fac24ac9..2c1d17f830 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/TreeService.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/TreeService.cs @@ -3,12 +3,11 @@ using umbraco.uicontrols; namespace umbraco.cms.presentation.Trees { - - /// - /// A utility class to aid in creating the URL for returning XML for a tree structure and - /// for reading the parameters from the URL when a request is made. - /// - public class TreeService : TreeUrlGenerator, ITreeService + /// + /// A utility class to aid in creating the URL for returning XML for a tree structure and + /// for reading the parameters from the URL when a request is made. + /// + public class TreeService : TreeUrlGenerator, ITreeService { /// diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/TreeUrlGenerator.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/TreeUrlGenerator.cs new file mode 100644 index 0000000000..6bf18a9202 --- /dev/null +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/TreeUrlGenerator.cs @@ -0,0 +1,189 @@ +using System; +using System.Text; + +namespace umbraco.cms.presentation.Trees +{ + /// + /// This class will generate the URLs for iframe tree pages. + /// Generally used to get the a tree picker url. + /// + /// + /// This was created in 4.1 so that this helper class can be exposed to other assemblies since + /// it only existed in the presentation assembly in previous versions + /// + public class TreeUrlGenerator + { + + public const string TREE_URL = "tree.aspx"; + public const string INIT_URL = "treeinit.aspx"; + public const string PICKER_URL = "treepicker.aspx"; + + private int? m_startNodeID; + private string m_treeType; + private bool? m_showContextMenu; + private bool? m_isDialog; + private string m_app; + private string m_nodeKey; + private string m_functionToCall; + + #region Public Properties + + public string FunctionToCall + { + get { return m_functionToCall; } + set { m_functionToCall = value; } + } + + public string NodeKey + { + get { return m_nodeKey; } + set { m_nodeKey = value; } + } + + public int StartNodeID + { + get { return m_startNodeID ?? -1; } + set { m_startNodeID = value; } + } + + public string TreeType + { + get { return m_treeType; } + set { m_treeType = value; } + } + + public bool ShowContextMenu + { + get { return m_showContextMenu ?? true; } + set { m_showContextMenu = value; } + } + + public bool IsDialog + { + get { return m_isDialog ?? false; } + set { m_isDialog = value; } + } + + public string App + { + get { return m_app; } + set { m_app = value; } + } + #endregion + + /// + /// Returns the url for servicing the xml tree request based on the parameters specified on this class. + /// + /// Tree service url as a string + public string GetServiceUrl() + { + return Umbraco.Core.IO.IOHelper.ResolveUrl(Umbraco.Core.IO.SystemDirectories.Umbraco) + "/" + GetUrl(TREE_URL); + } + + /// + /// Static method to return the tree service url with the specified parameters + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static string GetServiceUrl(int? startNodeID, string treeType, bool? showContextMenu, + bool? isDialog, string app, string nodeKey, string functionToCall) + { + TreeUrlGenerator treeSvc = new TreeUrlGenerator() + { + StartNodeID = startNodeID ?? -1, + TreeType = treeType, + ShowContextMenu = showContextMenu ?? true, + IsDialog = isDialog ?? false, + App = app, + NodeKey = nodeKey, + FunctionToCall = functionToCall + }; + return treeSvc.GetServiceUrl(); + } + + /// + /// Returns the url for initializing the tree based on the parameters specified on this class + /// + /// + public string GetInitUrl() + { + return Umbraco.Core.IO.IOHelper.ResolveUrl(Umbraco.Core.IO.SystemDirectories.Umbraco) + "/" + GetUrl(INIT_URL); + } + + /// + /// static method to return the tree init url with the specified parameters + /// + /// + /// + /// + /// + /// + /// + /// + /// + public static string GetInitUrl(int? startNodeID, string treeType, bool? showContextMenu, + bool? isDialog, string app, string nodeKey, string functionToCall) + { + TreeUrlGenerator treeSvc = new TreeUrlGenerator() + { + StartNodeID = startNodeID ?? -1, + TreeType = treeType, + ShowContextMenu = showContextMenu ?? true, + IsDialog = isDialog ?? false, + App = app, + NodeKey = nodeKey, + FunctionToCall = functionToCall + }; + return treeSvc.GetInitUrl(); + } + + /// + /// Returns the url for the tree picker (used on modal windows) based on the parameters specified on this class + /// + public static string GetPickerUrl(string app, string treeType) + { + TreeUrlGenerator treeSvc = new TreeUrlGenerator(); + treeSvc.App = app; + treeSvc.TreeType = treeType; + return treeSvc.GetPickerUrl(); + } + + /// + /// Returns the url for the tree picker (used on modal windows) based on the parameters specified on this class + /// + public string GetPickerUrl() + { + return Umbraco.Core.IO.IOHelper.ResolveUrl(Umbraco.Core.IO.SystemDirectories.Umbraco) + "/dialogs/" + GetUrl(PICKER_URL); + } + + /// + /// Generates the URL parameters for the tree service. + /// + /// the base url (i.e. tree.aspx) + /// + protected virtual string GetUrl(string pageUrl) + { + StringBuilder sb = new StringBuilder(); + + sb.Append(pageUrl); + //insert random + sb.Append(string.Format("?rnd={0}", Guid.NewGuid().ToString("N"))); + + sb.Append(string.Format("&id={0}", this.StartNodeID.ToString())); + if (!string.IsNullOrEmpty(this.TreeType)) sb.Append(string.Format("&treeType={0}", this.TreeType)); + if (!string.IsNullOrEmpty(this.NodeKey)) sb.Append(string.Format("&nodeKey={0}", this.NodeKey)); + sb.Append(string.Format("&contextMenu={0}", this.ShowContextMenu.ToString().ToLower())); + sb.Append(string.Format("&isDialog={0}", this.IsDialog.ToString().ToLower())); + if (!string.IsNullOrEmpty(this.App)) sb.Append(string.Format("&app={0}", this.App)); + + return sb.ToString(); + } + + } +} \ No newline at end of file diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/UserPermissions.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/UserPermissions.cs index 3309c0ff8d..6a30bb64ec 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/UserPermissions.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/UserPermissions.cs @@ -14,6 +14,7 @@ using System.Collections.Generic; using System.Text; using umbraco.BusinessLogic.Actions; using Umbraco.Core; +using Umbraco.Web.Trees; namespace umbraco.cms.presentation.Trees { diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/UserTypes.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/UserTypes.cs index 8ac4771672..3e722d0a7a 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/UserTypes.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/UserTypes.cs @@ -11,6 +11,7 @@ using umbraco.BusinessLogic; using System.Collections.Generic; using umbraco.businesslogic; using Umbraco.Core; +using Umbraco.Web.Trees; namespace umbraco.cms.presentation.Trees { diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadDictionary.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadDictionary.cs index 500721198a..3700ed216c 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadDictionary.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadDictionary.cs @@ -8,11 +8,13 @@ using umbraco.interfaces; using umbraco.cms.presentation.Trees; using umbraco.BusinessLogic.Actions; using Umbraco.Core; +using Umbraco.Web.Trees; namespace umbraco { - [Tree(Constants.Applications.Settings, Constants.Trees.Dictionary, "Dictionary", action: "openDictionary()", sortOrder: 3)] + + [Tree(Constants.Applications.Settings, Constants.Trees.Dictionary, "Dictionary", sortOrder: 3)] public class loadDictionary : BaseTree { public loadDictionary(string application) : base(application) { } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadMacros.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadMacros.cs index 8e4a4c3dd6..57917b4ce9 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadMacros.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadMacros.cs @@ -4,6 +4,7 @@ using umbraco.businesslogic; using umbraco.DataLayer; using umbraco.cms.presentation.Trees; using Umbraco.Core; +using Umbraco.Web.Trees; namespace umbraco diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadMemberGroups.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadMemberGroups.cs index 3e6b72647a..1710b0ad5e 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadMemberGroups.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadMemberGroups.cs @@ -6,6 +6,7 @@ using umbraco.cms.businesslogic.member; using umbraco.cms.presentation.Trees; using System.Web.Security; using Umbraco.Core; +using Umbraco.Web.Trees; namespace umbraco { diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadPackager.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadPackager.cs index 05bc6c0e7a..ae888c2f4c 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadPackager.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadPackager.cs @@ -5,6 +5,7 @@ using umbraco.businesslogic; using umbraco.interfaces; using Umbraco.Core; using umbraco.cms.presentation.Trees; +using Umbraco.Web.Trees; namespace umbraco { diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadPackages.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadPackages.cs index 7bbf789981..e9e1fc6f47 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadPackages.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadPackages.cs @@ -9,6 +9,7 @@ using umbraco.cms.businesslogic.packager; using umbraco.cms.presentation.Trees; using Umbraco.Core; using umbraco.interfaces; +using Umbraco.Web.Trees; namespace umbraco { diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadRelationTypes.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadRelationTypes.cs index d94ff6942e..92d79a3ab1 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadRelationTypes.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadRelationTypes.cs @@ -11,6 +11,7 @@ using umbraco.interfaces; using umbraco.cms.presentation.developer.RelationTypes.TreeMenu; using umbraco.businesslogic; using Umbraco.Core; +using Umbraco.Web.Trees; namespace umbraco { diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadScripts.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadScripts.cs index 0cdb7d84c0..07caa5dbbd 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadScripts.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadScripts.cs @@ -7,6 +7,7 @@ using umbraco.interfaces; using umbraco.cms.presentation.Trees; using umbraco.BusinessLogic.Actions; using Umbraco.Core.IO; +using Umbraco.Web.Trees; namespace umbraco diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadStylesheetProperty.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadStylesheetProperty.cs index ab2739d7ae..211c77d299 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadStylesheetProperty.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadStylesheetProperty.cs @@ -6,6 +6,7 @@ using umbraco.businesslogic; using umbraco.cms.businesslogic.web; using umbraco.cms.presentation.Trees; using Umbraco.Core; +using Umbraco.Web.Trees; namespace umbraco diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadStylesheets.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadStylesheets.cs index b212dd22ad..7bec056e36 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadStylesheets.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadStylesheets.cs @@ -10,6 +10,7 @@ using umbraco.interfaces; using umbraco.cms.presentation.Trees; using umbraco.BusinessLogic.Actions; using Umbraco.Core; +using Umbraco.Web.Trees; namespace umbraco diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadUsers.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadUsers.cs index 9bd4e26a10..b03c69d6df 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadUsers.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadUsers.cs @@ -10,6 +10,7 @@ using umbraco.cms.presentation.Trees; using umbraco.BusinessLogic.Actions; using System.Linq; using Umbraco.Core; +using Umbraco.Web.Trees; namespace umbraco diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadXslt.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadXslt.cs index c75001b470..8acc8697f8 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadXslt.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadXslt.cs @@ -6,6 +6,7 @@ using umbraco.cms.presentation.Trees; using umbraco.BusinessLogic.Actions; using Umbraco.Core.IO; using Umbraco.Core; +using Umbraco.Web.Trees; namespace umbraco { diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/actions/preview.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/actions/preview.aspx.cs index 50327bb109..52b4b51aff 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/actions/preview.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/actions/preview.aspx.cs @@ -8,6 +8,7 @@ using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using umbraco.cms.businesslogic.web; +using Umbraco.Core; using Umbraco.Core.IO; using Umbraco.Web; @@ -18,7 +19,7 @@ namespace umbraco.presentation.actions public preview() { - CurrentApp = BusinessLogic.DefaultApps.content.ToString(); + CurrentApp = Constants.Applications.Content; } /// diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/CreatedPackageTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/CreatedPackageTasks.cs index 8c2f9ca837..381fe5559d 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/CreatedPackageTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/CreatedPackageTasks.cs @@ -8,6 +8,7 @@ using umbraco.DataLayer; using umbraco.BasePages; using Umbraco.Core.IO; using umbraco.cms.businesslogic.member; +using Umbraco.Core; namespace umbraco { @@ -42,7 +43,7 @@ namespace umbraco public override string AssignedApp { - get { return DefaultApps.developer.ToString(); } + get { return Constants.Applications.Developer.ToString(); } } } } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/MemberGroupTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/MemberGroupTasks.cs index 42f8419723..7aa428066b 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/MemberGroupTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/MemberGroupTasks.cs @@ -7,6 +7,7 @@ using umbraco.DataLayer; using umbraco.BasePages; using Umbraco.Core.IO; using umbraco.cms.businesslogic.member; +using Umbraco.Core; namespace umbraco { @@ -39,7 +40,7 @@ namespace umbraco public override string AssignedApp { - get { return DefaultApps.member.ToString(); } + get { return Constants.Applications.Members.ToString(); } } } } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/PartialViewMacrosTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/PartialViewMacrosTasks.cs index 9d1926bee4..c7ef4644a3 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/PartialViewMacrosTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/PartialViewMacrosTasks.cs @@ -1,5 +1,6 @@ using Umbraco.Core.CodeAnnotations; using umbraco.BusinessLogic; +using Umbraco.Core; namespace umbraco { @@ -11,7 +12,7 @@ namespace umbraco { public override string AssignedApp { - get { return DefaultApps.developer.ToString(); } + get { return Constants.Applications.Developer.ToString(); } } protected override bool IsPartialViewMacro diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/PartialViewTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/PartialViewTasks.cs index 326479ee34..4672e5d203 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/PartialViewTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/PartialViewTasks.cs @@ -1,5 +1,6 @@ using Umbraco.Core.CodeAnnotations; using umbraco.BusinessLogic; +using Umbraco.Core; namespace umbraco { @@ -11,7 +12,7 @@ namespace umbraco { public override string AssignedApp { - get { return DefaultApps.settings.ToString(); } + get { return Constants.Applications.Settings.ToString(); } } } } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/ScriptTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/ScriptTasks.cs index 876fd6d343..ac9db2237e 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/ScriptTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/ScriptTasks.cs @@ -70,7 +70,7 @@ namespace umbraco public override string AssignedApp { - get { return DefaultApps.settings.ToString(); } + get { return Constants.Applications.Settings; } } } } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/StylesheetTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/StylesheetTasks.cs index 81806a5484..b1820a409c 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/StylesheetTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/StylesheetTasks.cs @@ -47,7 +47,7 @@ namespace umbraco public override string AssignedApp { - get { return DefaultApps.settings.ToString(); } + get { return Constants.Applications.Settings.ToString(); } } } } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/XsltTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/XsltTasks.cs index 6c6174c0bb..f3060c81cb 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/XsltTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/XsltTasks.cs @@ -109,7 +109,7 @@ namespace umbraco public override string AssignedApp { - get { return DefaultApps.developer.ToString(); } + get { return Constants.Applications.Developer.ToString(); } } } } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/dictionaryTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/dictionaryTasks.cs index fc2244a418..5a6acbac27 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/dictionaryTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/dictionaryTasks.cs @@ -8,6 +8,7 @@ using umbraco.DataLayer; using umbraco.BasePages; using Umbraco.Core.IO; using umbraco.cms.businesslogic.member; +using Umbraco.Core; namespace umbraco { @@ -49,7 +50,7 @@ namespace umbraco public override string AssignedApp { - get { return DefaultApps.settings.ToString(); } + get { return Constants.Applications.Settings.ToString(); } } } } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/languageTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/languageTasks.cs index 05ab623caa..2d83009866 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/languageTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/languageTasks.cs @@ -8,6 +8,7 @@ using umbraco.DataLayer; using umbraco.BasePages; using Umbraco.Core.IO; using umbraco.cms.businesslogic.member; +using Umbraco.Core; namespace umbraco { @@ -33,7 +34,7 @@ namespace umbraco public override string AssignedApp { - get { return DefaultApps.settings.ToString(); } + get { return Constants.Applications.Settings.ToString(); } } } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/macroTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/macroTasks.cs index 5ad5999eb7..4fd5f4b45a 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/macroTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/macroTasks.cs @@ -7,6 +7,7 @@ using umbraco.DataLayer; using umbraco.BasePages; using Umbraco.Core.IO; using umbraco.cms.businesslogic.member; +using Umbraco.Core; namespace umbraco { @@ -43,7 +44,7 @@ namespace umbraco public override string AssignedApp { - get { return DefaultApps.developer.ToString(); } + get { return Constants.Applications.Developer.ToString(); } } } } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/stylesheetPropertyTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/stylesheetPropertyTasks.cs index 76f1b83190..9bff76aa79 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/stylesheetPropertyTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/stylesheetPropertyTasks.cs @@ -56,7 +56,7 @@ namespace umbraco public override string AssignedApp { - get { return DefaultApps.settings.ToString(); } + get { return Constants.Applications.Settings.ToString(); } } } } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/templateTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/templateTasks.cs index bbddcd9de8..f6aad2e05d 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/templateTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/templateTasks.cs @@ -52,7 +52,7 @@ namespace umbraco public override string AssignedApp { - get { return DefaultApps.settings.ToString(); } + get { return Constants.Applications.Settings.ToString(); } } } } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/create/userTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/create/userTasks.cs index f62915cfb1..d5327590e9 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/create/userTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/create/userTasks.cs @@ -10,6 +10,7 @@ using umbraco.DataLayer; using umbraco.BasePages; using Umbraco.Core.IO; using umbraco.cms.businesslogic.member; +using Umbraco.Core; namespace umbraco { @@ -24,7 +25,7 @@ namespace umbraco public override string AssignedApp { - get { return DefaultApps.users.ToString(); } + get { return Constants.Applications.Users.ToString(); } } public override bool PerformSave() diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dashboard/FeedProxy.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dashboard/FeedProxy.aspx.cs index b304cda0b6..5c0cb9ede0 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dashboard/FeedProxy.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dashboard/FeedProxy.aspx.cs @@ -1,4 +1,5 @@ -using Umbraco.Core.Logging; +using Umbraco.Core; +using Umbraco.Core.Logging; using Umbraco.Web; namespace dashboardUtilities @@ -26,7 +27,7 @@ namespace dashboardUtilities Uri requestUri; if (Uri.TryCreate(url, UriKind.Absolute, out requestUri)) { - var feedProxyXml = xmlHelper.OpenAsXmlDocument(IOHelper.MapPath(SystemFiles.FeedProxyConfig)); + var feedProxyXml = XmlHelper.OpenAsXmlDocument(IOHelper.MapPath(SystemFiles.FeedProxyConfig)); if (feedProxyXml != null && feedProxyXml.SelectSingleNode(string.Concat("//allow[@host = '", requestUri.Host, "']")) != null && requestUri.Port == 80) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Macros/assemblyBrowser.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Macros/assemblyBrowser.aspx.cs index d186d9ef50..a51f49f7a2 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Macros/assemblyBrowser.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Macros/assemblyBrowser.aspx.cs @@ -29,7 +29,7 @@ namespace umbraco.developer { public assemblyBrowser() { - CurrentApp = DefaultApps.developer.ToString(); + CurrentApp = Constants.Applications.Developer.ToString(); } protected void Page_Load(object sender, EventArgs e) { diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Macros/editMacro.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Macros/editMacro.aspx.cs index c7e2db58a5..04aca72d62 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Macros/editMacro.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Macros/editMacro.aspx.cs @@ -24,7 +24,7 @@ namespace umbraco.cms.presentation.developer { public editMacro() { - CurrentApp = BusinessLogic.DefaultApps.developer.ToString(); + CurrentApp = Constants.Applications.Developer.ToString(); } protected PlaceHolder Buttons; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/BrowseRepository.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/BrowseRepository.aspx.cs index 84e4a38d24..b99ac3e091 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/BrowseRepository.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/BrowseRepository.aspx.cs @@ -10,6 +10,7 @@ using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using System.Xml; using System.Xml.XPath; +using Umbraco.Core; using Umbraco.Core.Configuration; using Umbraco.Core.IO; using Umbraco.Web; @@ -19,7 +20,7 @@ namespace umbraco.presentation.developer.packages { public BrowseRepository() { - CurrentApp = BusinessLogic.DefaultApps.developer.ToString(); + CurrentApp = Constants.Applications.Developer.ToString(); } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/SubmitPackage.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/SubmitPackage.aspx.cs index ad80072c74..4908bee541 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/SubmitPackage.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/SubmitPackage.aspx.cs @@ -10,6 +10,7 @@ using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; +using Umbraco.Core; using Umbraco.Web; namespace umbraco.presentation.developer.packages { @@ -17,7 +18,7 @@ namespace umbraco.presentation.developer.packages { public SubmitPackage() { - CurrentApp = BusinessLogic.DefaultApps.developer.ToString(); + CurrentApp = Constants.Applications.Developer.ToString(); } private cms.businesslogic.packager.PackageInstance pack; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/directoryBrowser.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/directoryBrowser.aspx.cs index f6a7742423..9df34e9a23 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/directoryBrowser.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/directoryBrowser.aspx.cs @@ -9,6 +9,7 @@ using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using umbraco.BusinessLogic; +using Umbraco.Core; namespace umbraco.presentation.developer.packages { @@ -17,7 +18,7 @@ namespace umbraco.presentation.developer.packages { public directoryBrowser() { - CurrentApp = DefaultApps.developer.ToString(); + CurrentApp = Constants.Applications.Developer.ToString(); } /// diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/editPackage.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/editPackage.aspx.cs index 1035b521db..5b954eaa4f 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/editPackage.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/editPackage.aspx.cs @@ -12,6 +12,7 @@ using umbraco.cms.businesslogic.template; using umbraco.cms.businesslogic.web; using umbraco.cms.presentation.Trees; using umbraco.controls; +using Umbraco.Core; using Umbraco.Core.IO; namespace umbraco.presentation.developer.packages @@ -21,7 +22,7 @@ namespace umbraco.presentation.developer.packages public _Default() { - CurrentApp = BusinessLogic.DefaultApps.developer.ToString(); + CurrentApp = Constants.Applications.Developer.ToString(); } public uicontrols.TabPage packageInfo; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/installedPackage.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/installedPackage.aspx.cs index 45ee642267..b6d273ab3a 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/installedPackage.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/installedPackage.aspx.cs @@ -30,7 +30,7 @@ namespace umbraco.presentation.developer.packages { public installedPackage() { - CurrentApp = DefaultApps.developer.ToString(); + CurrentApp = Constants.Applications.Developer.ToString(); } private cms.businesslogic.packager.InstalledPackage _pack; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/installer.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/installer.aspx.cs index 1d98226f2d..88349cf6dc 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/installer.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/Packages/installer.aspx.cs @@ -30,7 +30,7 @@ namespace umbraco.presentation.developer.packages { public Installer() { - CurrentApp = DefaultApps.developer.ToString(); + CurrentApp = Constants.Applications.Developer.ToString(); _installer = new cms.businesslogic.packager.Installer(UmbracoUser.Id); } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/autoDoc.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/autoDoc.aspx.cs index 3484a4504e..7c0e146680 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/developer/autoDoc.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/developer/autoDoc.aspx.cs @@ -10,6 +10,7 @@ using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using System.Linq; using umbraco.BusinessLogic; +using Umbraco.Core; namespace umbraco.developer { @@ -20,7 +21,7 @@ namespace umbraco.developer { public autoDoc() { - CurrentApp = DefaultApps.developer.ToString(); + CurrentApp = Constants.Applications.Developer.ToString(); } protected void Page_Load(object sender, EventArgs e) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/AssignDomain.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/AssignDomain.aspx.cs index 0507a6e321..45c7ceefab 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/AssignDomain.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/AssignDomain.aspx.cs @@ -6,6 +6,7 @@ using umbraco.BasePages; using umbraco.BusinessLogic; using umbraco.cms.businesslogic.language; using umbraco.cms.businesslogic.web; +using Umbraco.Core; namespace umbraco.dialogs { @@ -19,7 +20,7 @@ namespace umbraco.dialogs public AssignDomain() { - CurrentApp = DefaultApps.content.ToString(); + CurrentApp = Constants.Applications.Content.ToString(); } protected void Page_Load(object sender, EventArgs e) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/Preview.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/Preview.aspx.cs index e3586eee8f..a0fbeb2a50 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/Preview.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/Preview.aspx.cs @@ -15,6 +15,7 @@ using Umbraco.Web; using umbraco.cms.businesslogic.web; using umbraco.presentation.preview; using umbraco.BusinessLogic; +using Umbraco.Core; namespace umbraco.presentation.dialogs { @@ -22,7 +23,7 @@ namespace umbraco.presentation.dialogs { public Preview() { - CurrentApp = DefaultApps.content.ToString(); + CurrentApp = Constants.Applications.Content.ToString(); } protected void Page_Load(object sender, EventArgs e) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/RegexWs.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/RegexWs.aspx.cs index 935ffd129c..96ce239ff3 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/RegexWs.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/RegexWs.aspx.cs @@ -8,6 +8,7 @@ using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; +using Umbraco.Core; namespace umbraco.presentation.dialogs { public partial class RegexWs : BasePages.UmbracoEnsuredPage { @@ -15,7 +16,7 @@ namespace umbraco.presentation.dialogs { public RegexWs() { - CurrentApp = BusinessLogic.DefaultApps.settings.ToString(); + CurrentApp = Constants.Applications.Settings.ToString(); } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/SendPublish.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/SendPublish.aspx.cs index 78c4549a55..0f3f18494d 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/SendPublish.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/SendPublish.aspx.cs @@ -12,6 +12,7 @@ using Umbraco.Web; using umbraco.BusinessLogic; using umbraco.BusinessLogic.Actions; using umbraco.cms.businesslogic.web; +using Umbraco.Core; namespace umbraco.dialogs { @@ -23,7 +24,7 @@ namespace umbraco.dialogs { public SendPublish() { - CurrentApp = DefaultApps.content.ToString(); + CurrentApp = Constants.Applications.Content.ToString(); } protected void Page_Load(object sender, EventArgs e) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/cruds.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/cruds.aspx.cs index 1634fd370f..a135386777 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/cruds.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/cruds.aspx.cs @@ -24,7 +24,7 @@ namespace umbraco.dialogs public cruds() { - CurrentApp = BusinessLogic.DefaultApps.content.ToString(); + CurrentApp = Constants.Applications.Content.ToString(); } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/exportDocumenttype.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/exportDocumenttype.aspx.cs index b91dacbf2f..49cb4c659c 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/exportDocumenttype.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/exportDocumenttype.aspx.cs @@ -11,6 +11,7 @@ using System.Web.UI.HtmlControls; using umbraco.cms.businesslogic.web; using System.Xml; +using Umbraco.Core; using Umbraco.Web; namespace umbraco.presentation.dialogs @@ -22,7 +23,7 @@ namespace umbraco.presentation.dialogs { public exportDocumenttype() { - CurrentApp = BusinessLogic.DefaultApps.settings.ToString(); + CurrentApp = Constants.Applications.Settings.ToString(); } private void Page_Load(object sender, System.EventArgs e) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/importDocumenttype.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/importDocumenttype.aspx.cs index 27c1724bff..100a103b5f 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/importDocumenttype.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/importDocumenttype.aspx.cs @@ -17,7 +17,7 @@ namespace umbraco.presentation.umbraco.dialogs public importDocumentType() { - CurrentApp = BusinessLogic.DefaultApps.settings.ToString(); + CurrentApp = Constants.Applications.Settings.ToString(); } protected Literal FeedBackMessage; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/insertMacro.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/insertMacro.aspx.cs index 68764c3de4..f1a8191213 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/insertMacro.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/insertMacro.aspx.cs @@ -1,19 +1,11 @@ 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 System.Reflection; +using System.Security; using Umbraco.Core.IO; -using umbraco.BusinessLogic; using umbraco.DataLayer; -using umbraco.businesslogic.Exceptions; +using Umbraco.Core; using Umbraco.Web; namespace umbraco.dialogs @@ -30,8 +22,8 @@ namespace umbraco.dialogs base.OnInit(e); //this could be used for media or content so we need to at least validate that the user has access to one or the other - if (!ValidateUserApp(DefaultApps.content.ToString()) && !ValidateUserApp(DefaultApps.media.ToString())) - throw new UserAuthorizationException("The current user doesn't have access to the section/app"); + if (!ValidateUserApp(Constants.Applications.Content.ToString()) && !ValidateUserApp(Constants.Applications.Media.ToString())) + throw new SecurityException("The current user doesn't have access to the section/app"); } protected void Page_Load(object sender, EventArgs e) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/insertMasterpageContent.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/insertMasterpageContent.aspx.cs index 0aa49a70b5..2235e9776b 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/insertMasterpageContent.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/insertMasterpageContent.aspx.cs @@ -6,6 +6,7 @@ using System.Web.UI.WebControls; using System.Text.RegularExpressions; using umbraco.BusinessLogic; using umbraco.cms.businesslogic; +using Umbraco.Core; namespace umbraco.presentation.umbraco.dialogs { @@ -13,7 +14,7 @@ namespace umbraco.presentation.umbraco.dialogs { public insertMasterpageContent() { - CurrentApp = DefaultApps.settings.ToString(); + CurrentApp = Constants.Applications.Settings.ToString(); } protected void Page_Load(object sender, EventArgs e) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/insertMasterpagePlaceholder.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/insertMasterpagePlaceholder.aspx.cs index efac983598..fd936211a9 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/insertMasterpagePlaceholder.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/insertMasterpagePlaceholder.aspx.cs @@ -3,13 +3,14 @@ using System.Collections.Generic; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; +using Umbraco.Core; namespace umbraco.presentation.umbraco.dialogs { public partial class insertMasterpagePlaceholder : BasePages.UmbracoEnsuredPage { public insertMasterpagePlaceholder() { - CurrentApp = BusinessLogic.DefaultApps.settings.ToString(); + CurrentApp = Constants.Applications.Settings.ToString(); } protected void Page_Load(object sender, EventArgs e) { //labels 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 0748bcdb9f..f77b635af4 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/notifications.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/notifications.aspx.cs @@ -6,6 +6,7 @@ using System.Web.UI.WebControls; using umbraco.BasePages; using umbraco.cms.businesslogic; using umbraco.cms.businesslogic.workflow; +using Umbraco.Core; using Umbraco.Web; namespace umbraco.dialogs @@ -20,7 +21,7 @@ namespace umbraco.dialogs public notifications() { - CurrentApp = BusinessLogic.DefaultApps.content.ToString(); + CurrentApp = Constants.Applications.Content.ToString(); } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/protectPage.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/protectPage.aspx.cs index 78d2d09199..421bdccdea 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/protectPage.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/protectPage.aspx.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Globalization; using System.Linq; using System.Web.Security; @@ -7,13 +8,15 @@ using System.Web.UI.WebControls; using System.Windows.Forms.VisualStyles; using Umbraco.Core; using Umbraco.Core.Logging; -using umbraco.cms.businesslogic.member; using umbraco.cms.businesslogic.web; using umbraco.controls; using umbraco.BasePages; +using Umbraco.Core.Models; using Umbraco.Core.Persistence; using Umbraco.Core.Security; using Umbraco.Web; +using MembershipProviderExtensions = Umbraco.Core.Security.MembershipProviderExtensions; +using MemberType = umbraco.cms.businesslogic.member.MemberType; namespace umbraco.presentation.umbraco.dialogs { @@ -24,7 +27,7 @@ namespace umbraco.presentation.umbraco.dialogs { public protectPage() { - CurrentApp = BusinessLogic.DefaultApps.content.ToString(); + CurrentApp = Constants.Applications.Content.ToString(); } @@ -57,6 +60,150 @@ namespace umbraco.presentation.umbraco.dialogs } } + private ProtectionType GetProtectionType(int documentId) + { + var content = Services.ContentService.GetById(documentId); + if (content == null) return ProtectionType.NotProtected; + + var entry = Services.PublicAccessService.GetEntryForContent(content); + if (entry == null) return ProtectionType.NotProtected; + + //legacy states that if it is protected by a member id then it is 'simple' + return entry.Rules.Any(x => x.RuleType == Constants.Conventions.PublicAccess.MemberIdRuleType) + ? ProtectionType.Simple + : ProtectionType.Advanced; + } + + private enum ProtectionType + { + NotProtected, + Simple, + Advanced + } + + private int GetErrorPage(string path) + { + var entry = Services.PublicAccessService.GetEntryForContent(path); + if (entry == null) return -1; + var entity = Services.EntityService.Get(entry.NoAccessNodeId, UmbracoObjectTypes.Document, false); + return entity.Id; + } + + private int GetLoginPage(string path) + { + var entry = Services.PublicAccessService.GetEntryForContent(path); + if (entry == null) return -1; + var entity = Services.EntityService.Get(entry.LoginNodeId, UmbracoObjectTypes.Document, false); + return entity.Id; + } + + private MembershipUser GetAccessingMembershipUser(int documentId) + { + var content = Services.ContentService.GetById(documentId); + if (content == null) return null; + var entry = Services.PublicAccessService.GetEntryForContent(content); + if (entry == null) return null; + //legacy would throw an exception here if it was not 'simple' and simple means based on a username + if (entry.Rules.All(x => x.RuleType != Constants.Conventions.PublicAccess.MemberUsernameRuleType)) + { + throw new Exception("Document isn't protected using Simple mechanism. Use GetAccessingMemberGroups instead"); + } + var provider = MembershipProviderExtensions.GetMembersMembershipProvider(); + var usernameRule = entry.Rules.First(x => x.RuleType == Constants.Conventions.PublicAccess.MemberUsernameRuleType); + return provider.GetUser(usernameRule.RuleValue, false); + } + + private bool IsProtectedByMembershipRole(int documentId, string role) + { + var content = Services.ContentService.GetById(documentId); + var entry = Services.PublicAccessService.GetEntryForContent(content); + if (entry == null) return false; + return entry.Rules + .Any(x => x.RuleType == Constants.Conventions.PublicAccess.MemberRoleRuleType + && x.RuleValue == role); + } + + private void ProtectPage(bool Simple, int DocumentId, int LoginDocumentId, int ErrorDocumentId) + { + var doc = new Document(DocumentId); + var loginContent = Services.ContentService.GetById(LoginDocumentId); + if (loginContent == null) throw new NullReferenceException("No content item found with id " + LoginDocumentId); + var noAccessContent = Services.ContentService.GetById(ErrorDocumentId); + if (noAccessContent == null) throw new NullReferenceException("No content item found with id " + ErrorDocumentId); + + var entry = Services.PublicAccessService.GetEntryForContent(doc.ContentEntity.Id.ToString()); + if (entry != null) + { + if (Simple) + { + // if using simple mode, make sure that all existing groups are removed + entry.ClearRules(); + } + + //ensure the correct ids are applied + entry.LoginNodeId = loginContent.Id; + entry.NoAccessNodeId = noAccessContent.Id; + } + else + { + entry = new PublicAccessEntry(doc.ContentEntity, + Services.ContentService.GetById(LoginDocumentId), + Services.ContentService.GetById(ErrorDocumentId), + new List()); + } + Services.PublicAccessService.Save(entry); + } + + private void AddMembershipRoleToDocument(int documentId, string role) + { + //event + var doc = new Document(documentId); + + var entry = Services.PublicAccessService.AddRule( + doc.ContentEntity, + Constants.Conventions.PublicAccess.MemberRoleRuleType, + role); + + if (entry.Success == false && entry.Result.Entity == null) + { + throw new Exception("Document is not protected!"); + } + } + + private void AddMembershipUserToDocument(int documentId, string membershipUserName) + { + //event + var doc = new Document(documentId); + var entry = Services.PublicAccessService.AddRule( + doc.ContentEntity, + Constants.Conventions.PublicAccess.MemberUsernameRuleType, + membershipUserName); + + if (entry.Success == false && entry.Result.Entity == null) + { + throw new Exception("Document is not protected!"); + } + } + + private void RemoveMembershipRoleFromDocument(int documentId, string role) + { + var doc = new Document(documentId); + Services.PublicAccessService.RemoveRule( + doc.ContentEntity, + Constants.Conventions.PublicAccess.MemberRoleRuleType, + role); + } + + private void RemoveProtection(int documentId) + { + var doc = new Document(documentId); + var entry = Services.PublicAccessService.GetEntryForContent(doc.ContentEntity); + if (entry != null) + { + Services.PublicAccessService.Delete(entry); + } + } + protected void Page_Load(object sender, EventArgs e) { // Check for editing @@ -79,14 +226,15 @@ namespace umbraco.presentation.umbraco.dialogs if (IsPostBack == false) { - if (Access.IsProtected(documentId) && Access.GetProtectionType(documentId) != ProtectionType.NotProtected) + if (Services.PublicAccessService.IsProtected(documentId.ToString()) + && GetProtectionType(documentId) != ProtectionType.NotProtected) { bt_buttonRemoveProtection.Visible = true; bt_buttonRemoveProtection.Attributes.Add("onClick", "return confirm('" + ui.Text("areyousure") + "')"); // Get login and error pages - int errorPage = Access.GetErrorPage(documentObject.Path); - int loginPage = Access.GetLoginPage(documentObject.Path); + int errorPage = GetErrorPage(documentObject.Path); + int loginPage = GetLoginPage(documentObject.Path); try { var loginPageObj = new Document(loginPage); @@ -102,9 +250,9 @@ namespace umbraco.presentation.umbraco.dialogs LogHelper.Error("An error occurred initializing the protect page editor", ex); } - if (Access.GetProtectionType(documentId) == ProtectionType.Simple) + if (GetProtectionType(documentId) == ProtectionType.Simple) { - MembershipUser m = Access.GetAccessingMembershipUser(documentId); + MembershipUser m = GetAccessingMembershipUser(documentId); if (m != null) { pane_simple.Visible = true; @@ -117,7 +265,7 @@ namespace umbraco.presentation.umbraco.dialogs } } - else if (Access.GetProtectionType(documentId) == ProtectionType.Advanced) + else if (GetProtectionType(documentId) == ProtectionType.Advanced) { pane_simple.Visible = false; pane_advanced.Visible = true; @@ -142,7 +290,7 @@ namespace umbraco.presentation.umbraco.dialogs ListItem li = new ListItem(role, role); if (IsPostBack == false) { - if (Access.IsProtectedByMembershipRole(int.Parse(Request.GetItemAsString("nodeid")), role)) + if (IsProtectedByMembershipRole(int.Parse(Request.GetItemAsString("nodeid")), role)) selectedGroups += role + ","; } _memberGroups.Items.Add(li); @@ -243,19 +391,19 @@ namespace umbraco.presentation.umbraco.dialogs Roles.AddUserToRole(member.UserName, simpleRoleName); } - Access.ProtectPage(true, pageId, int.Parse(loginPagePicker.Value), int.Parse(errorPagePicker.Value)); - Access.AddMembershipRoleToDocument(pageId, simpleRoleName); - Access.AddMembershipUserToDocument(pageId, member.UserName); + ProtectPage(true, pageId, int.Parse(loginPagePicker.Value), int.Parse(errorPagePicker.Value)); + AddMembershipRoleToDocument(pageId, simpleRoleName); + AddMembershipUserToDocument(pageId, member.UserName); } else if (e.CommandName == "advanced") { - Access.ProtectPage(false, pageId, int.Parse(loginPagePicker.Value), int.Parse(errorPagePicker.Value)); + ProtectPage(false, pageId, int.Parse(loginPagePicker.Value), int.Parse(errorPagePicker.Value)); foreach (ListItem li in _memberGroups.Items) if (("," + _memberGroups.Value + ",").IndexOf("," + li.Value + ",", StringComparison.Ordinal) > -1) - Access.AddMembershipRoleToDocument(pageId, li.Value); + AddMembershipRoleToDocument(pageId, li.Value); else - Access.RemoveMembershipRoleFromDocument(pageId, li.Value); + RemoveMembershipRoleFromDocument(pageId, li.Value); } feedback.Text = ui.Text("publicAccess", "paIsProtected", new cms.businesslogic.CMSNode(pageId).Text) + "

" + ui.Text("closeThisWindow") + ""; @@ -263,7 +411,7 @@ namespace umbraco.presentation.umbraco.dialogs p_buttons.Visible = false; pane_advanced.Visible = false; pane_simple.Visible = false; - var content = ApplicationContext.Current.Services.ContentService.GetById(pageId); + var content = Services.ContentService.GetById(pageId); //reloads the current node in the tree ClientTools.SyncTree(content.Path, true); //reloads the current node's children in the tree @@ -280,11 +428,11 @@ namespace umbraco.presentation.umbraco.dialogs pane_advanced.Visible = false; pane_simple.Visible = false; - Access.RemoveProtection(pageId); + RemoveProtection(pageId); feedback.Text = ui.Text("publicAccess", "paIsRemoved", new cms.businesslogic.CMSNode(pageId).Text) + "

" + ui.Text("closeThisWindow") + ""; - var content = ApplicationContext.Current.Services.ContentService.GetById(pageId); + var content = Services.ContentService.GetById(pageId); //reloads the current node in the tree ClientTools.SyncTree(content.Path, true); //reloads the current node's children in the tree diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/republish.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/republish.aspx.cs index 61213e2a7e..5ff42e069b 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/republish.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/republish.aspx.cs @@ -21,7 +21,7 @@ // { // public republish() // { -// CurrentApp = BusinessLogic.DefaultApps.content.ToString(); +// CurrentApp = Constants.Applications.Content.ToString(); // } // protected void go(object sender, EventArgs e) { diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/rollBack.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/rollBack.aspx.cs index 7f42fa2194..bb634887cb 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/rollBack.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/rollBack.aspx.cs @@ -23,7 +23,7 @@ // { // public rollBack() // { -// CurrentApp = BusinessLogic.DefaultApps.content.ToString(); +// CurrentApp = Constants.Applications.Content.ToString(); // } // private Document currentDoc = new Document(int.Parse(helper.Request("nodeId"))); diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/search.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/search.aspx.cs index b8949de207..649e8b5fc0 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/search.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/search.aspx.cs @@ -106,7 +106,7 @@ namespace umbraco.presentation.dialogs x.Attributes.Append(XmlHelper.AddAttribute(result, "title", r.Fields["nodeName"])); x.Attributes.Append(XmlHelper.AddAttribute(result, "author", r.Fields["writerName"])); x.Attributes.Append(XmlHelper.AddAttribute(result, "changeDate", r.Fields["updateDate"])); - x.Attributes.Append(xmlHelper.addAttribute(result, "type", r.Fields["nodeTypeAlias"])); + x.Attributes.Append(XmlHelper.AddAttribute(result, "type", r.Fields["nodeTypeAlias"])); result.DocumentElement.AppendChild(x); } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/sendToTranslation.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/sendToTranslation.aspx.cs index 028e90252a..befc2e5cd0 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/sendToTranslation.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/sendToTranslation.aspx.cs @@ -13,6 +13,7 @@ using umbraco.cms.businesslogic.web; using umbraco.cms.businesslogic; using umbraco.BusinessLogic; using umbraco.BasePages; +using Umbraco.Core; using Umbraco.Web; namespace umbraco.presentation.dialogs @@ -23,7 +24,7 @@ namespace umbraco.presentation.dialogs public sendToTranslation() { - CurrentApp = DefaultApps.content.ToString(); + CurrentApp = Constants.Applications.Content.ToString(); } protected void Page_Load(object sender, EventArgs e) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/umbracoField.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/umbracoField.aspx.cs index 2d23c9e7a2..8b61479375 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/umbracoField.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/umbracoField.aspx.cs @@ -27,7 +27,7 @@ namespace umbraco.dialogs public umbracoField() { - CurrentApp = BusinessLogic.DefaultApps.settings.ToString(); + CurrentApp = Constants.Applications.Settings.ToString(); } protected void Page_Load(object sender, System.EventArgs e) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/viewAuditTrail.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/viewAuditTrail.aspx.cs index f4085a5dd7..65694366c8 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/viewAuditTrail.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/dialogs/viewAuditTrail.aspx.cs @@ -8,6 +8,7 @@ using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; +using Umbraco.Core; namespace umbraco.presentation.umbraco.dialogs { @@ -18,7 +19,7 @@ namespace umbraco.presentation.umbraco.dialogs { public viewAuditTrail() { - CurrentApp = BusinessLogic.DefaultApps.content.ToString(); + CurrentApp = Constants.Applications.Content.ToString(); } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/masterpages/umbracoDialog.Master.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/masterpages/umbracoDialog.Master.cs index a5b0cd39ef..340457599b 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/masterpages/umbracoDialog.Master.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/masterpages/umbracoDialog.Master.cs @@ -4,6 +4,7 @@ using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using Umbraco.Core.IO; +using Umbraco.Web.UI.JavaScript; namespace umbraco.presentation.masterpages { @@ -56,7 +57,7 @@ namespace umbraco.presentation.masterpages /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.UmbracoClientDependencyLoader ClientLoader; + protected UmbracoClientDependencyLoader ClientLoader; ///

/// CssInclude1 control. diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/masterpages/umbracoPage.Master.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/masterpages/umbracoPage.Master.cs index e3d6bfe82a..54d74bdbb0 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/masterpages/umbracoPage.Master.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/masterpages/umbracoPage.Master.cs @@ -11,6 +11,7 @@ using System.Web.UI.WebControls; using StackExchange.Profiling; using Umbraco.Core.Profiling; using Umbraco.Web; +using Umbraco.Web.UI.JavaScript; using mp = umbraco.presentation.masterpages; namespace umbraco.presentation.umbraco.masterpages { @@ -79,7 +80,7 @@ namespace umbraco.presentation.masterpages /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.UmbracoClientDependencyLoader ClientLoader; + protected UmbracoClientDependencyLoader ClientLoader; /// /// CssInclude1 control. diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/members/EditMemberGroup.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/members/EditMemberGroup.aspx.cs index b126282300..860a71de33 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/members/EditMemberGroup.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/members/EditMemberGroup.aspx.cs @@ -13,6 +13,7 @@ using System.Web.Security; using umbraco.cms.businesslogic.member; using umbraco.cms.presentation.Trees; using umbraco.uicontrols; +using Umbraco.Core; namespace umbraco.presentation.members { @@ -23,7 +24,7 @@ namespace umbraco.presentation.members { public EditMemberGroup() { - CurrentApp = BusinessLogic.DefaultApps.member.ToString(); + CurrentApp = Constants.Applications.Members.ToString(); } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/members/ViewMembers.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/members/ViewMembers.aspx.cs index 562073ecf1..d48273247a 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/members/ViewMembers.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/members/ViewMembers.aspx.cs @@ -4,6 +4,7 @@ using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; +using Umbraco.Core; using Umbraco.Core.Security; namespace umbraco.presentation.members @@ -13,7 +14,7 @@ namespace umbraco.presentation.members public ViewMembers() { - CurrentApp = BusinessLogic.DefaultApps.member.ToString(); + CurrentApp = Constants.Applications.Members.ToString(); } protected void Page_Load(object sender, EventArgs e) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/members/search.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/members/search.aspx.cs index 218e891034..70d85354b3 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/members/search.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/members/search.aspx.cs @@ -9,6 +9,7 @@ using umbraco.cms.businesslogic.member; using umbraco.DataLayer.SqlHelpers; using umbraco.BusinessLogic; using Examine; +using Umbraco.Core; namespace umbraco.presentation.members { @@ -18,7 +19,7 @@ namespace umbraco.presentation.members { public search() { - CurrentApp = DefaultApps.member.ToString(); + CurrentApp = Constants.Applications.Members.ToString(); } } } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/publishStatus.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/publishStatus.aspx.cs index e2922829f3..dcd6cdbd21 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/publishStatus.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/publishStatus.aspx.cs @@ -8,6 +8,7 @@ using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; +using Umbraco.Core; namespace umbraco.cms.presentation { @@ -19,7 +20,7 @@ namespace umbraco.cms.presentation { public publishStatus() { - CurrentApp = BusinessLogic.DefaultApps.content.ToString(); + CurrentApp = Constants.Applications.Content.ToString(); } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/editLanguage.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/editLanguage.aspx.cs index ddab4c559e..73c11643a9 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/editLanguage.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/editLanguage.aspx.cs @@ -24,7 +24,7 @@ namespace umbraco.settings { public editLanguage() { - CurrentApp = BusinessLogic.DefaultApps.settings.ToString(); + CurrentApp = Constants.Applications.Settings.ToString(); } protected System.Web.UI.WebControls.TextBox NameTxt; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/editTemplate.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/editTemplate.aspx.cs index 8f533188cd..d8b56c94b3 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/editTemplate.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/editTemplate.aspx.cs @@ -27,7 +27,7 @@ namespace umbraco.cms.presentation.settings public editTemplate() { - CurrentApp = DefaultApps.settings.ToString(); + CurrentApp = Constants.Applications.Settings.ToString(); } protected override void OnPreRender(EventArgs e) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/modals/ShowUmbracoTags.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/modals/ShowUmbracoTags.aspx.cs index d79da04cfb..d69e97d939 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/modals/ShowUmbracoTags.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/modals/ShowUmbracoTags.aspx.cs @@ -9,6 +9,7 @@ using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using umbraco.BusinessLogic; +using Umbraco.Core; namespace umbraco.cms.presentation.settings.modal { @@ -20,7 +21,7 @@ namespace umbraco.cms.presentation.settings.modal public ShowUmbracoTags() { - CurrentApp = DefaultApps.settings.ToString(); + CurrentApp = Constants.Applications.Settings.ToString(); } public static string alias = ""; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/scripts/editScript.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/scripts/editScript.aspx.cs index 84931f3eb6..12f9eee317 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/scripts/editScript.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/scripts/editScript.aspx.cs @@ -23,7 +23,7 @@ namespace umbraco.cms.presentation.settings.scripts { public editScript() { - CurrentApp = BusinessLogic.DefaultApps.settings.ToString(); + CurrentApp = Constants.Applications.Settings.ToString(); } protected System.Web.UI.HtmlControls.HtmlForm Form1; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/stylesheet/editstylesheet.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/stylesheet/editstylesheet.aspx.cs index 847c55a322..4cb321ae0a 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/stylesheet/editstylesheet.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/stylesheet/editstylesheet.aspx.cs @@ -25,7 +25,7 @@ namespace umbraco.cms.presentation.settings.stylesheet public editstylesheet() { - CurrentApp = DefaultApps.settings.ToString(); + CurrentApp = Constants.Applications.Settings.ToString(); } protected override void OnInit(EventArgs e) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/stylesheet/property/EditStyleSheetProperty.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/stylesheet/property/EditStyleSheetProperty.aspx.cs index f058b31bb7..6836376837 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/settings/stylesheet/property/EditStyleSheetProperty.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/settings/stylesheet/property/EditStyleSheetProperty.aspx.cs @@ -25,7 +25,7 @@ namespace umbraco.cms.presentation.settings.stylesheet { public EditStyleSheetProperty() { - CurrentApp = BusinessLogic.DefaultApps.settings.ToString(); + CurrentApp = Constants.Applications.Settings.ToString(); } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/translation/default.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/translation/default.aspx.cs index d3d3a9dfff..9dff5305b4 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/translation/default.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/translation/default.aspx.cs @@ -31,7 +31,7 @@ namespace umbraco.presentation.translation { public _default() { - CurrentApp = DefaultApps.translation.ToString(); + CurrentApp = Constants.Applications.Translation.ToString(); } protected void Page_Load(object sender, EventArgs e) @@ -112,7 +112,7 @@ namespace umbraco.presentation.translation // Unpack the zip file - cms.businesslogic.utilities.Zip.UnPack(tempFileName, tempPath, true); + IOHelper.UnZip(tempFileName, tempPath, true); // Test the number of xml files try diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/translation/details.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/translation/details.aspx.cs index 1c1863926a..ee3df0cc43 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/translation/details.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/translation/details.aspx.cs @@ -19,13 +19,14 @@ using ICSharpCode.SharpZipLib.Zip; using ICSharpCode.SharpZipLib.Zip.Compression; using ICSharpCode.SharpZipLib.Zip.Compression.Streams; using ICSharpCode.SharpZipLib.GZip; +using Umbraco.Core; namespace umbraco.presentation.umbraco.translation { public partial class details : BasePages.UmbracoEnsuredPage { public details() { - CurrentApp = BusinessLogic.DefaultApps.translation.ToString(); + CurrentApp = Constants.Applications.Translation.ToString(); } protected void closeTask(object sender, EventArgs e) { diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/translation/preview.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/translation/preview.aspx.cs index 952d6d4f7e..25808f1814 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/translation/preview.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/translation/preview.aspx.cs @@ -12,6 +12,7 @@ using umbraco.BusinessLogic; using umbraco.cms.businesslogic.task; using umbraco.cms.businesslogic.web; using umbraco.cms.businesslogic.relation; +using Umbraco.Core; using Umbraco.Web; namespace umbraco.presentation.translation @@ -23,7 +24,7 @@ namespace umbraco.presentation.translation public preview() { - CurrentApp = DefaultApps.translation.ToString(); + CurrentApp = Constants.Applications.Translation.ToString(); } protected void Page_Load(object sender, EventArgs e) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/translation/xml.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/translation/xml.aspx.cs index 9adbf6c178..5ebdd61861 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/translation/xml.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/translation/xml.aspx.cs @@ -26,7 +26,7 @@ namespace umbraco.presentation.translation public xml() { - CurrentApp = DefaultApps.translation.ToString(); + CurrentApp = Constants.Applications.Translation.ToString(); } protected void Page_Load(object sender, EventArgs e) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/treeInit.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/treeInit.aspx.cs index fe5b33cf34..a8921f2394 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/treeInit.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/treeInit.aspx.cs @@ -13,6 +13,7 @@ using System.Collections.Generic; using System.Web; using umbraco.BusinessLogic.Actions; using System.Web.Services; +using Umbraco.Web.UI.JavaScript; namespace umbraco.cms.presentation { @@ -45,7 +46,7 @@ namespace umbraco.cms.presentation /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::umbraco.uicontrols.UmbracoClientDependencyLoader ClientLoader; + protected UmbracoClientDependencyLoader ClientLoader; /// /// CssInclude1 control. 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 2254e96b4c..c0e20cd99a 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUser.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUser.aspx.cs @@ -34,7 +34,7 @@ namespace umbraco.cms.presentation.user { public EditUser() { - CurrentApp = DefaultApps.users.ToString(); + CurrentApp = Constants.Applications.Users.ToString(); } protected HtmlTable macroProperties; protected TextBox uname = new TextBox(); 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 b6796e45fa..8b90630f48 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUserType.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/users/EditUserType.aspx.cs @@ -15,6 +15,7 @@ using umbraco.BusinessLogic.Actions; using umbraco.BusinessLogic; using umbraco.uicontrols; using umbraco.cms.presentation.Trees; +using Umbraco.Core; using Umbraco.Core.IO; namespace umbraco.cms.presentation.user @@ -23,7 +24,7 @@ namespace umbraco.cms.presentation.user { public EditUserType() { - CurrentApp = BusinessLogic.DefaultApps.users.ToString(); + CurrentApp = Constants.Applications.Users.ToString(); } protected void Page_Load(object sender, EventArgs e) { diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/users/PermissionEditor.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/users/PermissionEditor.aspx.cs index 31cd1db356..27157f38d6 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/users/PermissionEditor.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/users/PermissionEditor.aspx.cs @@ -28,7 +28,7 @@ namespace umbraco.cms.presentation.user { public PermissionEditor() { - CurrentApp = BusinessLogic.DefaultApps.users.ToString(); + CurrentApp = Constants.Applications.Users.ToString(); } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/users/UserTypeTasks.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/users/UserTypeTasks.cs index 0a8e02341a..57f9df6054 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/users/UserTypeTasks.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/users/UserTypeTasks.cs @@ -10,6 +10,7 @@ using System.Web.UI.HtmlControls; using Umbraco.Web.UI; using umbraco.interfaces; using umbraco.BusinessLogic; +using Umbraco.Core; namespace umbraco.cms.presentation.user { @@ -46,7 +47,7 @@ namespace umbraco.cms.presentation.user public override string AssignedApp { - get { return DefaultApps.users.ToString(); } + get { return Constants.Applications.Users.ToString(); } } } } diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/CacheRefresher.asmx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/CacheRefresher.asmx.cs index 5cfb8d3393..c4c9639e26 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/CacheRefresher.asmx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/CacheRefresher.asmx.cs @@ -157,8 +157,8 @@ namespace umbraco.presentation.webservices xd.LoadXml(""); foreach (var cr in CacheRefreshersResolver.Current.CacheRefreshers) { - var n = xmlHelper.addTextNode(xd, "cacheRefresher", cr.Name); - n.Attributes.Append(xmlHelper.addAttribute(xd, "uniqueIdentifier", cr.UniqueIdentifier.ToString())); + var n = XmlHelper.AddTextNode(xd, "cacheRefresher", cr.Name); + n.Attributes.Append(XmlHelper.AddAttribute(xd, "uniqueIdentifier", cr.UniqueIdentifier.ToString())); xd.DocumentElement.AppendChild(n); } return xd; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/Developer.asmx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/Developer.asmx.cs index 290850967a..978343b7bb 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/Developer.asmx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/Developer.asmx.cs @@ -19,7 +19,7 @@ namespace umbraco.webservices public XmlNode GetMacros(string Login, string Password) { if (ValidateCredentials(Login, Password) - && UserHasAppAccess(DefaultApps.developer.ToString(), Login)) + && UserHasAppAccess(Constants.Applications.Developer.ToString(), Login)) { var xmlDoc = new XmlDocument(); var macros = xmlDoc.CreateElement("macros"); @@ -40,7 +40,7 @@ namespace umbraco.webservices public XmlNode GetMacro(int Id, string Login, string Password) { if (ValidateCredentials(Login, Password) - && UserHasAppAccess(DefaultApps.developer.ToString(), Login)) + && UserHasAppAccess(Constants.Applications.Developer.ToString(), Login)) { var xmlDoc = new XmlDocument(); var macro = xmlDoc.CreateElement("macro"); diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/Settings.asmx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/Settings.asmx.cs index d33e9b842e..4b5f90a681 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/Settings.asmx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/Settings.asmx.cs @@ -20,7 +20,7 @@ namespace umbraco.webservices [WebMethod] public XmlNode GetTabs(string ContextID, int ContentTypeId) { - if (!AuthorizeRequest(DefaultApps.settings.ToString())) + if (!AuthorizeRequest(Constants.Applications.Settings.ToString())) { var xmlDoc = new XmlDocument(); var tabs = xmlDoc.CreateElement("tabs"); 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 6b927a4d29..3b20ac1fdf 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/codeEditorSave.asmx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/codeEditorSave.asmx.cs @@ -38,7 +38,7 @@ namespace umbraco.presentation.webservices [WebMethod] public string SaveCss(string fileName, string oldName, string fileContents, int fileID) { - if (AuthorizeRequest(DefaultApps.settings.ToString())) + 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); @@ -60,7 +60,7 @@ namespace umbraco.presentation.webservices [WebMethod] public string SaveXslt(string fileName, string oldName, string fileContents, bool ignoreDebugging) { - if (AuthorizeRequest(DefaultApps.developer.ToString())) + if (AuthorizeRequest(Constants.Applications.Developer.ToString())) { IOHelper.EnsurePathExists(SystemDirectories.Xslt); @@ -263,7 +263,7 @@ namespace umbraco.presentation.webservices [WebMethod] public string SaveScript(string filename, string oldName, string contents) { - if (AuthorizeRequest(DefaultApps.settings.ToString())) + if (AuthorizeRequest(Constants.Applications.Settings.ToString())) { // validate file @@ -329,7 +329,7 @@ namespace umbraco.presentation.webservices [WebMethod] public string SaveTemplate(string templateName, string templateAlias, string templateContents, int templateID, int masterTemplateID) { - if (AuthorizeRequest(DefaultApps.settings.ToString())) + if (AuthorizeRequest(Constants.Applications.Settings.ToString())) { var _template = new Template(templateID); string retVal = "false"; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/legacyAjaxCalls.asmx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/legacyAjaxCalls.asmx.cs index 850af8012b..e4e292e53f 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/legacyAjaxCalls.asmx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/legacyAjaxCalls.asmx.cs @@ -1,6 +1,5 @@ using System; using System.Web; -using System.Web.Security; using System.Web.Services; using System.ComponentModel; using System.Web.Script.Services; @@ -9,16 +8,15 @@ using System.Xml.Xsl; using System.IO; using System.Text.RegularExpressions; using System.Net; +using System.Security; using System.Web.UI; using Umbraco.Core; using Umbraco.Core.IO; using Umbraco.Web.UI; using Umbraco.Web; -using Umbraco.Web.Cache; using Umbraco.Web.WebServices; using umbraco.BusinessLogic; -using umbraco.businesslogic.Exceptions; using umbraco.cms.businesslogic.web; using umbraco.cms.businesslogic.media; using umbraco.BasePages; @@ -109,7 +107,7 @@ namespace umbraco.presentation.webservices case "media": case "mediaRecycleBin": //ensure user has access to media - AuthorizeRequest(DefaultApps.media.ToString(), true); + AuthorizeRequest(Constants.Applications.Media.ToString(), true); new Media(intNodeId).delete(true); break; @@ -117,7 +115,7 @@ namespace umbraco.presentation.webservices case "contentRecycleBin": default: //ensure user has access to content - AuthorizeRequest(DefaultApps.content.ToString(), true); + AuthorizeRequest(Constants.Applications.Content.ToString(), true); new Document(intNodeId).delete(true); break; @@ -133,7 +131,7 @@ namespace umbraco.presentation.webservices [ScriptMethod] public void DisableUser(int userId) { - AuthorizeRequest(DefaultApps.users.ToString(), true); + AuthorizeRequest(Constants.Applications.Users.ToString(), true); BusinessLogic.User.GetUser(userId).disable(); } @@ -216,7 +214,7 @@ namespace umbraco.presentation.webservices [ScriptMethod] public string TemplateMasterPageContentContainer(int templateId, int masterTemplateId) { - AuthorizeRequest(DefaultApps.settings.ToString(), true); + AuthorizeRequest(Constants.Applications.Settings.ToString(), true); return new cms.businesslogic.template.Template(templateId).GetMasterContentElement(masterTemplateId); } @@ -227,19 +225,19 @@ namespace umbraco.presentation.webservices switch (fileType) { case "xslt": - AuthorizeRequest(DefaultApps.developer.ToString(), true); + AuthorizeRequest(Constants.Applications.Developer.ToString(), true); return SaveXslt(fileName, fileContents, ignoreDebug); case "python": - AuthorizeRequest(DefaultApps.developer.ToString(), true); + AuthorizeRequest(Constants.Applications.Developer.ToString(), true); return "true"; case "css": - AuthorizeRequest(DefaultApps.settings.ToString(), true); + AuthorizeRequest(Constants.Applications.Settings.ToString(), true); return SaveCss(fileName, fileContents, fileID); case "script": - AuthorizeRequest(DefaultApps.settings.ToString(), true); + AuthorizeRequest(Constants.Applications.Settings.ToString(), true); return SaveScript(fileName, fileContents); case "template": - AuthorizeRequest(DefaultApps.settings.ToString(), true); + AuthorizeRequest(Constants.Applications.Settings.ToString(), true); return SaveTemplate(fileName, fileAlias, fileContents, fileID, masterID); default: throw new ArgumentException(String.Format("Invalid fileType passed: '{0}'", fileType)); @@ -455,7 +453,7 @@ namespace umbraco.presentation.webservices { // check for secure connection if (GlobalSettings.UseSSL && !HttpContext.Current.Request.IsSecureConnection) - throw new UserAuthorizationException("This installation requires a secure connection (via SSL). Please update the URL to include https://"); + throw new SecurityException("This installation requires a secure connection (via SSL). Please update the URL to include https://"); if (!BasePage.ValidateUserContextID(BasePages.BasePage.umbracoUserContextID)) throw new Exception("Client authorization failed. User is not logged in"); diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/nodeSorter.asmx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/nodeSorter.asmx.cs index e0feb72c44..eb73d78b5b 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/nodeSorter.asmx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/nodeSorter.asmx.cs @@ -108,8 +108,8 @@ namespace umbraco.presentation.webservices var isMedia = Context.Request.GetItemAsString("app") == "media"; //ensure user is authorized for the app requested - if (isContent && AuthorizeRequest(DefaultApps.content.ToString()) == false) return; - if (isMedia && AuthorizeRequest(DefaultApps.media.ToString()) == false) return; + if (isContent && AuthorizeRequest(Constants.Applications.Content.ToString()) == false) return; + if (isMedia && AuthorizeRequest(Constants.Applications.Media.ToString()) == false) return; var ids = SortOrder.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries); if (isContent) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/publication.asmx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/publication.asmx.cs index 4fca8117d2..1a89a6d80d 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/publication.asmx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/publication.asmx.cs @@ -5,6 +5,7 @@ using System.Web.Script.Services; using Umbraco.Web.WebServices; using umbraco.BusinessLogic; using umbraco.presentation.webservices; +using Umbraco.Core; namespace umbraco.webservices { @@ -20,7 +21,7 @@ namespace umbraco.webservices [ScriptMethod] public int GetPublicationStatus(string key) { - if (!AuthorizeRequest(DefaultApps.content.ToString())) + if (!AuthorizeRequest(Constants.Applications.Content.ToString())) return 0; try @@ -37,7 +38,7 @@ namespace umbraco.webservices [ScriptMethod] public int GetPublicationStatusMax(string key) { - if (!AuthorizeRequest(DefaultApps.content.ToString())) + if (!AuthorizeRequest(Constants.Applications.Content.ToString())) return 0; try @@ -54,7 +55,7 @@ namespace umbraco.webservices [ScriptMethod] public int GetPublicationStatusMaxAll(string key) { - if (!AuthorizeRequest(DefaultApps.content.ToString())) + if (!AuthorizeRequest(Constants.Applications.Content.ToString())) return 0; try @@ -77,7 +78,7 @@ namespace umbraco.webservices [WebMethod] public void SaveXmlCacheToDisk() { - if (!AuthorizeRequest(DefaultApps.content.ToString())) + if (!AuthorizeRequest(Constants.Applications.Content.ToString())) return; } 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 b790c5d225..3a4d52c026 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/templates.asmx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/templates.asmx.cs @@ -26,7 +26,7 @@ namespace umbraco.webservices [WebMethod] public XmlNode GetTemplates(string Login, string Password) { - if (ValidateCredentials(Login, Password) && UserHasAppAccess(DefaultApps.settings.ToString(), Login)) + if (ValidateCredentials(Login, Password) && UserHasAppAccess(Constants.Applications.Settings.ToString(), Login)) { var xmlDoc = new XmlDocument(); xmlDoc.LoadXml(""); @@ -45,7 +45,7 @@ namespace umbraco.webservices [WebMethod] public XmlNode GetTemplate(int Id, string Login, string Password) { - if (ValidateCredentials(Login, Password) && UserHasAppAccess(DefaultApps.settings.ToString(), Login)) + if (ValidateCredentials(Login, Password) && UserHasAppAccess(Constants.Applications.Settings.ToString(), Login)) { var t = new cms.businesslogic.template.Template(Id); var xmlDoc = new XmlDocument(); @@ -62,7 +62,7 @@ namespace umbraco.webservices [WebMethod] public bool UpdateTemplate(int Id, int Master, string Design, string Login, string Password) { - if (ValidateCredentials(Login, Password) && UserHasAppAccess(DefaultApps.settings.ToString(), Login)) + if (ValidateCredentials(Login, Password) && UserHasAppAccess(Constants.Applications.Settings.ToString(), Login)) { try { @@ -88,7 +88,7 @@ namespace umbraco.webservices public string GetCodeSnippet(object templateId) { //NOTE: The legacy code threw an exception so will continue to do that. - AuthorizeRequest(DefaultApps.settings.ToString(), true); + AuthorizeRequest(Constants.Applications.Settings.ToString(), true); var snippetPath = SystemDirectories.Umbraco + "/scripting/templates/cshtml/"; var filePath = IOHelper.MapPath(snippetPath + templateId); diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/trashcan.asmx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/trashcan.asmx.cs index f1bdd6d3d5..85b8f383f6 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/trashcan.asmx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/webservices/trashcan.asmx.cs @@ -6,6 +6,7 @@ using Umbraco.Web.WebServices; using umbraco.BasePages; using umbraco.BusinessLogic; using umbraco.cms.businesslogic; +using Umbraco.Core; namespace umbraco.presentation.webservices { @@ -25,10 +26,10 @@ namespace umbraco.presentation.webservices switch (type) { case RecycleBin.RecycleBinType.Content: - if (!AuthorizeRequest(DefaultApps.content.ToString())) return; + if (!AuthorizeRequest(Constants.Applications.Content.ToString())) return; break; case RecycleBin.RecycleBinType.Media: - if (!AuthorizeRequest(DefaultApps.media.ToString())) return; + if (!AuthorizeRequest(Constants.Applications.Media.ToString())) return; break; default: throw new ArgumentOutOfRangeException("type"); diff --git a/src/umbraco.businesslogic/BasePages/UmbracoEnsuredPage.cs b/src/umbraco.businesslogic/BasePages/UmbracoEnsuredPage.cs index b70d40b2bc..f7bf1f7a28 100644 --- a/src/umbraco.businesslogic/BasePages/UmbracoEnsuredPage.cs +++ b/src/umbraco.businesslogic/BasePages/UmbracoEnsuredPage.cs @@ -1,12 +1,11 @@ using System; using Umbraco.Core.Logging; using System.Linq; +using System.Security; using System.Web; using Umbraco.Core; using Umbraco.Core.IO; -using Umbraco.Core.Logging; using umbraco.BusinessLogic; -using umbraco.businesslogic.Exceptions; using Umbraco.Core.Security; namespace umbraco.BasePages @@ -121,10 +120,10 @@ namespace umbraco.BasePages if (!string.IsNullOrEmpty(CurrentApp)) { if (!ValidateUserApp(CurrentApp)) - throw new UserAuthorizationException(String.Format("The current user doesn't have access to the section/app '{0}'", CurrentApp)); + throw new SecurityException(string.Format("The current user doesn't have access to the section/app '{0}'", CurrentApp)); } } - catch (UserAuthorizationException ex) + catch (SecurityException ex) { LogHelper.Warn(string.Format("{0} tried to access '{1}'", CurrentUser.Id, CurrentApp)); throw; diff --git a/src/umbraco.businesslogic/CacheHelper.cs b/src/umbraco.businesslogic/CacheHelper.cs deleted file mode 100644 index 243da8eadd..0000000000 --- a/src/umbraco.businesslogic/CacheHelper.cs +++ /dev/null @@ -1,31 +0,0 @@ -//using System; -//using System.Web.Caching; - -//namespace umbraco.BusinessLogic -//{ -// internal class CacheHelper -// { -// public delegate TT GetCacheItemDelegate(); -// public static TT GetCacheItem(string cacheKey, object syncLock, -// CacheItemPriority priority, CacheItemRemovedCallback refreshAction, -// CacheDependency cacheDependency, TimeSpan timeout, GetCacheItemDelegate getCacheItem) -// { -// object result = System.Web.HttpRuntime.Cache.Get(cacheKey); -// if (result == null) -// { -// lock (syncLock) -// { -// result = System.Web.HttpRuntime.Cache.Get(cacheKey); -// if (result == null) -// { -// result = getCacheItem(); -// System.Web.HttpRuntime.Cache.Add(cacheKey, result, cacheDependency, -// DateTime.Now.Add(timeout), TimeSpan.Zero, priority, refreshAction); -// } -// } -// } -// return (TT)result; -// } - -// } -//} diff --git a/src/umbraco.businesslogic/DefaultApps.cs b/src/umbraco.businesslogic/DefaultApps.cs deleted file mode 100644 index 63c7c2815e..0000000000 --- a/src/umbraco.businesslogic/DefaultApps.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace umbraco.BusinessLogic -{ - public enum DefaultApps - { - content, - media, - users, - settings, - developer, - member, - translation - } -} \ No newline at end of file diff --git a/src/umbraco.businesslogic/Exceptions/FileSecurityException.cs b/src/umbraco.businesslogic/Exceptions/FileSecurityException.cs deleted file mode 100644 index 1b9f084003..0000000000 --- a/src/umbraco.businesslogic/Exceptions/FileSecurityException.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace umbraco.businesslogic.Exceptions -{ - [Obsolete("This class has been superceded by Umbraco.Core.UI.FileSecurityException")] - public class FileSecurityException : Umbraco.Core.IO.FileSecurityException - { - public FileSecurityException() - : base() - { - - } - - public FileSecurityException(string message) - : base(message) - { - - } - } -} diff --git a/src/umbraco.businesslogic/Exceptions/UserAuthorizationException.cs b/src/umbraco.businesslogic/Exceptions/UserAuthorizationException.cs deleted file mode 100644 index b27d8d0ae3..0000000000 --- a/src/umbraco.businesslogic/Exceptions/UserAuthorizationException.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace umbraco.businesslogic.Exceptions -{ - /// - /// Exception class when an Umbraco user either has wrong credentials or insufficient permissions - /// - public class UserAuthorizationException : Exception - { - public UserAuthorizationException() - { - - } - - public UserAuthorizationException(string message) : base(message) - { - - } - } -} diff --git a/src/umbraco.businesslogic/IconI.cs b/src/umbraco.businesslogic/IconI.cs deleted file mode 100644 index 668f65d443..0000000000 --- a/src/umbraco.businesslogic/IconI.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; - -namespace umbraco.BusinessLogic.console -{ - [Obsolete("REMOVE THIS ASAP!! what is it??")] - public interface IconI - { - Guid UniqueId{get;} - int Id{get;} - - IconI[] Children {get;} - string DefaultEditorURL{get;} - string Text{get;set;} - string OpenImage {get;} - string Image {get;} - } -} \ No newline at end of file diff --git a/src/umbraco.businesslogic/PluginManagerExtensions.cs b/src/umbraco.businesslogic/PluginManagerExtensions.cs index 7a61414315..3db233748a 100644 --- a/src/umbraco.businesslogic/PluginManagerExtensions.cs +++ b/src/umbraco.businesslogic/PluginManagerExtensions.cs @@ -21,16 +21,5 @@ namespace umbraco.businesslogic return resolver.ResolveTypesWithAttribute(cacheResult:false); } - /// - /// Returns all available ITrees in application that are attribute with TreeAttribute - /// - /// - /// - internal static IEnumerable ResolveAttributedTrees(this PluginManager resolver) - { - //don't cache the result of this because it is only used once during app startup, caching will just add a bit more mem overhead for no reason - return resolver.ResolveTypesWithAttribute(cacheResult:false); - } - } } \ No newline at end of file diff --git a/src/umbraco.businesslogic/TreeAttribute.cs b/src/umbraco.businesslogic/TreeAttribute.cs deleted file mode 100644 index f5089ca276..0000000000 --- a/src/umbraco.businesslogic/TreeAttribute.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace umbraco.businesslogic -{ - /// - /// Identifies an application tree - /// - [AttributeUsage(AttributeTargets.Class, AllowMultiple = false)] - public class TreeAttribute : Attribute - { - /// - /// Initializes a new instance of the class. - /// - /// The app alias. - /// The alias. - /// The title. - /// The icon closed. - /// The icon open. - /// The action. - /// if set to true [silent]. - /// if set to true [initialize]. - /// The sort order. - public TreeAttribute(string appAlias, - string alias, - string title, - string iconClosed = ".sprTreeFolder", - string iconOpen = ".sprTreeFolder_o", - string action = "", - bool silent = false, - bool initialize = true, - int sortOrder = 0) - { - ApplicationAlias = appAlias; - Alias = alias; - Title = title; - IconClosed = iconClosed; - IconOpen = iconOpen; - Action = action; - Silent = silent; - Initialize = initialize; - SortOrder = sortOrder; - } - - public string ApplicationAlias { get; private set; } - public string Alias { get; private set; } - public string Title { get; private set; } - public string IconClosed { get; private set; } - public string IconOpen { get; private set; } - - [Obsolete("This doesn't do anything")] - public string Action { get; private set; } - - [Obsolete("This doesn't do anything")] - public bool Silent { get; private set; } - - public bool Initialize { get; private set; } - public int SortOrder { get; private set; } - } -} diff --git a/src/umbraco.businesslogic/Utils/fileHelper.cs b/src/umbraco.businesslogic/Utils/fileHelper.cs deleted file mode 100644 index 6dac4ed113..0000000000 --- a/src/umbraco.businesslogic/Utils/fileHelper.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Security; -using System.IO; -using System.Security.AccessControl; -using System.Security.Authentication; -using System.Security.Cryptography; -using System.Security.Permissions; -using System.Security.Policy; -using System.Security.Principal; - -namespace umbraco.Utils { - public class fileHelper { - - public static bool TestReadWriteAccces(string filePath) { - FileInfo fi = new FileInfo(filePath); - if (!fi.IsReadOnly) - return HasAccces(fi, FileSystemRights.Modify); - else - return false; - } - - public static bool HasAccces(FileInfo fileInfo, FileSystemRights fileSystemRights) { - string identityName = System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToUpper(); - - AuthorizationRuleCollection authorizationRuleCollection = fileInfo.GetAccessControl().GetAccessRules(true, true, typeof(NTAccount)); - - foreach (FileSystemAccessRule fileSystemAccessRule in authorizationRuleCollection) { - if (identityName == fileSystemAccessRule.IdentityReference.Value.ToUpper()) - return AccessControlType.Allow == fileSystemAccessRule.AccessControlType && fileSystemRights == (fileSystemAccessRule.FileSystemRights & fileSystemRights); - } - - return false; - } - } -} diff --git a/src/umbraco.businesslogic/umbraco.businesslogic.csproj b/src/umbraco.businesslogic/umbraco.businesslogic.csproj index fcd9a59500..daffbe8601 100644 --- a/src/umbraco.businesslogic/umbraco.businesslogic.csproj +++ b/src/umbraco.businesslogic/umbraco.businesslogic.csproj @@ -190,10 +190,8 @@ - - Code @@ -204,15 +202,9 @@ ASPXCodeBehind - - - Code - - Code - Code @@ -230,13 +222,9 @@ Code - - - Code - diff --git a/src/umbraco.businesslogic/xmlHelper.cs b/src/umbraco.businesslogic/xmlHelper.cs deleted file mode 100644 index 5d187dbfca..0000000000 --- a/src/umbraco.businesslogic/xmlHelper.cs +++ /dev/null @@ -1,119 +0,0 @@ -using System; -using System.Xml; -using Umbraco.Core.IO; - -namespace umbraco -{ - /// - /// The xmlHelper class contains general helper methods for working with xml in umbraco. - /// - [Obsolete("Use Umbraco.Core.XmlHelper instead")] - public class xmlHelper - { - /// - /// Imports a XML node from text. - /// - /// The text. - /// The XML doc. - /// - public static XmlNode ImportXmlNodeFromText(string text, ref XmlDocument xmlDoc) - { - return Umbraco.Core.XmlHelper.ImportXmlNodeFromText(text, ref xmlDoc); - } - - /// - /// Opens a file as a XmlDocument. - /// - /// The relative file path. ei. /config/umbraco.config - /// Returns a XmlDocument class - public static XmlDocument OpenAsXmlDocument(string filePath) - { - return Umbraco.Core.XmlHelper.OpenAsXmlDocument(filePath); - } - - /// - /// creates a XmlAttribute with the specified name and value - /// - /// The xmldocument. - /// The name of the attribute. - /// The value of the attribute. - /// a XmlAttribute - public static XmlAttribute addAttribute(XmlDocument Xd, string Name, string Value) - { - return Umbraco.Core.XmlHelper.AddAttribute(Xd, Name, Value); - } - - /// - /// Creates a text XmlNode with the specified name and value - /// - /// The xmldocument. - /// The node name. - /// The node value. - /// a XmlNode - public static XmlNode addTextNode(XmlDocument Xd, string Name, string Value) - { - return Umbraco.Core.XmlHelper.AddTextNode(Xd, Name, Value); - } - - /// - /// Creates a cdata XmlNode with the specified name and value - /// - /// The xmldocument. - /// The node name. - /// The node value. - /// A XmlNode - public static XmlNode addCDataNode(XmlDocument Xd, string Name, string Value) - { - return Umbraco.Core.XmlHelper.AddCDataNode(Xd, Name, Value); - } - - /// - /// Gets the value of a XmlNode - /// - /// The XmlNode. - /// the value as a string - public static string GetNodeValue(XmlNode n) - { - return Umbraco.Core.XmlHelper.GetNodeValue(n); - } - - /// - /// Determines whether the specified string appears to be XML. - /// - /// The XML string. - /// - /// true if the specified string appears to be XML; otherwise, false. - /// - public static bool CouldItBeXml(string xml) - { - return Umbraco.Core.XmlHelper.CouldItBeXml(xml); - } - - /// - /// Splits the specified delimited string into an XML document. - /// - /// The data. - /// The separator. - /// Name of the root. - /// Name of the element. - /// Returns an System.Xml.XmlDocument representation of the delimited string data. - public static XmlDocument Split(string data, string[] separator, string rootName, string elementName) - { - return Umbraco.Core.XmlHelper.Split(data, separator, rootName, elementName); - } - - /// - /// Splits the specified delimited string into an XML document. - /// - /// The XML document. - /// The delimited string data. - /// The separator. - /// Name of the root node. - /// Name of the element node. - /// Returns an System.Xml.XmlDocument representation of the delimited string data. - public static XmlDocument Split(XmlDocument xml, string data, string[] separator, string rootName, string elementName) - { - return Umbraco.Core.XmlHelper.Split(xml, data, separator, rootName, elementName); - } - } -} diff --git a/src/umbraco.cms/businesslogic/CMSNode.cs b/src/umbraco.cms/businesslogic/CMSNode.cs index 8a34d1735a..f98067ed35 100644 --- a/src/umbraco.cms/businesslogic/CMSNode.cs +++ b/src/umbraco.cms/businesslogic/CMSNode.cs @@ -34,7 +34,7 @@ namespace umbraco.cms.businesslogic /// distinguishing the different types of CMSNodes (ex. Documents/Medias/Stylesheets/documenttypes and so forth). /// [Obsolete("Obsolete, This class will eventually be phased out", false)] - public class CMSNode : BusinessLogic.console.IconI + public class CMSNode { #region Private Members @@ -809,7 +809,7 @@ order by level,sortOrder"; /// The basic recursive tree pattern /// /// The children. - public virtual BusinessLogic.console.IconI[] Children + public virtual CMSNode[] Children { get { @@ -839,7 +839,7 @@ order by level,sortOrder"; /// Use with care. /// /// The children of all object types. - public BusinessLogic.console.IconI[] ChildrenOfAllObjectTypes + public CMSNode[] ChildrenOfAllObjectTypes { get { @@ -1086,18 +1086,18 @@ order by level,sortOrder"; 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())); + 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.Parent.Id.ToString())); + x.Attributes.Append(XmlHelper.AddAttribute(xd, "parentID", this.Parent.Id.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)); + 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) { diff --git a/src/umbraco.cms/businesslogic/ContentItem/ContentItem.cs b/src/umbraco.cms/businesslogic/ContentItem/ContentItem.cs deleted file mode 100644 index b5ea54e5bb..0000000000 --- a/src/umbraco.cms/businesslogic/ContentItem/ContentItem.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; - -namespace umbraco.cms.businesslogic.contentitem -{ - /// - /// Summary description for ContentItem. - /// - public class ContentItem : Content - { - public ContentItem(int id) : base(id) - { - } - public ContentItem(Guid id) : base(id) - { - } - - public static void DeleteFromType(ContentItemType cit) - { - var objs = Content.getContentOfContentType(cit); - foreach (Content c in objs) - { - // due to recursive structure document might already been deleted.. - if (CMSNode.IsNode(c.UniqueId)) - { - ContentItem tmp = new ContentItem(c.UniqueId); - tmp.delete(); - } - } - } - - - - - new public void delete() - { - foreach (ContentItem d in this.Children) - { - d.delete(); - } - base.delete(); - } - - new public ContentItem[] Children - { - get - { - BusinessLogic.console.IconI[] tmp = base.Children; - ContentItem[] retval = new ContentItem[tmp.Length]; - for (int i = 0; i < tmp.Length; i++) retval[i] = new ContentItem(tmp[i].UniqueId); - return retval; - } - } - } -} diff --git a/src/umbraco.cms/businesslogic/ContentItem/ContentItemType.cs b/src/umbraco.cms/businesslogic/ContentItem/ContentItemType.cs deleted file mode 100644 index 786fe95d83..0000000000 --- a/src/umbraco.cms/businesslogic/ContentItem/ContentItemType.cs +++ /dev/null @@ -1,67 +0,0 @@ -using System; - -namespace umbraco.cms.businesslogic.contentitem -{ - /// - /// Summary description for ContentItemType. - /// - public class ContentItemType : ContentType - { - private static Guid _objectType = new Guid("7a333c54-6f43-40a4-86a2-18688dc7e532 "); - public ContentItemType(int id) : base(id) - { - // - // TODO: Add constructor logic here - // - } - public ContentItemType(Guid id) : base(id) - { - // - // TODO: Add constructor logic here - // - } - - - /// - /// Used to persist object changes to the database. In Version3.0 it's just a stub for future compatibility - /// - public override void Save() - { - } - - - - - public static ContentItemType MakeNew( BusinessLogic.User u,string Text) - { - - int ParentId= -1; - int level = 1; - Guid uniqueId = Guid.NewGuid(); - CMSNode n = CMSNode.MakeNew(ParentId, _objectType, u.Id, level,Text, uniqueId); - - ContentType.Create(n.Id, Text,""); - - return new ContentItemType(n.Id); - } - - new public static ContentItemType[] GetAll - { - get - { - Guid[] Ids = CMSNode.getAllUniquesFromObjectType(_objectType); - ContentItemType[] retVal = new ContentItemType[Ids.Length]; - for (int i = 0; i < Ids.Length; i++) retVal[i] = new ContentItemType(Ids[i]); - return retVal; - } - } - - new public void delete() - { - // delete all documents of this type - ContentItem.DeleteFromType(this); - // Delete contentType - base.delete(); - } - } -} diff --git a/src/umbraco.cms/businesslogic/ContentType.cs b/src/umbraco.cms/businesslogic/ContentType.cs index 1a1fb05590..da498593da 100644 --- a/src/umbraco.cms/businesslogic/ContentType.cs +++ b/src/umbraco.cms/businesslogic/ContentType.cs @@ -4,14 +4,10 @@ using System.Collections.Generic; using System.Threading; using System.Runtime.CompilerServices; using System.Linq; -using System.Xml; using Umbraco.Core; using Umbraco.Core.Cache; -using Umbraco.Core.Logging; using Umbraco.Core.Models; using Umbraco.Core.Models.Rdbms; - -using umbraco.cms.businesslogic.cache; using umbraco.cms.businesslogic.propertytype; using umbraco.cms.businesslogic.web; using umbraco.DataLayer; diff --git a/src/umbraco.cms/businesslogic/Dictionary.cs b/src/umbraco.cms/businesslogic/Dictionary.cs index 8e76122175..b282493f07 100644 --- a/src/umbraco.cms/businesslogic/Dictionary.cs +++ b/src/umbraco.cms/businesslogic/Dictionary.cs @@ -292,7 +292,7 @@ namespace umbraco.cms.businesslogic foreach (XmlNode xn in values) { string cA = xn.Attributes["LanguageCultureAlias"].Value; - string keyValue = xmlHelper.GetNodeValue(xn); + string keyValue = XmlHelper.GetNodeValue(xn); Language valueLang = Language.GetByCultureCode(cA); diff --git a/src/umbraco.cms/businesslogic/Files/IFile.cs b/src/umbraco.cms/businesslogic/Files/IFile.cs deleted file mode 100644 index 5f018b688f..0000000000 --- a/src/umbraco.cms/businesslogic/Files/IFile.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace umbraco.cms.businesslogic.Files -{ - [Obsolete("This is no longer used ane will be removed from the codebase in the future")] - public interface IFile - { - string Filename { get; } - string Extension { get; } - [Obsolete("LocalName is obsolete, please use URL instead", false)] - string LocalName { get; } - string Path { get; } - string Url { get; } - bool SupportsResizing { get; } - string GetFriendlyName(); - System.Tuple GetDimensions(); - string Resize(int width, int height); - string Resize(int maxWidthHeight, string fileNameAddition); - } -} diff --git a/src/umbraco.cms/businesslogic/Files/NotAnImageException.cs b/src/umbraco.cms/businesslogic/Files/NotAnImageException.cs deleted file mode 100644 index 7ea71e2426..0000000000 --- a/src/umbraco.cms/businesslogic/Files/NotAnImageException.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace umbraco.cms.businesslogic.Files -{ - [Obsolete("This is no longer used ane will be removed from the codebase in the future")] - public class NotAnImageException : Exception - { - public NotAnImageException() - : base() - { - - } - - public NotAnImageException(string message) : base(message) - { - - } - } -} diff --git a/src/umbraco.cms/businesslogic/Files/UmbracoFile.cs b/src/umbraco.cms/businesslogic/Files/UmbracoFile.cs deleted file mode 100644 index 5822e8c72c..0000000000 --- a/src/umbraco.cms/businesslogic/Files/UmbracoFile.cs +++ /dev/null @@ -1,133 +0,0 @@ -using System; -using System.Drawing; -using System.Drawing.Drawing2D; -using System.Drawing.Imaging; -using System.IO; -using System.Linq; -using System.Web; -using Umbraco.Core; -using Umbraco.Core.IO; - -namespace umbraco.cms.businesslogic.Files -{ - [Obsolete("Use Umbraco.Core.IO.UmbracoMediaFile instead")] - public class UmbracoFile : IFile - { - private readonly UmbracoMediaFile _mediaFile; - - #region Constructors - - public UmbracoFile() - { - _mediaFile = new UmbracoMediaFile(); - } - - public UmbracoFile(string path) - { - _mediaFile = new UmbracoMediaFile(path); - } - - internal UmbracoFile(UmbracoMediaFile mediaFile) - { - _mediaFile = mediaFile; - } - - #endregion - - #region Static Methods - - //MB: Do we really need all these overloads? looking through the code, only one of them is actually used - - public static UmbracoFile Save(HttpPostedFile file, string path) - { - return new UmbracoFile(UmbracoMediaFile.Save(file.InputStream, path)); - } - - public static UmbracoFile Save(HttpPostedFileBase file, string path) - { - return new UmbracoFile(UmbracoMediaFile.Save(file.InputStream, path)); - } - - public static UmbracoFile Save(Stream inputStream, string path) - { - return new UmbracoFile(UmbracoMediaFile.Save(inputStream, path)); - } - - public static UmbracoFile Save(byte[] file, string relativePath) - { - return new UmbracoFile(UmbracoMediaFile.Save(new MemoryStream(file), relativePath)); - } - - public static UmbracoFile Save(HttpPostedFile file) - { - return new UmbracoFile(UmbracoMediaFile.Save(file)); - } - - //filebase overload... - public static UmbracoFile Save(HttpPostedFileBase file) - { - return new UmbracoFile(UmbracoMediaFile.Save(file)); - } - - #endregion - - public string Filename - { - get { return _mediaFile.Filename; } - } - - public string Extension - { - get { return _mediaFile.Extension; } - } - - [Obsolete("LocalName is obsolete, please use Url instead", false)] - public string LocalName - { - get { return Url; } - } - - public string Path - { - get { return _mediaFile.Path; } - } - - public string Url - { - get { return _mediaFile.Url; } - } - - public long Length - { - get { return _mediaFile.Length; } - } - - public bool SupportsResizing - { - get { return _mediaFile.SupportsResizing; } - } - - public string GetFriendlyName() - { - return _mediaFile.GetFriendlyName(); - } - - public System.Tuple GetDimensions() - { - var size = _mediaFile.GetDimensions(); - return new System.Tuple(size.Width, size.Height); - } - - public string Resize(int width, int height) - { - return _mediaFile.Resize(width, height); - } - - public string Resize(int maxWidthHeight, string fileNameAddition) - { - return _mediaFile.Resize(maxWidthHeight, fileNameAddition); - } - - } - -} diff --git a/src/umbraco.cms/businesslogic/ISaveHandlerContents.cs b/src/umbraco.cms/businesslogic/ISaveHandlerContents.cs deleted file mode 100644 index e9e2c285a2..0000000000 --- a/src/umbraco.cms/businesslogic/ISaveHandlerContents.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace umbraco.cms.businesslogic -{ - /// - /// Not implemented - /// - public interface ISaveHandlerContents - { - /// - /// Not implemented - /// - bool Execute(Content contentObject); - } -} diff --git a/src/umbraco.cms/businesslogic/Packager/PackageActions/helper.cs b/src/umbraco.cms/businesslogic/Packager/PackageActions/PackageHelper.cs similarity index 89% rename from src/umbraco.cms/businesslogic/Packager/PackageActions/helper.cs rename to src/umbraco.cms/businesslogic/Packager/PackageActions/PackageHelper.cs index fedb99f93e..1f263df998 100644 --- a/src/umbraco.cms/businesslogic/Packager/PackageActions/helper.cs +++ b/src/umbraco.cms/businesslogic/Packager/PackageActions/PackageHelper.cs @@ -1,80 +1,81 @@ -using System; -using System.Xml; - -namespace umbraco.cms.businesslogic.packager.standardPackageActions -{ - public class helper - { - //Helper method to replace umbraco tags that breaks the xml format.. - public static string parseToValidXml(template.Template templateObj, ref bool hasAspNetContentBeginning, string template, bool toValid) - { - string retVal = template; - if (toValid) - { - // test for asp:content as the first part of the design - if (retVal.StartsWith("") + 1); - retVal = retVal.Substring(0, retVal.Length - 14); - } - //shorten empty macro tags.. - retVal = retVal.Replace(">", " />"); - retVal = retVal.Replace(">", " />"); - - retVal = retVal.Replace("", ""); - retVal = retVal.Replace("", ""); - retVal = retVal.Replace("", ""); - - // add asp content element - if (hasAspNetContentBeginning) - { - retVal = templateObj.GetMasterContentElement(templateObj.MasterTemplate) + retVal + ""; - } - } - - return retVal; - } - - public static XmlNode parseStringToXmlNode(string value) - { - XmlDocument doc = new XmlDocument(); - XmlNode node = xmlHelper.addTextNode(doc, "error", ""); - - try - { - doc.LoadXml(value); - return doc.SelectSingleNode("."); - } - catch - { - return node; - } - - } - } +using System; +using System.Xml; +using Umbraco.Core; + +namespace umbraco.cms.businesslogic.packager.standardPackageActions +{ + public class PackageHelper + { + //Helper method to replace umbraco tags that breaks the xml format.. + public static string ParseToValidXml(template.Template templateObj, ref bool hasAspNetContentBeginning, string template, bool toValid) + { + string retVal = template; + if (toValid) + { + // test for asp:content as the first part of the design + if (retVal.StartsWith("") + 1); + retVal = retVal.Substring(0, retVal.Length - 14); + } + //shorten empty macro tags.. + retVal = retVal.Replace(">", " />"); + retVal = retVal.Replace(">", " />"); + + retVal = retVal.Replace("", ""); + retVal = retVal.Replace("", ""); + retVal = retVal.Replace("", ""); + + // add asp content element + if (hasAspNetContentBeginning) + { + retVal = templateObj.GetMasterContentElement(templateObj.MasterTemplate) + retVal + ""; + } + } + + return retVal; + } + + public static XmlNode ParseStringToXmlNode(string value) + { + XmlDocument doc = new XmlDocument(); + XmlNode node = XmlHelper.AddTextNode(doc, "error", ""); + + try + { + doc.LoadXml(value); + return doc.SelectSingleNode("."); + } + catch + { + return node; + } + + } + } } \ No newline at end of file diff --git a/src/umbraco.cms/businesslogic/Packager/PackageActions/addApplicationTree.cs b/src/umbraco.cms/businesslogic/Packager/PackageActions/addApplicationTree.cs index 6d6d3db6cf..d61c6395d2 100644 --- a/src/umbraco.cms/businesslogic/Packager/PackageActions/addApplicationTree.cs +++ b/src/umbraco.cms/businesslogic/Packager/PackageActions/addApplicationTree.cs @@ -77,7 +77,7 @@ namespace umbraco.cms.businesslogic.packager.standardPackageActions { string sample = ""; - return helper.parseStringToXmlNode(sample); + return PackageHelper.ParseStringToXmlNode(sample); } } } diff --git a/src/umbraco.cms/businesslogic/Packager/PackageActions/addProxyFeedHost.cs b/src/umbraco.cms/businesslogic/Packager/PackageActions/addProxyFeedHost.cs index 2c718a1d41..d9e5008b85 100644 --- a/src/umbraco.cms/businesslogic/Packager/PackageActions/addProxyFeedHost.cs +++ b/src/umbraco.cms/businesslogic/Packager/PackageActions/addProxyFeedHost.cs @@ -1,4 +1,5 @@ using System.Xml; +using Umbraco.Core; using Umbraco.Core.IO; namespace umbraco.cms.businesslogic.packager.standardPackageActions @@ -13,7 +14,7 @@ namespace umbraco.cms.businesslogic.packager.standardPackageActions if (string.IsNullOrEmpty(hostname)) return false; - var xdoc = xmlHelper.OpenAsXmlDocument(SystemFiles.FeedProxyConfig); + var xdoc = XmlHelper.OpenAsXmlDocument(SystemFiles.FeedProxyConfig); xdoc.PreserveWhitespace = true; @@ -33,8 +34,8 @@ namespace umbraco.cms.businesslogic.packager.standardPackageActions if (insert) { - var newHostname = xmlHelper.addTextNode(xdoc, "allow", string.Empty); - newHostname.Attributes.Append(xmlHelper.addAttribute(xdoc, "host", hostname)); + var newHostname = XmlHelper.AddTextNode(xdoc, "allow", string.Empty); + newHostname.Attributes.Append(XmlHelper.AddAttribute(xdoc, "host", hostname)); xn.AppendChild(newHostname); xdoc.Save(IOHelper.MapPath(SystemFiles.FeedProxyConfig)); @@ -57,7 +58,7 @@ namespace umbraco.cms.businesslogic.packager.standardPackageActions if (string.IsNullOrEmpty(hostname)) return false; - var xdoc = xmlHelper.OpenAsXmlDocument(SystemFiles.FeedProxyConfig); + var xdoc = XmlHelper.OpenAsXmlDocument(SystemFiles.FeedProxyConfig); xdoc.PreserveWhitespace = true; var xn = xdoc.SelectSingleNode("//feedProxy"); @@ -91,7 +92,7 @@ namespace umbraco.cms.businesslogic.packager.standardPackageActions public XmlNode SampleXml() { string sample = ""; - return helper.parseStringToXmlNode(sample); + return PackageHelper.ParseStringToXmlNode(sample); } } } \ No newline at end of file diff --git a/src/umbraco.cms/businesslogic/Packager/PackageActions/addStringToHtmlElement.cs b/src/umbraco.cms/businesslogic/Packager/PackageActions/addStringToHtmlElement.cs index 47cfd2e15c..9973fbc79d 100644 --- a/src/umbraco.cms/businesslogic/Packager/PackageActions/addStringToHtmlElement.cs +++ b/src/umbraco.cms/businesslogic/Packager/PackageActions/addStringToHtmlElement.cs @@ -1,5 +1,6 @@ using System; using System.Xml; +using Umbraco.Core; using Umbraco.Core.Configuration; using Umbraco.Core.Logging; @@ -33,7 +34,7 @@ namespace umbraco.cms.businesslogic.packager.standardPackageActions string templateAlias = xmlData.Attributes["templateAlias"].Value; string htmlElementId = xmlData.Attributes["htmlElementId"].Value; string position = xmlData.Attributes["position"].Value; - string value = xmlHelper.GetNodeValue(xmlData); + string value = XmlHelper.GetNodeValue(xmlData); template.Template tmp = template.Template.GetByAlias(templateAlias); if (UmbracoConfig.For.UmbracoSettings().Templates.UseAspNetMasterPages) @@ -55,7 +56,7 @@ namespace umbraco.cms.businesslogic.packager.standardPackageActions { string templateAlias = xmlData.Attributes["templateAlias"].Value; string htmlElementId = xmlData.Attributes["htmlElementId"].Value; - string value = xmlHelper.GetNodeValue(xmlData); + string value = XmlHelper.GetNodeValue(xmlData); template.Template tmp = template.Template.GetByAlias(templateAlias); if (UmbracoConfig.For.UmbracoSettings().Templates.UseAspNetMasterPages) @@ -95,9 +96,9 @@ namespace umbraco.cms.businesslogic.packager.standardPackageActions //making sure that the template xml has a root node... if (tmp.MasterTemplate > 0) - templateXml.LoadXml(helper.parseToValidXml(tmp, ref hasAspNetContentBeginning, "" + design + "", true)); + templateXml.LoadXml(PackageHelper.ParseToValidXml(tmp, ref hasAspNetContentBeginning, "" + design + "", true)); else - templateXml.LoadXml(helper.parseToValidXml(tmp, ref hasAspNetContentBeginning, design, true)); + templateXml.LoadXml(PackageHelper.ParseToValidXml(tmp, ref hasAspNetContentBeginning, design, true)); XmlNode xmlElement = templateXml.SelectSingleNode("//* [@id = '" + htmlElementId + "']"); @@ -106,15 +107,15 @@ namespace umbraco.cms.businesslogic.packager.standardPackageActions if (position == "beginning") { - xmlElement.InnerXml = "\n" + helper.parseToValidXml(tmp, ref hasAspNetContentBeginning, value, true) + "\n" + xmlElement.InnerXml; + xmlElement.InnerXml = "\n" + PackageHelper.ParseToValidXml(tmp, ref hasAspNetContentBeginning, value, true) + "\n" + xmlElement.InnerXml; } else { - xmlElement.InnerXml = xmlElement.InnerXml + "\n" + helper.parseToValidXml(tmp, ref hasAspNetContentBeginning, value, true) + "\n"; + xmlElement.InnerXml = xmlElement.InnerXml + "\n" + PackageHelper.ParseToValidXml(tmp, ref hasAspNetContentBeginning, value, true) + "\n"; } } - tmp.Design = directive + "\n" + helper.parseToValidXml(tmp, ref hasAspNetContentBeginning, templateXml.OuterXml, false); + tmp.Design = directive + "\n" + PackageHelper.ParseToValidXml(tmp, ref hasAspNetContentBeginning, templateXml.OuterXml, false); tmp.Save(); } catch (Exception ex) @@ -148,9 +149,9 @@ namespace umbraco.cms.businesslogic.packager.standardPackageActions //making sure that the template xml has a root node... if (tmp.MasterTemplate > 0) - templateXml.LoadXml(helper.parseToValidXml(tmp, ref hasAspNetContentBeginning, "" + design + "", true)); + templateXml.LoadXml(PackageHelper.ParseToValidXml(tmp, ref hasAspNetContentBeginning, "" + design + "", true)); else - templateXml.LoadXml(helper.parseToValidXml(tmp, ref hasAspNetContentBeginning, design, true)); + templateXml.LoadXml(PackageHelper.ParseToValidXml(tmp, ref hasAspNetContentBeginning, design, true)); XmlNode xmlElement = templateXml.SelectSingleNode("//* [@id = '" + htmlElementId + "']"); @@ -158,11 +159,11 @@ namespace umbraco.cms.businesslogic.packager.standardPackageActions if (xmlElement != null) { - string repValue = helper.parseToValidXml(tmp, ref hasAspNetContentBeginning, value, true); + string repValue = PackageHelper.ParseToValidXml(tmp, ref hasAspNetContentBeginning, value, true); xmlElement.InnerXml = xmlElement.InnerXml.Replace(repValue, ""); } - tmp.Design = directive + "\n" + helper.parseToValidXml(tmp, ref hasAspNetContentBeginning, templateXml.OuterXml, false); + tmp.Design = directive + "\n" + PackageHelper.ParseToValidXml(tmp, ref hasAspNetContentBeginning, templateXml.OuterXml, false); tmp.Save(); } catch (Exception ex) diff --git a/src/umbraco.cms/businesslogic/Packager/data.cs b/src/umbraco.cms/businesslogic/Packager/data.cs index 2d153daaa5..eb2113ef23 100644 --- a/src/umbraco.cms/businesslogic/Packager/data.cs +++ b/src/umbraco.cms/businesslogic/Packager/data.cs @@ -102,48 +102,48 @@ namespace umbraco.cms.businesslogic.packager } XmlElement instance = Source.CreateElement("package"); - instance.Attributes.Append(xmlHelper.addAttribute(Source, "id", _maxId.ToString())); - instance.Attributes.Append(xmlHelper.addAttribute(Source, "version", "")); - instance.Attributes.Append(xmlHelper.addAttribute(Source, "url", "")); - instance.Attributes.Append(xmlHelper.addAttribute(Source, "name", Name)); - instance.Attributes.Append(xmlHelper.addAttribute(Source, "folder", System.Guid.NewGuid().ToString())); - instance.Attributes.Append(xmlHelper.addAttribute(Source, "packagepath", "")); - instance.Attributes.Append(xmlHelper.addAttribute(Source, "repositoryGuid", "")); - instance.Attributes.Append(xmlHelper.addAttribute(Source, "packageGuid", System.Guid.NewGuid().ToString())); - instance.Attributes.Append(xmlHelper.addAttribute(Source, "hasUpdate", "false")); + instance.Attributes.Append(XmlHelper.AddAttribute(Source, "id", _maxId.ToString())); + instance.Attributes.Append(XmlHelper.AddAttribute(Source, "version", "")); + instance.Attributes.Append(XmlHelper.AddAttribute(Source, "url", "")); + instance.Attributes.Append(XmlHelper.AddAttribute(Source, "name", Name)); + instance.Attributes.Append(XmlHelper.AddAttribute(Source, "folder", System.Guid.NewGuid().ToString())); + instance.Attributes.Append(XmlHelper.AddAttribute(Source, "packagepath", "")); + instance.Attributes.Append(XmlHelper.AddAttribute(Source, "repositoryGuid", "")); + instance.Attributes.Append(XmlHelper.AddAttribute(Source, "packageGuid", System.Guid.NewGuid().ToString())); + instance.Attributes.Append(XmlHelper.AddAttribute(Source, "hasUpdate", "false")); - instance.Attributes.Append(xmlHelper.addAttribute(Source, "enableSkins", "false")); - instance.Attributes.Append(xmlHelper.addAttribute(Source, "skinRepoGuid", "")); + instance.Attributes.Append(XmlHelper.AddAttribute(Source, "enableSkins", "false")); + instance.Attributes.Append(XmlHelper.AddAttribute(Source, "skinRepoGuid", "")); XmlElement license = Source.CreateElement("license"); license.InnerText = "MIT License"; - license.Attributes.Append(xmlHelper.addAttribute(Source, "url", "http://opensource.org/licenses/MIT")); + license.Attributes.Append(XmlHelper.AddAttribute(Source, "url", "http://opensource.org/licenses/MIT")); instance.AppendChild(license); XmlElement author = Source.CreateElement("author"); author.InnerText = ""; - author.Attributes.Append(xmlHelper.addAttribute(Source, "url", "")); + author.Attributes.Append(XmlHelper.AddAttribute(Source, "url", "")); instance.AppendChild(author); - instance.AppendChild(xmlHelper.addTextNode(Source, "readme", "")); - instance.AppendChild(xmlHelper.addTextNode(Source, "actions", "")); + instance.AppendChild(XmlHelper.AddTextNode(Source, "readme", "")); + instance.AppendChild(XmlHelper.AddTextNode(Source, "actions", "")); - instance.AppendChild(xmlHelper.addTextNode(Source, "datatypes", "")); + instance.AppendChild(XmlHelper.AddTextNode(Source, "datatypes", "")); XmlElement content = Source.CreateElement("content"); content.InnerText = ""; - content.Attributes.Append(xmlHelper.addAttribute(Source, "nodeId", "")); - content.Attributes.Append(xmlHelper.addAttribute(Source, "loadChildNodes", "false")); + content.Attributes.Append(XmlHelper.AddAttribute(Source, "nodeId", "")); + content.Attributes.Append(XmlHelper.AddAttribute(Source, "loadChildNodes", "false")); instance.AppendChild(content); - instance.AppendChild(xmlHelper.addTextNode(Source, "templates", "")); - instance.AppendChild(xmlHelper.addTextNode(Source, "stylesheets", "")); - instance.AppendChild(xmlHelper.addTextNode(Source, "documenttypes", "")); - instance.AppendChild(xmlHelper.addTextNode(Source, "macros", "")); - instance.AppendChild(xmlHelper.addTextNode(Source, "files", "")); - instance.AppendChild(xmlHelper.addTextNode(Source, "languages", "")); - instance.AppendChild(xmlHelper.addTextNode(Source, "dictionaryitems", "")); - instance.AppendChild(xmlHelper.addTextNode(Source, "loadcontrol", "")); + instance.AppendChild(XmlHelper.AddTextNode(Source, "templates", "")); + instance.AppendChild(XmlHelper.AddTextNode(Source, "stylesheets", "")); + instance.AppendChild(XmlHelper.AddTextNode(Source, "documenttypes", "")); + instance.AppendChild(XmlHelper.AddTextNode(Source, "macros", "")); + instance.AppendChild(XmlHelper.AddTextNode(Source, "files", "")); + instance.AppendChild(XmlHelper.AddTextNode(Source, "languages", "")); + instance.AppendChild(XmlHelper.AddTextNode(Source, "dictionaryitems", "")); + instance.AppendChild(XmlHelper.AddTextNode(Source, "loadcontrol", "")); Source.SelectSingleNode("packages").AppendChild(instance); Source.Save(dataSource); @@ -309,7 +309,7 @@ namespace umbraco.cms.businesslogic.packager _xmlDef.SelectSingleNode("readme").InnerXml = ""; if(_xmlDef.SelectSingleNode("actions") == null) - _xmlDef.AppendChild(xmlHelper.addTextNode(Source, "actions", "")); + _xmlDef.AppendChild(XmlHelper.AddTextNode(Source, "actions", "")); _xmlDef.SelectSingleNode("actions").InnerXml = package.Actions; @@ -329,7 +329,7 @@ namespace umbraco.cms.businesslogic.packager foreach (string fileStr in package.Files) { if(!string.IsNullOrEmpty(fileStr.Trim())) - _xmlDef.SelectSingleNode("files").AppendChild(xmlHelper.addTextNode(data.Source, "file", fileStr)); + _xmlDef.SelectSingleNode("files").AppendChild(XmlHelper.AddTextNode(data.Source, "file", fileStr)); } _xmlDef.SelectSingleNode("loadcontrol").InnerText = package.LoadControl; @@ -355,7 +355,7 @@ namespace umbraco.cms.businesslogic.packager private static string safeNodeValue(XmlNode n) { try { - return xmlHelper.GetNodeValue(n); + return XmlHelper.GetNodeValue(n); } catch { return ""; } diff --git a/src/umbraco.cms/businesslogic/ProviderBase.cs b/src/umbraco.cms/businesslogic/ProviderBase.cs deleted file mode 100644 index 0a6ca7052f..0000000000 --- a/src/umbraco.cms/businesslogic/ProviderBase.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace umbraco.cms.businesslogic -{ - public abstract class ProviderBase - { - public string Name { get; set; } - public string Description { get; set; } - } -} diff --git a/src/umbraco.cms/businesslogic/RecycleBin.cs b/src/umbraco.cms/businesslogic/RecycleBin.cs index 3f4ad28b94..934506b204 100644 --- a/src/umbraco.cms/businesslogic/RecycleBin.cs +++ b/src/umbraco.cms/businesslogic/RecycleBin.cs @@ -151,7 +151,7 @@ namespace umbraco.cms.businesslogic #endregion #region Public properties - public override umbraco.BusinessLogic.console.IconI[] Children + public override CMSNode[] Children { get { diff --git a/src/umbraco.cms/businesslogic/Tuple.cs b/src/umbraco.cms/businesslogic/Tuple.cs deleted file mode 100644 index 6034f187b4..0000000000 --- a/src/umbraco.cms/businesslogic/Tuple.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Collections; - -namespace umbraco.cms.businesslogic -{ - [Obsolete("umbraco.cms.businesslogic.Tuple is Obsolete, use System.Tuple instead")] - public class Tuple : IEquatable> - { - public T first { get; set; } - public T second { get; set; } - - public bool Equals(Tuple other) - { - if (ReferenceEquals(null, other)) return false; - if (ReferenceEquals(this, other)) return true; - return Equals(other.first, this.first) && Equals(other.second, this.second); - } - - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) return false; - if (obj.GetType() != typeof(Tuple)) return false; - return Equals((Tuple)obj); - } - - public override int GetHashCode() - { - unchecked - { - return ((this.first != null ? this.first.GetHashCode() : 0) * 397) ^ (this.second != null ? this.second.GetHashCode() : 0); - } - } - - } -} diff --git a/src/umbraco.cms/businesslogic/cache/Cache.cs b/src/umbraco.cms/businesslogic/cache/Cache.cs deleted file mode 100644 index dc6946a6b3..0000000000 --- a/src/umbraco.cms/businesslogic/cache/Cache.cs +++ /dev/null @@ -1,124 +0,0 @@ -using System; -using System.Web.Caching; -using System.Web; -using Umbraco.Core; - -namespace umbraco.cms.businesslogic.cache -{ - /// - /// Used to easily store and retrieve items from the cache. - /// - /// - /// This whole class will become obsolete, however one of the methods is still used that is not ported over to the new CacheHelper - /// class so that is why the class declaration is not marked obsolete. - /// We haven't migrated it because I don't know why it is needed. - /// - [Obsolete("Use the ApplicationContext.Current.ApplicationCache instead")] - public class Cache - { - /// - /// Clears everything in umbraco's runtime cache, which means that not only - /// umbraco content is removed, but also other cache items from pages running in - /// the same application / website. Use with care :-) - /// - [Obsolete("Use the ApplicationContext.Current.ApplicationCache.ClearAllCache instead")] - public static void ClearAllCache() - { - var helper = new CacheHelper(System.Web.HttpRuntime.Cache); - helper.ClearAllCache(); - } - - /// - /// Clears the item in umbraco's runtime cache with the given key - /// - /// Key - [Obsolete("Use the ApplicationContext.Current.ApplicationCache.ClearCacheItem instead")] - public static void ClearCacheItem(string key) - { - var helper = new CacheHelper(System.Web.HttpRuntime.Cache); - helper.ClearCacheItem(key); - } - - - /// - /// Clears all objects in the System.Web.Cache with the System.Type name as the - /// input parameter. (using [object].GetType()) - /// - /// The name of the System.Type which should be cleared from cache ex "System.Xml.XmlDocument" - [Obsolete("Use the ApplicationContext.Current.ApplicationCache.ClearCacheObjectTypes instead")] - public static void ClearCacheObjectTypes(string TypeName) - { - var helper = new CacheHelper(System.Web.HttpRuntime.Cache); - helper.ClearCacheObjectTypes(TypeName); - } - - /// - /// Clears all cache items that starts with the key passed. - /// - /// The start of the key - [Obsolete("Use the ApplicationContext.Current.ApplicationCache.ClearCacheByKeySearch instead")] - public static void ClearCacheByKeySearch(string KeyStartsWith) - { - var helper = new CacheHelper(System.Web.HttpRuntime.Cache); - helper.ClearCacheByKeySearch(KeyStartsWith); - } - - /// - /// Retrieve all cached items - /// - /// A hastable containing all cacheitems - [Obsolete("This method should not be used, use other methods to return specific cached items")] - public static System.Collections.Hashtable ReturnCacheItemsOrdred() - { - System.Collections.Hashtable ht = new System.Collections.Hashtable(); - System.Web.Caching.Cache c = System.Web.HttpRuntime.Cache; - if (c != null) - { - System.Collections.IDictionaryEnumerator cacheEnumerator = c.GetEnumerator(); - while (cacheEnumerator.MoveNext()) - { - if (ht[c[cacheEnumerator.Key.ToString()].GetType().ToString()] == null) - ht.Add(c[cacheEnumerator.Key.ToString()].GetType().ToString(), new System.Collections.ArrayList()); - - ((System.Collections.ArrayList)ht[c[cacheEnumerator.Key.ToString()].GetType().ToString()]).Add(cacheEnumerator.Key.ToString()); - } - } - return ht; - } - - public delegate TT GetCacheItemDelegate(); - - [Obsolete("Use the ApplicationContext.Current.ApplicationCache.GetCacheItem instead")] - public static TT GetCacheItem(string cacheKey, object syncLock, - TimeSpan timeout, GetCacheItemDelegate getCacheItem) - { - return GetCacheItem(cacheKey, syncLock, null, timeout, getCacheItem); - } - - [Obsolete("Use the ApplicationContext.Current.ApplicationCache.GetCacheItem instead")] - public static TT GetCacheItem(string cacheKey, object syncLock, - CacheItemRemovedCallback refreshAction, TimeSpan timeout, - GetCacheItemDelegate getCacheItem) - { - return GetCacheItem(cacheKey, syncLock, CacheItemPriority.Normal, refreshAction, timeout, getCacheItem); - } - - [Obsolete("Use the ApplicationContext.Current.ApplicationCache.GetCacheItem instead")] - public static TT GetCacheItem(string cacheKey, object syncLock, - CacheItemPriority priority, CacheItemRemovedCallback refreshAction, TimeSpan timeout, - GetCacheItemDelegate getCacheItem) - { - return GetCacheItem(cacheKey, syncLock, priority, refreshAction, null, timeout, getCacheItem); - } - - [Obsolete("Use the ApplicationContext.Current.ApplicationCache.GetCacheItem instead")] - public static TT GetCacheItem(string cacheKey, object syncLock, - CacheItemPriority priority, CacheItemRemovedCallback refreshAction, - CacheDependency cacheDependency, TimeSpan timeout, GetCacheItemDelegate getCacheItem) - { - var helper = new CacheHelper(System.Web.HttpRuntime.Cache); - Func f = () => getCacheItem(); - return helper.GetCacheItem(cacheKey, priority, refreshAction, cacheDependency, timeout, f); - } - } -} diff --git a/src/umbraco.cms/businesslogic/events/EventArgs.cs b/src/umbraco.cms/businesslogic/events/EventArgs.cs index 1329e9c6b2..4f5b10efe2 100644 --- a/src/umbraco.cms/businesslogic/events/EventArgs.cs +++ b/src/umbraco.cms/businesslogic/events/EventArgs.cs @@ -9,15 +9,11 @@ namespace umbraco.cms.businesslogic { //Content Event args public class PublishEventArgs : System.ComponentModel.CancelEventArgs { } public class MoveEventArgs : System.ComponentModel.CancelEventArgs { } - public class CopyEventArgs : System.ComponentModel.CancelEventArgs - { - public int CopyTo { get; set; } - public Document NewDocument { get; set; } - } + public class UnPublishEventArgs : System.ComponentModel.CancelEventArgs { } - public class RollBackEventArgs : System.ComponentModel.CancelEventArgs { } - public class SendToPublishEventArgs : System.ComponentModel.CancelEventArgs { } + + public class MoveToTrashEventArgs : System.ComponentModel.CancelEventArgs { } //Content Cache Event args @@ -38,9 +34,7 @@ namespace umbraco.cms.businesslogic { { public int GroupId{ get; set; } } - //Tree node event args - public class NodeRenderEventArgs : System.ComponentModel.CancelEventArgs { } - + //Access event args public class AddProtectionEventArgs : System.ComponentModel.CancelEventArgs { } public class RemoveProtectionEventArgs : System.ComponentModel.CancelEventArgs { } @@ -48,51 +42,12 @@ namespace umbraco.cms.businesslogic { public class RemoveMemberShipRoleFromDocumentEventArgs : System.ComponentModel.CancelEventArgs { } public class RemoveMemberShipUserFromDocumentEventArgs : System.ComponentModel.CancelEventArgs { } public class AddMembershipUserToDocumentEventArgs : System.ComponentModel.CancelEventArgs { } - - //Document Events Arguments - public class DocumentNewingEventArgs : System.ComponentModel.CancelEventArgs - { - public string Text { get; internal set; } - public umbraco.BusinessLogic.User User { get; internal set; } - public umbraco.cms.businesslogic.web.DocumentType DocumentType { get; internal set; } - public int ParentId { get; internal set; } - } + public class ContentCacheLoadNodeEventArgs : System.ComponentModel.CancelEventArgs { public bool CancelChildren { get; set; } } - - // Provides information on the macro that caused an error - public class MacroErrorEventArgs : System.EventArgs - { - /// - /// Name of the faulting macro. - /// - public string Name { get; set; } - - /// - /// Alias of the faulting macro. - /// - public string Alias { get; set; } - - /// - /// Filename of the faulting macro. - /// - public string File { get; set; } - - /// - /// Exception raised. - /// - public Exception Exception { get; set; } - - /// - /// Gets or sets the desired behaviour when a matching macro causes an error. See - /// for definitions. By setting this in your event - /// you can override the default behaviour defined in UmbracoSettings.config. - /// - /// Macro error behaviour enum. - public MacroErrorBehaviour Behaviour { get; set; } - } + } diff --git a/src/umbraco.cms/businesslogic/installer/IInstallerStep.cs b/src/umbraco.cms/businesslogic/installer/IInstallerStep.cs deleted file mode 100644 index a64d13c576..0000000000 --- a/src/umbraco.cms/businesslogic/installer/IInstallerStep.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -namespace umbraco.cms.businesslogic.installer -{ - [Obsolete("This is no longer used and will be removed from the codebase in future versions.")] - interface IInstallerStep - { - string Alias { get;} - bool Completed(); - string Name { get;} - string UserControl {get;} - - bool HideFromNavigation { get; } - } -} diff --git a/src/umbraco.cms/businesslogic/installer/InstallStepCollection.cs b/src/umbraco.cms/businesslogic/installer/InstallStepCollection.cs deleted file mode 100644 index 04b674c51e..0000000000 --- a/src/umbraco.cms/businesslogic/installer/InstallStepCollection.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Collections.Specialized; - -namespace umbraco.cms.businesslogic.installer -{ - - [Obsolete("This is no longer used and will be removed from the codebase in future versions. It has been superceded by Umbraco.Web.Install.InstallerStepCollection however that is marked internal and is not to be used in external code.")] - public class InstallerStepCollection : Dictionary - { - public void Add(InstallerStep step){ - step.Index = this.Count; - this.Add(step.Alias, step); - } - - public InstallerStep Get(string key) - { - return this.First(item => item.Key == key).Value; - } - - public bool StepExists(string key) - { - return this.ContainsKey(key); - } - - public InstallerStep GotoNextStep(string key) - { - InstallerStep s = this[key]; - foreach(InstallerStep i in this.Values){ - - // System.Web.HttpContext.Current.Response.Write(i.Index.ToString() + i.Alias); - - if (i.Index > s.Index && !i.Completed()) { - // System.Web.HttpContext.Current.Response.Write( "FOUND" + i.Index.ToString() + i.Alias); - return i; - } - } - - return null; - } - - - public InstallerStep FirstAvailableStep() - { - return this.First(item => item.Value.Completed() == false ).Value; - } - } -} - diff --git a/src/umbraco.cms/businesslogic/installer/InstallerStep.cs b/src/umbraco.cms/businesslogic/installer/InstallerStep.cs deleted file mode 100644 index 58953143dc..0000000000 --- a/src/umbraco.cms/businesslogic/installer/InstallerStep.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace umbraco.cms.businesslogic.installer -{ - [Obsolete("This is no longer used and will be removed from the codebase in future versions. It has been superceded by Umbraco.Web.Install.InstallerStep however that is marked internal and is not to be used in external code.")] - public abstract class InstallerStep : IInstallerStep - { - public abstract string Alias { get; } - public abstract string Name { get; } - public abstract string UserControl { get;} - public virtual int Index { get; set; } - - public virtual bool MoveToNextStepAutomaticly { get; set; } - - public virtual bool HideFromNavigation { - get { - return false; - } - } - public abstract bool Completed(); - - - } -} diff --git a/src/umbraco.cms/businesslogic/member/Member.cs b/src/umbraco.cms/businesslogic/member/Member.cs index 51a859735f..95931e33f7 100644 --- a/src/umbraco.cms/businesslogic/member/Member.cs +++ b/src/umbraco.cms/businesslogic/member/Member.cs @@ -1,21 +1,16 @@ using System; using System.Collections; using System.Collections.Generic; -using System.Data; -using System.Diagnostics; using System.Globalization; using System.Runtime.CompilerServices; using System.Web; using System.Xml; using Umbraco.Core; using Umbraco.Core.Cache; -using Umbraco.Core.Configuration; using Umbraco.Core.Logging; using Umbraco.Core.Models; using Umbraco.Core.Models.EntityBase; -using Umbraco.Core.Models.Rdbms; using Umbraco.Core.Persistence.Querying; -using umbraco.cms.businesslogic.cache; using umbraco.BusinessLogic; using umbraco.DataLayer; using System.Web.Security; diff --git a/src/umbraco.cms/businesslogic/template/Template.cs b/src/umbraco.cms/businesslogic/template/Template.cs index bfae620daa..c49c8e55a0 100644 --- a/src/umbraco.cms/businesslogic/template/Template.cs +++ b/src/umbraco.cms/businesslogic/template/Template.cs @@ -3,18 +3,12 @@ using System.Linq; using System.Collections; using System.Xml; using Umbraco.Core; -using Umbraco.Core.Cache; -using Umbraco.Core.Configuration; using Umbraco.Core.IO; using Umbraco.Core.Logging; using Umbraco.Core.Models; using Umbraco.Core.Services; -using Umbraco.Core.Strings; -using umbraco.DataLayer; using System.Text.RegularExpressions; -using System.IO; using System.Collections.Generic; -using umbraco.cms.businesslogic.cache; using umbraco.BusinessLogic; using umbraco.cms.businesslogic.web; diff --git a/src/umbraco.cms/businesslogic/utilities/Diff.cs b/src/umbraco.cms/businesslogic/utilities/Diff.cs deleted file mode 100644 index 3aa159de7e..0000000000 --- a/src/umbraco.cms/businesslogic/utilities/Diff.cs +++ /dev/null @@ -1,655 +0,0 @@ -using System; -using System.Collections; -using System.Text; -using System.Text.RegularExpressions; - -//TODO: We've alraedy moved most of this logic to Core.Strings - need to review this as it has slightly more functionality but should be moved to core and obsoleted! - -namespace umbraco.cms.businesslogic.utilities { - /// - /// This Class implements the Difference Algorithm published in - /// "An O(ND) Difference Algorithm and its Variations" by Eugene Myers - /// Algorithmica Vol. 1 No. 2, 1986, p 251. - /// - /// There are many C, Java, Lisp implementations public available but they all seem to come - /// from the same source (diffutils) that is under the (unfree) GNU public License - /// and cannot be reused as a sourcecode for a commercial application. - /// There are very old C implementations that use other (worse) algorithms. - /// Microsoft also published sourcecode of a diff-tool (windiff) that uses some tree data. - /// Also, a direct transfer from a C source to C# is not easy because there is a lot of pointer - /// arithmetic in the typical C solutions and i need a managed solution. - /// These are the reasons why I implemented the original published algorithm from the scratch and - /// make it avaliable without the GNU license limitations. - /// I do not need a high performance diff tool because it is used only sometimes. - /// I will do some performace tweaking when needed. - /// - /// The algorithm itself is comparing 2 arrays of numbers so when comparing 2 text documents - /// each line is converted into a (hash) number. See DiffText(). - /// - /// Some chages to the original algorithm: - /// The original algorithm was described using a recursive approach and comparing zero indexed arrays. - /// Extracting sub-arrays and rejoining them is very performance and memory intensive so the same - /// (readonly) data arrays are passed arround together with their lower and upper bounds. - /// This circumstance makes the LCS and SMS functions more complicate. - /// I added some code to the LCS function to get a fast response on sub-arrays that are identical, - /// completely deleted or inserted. - /// - /// The result from a comparisation is stored in 2 arrays that flag for modified (deleted or inserted) - /// lines in the 2 data arrays. These bits are then analysed to produce a array of Item objects. - /// - /// Further possible optimizations: - /// (first rule: don't do it; second: don't do it yet) - /// The arrays DataA and DataB are passed as parameters, but are never changed after the creation - /// so they can be members of the class to avoid the paramter overhead. - /// In SMS is a lot of boundary arithmetic in the for-D and for-k loops that can be done by increment - /// and decrement of local variables. - /// The DownVector and UpVector arrays are alywas created and destroyed each time the SMS gets called. - /// It is possible to reuse tehm when transfering them to members of the class. - /// See TODO: hints. - /// - /// diff.cs: A port of the algorythm to C# - /// Copyright (c) by Matthias Hertel, http://www.mathertel.de - /// This work is licensed under a BSD style license. See http://www.mathertel.de/License.aspx - /// - /// Changes: - /// 2002.09.20 There was a "hang" in some situations. - /// Now I undestand a little bit more of the SMS algorithm. - /// There have been overlapping boxes; that where analyzed partial differently. - /// One return-point is enough. - /// A assertion was added in CreateDiffs when in debug-mode, that counts the number of equal (no modified) lines in both arrays. - /// They must be identical. - /// - /// 2003.02.07 Out of bounds error in the Up/Down vector arrays in some situations. - /// The two vetors are now accessed using different offsets that are adjusted using the start k-Line. - /// A test case is added. - /// - /// 2006.03.05 Some documentation and a direct Diff entry point. - /// - /// 2006.03.08 Refactored the API to static methods on the Diff class to make usage simpler. - /// 2006.03.10 using the standard Debug class for self-test now. - /// compile with: csc /target:exe /out:diffTest.exe /d:DEBUG /d:TRACE /d:SELFTEST Diff.cs - /// 2007.01.06 license agreement changed to a BSD style license. - /// 2007.06.03 added the Optimize method. - /// 2007.09.23 UpVector and DownVector optimization by Jan Stoklasa (). - /// - - public class Diff { - - /// details of one difference. - public struct Item { - /// Start Line number in Data A. - public int StartA; - /// Start Line number in Data B. - public int StartB; - - /// Number of changes in Data A. - public int deletedA; - /// Number of changes in Data B. - public int insertedB; - } // Item - - /// - /// Shortest Middle Snake Return Data - /// - private struct SMSRD { - internal int x, y; - // internal int u, v; // 2002.09.20: no need for 2 points - } - - - #region self-Test - -#if (SELFTEST) - /// - /// start a self- / box-test for some diff cases and report to the debug output. - /// - /// not used - /// always 0 - public static int Main(string[] args) { - StringBuilder ret = new StringBuilder(); - string a, b; - - System.Diagnostics.ConsoleTraceListener ctl = new System.Diagnostics.ConsoleTraceListener(false); - System.Diagnostics.Debug.Listeners.Add(ctl); - - System.Console.WriteLine("Diff Self Test..."); - - // test all changes - a = "a,b,c,d,e,f,g,h,i,j,k,l".Replace(',', '\n'); - b = "0,1,2,3,4,5,6,7,8,9".Replace(',', '\n'); - System.Diagnostics.Debug.Assert(TestHelper(Diff.DiffText(a, b, false, false, false)) - == "12.10.0.0*", - "all-changes test failed."); - System.Diagnostics.Debug.WriteLine("all-changes test passed."); - // test all same - a = "a,b,c,d,e,f,g,h,i,j,k,l".Replace(',', '\n'); - b = a; - System.Diagnostics.Debug.Assert(TestHelper(Diff.DiffText(a, b, false, false, false)) - == "", - "all-same test failed."); - System.Diagnostics.Debug.WriteLine("all-same test passed."); - - // test snake - a = "a,b,c,d,e,f".Replace(',', '\n'); - b = "b,c,d,e,f,x".Replace(',', '\n'); - System.Diagnostics.Debug.Assert(TestHelper(Diff.DiffText(a, b, false, false, false)) - == "1.0.0.0*0.1.6.5*", - "snake test failed."); - System.Diagnostics.Debug.WriteLine("snake test passed."); - - // 2002.09.20 - repro - a = "c1,a,c2,b,c,d,e,g,h,i,j,c3,k,l".Replace(',', '\n'); - b = "C1,a,C2,b,c,d,e,I1,e,g,h,i,j,C3,k,I2,l".Replace(',', '\n'); - System.Diagnostics.Debug.Assert(TestHelper(Diff.DiffText(a, b, false, false, false)) - == "1.1.0.0*1.1.2.2*0.2.7.7*1.1.11.13*0.1.13.15*", - "repro20020920 test failed."); - System.Diagnostics.Debug.WriteLine("repro20020920 test passed."); - - // 2003.02.07 - repro - a = "F".Replace(',', '\n'); - b = "0,F,1,2,3,4,5,6,7".Replace(',', '\n'); - System.Diagnostics.Debug.Assert(TestHelper(Diff.DiffText(a, b, false, false, false)) - == "0.1.0.0*0.7.1.2*", - "repro20030207 test failed."); - System.Diagnostics.Debug.WriteLine("repro20030207 test passed."); - - // Muegel - repro - a = "HELLO\nWORLD"; - b = "\n\nhello\n\n\n\nworld\n"; - System.Diagnostics.Debug.Assert(TestHelper(Diff.DiffText(a, b, false, false, false)) - == "2.8.0.0*", - "repro20030409 test failed."); - System.Diagnostics.Debug.WriteLine("repro20030409 test passed."); - - // test some differences - a = "a,b,-,c,d,e,f,f".Replace(',', '\n'); - b = "a,b,x,c,e,f".Replace(',', '\n'); - System.Diagnostics.Debug.Assert(TestHelper(Diff.DiffText(a, b, false, false, false)) - == "1.1.2.2*1.0.4.4*1.0.6.5*", - "some-changes test failed."); - System.Diagnostics.Debug.WriteLine("some-changes test passed."); - - System.Diagnostics.Debug.WriteLine("End."); - System.Diagnostics.Debug.Flush(); - - return (0); - } - - - public static string TestHelper(Item []f) { - StringBuilder ret = new StringBuilder(); - for (int n = 0; n < f.Length; n++) { - ret.Append(f[n].deletedA.ToString() + "." + f[n].insertedB.ToString() + "." + f[n].StartA.ToString() + "." + f[n].StartB.ToString() + "*"); - } - // Debug.Write(5, "TestHelper", ret.ToString()); - return (ret.ToString()); - } -#endif - #endregion - - - /// - /// Find the difference in 2 texts, comparing by textlines, returns the result as Html. - /// If content has been removed, it will be marked up with a <del> html element. - /// If content has been added, it will be marked up with a <ins> html element - /// - /// The old version of the string. - /// The new version of the string. - /// - public static string Diff2Html(string a_line, string b_line) { - - int[] a_codes = DiffCharCodes(a_line, false); - int[] b_codes = DiffCharCodes(b_line, false); - string result = ""; - - Diff.Item[] diffs = Diff.DiffInt(a_codes, b_codes); - - int pos = 0; - for (int n = 0; n < diffs.Length; n++) { - Diff.Item it = diffs[n]; - - // write unchanged chars - while ((pos < it.StartB) && (pos < b_line.Length)) { - result += b_line[pos]; - pos++; - } // while - - // write deleted chars - if (it.deletedA > 0) { - result += ""; - for (int m = 0; m < it.deletedA; m++) { - result += a_line[it.StartA + m]; - } // for - result += ""; - } - - // write inserted chars - if (pos < it.StartB + it.insertedB) { - result += ""; - while (pos < it.StartB + it.insertedB) { - result += b_line[pos]; - pos++; - } // while - result += ""; - } // if - } // while - - // write rest of unchanged chars - while (pos < b_line.Length) { - result += b_line[pos]; - pos++; - } - - return result; - } - - - private static int[] DiffCharCodes(string aText, bool ignoreCase) { - int[] Codes; - - if (ignoreCase) - aText = aText.ToUpperInvariant(); - - Codes = new int[aText.Length]; - - for (int n = 0; n < aText.Length; n++) - Codes[n] = (int)aText[n]; - - return (Codes); - } - - - - /// - /// Find the difference in 2 texts, comparing by textlines. - /// - /// A-version of the text (usualy the old one) - /// B-version of the text (usualy the new one) - /// Returns a array of Items that describe the differences. - public Item[] DiffText(string TextA, string TextB) { - return (DiffText(TextA, TextB, false, false, false)); - } // DiffText - - - /// - /// Find the difference in 2 text documents, comparing by textlines. - /// The algorithm itself is comparing 2 arrays of numbers so when comparing 2 text documents - /// each line is converted into a (hash) number. This hash-value is computed by storing all - /// textlines into a common hashtable so i can find dublicates in there, and generating a - /// new number each time a new textline is inserted. - /// - /// A-version of the text (usualy the old one) - /// B-version of the text (usualy the new one) - /// When set to true, all leading and trailing whitespace characters are stripped out before the comparation is done. - /// When set to true, all whitespace characters are converted to a single space character before the comparation is done. - /// When set to true, all characters are converted to their lowercase equivivalence before the comparation is done. - /// Returns a array of Items that describe the differences. - public static Item[] DiffText(string TextA, string TextB, bool trimSpace, bool ignoreSpace, bool ignoreCase) { - // prepare the input-text and convert to comparable numbers. - Hashtable h = new Hashtable(TextA.Length + TextB.Length); - - // The A-Version of the data (original data) to be compared. - DiffData DataA = new DiffData(DiffCodes(TextA, h, trimSpace, ignoreSpace, ignoreCase)); - - // The B-Version of the data (modified data) to be compared. - DiffData DataB = new DiffData(DiffCodes(TextB, h, trimSpace, ignoreSpace, ignoreCase)); - - h = null; // free up hashtable memory (maybe) - - int MAX = DataA.Length + DataB.Length + 1; - /// vector for the (0,0) to (x,y) search - int[] DownVector = new int[2 * MAX + 2]; - /// vector for the (u,v) to (N,M) search - int[] UpVector = new int[2 * MAX + 2]; - - LCS(DataA, 0, DataA.Length, DataB, 0, DataB.Length, DownVector, UpVector); - - Optimize(DataA); - Optimize(DataB); - return CreateDiffs(DataA, DataB); - } // DiffText - - - /// - /// If a sequence of modified lines starts with a line that contains the same content - /// as the line that appends the changes, the difference sequence is modified so that the - /// appended line and not the starting line is marked as modified. - /// This leads to more readable diff sequences when comparing text files. - /// - /// A Diff data buffer containing the identified changes. - private static void Optimize(DiffData Data) { - int StartPos, EndPos; - - StartPos = 0; - while (StartPos < Data.Length) { - while ((StartPos < Data.Length) && (Data.modified[StartPos] == false)) - StartPos++; - EndPos = StartPos; - while ((EndPos < Data.Length) && (Data.modified[EndPos] == true)) - EndPos++; - - if ((EndPos < Data.Length) && (Data.data[StartPos] == Data.data[EndPos])) { - Data.modified[StartPos] = false; - Data.modified[EndPos] = true; - } else { - StartPos = EndPos; - } // if - } // while - } // Optimize - - - /// - /// Find the difference in 2 arrays of integers. - /// - /// A-version of the numbers (usualy the old one) - /// B-version of the numbers (usualy the new one) - /// Returns a array of Items that describe the differences. - public static Item[] DiffInt(int[] ArrayA, int[] ArrayB) { - // The A-Version of the data (original data) to be compared. - DiffData DataA = new DiffData(ArrayA); - - // The B-Version of the data (modified data) to be compared. - DiffData DataB = new DiffData(ArrayB); - - int MAX = DataA.Length + DataB.Length + 1; - /// vector for the (0,0) to (x,y) search - int[] DownVector = new int[2 * MAX + 2]; - /// vector for the (u,v) to (N,M) search - int[] UpVector = new int[2 * MAX + 2]; - - LCS(DataA, 0, DataA.Length, DataB, 0, DataB.Length, DownVector, UpVector); - return CreateDiffs(DataA, DataB); - } // Diff - - - /// - /// This function converts all textlines of the text into unique numbers for every unique textline - /// so further work can work only with simple numbers. - /// - /// the input text - /// This extern initialized hashtable is used for storing all ever used textlines. - /// ignore leading and trailing space characters - /// a array of integers. - private static int[] DiffCodes(string aText, Hashtable h, bool trimSpace, bool ignoreSpace, bool ignoreCase) { - // get all codes of the text - string[] Lines; - int[] Codes; - int lastUsedCode = h.Count; - object aCode; - string s; - - // strip off all cr, only use lf as textline separator. - aText = aText.Replace("\r", ""); - Lines = aText.Split('\n'); - - Codes = new int[Lines.Length]; - - for (int i = 0; i < Lines.Length; ++i) { - s = Lines[i]; - if (trimSpace) - s = s.Trim(); - - if (ignoreSpace) { - s = Regex.Replace(s, "\\s+", " "); // TODO: optimization: faster blank removal. - } - - if (ignoreCase) - s = s.ToLower(); - - aCode = h[s]; - if (aCode == null) { - lastUsedCode++; - h[s] = lastUsedCode; - Codes[i] = lastUsedCode; - } else { - Codes[i] = (int)aCode; - } // if - } // for - return (Codes); - } // DiffCodes - - - /// - /// This is the algorithm to find the Shortest Middle Snake (SMS). - /// - /// sequence A - /// lower bound of the actual range in DataA - /// upper bound of the actual range in DataA (exclusive) - /// sequence B - /// lower bound of the actual range in DataB - /// upper bound of the actual range in DataB (exclusive) - /// a vector for the (0,0) to (x,y) search. Passed as a parameter for speed reasons. - /// a vector for the (u,v) to (N,M) search. Passed as a parameter for speed reasons. - /// a MiddleSnakeData record containing x,y and u,v - private static SMSRD SMS(DiffData DataA, int LowerA, int UpperA, DiffData DataB, int LowerB, int UpperB, - int[] DownVector, int[] UpVector) { - - SMSRD ret; - int MAX = DataA.Length + DataB.Length + 1; - - int DownK = LowerA - LowerB; // the k-line to start the forward search - int UpK = UpperA - UpperB; // the k-line to start the reverse search - - int Delta = (UpperA - LowerA) - (UpperB - LowerB); - bool oddDelta = (Delta & 1) != 0; - - // The vectors in the publication accepts negative indexes. the vectors implemented here are 0-based - // and are access using a specific offset: UpOffset UpVector and DownOffset for DownVektor - int DownOffset = MAX - DownK; - int UpOffset = MAX - UpK; - - int MaxD = ((UpperA - LowerA + UpperB - LowerB) / 2) + 1; - - // Debug.Write(2, "SMS", String.Format("Search the box: A[{0}-{1}] to B[{2}-{3}]", LowerA, UpperA, LowerB, UpperB)); - - // init vectors - DownVector[DownOffset + DownK + 1] = LowerA; - UpVector[UpOffset + UpK - 1] = UpperA; - - for (int D = 0; D <= MaxD; D++) { - - // Extend the forward path. - for (int k = DownK - D; k <= DownK + D; k += 2) { - // Debug.Write(0, "SMS", "extend forward path " + k.ToString()); - - // find the only or better starting point - int x, y; - if (k == DownK - D) { - x = DownVector[DownOffset + k + 1]; // down - } else { - x = DownVector[DownOffset + k - 1] + 1; // a step to the right - if ((k < DownK + D) && (DownVector[DownOffset + k + 1] >= x)) - x = DownVector[DownOffset + k + 1]; // down - } - y = x - k; - - // find the end of the furthest reaching forward D-path in diagonal k. - while ((x < UpperA) && (y < UpperB) && (DataA.data[x] == DataB.data[y])) { - x++; y++; - } - DownVector[DownOffset + k] = x; - - // overlap ? - if (oddDelta && (UpK - D < k) && (k < UpK + D)) { - if (UpVector[UpOffset + k] <= DownVector[DownOffset + k]) { - ret.x = DownVector[DownOffset + k]; - ret.y = DownVector[DownOffset + k] - k; - // ret.u = UpVector[UpOffset + k]; // 2002.09.20: no need for 2 points - // ret.v = UpVector[UpOffset + k] - k; - return (ret); - } // if - } // if - - } // for k - - // Extend the reverse path. - for (int k = UpK - D; k <= UpK + D; k += 2) { - // Debug.Write(0, "SMS", "extend reverse path " + k.ToString()); - - // find the only or better starting point - int x, y; - if (k == UpK + D) { - x = UpVector[UpOffset + k - 1]; // up - } else { - x = UpVector[UpOffset + k + 1] - 1; // left - if ((k > UpK - D) && (UpVector[UpOffset + k - 1] < x)) - x = UpVector[UpOffset + k - 1]; // up - } // if - y = x - k; - - while ((x > LowerA) && (y > LowerB) && (DataA.data[x - 1] == DataB.data[y - 1])) { - x--; y--; // diagonal - } - UpVector[UpOffset + k] = x; - - // overlap ? - if (!oddDelta && (DownK - D <= k) && (k <= DownK + D)) { - if (UpVector[UpOffset + k] <= DownVector[DownOffset + k]) { - ret.x = DownVector[DownOffset + k]; - ret.y = DownVector[DownOffset + k] - k; - // ret.u = UpVector[UpOffset + k]; // 2002.09.20: no need for 2 points - // ret.v = UpVector[UpOffset + k] - k; - return (ret); - } // if - } // if - - } // for k - - } // for D - - throw new ApplicationException("the algorithm should never come here."); - } // SMS - - - /// - /// This is the divide-and-conquer implementation of the longes common-subsequence (LCS) - /// algorithm. - /// The published algorithm passes recursively parts of the A and B sequences. - /// To avoid copying these arrays the lower and upper bounds are passed while the sequences stay constant. - /// - /// sequence A - /// lower bound of the actual range in DataA - /// upper bound of the actual range in DataA (exclusive) - /// sequence B - /// lower bound of the actual range in DataB - /// upper bound of the actual range in DataB (exclusive) - /// a vector for the (0,0) to (x,y) search. Passed as a parameter for speed reasons. - /// a vector for the (u,v) to (N,M) search. Passed as a parameter for speed reasons. - private static void LCS(DiffData DataA, int LowerA, int UpperA, DiffData DataB, int LowerB, int UpperB, int[] DownVector, int[] UpVector) { - // Debug.Write(2, "LCS", String.Format("Analyse the box: A[{0}-{1}] to B[{2}-{3}]", LowerA, UpperA, LowerB, UpperB)); - - // Fast walkthrough equal lines at the start - while (LowerA < UpperA && LowerB < UpperB && DataA.data[LowerA] == DataB.data[LowerB]) { - LowerA++; LowerB++; - } - - // Fast walkthrough equal lines at the end - while (LowerA < UpperA && LowerB < UpperB && DataA.data[UpperA - 1] == DataB.data[UpperB - 1]) { - --UpperA; --UpperB; - } - - if (LowerA == UpperA) { - // mark as inserted lines. - while (LowerB < UpperB) - DataB.modified[LowerB++] = true; - - } else if (LowerB == UpperB) { - // mark as deleted lines. - while (LowerA < UpperA) - DataA.modified[LowerA++] = true; - - } else { - // Find the middle snakea and length of an optimal path for A and B - SMSRD smsrd = SMS(DataA, LowerA, UpperA, DataB, LowerB, UpperB, DownVector, UpVector); - // Debug.Write(2, "MiddleSnakeData", String.Format("{0},{1}", smsrd.x, smsrd.y)); - - // The path is from LowerX to (x,y) and (x,y) to UpperX - LCS(DataA, LowerA, smsrd.x, DataB, LowerB, smsrd.y, DownVector, UpVector); - LCS(DataA, smsrd.x, UpperA, DataB, smsrd.y, UpperB, DownVector, UpVector); // 2002.09.20: no need for 2 points - } - } // LCS() - - - /// Scan the tables of which lines are inserted and deleted, - /// producing an edit script in forward order. - /// - /// dynamic array - private static Item[] CreateDiffs(DiffData DataA, DiffData DataB) { - ArrayList a = new ArrayList(); - Item aItem; - Item[] result; - - int StartA, StartB; - int LineA, LineB; - - LineA = 0; - LineB = 0; - while (LineA < DataA.Length || LineB < DataB.Length) { - if ((LineA < DataA.Length) && (!DataA.modified[LineA]) - && (LineB < DataB.Length) && (!DataB.modified[LineB])) { - // equal lines - LineA++; - LineB++; - - } else { - // maybe deleted and/or inserted lines - StartA = LineA; - StartB = LineB; - - while (LineA < DataA.Length && (LineB >= DataB.Length || DataA.modified[LineA])) - // while (LineA < DataA.Length && DataA.modified[LineA]) - LineA++; - - while (LineB < DataB.Length && (LineA >= DataA.Length || DataB.modified[LineB])) - // while (LineB < DataB.Length && DataB.modified[LineB]) - LineB++; - - if ((StartA < LineA) || (StartB < LineB)) { - // store a new difference-item - aItem = new Item(); - aItem.StartA = StartA; - aItem.StartB = StartB; - aItem.deletedA = LineA - StartA; - aItem.insertedB = LineB - StartB; - a.Add(aItem); - } // if - } // if - } // while - - result = new Item[a.Count]; - a.CopyTo(result); - - return (result); - } - - } // class Diff - - /// Data on one input file being compared. - /// - internal class DiffData { - - /// Number of elements (lines). - internal int Length; - - /// Buffer of numbers that will be compared. - internal int[] data; - - /// - /// Array of booleans that flag for modified data. - /// This is the result of the diff. - /// This means deletedA in the first Data or inserted in the second Data. - /// - internal bool[] modified; - - /// - /// Initialize the Diff-Data buffer. - /// - /// reference to the buffer - internal DiffData(int[] initData) { - data = initData; - Length = initData.Length; - modified = new bool[Length + 2]; - } // DiffData - - } // class DiffData -} diff --git a/src/umbraco.cms/businesslogic/utilities/File.cs b/src/umbraco.cms/businesslogic/utilities/File.cs deleted file mode 100644 index 48b7cce46b..0000000000 --- a/src/umbraco.cms/businesslogic/utilities/File.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace umbraco.cms.businesslogic.utilities { - public class IOPermissions { - - public static bool IsFileWriteable(string path) { - if(System.IO.File.Exists(path)){ - System.IO.FileInfo fi = new System.IO.FileInfo(path); - fi.OpenWrite(); - } - - return false; - } - - - - } -} diff --git a/src/umbraco.cms/businesslogic/utilities/Zip.cs b/src/umbraco.cms/businesslogic/utilities/Zip.cs deleted file mode 100644 index 36e9b6fc53..0000000000 --- a/src/umbraco.cms/businesslogic/utilities/Zip.cs +++ /dev/null @@ -1,59 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Text; -using System.Web; -using ICSharpCode.SharpZipLib.Zip; -using umbraco; - -namespace umbraco.cms.businesslogic.utilities -{ - public class Zip - { - public static void UnPack(string ZipFilePath, string UnPackDirectory, bool DeleteZipFile) - { - // Unzip - string tempDir = UnPackDirectory; - Directory.CreateDirectory(tempDir); - - ZipInputStream s = new ZipInputStream(File.OpenRead(ZipFilePath)); - - ZipEntry theEntry; - while ((theEntry = s.GetNextEntry()) != null) - { - string directoryName = Path.GetDirectoryName(theEntry.Name); - string fileName = Path.GetFileName(theEntry.Name); - - if (fileName != String.Empty) - { - FileStream streamWriter = File.Create(tempDir + Path.DirectorySeparatorChar + fileName); - - int size = 2048; - byte[] data = new byte[2048]; - while (true) - { - size = s.Read(data, 0, data.Length); - if (size > 0) - { - streamWriter.Write(data, 0, size); - } - else - { - break; - } - } - - streamWriter.Close(); - - } - } - - // Clean up - s.Close(); - if (DeleteZipFile) - File.Delete(ZipFilePath); - - } - - } -} diff --git a/src/umbraco.cms/businesslogic/web/Access.cs b/src/umbraco.cms/businesslogic/web/Access.cs deleted file mode 100644 index 3d4470d23c..0000000000 --- a/src/umbraco.cms/businesslogic/web/Access.cs +++ /dev/null @@ -1,581 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Linq; -using System.Xml; -using System.Xml.Linq; -using System.Web.Security; -using Umbraco.Core; -using Umbraco.Core.Models; -using Umbraco.Core.Security; -using Umbraco.Core.Services; - -namespace umbraco.cms.businesslogic.web -{ - /// - /// Summary description for Access. - /// - [Obsolete("Use Umbraco.Core.Service.IPublicAccessService instead")] - public class Access - { - - [Obsolete("Do not access this property directly, it is not thread safe, use GetXmlDocumentCopy instead")] - public static XmlDocument AccessXml - { - get { return GetXmlDocumentCopy(); } - } - - //NOTE: This is here purely for backwards compat - [Obsolete("This should never be used, the data is stored in the database now")] - public static XmlDocument GetXmlDocumentCopy() - { - var allAccessEntries = ApplicationContext.Current.Services.PublicAccessService.GetAll().ToArray(); - - var xml = XDocument.Parse(""); - foreach (var entry in allAccessEntries) - { - var pageXml = new XElement("page", - new XAttribute("id", entry.ProtectedNodeId), - new XAttribute("loginPage", entry.LoginNodeId), - new XAttribute("noRightsPage", entry.NoAccessNodeId)); - - foreach (var rule in entry.Rules) - { - if (rule.RuleType == Constants.Conventions.PublicAccess.MemberUsernameRuleType) - { - //if there is a member id claim then it is 'simple' (this is how legacy worked) - pageXml.Add(new XAttribute("simple", "True")); - pageXml.Add(new XAttribute("memberId", rule.RuleValue)); - } - else if (rule.RuleType == Constants.Conventions.PublicAccess.MemberRoleRuleType) - { - pageXml.Add(new XElement("group", new XAttribute("id", rule.RuleValue))); - } - } - - xml.Root.Add(pageXml); - } - - return xml.ToXmlDocument(); - } - - #region Manipulation methods - - public static void AddMembershipRoleToDocument(int documentId, string role) - { - //event - var doc = new Document(documentId); - var e = new AddMemberShipRoleToDocumentEventArgs(); - new Access().FireBeforeAddMemberShipRoleToDocument(doc, role, e); - - if (e.Cancel) return; - - - var entry = ApplicationContext.Current.Services.PublicAccessService.AddRule( - doc.ContentEntity, - Constants.Conventions.PublicAccess.MemberRoleRuleType, - role); - - if (entry.Success == false && entry.Result.Entity == null) - { - throw new Exception("Document is not protected!"); - } - - Save(); - - new Access().FireAfterAddMemberShipRoleToDocument(doc, role, e); - } - - - [Obsolete("This method is no longer supported. Use the ASP.NET MemberShip methods instead", true)] - public static void AddMemberGroupToDocument(int DocumentId, int MemberGroupId) - { - var content = ApplicationContext.Current.Services.ContentService.GetById(DocumentId); - - if (content == null) - throw new Exception("No content found with document id " + DocumentId); - - if (ApplicationContext.Current.Services.PublicAccessService.AddRule( - content, - Constants.Conventions.PublicAccess.MemberGroupIdRuleType, - MemberGroupId.ToString(CultureInfo.InvariantCulture))) - { - Save(); - } - - } - - [Obsolete("This method is no longer supported. Use the ASP.NET MemberShip methods instead", true)] - public static void AddMemberToDocument(int DocumentId, int MemberId) - { - var content = ApplicationContext.Current.Services.ContentService.GetById(DocumentId); - - if (content == null) - throw new Exception("No content found with document id " + DocumentId); - - if (ApplicationContext.Current.Services.PublicAccessService.AddRule( - content, - Constants.Conventions.PublicAccess.MemberIdRuleType, - MemberId.ToString(CultureInfo.InvariantCulture))) - { - Save(); - } - - } - - public static void AddMembershipUserToDocument(int documentId, string membershipUserName) - { - //event - var doc = new Document(documentId); - var e = new AddMembershipUserToDocumentEventArgs(); - new Access().FireBeforeAddMembershipUserToDocument(doc, membershipUserName, e); - - if (e.Cancel) return; - - var entry = ApplicationContext.Current.Services.PublicAccessService.AddRule( - doc.ContentEntity, - Constants.Conventions.PublicAccess.MemberUsernameRuleType, - membershipUserName); - - if (entry.Success == false && entry.Result.Entity == null) - { - throw new Exception("Document is not protected!"); - } - - if (entry) - { - Save(); - new Access().FireAfterAddMembershipUserToDocument(doc, membershipUserName, e); - } - - } - - [Obsolete("This method is no longer supported. Use the ASP.NET MemberShip methods instead", true)] - public static void RemoveMemberGroupFromDocument(int DocumentId, int MemberGroupId) - { - var doc = new Document(DocumentId); - - var entry = ApplicationContext.Current.Services.PublicAccessService.AddRule( - doc.ContentEntity, - Constants.Conventions.PublicAccess.MemberGroupIdRuleType, - MemberGroupId.ToString(CultureInfo.InvariantCulture)); - - if (entry.Success == false && entry.Result.Entity == null) - { - throw new Exception("Document is not protected!"); - } - - if (entry) - { - Save(); - } - } - - public static void RemoveMembershipRoleFromDocument(int documentId, string role) - { - var doc = new Document(documentId); - var e = new RemoveMemberShipRoleFromDocumentEventArgs(); - new Access().FireBeforeRemoveMemberShipRoleFromDocument(doc, role, e); - - if (e.Cancel) return; - - if (ApplicationContext.Current.Services.PublicAccessService.RemoveRule( - doc.ContentEntity, - Constants.Conventions.PublicAccess.MemberRoleRuleType, - role)) - { - Save(); - new Access().FireAfterRemoveMemberShipRoleFromDocument(doc, role, e); - }; - - } - - public static bool RenameMemberShipRole(string oldRolename, string newRolename) - { - var hasChange = ApplicationContext.Current.Services.PublicAccessService.RenameMemberGroupRoleRules(oldRolename, newRolename); - - if (hasChange) - Save(); - - return hasChange; - } - - public static void ProtectPage(bool Simple, int DocumentId, int LoginDocumentId, int ErrorDocumentId) - { - var doc = new Document(DocumentId); - var e = new AddProtectionEventArgs(); - new Access().FireBeforeAddProtection(doc, e); - - if (e.Cancel) return; - - var loginContent = ApplicationContext.Current.Services.ContentService.GetById(LoginDocumentId); - if (loginContent == null) throw new NullReferenceException("No content item found with id " + LoginDocumentId); - var noAccessContent = ApplicationContext.Current.Services.ContentService.GetById(ErrorDocumentId); - if (noAccessContent == null) throw new NullReferenceException("No content item found with id " + ErrorDocumentId); - - var entry = ApplicationContext.Current.Services.PublicAccessService.GetEntryForContent(doc.ContentEntity.Id.ToString()); - if (entry != null) - { - if (Simple) - { - // if using simple mode, make sure that all existing groups are removed - entry.ClearRules(); - } - - //ensure the correct ids are applied - entry.LoginNodeId = loginContent.Id; - entry.NoAccessNodeId = noAccessContent.Id; - } - else - { - entry = new PublicAccessEntry(doc.ContentEntity, - ApplicationContext.Current.Services.ContentService.GetById(LoginDocumentId), - ApplicationContext.Current.Services.ContentService.GetById(ErrorDocumentId), - new List()); - } - - if (ApplicationContext.Current.Services.PublicAccessService.Save(entry)) - { - Save(); - new Access().FireAfterAddProtection(new Document(DocumentId), e); - } - - } - - public static void RemoveProtection(int DocumentId) - { - //event - var doc = new Document(DocumentId); - var e = new RemoveProtectionEventArgs(); - new Access().FireBeforeRemoveProtection(doc, e); - - if (e.Cancel) return; - - var entry = ApplicationContext.Current.Services.PublicAccessService.GetEntryForContent(doc.ContentEntity); - if (entry != null) - { - ApplicationContext.Current.Services.PublicAccessService.Delete(entry); - } - - Save(); - - new Access().FireAfterRemoveProtection(doc, e); - } - #endregion - - #region Reading methods - - [Obsolete("This method is no longer supported. Use the ASP.NET MemberShip methods instead", true)] - public static bool IsProtectedByGroup(int DocumentId, int GroupId) - { - var d = new Document(DocumentId); - - var entry = ApplicationContext.Current.Services.PublicAccessService.GetEntryForContent(d.ContentEntity); - if (entry == null) return false; - - return entry.Rules - .Any(x => x.RuleType == Constants.Conventions.PublicAccess.MemberGroupIdRuleType - && x.RuleValue == GroupId.ToString(CultureInfo.InvariantCulture)); - - } - - public static bool IsProtectedByMembershipRole(int documentId, string role) - { - var content = ApplicationContext.Current.Services.ContentService.GetById(documentId); - - var entry = ApplicationContext.Current.Services.PublicAccessService.GetEntryForContent(content); - if (entry == null) return false; - - return entry.Rules - .Any(x => x.RuleType == Constants.Conventions.PublicAccess.MemberRoleRuleType - && x.RuleValue == role); - - } - - public static string[] GetAccessingMembershipRoles(int documentId, string path) - { - var entry = ApplicationContext.Current.Services.PublicAccessService.GetEntryForContent(path.EnsureEndsWith("," + documentId)); - if (entry == null) return new string[] { }; - - var memberGroupRoleRules = entry.Rules.Where(x => x.RuleType == Constants.Conventions.PublicAccess.MemberRoleRuleType); - return memberGroupRoleRules.Select(x => x.RuleValue).ToArray(); - - } - - [Obsolete("This method is no longer supported. Use the ASP.NET MemberShip methods instead", true)] - public static member.MemberGroup[] GetAccessingGroups(int DocumentId) - { - var content = ApplicationContext.Current.Services.ContentService.GetById(DocumentId); - if (content == null) return null; - - var entry = ApplicationContext.Current.Services.PublicAccessService.GetEntryForContent(content); - if (entry == null) return null; - - var memberGroupIdRules = entry.Rules.Where(x => x.RuleType == Constants.Conventions.PublicAccess.MemberGroupIdRuleType); - - return memberGroupIdRules.Select(x => new member.MemberGroup(int.Parse(x.RuleValue))).ToArray(); - - } - - [Obsolete("This method is no longer supported. Use the ASP.NET MemberShip methods instead", true)] - public static member.Member GetAccessingMember(int DocumentId) - { - var content = ApplicationContext.Current.Services.ContentService.GetById(DocumentId); - if (content == null) return null; - - var entry = ApplicationContext.Current.Services.PublicAccessService.GetEntryForContent(content); - if (entry == null) return null; - - //legacy would throw an exception here if it was not 'simple' and simple means based on a member id in this case - if (entry.Rules.All(x => x.RuleType != Constants.Conventions.PublicAccess.MemberIdRuleType)) - { - throw new Exception("Document isn't protected using Simple mechanism. Use GetAccessingMemberGroups instead"); - } - - var memberIdRule = entry.Rules.First(x => x.RuleType == Constants.Conventions.PublicAccess.MemberIdRuleType); - return new member.Member(int.Parse(memberIdRule.RuleValue)); - - } - - public static MembershipUser GetAccessingMembershipUser(int documentId) - { - var content = ApplicationContext.Current.Services.ContentService.GetById(documentId); - if (content == null) return null; - - var entry = ApplicationContext.Current.Services.PublicAccessService.GetEntryForContent(content); - if (entry == null) return null; - - //legacy would throw an exception here if it was not 'simple' and simple means based on a username - if (entry.Rules.All(x => x.RuleType != Constants.Conventions.PublicAccess.MemberUsernameRuleType)) - { - throw new Exception("Document isn't protected using Simple mechanism. Use GetAccessingMemberGroups instead"); - } - - var provider = MembershipProviderExtensions.GetMembersMembershipProvider(); - var usernameRule = entry.Rules.First(x => x.RuleType == Constants.Conventions.PublicAccess.MemberUsernameRuleType); - return provider.GetUser(usernameRule.RuleValue, false); - - } - - - [Obsolete("This method is no longer supported. Use the ASP.NET MemberShip methods instead", true)] - public static bool HasAccess(int DocumentId, member.Member Member) - { - var content = ApplicationContext.Current.Services.ContentService.GetById(DocumentId); - if (content == null) return true; - - var entry = ApplicationContext.Current.Services.PublicAccessService.GetEntryForContent(content); - if (entry == null) return true; - - var memberGroupIds = Member.Groups.Values.Cast().Select(x => x.Id.ToString(CultureInfo.InvariantCulture)).ToArray(); - return entry.Rules.Any(x => x.RuleType == Constants.Conventions.PublicAccess.MemberGroupIdRuleType - && memberGroupIds.Contains(x.RuleValue)); - - } - - [Obsolete("This method has been replaced because of a spelling mistake. Use the HasAccess method instead.", false)] - public static bool HasAccces(int documentId, object memberId) - { - // Call the correctly named version of this method - return HasAccess(documentId, memberId); - } - - public static bool HasAccess(int documentId, object memberId) - { - return ApplicationContext.Current.Services.PublicAccessService.HasAccess( - documentId, - memberId, - ApplicationContext.Current.Services.ContentService, - MembershipProviderExtensions.GetMembersMembershipProvider(), - //TODO: This should really be targeting a specific provider by name!! - Roles.Provider); - } - - public static bool HasAccess(int documentId, string path, MembershipUser member) - { - return ApplicationContext.Current.Services.PublicAccessService.HasAccess( - path, - member, - //TODO: This should really be targeting a specific provider by name!! - Roles.Provider); - } - - public static ProtectionType GetProtectionType(int DocumentId) - { - var content = ApplicationContext.Current.Services.ContentService.GetById(DocumentId); - if (content == null) return ProtectionType.NotProtected; - - var entry = ApplicationContext.Current.Services.PublicAccessService.GetEntryForContent(content); - if (entry == null) return ProtectionType.NotProtected; - - //legacy states that if it is protected by a member id then it is 'simple' - return entry.Rules.Any(x => x.RuleType == Constants.Conventions.PublicAccess.MemberIdRuleType) - ? ProtectionType.Simple - : ProtectionType.Advanced; - - } - - public static bool IsProtected(int DocumentId, string Path) - { - return ApplicationContext.Current.Services.PublicAccessService.IsProtected(Path.EnsureEndsWith("," + DocumentId)); - } - - //return the protection status of this exact document - not based on inheritance - public static bool IsProtected(int DocumentId) - { - return ApplicationContext.Current.Services.PublicAccessService.IsProtected(DocumentId.ToString()); - } - - public static int GetErrorPage(string Path) - { - var entry = ApplicationContext.Current.Services.PublicAccessService.GetEntryForContent(Path); - if (entry == null) return -1; - var entity = ApplicationContext.Current.Services.EntityService.Get(entry.NoAccessNodeId, UmbracoObjectTypes.Document, false); - return entity.Id; - - } - - public static int GetLoginPage(string Path) - { - var entry = ApplicationContext.Current.Services.PublicAccessService.GetEntryForContent(Path); - if (entry == null) return -1; - var entity = ApplicationContext.Current.Services.EntityService.Get(entry.LoginNodeId, UmbracoObjectTypes.Document, false); - return entity.Id; - - } - #endregion - - - //NOTE: This is purely here for backwards compat for events - private static void Save() - { - var e = new SaveEventArgs(); - - new Access().FireBeforeSave(e); - - if (e.Cancel) return; - - new Access().FireAfterSave(e); - } - - - //Event delegates - public delegate void SaveEventHandler(Access sender, SaveEventArgs e); - - public delegate void AddProtectionEventHandler(Document sender, AddProtectionEventArgs e); - public delegate void RemoveProtectionEventHandler(Document sender, RemoveProtectionEventArgs e); - - public delegate void AddMemberShipRoleToDocumentEventHandler(Document sender, string role, AddMemberShipRoleToDocumentEventArgs e); - public delegate void RemoveMemberShipRoleFromDocumentEventHandler(Document sender, string role, RemoveMemberShipRoleFromDocumentEventArgs e); - - public delegate void RemoveMemberShipUserFromDocumentEventHandler(Document sender, string MembershipUserName, RemoveMemberShipUserFromDocumentEventArgs e); - public delegate void AddMembershipUserToDocumentEventHandler(Document sender, string MembershipUserName, AddMembershipUserToDocumentEventArgs e); - - //Events - - 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 AddProtectionEventHandler BeforeAddProtection; - protected virtual void FireBeforeAddProtection(Document doc, AddProtectionEventArgs e) - { - if (BeforeAddProtection != null) - BeforeAddProtection(doc, e); - } - - public static event AddProtectionEventHandler AfterAddProtection; - protected virtual void FireAfterAddProtection(Document doc, AddProtectionEventArgs e) - { - if (AfterAddProtection != null) - AfterAddProtection(doc, e); - } - - public static event RemoveProtectionEventHandler BeforeRemoveProtection; - protected virtual void FireBeforeRemoveProtection(Document doc, RemoveProtectionEventArgs e) - { - if (BeforeRemoveProtection != null) - BeforeRemoveProtection(doc, e); - } - - public static event RemoveProtectionEventHandler AfterRemoveProtection; - protected virtual void FireAfterRemoveProtection(Document doc, RemoveProtectionEventArgs e) - { - if (AfterRemoveProtection != null) - AfterRemoveProtection(doc, e); - } - - public static event AddMemberShipRoleToDocumentEventHandler BeforeAddMemberShipRoleToDocument; - protected virtual void FireBeforeAddMemberShipRoleToDocument(Document doc, string role, AddMemberShipRoleToDocumentEventArgs e) - { - if (BeforeAddMemberShipRoleToDocument != null) - BeforeAddMemberShipRoleToDocument(doc, role, e); - } - - public static event AddMemberShipRoleToDocumentEventHandler AfterAddMemberShipRoleToDocument; - protected virtual void FireAfterAddMemberShipRoleToDocument(Document doc, string role, AddMemberShipRoleToDocumentEventArgs e) - { - if (AfterAddMemberShipRoleToDocument != null) - AfterAddMemberShipRoleToDocument(doc, role, e); - } - - public static event RemoveMemberShipRoleFromDocumentEventHandler BeforeRemoveMemberShipRoleToDocument; - protected virtual void FireBeforeRemoveMemberShipRoleFromDocument(Document doc, string role, RemoveMemberShipRoleFromDocumentEventArgs e) - { - if (BeforeRemoveMemberShipRoleToDocument != null) - BeforeRemoveMemberShipRoleToDocument(doc, role, e); - } - - public static event RemoveMemberShipRoleFromDocumentEventHandler AfterRemoveMemberShipRoleToDocument; - protected virtual void FireAfterRemoveMemberShipRoleFromDocument(Document doc, string role, RemoveMemberShipRoleFromDocumentEventArgs e) - { - if (AfterRemoveMemberShipRoleToDocument != null) - AfterRemoveMemberShipRoleToDocument(doc, role, e); - } - - public static event RemoveMemberShipUserFromDocumentEventHandler BeforeRemoveMembershipUserFromDocument; - protected virtual void FireBeforeRemoveMembershipUserFromDocument(Document doc, string username, RemoveMemberShipUserFromDocumentEventArgs e) - { - if (BeforeRemoveMembershipUserFromDocument != null) - BeforeRemoveMembershipUserFromDocument(doc, username, e); - } - - public static event RemoveMemberShipUserFromDocumentEventHandler AfterRemoveMembershipUserFromDocument; - protected virtual void FireAfterRemoveMembershipUserFromDocument(Document doc, string username, RemoveMemberShipUserFromDocumentEventArgs e) - { - if (AfterRemoveMembershipUserFromDocument != null) - AfterRemoveMembershipUserFromDocument(doc, username, e); - } - - public static event AddMembershipUserToDocumentEventHandler BeforeAddMembershipUserToDocument; - protected virtual void FireBeforeAddMembershipUserToDocument(Document doc, string username, AddMembershipUserToDocumentEventArgs e) - { - if (BeforeAddMembershipUserToDocument != null) - BeforeAddMembershipUserToDocument(doc, username, e); - } - - public static event AddMembershipUserToDocumentEventHandler AfterAddMembershipUserToDocument; - protected virtual void FireAfterAddMembershipUserToDocument(Document doc, string username, AddMembershipUserToDocumentEventArgs e) - { - if (AfterAddMembershipUserToDocument != null) - AfterAddMembershipUserToDocument(doc, username, e); - } - } - - public enum ProtectionType - { - NotProtected, - Simple, - Advanced - } -} diff --git a/src/umbraco.cms/businesslogic/web/Domain.cs b/src/umbraco.cms/businesslogic/web/Domain.cs index d47766e36e..4dfc4e28aa 100644 --- a/src/umbraco.cms/businesslogic/web/Domain.cs +++ b/src/umbraco.cms/businesslogic/web/Domain.cs @@ -1,18 +1,8 @@ using System; using System.Collections.Generic; -using System.Data; using System.Linq; -using System.Runtime.InteropServices; using Umbraco.Core; -using Umbraco.Core.Cache; -using Umbraco.Core.Logging; -using umbraco.BusinessLogic; -using umbraco.BusinessLogic.Actions; -using umbraco.cms.businesslogic.cache; using Umbraco.Core.Models; -using umbraco.interfaces; -using umbraco.DataLayer; -using System.Runtime.CompilerServices; using Language = umbraco.cms.businesslogic.language.Language; diff --git a/src/umbraco.cms/businesslogic/web/StyleSheet.cs b/src/umbraco.cms/businesslogic/web/StyleSheet.cs index 7a0902ebb3..dfe4749a18 100644 --- a/src/umbraco.cms/businesslogic/web/StyleSheet.cs +++ b/src/umbraco.cms/businesslogic/web/StyleSheet.cs @@ -1,18 +1,10 @@ using System; using System.Collections; -using System.IO; using System.Linq; -using System.Text.RegularExpressions; using System.Xml; -using umbraco.BusinessLogic.console; -using Umbraco.Core.Cache; -using Umbraco.Core.IO; -using umbraco.cms.businesslogic.cache; using Umbraco.Core.Models; using Umbraco.Core.Services; -using umbraco.DataLayer; using Umbraco.Core; -using File = System.IO.File; namespace umbraco.cms.businesslogic.web { @@ -226,22 +218,22 @@ namespace umbraco.cms.businesslogic.web public static StyleSheet Import(XmlNode n, umbraco.BusinessLogic.User u) { - string stylesheetName = xmlHelper.GetNodeValue(n.SelectSingleNode("Name")); + string stylesheetName = XmlHelper.GetNodeValue(n.SelectSingleNode("Name")); StyleSheet s = GetByName(stylesheetName); if (s == null) { s = StyleSheet.MakeNew( u, stylesheetName, - xmlHelper.GetNodeValue(n.SelectSingleNode("FileName")), - xmlHelper.GetNodeValue(n.SelectSingleNode("Content"))); + XmlHelper.GetNodeValue(n.SelectSingleNode("FileName")), + XmlHelper.GetNodeValue(n.SelectSingleNode("Content"))); } foreach (XmlNode prop in n.SelectNodes("Properties/Property")) { - string alias = xmlHelper.GetNodeValue(prop.SelectSingleNode("Alias")); + string alias = XmlHelper.GetNodeValue(prop.SelectSingleNode("Alias")); var sp = s.Properties.SingleOrDefault(p => p != null && p.Alias == alias); - string name = xmlHelper.GetNodeValue(prop.SelectSingleNode("Name")); + string name = XmlHelper.GetNodeValue(prop.SelectSingleNode("Name")); if (sp == null) { sp = StylesheetProperty.MakeNew( @@ -254,7 +246,7 @@ namespace umbraco.cms.businesslogic.web sp.Text = name; } sp.Alias = alias; - sp.value = xmlHelper.GetNodeValue(prop.SelectSingleNode("Value")); + sp.value = XmlHelper.GetNodeValue(prop.SelectSingleNode("Value")); } s.saveCssToFile(); diff --git a/src/umbraco.cms/businesslogic/web/StylesheetProperty.cs b/src/umbraco.cms/businesslogic/web/StylesheetProperty.cs index 4d530bd9ed..414c63ea05 100644 --- a/src/umbraco.cms/businesslogic/web/StylesheetProperty.cs +++ b/src/umbraco.cms/businesslogic/web/StylesheetProperty.cs @@ -1,10 +1,6 @@ using System; using System.Linq; using Umbraco.Core; -using Umbraco.Core.Cache; -using umbraco.cms.businesslogic.cache; -using Umbraco.Core.Models.Rdbms; -using umbraco.DataLayer; namespace umbraco.cms.businesslogic.web { diff --git a/src/umbraco.cms/businesslogic/workflow/Diff.cs b/src/umbraco.cms/businesslogic/workflow/Diff.cs deleted file mode 100644 index 39cbc1d2c3..0000000000 --- a/src/umbraco.cms/businesslogic/workflow/Diff.cs +++ /dev/null @@ -1,522 +0,0 @@ -using System; -using System.Collections; -using System.Text; -using System.Text.RegularExpressions; - - -namespace umbraco.cms.businesslogic.workflow -{ - /// - /// This Class implements the Difference Algorithm published in - /// "An O(ND) Difference Algorithm and its Variations" by Eugene Myers - /// Algorithmica Vol. 1 No. 2, 1986, p 251. - /// - /// The algorithm itself is comparing 2 arrays of numbers so when comparing 2 text documents - /// each line is converted into a (hash) number. See DiffText(). - /// - /// diff.cs: A port of the algorithm to C# - /// Copyright (c) by Matthias Hertel, http://www.mathertel.de - /// This work is licensed under a BSD style license. See http://www.mathertel.de/License.aspx - /// - [Obsolete("This class will be removed from the codebase in the future")] - public class Diff - { - - /// details of one difference. - public struct Item - { - /// Start Line number in Data A. - public int StartA; - /// Start Line number in Data B. - public int StartB; - - /// Number of changes in Data A. - public int deletedA; - /// Number of changes in Data B. - public int insertedB; - } // Item - - /// - /// Shortest Middle Snake Return Data - /// - private struct SMSRD - { - internal int x, y; - // internal int u, v; // 2002.09.20: no need for 2 points - } - - /// - /// Find the difference in 2 texts, comparing by textlines. - /// - /// A-version of the text (usualy the old one) - /// B-version of the text (usualy the new one) - /// Returns a array of Items that describe the differences. - public static Item[] DiffText(string TextA, string TextB) - { - return (DiffText(TextA, TextB, false, false, false)); - } // DiffText - - /// - /// Find the difference in 2 texts, comparing by textlines. - /// This method uses the DiffInt internally by 1st converting the string into char codes - /// then uses the diff int method - /// - /// A-version of the text (usualy the old one) - /// B-version of the text (usualy the new one) - /// Returns a array of Items that describe the differences. - public static Item[] DiffText1(string TextA, string TextB) - { - return DiffInt(DiffCharCodes(TextA, false), DiffCharCodes(TextB, false)); - } - - - /// - /// Find the difference in 2 text documents, comparing by textlines. - /// The algorithm itself is comparing 2 arrays of numbers so when comparing 2 text documents - /// each line is converted into a (hash) number. This hash-value is computed by storing all - /// textlines into a common hashtable so i can find dublicates in there, and generating a - /// new number each time a new textline is inserted. - /// - /// A-version of the text (usualy the old one) - /// B-version of the text (usualy the new one) - /// When set to true, all leading and trailing whitespace characters are stripped out before the comparation is done. - /// When set to true, all whitespace characters are converted to a single space character before the comparation is done. - /// When set to true, all characters are converted to their lowercase equivivalence before the comparation is done. - /// Returns a array of Items that describe the differences. - public static Item[] DiffText(string TextA, string TextB, bool trimSpace, bool ignoreSpace, bool ignoreCase) - { - // prepare the input-text and convert to comparable numbers. - Hashtable h = new Hashtable(TextA.Length + TextB.Length); - - // The A-Version of the data (original data) to be compared. - DiffData DataA = new DiffData(DiffCodes(TextA, h, trimSpace, ignoreSpace, ignoreCase)); - - // The B-Version of the data (modified data) to be compared. - DiffData DataB = new DiffData(DiffCodes(TextB, h, trimSpace, ignoreSpace, ignoreCase)); - - h = null; // free up hashtable memory (maybe) - - int MAX = DataA.Length + DataB.Length + 1; - /// vector for the (0,0) to (x,y) search - int[] DownVector = new int[2 * MAX + 2]; - /// vector for the (u,v) to (N,M) search - int[] UpVector = new int[2 * MAX + 2]; - - LCS(DataA, 0, DataA.Length, DataB, 0, DataB.Length, DownVector, UpVector); - - Optimize(DataA); - Optimize(DataB); - return CreateDiffs(DataA, DataB); - } // DiffText - - - /// - /// Diffs the char codes. - /// - /// A text. - /// if set to true [ignore case]. - /// - private static int[] DiffCharCodes(string aText, bool ignoreCase) - { - int[] Codes; - - if (ignoreCase) - aText = aText.ToUpperInvariant(); - - Codes = new int[aText.Length]; - - for (int n = 0; n < aText.Length; n++) - Codes[n] = (int)aText[n]; - - return (Codes); - } // DiffCharCodes - - /// - /// If a sequence of modified lines starts with a line that contains the same content - /// as the line that appends the changes, the difference sequence is modified so that the - /// appended line and not the starting line is marked as modified. - /// This leads to more readable diff sequences when comparing text files. - /// - /// A Diff data buffer containing the identified changes. - private static void Optimize(DiffData Data) - { - int StartPos, EndPos; - - StartPos = 0; - while (StartPos < Data.Length) - { - while ((StartPos < Data.Length) && (Data.modified[StartPos] == false)) - StartPos++; - EndPos = StartPos; - while ((EndPos < Data.Length) && (Data.modified[EndPos] == true)) - EndPos++; - - if ((EndPos < Data.Length) && (Data.data[StartPos] == Data.data[EndPos])) - { - Data.modified[StartPos] = false; - Data.modified[EndPos] = true; - } - else - { - StartPos = EndPos; - } // if - } // while - } // Optimize - - - /// - /// Find the difference in 2 arrays of integers. - /// - /// A-version of the numbers (usualy the old one) - /// B-version of the numbers (usualy the new one) - /// Returns a array of Items that describe the differences. - public static Item[] DiffInt(int[] ArrayA, int[] ArrayB) - { - // The A-Version of the data (original data) to be compared. - DiffData DataA = new DiffData(ArrayA); - - // The B-Version of the data (modified data) to be compared. - DiffData DataB = new DiffData(ArrayB); - - int MAX = DataA.Length + DataB.Length + 1; - /// vector for the (0,0) to (x,y) search - int[] DownVector = new int[2 * MAX + 2]; - /// vector for the (u,v) to (N,M) search - int[] UpVector = new int[2 * MAX + 2]; - - LCS(DataA, 0, DataA.Length, DataB, 0, DataB.Length, DownVector, UpVector); - return CreateDiffs(DataA, DataB); - } // Diff - - - /// - /// This function converts all textlines of the text into unique numbers for every unique textline - /// so further work can work only with simple numbers. - /// - /// the input text - /// This extern initialized hashtable is used for storing all ever used textlines. - /// ignore leading and trailing space characters - /// a array of integers. - private static int[] DiffCodes(string aText, Hashtable h, bool trimSpace, bool ignoreSpace, bool ignoreCase) - { - // get all codes of the text - string[] Lines; - int[] Codes; - int lastUsedCode = h.Count; - object aCode; - string s; - - // strip off all cr, only use lf as textline separator. - aText = aText.Replace("\r", ""); - Lines = aText.Split('\n'); - - Codes = new int[Lines.Length]; - - for (int i = 0; i < Lines.Length; ++i) - { - s = Lines[i]; - if (trimSpace) - s = s.Trim(); - - if (ignoreSpace) - { - s = Regex.Replace(s, "\\s+", " "); // TODO: optimization: faster blank removal. - } - - if (ignoreCase) - s = s.ToLower(); - - aCode = h[s]; - if (aCode == null) - { - lastUsedCode++; - h[s] = lastUsedCode; - Codes[i] = lastUsedCode; - } - else - { - Codes[i] = (int)aCode; - } // if - } // for - return (Codes); - } // DiffCodes - - - /// - /// This is the algorithm to find the Shortest Middle Snake (SMS). - /// - /// sequence A - /// lower bound of the actual range in DataA - /// upper bound of the actual range in DataA (exclusive) - /// sequence B - /// lower bound of the actual range in DataB - /// upper bound of the actual range in DataB (exclusive) - /// a vector for the (0,0) to (x,y) search. Passed as a parameter for speed reasons. - /// a vector for the (u,v) to (N,M) search. Passed as a parameter for speed reasons. - /// a MiddleSnakeData record containing x,y and u,v - private static SMSRD SMS(DiffData DataA, int LowerA, int UpperA, DiffData DataB, int LowerB, int UpperB, - int[] DownVector, int[] UpVector) - { - - SMSRD ret; - int MAX = DataA.Length + DataB.Length + 1; - - int DownK = LowerA - LowerB; // the k-line to start the forward search - int UpK = UpperA - UpperB; // the k-line to start the reverse search - - int Delta = (UpperA - LowerA) - (UpperB - LowerB); - bool oddDelta = (Delta & 1) != 0; - - // The vectors in the publication accepts negative indexes. the vectors implemented here are 0-based - // and are access using a specific offset: UpOffset UpVector and DownOffset for DownVektor - int DownOffset = MAX - DownK; - int UpOffset = MAX - UpK; - - int MaxD = ((UpperA - LowerA + UpperB - LowerB) / 2) + 1; - - // Debug.Write(2, "SMS", String.Format("Search the box: A[{0}-{1}] to B[{2}-{3}]", LowerA, UpperA, LowerB, UpperB)); - - // init vectors - DownVector[DownOffset + DownK + 1] = LowerA; - UpVector[UpOffset + UpK - 1] = UpperA; - - for (int D = 0; D <= MaxD; D++) - { - - // Extend the forward path. - for (int k = DownK - D; k <= DownK + D; k += 2) - { - // Debug.Write(0, "SMS", "extend forward path " + k.ToString()); - - // find the only or better starting point - int x, y; - if (k == DownK - D) - { - x = DownVector[DownOffset + k + 1]; // down - } - else - { - x = DownVector[DownOffset + k - 1] + 1; // a step to the right - if ((k < DownK + D) && (DownVector[DownOffset + k + 1] >= x)) - x = DownVector[DownOffset + k + 1]; // down - } - y = x - k; - - // find the end of the furthest reaching forward D-path in diagonal k. - while ((x < UpperA) && (y < UpperB) && (DataA.data[x] == DataB.data[y])) - { - x++; y++; - } - DownVector[DownOffset + k] = x; - - // overlap ? - if (oddDelta && (UpK - D < k) && (k < UpK + D)) - { - if (UpVector[UpOffset + k] <= DownVector[DownOffset + k]) - { - ret.x = DownVector[DownOffset + k]; - ret.y = DownVector[DownOffset + k] - k; - // ret.u = UpVector[UpOffset + k]; // 2002.09.20: no need for 2 points - // ret.v = UpVector[UpOffset + k] - k; - return (ret); - } // if - } // if - - } // for k - - // Extend the reverse path. - for (int k = UpK - D; k <= UpK + D; k += 2) - { - // Debug.Write(0, "SMS", "extend reverse path " + k.ToString()); - - // find the only or better starting point - int x, y; - if (k == UpK + D) - { - x = UpVector[UpOffset + k - 1]; // up - } - else - { - x = UpVector[UpOffset + k + 1] - 1; // left - if ((k > UpK - D) && (UpVector[UpOffset + k - 1] < x)) - x = UpVector[UpOffset + k - 1]; // up - } // if - y = x - k; - - while ((x > LowerA) && (y > LowerB) && (DataA.data[x - 1] == DataB.data[y - 1])) - { - x--; y--; // diagonal - } - UpVector[UpOffset + k] = x; - - // overlap ? - if (!oddDelta && (DownK - D <= k) && (k <= DownK + D)) - { - if (UpVector[UpOffset + k] <= DownVector[DownOffset + k]) - { - ret.x = DownVector[DownOffset + k]; - ret.y = DownVector[DownOffset + k] - k; - // ret.u = UpVector[UpOffset + k]; // 2002.09.20: no need for 2 points - // ret.v = UpVector[UpOffset + k] - k; - return (ret); - } // if - } // if - - } // for k - - } // for D - - throw new ApplicationException("the algorithm should never come here."); - } // SMS - - - /// - /// This is the divide-and-conquer implementation of the longes common-subsequence (LCS) - /// algorithm. - /// The published algorithm passes recursively parts of the A and B sequences. - /// To avoid copying these arrays the lower and upper bounds are passed while the sequences stay constant. - /// - /// sequence A - /// lower bound of the actual range in DataA - /// upper bound of the actual range in DataA (exclusive) - /// sequence B - /// lower bound of the actual range in DataB - /// upper bound of the actual range in DataB (exclusive) - /// a vector for the (0,0) to (x,y) search. Passed as a parameter for speed reasons. - /// a vector for the (u,v) to (N,M) search. Passed as a parameter for speed reasons. - private static void LCS(DiffData DataA, int LowerA, int UpperA, DiffData DataB, int LowerB, int UpperB, int[] DownVector, int[] UpVector) - { - // Debug.Write(2, "LCS", String.Format("Analyse the box: A[{0}-{1}] to B[{2}-{3}]", LowerA, UpperA, LowerB, UpperB)); - - // Fast walkthrough equal lines at the start - while (LowerA < UpperA && LowerB < UpperB && DataA.data[LowerA] == DataB.data[LowerB]) - { - LowerA++; LowerB++; - } - - // Fast walkthrough equal lines at the end - while (LowerA < UpperA && LowerB < UpperB && DataA.data[UpperA - 1] == DataB.data[UpperB - 1]) - { - --UpperA; --UpperB; - } - - if (LowerA == UpperA) - { - // mark as inserted lines. - while (LowerB < UpperB) - DataB.modified[LowerB++] = true; - - } - else if (LowerB == UpperB) - { - // mark as deleted lines. - while (LowerA < UpperA) - DataA.modified[LowerA++] = true; - - } - else - { - // Find the middle snakea and length of an optimal path for A and B - SMSRD smsrd = SMS(DataA, LowerA, UpperA, DataB, LowerB, UpperB, DownVector, UpVector); - // Debug.Write(2, "MiddleSnakeData", String.Format("{0},{1}", smsrd.x, smsrd.y)); - - // The path is from LowerX to (x,y) and (x,y) to UpperX - LCS(DataA, LowerA, smsrd.x, DataB, LowerB, smsrd.y, DownVector, UpVector); - LCS(DataA, smsrd.x, UpperA, DataB, smsrd.y, UpperB, DownVector, UpVector); // 2002.09.20: no need for 2 points - } - } // LCS() - - - /// Scan the tables of which lines are inserted and deleted, - /// producing an edit script in forward order. - /// - /// dynamic array - private static Item[] CreateDiffs(DiffData DataA, DiffData DataB) - { - ArrayList a = new ArrayList(); - Item aItem; - Item[] result; - - int StartA, StartB; - int LineA, LineB; - - LineA = 0; - LineB = 0; - while (LineA < DataA.Length || LineB < DataB.Length) - { - if ((LineA < DataA.Length) && (!DataA.modified[LineA]) - && (LineB < DataB.Length) && (!DataB.modified[LineB])) - { - // equal lines - LineA++; - LineB++; - - } - else - { - // maybe deleted and/or inserted lines - StartA = LineA; - StartB = LineB; - - while (LineA < DataA.Length && (LineB >= DataB.Length || DataA.modified[LineA])) - // while (LineA < DataA.Length && DataA.modified[LineA]) - LineA++; - - while (LineB < DataB.Length && (LineA >= DataA.Length || DataB.modified[LineB])) - // while (LineB < DataB.Length && DataB.modified[LineB]) - LineB++; - - if ((StartA < LineA) || (StartB < LineB)) - { - // store a new difference-item - aItem = new Item(); - aItem.StartA = StartA; - aItem.StartB = StartB; - aItem.deletedA = LineA - StartA; - aItem.insertedB = LineB - StartB; - a.Add(aItem); - } // if - } // if - } // while - - result = new Item[a.Count]; - a.CopyTo(result); - - return (result); - } - - } // class Diff - - /// Data on one input file being compared. - /// - [Obsolete("This class will be removed from the codebase in the future, logic has moved to the Core project")] - internal class DiffData - { - - /// Number of elements (lines). - internal int Length; - - /// Buffer of numbers that will be compared. - internal int[] data; - - /// - /// Array of booleans that flag for modified data. - /// This is the result of the diff. - /// This means deletedA in the first Data or inserted in the second Data. - /// - internal bool[] modified; - - /// - /// Initialize the Diff-Data buffer. - /// - /// reference to the buffer - internal DiffData(int[] initData) - { - data = initData; - Length = initData.Length; - modified = new bool[Length + 2]; - } // DiffData - - } // class DiffData - -} // namespace \ No newline at end of file diff --git a/src/umbraco.cms/umbraco.cms.csproj b/src/umbraco.cms/umbraco.cms.csproj index add46ea274..662b732773 100644 --- a/src/umbraco.cms/umbraco.cms.csproj +++ b/src/umbraco.cms/umbraco.cms.csproj @@ -211,15 +211,6 @@ - - - - - - - Code - - @@ -237,22 +228,17 @@ - + - - Code - - Code - Code @@ -262,12 +248,6 @@ Code - - Code - - - Code - Code @@ -338,12 +318,6 @@ Code - - - - - Code - Code @@ -359,7 +333,6 @@ Code - Code diff --git a/src/umbraco.controls/TreeUrlGenerator.cs b/src/umbraco.controls/TreeUrlGenerator.cs deleted file mode 100644 index 0ca735cb4f..0000000000 --- a/src/umbraco.controls/TreeUrlGenerator.cs +++ /dev/null @@ -1,202 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace umbraco.uicontrols -{ - /// - /// This class will generate the URLs for iframe tree pages. - /// Generally used to get the a tree picker url. - /// - /// - /// This was created in 4.1 so that this helper class can be exposed to other assemblies since - /// it only existed in the presentation assembly in previous versions - /// - public class TreeUrlGenerator - { - - public const string TREE_URL = "tree.aspx"; - public const string INIT_URL = "treeinit.aspx"; - public const string PICKER_URL = "treepicker.aspx"; - - private int? m_startNodeID; - private string m_treeType; - private bool? m_showContextMenu; - private bool? m_isDialog; - private string m_app; - private string m_nodeKey; - private string m_functionToCall; - - #region Public Properties - - public string FunctionToCall - { - get { return m_functionToCall; } - set { m_functionToCall = value; } - } - - public string NodeKey - { - get { return m_nodeKey; } - set { m_nodeKey = value; } - } - - public int StartNodeID - { - get { return m_startNodeID ?? -1; } - set { m_startNodeID = value; } - } - - public string TreeType - { - get { return m_treeType; } - set { m_treeType = value; } - } - - public bool ShowContextMenu - { - get { return m_showContextMenu ?? true; } - set { m_showContextMenu = value; } - } - - public bool IsDialog - { - get { return m_isDialog ?? false; } - set { m_isDialog = value; } - } - - public string App - { - get { return m_app; } - set { m_app = value; } - } - #endregion - - /// - /// Returns the url for servicing the xml tree request based on the parameters specified on this class. - /// - /// Tree service url as a string - public string GetServiceUrl() - { - return Umbraco.Core.IO.IOHelper.ResolveUrl(Umbraco.Core.IO.SystemDirectories.Umbraco) + "/" + GetUrl(TREE_URL); - } - - /// - /// Static method to return the tree service url with the specified parameters - /// - /// - /// - /// - /// - /// - /// - /// - /// - public static string GetServiceUrl(int? startNodeID, string treeType, bool? showContextMenu, - bool? isDialog, string app, string nodeKey, string functionToCall) - { - TreeUrlGenerator treeSvc = new TreeUrlGenerator() - { - StartNodeID = startNodeID ?? -1, - TreeType = treeType, - ShowContextMenu = showContextMenu ?? true, - IsDialog = isDialog ?? false, - App = app, - NodeKey = nodeKey, - FunctionToCall = functionToCall - }; - return treeSvc.GetServiceUrl(); - } - - /// - /// Returns the url for initializing the tree based on the parameters specified on this class - /// - /// - public string GetInitUrl() - { - return Umbraco.Core.IO.IOHelper.ResolveUrl(Umbraco.Core.IO.SystemDirectories.Umbraco) + "/" + GetUrl(INIT_URL); - } - - /// - /// static method to return the tree init url with the specified parameters - /// - /// - /// - /// - /// - /// - /// - /// - /// - public static string GetInitUrl(int? startNodeID, string treeType, bool? showContextMenu, - bool? isDialog, string app, string nodeKey, string functionToCall) - { - TreeUrlGenerator treeSvc = new TreeUrlGenerator() - { - StartNodeID = startNodeID ?? -1, - TreeType = treeType, - ShowContextMenu = showContextMenu ?? true, - IsDialog = isDialog ?? false, - App = app, - NodeKey = nodeKey, - FunctionToCall = functionToCall - }; - return treeSvc.GetInitUrl(); - } - - /// - /// Returns the url for the tree picker (used on modal windows) based on the parameters specified on this class - /// - public static string GetPickerUrl(string app, string treeType) - { - TreeUrlGenerator treeSvc = new TreeUrlGenerator(); - treeSvc.App = app; - treeSvc.TreeType = treeType; - return treeSvc.GetPickerUrl(); - } - - /// - /// Returns the url for the tree picker (used on modal windows) based on the parameters specified on this class - /// - public string GetPickerUrl() - { - return Umbraco.Core.IO.IOHelper.ResolveUrl(Umbraco.Core.IO.SystemDirectories.Umbraco) + "/dialogs/" + GetUrl(PICKER_URL); - } - - [Obsolete("No longer used as useSubModal no longer has any relavence")] - public static string GetPickerUrl(bool useSubModal, string app, string treeType) - { - return GetPickerUrl(app, treeType); - } - [Obsolete("No longer used as useSubModal no longer has any relavence")] - public string GetPickerUrl(bool useSubModal) - { - return GetPickerUrl(); - } - - /// - /// Generates the URL parameters for the tree service. - /// - /// the base url (i.e. tree.aspx) - /// - protected virtual string GetUrl(string pageUrl) - { - StringBuilder sb = new StringBuilder(); - - sb.Append(pageUrl); - //insert random - sb.Append(string.Format("?rnd={0}", Guid.NewGuid().ToString("N"))); - - sb.Append(string.Format("&id={0}", this.StartNodeID.ToString())); - if (!string.IsNullOrEmpty(this.TreeType)) sb.Append(string.Format("&treeType={0}", this.TreeType)); - if (!string.IsNullOrEmpty(this.NodeKey)) sb.Append(string.Format("&nodeKey={0}", this.NodeKey)); - sb.Append(string.Format("&contextMenu={0}", this.ShowContextMenu.ToString().ToLower())); - sb.Append(string.Format("&isDialog={0}", this.IsDialog.ToString().ToLower())); - if (!string.IsNullOrEmpty(this.App)) sb.Append(string.Format("&app={0}", this.App)); - - return sb.ToString(); - } - - } -} diff --git a/src/umbraco.controls/helper.cs b/src/umbraco.controls/helper.cs deleted file mode 100644 index 51fa443f13..0000000000 --- a/src/umbraco.controls/helper.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Web.UI; -using System.Web.UI.WebControls; -using System.Web.UI.HtmlControls; - -namespace umbraco.uicontrols -{ - [Obsolete("To register scripts and css files for controls, use the ClientDependency library")] - public class helper - { - [Obsolete("To register scripts and css files for controls, use the ClientDependency library")] - public static void AddLinkToHeader(string key, string src, Page page) - { - if (page.Header != null) - { - if (!page.ClientScript.IsClientScriptBlockRegistered(page.GetType(), key)) - { - page.ClientScript.RegisterClientScriptBlock(page.GetType(), key, String.Empty); - ((HtmlHead)page.Header).Controls.Add(new LiteralControl(String.Format("", src))); - } - } - else - { - // can't add to header, will failback to a simple register script - page.ClientScript.RegisterClientScriptBlock(page.GetType(), key, String.Format("", src)); - } - } - - [Obsolete("To register scripts and css files for controls, use the ClientDependency library")] - public static void AddScriptToHeader(string key, string src, Page page) - { - if (page.Header != null) - { - if (!page.ClientScript.IsClientScriptBlockRegistered(page.GetType(), key)) - { - page.ClientScript.RegisterClientScriptBlock(page.GetType(), key, String.Empty); - ((HtmlHead)page.Header).Controls.Add(new LiteralControl(String.Format("", src))); - } - } - else - { - // can't add to header, will failback to a simple register script - page.ClientScript.RegisterClientScriptBlock(page.GetType(), key, String.Format("", src)); - } - } - } -} diff --git a/src/umbraco.controls/umbraco.controls.csproj b/src/umbraco.controls/umbraco.controls.csproj index 4c1914f75f..cd94d6af08 100644 --- a/src/umbraco.controls/umbraco.controls.csproj +++ b/src/umbraco.controls/umbraco.controls.csproj @@ -102,11 +102,8 @@ - - -