Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15515989
D13160.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
5 KB
Referenced Files
None
Subscribers
None
D13160.id.diff
View Options
diff --git a/src/applications/nuance/controller/NuanceQueueEditController.php b/src/applications/nuance/controller/NuanceQueueEditController.php
--- a/src/applications/nuance/controller/NuanceQueueEditController.php
+++ b/src/applications/nuance/controller/NuanceQueueEditController.php
@@ -2,43 +2,36 @@
final class NuanceQueueEditController extends NuanceController {
- private $queueID;
+ public function handleRequest(AphrontRequest $request) {
+ $viewer = $this->getViewer();
- public function setQueueID($queue_id) {
- $this->queueID = $queue_id;
- return $this;
- }
- public function getQueueID() {
- return $this->queueID;
- }
-
- public function willProcessRequest(array $data) {
- $this->setQueueID(idx($data, 'id'));
- }
-
- public function processRequest() {
- $request = $this->getRequest();
- $user = $request->getUser();
-
- $queue_id = $this->getQueueID();
+ $queue_id = $request->getURIData('id');
$is_new = !$queue_id;
-
if ($is_new) {
- $queue = new NuanceQueue();
-
+ $queue = NuanceQueue::initializeNewQueue();
} else {
$queue = id(new NuanceQueueQuery())
- ->setViewer($user)
+ ->setViewer($viewer)
->withIDs(array($queue_id))
->executeOne();
- }
-
- if (!$queue) {
- return new Aphront404Response();
+ if (!$queue) {
+ return new Aphront404Response();
+ }
}
$crumbs = $this->buildApplicationCrumbs();
- $title = 'TODO';
+ $crumbs->addTextCrumb(
+ pht('Queues'),
+ $this->getApplicationURI('queue/'));
+
+ if ($is_new) {
+ $title = pht('Create Queue');
+ $crumbs->addTextCrumb(pht('Create'));
+ } else {
+ $title = pht('Edit %s', $queue->getName());
+ $crumbs->addTextCrumb($queue->getName(), $queue->getURI());
+ $crumbs->addTextCrumb(pht('Edit'));
+ }
return $this->buildApplicationPage(
$crumbs,
diff --git a/src/applications/nuance/query/NuanceQueueQuery.php b/src/applications/nuance/query/NuanceQueueQuery.php
--- a/src/applications/nuance/query/NuanceQueueQuery.php
+++ b/src/applications/nuance/query/NuanceQueueQuery.php
@@ -18,39 +18,38 @@
protected function loadPage() {
$table = new NuanceQueue();
- $conn_r = $table->establishConnection('r');
+ $conn = $table->establishConnection('r');
$data = queryfx_all(
- $conn_r,
- 'SELECT FROM %T %Q %Q %Q',
+ $conn,
+ '%Q FROM %T %Q %Q %Q',
+ $this->buildSelectClause($conn),
$table->getTableName(),
- $this->buildWhereClause($conn_r),
- $this->buildOrderClause($conn_r),
- $this->buildLimitClause($conn_r));
+ $this->buildWhereClause($conn),
+ $this->buildOrderClause($conn),
+ $this->buildLimitClause($conn));
return $table->loadAllFromArray($data);
}
- protected function buildWhereClause(AphrontDatabaseConnection $conn_r) {
- $where = array();
+ protected function buildWhereClauseParts(AphrontDatabaseConnection $conn) {
+ $where = parent::buildWhereClauseParts($conn);
- $where[] = $this->buildPagingClause($conn_r);
-
- if ($this->ids) {
+ if ($this->ids !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'id IN (%Ld)',
$this->ids);
}
- if ($this->phids) {
+ if ($this->phids !== null) {
$where[] = qsprintf(
- $conn_r,
+ $conn,
'phid IN (%Ls)',
$this->phids);
}
- return $this->formatWhereClause($where);
+ return $where;
}
}
diff --git a/src/applications/nuance/storage/NuanceQueue.php b/src/applications/nuance/storage/NuanceQueue.php
--- a/src/applications/nuance/storage/NuanceQueue.php
+++ b/src/applications/nuance/storage/NuanceQueue.php
@@ -2,7 +2,9 @@
final class NuanceQueue
extends NuanceDAO
- implements PhabricatorPolicyInterface {
+ implements
+ PhabricatorPolicyInterface,
+ PhabricatorApplicationTransactionInterface {
protected $name;
protected $mailKey;
@@ -24,6 +26,10 @@
NuanceQueuePHIDType::TYPECONST);
}
+ public static function initializeNewQueue() {
+ return new NuanceQueue();
+ }
+
public function save() {
if (!$this->getMailKey()) {
$this->setMailKey(Filesystem::readRandomCharacters(20));
@@ -35,6 +41,10 @@
return '/nuance/queue/view/'.$this->getID().'/';
}
+
+/* -( PhabricatorPolicyInterface )----------------------------------------- */
+
+
public function getCapabilities() {
return array(
PhabricatorPolicyCapability::CAN_VIEW,
@@ -59,4 +69,26 @@
return null;
}
+
+/* -( PhabricatorApplicationTransactionInterface )------------------------- */
+
+
+ public function getApplicationTransactionEditor() {
+ return new NuanceQueueEditor();
+ }
+
+ public function getApplicationTransactionObject() {
+ return $this;
+ }
+
+ public function getApplicationTransactionTemplate() {
+ return new NuanceQueueTransaction();
+ }
+
+ public function willRenderTimeline(
+ PhabricatorApplicationTransactionView $timeline,
+ AphrontRequest $request) {
+ return $timeline;
+ }
+
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Apr 19, 3:09 PM (5 d, 17 h ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7382363
Default Alt Text
D13160.id.diff (5 KB)
Attached To
Mode
D13160: Slightly modernize NuanceQueue
Attached
Detach File
Event Timeline
Log In to Comment