<?xml version="1.0" encoding="ISO-8859-15"?>
<!-- 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">Options V.O. Line</xsl:with-param>
			<xsl:with-param name="Head">
				<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="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">
								<li>
									<a href="Security">Utilisateurs</a>
								</li>
								<xsl:if test="/document/XMLC_Params/User_RVN = '1' ">
									<li>
										<a href="OptVersions">Modèles et Motorisations</a>
									</li>
								</xsl:if>
								<li class="selected">
									<a href="Options">Options</a>
								</li>
								<li>
									<a href="About">A Propos</a>
								</li>
							</ul>
						</div>
						<xsl:apply-templates select="OptDates"/>
						<xsl:apply-templates select="tVOContactsS"/>
						<xsl:call-template name="xslc:PoweredBy"/>
					</xsl:with-param>
				</xsl:call-template>
			</xsl:with-param>
		</xsl:call-template>
	</xsl:template>
	<xsl:template match="OptDates">
		<form name="MainForm" method="POST" action="{/document/Aliases/SecurityDLL}UpdateOptions">
			<br/>
			<table>
				<tr>
					<td width="350px">
						<table border="0" cellpadding="2" cellspacing="0" width="100%">
							<tr>
								<td colspan="2" nowrap="">
									<b>Période de saisie comptable </b>
								</td>
							</tr>
							<tr>
								<td nowrap="">
									<b>Date Limite Début :</b>
								</td>
								<td style="padding-left: 10px" width="100%">
									<input type="text" class="clFlatTextInput" name="DateDeb" size="14" value="{Opt_LimiteDateDeb}"/> - <a href="." onclick="PopCalendar('CalendarDeb', 'DateDeb', -90); return false;">
										<img border="0" alt="Choisissez une date de Début" 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 style="display: none;">
								<td nowrap="">
									<b>Date Limite Fin :</b>
								</td>
								<td style="padding-left: 10px" width="100%">
									<input type="text" class="clFlatTextInput" name="DateFin" size="14" value="{Opt_LimiteDateFin}"/> - <a href="." onclick="PopCalendar('CalendarFin', 'DateFin', -5); return false;">
										<img border="0" alt="Choisissez une date de Fin" src="{$XMLC_PictosPath}ico_planning.gif"/>
									</a>
									<iframe border="0" frameborder="0" marginheight="0" marginwidth="0" id="CalendarFin" name="CalendarFin" scrolling="no" src="{$XMLC_Portal}blank.htm" style="position: absolute; display: none; z-index:1000;"/>
								</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:template match="tVOContactsS">
		<table border="0" cellpadding="2" cellspacing="0" class="clFlatTable" width="100%">
			<form name="FormDeletetVOContacts" method="POST" action="{/document/Aliases/bdVODLL}DeletetVOContacts">
				<input type="hidden" name="tVOContacts_STARTINGROW" value="{@StartingRow}"/>
				<input type="hidden" name="NextAction" value="Options"/>
				<input type="hidden" name="idContact"/>
			</form>
			<form name="FormUpdatetVOContacts" method="POST" action="{/document/Aliases/bdVODLL}UpdatetVOContacts">
				<input type="hidden" name="XMLC_Pivot" value="tVOContacts"/>
				<input type="hidden" name="tVOContacts_STARTINGROW" value="{@StartingRow}"/>
				<input type="hidden" name="NextAction" value="Options"/>
				<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 style="width: 12px;">
						<input type="image" border="0" src="{$XMLC_PictosPath}ico_Check.gif" alt="Save"/>
					</td>
					<td style="width: 150px;">Site</td>
					<td style="width: 50px;">Type</td>
					<td style="width: 180px;">Contact(s)</td>
					<td style="width: 200px;">Mail &amp; Téléphone </td>
				</tr>
				<xsl:apply-templates select="tVOContacts"/>
			</form>
			<form name="FormInserttVOContacts" method="POST" action="{/document/Aliases/bdVODLL}InserttVOContacts">
				<input type="hidden" name="tVOContacts_STARTINGROW" value="{@StartingRow}"/>
				<input type="hidden" name="NextAction" value="Options"/>
				<tr class="clDataGridLight">
					<td class="clRowHeader">
						<a href="." onclick="document.FormInserttVOContacts.submit(); return false;">
							<img border="0" src="{$XMLC_PictosPath}ico_xplus.gif" alt="Insert this new record"/>
						</a>
					</td>
					<td>
						<select name="idSite" id="idSite" style="width:140px">
							<xsl:for-each select="/document/tVOSitesS/tVOSites">
								<xsl:sort select="LibelleSociete"/>
								<option value="{idSite}">
									<xsl:if test="/document/OutParams/SITE=idSite">
										<xsl:attribute name="selected"/>
									</xsl:if>
									<xsl:value-of select="LibelleSociete"/>
								</option>
							</xsl:for-each>
						</select>
					</td>
					<td>
						<select name="TypeVO" id="TypeVO">
							<option value="1">VO</option>
							<option value="2">VD</option>
						</select>
					</td>
					<td>
						<textarea class="clFlatTextInput" rows="3" border="0" cols="25" name="contact"/>
					</td>
					<td>
						<input type="text" name="email"/>
						<input type="text" name="telephone"/>
					</td>
				</tr>
			</form>
			<xsl:call-template name="xslc:ListFooter">
				<xsl:with-param name="colspan">6</xsl:with-param>
			</xsl:call-template>
		</table>
	</xsl:template>
	<xsl:template match="tVOContacts">
		<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>
		<xsl:variable name="clType">
			<xsl:value-of select="TypeVO"/>
		</xsl:variable>
		<xsl:variable name="clSite">
			<xsl:value-of select="idSite"/>
		</xsl:variable>
		<tr class="{$clValue}">
			<input type="hidden" name="tVOContacts[{position()}].idContact" value="{idContact}"/>
			<td class="clRowHeader">
				<a href="." onclick="document.FormDeletetVOContacts.idContact.value='{idContact}'; document.FormDeletetVOContacts.submit(); return false;">
					<img border="0" src="{$XMLC_PictosPath}ico_xminus.gif" alt="Delete this record"/>
				</a>
			</td>
			<td>
				<select name="tVOContacts[{position()}].idSite" id="tVOContacts[{position()}].idSite" style="width:140px">
					<xsl:for-each select="/document/tVOSitesS/tVOSites">
						<xsl:sort select="LibelleSociete"/>
						<option value="{idSite}">
							<xsl:if test="$clSite=idSite">
								<xsl:attribute name="selected"/>
							</xsl:if>
							<xsl:value-of select="LibelleSociete"/>
						</option>
					</xsl:for-each>
				</select>
			</td>
			<td>
				<select name="tVOContacts[{position()}].TypeVO" id="tVOContacts[{position()}].TypeVO">
					<option value="1">
						<xsl:if test="$clType=1">
							<xsl:attribute name="selected"/>
						</xsl:if>VO</option>
					<option value="2">
						<xsl:if test="$clType=2">
							<xsl:attribute name="selected"/>
						</xsl:if>VD</option>
				</select>
			</td>
			<td>
				<textarea class="clFlatTextInput" rows="3" border="0" cols="25" name="tVOContacts[{position()}].contact">
					<xsl:value-of select="contact"/>
				</textarea>
			</td>
			<td>
				<input type="text" name="tVOContacts[{position()}].email" value="{email}"/>
				<input type="text" name="tVOContacts[{position()}].telephone" value="{telephone}"/>
			</td>
		</tr>
	</xsl:template>
</xsl:stylesheet>
