| 
									
										
										
										
											2011-02-08 10:53:59 -08:00
										 |  |  | <?php | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-07-04 13:04:22 -07:00
										 |  |  | /** | 
					
						
							|  |  |  |  * @group maniphest | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2012-03-09 15:46:25 -08:00
										 |  |  | final class ManiphestTaskDetailController extends ManiphestController { | 
					
						
							| 
									
										
										
										
											2011-02-08 10:53:59 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   private $id; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   public function willProcessRequest(array $data) { | 
					
						
							|  |  |  |     $this->id = $data['id']; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   public function processRequest() { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     $request = $this->getRequest(); | 
					
						
							|  |  |  |     $user = $request->getUser(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     $e_title = null; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     $priority_map = ManiphestTaskPriority::getTaskPriorityMap(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     $task = id(new ManiphestTask())->load($this->id); | 
					
						
							| 
									
										
										
										
											2011-03-30 21:38:24 -07:00
										 |  |  |     if (!$task) { | 
					
						
							|  |  |  |       return new Aphront404Response(); | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2011-02-08 10:53:59 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-03 14:20:05 -07:00
										 |  |  |     $workflow = $request->getStr('workflow'); | 
					
						
							|  |  |  |     $parent_task = null; | 
					
						
							|  |  |  |     if ($workflow && is_numeric($workflow)) { | 
					
						
							|  |  |  |       $parent_task = id(new ManiphestTask())->load($workflow); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-08 10:53:59 -08:00
										 |  |  |     $transactions = id(new ManiphestTransaction())->loadAllWhere( | 
					
						
							| 
									
										
										
										
											2011-04-11 02:45:53 -07:00
										 |  |  |       'taskID = %d ORDER BY id ASC', | 
					
						
							| 
									
										
										
										
											2011-02-08 10:53:59 -08:00
										 |  |  |       $task->getID()); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-03-07 17:24:58 -08:00
										 |  |  |     $extensions = ManiphestTaskExtensions::newExtensions(); | 
					
						
							|  |  |  |     $aux_fields = $extensions->loadFields($task, $user); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-18 20:41:42 -07:00
										 |  |  |     $e_commit = PhabricatorEdgeConfig::TYPE_TASK_HAS_COMMIT; | 
					
						
							|  |  |  |     $e_dep_on = PhabricatorEdgeConfig::TYPE_TASK_DEPENDS_ON_TASK; | 
					
						
							|  |  |  |     $e_dep_by = PhabricatorEdgeConfig::TYPE_TASK_DEPENDED_ON_BY_TASK; | 
					
						
							| 
									
										
										
										
											2012-07-20 08:59:39 -07:00
										 |  |  |     $e_rev    = PhabricatorEdgeConfig::TYPE_TASK_HAS_RELATED_DREV; | 
					
						
							| 
									
										
										
										
											2012-07-18 20:41:42 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |     $phid = $task->getPHID(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     $query = id(new PhabricatorEdgeQuery()) | 
					
						
							|  |  |  |       ->withSourcePHIDs(array($phid)) | 
					
						
							|  |  |  |       ->withEdgeTypes( | 
					
						
							|  |  |  |         array( | 
					
						
							|  |  |  |           $e_commit, | 
					
						
							|  |  |  |           $e_dep_on, | 
					
						
							|  |  |  |           $e_dep_by, | 
					
						
							| 
									
										
										
										
											2012-07-20 08:59:39 -07:00
										 |  |  |           $e_rev, | 
					
						
							| 
									
										
										
										
											2012-07-18 20:41:42 -07:00
										 |  |  |         )); | 
					
						
							| 
									
										
										
										
											2012-12-11 14:03:16 -08:00
										 |  |  |     $edges = idx($query->execute(), $phid); | 
					
						
							| 
									
										
										
										
											2012-07-18 20:41:42 -07:00
										 |  |  |     $phids = array_fill_keys($query->getDestinationPHIDs(), true); | 
					
						
							| 
									
										
										
										
											2012-04-04 17:34:25 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-08 10:53:59 -08:00
										 |  |  |     foreach ($transactions as $transaction) { | 
					
						
							|  |  |  |       foreach ($transaction->extractPHIDs() as $phid) { | 
					
						
							|  |  |  |         $phids[$phid] = true; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     foreach ($task->getCCPHIDs() as $phid) { | 
					
						
							|  |  |  |       $phids[$phid] = true; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2011-02-20 20:08:16 -08:00
										 |  |  |     foreach ($task->getProjectPHIDs() as $phid) { | 
					
						
							|  |  |  |       $phids[$phid] = true; | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2011-02-08 10:53:59 -08:00
										 |  |  |     if ($task->getOwnerPHID()) { | 
					
						
							|  |  |  |       $phids[$task->getOwnerPHID()] = true; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  |     $phids[$task->getAuthorPHID()] = true; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-17 14:32:01 -08:00
										 |  |  |     $attached = $task->getAttached(); | 
					
						
							|  |  |  |     foreach ($attached as $type => $list) { | 
					
						
							|  |  |  |       foreach ($list as $phid => $info) { | 
					
						
							|  |  |  |         $phids[$phid] = true; | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-03 14:20:05 -07:00
										 |  |  |     if ($parent_task) { | 
					
						
							|  |  |  |       $phids[$parent_task->getPHID()] = true; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     $phids = array_keys($phids); | 
					
						
							| 
									
										
										
										
											2013-03-07 17:24:58 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     $phids = array_merge( | 
					
						
							|  |  |  |       $phids, | 
					
						
							|  |  |  |       array_mergev(mpull($aux_fields, 'getRequiredHandlePHIDs'))); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-12-11 14:03:16 -08:00
										 |  |  |     $this->loadHandles($phids); | 
					
						
							| 
									
										
										
										
											2011-02-20 20:08:16 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-03-07 17:24:58 -08:00
										 |  |  |     $handles = $this->getLoadedHandles(); | 
					
						
							|  |  |  |     foreach ($aux_fields as $aux_field) { | 
					
						
							|  |  |  |       $aux_field->setHandles($handles); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
											
												Tweak style on "Create Another Task" button
Summary:
Not totally sure I'm in love with this but I think it's somewhat non-terrible,
despite the lack of lens flare.
Also made "Cancel" take you back to the task if you got to "Create" from "Create
Another Task".
Test Plan:
  - Style:
https://secure.phabricator.com/file/view/PHID-FILE-ad37d3c1f3b2c7a7a7d1/
  - Hit "Cancel" from "Create Another", got sent back to task.
  - Hit "Cancel" from normal create, got sent back to list.
  - Tried to save an invalid task after making changes to CC/Projects, changes
were preserved.
Reviewed By: codeblock
Reviewers: hunterbridges, jungejason, tuomaspelkonen, aran, codeblock
CC: aran, epriestley, codeblock
Differential Revision: 736
											
										 
											2011-07-27 10:46:22 -07:00
										 |  |  |     $context_bar = null; | 
					
						
							| 
									
										
										
										
											2011-08-03 14:20:05 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |     if ($parent_task) { | 
					
						
							|  |  |  |       $context_bar = new AphrontContextBarView(); | 
					
						
							| 
									
										
										
										
											2013-02-13 14:50:15 -08:00
										 |  |  |       $context_bar->addButton(phutil_tag( | 
					
						
							|  |  |  |       'a', | 
					
						
							|  |  |  |       array( | 
					
						
							|  |  |  |         'href' => '/maniphest/task/create/?parent='.$parent_task->getID(), | 
					
						
							|  |  |  |         'class' => 'green button', | 
					
						
							|  |  |  |       ), | 
					
						
							| 
									
										
										
										
											2013-03-12 23:30:03 -07:00
										 |  |  |       pht('Create Another Subtask'))); | 
					
						
							| 
									
										
										
										
											2013-02-13 14:50:15 -08:00
										 |  |  |       $context_bar->appendChild(hsprintf( | 
					
						
							|  |  |  |         'Created a subtask of <strong>%s</strong>', | 
					
						
							|  |  |  |         $this->getHandle($parent_task->getPHID())->renderLink())); | 
					
						
							| 
									
										
										
										
											2011-08-03 14:20:05 -07:00
										 |  |  |     } else if ($workflow == 'create') { | 
					
						
							| 
									
										
										
											
												Tweak style on "Create Another Task" button
Summary:
Not totally sure I'm in love with this but I think it's somewhat non-terrible,
despite the lack of lens flare.
Also made "Cancel" take you back to the task if you got to "Create" from "Create
Another Task".
Test Plan:
  - Style:
https://secure.phabricator.com/file/view/PHID-FILE-ad37d3c1f3b2c7a7a7d1/
  - Hit "Cancel" from "Create Another", got sent back to task.
  - Hit "Cancel" from normal create, got sent back to list.
  - Tried to save an invalid task after making changes to CC/Projects, changes
were preserved.
Reviewed By: codeblock
Reviewers: hunterbridges, jungejason, tuomaspelkonen, aran, codeblock
CC: aran, epriestley, codeblock
Differential Revision: 736
											
										 
											2011-07-27 10:46:22 -07:00
										 |  |  |       $context_bar = new AphrontContextBarView(); | 
					
						
							| 
									
										
										
										
											2013-02-13 14:50:15 -08:00
										 |  |  |       $context_bar->addButton(phutil_tag('label', array(), 'Create Another')); | 
					
						
							|  |  |  |       $context_bar->addButton(phutil_tag( | 
					
						
							|  |  |  |         'a', | 
					
						
							|  |  |  |         array( | 
					
						
							|  |  |  |           'href' => '/maniphest/task/create/?template='.$task->getID(), | 
					
						
							|  |  |  |           'class' => 'green button', | 
					
						
							|  |  |  |         ), | 
					
						
							| 
									
										
										
										
											2013-03-12 23:30:03 -07:00
										 |  |  |         pht('Similar Task'))); | 
					
						
							| 
									
										
										
										
											2013-02-13 14:50:15 -08:00
										 |  |  |       $context_bar->addButton(phutil_tag( | 
					
						
							|  |  |  |         'a', | 
					
						
							|  |  |  |         array( | 
					
						
							|  |  |  |           'href' => '/maniphest/task/create/', | 
					
						
							|  |  |  |           'class' => 'green button', | 
					
						
							|  |  |  |         ), | 
					
						
							| 
									
										
										
										
											2013-03-12 23:30:03 -07:00
										 |  |  |         pht('Empty Task'))); | 
					
						
							|  |  |  |       $context_bar->appendChild(pht('New task created.')); | 
					
						
							| 
									
										
										
										
											2011-07-26 12:39:36 -05:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2011-02-20 14:15:53 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-07-11 11:40:10 -07:00
										 |  |  |     $engine = new PhabricatorMarkupEngine(); | 
					
						
							| 
									
										
										
										
											2012-09-05 11:40:48 -07:00
										 |  |  |     $engine->setViewer($user); | 
					
						
							| 
									
										
										
										
											2012-07-11 11:40:10 -07:00
										 |  |  |     $engine->addObject($task, ManiphestTask::MARKUP_FIELD_DESCRIPTION); | 
					
						
							|  |  |  |     foreach ($transactions as $xaction) { | 
					
						
							|  |  |  |       if ($xaction->hasComments()) { | 
					
						
							|  |  |  |         $engine->addObject($xaction, ManiphestTransaction::MARKUP_FIELD_BODY); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-03-07 17:24:33 -08:00
										 |  |  |     foreach ($aux_fields as $aux_field) { | 
					
						
							|  |  |  |       foreach ($aux_field->getMarkupFields() as $markup_field) { | 
					
						
							|  |  |  |         $engine->addObject($aux_field, $markup_field); | 
					
						
							|  |  |  |         $aux_field->setMarkupEngine($engine); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     $engine->process(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-08 10:53:59 -08:00
										 |  |  |     $transaction_types = ManiphestTransactionType::getTransactionTypeMap(); | 
					
						
							|  |  |  |     $resolution_types = ManiphestTaskStatus::getTaskStatusMap(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if ($task->getStatus() == ManiphestTaskStatus::STATUS_OPEN) { | 
					
						
							|  |  |  |       $resolution_types = array_select_keys( | 
					
						
							|  |  |  |         $resolution_types, | 
					
						
							|  |  |  |         array( | 
					
						
							|  |  |  |           ManiphestTaskStatus::STATUS_CLOSED_RESOLVED, | 
					
						
							|  |  |  |           ManiphestTaskStatus::STATUS_CLOSED_WONTFIX, | 
					
						
							|  |  |  |           ManiphestTaskStatus::STATUS_CLOSED_INVALID, | 
					
						
							|  |  |  |           ManiphestTaskStatus::STATUS_CLOSED_SPITE, | 
					
						
							|  |  |  |         )); | 
					
						
							|  |  |  |     } else { | 
					
						
							|  |  |  |       $resolution_types = array( | 
					
						
							|  |  |  |         ManiphestTaskStatus::STATUS_OPEN => 'Reopened', | 
					
						
							|  |  |  |       ); | 
					
						
							|  |  |  |       $transaction_types[ManiphestTransactionType::TYPE_STATUS] = | 
					
						
							|  |  |  |         'Reopen Task'; | 
					
						
							|  |  |  |       unset($transaction_types[ManiphestTransactionType::TYPE_PRIORITY]); | 
					
						
							|  |  |  |       unset($transaction_types[ManiphestTransactionType::TYPE_OWNER]); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     $default_claim = array( | 
					
						
							|  |  |  |       $user->getPHID() => $user->getUsername().' ('.$user->getRealName().')', | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-10 16:18:47 -07:00
										 |  |  |     $draft = id(new PhabricatorDraft())->loadOneWhere( | 
					
						
							|  |  |  |       'authorPHID = %s AND draftKey = %s', | 
					
						
							|  |  |  |       $user->getPHID(), | 
					
						
							|  |  |  |       $task->getPHID()); | 
					
						
							|  |  |  |     if ($draft) { | 
					
						
							|  |  |  |       $draft_text = $draft->getDraft(); | 
					
						
							|  |  |  |     } else { | 
					
						
							|  |  |  |       $draft_text = null; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
											
												Provide a configuration flag to disable silliness in the UI
Summary: See comments. A few installs have remarked that their organizations
would prefer buttons labled "Submit" to buttons labeled "Clowncopterize".
Test Plan:
  - In "serious" mode, verified Differential and Maniphest have serious strings,
tasks can not be closed out of spite, and reset/welcome emails are extremely
serious.
  - In unserious mode, verified Differential and Maniphest have normal strings,
tasks can be closed out of spite, and reset/welcome emails are silly.
  - This does not disable the "fax these changes" message in Arcanist (no
reasonable way for it to read the config value) or the rainbow syntax
highlighter (already removable though configuration).
Reviewers: moskov, jungejason, nh, tuomaspelkonen, aran
Reviewed By: moskov
CC: aran, moskov
Differential Revision: 1081
											
										 
											2011-11-04 15:16:34 -07:00
										 |  |  |     $is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business'); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if ($is_serious) { | 
					
						
							|  |  |  |       // Prevent tasks from being closed "out of spite" in serious business
 | 
					
						
							|  |  |  |       // installs.
 | 
					
						
							|  |  |  |       unset($resolution_types[ManiphestTaskStatus::STATUS_CLOSED_SPITE]); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-08 10:53:59 -08:00
										 |  |  |     $comment_form = new AphrontFormView(); | 
					
						
							|  |  |  |     $comment_form | 
					
						
							|  |  |  |       ->setUser($user) | 
					
						
							|  |  |  |       ->setAction('/maniphest/transaction/save/') | 
					
						
							| 
									
										
										
										
											2011-02-20 20:08:16 -08:00
										 |  |  |       ->setEncType('multipart/form-data') | 
					
						
							| 
									
										
										
										
											2011-02-08 10:53:59 -08:00
										 |  |  |       ->addHiddenInput('taskID', $task->getID()) | 
					
						
							|  |  |  |       ->appendChild( | 
					
						
							|  |  |  |         id(new AphrontFormSelectControl()) | 
					
						
							| 
									
										
										
										
											2013-03-12 23:30:03 -07:00
										 |  |  |           ->setLabel(pht('Action')) | 
					
						
							| 
									
										
										
										
											2011-02-08 10:53:59 -08:00
										 |  |  |           ->setName('action') | 
					
						
							|  |  |  |           ->setOptions($transaction_types) | 
					
						
							|  |  |  |           ->setID('transaction-action')) | 
					
						
							|  |  |  |       ->appendChild( | 
					
						
							|  |  |  |         id(new AphrontFormSelectControl()) | 
					
						
							| 
									
										
										
										
											2013-03-12 23:30:03 -07:00
										 |  |  |           ->setLabel(pht('Resolution')) | 
					
						
							| 
									
										
										
										
											2011-02-08 10:53:59 -08:00
										 |  |  |           ->setName('resolution') | 
					
						
							|  |  |  |           ->setControlID('resolution') | 
					
						
							|  |  |  |           ->setControlStyle('display: none') | 
					
						
							|  |  |  |           ->setOptions($resolution_types)) | 
					
						
							|  |  |  |       ->appendChild( | 
					
						
							|  |  |  |         id(new AphrontFormTokenizerControl()) | 
					
						
							| 
									
										
										
										
											2013-03-12 23:30:03 -07:00
										 |  |  |           ->setLabel(pht('Assign To')) | 
					
						
							| 
									
										
										
										
											2011-02-08 10:53:59 -08:00
										 |  |  |           ->setName('assign_to') | 
					
						
							|  |  |  |           ->setControlID('assign_to') | 
					
						
							|  |  |  |           ->setControlStyle('display: none') | 
					
						
							|  |  |  |           ->setID('assign-tokenizer') | 
					
						
							|  |  |  |           ->setDisableBehavior(true)) | 
					
						
							|  |  |  |       ->appendChild( | 
					
						
							|  |  |  |         id(new AphrontFormTokenizerControl()) | 
					
						
							| 
									
										
										
										
											2013-03-12 23:30:03 -07:00
										 |  |  |           ->setLabel(pht('CCs')) | 
					
						
							| 
									
										
										
										
											2011-02-08 10:53:59 -08:00
										 |  |  |           ->setName('ccs') | 
					
						
							|  |  |  |           ->setControlID('ccs') | 
					
						
							|  |  |  |           ->setControlStyle('display: none') | 
					
						
							|  |  |  |           ->setID('cc-tokenizer') | 
					
						
							|  |  |  |           ->setDisableBehavior(true)) | 
					
						
							|  |  |  |       ->appendChild( | 
					
						
							|  |  |  |         id(new AphrontFormSelectControl()) | 
					
						
							| 
									
										
										
										
											2013-03-12 23:30:03 -07:00
										 |  |  |           ->setLabel(pht('Priority')) | 
					
						
							| 
									
										
										
										
											2011-02-08 10:53:59 -08:00
										 |  |  |           ->setName('priority') | 
					
						
							|  |  |  |           ->setOptions($priority_map) | 
					
						
							|  |  |  |           ->setControlID('priority') | 
					
						
							|  |  |  |           ->setControlStyle('display: none') | 
					
						
							|  |  |  |           ->setValue($task->getPriority())) | 
					
						
							| 
									
										
										
										
											2011-02-20 20:08:16 -08:00
										 |  |  |       ->appendChild( | 
					
						
							|  |  |  |         id(new AphrontFormTokenizerControl()) | 
					
						
							| 
									
										
										
										
											2013-03-12 23:30:03 -07:00
										 |  |  |           ->setLabel(pht('Projects')) | 
					
						
							| 
									
										
										
										
											2011-02-20 20:08:16 -08:00
										 |  |  |           ->setName('projects') | 
					
						
							|  |  |  |           ->setControlID('projects') | 
					
						
							|  |  |  |           ->setControlStyle('display: none') | 
					
						
							|  |  |  |           ->setID('projects-tokenizer') | 
					
						
							|  |  |  |           ->setDisableBehavior(true)) | 
					
						
							|  |  |  |       ->appendChild( | 
					
						
							|  |  |  |         id(new AphrontFormFileControl()) | 
					
						
							| 
									
										
										
										
											2013-03-12 23:30:03 -07:00
										 |  |  |           ->setLabel(pht('File')) | 
					
						
							| 
									
										
										
										
											2011-02-20 20:08:16 -08:00
										 |  |  |           ->setName('file') | 
					
						
							|  |  |  |           ->setControlID('file') | 
					
						
							|  |  |  |           ->setControlStyle('display: none')) | 
					
						
							| 
									
										
										
										
											2011-02-08 10:53:59 -08:00
										 |  |  |       ->appendChild( | 
					
						
							| 
									
										
										
										
											2012-09-19 12:27:28 -07:00
										 |  |  |         id(new PhabricatorRemarkupControl()) | 
					
						
							| 
									
										
										
										
											2013-03-12 23:30:03 -07:00
										 |  |  |           ->setLabel(pht('Comments')) | 
					
						
							| 
									
										
										
										
											2011-02-08 10:53:59 -08:00
										 |  |  |           ->setName('comments') | 
					
						
							| 
									
										
										
										
											2011-05-10 16:18:47 -07:00
										 |  |  |           ->setValue($draft_text) | 
					
						
							| 
									
										
										
										
											2012-11-27 14:06:31 -08:00
										 |  |  |           ->setID('transaction-comments') | 
					
						
							|  |  |  |           ->setUser($user)) | 
					
						
							| 
									
										
										
										
											2011-02-08 10:53:59 -08:00
										 |  |  |       ->appendChild( | 
					
						
							|  |  |  |         id(new AphrontFormSubmitControl()) | 
					
						
							| 
									
										
										
										
											2013-03-12 23:30:03 -07:00
										 |  |  |           ->setValue($is_serious ? pht('Submit') : pht('Avast!'))); | 
					
						
							| 
									
										
										
										
											2011-02-08 10:53:59 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-11 04:17:48 -07:00
										 |  |  |     $control_map = array( | 
					
						
							|  |  |  |       ManiphestTransactionType::TYPE_STATUS   => 'resolution', | 
					
						
							|  |  |  |       ManiphestTransactionType::TYPE_OWNER    => 'assign_to', | 
					
						
							|  |  |  |       ManiphestTransactionType::TYPE_CCS      => 'ccs', | 
					
						
							|  |  |  |       ManiphestTransactionType::TYPE_PRIORITY => 'priority', | 
					
						
							|  |  |  |       ManiphestTransactionType::TYPE_PROJECTS => 'projects', | 
					
						
							|  |  |  |       ManiphestTransactionType::TYPE_ATTACH   => 'file', | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-04-14 07:05:58 -07:00
										 |  |  |     $tokenizer_map = array( | 
					
						
							|  |  |  |       ManiphestTransactionType::TYPE_PROJECTS => array( | 
					
						
							|  |  |  |         'id'          => 'projects-tokenizer', | 
					
						
							|  |  |  |         'src'         => '/typeahead/common/projects/', | 
					
						
							|  |  |  |         'ondemand'    => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'), | 
					
						
							| 
									
										
										
										
											2013-03-12 23:30:03 -07:00
										 |  |  |         'placeholder' => pht('Type a project name...'), | 
					
						
							| 
									
										
										
										
											2012-04-14 07:05:58 -07:00
										 |  |  |       ), | 
					
						
							|  |  |  |       ManiphestTransactionType::TYPE_OWNER => array( | 
					
						
							|  |  |  |         'id'          => 'assign-tokenizer', | 
					
						
							|  |  |  |         'src'         => '/typeahead/common/users/', | 
					
						
							|  |  |  |         'value'       => $default_claim, | 
					
						
							|  |  |  |         'limit'       => 1, | 
					
						
							|  |  |  |         'ondemand'    => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'), | 
					
						
							| 
									
										
										
										
											2013-03-12 23:30:03 -07:00
										 |  |  |         'placeholder' => pht('Type a user name...'), | 
					
						
							| 
									
										
										
										
											2012-04-14 07:05:58 -07:00
										 |  |  |       ), | 
					
						
							|  |  |  |       ManiphestTransactionType::TYPE_CCS => array( | 
					
						
							|  |  |  |         'id'          => 'cc-tokenizer', | 
					
						
							|  |  |  |         'src'         => '/typeahead/common/mailable/', | 
					
						
							|  |  |  |         'ondemand'    => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'), | 
					
						
							| 
									
										
										
										
											2013-03-12 23:30:03 -07:00
										 |  |  |         'placeholder' => pht('Type a user or mailing list...'), | 
					
						
							| 
									
										
										
										
											2012-04-14 07:05:58 -07:00
										 |  |  |       ), | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-08 10:53:59 -08:00
										 |  |  |     Javelin::initBehavior('maniphest-transaction-controls', array( | 
					
						
							| 
									
										
										
										
											2012-04-14 07:05:58 -07:00
										 |  |  |       'select'     => 'transaction-action', | 
					
						
							| 
									
										
										
										
											2011-05-11 04:17:48 -07:00
										 |  |  |       'controlMap' => $control_map, | 
					
						
							| 
									
										
										
										
											2012-04-14 07:05:58 -07:00
										 |  |  |       'tokenizers' => $tokenizer_map, | 
					
						
							| 
									
										
										
										
											2011-02-08 10:53:59 -08:00
										 |  |  |     )); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-05-10 08:29:28 -07:00
										 |  |  |     Javelin::initBehavior('maniphest-transaction-preview', array( | 
					
						
							| 
									
										
										
										
											2012-04-14 07:05:58 -07:00
										 |  |  |       'uri'        => '/maniphest/transaction/preview/'.$task->getID().'/', | 
					
						
							|  |  |  |       'preview'    => 'transaction-preview', | 
					
						
							|  |  |  |       'comments'   => 'transaction-comments', | 
					
						
							|  |  |  |       'action'     => 'transaction-action', | 
					
						
							|  |  |  |       'map'        => $control_map, | 
					
						
							|  |  |  |       'tokenizers' => $tokenizer_map, | 
					
						
							| 
									
										
										
										
											2011-05-10 08:29:28 -07:00
										 |  |  |     )); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-01-24 16:29:47 -08:00
										 |  |  |     $comment_header = id(new PhabricatorHeaderView()) | 
					
						
							|  |  |  |       ->setHeader($is_serious ? pht('Add Comment') : pht('Weigh In')); | 
					
						
							| 
									
										
										
										
											2011-02-08 10:53:59 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-13 14:50:15 -08:00
										 |  |  |     $preview_panel = hsprintf( | 
					
						
							| 
									
										
										
											
												Tweak Maniphest CSS, fix remarkup in description change views
Summary:
Various CSS tweaks and fixes:
  - Add remarkup styling to description change views, missed this before.
  - Fix CSS so that transactions with only one item (e.g., changed priority)
don't have weird floater underneath them.
  - Add more space between transaction items.
  - Make default background color lighter and less heavy.
  - Use beigey color for comment form in Maniphest.
  - Share more CSS between Maniphest and Differential (previews, feedback).
  - Move "Leap Into Action" call to Differential, replace Maniphest with
thematically-consistent "Weigh In" (obviously, Maniphest has a nautical theme).
Test Plan:
Browsed Maniphest and Differential in a couple browsers, styling all seems
correct.
Reviewed By: tomo
Reviewers: tomo, aran, jungejason, tuomaspelkonen
CC: anjali, aran, tomo
Differential Revision: 328
											
										 
											2011-05-22 08:49:07 -07:00
										 |  |  |       '<div class="aphront-panel-preview"> | 
					
						
							| 
									
										
										
										
											2011-05-10 08:29:28 -07:00
										 |  |  |         <div id="transaction-preview"> | 
					
						
							| 
									
										
										
										
											2013-02-13 14:50:15 -08:00
										 |  |  |           <div class="aphront-panel-preview-loading-text">%s</div> | 
					
						
							| 
									
										
										
										
											2011-05-10 08:29:28 -07:00
										 |  |  |         </div> | 
					
						
							| 
									
										
										
										
											2013-02-13 14:50:15 -08:00
										 |  |  |       </div>', | 
					
						
							|  |  |  |       pht('Loading preview...')); | 
					
						
							| 
									
										
										
										
											2011-05-10 08:29:28 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-08 10:53:59 -08:00
										 |  |  |     $transaction_view = new ManiphestTransactionListView(); | 
					
						
							|  |  |  |     $transaction_view->setTransactions($transactions); | 
					
						
							| 
									
										
										
										
											2012-12-11 14:03:16 -08:00
										 |  |  |     $transaction_view->setHandles($this->getLoadedHandles()); | 
					
						
							| 
									
										
										
										
											2011-02-08 10:53:59 -08:00
										 |  |  |     $transaction_view->setUser($user); | 
					
						
							| 
									
										
										
										
											2012-03-06 15:10:17 -08:00
										 |  |  |     $transaction_view->setAuxiliaryFields($aux_fields); | 
					
						
							| 
									
										
										
										
											2011-02-08 10:53:59 -08:00
										 |  |  |     $transaction_view->setMarkupEngine($engine); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-12-11 14:03:16 -08:00
										 |  |  |     $object_name = 'T'.$task->getID(); | 
					
						
							| 
									
										
										
										
											2013-04-09 12:42:03 -07:00
										 |  |  |     $actions = $this->buildActionView($task); | 
					
						
							| 
									
										
										
										
											2012-12-11 14:03:16 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     $crumbs = $this->buildApplicationCrumbs(); | 
					
						
							|  |  |  |     $crumbs->addCrumb( | 
					
						
							|  |  |  |       id(new PhabricatorCrumbView()) | 
					
						
							|  |  |  |         ->setName($object_name) | 
					
						
							| 
									
										
										
										
											2013-03-26 13:15:15 -07:00
										 |  |  |         ->setHref('/'.$object_name)) | 
					
						
							| 
									
										
										
										
											2013-04-09 12:42:03 -07:00
										 |  |  |       ->setActionList($actions) | 
					
						
							| 
									
										
										
										
											2013-03-26 13:15:15 -07:00
										 |  |  |       ->addAction( | 
					
						
							| 
									
										
										
										
											2013-06-05 08:41:43 -07:00
										 |  |  |         id(new PHUIListItemView()) | 
					
						
							| 
									
										
										
										
											2013-03-26 13:15:15 -07:00
										 |  |  |           ->setHref($this->getApplicationURI('/task/create/')) | 
					
						
							|  |  |  |           ->setName(pht('Create Task')) | 
					
						
							|  |  |  |           ->setIcon('create')); | 
					
						
							| 
									
										
										
										
											2012-12-11 14:03:16 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     $header = $this->buildHeaderView($task); | 
					
						
							|  |  |  |     $properties = $this->buildPropertyView($task, $aux_fields, $edges, $engine); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return $this->buildApplicationPage( | 
					
						
							| 
									
										
										
										
											2011-02-08 10:53:59 -08:00
										 |  |  |       array( | 
					
						
							| 
									
										
										
										
											2012-12-11 14:03:16 -08:00
										 |  |  |         $crumbs, | 
					
						
							| 
									
										
										
											
												Tweak style on "Create Another Task" button
Summary:
Not totally sure I'm in love with this but I think it's somewhat non-terrible,
despite the lack of lens flare.
Also made "Cancel" take you back to the task if you got to "Create" from "Create
Another Task".
Test Plan:
  - Style:
https://secure.phabricator.com/file/view/PHID-FILE-ad37d3c1f3b2c7a7a7d1/
  - Hit "Cancel" from "Create Another", got sent back to task.
  - Hit "Cancel" from normal create, got sent back to list.
  - Tried to save an invalid task after making changes to CC/Projects, changes
were preserved.
Reviewed By: codeblock
Reviewers: hunterbridges, jungejason, tuomaspelkonen, aran, codeblock
CC: aran, epriestley, codeblock
Differential Revision: 736
											
										 
											2011-07-27 10:46:22 -07:00
										 |  |  |         $context_bar, | 
					
						
							| 
									
										
										
										
											2012-12-11 14:03:16 -08:00
										 |  |  |         $header, | 
					
						
							|  |  |  |         $actions, | 
					
						
							|  |  |  |         $properties, | 
					
						
							| 
									
										
										
										
											2011-02-08 10:53:59 -08:00
										 |  |  |         $transaction_view, | 
					
						
							| 
									
										
										
										
											2013-01-24 16:29:47 -08:00
										 |  |  |         $comment_header, | 
					
						
							|  |  |  |         $comment_form, | 
					
						
							| 
									
										
										
										
											2011-05-10 08:29:28 -07:00
										 |  |  |         $preview_panel, | 
					
						
							| 
									
										
										
										
											2011-02-08 10:53:59 -08:00
										 |  |  |       ), | 
					
						
							|  |  |  |       array( | 
					
						
							| 
									
										
										
										
											2011-02-09 16:38:31 -08:00
										 |  |  |         'title' => 'T'.$task->getID().' '.$task->getTitle(), | 
					
						
							| 
									
										
										
										
											2012-06-13 17:28:21 -07:00
										 |  |  |         'pageObjects' => array($task->getPHID()), | 
					
						
							| 
									
										
										
										
											2013-01-24 16:29:47 -08:00
										 |  |  |         'device' => true, | 
					
						
							| 
									
										
										
										
											2011-02-08 10:53:59 -08:00
										 |  |  |       )); | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2011-02-18 22:15:28 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-12-11 14:03:16 -08:00
										 |  |  |   private function buildHeaderView(ManiphestTask $task) { | 
					
						
							|  |  |  |     $view = id(new PhabricatorHeaderView()) | 
					
						
							|  |  |  |       ->setHeader($task->getTitle()); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-04-03 08:28:18 -07:00
										 |  |  |     $view->addTag(ManiphestView::renderTagForTask($task)); | 
					
						
							| 
									
										
										
										
											2012-12-11 14:03:16 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     return $view; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   private function buildActionView(ManiphestTask $task) { | 
					
						
							|  |  |  |     $viewer = $this->getRequest()->getUser(); | 
					
						
							| 
									
										
										
										
											2013-05-03 15:47:39 -07:00
										 |  |  |     $viewer_phid = $viewer->getPHID(); | 
					
						
							|  |  |  |     $viewer_is_cc = in_array($viewer_phid, $task->getCCPHIDs()); | 
					
						
							| 
									
										
										
										
											2012-12-11 14:03:16 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     $id = $task->getID(); | 
					
						
							|  |  |  |     $phid = $task->getPHID(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     $view = new PhabricatorActionListView(); | 
					
						
							|  |  |  |     $view->setUser($viewer); | 
					
						
							|  |  |  |     $view->setObject($task); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     $view->addAction( | 
					
						
							|  |  |  |       id(new PhabricatorActionView()) | 
					
						
							|  |  |  |         ->setName(pht('Edit Task')) | 
					
						
							|  |  |  |         ->setIcon('edit') | 
					
						
							|  |  |  |         ->setHref($this->getApplicationURI("/task/edit/{$id}/"))); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-03 15:47:39 -07:00
										 |  |  |     if ($task->getOwnerPHID() === $viewer_phid) { | 
					
						
							|  |  |  |       $view->addAction( | 
					
						
							|  |  |  |         id(new PhabricatorActionView()) | 
					
						
							|  |  |  |           ->setName(pht('Automatically Subscribed')) | 
					
						
							|  |  |  |           ->setDisabled(true) | 
					
						
							|  |  |  |           ->setIcon('subscribe-auto')); | 
					
						
							|  |  |  |     } else { | 
					
						
							|  |  |  |       $action = $viewer_is_cc ? 'rem' : 'add'; | 
					
						
							|  |  |  |       $name   = $viewer_is_cc ? 'Unsubscribe' : 'Subscribe'; | 
					
						
							|  |  |  |       $icon   = $viewer_is_cc ? 'subscribe-delete' : 'subscribe-add'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       $view->addAction( | 
					
						
							|  |  |  |         id(new PhabricatorActionView()) | 
					
						
							|  |  |  |           ->setName(pht($name)) | 
					
						
							|  |  |  |           ->setHref("/maniphest/subscribe/{$action}/{$id}/") | 
					
						
							|  |  |  |           ->setRenderAsForm(true) | 
					
						
							|  |  |  |           ->setUser($viewer) | 
					
						
							|  |  |  |           ->setIcon($icon)); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-12-11 14:03:16 -08:00
										 |  |  |     $view->addAction( | 
					
						
							|  |  |  |       id(new PhabricatorActionView()) | 
					
						
							|  |  |  |         ->setName(pht('Merge Duplicates')) | 
					
						
							|  |  |  |         ->setHref("/search/attach/{$phid}/TASK/merge/") | 
					
						
							|  |  |  |         ->setWorkflow(true) | 
					
						
							|  |  |  |         ->setIcon('merge')); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     $view->addAction( | 
					
						
							|  |  |  |       id(new PhabricatorActionView()) | 
					
						
							|  |  |  |         ->setName(pht('Create Subtask')) | 
					
						
							|  |  |  |         ->setHref($this->getApplicationURI("/task/create/?parent={$id}")) | 
					
						
							|  |  |  |         ->setIcon('fork')); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     $view->addAction( | 
					
						
							|  |  |  |       id(new PhabricatorActionView()) | 
					
						
							|  |  |  |         ->setName(pht('Edit Dependencies')) | 
					
						
							|  |  |  |         ->setHref("/search/attach/{$phid}/TASK/dependencies/") | 
					
						
							|  |  |  |         ->setWorkflow(true) | 
					
						
							|  |  |  |         ->setIcon('link')); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     $view->addAction( | 
					
						
							|  |  |  |       id(new PhabricatorActionView()) | 
					
						
							|  |  |  |         ->setName(pht('Edit Differential Revisions')) | 
					
						
							|  |  |  |         ->setHref("/search/attach/{$phid}/DREV/") | 
					
						
							|  |  |  |         ->setWorkflow(true) | 
					
						
							|  |  |  |         ->setIcon('attach')); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     return $view; | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   private function buildPropertyView( | 
					
						
							|  |  |  |     ManiphestTask $task, | 
					
						
							|  |  |  |     array $aux_fields, | 
					
						
							|  |  |  |     array $edges, | 
					
						
							|  |  |  |     PhabricatorMarkupEngine $engine) { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     $viewer = $this->getRequest()->getUser(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-15 07:47:14 -08:00
										 |  |  |     $view = id(new PhabricatorPropertyListView()) | 
					
						
							|  |  |  |       ->setUser($viewer) | 
					
						
							|  |  |  |       ->setObject($task); | 
					
						
							| 
									
										
										
										
											2012-12-11 14:03:16 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     $view->addProperty( | 
					
						
							|  |  |  |       pht('Assigned To'), | 
					
						
							|  |  |  |       $task->getOwnerPHID() | 
					
						
							|  |  |  |         ? $this->getHandle($task->getOwnerPHID())->renderLink() | 
					
						
							| 
									
										
										
										
											2013-01-29 11:01:47 -08:00
										 |  |  |         : phutil_tag('em', array(), pht('None'))); | 
					
						
							| 
									
										
										
										
											2012-12-11 14:03:16 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     $view->addProperty( | 
					
						
							|  |  |  |       pht('Priority'), | 
					
						
							| 
									
										
										
										
											2013-01-29 11:01:47 -08:00
										 |  |  |       ManiphestTaskPriority::getTaskPriorityName($task->getPriority())); | 
					
						
							| 
									
										
										
										
											2012-12-11 14:03:16 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     $view->addProperty( | 
					
						
							|  |  |  |       pht('Subscribers'), | 
					
						
							|  |  |  |       $task->getCCPHIDs() | 
					
						
							| 
									
										
										
										
											2012-12-11 17:15:59 -08:00
										 |  |  |         ? $this->renderHandlesForPHIDs($task->getCCPHIDs(), ',') | 
					
						
							| 
									
										
										
										
											2013-01-29 11:01:47 -08:00
										 |  |  |         : phutil_tag('em', array(), pht('None'))); | 
					
						
							| 
									
										
										
										
											2012-12-11 14:03:16 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     $view->addProperty( | 
					
						
							|  |  |  |       pht('Author'), | 
					
						
							|  |  |  |       $this->getHandle($task->getAuthorPHID())->renderLink()); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     $source = $task->getOriginalEmailSource(); | 
					
						
							|  |  |  |     if ($source) { | 
					
						
							|  |  |  |       $subject = '[T'.$task->getID().'] '.$task->getTitle(); | 
					
						
							|  |  |  |       $view->addProperty( | 
					
						
							|  |  |  |         pht('From Email'), | 
					
						
							| 
									
										
										
										
											2013-01-17 18:43:35 -08:00
										 |  |  |         phutil_tag( | 
					
						
							| 
									
										
										
										
											2012-12-11 14:03:16 -08:00
										 |  |  |           'a', | 
					
						
							|  |  |  |           array( | 
					
						
							|  |  |  |             'href' => 'mailto:'.$source.'?subject='.$subject | 
					
						
							|  |  |  |             ), | 
					
						
							| 
									
										
										
										
											2013-01-17 18:43:35 -08:00
										 |  |  |           $source)); | 
					
						
							| 
									
										
										
										
											2012-12-11 14:03:16 -08:00
										 |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     $view->addProperty( | 
					
						
							|  |  |  |       pht('Projects'), | 
					
						
							|  |  |  |       $task->getProjectPHIDs() | 
					
						
							| 
									
										
										
										
											2012-12-11 17:15:59 -08:00
										 |  |  |         ? $this->renderHandlesForPHIDs($task->getProjectPHIDs(), ',') | 
					
						
							| 
									
										
										
										
											2013-01-29 11:01:47 -08:00
										 |  |  |         : phutil_tag('em', array(), pht('None'))); | 
					
						
							| 
									
										
										
										
											2012-12-11 14:03:16 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     foreach ($aux_fields as $aux_field) { | 
					
						
							|  |  |  |       $value = $aux_field->renderForDetailView(); | 
					
						
							|  |  |  |       if (strlen($value)) { | 
					
						
							|  |  |  |         $view->addProperty($aux_field->getLabel(), $value); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     $edge_types = array( | 
					
						
							|  |  |  |       PhabricatorEdgeConfig::TYPE_TASK_DEPENDED_ON_BY_TASK | 
					
						
							|  |  |  |         => pht('Dependent Tasks'), | 
					
						
							|  |  |  |       PhabricatorEdgeConfig::TYPE_TASK_DEPENDS_ON_TASK | 
					
						
							|  |  |  |         => pht('Depends On'), | 
					
						
							|  |  |  |       PhabricatorEdgeConfig::TYPE_TASK_HAS_RELATED_DREV | 
					
						
							|  |  |  |         => pht('Differential Revisions'), | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-04-06 11:40:43 -07:00
										 |  |  |     $revisions_commits = array(); | 
					
						
							|  |  |  |     $handles = $this->getLoadedHandles(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     $commit_phids = array_keys( | 
					
						
							|  |  |  |       $edges[PhabricatorEdgeConfig::TYPE_TASK_HAS_COMMIT]); | 
					
						
							|  |  |  |     if ($commit_phids) { | 
					
						
							| 
									
										
										
										
											2013-04-12 22:48:16 -07:00
										 |  |  |       $commit_drev = PhabricatorEdgeConfig::TYPE_COMMIT_HAS_DREV; | 
					
						
							|  |  |  |       $drev_edges = id(new PhabricatorEdgeQuery()) | 
					
						
							|  |  |  |         ->withSourcePHIDs($commit_phids) | 
					
						
							|  |  |  |         ->withEdgeTypes(array($commit_drev)) | 
					
						
							|  |  |  |         ->execute(); | 
					
						
							| 
									
										
										
										
											2013-04-06 11:40:43 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-04-12 22:48:16 -07:00
										 |  |  |       foreach ($commit_phids as $phid) { | 
					
						
							| 
									
										
										
										
											2013-04-06 11:40:43 -07:00
										 |  |  |         $revisions_commits[$phid] = $handles[$phid]->renderLink(); | 
					
						
							| 
									
										
										
										
											2013-04-12 22:48:16 -07:00
										 |  |  |         $revision_phid = key($drev_edges[$phid][$commit_drev]); | 
					
						
							| 
									
										
										
										
											2013-04-06 11:40:43 -07:00
										 |  |  |         $revision_handle = idx($handles, $revision_phid); | 
					
						
							|  |  |  |         if ($revision_handle) { | 
					
						
							| 
									
										
										
										
											2013-04-12 22:48:16 -07:00
										 |  |  |           $task_drev = PhabricatorEdgeConfig::TYPE_TASK_HAS_RELATED_DREV; | 
					
						
							|  |  |  |           unset($edges[$task_drev][$revision_phid]); | 
					
						
							| 
									
										
										
										
											2013-04-06 11:40:43 -07:00
										 |  |  |           $revisions_commits[$phid] = hsprintf( | 
					
						
							|  |  |  |             '%s / %s', | 
					
						
							|  |  |  |             $revision_handle->renderLink($revision_handle->getName()), | 
					
						
							|  |  |  |             $revisions_commits[$phid]); | 
					
						
							|  |  |  |         } | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-12-11 14:03:16 -08:00
										 |  |  |     foreach ($edge_types as $edge_type => $edge_name) { | 
					
						
							|  |  |  |       if ($edges[$edge_type]) { | 
					
						
							|  |  |  |         $view->addProperty( | 
					
						
							|  |  |  |           $edge_name, | 
					
						
							|  |  |  |           $this->renderHandlesForPHIDs(array_keys($edges[$edge_type]))); | 
					
						
							|  |  |  |       } | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-04-06 11:40:43 -07:00
										 |  |  |     if ($revisions_commits) { | 
					
						
							|  |  |  |       $view->addProperty( | 
					
						
							|  |  |  |         pht('Commits'), | 
					
						
							|  |  |  |         phutil_implode_html(phutil_tag('br'), $revisions_commits)); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-12-11 14:03:16 -08:00
										 |  |  |     $attached = $task->getAttached(); | 
					
						
							|  |  |  |     $file_infos = idx($attached, PhabricatorPHIDConstants::PHID_TYPE_FILE); | 
					
						
							|  |  |  |     if ($file_infos) { | 
					
						
							|  |  |  |       $file_phids = array_keys($file_infos); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       $files = id(new PhabricatorFile())->loadAllWhere( | 
					
						
							|  |  |  |         'phid IN (%Ls)', | 
					
						
							|  |  |  |         $file_phids); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       $file_view = new PhabricatorFileLinkListView(); | 
					
						
							|  |  |  |       $file_view->setFiles($files); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |       $view->addProperty( | 
					
						
							|  |  |  |         pht('Files'), | 
					
						
							|  |  |  |         $file_view->render()); | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-02-15 07:47:14 -08:00
										 |  |  |     $view->invokeWillRenderEvent(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-12-11 14:03:16 -08:00
										 |  |  |     if (strlen($task->getDescription())) { | 
					
						
							|  |  |  |       $view->addSectionHeader(pht('Description')); | 
					
						
							|  |  |  |       $view->addTextContent( | 
					
						
							| 
									
										
										
										
											2013-01-28 18:46:48 -08:00
										 |  |  |         phutil_tag( | 
					
						
							| 
									
										
										
										
											2012-12-11 14:03:16 -08:00
										 |  |  |           'div', | 
					
						
							|  |  |  |           array( | 
					
						
							|  |  |  |             'class' => 'phabricator-remarkup', | 
					
						
							|  |  |  |           ), | 
					
						
							|  |  |  |           $engine->getOutput($task, ManiphestTask::MARKUP_FIELD_DESCRIPTION))); | 
					
						
							| 
									
										
										
										
											2012-07-18 20:41:42 -07:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2012-12-11 14:03:16 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |     return $view; | 
					
						
							| 
									
										
										
										
											2012-07-18 20:41:42 -07:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-12-11 14:03:16 -08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-02-08 10:53:59 -08:00
										 |  |  | } |