[Fusionforge-commits] r12200 - in trunk/src/www/tracker: . include

Roland Mas lolando at libremir.placard.fr.eu.org
Wed Feb 9 16:15:50 CET 2011


Author: lolando
Date: 2011-02-09 16:15:48 +0100 (Wed, 09 Feb 2011)
New Revision: 12200

Modified:
   trunk/src/www/tracker/include/ArtifactTypeHtml.class.php
   trunk/src/www/tracker/tracker.php
Log:
Allow tracker admins to unlink a task from an artifact

Modified: trunk/src/www/tracker/include/ArtifactTypeHtml.class.php
===================================================================
--- trunk/src/www/tracker/include/ArtifactTypeHtml.class.php	2011-02-09 15:15:14 UTC (rev 12199)
+++ trunk/src/www/tracker/include/ArtifactTypeHtml.class.php	2011-02-09 15:15:48 UTC (rev 12200)
@@ -296,6 +296,12 @@
 		}
 
 		$taskcount = db_numrows($ah->getRelatedTasks());
+		
+		if (forge_check_perm ('tracker_admin', $this->ArtifactType->Group->getID())) {
+			$is_admin=false;
+		} else {
+			$is_admin=true;
+		}
 
 		if ($taskcount > 0) {
 			echo '<tr><td colspan="2">';
@@ -306,6 +312,7 @@
 			$title_arr[] = _('Start Date');
 			$title_arr[] = _('End Date');
 			$title_arr[] = _('Status');
+			(($is_admin) ? $title_arr[]=_('Remove Relation') : '');
 			echo $GLOBALS['HTML']->listTableTop($title_arr);
 
 			echo '<table cellspacing="0">';
@@ -323,8 +330,9 @@
 						'&group_id='.$groupid.'&group_project_id='.$projectid.'">[T'.$taskid.'] '.$summary.'</a></td>
 						<td>'.$startdate.'</td>
 						<td>'.$enddate.'</td>
-						<td>'.$status.'</td>
-				</tr>';
+						<td>'.$status.'</td>'.
+					(($is_admin) ? '<td><input type="checkbox" name="remlink[]" value="'.$taskid.'" /></td>' : '').
+					'</tr>';
 			}
 			echo $GLOBALS['HTML']->listTableBottom();
 			echo '</td></tr>';

Modified: trunk/src/www/tracker/tracker.php
===================================================================
--- trunk/src/www/tracker/tracker.php	2011-02-09 15:15:14 UTC (rev 12199)
+++ trunk/src/www/tracker/tracker.php	2011-02-09 15:15:48 UTC (rev 12200)
@@ -283,7 +283,18 @@
 		} else if (!$ath->allowsAnon() && !session_loggedin()) {
 			exit_error(_('Artifact: This ArtifactType Does Not Allow Anonymous Submissions. Please Login.'),'tracker');
 		} else {
-
+			
+			$remlink = getArrayFromRequest('remlink');
+			if (count($remlink) > 0 && forge_check_perm ('tracker_admin', $ah->ArtifactType->Group->getID())) {
+				require_once $gfcommon.'pm/ProjectTask.class.php';
+				foreach ($remlink as $tid) {
+					$pt = &projecttask_get_object($tid);
+					if (!$pt || $pt->isError())
+						exit_error(_('Error'), sprintf(_('Could not get Project Task for %d'), $tid));
+					if (!$pt->removeRelatedArtifacts(array($artifact_id)))
+						exit_error($tid."->removeRelatedArtifacts(".$artifact_id.")", $pt->getErrorMessage());
+				}
+			}
 			/*
 
 				The following logic causes fields to be overridden




More information about the Fusionforge-commits mailing list