diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 6bb9dbcb9d..5bf656e8a4 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -389,7 +389,6 @@ ContentTypeControlNew.ascx - ASPXCodeBehind ContentTypeControlNew.ascx diff --git a/src/Umbraco.Web.UI/umbraco/dashboard/ExamineManagement.ascx.cs b/src/Umbraco.Web.UI/umbraco/dashboard/ExamineManagement.ascx.cs index bb5dc13c99..77a04423c0 100644 --- a/src/Umbraco.Web.UI/umbraco/dashboard/ExamineManagement.ascx.cs +++ b/src/Umbraco.Web.UI/umbraco/dashboard/ExamineManagement.ascx.cs @@ -7,7 +7,7 @@ using System.Web.UI.WebControls; namespace Umbraco.Web.UI.Umbraco.Dashboard { - public partial class ExamineManagement : Controls.UmbracoUserControl + public partial class ExamineManagement : UI.Controls.UmbracoUserControl { } diff --git a/src/Umbraco.Web/UI/Controls/UmbracoUserControl.cs b/src/Umbraco.Web/UI/Controls/UmbracoUserControl.cs index 35e6cba498..b97a09a080 100644 --- a/src/Umbraco.Web/UI/Controls/UmbracoUserControl.cs +++ b/src/Umbraco.Web/UI/Controls/UmbracoUserControl.cs @@ -5,6 +5,7 @@ using System.Web.Routing; using System.Web.UI; using Umbraco.Core; using Umbraco.Core.Services; +using Umbraco.Web.Security; using umbraco.DataLayer; namespace Umbraco.Web.UI.Controls @@ -44,6 +45,14 @@ namespace Umbraco.Web.UI.Controls /// public UmbracoHelper Umbraco { get; private set; } + /// + /// Returns the current WebSecurity instance + /// + public WebSecurity Security + { + get { return UmbracoContext.Security; } + } + /// /// Returns the current UmbracoContext /// diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index e3adc8ff6d..a9f2aa9765 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -350,6 +350,9 @@ + + ASPXCodeBehind + ASPXCodeBehind diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentTypeControlNew.ascx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentTypeControlNew.ascx.cs index 7d8ad896b2..a9d502cdce 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentTypeControlNew.ascx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentTypeControlNew.ascx.cs @@ -16,6 +16,7 @@ using ClientDependency.Core; using Umbraco.Core; using Umbraco.Core.Logging; using Umbraco.Core.Models; +using Umbraco.Web.UI.Controls; using umbraco.BusinessLogic; using umbraco.cms.businesslogic; using umbraco.cms.businesslogic.propertytype; @@ -38,7 +39,7 @@ namespace umbraco.controls [ClientDependency(ClientDependencyType.Css, "Tree/Themes/umbraco/style.css", "UmbracoClient")] [ClientDependency(ClientDependencyType.Css, "GenericProperty/genericproperty.css", "UmbracoClient")] [ClientDependency(ClientDependencyType.Javascript, "GenericProperty/genericproperty.js", "UmbracoClient")] - public partial class ContentTypeControlNew : UserControl + public partial class ContentTypeControlNew : UmbracoUserControl { // General Private members private ContentType _contentType; @@ -110,34 +111,20 @@ namespace umbraco.controls checkTxtAliasJs.Text = string.Format("checkAlias('{0}');", txtAlias.ClientID); } - //SD: this is temporary in v4, in v6 we have a proper user control hierarchy - //containing this property. - //this is required due to this issue: http://issues.umbraco.org/issue/u4-493 - //because we need to execute some code in async but due to the localization - //framework requiring an httpcontext.current, it will not work. - //http://issues.umbraco.org/issue/u4-2143 - //so, we are going to make a property here and ensure that the basepage has - //resolved the user before we execute the async task so that in this method - //our calls to ui.text will include the current user and not rely on the - //httpcontext.current. This also improves performance: - // http://issues.umbraco.org/issue/U4-2142 - private User CurrentUser - { - get { return ((BasePage)Page).getUser(); } - } - /// /// A class to track the async state for saving the doc type /// private class SaveAsyncState { public SaveAsyncState( + Umbraco.Web.UmbracoContext umbracoContext, SaveClickEventArgs saveArgs, string originalAlias, string originalName, string newAlias, string newName) { + UmbracoContext = umbracoContext; SaveArgs = saveArgs; OriginalAlias = originalAlias; OriginalName = originalName; @@ -145,6 +132,7 @@ namespace umbraco.controls NewName = newName; } + public Umbraco.Web.UmbracoContext UmbracoContext { get; private set; } public SaveClickEventArgs SaveArgs { get; private set; } public string OriginalAlias { get; private set; } public string OriginalName { get; private set; } @@ -198,7 +186,7 @@ namespace umbraco.controls //get the args from the async state var state = (SaveAsyncState)ar.AsyncState; - + // reload content type (due to caching) LoadContentType(); BindTabs(); @@ -236,7 +224,9 @@ namespace umbraco.controls protected void save_click(object sender, ImageClickEventArgs e) { - var state = new SaveAsyncState(new SaveClickEventArgs("Saved") + var state = new SaveAsyncState( + UmbracoContext, + new SaveClickEventArgs("Saved") { IconType = BasePage.speechBubbleIcon.success }, _contentType.Alias, _contentType.Text, txtAlias.Text, txtName.Text); @@ -249,6 +239,9 @@ namespace umbraco.controls { Trace.Write("ContentTypeControlNew", "executing task"); + //we need to re-set the UmbracoContext since it will be nulled and our cache handlers need it + global::Umbraco.Web.UmbracoContext.Current = asyncState.UmbracoContext; + //NOTE The saving of the 5 properties (Name, Alias, Icon, Description and Thumbnail) are divided //to avoid the multiple cache flushing when each property is set using the legacy ContentType class, //which has been reduced to the else-clause. @@ -377,10 +370,10 @@ namespace umbraco.controls Save.Click += save_click; Save.ImageUrl = UmbracoPath + "/images/editor/save.gif"; - Save.AlternateText = ui.Text("save", CurrentUser); + Save.AlternateText = ui.Text("save", Security.CurrentUser); Save.ID = "save"; - var dirInfo = new DirectoryInfo(UmbracoContext.Current.Server.MapPath(SystemDirectories.Umbraco + "/images/umbraco")); + var dirInfo = new DirectoryInfo(Server.MapPath(SystemDirectories.Umbraco + "/images/umbraco")); var fileInfo = dirInfo.GetFiles(); var spriteFileNames = CMSNode.DefaultIconClasses.Select(IconClassToIconFileName).ToList(); @@ -890,7 +883,7 @@ jQuery(document).ready(function() {{ refreshDropDowns(); }}); } else { - e.Message = ui.Text("contentTypeDublicatePropertyType", CurrentUser); + e.Message = ui.Text("contentTypeDublicatePropertyType", Security.CurrentUser); e.IconType = BasePage.speechBubbleIcon.warning; } } @@ -1572,12 +1565,12 @@ Umbraco.Controls.TabView.onActiveTabChange(function(tabviewid, tabid, tabs) { protected global::System.Web.UI.WebControls.PlaceHolder PropertyTypes; /// - /// theClientId control. + /// checkTxtAliasJs control. /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// - protected global::System.Web.UI.WebControls.Literal theClientId; + protected global::System.Web.UI.WebControls.Literal checkTxtAliasJs; } } \ No newline at end of file diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/members/EditMemberType.aspx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/members/EditMemberType.aspx.cs index 4ca54dd162..fe3fb9b0f7 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/members/EditMemberType.aspx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/members/EditMemberType.aspx.cs @@ -24,7 +24,7 @@ namespace umbraco.cms.presentation.members private cms.businesslogic.member.MemberType dt; private System.Collections.ArrayList ExtraPropertyTypeInfos = new System.Collections.ArrayList(); - protected controls.ContentTypeControlNew ContentTypeControlNew1; + protected global::umbraco.controls.ContentTypeControlNew ContentTypeControlNew1; protected void Page_Load(object sender, System.EventArgs e) {