<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Options.ascx.cs" Inherits="bitrix_modules_main_Options" EnableViewState="false" %>

<bx:BXValidationSummary ID="errorMessage" runat="server" CssClass="errorSummary" ValidationGroup="vgInnerForm" HeaderText="<%$ Loc:Kernel.Error %>" />
<bx:BXMessage ID="successMessage" runat="server" CssClass="ok" IconClass="ok" Title="<%$ Loc:Kernel.Information %>"
	Visible="False" Content="<%$ Loc:Message.SettingsHasBeenSavedSuccessfully %>" />

<bx:InlineScript runat="server" ID="Script">
<script type="text/javascript">
	function MailerDefaultEmailFromValidator_Validate(sender, args)
	{
		args.IsValid = document.getElementById('<%= MailerSmtpHost.ClientID %>').value == '' || args.Value != '';
	}
</script>
</bx:InlineScript>

<bx:BXTabControl ID="BXTabControl1" ValidationGroup="vgInnerForm" runat="server" OnCommand="BXTabControl1_Command">
	<bx:BXTabControlTab runat="server" Selected="True" Text="<%$ Loc:TabText.AdjustmentOfModuleParameters %>"
		Title="<%$ Loc:Kernel.TopPanel.Settings %>">
		<table border="0" cellpadding="0" cellspacing="0" class="edit-table">
			<tr class="heading">
				<td colspan="2">
					<%= GetMessage("Legend.SystemSettings") %>
				</td>
			</tr>
		    <%--<tr valign="top">
				<td class="field-name" width="40%">
					<%= GetMessage("Legend.DefaultLanguageForAdministrativeSection") %>
				</td>
				<td width="60%">
					<asp:DropDownList ID="ddlAdminLanguage" ValidationGroup="vgInnerForm" runat="server">
					</asp:DropDownList>
				</td>
			</tr>--%>
		    <tr valign="top">
				<td class="field-name" width="40%">
					<%= GetMessage("Legend.SiteTitle") %>
				</td>
				<td width="60%">
					<asp:TextBox ID="tbSiteName" ValidationGroup="vgInnerForm" runat="server"></asp:TextBox>
				</td>
			</tr>
			<tr valign="top">
				<td class="field-name" width="40%">
				</td>
				<td width="60%">
					<asp:CheckBox runat="server" ID="AutoCache" Text="<%$ Loc:CheckBoxText.PerformAutocaching %>" />
				</td>
			</tr>
			<tr valign="top">
				<td class="field-name" width="40%">
				</td>
				<td width="60%">
					<asp:CheckBox runat="server" ID="HandleError404" Text="<%$ Loc:CheckBoxText.Enable404Handling %>" />
				</td>
			</tr>
			<tr valign="top">
				<td class="field-name" width="40%">
				</td>
				<td width="60%">
					<asp:CheckBox runat="server" ID="HandleStandardSefExceptions" Text="<%$ Loc:CheckBoxText.HandleStandardSefExceptions %>" />
				</td>
			</tr>
			<tr class="heading">
				<td colspan="2">
					<%= GetMessage("Legend.Files") %>
				</td>
			</tr>
		    <tr valign="top">
				<td class="field-name" width="40%"></td>
				<td width="60%">
					<asp:CheckBox ID="cbSaveOriginalFileNames" ValidationGroup="vgInnerForm"  Text="<%$ Loc:Legend.SaveOriginalFileNames %>" runat="server" />
				</td>
			</tr>
		    <tr valign="top">
				<td class="field-name" width="40%"></td>
				<td width="60%">
					<asp:CheckBox ID="cbCorrectFileNames" ValidationGroup="vgInnerForm" Text="<%$ Loc:Legend.ReplaceInvalidCharactersInNamesOfUploadedFiles %>" runat="server" />
				</td>
			</tr>
			<tr class="heading">
				<td colspan="2">
					<%= GetMessage("Legend.SiteMap") %>
				</td>
			</tr>
		    <tr valign="top">
				<td class="field-name" width="40%">
					<%= GetMessage("Legend.TypeOfSiteMap") %>
					<br/><%= GetMessage("LegendPart.TopLevel") %>
				</td>
				<td width="60%">
					<asp:TextBox ValidationGroup="vgInnerForm" ID="TopSiteMap" runat="server"></asp:TextBox>
				</td>
			</tr>
			<tr valign="top">
				<td class="field-name" width="40%">
					<%= GetMessage("Legend.TypeOfSiteMap") %>
					<br/><%= GetMessage("LegendPart.OtherLevels") %>
				</td>
				<td width="60%">
					<asp:TextBox ValidationGroup="vgInnerForm" ID="OtherSiteMap" runat="server"></asp:TextBox>
				</td>
			</tr>
			<tr class="heading">
				<td colspan="2">
					<asp:Literal ID="Literal1" runat="server" Text="<%$ Loc:Header.Mailer %>" />
				</td>
			</tr>
		    <tr valign="top">
				<td class="field-name" width="40%">
					<asp:Literal ID="Literal2" runat="server" Text="<%$ Loc:Mailer.SmtpHost %>" />:
				</td>
				<td width="60%">
					<asp:TextBox ID="MailerSmtpHost" runat="server" ValidationGroup="vgInnerForm" />
				</td>
			</tr>
			<tr valign="top">
				<td class="field-name" width="40%">
					<asp:Literal ID="Literal3" runat="server" Text="<%$ Loc:Mailer.SmtpPort %>" />:
				</td>
				<td width="60%">
					<asp:TextBox ID="MailerSmtpPort" runat="server" ValidationGroup="vgInnerForm" Text="25" />
					<asp:RangeValidator ID="MailerSmtpPortValidator" runat="server" ValidationGroup="vgInnerForm" 
						ControlToValidate="MailerSmtpPort" Type="Integer" MinimumValue="1" MaximumValue="65535"
						Display="Dynamic" ErrorMessage="<%$ Loc:Error.InvalidPort %>" >*</asp:RangeValidator>
				</td>
			</tr>
			<tr valign="top">
				<td class="field-name" width="40%">
					<asp:Literal ID="Literal4" runat="server" Text="<%$ Loc:Mailer.SmtpUsername %>" />:
				</td>
				<td width="60%">
					<asp:TextBox ID="MailerSmtpUsername" runat="server" ValidationGroup="vgInnerForm" autocomplete="off" />
				</td>
			</tr>
			<tr valign="top">
				<td class="field-name" width="40%">
					<asp:Literal ID="Literal5" runat="server" Text="<%$ Loc:Mailer.SmtpPassword %>" />:
				</td>
				<td width="60%">
					<asp:TextBox ID="MailerSmtpPassword" runat="server" ValidationGroup="vgInnerForm" TextMode="Password" autocomplete="off" />
				</td>
			</tr>
			<tr valign="top">
				<td class="field-name" width="40%">
					<asp:Literal ID="Literal13" runat="server" Text="<%$ Loc:Mailer.DefaultEmailFrom %>" />:
				</td>
				<td width="60%">
					<asp:TextBox ID="MailerDefaultEmailFrom" runat="server" /><asp:CustomValidator 
					ID="MailerDefaultEmailFromValidator" runat="server" ValidationGroup="vgInnerForm" ValidateEmptyText="true" 
					ClientValidationFunction="MailerDefaultEmailFromValidator_Validate" ControlToValidate="MailerDefaultEmailFrom"
					OnServerValidate="MailerDefaultEmailFromValidator_Validate" ErrorMessage="<%$ Loc:Error.DefaultEmailFromRequired %>" >*</asp:CustomValidator>
				</td>
			</tr>
		</table>
	</bx:BXTabControlTab>
	<bx:BXTabControlTab runat="server" Text="<%$ Loc:TabText.StructureManagement %>" Title="<%$ Loc:Kernel.TopPanel.Settings %>">
		<table border="0" cellpadding="0" cellspacing="0" class="edit-table">
			<tr class="heading">
				<td colspan="2">
					<asp:Literal ID="Literal7" runat="server" Text="<%$ Loc:Header.EditorSettings %>" />
				</td>
			</tr>
			<tr valign="top">
				<td class="field-name" width="40%">
					<asp:Literal ID="Literal10" runat="server" Text="<%$ Loc:EditorSettings.DefaultEncoding %>" />:
				</td>
				<td width="60%">
					<asp:DropDownList ID="DefaultEncoding" runat="server" Width="200px" />
				</td>
			</tr>
			<tr valign="top">
				<td class="field-name" width="40%">
					<asp:Literal ID="Literal11" runat="server" Text="<%$ Loc:EditorSettings.DefaultPageEditor %>" />:
				</td>
				<td width="60%">
					<asp:DropDownList ID="DefaultPageEditor" runat="server" Width="200px" >
						<asp:ListItem Value="text" Text="<%$ Loc:DefaultPageEditor.Text %>" />
						<asp:ListItem Value="visual" Text="<%$ Loc:DefaultPageEditor.Visual %>" />
					</asp:DropDownList>
				</td>
			</tr>
			<tr valign="top">
				<td class="field-name" width="40%">
					<asp:Literal ID="Literal14" runat="server" Text="<%$ Loc:EditorSettings.MainContentPlaceHolder %>" />:
				</td>
				<td width="60%">
					<asp:TextBox ID="MainContentPlaceHolder" runat="server" />
				</td>
			</tr>
			<tr valign="top">
				<td class="field-name" width="40%">
					<asp:Literal ID="Literal15" runat="server" Text="<%$ Loc:EditorSettings.PageBaseClass %>" />:
				</td>
				<td width="60%">
					<% 
						string value = Request.Form[UniqueID + "$PageBaseClass"] ?? Bitrix.Configuration.BXConfigurationUtility.Options.PageBaseClass;
						bool selected = false;
					%>
					<select name="<%= UniqueID %>$PageBaseClass" onchange="document.getElementById('<%= PageBaseClassCustom.ClientID %>').disabled = (this.value != '');">
						<option value=""><%= GetMessage("PageBaseClass.Custom") %></option>
						<% foreach(ListItem i in GetPageClasses()) { %>
						<option value="<%= Encode(i.Value) %>" <% if (value == i.Value) { selected = true; %>selected="selected"<% } %>><%= Encode(i.Text) %></option>
						<% } %>
					</select>
					<% 
						if (selected)
							PageBaseClassCustom.Attributes["disabled"] = "true";
						else if (!string.IsNullOrEmpty(value))
							PageBaseClassCustom.Text = value;			
					%>
					<asp:TextBox ID="PageBaseClassCustom" runat="server" Width="250px" /><asp:CustomValidator 
					ID="PageBaseClassValidator" runat="server" ValidationGroup="vgInnerForm" ValidateEmptyText="true" 
					ControlToValidate="PageBaseClassCustom"	OnServerValidate="PageBaseClassValidator_Validate">*</asp:CustomValidator><br />
					<small><%= GetMessageRaw("PageBaseClass.Description") %></small>
				</td>
			</tr>
			<tr valign="top">
				<td class="field-name" width="40%"></td>
				<td width="60%">
					<asp:CheckBox ID="RenderComponents" ValidationGroup="vgInnerForm" Text="<%$ LocRaw:EditorSettings.RenderComponents %>" runat="server" />
				</td>
			</tr>
			<tr class="heading">
				<td colspan="2">
					<asp:Literal ID="Literal6" runat="server" Text="<%$ Loc:Header.SiteSettings %>" />
				</td>
			</tr>
			<tr valign="top">
				<td class="field-name" width="40%">
					<asp:Literal ID="Literal9" runat="server" Text="<%$ Loc:SiteSettings.SettingsForSite %>" />:
				</td>
				<td width="60%">
					<asp:DropDownList ID="SettingsForSite" runat="server" Width="200px" />
				</td>
			</tr>
			<tr>
			<td class="field-name" width="40%" valign="top" >
				<asp:Literal ID="Literal8" runat="server" Text="<%$ Loc:SiteSettings.MenuTypes %>" />:
			</td>
			<td width="60%">
			<asp:Repeater ID="MenuSettings" runat="server" OnItemDataBound="MenuSettings_ItemDataBound" >
			<ItemTemplate>
					<asp:HiddenField ID="MenuTypesCount" runat="server" Value="0" />
					<asp:Table ID="MenuTypes" runat="server" BorderWidth="0px" BorderStyle="None" CellPadding="0" CellSpacing="2" Width="100%" CssClass="edit-table">
					<asp:TableHeaderRow CssClass="heading" runat="server">
						<asp:TableCell Text="<%$ Loc:SiteSettings.MenuType %>" runat="server" />
						<asp:TableCell Text="<%$ Loc:SiteSettings.MenuTitle %>" runat="server" />
					</asp:TableHeaderRow>
					</asp:Table>
			</ItemTemplate>
			</asp:Repeater>
			</td>
			</tr>
			<tr>
			<td class="field-name" width="40%" valign="top" >
				<asp:Literal ID="Literal12" runat="server" Text="<%$ Loc:SiteSettings.Properties %>" />:
			</td>
			<td width="60%">
			<asp:Repeater ID="PropertiesSettings" runat="server" OnItemDataBound="PropertiesSettings_ItemDataBound" >
			<ItemTemplate>
					<asp:HiddenField ID="PropertiesCount" runat="server" Value="0" />
					<asp:Table ID="Properties" runat="server" BorderWidth="0px" BorderStyle="None" CellPadding="0" CellSpacing="2" Width="100%" CssClass="edit-table">
					<asp:TableHeaderRow CssClass="heading" runat="server">
						<asp:TableCell Text="<%$ Loc:SiteSettings.PropertyType %>" runat="server" />
						<asp:TableCell Text="<%$ Loc:SiteSettings.PropertyTitle %>" runat="server" />
					</asp:TableHeaderRow>
					</asp:Table>
			</ItemTemplate>
			</asp:Repeater>
			</td>
			</tr>
		</table>
	</bx:BXTabControlTab>
	<bx:BXTabControlTab runat="server" Text="<%$ LocRaw:TabText.Users %>" Title="<%$ LocRaw:TabTitle.Users %>" >
		<table border="0" cellpadding="0" cellspacing="0" class="edit-table">
			<tr class="heading">
				<td colspan="2"><%= GetMessage("Heading.UserImage") %></td>
			</tr>
			<tr valign="top">
				<td class="field-name" width="40%">
					<%= GetMessage("Label.MaxImageSize") %>:
				</td>
				<td width="60%">
					<asp:TextBox runat="server" ID="AvatarMaxSizeKB" />
				</td>
			</tr>
			<tr valign="top">
				<td class="field-name" width="40%">
					<%= GetMessage("Label.MaxImageWidth") %>:
				</td>
				<td width="60%">
					<asp:TextBox runat="server" ID="AvatarMaxWidth" />
				</td>
			</tr>
			<tr valign="top">
				<td class="field-name" width="40%">
					<%= GetMessage("Label.MaxImageHeight") %>:
				</td>
				<td width="60%">
					<asp:TextBox runat="server" ID="AvatarMaxHeight" />
				</td>
			</tr>
		</table>
	</bx:BXTabControlTab>
</bx:BXTabControl>
