Page MenuHomePhorge

No OneTemporary

diff --git a/src/applications/countdown/view/PhabricatorCountdownView.php b/src/applications/countdown/view/PhabricatorCountdownView.php
index 11f43825dd..7ede4ef887 100644
--- a/src/applications/countdown/view/PhabricatorCountdownView.php
+++ b/src/applications/countdown/view/PhabricatorCountdownView.php
@@ -1,79 +1,79 @@
<?php
final class PhabricatorCountdownView extends AphrontTagView {
private $countdown;
private $headless;
public function setHeadless($headless) {
$this->headless = $headless;
return $this;
}
public function setCountdown(PhabricatorCountdown $countdown) {
$this->countdown = $countdown;
return $this;
}
- public function getTagContent() {
+ protected function getTagContent() {
$countdown = $this->countdown;
require_celerity_resource('phabricator-countdown-css');
$header = null;
if (!$this->headless) {
$header = phutil_tag(
'div',
array(
'class' => 'phabricator-timer-header',
),
array(
'C'.$countdown->getID(),
' ',
phutil_tag(
'a',
array(
'href' => '/countdown/'.$countdown->getID(),
),
$countdown->getTitle()),
));
}
$ths = array(
phutil_tag('th', array(), pht('Days')),
phutil_tag('th', array(), pht('Hours')),
phutil_tag('th', array(), pht('Minutes')),
phutil_tag('th', array(), pht('Seconds')),
);
$dashes = array(
javelin_tag('td', array('sigil' => 'phabricator-timer-days'), '-'),
javelin_tag('td', array('sigil' => 'phabricator-timer-hours'), '-'),
javelin_tag('td', array('sigil' => 'phabricator-timer-minutes'), '-'),
javelin_tag('td', array('sigil' => 'phabricator-timer-seconds'), '-'),
);
$container = celerity_generate_unique_node_id();
$content = phutil_tag(
'div',
array('class' => 'phabricator-timer', 'id' => $container),
array(
$header,
phutil_tag('table', array('class' => 'phabricator-timer-table'), array(
phutil_tag('tr', array(), $ths),
phutil_tag('tr', array(), $dashes),
)),
));
Javelin::initBehavior('countdown-timer', array(
'timestamp' => $countdown->getEpoch(),
'container' => $container,
));
return $content;
}
}
diff --git a/src/applications/diviner/view/DivinerBookItemView.php b/src/applications/diviner/view/DivinerBookItemView.php
index b396dcc5d1..227a791308 100644
--- a/src/applications/diviner/view/DivinerBookItemView.php
+++ b/src/applications/diviner/view/DivinerBookItemView.php
@@ -1,68 +1,68 @@
<?php
final class DivinerBookItemView extends AphrontTagView {
private $title;
private $subtitle;
private $type;
private $href;
public function setTitle($title) {
$this->title = $title;
return $this;
}
public function setSubtitle($subtitle) {
$this->subtitle = $subtitle;
return $this;
}
public function setType($type) {
$this->type = $type;
return $this;
}
public function setHref($href) {
$this->href = $href;
return $this;
}
- public function getTagName() {
+ protected function getTagName() {
return 'a';
}
- public function getTagAttributes() {
+ protected function getTagAttributes() {
return array(
'class' => 'diviner-book-item',
'href' => $this->href,
);
}
- public function getTagContent() {
+ protected function getTagContent() {
require_celerity_resource('diviner-shared-css');
$title = phutil_tag(
'span',
array(
'class' => 'diviner-book-item-title',
),
$this->title);
$subtitle = phutil_tag(
'span',
array(
'class' => 'diviner-book-item-subtitle',
),
$this->subtitle);
$type = phutil_tag(
'span',
array(
'class' => 'diviner-book-item-type',
),
$this->type);
return array($title, $type, $subtitle);
}
}
diff --git a/src/applications/diviner/view/DivinerParameterTableView.php b/src/applications/diviner/view/DivinerParameterTableView.php
index f5eaddbfd6..fbb150e884 100644
--- a/src/applications/diviner/view/DivinerParameterTableView.php
+++ b/src/applications/diviner/view/DivinerParameterTableView.php
@@ -1,84 +1,84 @@
<?php
final class DivinerParameterTableView extends AphrontTagView {
private $parameters;
private $header;
public function setParameters(array $parameters) {
$this->parameters = $parameters;
return $this;
}
public function setHeader($text) {
$this->header = $text;
return $this;
}
- public function getTagName() {
+ protected function getTagName() {
return 'div';
}
- public function getTagAttributes() {
+ protected function getTagAttributes() {
return array(
'class' => 'diviner-table-view',
);
}
- public function getTagContent() {
+ protected function getTagContent() {
require_celerity_resource('diviner-shared-css');
$rows = array();
foreach ($this->parameters as $param) {
$cells = array();
$type = idx($param, 'doctype');
if (!$type) {
$type = idx($param, 'type');
}
$name = idx($param, 'name');
$docs = idx($param, 'docs');
$cells[] = phutil_tag(
'td',
array(
'class' => 'diviner-parameter-table-type diviner-monospace',
),
$type);
$cells[] = phutil_tag(
'td',
array(
'class' => 'diviner-parameter-table-name diviner-monospace',
),
$name);
$cells[] = phutil_tag(
'td',
array(
'class' => 'diviner-parameter-table-docs',
),
$docs);
$rows[] = phutil_tag('tr', array(), $cells);
}
$table = phutil_tag(
'table',
array(
'class' => 'diviner-parameter-table-view',
),
$rows);
$header = phutil_tag(
'span',
array(
'class' => 'diviner-table-header',
),
$this->header);
return array($header, $table);
}
}
diff --git a/src/applications/diviner/view/DivinerReturnTableView.php b/src/applications/diviner/view/DivinerReturnTableView.php
index fa1f450200..ff89024236 100644
--- a/src/applications/diviner/view/DivinerReturnTableView.php
+++ b/src/applications/diviner/view/DivinerReturnTableView.php
@@ -1,78 +1,78 @@
<?php
final class DivinerReturnTableView extends AphrontTagView {
private $return;
private $header;
public function setReturn(array $return) {
$this->return = $return;
return $this;
}
public function setHeader($text) {
$this->header = $text;
return $this;
}
- public function getTagName() {
+ protected function getTagName() {
return 'div';
}
- public function getTagAttributes() {
+ protected function getTagAttributes() {
return array(
'class' => 'diviner-table-view',
);
}
- public function getTagContent() {
+ protected function getTagContent() {
require_celerity_resource('diviner-shared-css');
$return = $this->return;
$type = idx($return, 'doctype');
if (!$type) {
$type = idx($return, 'type');
}
$docs = idx($return, 'docs');
$cells = array();
$cells[] = phutil_tag(
'td',
array(
'class' => 'diviner-return-table-type diviner-monospace',
),
$type);
$cells[] = phutil_tag(
'td',
array(
'class' => 'diviner-return-table-docs',
),
$docs);
$rows = phutil_tag(
'tr',
array(),
$cells);
$table = phutil_tag(
'table',
array(
'class' => 'diviner-return-table-view',
),
$rows);
$header = phutil_tag(
'span',
array(
'class' => 'diviner-table-header',
),
$this->header);
return array($header, $table);
}
}
diff --git a/src/applications/diviner/view/DivinerSectionView.php b/src/applications/diviner/view/DivinerSectionView.php
index 0f48858db6..f12fb01fab 100644
--- a/src/applications/diviner/view/DivinerSectionView.php
+++ b/src/applications/diviner/view/DivinerSectionView.php
@@ -1,43 +1,43 @@
<?php
final class DivinerSectionView extends AphrontTagView {
private $header;
private $content;
public function addContent($content) {
$this->content[] = $content;
return $this;
}
public function setHeader($text) {
$this->header = $text;
return $this;
}
- public function getTagName() {
+ protected function getTagName() {
return 'div';
}
- public function getTagAttributes() {
+ protected function getTagAttributes() {
return array(
'class' => 'diviner-document-section',
);
}
- public function getTagContent() {
+ protected function getTagContent() {
require_celerity_resource('diviner-shared-css');
$header = id(new PHUIHeaderView())
->setBleedHeader(true)
->setHeader($this->header);
$content = id(new PHUIBoxView())
->addPadding(PHUI::PADDING_LARGE_LEFT)
->addPadding(PHUI::PADDING_LARGE_RIGHT)
->appendChild($this->content);
return array($header, $content);
}
}
diff --git a/src/view/form/PHUIPagedFormView.php b/src/view/form/PHUIPagedFormView.php
index 11b1db9441..ee40c3d496 100644
--- a/src/view/form/PHUIPagedFormView.php
+++ b/src/view/form/PHUIPagedFormView.php
@@ -1,278 +1,278 @@
<?php
/**
* @task page Managing Pages
*/
final class PHUIPagedFormView extends AphrontTagView {
private $name = 'pages';
private $pages = array();
private $selectedPage;
private $choosePage;
private $nextPage;
private $prevPage;
private $complete;
private $cancelURI;
protected function canAppendChild() {
return false;
}
/* -( Managing Pages )----------------------------------------------------- */
/**
* @task page
*/
public function addPage($key, PHUIFormPageView $page) {
if (isset($this->pages[$key])) {
throw new Exception("Duplicate page with key '{$key}'!");
}
$this->pages[$key] = $page;
$page->setPagedFormView($this, $key);
$this->selectedPage = null;
$this->complete = null;
return $this;
}
/**
* @task page
*/
public function getPage($key) {
if (!$this->pageExists($key)) {
throw new Exception("No page '{$key}' exists!");
}
return $this->pages[$key];
}
/**
* @task page
*/
public function pageExists($key) {
return isset($this->pages[$key]);
}
/**
* @task page
*/
protected function getPageIndex($key) {
$page = $this->getPage($key);
$index = 0;
foreach ($this->pages as $target_page) {
if ($page === $target_page) {
break;
}
$index++;
}
return $index;
}
/**
* @task page
*/
protected function getPageByIndex($index) {
foreach ($this->pages as $page) {
if (!$index) {
return $page;
}
$index--;
}
throw new Exception("Requesting out-of-bounds page '{$index}'.");
}
protected function getLastIndex() {
return count($this->pages) - 1;
}
protected function isFirstPage(PHUIFormPageView $page) {
return ($this->getPageIndex($page->getKey()) === 0);
}
protected function isLastPage(PHUIFormPageView $page) {
return ($this->getPageIndex($page->getKey()) === (count($this->pages) - 1));
}
public function getSelectedPage() {
return $this->selectedPage;
}
public function readFromObject($object) {
return $this->processForm($is_request = false, $object);
}
public function writeToResponse($response) {
foreach ($this->pages as $page) {
$page->validateResponseType($response);
$response = $page->writeToResponse($page);
}
return $response;
}
public function readFromRequest(AphrontRequest $request) {
$this->choosePage = $request->getStr($this->getRequestKey('page'));
$this->nextPage = $request->getStr('__submit__');
$this->prevPage = $request->getStr('__back__');
return $this->processForm($is_request = true, $request);
}
public function setName($name) {
$this->name = $name;
return $this;
}
public function getValue($page, $key, $default = null) {
return $this->getPage($page)->getValue($key, $default);
}
public function setValue($page, $key, $value) {
$this->getPage($page)->setValue($key, $value);
return $this;
}
private function processForm($is_request, $source) {
if ($this->pageExists($this->choosePage)) {
$selected = $this->getPage($this->choosePage);
} else {
$selected = $this->getPageByIndex(0);
}
$is_attempt_complete = false;
if ($this->prevPage) {
$prev_index = $this->getPageIndex($selected->getKey()) - 1;;
$index = max(0, $prev_index);
$selected = $this->getPageByIndex($index);
} else if ($this->nextPage) {
$next_index = $this->getPageIndex($selected->getKey()) + 1;
if ($next_index > $this->getLastIndex()) {
$is_attempt_complete = true;
}
$index = min($this->getLastIndex(), $next_index);
$selected = $this->getPageByIndex($index);
}
$validation_error = false;
$found_selected = false;
foreach ($this->pages as $key => $page) {
if ($is_request) {
if ($key === $this->choosePage) {
$page->readFromRequest($source);
} else {
$page->readSerializedValues($source);
}
} else {
$page->readFromObject($source);
}
if (!$found_selected) {
$page->adjustFormPage();
}
if ($page === $selected) {
$found_selected = true;
}
if (!$found_selected || $is_attempt_complete) {
if (!$page->isValid()) {
$selected = $page;
$validation_error = true;
break;
}
}
}
if ($is_attempt_complete && !$validation_error) {
$this->complete = true;
} else {
$this->selectedPage = $selected;
}
return $this;
}
public function isComplete() {
return $this->complete;
}
public function getRequestKey($key) {
return $this->name.':'.$key;
}
public function setCancelURI($cancel_uri) {
$this->cancelURI = $cancel_uri;
return $this;
}
public function getCancelURI() {
return $this->cancelURI;
}
- public function getTagContent() {
+ protected function getTagContent() {
$form = id(new AphrontFormView())
->setUser($this->getUser());
$selected_page = $this->getSelectedPage();
if (!$selected_page) {
throw new Exception('No selected page!');
}
$form->addHiddenInput(
$this->getRequestKey('page'),
$selected_page->getKey());
$errors = array();
foreach ($this->pages as $page) {
if ($page == $selected_page) {
$errors = $page->getPageErrors();
continue;
}
foreach ($page->getSerializedValues() as $key => $value) {
$form->addHiddenInput($key, $value);
}
}
$submit = id(new PHUIFormMultiSubmitControl());
if (!$this->isFirstPage($selected_page)) {
$submit->addBackButton();
} else if ($this->getCancelURI()) {
$submit->addCancelButton($this->getCancelURI());
}
if ($this->isLastPage($selected_page)) {
$submit->addSubmitButton(pht('Save'));
} else {
$submit->addSubmitButton(pht("Continue \xC2\xBB"));
}
$form->appendChild($selected_page);
$form->appendChild($submit);
$box = id(new PHUIObjectBoxView())
->setFormErrors($errors)
->setForm($form);
if ($selected_page->getPageName()) {
$header = id(new PHUIHeaderView())
->setHeader($selected_page->getPageName());
$box->setHeader($header);
}
return $box;
}
}
diff --git a/src/view/phui/PHUIBoxView.php b/src/view/phui/PHUIBoxView.php
index 4a0653a3ab..bc805515f0 100644
--- a/src/view/phui/PHUIBoxView.php
+++ b/src/view/phui/PHUIBoxView.php
@@ -1,47 +1,47 @@
<?php
final class PHUIBoxView extends AphrontTagView {
private $margin = array();
private $padding = array();
private $border = false;
public function addMargin($margin) {
$this->margin[] = $margin;
return $this;
}
public function addPadding($padding) {
$this->padding[] = $padding;
return $this;
}
public function setBorder($border) {
$this->border = $border;
return $this;
}
protected function getTagAttributes() {
require_celerity_resource('phui-box-css');
$outer_classes = array();
$outer_classes[] = 'phui-box';
if ($this->border) {
$outer_classes[] = 'phui-box-border';
}
foreach ($this->margin as $margin) {
$outer_classes[] = $margin;
}
foreach ($this->padding as $padding) {
$outer_classes[] = $padding;
}
return array('class' => $outer_classes);
}
- public function getTagName() {
+ protected function getTagName() {
return 'div';
}
- public function getTagContent() {
+ protected function getTagContent() {
return $this->renderChildren();
}
}
diff --git a/src/view/phui/PHUIButtonBarView.php b/src/view/phui/PHUIButtonBarView.php
index 861ea34ebf..ad4fd21665 100644
--- a/src/view/phui/PHUIButtonBarView.php
+++ b/src/view/phui/PHUIButtonBarView.php
@@ -1,42 +1,42 @@
<?php
final class PHUIButtonBarView extends AphrontTagView {
private $buttons = array();
public function addButton($button) {
$this->buttons[] = $button;
return $this;
}
protected function getTagAttributes() {
return array('class' => 'phui-button-bar');
}
- public function getTagName() {
+ protected function getTagName() {
return 'div';
}
- public function getTagContent() {
+ protected function getTagContent() {
require_celerity_resource('phui-button-css');
$i = 1;
$j = count($this->buttons);
foreach ($this->buttons as $button) {
// LeeLoo Dallas Multi-Pass
if ($j > 1) {
if ($i == 1) {
$button->addClass('phui-button-bar-first');
} else if ($i == $j) {
$button->addClass('phui-button-bar-last');
} else if ($j > 1) {
$button->addClass('phui-button-bar-middle');
}
}
$this->appendChild($button);
$i++;
}
return $this->renderChildren();
}
}
diff --git a/src/view/phui/PHUIButtonView.php b/src/view/phui/PHUIButtonView.php
index e0019f7edf..5de56909d2 100644
--- a/src/view/phui/PHUIButtonView.php
+++ b/src/view/phui/PHUIButtonView.php
@@ -1,147 +1,147 @@
<?php
final class PHUIButtonView extends AphrontTagView {
const GREEN = 'green';
const GREY = 'grey';
const BLACK = 'black';
const DISABLED = 'disabled';
const SIMPLE = 'simple';
const SMALL = 'small';
const BIG = 'big';
private $size;
private $text;
private $subtext;
private $color;
private $tag = 'button';
private $dropdown;
private $icon;
private $href = null;
private $title = null;
private $disabled;
private $name;
public function setName($name) {
$this->name = $name;
return $this;
}
public function getName() {
return $this->name;
}
public function setText($text) {
$this->text = $text;
return $this;
}
public function setHref($href) {
$this->href = $href;
return $this;
}
public function setTitle($title) {
$this->title = $title;
return $this;
}
public function setSubtext($subtext) {
$this->subtext = $subtext;
return $this;
}
public function setColor($color) {
$this->color = $color;
return $this;
}
public function setDisabled($disabled) {
$this->disabled = $disabled;
return $this;
}
public function setTag($tag) {
$this->tag = $tag;
return $this;
}
public function setSize($size) {
$this->size = $size;
return $this;
}
public function setDropdown($dd) {
$this->dropdown = $dd;
return $this;
}
public function setIcon(PHUIIconView $icon) {
$this->icon = $icon;
return $this;
}
- public function getTagName() {
+ protected function getTagName() {
return $this->tag;
}
protected function getTagAttributes() {
require_celerity_resource('phui-button-css');
$classes = array();
$classes[] = 'button';
if ($this->color) {
$classes[] = $this->color;
}
if ($this->size) {
$classes[] = $this->size;
}
if ($this->dropdown) {
$classes[] = 'dropdown';
}
if ($this->icon) {
$classes[] = 'has-icon';
}
if ($this->disabled) {
$classes[] = 'disabled';
}
return array(
'class' => $classes,
'href' => $this->href,
'name' => $this->name,
'title' => $this->title,
);
}
protected function getTagContent() {
$icon = null;
$text = $this->text;
if ($this->icon) {
$icon = $this->icon;
$subtext = null;
if ($this->subtext) {
$subtext = phutil_tag(
'div', array('class' => 'phui-button-subtext'), $this->subtext);
}
$text = phutil_tag(
'div', array('class' => 'phui-button-text'), array($text, $subtext));
}
$caret = null;
if ($this->dropdown) {
$caret = phutil_tag('span', array('class' => 'caret'), '');
}
return array($icon, $text, $caret);
}
}
diff --git a/src/view/phui/PHUIDocumentView.php b/src/view/phui/PHUIDocumentView.php
index 60f099730b..d043da1e17 100644
--- a/src/view/phui/PHUIDocumentView.php
+++ b/src/view/phui/PHUIDocumentView.php
@@ -1,189 +1,189 @@
<?php
final class PHUIDocumentView extends AphrontTagView {
/* For mobile displays, where do you want the sidebar */
const NAV_BOTTOM = 'nav_bottom';
const NAV_TOP = 'nav_top';
const FONT_SOURCE_SANS = 'source-sans';
private $offset;
private $header;
private $sidenav;
private $topnav;
private $crumbs;
private $bookname;
private $bookdescription;
private $mobileview;
private $fontKit;
public function setOffset($offset) {
$this->offset = $offset;
return $this;
}
public function setHeader(PHUIHeaderView $header) {
$header->setHeaderColor(PHUIActionHeaderView::HEADER_LIGHTBLUE);
$this->header = $header;
return $this;
}
public function setSideNav(PHUIListView $list, $display = self::NAV_BOTTOM) {
$list->setType(PHUIListView::SIDENAV_LIST);
$this->sidenav = $list;
$this->mobileview = $display;
return $this;
}
public function setTopNav(PHUIListView $list) {
$list->setType(PHUIListView::NAVBAR_LIST);
$this->topnav = $list;
return $this;
}
public function setCrumbs(PHUIListView $list) {
$this->crumbs = $list;
return $this;
}
public function setBook($name, $description) {
$this->bookname = $name;
$this->bookdescription = $description;
return $this;
}
public function setFontKit($kit) {
$this->fontKit = $kit;
return $this;
}
- public function getTagAttributes() {
+ protected function getTagAttributes() {
$classes = array();
if ($this->offset) {
$classes[] = 'phui-document-offset';
};
return array(
'class' => $classes,
);
}
- public function getTagContent() {
+ protected function getTagContent() {
require_celerity_resource('phui-document-view-css');
if ($this->fontKit) {
require_celerity_resource('phui-fontkit-css');
}
switch ($this->fontKit) {
case self::FONT_SOURCE_SANS:
require_celerity_resource('font-source-sans-pro');
break;
}
$classes = array();
$classes[] = 'phui-document-view';
if ($this->offset) {
$classes[] = 'phui-offset-view';
}
if ($this->sidenav) {
$classes[] = 'phui-sidenav-view';
}
$sidenav = null;
if ($this->sidenav) {
$sidenav = phutil_tag(
'div',
array(
'class' => 'phui-document-sidenav',
),
$this->sidenav);
}
$book = null;
if ($this->bookname) {
$book = phutil_tag(
'div',
array(
'class' => 'phui-document-bookname grouped',
),
array(
phutil_tag(
'span',
array('class' => 'bookname'),
$this->bookname),
phutil_tag(
'span',
array('class' => 'bookdescription'),
$this->bookdescription),
));
}
$topnav = null;
if ($this->topnav) {
$topnav = phutil_tag(
'div',
array(
'class' => 'phui-document-topnav',
),
$this->topnav);
}
$crumbs = null;
if ($this->crumbs) {
$crumbs = phutil_tag(
'div',
array(
'class' => 'phui-document-crumbs',
),
$this->bookName);
}
if ($this->fontKit) {
$main_content = phutil_tag(
'div',
array(
'class' => 'phui-font-'.$this->fontKit,
),
$this->renderChildren());
} else {
$main_content = $this->renderChildren();
}
$content_inner = phutil_tag(
'div',
array(
'class' => 'phui-document-inner',
),
array(
$book,
$this->header,
$topnav,
$main_content,
$crumbs,
));
if ($this->mobileview == self::NAV_BOTTOM) {
$order = array($content_inner, $sidenav);
} else {
$order = array($sidenav, $content_inner);
}
$content = phutil_tag(
'div',
array(
'class' => 'phui-document-content',
),
$order);
$view = phutil_tag(
'div',
array(
'class' => implode(' ', $classes),
),
$content);
return $view;
}
}
diff --git a/src/view/phui/PHUIIconView.php b/src/view/phui/PHUIIconView.php
index 4f8ab8c871..0314c86c26 100644
--- a/src/view/phui/PHUIIconView.php
+++ b/src/view/phui/PHUIIconView.php
@@ -1,631 +1,631 @@
<?php
final class PHUIIconView extends AphrontTagView {
const SPRITE_APPS = 'apps';
const SPRITE_TOKENS = 'tokens';
const SPRITE_LOGIN = 'login';
const SPRITE_PROJECTS = 'projects';
const HEAD_SMALL = 'phuihead-small';
const HEAD_MEDIUM = 'phuihead-medium';
private $href = null;
private $image;
private $text;
private $headSize = null;
private $spriteIcon;
private $spriteSheet;
private $iconFont;
private $iconColor;
public function setHref($href) {
$this->href = $href;
return $this;
}
public function setImage($image) {
$this->image = $image;
return $this;
}
public function setText($text) {
$this->text = $text;
return $this;
}
public function setHeadSize($size) {
$this->headSize = $size;
return $this;
}
public function setSpriteIcon($sprite) {
$this->spriteIcon = $sprite;
return $this;
}
public function setSpriteSheet($sheet) {
$this->spriteSheet = $sheet;
return $this;
}
public function setIconFont($icon, $color = null) {
$this->iconFont = $icon;
$this->iconColor = $color;
return $this;
}
- public function getTagName() {
+ protected function getTagName() {
$tag = 'span';
if ($this->href) {
$tag = 'a';
}
return $tag;
}
- public function getTagAttributes() {
+ protected function getTagAttributes() {
require_celerity_resource('phui-icon-view-css');
$style = null;
$classes = array();
$classes[] = 'phui-icon-view';
if ($this->spriteIcon) {
require_celerity_resource('sprite-'.$this->spriteSheet.'-css');
$classes[] = 'sprite-'.$this->spriteSheet;
$classes[] = $this->spriteSheet.'-'.$this->spriteIcon;
} else if ($this->iconFont) {
require_celerity_resource('phui-font-icon-base-css');
require_celerity_resource('font-fontawesome');
$classes[] = 'phui-font-fa';
$classes[] = $this->iconFont;
if ($this->iconColor) {
$classes[] = $this->iconColor;
}
} else {
if ($this->headSize) {
$classes[] = $this->headSize;
}
$style = 'background-image: url('.$this->image.');';
}
if ($this->text) {
$classes[] = 'phui-icon-has-text';
$this->appendChild($this->text);
}
return array(
'href' => $this->href,
'style' => $style,
'aural' => false,
'class' => $classes,
);
}
public static function getSheetManifest($sheet) {
$root = dirname(phutil_get_library_root('phabricator'));
$path = $root.'/resources/sprite/manifest/'.$sheet.'.json';
$data = Filesystem::readFile($path);
return idx(json_decode($data, true), 'sprites');
}
public static function getFontIcons() {
return array(
'fa-glass',
'fa-music',
'fa-search',
'fa-envelope-o',
'fa-heart',
'fa-star',
'fa-star-o',
'fa-user',
'fa-film',
'fa-th-large',
'fa-th',
'fa-th-list',
'fa-check',
'fa-times',
'fa-search-plus',
'fa-search-minus',
'fa-power-off',
'fa-signal',
'fa-cog',
'fa-trash-o',
'fa-home',
'fa-file-o',
'fa-clock-o',
'fa-road',
'fa-download',
'fa-arrow-circle-o-down',
'fa-arrow-circle-o-up',
'fa-inbox',
'fa-play-circle-o',
'fa-repeat',
'fa-refresh',
'fa-list-alt',
'fa-lock',
'fa-flag',
'fa-headphones',
'fa-volume-off',
'fa-volume-down',
'fa-volume-up',
'fa-qrcode',
'fa-barcode',
'fa-tag',
'fa-tags',
'fa-book',
'fa-bookmark',
'fa-print',
'fa-camera',
'fa-font',
'fa-bold',
'fa-italic',
'fa-text-height',
'fa-text-width',
'fa-align-left',
'fa-align-center',
'fa-align-right',
'fa-align-justify',
'fa-list',
'fa-outdent',
'fa-indent',
'fa-video-camera',
'fa-picture-o',
'fa-pencil',
'fa-map-marker',
'fa-adjust',
'fa-tint',
'fa-pencil-square-o',
'fa-share-square-o',
'fa-check-square-o',
'fa-arrows',
'fa-step-backward',
'fa-fast-backward',
'fa-backward',
'fa-play',
'fa-pause',
'fa-stop',
'fa-forward',
'fa-fast-forward',
'fa-step-forward',
'fa-eject',
'fa-chevron-left',
'fa-chevron-right',
'fa-plus-circle',
'fa-minus-circle',
'fa-times-circle',
'fa-check-circle',
'fa-question-circle',
'fa-info-circle',
'fa-crosshairs',
'fa-times-circle-o',
'fa-check-circle-o',
'fa-ban',
'fa-arrow-left',
'fa-arrow-right',
'fa-arrow-up',
'fa-arrow-down',
'fa-share',
'fa-expand',
'fa-compress',
'fa-plus',
'fa-minus',
'fa-asterisk',
'fa-exclamation-circle',
'fa-gift',
'fa-leaf',
'fa-fire',
'fa-eye',
'fa-eye-slash',
'fa-exclamation-triangle',
'fa-plane',
'fa-calendar',
'fa-random',
'fa-comment',
'fa-magnet',
'fa-chevron-up',
'fa-chevron-down',
'fa-retweet',
'fa-shopping-cart',
'fa-folder',
'fa-folder-open',
'fa-arrows-v',
'fa-arrows-h',
'fa-bar-chart-o',
'fa-twitter-square',
'fa-facebook-square',
'fa-camera-retro',
'fa-key',
'fa-cogs',
'fa-comments',
'fa-thumbs-o-up',
'fa-thumbs-o-down',
'fa-star-half',
'fa-heart-o',
'fa-sign-out',
'fa-linkedin-square',
'fa-thumb-tack',
'fa-external-link',
'fa-sign-in',
'fa-trophy',
'fa-github-square',
'fa-upload',
'fa-lemon-o',
'fa-phone',
'fa-square-o',
'fa-bookmark-o',
'fa-phone-square',
'fa-twitter',
'fa-facebook',
'fa-github',
'fa-unlock',
'fa-credit-card',
'fa-rss',
'fa-hdd-o',
'fa-bullhorn',
'fa-bell',
'fa-certificate',
'fa-hand-o-right',
'fa-hand-o-left',
'fa-hand-o-up',
'fa-hand-o-down',
'fa-arrow-circle-left',
'fa-arrow-circle-right',
'fa-arrow-circle-up',
'fa-arrow-circle-down',
'fa-globe',
'fa-wrench',
'fa-tasks',
'fa-filter',
'fa-briefcase',
'fa-arrows-alt',
'fa-users',
'fa-link',
'fa-cloud',
'fa-flask',
'fa-scissors',
'fa-files-o',
'fa-paperclip',
'fa-floppy-o',
'fa-square',
'fa-bars',
'fa-list-ul',
'fa-list-ol',
'fa-strikethrough',
'fa-underline',
'fa-table',
'fa-magic',
'fa-truck',
'fa-pinterest',
'fa-pinterest-square',
'fa-google-plus-square',
'fa-google-plus',
'fa-money',
'fa-caret-down',
'fa-caret-up',
'fa-caret-left',
'fa-caret-right',
'fa-columns',
'fa-sort',
'fa-sort-asc',
'fa-sort-desc',
'fa-envelope',
'fa-linkedin',
'fa-undo',
'fa-gavel',
'fa-tachometer',
'fa-comment-o',
'fa-comments-o',
'fa-bolt',
'fa-sitemap',
'fa-umbrella',
'fa-clipboard',
'fa-lightbulb-o',
'fa-exchange',
'fa-cloud-download',
'fa-cloud-upload',
'fa-user-md',
'fa-stethoscope',
'fa-suitcase',
'fa-bell-o',
'fa-coffee',
'fa-cutlery',
'fa-file-text-o',
'fa-building-o',
'fa-hospital-o',
'fa-ambulance',
'fa-medkit',
'fa-fighter-jet',
'fa-beer',
'fa-h-square',
'fa-plus-square',
'fa-angle-double-left',
'fa-angle-double-right',
'fa-angle-double-up',
'fa-angle-double-down',
'fa-angle-left',
'fa-angle-right',
'fa-angle-up',
'fa-angle-down',
'fa-desktop',
'fa-laptop',
'fa-tablet',
'fa-mobile',
'fa-circle-o',
'fa-quote-left',
'fa-quote-right',
'fa-spinner',
'fa-circle',
'fa-reply',
'fa-github-alt',
'fa-folder-o',
'fa-folder-open-o',
'fa-smile-o',
'fa-frown-o',
'fa-meh-o',
'fa-gamepad',
'fa-keyboard-o',
'fa-flag-o',
'fa-flag-checkered',
'fa-terminal',
'fa-code',
'fa-reply-all',
'fa-mail-reply-all',
'fa-star-half-o',
'fa-location-arrow',
'fa-crop',
'fa-code-fork',
'fa-chain-broken',
'fa-question',
'fa-info',
'fa-exclamation',
'fa-superscript',
'fa-subscript',
'fa-eraser',
'fa-puzzle-piece',
'fa-microphone',
'fa-microphone-slash',
'fa-shield',
'fa-calendar-o',
'fa-fire-extinguisher',
'fa-rocket',
'fa-maxcdn',
'fa-chevron-circle-left',
'fa-chevron-circle-right',
'fa-chevron-circle-up',
'fa-chevron-circle-down',
'fa-html5',
'fa-css3',
'fa-anchor',
'fa-unlock-alt',
'fa-bullseye',
'fa-ellipsis-h',
'fa-ellipsis-v',
'fa-rss-square',
'fa-play-circle',
'fa-ticket',
'fa-minus-square',
'fa-minus-square-o',
'fa-level-up',
'fa-level-down',
'fa-check-square',
'fa-pencil-square',
'fa-external-link-square',
'fa-share-square',
'fa-compass',
'fa-caret-square-o-down',
'fa-caret-square-o-up',
'fa-caret-square-o-right',
'fa-eur',
'fa-gbp',
'fa-usd',
'fa-inr',
'fa-jpy',
'fa-rub',
'fa-krw',
'fa-btc',
'fa-file',
'fa-file-text',
'fa-sort-alpha-asc',
'fa-sort-alpha-desc',
'fa-sort-amount-asc',
'fa-sort-amount-desc',
'fa-sort-numeric-asc',
'fa-sort-numeric-desc',
'fa-thumbs-up',
'fa-thumbs-down',
'fa-youtube-square',
'fa-youtube',
'fa-xing',
'fa-xing-square',
'fa-youtube-play',
'fa-dropbox',
'fa-stack-overflow',
'fa-instagram',
'fa-flickr',
'fa-adn',
'fa-bitbucket',
'fa-bitbucket-square',
'fa-tumblr',
'fa-tumblr-square',
'fa-long-arrow-down',
'fa-long-arrow-up',
'fa-long-arrow-left',
'fa-long-arrow-right',
'fa-apple',
'fa-windows',
'fa-android',
'fa-linux',
'fa-dribbble',
'fa-skype',
'fa-foursquare',
'fa-trello',
'fa-female',
'fa-male',
'fa-gittip',
'fa-sun-o',
'fa-moon-o',
'fa-archive',
'fa-bug',
'fa-vk',
'fa-weibo',
'fa-renren',
'fa-pagelines',
'fa-stack-exchange',
'fa-arrow-circle-o-right',
'fa-arrow-circle-o-left',
'fa-caret-square-o-left',
'fa-dot-circle-o',
'fa-wheelchair',
'fa-vimeo-square',
'fa-try',
'fa-plus-square-o',
'fa-space-shuttle',
'fa-slack',
'fa-envelope-square',
'fa-wordpress',
'fa-openid',
'fa-institution',
'fa-bank',
'fa-university',
'fa-mortar-board',
'fa-graduation-cap',
'fa-yahoo',
'fa-google',
'fa-reddit',
'fa-reddit-square',
'fa-stumbleupon-circle',
'fa-stumbleupon',
'fa-delicious',
'fa-digg',
'fa-pied-piper-square',
'fa-pied-piper',
'fa-pied-piper-alt',
'fa-drupal',
'fa-joomla',
'fa-language',
'fa-fax',
'fa-building',
'fa-child',
'fa-paw',
'fa-spoon',
'fa-cube',
'fa-cubes',
'fa-behance',
'fa-behance-square',
'fa-steam',
'fa-steam-square',
'fa-recycle',
'fa-automobile',
'fa-car',
'fa-cab',
'fa-tree',
'fa-spotify',
'fa-deviantart',
'fa-soundcloud',
'fa-database',
'fa-file-pdf-o',
'fa-file-word-o',
'fa-file-excel-o',
'fa-file-powerpoint-o',
'fa-file-photo-o',
'fa-file-picture-o',
'fa-file-image-o',
'fa-file-zip-o',
'fa-file-archive-o',
'fa-file-sound-o',
'fa-file-movie-o',
'fa-file-code-o',
'fa-vine',
'fa-codepen',
'fa-jsfiddle',
'fa-life-bouy',
'fa-support',
'fa-life-ring',
'fa-circle-o-notch',
'fa-rebel',
'fa-empire',
'fa-git-square',
'fa-git',
'fa-hacker-news',
'fa-tencent-weibo',
'fa-qq',
'fa-wechat',
'fa-send',
'fa-paper-plane',
'fa-send-o',
'fa-paper-plane-o',
'fa-history',
'fa-circle-thin',
'fa-header',
'fa-paragraph',
'fa-sliders',
'fa-share-alt',
'fa-share-alt-square',
'fa-bomb',
'fa-soccer-ball',
'fa-futbol-o',
'fa-tty',
'fa-binoculars',
'fa-plug',
'fa-slideshare',
'fa-twitch',
'fa-yelp',
'fa-newspaper-o',
'fa-wifi',
'fa-calculator',
'fa-paypal',
'fa-google-wallet',
'fa-cc-visa',
'fa-cc-mastercard',
'fa-cc-discover',
'fa-cc-amex',
'fa-cc-paypal',
'fa-cc-stripe',
'fa-bell-slash',
'fa-bell-slash-o',
'fa-trash',
'fa-copyright',
'fa-at',
'fa-eyedropper',
'fa-paint-brush',
'fa-birthday-cake',
'fa-area-chart',
'fa-pie-chart',
'fa-line-chart',
'fa-lastfm',
'fa-lastfm-square',
'fa-toggle-off',
'fa-toggle-on',
'fa-bicycle',
'fa-bus',
'fa-ioxhost',
'fa-angellist',
'fa-cc',
'fa-shekel',
'fa-sheqel',
'fa-ils',
'fa-meanpath',
);
}
public static function getFontIconColors() {
return array(
'bluegrey',
'white',
'red',
'orange',
'yellow',
'green',
'blue',
'sky',
'indigo',
'violet',
'pink',
'lightgreytext',
'lightbluetext',
);
}
}
diff --git a/src/view/phui/PHUIImageMaskView.php b/src/view/phui/PHUIImageMaskView.php
index 44233db93c..6d899841c3 100644
--- a/src/view/phui/PHUIImageMaskView.php
+++ b/src/view/phui/PHUIImageMaskView.php
@@ -1,116 +1,116 @@
<?php
final class PHUIImageMaskView extends AphrontTagView {
private $image;
private $withMask;
private $displayWidth;
private $displayHeight;
private $centerX;
private $centerY;
private $maskH;
private $maskW;
public function setImage($image) {
$this->image = $image;
return $this;
}
public function setDisplayWidth($width) {
$this->displayWidth = $width;
return $this;
}
public function setDisplayHeight($height) {
$this->displayHeight = $height;
return $this;
}
public function centerViewOnPoint($x, $y, $h, $w) {
$this->centerX = $x;
$this->centerY = $y;
$this->maskH = $h;
$this->maskW = $w;
return $this;
}
public function withMask($mask) {
$this->withMask = $mask;
return $this;
}
- public function getTagName() {
+ protected function getTagName() {
return 'div';
}
- public function getTagAttributes() {
+ protected function getTagAttributes() {
require_celerity_resource('phui-image-mask-css');
$classes = array();
$classes[] = 'phui-image-mask';
$styles = array();
$styles[] = 'height: '.$this->displayHeight.'px;';
$styles[] = 'width: '.$this->displayWidth.'px;';
return array(
'class' => implode(' ', $classes),
'styles' => implode(' ', $styles),
);
}
- public function getTagContent() {
+ protected function getTagContent() {
/* Center it in the middle of the selected area */
$center_x = round($this->centerX + ($this->maskW / 2));
$center_y = round($this->centerY + ($this->maskH / 2));
$center_x = round($center_x - ($this->displayWidth / 2));
$center_y = round($center_y - ($this->displayHeight / 2));
$center_x = -$center_x;
$center_y = -$center_y;
$classes = array();
$classes[] = 'phui-image-mask-image';
$styles = array();
$styles[] = 'height: '.$this->displayHeight.'px;';
$styles[] = 'width: '.$this->displayWidth.'px;';
$styles[] = 'background-image: url('.$this->image.');';
$styles[] = 'background-position: '.$center_x.'px '.$center_y.'px;';
$mask = null;
if ($this->withMask) {
/* The mask is a 300px border around a transparent box.
so we do the math here to position the box correctly. */
$border = 300;
$left = round((($this->displayWidth - $this->maskW) / 2) - $border);
$top = round((($this->displayHeight - $this->maskH) / 2) - $border);
$mstyles = array();
$mstyles[] = 'left: '.$left.'px;';
$mstyles[] = 'top: '.$top.'px;';
$mstyles[] = 'height: '.$this->maskH.'px;';
$mstyles[] = 'width: '.$this->maskW.'px;';
$mask = phutil_tag(
'span',
array(
'class' => 'phui-image-mask-mask',
'style' => implode(' ', $mstyles),
),
null);
}
return phutil_tag(
'div',
array(
'class' => implode(' ', $classes),
'style' => implode(' ', $styles),
),
$mask);
}
}
diff --git a/src/view/phui/PHUIListView.php b/src/view/phui/PHUIListView.php
index 3a7e9bd831..1d67b1b241 100644
--- a/src/view/phui/PHUIListView.php
+++ b/src/view/phui/PHUIListView.php
@@ -1,193 +1,193 @@
<?php
final class PHUIListView extends AphrontTagView {
const NAVBAR_LIST = 'phui-list-navbar';
const SIDENAV_LIST = 'phui-list-sidenav';
const TABBAR_LIST = 'phui-list-tabbar';
private $items = array();
private $type;
protected function canAppendChild() {
return false;
}
public function newLabel($name, $key = null) {
$item = id(new PHUIListItemView())
->setType(PHUIListItemView::TYPE_LABEL)
->setName($name);
if ($key !== null) {
$item->setKey($key);
}
$this->addMenuItem($item);
return $item;
}
public function newLink($name, $href, $key = null) {
$item = id(new PHUIListItemView())
->setType(PHUIListItemView::TYPE_LINK)
->setName($name)
->setHref($href);
if ($key !== null) {
$item->setKey($key);
}
$this->addMenuItem($item);
return $item;
}
public function newButton($name, $href) {
$item = id(new PHUIListItemView())
->setType(PHUIListItemView::TYPE_BUTTON)
->setName($name)
->setHref($href);
$this->addMenuItem($item);
return $item;
}
public function addMenuItem(PHUIListItemView $item) {
return $this->addMenuItemAfter(null, $item);
}
public function addMenuItemAfter($key, PHUIListItemView $item) {
if ($key === null) {
$this->items[] = $item;
return $this;
}
if (!$this->getItem($key)) {
throw new Exception(pht("No such key '%s' to add menu item after!",
$key));
}
$result = array();
foreach ($this->items as $other) {
$result[] = $other;
if ($other->getKey() == $key) {
$result[] = $item;
}
}
$this->items = $result;
return $this;
}
public function addMenuItemBefore($key, PHUIListItemView $item) {
if ($key === null) {
array_unshift($this->items, $item);
return $this;
}
$this->requireKey($key);
$result = array();
foreach ($this->items as $other) {
if ($other->getKey() == $key) {
$result[] = $item;
}
$result[] = $other;
}
$this->items = $result;
return $this;
}
public function addMenuItemToLabel($key, PHUIListItemView $item) {
$this->requireKey($key);
$other = $this->getItem($key);
if ($other->getType() != PHUIListItemView::TYPE_LABEL) {
throw new Exception(pht("Menu item '%s' is not a label!", $key));
}
$seen = false;
$after = null;
foreach ($this->items as $other) {
if (!$seen) {
if ($other->getKey() == $key) {
$seen = true;
}
} else {
if ($other->getType() == PHUIListItemView::TYPE_LABEL) {
break;
}
}
$after = $other->getKey();
}
return $this->addMenuItemAfter($after, $item);
}
private function requireKey($key) {
if (!$this->getItem($key)) {
throw new Exception(pht("No menu item with key '%s' exists!", $key));
}
}
public function getItem($key) {
$key = (string)$key;
// NOTE: We could optimize this, but need to update any map when items have
// their keys change. Since that's moderately complex, wait for a profile
// or use case.
foreach ($this->items as $item) {
if ($item->getKey() == $key) {
return $item;
}
}
return null;
}
public function getItems() {
return $this->items;
}
protected function willRender() {
$key_map = array();
foreach ($this->items as $item) {
$key = $item->getKey();
if ($key !== null) {
if (isset($key_map[$key])) {
throw new Exception(
pht("Menu contains duplicate items with key '%s'!", $key));
}
$key_map[$key] = $item;
}
}
}
- public function getTagName() {
+ protected function getTagName() {
return 'ul';
}
public function setType($type) {
$this->type = $type;
return $this;
}
protected function getTagAttributes() {
require_celerity_resource('phui-list-view-css');
$classes = array();
$classes[] = 'phui-list-view';
if ($this->type) {
$classes[] = $this->type;
}
return array(
'class' => implode(' ', $classes),
);
}
protected function getTagContent() {
return $this->items;
}
}
diff --git a/src/view/phui/PHUIObjectItemView.php b/src/view/phui/PHUIObjectItemView.php
index 389e2c1c81..82a39a3cb0 100644
--- a/src/view/phui/PHUIObjectItemView.php
+++ b/src/view/phui/PHUIObjectItemView.php
@@ -1,668 +1,668 @@
<?php
final class PHUIObjectItemView extends AphrontTagView {
private $objectName;
private $header;
private $subhead;
private $href;
private $attributes = array();
private $icons = array();
private $barColor;
private $object;
private $effect;
private $footIcons = array();
private $handleIcons = array();
private $bylines = array();
private $grippable;
private $actions = array();
private $headIcons = array();
private $disabled;
private $imageURI;
private $state;
private $fontIcon;
private $imageIcon;
const AGE_FRESH = 'fresh';
const AGE_STALE = 'stale';
const AGE_OLD = 'old';
const STATE_SUCCESS = 'green';
const STATE_FAIL = 'red';
const STATE_WARN = 'yellow';
const STATE_NOTE = 'blue';
const STATE_BUILD = 'sky';
public function setDisabled($disabled) {
$this->disabled = $disabled;
return $this;
}
public function getDisabled() {
return $this->disabled;
}
public function addHeadIcon($icon) {
$this->headIcons[] = $icon;
return $this;
}
public function setObjectName($name) {
$this->objectName = $name;
return $this;
}
public function setGrippable($grippable) {
$this->grippable = $grippable;
return $this;
}
public function getGrippable() {
return $this->grippable;
}
public function setEffect($effect) {
$this->effect = $effect;
return $this;
}
public function getEffect() {
return $this->effect;
}
public function setObject($object) {
$this->object = $object;
return $this;
}
public function getObject() {
return $this->object;
}
public function setHref($href) {
$this->href = $href;
return $this;
}
public function getHref() {
return $this->href;
}
public function setHeader($header) {
$this->header = $header;
return $this;
}
public function setSubHead($subhead) {
$this->subhead = $subhead;
return $this;
}
public function getHeader() {
return $this->header;
}
public function addByline($byline) {
$this->bylines[] = $byline;
return $this;
}
public function setImageURI($image_uri) {
$this->imageURI = $image_uri;
return $this;
}
public function getImageURI() {
return $this->imageURI;
}
public function setImageIcon($image_icon) {
$this->imageIcon = $image_icon;
return $this;
}
public function getImageIcon() {
return $this->imageIcon;
}
public function setState($state) {
$this->state = $state;
switch ($state) {
case self::STATE_SUCCESS:
$fi = 'fa-check-circle green';
break;
case self::STATE_FAIL:
$fi = 'fa-times-circle red';
break;
case self::STATE_WARN:
$fi = 'fa-exclamation-circle yellow';
break;
case self::STATE_NOTE:
$fi = 'fa-info-circle blue';
break;
case self::STATE_BUILD:
$fi = 'fa-refresh ph-spin sky';
break;
}
$this->fontIcon = id(new PHUIIconView())
->setIconFont($fi.' fa-2x');
return $this;
}
public function setEpoch($epoch, $age = self::AGE_FRESH) {
$date = phabricator_datetime($epoch, $this->getUser());
$days = floor((time() - $epoch) / 60 / 60 / 24);
switch ($age) {
case self::AGE_FRESH:
$this->addIcon('none', $date);
break;
case self::AGE_STALE:
$attr = array(
'tip' => pht('Stale (%s day(s))', new PhutilNumber($days)),
'class' => 'icon-age-stale',
);
$this->addIcon('fa-clock-o yellow', $date, $attr);
break;
case self::AGE_OLD:
$attr = array(
'tip' => pht('Old (%s day(s))', new PhutilNumber($days)),
'class' => 'icon-age-old',
);
$this->addIcon('fa-clock-o red', $date, $attr);
break;
default:
throw new Exception("Unknown age '{$age}'!");
}
return $this;
}
public function addAction(PHUIListItemView $action) {
if (count($this->actions) >= 3) {
throw new Exception('Limit 3 actions per item.');
}
$this->actions[] = $action;
return $this;
}
public function addIcon($icon, $label = null, $attributes = array()) {
$this->icons[] = array(
'icon' => $icon,
'label' => $label,
'attributes' => $attributes,
);
return $this;
}
public function addFootIcon($icon, $label = null) {
$this->footIcons[] = array(
'icon' => $icon,
'label' => $label,
);
return $this;
}
public function addHandleIcon(
PhabricatorObjectHandle $handle,
$label = null) {
$this->handleIcons[] = array(
'icon' => $handle,
'label' => $label,
);
return $this;
}
public function setBarColor($bar_color) {
$this->barColor = $bar_color;
return $this;
}
public function getBarColor() {
return $this->barColor;
}
public function addAttribute($attribute) {
if (!empty($attribute)) {
$this->attributes[] = $attribute;
}
return $this;
}
protected function getTagName() {
return 'li';
}
protected function getTagAttributes() {
$item_classes = array();
$item_classes[] = 'phui-object-item';
if ($this->icons) {
$item_classes[] = 'phui-object-item-with-icons';
}
if ($this->attributes) {
$item_classes[] = 'phui-object-item-with-attrs';
}
if ($this->handleIcons) {
$item_classes[] = 'phui-object-item-with-handle-icons';
}
if ($this->barColor) {
$item_classes[] = 'phui-object-item-bar-color-'.$this->barColor;
}
if ($this->footIcons) {
$item_classes[] = 'phui-object-item-with-foot-icons';
}
if ($this->actions) {
$n = count($this->actions);
$item_classes[] = 'phui-object-item-with-actions';
$item_classes[] = 'phui-object-item-with-'.$n.'-actions';
}
if ($this->disabled) {
$item_classes[] = 'phui-object-item-disabled';
}
if ($this->state) {
$item_classes[] = 'phui-object-item-state-'.$this->state;
}
switch ($this->effect) {
case 'highlighted':
$item_classes[] = 'phui-object-item-highlighted';
break;
case 'selected':
$item_classes[] = 'phui-object-item-selected';
break;
case null:
break;
default:
throw new Exception(pht('Invalid effect!'));
}
if ($this->getGrippable()) {
$item_classes[] = 'phui-object-item-grippable';
}
if ($this->getImageURI()) {
$item_classes[] = 'phui-object-item-with-image';
}
if ($this->getImageIcon()) {
$item_classes[] = 'phui-object-item-with-image-icon';
}
if ($this->fontIcon) {
$item_classes[] = 'phui-object-item-with-ficon';
}
return array(
'class' => $item_classes,
);
}
- public function getTagContent() {
+ protected function getTagContent() {
$content_classes = array();
$content_classes[] = 'phui-object-item-content';
$header_name = null;
if ($this->objectName) {
$header_name = array(
phutil_tag(
'span',
array(
'class' => 'phui-object-item-objname',
),
$this->objectName),
' ',
);
}
$header_link = phutil_tag(
$this->href ? 'a' : 'div',
array(
'href' => $this->href,
'class' => 'phui-object-item-link',
'title' => ($this->href) ? $this->header : null,
),
$this->header);
$header = javelin_tag(
'div',
array(
'class' => 'phui-object-item-name',
'sigil' => 'slippery',
),
array(
$this->headIcons,
$header_name,
$header_link,
));
$icons = array();
if ($this->icons) {
$icon_list = array();
foreach ($this->icons as $spec) {
$icon = $spec['icon'];
$icon = id(new PHUIIconView())
->setIconFont($icon)
->addClass('phui-object-item-icon-image');
if (isset($spec['attributes']['tip'])) {
$sigil = 'has-tooltip';
$meta = array(
'tip' => $spec['attributes']['tip'],
'align' => 'W',
);
$icon->addSigil($sigil);
$icon->setMetadata($meta);
}
$label = phutil_tag(
'span',
array(
'class' => 'phui-object-item-icon-label',
),
$spec['label']);
if (isset($spec['attributes']['href'])) {
$icon_href = phutil_tag(
'a',
array('href' => $spec['attributes']['href']),
array($icon, $label));
} else {
$icon_href = array($icon, $label);
}
$classes = array();
$classes[] = 'phui-object-item-icon';
if (isset($spec['attributes']['class'])) {
$classes[] = $spec['attributes']['class'];
}
$icon_list[] = javelin_tag(
'li',
array(
'class' => implode(' ', $classes),
),
$icon_href);
}
$icons[] = phutil_tag(
'ul',
array(
'class' => 'phui-object-item-icons',
),
$icon_list);
}
if ($this->handleIcons) {
$handle_bar = array();
foreach ($this->handleIcons as $icon) {
$handle_bar[] = $this->renderHandleIcon($icon['icon'], $icon['label']);
}
$icons[] = phutil_tag(
'div',
array(
'class' => 'phui-object-item-handle-icons',
),
$handle_bar);
}
$bylines = array();
if ($this->bylines) {
foreach ($this->bylines as $byline) {
$bylines[] = phutil_tag(
'div',
array(
'class' => 'phui-object-item-byline',
),
$byline);
}
$bylines = phutil_tag(
'div',
array(
'class' => 'phui-object-item-bylines',
),
$bylines);
}
$subhead = null;
if ($this->subhead) {
$subhead = phutil_tag(
'div',
array(
'class' => 'phui-object-item-subhead',
),
$this->subhead);
}
if ($icons) {
$icons = phutil_tag(
'div',
array(
'class' => 'phui-object-icon-pane',
),
$icons);
}
$attrs = null;
if ($this->attributes) {
$attrs = array();
$spacer = phutil_tag(
'span',
array(
'class' => 'phui-object-item-attribute-spacer',
),
"\xC2\xB7");
$first = true;
foreach ($this->attributes as $attribute) {
$attrs[] = phutil_tag(
'li',
array(
'class' => 'phui-object-item-attribute',
),
array(
($first ? null : $spacer),
$attribute,
));
$first = false;
}
$attrs = phutil_tag(
'ul',
array(
'class' => 'phui-object-item-attributes',
),
$attrs);
}
$foot = null;
if ($this->footIcons) {
$foot_bar = array();
foreach ($this->footIcons as $icon) {
$foot_bar[] = $this->renderFootIcon($icon['icon'], $icon['label']);
}
$foot = phutil_tag(
'div',
array(
'class' => 'phui-object-item-foot-icons',
),
$foot_bar);
}
$grippable = null;
if ($this->getGrippable()) {
$grippable = phutil_tag(
'div',
array(
'class' => 'phui-object-item-grip',
),
'');
}
$content = phutil_tag(
'div',
array(
'class' => implode(' ', $content_classes),
),
array(
$subhead,
$attrs,
$this->renderChildren(),
$foot,
));
$image = null;
if ($this->getImageURI()) {
$image = phutil_tag(
'div',
array(
'class' => 'phui-object-item-image',
'style' => 'background-image: url('.$this->getImageURI().')',
),
'');
} else if ($this->getImageIcon()) {
$image = phutil_tag(
'div',
array(
'class' => 'phui-object-item-image-icon',
),
$this->getImageIcon());
}
if ($image && $this->href) {
$image = phutil_tag(
'a',
array(
'href' => $this->href,
),
$image);
}
$ficon = null;
if ($this->fontIcon) {
$image = phutil_tag(
'div',
array(
'class' => 'phui-object-item-ficon',
),
$this->fontIcon);
}
/* Build a fake table */
$column1 = phutil_tag(
'div',
array(
'class' => 'phui-object-item-col1',
),
array(
$header,
$content,
));
$column2 = null;
if ($icons || $bylines) {
$column2 = phutil_tag(
'div',
array(
'class' => 'phui-object-item-col2',
),
array(
$icons,
$bylines,));
}
$table = phutil_tag(
'div',
array(
'class' => 'phui-object-item-table',
),
phutil_tag_div('phui-object-item-table-row', array($column1, $column2)));
$box = phutil_tag(
'div',
array(
'class' => 'phui-object-item-content-box',
),
array(
$grippable,
$table,
));
$actions = array();
if ($this->actions) {
Javelin::initBehavior('phabricator-tooltips');
foreach (array_reverse($this->actions) as $action) {
$action->setRenderNameAsTooltip(true);
$actions[] = $action;
}
$actions = phutil_tag(
'ul',
array(
'class' => 'phui-object-item-actions',
),
$actions);
}
return phutil_tag(
'div',
array(
'class' => 'phui-object-item-frame',
),
array(
$actions,
$image,
$box,
));
}
private function renderFootIcon($icon, $label) {
$icon = id(new PHUIIconView())
->setIconFont($icon);
$label = phutil_tag(
'span',
array(
),
$label);
return phutil_tag(
'span',
array(
'class' => 'phui-object-item-foot-icon',
),
array($icon, $label));
}
private function renderHandleIcon(PhabricatorObjectHandle $handle, $label) {
Javelin::initBehavior('phabricator-tooltips');
$options = array(
'class' => 'phui-object-item-handle-icon',
'style' => 'background-image: url('.$handle->getImageURI().')',
);
if (strlen($label)) {
$options['sigil'] = 'has-tooltip';
$options['meta'] = array('tip' => $label);
}
return javelin_tag(
'span',
$options,
'');
}
}
diff --git a/src/view/phui/PHUIRemarkupPreviewPanel.php b/src/view/phui/PHUIRemarkupPreviewPanel.php
index 91ad7a4be4..8fa02f983c 100644
--- a/src/view/phui/PHUIRemarkupPreviewPanel.php
+++ b/src/view/phui/PHUIRemarkupPreviewPanel.php
@@ -1,135 +1,135 @@
<?php
/**
* Render a simple preview panel for a bound Remarkup text control.
*/
final class PHUIRemarkupPreviewPanel extends AphrontTagView {
private $header;
private $loadingText;
private $controlID;
private $previewURI;
private $skin = 'default';
protected function canAppendChild() {
return false;
}
public function setPreviewURI($preview_uri) {
$this->previewURI = $preview_uri;
return $this;
}
public function setControlID($control_id) {
$this->controlID = $control_id;
return $this;
}
public function setHeader($header) {
$this->header = $header;
return $this;
}
public function setLoadingText($loading_text) {
$this->loadingText = $loading_text;
return $this;
}
public function setSkin($skin) {
static $skins = array(
'default' => true,
'document' => true,
);
if (empty($skins[$skin])) {
$valid = implode(', ', array_keys($skins));
throw new Exception("Invalid skin '{$skin}'. Valid skins are: {$valid}.");
}
$this->skin = $skin;
return $this;
}
- public function getTagName() {
+ protected function getTagName() {
return 'div';
}
- public function getTagAttributes() {
+ protected function getTagAttributes() {
$classes = array();
$classes[] = 'phui-remarkup-preview';
if ($this->skin) {
$classes[] = 'phui-remarkup-preview-skin-'.$this->skin;
}
return array(
'class' => $classes,
);
}
protected function getTagContent() {
if ($this->previewURI === null) {
throw new Exception('Call setPreviewURI() before rendering!');
}
if ($this->controlID === null) {
throw new Exception('Call setControlID() before rendering!');
}
$preview_id = celerity_generate_unique_node_id();
require_celerity_resource('phui-remarkup-preview-css');
Javelin::initBehavior(
'remarkup-preview',
array(
'previewID' => $preview_id,
'controlID' => $this->controlID,
'uri' => $this->previewURI,
));
$loading = phutil_tag(
'div',
array(
'class' => 'phui-preview-loading-text',
),
nonempty($this->loadingText, pht('Loading preview...')));
$header = null;
if ($this->header) {
$header = phutil_tag(
'div',
array(
'class' => 'phui-preview-header',
),
$this->header);
}
$preview = phutil_tag(
'div',
array(
'id' => $preview_id,
'class' => 'phabricator-remarkup',
),
$loading);
$content = array($header, $preview);
switch ($this->skin) {
case 'document':
$content = id(new PHUIDocumentView())
->appendChild($content)
->setFontKit(PHUIDocumentView::FONT_SOURCE_SANS);
break;
default:
$content = id(new PHUIBoxView())
->appendChild($content)
->setBorder(true)
->addMargin(PHUI::MARGIN_LARGE)
->addPadding(PHUI::PADDING_LARGE)
->addClass('phui-panel-preview');
break;
}
return $content;
}
}
diff --git a/src/view/phui/PHUIStatusListView.php b/src/view/phui/PHUIStatusListView.php
index 9200da4531..433efc9610 100644
--- a/src/view/phui/PHUIStatusListView.php
+++ b/src/view/phui/PHUIStatusListView.php
@@ -1,34 +1,34 @@
<?php
final class PHUIStatusListView extends AphrontTagView {
private $items;
public function addItem(PHUIStatusItemView $item) {
$this->items[] = $item;
return $this;
}
protected function canAppendChild() {
return false;
}
- public function getTagName() {
+ protected function getTagName() {
return 'table';
}
protected function getTagAttributes() {
require_celerity_resource('phui-status-list-view-css');
$classes = array();
$classes[] = 'phui-status-list-view';
return array(
'class' => implode(' ', $classes),
);
}
protected function getTagContent() {
return $this->items;
}
}
diff --git a/src/view/phui/PHUITagView.php b/src/view/phui/PHUITagView.php
index b85ebcc902..afca3a445e 100644
--- a/src/view/phui/PHUITagView.php
+++ b/src/view/phui/PHUITagView.php
@@ -1,253 +1,253 @@
<?php
final class PHUITagView extends AphrontTagView {
const TYPE_PERSON = 'person';
const TYPE_OBJECT = 'object';
const TYPE_STATE = 'state';
const TYPE_SHADE = 'shade';
const COLOR_RED = 'red';
const COLOR_ORANGE = 'orange';
const COLOR_YELLOW = 'yellow';
const COLOR_BLUE = 'blue';
const COLOR_INDIGO = 'indigo';
const COLOR_VIOLET = 'violet';
const COLOR_GREEN = 'green';
const COLOR_BLACK = 'black';
const COLOR_GREY = 'grey';
const COLOR_WHITE = 'white';
const COLOR_PINK = 'pink';
const COLOR_BLUEGREY = 'bluegrey';
const COLOR_CHECKERED = 'checkered';
const COLOR_DISABLED = 'disabled';
const COLOR_OBJECT = 'object';
const COLOR_PERSON = 'person';
private $type;
private $href;
private $name;
private $phid;
private $backgroundColor;
private $dotColor;
private $closed;
private $external;
private $icon;
private $shade;
private $slimShady;
public function setType($type) {
$this->type = $type;
switch ($type) {
case self::TYPE_SHADE:
break;
case self::TYPE_OBJECT:
$this->setBackgroundColor(self::COLOR_OBJECT);
break;
case self::TYPE_PERSON:
$this->setBackgroundColor(self::COLOR_PERSON);
break;
}
return $this;
}
public function setShade($shade) {
$this->shade = $shade;
return $this;
}
public function setDotColor($dot_color) {
$this->dotColor = $dot_color;
return $this;
}
public function setBackgroundColor($background_color) {
$this->backgroundColor = $background_color;
return $this;
}
public function setPHID($phid) {
$this->phid = $phid;
return $this;
}
public function setName($name) {
$this->name = $name;
return $this;
}
public function setHref($href) {
$this->href = $href;
return $this;
}
public function setClosed($closed) {
$this->closed = $closed;
return $this;
}
public function setIcon($icon) {
$this->icon = $icon;
return $this;
}
public function setSlimShady($mm) {
$this->slimShady = $mm;
return $this;
}
protected function getTagName() {
return strlen($this->href) ? 'a' : 'span';
}
protected function getTagAttributes() {
require_celerity_resource('phui-tag-view-css');
$classes = array(
'phui-tag-view',
'phui-tag-type-'.$this->type,
);
if ($this->shade) {
$classes[] = 'phui-tag-shade';
$classes[] = 'phui-tag-shade-'.$this->shade;
if ($this->slimShady) {
$classes[] = 'phui-tag-shade-slim';
}
}
if ($this->icon) {
$classes[] = 'phui-tag-icon-view';
}
if ($this->phid) {
Javelin::initBehavior('phabricator-hovercards');
$attributes = array(
'href' => $this->href,
'sigil' => 'hovercard',
'meta' => array(
'hoverPHID' => $this->phid,
),
'target' => $this->external ? '_blank' : null,
);
} else {
$attributes = array(
'href' => $this->href,
'target' => $this->external ? '_blank' : null,
);
}
return $attributes + array('class' => $classes);
}
- public function getTagContent() {
+ protected function getTagContent() {
if (!$this->type) {
throw new Exception(pht('You must call setType() before render()!'));
}
$color = null;
if (!$this->shade && $this->backgroundColor) {
$color = 'phui-tag-color-'.$this->backgroundColor;
}
if ($this->dotColor) {
$dotcolor = 'phui-tag-color-'.$this->dotColor;
$dot = phutil_tag(
'span',
array(
'class' => 'phui-tag-dot '.$dotcolor,
),
'');
} else {
$dot = null;
}
if ($this->icon) {
$icon = id(new PHUIIconView())
->setIconFont($this->icon);
} else {
$icon = null;
}
$content = phutil_tag(
'span',
array(
'class' => 'phui-tag-core '.$color,
),
array($dot, $this->name));
if ($this->closed) {
$content = phutil_tag(
'span',
array(
'class' => 'phui-tag-core-closed',
),
$content);
}
return array($icon, $content);
}
public static function getTagTypes() {
return array(
self::TYPE_PERSON,
self::TYPE_OBJECT,
self::TYPE_STATE,
);
}
public static function getColors() {
return array(
self::COLOR_RED,
self::COLOR_ORANGE,
self::COLOR_YELLOW,
self::COLOR_BLUE,
self::COLOR_INDIGO,
self::COLOR_VIOLET,
self::COLOR_GREEN,
self::COLOR_BLACK,
self::COLOR_GREY,
self::COLOR_WHITE,
self::COLOR_OBJECT,
self::COLOR_PERSON,
);
}
public static function getShades() {
return array_keys(self::getShadeMap());
}
public static function getShadeMap() {
return array(
self::COLOR_RED => pht('Red'),
self::COLOR_ORANGE => pht('Orange'),
self::COLOR_YELLOW => pht('Yellow'),
self::COLOR_BLUE => pht('Blue'),
self::COLOR_INDIGO => pht('Indigo'),
self::COLOR_VIOLET => pht('Violet'),
self::COLOR_GREEN => pht('Green'),
self::COLOR_GREY => pht('Grey'),
self::COLOR_PINK => pht('Pink'),
self::COLOR_CHECKERED => pht('Checkered'),
self::COLOR_DISABLED => pht('Disabled'),
);
}
public static function getShadeName($shade) {
return idx(self::getShadeMap(), $shade, $shade);
}
public function setExternal($external) {
$this->external = $external;
return $this;
}
public function getExternal() {
return $this->external;
}
}
diff --git a/src/view/phui/PHUITextView.php b/src/view/phui/PHUITextView.php
index d34883027e..e075e1f205 100644
--- a/src/view/phui/PHUITextView.php
+++ b/src/view/phui/PHUITextView.php
@@ -1,20 +1,20 @@
<?php
final class PHUITextView extends AphrontTagView {
private $text;
public function setText($text) {
$this->appendChild($text);
return $this;
}
- public function getTagName() {
+ protected function getTagName() {
return 'span';
}
- public function getTagAttributes() {
+ protected function getTagAttributes() {
require_celerity_resource('phui-text-css');
return array();
}
}
diff --git a/src/view/phui/PHUIWorkboardView.php b/src/view/phui/PHUIWorkboardView.php
index 948d1c5740..04a0941d70 100644
--- a/src/view/phui/PHUIWorkboardView.php
+++ b/src/view/phui/PHUIWorkboardView.php
@@ -1,82 +1,82 @@
<?php
final class PHUIWorkboardView extends AphrontTagView {
private $panels = array();
private $fluidLayout = false;
private $fluidishLayout = false;
private $actions = array();
public function addPanel(PHUIWorkpanelView $panel) {
$this->panels[] = $panel;
return $this;
}
public function setFluidLayout($layout) {
$this->fluidLayout = $layout;
return $this;
}
public function setFluidishLayout($layout) {
$this->fluidishLayout = $layout;
return $this;
}
public function addAction(PHUIIconView $action) {
$this->actions[] = $action;
return $this;
}
- public function getTagAttributes() {
+ protected function getTagAttributes() {
return array(
'class' => 'phui-workboard-view',
);
}
- public function getTagContent() {
+ protected function getTagContent() {
require_celerity_resource('phui-workboard-view-css');
$action_list = null;
if (!empty($this->actions)) {
$items = array();
foreach ($this->actions as $action) {
$items[] = phutil_tag(
'li',
array(
'class' => 'phui-workboard-action-item',
),
$action);
}
$action_list = phutil_tag(
'ul',
array(
'class' => 'phui-workboard-action-list',
),
$items);
}
$view = new AphrontMultiColumnView();
$view->setGutter(AphrontMultiColumnView::GUTTER_MEDIUM);
if ($this->fluidLayout) {
$view->setFluidLayout($this->fluidLayout);
}
if ($this->fluidishLayout) {
$view->setFluidishLayout($this->fluidishLayout);
}
foreach ($this->panels as $panel) {
$view->addColumn($panel);
}
$board = phutil_tag(
'div',
array(
'class' => 'phui-workboard-view-shadow',
),
$view);
return array(
$action_list,
$board,
);
}
}
diff --git a/src/view/phui/PHUIWorkpanelView.php b/src/view/phui/PHUIWorkpanelView.php
index 967ebd1d2c..6c2273f126 100644
--- a/src/view/phui/PHUIWorkpanelView.php
+++ b/src/view/phui/PHUIWorkpanelView.php
@@ -1,119 +1,119 @@
<?php
final class PHUIWorkpanelView extends AphrontTagView {
private $cards = array();
private $header;
private $subheader = null;
private $footerAction;
private $headerColor = PHUIActionHeaderView::HEADER_GREY;
private $headerActions = array();
private $headerTag;
private $headerIcon;
public function setHeaderIcon(PHUIIconView $header_icon) {
$this->headerIcon = $header_icon;
return $this;
}
public function getHeaderIcon() {
return $this->headerIcon;
}
public function setCards(PHUIObjectItemListView $cards) {
$this->cards[] = $cards;
return $this;
}
public function setHeader($header) {
$this->header = $header;
return $this;
}
public function setSubheader($subheader) {
$this->subheader = $subheader;
return $this;
}
public function setFooterAction(PHUIListItemView $footer_action) {
$this->footerAction = $footer_action;
return $this;
}
public function setHeaderColor($header_color) {
$this->headerColor = $header_color;
return $this;
}
public function addHeaderAction(PHUIIconView $action) {
$this->headerActions[] = $action;
return $this;
}
public function setHeaderTag(PHUITagView $tag) {
$this->headerTag = $tag;
return $this;
}
- public function getTagAttributes() {
+ protected function getTagAttributes() {
return array(
'class' => 'phui-workpanel-view',
);
}
- public function getTagContent() {
+ protected function getTagContent() {
require_celerity_resource('phui-workpanel-view-css');
$classes = array();
$classes[] = 'phui-workpanel-view-inner';
$footer = '';
if ($this->footerAction) {
$footer_tag = $this->footerAction;
$footer = phutil_tag(
'ul',
array(
'class' => 'phui-workpanel-footer-action mst ps',
),
$footer_tag);
}
$header = id(new PHUIActionHeaderView())
->setHeaderTitle($this->header)
->setHeaderSubtitle($this->subheader)
->setHeaderColor($this->headerColor);
if ($this->headerIcon) {
$header->setHeaderIcon($this->headerIcon);
}
if ($this->headerTag) {
$header->setTag($this->headerTag);
}
foreach ($this->headerActions as $action) {
$header->addAction($action);
}
$classes[] = 'phui-workpanel-'.$this->headerColor;
$body = phutil_tag(
'div',
array(
'class' => 'phui-workpanel-body',
),
$this->cards);
$view = phutil_tag(
'div',
array(
'class' => implode(' ', $classes),
),
array(
$header,
$body,
$footer,
));
return $view;
}
}
diff --git a/src/view/phui/calendar/PHUICalendarListView.php b/src/view/phui/calendar/PHUICalendarListView.php
index 953abc6d1a..b337efb0b4 100644
--- a/src/view/phui/calendar/PHUICalendarListView.php
+++ b/src/view/phui/calendar/PHUICalendarListView.php
@@ -1,130 +1,130 @@
<?php
final class PHUICalendarListView extends AphrontTagView {
private $events = array();
private $blankState;
public function addEvent(AphrontCalendarEventView $event) {
$this->events[] = $event;
return $this;
}
public function showBlankState($state) {
$this->blankState = $state;
return $this;
}
- public function getTagName() {
+ protected function getTagName() {
return 'div';
}
- public function getTagAttributes() {
+ protected function getTagAttributes() {
require_celerity_resource('phui-calendar-css');
require_celerity_resource('phui-calendar-list-css');
return array('class' => 'phui-calendar-day-list');
}
protected function getTagContent() {
if (!$this->blankState && empty($this->events)) {
return '';
}
$events = msort($this->events, 'getEpochStart');
$singletons = array();
$allday = false;
foreach ($events as $event) {
$color = $event->getColor();
if ($event->getAllDay()) {
$timelabel = pht('All Day');
} else {
$timelabel = phabricator_time(
$event->getEpochStart(),
$this->getUser());
}
$dot = phutil_tag(
'span',
array(
'class' => 'phui-calendar-list-dot',
),
'');
$title = phutil_tag(
'span',
array(
'class' => 'phui-calendar-list-title',
),
$this->renderEventLink($event, $allday));
$time = phutil_tag(
'span',
array(
'class' => 'phui-calendar-list-time',
),
$timelabel);
$singletons[] = phutil_tag(
'li',
array(
'class' => 'phui-calendar-list-item phui-calendar-'.$color,
),
array(
$dot,
$title,
$time,
));
}
if (empty($singletons)) {
$singletons[] = phutil_tag(
'li',
array(
'class' => 'phui-calendar-list-item-empty',
),
pht('Clear sailing ahead.'));
}
$list = phutil_tag(
'ul',
array(
'class' => 'phui-calendar-list',
),
$singletons);
return $list;
}
private function renderEventLink($event) {
Javelin::initBehavior('phabricator-tooltips');
if ($event->getMultiDay()) {
$tip = pht('%s, Until: %s', $event->getName(),
phabricator_date($event->getEpochEnd(), $this->getUser()));
} else {
$tip = pht('%s, Until: %s', $event->getName(),
phabricator_time($event->getEpochEnd(), $this->getUser()));
}
$description = $event->getDescription();
if (strlen($description) == 0) {
$description = pht('(%s)', $event->getName());
}
$anchor = javelin_tag(
'a',
array(
'sigil' => 'has-tooltip',
'class' => 'phui-calendar-item-link',
'href' => '/calendar/event/view/'.$event->getEventID().'/',
'meta' => array(
'tip' => $tip,
'size' => 200,
),
),
$description);
return $anchor;
}
}
diff --git a/src/view/phui/calendar/PHUICalendarWidgetView.php b/src/view/phui/calendar/PHUICalendarWidgetView.php
index 1f294abebd..d5e1d2d24a 100644
--- a/src/view/phui/calendar/PHUICalendarWidgetView.php
+++ b/src/view/phui/calendar/PHUICalendarWidgetView.php
@@ -1,39 +1,39 @@
<?php
final class PHUICalendarWidgetView extends AphrontTagView {
private $header;
private $list;
public function setHeader($date) {
$this->header = $date;
return $this;
}
public function setCalendarList(PHUICalendarListView $list) {
$this->list = $list;
return $this;
}
- public function getTagName() {
+ protected function getTagName() {
return 'div';
}
- public function getTagAttributes() {
+ protected function getTagAttributes() {
require_celerity_resource('phui-calendar-list-css');
return array('class' => 'phui-calendar-list-container');
}
protected function getTagContent() {
$header = id(new PHUIHeaderView())
->setHeader($this->header);
$box = id(new PHUIObjectBoxView())
->setHeader($header)
->setFlush(true)
->appendChild($this->list);
return $box;
}
}

File Metadata

Mime Type
text/x-diff
Expires
Sun, Jan 19, 17:29 (1 w, 5 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1126973
Default Alt Text
(84 KB)

Event Timeline