<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xslc="http://xslcomponents.org/TR/WD-xslc">
	<xsl:import href="../../xslc.xsl"/>
	<xsl:import href="../../Common.xsl"/>
	<xsl:template match="/">
		<xsl:apply-templates select="document"/>
	</xsl:template>
	<xsl:template match="document">
		<xsl:call-template name="xslc:Page">
			<xsl:with-param name="DisplayToolbar">1</xsl:with-param>
			<xsl:with-param name="DisplayTabControl">0</xsl:with-param>
			<xsl:with-param name="DisplayTabs">0</xsl:with-param>
			<xsl:with-param name="DisplayActionMenu">
				<xsl:if test="/document/OutParams/AmMode='0'">2</xsl:if>
				<xsl:if test="/document/OutParams/AmMode!='0'">1</xsl:if>
			</xsl:with-param>
			<xsl:with-param name="Head"/>
			<xsl:with-param name="ActionMenu">
				<xsl:if test="/document/XMLC_Params/XMLC_UserName != '' ">
					<xsl:call-template name="xslc:VOActionPanel">
						<xsl:with-param name="Expanded">1</xsl:with-param>
						<xsl:with-param name="Dark">1</xsl:with-param>
						<xsl:with-param name="Name">FiltAffichage</xsl:with-param>
						<xsl:with-param name="Title">Paramètres</xsl:with-param>
						<xsl:with-param name="Content">
							<xsl:variable name="idAffSel">
								<xsl:if test="/document/OutParams/AffSel=''">0</xsl:if>
								<xsl:value-of select="/document/OutParams/AffSel"/>
							</xsl:variable>
							<table cellpadding="2" cellspacing="0">
								<xsl:for-each select="/document/ListFiltersS/ListFilters">
									<xsl:variable name="apOver">
										<xsl:if test="idAffichage='-1' or nService=''">apRowNoSelected</xsl:if>
										<xsl:if test="idAffichage!='-1'">apRowSelected</xsl:if>
									</xsl:variable>
									<xsl:variable name="apAttr">
										<xsl:if test="idAffichage='-1' or nService=''">color:#A0A0A0;</xsl:if>
										<xsl:if test="'Security'=nService">
											<xsl:if test="AttrColor!=''">color:#<xsl:value-of select="AttrColor"/>; font-weight: bold;</xsl:if>
											<xsl:if test="AttrColor=''">color:#3f3dfd; </xsl:if>
										</xsl:if>
										<xsl:if test="idAffichage!='-1' and /document/XMLC_Params/XMLC_Action!=nService and nService!=''">
											<xsl:if test="AttrColor=''">color:#145aa2; </xsl:if>
											<xsl:if test="AttrColor!=''">color:#<xsl:value-of select="AttrColor"/>; </xsl:if>
										</xsl:if>
									</xsl:variable>
									<xsl:variable name="nServ">
										<xsl:value-of select="nService"/>
									</xsl:variable>
									<xsl:if test="idAffichage!='-2'">
										<tr>
											<td class="apLink" onmouseover="oldClass=this.className; this.className='{$apOver}';" onmouseout="this.className=oldClass;" onclick="javascript: goService('{$nServ}'); return false;" align="left" style="{$apAttr} width:200px;">
												<span style="color:#d0d0ff;">
													<xsl:if test="AttrIndent='1'">» </xsl:if>
													<xsl:if test="AttrIndent='2'">»» </xsl:if>
													<xsl:if test="AttrIndent='3'">»»» </xsl:if>
												</span>
												<xsl:if test="/document/XMLC_Params/XMLC_Action=nService">
													<img border="0" src="{$XMLC_PictosPath}ico_run.gif"/> - </xsl:if>
												<xsl:value-of select="FilterName"/>
											</td>
										</tr>
									</xsl:if>
								</xsl:for-each>
							</table>
						</xsl:with-param>
					</xsl:call-template>
				</xsl:if>
			</xsl:with-param>
			<xsl:with-param name="Title">
				<xsl:value-of select="/document/ListFiltersS/ListFilters[nService=/document/XMLC_Params/XMLC_Action]/FilterName"/>
			</xsl:with-param>
			<xsl:with-param name="ToolbarButtonsLeft">
				<ToolbarButton>
					<xsl:call-template name="ToolButtonRefresh">
						<xsl:with-param name="URL">
							<xsl:value-of select="/document/Aliases/bdVODLL"/>FormUser?SelGroup=<xsl:value-of select="/document/OutParams/SelGroup"/>&amp;User_ID=<xsl:value-of select="/document/OutParams/User_ID"/>
						</xsl:with-param>
					</xsl:call-template>
				</ToolbarButton>
				<ToolbarButton>
					<img border="0" src="{$XMLC_SkinPath}toolbar_separator.gif"/>
				</ToolbarButton>
				<xsl:call-template name="CommonToolbarButtonsLeft"/>
			</xsl:with-param>
			<xsl:with-param name="ToolbarButtonsRight">
				<xsl:call-template name="VOLineToolbarButtonsRight"/>
			</xsl:with-param>
			<xsl:with-param name="Body">
				<xsl:call-template name="xslc:ApplicationMessages"/>
				<xsl:call-template name="VOZoneTab">
					<xsl:with-param name="nService">OptParams</xsl:with-param>
				</xsl:call-template>
				<div id="zoneTOP">
					<p style="font-size:16px">Utilisateur : <xsl:value-of select="/document/User/Name"/>
					</p>
				</div>
				<xsl:apply-templates select="User"/>
				<xsl:call-template name="xslc:PoweredBy"/>
			</xsl:with-param>
		</xsl:call-template>
	</xsl:template>
	<xsl:template match="User">
		<form name="MainForm" method="POST" action="{/document/Aliases/SecurityDLL}UpdateUser">
			<xsl:variable name="vConcession">
				<xsl:if test="UserConcession != '' ">
					<xsl:value-of select="UserConcession"/>
				</xsl:if>
				<xsl:if test="UserConcession = '' ">
					<xsl:value-of select="/document/XMLC_Params/UserConcession"/>
				</xsl:if>
			</xsl:variable>
			<br/>
			<input type="hidden" name="ID" value="{ID}"/>
			<input type="hidden" name="Group_ID"/>
			<input type="hidden" name="InfoNextAction" value="FormUser"/>
			<input type="hidden" name="Password" value="{Password}"/>
			<table border="0" cellpadding="2" cellspacing="0" width="100%">
				<tr>
					<td nowrap="">
						<b>Utilisateur :</b>
					</td>
					<td style="padding-left: 10px">
						<input type="text" class="clFlatTextInput" name="Name" size="45" value="{Name}"/>
					</td>
					<td align="left">
						<xsl:call-template name="xslc:ToolbarButton">
							<xsl:with-param name="Caption">
								<img alt="contacter par mail" border="0" src="{$XMLC_PictosPath}button_email.gif"/>
							</xsl:with-param>
							<xsl:with-param name="HRef">mailto:<xsl:value-of select="/document/User/Name"/>
							</xsl:with-param>
						</xsl:call-template>
					</td>
				</tr>
				<tr>
					<td nowrap="">
						<b>Groupe :</b>
					</td>
					<td style="padding-left: 10px">
						<xsl:if test="/document/XMLC_Params/XMLC_Supervisor = '1' ">
							<input type="text" class="clFlatTextInput" name="cUserConcession" size="45" value="{$vConcession}"/>
						</xsl:if>
						<xsl:if test="/document/XMLC_Params/XMLC_Supervisor != '1' ">
							<input type="hidden" name="cUserConcession" value="{$vConcession}"/>
							<xsl:value-of select="$vConcession"/>
						</xsl:if>
					</td>
					<td width="100%"/>
				</tr>
				<tr>
					<td nowrap="">
						<b>Site(s) :</b>
					</td>
					<td style="padding-left: 10px">
						<input type="text" class="clFlatTextInput" name="cUserSite" size="45" value="{UserSite}"/>
					</td>
					<td width="100%"/>
				</tr>
			</table>
			<br/>
			<br/>
			<table>
				<tr>
					<td>
						<xsl:call-template name="xslc:ButtonPad"/>
					</td>
					<td width="20px"/>
					<td>
						<xsl:call-template name="xslc:Button">
							<xsl:with-param name="HRef">CLEARPassWord?ID=<xsl:value-of select="/document/Params/ID"/>
							</xsl:with-param>
							<xsl:with-param name="Caption">
								<span>
									<b>Effacer le Mot de Passe</b>
								</span>
							</xsl:with-param>
						</xsl:call-template>
					</td>
					<td>
						<xsl:if test="/document/User/DSession!=''"> - Dernière Session : <xsl:value-of select="/document/User/DSession"/>
						</xsl:if>
					</td>
				</tr>
			</table>
			<br/>
			<br/>
		</form>
		<table border="0" cellpadding="2" cellspacing="0" width="600px">
			<tr valign="top">
				<td>
					<xsl:apply-templates select="Groups" mode="User"/>
				</td>
				<td>
					<xsl:apply-templates select="/document/Groups"/>
				</td>
			</tr>
		</table>
	</xsl:template>
	<xsl:template match="Groups" mode="User">
		<table cellspacing="0" class="clFlatTable" width="290px" border="0" cellpadding="2">
			<tr class="clRowHeader">
				<td colspan="2">Profil(s) de l'Utilisateur</td>
			</tr>
			<xsl:apply-templates select="Group" mode="User">
				<xsl:sort select="Name"/>
			</xsl:apply-templates>
		</table>
	</xsl:template>
	<xsl:template match="Group" mode="User">
		<tr>
			<xsl:attribute name="class">
				<xsl:choose>
					<xsl:when test="position() mod 2 = 1">clRowLight</xsl:when>
					<xsl:otherwise>clRowDark</xsl:otherwise>
				</xsl:choose>
			</xsl:attribute>
			<xsl:variable name="Group_ID">
				<xsl:value-of select="ID"/>
			</xsl:variable>
			<td width="12px" onclick="document.MainForm.Group_ID.value='{ID}'; document.MainForm.action='{/document/Aliases/SecurityDLL}RemoveGroupFromUser';document.MainForm.submit(); return false;">
				<img alt="Suppression du profil" border="0" src="{$XMLC_PictosPath}ico_xminus.gif"/>
			</td>
			<td width="290px">
				<a href="{/document/Aliases/SecurityDLL}FormGroup?Group_ID={$Group_ID}">
					<xsl:value-of select="Name"/>
				</a>
			</td>
		</tr>
	</xsl:template>
	<xsl:template match="/document/Groups">
		<table border="0" cellpadding="2" cellspacing="0" class="clFlatTable" width="290px">
			<tr class="clRowHeader">
				<td colspan="2">Liste des Profils</td>
				<xsl:apply-templates select="/document/Groups/Group">
					<xsl:sort select="Name"/>
				</xsl:apply-templates>
			</tr>
		</table>
	</xsl:template>
	<xsl:template match="/document/Groups/Group">
		<xsl:variable name="clValue">
			<xsl:choose>
				<xsl:when test="position() mod 2 = 1">clRowLight</xsl:when>
				<xsl:otherwise>clRowDark</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<tr class="{$clValue}">
			<td width="12px" onclick="document.MainForm.Group_ID.value='{ID}'; document.MainForm.action='{/document/Aliases/SecurityDLL}AddGroupToUser';document.MainForm.submit(); return false;">
				<img alt="Ajout du profil" border="0" src="{$XMLC_PictosPath}ico_xplus.gif"/>
			</td>
			<td width="290px">
				<a href="{/document/Aliases/SecurityDLL}FormGroup?Group_ID={ID}">
					<xsl:value-of select="Name"/>
				</a>
			</td>
		</tr>
	</xsl:template>
</xsl:stylesheet>
