1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-26 08:42:41 +01:00

Modernize the top half of Maniphest

Summary:
Use modern elements: crumbs, header, action list, property list, tags.

No functional changes.

Test Plan: {F26934}

Reviewers: chad, btrahan, vrana

Reviewed By: btrahan

CC: aran

Differential Revision: https://secure.phabricator.com/D4153
This commit is contained in:
epriestley 2012-12-11 14:03:16 -08:00
parent 4a3d50bcb5
commit 571ec81dd9
3 changed files with 313 additions and 271 deletions

View file

@ -607,7 +607,7 @@ celerity_register_resource_map(array(
),
'aphront-dialog-view-css' =>
array(
'uri' => '/res/ae4f5352/rsrc/css/aphront/dialog-view.css',
'uri' => '/res/2d27097e/rsrc/css/aphront/dialog-view.css',
'type' => 'css',
'requires' =>
array(
@ -1088,7 +1088,7 @@ celerity_register_resource_map(array(
),
'javelin-behavior-device' =>
array(
'uri' => '/res/4d387c75/rsrc/js/application/core/behavior-device.js',
'uri' => '/res/d30d2401/rsrc/js/application/core/behavior-device.js',
'type' => 'js',
'requires' =>
array(
@ -1591,7 +1591,7 @@ celerity_register_resource_map(array(
),
'javelin-behavior-phabricator-nav' =>
array(
'uri' => '/res/ef90e83f/rsrc/js/application/core/behavior-phabricator-nav.js',
'uri' => '/res/c2b1d50c/rsrc/js/application/core/behavior-phabricator-nav.js',
'type' => 'js',
'requires' =>
array(
@ -1683,6 +1683,20 @@ celerity_register_resource_map(array(
),
'disk' => '/rsrc/js/application/core/behavior-tooltip.js',
),
'javelin-behavior-phabricator-transaction-list' =>
array(
'uri' => '/res/212f97ba/rsrc/js/application/transactions/behavior-transaction-list.js',
'type' => 'js',
'requires' =>
array(
0 => 'javelin-behavior',
1 => 'javelin-stratcom',
2 => 'javelin-workflow',
3 => 'javelin-dom',
4 => 'javelin-fx',
),
'disk' => '/rsrc/js/application/transactions/behavior-transaction-list.js',
),
'javelin-behavior-phabricator-watch-anchor' =>
array(
'uri' => '/res/b20b1cc2/rsrc/js/application/core/behavior-watch-anchor.js',
@ -2259,7 +2273,7 @@ celerity_register_resource_map(array(
),
'lightbox-attachment-css' =>
array(
'uri' => '/res/c1c3415d/rsrc/css/aphront/lightbox-attachment.css',
'uri' => '/res/67f95ed6/rsrc/css/aphront/lightbox-attachment.css',
'type' => 'css',
'requires' =>
array(
@ -2365,7 +2379,7 @@ celerity_register_resource_map(array(
),
'phabricator-action-list-view-css' =>
array(
'uri' => '/res/36609e24/rsrc/css/layout/phabricator-action-list-view.css',
'uri' => '/res/7a67c3b9/rsrc/css/layout/phabricator-action-list-view.css',
'type' => 'css',
'requires' =>
array(
@ -2544,7 +2558,7 @@ celerity_register_resource_map(array(
),
'phabricator-header-view-css' =>
array(
'uri' => '/res/c89cc14d/rsrc/css/layout/phabricator-header-view.css',
'uri' => '/res/88ef478c/rsrc/css/layout/phabricator-header-view.css',
'type' => 'css',
'requires' =>
array(
@ -2746,7 +2760,7 @@ celerity_register_resource_map(array(
),
'phabricator-property-list-view-css' =>
array(
'uri' => '/res/6a0f30be/rsrc/css/layout/phabricator-property-list-view.css',
'uri' => '/res/39b4bf73/rsrc/css/layout/phabricator-property-list-view.css',
'type' => 'css',
'requires' =>
array(
@ -2755,7 +2769,7 @@ celerity_register_resource_map(array(
),
'phabricator-remarkup-css' =>
array(
'uri' => '/res/2e0d0042/rsrc/css/core/remarkup.css',
'uri' => '/res/6764f5d9/rsrc/css/core/remarkup.css',
'type' => 'css',
'requires' =>
array(
@ -2840,7 +2854,7 @@ celerity_register_resource_map(array(
),
'phabricator-timeline-view-css' =>
array(
'uri' => '/res/f20ee7f2/rsrc/css/layout/phabricator-timeline-view.css',
'uri' => '/res/1846f7d5/rsrc/css/layout/phabricator-timeline-view.css',
'type' => 'css',
'requires' =>
array(
@ -3148,7 +3162,7 @@ celerity_register_resource_map(array(
),
'sprite-icon-css' =>
array(
'uri' => '/res/0e50eab2/rsrc/css/sprite-icon.css',
'uri' => '/res/3f514adc/rsrc/css/sprite-icon.css',
'type' => 'css',
'requires' =>
array(
@ -3194,7 +3208,7 @@ celerity_register_resource_map(array(
), array(
'packages' =>
array(
81950573 =>
'188c56c1' =>
array(
'name' => 'core.pkg.css',
'symbols' =>
@ -3238,10 +3252,10 @@ celerity_register_resource_map(array(
36 => 'phabricator-crumbs-view-css',
37 => 'phabricator-object-item-list-view-css',
),
'uri' => '/res/pkg/81950573/core.pkg.css',
'uri' => '/res/pkg/188c56c1/core.pkg.css',
'type' => 'css',
),
'5bcc25b6' =>
'8243143a' =>
array(
'name' => 'core.pkg.js',
'symbols' =>
@ -3278,7 +3292,7 @@ celerity_register_resource_map(array(
29 => 'phabricator-textareautils',
30 => 'phabricator-file-upload',
),
'uri' => '/res/pkg/5bcc25b6/core.pkg.js',
'uri' => '/res/pkg/8243143a/core.pkg.js',
'type' => 'js',
),
'3c5efda9' =>
@ -3426,20 +3440,20 @@ celerity_register_resource_map(array(
'reverse' =>
array(
'aphront-attached-file-view-css' => '7839ae2d',
'aphront-crumbs-view-css' => '81950573',
'aphront-dialog-view-css' => '81950573',
'aphront-error-view-css' => '81950573',
'aphront-form-view-css' => '81950573',
'aphront-crumbs-view-css' => '188c56c1',
'aphront-dialog-view-css' => '188c56c1',
'aphront-error-view-css' => '188c56c1',
'aphront-form-view-css' => '188c56c1',
'aphront-headsup-action-list-view-css' => '99f819b9',
'aphront-headsup-view-css' => '81950573',
'aphront-list-filter-view-css' => '81950573',
'aphront-pager-view-css' => '81950573',
'aphront-panel-view-css' => '81950573',
'aphront-side-nav-view-css' => '81950573',
'aphront-table-view-css' => '81950573',
'aphront-tokenizer-control-css' => '81950573',
'aphront-tooltip-css' => '81950573',
'aphront-typeahead-control-css' => '81950573',
'aphront-headsup-view-css' => '188c56c1',
'aphront-list-filter-view-css' => '188c56c1',
'aphront-pager-view-css' => '188c56c1',
'aphront-panel-view-css' => '188c56c1',
'aphront-side-nav-view-css' => '188c56c1',
'aphront-table-view-css' => '188c56c1',
'aphront-tokenizer-control-css' => '188c56c1',
'aphront-tooltip-css' => '188c56c1',
'aphront-typeahead-control-css' => '188c56c1',
'differential-changeset-view-css' => '99f819b9',
'differential-core-view-css' => '99f819b9',
'differential-inline-comment-editor' => '7ecd31fa',
@ -3454,18 +3468,18 @@ celerity_register_resource_map(array(
'diffusion-commit-view-css' => 'c8ce2d88',
'diffusion-icons-css' => 'c8ce2d88',
'inline-comment-summary-css' => '99f819b9',
'javelin-aphlict' => '5bcc25b6',
'javelin-aphlict' => '8243143a',
'javelin-behavior' => 'db6d724d',
'javelin-behavior-aphlict-dropdown' => '5bcc25b6',
'javelin-behavior-aphlict-listen' => '5bcc25b6',
'javelin-behavior-aphront-basic-tokenizer' => '5bcc25b6',
'javelin-behavior-aphlict-dropdown' => '8243143a',
'javelin-behavior-aphlict-listen' => '8243143a',
'javelin-behavior-aphront-basic-tokenizer' => '8243143a',
'javelin-behavior-aphront-drag-and-drop' => '7ecd31fa',
'javelin-behavior-aphront-drag-and-drop-textarea' => '7ecd31fa',
'javelin-behavior-aphront-form-disable-on-submit' => '5bcc25b6',
'javelin-behavior-aphront-form-disable-on-submit' => '8243143a',
'javelin-behavior-audit-preview' => '5e68be89',
'javelin-behavior-dark-console' => '3c5efda9',
'javelin-behavior-dark-console-ajax' => '3c5efda9',
'javelin-behavior-device' => '5bcc25b6',
'javelin-behavior-device' => '8243143a',
'javelin-behavior-differential-accept-with-errors' => '7ecd31fa',
'javelin-behavior-differential-add-reviewers-and-ccs' => '7ecd31fa',
'javelin-behavior-differential-comment-jump' => '7ecd31fa',
@ -3481,27 +3495,27 @@ celerity_register_resource_map(array(
'javelin-behavior-diffusion-commit-graph' => '5e68be89',
'javelin-behavior-diffusion-pull-lastmodified' => '5e68be89',
'javelin-behavior-error-log' => '3c5efda9',
'javelin-behavior-konami' => '5bcc25b6',
'javelin-behavior-lightbox-attachments' => '5bcc25b6',
'javelin-behavior-konami' => '8243143a',
'javelin-behavior-lightbox-attachments' => '8243143a',
'javelin-behavior-maniphest-batch-selector' => '7707de41',
'javelin-behavior-maniphest-subpriority-editor' => '7707de41',
'javelin-behavior-maniphest-transaction-controls' => '7707de41',
'javelin-behavior-maniphest-transaction-expand' => '7707de41',
'javelin-behavior-maniphest-transaction-preview' => '7707de41',
'javelin-behavior-phabricator-active-nav' => '5bcc25b6',
'javelin-behavior-phabricator-autofocus' => '5bcc25b6',
'javelin-behavior-phabricator-keyboard-shortcuts' => '5bcc25b6',
'javelin-behavior-phabricator-nav' => '5bcc25b6',
'javelin-behavior-phabricator-active-nav' => '8243143a',
'javelin-behavior-phabricator-autofocus' => '8243143a',
'javelin-behavior-phabricator-keyboard-shortcuts' => '8243143a',
'javelin-behavior-phabricator-nav' => '8243143a',
'javelin-behavior-phabricator-object-selector' => '7ecd31fa',
'javelin-behavior-phabricator-oncopy' => '5bcc25b6',
'javelin-behavior-phabricator-remarkup-assist' => '5bcc25b6',
'javelin-behavior-phabricator-search-typeahead' => '5bcc25b6',
'javelin-behavior-phabricator-tooltips' => '5bcc25b6',
'javelin-behavior-phabricator-watch-anchor' => '5bcc25b6',
'javelin-behavior-refresh-csrf' => '5bcc25b6',
'javelin-behavior-phabricator-oncopy' => '8243143a',
'javelin-behavior-phabricator-remarkup-assist' => '8243143a',
'javelin-behavior-phabricator-search-typeahead' => '8243143a',
'javelin-behavior-phabricator-tooltips' => '8243143a',
'javelin-behavior-phabricator-watch-anchor' => '8243143a',
'javelin-behavior-refresh-csrf' => '8243143a',
'javelin-behavior-repository-crossreference' => '7ecd31fa',
'javelin-behavior-toggle-class' => '5bcc25b6',
'javelin-behavior-workflow' => '5bcc25b6',
'javelin-behavior-toggle-class' => '8243143a',
'javelin-behavior-workflow' => '8243143a',
'javelin-dom' => 'db6d724d',
'javelin-event' => 'db6d724d',
'javelin-install' => 'db6d724d',
@ -3520,48 +3534,48 @@ celerity_register_resource_map(array(
'javelin-util' => 'db6d724d',
'javelin-vector' => 'db6d724d',
'javelin-workflow' => 'db6d724d',
'lightbox-attachment-css' => '81950573',
'lightbox-attachment-css' => '188c56c1',
'maniphest-task-summary-css' => '7839ae2d',
'maniphest-transaction-detail-css' => '7839ae2d',
'phabricator-app-buttons-css' => '81950573',
'phabricator-busy' => '5bcc25b6',
'phabricator-app-buttons-css' => '188c56c1',
'phabricator-busy' => '8243143a',
'phabricator-content-source-view-css' => '99f819b9',
'phabricator-core-buttons-css' => '81950573',
'phabricator-core-css' => '81950573',
'phabricator-crumbs-view-css' => '81950573',
'phabricator-directory-css' => '81950573',
'phabricator-core-buttons-css' => '188c56c1',
'phabricator-core-css' => '188c56c1',
'phabricator-crumbs-view-css' => '188c56c1',
'phabricator-directory-css' => '188c56c1',
'phabricator-drag-and-drop-file-upload' => '7ecd31fa',
'phabricator-dropdown-menu' => '5bcc25b6',
'phabricator-file-upload' => '5bcc25b6',
'phabricator-filetree-view-css' => '81950573',
'phabricator-flag-css' => '81950573',
'phabricator-form-view-css' => '81950573',
'phabricator-header-view-css' => '81950573',
'phabricator-jump-nav' => '81950573',
'phabricator-keyboard-shortcut' => '5bcc25b6',
'phabricator-keyboard-shortcut-manager' => '5bcc25b6',
'phabricator-main-menu-view' => '81950573',
'phabricator-menu-item' => '5bcc25b6',
'phabricator-nav-view-css' => '81950573',
'phabricator-notification' => '5bcc25b6',
'phabricator-notification-css' => '81950573',
'phabricator-notification-menu-css' => '81950573',
'phabricator-object-item-list-view-css' => '81950573',
'phabricator-dropdown-menu' => '8243143a',
'phabricator-file-upload' => '8243143a',
'phabricator-filetree-view-css' => '188c56c1',
'phabricator-flag-css' => '188c56c1',
'phabricator-form-view-css' => '188c56c1',
'phabricator-header-view-css' => '188c56c1',
'phabricator-jump-nav' => '188c56c1',
'phabricator-keyboard-shortcut' => '8243143a',
'phabricator-keyboard-shortcut-manager' => '8243143a',
'phabricator-main-menu-view' => '188c56c1',
'phabricator-menu-item' => '8243143a',
'phabricator-nav-view-css' => '188c56c1',
'phabricator-notification' => '8243143a',
'phabricator-notification-css' => '188c56c1',
'phabricator-notification-menu-css' => '188c56c1',
'phabricator-object-item-list-view-css' => '188c56c1',
'phabricator-object-selector-css' => '99f819b9',
'phabricator-paste-file-upload' => '5bcc25b6',
'phabricator-prefab' => '5bcc25b6',
'phabricator-paste-file-upload' => '8243143a',
'phabricator-prefab' => '8243143a',
'phabricator-project-tag-css' => '7839ae2d',
'phabricator-remarkup-css' => '81950573',
'phabricator-remarkup-css' => '188c56c1',
'phabricator-shaped-request' => '7ecd31fa',
'phabricator-side-menu-view-css' => '81950573',
'phabricator-standard-page-view' => '81950573',
'phabricator-textareautils' => '5bcc25b6',
'phabricator-tooltip' => '5bcc25b6',
'phabricator-transaction-view-css' => '81950573',
'sprite-apps-large-css' => '81950573',
'sprite-gradient-css' => '81950573',
'sprite-icon-css' => '81950573',
'sprite-menu-css' => '81950573',
'syntax-highlighting-css' => '81950573',
'phabricator-side-menu-view-css' => '188c56c1',
'phabricator-standard-page-view' => '188c56c1',
'phabricator-textareautils' => '8243143a',
'phabricator-tooltip' => '8243143a',
'phabricator-transaction-view-css' => '188c56c1',
'sprite-apps-large-css' => '188c56c1',
'sprite-gradient-css' => '188c56c1',
'sprite-icon-css' => '188c56c1',
'sprite-menu-css' => '188c56c1',
'syntax-highlighting-css' => '188c56c1',
),
));

View file

@ -35,4 +35,19 @@ final class ManiphestTaskStatus extends ManiphestConstants {
return idx($map, $status, '???');
}
public static function getTaskStatusTagColor($status) {
$default = PhabricatorTagView::COLOR_GREY;
$map = array(
self::STATUS_OPEN => PhabricatorTagView::COLOR_ORANGE,
self::STATUS_CLOSED_RESOLVED => PhabricatorTagView::COLOR_BLUE,
self::STATUS_CLOSED_WONTFIX => PhabricatorTagView::COLOR_BLACK,
self::STATUS_CLOSED_INVALID => PhabricatorTagView::COLOR_BLACK,
self::STATUS_CLOSED_DUPLICATE => PhabricatorTagView::COLOR_BLACK,
self::STATUS_CLOSED_SPITE => PhabricatorTagView::COLOR_MAGENTA,
);
return idx($map, $status, $default);
}
}

View file

@ -51,13 +51,7 @@ final class ManiphestTaskDetailController extends ManiphestController {
$e_dep_by,
$e_rev,
));
$edges = $query->execute();
$commit_phids = array_keys($edges[$phid][$e_commit]);
$dep_on_tasks = array_keys($edges[$phid][$e_dep_on]);
$dep_by_tasks = array_keys($edges[$phid][$e_dep_by]);
$revs = array_keys($edges[$phid][$e_rev]);
$edges = idx($query->execute(), $phid);
$phids = array_fill_keys($query->getDestinationPHIDs(), true);
foreach ($transactions as $transaction) {
@ -88,104 +82,7 @@ final class ManiphestTaskDetailController extends ManiphestController {
}
$phids = array_keys($phids);
$handles = $this->loadViewerHandles($phids);
$dict = array();
$dict['Status'] =
'<strong>'.
ManiphestTaskStatus::getTaskStatusFullName($task->getStatus()).
'</strong>';
$dict['Assigned To'] = $task->getOwnerPHID()
? $handles[$task->getOwnerPHID()]->renderLink()
: '<em>None</em>';
$dict['Priority'] = ManiphestTaskPriority::getTaskPriorityName(
$task->getPriority());
$cc = $task->getCCPHIDs();
if ($cc) {
$cc_links = array();
foreach ($cc as $phid) {
$cc_links[] = $handles[$phid]->renderLink();
}
$dict['CC'] = implode(', ', $cc_links);
} else {
$dict['CC'] = '<em>None</em>';
}
$dict['Author'] = $handles[$task->getAuthorPHID()]->renderLink();
$source = $task->getOriginalEmailSource();
if ($source) {
$subject = '[T'.$task->getID().'] '.$task->getTitle();
$dict['From Email'] = phutil_render_tag(
'a',
array(
'href' => 'mailto:'.$source.'?subject='.$subject
),
phutil_escape_html($source));
}
$projects = $task->getProjectPHIDs();
if ($projects) {
$project_links = array();
foreach ($projects as $phid) {
$project_links[] = $handles[$phid]->renderLink();
}
$dict['Projects'] = implode(', ', $project_links);
} else {
$dict['Projects'] = '<em>None</em>';
}
$extensions = ManiphestTaskExtensions::newExtensions();
$aux_fields = $extensions->getAuxiliaryFieldSpecifications();
if ($aux_fields) {
$task->loadAndAttachAuxiliaryAttributes();
foreach ($aux_fields as $aux_field) {
$aux_key = $aux_field->getAuxiliaryKey();
$aux_field->setValue($task->getAuxiliaryAttribute($aux_key));
$value = $aux_field->renderForDetailView();
if (strlen($value)) {
$dict[$aux_field->getLabel()] = $value;
}
}
}
if ($dep_by_tasks) {
$dict['Dependent Tasks'] = $this->renderHandleList(
array_select_keys($handles, $dep_by_tasks));
}
if ($dep_on_tasks) {
$dict['Depends On'] = $this->renderHandleList(
array_select_keys($handles, $dep_on_tasks));
}
if ($revs) {
$dict['Revisions'] = $this->renderHandleList(
array_select_keys($handles, $revs));
}
if ($commit_phids) {
$dict['Commits'] = $this->renderHandleList(
array_select_keys($handles, $commit_phids));
}
$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);
$view = new PhabricatorFileLinkListView();
$view->setFiles($files);
$dict['Files'] = $view->render();
}
$this->loadHandles($phids);
$context_bar = null;
@ -201,7 +98,7 @@ final class ManiphestTaskDetailController extends ManiphestController {
'Create Another Subtask'));
$context_bar->appendChild(
'Created a subtask of <strong>'.
$handles[$parent_task->getPHID()]->renderLink().
$this->getHandle($parent_task->getPHID())->renderLink().
'</strong>');
} else if ($workflow == 'create') {
$context_bar = new AphrontContextBarView();
@ -225,75 +122,6 @@ final class ManiphestTaskDetailController extends ManiphestController {
$context_bar->appendChild('New task created.');
}
$actions = array();
$action = new AphrontHeadsupActionView();
$action->setName('Edit Task');
$action->setURI('/maniphest/task/edit/'.$task->getID().'/');
$action->setClass('action-edit');
$actions[] = $action;
require_celerity_resource('phabricator-flag-css');
$flag = PhabricatorFlagQuery::loadUserFlag($user, $task->getPHID());
if ($flag) {
$class = PhabricatorFlagColor::getCSSClass($flag->getColor());
$color = PhabricatorFlagColor::getColorName($flag->getColor());
$action = new AphrontHeadsupActionView();
$action->setClass('flag-clear '.$class);
$action->setURI('/flag/delete/'.$flag->getID().'/');
$action->setName('Remove '.$color.' Flag');
$action->setWorkflow(true);
$actions[] = $action;
} else {
$action = new AphrontHeadsupActionView();
$action->setClass('phabricator-flag-ghost');
$action->setURI('/flag/edit/'.$task->getPHID().'/');
$action->setName('Flag Task');
$action->setWorkflow(true);
$actions[] = $action;
}
require_celerity_resource('phabricator-object-selector-css');
require_celerity_resource('javelin-behavior-phabricator-object-selector');
$action = new AphrontHeadsupActionView();
$action->setName('Merge Duplicates');
$action->setURI('/search/attach/'.$task->getPHID().'/TASK/merge/');
$action->setWorkflow(true);
$action->setClass('action-merge');
$actions[] = $action;
$action = new AphrontHeadsupActionView();
$action->setName('Create Subtask');
$action->setURI('/maniphest/task/create/?parent='.$task->getID());
$action->setClass('action-branch');
$actions[] = $action;
$action = new AphrontHeadsupActionView();
$action->setName('Edit Dependencies');
$action->setURI('/search/attach/'.$task->getPHID().'/TASK/dependencies/');
$action->setWorkflow(true);
$action->setClass('action-dependencies');
$actions[] = $action;
$action = new AphrontHeadsupActionView();
$action->setName('Edit Differential Revisions');
$action->setURI('/search/attach/'.$task->getPHID().'/DREV/');
$action->setWorkflow(true);
$action->setClass('action-attach');
$actions[] = $action;
$action_list = new AphrontHeadsupActionListView();
$action_list->setActions($actions);
$headsup_panel = new AphrontHeadsupView();
$headsup_panel->setObjectName('T'.$task->getID());
$headsup_panel->setHeader($task->getTitle());
$headsup_panel->setActionList($action_list);
$headsup_panel->setProperties($dict);
$engine = new PhabricatorMarkupEngine();
$engine->setViewer($user);
$engine->addObject($task, ManiphestTask::MARKUP_FIELD_DESCRIPTION);
@ -304,10 +132,11 @@ final class ManiphestTaskDetailController extends ManiphestController {
}
$engine->process();
$headsup_panel->appendChild(
'<div class="phabricator-remarkup">'.
$engine->getOutput($task, ManiphestTask::MARKUP_FIELD_DESCRIPTION).
'</div>');
$extensions = ManiphestTaskExtensions::newExtensions();
$aux_fields = $extensions->getAuxiliaryFieldSpecifications();
if ($aux_fields) {
$task->loadAndAttachAuxiliaryAttributes();
}
$transaction_types = ManiphestTransactionType::getTransactionTypeMap();
$resolution_types = ManiphestTaskStatus::getTaskStatusMap();
@ -489,7 +318,7 @@ final class ManiphestTaskDetailController extends ManiphestController {
$transaction_view = new ManiphestTransactionListView();
$transaction_view->setTransactions($transactions);
$transaction_view->setHandles($handles);
$transaction_view->setHandles($this->getLoadedHandles());
$transaction_view->setUser($user);
$transaction_view->setAuxiliaryFields($aux_fields);
$transaction_view->setMarkupEngine($engine);
@ -497,10 +326,25 @@ final class ManiphestTaskDetailController extends ManiphestController {
PhabricatorFeedStoryNotification::updateObjectNotificationViews(
$user, $task->getPHID());
return $this->buildStandardPageResponse(
$object_name = 'T'.$task->getID();
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addCrumb(
id(new PhabricatorCrumbView())
->setName($object_name)
->setHref('/'.$object_name));
$header = $this->buildHeaderView($task);
$actions = $this->buildActionView($task);
$properties = $this->buildPropertyView($task, $aux_fields, $edges, $engine);
return $this->buildApplicationPage(
array(
$crumbs,
$context_bar,
$headsup_panel,
$header,
$actions,
$properties,
$transaction_view,
$comment_panel,
$preview_panel,
@ -511,12 +355,181 @@ final class ManiphestTaskDetailController extends ManiphestController {
));
}
private function renderHandleList(array $handles) {
$links = array();
foreach ($handles as $handle) {
$links[] = $handle->renderLink();
}
return implode('<br />', $links);
private function buildHeaderView(ManiphestTask $task) {
$view = id(new PhabricatorHeaderView())
->setObjectName('T'.$task->getID())
->setHeader($task->getTitle());
$status = $task->getStatus();
$status_name = ManiphestTaskStatus::getTaskStatusFullName($status);
$status_color = ManiphestTaskStatus::getTaskStatusTagColor($status);
$view->addTag(
id(new PhabricatorTagView())
->setType(PhabricatorTagView::TYPE_STATE)
->setName($status_name)
->setBackgroundColor($status_color));
return $view;
}
private function buildActionView(ManiphestTask $task) {
$viewer = $this->getRequest()->getUser();
$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}/")));
$view->addAction(
id(new PhabricatorActionView())
->setName(pht('Merge Duplicates'))
->setHref("/search/attach/{$phid}/TASK/merge/")
->setWorkflow(true)
->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();
$view = new PhabricatorPropertyListView();
$view->addProperty(
pht('Assigned To'),
$task->getOwnerPHID()
? $this->getHandle($task->getOwnerPHID())->renderLink()
: '<em>'.pht('None').'</em>');
$view->addProperty(
pht('Priority'),
phutil_escape_html(
ManiphestTaskPriority::getTaskPriorityName($task->getPriority())));
$view->addProperty(
pht('Subscribers'),
$task->getCCPHIDs()
? $this->renderHandlesForPHIDs($task->getCCPHIDs())
: '<em>'.pht('None').'</em>');
$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'),
phutil_render_tag(
'a',
array(
'href' => 'mailto:'.$source.'?subject='.$subject
),
phutil_escape_html($source)));
}
$view->addProperty(
pht('Projects'),
$task->getProjectPHIDs()
? $this->renderHandlesForPHIDs($task->getProjectPHIDs())
: '<em>'.pht('None').'</em>');
foreach ($aux_fields as $aux_field) {
$aux_key = $aux_field->getAuxiliaryKey();
$aux_field->setValue($task->getAuxiliaryAttribute($aux_key));
$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'),
PhabricatorEdgeConfig::TYPE_TASK_HAS_COMMIT
=> pht('Commits'),
);
foreach ($edge_types as $edge_type => $edge_name) {
if ($edges[$edge_type]) {
$view->addProperty(
$edge_name,
$this->renderHandlesForPHIDs(array_keys($edges[$edge_type])));
}
}
$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());
}
if (strlen($task->getDescription())) {
$view->addSectionHeader(pht('Description'));
$view->addTextContent(
phutil_render_tag(
'div',
array(
'class' => 'phabricator-remarkup',
),
$engine->getOutput($task, ManiphestTask::MARKUP_FIELD_DESCRIPTION)));
}
return $view;
}
}