2012-11-22 02:24:56 +01:00
|
|
|
<?php
|
|
|
|
|
2014-02-12 18:02:05 +01:00
|
|
|
final class PHUITimelineEventView extends AphrontView {
|
2012-11-22 02:24:56 +01:00
|
|
|
|
2014-04-04 21:23:22 +02:00
|
|
|
const DELIMITER = " \xC2\xB7 ";
|
|
|
|
|
2012-11-22 02:24:56 +01:00
|
|
|
private $userHandle;
|
|
|
|
private $title;
|
2012-12-11 22:59:35 +01:00
|
|
|
private $icon;
|
|
|
|
private $color;
|
2012-11-22 02:24:56 +01:00
|
|
|
private $classes = array();
|
2012-12-11 22:59:51 +01:00
|
|
|
private $contentSource;
|
|
|
|
private $dateCreated;
|
|
|
|
private $anchor;
|
2012-12-11 23:01:51 +01:00
|
|
|
private $isEditable;
|
|
|
|
private $isEdited;
|
2014-05-05 19:55:32 +02:00
|
|
|
private $isRemovable;
|
2012-12-11 23:01:51 +01:00
|
|
|
private $transactionPHID;
|
2012-12-21 14:51:33 +01:00
|
|
|
private $isPreview;
|
2013-09-24 23:35:35 +02:00
|
|
|
private $eventGroup = array();
|
2014-02-14 19:23:07 +01:00
|
|
|
private $hideByDefault;
|
2014-03-27 22:24:31 +01:00
|
|
|
private $token;
|
|
|
|
private $tokenRemoved;
|
2014-05-05 19:55:58 +02:00
|
|
|
private $quoteTargetID;
|
|
|
|
private $quoteRef;
|
|
|
|
|
|
|
|
public function setQuoteRef($quote_ref) {
|
|
|
|
$this->quoteRef = $quote_ref;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getQuoteRef() {
|
|
|
|
return $this->quoteRef;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setQuoteTargetID($quote_target_id) {
|
|
|
|
$this->quoteTargetID = $quote_target_id;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getQuoteTargetID() {
|
|
|
|
return $this->quoteTargetID;
|
|
|
|
}
|
2014-02-14 19:23:07 +01:00
|
|
|
|
|
|
|
public function setHideByDefault($hide_by_default) {
|
|
|
|
$this->hideByDefault = $hide_by_default;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getHideByDefault() {
|
|
|
|
return $this->hideByDefault;
|
|
|
|
}
|
2012-12-11 23:01:51 +01:00
|
|
|
|
|
|
|
public function setTransactionPHID($transaction_phid) {
|
|
|
|
$this->transactionPHID = $transaction_phid;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getTransactionPHID() {
|
|
|
|
return $this->transactionPHID;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setIsEdited($is_edited) {
|
|
|
|
$this->isEdited = $is_edited;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getIsEdited() {
|
|
|
|
return $this->isEdited;
|
|
|
|
}
|
|
|
|
|
2012-12-21 14:51:33 +01:00
|
|
|
public function setIsPreview($is_preview) {
|
|
|
|
$this->isPreview = $is_preview;
|
2012-12-11 23:01:51 +01:00
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2012-12-21 14:51:33 +01:00
|
|
|
public function getIsPreview() {
|
|
|
|
return $this->isPreview;
|
2012-12-11 23:01:51 +01:00
|
|
|
}
|
2012-12-11 22:59:51 +01:00
|
|
|
|
2012-12-21 14:51:33 +01:00
|
|
|
public function setIsEditable($is_editable) {
|
|
|
|
$this->isEditable = $is_editable;
|
2012-12-11 22:59:51 +01:00
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2012-12-21 14:51:33 +01:00
|
|
|
public function getIsEditable() {
|
|
|
|
return $this->isEditable;
|
2012-12-11 22:59:51 +01:00
|
|
|
}
|
|
|
|
|
2014-05-05 19:55:32 +02:00
|
|
|
public function setIsRemovable($is_removable) {
|
|
|
|
$this->isRemovable = $is_removable;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getIsRemovable() {
|
|
|
|
return $this->isRemovable;
|
|
|
|
}
|
|
|
|
|
2012-12-11 22:59:51 +01:00
|
|
|
public function setDateCreated($date_created) {
|
|
|
|
$this->dateCreated = $date_created;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getDateCreated() {
|
|
|
|
return $this->dateCreated;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setContentSource(PhabricatorContentSource $content_source) {
|
|
|
|
$this->contentSource = $content_source;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getContentSource() {
|
|
|
|
return $this->contentSource;
|
|
|
|
}
|
2012-11-22 02:24:56 +01:00
|
|
|
|
|
|
|
public function setUserHandle(PhabricatorObjectHandle $handle) {
|
|
|
|
$this->userHandle = $handle;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2012-12-11 22:59:51 +01:00
|
|
|
public function setAnchor($anchor) {
|
|
|
|
$this->anchor = $anchor;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2014-02-14 19:23:07 +01:00
|
|
|
public function getAnchor() {
|
|
|
|
return $this->anchor;
|
|
|
|
}
|
|
|
|
|
2012-11-22 02:24:56 +01:00
|
|
|
public function setTitle($title) {
|
|
|
|
$this->title = $title;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function addClass($class) {
|
|
|
|
$this->classes[] = $class;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2012-12-11 22:59:35 +01:00
|
|
|
public function setIcon($icon) {
|
|
|
|
$this->icon = $icon;
|
2012-11-22 02:24:56 +01:00
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2012-12-11 22:59:35 +01:00
|
|
|
public function setColor($color) {
|
|
|
|
$this->color = $color;
|
2012-11-22 02:24:56 +01:00
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2014-03-27 22:24:31 +01:00
|
|
|
public function setToken($token, $removed=false) {
|
|
|
|
$this->token = $token;
|
|
|
|
$this->tokenRemoved = $removed;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2013-09-24 23:35:35 +02:00
|
|
|
public function getEventGroup() {
|
|
|
|
return array_merge(array($this), $this->eventGroup);
|
|
|
|
}
|
|
|
|
|
2014-02-12 18:02:05 +01:00
|
|
|
public function addEventToGroup(PHUITimelineEventView $event) {
|
2013-09-24 23:35:35 +02:00
|
|
|
$this->eventGroup[] = $event;
|
|
|
|
return $this;
|
|
|
|
}
|
|
|
|
|
2014-05-21 22:37:11 +02:00
|
|
|
protected function shouldRenderEventTitle() {
|
|
|
|
if ($this->title === null) {
|
|
|
|
return false;
|
2012-11-22 02:24:56 +01:00
|
|
|
}
|
|
|
|
|
2014-05-21 22:37:11 +02:00
|
|
|
return true;
|
|
|
|
}
|
2012-12-11 22:59:51 +01:00
|
|
|
|
2014-05-21 22:37:11 +02:00
|
|
|
protected function renderEventTitle($force_icon, $has_menu, $extra) {
|
|
|
|
$title = $this->title;
|
2012-12-11 22:59:35 +01:00
|
|
|
|
2014-05-21 22:37:11 +02:00
|
|
|
$title_classes = array();
|
|
|
|
$title_classes[] = 'phui-timeline-title';
|
2012-12-11 22:59:35 +01:00
|
|
|
|
2014-05-21 22:37:11 +02:00
|
|
|
$icon = null;
|
|
|
|
if ($this->icon || $force_icon) {
|
|
|
|
$title_classes[] = 'phui-timeline-title-with-icon';
|
|
|
|
}
|
2013-09-24 23:35:35 +02:00
|
|
|
|
2014-05-21 22:37:11 +02:00
|
|
|
if ($has_menu) {
|
|
|
|
$title_classes[] = 'phui-timeline-title-with-menu';
|
|
|
|
}
|
2014-04-22 17:25:54 +02:00
|
|
|
|
2014-05-21 22:37:11 +02:00
|
|
|
if ($this->icon) {
|
|
|
|
$fill_classes = array();
|
|
|
|
$fill_classes[] = 'phui-timeline-icon-fill';
|
|
|
|
if ($this->color) {
|
|
|
|
$fill_classes[] = 'phui-timeline-icon-fill-'.$this->color;
|
2012-11-22 02:24:56 +01:00
|
|
|
}
|
|
|
|
|
2014-05-21 22:37:11 +02:00
|
|
|
$icon = id(new PHUIIconView())
|
|
|
|
->setIconFont($this->icon.' white')
|
|
|
|
->addClass('phui-timeline-icon');
|
2014-03-27 22:24:31 +01:00
|
|
|
|
2014-05-21 22:37:11 +02:00
|
|
|
$icon = phutil_tag(
|
|
|
|
'span',
|
2012-11-22 02:24:56 +01:00
|
|
|
array(
|
2014-05-21 22:37:11 +02:00
|
|
|
'class' => implode(' ', $fill_classes),
|
2012-11-22 02:24:56 +01:00
|
|
|
),
|
2014-05-21 22:37:11 +02:00
|
|
|
$icon);
|
2013-09-24 23:35:35 +02:00
|
|
|
}
|
2012-12-11 23:02:51 +01:00
|
|
|
|
2014-05-21 22:37:11 +02:00
|
|
|
$token = null;
|
|
|
|
if ($this->token) {
|
|
|
|
$token = id(new PHUIIconView())
|
|
|
|
->addClass('phui-timeline-token')
|
|
|
|
->setSpriteSheet(PHUIIconView::SPRITE_TOKENS)
|
|
|
|
->setSpriteIcon($this->token);
|
|
|
|
if ($this->tokenRemoved) {
|
|
|
|
$token->addClass('strikethrough');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$title = phutil_tag(
|
|
|
|
'div',
|
|
|
|
array(
|
|
|
|
'class' => implode(' ', $title_classes),
|
|
|
|
),
|
|
|
|
array($icon, $token, $title, $extra));
|
|
|
|
|
2013-09-24 23:35:35 +02:00
|
|
|
return $title;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function render() {
|
|
|
|
|
2013-12-27 04:24:04 +01:00
|
|
|
$events = $this->getEventGroup();
|
|
|
|
|
|
|
|
// Move events with icons first.
|
|
|
|
$icon_keys = array();
|
|
|
|
foreach ($this->getEventGroup() as $key => $event) {
|
|
|
|
if ($event->icon) {
|
|
|
|
$icon_keys[] = $key;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$events = array_select_keys($events, $icon_keys) + $events;
|
|
|
|
$force_icon = (bool)$icon_keys;
|
|
|
|
|
2014-05-05 19:57:23 +02:00
|
|
|
$menu = null;
|
|
|
|
$items = array();
|
|
|
|
$has_menu = false;
|
|
|
|
if (!$this->getIsPreview()) {
|
|
|
|
foreach ($this->getEventGroup() as $event) {
|
|
|
|
$items[] = $event->getMenuItems($this->anchor);
|
|
|
|
if ($event->hasChildren()) {
|
|
|
|
$has_menu = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$items = array_mergev($items);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($items || $has_menu) {
|
|
|
|
$icon = id(new PHUIIconView())
|
|
|
|
->setIconFont('fa-cog');
|
|
|
|
$aural = javelin_tag(
|
|
|
|
'span',
|
|
|
|
array(
|
|
|
|
'aural' => true,
|
|
|
|
),
|
|
|
|
pht('Comment Actions'));
|
|
|
|
|
|
|
|
if ($items) {
|
|
|
|
$sigil = 'phui-timeline-menu';
|
|
|
|
Javelin::initBehavior('phui-timeline-dropdown-menu');
|
|
|
|
} else {
|
|
|
|
$sigil = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
$action_list = id(new PhabricatorActionListView())
|
|
|
|
->setUser($this->getUser());
|
|
|
|
foreach ($items as $item) {
|
|
|
|
$action_list->addAction($item);
|
|
|
|
}
|
|
|
|
|
|
|
|
$menu = javelin_tag(
|
|
|
|
$items ? 'a' : 'span',
|
|
|
|
array(
|
|
|
|
'href' => '#',
|
|
|
|
'class' => 'phui-timeline-menu',
|
|
|
|
'sigil' => $sigil,
|
|
|
|
'aria-haspopup' => 'true',
|
|
|
|
'aria-expanded' => 'false',
|
|
|
|
'meta' => array(
|
|
|
|
'items' => hsprintf('%s', $action_list),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
array(
|
|
|
|
$aural,
|
|
|
|
$icon,
|
|
|
|
));
|
|
|
|
|
|
|
|
$has_menu = true;
|
|
|
|
}
|
|
|
|
|
2014-05-21 22:37:11 +02:00
|
|
|
// Render "extra" information (timestamp, etc).
|
|
|
|
$extra = $this->renderExtra($events);
|
|
|
|
|
2013-09-24 23:35:35 +02:00
|
|
|
$group_titles = array();
|
2014-05-05 19:57:23 +02:00
|
|
|
$group_items = array();
|
2013-09-24 23:35:35 +02:00
|
|
|
$group_children = array();
|
2013-12-27 04:24:04 +01:00
|
|
|
foreach ($events as $event) {
|
2014-05-21 22:37:11 +02:00
|
|
|
if ($event->shouldRenderEventTitle()) {
|
|
|
|
$group_titles[] = $event->renderEventTitle(
|
|
|
|
$force_icon,
|
|
|
|
$has_menu,
|
|
|
|
$extra);
|
|
|
|
|
|
|
|
// Don't render this information more than once.
|
|
|
|
$extra = null;
|
|
|
|
}
|
|
|
|
|
2013-09-24 23:35:35 +02:00
|
|
|
if ($event->hasChildren()) {
|
|
|
|
$group_children[] = $event->renderChildren();
|
|
|
|
}
|
2012-11-22 02:24:56 +01:00
|
|
|
}
|
|
|
|
|
2014-04-29 19:11:40 +02:00
|
|
|
$image_uri = $this->userHandle->getImageURI();
|
|
|
|
|
2013-01-18 03:57:09 +01:00
|
|
|
$wedge = phutil_tag(
|
2012-11-22 02:24:56 +01:00
|
|
|
'div',
|
|
|
|
array(
|
2014-02-12 18:02:05 +01:00
|
|
|
'class' => 'phui-timeline-wedge phui-timeline-border',
|
2014-04-29 19:11:40 +02:00
|
|
|
'style' => (nonempty($image_uri)) ? '' : 'display: none;',
|
2012-11-22 02:24:56 +01:00
|
|
|
),
|
|
|
|
'');
|
|
|
|
|
2013-01-18 03:57:09 +01:00
|
|
|
$image = phutil_tag(
|
2012-11-22 02:24:56 +01:00
|
|
|
'div',
|
|
|
|
array(
|
|
|
|
'style' => 'background-image: url('.$image_uri.')',
|
2014-02-12 18:02:05 +01:00
|
|
|
'class' => 'phui-timeline-image',
|
2012-11-22 02:24:56 +01:00
|
|
|
),
|
|
|
|
'');
|
|
|
|
|
|
|
|
$content_classes = array();
|
2014-02-12 18:02:05 +01:00
|
|
|
$content_classes[] = 'phui-timeline-content';
|
2012-11-22 02:24:56 +01:00
|
|
|
|
|
|
|
$classes = array();
|
2014-02-12 18:02:05 +01:00
|
|
|
$classes[] = 'phui-timeline-event-view';
|
2013-09-24 23:35:35 +02:00
|
|
|
if ($group_children) {
|
2014-02-12 18:02:05 +01:00
|
|
|
$classes[] = 'phui-timeline-major-event';
|
2013-01-29 03:09:33 +01:00
|
|
|
$content = phutil_tag(
|
2012-11-22 02:24:56 +01:00
|
|
|
'div',
|
|
|
|
array(
|
2014-02-12 18:02:05 +01:00
|
|
|
'class' => 'phui-timeline-inner-content',
|
2012-11-22 02:24:56 +01:00
|
|
|
),
|
2013-09-24 23:35:35 +02:00
|
|
|
array(
|
|
|
|
$group_titles,
|
2014-05-05 19:57:23 +02:00
|
|
|
$menu,
|
2013-09-24 23:35:35 +02:00
|
|
|
phutil_tag(
|
|
|
|
'div',
|
|
|
|
array(
|
2014-02-12 18:02:05 +01:00
|
|
|
'class' => 'phui-timeline-core-content',
|
2013-09-24 23:35:35 +02:00
|
|
|
),
|
|
|
|
$group_children),
|
|
|
|
));
|
2012-11-22 02:24:56 +01:00
|
|
|
} else {
|
2014-02-12 18:02:05 +01:00
|
|
|
$classes[] = 'phui-timeline-minor-event';
|
2013-09-24 23:35:35 +02:00
|
|
|
$content = $group_titles;
|
2012-11-22 02:24:56 +01:00
|
|
|
}
|
|
|
|
|
2013-09-24 23:35:35 +02:00
|
|
|
$content = phutil_tag(
|
|
|
|
'div',
|
|
|
|
array(
|
2014-02-12 18:02:05 +01:00
|
|
|
'class' => 'phui-timeline-group phui-timeline-border',
|
2013-09-24 23:35:35 +02:00
|
|
|
),
|
|
|
|
$content);
|
|
|
|
|
|
|
|
$content = phutil_tag(
|
|
|
|
'div',
|
|
|
|
array(
|
|
|
|
'class' => implode(' ', $content_classes),
|
|
|
|
),
|
|
|
|
array($image, $wedge, $content));
|
|
|
|
|
2012-12-11 22:59:35 +01:00
|
|
|
$outer_classes = $this->classes;
|
2014-02-12 18:02:05 +01:00
|
|
|
$outer_classes[] = 'phui-timeline-shell';
|
2013-09-24 23:35:35 +02:00
|
|
|
$color = null;
|
|
|
|
foreach ($this->getEventGroup() as $event) {
|
|
|
|
if ($event->color) {
|
|
|
|
$color = $event->color;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($color) {
|
2014-02-12 18:02:05 +01:00
|
|
|
$outer_classes[] = 'phui-timeline-'.$color;
|
2012-12-11 22:59:35 +01:00
|
|
|
}
|
|
|
|
|
2012-12-11 23:02:12 +01:00
|
|
|
$sigil = null;
|
|
|
|
$meta = null;
|
|
|
|
if ($this->getTransactionPHID()) {
|
|
|
|
$sigil = 'transaction';
|
|
|
|
$meta = array(
|
|
|
|
'phid' => $this->getTransactionPHID(),
|
|
|
|
'anchor' => $this->anchor,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2013-01-29 03:09:33 +01:00
|
|
|
return javelin_tag(
|
2012-11-22 02:24:56 +01:00
|
|
|
'div',
|
|
|
|
array(
|
2012-12-11 22:59:35 +01:00
|
|
|
'class' => implode(' ', $outer_classes),
|
2012-12-11 22:59:51 +01:00
|
|
|
'id' => $this->anchor ? 'anchor-'.$this->anchor : null,
|
2012-12-11 23:02:12 +01:00
|
|
|
'sigil' => $sigil,
|
|
|
|
'meta' => $meta,
|
2012-11-22 02:24:56 +01:00
|
|
|
),
|
2013-01-29 03:09:33 +01:00
|
|
|
phutil_tag(
|
2012-11-22 02:24:56 +01:00
|
|
|
'div',
|
|
|
|
array(
|
|
|
|
'class' => implode(' ', $classes),
|
|
|
|
),
|
|
|
|
$content));
|
|
|
|
}
|
|
|
|
|
2014-05-21 22:37:11 +02:00
|
|
|
private function renderExtra(array $events) {
|
2012-12-21 14:51:33 +01:00
|
|
|
$extra = array();
|
|
|
|
|
|
|
|
if ($this->getIsPreview()) {
|
|
|
|
$extra[] = pht('PREVIEW');
|
|
|
|
} else {
|
2014-05-21 22:37:11 +02:00
|
|
|
foreach ($events as $event) {
|
|
|
|
if ($event->getIsEdited()) {
|
|
|
|
$extra[] = pht('Edited');
|
|
|
|
break;
|
|
|
|
}
|
2014-05-05 19:55:32 +02:00
|
|
|
}
|
|
|
|
|
2014-05-21 22:37:11 +02:00
|
|
|
$source = $this->getContentSource();
|
|
|
|
if ($source) {
|
|
|
|
$extra[] = id(new PhabricatorContentSourceView())
|
|
|
|
->setContentSource($source)
|
|
|
|
->setUser($this->getUser())
|
|
|
|
->render();
|
|
|
|
}
|
2012-12-21 14:51:33 +01:00
|
|
|
|
2014-05-21 22:37:11 +02:00
|
|
|
$date_created = null;
|
|
|
|
foreach ($events as $event) {
|
|
|
|
if ($event->getDateCreated()) {
|
|
|
|
if ($date_created === null) {
|
|
|
|
$date_created = $event->getDateCreated();
|
|
|
|
} else {
|
|
|
|
$date_created = min($event->getDateCreated(), $date_created);
|
2013-12-27 04:24:04 +01:00
|
|
|
}
|
2012-12-21 14:51:33 +01:00
|
|
|
}
|
2014-05-21 22:37:11 +02:00
|
|
|
}
|
2012-12-21 14:51:33 +01:00
|
|
|
|
2014-05-21 22:37:11 +02:00
|
|
|
if ($date_created) {
|
|
|
|
$date = phabricator_datetime(
|
|
|
|
$date_created,
|
|
|
|
$this->getUser());
|
|
|
|
if ($this->anchor) {
|
|
|
|
Javelin::initBehavior('phabricator-watch-anchor');
|
|
|
|
|
|
|
|
$anchor = id(new PhabricatorAnchorView())
|
|
|
|
->setAnchorName($this->anchor)
|
|
|
|
->render();
|
|
|
|
|
|
|
|
$date = array(
|
|
|
|
$anchor,
|
|
|
|
phutil_tag(
|
|
|
|
'a',
|
|
|
|
array(
|
|
|
|
'href' => '#'.$this->anchor,
|
|
|
|
),
|
|
|
|
$date),
|
|
|
|
);
|
2013-12-27 04:24:04 +01:00
|
|
|
}
|
2014-05-21 22:37:11 +02:00
|
|
|
$extra[] = $date;
|
2013-12-27 04:24:04 +01:00
|
|
|
}
|
2012-12-21 14:51:33 +01:00
|
|
|
}
|
|
|
|
|
2014-05-21 22:37:11 +02:00
|
|
|
$extra = javelin_tag(
|
|
|
|
'span',
|
|
|
|
array(
|
|
|
|
'class' => 'phui-timeline-extra',
|
|
|
|
),
|
|
|
|
phutil_implode_html(
|
|
|
|
javelin_tag(
|
|
|
|
'span',
|
|
|
|
array(
|
|
|
|
'aural' => false,
|
|
|
|
),
|
|
|
|
self::DELIMITER),
|
|
|
|
$extra));
|
|
|
|
|
2012-12-21 14:51:33 +01:00
|
|
|
return $extra;
|
|
|
|
}
|
|
|
|
|
2014-05-05 19:57:23 +02:00
|
|
|
private function getMenuItems($anchor) {
|
|
|
|
$xaction_phid = $this->getTransactionPHID();
|
|
|
|
|
|
|
|
$items = array();
|
|
|
|
|
2014-07-29 00:01:43 +02:00
|
|
|
if ($this->getIsEditable()) {
|
|
|
|
$items[] = id(new PhabricatorActionView())
|
|
|
|
->setIcon('fa-pencil')
|
|
|
|
->setHref('/transactions/edit/'.$xaction_phid.'/')
|
|
|
|
->setName(pht('Edit Comment'))
|
|
|
|
->addSigil('transaction-edit')
|
|
|
|
->setMetadata(
|
|
|
|
array(
|
|
|
|
'anchor' => $anchor,
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($this->getQuoteTargetID()) {
|
2014-05-05 19:57:23 +02:00
|
|
|
$ref = null;
|
|
|
|
if ($this->getQuoteRef()) {
|
|
|
|
$ref = $this->getQuoteRef();
|
|
|
|
if ($anchor) {
|
|
|
|
$ref = $ref.'#'.$anchor;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
$items[] = id(new PhabricatorActionView())
|
2014-05-12 19:08:32 +02:00
|
|
|
->setIcon('fa-quote-left')
|
2014-05-05 19:57:23 +02:00
|
|
|
->setHref('#')
|
|
|
|
->setName(pht('Quote'))
|
|
|
|
->addSigil('transaction-quote')
|
|
|
|
->setMetadata(
|
|
|
|
array(
|
|
|
|
'targetID' => $this->getQuoteTargetID(),
|
|
|
|
'uri' => '/transactions/quote/'.$xaction_phid.'/',
|
|
|
|
'ref' => $ref,
|
|
|
|
));
|
2014-08-08 00:21:32 +02:00
|
|
|
|
|
|
|
// if there is something to quote then there is something to view raw
|
|
|
|
$items[] = id(new PhabricatorActionView())
|
|
|
|
->setIcon('fa-cutlery')
|
|
|
|
->setHref('/transactions/raw/'.$xaction_phid.'/')
|
|
|
|
->setName(pht('View Raw'))
|
|
|
|
->addSigil('transaction-raw')
|
|
|
|
->setMetadata(
|
|
|
|
array(
|
|
|
|
'anchor' => $anchor,
|
|
|
|
));
|
2014-05-05 19:57:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if ($this->getIsRemovable()) {
|
|
|
|
$items[] = id(new PhabricatorActionView())
|
2014-05-12 19:08:32 +02:00
|
|
|
->setIcon('fa-times')
|
2014-05-05 19:57:23 +02:00
|
|
|
->setHref('/transactions/remove/'.$xaction_phid.'/')
|
|
|
|
->setName(pht('Remove Comment'))
|
|
|
|
->addSigil('transaction-remove')
|
|
|
|
->setMetadata(
|
|
|
|
array(
|
|
|
|
'anchor' => $anchor,
|
|
|
|
));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($this->getIsEdited()) {
|
|
|
|
$items[] = id(new PhabricatorActionView())
|
2014-05-12 19:08:32 +02:00
|
|
|
->setIcon('fa-list')
|
2014-05-05 19:57:23 +02:00
|
|
|
->setHref('/transactions/history/'.$xaction_phid.'/')
|
|
|
|
->setName(pht('View Edit History'))
|
|
|
|
->setWorkflow(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
return $items;
|
|
|
|
}
|
|
|
|
|
2012-11-22 02:24:56 +01:00
|
|
|
}
|