<?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:template match="/">
<xsl:apply-templates select="document"/>
</xsl:template>
<xsl:template match="document">
<xsl:call-template name="xslc:Page">
<xsl:with-param name="Head">
<link rel="stylesheet" type="text/css" href="{$XMLC_SkinPath}DelosPlanning.css"/>
<script language="javascript"><![CDATA[function UpdateField(FieldValue) {
  if (! parent.ShowHide)
    return;
  if (! parent.SetField)
    return;
  var vFieldName = GetField('MainForm', 'XMLC_FieldName');
  var vEndFieldName = GetField('MainForm', 'XMLC_EndFieldName');
  var vPopID = GetField('MainForm', 'XMLC_PopID');
  var SenderFormName = ']]><xsl:choose>
<xsl:when test="/document/PARAMS/XMLC_HTMLForm != ''">
<xsl:value-of select="/document/PARAMS/XMLC_HTMLForm"/>
</xsl:when>
<xsl:otherwise>MainForm</xsl:otherwise>
</xsl:choose><![CDATA[';

  parent.ShowHide(vPopID);
  parent.SetField(SenderFormName, vFieldName, FieldValue);
  if (vEndFieldName != '')
    parent.SetField(SenderFormName, vEndFieldName, FieldValue);
  ParentCallBack();
}

function ParentCallBack() {
  CallbackFunc = ']]><xsl:value-of select="/document/PARAMS/XMLC_CallbackFunc"/><![CDATA[';
  if (CallbackFunc != '')
    eval('parent.' + CallbackFunc + ';');
}]]></script>
</xsl:with-param>
<xsl:with-param name="BodyAttributes">
<Attributes rightmargin="0" style="margin: 0px;"/>
</xsl:with-param>
<xsl:with-param name="Body">
<xsl:apply-templates select="Calendar"/>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template match="Calendar">
<form action="{/document/Aliases/DelosWorkflowDLL}XMLC_PopupCalendar" method="POST" name="MainForm" style="margin: 0px;">
<input type="hidden" name="XMLC_DateValue"/>
<input type="hidden" name="XMLC_EndFieldName" value="{/document/PARAMS/XMLC_EndFieldName}"/>
<input type="hidden" name="XMLC_FieldName" value="{/document/PARAMS/XMLC_FieldName}"/>
<input type="hidden" name="XMLC_PopID" value="{/document/PARAMS/XMLC_PopID}"/>
<input type="hidden" name="XMLC_CallbackFunc" value="{/document/PARAMS/XMLC_CallbackFunc}"/>
<input type="hidden" name="XMLC_HTMLForm" value="{/document/PARAMS/XMLC_HTMLForm}"/>
<table cellpadding="0" cellspacing="0" class="clCalTable">
<tr>
<td class="clCalHeader" colspan="8">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td>
<a href="." onclick="SetField('MainForm', 'XMLC_DateValue', '{/document/DateSteps/PrevYear}'); SubmitForm('MainForm'); return false;">
<img align="left" alt="{/document/Locales/GoPrevYear}" border="0" src="{$XMLC_PictosPath}ico_stepdouble_left.gif"/>
</a>
</td>
<td>
<a href="." onclick="SetField('MainForm', 'XMLC_DateValue', '{/document/DateSteps/PrevMonth}'); SubmitForm('MainForm'); return false;">
<img align="left" alt="{/document/Locales/GoPrevMonth}" border="0" src="{$XMLC_PictosPath}ico_step_left.gif"/>
</a>
</td>
<td width="100" align="center">
<xsl:variable name="Month">M<xsl:value-of select="@Month"/>
</xsl:variable>
<xsl:value-of select="/document/Locales/*[name()=$Month]"/>&#160;<xsl:value-of select="@Year"/>
</td>
<td>
<a href="." onclick="SetField('MainForm', 'XMLC_DateValue', '{/document/DateSteps/NextMonth}'); SubmitForm('MainForm'); return false;">
<img align="right" alt="{/document/Locales/GoNextMonth}" border="0" src="{$XMLC_PictosPath}ico_step_right.gif"/>
</a>
</td>
<td>
<a href="." onclick="SetField('MainForm', 'XMLC_DateValue', '{/document/DateSteps/NextYear}'); SubmitForm('MainForm'); return false;">
<img align="left" alt="{/document/Locales/GoNextYear}" border="0" src="{$XMLC_PictosPath}ico_stepdouble_right.gif"/>
</a>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="clCalDayHeader">
<xsl:value-of select="/document/Locales/D01"/>
</td>
<td class="clCalDayHeader">
<xsl:value-of select="/document/Locales/D02"/>
</td>
<td class="clCalDayHeader">
<xsl:value-of select="/document/Locales/D03"/>
</td>
<td class="clCalDayHeader">
<xsl:value-of select="/document/Locales/D04"/>
</td>
<td class="clCalDayHeader">
<xsl:value-of select="/document/Locales/D05"/>
</td>
<td class="clCalDayHeader">
<xsl:value-of select="/document/Locales/D06"/>
</td>
<td class="clCalDayHeader">
<xsl:value-of select="/document/Locales/D07"/>
</td>
</tr>
<xsl:for-each select="Cell">
<xsl:variable name="Position" select="position()"/>
<xsl:if test="((position()-1) mod 7) = 0">
<tr>
<xsl:apply-templates select="../Cell[(position() &gt;= $Position) and (position() &lt; $Position+7)]"/>
</tr>
</xsl:if>
</xsl:for-each>
<xsl:if test="count(Cell)&lt;36">
<tr>
<td class="clCalDay">&#160;</td>
<td class="clCalDay">&#160;</td>
<td class="clCalDay">&#160;</td>
<td class="clCalDay">&#160;</td>
<td class="clCalDay">&#160;</td>
<td class="clCalDay">&#160;</td>
<td class="clCalDay">&#160;</td>
</tr>
</xsl:if>
</table>
</form>
</xsl:template>
<xsl:template match="Cell">
<xsl:variable name="id" select="generate-id()"/>
<xsl:choose>
<xsl:when test="(@IsInSelectedMonth='1') or ((../@Name='PrevMonth') and (Month&lt;../@Month)) or ((../@Name='NextMonth') and (Month&gt;../@Month))">
<td id="{$id}" width="10">
<xsl:attribute name="class"><xsl:choose><xsl:when test="@Today">clCalToday</xsl:when><xsl:when test="@IsInSelectedMonth='1'">clCalDay</xsl:when><xsl:otherwise>clCalOtherDay</xsl:otherwise></xsl:choose></xsl:attribute>
<a href="." onclick="UpdateField('{Date}'); return false;">
<xsl:value-of select="Day"/>
</a>
</td>
</xsl:when>
<xsl:when test="(../@Name='SelMonth') and (@Selected='True')">
<xsl:choose>
<xsl:when test="@IsInSelectedMonth='0'">
<td class="clCalSelectedOtherDay" width="10">
<xsl:value-of select="Day"/>
</td>
</xsl:when>
<xsl:otherwise>
<td class="clCalSelectedDay" width="10">&#160;</td>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<td class="clCalOtherDay" width="10">&#160;</td>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
