mirror of
https://we.phorge.it/source/phorge.git
synced 2025-01-03 11:21:01 +01:00
Maniphest wireframes
Summary: Test Plan: Reviewers: CC:
This commit is contained in:
parent
3018d44279
commit
6ec5e682f4
42 changed files with 1931 additions and 3 deletions
|
@ -188,6 +188,33 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'disk' => '/rsrc/css/application/directory/phabricator-directory.css',
|
||||
),
|
||||
'mainphest-task-detail-css' =>
|
||||
array(
|
||||
'uri' => '/res/e5f3beca/rsrc/css/application/maniphest/task-detail.css',
|
||||
'type' => 'css',
|
||||
'requires' =>
|
||||
array(
|
||||
),
|
||||
'disk' => '/rsrc/css/application/maniphest/task-detail.css',
|
||||
),
|
||||
'maniphest-task-summary-css' =>
|
||||
array(
|
||||
'uri' => '/res/bed1edf0/rsrc/css/application/maniphest/task-summary.css',
|
||||
'type' => 'css',
|
||||
'requires' =>
|
||||
array(
|
||||
),
|
||||
'disk' => '/rsrc/css/application/maniphest/task-summary.css',
|
||||
),
|
||||
'maniphest-transaction-detail-css' =>
|
||||
array(
|
||||
'uri' => '/res/436b83d7/rsrc/css/application/maniphest/transaction-detail.css',
|
||||
'type' => 'css',
|
||||
'requires' =>
|
||||
array(
|
||||
),
|
||||
'disk' => '/rsrc/css/application/maniphest/transaction-detail.css',
|
||||
),
|
||||
'phabricator-core-buttons-css' =>
|
||||
array(
|
||||
'uri' => '/res/fe74ba44/rsrc/css/core/buttons.css',
|
||||
|
@ -332,6 +359,16 @@ celerity_register_resource_map(array(
|
|||
),
|
||||
'disk' => '/rsrc/js/application/differential/behavior-show-more.js',
|
||||
),
|
||||
'javelin-behavior-maniphest-transaction-controls' =>
|
||||
array(
|
||||
'uri' => '/res/fc6a8722/rsrc/js/application/maniphest/behavior-transaction-controls.js',
|
||||
'type' => 'js',
|
||||
'requires' =>
|
||||
array(
|
||||
0 => 'javelin-lib-dev',
|
||||
),
|
||||
'disk' => '/rsrc/js/application/maniphest/behavior-transaction-controls.js',
|
||||
),
|
||||
'javelin-magical-init' =>
|
||||
array(
|
||||
'uri' => '/res/76614f84/rsrc/js/javelin/init.dev.js',
|
||||
|
|
|
@ -133,6 +133,22 @@ phutil_register_library_map(array(
|
|||
'DifferentialUnitStatus' => 'applications/differential/constants/unitstatus',
|
||||
'Javelin' => 'infrastructure/javelin/api',
|
||||
'LiskDAO' => 'storage/lisk/dao',
|
||||
'ManiphestController' => 'applications/maniphest/controller/base',
|
||||
'ManiphestDAO' => 'applications/maniphest/storage/base',
|
||||
'ManiphestTask' => 'applications/maniphest/storage/task',
|
||||
'ManiphestTaskCreateController' => 'applications/maniphest/controller/createtask',
|
||||
'ManiphestTaskDetailController' => 'applications/maniphest/controller/taskdetail',
|
||||
'ManiphestTaskListController' => 'applications/maniphest/controller/tasklist',
|
||||
'ManiphestTaskListView' => 'applications/maniphest/view/tasklist',
|
||||
'ManiphestTaskPriority' => 'applications/maniphest/constants/priority',
|
||||
'ManiphestTaskStatus' => 'applications/maniphest/constants/status',
|
||||
'ManiphestTaskSummaryView' => 'applications/maniphest/view/tasksummary',
|
||||
'ManiphestTransaction' => 'applications/maniphest/storage/transaction',
|
||||
'ManiphestTransactionDetailView' => 'applications/maniphest/view/transactiondetail',
|
||||
'ManiphestTransactionEditor' => 'applications/maniphest/editor/transaction',
|
||||
'ManiphestTransactionListView' => 'applications/maniphest/view/transactionlist',
|
||||
'ManiphestTransactionSaveController' => 'applications/maniphest/controller/transactionsave',
|
||||
'ManiphestTransactionType' => 'applications/maniphest/constants/transactiontype',
|
||||
'Phabricator404Controller' => 'applications/base/controller/404',
|
||||
'PhabricatorAuthController' => 'applications/auth/controller/base',
|
||||
'PhabricatorConduitAPIController' => 'applications/conduit/controller/api',
|
||||
|
@ -320,6 +336,18 @@ phutil_register_library_map(array(
|
|||
'DifferentialRevisionListController' => 'DifferentialController',
|
||||
'DifferentialRevisionUpdateHistoryView' => 'AphrontView',
|
||||
'DifferentialRevisionViewController' => 'DifferentialController',
|
||||
'ManiphestController' => 'PhabricatorController',
|
||||
'ManiphestDAO' => 'PhabricatorLiskDAO',
|
||||
'ManiphestTask' => 'ManiphestDAO',
|
||||
'ManiphestTaskCreateController' => 'ManiphestController',
|
||||
'ManiphestTaskDetailController' => 'ManiphestController',
|
||||
'ManiphestTaskListController' => 'ManiphestController',
|
||||
'ManiphestTaskListView' => 'AphrontView',
|
||||
'ManiphestTaskSummaryView' => 'AphrontView',
|
||||
'ManiphestTransaction' => 'ManiphestDAO',
|
||||
'ManiphestTransactionDetailView' => 'AphrontView',
|
||||
'ManiphestTransactionListView' => 'AphrontView',
|
||||
'ManiphestTransactionSaveController' => 'ManiphestController',
|
||||
'Phabricator404Controller' => 'PhabricatorController',
|
||||
'PhabricatorAuthController' => 'PhabricatorController',
|
||||
'PhabricatorConduitAPIController' => 'PhabricatorConduitController',
|
||||
|
|
|
@ -53,7 +53,7 @@ class DarkConsoleRequestPlugin extends DarkConsolePlugin {
|
|||
foreach ($map as $key => $value) {
|
||||
$rows[] = array(
|
||||
phutil_escape_html($key),
|
||||
phutil_escape_html($value),
|
||||
phutil_escape_html(is_array($value) ? json_encode($value) : $value),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -139,6 +139,19 @@ class AphrontDefaultApplicationConfiguration
|
|||
'/settings/' => array(
|
||||
'(?:page/(?P<page>[^/]+)/)?$' => 'PhabricatorUserSettingsController',
|
||||
),
|
||||
|
||||
'/maniphest/' => array(
|
||||
'$' => 'ManiphestTaskListController',
|
||||
'view/(?P<view>\w+)/$' => 'ManiphestTaskListController',
|
||||
'task/' => array(
|
||||
'create/' => 'ManiphestTaskCreateController',
|
||||
),
|
||||
'transaction/' => array(
|
||||
'save/' => 'ManiphestTransactionSaveController',
|
||||
),
|
||||
),
|
||||
|
||||
'/T(?P<id>\d+)$' => 'ManiphestTaskDetailController',
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
final class ManiphestTaskPriority {
|
||||
|
||||
const PRIORITY_UNBREAK_NOW = 100;
|
||||
const PRIORITY_TRIAGE = 90;
|
||||
const PRIORITY_HIGH = 80;
|
||||
const PRIORITY_NORMAL = 50;
|
||||
const PRIORITY_LOW = 25;
|
||||
const PRIORITY_WISH = 0;
|
||||
|
||||
public static function getTaskPriorityMap() {
|
||||
return array(
|
||||
self::PRIORITY_UNBREAK_NOW => 'Unbreak Now!',
|
||||
self::PRIORITY_TRIAGE => 'Needs Triage',
|
||||
self::PRIORITY_HIGH => 'High',
|
||||
self::PRIORITY_NORMAL => 'Normal',
|
||||
self::PRIORITY_LOW => 'Low',
|
||||
self::PRIORITY_WISH => 'Wishlist',
|
||||
);
|
||||
}
|
||||
|
||||
public static function getTaskPriorityName($priority) {
|
||||
return idx(self::getTaskPriorityMap(), $priority, '???');
|
||||
}
|
||||
}
|
12
src/applications/maniphest/constants/priority/__init__.php
Normal file
12
src/applications/maniphest/constants/priority/__init__.php
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is automatically generated. Lint this module to rebuild it.
|
||||
* @generated
|
||||
*/
|
||||
|
||||
|
||||
|
||||
phutil_require_module('phutil', 'utils');
|
||||
|
||||
|
||||
phutil_require_source('ManiphestTaskPriority.php');
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
final class ManiphestTaskStatus {
|
||||
|
||||
const STATUS_OPEN = 0;
|
||||
const STATUS_CLOSED_RESOLVED = 1;
|
||||
const STATUS_CLOSED_WONTFIX = 2;
|
||||
const STATUS_CLOSED_INVALID = 3;
|
||||
const STATUS_CLOSED_DUPLICATE = 4;
|
||||
const STATUS_CLOSED_SPITE = 5;
|
||||
|
||||
public static function getTaskStatusMap() {
|
||||
return array(
|
||||
self::STATUS_OPEN => 'Open',
|
||||
self::STATUS_CLOSED_RESOLVED => 'Resolved',
|
||||
self::STATUS_CLOSED_WONTFIX => 'Wontfix',
|
||||
self::STATUS_CLOSED_INVALID => 'Invalid',
|
||||
self::STATUS_CLOSED_DUPLICATE => 'Duplicate',
|
||||
self::STATUS_CLOSED_SPITE => 'Spite',
|
||||
);
|
||||
}
|
||||
|
||||
public static function getTaskStatusFullName($status) {
|
||||
$map = array(
|
||||
self::STATUS_OPEN => 'Open',
|
||||
self::STATUS_CLOSED_RESOLVED => 'Closed, Resolved',
|
||||
self::STATUS_CLOSED_WONTFIX => 'Closed, Wontfix',
|
||||
self::STATUS_CLOSED_INVALID => 'Closed, Invalid',
|
||||
self::STATUS_CLOSED_DUPLICATE => 'Closed, Duplicate',
|
||||
self::STATUS_CLOSED_SPITE => 'Closed out of Spite',
|
||||
);
|
||||
return idx($map, $status, '???');
|
||||
}
|
||||
|
||||
}
|
12
src/applications/maniphest/constants/status/__init__.php
Normal file
12
src/applications/maniphest/constants/status/__init__.php
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is automatically generated. Lint this module to rebuild it.
|
||||
* @generated
|
||||
*/
|
||||
|
||||
|
||||
|
||||
phutil_require_module('phutil', 'utils');
|
||||
|
||||
|
||||
phutil_require_source('ManiphestTaskStatus.php');
|
|
@ -0,0 +1,37 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
final class ManiphestTransactionType {
|
||||
|
||||
const TYPE_NONE = 'comment';
|
||||
const TYPE_STATUS = 'status';
|
||||
const TYPE_OWNER = 'reassign';
|
||||
const TYPE_CCS = 'ccs';
|
||||
const TYPE_PRIORITY = 'priority';
|
||||
|
||||
public static function getTransactionTypeMap() {
|
||||
return array(
|
||||
self::TYPE_NONE => 'Comment',
|
||||
self::TYPE_STATUS => 'Close Task',
|
||||
self::TYPE_OWNER => 'Reassign / Claim',
|
||||
self::TYPE_CCS => 'Add CCs',
|
||||
self::TYPE_PRIORITY => 'Change Priority',
|
||||
);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is automatically generated. Lint this module to rebuild it.
|
||||
* @generated
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
phutil_require_source('ManiphestTransactionType.php');
|
|
@ -0,0 +1,34 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
abstract class ManiphestController extends PhabricatorController {
|
||||
|
||||
public function buildStandardPageResponse($view, array $data) {
|
||||
$page = $this->buildStandardPageView();
|
||||
|
||||
$page->setApplicationName('Maniphest');
|
||||
$page->setBaseURI('/maniphest/');
|
||||
$page->setTitle(idx($data, 'title'));
|
||||
$page->setGlyph("\xE2\x9A\x93");
|
||||
$page->appendChild($view);
|
||||
|
||||
$response = new AphrontWebpageResponse();
|
||||
return $response->setContent($page->render());
|
||||
}
|
||||
|
||||
}
|
15
src/applications/maniphest/controller/base/__init__.php
Normal file
15
src/applications/maniphest/controller/base/__init__.php
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is automatically generated. Lint this module to rebuild it.
|
||||
* @generated
|
||||
*/
|
||||
|
||||
|
||||
|
||||
phutil_require_module('phabricator', 'aphront/response/webpage');
|
||||
phutil_require_module('phabricator', 'applications/base/controller/base');
|
||||
|
||||
phutil_require_module('phutil', 'utils');
|
||||
|
||||
|
||||
phutil_require_source('ManiphestController.php');
|
|
@ -0,0 +1,147 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
class ManiphestTaskCreateController extends ManiphestController {
|
||||
|
||||
public function processRequest() {
|
||||
|
||||
$request = $this->getRequest();
|
||||
$user = $request->getUser();
|
||||
|
||||
$task = new ManiphestTask();
|
||||
|
||||
$task->setPriority(ManiphestTaskPriority::PRIORITY_TRIAGE);
|
||||
|
||||
$errors = array();
|
||||
$e_title = true;
|
||||
|
||||
if ($request->isFormPost()) {
|
||||
$task->setTitle($request->getStr('title'));
|
||||
$task->setAuthorPHID($user->getPHID());
|
||||
$owner_tokenizer = $request->getArr('assigned_to');
|
||||
$task->setOwnerPHID(reset($owner_tokenizer));
|
||||
$task->setCCPHIDs($request->getArr('cc'));
|
||||
$task->setPriority($request->getInt('priority'));
|
||||
$task->setDescription($request->getStr('description'));
|
||||
|
||||
if (!strlen($task->getTitle())) {
|
||||
$e_title = 'Required';
|
||||
$errors[] = 'Title is required.';
|
||||
}
|
||||
|
||||
if (!$errors) {
|
||||
$transaction = new ManiphestTransaction();
|
||||
$transaction->setAuthorPHID($user->getPHID());
|
||||
$transaction->setTransactionType(ManiphestTransactionType::TYPE_STATUS);
|
||||
$transaction->setNewValue(ManiphestTaskStatus::STATUS_OPEN);
|
||||
|
||||
$editor = new ManiphestTransactionEditor();
|
||||
$editor->applyTransaction($task, $transaction);
|
||||
|
||||
return id(new AphrontRedirectResponse())
|
||||
->setURI('/T'.$task->getID());
|
||||
}
|
||||
}
|
||||
|
||||
$phids = array_merge(
|
||||
array($task->getOwnerPHID()),
|
||||
nonempty($task->getCCPHIDs(), array()));
|
||||
$phids = array_filter($phids);
|
||||
$phids = array_unique($phids);
|
||||
|
||||
$handles = id(new PhabricatorObjectHandleData($phids))
|
||||
->loadHandles($phids);
|
||||
|
||||
$tvalues = mpull($handles, 'getFullName', 'getPHID');
|
||||
|
||||
$error_view = null;
|
||||
if ($errors) {
|
||||
$error_view = new AphrontErrorView();
|
||||
$error_view->setErrors($errors);
|
||||
$error_view->setTitle('Form Errors');
|
||||
}
|
||||
|
||||
$priority_map = ManiphestTaskPriority::getTaskPriorityMap();
|
||||
|
||||
if ($task->getOwnerPHID()) {
|
||||
$assigned_value = array(
|
||||
$task->getOwnerPHID() => $handles[$task->getOwnerPHID()]->getFullName(),
|
||||
);
|
||||
} else {
|
||||
$assigned_value = array();
|
||||
}
|
||||
|
||||
if ($task->getCCPHIDs()) {
|
||||
$cc_value = array_select_keys($tvalues, $task->getCCPHIDs());
|
||||
} else {
|
||||
$cc_value = array();
|
||||
}
|
||||
|
||||
$form = new AphrontFormView();
|
||||
$form
|
||||
->setUser($user)
|
||||
->appendChild(
|
||||
id(new AphrontFormTextAreaControl())
|
||||
->setLabel('Title')
|
||||
->setName('title')
|
||||
->setError($e_title)
|
||||
->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_SHORT)
|
||||
->setValue($task->getTitle()))
|
||||
->appendChild(
|
||||
id(new AphrontFormTokenizerControl())
|
||||
->setLabel('Assigned To')
|
||||
->setName('assigned_to')
|
||||
->setValue($assigned_value)
|
||||
->setDatasource('/typeahead/common/users/')
|
||||
->setLimit(1))
|
||||
->appendChild(
|
||||
id(new AphrontFormTokenizerControl())
|
||||
->setLabel('CC')
|
||||
->setName('cc')
|
||||
->setValue($cc_value)
|
||||
->setDatasource('/typeahead/common/mailable/'))
|
||||
->appendChild(
|
||||
id(new AphrontFormSelectControl())
|
||||
->setLabel('Priority')
|
||||
->setName('priority')
|
||||
->setOptions($priority_map)
|
||||
->setValue($task->getPriority()))
|
||||
->appendChild(
|
||||
id(new AphrontFormTextAreaControl())
|
||||
->setLabel('Description')
|
||||
->setName('description')
|
||||
->setValue($task->getDescription()))
|
||||
->appendChild(
|
||||
id(new AphrontFormSubmitControl())
|
||||
->setValue('Create Task'));
|
||||
|
||||
$panel = new AphrontPanelView();
|
||||
$panel->setWidth(AphrontPanelView::WIDTH_FULL);
|
||||
$panel->setHeader('Create New Task');
|
||||
$panel->appendChild($form);
|
||||
|
||||
return $this->buildStandardPageResponse(
|
||||
array(
|
||||
$error_view,
|
||||
$panel,
|
||||
),
|
||||
array(
|
||||
'title' => 'Create Task',
|
||||
));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is automatically generated. Lint this module to rebuild it.
|
||||
* @generated
|
||||
*/
|
||||
|
||||
|
||||
|
||||
phutil_require_module('phabricator', 'aphront/response/redirect');
|
||||
phutil_require_module('phabricator', 'applications/maniphest/constants/priority');
|
||||
phutil_require_module('phabricator', 'applications/maniphest/constants/status');
|
||||
phutil_require_module('phabricator', 'applications/maniphest/constants/transactiontype');
|
||||
phutil_require_module('phabricator', 'applications/maniphest/controller/base');
|
||||
phutil_require_module('phabricator', 'applications/maniphest/editor/transaction');
|
||||
phutil_require_module('phabricator', 'applications/maniphest/storage/task');
|
||||
phutil_require_module('phabricator', 'applications/maniphest/storage/transaction');
|
||||
phutil_require_module('phabricator', 'applications/phid/handle/data');
|
||||
phutil_require_module('phabricator', 'view/form/base');
|
||||
phutil_require_module('phabricator', 'view/form/control/submit');
|
||||
phutil_require_module('phabricator', 'view/form/error');
|
||||
phutil_require_module('phabricator', 'view/layout/panel');
|
||||
|
||||
phutil_require_module('phutil', 'utils');
|
||||
|
||||
|
||||
phutil_require_source('ManiphestTaskCreateController.php');
|
|
@ -0,0 +1,235 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
class ManiphestTaskDetailController extends ManiphestController {
|
||||
|
||||
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);
|
||||
|
||||
$transactions = id(new ManiphestTransaction())->loadAllWhere(
|
||||
'taskID = %d',
|
||||
$task->getID());
|
||||
|
||||
$phids = array();
|
||||
foreach ($transactions as $transaction) {
|
||||
foreach ($transaction->extractPHIDs() as $phid) {
|
||||
$phids[$phid] = true;
|
||||
}
|
||||
}
|
||||
foreach ($task->getCCPHIDs() as $phid) {
|
||||
$phids[$phid] = true;
|
||||
}
|
||||
if ($task->getOwnerPHID()) {
|
||||
$phids[$task->getOwnerPHID()] = true;
|
||||
}
|
||||
$phids[$task->getAuthorPHID()] = true;
|
||||
$phids = array_keys($phids);
|
||||
|
||||
$handles = id(new PhabricatorObjectHandleData($phids))
|
||||
->loadHandles();
|
||||
|
||||
$factory = new DifferentialMarkupEngineFactory();
|
||||
$engine = $factory->newDifferentialCommentMarkupEngine();
|
||||
|
||||
$dict = array();
|
||||
$dict['Status'] =
|
||||
'<strong>'.
|
||||
ManiphestTaskStatus::getTaskStatusFullName($task->getStatus()).
|
||||
'</strong>';
|
||||
|
||||
$dict['Assigned To'] = $task->getOwnerPHID()
|
||||
? '<em>None</em>'
|
||||
: $handles[$task->getOwnerPHID()]->renderLink();
|
||||
|
||||
$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();
|
||||
|
||||
$dict['Description'] = $engine->markupText($task->getDescription());
|
||||
|
||||
require_celerity_resource('mainphest-task-detail-css');
|
||||
|
||||
$table = array();
|
||||
foreach ($dict as $key => $value) {
|
||||
$table[] =
|
||||
'<tr>'.
|
||||
'<th>'.phutil_escape_html($key).':</th>'.
|
||||
'<td>'.$value.'</td>'.
|
||||
'</tr>';
|
||||
}
|
||||
$table =
|
||||
'<table class="maniphest-task-properties">'.
|
||||
implode("\n", $table).
|
||||
'</table>';
|
||||
|
||||
$panel =
|
||||
'<div class="maniphest-panel">'.
|
||||
'<div class="maniphest-task-detail-core">'.
|
||||
'<h1>'.
|
||||
phutil_escape_html('T'.$task->getID().' '.$task->getTitle()).
|
||||
'</h1>'.
|
||||
$table.
|
||||
'</div>'.
|
||||
'</div>';
|
||||
|
||||
$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().')',
|
||||
);
|
||||
|
||||
$comment_form = new AphrontFormView();
|
||||
$comment_form
|
||||
->setUser($user)
|
||||
->setAction('/maniphest/transaction/save/')
|
||||
->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()))
|
||||
->appendChild(
|
||||
id(new AphrontFormTextAreaControl())
|
||||
->setLabel('Comments')
|
||||
->setName('comments')
|
||||
->setValue(''))
|
||||
->appendChild(
|
||||
id(new AphrontFormSubmitControl())
|
||||
->setValue('Avast!'));
|
||||
|
||||
Javelin::initBehavior('maniphest-transaction-controls', array(
|
||||
'select' => 'transaction-action',
|
||||
'controlMap' => array(
|
||||
ManiphestTransactionType::TYPE_STATUS => 'resolution',
|
||||
ManiphestTransactionType::TYPE_OWNER => 'assign_to',
|
||||
ManiphestTransactionType::TYPE_CCS => 'ccs',
|
||||
ManiphestTransactionType::TYPE_PRIORITY => 'priority',
|
||||
),
|
||||
'tokenizers' => array(
|
||||
ManiphestTransactionType::TYPE_OWNER => array(
|
||||
'id' => 'assign-tokenizer',
|
||||
'src' => '/typeahead/common/users/',
|
||||
'value' => $default_claim,
|
||||
'limit' => 1,
|
||||
),
|
||||
ManiphestTransactionType::TYPE_CCS => array(
|
||||
'id' => 'cc-tokenizer',
|
||||
'src' => '/typeahead/common/mailable/',
|
||||
),
|
||||
),
|
||||
));
|
||||
|
||||
$comment_panel = new AphrontPanelView();
|
||||
$comment_panel->appendChild($comment_form);
|
||||
$comment_panel->setHeader('Leap Into Action');
|
||||
|
||||
$transaction_view = new ManiphestTransactionListView();
|
||||
$transaction_view->setTransactions($transactions);
|
||||
$transaction_view->setHandles($handles);
|
||||
$transaction_view->setUser($user);
|
||||
$transaction_view->setMarkupEngine($engine);
|
||||
|
||||
return $this->buildStandardPageResponse(
|
||||
array(
|
||||
$panel,
|
||||
$transaction_view,
|
||||
$comment_panel,
|
||||
),
|
||||
array(
|
||||
'title' => 'Create Task',
|
||||
));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is automatically generated. Lint this module to rebuild it.
|
||||
* @generated
|
||||
*/
|
||||
|
||||
|
||||
|
||||
phutil_require_module('phabricator', 'applications/differential/parser/markup');
|
||||
phutil_require_module('phabricator', 'applications/maniphest/constants/priority');
|
||||
phutil_require_module('phabricator', 'applications/maniphest/constants/status');
|
||||
phutil_require_module('phabricator', 'applications/maniphest/constants/transactiontype');
|
||||
phutil_require_module('phabricator', 'applications/maniphest/controller/base');
|
||||
phutil_require_module('phabricator', 'applications/maniphest/storage/task');
|
||||
phutil_require_module('phabricator', 'applications/maniphest/storage/transaction');
|
||||
phutil_require_module('phabricator', 'applications/maniphest/view/transactionlist');
|
||||
phutil_require_module('phabricator', 'applications/phid/handle/data');
|
||||
phutil_require_module('phabricator', 'infrastructure/celerity/api');
|
||||
phutil_require_module('phabricator', 'infrastructure/javelin/api');
|
||||
phutil_require_module('phabricator', 'view/form/base');
|
||||
phutil_require_module('phabricator', 'view/form/control/submit');
|
||||
phutil_require_module('phabricator', 'view/layout/panel');
|
||||
|
||||
phutil_require_module('phutil', 'markup');
|
||||
phutil_require_module('phutil', 'utils');
|
||||
|
||||
|
||||
phutil_require_source('ManiphestTaskDetailController.php');
|
|
@ -0,0 +1,105 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
class ManiphestTaskListController extends ManiphestController {
|
||||
|
||||
private $view;
|
||||
|
||||
public function willProcessRequest(array $data) {
|
||||
$this->view = idx($data, 'view');
|
||||
}
|
||||
|
||||
public function processRequest() {
|
||||
|
||||
$views = array(
|
||||
'action' => 'Action Required',
|
||||
// 'activity' => 'Recently Active',
|
||||
// 'closed' => 'Recently Closed',
|
||||
'created' => 'Created',
|
||||
'triage' => 'Need Triage',
|
||||
);
|
||||
|
||||
if (empty($views[$this->view])) {
|
||||
$this->view = key($views);
|
||||
}
|
||||
|
||||
$tasks = $this->loadTasks();
|
||||
|
||||
$nav = new AphrontSideNavView();
|
||||
foreach ($views as $view => $name) {
|
||||
$nav->addNavItem(
|
||||
phutil_render_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => '/maniphest/view/'.$view.'/',
|
||||
'class' => ($this->view == $view)
|
||||
? 'aphront-side-nav-selected'
|
||||
: null,
|
||||
),
|
||||
phutil_escape_html($name)));
|
||||
}
|
||||
|
||||
$handle_phids = mpull($tasks, 'getOwnerPHID');
|
||||
$handles = id(new PhabricatorObjectHandleData($handle_phids))
|
||||
->loadHandles();
|
||||
|
||||
$task_list = new ManiphestTaskListView();
|
||||
$task_list->setTasks($tasks);
|
||||
$task_list->setHandles($handles);
|
||||
|
||||
$nav->appendChild(
|
||||
'<div style="text-align: right; padding: 1em 1em 0;">'.
|
||||
'<a href="/maniphest/task/create/" class="green button">'.
|
||||
'Create New Task'.
|
||||
'</a>'.
|
||||
'</div>');
|
||||
$nav->appendChild($task_list);
|
||||
|
||||
return $this->buildStandardPageResponse(
|
||||
$nav,
|
||||
array(
|
||||
'title' => 'Task List',
|
||||
));
|
||||
}
|
||||
|
||||
private function loadTasks() {
|
||||
$request = $this->getRequest();
|
||||
$user = $request->getUser();
|
||||
|
||||
$phids = array($user->getPHID());
|
||||
|
||||
switch ($this->view) {
|
||||
case 'action':
|
||||
return id(new ManiphestTask())->loadAllWhere(
|
||||
'ownerPHID in (%Ls) AND status = 0',
|
||||
$phids);
|
||||
case 'created':
|
||||
return id(new ManiphestTask())->loadAllWhere(
|
||||
'authorPHID in (%Ls) AND status = 0',
|
||||
$phids);
|
||||
case 'triage':
|
||||
return id(new ManiphestTask())->loadAllWhere(
|
||||
'status = %d',
|
||||
ManiphestTaskPriority::PRIORITY_TRIAGE);
|
||||
}
|
||||
|
||||
return array();
|
||||
}
|
||||
|
||||
|
||||
}
|
20
src/applications/maniphest/controller/tasklist/__init__.php
Normal file
20
src/applications/maniphest/controller/tasklist/__init__.php
Normal file
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is automatically generated. Lint this module to rebuild it.
|
||||
* @generated
|
||||
*/
|
||||
|
||||
|
||||
|
||||
phutil_require_module('phabricator', 'applications/maniphest/constants/priority');
|
||||
phutil_require_module('phabricator', 'applications/maniphest/controller/base');
|
||||
phutil_require_module('phabricator', 'applications/maniphest/storage/task');
|
||||
phutil_require_module('phabricator', 'applications/maniphest/view/tasklist');
|
||||
phutil_require_module('phabricator', 'applications/phid/handle/data');
|
||||
phutil_require_module('phabricator', 'view/layout/sidenav');
|
||||
|
||||
phutil_require_module('phutil', 'markup');
|
||||
phutil_require_module('phutil', 'utils');
|
||||
|
||||
|
||||
phutil_require_source('ManiphestTaskListController.php');
|
|
@ -0,0 +1,67 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
class ManiphestTransactionSaveController extends ManiphestController {
|
||||
|
||||
public function processRequest() {
|
||||
$request = $this->getRequest();
|
||||
$user = $request->getUser();
|
||||
|
||||
$task = id(new ManiphestTask())->load($request->getStr('taskID'));
|
||||
if (!$task) {
|
||||
return new Aphront404Response();
|
||||
}
|
||||
|
||||
$action = $request->getStr('action');
|
||||
|
||||
$transaction = new ManiphestTransaction();
|
||||
$transaction
|
||||
->setAuthorPHID($user->getPHID())
|
||||
->setComments($request->getStr('comments'))
|
||||
->setTransactionType($action);
|
||||
|
||||
switch ($action) {
|
||||
case ManiphestTransactionType::TYPE_NONE:
|
||||
break;
|
||||
case ManiphestTransactionType::TYPE_STATUS:
|
||||
$transaction->setNewValue($request->getStr('resolution'));
|
||||
break;
|
||||
case ManiphestTransactionType::TYPE_OWNER:
|
||||
$assign_to = $request->getArr('assign_to');
|
||||
$assign_to = reset($assign_to);
|
||||
$transaction->setNewValue($assign_to);
|
||||
break;
|
||||
case ManiphestTransactionType::TYPE_CCS:
|
||||
$ccs = $request->getArr('ccs');
|
||||
$transaction->setNewValue($ccs);
|
||||
break;
|
||||
case ManiphestTransactionType::TYPE_PRIORITY:
|
||||
$transaction->setNewValue($request->getInt('priority'));
|
||||
break;
|
||||
default:
|
||||
throw new Exception('unknown action');
|
||||
}
|
||||
|
||||
$editor = new ManiphestTransactionEditor();
|
||||
$editor->applyTransaction($task, $transaction);
|
||||
|
||||
return id(new AphrontRedirectResponse())
|
||||
->setURI('/T'.$task->getID());
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is automatically generated. Lint this module to rebuild it.
|
||||
* @generated
|
||||
*/
|
||||
|
||||
|
||||
|
||||
phutil_require_module('phabricator', 'aphront/response/404');
|
||||
phutil_require_module('phabricator', 'aphront/response/redirect');
|
||||
phutil_require_module('phabricator', 'applications/maniphest/constants/transactiontype');
|
||||
phutil_require_module('phabricator', 'applications/maniphest/controller/base');
|
||||
phutil_require_module('phabricator', 'applications/maniphest/editor/transaction');
|
||||
phutil_require_module('phabricator', 'applications/maniphest/storage/task');
|
||||
phutil_require_module('phabricator', 'applications/maniphest/storage/transaction');
|
||||
|
||||
phutil_require_module('phutil', 'utils');
|
||||
|
||||
|
||||
phutil_require_source('ManiphestTransactionSaveController.php');
|
|
@ -0,0 +1,132 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
class ManiphestTransactionEditor {
|
||||
|
||||
public function applyTransaction($task, $transaction) {
|
||||
|
||||
$type = $transaction->getTransactionType();
|
||||
|
||||
$new = $transaction->getNewValue();
|
||||
|
||||
$email_cc = $task->getCCPHIDs();
|
||||
|
||||
$email_to = array();
|
||||
$email_to[] = $task->getOwnerPHID();
|
||||
$email_to[] = $transaction->getAuthorPHID();
|
||||
|
||||
switch ($type) {
|
||||
case ManiphestTransactionType::TYPE_NONE:
|
||||
$old = null;
|
||||
break;
|
||||
case ManiphestTransactionType::TYPE_STATUS:
|
||||
$old = $task->getStatus();
|
||||
break;
|
||||
case ManiphestTransactionType::TYPE_OWNER:
|
||||
$old = $task->getOwnerPHID();
|
||||
break;
|
||||
case ManiphestTransactionType::TYPE_CCS:
|
||||
$old = $task->getCCPHIDs();
|
||||
$new = array_unique(array_merge($old, $new));
|
||||
break;
|
||||
case ManiphestTransactionType::TYPE_PRIORITY:
|
||||
$old = $task->getPriority();
|
||||
break;
|
||||
default:
|
||||
throw new Exception('Unknown action type.');
|
||||
}
|
||||
|
||||
if (($old !== null) && ($old == $new)) {
|
||||
$transaction->setOldValue(null);
|
||||
$transaction->setNewValue(null);
|
||||
$transaction->setTransactionType(ManiphestTransactionType::TYPE_NONE);
|
||||
} else {
|
||||
switch ($type) {
|
||||
case ManiphestTransactionType::TYPE_NONE:
|
||||
break;
|
||||
case ManiphestTransactionType::TYPE_STATUS:
|
||||
$task->setStatus($new);
|
||||
break;
|
||||
case ManiphestTransactionType::TYPE_OWNER:
|
||||
$task->setOwnerPHID($new);
|
||||
break;
|
||||
case ManiphestTransactionType::TYPE_CCS:
|
||||
$task->setCCPHIDs($new);
|
||||
break;
|
||||
case ManiphestTransactionType::TYPE_PRIORITY:
|
||||
$task->setPriority($new);
|
||||
break;
|
||||
default:
|
||||
throw new Exception('Unknown action type.');
|
||||
}
|
||||
|
||||
$transaction->setOldValue($old);
|
||||
$transaction->setNewValue($new);
|
||||
}
|
||||
|
||||
$task->save();
|
||||
$transaction->setTaskID($task->getID());
|
||||
$transaction->save();
|
||||
|
||||
$email_to[] = $task->getOwnerPHID();
|
||||
$email_cc = array_merge($email_cc, $task->getCCPHIDs());
|
||||
|
||||
$this->sendEmail($task, $transaction, $email_to, $email_cc);
|
||||
}
|
||||
|
||||
private function sendEmail($task, $transaction, $email_to, $email_cc) {
|
||||
$email_to = array_filter(array_unique($email_to));
|
||||
$email_cc = array_filter(array_unique($email_cc));
|
||||
|
||||
$transactions = array($transaction);
|
||||
|
||||
$phids = array();
|
||||
foreach ($transactions as $transaction) {
|
||||
foreach ($transaction->extractPHIDs() as $phid) {
|
||||
$phids[$phid] = true;
|
||||
}
|
||||
}
|
||||
$phids = array_keys($phids);
|
||||
|
||||
$handles = id(new PhabricatorObjectHandleData($phids))
|
||||
->loadHandles();
|
||||
|
||||
|
||||
$view = new ManiphestTransactionDetailView();
|
||||
$view->setTransaction($transaction);
|
||||
$view->setHandles($handles);
|
||||
|
||||
list($action, $body) = $view->renderForEmail($with_date = false);
|
||||
|
||||
$task_uri = PhabricatorEnv::getURI('/T'.$task->getID());
|
||||
|
||||
$body .=
|
||||
"\n\n".
|
||||
"TASK DETAIL\n".
|
||||
" ".$task_uri."\n";
|
||||
|
||||
id(new PhabricatorMetaMTAMail())
|
||||
->setSubject(
|
||||
'[Maniphest] '.$action.': T'.$task->getID().' '.$task->getTitle())
|
||||
->setFrom($transaction->getAuthorPHID())
|
||||
->addTos($email_to)
|
||||
->addCCs($email_cc)
|
||||
->setBody($body)
|
||||
->save();
|
||||
}
|
||||
}
|
18
src/applications/maniphest/editor/transaction/__init__.php
Normal file
18
src/applications/maniphest/editor/transaction/__init__.php
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is automatically generated. Lint this module to rebuild it.
|
||||
* @generated
|
||||
*/
|
||||
|
||||
|
||||
|
||||
phutil_require_module('phabricator', 'applications/maniphest/constants/transactiontype');
|
||||
phutil_require_module('phabricator', 'applications/maniphest/view/transactiondetail');
|
||||
phutil_require_module('phabricator', 'applications/metamta/storage/mail');
|
||||
phutil_require_module('phabricator', 'applications/phid/handle/data');
|
||||
phutil_require_module('phabricator', 'infrastructure/env');
|
||||
|
||||
phutil_require_module('phutil', 'utils');
|
||||
|
||||
|
||||
phutil_require_source('ManiphestTransactionEditor.php');
|
25
src/applications/maniphest/storage/base/ManiphestDAO.php
Normal file
25
src/applications/maniphest/storage/base/ManiphestDAO.php
Normal file
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
class ManiphestDAO extends PhabricatorLiskDAO {
|
||||
|
||||
public function getApplicationName() {
|
||||
return 'maniphest';
|
||||
}
|
||||
|
||||
}
|
12
src/applications/maniphest/storage/base/__init__.php
Normal file
12
src/applications/maniphest/storage/base/__init__.php
Normal file
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is automatically generated. Lint this module to rebuild it.
|
||||
* @generated
|
||||
*/
|
||||
|
||||
|
||||
|
||||
phutil_require_module('phabricator', 'applications/base/storage/lisk');
|
||||
|
||||
|
||||
phutil_require_source('ManiphestDAO.php');
|
48
src/applications/maniphest/storage/task/ManiphestTask.php
Normal file
48
src/applications/maniphest/storage/task/ManiphestTask.php
Normal file
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
class ManiphestTask extends ManiphestDAO {
|
||||
|
||||
protected $phid;
|
||||
protected $authorPHID;
|
||||
protected $ownerPHID;
|
||||
protected $ccPHIDs;
|
||||
|
||||
protected $status;
|
||||
protected $priority;
|
||||
|
||||
protected $title;
|
||||
protected $description;
|
||||
|
||||
protected $relatedPHIDs;
|
||||
|
||||
public function getConfiguration() {
|
||||
return array(
|
||||
self::CONFIG_AUX_PHID => true,
|
||||
self::CONFIG_SERIALIZATION => array(
|
||||
'ccPHIDs' => self::SERIALIZATION_JSON,
|
||||
'relatedPHIDs' => self::SERIALIZATION_JSON,
|
||||
),
|
||||
) + parent::getConfiguration();
|
||||
}
|
||||
|
||||
public function generatePHID() {
|
||||
return PhabricatorPHID::generateNewPHID('TASK');
|
||||
}
|
||||
|
||||
}
|
13
src/applications/maniphest/storage/task/__init__.php
Normal file
13
src/applications/maniphest/storage/task/__init__.php
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is automatically generated. Lint this module to rebuild it.
|
||||
* @generated
|
||||
*/
|
||||
|
||||
|
||||
|
||||
phutil_require_module('phabricator', 'applications/maniphest/storage/base');
|
||||
phutil_require_module('phabricator', 'applications/phid/storage/phid');
|
||||
|
||||
|
||||
phutil_require_source('ManiphestTask.php');
|
|
@ -0,0 +1,61 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
class ManiphestTransaction extends ManiphestDAO {
|
||||
|
||||
protected $taskID;
|
||||
protected $authorPHID;
|
||||
protected $transactionType;
|
||||
protected $oldValue;
|
||||
protected $newValue;
|
||||
protected $comments;
|
||||
protected $cache;
|
||||
|
||||
public function getConfiguration() {
|
||||
return array(
|
||||
self::CONFIG_SERIALIZATION => array(
|
||||
'oldValue' => self::SERIALIZATION_JSON,
|
||||
'newValue' => self::SERIALIZATION_JSON,
|
||||
),
|
||||
) + parent::getConfiguration();
|
||||
}
|
||||
|
||||
public function extractPHIDs() {
|
||||
$phids = array();
|
||||
|
||||
switch ($this->getTransactionType()) {
|
||||
case ManiphestTransactionType::TYPE_CCS:
|
||||
foreach ($this->getOldValue() as $phid) {
|
||||
$phids[] = $phid;
|
||||
}
|
||||
foreach ($this->getNewValue() as $phid) {
|
||||
$phids[] = $phid;
|
||||
}
|
||||
break;
|
||||
case ManiphestTransactionType::TYPE_OWNER:
|
||||
$phids[] = $this->getOldValue();
|
||||
$phids[] = $this->getNewValue();
|
||||
break;
|
||||
}
|
||||
|
||||
$phids[] = $this->getAuthorPHID();
|
||||
|
||||
return $phids;
|
||||
}
|
||||
|
||||
}
|
13
src/applications/maniphest/storage/transaction/__init__.php
Normal file
13
src/applications/maniphest/storage/transaction/__init__.php
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is automatically generated. Lint this module to rebuild it.
|
||||
* @generated
|
||||
*/
|
||||
|
||||
|
||||
|
||||
phutil_require_module('phabricator', 'applications/maniphest/constants/transactiontype');
|
||||
phutil_require_module('phabricator', 'applications/maniphest/storage/base');
|
||||
|
||||
|
||||
phutil_require_source('ManiphestTransaction.php');
|
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
class ManiphestTaskListView extends AphrontView {
|
||||
|
||||
private $tasks;
|
||||
private $handles;
|
||||
|
||||
public function setTasks(array $tasks) {
|
||||
$this->tasks = $tasks;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setHandles(array $handles) {
|
||||
$this->handles = $handles;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function render() {
|
||||
|
||||
$views = array();
|
||||
foreach ($this->tasks as $task) {
|
||||
$view = new ManiphestTaskSummaryView($task);
|
||||
$view->setTask($task);
|
||||
$view->setHandles($this->handles);
|
||||
$views[] = $view->render();
|
||||
}
|
||||
|
||||
return
|
||||
'<div style="padding: 1em;">'.
|
||||
implode("\n", $views).
|
||||
'</div>';
|
||||
}
|
||||
|
||||
}
|
13
src/applications/maniphest/view/tasklist/__init__.php
Normal file
13
src/applications/maniphest/view/tasklist/__init__.php
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is automatically generated. Lint this module to rebuild it.
|
||||
* @generated
|
||||
*/
|
||||
|
||||
|
||||
|
||||
phutil_require_module('phabricator', 'applications/maniphest/view/tasksummary');
|
||||
phutil_require_module('phabricator', 'view/base');
|
||||
|
||||
|
||||
phutil_require_source('ManiphestTaskListView.php');
|
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
class ManiphestTaskSummaryView extends AphrontView {
|
||||
|
||||
private $task;
|
||||
private $handles;
|
||||
|
||||
public function setTask(ManiphestTask $task) {
|
||||
$this->task = $task;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setHandles(array $handles) {
|
||||
$this->handles = $handles;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function render() {
|
||||
$task = $this->task;
|
||||
$handles = $this->handles;
|
||||
|
||||
require_celerity_resource('maniphest-task-summary-css');
|
||||
|
||||
return
|
||||
'<table class="maniphest-task-summary">'.
|
||||
'<td class="maniphest-task-number">'.
|
||||
'T'.$task->getID().
|
||||
'</td>'.
|
||||
'<td class="maniphest-task-owner">'.
|
||||
$handles[$task->getOwnerPHID()]->renderLink().
|
||||
'</td>'.
|
||||
'<td class="maniphest-task-name">'.
|
||||
phutil_render_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => '/T'.$task->getID(),
|
||||
),
|
||||
phutil_escape_html($task->getTitle())).
|
||||
'</td>'.
|
||||
'<td class="maniphest-task-priority">'.
|
||||
ManiphestTaskPriority::getTaskPriorityName($task->getPriority()).
|
||||
'</td>'.
|
||||
'<td class="maniphest-task-updated">'.
|
||||
phabricator_format_timestamp($task->getDateModified()).
|
||||
'</td>'.
|
||||
'</table>';
|
||||
}
|
||||
|
||||
}
|
17
src/applications/maniphest/view/tasksummary/__init__.php
Normal file
17
src/applications/maniphest/view/tasksummary/__init__.php
Normal file
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is automatically generated. Lint this module to rebuild it.
|
||||
* @generated
|
||||
*/
|
||||
|
||||
|
||||
|
||||
phutil_require_module('phabricator', 'applications/maniphest/constants/priority');
|
||||
phutil_require_module('phabricator', 'infrastructure/celerity/api');
|
||||
phutil_require_module('phabricator', 'view/base');
|
||||
phutil_require_module('phabricator', 'view/utils');
|
||||
|
||||
phutil_require_module('phutil', 'markup');
|
||||
|
||||
|
||||
phutil_require_source('ManiphestTaskSummaryView.php');
|
|
@ -0,0 +1,230 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
class ManiphestTransactionDetailView extends AphrontView {
|
||||
|
||||
private $transaction;
|
||||
private $handles;
|
||||
private $markupEngine;
|
||||
private $forEmail;
|
||||
|
||||
public function setTransaction(ManiphestTransaction $transaction) {
|
||||
$this->transaction = $transaction;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setHandles(array $handles) {
|
||||
$this->handles = $handles;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setMarkupEngine(PhutilMarkupEngine $engine) {
|
||||
$this->markupEngine = $engine;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function renderForEmail($with_date) {
|
||||
$this->forEmail = true;
|
||||
list ($verb, $desc, $classes) = $this->describeAction();
|
||||
|
||||
$transaction = $this->transaction;
|
||||
$author = $this->renderHandles(array($transaction->getAuthorPHID()));
|
||||
|
||||
$desc = $author.' '.$desc;
|
||||
if ($with_date) {
|
||||
$desc = 'On '.date('M jS \a\t g:i A', $transaction->getDateCreated()).
|
||||
', '.$desc;
|
||||
}
|
||||
|
||||
$comments = $transaction->getComments();
|
||||
if (strlen(trim($comments))) {
|
||||
$desc = $desc.":\n".$comments;
|
||||
} else {
|
||||
$desc = $desc.".";
|
||||
}
|
||||
|
||||
$this->forEmail = false;
|
||||
return array($verb, $desc);
|
||||
}
|
||||
|
||||
public function render() {
|
||||
$transaction = $this->transaction;
|
||||
$handles = $this->handles;
|
||||
|
||||
require_celerity_resource('maniphest-transaction-detail-css');
|
||||
|
||||
$author = $this->handles[$transaction->getAuthorPHID()];
|
||||
|
||||
$comments = $transaction->getCache();
|
||||
if (!strlen($comments)) {
|
||||
$comments = $transaction->getComments();
|
||||
if (strlen($comments)) {
|
||||
$comments = $this->markupEngine->markupText($comments);
|
||||
$transaction->setCache($comments);
|
||||
$transaction->save();
|
||||
}
|
||||
}
|
||||
|
||||
list($verb, $desc, $classes) = $this->describeAction(
|
||||
$transaction->getComments());
|
||||
|
||||
$more_classes = implode(' ', $classes);
|
||||
|
||||
if (strlen(trim($transaction->getComments()))) {
|
||||
$punc = ':';
|
||||
} else {
|
||||
$punc = '.';
|
||||
}
|
||||
|
||||
return phutil_render_tag(
|
||||
'div',
|
||||
array(
|
||||
'class' => "maniphest-transaction-detail-container",
|
||||
'style' => "background-image: url('".$author->getImageURI()."')",
|
||||
),
|
||||
'<div class="maniphest-transaction-detail-view '.$more_classes.'">'.
|
||||
'<div class="maniphest-transaction-header">'.
|
||||
'<div class="maniphest-transaction-timestamp">'.
|
||||
phabricator_format_timestamp($transaction->getDateCreated()).
|
||||
'</div>'.
|
||||
'<strong>'.
|
||||
$author->renderLink().
|
||||
' '.
|
||||
$desc.
|
||||
$punc.
|
||||
'</strong>'.
|
||||
'</div>'.
|
||||
'<div class="maniphest-transaction-comments">'.
|
||||
$comments.
|
||||
'</div>'.
|
||||
'</div>');
|
||||
}
|
||||
|
||||
private function describeAction() {
|
||||
$verb = null;
|
||||
$desc = null;
|
||||
$classes = array();
|
||||
|
||||
$handles = $this->handles;
|
||||
|
||||
$transaction = $this->transaction;
|
||||
$type = $transaction->getTransactionType();
|
||||
$author_phid = $transaction->getAuthorPHID();
|
||||
$new = $transaction->getNewValue();
|
||||
$old = $transaction->getOldValue();
|
||||
switch ($type) {
|
||||
case ManiphestTransactionType::TYPE_NONE:
|
||||
$verb = 'Commented On';
|
||||
$desc = 'added a comment';
|
||||
break;
|
||||
case ManiphestTransactionType::TYPE_OWNER:
|
||||
if ($transaction->getAuthorPHID() == $new) {
|
||||
$verb = 'Claimed';
|
||||
$desc = 'claimed this task';
|
||||
} else if (!$new) {
|
||||
$verb = 'Up For Grabs';
|
||||
$desc = 'placed this task up for grabs';
|
||||
} else if (!$old) {
|
||||
$verb = 'Assigned';
|
||||
$desc = 'assigned this task to '.$this->renderHandles(array($new));
|
||||
} else {
|
||||
$verb = 'Reassigned';
|
||||
$desc = 'reassigned this task from '.
|
||||
$this->renderHandles(array($old)).
|
||||
' to '.
|
||||
$this->renderHandles(array($new));
|
||||
}
|
||||
break;
|
||||
case ManiphestTransactionType::TYPE_CCS:
|
||||
$added = array_diff($new, $old);
|
||||
$removed = array_diff($old, $new);
|
||||
if ($added && !$removed) {
|
||||
$verb = 'Added CC';
|
||||
if (count($added) == 1) {
|
||||
$desc = 'added '.$this->renderHandles($added).' to CC';
|
||||
} else {
|
||||
$desc = 'added CCs: '.$this->renderHandles($added);
|
||||
}
|
||||
} else if ($removed && !$added) {
|
||||
$verb = 'Removed CC';
|
||||
if (count($removed) == 1) {
|
||||
$desc = 'removed '.$this->renderHandles($removed).' from CC';
|
||||
} else {
|
||||
$desc = 'removed CCs: '.$this->renderHandles($removed);
|
||||
}
|
||||
} else {
|
||||
$verb = 'Changed CC';
|
||||
$desc = 'changed CCs, added: '.$this->renderHandles($added).'; '.
|
||||
'removed: '.$this->renderHandles($removed);
|
||||
}
|
||||
break;
|
||||
case ManiphestTransactionType::TYPE_STATUS:
|
||||
if ($new == ManiphestTaskStatus::STATUS_OPEN) {
|
||||
if ($old) {
|
||||
$verb = 'Reopened';
|
||||
$desc = 'reopened this task';
|
||||
} else {
|
||||
$verb = 'Created';
|
||||
$desc = 'created this task';
|
||||
}
|
||||
} else if ($new == ManiphestTaskStatus::STATUS_CLOSED_SPITE) {
|
||||
$verb = 'Spited';
|
||||
$desc = 'closed this task out of spite';
|
||||
} else {
|
||||
$verb = 'Closed';
|
||||
$full = idx(ManiphestTaskStatus::getTaskStatusMap(), $new, '???');
|
||||
$desc = 'closed this task as "'.$full.'"';
|
||||
}
|
||||
break;
|
||||
case ManiphestTransactionType::TYPE_PRIORITY:
|
||||
$old_name = ManiphestTaskPriority::getTaskPriorityName($old);
|
||||
$new_name = ManiphestTaskPriority::getTaskPriorityName($new);
|
||||
|
||||
if ($old == ManiphestTaskPriority::PRIORITY_TRIAGE) {
|
||||
$verb = 'Triaged';
|
||||
$desc = 'triaged this task as "'.$new_name.'" priority';
|
||||
} else if ($old > $new) {
|
||||
$verb = 'Lowered Priority';
|
||||
$desc = 'lowered the priority of this task from "'.$old_name.'" to '.
|
||||
'"'.$new_name.'"';
|
||||
} else {
|
||||
$verb = 'Raised Priority';
|
||||
$desc = 'raised the priority of this task from "'.$old_name.'" to '.
|
||||
'"'.$new_name.'"';
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return ' brazenly '.$type."'d";
|
||||
}
|
||||
|
||||
return array($verb, $desc, $classes);
|
||||
}
|
||||
|
||||
private function renderHandles($phids) {
|
||||
$links = array();
|
||||
foreach ($phids as $phid) {
|
||||
if ($this->forEmail) {
|
||||
$links[] = $this->handles[$phid]->getName();
|
||||
} else {
|
||||
$links[] = $this->handles[$phid]->renderLink();
|
||||
}
|
||||
}
|
||||
return implode(', ', $links);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is automatically generated. Lint this module to rebuild it.
|
||||
* @generated
|
||||
*/
|
||||
|
||||
|
||||
|
||||
phutil_require_module('phabricator', 'applications/maniphest/constants/priority');
|
||||
phutil_require_module('phabricator', 'applications/maniphest/constants/status');
|
||||
phutil_require_module('phabricator', 'applications/maniphest/constants/transactiontype');
|
||||
phutil_require_module('phabricator', 'infrastructure/celerity/api');
|
||||
phutil_require_module('phabricator', 'view/base');
|
||||
phutil_require_module('phabricator', 'view/utils');
|
||||
|
||||
phutil_require_module('phutil', 'markup');
|
||||
phutil_require_module('phutil', 'utils');
|
||||
|
||||
|
||||
phutil_require_source('ManiphestTransactionDetailView.php');
|
|
@ -0,0 +1,63 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* Copyright 2011 Facebook, Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
class ManiphestTransactionListView extends AphrontView {
|
||||
|
||||
private $transactions;
|
||||
private $handles;
|
||||
private $user;
|
||||
private $markupEngine;
|
||||
|
||||
public function setTransactions(array $transactions) {
|
||||
$this->transactions = $transactions;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setHandles(array $handles) {
|
||||
$this->handles = $handles;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setUser(PhabricatorUser $user) {
|
||||
$this->user = $user;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setMarkupEngine(PhutilMarkupEngine $engine) {
|
||||
$this->markupEngine = $engine;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function render() {
|
||||
|
||||
$views = array();
|
||||
foreach ($this->transactions as $transaction) {
|
||||
$view = new ManiphestTransactionDetailView($transaction);
|
||||
$view->setTransaction($transaction);
|
||||
$view->setHandles($this->handles);
|
||||
$view->setMarkupEngine($this->markupEngine);
|
||||
$views[] = $view->render();
|
||||
}
|
||||
|
||||
return
|
||||
'<div style="padding: .5em 1.5em;">'.
|
||||
implode("\n", $views).
|
||||
'</div>';
|
||||
}
|
||||
|
||||
}
|
13
src/applications/maniphest/view/transactionlist/__init__.php
Normal file
13
src/applications/maniphest/view/transactionlist/__init__.php
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?php
|
||||
/**
|
||||
* This file is automatically generated. Lint this module to rebuild it.
|
||||
* @generated
|
||||
*/
|
||||
|
||||
|
||||
|
||||
phutil_require_module('phabricator', 'applications/maniphest/view/transactiondetail');
|
||||
phutil_require_module('phabricator', 'view/base');
|
||||
|
||||
|
||||
phutil_require_source('ManiphestTransactionListView.php');
|
|
@ -20,6 +20,7 @@ class AphrontFormTokenizerControl extends AphrontFormControl {
|
|||
|
||||
private $datasource;
|
||||
private $disableBehavior;
|
||||
private $limit;
|
||||
|
||||
public function setDatasource($datasource) {
|
||||
$this->datasource = $datasource;
|
||||
|
@ -35,6 +36,11 @@ class AphrontFormTokenizerControl extends AphrontFormControl {
|
|||
return 'aphront-form-control-tokenizer';
|
||||
}
|
||||
|
||||
public function setLimit($limit) {
|
||||
$this->limit = $limit;
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function renderInput() {
|
||||
require_celerity_resource('aphront-tokenizer-control-css');
|
||||
require_celerity_resource('javelin-typeahead-dev');
|
||||
|
@ -70,6 +76,7 @@ class AphrontFormTokenizerControl extends AphrontFormControl {
|
|||
'id' => $id,
|
||||
'src' => $this->datasource,
|
||||
'value' => $values,
|
||||
'limit' => $this->limit,
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -88,7 +95,6 @@ class AphrontFormTokenizerControl extends AphrontFormControl {
|
|||
array(
|
||||
'type' => 'text',
|
||||
'name' => $this->getName(),
|
||||
'value' => $this->getValue(),
|
||||
'disabled' => $this->getDisabled() ? 'disabled' : null,
|
||||
));
|
||||
}
|
||||
|
|
|
@ -202,7 +202,6 @@ class PhabricatorStandardPageView extends AphrontPageView {
|
|||
}
|
||||
$foot_links = implode(' · ', $foot_links);
|
||||
|
||||
|
||||
return
|
||||
($console ? '<darkconsole />' : null).
|
||||
'<div class="phabricator-standard-page">'.
|
||||
|
|
44
webroot/rsrc/css/application/maniphest/task-detail.css
Normal file
44
webroot/rsrc/css/application/maniphest/task-detail.css
Normal file
|
@ -0,0 +1,44 @@
|
|||
/**
|
||||
* @provides mainphest-task-detail-css
|
||||
*/
|
||||
|
||||
.maniphest-panel {
|
||||
margin: .5em 2em .25em;
|
||||
border: 1px solid #666622;
|
||||
background: #efefdf;
|
||||
padding: 15px 20px;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
.maniphest-panel h1 {
|
||||
border-bottom: 1px solid #aaaa99;
|
||||
padding-bottom: 8px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
|
||||
.maniphest-task-properties {
|
||||
font-size: 12px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.maniphest-task-properties tt {
|
||||
letter-spacing: 1.1px;
|
||||
}
|
||||
|
||||
.maniphest-task-properties th {
|
||||
font-weight: bold;
|
||||
width: 100px;
|
||||
text-align: right;
|
||||
padding: 3px 4px 3px 3px;
|
||||
color: #333333;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.maniphest-task-properties td {
|
||||
padding: 3px 2px;
|
||||
}
|
||||
|
||||
.maniphest-task-detail-core {
|
||||
margin-right: 265px;
|
||||
}
|
43
webroot/rsrc/css/application/maniphest/task-summary.css
Normal file
43
webroot/rsrc/css/application/maniphest/task-summary.css
Normal file
|
@ -0,0 +1,43 @@
|
|||
/**
|
||||
* @provides maniphest-task-summary-css
|
||||
*/
|
||||
|
||||
.maniphest-task-summary {
|
||||
border: 1px solid #aaaaaa;
|
||||
width: 100%;
|
||||
margin: 2px 0;
|
||||
border-collapse: separate;
|
||||
border-spacing: 1px;
|
||||
}
|
||||
|
||||
.maniphest-task-summary td {
|
||||
padding: 4px 1%;
|
||||
background: #dfdfdf;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.maniphest-task-summary td.maniphest-task-number {
|
||||
font-weight: bold;
|
||||
color: #444444;
|
||||
width: 8%;
|
||||
}
|
||||
|
||||
.maniphest-task-summary td.maniphest-task-owner {
|
||||
width: 11%;
|
||||
}
|
||||
|
||||
.maniphest-task-summary td.maniphest-task-name {
|
||||
overflow: hidden;
|
||||
font-weight: bold;
|
||||
width: 49%;
|
||||
}
|
||||
|
||||
.maniphest-task-summary td.maniphest-task-priority {
|
||||
text-align: center;
|
||||
width: 11%;
|
||||
}
|
||||
|
||||
.maniphest-task-summary td.maniphest-task-updated {
|
||||
text-align: center;
|
||||
width: 11%;
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
/**
|
||||
* @provides maniphest-transaction-detail-css
|
||||
*/
|
||||
|
||||
.maniphest-transaction-detail-container {
|
||||
margin: 2px 1em 3px;
|
||||
background: 0px 0px no-repeat;
|
||||
min-height: 50px;
|
||||
}
|
||||
|
||||
.maniphest-transaction-detail-view {
|
||||
margin-left: 54px;
|
||||
padding: 4px 1em;
|
||||
border: 1px solid #dddddd;
|
||||
background: #f6f6f6;
|
||||
min-height: 40px;
|
||||
}
|
||||
|
||||
.maniphest-transaction-timestamp {
|
||||
float: right;
|
||||
font-size: 11px;
|
||||
color: #666666;
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
/**
|
||||
* @provides javelin-behavior-maniphest-transaction-controls
|
||||
* @requires javelin-lib-dev
|
||||
*/
|
||||
|
||||
JX.behavior('maniphest-transaction-controls', function(config) {
|
||||
|
||||
var tokenizers = {};
|
||||
|
||||
for (var k in config.tokenizers) {
|
||||
var tconfig = config.tokenizers[k];
|
||||
var root = JX.$(tconfig.id);
|
||||
var datasource = new JX.TypeaheadPreloadedSource(tconfig.src);
|
||||
|
||||
var typeahead = new JX.Typeahead(root);
|
||||
typeahead.setDatasource(datasource);
|
||||
|
||||
var tokenizer = new JX.Tokenizer(root);
|
||||
tokenizer.setTypeahead(typeahead);
|
||||
|
||||
if (tconfig.limit) {
|
||||
tokenizer.setLimit(tconfig.limit);
|
||||
}
|
||||
|
||||
tokenizer.start();
|
||||
|
||||
|
||||
if (tconfig.value) {
|
||||
for (var jj in tconfig.value) {
|
||||
tokenizer.addToken(jj, tconfig.value[jj]);
|
||||
}
|
||||
}
|
||||
|
||||
tokenizers[k] = tokenizer;
|
||||
}
|
||||
|
||||
JX.DOM.listen(
|
||||
JX.$(config.select),
|
||||
'change',
|
||||
null,
|
||||
function(e) {
|
||||
for (var k in config.controlMap) {
|
||||
if (k == JX.$(config.select).value) {
|
||||
JX.DOM.show(JX.$(config.controlMap[k]));
|
||||
if (tokenizers[k]) {
|
||||
tokenizers[k].refresh();
|
||||
}
|
||||
} else {
|
||||
JX.DOM.hide(JX.$(config.controlMap[k]));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
|
||||
var root = JX.$(config.tokenizer);
|
||||
var datasource = new JX.TypeaheadPreloadedSource(config.src);
|
||||
|
||||
var typeahead = new JX.Typeahead(root);
|
||||
typeahead.setDatasource(datasource);
|
||||
|
||||
var tokenizer = new JX.Tokenizer(root);
|
||||
tokenizer.setTypeahead(typeahead);
|
||||
tokenizer.start();
|
||||
|
||||
JX.DOM.listen(
|
||||
JX.$(config.select),
|
||||
'change',
|
||||
null,
|
||||
function(e) {
|
||||
if (JX.$(config.select).value == 'add_reviewers') {
|
||||
JX.DOM.show(JX.$(config.row));
|
||||
tokenizer.refresh();
|
||||
} else {
|
||||
JX.DOM.hide(JX.$(config.row));
|
||||
}
|
||||
});
|
||||
|
||||
*/
|
||||
});
|
||||
|
Loading…
Reference in a new issue