Files
phabricator/src/applications/nuance/controller/NuanceQueueViewController.php
epriestley cbf9008d15 Rough in a Nuance "work" controller
Summary:
Ref T12738. This is mostly just laying in groundwork and prerequisites, like the ability to query items by queue.

Eventually, this will become the main UI which staff use to process a queue of items. For now, it does nothing and renders nonsense.

This and probably the next big chunk of changes are all going to be made-up, nonfinal things that just make basic operations work until we have fundamental flows -- like "assign", "comment", "close" -- working at a basic level and can think more about UI/workflow.

Test Plan:
Visited the page, it loaded a mostly-reasonable item and then rendered nonsense:

{F4975050}

Reviewers: chad

Reviewed By: chad

Maniphest Tasks: T12738

Differential Revision: https://secure.phabricator.com/D18008
2017-05-24 11:03:56 -07:00

85 lines
2.2 KiB
PHP

<?php
final class NuanceQueueViewController
extends NuanceQueueController {
public function handleRequest(AphrontRequest $request) {
$viewer = $this->getViewer();
$queue = id(new NuanceQueueQuery())
->setViewer($viewer)
->withIDs(array($request->getURIData('id')))
->executeOne();
if (!$queue) {
return new Aphront404Response();
}
$title = $queue->getName();
$crumbs = $this->buildApplicationCrumbs();
$crumbs->addTextCrumb(pht('Queues'), $this->getApplicationURI('queue/'));
$crumbs->addTextCrumb($queue->getName());
$crumbs->setBorder(true);
$header = $this->buildHeaderView($queue);
$curtain = $this->buildCurtain($queue);
$timeline = $this->buildTransactionTimeline(
$queue,
new NuanceQueueTransactionQuery());
$timeline->setShouldTerminate(true);
$view = id(new PHUITwoColumnView())
->setHeader($header)
->setCurtain($curtain)
->setMainColumn($timeline);
return $this->newPage()
->setTitle($title)
->setCrumbs($crumbs)
->appendChild($view);
}
private function buildHeaderView(NuanceQueue $queue) {
$viewer = $this->getViewer();
$header = id(new PHUIHeaderView())
->setUser($viewer)
->setHeader($queue->getName())
->setPolicyObject($queue);
return $header;
}
private function buildCurtain(NuanceQueue $queue) {
$viewer = $this->getViewer();
$id = $queue->getID();
$can_edit = PhabricatorPolicyFilter::hasCapability(
$viewer,
$queue,
PhabricatorPolicyCapability::CAN_EDIT);
$curtain = $this->newCurtainView($queue);
$curtain->addAction(
id(new PhabricatorActionView())
->setName(pht('Edit Queue'))
->setIcon('fa-pencil')
->setHref($this->getApplicationURI("queue/edit/{$id}/"))
->setDisabled(!$can_edit)
->setWorkflow(!$can_edit));
$curtain->addAction(
id(new PhabricatorActionView())
->setName(pht('Begin Work'))
->setIcon('fa-play-circle-o')
->setHref($this->getApplicationURI("queue/work/{$id}/"))
->setDisabled(!$can_edit)
->setWorkflow(!$can_edit));
return $curtain;
}
}