diff --git a/umbraco/cms/businesslogic/ContentType.cs b/umbraco/cms/businesslogic/ContentType.cs index f8ab92d71b..33287cd49d 100644 --- a/umbraco/cms/businesslogic/ContentType.cs +++ b/umbraco/cms/businesslogic/ContentType.cs @@ -10,6 +10,7 @@ using umbraco.cms.businesslogic.cache; using umbraco.cms.businesslogic.datatype; using umbraco.cms.businesslogic.language; using umbraco.cms.businesslogic.propertytype; +using umbraco.cms.businesslogic.web; using umbraco.DataLayer; [assembly: InternalsVisibleTo("Umbraco.Test")] @@ -761,6 +762,15 @@ namespace umbraco.cms.businesslogic Cache.ClearCacheItem(GetPropertiesCacheKey()); ClearVirtualTabs(); + + // clear anything that uses this as master content type + if (this.nodeObjectType == DocumentType._objectType) + { + List cacheToFlush = DocumentType.GetAllAsList().FindAll(dt => dt.MasterContentType == Id); + foreach(DocumentType dt in cacheToFlush) + FlushFromCache(dt.Id); + + } } protected internal void FlushAllFromCache() diff --git a/umbraco/cms/businesslogic/propertytype/propertytype.cs b/umbraco/cms/businesslogic/propertytype/propertytype.cs index 3d59e56a69..6c9946922e 100644 --- a/umbraco/cms/businesslogic/propertytype/propertytype.cs +++ b/umbraco/cms/businesslogic/propertytype/propertytype.cs @@ -322,7 +322,8 @@ namespace umbraco.cms.businesslogic.propertytype FlushCache(); // clean all properties on inherited document types (if this propertytype is removed from a master) - DocumentType.GetAllAsList().FindAll(dt => dt.MasterContentType == _contenttypeid).ForEach(dt => cleanPropertiesOnDeletion(dt.Id)); + cleanPropertiesOnDeletion(_contenttypeid); +// DocumentType.GetAllAsList().FindAll(dt => dt.MasterContentType == _contenttypeid).ForEach(dt => cleanPropertiesOnDeletion(dt.Id)); // Delete all properties of propertytype cleanPropertiesOnDeletion(_contenttypeid); @@ -337,6 +338,10 @@ namespace umbraco.cms.businesslogic.propertytype private void cleanPropertiesOnDeletion(int contentTypeId) { + // first delete from all master document types + DocumentType.GetAllAsList().FindAll(dt => dt.MasterContentType == contentTypeId).ForEach(dt => cleanPropertiesOnDeletion(dt.Id)); + + // then remove from the current doc type var objs = Content.getContentOfContentType(new ContentType(contentTypeId)); foreach (Content c in objs.ToList()) { diff --git a/umbraco/presentation/umbraco/controls/ContentControl.cs b/umbraco/presentation/umbraco/controls/ContentControl.cs index 0fa00af7a5..a8219139b0 100644 --- a/umbraco/presentation/umbraco/controls/ContentControl.cs +++ b/umbraco/presentation/umbraco/controls/ContentControl.cs @@ -270,7 +270,7 @@ namespace umbraco.controls private void addControlNew(Property p, TabPage tp, string Caption) { IDataType dt = p.PropertyType.DataTypeDefinition.DataType; - dt.DataEditor.Editor.ID = p.PropertyType.Alias; + dt.DataEditor.Editor.ID = string.Format("prop_{0}", p.PropertyType.Alias); dt.Data.PropertyId = p.Id; // check for buttons diff --git a/umbraco/presentation/umbraco/controls/ContentTypeControlNew.ascx.cs b/umbraco/presentation/umbraco/controls/ContentTypeControlNew.ascx.cs index b8d9e9f368..28f2630b42 100644 --- a/umbraco/presentation/umbraco/controls/ContentTypeControlNew.ascx.cs +++ b/umbraco/presentation/umbraco/controls/ContentTypeControlNew.ascx.cs @@ -322,11 +322,14 @@ jQuery(function() { refreshDropDowns(); }); propSort.ID = "propSort_" + t.Id.ToString() + "_Content"; PropertyTypes.Controls.Add(propSort); _sortLists.Add(propSort); - PropertyTypes.Controls.Add(new LiteralControl("")); - var jsSortable = @" (function($) { var propSortId = ""#" + propSort.ClientID + @"""; @@ -374,10 +375,12 @@ jQuery(function() { refreshDropDowns(); }); addNoPropertiesDefinedMessage(); } + PropertyTypes.Controls.Add(new LiteralControl("")); } else { addNoPropertiesDefinedMessage(); + PropertyTypes.Controls.Add(new LiteralControl("")); } } @@ -446,7 +449,7 @@ jQuery(function() { refreshDropDowns(); }); if (!propertyTabHasProperties) { - PropertyTypes.Controls.Add(new LiteralControl("
No properties defined on this tab. Click on the \"add a new property\" link at the top to create a new property.
")); + PropertyTypes.Controls.Add(new LiteralControl("
No properties defined on this tab. Click on the \"add a new property\" link at the top to create a new property.
")); PropertyTypes.Controls.Remove(PropertyTypes.FindControl("propertiesPH")); } else @@ -456,7 +459,7 @@ jQuery(function() { refreshDropDowns(); }); private void addNoPropertiesDefinedMessage() { - PropertyTypes.Controls.Add(new LiteralControl("
No properties defined on this tab. Click on the \"add a new property\" link at the top to create a new property.
")); + PropertyTypes.Controls.Add(new LiteralControl("
No properties defined on this tab. Click on the \"add a new property\" link at the top to create a new property.
")); } protected void gpw_Delete(object sender, System.EventArgs e)