using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Globalization;

public partial class bitrix_install_Summary : System.Web.UI.UserControl
{
	//PROPERTIES
	public virtual string ValidationGroup
	{
		get
		{
			string str = (string)this.ViewState["ValidationGroup"];
			if (str != null)
				return str;
			return string.Empty;
		}
		set
		{
			this.ViewState["ValidationGroup"] = value;
		}
	}
	
	//METHODS
	public void AddErrorHtml(string errorHtml)
	{
		ErrorValidator v = new ErrorValidator(errorHtml, this.ValidationGroup);
		ErrorValidators.Controls.Add(v);
		v.Validate();
	}
	
	protected override void OnPreRender(EventArgs e)
	{
		base.OnPreRender(e);
		Page.ClientScript.RegisterArrayDeclaration("Page_ValidationSummaries", "document.getElementById(\"" + this.ClientID + "\")");
		//Page.ClientScript.RegisterStartupScript(typeof(ValidationSummary), this.ClientID + "_DisposeScript", string.Format(CultureInfo.InvariantCulture, "\r\ndocument.getElementById('{0}').dispose = function() {{\r\n    Array.remove({1}, document.getElementById('{0}'));\r\n}}\r\n", new object[] { this.ClientID, "Page_ValidationSummaries" }), true);

		if (!string.IsNullOrEmpty(ValidationGroup))
			Page.ClientScript.RegisterExpandoAttribute(ClientID, "validationGroup", this.ValidationGroup, true);
		Page.ClientScript.RegisterExpandoAttribute(ClientID, "showsummary", "False", false);
		Page.ClientScript.RegisterExpandoAttribute(ClientID, "showmessagebox", "False", false);
	}
	internal string[] GetErrorMessages(out bool inError)
	{
		string[] strArray = null;
		inError = false;
		int num = 0;
		ValidatorCollection validators = this.Page.GetValidators(this.ValidationGroup);
		for (int i = 0; i < validators.Count; i++)
		{
			IValidator validator = validators[i];
			if (!validator.IsValid)
			{
				inError = true;
				if (validator.ErrorMessage.Length != 0)
				{
					num++;
				}
			}
		}
		if (num != 0)
		{
			strArray = new string[num];
			int index = 0;
			for (int j = 0; j < validators.Count; j++)
			{
				IValidator validator2 = validators[j];
				if ((!validator2.IsValid && (validator2.ErrorMessage != null)) && (validator2.ErrorMessage.Length != 0))
				{
					strArray[index] = string.Copy(validator2.ErrorMessage);
					index++;
				}
			}
		}
		return strArray;
	}

	//NESTED CLASSES
	class ErrorValidator : BaseValidator
	{
		protected override bool EvaluateIsValid()
		{
			return false;
		}

		public ErrorValidator(string errorMessage, string validationGroup)
			: base()
		{
			this.ErrorMessage = errorMessage;
			this.ValidationGroup = validationGroup;
		}

		protected override bool ControlPropertiesValid()
		{
			return true;
		}
	}
}
