2011-02-08 19:53:59 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/*
|
2012-02-08 18:44:22 +01:00
|
|
|
* Copyright 2012 Facebook, Inc.
|
2011-02-08 19:53:59 +01:00
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2011-07-04 22:04:22 +02:00
|
|
|
/**
|
|
|
|
* @group maniphest
|
|
|
|
*/
|
2012-03-10 00:46:25 +01:00
|
|
|
final class ManiphestTaskDetailController extends ManiphestController {
|
2011-02-08 19:53:59 +01: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-31 06:38:24 +02:00
|
|
|
if (!$task) {
|
|
|
|
return new Aphront404Response();
|
|
|
|
}
|
2011-02-08 19:53:59 +01:00
|
|
|
|
2011-08-03 23:20:05 +02:00
|
|
|
$workflow = $request->getStr('workflow');
|
|
|
|
$parent_task = null;
|
|
|
|
if ($workflow && is_numeric($workflow)) {
|
|
|
|
$parent_task = id(new ManiphestTask())->load($workflow);
|
|
|
|
}
|
|
|
|
|
2011-02-08 19:53:59 +01:00
|
|
|
$transactions = id(new ManiphestTransaction())->loadAllWhere(
|
2011-04-11 11:45:53 +02:00
|
|
|
'taskID = %d ORDER BY id ASC',
|
2011-02-08 19:53:59 +01:00
|
|
|
$task->getID());
|
|
|
|
|
2012-07-19 05:41:42 +02: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;
|
|
|
|
|
|
|
|
$phid = $task->getPHID();
|
|
|
|
|
|
|
|
$query = id(new PhabricatorEdgeQuery())
|
|
|
|
->withSourcePHIDs(array($phid))
|
|
|
|
->withEdgeTypes(
|
|
|
|
array(
|
|
|
|
$e_commit,
|
|
|
|
$e_dep_on,
|
|
|
|
$e_dep_by,
|
|
|
|
));
|
|
|
|
$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]);
|
|
|
|
|
|
|
|
$phids = array_fill_keys($query->getDestinationPHIDs(), true);
|
2012-04-05 02:34:25 +02:00
|
|
|
|
2011-02-08 19:53:59 +01:00
|
|
|
foreach ($transactions as $transaction) {
|
|
|
|
foreach ($transaction->extractPHIDs() as $phid) {
|
|
|
|
$phids[$phid] = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
foreach ($task->getCCPHIDs() as $phid) {
|
|
|
|
$phids[$phid] = true;
|
|
|
|
}
|
2011-02-21 05:08:16 +01:00
|
|
|
foreach ($task->getProjectPHIDs() as $phid) {
|
|
|
|
$phids[$phid] = true;
|
|
|
|
}
|
2011-02-08 19:53:59 +01:00
|
|
|
if ($task->getOwnerPHID()) {
|
|
|
|
$phids[$task->getOwnerPHID()] = true;
|
|
|
|
}
|
|
|
|
$phids[$task->getAuthorPHID()] = true;
|
|
|
|
|
2011-02-17 23:32:01 +01:00
|
|
|
$attached = $task->getAttached();
|
|
|
|
foreach ($attached as $type => $list) {
|
|
|
|
foreach ($list as $phid => $info) {
|
|
|
|
$phids[$phid] = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-08-03 23:20:05 +02:00
|
|
|
if ($parent_task) {
|
|
|
|
$phids[$parent_task->getPHID()] = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
$phids = array_keys($phids);
|
|
|
|
|
2011-02-08 19:53:59 +01:00
|
|
|
$handles = id(new PhabricatorObjectHandleData($phids))
|
|
|
|
->loadHandles();
|
|
|
|
|
|
|
|
$dict = array();
|
|
|
|
$dict['Status'] =
|
|
|
|
'<strong>'.
|
|
|
|
ManiphestTaskStatus::getTaskStatusFullName($task->getStatus()).
|
|
|
|
'</strong>';
|
|
|
|
|
|
|
|
$dict['Assigned To'] = $task->getOwnerPHID()
|
2011-02-09 06:01:42 +01:00
|
|
|
? $handles[$task->getOwnerPHID()]->renderLink()
|
|
|
|
: '<em>None</em>';
|
2011-02-08 19:53:59 +01:00
|
|
|
|
|
|
|
$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();
|
|
|
|
|
2011-10-14 22:11:58 +02:00
|
|
|
$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));
|
|
|
|
}
|
|
|
|
|
2011-02-21 05:08:16 +01:00
|
|
|
$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>';
|
|
|
|
}
|
|
|
|
|
2011-12-24 04:03:28 +01:00
|
|
|
$extensions = ManiphestTaskExtensions::newExtensions();
|
|
|
|
$aux_fields = $extensions->getAuxiliaryFieldSpecifications();
|
2011-07-27 18:49:50 +02:00
|
|
|
if ($aux_fields) {
|
2011-12-24 04:03:28 +01:00
|
|
|
$task->loadAndAttachAuxiliaryAttributes();
|
2011-07-27 18:49:50 +02:00
|
|
|
foreach ($aux_fields as $aux_field) {
|
2011-12-24 04:03:28 +01:00
|
|
|
$aux_key = $aux_field->getAuxiliaryKey();
|
|
|
|
$aux_field->setValue($task->getAuxiliaryAttribute($aux_key));
|
2011-12-17 01:31:02 +01:00
|
|
|
$value = $aux_field->renderForDetailView();
|
|
|
|
if (strlen($value)) {
|
|
|
|
$dict[$aux_field->getLabel()] = $value;
|
|
|
|
}
|
2011-07-27 18:49:50 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-19 05:41:42 +02:00
|
|
|
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));
|
2011-07-05 22:18:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
$revs = idx($attached, PhabricatorPHIDConstants::PHID_TYPE_DREV);
|
|
|
|
if ($revs) {
|
2012-07-19 05:41:42 +02:00
|
|
|
$dict['Revisions'] = $this->renderHandleList(
|
|
|
|
array_select_keys($handles, $revs));
|
2011-02-17 23:32:01 +01:00
|
|
|
}
|
|
|
|
|
2012-04-05 02:34:25 +02:00
|
|
|
if ($commit_phids) {
|
2012-07-19 05:41:42 +02:00
|
|
|
$dict['Commits'] = $this->renderHandleList(
|
|
|
|
array_select_keys($handles, $commit_phids));
|
2012-04-05 02:34:25 +02:00
|
|
|
}
|
|
|
|
|
2011-07-05 22:18:47 +02:00
|
|
|
$file_infos = idx($attached, PhabricatorPHIDConstants::PHID_TYPE_FILE);
|
|
|
|
if ($file_infos) {
|
2011-05-23 02:06:42 +02:00
|
|
|
$file_phids = array_keys($file_infos);
|
|
|
|
|
2011-07-05 22:18:47 +02:00
|
|
|
$files = id(new PhabricatorFile())->loadAllWhere(
|
|
|
|
'phid IN (%Ls)',
|
|
|
|
$file_phids);
|
2011-05-23 02:06:42 +02:00
|
|
|
|
2011-07-05 22:18:47 +02:00
|
|
|
$views = array();
|
|
|
|
foreach ($files as $file) {
|
|
|
|
$view = new AphrontFilePreviewView();
|
|
|
|
$view->setFile($file);
|
|
|
|
$views[] = $view->render();
|
2011-02-21 05:08:16 +01:00
|
|
|
}
|
2011-07-05 22:18:47 +02:00
|
|
|
$dict['Files'] = implode('', $views);
|
2011-02-21 05:08:16 +01:00
|
|
|
}
|
|
|
|
|
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 19:46:22 +02:00
|
|
|
$context_bar = null;
|
2011-08-03 23:20:05 +02:00
|
|
|
|
|
|
|
if ($parent_task) {
|
|
|
|
$context_bar = new AphrontContextBarView();
|
|
|
|
$context_bar->addButton(
|
|
|
|
phutil_render_tag(
|
|
|
|
'a',
|
|
|
|
array(
|
|
|
|
'href' => '/maniphest/task/create/?parent='.$parent_task->getID(),
|
|
|
|
'class' => 'green button',
|
|
|
|
),
|
|
|
|
'Create Another Subtask'));
|
|
|
|
$context_bar->appendChild(
|
|
|
|
'Created a subtask of <strong>'.
|
|
|
|
$handles[$parent_task->getPHID()]->renderLink().
|
|
|
|
'</strong>');
|
|
|
|
} 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 19:46:22 +02:00
|
|
|
$context_bar = new AphrontContextBarView();
|
2012-02-08 18:44:22 +01:00
|
|
|
$context_bar->addButton('<label>Create Another:</label>');
|
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 19:46:22 +02:00
|
|
|
$context_bar->addButton(
|
|
|
|
phutil_render_tag(
|
|
|
|
'a',
|
|
|
|
array(
|
|
|
|
'href' => '/maniphest/task/create/?template='.$task->getID(),
|
|
|
|
'class' => 'green button',
|
|
|
|
),
|
2012-02-08 18:44:22 +01:00
|
|
|
'Similar Task'));
|
|
|
|
$context_bar->addButton(
|
|
|
|
phutil_render_tag(
|
|
|
|
'a',
|
|
|
|
array(
|
|
|
|
'href' => '/maniphest/task/create/',
|
|
|
|
'class' => 'green button',
|
|
|
|
),
|
|
|
|
'Empty Task'));
|
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 19:46:22 +02:00
|
|
|
$context_bar->appendChild('New task created.');
|
2011-07-26 19:39:36 +02:00
|
|
|
}
|
2011-02-20 23:15:53 +01:00
|
|
|
|
2011-02-20 21:50:28 +01:00
|
|
|
$actions = array();
|
2011-02-20 23:15:53 +01:00
|
|
|
|
2011-02-20 21:50:28 +01:00
|
|
|
$action = new AphrontHeadsupActionView();
|
|
|
|
$action->setName('Edit Task');
|
2011-02-20 23:15:53 +01:00
|
|
|
$action->setURI('/maniphest/task/edit/'.$task->getID().'/');
|
2011-02-20 21:50:28 +01:00
|
|
|
$action->setClass('action-edit');
|
|
|
|
$actions[] = $action;
|
|
|
|
|
2012-03-28 01:22:40 +02:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2011-05-16 20:43:39 +02:00
|
|
|
require_celerity_resource('phabricator-object-selector-css');
|
|
|
|
require_celerity_resource('javelin-behavior-phabricator-object-selector');
|
|
|
|
|
2011-06-14 16:55:04 +02:00
|
|
|
$action = new AphrontHeadsupActionView();
|
|
|
|
$action->setName('Merge Duplicates');
|
|
|
|
$action->setURI('/search/attach/'.$task->getPHID().'/TASK/merge/');
|
|
|
|
$action->setWorkflow(true);
|
|
|
|
$action->setClass('action-merge');
|
|
|
|
$actions[] = $action;
|
|
|
|
|
2011-08-03 17:48:42 +02:00
|
|
|
$action = new AphrontHeadsupActionView();
|
|
|
|
$action->setName('Create Subtask');
|
|
|
|
$action->setURI('/maniphest/task/create/?parent='.$task->getID());
|
|
|
|
$action->setClass('action-branch');
|
|
|
|
$actions[] = $action;
|
|
|
|
|
|
|
|
|
2011-07-05 22:18:47 +02:00
|
|
|
$action = new AphrontHeadsupActionView();
|
|
|
|
$action->setName('Edit Dependencies');
|
|
|
|
$action->setURI('/search/attach/'.$task->getPHID().'/TASK/dependencies/');
|
|
|
|
$action->setWorkflow(true);
|
|
|
|
$action->setClass('action-dependencies');
|
|
|
|
$actions[] = $action;
|
|
|
|
|
2011-02-20 21:50:28 +01:00
|
|
|
$action = new AphrontHeadsupActionView();
|
|
|
|
$action->setName('Edit Differential Revisions');
|
2011-05-16 20:43:39 +02:00
|
|
|
$action->setURI('/search/attach/'.$task->getPHID().'/DREV/');
|
|
|
|
$action->setWorkflow(true);
|
|
|
|
$action->setClass('action-attach');
|
2011-02-20 21:50:28 +01:00
|
|
|
$actions[] = $action;
|
2011-02-20 23:15:53 +01:00
|
|
|
|
2011-02-20 21:50:28 +01:00
|
|
|
$action_list = new AphrontHeadsupActionListView();
|
|
|
|
$action_list->setActions($actions);
|
|
|
|
|
2012-03-30 23:12:10 +02:00
|
|
|
$headsup_panel = new AphrontHeadsupView();
|
|
|
|
$headsup_panel->setObjectName('T'.$task->getID());
|
|
|
|
$headsup_panel->setHeader($task->getTitle());
|
|
|
|
$headsup_panel->setActionList($action_list);
|
|
|
|
$headsup_panel->setProperties($dict);
|
|
|
|
|
2012-07-11 20:40:10 +02:00
|
|
|
$engine = new PhabricatorMarkupEngine();
|
|
|
|
$engine->addObject($task, ManiphestTask::MARKUP_FIELD_DESCRIPTION);
|
|
|
|
foreach ($transactions as $xaction) {
|
|
|
|
if ($xaction->hasComments()) {
|
|
|
|
$engine->addObject($xaction, ManiphestTransaction::MARKUP_FIELD_BODY);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$engine->process();
|
|
|
|
|
2012-03-30 23:12:10 +02:00
|
|
|
$headsup_panel->appendChild(
|
|
|
|
'<div class="phabricator-remarkup">'.
|
2012-07-11 20:40:10 +02:00
|
|
|
$engine->getOutput($task, ManiphestTask::MARKUP_FIELD_DESCRIPTION).
|
2012-03-30 23:12:10 +02:00
|
|
|
'</div>');
|
2011-02-08 19:53:59 +01: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-11 01:18:47 +02: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;
|
|
|
|
}
|
|
|
|
|
Improve drag-and-drop uploader
Summary:
Make it discoverable, show uploading progress, show file thumbnails, allow you
to remove files, make it a generic form component.
Test Plan:
Uploaded ducks
Reviewed By: tomo
Reviewers: aran, tomo, jungejason, tuomaspelkonen
CC: anjali, aran, epriestley, tomo
Differential Revision: 334
2011-05-23 01:11:41 +02:00
|
|
|
$panel_id = celerity_generate_unique_node_id();
|
|
|
|
|
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 23:16:34 +01: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-12-01 18:48:27 +01:00
|
|
|
$remarkup_href = PhabricatorEnv::getDoclink(
|
|
|
|
'article/Remarkup_Reference.html');
|
|
|
|
|
2011-02-08 19:53:59 +01:00
|
|
|
$comment_form = new AphrontFormView();
|
|
|
|
$comment_form
|
|
|
|
->setUser($user)
|
|
|
|
->setAction('/maniphest/transaction/save/')
|
2011-02-21 05:08:16 +01:00
|
|
|
->setEncType('multipart/form-data')
|
2011-02-08 19:53:59 +01:00
|
|
|
->addHiddenInput('taskID', $task->getID())
|
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormSelectControl())
|
|
|
|
->setLabel('Action')
|
|
|
|
->setName('action')
|
|
|
|
->setOptions($transaction_types)
|
|
|
|
->setID('transaction-action'))
|
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormSelectControl())
|
|
|
|
->setLabel('Resolution')
|
|
|
|
->setName('resolution')
|
|
|
|
->setControlID('resolution')
|
|
|
|
->setControlStyle('display: none')
|
|
|
|
->setOptions($resolution_types))
|
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormTokenizerControl())
|
|
|
|
->setLabel('Assign To')
|
|
|
|
->setName('assign_to')
|
|
|
|
->setControlID('assign_to')
|
|
|
|
->setControlStyle('display: none')
|
|
|
|
->setID('assign-tokenizer')
|
|
|
|
->setDisableBehavior(true))
|
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormTokenizerControl())
|
|
|
|
->setLabel('CCs')
|
|
|
|
->setName('ccs')
|
|
|
|
->setControlID('ccs')
|
|
|
|
->setControlStyle('display: none')
|
|
|
|
->setID('cc-tokenizer')
|
|
|
|
->setDisableBehavior(true))
|
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormSelectControl())
|
|
|
|
->setLabel('Priority')
|
|
|
|
->setName('priority')
|
|
|
|
->setOptions($priority_map)
|
|
|
|
->setControlID('priority')
|
|
|
|
->setControlStyle('display: none')
|
|
|
|
->setValue($task->getPriority()))
|
2011-02-21 05:08:16 +01:00
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormTokenizerControl())
|
|
|
|
->setLabel('Projects')
|
|
|
|
->setName('projects')
|
|
|
|
->setControlID('projects')
|
|
|
|
->setControlStyle('display: none')
|
|
|
|
->setID('projects-tokenizer')
|
|
|
|
->setDisableBehavior(true))
|
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormFileControl())
|
|
|
|
->setLabel('File')
|
|
|
|
->setName('file')
|
|
|
|
->setControlID('file')
|
|
|
|
->setControlStyle('display: none'))
|
2011-02-08 19:53:59 +01:00
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormTextAreaControl())
|
|
|
|
->setLabel('Comments')
|
|
|
|
->setName('comments')
|
2011-05-11 01:18:47 +02:00
|
|
|
->setValue($draft_text)
|
2011-12-01 18:48:27 +01:00
|
|
|
->setCaption(
|
|
|
|
phutil_render_tag(
|
|
|
|
'a',
|
|
|
|
array(
|
|
|
|
'href' => $remarkup_href,
|
2011-12-07 15:46:37 +01:00
|
|
|
'tabindex' => '-1',
|
2011-12-01 18:48:27 +01:00
|
|
|
'target' => '_blank',
|
|
|
|
),
|
2011-12-07 15:46:37 +01:00
|
|
|
'Formatting Reference'))
|
2011-05-10 17:29:28 +02:00
|
|
|
->setID('transaction-comments'))
|
2011-05-22 20:55:10 +02:00
|
|
|
->appendChild(
|
Improve drag-and-drop uploader
Summary:
Make it discoverable, show uploading progress, show file thumbnails, allow you
to remove files, make it a generic form component.
Test Plan:
Uploaded ducks
Reviewed By: tomo
Reviewers: aran, tomo, jungejason, tuomaspelkonen
CC: anjali, aran, epriestley, tomo
Differential Revision: 334
2011-05-23 01:11:41 +02:00
|
|
|
id(new AphrontFormDragAndDropUploadControl())
|
2011-05-22 20:55:10 +02:00
|
|
|
->setLabel('Attached Files')
|
Improve drag-and-drop uploader
Summary:
Make it discoverable, show uploading progress, show file thumbnails, allow you
to remove files, make it a generic form component.
Test Plan:
Uploaded ducks
Reviewed By: tomo
Reviewers: aran, tomo, jungejason, tuomaspelkonen
CC: anjali, aran, epriestley, tomo
Differential Revision: 334
2011-05-23 01:11:41 +02:00
|
|
|
->setName('files')
|
|
|
|
->setDragAndDropTarget($panel_id)
|
|
|
|
->setActivatedClass('aphront-panel-view-drag-and-drop'))
|
2011-02-08 19:53:59 +01:00
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormSubmitControl())
|
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 23:16:34 +01:00
|
|
|
->setValue($is_serious ? 'Submit' : 'Avast!'));
|
2011-02-08 19:53:59 +01:00
|
|
|
|
2011-05-11 13:17:48 +02: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 16:05:58 +02:00
|
|
|
$tokenizer_map = array(
|
|
|
|
ManiphestTransactionType::TYPE_PROJECTS => array(
|
|
|
|
'id' => 'projects-tokenizer',
|
|
|
|
'src' => '/typeahead/common/projects/',
|
|
|
|
'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'),
|
|
|
|
'placeholder' => 'Type a project name...',
|
|
|
|
),
|
|
|
|
ManiphestTransactionType::TYPE_OWNER => array(
|
|
|
|
'id' => 'assign-tokenizer',
|
|
|
|
'src' => '/typeahead/common/users/',
|
|
|
|
'value' => $default_claim,
|
|
|
|
'limit' => 1,
|
|
|
|
'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'),
|
|
|
|
'placeholder' => 'Type a user name...',
|
|
|
|
),
|
|
|
|
ManiphestTransactionType::TYPE_CCS => array(
|
|
|
|
'id' => 'cc-tokenizer',
|
|
|
|
'src' => '/typeahead/common/mailable/',
|
|
|
|
'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'),
|
|
|
|
'placeholder' => 'Type a user or mailing list...',
|
|
|
|
),
|
|
|
|
);
|
|
|
|
|
2011-02-08 19:53:59 +01:00
|
|
|
Javelin::initBehavior('maniphest-transaction-controls', array(
|
2012-04-14 16:05:58 +02:00
|
|
|
'select' => 'transaction-action',
|
2011-05-11 13:17:48 +02:00
|
|
|
'controlMap' => $control_map,
|
2012-04-14 16:05:58 +02:00
|
|
|
'tokenizers' => $tokenizer_map,
|
2011-02-08 19:53:59 +01:00
|
|
|
));
|
|
|
|
|
2011-05-10 17:29:28 +02:00
|
|
|
Javelin::initBehavior('maniphest-transaction-preview', array(
|
2012-04-14 16:05:58 +02: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 17:29:28 +02:00
|
|
|
));
|
|
|
|
|
2011-02-08 19:53:59 +01:00
|
|
|
$comment_panel = new AphrontPanelView();
|
|
|
|
$comment_panel->appendChild($comment_form);
|
Improve drag-and-drop uploader
Summary:
Make it discoverable, show uploading progress, show file thumbnails, allow you
to remove files, make it a generic form component.
Test Plan:
Uploaded ducks
Reviewed By: tomo
Reviewers: aran, tomo, jungejason, tuomaspelkonen
CC: anjali, aran, epriestley, tomo
Differential Revision: 334
2011-05-23 01:11:41 +02:00
|
|
|
$comment_panel->setID($panel_id);
|
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 17:49:07 +02:00
|
|
|
$comment_panel->addClass('aphront-panel-accent');
|
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 23:16:34 +01:00
|
|
|
$comment_panel->setHeader($is_serious ? 'Add Comment' : 'Weigh In');
|
2011-02-08 19:53:59 +01:00
|
|
|
|
2011-05-10 17:29:28 +02:00
|
|
|
$preview_panel =
|
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 17:49:07 +02:00
|
|
|
'<div class="aphront-panel-preview">
|
2011-05-10 17:29:28 +02:00
|
|
|
<div id="transaction-preview">
|
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 17:49:07 +02:00
|
|
|
<div class="aphront-panel-preview-loading-text">
|
2011-05-10 17:29:28 +02:00
|
|
|
Loading preview...
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>';
|
|
|
|
|
2011-02-08 19:53:59 +01:00
|
|
|
$transaction_view = new ManiphestTransactionListView();
|
|
|
|
$transaction_view->setTransactions($transactions);
|
|
|
|
$transaction_view->setHandles($handles);
|
|
|
|
$transaction_view->setUser($user);
|
2012-03-07 00:10:17 +01:00
|
|
|
$transaction_view->setAuxiliaryFields($aux_fields);
|
2011-02-08 19:53:59 +01:00
|
|
|
$transaction_view->setMarkupEngine($engine);
|
|
|
|
|
2012-06-08 15:31:30 +02:00
|
|
|
PhabricatorFeedStoryNotification::updateObjectNotificationViews(
|
|
|
|
$user, $task->getPHID());
|
|
|
|
|
2011-02-08 19:53:59 +01:00
|
|
|
return $this->buildStandardPageResponse(
|
|
|
|
array(
|
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 19:46:22 +02:00
|
|
|
$context_bar,
|
2012-03-30 23:12:10 +02:00
|
|
|
$headsup_panel,
|
2011-02-08 19:53:59 +01:00
|
|
|
$transaction_view,
|
|
|
|
$comment_panel,
|
2011-05-10 17:29:28 +02:00
|
|
|
$preview_panel,
|
2011-02-08 19:53:59 +01:00
|
|
|
),
|
|
|
|
array(
|
2011-02-10 01:38:31 +01:00
|
|
|
'title' => 'T'.$task->getID().' '.$task->getTitle(),
|
2012-06-14 02:28:21 +02:00
|
|
|
'pageObjects' => array($task->getPHID()),
|
2011-02-08 19:53:59 +01:00
|
|
|
));
|
|
|
|
}
|
2011-02-19 07:15:28 +01:00
|
|
|
|
2012-07-19 05:41:42 +02:00
|
|
|
private function renderHandleList(array $handles) {
|
|
|
|
$links = array();
|
|
|
|
foreach ($handles as $handle) {
|
|
|
|
$links[] = $handle->renderLink();
|
|
|
|
}
|
|
|
|
return implode('<br />', $links);
|
|
|
|
}
|
|
|
|
|
2011-02-08 19:53:59 +01:00
|
|
|
}
|