[planner] Include duration in exported HTML



commit 33c0eecd51b7ee46c1ff4b911a433e20d1b9ac26
Author: Caolan McNamara <caolanm redhat com>
Date:   Fri Mar 8 19:44:42 2013 +0100

    Include duration in exported HTML

 data/stylesheets/html1_gantt.xsl |   24 ++++++++++++++++++++++++
 data/stylesheets/html1_tasks.xsl |   10 ++++++++++
 libplanner/mrp-parser.c          |    4 +---
 3 files changed, 35 insertions(+), 3 deletions(-)
---
diff --git a/data/stylesheets/html1_gantt.xsl b/data/stylesheets/html1_gantt.xsl
index e73db4b..c5689c2 100644
--- a/data/stylesheets/html1_gantt.xsl
+++ b/data/stylesheets/html1_gantt.xsl
@@ -95,11 +95,13 @@
       <th><span><xsl:value-of select="I18N:gettext('WBS')"/></span></th>
       <th><span><xsl:value-of select="I18N:gettext('Name')"/></span></th>
       <th><span><xsl:value-of select="I18N:gettext('Work')"/></span></th>
+      <th><span><xsl:value-of select="I18N:gettext('Duration')"/></span></th>
     </tr>
     <tr class="header">
       <th>&nbsp;</th>
       <th>&nbsp;</th>
       <th>&nbsp;</th>
+      <th>&nbsp;</th>
     </tr>
     <xsl:for-each select="//project//task">
       <xsl:variable name="rowclass">
@@ -179,6 +181,28 @@
             </xsl:otherwise>
           </xsl:choose>
         </td>
+
+        <td>
+          <xsl:choose>
+            <!-- Task has subtasks -->
+            <xsl:when test="task">
+              <span style="white-space: nowrap; font-weight: bold;">
+                <xsl:call-template name="mrproj-duration">
+                  <xsl:with-param name="duration-in-seconds" select="@duration"/>
+                </xsl:call-template>
+               </span>
+            </xsl:when>
+                        
+            <!-- Task is leaf -->
+            <xsl:otherwise>
+              <span>
+                <xsl:call-template name="mrproj-duration">
+                  <xsl:with-param name="duration-in-seconds" select="@duration"/>
+                </xsl:call-template>
+              </span>
+            </xsl:otherwise>
+          </xsl:choose>
+        </td>
       </tr>
     </xsl:for-each>
   </table>
diff --git a/data/stylesheets/html1_tasks.xsl b/data/stylesheets/html1_tasks.xsl
index 557eb71..87a3b67 100644
--- a/data/stylesheets/html1_tasks.xsl
+++ b/data/stylesheets/html1_tasks.xsl
@@ -54,6 +54,7 @@
       <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('Duration')"/></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>
@@ -139,6 +140,15 @@
             </xsl:if>
           </td>
           <td>
+            <xsl:if test="@type!='milestone'">
+              <span>
+                <xsl:call-template name="mrproj-duration">
+                  <xsl:with-param name="duration-in-seconds" select="@duration"/>
+                </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>
diff --git a/libplanner/mrp-parser.c b/libplanner/mrp-parser.c
index f4448e3..225457f 100644
--- a/libplanner/mrp-parser.c
+++ b/libplanner/mrp-parser.c
@@ -530,9 +530,7 @@ mpp_write_task_cb (MrpTask *task, MrpParser *parser)
        xmlSetProp (node, "note", note);
        mpp_xml_set_int (node, "work", work);
 
-       if (sched == MRP_TASK_SCHED_FIXED_DURATION) {
-               mpp_xml_set_int (node, "duration", duration);
-       }
+       mpp_xml_set_int (node, "duration", duration);
 
        mpp_xml_set_date (node, "start", start);
        mpp_xml_set_date (node, "end", finish);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]