[planner] Added assigned resource information to HTML export
- From: Maurice van der Pot <mvdpot src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [planner] Added assigned resource information to HTML export
- Date: Sat, 24 Oct 2009 22:26:11 +0000 (UTC)
commit b43d37f21cbf51b2926447fb93813ce358fdba26
Author: Maurice van der Pot <griffon26 kfk4ever com>
Date: Sun Oct 25 00:21:01 2009 +0200
Added assigned resource information to HTML export
The HTML export now lists both in the gantt chart and in the task view
what resources are assigned to a task and for how many units if it is
not 100. The code was also cleaned up a bit to have less duplication.
The priority field was removed because it is not used anywhere and was
only visible in the HTML export and in the task dialog.
data/stylesheets/html1_gantt.xsl | 59 ++------
data/stylesheets/html1_tasks.xsl | 303 +++++++++++--------------------------
data/stylesheets/planner2html.xsl | 28 ++++
3 files changed, 127 insertions(+), 263 deletions(-)
---
diff --git a/data/stylesheets/html1_gantt.xsl b/data/stylesheets/html1_gantt.xsl
index 8d1de53..e73db4b 100644
--- a/data/stylesheets/html1_gantt.xsl
+++ b/data/stylesheets/html1_gantt.xsl
@@ -27,15 +27,14 @@
<xsl:if test="not($days = 7)">
<xsl:call-template name="create-week-row">
<xsl:with-param name="days" select="$days - 7"/>
- <xsl:with-param name="date" select="date:add($date, date:duration(604800))"/>
- </xsl:call-template>
+ <xsl:with-param name="date" select="date:add($date, date:duration(604800))"/>
+ </xsl:call-template>
</xsl:if>
</xsl:when>
<xsl:when test="not($days >= 7)">
<th class="gantt-{$days}day-header" colspan="{$days}"></th>
- <th></th>
- </xsl:when>
- <xsl:otherwise>
+ </xsl:when>
+ <xsl:otherwise>
<xsl:variable name="colspan">
<xsl:choose>
<xsl:when test="date:day-in-week($date) = 1">1</xsl:when>
@@ -192,6 +191,7 @@
<xsl:with-param name="days" select="$days"/>
<xsl:with-param name="date" select="$projstart"/>
</xsl:call-template>
+ <th></th>
</tr>
<tr class="header" align="left">
@@ -248,56 +248,21 @@
</xsl:if>
</div>
</xsl:if>
-
+
<xsl:choose>
<xsl:when test="@type = 'milestone'">
<div class="gantt-milestone">◆</div>
- <div class="gantt-resources">
- <xsl:variable name="task-id" select="@id"/>
- <xsl:for-each select="/project/allocations/allocation[ task-id=$task-id]">
- <xsl:sort data-type="number" select="@resource-id" order="descending"/>
- <xsl:variable name="resource-id" select="@resource-id"/>
-
- <xsl:choose>
- <xsl:when test="/project/resources/resource[ id=$resource-id]/@short-name = ''">
- <xsl:value-of select="/project/resources/resource[ id=$resource-id]/@name"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="/project/resources/resource[ id=$resource-id]/@short-name"/>
- </xsl:otherwise>
- </xsl:choose>
-
- <xsl:if test="not(position() = last())">
- <xsl:text>, </xsl:text>
- </xsl:if>
- </xsl:for-each>
- </div>
</xsl:when>
<xsl:otherwise>
<div class="gantt-empty-end"></div>
- <div class="gantt-resources">
- <xsl:variable name="task-id" select="@id"/>
- <xsl:for-each select="/project/allocations/allocation[ task-id=$task-id]">
- <xsl:sort data-type="number" select="@resource-id" order="descending"/>
- <xsl:variable name="resource-id" select="@resource-id"/>
-
- <xsl:choose>
- <xsl:when test="/project/resources/resource[ id=$resource-id]/@short-name = ''">
- <xsl:value-of select="/project/resources/resource[ id=$resource-id]/@name"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="/project/resources/resource[ id=$resource-id]/@short-name"/>
- </xsl:otherwise>
- </xsl:choose>
-
- <xsl:if test="not(position() = last())">
- <xsl:text>, </xsl:text>
- </xsl:if>
- </xsl:for-each>
- </div>
</xsl:otherwise>
</xsl:choose>
-
+ <div class="gantt-resources">
+ <xsl:variable name="task-id" select="@id"/>
+ <xsl:call-template name="mrproj-assigned-resources">
+ <xsl:with-param name="task-id" select="$task-id"/>
+ </xsl:call-template>
+ </div>
</xsl:if>
</div>
</td>
diff --git a/data/stylesheets/html1_tasks.xsl b/data/stylesheets/html1_tasks.xsl
index 6ee632c..557eb71 100644
--- a/data/stylesheets/html1_tasks.xsl
+++ b/data/stylesheets/html1_tasks.xsl
@@ -54,9 +54,9 @@
<th><span><xsl:value-of select="I18N:gettext('Start')"/></span></th>
<th><span><xsl:value-of select="I18N:gettext('Finish')"/></span></th>
<th><span><xsl:value-of select="I18N:gettext('Work')"/></span></th>
- <th><span><xsl:value-of select="I18N:gettext('Priority')"/></span></th>
<th><span><xsl:value-of select="I18N:gettext('Complete')"/></span></th>
<th><span><xsl:value-of select="I18N:gettext('Cost')"/></span></th>
+ <th><span><xsl:value-of select="I18N:gettext('Assigned to')"/></span></th>
<xsl:if test="$hasnotes">
<th class="note"><span>Notes</span></th>
</xsl:if>
@@ -90,222 +90,93 @@
<xsl:otherwise>odd</xsl:otherwise>
</xsl:choose>
</xsl:variable>
-
- <xsl:choose>
- <xsl:when test="task">
- <tr class="{$rowclass}">
- <td>
- <span>
- <xsl:for-each select="ancestor-or-self::task">
- <xsl:value-of select="count(preceding-sibling::task) + 1"/>
- <xsl:if test="not(position() = last())">
- <xsl:text>.</xsl:text>
- </xsl:if>
- </xsl:for-each>
- </span>
- </td>
- <td>
- <a name="task{ id}" style="font-weight: bold; margin-left: {$indent*$task-indent-pixels}px">
- <span>
- <xsl:value-of select="@name"/>
- </span>
- </a>
- </td>
- <td>
- <span>
- <xsl:value-of select="date:month-abbreviation($start_date)"/>
- <xsl:text> </xsl:text>
- <xsl:value-of select="date:day-in-month($start_date)"/>
- </span>
- </td>
- <td>
- <span>
- <xsl:value-of select="date:month-abbreviation($end_date)"/>
- <xsl:text> </xsl:text>
- <xsl:value-of select="date:day-in-month($end_date)"/>
- </span>
- </td>
- <td>
- <span>
- <xsl:call-template name="mrproj-duration">
- <xsl:with-param name="duration-in-seconds" select="@work"/>
- </xsl:call-template>
- </span>
- </td>
- <td>
- </td>
- <td>
- </td>
- <td>
- <span>
- <xsl:variable name="std-rates" select="/project/resources/resource[ id=/project/allocations/allocation[ task-id=$tid]/@resource-id]/@std-rate"/>
- <xsl:variable name="units" select="/project/allocations/allocation[ task-id=$tid]/@units"/>
- <xsl:variable name="cost">
- <xsl:call-template name="calculate-cost">
- <xsl:with-param name="std-rates" select="$std-rates"/>
- <xsl:with-param name="units" select="$units"/>
- <xsl:with-param name="level" select="count($std-rates)"/>
- <xsl:with-param name="work" select="@work div 3600"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:if test="not($cost = 0)">
- <xsl:value-of select="format-number($cost, '###,###,###,###.##')"/>
- </xsl:if>
- </span>
- </td>
- <xsl:if test="$hasnotes">
- <td class="note">
- <span>
- <xsl:value-of select="@note"/>
- </span>
- </td>
- </xsl:if>
- </tr>
- </xsl:when>
- <xsl:when test="@type='milestone'">
- <tr class="{$rowclass}">
- <td>
- <span>
- <xsl:for-each select="ancestor-or-self::task">
- <xsl:value-of select="count(preceding-sibling::task) + 1"/>
- <xsl:if test="not(position() = last())">
- <xsl:text>.</xsl:text>
- </xsl:if>
- </xsl:for-each>
- </span>
- </td>
- <td>
- <a name="task{ id}" style="margin-left: {$indent*$task-indent-pixels}px">
- <span>
- <xsl:value-of select="@name"/>
- </span>
- </a>
- </td>
- <td>
- <span>
- <xsl:value-of select="date:month-abbreviation($start_date)"/>
- <xsl:text> </xsl:text>
- <xsl:value-of select="date:day-in-month($start_date)"/>
- </span>
- </td>
- <td>
- <span>
- <xsl:value-of select="date:month-abbreviation($end_date)"/>
- <xsl:text> </xsl:text>
- <xsl:value-of select="date:day-in-month($end_date)"/>
- </span>
- </td>
- <td>
- </td>
- <td>
- </td>
- <td>
- </td>
- <td>
- <span>
- <xsl:variable name="std-rates" select="/project/resources/resource[ id=/project/allocations/allocation[ task-id=$tid]/@resource-id]/@std-rate"/>
- <xsl:variable name="units" select="/project/allocations/allocation[ task-id=$tid]/@units"/>
- <xsl:variable name="cost">
- <xsl:call-template name="calculate-cost">
- <xsl:with-param name="std-rates" select="$std-rates"/>
- <xsl:with-param name="units" select="$units"/>
- <xsl:with-param name="level" select="count($std-rates)"/>
- <xsl:with-param name="work" select="@work div 3600"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:if test="not($cost = 0)">
- <xsl:value-of select="format-number($cost, '###,###,###,###.##')"/>
- </xsl:if>
- </span>
- </td>
- <xsl:if test="$hasnotes">
- <td class="note">
- <span>
- <xsl:value-of select="@note"/>
- </span>
- </td>
- </xsl:if>
- </tr>
- </xsl:when>
- <xsl:otherwise>
- <tr class="{$rowclass}">
- <td>
- <span>
- <xsl:for-each select="ancestor-or-self::task">
- <xsl:value-of select="count(preceding-sibling::task) + 1"/>
- <xsl:if test="not(position() = last())">
- <xsl:text>.</xsl:text>
- </xsl:if>
- </xsl:for-each>
- </span>
- </td>
- <td>
- <a name="task{ id}" style="margin-left: {$indent*$task-indent-pixels}px">
- <span>
- <xsl:value-of select="@name"/>
- </span>
- </a>
- </td>
- <td>
- <span>
- <xsl:value-of select="date:month-abbreviation($start_date)"/>
- <xsl:text> </xsl:text>
- <xsl:value-of select="date:day-in-month($start_date)"/>
- </span>
- </td>
- <td>
- <span>
- <xsl:value-of select="date:month-abbreviation($end_date)"/>
- <xsl:text> </xsl:text>
- <xsl:value-of select="date:day-in-month($end_date)"/>
- </span>
- </td>
- <td>
- <span>
- <xsl:call-template name="mrproj-duration">
- <xsl:with-param name="duration-in-seconds" select="@work"/>
- </xsl:call-template>
- </span>
- </td>
- <td align="center">
- <span>
- <xsl:if test="not(@priority = 0)">
- <xsl:value-of select="format-number(@priority, '0')"/>
- </xsl:if>
- </span>
- </td>
- <td align="right">
- <span>
- <xsl:value-of select="@percent-complete"/>%
- </span>
- </td>
- <td align="right">
- <span>
- <xsl:variable name="std-rates" select="/project/resources/resource[ id=/project/allocations/allocation[ task-id=$tid]/@resource-id]/@std-rate"/>
- <xsl:variable name="units" select="/project/allocations/allocation[ task-id=$tid]/@units"/>
- <xsl:variable name="cost">
- <xsl:call-template name="calculate-cost">
- <xsl:with-param name="std-rates" select="$std-rates"/>
- <xsl:with-param name="units" select="$units"/>
- <xsl:with-param name="level" select="count($std-rates)"/>
- <xsl:with-param name="work" select="@work div 3600"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:if test="not($cost = 0)">
- <xsl:value-of select="format-number($cost, '###,###,###,###.##')"/>
- </xsl:if>
- </span>
- </td>
- <xsl:if test="$hasnotes">
- <td class="note">
- <span>
- <xsl:value-of select="@note"/>
- </span>
- </td>
+
+ <xsl:variable name="rowstyle">
+ <xsl:if test="task">
+ font-weight: bold;
+ </xsl:if>
+ </xsl:variable>
+
+ <tr class="{$rowclass}" style="{$rowstyle}">
+ <td>
+ <span>
+ <xsl:for-each select="ancestor-or-self::task">
+ <xsl:value-of select="count(preceding-sibling::task) + 1"/>
+ <xsl:if test="not(position() = last())">
+ <xsl:text>.</xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+ </span>
+ </td>
+ <td>
+ <a name="task{ id}" style="margin-left: {$indent*$task-indent-pixels}px">
+ <span>
+ <xsl:value-of select="@name"/>
+ </span>
+ </a>
+ </td>
+ <td>
+ <span>
+ <xsl:value-of select="date:month-abbreviation($start_date)"/>
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="date:day-in-month($start_date)"/>
+ </span>
+ </td>
+ <td>
+ <span>
+ <xsl:value-of select="date:month-abbreviation($end_date)"/>
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="date:day-in-month($end_date)"/>
+ </span>
+ </td>
+ <td>
+ <xsl:if test="@type!='milestone'">
+ <span>
+ <xsl:call-template name="mrproj-duration">
+ <xsl:with-param name="duration-in-seconds" select="@work"/>
+ </xsl:call-template>
+ </span>
+ </xsl:if>
+ </td>
+ <td>
+ <!-- if the task has no children and isn't a milestone -->
+ <xsl:if test="not(task) and @type!='milestone'">
+ <span>
+ <xsl:value-of select="@percent-complete"/>%
+ </span>
+ </xsl:if>
+ </td>
+ <td>
+ <span>
+ <xsl:variable name="std-rates" select="/project/resources/resource[ id=/project/allocations/allocation[ task-id=$tid]/@resource-id]/@std-rate"/>
+ <xsl:variable name="units" select="/project/allocations/allocation[ task-id=$tid]/@units"/>
+ <xsl:variable name="cost">
+ <xsl:call-template name="calculate-cost">
+ <xsl:with-param name="std-rates" select="$std-rates"/>
+ <xsl:with-param name="units" select="$units"/>
+ <xsl:with-param name="level" select="count($std-rates)"/>
+ <xsl:with-param name="work" select="@work div 3600"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:if test="not($cost = 0)">
+ <xsl:value-of select="format-number($cost, '###,###,###,###.##')"/>
</xsl:if>
- </tr>
- </xsl:otherwise>
- </xsl:choose>
+ </span>
+ </td>
+ <td>
+ <xsl:call-template name="mrproj-assigned-resources">
+ <xsl:with-param name="task-id" select="$tid"/>
+ </xsl:call-template>
+ </td>
+ <xsl:if test="$hasnotes">
+ <td class="note">
+ <span>
+ <xsl:value-of select="@note"/>
+ </span>
+ </td>
+ </xsl:if>
+ </tr>
+
</xsl:for-each>
</table>
</div>
diff --git a/data/stylesheets/planner2html.xsl b/data/stylesheets/planner2html.xsl
index 3683219..b932544 100644
--- a/data/stylesheets/planner2html.xsl
+++ b/data/stylesheets/planner2html.xsl
@@ -132,6 +132,34 @@
</xsl:if>
</xsl:template>
+<!-- List the resources along with their assigned units if not 100 -->
+<xsl:template name="mrproj-assigned-resources">
+ <xsl:param name="task-id"/>
+
+ <xsl:for-each select="/project/allocations/allocation[ task-id=$task-id]">
+ <xsl:sort data-type="number" select="@resource-id" order="ascending"/>
+ <xsl:variable name="resource-id" select="@resource-id"/>
+
+ <!-- Use the short name of a resource unless it's empty -->
+ <xsl:choose>
+ <xsl:when test="/project/resources/resource[ id=$resource-id]/@short-name = ''">
+ <xsl:value-of select="/project/resources/resource[ id=$resource-id]/@name"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="/project/resources/resource[ id=$resource-id]/@short-name"/>
+ </xsl:otherwise>
+ </xsl:choose>
+
+ <!-- Create a tag displaying the number of units this resource spends on this task if it is not 100 -->
+ <xsl:variable name="units" select="/project/allocations/allocation[ resource-id=$resource-id and @task-id=$task-id]/@units"/>
+ <xsl:if test="$units != 100">[<xsl:value-of select="$units"/>]</xsl:if>
+
+ <xsl:if test="not(position() = last())">
+ <xsl:text>, </xsl:text>
+ </xsl:if>
+ </xsl:for-each>
+</xsl:template>
+
<!-- ********************************************************************* -->
<!-- XHTML page header -->
<xsl:template name="htmlhead">
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]