Page MenuHomePhabricator

D15278.diff
No OneTemporary

D15278.diff

diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -2872,6 +2872,7 @@
'PhabricatorProjectBoardController' => 'applications/project/controller/PhabricatorProjectBoardController.php',
'PhabricatorProjectBoardDisableController' => 'applications/project/controller/PhabricatorProjectBoardDisableController.php',
'PhabricatorProjectBoardImportController' => 'applications/project/controller/PhabricatorProjectBoardImportController.php',
+ 'PhabricatorProjectBoardManageController' => 'applications/project/controller/PhabricatorProjectBoardManageController.php',
'PhabricatorProjectBoardReorderController' => 'applications/project/controller/PhabricatorProjectBoardReorderController.php',
'PhabricatorProjectBoardViewController' => 'applications/project/controller/PhabricatorProjectBoardViewController.php',
'PhabricatorProjectCardView' => 'applications/project/view/PhabricatorProjectCardView.php',
@@ -7300,6 +7301,7 @@
'PhabricatorProjectBoardController' => 'PhabricatorProjectController',
'PhabricatorProjectBoardDisableController' => 'PhabricatorProjectBoardController',
'PhabricatorProjectBoardImportController' => 'PhabricatorProjectBoardController',
+ 'PhabricatorProjectBoardManageController' => 'PhabricatorProjectBoardController',
'PhabricatorProjectBoardReorderController' => 'PhabricatorProjectBoardController',
'PhabricatorProjectBoardViewController' => 'PhabricatorProjectBoardController',
'PhabricatorProjectCardView' => 'AphrontTagView',
diff --git a/src/applications/project/application/PhabricatorProjectApplication.php b/src/applications/project/application/PhabricatorProjectApplication.php
--- a/src/applications/project/application/PhabricatorProjectApplication.php
+++ b/src/applications/project/application/PhabricatorProjectApplication.php
@@ -84,6 +84,8 @@
=> 'PhabricatorProjectBoardReorderController',
'disable/'
=> 'PhabricatorProjectBoardDisableController',
+ 'manage/'
+ => 'PhabricatorProjectBoardManageController',
),
'update/(?P<id>[1-9]\d*)/(?P<action>[^/]+)/'
=> 'PhabricatorProjectUpdateController',
diff --git a/src/applications/project/controller/PhabricatorProjectBoardManageController.php b/src/applications/project/controller/PhabricatorProjectBoardManageController.php
new file mode 100644
--- /dev/null
+++ b/src/applications/project/controller/PhabricatorProjectBoardManageController.php
@@ -0,0 +1,155 @@
+<?php
+
+final class PhabricatorProjectBoardManageController
+ extends PhabricatorProjectBoardController {
+
+ public function handleRequest(AphrontRequest $request) {
+ $viewer = $request->getViewer();
+ $board_id = $request->getURIData('projectID');
+
+ $board = id(new PhabricatorProjectQuery())
+ ->setViewer($viewer)
+ ->withIDs(array($board_id))
+ ->needImages(true)
+ ->executeOne();
+ if (!$board) {
+ return new Aphront404Response();
+ }
+ $this->setProject($board);
+
+ // Perform layout of no tasks to load and populate the columns in the
+ // correct order.
+ $layout_engine = id(new PhabricatorBoardLayoutEngine())
+ ->setViewer($viewer)
+ ->setBoardPHIDs(array($board->getPHID()))
+ ->setObjectPHIDs(array())
+ ->setFetchAllBoards(true)
+ ->executeLayout();
+
+ $columns = $layout_engine->getColumns($board->getPHID());
+
+ $board_id = $board->getID();
+
+ $header = $this->buildHeaderView($board);
+ $actions = $this->buildActionView($board);
+ $properties = $this->buildPropertyView($board);
+
+ $properties->setActionList($actions);
+
+ $crumbs = $this->buildApplicationCrumbs();
+ $crumbs->addTextCrumb(pht('Workboard'), "/project/board/{$board_id}/");
+ $crumbs->addTextCrumb(pht('Manage'));
+
+ $box = id(new PHUIObjectBoxView())
+ ->setHeader($header)
+ ->addPropertyList($properties);
+
+ $nav = $this->getProfileMenu();
+
+ $title = array(
+ pht('Manage Workboard'),
+ $board->getDisplayName(),
+ );
+
+ $columns_list = $this->buildColumnsList($board, $columns);
+
+ return $this->newPage()
+ ->setTitle($title)
+ ->setNavigation($nav)
+ ->setCrumbs($crumbs)
+ ->appendChild(
+ array(
+ $box,
+ $columns_list,
+ ));
+ }
+
+ private function buildHeaderView(PhabricatorProject $board) {
+ $viewer = $this->getRequest()->getUser();
+
+ $header = id(new PHUIHeaderView())
+ ->setUser($viewer)
+ ->setHeader(pht('Workboard: %s', $board->getDisplayName()));
+
+ return $header;
+ }
+
+ private function buildActionView(PhabricatorProject $board) {
+ $viewer = $this->getRequest()->getUser();
+ $id = $board->getID();
+
+ $actions = id(new PhabricatorActionListView())
+ ->setUser($viewer);
+
+ $can_edit = PhabricatorPolicyFilter::hasCapability(
+ $viewer,
+ $board,
+ PhabricatorPolicyCapability::CAN_EDIT);
+
+ $reorder_uri = $this->getApplicationURI("board/{$id}/reorder/");
+
+ $actions->addAction(
+ id(new PhabricatorActionView())
+ ->setIcon('fa-exchange')
+ ->setName(pht('Reorder Columns'))
+ ->setHref($reorder_uri)
+ ->setDisabled(!$can_edit)
+ ->setWorkflow(true));
+
+ $disable_uri = $this->getApplicationURI("board/{$id}/disable/");
+
+ $actions->addAction(
+ id(new PhabricatorActionView())
+ ->setIcon('fa-ban')
+ ->setName(pht('Disable Board'))
+ ->setHref($disable_uri)
+ ->setDisabled(!$can_edit)
+ ->setWorkflow(true));
+
+ return $actions;
+ }
+
+ private function buildPropertyView(
+ PhabricatorProject $board) {
+ $viewer = $this->getRequest()->getUser();
+
+ $properties = id(new PHUIPropertyListView())
+ ->setUser($viewer)
+ ->setObject($board);
+
+ return $properties;
+ }
+
+ private function buildColumnsList(
+ PhabricatorProject $board,
+ array $columns) {
+ assert_instances_of($columns, 'PhabricatorProjectColumn');
+
+ $board_id = $board->getID();
+
+ $view = id(new PHUIObjectItemListView())
+ ->setNoDataString(pht('This board has no columns.'));
+
+ foreach ($columns as $column) {
+ $column_id = $column->getID();
+
+ $detail_uri = "/project/board/{$board_id}/column/{$column_id}/";
+
+ $item = id(new PHUIObjectItemView())
+ ->setHeader($column->getDisplayName())
+ ->setHref($detail_uri);
+
+ if ($column->isHidden()) {
+ $item->setDisabled(true);
+ }
+
+ $view->addItem($item);
+ }
+
+ return id(new PHUIObjectBoxView())
+ ->setHeaderText(pht('Columns'))
+ ->setObjectList($view);
+ }
+
+
+}
diff --git a/src/applications/project/controller/PhabricatorProjectBoardReorderController.php b/src/applications/project/controller/PhabricatorProjectBoardReorderController.php
--- a/src/applications/project/controller/PhabricatorProjectBoardReorderController.php
+++ b/src/applications/project/controller/PhabricatorProjectBoardReorderController.php
@@ -23,13 +23,13 @@
$this->setProject($project);
$project_id = $project->getID();
- $board_uri = $this->getApplicationURI("board/{$project_id}/");
+ $manage_uri = $this->getApplicationURI("board/{$project_id}/manage/");
$reorder_uri = $this->getApplicationURI("board/{$project_id}/reorder/");
if ($request->isFormPost()) {
// User clicked "Done", make sure the page reloads to show the new
// column order.
- return id(new AphrontRedirectResponse())->setURI($board_uri);
+ return id(new AphrontRedirectResponse())->setURI($manage_uri);
}
$columns = id(new PhabricatorProjectColumnQuery())
diff --git a/src/applications/project/controller/PhabricatorProjectBoardViewController.php b/src/applications/project/controller/PhabricatorProjectBoardViewController.php
--- a/src/applications/project/controller/PhabricatorProjectBoardViewController.php
+++ b/src/applications/project/controller/PhabricatorProjectBoardViewController.php
@@ -680,9 +680,8 @@
$id = $project->getID();
- $disable_uri = $this->getApplicationURI("board/{$id}/disable/");
+ $manage_uri = $this->getApplicationURI("board/{$id}/manage/");
$add_uri = $this->getApplicationURI("board/{$id}/edit/");
- $reorder_uri = $this->getApplicationURI("board/{$id}/reorder/");
$can_edit = PhabricatorPolicyFilter::hasCapability(
$viewer,
@@ -699,11 +698,9 @@
->setWorkflow(true);
$manage_items[] = id(new PhabricatorActionView())
- ->setIcon('fa-exchange')
- ->setName(pht('Reorder Columns'))
- ->setHref($reorder_uri)
- ->setDisabled(!$can_edit)
- ->setWorkflow(true);
+ ->setIcon('fa-pencil')
+ ->setName(pht('Manage Board'))
+ ->setHref($manage_uri);
if ($show_hidden) {
$hidden_uri = $this->getURIWithState()
@@ -735,13 +732,6 @@
->setHref($batch_edit_uri)
->setDisabled(!$can_batch_edit);
- $manage_items[] = id(new PhabricatorActionView())
- ->setIcon('fa-ban')
- ->setName(pht('Disable Workboard'))
- ->setHref($disable_uri)
- ->setWorkflow(true)
- ->setDisabled(!$can_edit);
-
$manage_menu = id(new PhabricatorActionListView())
->setUser($viewer);
foreach ($manage_items as $item) {
@@ -826,14 +816,6 @@
->setHref($batch_edit_uri)
->setDisabled(!$can_batch_edit);
- $detail_uri = $this->getApplicationURI(
- 'board/'.$this->id.'/column/'.$column->getID().'/');
-
- $column_items[] = id(new PhabricatorActionView())
- ->setIcon('fa-columns')
- ->setName(pht('Column Details'))
- ->setHref($detail_uri);
-
$can_hide = ($can_edit && !$column->isDefaultColumn());
$hide_uri = 'board/'.$this->id.'/hide/'.$column->getID().'/';
$hide_uri = $this->getApplicationURI($hide_uri);

File Metadata

Mime Type
text/plain
Expires
Sat, Nov 9, 2:52 PM (1 w, 2 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6724881
Default Alt Text
D15278.diff (9 KB)

Event Timeline