<?xml version="1.0" encoding="ISO-8859-15"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xslc="http://xslcomponents.org/TR/WD-xslc" xmlns:msxsl="urn:schemas-microsoft-com:xslt">
<xsl:template name="ProfileItem">
<xsl:param name="Name" select="Name"/>
<xsl:param name="id">
<xsl:choose>
<xsl:when test="ID">
<xsl:value-of select="ID"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$Name"/>
</xsl:otherwise>
</xsl:choose>
</xsl:param>
<xsl:param name="DisplayProfileFieldName" select="/document/XMLC_Params/XMLC_Supervisor"/>
<xsl:param name="Permissions" select="Permissions"/>
<xsl:param name="HideItem" select="HideItem"/>
<xsl:param name="ImageName" select="ImageName"/>
<xsl:param name="ImagePath" select="ImagePath"/>
<xsl:param name="Locale">
<xsl:choose>
<xsl:when test="Locale">
<xsl:value-of select="Locale/*[name() = /document/XMLC_Params/XMLC_Language]"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="/document/Locales/*[name() = $Name]"/>
</xsl:otherwise>
</xsl:choose>
</xsl:param>
<xsl:param name="OnChange"/>
<xsl:param name="Options">
<xsl:choose>
<xsl:when test="Options/*">
<xsl:copy-of select="Options/*"/>
</xsl:when>
<xsl:otherwise>
<Dummy/>
</xsl:otherwise>
</xsl:choose>
</xsl:param>
<xsl:param name="Permission">
<xsl:choose>
<xsl:when test="Permission = 'Supervisor' and /document/XMLC_Params/XMLC_Supervisor != '1'">0</xsl:when>
<xsl:when test="Permission = 'Administrator' and (/document/XMLC_Params/XMLC_Administrator != '1' and /document/XMLC_Params/XMLC_Supervisor != '1')">0</xsl:when>
<xsl:otherwise>1</xsl:otherwise>
</xsl:choose>
</xsl:param>
<xsl:param name="Size" select="Size"/>
<xsl:param name="Type" select="Type"/>
<xsl:variable name="Image">
<img align="absmiddle">
<xsl:attribute name="src"><xsl:choose><xsl:when test="ImageName != ''"><xsl:value-of select="$XMLC_PictosPath"/><xsl:value-of select="$ImageName"/></xsl:when><xsl:otherwise><xsl:value-of select="$ImagePath"/></xsl:otherwise></xsl:choose></xsl:attribute>
</img>
</xsl:variable>
<xsl:variable name="VOptions" select="msxsl:node-set($Options)"/>
<xsl:choose>
<xsl:when test="($Permissions = 'System') and (/document/XMLC_Params/XMLC_Administrator != '1') and (/document/XMLC_Params/XMLC_Supervisor != '1')"/>
<xsl:when test="($Permissions = 'Deprecated') and (/document/XMLC_Params/XMLC_Supervisor != '1')"/>
<xsl:otherwise>
<tr>
<xsl:if test="$id != ''">
<xsl:attribute name="id"><xsl:value-of select="$id"/></xsl:attribute>
</xsl:if>
<xsl:if test="$HideItem = '1'">
<xsl:attribute name="style">display: none;</xsl:attribute>
</xsl:if>
<td align="center" nowrap="">
<xsl:choose>
<xsl:when test="($ImageName != '') or ($ImagePath != '')">
<xsl:copy-of select="$Image"/>
</xsl:when>
<xsl:otherwise>&#160;</xsl:otherwise>
</xsl:choose>
</td>
<td width="100%">
<xsl:choose>
<xsl:when test="$Type = 'Input'">
<input type="text" name="Profile.{$Name}" value="{/document/XMLC_Profile/*[name() = $Name]}" class="clFlatTextInput" size="{$Size}"/>&#160;<xsl:value-of select="$Locale"/>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="($VOptions/Option) or ($VOptions/option) or ($VOptions != '')">
<select name="Profile.{$Name}">
<xsl:if test="$OnChange != ''">
<xsl:attribute name="onchange"><xsl:value-of select="$OnChange"/></xsl:attribute>
</xsl:if>
<xsl:choose>
<xsl:when test="$VOptions/Option">
<xsl:variable name="CurrentValue" select="/document/XMLC_Profile/*[name() = $Name]"/>
<xsl:for-each select="$VOptions/Option">
<xsl:variable name="Value" select="@Value"/>
<xsl:variable name="LocaleName">
<xsl:value-of select="$Name"/>
<xsl:choose>
<xsl:when test="@Locale">
<xsl:value-of select="@Locale"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$Value"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<option value="{$Value}">
<xsl:if test="$CurrentValue = $Value">
<xsl:attribute name="selected"/>
</xsl:if>
<xsl:choose>
<xsl:when test="$Value = ''"/>
<xsl:when test="/document/Locales/*[name() = $LocaleName]">
<xsl:value-of select="/document/Locales/*[name() = $LocaleName]"/>
</xsl:when>
<xsl:when test="Locale">
<xsl:value-of select="Locale/*[name() = /document/XMLC_Params/XMLC_Language]"/>
</xsl:when>
<xsl:when test="@Locale">
<xsl:value-of select="@Locale"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$Value"/>
</xsl:otherwise>
</xsl:choose>
</option>
</xsl:for-each>
</xsl:when>
<xsl:when test="$Options/option or $Options != ''">
<xsl:copy-of select="$Options"/>
</xsl:when>
<xsl:otherwise>
<option value="0">
<xsl:value-of select="/document/Locales/FalseCaption"/>
</option>
<option value="1">
<xsl:if test="/document/XMLC_Profile/*[name() = $Name] = '1'">
<xsl:attribute name="selected"/>
</xsl:if>
<xsl:value-of select="/document/Locales/TrueCaption"/>
</option>
</xsl:otherwise>
</xsl:choose>
</select>&#160;<xsl:value-of select="$Locale"/>
</xsl:when>
<xsl:otherwise>
<xsl:variable name="Value" select="/document/XMLC_Profile/*[name() = $Name]"/>
<input id="Profile.{$Name}" type="hidden" name="Profile.{$Name}" value="{$Value}"/>
<input id="{$id}.check" type="checkbox" onclick="if (this.checked) SetField('MainForm', 'Profile.{$Name}', '1'); else SetField('MainForm', 'Profile.{$Name}', '0'); ">
<xsl:if test="$Value = '1'">
<xsl:attribute name="checked"/>
</xsl:if>
</input>&#160;<label for="{$id}.check">
<xsl:value-of select="$Locale"/>
</label>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</td>
<xsl:if test="$DisplayProfileFieldName = '1'">
<td>[<a href="{/document/Aliases/XMLRADDLL}FormProfileItem?ProjectName={/document/XMLC_Params/XMLC_InstanceName}&amp;ProfileItemName={$Name}">
<xsl:value-of select="$Name"/>
</a>]</td>
</xsl:if>
</tr>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
