<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xslc="http://xslcomponents.org/TR/WD-xslc">
<xsl:template match="Calendars">
<table>
<script language="javascript"><![CDATA[var oldSelected;
var oldClassName;

function setClass(obj) {
  if (oldSelected != null) 
    oldSelected.className = oldClassName; 
  oldSelected = obj; 
  oldClassName = obj.className; 
  obj.className = 'clCalSelectedDay'; 
  event.cancelBubble = true;
}]]></script>
<tr valign="top">
<xsl:apply-templates select="Calendar"/>
</tr>
</table>
</xsl:template>
<xsl:template match="Calendar">
<xsl:variable name="CalendarCount" select="count(../Calendar)"/>
<td align="center">
<table cellpadding="1" cellspacing="0" class="clCalTable" style="margin-top: 5px; width: 180px;">
<tr>
<td class="clCalHeader" colspan="8">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td>
<xsl:choose>
<xsl:when test="@Name='PrevMonth'">
<a href="." onclick="SetField('MainForm', 'KTIM_STARTING', '{/document/DateSteps/PrevYear}'); SubmitForm('MainForm', 'ACTION', '{/document/XMLC_Params/XMLC_Action}'); return false;">
<img align="left" alt="{/document/Locales/GoPrevYear}" border="0" src="{$XMLC_PictosPath}ico_stepdouble_left.gif"/>
</a>
</xsl:when>
<xsl:when test="$CalendarCount = 1">
<a href="Menu?KTIM_STARTING={/document/DateSteps/PrevYear}">
<img align="left" alt="{/document/Locales/GoPrevYear}" border="0" src="{$XMLC_PictosPath}ico_stepdouble_left.gif"/>
</a>
</xsl:when>
<xsl:otherwise> </xsl:otherwise>
</xsl:choose>
</td>
<td>
<xsl:choose>
<xsl:when test="@Name='PrevMonth'">
<a href="." onclick="SetField('MainForm', 'KTIM_STARTING', '{/document/DateSteps/PrevMonth}'); SubmitForm('MainForm', 'ACTION', '{/document/XMLC_Params/XMLC_Action}'); return false;">
<img align="left" alt="{/document/Locales/GoPrevMonth}" border="0" src="{$XMLC_PictosPath}ico_step_left.gif"/>
</a>
</xsl:when>
<xsl:when test="$CalendarCount = 1">
<a href="MenuEML?KTIM_STARTING={/document/DateSteps/PrevMonth}">
<img align="left" alt="{/document/Locales/GoPrevMonth}" border="0" src="{$XMLC_PictosPath}ico_step_left.gif"/>
</a>
</xsl:when>
<xsl:otherwise> </xsl:otherwise>
</xsl:choose>
</td>
<td width="100%" align="center">
<xsl:variable name="Month">M<xsl:value-of select="@Month"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="(/document/XMLC_Params/XMLC_Action='WeeklyClosedWMSG') or (/document/XMLC_Params/XMLC_Action='DailyClosedWMSG')">
<xsl:value-of select="/document/Locales/*[name()=$Month]"/> <xsl:value-of select="@Year"/>
</xsl:when>
<xsl:when test="(/document/XMLC_Params/XMLC_Action='WeeklyPlanningExpanded') or (/document/XMLC_Params/XMLC_Action='DailyPlanningExpanded')">
<a href="." onclick="SetField('MainForm', 'KTIM_STARTING', '{@MonthDate}'); SubmitForm('MainForm', 'ACTION', 'MonthlyPlanningExpanded'); return false;">
<xsl:value-of select="/document/Locales/*[name()=$Month]"/> <xsl:value-of select="@Year"/>
</a>
</xsl:when>
<xsl:otherwise>
<a href=".">
<xsl:attribute name="onclick">SetField('MainForm', 'KTIM_STARTING', '<xsl:value-of select="@MonthDate"/>'); SubmitForm('MainForm', 'ACTION', 'MonthlyPlanning'); return false;</xsl:attribute>
<xsl:value-of select="/document/Locales/*[name()=$Month]"/> <xsl:value-of select="@Year"/>
</a>
</xsl:otherwise>
</xsl:choose>
</td>
<td>
<xsl:choose>
<xsl:when test="@Name='NextMonth'">
<a href="." onclick="SetField('MainForm', 'KTIM_STARTING', '{/document/DateSteps/NextMonth}'); SubmitForm('MainForm', 'ACTION', '{/document/XMLC_Params/XMLC_Action}'); return false;">
<img align="right" alt="{/document/Locales/GoNextMonth}" border="0" src="{$XMLC_PictosPath}ico_step_right.gif"/>
</a>
</xsl:when>
<xsl:when test="$CalendarCount = 1">
<a href="Menu?KTIM_STARTING={/document/DateSteps/NextMonth}">
<img align="left" alt="{/document/Locales/GoNextMonth}" border="0" src="{$XMLC_PictosPath}ico_step_right.gif"/>
</a>
</xsl:when>
<xsl:otherwise> </xsl:otherwise>
</xsl:choose>
</td>
<td>
<xsl:choose>
<xsl:when test="@Name='NextMonth'">
<a href="." onclick="SetField('MainForm', 'KTIM_STARTING', '{/document/DateSteps/NextYear}'); SubmitForm('MainForm', 'ACTION', '{/document/XMLC_Params/XMLC_Action}'); return false;">
<img align="left" alt="{/document/Locales/GoNextYear}" border="0" src="{$XMLC_PictosPath}ico_stepdouble_right.gif"/>
</a>
</xsl:when>
<xsl:when test="$CalendarCount = 1">
<a href="MenuEML?KTIM_STARTING={/document/DateSteps/NextYear}">
<img align="left" alt="{/document/Locales/GoNextYear}" border="0" src="{$XMLC_PictosPath}ico_stepdouble_right.gif"/>
</a>
</xsl:when>
<xsl:otherwise> </xsl:otherwise>
</xsl:choose>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="clCalDayHeader">&#160;</td>
<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 onclick="setClass(this);">
<td class="clCalLeftHeader" style="width: 2%; padding-left: 2px; padding-right: 2px">
<xsl:variable name="WeekAction">
<xsl:choose>
<xsl:when test="(/document/XMLC_Params/XMLC_Action='WeeklyClosedWMSG') or (/document/XMLC_Params/XMLC_Action='DailyClosedWMSG')">WeeklyClosedWMSG</xsl:when>
<xsl:otherwise>WeeklyPlanning<xsl:if test="/document/XMLC_Profile/DisplayPlanningExpanded = '1'">Expanded</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="WeekLink">document.MainForm.action='<xsl:value-of select="$WeekAction"/>'; document.MainForm.KTIM_STARTING.value='<xsl:value-of select="../Cell[position()=$Position]/Date"/>'; MainForm.submit(); return false;</xsl:variable>
<a hidefocus="1" title="{/document/Locales/WeeklyPlanning}" href="." onclick="{$WeekLink}">
<xsl:choose>
<xsl:when test="(/document/XMLC_Profile/DisplayPlanningWeekNumber) and (WeekOfYear != '')">
<xsl:value-of select="WeekOfYear"/>
</xsl:when>
<xsl:otherwise>
<img alt="{/document/Locales/WeeklyPlanning}" border="0" src="{$XMLC_PictosPath}ico_run.gif"/>
</xsl:otherwise>
</xsl:choose>
</a>
</td>
<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="clCalLeftHeader"> </td>
<td class="clCalDay"> </td>
<td class="clCalDay"> </td>
<td class="clCalDay"> </td>
<td class="clCalDay"> </td>
<td class="clCalDay"> </td>
<td class="clCalDay"> </td>
<td class="clCalDay"> </td>
</tr>
</xsl:if>
</table>
</td>
</xsl:template>
<xsl:template match="Cell">
<xsl:choose>
<xsl:when test="(@IsInSelectedMonth='1') or ((../@Name = 'PrevMonth') and (Month &lt; ../@Month)) or ((../@Name = 'NextMonth') and (Month &gt; ../@Month))">
<td onclick="setClass(this);">
<xsl:attribute name="class"><xsl:choose><xsl:when test="(@Selected='True') and (@Today)">clCalSelToday</xsl:when><xsl:when test="@Today">clCalToday</xsl:when><xsl:when test="@Selected='True'">clCalSelectedDay</xsl:when><xsl:when test="@IsInSelectedMonth='1'">clCalDay</xsl:when><xsl:otherwise>clCalOtherDay</xsl:otherwise></xsl:choose></xsl:attribute>
<xsl:attribute name="id"><xsl:value-of select="generate-id()"/></xsl:attribute>
<xsl:variable name="DayAction">
<xsl:choose>
<xsl:when test="(/document/XMLC_Params/XMLC_Action='WeeklyClosedWMSG') or (/document/XMLC_Params/XMLC_Action='DailyClosedWMSG')">DailyClosedWMSG</xsl:when>
<xsl:otherwise>DailyPlanning<xsl:if test="/document/XMLC_Profile/DisplayPlanningExpanded = '1'">Expanded</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:variable name="DayLink">document.MainForm.action='<xsl:value-of select="$DayAction"/>'; document.MainForm.KTIM_STARTING.value='<xsl:value-of select="Date"/>'; MainForm.submit(); return false;</xsl:variable>
<xsl:choose>
<xsl:when test="@IsInSelectedMonth = '1'">
<a hidefocus="1" href="." onclick="{$DayLink};">
<xsl:value-of select="Day"/>
</a>
</xsl:when>
<xsl:otherwise>&#160;</xsl:otherwise>
</xsl:choose>
</td>
</xsl:when>
<xsl:when test="(../@Name='SelMonth') and (@Selected='True')">
<xsl:choose>
<xsl:when test="@IsInSelectedMonth='0'">
<td class="clCalSelectedOtherDay">
<xsl:value-of select="Day"/>
</td>
</xsl:when>
<xsl:otherwise>
<td class="clCalSelectedDay"> </td>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<td class="clCalOtherDay"> </td>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
