Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2893580
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
6 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/src/applications/nuance/controller/NuanceQueueEditController.php b/src/applications/nuance/controller/NuanceQueueEditController.php
index 02e73c912c..8c02672890 100644
--- a/src/applications/nuance/controller/NuanceQueueEditController.php
+++ b/src/applications/nuance/controller/NuanceQueueEditController.php
@@ -1,50 +1,43 @@
<?php
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,
array(
'title' => $title,
));
}
}
diff --git a/src/applications/nuance/query/NuanceQueueQuery.php b/src/applications/nuance/query/NuanceQueueQuery.php
index 822a60c620..d50e393667 100644
--- a/src/applications/nuance/query/NuanceQueueQuery.php
+++ b/src/applications/nuance/query/NuanceQueueQuery.php
@@ -1,56 +1,55 @@
<?php
final class NuanceQueueQuery
extends NuanceQuery {
private $ids;
private $phids;
public function withIDs(array $ids) {
$this->ids = $ids;
return $this;
}
public function withPHIDs(array $phids) {
$this->phids = $phids;
return $this;
}
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
index e9499e0f3d..093b437e24 100644
--- a/src/applications/nuance/storage/NuanceQueue.php
+++ b/src/applications/nuance/storage/NuanceQueue.php
@@ -1,62 +1,94 @@
<?php
final class NuanceQueue
extends NuanceDAO
- implements PhabricatorPolicyInterface {
+ implements
+ PhabricatorPolicyInterface,
+ PhabricatorApplicationTransactionInterface {
protected $name;
protected $mailKey;
protected $viewPolicy;
protected $editPolicy;
protected function getConfiguration() {
return array(
self::CONFIG_AUX_PHID => true,
self::CONFIG_COLUMN_SCHEMA => array(
'name' => 'text255?',
'mailKey' => 'bytes20',
),
) + parent::getConfiguration();
}
public function generatePHID() {
return PhabricatorPHID::generateNewPHID(
NuanceQueuePHIDType::TYPECONST);
}
+ public static function initializeNewQueue() {
+ return new NuanceQueue();
+ }
+
public function save() {
if (!$this->getMailKey()) {
$this->setMailKey(Filesystem::readRandomCharacters(20));
}
return parent::save();
}
public function getURI() {
return '/nuance/queue/view/'.$this->getID().'/';
}
+
+/* -( PhabricatorPolicyInterface )----------------------------------------- */
+
+
public function getCapabilities() {
return array(
PhabricatorPolicyCapability::CAN_VIEW,
PhabricatorPolicyCapability::CAN_EDIT,
);
}
public function getPolicy($capability) {
switch ($capability) {
case PhabricatorPolicyCapability::CAN_VIEW:
return $this->getViewPolicy();
case PhabricatorPolicyCapability::CAN_EDIT:
return $this->getEditPolicy();
}
}
public function hasAutomaticCapability($capability, PhabricatorUser $viewer) {
return false;
}
public function describeAutomaticCapability($capability) {
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/x-diff
Expires
Sun, Jan 19, 18:40 (1 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1127519
Default Alt Text
(6 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment