2011-03-11 18:34:22 +01:00
|
|
|
<?php
|
|
|
|
|
2012-03-10 00:46:25 +01:00
|
|
|
final class PhabricatorDaemonTimelineEventController
|
2011-03-11 18:34:22 +01:00
|
|
|
extends PhabricatorDaemonController {
|
|
|
|
|
|
|
|
private $id;
|
|
|
|
|
|
|
|
public function willProcessRequest(array $data) {
|
|
|
|
$this->id = $data['id'];
|
|
|
|
}
|
|
|
|
|
|
|
|
public function processRequest() {
|
|
|
|
$event = id(new PhabricatorTimelineEvent('NULL'))->load($this->id);
|
|
|
|
if (!$event) {
|
|
|
|
return new Aphront404Response();
|
|
|
|
}
|
|
|
|
|
|
|
|
$request = $this->getRequest();
|
|
|
|
$user = $request->getUser();
|
|
|
|
|
2011-04-14 18:41:43 +02:00
|
|
|
if ($event->getDataID()) {
|
|
|
|
$data = id(new PhabricatorTimelineEventData())->load(
|
|
|
|
$event->getDataID());
|
|
|
|
}
|
2011-03-11 18:34:22 +01:00
|
|
|
|
|
|
|
if ($data) {
|
|
|
|
$data = json_encode($data->getEventData());
|
|
|
|
} else {
|
|
|
|
$data = 'null';
|
|
|
|
}
|
|
|
|
|
|
|
|
$form = new AphrontFormView();
|
|
|
|
$form
|
|
|
|
->setUser($user)
|
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormStaticControl())
|
|
|
|
->setLabel('ID')
|
|
|
|
->setValue($event->getID()))
|
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormStaticControl())
|
|
|
|
->setLabel('Type')
|
|
|
|
->setValue($event->getType()))
|
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormTextAreaControl())
|
|
|
|
->setDisabled(true)
|
|
|
|
->setLabel('Data')
|
|
|
|
->setValue($data))
|
|
|
|
->appendChild(
|
|
|
|
id(new AphrontFormSubmitControl())
|
|
|
|
->addCancelButton('/daemon/timeline/'));
|
|
|
|
|
|
|
|
$panel = new AphrontPanelView();
|
|
|
|
$panel->setHeader('Event');
|
|
|
|
$panel->setWidth(AphrontPanelView::WIDTH_FORM);
|
|
|
|
$panel->appendChild($form);
|
|
|
|
|
2012-08-14 00:27:45 +02:00
|
|
|
$nav = $this->buildSideNavView();
|
|
|
|
$nav->selectFilter('timeline');
|
|
|
|
$nav->appendChild($panel);
|
|
|
|
|
|
|
|
return $this->buildApplicationPage(
|
|
|
|
$nav,
|
2011-03-11 18:34:22 +01:00
|
|
|
array(
|
|
|
|
'title' => 'Timeline Event',
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|