<?xml version="1.0"?>
<!-- edited with XML Spy v2.5 NT  - http://www.xmlspy.com -->
<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="Title">Paramétrage Modèles et Motorisations</xsl:with-param>
			<xsl:with-param name="Head">
				<META HTTP-EQUIV="imagetoolbar" CONTENT="no"/>
				<script language="javascript">
					<![CDATA[function handleNumberKeyPress(e) {
  var keyCode = GetEventKeyCode(e);
  if (keyCode != 13)
    return true;
  return false;
}

function onKeyTestCR(e) {
  var aKey = window.event ? e.keyCode : e.which;
  if (aKey == 13) {
    goSubmit(); 
    }
}
]]>
				</script>
				<script language="javascript">
					<![CDATA[// 
// Valider les paramètres d'appel et lancement Submit
// 
function goSubmit() {
 aVal=parseInt(getObjectById('CBMARQUE').value);
 if (aVal==-1) {
      SetFocus(getObjectById('CBMARQUE'));
      return false
   } ;
document.aMainForm.submit(); 
return false;
}]]>
				</script>
			</xsl:with-param>
			<xsl:with-param name="ToolbarButtonsLeft">
				<ToolbarButton>
					<xsl:call-template name="ToolButtonRefresh"/>
				</ToolbarButton>
			</xsl:with-param>
			<xsl:with-param name="ToolbarButtonsRight">
				<xsl:call-template name="CommonToolbarButtonsRight"/>
			</xsl:with-param>
			<xsl:with-param name="Body">
				<xsl:call-template name="xslc:TabControl">
					<xsl:with-param name="Width" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">625</xsl:with-param>
					<xsl:with-param name="Page">
						<xsl:call-template name="xslc:ApplicationMessages"/>
						<div id="zoneTAB">
							<ul class="nicetab">
								<xsl:if test="/document/XMLC_Params/XMLC_Supervisor = '1' ">
									<li>
										<a href="Security">Utilisateurs</a>
									</li>
								</xsl:if>
								<li class="selected">
									<a href="OptVersions">Modèles et Motorisations</a>
								</li>
								<xsl:if test="/document/XMLC_Params/XMLC_Supervisor = '1' ">
									<li>
										<a href="Options">Options</a>
									</li>
								</xsl:if>
								<li>
									<a href="About">A Propos</a>
								</li>
							</ul>
						</div>
						<form action="{/document/Aliases/bdVODLL}OptVersions" name="aMainForm" method="post">
							<input type="hidden" name="SelMarque" value="{/document/OutParams/SelMarque}"/>
							<input type="hidden" name="SelModele" value="{/document/OutParams/SelModele}"/>
						</form>
						<xsl:apply-templates select="ListVersionsS"/>
						<xsl:call-template name="xslc:PoweredBy"/>
					</xsl:with-param>
				</xsl:call-template>
			</xsl:with-param>
		</xsl:call-template>
	</xsl:template>
	<xsl:template match="ListVersionsS">
		<xsl:variable name="svConcession">
			<xsl:value-of select="/document/XMLC_Params/UserConcession"/>
		</xsl:variable>
		<xsl:variable name="svMarque">
			<xsl:value-of select="/document/OutParams/SelMarque"/>
		</xsl:variable>
		<xsl:variable name="svModele">
			<xsl:value-of select="/document/OutParams/SelModele"/>
		</xsl:variable>
		<div id="zoneTOP">
			<table width="50px">
				<tr>
					<td width="65px" align="right">Marque : </td>
					<td width="145px">
						<select id="CBMARQUE" style="width:125px" onchange="javascript: document.aMainForm.SelMarque.value=getObjectById('CBMARQUE').value; goSubmit(); return false;">
							<option value="">
								<xsl:if test="/document/OutParams/SelMarque=''">Choix Marque</xsl:if>
							</option>
							<xsl:for-each select="/document/ListMarquesS/ListMarques">
								<xsl:sort select="vMarque"/>
								<option value="{vMarque}">
									<xsl:if test="/document/OutParams/SelMarque=vMarque">
										<xsl:attribute name="selected"/>
									</xsl:if>
									<xsl:value-of select="vMarque"/>
								</option>
							</xsl:for-each>
						</select>
					</td>
					<td width="65px" align="right">Modèle : </td>
					<td width="145px">
						<select id="CBMODELE" style="width:125px" onchange="javascript: document.aMainForm.SelModele.value=getObjectById('CBMODELE').value; goSubmit(); return false;">
							<option value="">
								<xsl:if test="/document/OutParams/SelModele=''">Choix Modèle</xsl:if>
							</option>
							<xsl:for-each select="/document/ListModelsS/ListModels">
								<xsl:sort select="vModele"/>
								<option value="{vModele}">
									<xsl:if test="/document/OutParams/SelModele=vModele">
										<xsl:attribute name="selected"/>
									</xsl:if>
									<xsl:value-of select="vModele"/>
								</option>
							</xsl:for-each>
						</select>
					</td>
				</tr>
			</table>
		</div>
		<table border="0" cellpadding="2" cellspacing="0" class="clFlatTable" width="500px">
			<form name="FormDeleteListVersions" method="POST" action="{/document/Aliases/bdVODLL}DeleteOptVersions">
				<input type="hidden" name="ListVersions_STARTINGROW" value="{@StartingRow}"/>
				<input type="hidden" name="NextAction" value="OptVersions"/>
				<input type="hidden" name="vConcession"/>
				<input type="hidden" name="vMarque"/>
				<input type="hidden" name="vModele"/>
				<input type="hidden" name="vVersion"/>
			</form>
			<form name="MainForm" method="POST" action="{/document/Aliases/bdVODLL}UpdateOptVersions">
				<input type="hidden" name="XMLC_Pivot" value="ListVersions"/>
				<input type="hidden" name="ListVersions_STARTINGROW" value="{@StartingRow}"/>
				<input type="hidden" name="NextAction" value="OptVersions"/>
				<tr class="clRowHeader">
					<xsl:if test="/document/XMLC_Profile/XMLC_DisplayHeaderGradient = '1'">
						<xsl:attribute name="style">background-image: url('<xsl:value-of select="$XMLC_SkinPath"/>rowHeader_Gradient.gif');</xsl:attribute>
					</xsl:if>
					<td width="200px">Modèle</td>
					<td width="200px">Motorisation</td>
					<td width="100px">nb Mois Appro</td>
					<td style="width: 12px;">
						<input type="image" border="0" src="{$XMLC_PictosPath}ico_Check.gif" alt="Save"/>
					</td>
				</tr>
				<xsl:apply-templates select="ListVersions"/>
			</form>
			<xsl:if test="/document/XMLC_Params/XMLC_Authenticated != '0' and (/document/XMLC_Params/XMLC_Supervisor = '1' or /document/XMLC_Params/User_RVN = '1' )">
				<form name="FormInsertListVersions" method="POST" action="{/document/Aliases/bdVODLL}InsertOptVersions">
					<input type="hidden" name="ListVersions_STARTINGROW" value="{@StartingRow}"/>
					<input type="hidden" name="NextAction" value="OptVersions"/>
					<tr class="clRowHeader">
						<td>
							<input type="hidden" name="vConcession" value="{$svConcession}"/>
							<input type="hidden" name="vMarque" value="{$svMarque}"/>
							<input type="text" name="vModele" value="{$svModele}"/>
						</td>
						<td>
							<input type="text" name="vVersion"/>
						</td>
						<td>
							<input type="text" name="vNbMoisAppro"/>
						</td>
						<td>
							<a href="." onclick="document.FormInsertListVersions.submit(); return false;">
								<img border="0" src="{$XMLC_PictosPath}ico_xplus.gif" alt="Insert this new record"/>
							</a>
						</td>
					</tr>
				</form>
			</xsl:if>
			<tr class="clDataGridLight">
				<td colspan="4" align="right">
					<xsl:call-template name="xslc:ButtonPad"/>
				</td>
			</tr>
		</table>
	</xsl:template>
	<xsl:template match="ListVersions">
		<xsl:variable name="clValue">
			<xsl:choose>
				<xsl:when test="(position() mod 2)=0">clDataGridDark</xsl:when>
				<xsl:otherwise>clDataGridLight</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<tr class="{$clValue}">
			<td>
				<input type="hidden" name="ListVersions[{position()}].vConcession" value="{vConcession}"/>
				<input type="hidden" name="ListVersions[{position()}].vMarque" value="{vMarque}"/>
				<input type="text" name="ListVersions[{position()}].vModele" value="{vModele}"/>
			</td>
			<td>
				<input type="text" name="ListVersions[{position()}].vVersion" value="{vVersion}"/>
			</td>
			<td align="right">
				<input type="text" name="ListVersions[{position()}].vNbMoisAppro" value="{vNbMoisAppro}"/>
			</td>
			<td class="clRowHeader">
				<xsl:if test="/document/XMLC_Params/XMLC_Authenticated != '0' and (/document/XMLC_Params/XMLC_Supervisor = '1' or /document/XMLC_Params/User_RVN = '1' )">
					<a href="." onclick="document.FormDeleteListVersions.vConcession.value='{vConcession}'; 
document.FormDeleteListVersions.vMarque.value='{vMarque}'; 
document.FormDeleteListVersions.vModele.value='{vModele}'; 
document.FormDeleteListVersions.vVersion.value='{vVersion}'; 
document.FormDeleteListVersions.submit(); return false;">
						<img border="0" src="{$XMLC_PictosPath}ico_xminus.gif" alt="Delete this record"/>
					</a>
				</xsl:if>
			</td>
		</tr>
	</xsl:template>
</xsl:stylesheet>
