diff --git a/src/Umbraco.Core/Persistence/Repositories/ContentTypeBaseRepository.cs b/src/Umbraco.Core/Persistence/Repositories/ContentTypeBaseRepository.cs
index ca52678b91..f2eaa4280b 100644
--- a/src/Umbraco.Core/Persistence/Repositories/ContentTypeBaseRepository.cs
+++ b/src/Umbraco.Core/Persistence/Repositories/ContentTypeBaseRepository.cs
@@ -258,7 +258,7 @@ namespace Umbraco.Core.Persistence.Repositories
//unless the PropertyGroupId has already been changed.
foreach (var propertyType in propertyGroup.PropertyTypes)
{
- if(propertyType.IsPropertyDirty("PropertyGroupId") == false)
+ if ((propertyType.IsPropertyDirty("PropertyGroupId") && propertyType.PropertyGroupId == 0) == false)
propertyType.PropertyGroupId = propertyGroup.Id;
}
}
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 4a2efb2438..b8e33be1fc 100644
--- a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentTypeControlNew.ascx.cs
+++ b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/ContentTypeControlNew.ascx.cs
@@ -405,6 +405,7 @@ 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(""));
@@ -414,6 +415,7 @@ 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();
@@ -435,14 +437,18 @@ jQuery(document).ready(function() {{ refreshDropDowns(); }});
? tab.GetPropertyTypes(_contentType.Id, false)
: propertyGroup.GetPropertyTypes();
+ var propertyGroupId = tab.Id;
+ if (propertyGroup != null && propertyGroup.ParentId > 0)
+ propertyGroupId = propertyGroup.Id;
+
if (propertyTypes.Any())
{
var propSort = new HtmlInputHidden();
- propSort.ID = "propSort_" + tab.Id.ToString() + "_Content";
+ propSort.ID = "propSort_" + propertyGroupId.ToString() + "_Content";
PropertyTypes.Controls.Add(propSort);
_sortLists.Add(propSort);
- PropertyTypes.Controls.Add(new LiteralControl("
"));
+ PropertyTypes.Controls.Add(new LiteralControl(""));
foreach (cms.businesslogic.propertytype.PropertyType pt in propertyTypes)
{
@@ -453,10 +459,11 @@ jQuery(document).ready(function() {{ refreshDropDowns(); }});
gpw.ID = "gpw_" + pt.Id;
gpw.PropertyType = pt;
gpw.Tabs = tabs;
- gpw.TabId = tab.Id;
+ gp.PropertyGroups = propertyTypeGroups;
+ gpw.TabId = propertyGroupId;
gpw.DataTypeDefinitions = dtds;
gpw.Delete += new EventHandler(gpw_Delete);
- gpw.FullId = "t_" + tab.Id.ToString() + "_Contents_" + +pt.Id;
+ gpw.FullId = "t_" + propertyGroupId.ToString() + "_Contents_" + +pt.Id;
PropertyTypes.Controls.Add(gpw);
_genericProperties.Add(gpw);
@@ -528,6 +535,7 @@ 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 b38f3ba4af..d5063e950c 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
@@ -1,8 +1,12 @@
using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Linq;
using System.Web.UI.WebControls;
using ClientDependency.Core;
using umbraco.BasePages;
using umbraco.IO;
+using umbraco.cms.businesslogic.propertytype;
namespace umbraco.controls.GenericProperties
{
@@ -101,7 +105,9 @@ namespace umbraco.controls.GenericProperties
}
private int _id;
- public int Id {
+ private List _propertyGroups;
+
+ public int Id {
set {
_id = value;
}get{
@@ -114,7 +120,13 @@ namespace umbraco.controls.GenericProperties
get {return int.Parse(ddlTypes.SelectedValue);}
}
- public void Clear()
+ public List PropertyGroups
+ {
+ get { return _propertyGroups; }
+ set { _propertyGroups = value; }
+ }
+
+ public void Clear()
{
tbName.Text = "";
tbAlias.Text = "";
@@ -129,10 +141,8 @@ namespace umbraco.controls.GenericProperties
{
if (!IsPostBack)
{
-
UpdateInterface();
}
-
}
public void UpdateInterface()
@@ -182,7 +192,18 @@ namespace umbraco.controls.GenericProperties
}
// tabs
- if (_tabs != null)
+ 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)
{
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 bf6c391439..b78a4d7990 100644
--- a/src/Umbraco.Web/umbraco.presentation/umbraco/controls/GenericProperties/GenericPropertyWrapper.cs
+++ b/src/Umbraco.Web/umbraco.presentation/umbraco/controls/GenericProperties/GenericPropertyWrapper.cs
@@ -1,5 +1,7 @@
using System;
+using System.Collections.Generic;
using umbraco.IO;
+using umbraco.cms.businesslogic.propertytype;
namespace umbraco.controls.GenericProperties
{
@@ -15,8 +17,9 @@ namespace umbraco.controls.GenericProperties
private cms.businesslogic.datatype.DataTypeDefinition[] _dtds;
private int _tabId;
private string _fullId = "";
+ private List _propertyGroups;
- public event System.EventHandler Delete;
+ public event System.EventHandler Delete;
public cms.businesslogic.propertytype.PropertyType PropertyType
{
@@ -59,7 +62,12 @@ namespace umbraco.controls.GenericProperties
}
}
- public GenericPropertyWrapper()
+ public List PropertyGroups
+ {
+ set { _propertyGroups = value; }
+ }
+
+ public GenericPropertyWrapper()
{
//
// TODO: Add constructor logic here
@@ -76,6 +84,7 @@ namespace umbraco.controls.GenericProperties
_gp.PropertyType = _pt;
_gp.DataTypeDefinitions = _dtds;
_gp.Tabs = _tabs;
+ _gp.PropertyGroups = _propertyGroups;
_gp.TabId = _tabId;
_gp.FullId = _fullId;
}
diff --git a/src/umbraco.editorControls/memberpicker/memberPicker.cs b/src/umbraco.editorControls/memberpicker/memberPicker.cs
index e43ea3e1fb..63e7844638 100644
--- a/src/umbraco.editorControls/memberpicker/memberPicker.cs
+++ b/src/umbraco.editorControls/memberpicker/memberPicker.cs
@@ -62,8 +62,8 @@ namespace umbraco.editorControls
base.DataSource = dropdownData;
base.DataBind();
base.Items.Insert(0, new ListItem(ui.Text("choose") + "...",""));
-
- base.SelectedValue = _data.Value.ToString();
+
+ base.SelectedValue = _data.Value != null ? _data.Value.ToString() : "";
// Iterate on the control items and mark fields by match them with the Text property!
//foreach(ListItem li in base.Items)