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

<xsl:template match="OBJECT[@TYPE='USER']">
	<style>
		.sb-pagetitle { border-bottom: solid 1px #776655; }
	</style>
<script type="text/javascript" src="/js/Admin/Users.js?{$version}.{$build}"/>
<form name="objectForm" method="post" action="{$baseUrl}" onsubmit="submitForm(); return false;">
<input type="hidden" id="action" name="action" value="/Admin/User/Save"/>
<input type="hidden" name="userId">
	<xsl:attribute name="value"><xsl:value-of select="CONTROL[@NAME='id']/@VALUE"/></xsl:attribute>
</input>

<fieldset class="sb-form-fieldset">
	<legend>
        <b class="sb-text sb-page"><xsl:value-of select="@TITLE"/></b>
    </legend>
	<table border="0" width="100%" cellpadding="2" cellspacing="0">
		<tr>
			<td class="sb-formview-alternaterow">
				<xsl:apply-templates select="CONTROL[@NAME='firstName']" mode="TITLE-LEFT">
					<xsl:with-param name="controlClass">sb-control-input-input</xsl:with-param>
					<xsl:with-param name="require">on</xsl:with-param>
					<xsl:with-param name="onChange">self.sbApplyChangesObject.registerChange();</xsl:with-param>
				</xsl:apply-templates>
			</td>
		</tr>
		<tr>
			<td class="sb-formview-row">
				<xsl:apply-templates select="CONTROL[@NAME='lastName']" mode="TITLE-LEFT">
					<xsl:with-param name="controlClass">sb-control-input-input</xsl:with-param>
					<xsl:with-param name="require">on</xsl:with-param>
					<xsl:with-param name="onChange">self.sbApplyChangesObject.registerChange();</xsl:with-param>
				</xsl:apply-templates>
			</td>
		</tr>
		<tr>
			<td class="sb-formview-alternaterow">
				<xsl:apply-templates select="CONTROL[@NAME='userName']" mode="TITLE-LEFT">
					<xsl:with-param name="controlClass">sb-control-input-input</xsl:with-param>
					<xsl:with-param name="disabled">1</xsl:with-param>
					<xsl:with-param name="onChange">self.sbApplyChangesObject.registerChange();</xsl:with-param>
				</xsl:apply-templates>
			</td>
		</tr>

		<!--tr id="rowSetPassword">
			<td align="right" class="sb-formview-row">
				<div style="width:50%" align="left">
				<xsl:call-template name="BUTTON-CONTROL">
					<xsl:with-param name="class">sb-login-control-button</xsl:with-param>
					<xsl:with-param name="title"><xsl:value-of select="/SITEBUILDER-PAGE/LOCALE/CHANGE-PASSWORD"/></xsl:with-param>
					<xsl:with-param name="action">showPassword();</xsl:with-param>
				</xsl:call-template>
				</div>
			</td>
		</tr-->
		
		<tr id="rowSetPassword" class="sb-formview-row">
			<td>
				<table cellspacing="0" cellpadding="0" border="0" style="width: 100%; table-layout: fixed;">
					<tbody>
						<tr class="">
							<td style="width: 50%;">&#160;</td>
							<td style="">
								<xsl:call-template name="BUTTON-CONTROL">
									<xsl:with-param name="class">sb-login-control-button</xsl:with-param>
									<xsl:with-param name="title"><xsl:value-of select="/SITEBUILDER-PAGE/LOCALE/CHANGE-PASSWORD"/></xsl:with-param>
                                    <xsl:with-param name="action">showPassword(<xsl:value-of select="CONTROL[@NAME='ssoIsAppOwner']/@VALUE" />, &quot;<xsl:value-of select="CONTROL[@NAME='passwordChangeUrl']/@VALUE" />&quot;);</xsl:with-param>
								</xsl:call-template>
							</td>
						</tr>
					</tbody>
				</table>
			</td>
		</tr>
		

		<tr id="rowPassword" style="display: none;">
			<td class="sb-formview-row">
				<xsl:call-template name="INPUT-CONTROL" mode="TITLE-LEFT">
					<xsl:with-param name="controlClass">sb-control-input-input</xsl:with-param>
					<xsl:with-param name="title"><xsl:value-of select="/SITEBUILDER-PAGE/LOCALE/PASSWORD"/></xsl:with-param>
					<xsl:with-param name="name">password</xsl:with-param>
					<xsl:with-param name="id">password</xsl:with-param>
					<xsl:with-param name="type">password</xsl:with-param>
					<xsl:with-param name="require">on</xsl:with-param>
					<xsl:with-param name="onChange">self.sbApplyChangesObject.registerChange();</xsl:with-param>
				</xsl:call-template>
			</td>
		</tr>
		<tr id="rowPasswordConfirm" style="display: none;">
			<td class="sb-formview-alternaterow">
				<xsl:call-template name="INPUT-CONTROL" mode="TITLE-LEFT">
					<xsl:with-param name="controlClass">sb-control-input-input</xsl:with-param>
					<xsl:with-param name="title"><xsl:value-of select="/SITEBUILDER-PAGE/LOCALE/CONFIRM-PASSWORD"/></xsl:with-param>
					<xsl:with-param name="name">confirmPassword</xsl:with-param>
					<xsl:with-param name="id">confirmPassword</xsl:with-param>
					<xsl:with-param name="type">password</xsl:with-param>
					<xsl:with-param name="require">on</xsl:with-param>
					<xsl:with-param name="onChange">self.sbApplyChangesObject.registerChange();</xsl:with-param>
				</xsl:call-template>
			</td>
		</tr>
		<tr>
			<td class="sb-formview-row">
				<xsl:apply-templates select="CONTROL[@NAME='email']" mode="TITLE-LEFT">
					<xsl:with-param name="controlClass">sb-control-input-input</xsl:with-param>
					<xsl:with-param name="require">on</xsl:with-param>
					<xsl:with-param name="onChange">self.sbApplyChangesObject.registerChange();</xsl:with-param>
				</xsl:apply-templates>
			</td>
		</tr>
		<tr>
			<td class="sb-formview-alternaterow">
				<xsl:apply-templates select="CONTROL[@NAME='planId' and @TYPE='COMBO-BOX']" mode="TITLE-LEFT">
					<xsl:with-param name="controlClass">sb-control-input-input</xsl:with-param>
					<xsl:with-param name="onChange">self.sbApplyChangesObject.registerChange();</xsl:with-param>
				</xsl:apply-templates>
			</td>
		</tr>
	</table>
</fieldset>
<!-- input image needed for work default submit via Enter -->
<input type="image" style="border-width: 0px; height: 0px; width: 0px;"/>
</form>

<table border="0" cellpadding="0" cellspacing="0" width="100%">
	<tr>
		<td align="left" style="padding-left: 5px"><xsl:call-template name="REQUIRED-FIELDS"/></td>
		<td>
			<xsl:call-template name="OK-CANCEL-BUTTONS">
				<xsl:with-param name="okAction">submitForm();</xsl:with-param>
				<xsl:with-param name="cancelAction">document.location.href="<xsl:value-of select="$baseUrl"/>/Admin/User/List";</xsl:with-param>
			</xsl:call-template>
		</td>
	</tr>
</table>



<script type="text/javascript">
function showPassword(isLocalUser, passwordChangeUrl) {
	if (!isLocalUser) {
		try { window.open(passwordChangeUrl,'_blank'); } 
		catch(e) { };
		return false;
	}
	showElement(document.getElementById("rowPassword"), true);
	showElement(document.getElementById("rowPasswordConfirm"), true);
	showElement(document.getElementById("rowSetPassword"), false);
	return false;
}
</script>
</xsl:template>

</xsl:stylesheet>