<?xml version="1.0" encoding="ISO-8859-1"?>

<!--    TimeSaver xsl style sheet 
	Author: Danko Komlen
	Stylesheet version: 2.0
	Last change: Tue 02 Jan 2007 04:16:36 PM CET
	TimeSaver version: beta 0.5
	timesaver.sourceforge.net
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:java="java:xslextension" version="1.1">

<xsl:template match="/">
<html>
<head>
  <title>TimeSaver report</title>
  <meta content="Danko Komlen" name="author"></meta>
  <meta content="Session report made by TimeSaver" name="description"></meta>
</head>

<body style="color: rgb(0, 0, 0); background-color: rgb(204, 204, 204);"
 alink="#000099" link="#000099" vlink="#990099">


<div style="text-align: center;">
<h1>TimeSaver report</h1>

<xsl:for-each select="xml/session">
Session name: <span><xsl:value-of select="name"></xsl:value-of></span> 
<br></br>

User: <span><xsl:value-of select="user"></xsl:value-of></span><br></br>
<hr style="width: 60%; height: 2px;"></hr>
<span><xsl:value-of select="status"></xsl:value-of></span> 
<br></br>
</xsl:for-each>
<br></br>
</div>

<!-- Javascript for hiding and shownig subtasks -->
<script language="javascript"> 
   var m_intShow = 1; 

   function ShowHide(strRowID,strCellID) 
   { 
    var objRow = document.getElementById(strRowID); 

    if (objRow.style.display == "none") 
     { 
      objRow.style.display = ""; 
      var objCell = document.getElementById(strCellID);

      <!-- objCell.innerText = "-" + strName; -->
      m_intShow = 1; 
     } 
    else 
     { 
      objRow.style.display = "none"; 
      var objCell = document.getElementById(strCellID); 
      <!-- objCell.innerText = "+" + strName; -->
      m_intShow = 0; 
     }; 
} 

</script> 

<table style="width: 100%;">
<!-- Main table -->
<tr>
<table style="text-align: center; width: 100%; background-color: rgb(204, 204, 255);" border="1"
 cellpadding="2" cellspacing="2">
<!-- Table that contains descriptions for columns -->
  <tbody>
    <tr>
      <td style="font-weight: bold; width: 18%;">Task name</td>
      <td style="font-weight: bold; width: 18%;">Type</td>
      <td style="font-weight: bold; width: 22%;">Description</td>
      <td style="font-weight: bold; width: 14%;">Started</td>
      <td style="font-weight: bold; width: 10%;">Duration</td>
      <td style="font-weight: bold; width: 18%;">Status</td>
    </tr>
</tbody>
</table>
	<xsl:for-each select="xml/session/task">
		<xsl:call-template name="parse_task">
			<xsl:with-param name="node" select="current()"/>
			<xsl:with-param name="id" select="generate-id()"/>
		</xsl:call-template>
        </xsl:for-each>
</tr>
</table>


<div style="text-align: left;"><br></br>
<hr style="width: 100%; height: 2px;"></hr>
<xsl:for-each select="xml">
Created on <span><xsl:value-of select="created"></xsl:value-of></span> with TimeSaver beta v0.5 (<a href="http://timesaver.sourceforge.net">http://timesaver.sourceforge.net</a>)<br></br>
</xsl:for-each>
</div>
</body>
</html>

</xsl:template>

<xsl:template name="parse_task" >
<!-- Template for parsing tasks using recursion -->

<xsl:param name="node"/>
<xsl:param name="id"/>

<xsl:if test="$node/subcount = 0">
<!-- If task doesn't have subtasks -->

<table style="text-align: center; width: 100%;">
<tbody>
    <tr style="background-color: rgb(230,230, 255);">
      <td style="width: 18%;"><span><xsl:value-of select="$node/name"></xsl:value-of></span></td>
      <td style="width: 18%;"><span><xsl:value-of select="$node/type"></xsl:value-of></span></td>
      <td style="width: 22%;"><span><xsl:value-of select="$node/description"></xsl:value-of></span></td>
      <td style="width: 14%;"><span><xsl:value-of select="$node/startf"></xsl:value-of></span></td>
      <td style="width: 10%;"><span><xsl:value-of select="$node/duration"></xsl:value-of></span> min</td>
      <td style="width: 18%;"><span><xsl:value-of select="$node/status"></xsl:value-of></span></td>
    </tr>
</tbody>
</table>
</xsl:if>

<xsl:if test="$node/subcount &gt; 0">
<!-- If task has subtasks -->

<table style="text-align: center; width: 100%; background-color: rgb(204, 204, 255);" border="2"
 cellpadding="10" cellspacing="2">
<tbody >
    <tr >
      <td id="foo" onclick="ShowHide('{$id}','foo')" style="cursor:pointer; width: 18%;"><b><span><xsl:value-of select="$node/name"></xsl:value-of></span></b> </td>
      <td style="width: 18%;"><span><xsl:value-of select="$node/type"></xsl:value-of></span></td>
      <td style="width: 22%;"><span><xsl:value-of select="$node/description"></xsl:value-of></span></td>
      <td style="width: 14%;"><span><xsl:value-of select="$node/startf"></xsl:value-of></span></td>
      <td style="width: 10%;"><span><xsl:value-of select="$node/duration"></xsl:value-of></span> min</td>
      <td style="width: 18%;"><span><xsl:value-of select="$node/status"></xsl:value-of></span></td>
    </tr>

		

    <tr id="{$id}" style="background-color: rgb(204, 204, 204); ">
<td colspan="6" rowspan="1">
	<xsl:for-each select="$node/task">
	<!-- Runs parse_task template for each subtask -->

	<xsl:call-template name="parse_task">
		<xsl:with-param name="node" select="current()"/>
		<xsl:with-param name="id" select="generate-id()"/>
	</xsl:call-template>
	</xsl:for-each>
</td>
    </tr>

</tbody>
</table>
</xsl:if>
</xsl:template>

</xsl:stylesheet>
