<xf:title>{$option.title}</xf:title>

<xf:form action="{{ link('options/email-transport-server', $option) }}" ajax="true" class="block">
	<div class="block-container">
		<div class="block-body">
			<xf:formrow label="{{ phrase('connection_type') }}">
				{$type|to_upper}
				<xf:hiddenval name="emailTransport" value="{$type}" />
			</xf:formrow>

			<xf:set var="$values" value="{{ $type == $option.option_value.emailTransport ? $option.option_value : [] }}" />

			<xf:formrow label="{{ phrase('host') }}" rowtype="input">
				<div class="inputGroup">
					<xf:textbox name="smtpHost" value="{$values.smtpHost}" placeholder="{{ phrase('host') }}" size="40" required="required" />
					<span class="inputGroup-text">:</span>
					<xf:textbox name="smtpPort" value="{$values.smtpPort}" placeholder="{{ phrase('port') }}" size="5" required="required" />
				</div>
			</xf:formrow>

			<xf:radiorow label="{{ phrase('authentication') }}" name="smtpAuth" value="{{ $values.smtpAuth ?: 'none' }}">
				<xf:option value="none">{{ phrase('none') }}</xf:option>
				<xf:option value="login" label="{{ phrase('user_name_and_password') }}">
					<xf:dependent>
						<div class="inputGroup">
							<xf:textbox name="smtpLoginUsername" value="{$values.smtpLoginUsername}" placeholder="{{ phrase('user_name') }}" size="15" />
							<span class="inputGroup-splitter"></span>
							<xf:textbox name="smtpLoginPassword" placeholder="{{ phrase('password') }}" type="password" size="15" />
						</div>
					</xf:dependent>
				</xf:option>
			</xf:radiorow>

			<xf:radiorow label="{{ phrase('encryption') }}" name="smtpEncrypt" value="{{ $values.smtpEncrypt ?: 'none' }}"
				explain="{{ phrase('openssl_php_extension_required_tls_or_ssl_encryption') }}">

				<xf:option value="none">{{ phrase('none') }}</xf:option>
				<xf:option value="tls" disabled="{{ !in_array('tls', $transports) }}">TLS</xf:option>
				<xf:option value="ssl" disabled="{{ !in_array('ssl', $transports) }}">SSL</xf:option>
			</xf:radiorow>
		</div>
		<xf:submitrow sticky="true" icon="save" />
	</div>
</xf:form>