using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CMS.GlobalHelper;
using CMS.UIControls;
public partial class CMSModules_Content_Controls_Dialogs_YouTube_YouTubeColors : CMSUserControl
{
#region "Variables"
private string mOnSelectedItemClick = "";
#endregion
#region "Public properties"
///
/// Gets or sets the JavaScript code which is prcessed when some color is clicked.
///
public string OnSelectedItemClick
{
get
{
return mOnSelectedItemClick;
}
set
{
mOnSelectedItemClick = value;
}
}
///
/// Gets or sets the first color.
///
public string SelectedColor1
{
get
{
return hdnColor1.Value;
}
set
{
hdnColor1.Value = value;
}
}
///
/// Gets or sets the second color.
///
public string SelectedColor2
{
get
{
return hdnColor2.Value;
}
set
{
hdnColor2.Value = value;
}
}
#endregion
protected void Page_Load(object sender, EventArgs e)
{
// Register scripts
ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "YouTubeColors", ScriptHelper.GetScript(
"function setColors(color1, color2) { \n" +
" var color1Elem = document.getElementById('" + hdnColor1.ClientID + "'); \n" +
" var color2Elem = document.getElementById('" + hdnColor2.ClientID + "'); \n" +
" if ((color1Elem != null) && (color2Elem != null)) { \n" +
" color1Elem.value = color1; \n" +
" color2Elem.value = color2; \n" + OnSelectedItemClick + "; \n" +
" } \n" +
"} \n"));
}
#region "Public methods"
///
/// Loads the color previews.
///
/// Array with colors (two colors per box)
public void LoadColors(string[] colors)
{
plcColors.Controls.Clear();
plcColors.Controls.Add(new LiteralControl("
"));
for (int i = 0; i < colors.Length; i += 2)
{
plcColors.Controls.Add(new LiteralControl(
"
"));
}
plcColors.Controls.Add(new LiteralControl("
"));
}
#endregion
}