<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

	<xsl:strip-space elements="*"/>
	<xsl:output method="html" indent="yes" encoding="utf-8"/>

	<xsl:template match="LAST-PUBLICATION">
<!--
:TODO: abelyaev 20070405: implement here
-->
	</xsl:template>

	<xsl:template match="PUBLICATION-SETTINGS-FORM">
		<xsl:param name="inOneRow"/>
		<xsl:param name="descriptionClass">sb-text-pale</xsl:param>

		<table width="100%" cellpadding="4px" cellspacing="0" border="0" style="border-collapse:collapse;">
			<tr id="publicationModeRow">
				<td style="padding: 8px 0px 0px 8px;">
					<xsl:apply-templates select="CONTROL[@NAME='publicationMode' and @TYPE='COMBO-BOX']" mode="TITLE-LEFT">
						<xsl:with-param name="controlClass">sb-control-input-input</xsl:with-param>
						<xsl:with-param name="descriptionClass" select="$descriptionClass"/>
						<xsl:with-param name="onChange">self.sbApplyChangesObject.registerChange(); sbPublicationSettingsForm.onPublicationModeChange(); sbPublicationSettingsForm.onChange();</xsl:with-param>
						<xsl:with-param name="inOneRow" select="$inOneRow"/>
						<xsl:with-param name="rowClass">sb-formview-row</xsl:with-param>
					</xsl:apply-templates>
				</td>
			</tr>
			<xsl:call-template name="PUBLICATION-SETTINGS-FORM-CONTROL">
				<xsl:with-param name="name">hostName</xsl:with-param>
				<xsl:with-param name="inOneRow" select="$inOneRow"/>
				<xsl:with-param name="descriptionClass" select="$descriptionClass"/>
			</xsl:call-template>
			<xsl:call-template name="PUBLICATION-SETTINGS-FORM-CONTROL">
				<xsl:with-param name="name">ftpPort</xsl:with-param>
				<xsl:with-param name="inOneRow" select="$inOneRow"/>
				<xsl:with-param name="descriptionClass" select="$descriptionClass"/>
			</xsl:call-template>
			<xsl:call-template name="PUBLICATION-SETTINGS-FORM-CONTROL">
				<xsl:with-param name="name">ftpUser</xsl:with-param>
				<xsl:with-param name="inOneRow" select="$inOneRow"/>
				<xsl:with-param name="descriptionClass" select="$descriptionClass"/>
			</xsl:call-template>
			<xsl:call-template name="PUBLICATION-SETTINGS-FORM-CONTROL">
				<xsl:with-param name="name">ftpPassword</xsl:with-param>
				<xsl:with-param name="inOneRow" select="$inOneRow"/>
				<xsl:with-param name="descriptionClass" select="$descriptionClass"/>
			</xsl:call-template>
			<xsl:if test="CONTROL[@NAME='changeFtpPassword']">
				<tr id="changeFtpPasswordRow">
					<xsl:apply-templates select="CONTROL[@NAME='changeFtpPassword']/@HIDDEN" mode="publicationSettings"/>
					<td style="padding: 8px 0px 0px 8px;">
						<input type="hidden" name="isFtpPasswordChanged" id="isFtpPasswordChanged">
							<xsl:attribute name="value">
								<xsl:choose>
									<xsl:when test="CONTROL[@NAME='ftpPassword']/@EMPTY">true</xsl:when>
									<xsl:otherwise>false</xsl:otherwise>
								</xsl:choose>
							</xsl:attribute>
						</input>
						<xsl:apply-templates select="CONTROL[@NAME='changeFtpPassword']" mode="TITLE-LEFT">
							<xsl:with-param name="descriptionClass" select="$descriptionClass"/>
							<xsl:with-param name="controlStyle">width: 120px;</xsl:with-param>
							<xsl:with-param name="inOneRow" select="$inOneRow"/>
							<xsl:with-param name="onClick">sbPublicationSettingsForm.onChangeFtpPassword();</xsl:with-param>
							<xsl:with-param name="rowClass">sb-formview-row</xsl:with-param>
						</xsl:apply-templates>
					</td>
				</tr>
			</xsl:if>
			<xsl:call-template name="PUBLICATION-SETTINGS-FORM-CONTROL">
				<xsl:with-param name="name">vpsId</xsl:with-param>
				<xsl:with-param name="inOneRow" select="$inOneRow"/>
				<xsl:with-param name="descriptionClass" select="$descriptionClass"/>
			</xsl:call-template>
			<xsl:call-template name="PUBLICATION-SETTINGS-FORM-CONTROL">
				<xsl:with-param name="name">vpsUser</xsl:with-param>
				<xsl:with-param name="inOneRow" select="$inOneRow"/>
				<xsl:with-param name="descriptionClass" select="$descriptionClass"/>
			</xsl:call-template>
			<xsl:call-template name="PUBLICATION-SETTINGS-FORM-CONTROL">
				<xsl:with-param name="name">vpsGroup</xsl:with-param>
				<xsl:with-param name="inOneRow" select="$inOneRow"/>
				<xsl:with-param name="descriptionClass" select="$descriptionClass"/>
			</xsl:call-template>
			<xsl:call-template name="PUBLICATION-SETTINGS-FORM-CONTROL">
				<xsl:with-param name="name">workDir</xsl:with-param>
				<xsl:with-param name="inOneRow" select="$inOneRow"/>
				<xsl:with-param name="descriptionClass" select="$descriptionClass"/>
			</xsl:call-template>
			<xsl:call-template name="PUBLICATION-SETTINGS-FORM-CONTROL">
				<xsl:with-param name="name">siteUrl</xsl:with-param>
				<xsl:with-param name="inOneRow" select="$inOneRow"/>
				<xsl:with-param name="descriptionClass" select="$descriptionClass"/>
			</xsl:call-template>
		</table>
	</xsl:template>
	
	<xsl:template match="PUBLICATION-SETTINGS-FORM" mode="INIT-JS">
		<script type="text/javascript" src="/js/publication_settings.js?{$version}.{$build}"></script>
		<script type="text/javascript" language="javascript">
			self.sbPublicationSettingsForm = new SbPublicationSettingsForm(sbNavigationObject);
		</script>
	</xsl:template>

	<xsl:template match="@HIDDEN" mode="publicationSettings">
		<xsl:attribute name="style">display: none;</xsl:attribute>
	</xsl:template>

	<xsl:template name="PUBLICATION-SETTINGS-FORM-CONTROL">
		<xsl:param name="name"/>
		<xsl:param name="inOneRow"/>
		<xsl:param name="descriptionClass"/>
		
		<xsl:if test="CONTROL[@NAME=$name]">
			<tr id="{$name}Row">
				<xsl:apply-templates select="CONTROL[@NAME=$name]/@HIDDEN" mode="publicationSettings"/>
				<td style="padding: 8px 0px 0px 8px;">
					<xsl:apply-templates select="CONTROL[@NAME=$name]" mode="TITLE-LEFT">
						<xsl:with-param name="controlClass">sb-control-input-input</xsl:with-param>
						<xsl:with-param name="rowClass">sb-formview-row</xsl:with-param>
						<xsl:with-param name="descriptionClass" select="$descriptionClass"/>
						<xsl:with-param name="inOneRow" select="$inOneRow"/>
						<xsl:with-param name="onChange">self.sbApplyChangesObject.registerChange(); sbPublicationSettingsForm.onChange();</xsl:with-param>
					</xsl:apply-templates>
				</td>
			</tr>
		</xsl:if>
	</xsl:template>

	<xsl:template match="REVERT-PUBLICATION-SETTINGS-FORM">
		<xsl:param name="blockClass"/>
		<xsl:param name="disabledDescriptionClass"/>

		<table cellpadding="0" cellspacing="0" border="0" class="{$blockClass}">
			<tr>
				<td style="padding: 0 8px;">
					<xsl:call-template name="BUTTON-CONTROL">
						<xsl:with-param name="title"><xsl:value-of select="CONTROL[@NAME='revertSettings']/@CAPTION"/></xsl:with-param>
						<xsl:with-param name="id">revertSettings</xsl:with-param>
						<xsl:with-param name="action">sbPublicationSettingsForm.revertSettings();</xsl:with-param>
					</xsl:call-template>
				</td>
				<td style="padding-right: 8px;" id="revertSettingsText" class="sb-text">
					<xsl:value-of select="CONTROL[@NAME='revertSettings']/@DISABLED-TITLE"/>
				</td>
			</tr>
		</table>
		<script type="text/javascript" language="javascript">
			var revertSettingsButton = self.document.getElementById('revertSettings');
			revertSettingsButton.textContainer = self.document.getElementById('revertSettingsText');
			revertSettingsButton.disabledTextClass = '<xsl:value-of select="$disabledDescriptionClass"/>';
			revertSettingsButton.enabledTextClass = 'sb-text';
			revertSettingsButton.disabledText = '<xsl:value-of select="CONTROL[@NAME='revertSettings']/@DISABLED-TITLE"/>';
			revertSettingsButton.enabledText = '<xsl:value-of select="CONTROL[@NAME='revertSettings']/@TITLE"/>';
			disableButton(revertSettingsButton);
			revertSettingsButton.textContainer.className = revertSettingsButton.disabledTextClass;
			revertSettingsButton.textContainer.innerHTML = htmlSpecialChars(revertSettingsButton.disabledText);
			self.sbPublishStepManager.restoreRevertSettings();
			<xsl:apply-templates select="CONTROL[@NAME='revertSettings']/@SETTINGS-CHANGED" mode="publicationSettings"/>
		</script>
	</xsl:template>
	
	<xsl:template match="CONTROL[@NAME='revertSettings']/@SETTINGS-CHANGED" mode="publicationSettings">
		revertSettingsButton.revertMode = 'submit';
		enableButton(revertSettingsButton);
		revertSettingsButton.textContainer.className = revertSettingsButton.enabledTextClass;
		revertSettingsButton.textContainer.innerHTML = htmlSpecialChars(revertSettingsButton.enabledText);
	</xsl:template>

</xsl:stylesheet>