using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CMS.GlobalHelper;
using CMS.PortalControls;
using CMS.PortalEngine;
public partial class CMSWebParts_Layouts_Rows : CMSAbstractLayoutWebPart
{
#region "Properties"
///
/// Number of rows.
///
public int Rows
{
get
{
return ValidationHelper.GetInteger(GetValue("Rows"), 2);
}
set
{
SetValue("Rows", value);
}
}
///
/// First row width.
///
public string Row1Width
{
get
{
return ValidationHelper.GetString(GetValue("Row1Width"), "");
}
set
{
SetValue("Row1Width", value);
}
}
///
/// First row height.
///
public string Row1Height
{
get
{
return ValidationHelper.GetString(GetValue("Row1Height"), "");
}
set
{
SetValue("Row1Height", value);
}
}
///
/// First row CSS class.
///
public string Row1CSSClass
{
get
{
return ValidationHelper.GetString(GetValue("Row1CSSClass"), "");
}
set
{
SetValue("Row1CSSClass", value);
}
}
///
/// Second row width.
///
public string Row2Width
{
get
{
return ValidationHelper.GetString(GetValue("Row2Width"), "");
}
set
{
SetValue("Row2Width", value);
}
}
///
/// Second row height.
///
public string Row2Height
{
get
{
return ValidationHelper.GetString(GetValue("Row2Height"), "");
}
set
{
SetValue("Row2Height", value);
}
}
///
/// Second row CSS class.
///
public string Row2CSSClass
{
get
{
return ValidationHelper.GetString(GetValue("Row2CSSClass"), "");
}
set
{
SetValue("Row2CSSClass", value);
}
}
///
/// Third row width.
///
public string Row3Width
{
get
{
return ValidationHelper.GetString(GetValue("Row3Width"), "");
}
set
{
SetValue("Row3Width", value);
}
}
///
/// Third row height.
///
public string Row3Height
{
get
{
return ValidationHelper.GetString(GetValue("Row3Height"), "");
}
set
{
SetValue("Row3Height", value);
}
}
///
/// Third row CSS class.
///
public string Row3CSSClass
{
get
{
return ValidationHelper.GetString(GetValue("Row3CSSClass"), "");
}
set
{
SetValue("Row3CSSClass", value);
}
}
///
/// Fourth row width.
///
public string Row4Width
{
get
{
return ValidationHelper.GetString(GetValue("Row4Width"), "");
}
set
{
SetValue("Row4Width", value);
}
}
///
/// Fourth row height.
///
public string Row4Height
{
get
{
return ValidationHelper.GetString(GetValue("Row4Height"), "");
}
set
{
SetValue("Row4Height", value);
}
}
///
/// Fourth row CSS class.
///
public string Row4CSSClass
{
get
{
return ValidationHelper.GetString(GetValue("Row4CSSClass"), "");
}
set
{
SetValue("Row4CSSClass", value);
}
}
///
/// Fifth row width.
///
public string Row5Width
{
get
{
return ValidationHelper.GetString(GetValue("Row5Width"), "");
}
set
{
SetValue("Row5Width", value);
}
}
///
/// Fifth row height.
///
public string Row5Height
{
get
{
return ValidationHelper.GetString(GetValue("Row5Height"), "");
}
set
{
SetValue("Row5Height", value);
}
}
///
/// Fifth row CSS class.
///
public string Row5CSSClass
{
get
{
return ValidationHelper.GetString(GetValue("Row5CSSClass"), "");
}
set
{
SetValue("Row5CSSClass", value);
}
}
#endregion
#region "Methods"
///
/// Prepares the layout of the web part.
///
protected override void PrepareLayout()
{
// Prepare the main markup
StartLayout();
if (IsDesign)
{
Append("
");
if (ViewMode == ViewModeEnum.Design)
{
Append("
");
}
Append("");
}
// Add the columns
for (int i = 1; i <= Rows; i++)
{
// Set the width property
string heightPropertyName = "Row" + i + "Height";
string widthPropertyName = "Row" + i + "Width";
string width = ValidationHelper.GetString(GetValue(widthPropertyName), "");
string height = ValidationHelper.GetString(GetValue(heightPropertyName), "");
string rowId = "row" + i;
if (IsDesign)
{
Append("| ");
// Add the zone
AddZone(ID + "_" + i, "[" + i + "]");
if (IsDesign)
{
Append(" | ");
// Resizers
if (AllowDesignMode)
{
Append(" | ");
Append("| | ");
Append(" | ");
}
Append(" ");
}
else
{
Append("");
}
}
if (IsDesign)
{
Append(" |
");
// Footer
if (AllowDesignMode)
{
Append("
");
}
Append("
");
}
// Finalize
FinishLayout();
}
#endregion
}