Page MenuHomestyx hydra

No OneTemporary

diff --git a/src/applications/feed/story/base/PhabricatorFeedStory.php b/src/applications/feed/story/base/PhabricatorFeedStory.php
index a6828d16c5..7cdb665dee 100644
--- a/src/applications/feed/story/base/PhabricatorFeedStory.php
+++ b/src/applications/feed/story/base/PhabricatorFeedStory.php
@@ -1,66 +1,80 @@
<?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 PhabricatorFeedStory {
private $data;
private $handles;
private $objects;
final public function __construct(PhabricatorFeedStoryData $data) {
$this->data = $data;
}
abstract public function renderView();
public function getRequiredHandlePHIDs() {
return array();
}
public function getRequiredObjectPHIDs() {
return array();
}
final public function setHandles(array $handles) {
$this->handles = $handles;
return $this;
}
final public function setObjects(array $objects) {
$this->objects = $objects;
return $this;
}
final protected function getHandles() {
return $this->handles;
}
+ final protected function getHandle($phid) {
+ if (isset($this->handles[$phid])) {
+ if ($this->handles[$phid] instanceof PhabricatorObjectHandle) {
+ return $this->handles[$phid];
+ }
+ }
+
+ $handle = new PhabricatorObjectHandle();
+ $handle->setPHID($phid);
+ $handle->setName("Unloaded Object '{$phid}'");
+
+ return $handle;
+ }
+
final protected function getObjects() {
return $this->objects;
}
final protected function getStoryData() {
return $this->data;
}
final public function getEpoch() {
return $this->getStoryData()->getEpoch();
}
}
diff --git a/src/applications/feed/story/maniphest/PhabricatorFeedStoryManiphest.php b/src/applications/feed/story/maniphest/PhabricatorFeedStoryManiphest.php
index a5a45a52e4..91265a9d9c 100644
--- a/src/applications/feed/story/maniphest/PhabricatorFeedStoryManiphest.php
+++ b/src/applications/feed/story/maniphest/PhabricatorFeedStoryManiphest.php
@@ -1,94 +1,103 @@
<?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 PhabricatorFeedStoryManiphest extends PhabricatorFeedStory {
public function getRequiredHandlePHIDs() {
$data = $this->getStoryData();
- return array(
- $this->getStoryData()->getAuthorPHID(),
- $data->getValue('taskPHID'),
- $data->getValue('ownerPHID'),
- );
+ return array_filter(
+ array(
+ $this->getStoryData()->getAuthorPHID(),
+ $data->getValue('taskPHID'),
+ $data->getValue('ownerPHID'),
+ ));
}
public function getRequiredObjectPHIDs() {
return array(
$this->getStoryData()->getAuthorPHID(),
);
}
public function renderView() {
$data = $this->getStoryData();
- $handles = $this->getHandles();
$author_phid = $data->getAuthorPHID();
$owner_phid = $data->getValue('ownerPHID');
$task_phid = $data->getValue('taskPHID');
$objects = $this->getObjects();
$action = $data->getValue('action');
$view = new PhabricatorFeedStoryView();
$verb = ManiphestAction::getActionPastTenseVerb($action);
- $title =
- '<strong>'.$handles[$author_phid]->renderLink().'</strong>'.
- " {$verb} task ".
- '<strong>'.$handles[$task_phid]->renderLink().'</strong>';
+ $extra = null;
switch ($action) {
case ManiphestAction::ACTION_ASSIGN:
- $title .=
- ' to '.
- '<strong>'.$handles[$owner_phid]->renderLink().'</strong>';
+ if ($owner_phid) {
+ $extra =
+ ' to '.
+ '<strong>'.$this->getHandle($owner_phid)->renderLink().'</strong>';
+ } else {
+ $verb = 'placed';
+ $extra = ' up for grabs';
+ }
break;
}
+
+ $title =
+ '<strong>'.$this->getHandle($author_phid)->renderLink().'</strong>'.
+ " {$verb} task ".
+ '<strong>'.$this->getHandle($task_phid)->renderLink().'</strong>';
+ $title .= $extra;
$title .= '.';
+
$view->setTitle($title);
switch ($action) {
case ManiphestAction::ACTION_CREATE:
$full_size = true;
break;
default:
$full_size = false;
break;
}
$view->setEpoch($data->getEpoch());
if ($full_size) {
if (!empty($objects[$author_phid])) {
$image_phid = $objects[$author_phid]->getProfileImagePHID();
$image_uri = PhabricatorFileURI::getViewURIForPHID($image_phid);
$view->setImage($image_uri);
}
$content = phutil_escape_html(
phutil_utf8_shorten($data->getValue('description'), 128));
$content = str_replace("\n", '<br />', $content);
$view->appendChild($content);
} else {
$view->setOneLineStory(true);
}
return $view;
}
}
diff --git a/src/applications/metamta/controller/base/PhabricatorMetaMTAController.php b/src/applications/metamta/controller/base/PhabricatorMetaMTAController.php
index 76d3214649..80d2f2e8f3 100644
--- a/src/applications/metamta/controller/base/PhabricatorMetaMTAController.php
+++ b/src/applications/metamta/controller/base/PhabricatorMetaMTAController.php
@@ -1,50 +1,54 @@
<?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 PhabricatorMetaMTAController extends PhabricatorController {
+ public function shouldRequireAdmin() {
+ return true;
+ }
+
public function buildStandardPageResponse($view, array $data) {
$page = $this->buildStandardPageView();
$page->setApplicationName('MetaMTA');
$page->setBaseURI('/mail/');
$page->setTitle(idx($data, 'title'));
$page->setTabs(
array(
'queue' => array(
'name' => 'Mail Queue',
'href' => '/mail/',
),
'lists' => array(
'name' => 'Mailing Lists',
'href' => '/mail/lists/',
),
'received' => array(
'name' => 'Received',
'href' => '/mail/received/',
),
),
idx($data, 'tab'));
$page->setGlyph("@");
$page->appendChild($view);
$response = new AphrontWebpageResponse();
return $response->setContent($page->render());
}
}
diff --git a/src/applications/metamta/controller/list/PhabricatorMetaMTAListController.php b/src/applications/metamta/controller/list/PhabricatorMetaMTAListController.php
index 14904c65b1..96701fa606 100644
--- a/src/applications/metamta/controller/list/PhabricatorMetaMTAListController.php
+++ b/src/applications/metamta/controller/list/PhabricatorMetaMTAListController.php
@@ -1,113 +1,115 @@
<?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 PhabricatorMetaMTAListController extends PhabricatorMetaMTAController {
public function processRequest() {
// Get a page of mails together with pager.
$request = $this->getRequest();
$user = $request->getUser();
$offset = $request->getInt('offset', 0);
$related_phid = $request->getStr('phid');
$pager = new AphrontPagerView();
$pager->setOffset($offset);
$pager->setURI($request->getRequestURI(), 'offset');
$mail = new PhabricatorMetaMTAMail();
$conn_r = $mail->establishConnection('r');
if ($related_phid) {
$where_clause = qsprintf(
$conn_r,
'WHERE relatedPHID = %s',
$related_phid);
} else {
$where_clause = 'WHERE 1 = 1';
}
$data = queryfx_all(
$conn_r,
'SELECT * FROM %T
%Q
ORDER BY id DESC
LIMIT %d, %d',
$mail->getTableName(),
$where_clause,
$pager->getOffset(), $pager->getPageSize() + 1);
$data = $pager->sliceResults($data);
$mails = $mail->loadAllFromArray($data);
// Render the details table.
$rows = array();
foreach ($mails as $mail) {
$rows[] = array(
PhabricatorMetaMTAMail::getReadableStatus($mail->getStatus()),
$mail->getRetryCount(),
($mail->getNextRetry() - time()).' s',
phabricator_datetime($mail->getDateCreated(), $user),
(time() - $mail->getDateModified()).' s',
phutil_escape_html($mail->getSubject()),
phutil_render_tag(
'a',
array(
'class' => 'button small grey',
'href' => '/mail/view/'.$mail->getID().'/',
),
'View'),
);
}
$table = new AphrontTableView($rows);
$table->setHeaders(
array(
'Status',
'Retry',
'Next',
'Created',
'Updated',
'Subject',
'',
));
$table->setColumnClasses(
array(
null,
null,
null,
null,
null,
'wide',
'action',
));
// Render the whole page.
$panel = new AphrontPanelView();
$panel->appendChild($table);
$panel->setHeader('MetaMTA Messages');
- $panel->setCreateButton('Send New Message', '/mail/send/');
+ if ($user->getIsAdmin()) {
+ $panel->setCreateButton('Send New Test Message', '/mail/send/');
+ }
$panel->appendChild($pager);
return $this->buildStandardPageResponse(
$panel,
array(
'title' => 'MetaMTA',
'tab' => 'queue',
));
}
}
diff --git a/src/applications/metamta/controller/view/PhabricatorMetaMTAViewController.php b/src/applications/metamta/controller/view/PhabricatorMetaMTAViewController.php
index 627cf6ae36..2aecc5d665 100644
--- a/src/applications/metamta/controller/view/PhabricatorMetaMTAViewController.php
+++ b/src/applications/metamta/controller/view/PhabricatorMetaMTAViewController.php
@@ -1,83 +1,79 @@
<?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 PhabricatorMetaMTAViewController extends PhabricatorMetaMTAController {
private $id;
public function willProcessRequest(array $data) {
$this->id = $data['id'];
}
public function processRequest() {
$request = $this->getRequest();
$user = $request->getUser();
$mail = id(new PhabricatorMetaMTAMail())->load($this->id);
if (!$mail) {
return new Aphront404Response();
}
$status = PhabricatorMetaMTAMail::getReadableStatus($mail->getStatus());
$form = new AphrontFormView();
$form->setUser($request->getUser());
$form->setAction('/mail/send/');
$form
->appendChild(
id(new AphrontFormStaticControl())
->setLabel('Subject')
->setValue($mail->getSubject()))
->appendChild(
id(new AphrontFormStaticControl())
->setLabel('Created')
->setValue(phabricator_datetime($mail->getDateCreated(), $user)))
->appendChild(
id(new AphrontFormStaticControl())
->setLabel('Status')
->setValue($status))
->appendChild(
id(new AphrontFormStaticControl())
->setLabel('Message')
->setValue($mail->getMessage()))
->appendChild(
id(new AphrontFormStaticControl())
->setLabel('Related PHID')
->setValue($mail->getRelatedPHID()))
- ->appendChild(
- id(new AphrontFormTextAreaControl())
- ->setLabel('Parameters')
- ->setValue(json_encode($mail->getParameters())))
->appendChild(
id(new AphrontFormSubmitControl())
->addCancelButton('/mail/', 'Done'));
$panel = new AphrontPanelView();
$panel->setHeader('View Email');
$panel->appendChild($form);
$panel->setWidth(AphrontPanelView::WIDTH_WIDE);
return $this->buildStandardPageResponse(
$panel,
array(
'title' => 'View Mail',
));
}
}
diff --git a/src/applications/metamta/controller/view/__init__.php b/src/applications/metamta/controller/view/__init__.php
index d08f948405..be2cda3818 100644
--- a/src/applications/metamta/controller/view/__init__.php
+++ b/src/applications/metamta/controller/view/__init__.php
@@ -1,22 +1,21 @@
<?php
/**
* This file is automatically generated. Lint this module to rebuild it.
* @generated
*/
phutil_require_module('phabricator', 'aphront/response/404');
phutil_require_module('phabricator', 'applications/metamta/controller/base');
phutil_require_module('phabricator', 'applications/metamta/storage/mail');
phutil_require_module('phabricator', 'view/form/base');
phutil_require_module('phabricator', 'view/form/control/static');
phutil_require_module('phabricator', 'view/form/control/submit');
-phutil_require_module('phabricator', 'view/form/control/textarea');
phutil_require_module('phabricator', 'view/layout/panel');
phutil_require_module('phabricator', 'view/utils');
phutil_require_module('phutil', 'utils');
phutil_require_source('PhabricatorMetaMTAViewController.php');

File Metadata

Mime Type
text/x-diff
Expires
Tue, Jun 10, 8:39 AM (21 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
140311
Default Alt Text
(15 KB)

Event Timeline