From 89ae3bc143f816ceb9208e585b696e9d64695f0c Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Wed, 27 Feb 2013 13:51:58 -0100 Subject: [PATCH 1/8] Add RevertToCleanInstall.bat to 4.11.5 too, it's handy. --- build/RevertToCleanInstall.bat | 128 +++++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 build/RevertToCleanInstall.bat diff --git a/build/RevertToCleanInstall.bat b/build/RevertToCleanInstall.bat new file mode 100644 index 0000000000..6c391386cd --- /dev/null +++ b/build/RevertToCleanInstall.bat @@ -0,0 +1,128 @@ +@ECHO OFF + +:choice +set /P c=WARNING! Are you sure you want to continue, this will remove all package files, view files, sqlce database, etc... Press 'Y' to auto-remove all files/folders, 'N' to cancel or 'C' to prompt for each folder removal? +if /I "%c%" EQU "C" goto :prompt +if /I "%c%" EQU "Y" goto :auto +if /I "%c%" EQU "N" goto :exit +goto :choice + + +:prompt + +echo Current folder: %CD% + +echo Removing sqlce database +del ..\src\Umbraco.Web.UI\App_Data\Umbraco.sdf + +echo Resetting installedPackages.config +echo ^^^ >..\src\Umbraco.Web.UI\App_Data\packages\installed\installedPackages.config + +echo Removing plugin cache files +del ..\src\Umbraco.Web.UI\App_Data\TEMP\PluginCache\*.* + +echo Removing cache files and examine index +del ..\src\Umbraco.Web.UI\App_Data\TEMP\*.* + +echo Removing log files +del ..\src\Umbraco.Web.UI\App_Data\Logs\*.* + +echo Removing packages +del ..\src\Umbraco.Web.UI\App_Data\packages\*.* + +echo Removing previews +del ..\src\Umbraco.Web.UI\App_Data\preview\*.* + +echo Removing app code files (typically added by starterkits) +del ..\src\Umbraco.Web.UI\App_Code\*.* + +echo Removing xslt files +del ..\src\Umbraco.Web.UI\xslt\*.* + +echo Removing user control files +del ..\src\Umbraco.Web.UI\UserControls\*.* + +echo Removing masterpage files +del ..\src\Umbraco.Web.UI\masterpages\*.* + +echo Removing view files +del ..\src\Umbraco.Web.UI\Views\*.* + +echo Removing razor files +del ..\src\Umbraco.Web.UI\macroScripts\*.* + +echo Removing media files +del ..\src\Umbraco.Web.UI\media\*.* + +echo Removing script files +del ..\src\Umbraco.Web.UI\scripts\*.* + +echo Removing css files +del ..\src\Umbraco.Web.UI\css\*.* + +echo "Umbraco install reverted to clean install" +pause +exit + + + +:auto + +echo Current folder: %CD% + +echo Removing sqlce database +del ..\src\Umbraco.Web.UI\App_Data\Umbraco.sdf + +echo Resetting installedPackages.config +echo ^^^ >..\src\Umbraco.Web.UI\App_Data\packages\installed\installedPackages.config + +echo Removing plugin cache files +FOR %%A IN (..\src\Umbraco.Web.UI\App_Data\TEMP\PluginCache\*.*) DO DEL %%A + +echo Removing cache files and examine index +FOR %%A IN (..\src\Umbraco.Web.UI\App_Data\TEMP\*.*) DO DEL %%A + +echo Removing log files +FOR %%A IN (..\src\Umbraco.Web.UI\App_Data\Logs\*.*) DO DEL %%A + +echo Removing packages +FOR %%A IN (..\src\Umbraco.Web.UI\App_Data\packages\*.*) DO DEL %%A + +echo Removing previews +FOR %%A IN (..\src\Umbraco.Web.UI\App_Data\preview\*.*) DO DEL %%A + +echo Removing app code files (typically added by starterkits) +FOR %%A IN (..\src\Umbraco.Web.UI\App_Code\*.*) DO DEL %%A + +echo Removing xslt files +FOR %%A IN (..\src\Umbraco.Web.UI\xslt\*.*) DO DEL %%A + +echo Removing masterpage files +FOR %%A IN (..\src\Umbraco.Web.UI\masterpages\*.*) DO DEL %%A + +echo Removing user control files +FOR %%A IN (..\src\Umbraco.Web.UI\usercontrols\*.*) DO DEL %%A + +echo Removing view files +FOR %%A IN (..\src\Umbraco.Web.UI\Views\*.*) DO DEL %%A + +echo Removing razor files +FOR %%A IN (..\src\Umbraco.Web.UI\macroScripts\*.*) DO DEL %%A + +echo Removing media files +FOR %%A IN (..\src\Umbraco.Web.UI\media\*.*) DO DEL %%A + +echo Removing script files +FOR %%A IN (..\src\Umbraco.Web.UI\scripts\*.*) DO DEL %%A + +echo Removing css files +FOR %%A IN (..\src\Umbraco.Web.UI\css\*.*) DO DEL %%A + +echo "Umbraco install reverted to clean install" +pause +exit + + + +:exit +exit \ No newline at end of file From 5b00501d212e29eebdaa3050da345ac2f1ee9b5b Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Wed, 27 Feb 2013 14:38:15 -0100 Subject: [PATCH 2/8] trySkipIisCustomErrors was defined twice in the Release config --- .../config/umbracoSettings.Release.config | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/src/Umbraco.Web.UI/config/umbracoSettings.Release.config b/src/Umbraco.Web.UI/config/umbracoSettings.Release.config index 9f24056dd3..d3eb0e2477 100644 --- a/src/Umbraco.Web.UI/config/umbracoSettings.Release.config +++ b/src/Umbraco.Web.UI/config/umbracoSettings.Release.config @@ -254,17 +254,4 @@ trySkipIisCustomErrors="false"> - - - - From 250e627b1db37c80f751bf2c2ac60744733682a8 Mon Sep 17 00:00:00 2001 From: Morten Christensen Date: Wed, 27 Feb 2013 14:39:11 -0100 Subject: [PATCH 3/8] Fixes saving of RegEx in DocTypes. Fixes loading and saving of properties on inherited tabs. Adjusts logic around the creation of tabs/property groups --- src/Umbraco.Core/Models/ContentTypeBase.cs | 8 +++ .../Models/ContentTypeCompositionBase.cs | 29 ++++++++ src/Umbraco.Core/Models/IContentTypeBase.cs | 8 +++ .../Factories/PropertyGroupFactory.cs | 4 +- .../Repositories/ContentTypeBaseRepository.cs | 11 +-- .../umbraco/controls/ContentControl.cs | 1 + .../controls/ContentTypeControlNew.ascx.cs | 67 ++++++++++++++----- .../businesslogic/datatype/DefaultData.cs | 1 + 8 files changed, 104 insertions(+), 25 deletions(-) diff --git a/src/Umbraco.Core/Models/ContentTypeBase.cs b/src/Umbraco.Core/Models/ContentTypeBase.cs index fe2d1a3810..d255cc91a8 100644 --- a/src/Umbraco.Core/Models/ContentTypeBase.cs +++ b/src/Umbraco.Core/Models/ContentTypeBase.cs @@ -329,6 +329,14 @@ namespace Umbraco.Core.Models /// Returns True if a PropertyType with the passed in alias exists, otherwise False public abstract bool PropertyTypeExists(string propertyTypeAlias); + /// + /// Adds a PropertyGroup. + /// This method will also check if a group already exists with the same name and link it to the parent. + /// + /// Name of the PropertyGroup to add + /// Returns True if a PropertyGroup with the passed in name was added, otherwise False + public abstract bool AddPropertyGroup(string groupName); + /// /// Adds a PropertyType to a specific PropertyGroup /// diff --git a/src/Umbraco.Core/Models/ContentTypeCompositionBase.cs b/src/Umbraco.Core/Models/ContentTypeCompositionBase.cs index 88d11e9851..d7b91c038b 100644 --- a/src/Umbraco.Core/Models/ContentTypeCompositionBase.cs +++ b/src/Umbraco.Core/Models/ContentTypeCompositionBase.cs @@ -125,6 +125,35 @@ namespace Umbraco.Core.Models return CompositionPropertyTypes.Any(x => x.Alias == propertyTypeAlias); } + /// + /// Adds a PropertyGroup. + /// This method will also check if a group already exists with the same name and link it to the parent. + /// + /// Name of the PropertyGroup to add + /// Returns True if a PropertyGroup with the passed in name was added, otherwise False + public override bool AddPropertyGroup(string groupName) + { + if (PropertyGroups.Any(x => x.Name == groupName)) + return false; + + var propertyGroup = new PropertyGroup {Name = groupName, SortOrder = 0}; + + if (CompositionPropertyGroups.Any(x => x.Name == groupName)) + { + var first = CompositionPropertyGroups.First(x => x.Name == groupName && x.ParentId.HasValue == false); + propertyGroup.ParentId = first.Id; + } + + if (PropertyGroups.Any()) + { + var last = PropertyGroups.Last(); + propertyGroup.SortOrder = last.SortOrder + 1; + } + + PropertyGroups.Add(propertyGroup); + return true; + } + /// /// Adds a PropertyType to a specific PropertyGroup /// diff --git a/src/Umbraco.Core/Models/IContentTypeBase.cs b/src/Umbraco.Core/Models/IContentTypeBase.cs index 41c2938a0a..11a3b8aee6 100644 --- a/src/Umbraco.Core/Models/IContentTypeBase.cs +++ b/src/Umbraco.Core/Models/IContentTypeBase.cs @@ -91,5 +91,13 @@ namespace Umbraco.Core.Models /// to add /// Returns True if PropertyType was added, otherwise False bool AddPropertyType(PropertyType propertyType); + + /// + /// Adds a PropertyGroup. + /// This method will also check if a group already exists with the same name and link it to the parent. + /// + /// Name of the PropertyGroup to add + /// Returns True if a PropertyGroup with the passed in name was added, otherwise False + bool AddPropertyGroup(string groupName); } } \ No newline at end of file diff --git a/src/Umbraco.Core/Persistence/Factories/PropertyGroupFactory.cs b/src/Umbraco.Core/Persistence/Factories/PropertyGroupFactory.cs index 4721090614..9449f2c375 100644 --- a/src/Umbraco.Core/Persistence/Factories/PropertyGroupFactory.cs +++ b/src/Umbraco.Core/Persistence/Factories/PropertyGroupFactory.cs @@ -55,6 +55,7 @@ namespace Umbraco.Core.Persistence.Factories HelpText = typeDto.HelpText, Mandatory = typeDto.Mandatory, SortOrder = typeDto.SortOrder, + ValidationRegExp = typeDto.ValidationRegExp, PropertyGroupId = groupDto.Id }; @@ -106,7 +107,8 @@ namespace Umbraco.Core.Persistence.Factories HelpText = propertyType.HelpText, Mandatory = propertyType.Mandatory, Name = propertyType.Name, - SortOrder = propertyType.SortOrder + SortOrder = propertyType.SortOrder, + ValidationRegExp = propertyType.ValidationRegExp }; if (tabId != default(int)) diff --git a/src/Umbraco.Core/Persistence/Repositories/ContentTypeBaseRepository.cs b/src/Umbraco.Core/Persistence/Repositories/ContentTypeBaseRepository.cs index 5ae358c81f..69cfd0ce25 100644 --- a/src/Umbraco.Core/Persistence/Repositories/ContentTypeBaseRepository.cs +++ b/src/Umbraco.Core/Persistence/Repositories/ContentTypeBaseRepository.cs @@ -259,14 +259,6 @@ namespace Umbraco.Core.Persistence.Repositories : Convert.ToInt32(Database.Insert(tabDto)); if (propertyGroup.HasIdentity == false) propertyGroup.Id = groupPrimaryKey; //Set Id on new PropertyGroup - - //Ensure that the PropertyGroup's Id is set on the PropertyTypes within a group - //unless the PropertyGroupId has already been changed. - foreach (var propertyType in propertyGroup.PropertyTypes) - { - if ((propertyType.IsPropertyDirty("PropertyGroupId") && propertyType.PropertyGroupId == 0) == false) - propertyType.PropertyGroupId = propertyGroup.Id; - } } //Run through all PropertyTypes to insert or update entries @@ -337,7 +329,8 @@ namespace Umbraco.Core.Persistence.Repositories Name = dto.Name, HelpText = dto.HelpText, Mandatory = dto.Mandatory, - SortOrder = dto.SortOrder + SortOrder = dto.SortOrder, + ValidationRegExp = dto.ValidationRegExp }).ToList(); //Reset dirty properties diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentControl.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentControl.cs index 5fb1e1211b..e9ceb046bc 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentControl.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentControl.cs @@ -314,6 +314,7 @@ namespace umbraco.controls if (defaultData != null) { defaultData.PropertyTypeAlias = property.Key; + defaultData.NodeId = _content.Id; } property.Value.DataEditor.Save(); } 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 b8e33be1fc..f4d8d2e6fd 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentTypeControlNew.ascx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentTypeControlNew.ascx.cs @@ -10,6 +10,7 @@ using System.Web.UI.WebControls; using ClientDependency.Core; using Umbraco.Core; using Umbraco.Core.Models; +using umbraco.cms.businesslogic.propertytype; using umbraco.cms.businesslogic.web; using umbraco.cms.helpers; using umbraco.controls.GenericProperties; @@ -17,6 +18,7 @@ using umbraco.IO; using umbraco.presentation; using umbraco.BasePages; using ContentType = umbraco.cms.businesslogic.ContentType; +using PropertyType = Umbraco.Core.Models.PropertyType; namespace umbraco.controls { @@ -394,6 +396,15 @@ jQuery(document).ready(function() {{ refreshDropDowns(); }}); { var tabs = _contentType.getVirtualTabs; var propertyTypeGroups = _contentType.PropertyTypeGroups.ToList(); + /*if (_contentType.ContentTypeItem != null) + { + var compositionIds = _contentType.ContentTypeItem.CompositionIds(); + foreach (var compositionId in compositionIds) + { + var groupsFromContentType = PropertyTypeGroup.GetPropertyTypeGroupsFromContentType(compositionId); + propertyTypeGroups.AddRange(groupsFromContentType); + } + }*/ var dtds = cms.businesslogic.datatype.DataTypeDefinition.GetAll(); PropertyTypes.Controls.Clear(); @@ -405,7 +416,7 @@ jQuery(document).ready(function() {{ refreshDropDowns(); }}); gp = new GenericPropertyWrapper(); gp.ID = "GenericPropertyNew"; gp.Tabs = tabs; - gp.PropertyGroups = propertyTypeGroups; + //gp.PropertyGroups = propertyTypeGroups; gp.DataTypeDefinitions = dtds; PropertyTypeNew.Controls.Add(gp); PropertyTypeNew.Controls.Add(new LiteralControl("")); @@ -415,7 +426,7 @@ jQuery(document).ready(function() {{ refreshDropDowns(); }}); gp = (GenericPropertyWrapper)PropertyTypeNew.Controls[1]; gp.ID = "GenericPropertyNew"; gp.Tabs = tabs; - gp.PropertyGroups = propertyTypeGroups; + //gp.PropertyGroups = propertyTypeGroups; gp.DataTypeDefinitions = dtds; gp.UpdateEditControl(); gp.GenricPropertyControl.UpdateInterface(); @@ -432,7 +443,7 @@ jQuery(document).ready(function() {{ refreshDropDowns(); }}); string tabCaption = tab.ContentType == _contentType.Id ? tab.GetRawCaption() : tab.GetRawCaption() + " (inherited from " + new ContentType(tab.ContentType).Text + ")"; PropertyTypes.Controls.Add(new LiteralControl("

Tab: " + tabCaption + "

")); - var propertyGroup = propertyTypeGroups.SingleOrDefault(x => x.Id == tab.Id || x.ParentId == tab.Id); + var propertyGroup = propertyTypeGroups.SingleOrDefault(x => x.ParentId == tab.Id); var propertyTypes = propertyGroup == null ? tab.GetPropertyTypes(_contentType.Id, false) : propertyGroup.GetPropertyTypes(); @@ -441,7 +452,7 @@ jQuery(document).ready(function() {{ refreshDropDowns(); }}); if (propertyGroup != null && propertyGroup.ParentId > 0) propertyGroupId = propertyGroup.Id; - if (propertyTypes.Any()) + if (propertyTypes.Any(x => x.ContentTypeId == _contentType.Id)) { var propSort = new HtmlInputHidden(); propSort.ID = "propSort_" + propertyGroupId.ToString() + "_Content"; @@ -453,13 +464,13 @@ jQuery(document).ready(function() {{ refreshDropDowns(); }}); foreach (cms.businesslogic.propertytype.PropertyType pt in propertyTypes) { //If the PropertyType doesn't belong on this ContentType skip it and continue to the next one - if(pt.ContentTypeId != _contentType.Id) continue; + //if(pt.ContentTypeId != _contentType.Id) continue; var gpw = new GenericPropertyWrapper(); gpw.ID = "gpw_" + pt.Id; gpw.PropertyType = pt; gpw.Tabs = tabs; - gp.PropertyGroups = propertyTypeGroups; + //gpw.PropertyGroups = propertyTypeGroups; gpw.TabId = propertyGroupId; gpw.DataTypeDefinitions = dtds; gpw.Delete += new EventHandler(gpw_Delete); @@ -535,7 +546,7 @@ jQuery(document).ready(function() {{ refreshDropDowns(); }}); gpw.PropertyType = pt; gpw.Tabs = tabs; - gpw.PropertyGroups = propertyTypeGroups; + //gpw.PropertyGroups = propertyTypeGroups; gpw.DataTypeDefinitions = dtds; gpw.Delete += new EventHandler(gpw_Delete); gpw.FullId = "t_general_Contents_" + pt.Id; @@ -650,11 +661,43 @@ jQuery(document).ready(function() {{ refreshDropDowns(); }}); propertyType.Description = gpw.GenricPropertyControl.Description; propertyType.ValidationRegExp = gpw.GenricPropertyControl.Validation; propertyType.Mandatory = gpw.GenricPropertyControl.Mandatory; - propertyType.PropertyGroupId = gpw.GenricPropertyControl.Tab; propertyType.DataTypeDatabaseType = dataTypeDefinition.DatabaseType; propertyType.DataTypeDefinitionId = dataTypeDefinition.Id; propertyType.DataTypeId = dataTypeDefinition.ControlId; + if (propertyType.PropertyGroupId != gpw.GenricPropertyControl.Tab) + { + if (gpw.GenricPropertyControl.Tab == 0) + { + propertyType.PropertyGroupId = 0; + } + else if (contentTypeItem.PropertyGroups.Any(x => x.Id == gpw.GenricPropertyControl.Tab)) + { + propertyType.PropertyGroupId = gpw.GenricPropertyControl.Tab; + } + else if (contentTypeItem.PropertyGroups.Any(x => x.ParentId == gpw.GenricPropertyControl.Tab)) + { + var propertyGroup = contentTypeItem.PropertyGroups.First(x => x.ParentId == gpw.GenricPropertyControl.Tab); + propertyType.PropertyGroupId = propertyGroup.Id; + } + else + { + if ( + contentTypeItem.CompositionPropertyGroups.Any( + x => x.ParentId == gpw.GenricPropertyControl.Tab)) + { + var propertyGroups = contentTypeItem.CompositionPropertyGroups.Where(x => x.ParentId == gpw.GenricPropertyControl.Tab); + var propertyGroup = propertyGroups.First(); + propertyType.PropertyGroupId = propertyGroup.Id; + } + else + { + var propertyGroup = contentTypeItem.CompositionPropertyGroups.First(x => x.Id == gpw.GenricPropertyControl.Tab); + contentTypeItem.AddPropertyGroup(propertyGroup.Name); + } + } + } + //Is only called to flush cache since gpw.PropertyType.Save() isn't called // clear local cache cms.businesslogic.cache.Cache.ClearCacheItem("UmbracoPropertyTypeCache" + gpw.PropertyType.Id); @@ -961,13 +1004,7 @@ jQuery(document).ready(function() {{ refreshDropDowns(); }}); { if (_contentType.ContentTypeItem is IContentType || _contentType.ContentTypeItem is IMediaType) { - var propertyGroup = new PropertyGroup { Name = txtNewTab.Text }; - if (_contentType.ContentTypeItem.PropertyGroups.Any()) - { - var last = _contentType.ContentTypeItem.PropertyGroups.OrderBy(x => x.SortOrder).Last(); - propertyGroup.SortOrder = last.SortOrder + 1; - } - _contentType.ContentTypeItem.PropertyGroups.Add(propertyGroup); + _contentType.ContentTypeItem.AddPropertyGroup(txtNewTab.Text); _contentType.Save(); } else diff --git a/src/umbraco.cms/businesslogic/datatype/DefaultData.cs b/src/umbraco.cms/businesslogic/datatype/DefaultData.cs index 03851a9341..d72212aa5f 100644 --- a/src/umbraco.cms/businesslogic/datatype/DefaultData.cs +++ b/src/umbraco.cms/businesslogic/datatype/DefaultData.cs @@ -210,6 +210,7 @@ namespace umbraco.cms.businesslogic.datatype } return _nodeId.Value; } + internal set { _nodeId = value; } } #endregion From 30cef671dc5567fa22998ad0716f004a66a1b14c Mon Sep 17 00:00:00 2001 From: Morten Christensen Date: Wed, 27 Feb 2013 14:42:17 -0100 Subject: [PATCH 4/8] Removing unused code --- .../controls/ContentTypeControlNew.ascx.cs | 15 +------------- .../GenericProperties/GenericProperty.ascx.cs | 20 +------------------ .../GenericPropertyWrapper.cs | 7 ------- 3 files changed, 2 insertions(+), 40 deletions(-) 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 f4d8d2e6fd..bf482ea2f5 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentTypeControlNew.ascx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentTypeControlNew.ascx.cs @@ -396,15 +396,6 @@ jQuery(document).ready(function() {{ refreshDropDowns(); }}); { var tabs = _contentType.getVirtualTabs; var propertyTypeGroups = _contentType.PropertyTypeGroups.ToList(); - /*if (_contentType.ContentTypeItem != null) - { - var compositionIds = _contentType.ContentTypeItem.CompositionIds(); - foreach (var compositionId in compositionIds) - { - var groupsFromContentType = PropertyTypeGroup.GetPropertyTypeGroupsFromContentType(compositionId); - propertyTypeGroups.AddRange(groupsFromContentType); - } - }*/ var dtds = cms.businesslogic.datatype.DataTypeDefinition.GetAll(); PropertyTypes.Controls.Clear(); @@ -416,7 +407,6 @@ jQuery(document).ready(function() {{ refreshDropDowns(); }}); gp = new GenericPropertyWrapper(); gp.ID = "GenericPropertyNew"; gp.Tabs = tabs; - //gp.PropertyGroups = propertyTypeGroups; gp.DataTypeDefinitions = dtds; PropertyTypeNew.Controls.Add(gp); PropertyTypeNew.Controls.Add(new LiteralControl("")); @@ -426,7 +416,6 @@ jQuery(document).ready(function() {{ refreshDropDowns(); }}); gp = (GenericPropertyWrapper)PropertyTypeNew.Controls[1]; gp.ID = "GenericPropertyNew"; gp.Tabs = tabs; - //gp.PropertyGroups = propertyTypeGroups; gp.DataTypeDefinitions = dtds; gp.UpdateEditControl(); gp.GenricPropertyControl.UpdateInterface(); @@ -464,13 +453,12 @@ jQuery(document).ready(function() {{ refreshDropDowns(); }}); foreach (cms.businesslogic.propertytype.PropertyType pt in propertyTypes) { //If the PropertyType doesn't belong on this ContentType skip it and continue to the next one - //if(pt.ContentTypeId != _contentType.Id) continue; + if(pt.ContentTypeId != _contentType.Id) continue; var gpw = new GenericPropertyWrapper(); gpw.ID = "gpw_" + pt.Id; gpw.PropertyType = pt; gpw.Tabs = tabs; - //gpw.PropertyGroups = propertyTypeGroups; gpw.TabId = propertyGroupId; gpw.DataTypeDefinitions = dtds; gpw.Delete += new EventHandler(gpw_Delete); @@ -546,7 +534,6 @@ jQuery(document).ready(function() {{ refreshDropDowns(); }}); gpw.PropertyType = pt; gpw.Tabs = tabs; - //gpw.PropertyGroups = propertyTypeGroups; gpw.DataTypeDefinitions = dtds; gpw.Delete += new EventHandler(gpw_Delete); gpw.FullId = "t_general_Contents_" + pt.Id; diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/GenericProperties/GenericProperty.ascx.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/GenericProperties/GenericProperty.ascx.cs index d5063e950c..fc6a198939 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/GenericProperties/GenericProperty.ascx.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/GenericProperties/GenericProperty.ascx.cs @@ -105,7 +105,6 @@ namespace umbraco.controls.GenericProperties } private int _id; - private List _propertyGroups; public int Id { set { @@ -120,12 +119,6 @@ namespace umbraco.controls.GenericProperties get {return int.Parse(ddlTypes.SelectedValue);} } - public List PropertyGroups - { - get { return _propertyGroups; } - set { _propertyGroups = value; } - } - public void Clear() { tbName.Text = ""; @@ -192,18 +185,7 @@ namespace umbraco.controls.GenericProperties } // tabs - if (_propertyGroups != null) - { - ddlTab.Items.Clear(); - foreach (var propertyGroup in _propertyGroups.OrderBy(x => x.SortOrder)) - { - var li = new ListItem(propertyGroup.Name, propertyGroup.Id.ToString(CultureInfo.InvariantCulture)); - if (propertyGroup.Id == _tabId) - li.Selected = true; - ddlTab.Items.Add(li); - } - } - else if (_tabs != null) + if (_tabs != null) { ddlTab.Items.Clear(); for (int i=0;i<_tabs.Length;i++) diff --git a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/GenericProperties/GenericPropertyWrapper.cs b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/GenericProperties/GenericPropertyWrapper.cs index b78a4d7990..81a3bf2e50 100644 --- a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/GenericProperties/GenericPropertyWrapper.cs +++ b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/GenericProperties/GenericPropertyWrapper.cs @@ -17,7 +17,6 @@ namespace umbraco.controls.GenericProperties private cms.businesslogic.datatype.DataTypeDefinition[] _dtds; private int _tabId; private string _fullId = ""; - private List _propertyGroups; public event System.EventHandler Delete; @@ -62,11 +61,6 @@ namespace umbraco.controls.GenericProperties } } - public List PropertyGroups - { - set { _propertyGroups = value; } - } - public GenericPropertyWrapper() { // @@ -84,7 +78,6 @@ namespace umbraco.controls.GenericProperties _gp.PropertyType = _pt; _gp.DataTypeDefinitions = _dtds; _gp.Tabs = _tabs; - _gp.PropertyGroups = _propertyGroups; _gp.TabId = _tabId; _gp.FullId = _fullId; } From 5b4d8ed6f3d713348503ab10ee03cdc0ae77e786 Mon Sep 17 00:00:00 2001 From: Sebastiaan Janssen Date: Wed, 27 Feb 2013 14:57:42 -0100 Subject: [PATCH 5/8] U4-1793 YSOD when moving a node back to root --- src/Umbraco.Core/Services/ContentService.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/Umbraco.Core/Services/ContentService.cs b/src/Umbraco.Core/Services/ContentService.cs index b55f27f9a4..9e9fef26be 100644 --- a/src/Umbraco.Core/Services/ContentService.cs +++ b/src/Umbraco.Core/Services/ContentService.cs @@ -737,9 +737,18 @@ namespace Umbraco.Core.Services return; content.WriterId = userId; - var parent = GetById(parentId); - content.Path = string.Concat(parent.Path, ",", content.Id); - content.Level = parent.Level + 1; + if (parentId == -1) + { + content.Path = string.Concat("-1,", content.Id); + content.Level = 1; + } + else + { + var parent = GetById(parentId); + content.Path = string.Concat(parent.Path, ",", content.Id); + content.Level = parent.Level + 1; + } + //If Content is being moved away from Recycle Bin, its state should be un-trashed if (content.Trashed && parentId != -20) From 36c66e676a77177aa3b2d5372baf4e78f8a04648 Mon Sep 17 00:00:00 2001 From: Shannon Deminick Date: Wed, 27 Feb 2013 22:35:27 +0600 Subject: [PATCH 6/8] Fixed unit tests --- src/Umbraco.Core/Configuration/GlobalSettings.cs | 11 ++++++++++- src/Umbraco.Tests/GlobalSettingsTests.cs | 8 +++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Core/Configuration/GlobalSettings.cs b/src/Umbraco.Core/Configuration/GlobalSettings.cs index 22e69e0100..e5a0f0928c 100644 --- a/src/Umbraco.Core/Configuration/GlobalSettings.cs +++ b/src/Umbraco.Core/Configuration/GlobalSettings.cs @@ -38,6 +38,14 @@ namespace Umbraco.Core.Configuration #endregion + /// + /// used for unit tests + /// + internal static void ResetCache() + { + _reservedUrlsCache = null; + } + /// /// Gets the reserved urls from web.config. /// @@ -69,7 +77,8 @@ namespace Umbraco.Core.Configuration var staticReservedPaths = "~/app_plugins/,~/install/,"; //always add the umbraco path to the list - if (ConfigurationManager.AppSettings.ContainsKey("umbracoPath")) + if (ConfigurationManager.AppSettings.ContainsKey("umbracoPath") + && !ConfigurationManager.AppSettings["umbracoPath"].IsNullOrWhiteSpace()) { staticReservedPaths += ConfigurationManager.AppSettings["umbracoPath"].EnsureEndsWith(','); } diff --git a/src/Umbraco.Tests/GlobalSettingsTests.cs b/src/Umbraco.Tests/GlobalSettingsTests.cs index 5d57679b61..1298a5e719 100644 --- a/src/Umbraco.Tests/GlobalSettingsTests.cs +++ b/src/Umbraco.Tests/GlobalSettingsTests.cs @@ -23,10 +23,12 @@ namespace Umbraco.Tests public override void TearDown() { + //reset the app config + ConfigurationManager.AppSettings.Set("umbracoReservedPaths", ""); + ConfigurationManager.AppSettings.Set("umbracoReservedUrls", ""); + Umbraco.Core.Configuration.GlobalSettings.ResetCache(); base.TearDown(); - //reset the app config - ConfigurationManager.AppSettings.Set("umbracoReservedPaths", ""); - ConfigurationManager.AppSettings.Set("umbracoReservedUrls", ""); + } [TestCase("/umbraco/umbraco.aspx")] From ae0991bc6784496ac1c1a05913f0e0fd1caf4735 Mon Sep 17 00:00:00 2001 From: Shannon Deminick Date: Wed, 27 Feb 2013 23:02:12 +0600 Subject: [PATCH 7/8] Fixed unit tests now that we have default values stored in GlobalSettings. --- .../Configuration/GlobalSettings.cs | 55 ++++++++++++------- src/Umbraco.Tests/GlobalSettingsTests.cs | 10 +--- .../Routing/UmbracoModuleTests.cs | 4 +- .../TestHelpers/SettingsForTests.cs | 4 +- 4 files changed, 41 insertions(+), 32 deletions(-) diff --git a/src/Umbraco.Core/Configuration/GlobalSettings.cs b/src/Umbraco.Core/Configuration/GlobalSettings.cs index 44ae3882ed..44a9f1a0eb 100644 --- a/src/Umbraco.Core/Configuration/GlobalSettings.cs +++ b/src/Umbraco.Core/Configuration/GlobalSettings.cs @@ -33,6 +33,11 @@ namespace Umbraco.Core.Configuration private static volatile string _reservedUrlsCache; private static string _reservedPathsCache; private static StartsWithContainer _reservedList = new StartsWithContainer(); + private static string _reservedPaths; + private static string _reservedUrls; + //ensure the built on (non-changeable) reserved paths are there at all times + private const string StaticReservedPaths = "~/app_plugins/,~/install/,"; + private const string StaticReservedUrls = "~/config/splashes/booting.aspx,~/install/default.aspx,~/config/splashes/noNodes.aspx,~/VSEnterpriseHelper.axd,"; #endregion @@ -42,6 +47,8 @@ namespace Umbraco.Core.Configuration internal static void ResetCache() { _reservedUrlsCache = null; + _reservedPaths = null; + _reservedUrls = null; } /// @@ -51,16 +58,19 @@ namespace Umbraco.Core.Configuration public static string ReservedUrls { get - { - //ensure the built on (non-changeable) reserved paths are there at all times - const string staticReservedUrls = "~/config/splashes/booting.aspx,~/install/default.aspx,~/config/splashes/noNodes.aspx,~/VSEnterpriseHelper.axd,"; + { + if (_reservedUrls == null) + { + var urls = ConfigurationManager.AppSettings.ContainsKey("umbracoReservedUrls") + ? ConfigurationManager.AppSettings["umbracoReservedUrls"] + : string.Empty; - var urls = ConfigurationManager.AppSettings.ContainsKey("umbracoReservedUrls") - ? ConfigurationManager.AppSettings["umbracoReservedUrls"] - : string.Empty; - - return staticReservedUrls + urls; + //ensure the built on (non-changeable) reserved paths are there at all times + _reservedUrls = StaticReservedUrls + urls; + } + return _reservedUrls; } + internal set { _reservedUrls = value; } } /// @@ -71,22 +81,25 @@ namespace Umbraco.Core.Configuration { get { - //ensure the built on (non-changeable) reserved paths are there at all times - var staticReservedPaths = "~/app_plugins/,~/install/,"; - - //always add the umbraco path to the list - if (ConfigurationManager.AppSettings.ContainsKey("umbracoPath") - && !ConfigurationManager.AppSettings["umbracoPath"].IsNullOrWhiteSpace()) + if (_reservedPaths == null) { - staticReservedPaths += ConfigurationManager.AppSettings["umbracoPath"].EnsureEndsWith(','); + var reservedPaths = StaticReservedPaths; + //always add the umbraco path to the list + if (ConfigurationManager.AppSettings.ContainsKey("umbracoPath") + && !ConfigurationManager.AppSettings["umbracoPath"].IsNullOrWhiteSpace()) + { + reservedPaths += ConfigurationManager.AppSettings["umbracoPath"].EnsureEndsWith(','); + } + + var allPaths = ConfigurationManager.AppSettings.ContainsKey("umbracoReservedPaths") + ? ConfigurationManager.AppSettings["umbracoReservedPaths"] + : string.Empty; + + _reservedPaths = reservedPaths + allPaths; } - - var paths = ConfigurationManager.AppSettings.ContainsKey("umbracoReservedPaths") - ? ConfigurationManager.AppSettings["umbracoReservedPaths"] - : string.Empty; - - return staticReservedPaths + paths; + return _reservedPaths; } + internal set { _reservedPaths = value; } } /// diff --git a/src/Umbraco.Tests/GlobalSettingsTests.cs b/src/Umbraco.Tests/GlobalSettingsTests.cs index 7af45e10b1..ad48db0f74 100644 --- a/src/Umbraco.Tests/GlobalSettingsTests.cs +++ b/src/Umbraco.Tests/GlobalSettingsTests.cs @@ -18,15 +18,11 @@ namespace Umbraco.Tests public override void Initialize() { base.Initialize(); - ConfigurationManager.AppSettings.Set("umbracoReservedPaths", "~/umbraco,~/install/"); - ConfigurationManager.AppSettings.Set("umbracoReservedUrls", "~/config/splashes/booting.aspx,~/install/default.aspx,~/config/splashes/noNodes.aspx,~/VSEnterpriseHelper.axd"); } public override void TearDown() { - //reset the app config - ConfigurationManager.AppSettings.Set("umbracoReservedPaths", ""); - ConfigurationManager.AppSettings.Set("umbracoReservedUrls", ""); + //reset the app config Umbraco.Core.Configuration.GlobalSettings.ResetCache(); base.TearDown(); @@ -80,8 +76,8 @@ namespace Umbraco.Tests public void Is_Reserved_By_Route(string url, bool shouldMatch) { //reset the app config, we only want to test routes not the hard coded paths - ConfigurationManager.AppSettings.Set("umbracoReservedPaths", ""); - ConfigurationManager.AppSettings.Set("umbracoReservedUrls", ""); + Umbraco.Core.Configuration.GlobalSettings.ReservedPaths = ""; + Umbraco.Core.Configuration.GlobalSettings.ReservedUrls = ""; var routes = new RouteCollection(); diff --git a/src/Umbraco.Tests/Routing/UmbracoModuleTests.cs b/src/Umbraco.Tests/Routing/UmbracoModuleTests.cs index 5e7e47fc71..7a6550dd3e 100644 --- a/src/Umbraco.Tests/Routing/UmbracoModuleTests.cs +++ b/src/Umbraco.Tests/Routing/UmbracoModuleTests.cs @@ -32,8 +32,8 @@ namespace Umbraco.Tests.Routing _module = new UmbracoModule(); SettingsForTests.ConfigurationStatus = UmbracoVersion.Current.ToString(3); - SettingsForTests.ReservedPaths = "~/umbraco,~/install/"; - SettingsForTests.ReservedUrls = "~/config/splashes/booting.aspx,~/install/default.aspx,~/config/splashes/noNodes.aspx,~/VSEnterpriseHelper.axd"; + //SettingsForTests.ReservedPaths = "~/umbraco,~/install/"; + //SettingsForTests.ReservedUrls = "~/config/splashes/booting.aspx,~/install/default.aspx,~/config/splashes/noNodes.aspx,~/VSEnterpriseHelper.axd"; //create the not found handlers config using (var sw = File.CreateText(Umbraco.Core.IO.IOHelper.MapPath(Umbraco.Core.IO.SystemFiles.NotFoundhandlersConfig, false))) diff --git a/src/Umbraco.Tests/TestHelpers/SettingsForTests.cs b/src/Umbraco.Tests/TestHelpers/SettingsForTests.cs index cc7873afbf..d348582122 100644 --- a/src/Umbraco.Tests/TestHelpers/SettingsForTests.cs +++ b/src/Umbraco.Tests/TestHelpers/SettingsForTests.cs @@ -75,13 +75,13 @@ namespace Umbraco.Tests.TestHelpers public static string ReservedPaths { get { return GlobalSettings.ReservedPaths; } - set { ConfigurationManager.AppSettings.Set("umbracoReservedPaths", value); } + set { GlobalSettings.ReservedPaths = value; } } public static string ReservedUrls { get { return GlobalSettings.ReservedUrls; } - set { ConfigurationManager.AppSettings.Set("umbracoReservedUrls", value); } + set { GlobalSettings.ReservedUrls = value; } } public static string ConfigurationStatus From 8a9680e75c94102f7701fa7b5d8baa611650d227 Mon Sep 17 00:00:00 2001 From: Shannon Deminick Date: Wed, 27 Feb 2013 23:13:48 +0600 Subject: [PATCH 8/8] updated unit test logic --- .../Configuration/GlobalSettings.cs | 55 ++++++++++++------- src/Umbraco.Tests/GlobalSettingsTests.cs | 14 ++--- .../TestHelpers/SettingsForTests.cs | 6 +- 3 files changed, 42 insertions(+), 33 deletions(-) diff --git a/src/Umbraco.Core/Configuration/GlobalSettings.cs b/src/Umbraco.Core/Configuration/GlobalSettings.cs index e5a0f0928c..f207f1dec7 100644 --- a/src/Umbraco.Core/Configuration/GlobalSettings.cs +++ b/src/Umbraco.Core/Configuration/GlobalSettings.cs @@ -35,6 +35,11 @@ namespace Umbraco.Core.Configuration private static volatile string _reservedUrlsCache; private static string _reservedPathsCache; private static StartsWithContainer _reservedList = new StartsWithContainer(); + private static string _reservedPaths; + private static string _reservedUrls; + //ensure the built on (non-changeable) reserved paths are there at all times + private const string StaticReservedPaths = "~/app_plugins/,~/install/,"; + private const string StaticReservedUrls = "~/config/splashes/booting.aspx,~/install/default.aspx,~/config/splashes/noNodes.aspx,~/VSEnterpriseHelper.axd,"; #endregion @@ -44,6 +49,8 @@ namespace Umbraco.Core.Configuration internal static void ResetCache() { _reservedUrlsCache = null; + _reservedPaths = null; + _reservedUrls = null; } /// @@ -53,16 +60,19 @@ namespace Umbraco.Core.Configuration public static string ReservedUrls { get - { - //ensure the built on (non-changeable) reserved paths are there at all times - const string staticReservedUrls = "~/config/splashes/booting.aspx,~/install/default.aspx,~/config/splashes/noNodes.aspx,~/VSEnterpriseHelper.axd,"; + { + if (_reservedUrls == null) + { + var urls = ConfigurationManager.AppSettings.ContainsKey("umbracoReservedUrls") + ? ConfigurationManager.AppSettings["umbracoReservedUrls"] + : string.Empty; - var urls = ConfigurationManager.AppSettings.ContainsKey("umbracoReservedUrls") - ? ConfigurationManager.AppSettings["umbracoReservedUrls"] - : string.Empty; - - return staticReservedUrls + urls; + //ensure the built on (non-changeable) reserved paths are there at all times + _reservedUrls = StaticReservedUrls + urls; + } + return _reservedUrls; } + internal set { _reservedUrls = value; } } /// @@ -73,22 +83,25 @@ namespace Umbraco.Core.Configuration { get { - //ensure the built on (non-changeable) reserved paths are there at all times - var staticReservedPaths = "~/app_plugins/,~/install/,"; - - //always add the umbraco path to the list - if (ConfigurationManager.AppSettings.ContainsKey("umbracoPath") - && !ConfigurationManager.AppSettings["umbracoPath"].IsNullOrWhiteSpace()) + if (_reservedPaths == null) { - staticReservedPaths += ConfigurationManager.AppSettings["umbracoPath"].EnsureEndsWith(','); + var reservedPaths = StaticReservedPaths; + //always add the umbraco path to the list + if (ConfigurationManager.AppSettings.ContainsKey("umbracoPath") + && !ConfigurationManager.AppSettings["umbracoPath"].IsNullOrWhiteSpace()) + { + reservedPaths += ConfigurationManager.AppSettings["umbracoPath"].EnsureEndsWith(','); + } + + var allPaths = ConfigurationManager.AppSettings.ContainsKey("umbracoReservedPaths") + ? ConfigurationManager.AppSettings["umbracoReservedPaths"] + : string.Empty; + + _reservedPaths = reservedPaths + allPaths; } - - var paths = ConfigurationManager.AppSettings.ContainsKey("umbracoReservedPaths") - ? ConfigurationManager.AppSettings["umbracoReservedPaths"] - : string.Empty; - - return staticReservedPaths + paths; + return _reservedPaths; } + internal set { _reservedPaths = value; } } /// diff --git a/src/Umbraco.Tests/GlobalSettingsTests.cs b/src/Umbraco.Tests/GlobalSettingsTests.cs index 1298a5e719..ffffd11912 100644 --- a/src/Umbraco.Tests/GlobalSettingsTests.cs +++ b/src/Umbraco.Tests/GlobalSettingsTests.cs @@ -15,18 +15,14 @@ namespace Umbraco.Tests } public override void Initialize() - { + { base.Initialize(); - ConfigurationManager.AppSettings.Set("umbracoReservedPaths", "~/umbraco,~/install/"); - ConfigurationManager.AppSettings.Set("umbracoReservedUrls", "~/config/splashes/booting.aspx,~/install/default.aspx,~/config/splashes/noNodes.aspx,~/VSEnterpriseHelper.axd"); + SettingsForTests.UmbracoPath = "~/umbraco"; } public override void TearDown() { - //reset the app config - ConfigurationManager.AppSettings.Set("umbracoReservedPaths", ""); - ConfigurationManager.AppSettings.Set("umbracoReservedUrls", ""); - Umbraco.Core.Configuration.GlobalSettings.ResetCache(); + //reset the app config base.TearDown(); } @@ -72,8 +68,8 @@ namespace Umbraco.Tests public void Is_Reserved_By_Route(string url, bool shouldMatch) { //reset the app config, we only want to test routes not the hard coded paths - ConfigurationManager.AppSettings.Set("umbracoReservedPaths", ""); - ConfigurationManager.AppSettings.Set("umbracoReservedUrls", ""); + Umbraco.Core.Configuration.GlobalSettings.ReservedPaths = ""; + Umbraco.Core.Configuration.GlobalSettings.ReservedUrls = ""; var routes = new RouteCollection(); diff --git a/src/Umbraco.Tests/TestHelpers/SettingsForTests.cs b/src/Umbraco.Tests/TestHelpers/SettingsForTests.cs index cc7873afbf..7aabe196cf 100644 --- a/src/Umbraco.Tests/TestHelpers/SettingsForTests.cs +++ b/src/Umbraco.Tests/TestHelpers/SettingsForTests.cs @@ -75,13 +75,13 @@ namespace Umbraco.Tests.TestHelpers public static string ReservedPaths { get { return GlobalSettings.ReservedPaths; } - set { ConfigurationManager.AppSettings.Set("umbracoReservedPaths", value); } + set { GlobalSettings.ReservedPaths = value; } } public static string ReservedUrls { get { return GlobalSettings.ReservedUrls; } - set { ConfigurationManager.AppSettings.Set("umbracoReservedUrls", value); } + set { GlobalSettings.ReservedUrls = value; } } public static string ConfigurationStatus @@ -100,7 +100,7 @@ namespace Umbraco.Tests.TestHelpers public static void Reset() { UmbracoSettings.ResetSetters(); - + GlobalSettings.ResetCache(); foreach (var kvp in SavedAppSettings) ConfigurationManager.AppSettings.Set(kvp.Key, kvp.Value);