[evolvis-commits] r18692: [#3259] extend tasks too; fix dependency information

mirabilos at evolvis.org mirabilos at evolvis.org
Thu Oct 4 17:59:56 CEST 2012


Author: mirabilos
Date: 2012-10-04 17:59:56 +0200 (Thu, 04 Oct 2012)
New Revision: 18692

Modified:
   trunk/gforge_base/evolvisforge-5.1/src/common/pm/ProjectTask.class.php
   trunk/gforge_base/evolvisforge-5.1/src/debian/changelog
   trunk/gforge_base/evolvisforge-5.1/src/www/pm/t_lookup.php
Log:
[#3259] extend tasks too; fix dependency information

Modified: trunk/gforge_base/evolvisforge-5.1/src/common/pm/ProjectTask.class.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/src/common/pm/ProjectTask.class.php	2012-10-04 15:59:51 UTC (rev 18691)
+++ trunk/gforge_base/evolvisforge-5.1/src/common/pm/ProjectTask.class.php	2012-10-04 15:59:56 UTC (rev 18692)
@@ -840,21 +840,22 @@
 	 *	@return	array	The array of project_task_id's in this format: 
 	 *  array($id=>$link_type,id2=>link_type2).
 	 */
-	function getDependentOn() {
+	function getDependentOn($raw=false) {
 		if (!$this->getID()) {
 			return array();
 		}
 		if (!$this->dependon) {
+			$this->dependon = array();
 			$res = db_query_params ('SELECT is_dependent_on_task_id,link_type
 				FROM project_dependencies
 				WHERE project_task_id=$1',
 						array ($this->getID())) ;
 			for ($i=0; $i<db_numrows($res); $i++) {
-				$this->dependon[db_result($res,$i,'is_dependent_on_task_id')] = db_result($res,$i,'link_type');
+				$this->dependon[(int)db_result($res,$i,'is_dependent_on_task_id')] = db_result($res,$i,'link_type');
 			}
 		}
 		/* fix bug 319: if dependentlist is emtpy, set it to 100 (none) */
-		if (!$this->dependon) {
+		if (!$this->dependon && !$raw) {
 			$this->dependon[100]=PM_LINK_DEFAULT;
 		}
 		return $this->dependon;

Modified: trunk/gforge_base/evolvisforge-5.1/src/debian/changelog
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/src/debian/changelog	2012-10-04 15:59:51 UTC (rev 18691)
+++ trunk/gforge_base/evolvisforge-5.1/src/debian/changelog	2012-10-04 15:59:56 UTC (rev 18692)
@@ -26,8 +26,9 @@
   * Never display template groups in project list
   * scmgit: Permit branch deletion in personal repositories
   * [#2991] Display Open/Closed/Deleted mapping for custom status fields
+  * [#3259] Extend JSON export by much more information
 
- -- Thorsten Glaser <t.glaser at tarent.de>  Thu, 04 Oct 2012 15:27:30 +0200
+ -- Thorsten Glaser <t.glaser at tarent.de>  Thu, 04 Oct 2012 16:54:57 +0200
 
 fusionforge (1:5.1.1+evolvis70.1) unstable; urgency=high
 

Modified: trunk/gforge_base/evolvisforge-5.1/src/www/pm/t_lookup.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/src/www/pm/t_lookup.php	2012-10-04 15:59:51 UTC (rev 18691)
+++ trunk/gforge_base/evolvisforge-5.1/src/www/pm/t_lookup.php	2012-10-04 15:59:56 UTC (rev 18692)
@@ -95,9 +95,12 @@
 $tinfo['forge_name'] = forge_get_config ('forge_name') ;
 $tinfo['_permalink'] = util_make_url('/pm/t_follow.php/' . $tid);
 
-if ($showall && ($pth = projecttask_get_object($tid))) {
+if ($showall && ($pt = projecttask_get_object($tid))) {
+	if (($u = user_get_object($tinfo['submitted_by']))) {
+		$tinfo['submitted_email'] = $u->getEmail();
+	}
 	$tinfo['_linked_tracker_items'] = array();
-	if (($res = $pth->getRelatedArtifacts()) &&
+	if (($res = $pt->getRelatedArtifacts()) &&
 	    ($rows = db_numrows($res)) >= 1) {
 		for ($i = 0; $i < $rows; ++$i) {
 			$tinfo['_linked_tracker_items'][] =
@@ -105,6 +108,34 @@
 		}
 		sort($tinfo['_linked_tracker_items'], SORT_NUMERIC);
 	}
+	$tinfo['duration'] = (int)$pt->getDuration();
+	$tinfo['parent_id'] = (int)$pt->getParentID();
+	$tinfo['percent_complete'] = (int)$pt->getPercentComplete();
+	$tinfo['hours_estimated'] = (float)$pt->getHours();
+	$tinfo['start_date'] = (int)$pt->getStartDate();
+	$tinfo['end_date'] = (int)$pt->getEndDate();
+	$tinfo['last_modified_date'] = (int)$pt->getLastModifiedDate();
+	$tinfo['external_id'] = (int)$pt->getExternalID();
+	$tinfo['_depends_on'] = $pt->getDependentOn(true);
+	$ass = $pt->getAssignedTo();
+	sort($ass, SORT_NUMERIC);
+	$tinfo['assigned_email'] = array();
+	$tinfo['assigned_realname'] = array();
+	$tinfo['assigned_to'] = array();
+	$tinfo['assigned_unixname'] = array();
+	foreach ($ass as $a) {
+		if (!($u = user_get_object($a))) {
+			$tinfo['assigned_email'][] = '';
+			$tinfo['assigned_realname'][] = '?' . $a;
+			$tinfo['assigned_unixname'][] = '?' . $a;
+		} else {
+			$tinfo['assigned_email'][] = $u->getEmail();
+			$tinfo['assigned_realname'][] = $u->getRealName();
+			$tinfo['assigned_unixname'][] = $u->getUnixName();
+		}
+		$tinfo['assigned_to'][] = (int)$a;
+	}
+	$tinfo['hours_worked'] = $pt->getHoursWorked();
 }
 
 sysdebug_off("Content-type: " . $asformat);



More information about the evolvis-commits mailing list