[PATCH] Add an break down of assignments per resource to the html output



We wanted to have a section of the plan show all the assignments per person. This patch appends this to the end of the html output. Ideally, this would be a different export and generate one html page per person.. but this was good enough for now.

This also incorporates bugzilla 439182 <http://bugzilla.gnome.org/show_bug.cgi?id=439182>.

-- bk

diff -upN /usr/share/planner/stylesheets/backup.xsl plannerPatch/backup.xsl
--- /usr/share/planner/stylesheets/backup.xsl	1969-12-31 19:00:00.000000000 -0500
+++ plannerPatch/backup.xsl	2007-08-30 10:02:16.000000000 -0400
@@ -0,0 +1,68 @@
+<?xml version="1.0"?>
+<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#160;"> ]>
+<xsl:stylesheet version="1.0"
+              xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
+                  xmlns="http://www.w3.org/1999/xhtml";
+             xmlns:date="http://exslt.org/dates-and-times";>
+
+<xsl:template name="assignments">
+  <h2><a name="tasks">Assignments</a></h2>
+
+  <div class="scroll-div">
+          <table>
+  <xsl:for-each select="//resource">
+      <xsl:sort data-type="string" 
+        select="@name"
+        order="ascending"/>  	
+        <xsl:variable name="rid" select="@id"/>
+        <!-- The actual assignment -->
+        <tr><td colspan="4"><b><xsl:value-of select="@name"/></b></td></tr>
+        	<tr class="header" align="left">
+        		<th>ID</th>
+				<th>Task</th>        		
+				<th>Start</th>        						
+				<th>End</th>        						
+        	</tr>
+		<xsl:for-each select="/project/allocations/allocation[ resource-id=$rid]">
+		  <xsl:sort data-type="number" select="@task-id" order="descending"/>
+			<xsl:variable name="task-id" select="@task-id"/>
+			<xsl:variable name="start_date">
+			  <xsl:call-template name="mrproj-parse-date">
+				<xsl:with-param name="thedate" select="//task[ id=$task-id]/@work-start"/>
+			  </xsl:call-template>
+			</xsl:variable>
+			<xsl:variable name="end_date">
+			  <xsl:call-template name="mrproj-parse-date">
+				<xsl:with-param name="thedate" select="//task[ id=$task-id]/@end"/>
+			  </xsl:call-template>
+			</xsl:variable>		  
+			
+			<xsl:variable name="rowclass">
+			  <xsl:choose>
+				<xsl:when test="(position() mod 2) = 0">even</xsl:when>
+				<xsl:otherwise>odd</xsl:otherwise>
+			  </xsl:choose>
+			</xsl:variable>			
+			  <tr class="{$rowclass}">
+			  <td>
+			  </td>		  
+			  <td><xsl:value-of select="//task[ id=$task-id]/@name"/></td>
+			  <td>
+					  <xsl:value-of select="date:month-abbreviation($start_date)"/>
+					  <xsl:text> </xsl:text>
+					  <xsl:value-of select="date:day-in-month($start_date)"/>		  
+			   </td>
+			  <td>
+					  <xsl:value-of select="date:month-abbreviation($end_date)"/>
+					  <xsl:text> </xsl:text>
+					  <xsl:value-of select="date:day-in-month($end_date)"/>		  
+			   </td>		   
+			  </tr>		  
+		</xsl:for-each>                      
+				
+  </xsl:for-each>
+  </table>
+  </div>
+</xsl:template>
+
+</xsl:stylesheet>
diff -upN /usr/share/planner/stylesheets/html1_assignments.xsl plannerPatch/html1_assignments.xsl
--- /usr/share/planner/stylesheets/html1_assignments.xsl	1969-12-31 19:00:00.000000000 -0500
+++ plannerPatch/html1_assignments.xsl	2007-08-30 10:02:16.000000000 -0400
@@ -0,0 +1,77 @@
+<?xml version="1.0"?>
+<!DOCTYPE xsl:stylesheet
+[ <!ENTITY nbsp "&#160;"> ]>
+<xsl:stylesheet version="1.0"
+xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
+xmlns="http://www.w3.org/1999/xhtml";
+xmlns:date="http://exslt.org/dates-and-times";>
+  <xsl:template name="assignments">
+    <h2>
+      <a name="tasks">Assignments</a>
+    </h2>
+    <div class="scroll-div">
+      <table>
+        <xsl:for-each select="//resource">
+          <xsl:sort data-type="string" select="@name"
+          order="ascending" />
+          <xsl:variable name="rid" select="@id" />
+          <!-- The actual assignment -->
+          <tr>
+            <td colspan="4">
+              <b>
+                <xsl:value-of select="@name" />
+              </b>
+            </td>
+          </tr>
+          <tr class="header" align="left">
+            <th>ID</th>
+            <th>Task</th>
+            <th>Start</th>
+            <th>End</th>
+          </tr>
+          <xsl:for-each select="/project/allocations/allocation[ resource-id=$rid]">
+
+            <xsl:sort data-type="number" select="@task-id"
+            order="descending" />
+            <xsl:variable name="task-id" select="@task-id" />
+            <xsl:variable name="start_date">
+              <xsl:call-template name="mrproj-parse-date">
+                <xsl:with-param name="thedate"
+                select="//task[ id=$task-id]/@work-start" />
+              </xsl:call-template>
+            </xsl:variable>
+            <xsl:variable name="end_date">
+              <xsl:call-template name="mrproj-parse-date">
+                <xsl:with-param name="thedate"
+                select="//task[ id=$task-id]/@end" />
+              </xsl:call-template>
+            </xsl:variable>
+            <xsl:variable name="rowclass">
+              <xsl:choose>
+                <xsl:when test="(position() mod 2) = 0">
+                even</xsl:when>
+                <xsl:otherwise>odd</xsl:otherwise>
+              </xsl:choose>
+            </xsl:variable>
+            <tr class="{$rowclass}">
+              <td></td>
+              <td>
+                <xsl:value-of select="//task[ id=$task-id]/@name" />
+              </td>
+              <td>
+                <xsl:value-of select="date:month-abbreviation($start_date)" />
+                <xsl:text> </xsl:text>
+                <xsl:value-of select="date:day-in-month($start_date)" />
+              </td>
+              <td>
+                <xsl:value-of select="date:month-abbreviation($end_date)" />
+                <xsl:text> </xsl:text>
+                <xsl:value-of select="date:day-in-month($end_date)" />
+              </td>
+            </tr>
+          </xsl:for-each>
+        </xsl:for-each>
+      </table>
+    </div>
+  </xsl:template>
+</xsl:stylesheet>
diff -upN /usr/share/planner/stylesheets/html1_tasks.xsl plannerPatch/html1_tasks.xsl
--- /usr/share/planner/stylesheets/html1_tasks.xsl	2007-02-09 08:53:11.000000000 -0500
+++ plannerPatch/html1_tasks.xsl	2007-08-30 10:02:16.000000000 -0400
@@ -49,6 +49,9 @@
       <th><span>Name</span></th>
       <th><span>Start</span></th>
       <th><span>Finish</span></th>
+      <!--bk begin-->
+      <th><span>Resources</span></th>
+      <!--bk end -->      
       <th><span>Work</span></th>
       <th><span>Priority</span></th>
       <th><span>Complete</span></th>
@@ -122,6 +125,18 @@
 				</span>
 			  </td>
               <td>
+              	<span>
+					<xsl:for-each select="/project/allocations/allocation[ task-id=$tid]">
+					  <xsl:sort data-type="number" select="@resource-id" order="descending"/>
+					  <xsl:variable name="resource-id" select="@resource-id"/>
+					  <xsl:value-of select="/project/resources/resource[ id=$resource-id]/@short-name"/>
+					  <xsl:if test="not(position() = last())">
+						<xsl:text>, </xsl:text>
+					  </xsl:if>
+					</xsl:for-each>              	
+              	</span>
+              </td>			  
+              <td>
                 <span>
 				  <xsl:call-template name="mrproj-duration">
                     <xsl:with-param name="duration-in-seconds" select="@work"/>
@@ -192,7 +207,19 @@
 				</span>
               </td>
               <td>
-              </td>
+              	<span>
+					<xsl:for-each select="/project/allocations/allocation[ task-id=$tid]">
+					  <xsl:sort data-type="number" select="@resource-id" order="descending"/>
+					  <xsl:variable name="resource-id" select="@resource-id"/>
+					  <xsl:value-of select="/project/resources/resource[ id=$resource-id]/@short-name"/>
+					  <xsl:if test="not(position() = last())">
+						<xsl:text>, </xsl:text>
+					  </xsl:if>
+					</xsl:for-each>              	
+              	</span>
+              </td>              
+              <td>
+              </td>         
               <td>
               </td>
               <td>
@@ -257,6 +284,18 @@
 				</span>
               </td>
               <td>
+              	<span>
+					<xsl:for-each select="/project/allocations/allocation[ task-id=$tid]">
+					  <xsl:sort data-type="number" select="@resource-id" order="descending"/>
+					  <xsl:variable name="resource-id" select="@resource-id"/>
+					  <xsl:value-of select="/project/resources/resource[ id=$resource-id]/@short-name"/>
+					  <xsl:if test="not(position() = last())">
+						<xsl:text>, </xsl:text>
+					  </xsl:if>
+					</xsl:for-each>              	
+              	</span>
+              </td>              
+              <td>
                 <span>
 				  <xsl:call-template name="mrproj-duration">
                     <xsl:with-param name="duration-in-seconds" select="@work"/>
diff -upN /usr/share/planner/stylesheets/planner2html.xsl plannerPatch/planner2html.xsl
--- /usr/share/planner/stylesheets/planner2html.xsl	2007-02-09 08:53:11.000000000 -0500
+++ plannerPatch/planner2html.xsl	2007-08-30 10:02:16.000000000 -0400
@@ -97,6 +97,10 @@
 <xsl:include href="html1_tasks.xsl"/>
 <xsl:include href="html1_resources.xsl"/>
 <xsl:include href="html1_gantt.xsl"/>
+<xsl:include href="html1_assignments.xsl"/>
+
+
+
 
 
 <!-- ********************************************************************* -->
@@ -298,6 +302,11 @@
 
       <!-- Defined in html1_resources.xsl -->
       <xsl:apply-templates select="resources"/> 
+      
+      <div class="separator"/>
+
+      <!-- Defined in html1_assignements.xsl -->
+      <xsl:call-template name="assignments"/>       
 
       <xsl:call-template name="htmlfooter"/>
     </body>


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