diff --git a/src/applications/auth/controller/config/PhabricatorAuthListController.php b/src/applications/auth/controller/config/PhabricatorAuthListController.php index ae5808ed78..c5d4f7ad77 100644 --- a/src/applications/auth/controller/config/PhabricatorAuthListController.php +++ b/src/applications/auth/controller/config/PhabricatorAuthListController.php @@ -1,137 +1,137 @@ getViewer(); $configs = id(new PhabricatorAuthProviderConfigQuery()) ->setViewer($viewer) ->execute(); $list = new PHUIObjectItemListView(); $can_manage = $this->hasApplicationCapability( AuthManageProvidersCapability::CAPABILITY); foreach ($configs as $config) { $item = new PHUIObjectItemView(); $id = $config->getID(); $edit_uri = $this->getApplicationURI('config/edit/'.$id.'/'); $enable_uri = $this->getApplicationURI('config/enable/'.$id.'/'); $disable_uri = $this->getApplicationURI('config/disable/'.$id.'/'); $provider = $config->getProvider(); if ($provider) { $name = $provider->getProviderName(); } else { $name = $config->getProviderType().' ('.$config->getProviderClass().')'; } $item->setHeader($name); if ($provider) { $item->setHref($edit_uri); } else { $item->addAttribute(pht('Provider Implementation Missing!')); } $domain = null; if ($provider) { $domain = $provider->getProviderDomain(); if ($domain !== 'self') { $item->addAttribute($domain); } } if ($config->getShouldAllowRegistration()) { $item->addAttribute(pht('Allows Registration')); } else { $item->addAttribute(pht('Does Not Allow Registration')); } if ($config->getIsEnabled()) { $item->setStatusIcon('fa-check-circle green'); $item->addAction( id(new PHUIListItemView()) ->setIcon('fa-times') ->setHref($disable_uri) ->setDisabled(!$can_manage) ->addSigil('workflow')); } else { $item->setStatusIcon('fa-ban red'); $item->addIcon('fa-ban grey', pht('Disabled')); $item->addAction( id(new PHUIListItemView()) ->setIcon('fa-plus') ->setHref($enable_uri) ->setDisabled(!$can_manage) ->addSigil('workflow')); } $list->addItem($item); } $list->setNoDataString( pht( '%s You have not added authentication providers yet. Use "%s" to add '. 'a provider, which will let users register new Phabricator accounts '. 'and log in.', phutil_tag( 'strong', array(), pht('No Providers Configured:')), phutil_tag( 'a', array( 'href' => $this->getApplicationURI('config/new/'), ), pht('Add Authentication Provider')))); $crumbs = $this->buildApplicationCrumbs(); $crumbs->addTextCrumb(pht('Auth Providers')); $crumbs->setBorder(true); $guidance_context = new PhabricatorAuthProvidersGuidanceContext(); $guidance = id(new PhabricatorGuidanceEngine()) ->setViewer($viewer) ->setGuidanceContext($guidance_context) ->newInfoView(); $button = id(new PHUIButtonView()) ->setTag('a') - ->setColor(PHUIButtonView::SIMPLE) + ->setButtonType(PHUIButtonView::BUTTONTYPE_SIMPLE) ->setHref($this->getApplicationURI('config/new/')) ->setIcon('fa-plus') ->setDisabled(!$can_manage) ->setText(pht('Add Provider')); $list->setFlush(true); $list = id(new PHUIObjectBoxView()) ->setHeaderText(pht('Providers')) ->setBackground(PHUIObjectBoxView::BLUE_PROPERTY) ->appendChild($list); $title = pht('Auth Providers'); $header = id(new PHUIHeaderView()) ->setHeader($title) ->setHeaderIcon('fa-key') ->addActionLink($button); $view = id(new PHUITwoColumnView()) ->setHeader($header) ->setFooter(array( $guidance, $list, )); return $this->newPage() ->setTitle($title) ->setCrumbs($crumbs) ->appendChild($view); } } diff --git a/src/applications/guides/view/PhabricatorGuideListView.php b/src/applications/guides/view/PhabricatorGuideListView.php index 04ab7c3058..089f325e0c 100644 --- a/src/applications/guides/view/PhabricatorGuideListView.php +++ b/src/applications/guides/view/PhabricatorGuideListView.php @@ -1,43 +1,43 @@ items[] = $item; return $this; } public function render() { $list = id(new PHUIObjectItemListView()) ->setBig(true); foreach ($this->items as $item) { $icon = id(new PHUIIconView()) ->setIcon($item->getIcon()) ->setBackground($item->getIconBackground()); $list_item = id(new PHUIObjectItemView()) ->setHeader($item->getTitle()) ->setHref($item->getHref()) ->setImageIcon($icon) ->addAttribute($item->getDescription()); $skip_href = $item->getSkipHref(); if ($skip_href) { $skip = id(new PHUIButtonView()) ->setText(pht('Skip')) ->setTag('a') ->setHref($skip_href) - ->setColor(PHUIButtonView::SIMPLE); + ->setButtonType(PHUIButtonView::BUTTONTYPE_SIMPLE); $list_item->setSideColumn($skip); } $list->addItem($list_item); } return $list; } } diff --git a/src/applications/phame/query/PhameBlogSearchEngine.php b/src/applications/phame/query/PhameBlogSearchEngine.php index 3d23a9763d..eaef32af1c 100644 --- a/src/applications/phame/query/PhameBlogSearchEngine.php +++ b/src/applications/phame/query/PhameBlogSearchEngine.php @@ -1,115 +1,115 @@ needProfileImage(true); } protected function buildQueryFromParameters(array $map) { $query = $this->newQuery(); if ($map['statuses']) { $query->withStatuses(array($map['statuses'])); } return $query; } protected function buildCustomSearchFields() { return array( id(new PhabricatorSearchSelectField()) ->setKey('statuses') ->setLabel(pht('Status')) ->setOptions(array( '' => pht('All'), PhameBlog::STATUS_ACTIVE => pht('Active'), PhameBlog::STATUS_ARCHIVED => pht('Archived'), )), ); } protected function getURI($path) { return '/phame/blog/'.$path; } protected function getBuiltinQueryNames() { $names = array( 'active' => pht('Active Blogs'), 'archived' => pht('Archived Blogs'), 'all' => pht('All Blogs'), ); return $names; } public function buildSavedQueryFromBuiltin($query_key) { $query = $this->newSavedQuery(); $query->setQueryKey($query_key); switch ($query_key) { case 'all': return $query; case 'active': return $query->setParameter( 'statuses', PhameBlog::STATUS_ACTIVE); case 'archived': return $query->setParameter( 'statuses', PhameBlog::STATUS_ARCHIVED); } return parent::buildSavedQueryFromBuiltin($query_key); } protected function renderResultList( array $blogs, PhabricatorSavedQuery $query, array $handles) { assert_instances_of($blogs, 'PhameBlog'); $viewer = $this->requireViewer(); $list = new PHUIObjectItemListView(); $list->setUser($viewer); foreach ($blogs as $blog) { $id = $blog->getID(); if ($blog->getDomain()) { $domain = $blog->getDomain(); } else { $domain = pht('Local Blog'); } $item = id(new PHUIObjectItemView()) ->setUser($viewer) ->setObject($blog) ->setHeader($blog->getName()) ->setImageURI($blog->getProfileImageURI()) ->setDisabled($blog->isArchived()) ->setHref($this->getApplicationURI("/blog/view/{$id}/")) ->addAttribute($domain); if (!$blog->isArchived()) { $button = id(new PHUIButtonView()) ->setTag('a') ->setText('New Post') ->setHref($this->getApplicationURI('/post/edit/?blog='.$id)) - ->setColor(PHUIButtonView::SIMPLE); + ->setButtonType(PHUIButtonView::BUTTONTYPE_SIMPLE); $item->setSideColumn($button); } $list->addItem($item); } $result = new PhabricatorApplicationSearchResultView(); $result->setObjectList($list); $result->setNoDataString(pht('No blogs found.')); return $result; } } diff --git a/src/applications/uiexample/examples/PHUIBoxExample.php b/src/applications/uiexample/examples/PHUIBoxExample.php index 7a2674da94..4a551de707 100644 --- a/src/applications/uiexample/examples/PHUIBoxExample.php +++ b/src/applications/uiexample/examples/PHUIBoxExample.php @@ -1,131 +1,131 @@ appendChild($content1), id(new PHUIBoxView()) ->appendChild($content2), id(new PHUIBoxView()) ->appendChild($content3), ); $layout2 = array( id(new PHUIBoxView()) ->appendChild($content1) ->addMargin(PHUI::MARGIN_SMALL_LEFT), id(new PHUIBoxView()) ->appendChild($content2) ->addMargin(PHUI::MARGIN_MEDIUM_LEFT) ->addMargin(PHUI::MARGIN_MEDIUM_TOP), id(new PHUIBoxView()) ->appendChild($content3) ->addMargin(PHUI::MARGIN_LARGE_LEFT) ->addMargin(PHUI::MARGIN_LARGE_TOP), ); $layout3 = array( id(new PHUIBoxView()) ->appendChild($content1) ->setBorder(true) ->addPadding(PHUI::PADDING_SMALL) ->addMargin(PHUI::MARGIN_LARGE_BOTTOM), id(new PHUIBoxView()) ->appendChild($content2) ->setBorder(true) ->addPadding(PHUI::PADDING_MEDIUM) ->addMargin(PHUI::MARGIN_LARGE_BOTTOM), id(new PHUIBoxView()) ->appendChild($content3) ->setBorder(true) ->addPadding(PHUI::PADDING_LARGE) ->addMargin(PHUI::MARGIN_LARGE_BOTTOM), ); $button = id(new PHUIButtonView()) - ->setTag('a') - ->setColor(PHUIButtonView::SIMPLE) - ->setIcon('fa-heart') - ->setText(pht('Such Wow')) - ->addClass(PHUI::MARGIN_SMALL_RIGHT); + ->setTag('a') + ->setButtonType(PHUIButtonView::BUTTONTYPE_SIMPLE) + ->setIcon('fa-heart') + ->setText(pht('Such Wow')) + ->addClass(PHUI::MARGIN_SMALL_RIGHT); $badge1 = id(new PHUIBadgeMiniView()) ->setIcon('fa-bug') ->setHeader(pht('Bugmeister')); $badge2 = id(new PHUIBadgeMiniView()) ->setIcon('fa-heart') ->setHeader(pht('Funder')) ->setQuality(PhabricatorBadgesQuality::UNCOMMON); $header = id(new PHUIHeaderView()) ->setHeader(pht('Fancy Box')) ->addActionLink($button) ->setSubheader(pht('Much Features')) ->addBadge($badge1) ->addBadge($badge2); $obj4 = id(new PHUIObjectBoxView()) ->setHeader($header) ->appendChild(id(new PHUIBoxView()) ->addPadding(PHUI::PADDING_MEDIUM) ->appendChild(pht('Such Fancy, Nice Box, Many Corners.'))); $head1 = id(new PHUIHeaderView()) ->setHeader(pht('Plain Box')); $head2 = id(new PHUIHeaderView()) ->setHeader(pht('Plain Box with space')); $head3 = id(new PHUIHeaderView()) ->setHeader(pht('Border Box with space')); $head4 = id(new PHUIHeaderView()) ->setHeader(pht('PHUIObjectBoxView')); $wrap1 = id(new PHUIBoxView()) ->appendChild($layout1) ->addMargin(PHUI::MARGIN_LARGE); $wrap2 = id(new PHUIBoxView()) ->appendChild($layout2) ->addMargin(PHUI::MARGIN_LARGE); $wrap3 = id(new PHUIBoxView()) ->appendChild($layout3) ->addMargin(PHUI::MARGIN_LARGE); return phutil_tag( 'div', array(), array( $head1, $wrap1, $head2, $wrap2, $head3, $wrap3, $head4, $obj4, )); } } diff --git a/src/applications/uiexample/examples/PHUIButtonBarExample.php b/src/applications/uiexample/examples/PHUIButtonBarExample.php index 1501770dcf..d7992aa830 100644 --- a/src/applications/uiexample/examples/PHUIButtonBarExample.php +++ b/src/applications/uiexample/examples/PHUIButtonBarExample.php @@ -1,95 +1,95 @@ getRequest(); $user = $request->getUser(); // Icon Buttons $icons = array( 'Go Back' => 'fa-chevron-left bluegrey', 'Choose Date' => 'fa-calendar bluegrey', 'Edit View' => 'fa-pencil bluegrey', 'Go Forward' => 'fa-chevron-right bluegrey', ); $button_bar1 = new PHUIButtonBarView(); foreach ($icons as $text => $icon) { $button = id(new PHUIButtonView()) ->setTag('a') ->setColor(PHUIButtonView::GREY) ->setTitle($text) ->setIcon($icon); $button_bar1->addButton($button); } $button_bar2 = new PHUIButtonBarView(); foreach ($icons as $text => $icon) { $button = id(new PHUIButtonView()) ->setTag('a') - ->setColor(PHUIButtonView::SIMPLE) + ->setButtonType(PHUIButtonView::BUTTONTYPE_SIMPLE) ->setTitle($text) ->setText($text); $button_bar2->addButton($button); } $button_bar3 = new PHUIButtonBarView(); foreach ($icons as $text => $icon) { $button = id(new PHUIButtonView()) ->setTag('a') - ->setColor(PHUIButtonView::SIMPLE) + ->setButtonType(PHUIButtonView::BUTTONTYPE_SIMPLE) ->setTitle($text) ->setTooltip($text) ->setIcon($icon); $button_bar3->addButton($button); } $button_bar4 = new PHUIButtonBarView(); $button_bar4->setBorderless(true); foreach ($icons as $text => $icon) { $button = id(new PHUIButtonView()) ->setTag('a') ->setTitle($text) ->setTooltip($text) ->setIcon($icon); $button_bar4->addButton($button); } $layout1 = id(new PHUIBoxView()) ->appendChild($button_bar1) ->addClass('ml'); $layout2 = id(new PHUIBoxView()) ->appendChild($button_bar2) ->addClass('mlr mll mlb'); $layout3 = id(new PHUIBoxView()) ->appendChild($button_bar3) ->addClass('mlr mll mlb'); $layout4 = id(new PHUIBoxView()) ->appendChild($button_bar4) ->addClass('mlr mll mlb'); $wrap1 = id(new PHUIObjectBoxView()) ->setHeaderText(pht('Button Bar Example')) ->appendChild($layout1) ->appendChild($layout2) ->appendChild($layout3) ->appendChild($layout4); return array($wrap1); } } diff --git a/src/applications/uiexample/examples/PHUIButtonExample.php b/src/applications/uiexample/examples/PHUIButtonExample.php index 900125cbc2..8f2e1e57a7 100644 --- a/src/applications/uiexample/examples/PHUIButtonExample.php +++ b/src/applications/uiexample/examples/PHUIButtonExample.php @@ -1,227 +1,227 @@ getRequest(); $user = $request->getUser(); $colors = array('', 'green', 'grey', 'disabled'); $sizes = array('', 'small'); $tags = array('a', 'button'); // phutil_tag $column = array(); foreach ($tags as $tag) { foreach ($colors as $color) { foreach ($sizes as $key => $size) { $class = implode(' ', array($color, $size)); if ($tag == 'a') { $class .= ' button'; } $column[$key][] = phutil_tag( $tag, array( 'class' => $class, ), phutil_utf8_ucwords($size.' '.$color.' '.$tag)); $column[$key][] = hsprintf('

'); } } } $column3 = array(); foreach ($colors as $color) { $caret = phutil_tag('span', array('class' => 'caret'), ''); $column3[] = phutil_tag( 'a', array( 'class' => $color.' button dropdown', ), array( phutil_utf8_ucwords($color.' Dropdown'), $caret, )); $column3[] = hsprintf('

'); } $layout1 = id(new AphrontMultiColumnView()) ->addColumn($column[0]) ->addColumn($column[1]) ->addColumn($column3) ->setFluidLayout(true) ->setGutter(AphrontMultiColumnView::GUTTER_MEDIUM); // PHUIButtonView $colors = array( null, PHUIButtonView::GREEN, PHUIButtonView::GREY, PHUIButtonView::DISABLED, ); $sizes = array(null, PHUIButtonView::SMALL); $column = array(); foreach ($colors as $color) { foreach ($sizes as $key => $size) { $column[$key][] = id(new PHUIButtonView()) ->setColor($color) ->setSize($size) ->setTag('a') ->setText(pht('Clicky')); $column[$key][] = hsprintf('

'); } } foreach ($colors as $color) { $column[2][] = id(new PHUIButtonView()) ->setColor($color) ->setTag('button') ->setText(pht('Button')) ->setDropdown(true); $column[2][] = hsprintf('

'); } $layout2 = id(new AphrontMultiColumnView()) ->addColumn($column[0]) ->addColumn($column[1]) ->addColumn($column[2]) ->setFluidLayout(true) ->setGutter(AphrontMultiColumnView::GUTTER_MEDIUM); // Icon Buttons $column = array(); $icons = array( 'Comment' => 'fa-comment', 'Give Token' => 'fa-trophy', 'Reverse Time' => 'fa-clock-o', 'Implode Earth' => 'fa-exclamation-triangle red', ); foreach ($icons as $text => $icon) { $column[] = id(new PHUIButtonView()) ->setTag('a') ->setColor(PHUIButtonView::GREY) ->setIcon($icon) ->setText($text) ->addClass(PHUI::MARGIN_SMALL_RIGHT); } $layout3 = id(new AphrontMultiColumnView()) ->addColumn($column) ->setFluidLayout(true) ->setGutter(AphrontMultiColumnView::GUTTER_MEDIUM); $icons = array( 'Subscribe' => 'fa-check-circle bluegrey', 'Edit' => 'fa-pencil bluegrey', ); - $colors = array( - PHUIButtonView::SIMPLE, + $designs = array( + PHUIButtonView::BUTTONTYPE_SIMPLE, ); $column = array(); - foreach ($colors as $color) { + foreach ($designs as $design) { foreach ($icons as $text => $icon) { $column[] = id(new PHUIButtonView()) ->setTag('a') - ->setColor($color) + ->setButtonType($design) ->setIcon($icon) ->setText($text) ->addClass(PHUI::MARGIN_SMALL_RIGHT); } } $layout4 = id(new AphrontMultiColumnView()) ->addColumn($column) ->setFluidLayout(true) ->setGutter(AphrontMultiColumnView::GUTTER_MEDIUM); // Baby Got Back Buttons $column = array(); $icons = array('Asana', 'Github', 'Facebook', 'Google', 'LDAP'); foreach ($icons as $icon) { $image = id(new PHUIIconView()) ->setSpriteSheet(PHUIIconView::SPRITE_LOGIN) ->setSpriteIcon($icon); $column[] = id(new PHUIButtonView()) ->setTag('a') ->setSize(PHUIButtonView::BIG) ->setColor(PHUIButtonView::GREY) ->setIcon($image) ->setText(pht('Login or Register')) ->setSubtext($icon) ->addClass(PHUI::MARGIN_MEDIUM_RIGHT); } $layout5 = id(new AphrontMultiColumnView()) ->addColumn($column) ->setFluidLayout(true) ->setGutter(AphrontMultiColumnView::GUTTER_MEDIUM); // Set it and forget it $head1 = id(new PHUIHeaderView()) ->setHeader('phutil_tag'); $head2 = id(new PHUIHeaderView()) ->setHeader('PHUIButtonView'); $head3 = id(new PHUIHeaderView()) ->setHeader(pht('Icon Buttons')); $head4 = id(new PHUIHeaderView()) ->setHeader(pht('Simple Buttons')); $head5 = id(new PHUIHeaderView()) ->setHeader(pht('Big Icon Buttons')); $wrap1 = id(new PHUIBoxView()) ->appendChild($layout1) ->addMargin(PHUI::MARGIN_LARGE); $wrap2 = id(new PHUIBoxView()) ->appendChild($layout2) ->addMargin(PHUI::MARGIN_LARGE); $wrap3 = id(new PHUIBoxView()) ->appendChild($layout3) ->addMargin(PHUI::MARGIN_LARGE); $wrap4 = id(new PHUIBoxView()) ->appendChild($layout4) ->addMargin(PHUI::MARGIN_LARGE); $wrap5 = id(new PHUIBoxView()) ->appendChild($layout5) ->addMargin(PHUI::MARGIN_LARGE); return array( $head1, $wrap1, $head2, $wrap2, $head3, $wrap3, $head4, $wrap4, $head5, $wrap5, ); } } diff --git a/src/view/phui/PHUIButtonView.php b/src/view/phui/PHUIButtonView.php index ac3f8aabe0..0d0e0f3363 100644 --- a/src/view/phui/PHUIButtonView.php +++ b/src/view/phui/PHUIButtonView.php @@ -1,224 +1,246 @@ 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 getColor() { return $this->color; } 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 setTooltip($text) { $this->tooltip = $text; return $this; } public function setNoCSS($no_css) { $this->noCSS = $no_css; return $this; } public function setHasCaret($has_caret) { $this->hasCaret = $has_caret; return $this; } public function getHasCaret() { return $this->hasCaret; } + public function setButtonType($button_type) { + $this->buttonType = $button_type; + return $this; + } + + public function getButtonType() { + return $this->buttonType; + } + public function setIcon($icon, $first = true) { if (!($icon instanceof PHUIIconView)) { $icon = id(new PHUIIconView()) ->setIcon($icon); } $this->icon = $icon; $this->iconFirst = $first; return $this; } protected function getTagName() { return $this->tag; } public function setDropdownMenu(PhabricatorActionListView $actions) { Javelin::initBehavior('phui-dropdown-menu'); $this->addSigil('phui-dropdown-menu'); $this->setMetadata($actions->getDropdownMenuMetadata()); return $this; } public function setDropdownMenuID($id) { Javelin::initBehavior('phui-dropdown-menu'); $this->addSigil('phui-dropdown-menu'); $this->setMetadata( array( 'menuID' => $id, )); return $this; } 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->iconFirst == false) { $classes[] = 'icon-last'; } if ($this->disabled) { $classes[] = 'disabled'; } + switch ($this->getButtonType()) { + case self::BUTTONTYPE_DEFAULT: + // Nothing special for default buttons. + break; + case self::BUTTONTYPE_SIMPLE: + $classes[] = 'simple'; + break; + } + $sigil = null; $meta = null; if ($this->tooltip) { Javelin::initBehavior('phabricator-tooltips'); require_celerity_resource('aphront-tooltip-css'); $sigil = 'has-tooltip'; $meta = array( 'tip' => $this->tooltip, ); } if ($this->noCSS) { $classes = array(); } return array( 'class' => $classes, 'href' => $this->href, 'name' => $this->name, 'title' => $this->title, 'sigil' => $sigil, 'meta' => $meta, ); } 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 || $this->getHasCaret()) { $caret = phutil_tag('span', array('class' => 'caret'), ''); } if ($this->iconFirst == true) { return array($icon, $text, $caret); } else { return array($text, $icon); } } } diff --git a/src/view/phui/PHUIDocumentViewPro.php b/src/view/phui/PHUIDocumentViewPro.php index d60cd78d44..51ecc3526e 100644 --- a/src/view/phui/PHUIDocumentViewPro.php +++ b/src/view/phui/PHUIDocumentViewPro.php @@ -1,145 +1,145 @@ setTall(true); $this->header = $header; return $this; } public function setBook($name, $description) { $this->bookname = $name; $this->bookdescription = $description; return $this; } public function setFluid($fluid) { $this->fluid = $fluid; return $this; } public function setToc($toc) { $this->toc = $toc; return $this; } public function setFoot($foot) { $this->foot = $foot; return $this; } protected function getTagAttributes() { $classes = array(); $classes[] = 'phui-document-container'; if ($this->fluid) { $classes[] = 'phui-document-fluid'; } if ($this->foot) { $classes[] = 'document-has-foot'; } return array( 'class' => implode(' ', $classes), ); } protected function getTagContent() { require_celerity_resource('phui-document-view-css'); require_celerity_resource('phui-document-view-pro-css'); Javelin::initBehavior('phabricator-reveal-content'); $classes = array(); $classes[] = 'phui-document-view'; $classes[] = 'phui-document-view-pro'; $book = null; if ($this->bookname) { $book = pht('%s (%s)', $this->bookname, $this->bookdescription); } $main_content = $this->renderChildren(); if ($book) { $this->header->setSubheader($book); } $table_of_contents = null; if ($this->toc) { $toc = array(); $toc_id = celerity_generate_unique_node_id(); $toc[] = id(new PHUIButtonView()) ->setTag('a') ->setIcon('fa-align-left') - ->setColor(PHUIButtonView::SIMPLE) + ->setButtonType(PHUIButtonView::BUTTONTYPE_SIMPLE) ->addClass('phui-document-toc') ->addSigil('jx-toggle-class') ->setMetaData(array( 'map' => array( $toc_id => 'phui-document-toc-open', ), )); $toc[] = phutil_tag( 'div', array( 'class' => 'phui-list-sidenav phui-document-toc-list', ), $this->toc); $table_of_contents = phutil_tag( 'div', array( 'class' => 'phui-document-toc-container', 'id' => $toc_id, ), $toc); } $foot_content = null; if ($this->foot) { $foot_content = phutil_tag( 'div', array( 'class' => 'phui-document-foot-content', ), $this->foot); } $content_inner = phutil_tag( 'div', array( 'class' => 'phui-document-inner', ), array( $table_of_contents, $this->header, $main_content, $foot_content, )); $content = phutil_tag( 'div', array( 'class' => 'phui-document-content', ), $content_inner); return phutil_tag( 'div', array( 'class' => implode(' ', $classes), ), $content); } }