<?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">
	<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="BodyAttributes">
				<Attributes style="background:url({$XMLC_Portal}Pictos/backframe.gif) repeat-x top left;"/>
			</xsl:with-param>
			<xsl:with-param name="Head">
				<script language="javascript">
var keyPress = '0';

function SubmitMainForm() {
  var File = GetFieldValue('MainForm', 'FileToAttach');
  if ((File != '') || (keyPress == '17'))
  {
    keyPress = '0';
    SubmitForm('MainForm');
    document.body.style.cursor = 'wait';
    Hide('divRequest');
    Show('divUpload');
    SubmitForm('ProgressForm');
  }
}

function goSubmit() {
  document.MainForm.submit(); 
  return false;
}

function getKeyDown(e){
  keyPress = (document.all)?event.keyCode:e.keyCode;
}
document.onkeydown=getKeyDown;
</script>
			</xsl:with-param>
			<xsl:with-param name="ActivePageName">UploadDatas</xsl:with-param>
			<xsl:with-param name="Body">
				<xsl:call-template name="xslc:ApplicationMessages"/>
				<form method="POST" name="MainForm" enctype="multipart/form-data" action="{/document/Aliases/bdVODLL}XMLC_UploadFile">
					<input type="hidden" name="NextAction" value="ImportDatasUpload"/>
					<input type="hidden" name="XMLC_RequestID" value="{/document/Params/XMLC_RequestID}"/>
					<table border="0" width="100%">
						<tr>
							<td colspan="2" width="100%">
								<input type="file" name="FileToAttach" style="width: 100%"/>
							</td>
						</tr>
						<tr>
							<td nowrap="" align="right" width="450px">Sélectionnez le fichier à télécharger :</td>
							<td align="right">
								<xsl:call-template name="xslc:Button">
									<xsl:with-param name="Caption">
										<img border="0" src="{$XMLC_PictosPath}button_save.gif" alt="AttachFileAlt"/>
									</xsl:with-param>
									<xsl:with-param name="OnClick">SubmitMainForm(); return false;</xsl:with-param>
								</xsl:call-template>
							</td>
						</tr>
					</table>
				</form>
				<form method="POST" name="uForm" action="{/document/Aliases/bdVODLL}UpLoadDatas">
					<input type="hidden" name="Filter"/>
					<table border="0" width="100%">
						<tr>
							<td nowrap="" width="420px" align="right">ou filtrez selon le type de demande :</td>
							<td>
								<select id="CBFilter" style="width:170px" onchange="javascript: document.uForm.Filter.value=getObjectById('CBFilter').value; document.uForm.submit(); return false;">
									<option value="">
										<xsl:if test="/document/Params/Filter=''">Choix Site</xsl:if>
										<xsl:if test="/document/Params/Filter!=''">Tous Sites</xsl:if>
									</option>
									<xsl:for-each select="/document/LogsFiltersS/LogsFilters">
										<option value="{Site}">
											<xsl:if test="/document/Params/Filter=Site">
												<xsl:attribute name="selected"/>
											</xsl:if>
											<xsl:value-of select="Site"/> (<xsl:value-of select="Cpt"/>)</option>
									</xsl:for-each>
								</select> - <a href="{/document/Aliases/bdVODLL}OptEquipsExt" target="_blank">
									<img alt="Paramétrage des options issues du 3270" border="0" src="{$XMLC_PictosPath}UpdateK.gif" width="20" height="20"/>
								</a>
							</td>
						</tr>
					</table>
				</form>
				<form name="ProgressForm" method="POST" target="frmProgress" action="{/document/Aliases/bdVODLL}XMLC_UploadProgress">
					<input type="hidden" name="XMLC_RequestID" value="{Params/XMLC_RequestID}"/>
					<input type="hidden" name="XMLC_GZIP" value="0"/>
				</form>
				<div id="divUpload" style="visibility: hidden; display: none;">
					<br/>
					<div style="padding: 5px; font-weight: bold;">Votre fichier est en cours de téléchargement<br/>Veuillez patienter, Merci d'avance...</div>
					<iframe frameborder="0" height="150" name="frmProgress" width="100%"/>
				</div>
				<div id="divRequest">
					<br/>
					<xsl:apply-templates select="LogsRequestS"/>
				</div>
				<xsl:call-template name="xslc:PoweredBy"/>
			</xsl:with-param>
		</xsl:call-template>
	</xsl:template>
	<xsl:template match="LogsRequestS">
		<table border="0" cellpadding="2" cellspacing="0" class="clFlatTable" width="100%">
			<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 colspan="2">Import</td>
				<td>Date</td>
				<td>Fichier</td>
				<td>Statistiques</td>
			</tr>
			<xsl:apply-templates select="LogsRequest"/>
			<xsl:call-template name="xslc:ListFooter">
				<xsl:with-param name="colspan">5</xsl:with-param>
				<xsl:with-param name="URLParams">&amp;Filter=<xsl:value-of select="/document/Params/Filter"/>
				</xsl:with-param>
				<xsl:with-param name="MaxPages">15</xsl:with-param>
			</xsl:call-template>
		</table>
	</xsl:template>
	<xsl:template match="LogsRequest">
		<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>
		<xsl:choose>
			<xsl:when test="FileResult=''">
				<tr class="{$clValue}">
					<td align="center">
						<a href="{/document/Aliases/bdVODLL}FormLogsImport?&amp;idRequest={idRequest}">
							<xsl:if test="TypeImport='1'">
								<img border="0" src="{$XMLC_PictosPath}3270.gif" alt="Import des extractions issues du 3270"/>
							</xsl:if>
							<xsl:if test="TypeImport='2'">
								<img border="0" src="{$XMLC_PictosPath}euro.gif" alt="Import des commissions des financements"/>
							</xsl:if>
							<xsl:if test="TypeImport='3'">
								<img border="0" src="{$XMLC_PictosPath}cashier.gif" alt="Import des dates de règlements"/>
							</xsl:if>
							<xsl:if test="TypeImport='4'">
								<img border="0" src="{$XMLC_PictosPath}button_Trace.gif" alt="Import des situations d'achat"/>
							</xsl:if>
							<xsl:if test="TypeImport='100'">
								<img border="0" src="{$XMLC_PictosPath}ico_pdf.gif" alt="Import des factures constructeurs"/>
							</xsl:if>
						</a>
					</td>
					<td>
						<a href="{/document/Aliases/bdVODLL}FormLogsImport?&amp;idRequest={idRequest}">
							<xsl:value-of select="idRequest"/>
						</a>
					</td>
					<td>
						<a href="{/document/Aliases/bdVODLL}FormLogsImport?&amp;idRequest={idRequest}">
							<xsl:value-of select="DateImport"/>
						</a>
					</td>
					<td>
						<a href="{/document/Aliases/bdVODLL}FormLogsImport?&amp;idRequest={idRequest}">
							<xsl:value-of select="NFile"/>
							<xsl:if test="Site!=''"> - [<xsl:value-of select="Site"/>]</xsl:if>
						</a>
					</td>
					<td>
						<a href="{/document/Aliases/bdVODLL}FormLogsImport?&amp;idRequest={idRequest}">
							<xsl:value-of select="iStat"/>
						</a>
					</td>
				</tr>
			</xsl:when>
			<xsl:otherwise>
				<tr class="{$clValue}">
					<td align="center">
						<a href="/SharedPortal/IMP/{FileResult}">
							<xsl:if test="TypeImport='2'">
								<img border="0" src="{$XMLC_PictosPath}euro.gif" alt="Import des commissions des financements"/>
							</xsl:if>
							<xsl:if test="TypeImport='10' or TypeImport='11' ">
								<img border="0" src="{$XMLC_PictosPath}button_Excel.gif" alt="Import des contrôles des Frevo"/>
							</xsl:if>
						</a>
					</td>
					<td>
						<a href="/SharedPortal/IMP/{FileResult}">
							<xsl:value-of select="idRequest"/>
						</a>
					</td>
					<td>
						<a href="/SharedPortal/IMP/{FileResult}">
							<xsl:value-of select="DateImport"/>
						</a>
					</td>
					<td>
						<a href="/SharedPortal/IMP/{FileResult}">
							<xsl:value-of select="NFile"/>
							<xsl:if test="Site!=''"> - [<xsl:value-of select="Site"/>]</xsl:if>
						</a>
					</td>
					<td>
						<a href="/SharedPortal/IMP/{FileResult}">
							<xsl:value-of select="iStat"/>
							<xsl:if test="CptErreur!='0'">
								<xsl:value-of select="CptErreur"/>  erreurs,</xsl:if>
							<xsl:if test="CptAffecte!='0'">
								<xsl:value-of select="CptAffecte"/>  nouveaux,</xsl:if>
							<xsl:if test="CptValeur!='0'">
								<xsl:value-of select="CptValeur"/> liaisons,</xsl:if>
						</a>
					</td>
				</tr>
			</xsl:otherwise>
		</xsl:choose>
	</xsl:template>
</xsl:stylesheet>
