From f93fee28dd714aa6758c12a9cc9787274fd83309 Mon Sep 17 00:00:00 2001 From: Shannon Date: Wed, 16 Mar 2016 14:51:04 +0100 Subject: [PATCH 01/37] U4-8165 Ensure browsers are not caching service requests --- .../Editors/StylesheetController.cs | 3 +- .../Editors/TemplateQueryController.cs | 1 - .../UmbracoAuthorizedJsonController.cs | 1 + .../Mvc/DisableBrowserCacheAttribute.cs | 24 +++++++++++++++ .../Mvc/UmbracoAuthorizedController.cs | 2 +- src/Umbraco.Web/Umbraco.Web.csproj | 1 + .../Filters/DisableBrowserCacheAttribute.cs | 30 ++++++++----------- 7 files changed, 41 insertions(+), 21 deletions(-) create mode 100644 src/Umbraco.Web/Mvc/DisableBrowserCacheAttribute.cs diff --git a/src/Umbraco.Web/Editors/StylesheetController.cs b/src/Umbraco.Web/Editors/StylesheetController.cs index 38318541a4..535351a14f 100644 --- a/src/Umbraco.Web/Editors/StylesheetController.cs +++ b/src/Umbraco.Web/Editors/StylesheetController.cs @@ -22,8 +22,7 @@ namespace Umbraco.Web.Editors /// /// The API controller used for retrieving available stylesheets /// - [PluginController("UmbracoApi")] - [DisableBrowserCache] + [PluginController("UmbracoApi")] public class StylesheetController : UmbracoAuthorizedJsonController { public IEnumerable GetAll() diff --git a/src/Umbraco.Web/Editors/TemplateQueryController.cs b/src/Umbraco.Web/Editors/TemplateQueryController.cs index 4b81715ead..2eaf63f159 100644 --- a/src/Umbraco.Web/Editors/TemplateQueryController.cs +++ b/src/Umbraco.Web/Editors/TemplateQueryController.cs @@ -18,7 +18,6 @@ namespace Umbraco.Web.Editors /// The API controller used for building content queries within the template /// [PluginController("UmbracoApi")] - [DisableBrowserCache] [JsonCamelCaseFormatter] public class TemplateQueryController : UmbracoAuthorizedJsonController { diff --git a/src/Umbraco.Web/Editors/UmbracoAuthorizedJsonController.cs b/src/Umbraco.Web/Editors/UmbracoAuthorizedJsonController.cs index e60abe0859..30ffd26e12 100644 --- a/src/Umbraco.Web/Editors/UmbracoAuthorizedJsonController.cs +++ b/src/Umbraco.Web/Editors/UmbracoAuthorizedJsonController.cs @@ -13,6 +13,7 @@ namespace Umbraco.Web.Editors /// [ValidateAngularAntiForgeryToken] [AngularJsonOnlyConfiguration] + [DisableBrowserCache] public abstract class UmbracoAuthorizedJsonController : UmbracoAuthorizedApiController { protected UmbracoAuthorizedJsonController() diff --git a/src/Umbraco.Web/Mvc/DisableBrowserCacheAttribute.cs b/src/Umbraco.Web/Mvc/DisableBrowserCacheAttribute.cs new file mode 100644 index 0000000000..c1b5b88643 --- /dev/null +++ b/src/Umbraco.Web/Mvc/DisableBrowserCacheAttribute.cs @@ -0,0 +1,24 @@ +using System; +using System.Web; +using System.Web.Mvc; + +namespace Umbraco.Web.Mvc +{ + /// + /// Ensures that the request is not cached by the browser + /// + public class DisableBrowserCacheAttribute : ActionFilterAttribute + { + public override void OnActionExecuted(ActionExecutedContext filterContext) + { + base.OnActionExecuted(filterContext); + + filterContext.HttpContext.Response.Cache.SetCacheability(HttpCacheability.NoCache); + filterContext.HttpContext.Response.Cache.SetMaxAge(TimeSpan.Zero); + filterContext.HttpContext.Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches); + filterContext.HttpContext.Response.Cache.SetNoStore(); + filterContext.HttpContext.Response.AddHeader("Pragma", "no-cache"); + filterContext.HttpContext.Response.Cache.SetExpires(new DateTime(1990, 1, 1, 0, 0, 0)); + } + } +} \ No newline at end of file diff --git a/src/Umbraco.Web/Mvc/UmbracoAuthorizedController.cs b/src/Umbraco.Web/Mvc/UmbracoAuthorizedController.cs index a70bc47cb9..9229939d0f 100644 --- a/src/Umbraco.Web/Mvc/UmbracoAuthorizedController.cs +++ b/src/Umbraco.Web/Mvc/UmbracoAuthorizedController.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using System.Web.Mvc; using Umbraco.Core.Configuration; using Umbraco.Web.Routing; using Umbraco.Web.Security; @@ -18,6 +17,7 @@ namespace Umbraco.Web.Mvc /// authorization of each method can use this attribute instead of inheriting from this controller. /// [UmbracoAuthorize] + [DisableBrowserCache] public abstract class UmbracoAuthorizedController : UmbracoController { diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 9778cee6e0..7aec0b676f 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -343,6 +343,7 @@ + diff --git a/src/Umbraco.Web/WebApi/Filters/DisableBrowserCacheAttribute.cs b/src/Umbraco.Web/WebApi/Filters/DisableBrowserCacheAttribute.cs index c526317d95..e1890326fb 100644 --- a/src/Umbraco.Web/WebApi/Filters/DisableBrowserCacheAttribute.cs +++ b/src/Umbraco.Web/WebApi/Filters/DisableBrowserCacheAttribute.cs @@ -13,6 +13,9 @@ using Umbraco.Core; namespace Umbraco.Web.WebApi.Filters { + /// + /// Ensures that the request is not cached by the browser + /// public class DisableBrowserCacheAttribute : ActionFilterAttribute { public override void OnActionExecuted(HttpActionExecutedContext actionExecutedContext) @@ -21,23 +24,16 @@ namespace Umbraco.Web.WebApi.Filters base.OnActionExecuted(actionExecutedContext); - //TODO: This should all work without issue! BUT it doesn't, i have a feeling this might be fixed - // in the next webapi version. ASP.Net is overwriting the cachecontrol all the time, some docs are here: - // http://stackoverflow.com/questions/11547618/output-caching-for-an-apicontroller-mvc4-web-api - // and I've checked the source code so doing this should cause it to write the headers we want but it doesnt. - //So I've reverted to brute force on the HttpContext. - //actionExecutedContext.Response.Headers.CacheControl = new CacheControlHeaderValue() - //{ - // NoCache = true, - // NoStore = true, - // MaxAge = new TimeSpan(0), - // MustRevalidate = true - //}; - - HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache); - HttpContext.Current.Response.Cache.SetMaxAge(TimeSpan.Zero); - HttpContext.Current.Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches); - HttpContext.Current.Response.Cache.SetNoStore(); + //NOTE: Until we upgraded to WebApi 2, this didn't work correctly and we had to revert to using + // HttpContext.Current responses. I've changed this back to what it should be now since it works + // and now with WebApi2, the HttpContext.Current responses dont! Anyways, all good now. + actionExecutedContext.Response.Headers.CacheControl = new CacheControlHeaderValue() + { + NoCache = true, + NoStore = true, + MaxAge = new TimeSpan(0), + MustRevalidate = true + }; actionExecutedContext.Response.Headers.Pragma.Add(new NameValueHeaderValue("no-cache")); if (actionExecutedContext.Response.Content != null) From 5230f55f441358285fe602e559aea800c2b51e2b Mon Sep 17 00:00:00 2001 From: Shannon Date: Wed, 16 Mar 2016 14:52:40 +0100 Subject: [PATCH 02/37] moves attribute --- src/Umbraco.Web/Editors/UmbracoAuthorizedJsonController.cs | 3 +-- src/Umbraco.Web/WebApi/UmbracoAuthorizedApiController.cs | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web/Editors/UmbracoAuthorizedJsonController.cs b/src/Umbraco.Web/Editors/UmbracoAuthorizedJsonController.cs index 30ffd26e12..16001057be 100644 --- a/src/Umbraco.Web/Editors/UmbracoAuthorizedJsonController.cs +++ b/src/Umbraco.Web/Editors/UmbracoAuthorizedJsonController.cs @@ -12,8 +12,7 @@ namespace Umbraco.Web.Editors /// methods that are not called by Angular or don't contain a valid csrf header will NOT work. /// [ValidateAngularAntiForgeryToken] - [AngularJsonOnlyConfiguration] - [DisableBrowserCache] + [AngularJsonOnlyConfiguration] public abstract class UmbracoAuthorizedJsonController : UmbracoAuthorizedApiController { protected UmbracoAuthorizedJsonController() diff --git a/src/Umbraco.Web/WebApi/UmbracoAuthorizedApiController.cs b/src/Umbraco.Web/WebApi/UmbracoAuthorizedApiController.cs index 924ec8bd2e..a4d09f626d 100644 --- a/src/Umbraco.Web/WebApi/UmbracoAuthorizedApiController.cs +++ b/src/Umbraco.Web/WebApi/UmbracoAuthorizedApiController.cs @@ -18,6 +18,7 @@ namespace Umbraco.Web.WebApi [IsBackOffice] [UmbracoUserTimeoutFilter] [UmbracoAuthorize] + [DisableBrowserCache] public abstract class UmbracoAuthorizedApiController : UmbracoApiController { protected UmbracoAuthorizedApiController() From b3c6654d41a113572069bf084bd4bec0165acb51 Mon Sep 17 00:00:00 2001 From: Shannon Date: Thu, 17 Mar 2016 17:31:36 +0100 Subject: [PATCH 03/37] bumps version --- build/UmbracoVersion.txt | 2 +- src/SolutionInfo.cs | 4 ++-- src/Umbraco.Core/Configuration/UmbracoVersion.cs | 2 +- src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/build/UmbracoVersion.txt b/build/UmbracoVersion.txt index 44535920ee..4846f08fcf 100644 --- a/build/UmbracoVersion.txt +++ b/build/UmbracoVersion.txt @@ -1,2 +1,2 @@ # Usage: on line 2 put the release version, on line 3 put the version comment (example: beta) -7.4.1 \ No newline at end of file +7.4.2 \ No newline at end of file diff --git a/src/SolutionInfo.cs b/src/SolutionInfo.cs index 2e29693e9a..39a59f898c 100644 --- a/src/SolutionInfo.cs +++ b/src/SolutionInfo.cs @@ -11,5 +11,5 @@ using System.Resources; [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyFileVersion("7.4.1")] -[assembly: AssemblyInformationalVersion("7.4.1")] \ No newline at end of file +[assembly: AssemblyFileVersion("7.4.2")] +[assembly: AssemblyInformationalVersion("7.4.2")] \ No newline at end of file diff --git a/src/Umbraco.Core/Configuration/UmbracoVersion.cs b/src/Umbraco.Core/Configuration/UmbracoVersion.cs index 03a24dbb9d..c424d1fc21 100644 --- a/src/Umbraco.Core/Configuration/UmbracoVersion.cs +++ b/src/Umbraco.Core/Configuration/UmbracoVersion.cs @@ -6,7 +6,7 @@ namespace Umbraco.Core.Configuration { public class UmbracoVersion { - private static readonly Version Version = new Version("7.4.1"); + private static readonly Version Version = new Version("7.4.2"); /// /// Gets the current version of Umbraco. diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 4a8d202719..2652ccbf27 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -2411,9 +2411,9 @@ xcopy "$(ProjectDir)"..\packages\SqlServerCE.4.0.0.1\x86\*.* "$(TargetDir)x86\" True True - 7410 + 7420 / - http://localhost:7410 + http://localhost:7420 False False From 2703fa7ea21862dddef71144fbeec25489af6dcd Mon Sep 17 00:00:00 2001 From: Mitton Date: Fri, 18 Mar 2016 06:12:44 +0200 Subject: [PATCH 04/37] Grid translation - French --- src/Umbraco.Web.UI/umbraco/config/lang/fr.xml | 56 +++++++++---------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/fr.xml b/src/Umbraco.Web.UI/umbraco/config/lang/fr.xml index a7b219618e..db1597440f 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/fr.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/fr.xml @@ -839,43 +839,43 @@ Pour gérer votre site, ouvrez simplement le backoffice Umbraco et commencez à Modèle - Choose type of content - Choose a layout - Add a row - Add content + Choisissez le type de contenu + Choisissez une mise en page + Ajouter une ligne + Ajouter du contenu Drop content - Settings applied + Contenu goutte - This content is not allowed here - This content is allowed here + Ce contenu est pas autorisée ici + Ce contenu est permis ici - Click to embed - Click to insert image - Image caption... - Write here... + Cliquez pour intégrer + Cliquez pour insérer l'image + Légende de l'image... + Ecrire ici... - Grid Layouts - Layouts are the overall work area for the grid editor, usually you only need one or two different layouts - Add Grid Layout - Adjust the layout by setting column widths and adding additional sections - Row configurations - Rows are predefined cells arranged horizontally - Add row configuration - Adjust the row by setting cell widths and adding additional cells + Layouts Grid + Layouts sont la superficie totale de travail pour l'éditeur de grille, en général, vous avez seulement besoin d'une ou deux configurations différentes + Ajouter Grid Layout + Ajustez la mise en page en définissant la largeur des colonnes et ajouter des sections supplémentaires + Configurations des lignes + Les lignes sont des cellules prédéfinies disposées horizontalement + Ajouter une configuration de la ligne + Ajustez la ligne en réglant la largeur des cellules et en ajoutant des cellules supplémentaires - Columns - Total combined number of columns in the grid layout + Colonnes + Nombre total combiné de colonnes dans la configuration de la grille - Settings - Configure what settings editors can change + Paramètres + Configurer quels paramètres éditeurs peuvent changer - Styles - Configure what styling editors can change + Modes + Configurer ce style éditeurs peuvent changer - Settings will only save if the entered json configuration is valid + Les réglages seulement économiser si la configuration du json saisi est valide - Allow all editors - Allow all row configurations + Autoriser tous les éditeurs + Autoriser toutes les configurations de lignes Champ alternatif From 6ad56863d44316a8debe87d45b4183b93d34473c Mon Sep 17 00:00:00 2001 From: Mitton Date: Fri, 18 Mar 2016 06:15:37 +0200 Subject: [PATCH 05/37] Grid translation - French --- src/Umbraco.Web.UI/umbraco/config/lang/fr.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI/umbraco/config/lang/fr.xml b/src/Umbraco.Web.UI/umbraco/config/lang/fr.xml index db1597440f..a0842c8821 100644 --- a/src/Umbraco.Web.UI/umbraco/config/lang/fr.xml +++ b/src/Umbraco.Web.UI/umbraco/config/lang/fr.xml @@ -843,8 +843,8 @@ Pour gérer votre site, ouvrez simplement le backoffice Umbraco et commencez à Choisissez une mise en page Ajouter une ligne Ajouter du contenu - Drop content - Contenu goutte + Contenu goutte + Paramètres appliqués Ce contenu est pas autorisée ici Ce contenu est permis ici From 0468af67d45c7b5a1c5d40c34b434c2752a53603 Mon Sep 17 00:00:00 2001 From: David Brendel Date: Fri, 18 Mar 2016 07:58:19 +0100 Subject: [PATCH 06/37] U4-5448 Move dictionary tree to translation section instead of settings section --- .../umbraco.presentation/umbraco/Trees/loadDictionary.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadDictionary.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadDictionary.cs index d6c82d0fbc..acedf67ba4 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadDictionary.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadDictionary.cs @@ -13,7 +13,7 @@ using Umbraco.Web._Legacy.Actions; namespace umbraco { - [Tree(Constants.Applications.Settings, Constants.Trees.Dictionary, "Dictionary", sortOrder: 3)] + [Tree(Constants.Applications.Translation, Constants.Trees.Dictionary, "Dictionary", sortOrder: 3)] public class loadDictionary : BaseTree { public loadDictionary(string application) : base(application) { } From 9e3d7a1cce508e4ea364af20ec78b95a8ae59142 Mon Sep 17 00:00:00 2001 From: Shannon Date: Fri, 18 Mar 2016 11:05:39 +0100 Subject: [PATCH 07/37] updates default pipeline marker stage for the preview middleware, updates MembershipHelper to not throw an exception if the Role manager is disabled. --- .../Security/Identity/AppBuilderExtensions.cs | 9 +++++---- src/Umbraco.Web/Security/MembershipHelper.cs | 5 +++-- src/Umbraco.Web/UmbracoDefaultOwinStartup.cs | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/Umbraco.Web/Security/Identity/AppBuilderExtensions.cs b/src/Umbraco.Web/Security/Identity/AppBuilderExtensions.cs index 5247a7ad3b..3097407de3 100644 --- a/src/Umbraco.Web/Security/Identity/AppBuilderExtensions.cs +++ b/src/Umbraco.Web/Security/Identity/AppBuilderExtensions.cs @@ -276,15 +276,16 @@ namespace Umbraco.Web.Security.Identity var authOptions = CreateCookieAuthOptions(); app.Use(typeof(PreviewAuthenticationMiddleware), authOptions); + //This middleware must execute at least on PostAuthentication, by default it is on Authorize + // The middleware needs to execute after the RoleManagerModule executes which is during PostAuthenticate, + // currently I've had 100% success with ensuring this fires after RoleManagerModule even if this is set + // to PostAuthenticate though not sure if that's always a guarantee so by default it's Authorize. if (stage < PipelineStage.PostAuthenticate) { throw new InvalidOperationException("The stage specified for UseUmbracoPreviewAuthentication must be greater than or equal to " + PipelineStage.PostAuthenticate); } - //Marks the above middlewares to execute on PostAuthenticate - //NOTE: The above middleware needs to execute after the RoleManagerModule executes which is also during PostAuthenticate, - // currently I've had 100% success with ensuring this fires after RoleManagerModule though not sure if that's always a - // guarantee. + app.UseStageMarker(stage); } diff --git a/src/Umbraco.Web/Security/MembershipHelper.cs b/src/Umbraco.Web/Security/MembershipHelper.cs index 3bb916ed13..4f5c14723b 100644 --- a/src/Umbraco.Web/Security/MembershipHelper.cs +++ b/src/Umbraco.Web/Security/MembershipHelper.cs @@ -13,6 +13,7 @@ using Umbraco.Core.Security; using Umbraco.Web.Models; using Umbraco.Web.PublishedCache; using Umbraco.Core.Cache; +using Umbraco.Web.Security.Providers; using MPE = global::Umbraco.Core.Security.MembershipProviderExtensions; namespace Umbraco.Web.Security @@ -30,7 +31,7 @@ namespace Umbraco.Web.Security #region Constructors public MembershipHelper(ApplicationContext applicationContext, HttpContextBase httpContext) - : this(applicationContext, httpContext, MPE.GetMembersMembershipProvider(), Roles.Provider) + : this(applicationContext, httpContext, MPE.GetMembersMembershipProvider(), Roles.Enabled ? Roles.Provider : new MembersRoleProvider(applicationContext.Services.MemberService)) { } @@ -47,7 +48,7 @@ namespace Umbraco.Web.Security } public MembershipHelper(UmbracoContext umbracoContext) - : this(umbracoContext, MPE.GetMembersMembershipProvider(), Roles.Provider) + : this(umbracoContext, MPE.GetMembersMembershipProvider(), Roles.Enabled ? Roles.Provider: new MembersRoleProvider(umbracoContext.Application.Services.MemberService)) { } diff --git a/src/Umbraco.Web/UmbracoDefaultOwinStartup.cs b/src/Umbraco.Web/UmbracoDefaultOwinStartup.cs index 1f1f1c7674..5b3fadd0f3 100644 --- a/src/Umbraco.Web/UmbracoDefaultOwinStartup.cs +++ b/src/Umbraco.Web/UmbracoDefaultOwinStartup.cs @@ -59,7 +59,7 @@ namespace Umbraco.Web app .UseUmbracoBackOfficeCookieAuthentication(ApplicationContext, PipelineStage.Authenticate) .UseUmbracoBackOfficeExternalCookieAuthentication(ApplicationContext, PipelineStage.Authenticate) - .UseUmbracoPreviewAuthentication(ApplicationContext, PipelineStage.PostAuthenticate); + .UseUmbracoPreviewAuthentication(ApplicationContext, PipelineStage.Authorize); } protected virtual ApplicationContext ApplicationContext From 7f6296b2550a91040f96fc2ccedbeece6baab071 Mon Sep 17 00:00:00 2001 From: Dan Lister Date: Fri, 18 Mar 2016 10:07:56 +0000 Subject: [PATCH 08/37] U4-8187 Removed legacy loadLanguages and loadTemplates tree classes --- .../Trees/LanguageTreeController.cs | 1 - .../Trees/TemplatesTreeController.cs | 1 - src/Umbraco.Web/Umbraco.Web.csproj | 2 - .../umbraco/Trees/loadLanguages.cs | 55 ----- .../umbraco/Trees/loadTemplates.cs | 230 ------------------ 5 files changed, 289 deletions(-) delete mode 100644 src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadLanguages.cs delete mode 100644 src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadTemplates.cs diff --git a/src/Umbraco.Web/Trees/LanguageTreeController.cs b/src/Umbraco.Web/Trees/LanguageTreeController.cs index 88ad43e3a5..42721672fb 100644 --- a/src/Umbraco.Web/Trees/LanguageTreeController.cs +++ b/src/Umbraco.Web/Trees/LanguageTreeController.cs @@ -17,7 +17,6 @@ using Constants = Umbraco.Core.Constants; namespace Umbraco.Web.Trees { [UmbracoTreeAuthorize(Constants.Trees.Languages)] - [LegacyBaseTree(typeof(loadLanguages))] [Tree(Constants.Applications.Settings, Constants.Trees.Languages, null, sortOrder: 4)] [PluginController("UmbracoTrees")] [CoreTree] diff --git a/src/Umbraco.Web/Trees/TemplatesTreeController.cs b/src/Umbraco.Web/Trees/TemplatesTreeController.cs index 536151d738..3428b4b32e 100644 --- a/src/Umbraco.Web/Trees/TemplatesTreeController.cs +++ b/src/Umbraco.Web/Trees/TemplatesTreeController.cs @@ -21,7 +21,6 @@ using Constants = Umbraco.Core.Constants; namespace Umbraco.Web.Trees { [UmbracoTreeAuthorize(Constants.Trees.Templates)] - [LegacyBaseTree(typeof (loadTemplates))] [Tree(Constants.Applications.Settings, Constants.Trees.Templates, "Templates", sortOrder:1)] [PluginController("UmbracoTrees")] [CoreTree] diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 8a9160611d..d869580f85 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -1577,14 +1577,12 @@ - - diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadLanguages.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadLanguages.cs deleted file mode 100644 index c9fe72c2e9..0000000000 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadLanguages.cs +++ /dev/null @@ -1,55 +0,0 @@ -using System; -using System.Text; - -using umbraco.cms.businesslogic.language; -using umbraco.cms.presentation.Trees; -using Umbraco.Core; - - -namespace umbraco -{ - [Obsolete("This is no longer used and will be removed from the codebase in the future")] - //[Tree(Constants.Applications.Settings, "languages", "Languages", sortOrder: 4)] - public class loadLanguages : BaseTree - { - public loadLanguages(string application) : base(application) { } - - protected override void CreateRootNode(ref XmlTreeNode rootNode) - { - rootNode.NodeType = "init" + TreeAlias; - rootNode.NodeID = "init"; - } - - public override void RenderJS(ref StringBuilder Javascript) - { - Javascript.Append( - @" -function openLanguage(id) { - UmbClientMgr.contentFrame('settings/editLanguage.aspx?id=' + id); -}"); - } - - public override void Render(ref XmlTree tree) - { - foreach (Language l in Language.getAll) - { - XmlTreeNode xNode = XmlTreeNode.Create(this); - xNode.NodeID = l.id.ToString(); //"language_" + l.id.ToString(); - xNode.Text = l.FriendlyName; - xNode.Action = "javascript:openLanguage(" + l.id + ");"; - xNode.Icon = "icon-flag-alt"; - xNode.OpenIcon = "icon-flag-alt"; - - OnBeforeNodeRender(ref tree, ref xNode, EventArgs.Empty); - if (xNode != null) - { - tree.Add(xNode); - OnAfterNodeRender(ref tree, ref xNode, EventArgs.Empty); - } - - } - } - - } - -} diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadTemplates.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadTemplates.cs deleted file mode 100644 index 2d9fe51ec9..0000000000 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/Trees/loadTemplates.cs +++ /dev/null @@ -1,230 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Globalization; -using System.IO; -using System.Text; -using Umbraco.Core; -using Umbraco.Core.Configuration; -using Umbraco.Core.IO; - -using Umbraco.Core.Services; -using umbraco.cms.businesslogic.template; -using umbraco.cms.presentation.Trees; -using Umbraco.Web._Legacy.Actions; - - -namespace umbraco -{ - [Obsolete("This is no longer used and will be removed from the codebase in the future")] - public class loadTemplates : BaseTree - { - public loadTemplates(string application) : base(application) {} - - private ViewHelper _viewHelper = new ViewHelper(new PhysicalFileSystem(SystemDirectories.MvcViews)); - - protected override void CreateRootNode(ref XmlTreeNode rootNode) - { - rootNode.NodeType = "init" + TreeAlias; - rootNode.NodeID = "init"; - } - - - public override void RenderJS(ref StringBuilder Javascript) - { - - Javascript.Append( - @" - function openTemplate(id) { - UmbClientMgr.contentFrame('settings/editTemplate.aspx?templateID=' + id); - } - - function openView(id) { - UmbClientMgr.contentFrame('settings/views/editView.aspx?treeType=templates&templateID=' + id); - } - - function openSkin(id) { - UmbClientMgr.contentFrame('settings/editSkin.aspx?skinID=' + id); - } - "); - } - - - public override void Render(ref XmlTree tree) - { - string folder = umbraco.library.Request("folder"); - string folderPath = umbraco.library.Request("folderPath"); - - if (!string.IsNullOrEmpty(folder)) - RenderTemplateFolderItems(folder, folderPath, ref tree); - else - { - if (UmbracoConfig.For.UmbracoSettings().Templates.EnableTemplateFolders) - RenderTemplateFolders(ref tree); - - RenderTemplates(ref tree); - } - } - - private void RenderTemplateFolderItems(string folder, string folderPath, ref XmlTree tree) - { - string relPath = SystemDirectories.Masterpages + "/" + folder; - if (string.IsNullOrEmpty(folderPath) == false) - relPath += folderPath; - - string fullPath = IOHelper.MapPath(relPath); - - foreach (string dir in System.IO.Directory.GetDirectories(fullPath)) - { - System.IO.DirectoryInfo directoryInfo = new DirectoryInfo(dir); - XmlTreeNode xNode = XmlTreeNode.Create(this); - xNode.Menu.Clear(); - xNode.Menu.Add(ActionRefresh.Instance); - xNode.NodeID = "-1"; - xNode.Text = directoryInfo.Name; - xNode.HasChildren = true; - xNode.Icon = "icon-folder"; - xNode.OpenIcon = "icon-folder"; - xNode.Source = GetTreeServiceUrl(directoryInfo.Name) + "&folder=" + folder + "&folderPath=" + folderPath + "/" + directoryInfo.Name; - tree.Add(xNode); - } - - foreach (string file in System.IO.Directory.GetFiles(fullPath)) - { - System.IO.FileInfo fileinfo = new FileInfo(file); - string ext = fileinfo.Extension.ToLower().Trim('.'); - - XmlTreeNode xNode = XmlTreeNode.Create(this); - xNode.Menu.Clear(); - xNode.Menu.Add(ActionRefresh.Instance); - xNode.NodeID = "-1"; - xNode.Text = Path.GetFileName(file); - xNode.HasChildren = false; - xNode.Action = "javascript:openScriptEditor('" + relPath + "/" + Path.GetFileName(file) + "');"; - - //tree.Add(xNode); - - - switch (ext) - { - case "master": - xNode.Icon = "icon-newspaper-alt"; - xNode.OpenIcon = "icon-newspaper-alt"; - tree.Add(xNode); - break; - case "css": - case "js": - xNode.Icon = "icon-brackets"; - xNode.OpenIcon = "icon-brackets"; - tree.Add(xNode); - break; - case "xml": - if (xNode.Text == "skin.xml") - { - xNode.Icon = "icon-code"; - xNode.OpenIcon = "icon-code"; - tree.Add(xNode); - } - break; - default: - break; - } - - - - //xNode.Source = GetTreeServiceUrl(s.Alias) + "&skin=" + skin + "&path=" + path; - } - - - } - - private void RenderTemplateFolders(ref XmlTree tree) - { - if (base.m_id == -1) - { - var dir = new DirectoryInfo(IOHelper.MapPath(SystemDirectories.Masterpages)); - if (dir.Exists) - { - foreach (var s in dir.GetDirectories()) - { - var _s = Path.GetFileNameWithoutExtension(s.FullName); - - XmlTreeNode xNode = XmlTreeNode.Create(this); - xNode.NodeID = _s; - xNode.Text = _s; - xNode.Icon = "icon-folder"; - xNode.OpenIcon = "icon-folder"; - xNode.Source = GetTreeServiceUrl(_s) + "&folder=" + _s; - xNode.HasChildren = true; - xNode.Menu.Clear(); - xNode.Menu.Add(ActionRefresh.Instance); - - OnBeforeNodeRender(ref tree, ref xNode, EventArgs.Empty); - if (xNode != null) - { - tree.Add(xNode); - OnAfterNodeRender(ref tree, ref xNode, EventArgs.Empty); - } - } - - } - } - } - - private void RenderTemplates(ref XmlTree tree) - { - List