<?xml version="1.0"?>
<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">
				<xsl:value-of select="/document/ListFiltersS/ListFilters[nService=/document/XMLC_Params/XMLC_Action]/FilterName"/>
			</xsl:with-param>
			<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">
				<script language="javascript">
					<![CDATA[var apLastValue='x';
function VOapShowHide_dark(ID) {
  if (apLastValue!='') apShowHide_dark(ID); 
  apLastValue='x';
}
function VOapShowHide(ID) {
  if (apLastValue!='') apShowHide(ID); 
  apLastValue='x';
}
function VOShowHideActionMenu() {
  ShowHideActionMenu(); 
  goSubmit();
}]]>
				</script>
				<script language="javascript">
					<![CDATA[// Valider les paramètres d'appel et lancement Service
// 
function goService(nService) {
  if (nService != '') {
     if ((nService.search('http://www')==-1) && (nService.search('/projHistoBin')==-1)) nService=XMLC_BaseHRef+nService ;
     if (nService.search('/projHistoBin')>-1) nService='http://'+XMLC_Host+nService ;
     document.location =  nService ;}
  return false;
}

function goSubmit() {
  SetField('MainForm', 'AmMode',  (getObjectById('xslcActionMenu').style.display == 'none') ? '0' : '1');
  document.MainForm.submit(); 
  return false;
}]]>
				</script>
				<script language="javascript">
					<![CDATA[function handleKeyPress(e) {
  var keyCode = GetEventKeyCode(e);
// sur Entrer : Valider
  if (keyCode == 13) {
    goSubmit('PDF'); return false; }
  if (keyCode == 27) {
    parent.ShowHide('SelPrint'); return false;}
  return false;
}]]>
					<![CDATA[// 
// Gestion des dates des mois suivant et précédent
// 
var adate;
var datedeb;
var datefin;

function prevMonth() {
 if (verifdate('MainForm', 'DATEFieldDeb')) {
  SetDate(-15);
  SetField('MainForm', 'DATEFieldDeb', vdateFormat(datedeb));
  SetField('MainForm', 'DATEFieldFin', vdateFormat(datefin));
 }
}

function nextMonth() {
 if (verifdate('MainForm', 'DATEFieldDeb')) {
  SetDate(+32);
  SetField('MainForm', 'DATEFieldDeb', vdateFormat(datedeb));
  SetField('MainForm', 'DATEFieldFin', vdateFormat(datefin));
 }
}]]>
					<![CDATA[// 
// Vérification d'une date
// 
function verifdate(FormID, FieldName) {
    var datetest = GetField(FormID, FieldName);
    var format = /^(\d{1,2}\/){2}\d{4}$/;
    if(!format.test(datetest)){ return false;}
    else{
        var date_temp = datetest.split('/');
        date_temp[1] -=1;        // On rectifie le mois car de 0 à 11 !!!
        adate = new Date();
        adate.setFullYear(date_temp[2]);
        adate.setMonth(date_temp[1]);
        adate.setDate(date_temp[0]);
        return true;
    }
}]]>
					<![CDATA[// 
// Calculer la date de début et de fin de mois 
// 
function SetDate(aVal)
{
 var monHeure = adate.getTime();
 var jourPlus1 = monHeure + 86400 * 1000 * aVal; // 1 jour = 86400 secondes
 datedeb = new Date(); datedeb.setTime (jourPlus1);
 while (datedeb.getDate() != 1) { jourPlus1 = jourPlus1-86400*1000; datedeb.setTime (jourPlus1); }

    jourPlus1 = jourPlus1+28*86400*1000; 
    datefin = new Date(); datefin.setTime (jourPlus1);
    while (datefin.getDate() != 1) { jourPlus1 = jourPlus1 +86400*1000; datefin.setTime (jourPlus1); };
    jourPlus1 = jourPlus1 -86400*1000; datefin.setTime (jourPlus1); 
}
]]>
					<![CDATA[// 
// retourner le format d'une date "dd/mm/yyyy"
// 
function vdateFormat(vdate)
{
dy = vdate.getFullYear();
dm = vdate.getMonth() + 1;
dd = vdate.getDate();
if ( dy < 100 ) dy = dy + 1900; 	
ys = new String(dy);
ms = new String(dm);
ds = new String(dd);
if ( ms.length == 1 ) ms = "0" + ms;
if ( ds.length == 1 ) ds = "0" + ds;
vres = ds + "/" + ms + "/" + ys;
    return vres;
}]]>// 
// Afficher la fenêtre popup pour le calendrier XMLC_Calendar
// 
function PopCalendar(PopID, FieldName, yOffset) {
  if (Pop = getObjectById(PopID)) {
    if (obj = getObjectById(FieldName)) {
      ShowHide(PopID, 'WIDTH', 180, 'HEIGHT', 130); 
      aPos=GetObjectPosY(FieldName)+yOffset;
      if (Pop.style.top != aPos) {
        Pop.style.top = aPos;
      }
      CalendarURL = XMLC_BaseHRef+'XMLC_PopupCalendar?XMLC_FieldName='+FieldName;
      CalendarURL += '&amp;XMLC_DateValue=' + obj.value;
      CalendarURL += '&amp;XMLC_PopID=' + PopID;
      Pop.src = CalendarURL;
    }
  }
}</script>
			</xsl:with-param>
			<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="/document/XMLC_Params/XMLC_Action=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="ToolbarButtonsLeft">
				<ToolbarButton>
					<xsl:call-template name="ToolButtonRefresh"/>
				</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>
				<xsl:apply-templates select="OptDates"/>
				<xsl:call-template name="xslc:PoweredBy"/>
			</xsl:with-param>
		</xsl:call-template>
	</xsl:template>
	<xsl:template match="OptDates">
		<div id="zoneTOP">
			<p style="font-size:16px">
				<xsl:value-of select="/document/ListFiltersS/ListFilters[nService=/document/XMLC_Params/XMLC_Action]/FilterName"/>
			</p>
		</div>
		<form name="MainForm" method="POST" action="{/document/Aliases/SecurityDLL}UpdateOptions">
			<br/>
			<input type="hidden" name="AmMode" value="{/document/OutParams/AmMode}"/>
			<table>
				<tr>
					<td>
						<table border="0" cellpadding="2" cellspacing="0" width="100%">
							<tr>
								<td colspan="2" nowrap="">
									<b>Définition des dates limites de saisie </b>
								</td>
							</tr>
							<tr>
								<td nowrap="">
									<b>Date Limite Début VO.Line :</b>
								</td>
								<td style="padding-left: 10px" width="100%">
									<input type="text" class="clFlatTextInput" name="DateDeb" size="10" value="{Opt_LimiteDateDeb}"/> - <a href="." onclick="PopCalendar('CalendarDeb', 'DateDeb', -90); return false;">
										<img border="0" alt="Choisissez une date de Début pour VO.Line" src="{$XMLC_PictosPath}ico_planning.gif"/>
									</a>
									<iframe border="0" frameborder="0" marginheight="0" marginwidth="0" id="CalendarDeb" name="CalendarDeb" scrolling="no" src="{$XMLC_Portal}blank.htm" style="position: absolute; display: none; z-index:1000;"/>
								</td>
							</tr>
							<tr>
								<td nowrap="">
									<b>Date Limite Début FreVO :</b>
								</td>
								<td style="padding-left: 10px" width="100%">
									<input type="text" class="clFlatTextInput" name="DateDebFrevo" size="10" value="{Opt_LimiteDateDebFrevo}"/> - <a href="." onclick="PopCalendar('CalendarDeb', 'DateDebFrevo', -90); return false;">
										<img border="0" alt="Choisissez une date de Début pour les Frevo" src="{$XMLC_PictosPath}ico_planning.gif"/>
									</a>
								</td>
							</tr>
							<tr>
								<td nowrap="">
									<b>Date Verrouillage VN ou VO livrés :</b>
								</td>
								<td style="padding-left: 10px" width="100%">
									<input type="text" class="clFlatTextInput" name="DateVerrouVNVO" size="10" value="{Opt_LimiteDateVerrouVNVO}"/> - <a href="." onclick="PopCalendar('CalendarDeb', 'DateVerrouVNVO', -90); return false;">
										<img border="0" alt="Choisissez une date de Verrouillage pour les VN ou VO livrés" src="{$XMLC_PictosPath}ico_planning.gif"/>
									</a>
								</td>
							</tr>
							<tr>
								<td nowrap="">
									<b>Date Minimum Affichage VN ou VO :</b>
								</td>
								<td style="padding-left: 10px" width="100%">
									<input type="text" class="clFlatTextInput" name="DateDebAffich" size="10" value="{Opt_LimiteDateDebAffich}"/> - <a href="." onclick="PopCalendar('CalendarDeb', 'DateDebAffich', -90); return false;">
										<img border="0" alt="Choisissez une date minimum pour l'affichage des VN ou des VO" src="{$XMLC_PictosPath}ico_planning.gif"/>
									</a>
								</td>
							</tr>
							<tr>
								<td nowrap="">
									<b>Date Limite Début ProFid :</b>
								</td>
								<td style="padding-left: 10px" width="100%">
									<input type="text" class="clFlatTextInput" name="DateDebProFid" size="10" value="{Opt_LimiteDateDebProFid}"/> - <a href="." onclick="PopCalendar('CalendarDeb', 'DateDebProFid', -90); return false;">
										<img border="0" alt="Choisissez une date de Début pour ProFid" src="{$XMLC_PictosPath}ico_planning.gif"/>
									</a>
								</td>
							</tr>
							<tr>
								<td nowrap="">
									<b>Date Minimum Affichage des relances ProFid :</b>
								</td>
								<td style="padding-left: 10px" width="100%">
									<input type="text" class="clFlatTextInput" name="DateDebRelanceProfid" size="10" value="{Opt_LimiteDateDebRelanceProfid}"/> - <a href="." onclick="PopCalendar('CalendarDeb', 'DateDebRelanceProfid', -90); return false;">
										<img border="0" alt="Choisissez une date minimum pour l'affichage des relances Profid" src="{$XMLC_PictosPath}ico_planning.gif"/>
									</a>
								</td>
							</tr>
							<tr>
								<td nowrap="">
									<b>Date Limite Début CarFid :</b>
								</td>
								<td style="padding-left: 10px" width="100%">
									<input type="text" class="clFlatTextInput" name="DateDebCarFid" size="10" value="{Opt_LimiteDateDebCarFid}"/> - <a href="." onclick="PopCalendar('CalendarDeb', 'DateDebCarFid', -90); return false;">
										<img border="0" alt="Choisissez une date de Début pour CarFid" src="{$XMLC_PictosPath}ico_planning.gif"/>
									</a>
								</td>
							</tr>
							<tr>
								<td nowrap="">
									<b>Date Limite Fin :</b>
								</td>
								<td style="padding-left: 10px" width="100%">la date limite de fin est la date du jour (issue du serveur)</td>
							</tr>
						</table>
					</td>
					<td valign="bottom">
						<xsl:call-template name="xslc:ButtonPad"/>
					</td>
				</tr>
			</table>
			<br/>
			<br/>
		</form>
	</xsl:template>
</xsl:stylesheet>
