Sure.. Pasted below.
However, it's not just the custom Layouts that are broken. If I try adding a builtin Widget to a builtin Widget Layout in a blank Template, I get the same issue.
public partial class CssColumnLayout : CMSAbstractLayoutWebPart
{
private string mWebPartControlId;
//private bool mHaveChecked;
#region "Public properties"
public string ColumnSplit
{
get
{
return ValidationHelper.GetString(this.GetValue("ColumnSplit"), "3-3");
}
set
{
this.SetValue("ColumnSplit", value);
}
}
public string WebPartControlId
{
get
{
if (string.IsNullOrWhiteSpace(mWebPartControlId))
{
this.mWebPartControlId = string.Format("{1}", this.GetValue("WebPartControlID"), this.PartInstance.InstanceGUID);
}
return this.mWebPartControlId;
}
set
{
this.mWebPartControlId = value;
this.SetValue("WebPartControlID", value);
}
}
#endregion "Public properties"
#region "Methods"
/// <summary>
/// Prepares the layout of the web part.
/// </summary>
protected override void PrepareLayout()
{
if (this.Ancestors().Count(c => c.ID == base.ID) > 0)
{
this.WebPartControlId = this.PartInstance.InstanceGUID.ToString();
}
StartLayout();
int[] columnWidths = GetColumnWidths(this.ColumnSplit);
var columnId = 1;
var columnsTot = columnWidths.Sum();
var nestedLayout = false;
var layoutId = this.WebPartControlId;
Append(String.Format("<div class=\"column-layout-width-{0}\"", columnsTot));
if (IsDesign)
{
Append(" id=\"", this.WebPartControlId, "_env\"");
}
Append(">");
foreach (var width in columnWidths)
{
var columnIdent = string.Empty;
var panelId = string.Format("{0}_{1}wpc", this.WebPartControlId, columnId);
var zoneId = string.Format("{0}_{1}", this.ID, columnId);
if (columnId == 1) { columnIdent = " column-item-first"; }
if (columnId == columnWidths.Length) { columnIdent = " column-item-last"; }
var panel = new Panel()
{
CssClass = string.Format("column-item column-layout-width-{0}-{1}{2}", width, columnsTot, columnIdent),
};
if (IsDesign) { panel.ID = zoneId; }
if (zoneId == this.ID) { zoneId = zoneId + "wpz"; }
var zone = AddZone(zoneId, "Column " + columnId.ToString(), panel);
columnId += 1;
AddControl(panel);
}
Append("<div class=\"clear\"></div></div>");
FinishLayout();
}
private int[] GetColumnWidths(string columnSort)
{
switch (columnSort)
{
case "3-3":
return new int[] { 3, 3 };
case "4-2":
return new int[] { 4, 2 };
case "2-2-2":
return new int[] { 2, 2, 2 };
case "2-4":
return new int[] { 2, 4 };
case "4-4":
return new int[] { 4, 4 };
case "2-4-2":
return new int[] { 2, 4, 2 };
case "6-2":
return new int[] { 6, 2 };
case "2-2":
return new int[] { 2, 2 };
case "2-2-2-2":
return new int[] { 2, 2, 2, 2 };
default:
return new int[] { 3, 3 };
}
}
#endregion "Methods"
}