protected function getHead() { $framebust = null; if (!$this->getFrameable()) { $framebust = '(top == self) || top.location.replace(self.location.href);'; } $viewport_tag = null; if ($this->getDeviceReady()) { $viewport_tag = phutil_tag('meta', array('name' => 'viewport', 'content' => 'width=device-width, ' . 'initial-scale=1, ' . 'maximum-scale=1')); } $mask_icon = phutil_tag('link', array('rel' => 'mask-icon', 'color' => '#3D4B67', 'href' => celerity_get_resource_uri('/rsrc/favicons/mask-icon.svg'))); $icon_tag_76 = phutil_tag('link', array('rel' => 'apple-touch-icon', 'href' => celerity_get_resource_uri('/rsrc/favicons/apple-touch-icon-76x76.png'))); $icon_tag_120 = phutil_tag('link', array('rel' => 'apple-touch-icon', 'sizes' => '120x120', 'href' => celerity_get_resource_uri('/rsrc/favicons/apple-touch-icon-120x120.png'))); $icon_tag_152 = phutil_tag('link', array('rel' => 'apple-touch-icon', 'sizes' => '152x152', 'href' => celerity_get_resource_uri('/rsrc/favicons/apple-touch-icon-152x152.png'))); $favicon_tag = phutil_tag('link', array('id' => 'favicon', 'rel' => 'shortcut icon', 'href' => celerity_get_resource_uri('/rsrc/favicons/favicon.ico'))); $referrer_tag = phutil_tag('meta', array('name' => 'referrer', 'content' => 'never')); $response = CelerityAPI::getStaticResourceResponse(); if ($this->getRequest()) { $viewer = $this->getRequest()->getViewer(); if ($viewer) { $postprocessor_key = $viewer->getUserSetting(PhabricatorAccessibilitySetting::SETTINGKEY); if (strlen($postprocessor_key)) { $response->setPostProcessorKey($postprocessor_key); } } } $developer = PhabricatorEnv::getEnvConfig('phabricator.developer-mode'); return hsprintf('%s%s%s%s%s%s%s%s%s', $viewport_tag, $mask_icon, $icon_tag_76, $icon_tag_120, $icon_tag_152, $favicon_tag, $referrer_tag, CelerityStaticResourceResponse::renderInlineScript($framebust . jsprintf('window.__DEV__=%d;', $developer ? 1 : 0)), $response->renderResourcesOfType('css')); }
protected function getHead() { $framebust = null; if (!$this->getFrameable()) { $framebust = '(top == self) || top.location.replace(self.location.href);'; } $viewport_tag = null; if ($this->getDeviceReady()) { $viewport_tag = phutil_tag('meta', array('name' => 'viewport', 'content' => 'width=device-width, ' . 'initial-scale=1, ' . 'maximum-scale=1')); } $icon_tag_76 = phutil_tag('link', array('rel' => 'apple-touch-icon', 'href' => celerity_get_resource_uri('/rsrc/favicons/apple-touch-icon-76x76.png'))); $icon_tag_120 = phutil_tag('link', array('rel' => 'apple-touch-icon', 'sizes' => '120x120', 'href' => celerity_get_resource_uri('/rsrc/favicons/apple-touch-icon-120x120.png'))); $icon_tag_152 = phutil_tag('link', array('rel' => 'apple-touch-icon', 'sizes' => '152x152', 'href' => celerity_get_resource_uri('/rsrc/favicons/apple-touch-icon-152x152.png'))); $apple_tag = phutil_tag('meta', array('name' => 'apple-mobile-web-app-status-bar-style', 'content' => 'black-translucent')); $referrer_tag = phutil_tag('meta', array('name' => 'referrer', 'content' => 'never')); $response = CelerityAPI::getStaticResourceResponse(); if ($this->getRequest()) { $viewer = $this->getRequest()->getViewer(); if ($viewer) { $postprocessor_key = $viewer->getPreference(PhabricatorUserPreferences::PREFERENCE_RESOURCE_POSTPROCESSOR); if (strlen($postprocessor_key)) { $response->setPostProcessorKey($postprocessor_key); } } } $developer = PhabricatorEnv::getEnvConfig('phabricator.developer-mode'); return hsprintf('%s%s%s%s%s%s%s%s', $viewport_tag, $icon_tag_76, $icon_tag_120, $icon_tag_152, $apple_tag, $referrer_tag, CelerityStaticResourceResponse::renderInlineScript($framebust . jsprintf('window.__DEV__=%d;', $developer ? 1 : 0)), $response->renderResourcesOfType('css')); }
public function render() { if (!$this->mock) { throw new Exception('Call setMock() before render()!'); } $mock = $this->mock; require_celerity_resource('javelin-behavior-pholio-mock-view'); $images = array(); $panel_id = celerity_generate_unique_node_id(); $viewport_id = celerity_generate_unique_node_id(); $ids = mpull($mock->getImages(), 'getID'); if ($this->imageID && isset($ids[$this->imageID])) { $selected_id = $this->imageID; } else { $selected_id = head_key($ids); } // TODO: We could maybe do a better job with tailoring this, which is the // image shown on the review stage. $nonimage_uri = celerity_get_resource_uri('rsrc/image/icon/fatcow/thumbnails/default.p100.png'); $engine = id(new PhabricatorMarkupEngine())->setViewer($this->getUser()); foreach ($mock->getAllImages() as $image) { $engine->addObject($image, 'default'); } $engine->process(); $current_set = 0; foreach ($mock->getAllImages() as $image) { $file = $image->getFile(); $metadata = $file->getMetadata(); $x = idx($metadata, PhabricatorFile::METADATA_IMAGE_WIDTH); $y = idx($metadata, PhabricatorFile::METADATA_IMAGE_HEIGHT); $is_obs = (bool) $image->getIsObsolete(); if (!$is_obs) { $current_set++; } $history_uri = '/pholio/image/history/' . $image->getID() . '/'; $images[] = array('id' => $image->getID(), 'fullURI' => $file->getBestURI(), 'stageURI' => $file->isViewableImage() ? $file->getBestURI() : $nonimage_uri, 'pageURI' => $this->getImagePageURI($image, $mock), 'downloadURI' => $file->getDownloadURI(), 'historyURI' => $history_uri, 'width' => $x, 'height' => $y, 'title' => $image->getName(), 'descriptionMarkup' => $engine->getOutput($image, 'default'), 'isObsolete' => (bool) $image->getIsObsolete(), 'isImage' => $file->isViewableImage(), 'isViewable' => $file->isViewableInBrowser()); } $navsequence = array(); foreach ($mock->getImages() as $image) { $navsequence[] = $image->getID(); } $full_icon = array(javelin_tag('span', array('aural' => true), pht('View Raw File')), id(new PHUIIconView())->setIconFont('fa-file-image-o')); $download_icon = array(javelin_tag('span', array('aural' => true), pht('Download File')), id(new PHUIIconView())->setIconFont('fa-download')); $login_uri = id(new PhutilURI('/login/'))->setQueryParam('next', (string) $this->getRequestURI()); $config = array('mockID' => $mock->getID(), 'panelID' => $panel_id, 'viewportID' => $viewport_id, 'commentFormID' => $this->getCommentFormID(), 'images' => $images, 'selectedID' => $selected_id, 'loggedIn' => $this->getUser()->isLoggedIn(), 'logInLink' => (string) $login_uri, 'navsequence' => $navsequence, 'fullIcon' => hsprintf('%s', $full_icon), 'downloadIcon' => hsprintf('%s', $download_icon), 'currentSetSize' => $current_set); Javelin::initBehavior('pholio-mock-view', $config); $mockview = ''; $mock_wrapper = javelin_tag('div', array('id' => $viewport_id, 'sigil' => 'mock-viewport', 'class' => 'pholio-mock-image-viewport'), ''); $image_header = javelin_tag('div', array('id' => 'mock-image-header', 'class' => 'pholio-mock-image-header'), ''); $mock_wrapper = javelin_tag('div', array('id' => $panel_id, 'sigil' => 'mock-panel touchable', 'class' => 'pholio-mock-image-panel'), array($image_header, $mock_wrapper)); $inline_comments_holder = javelin_tag('div', array('id' => 'mock-image-description', 'sigil' => 'mock-image-description', 'class' => 'mock-image-description'), ''); $mockview[] = phutil_tag('div', array('class' => 'pholio-mock-image-container', 'id' => 'pholio-mock-image-container'), array($mock_wrapper, $inline_comments_holder)); return $mockview; }
private function getFaviconURI($type = null) { switch ($type) { case 'message': return celerity_get_resource_uri('/rsrc/favicons/favicon-message.ico'); case 'mention': return celerity_get_resource_uri('/rsrc/favicons/favicon-mention.ico'); default: return celerity_get_resource_uri('/rsrc/favicons/favicon.ico'); } }
protected function getHead() { $framebust = null; if (!$this->getFrameable()) { $framebust = '(top == self) || top.location.replace(self.location.href);'; } $viewport_tag = null; if ($this->getDeviceReady()) { $viewport_tag = phutil_tag('meta', array('name' => 'viewport', 'content' => 'width=device-width, ' . 'initial-scale=1, ' . 'maximum-scale=1')); } $icon_tag = phutil_tag('link', array('rel' => 'apple-touch-icon', 'href' => celerity_get_resource_uri('/rsrc/image/apple-touch-icon.png'))); $apple_tag = phutil_tag('meta', array('name' => 'apple-mobile-web-app-status-bar-style', 'content' => 'black-translucent')); $referrer_tag = phutil_tag('meta', array('name' => 'referrer', 'content' => 'never')); $response = CelerityAPI::getStaticResourceResponse(); $developer = PhabricatorEnv::getEnvConfig('phabricator.developer-mode'); return hsprintf('%s%s%s%s%s%s', $viewport_tag, $icon_tag, $apple_tag, $referrer_tag, CelerityStaticResourceResponse::renderInlineScript($framebust . jsprintf('window.__DEV__=%d;', $developer ? 1 : 0)), $response->renderResourcesOfType('css')); }
public function renderExample() { $image = celerity_get_resource_uri('/rsrc/image/examples/hero.png'); $display_height = 100; $display_width = 200; $mask1 = id(new PHUIImageMaskView())->addClass('ml')->setImage($image)->setDisplayHeight($display_height)->setDisplayWidth($display_width)->centerViewOnPoint(265, 185, 30, 140); $mask2 = id(new PHUIImageMaskView())->addClass('ml')->setImage($image)->setDisplayHeight($display_height)->setDisplayWidth($display_width)->centerViewOnPoint(18, 18, 40, 80); $mask3 = id(new PHUIImageMaskView())->addClass('ml')->setImage($image)->setDisplayHeight($display_height)->setDisplayWidth($display_width)->centerViewOnPoint(265, 185, 30, 140)->withMask(true); $mask4 = id(new PHUIImageMaskView())->addClass('ml')->setImage($image)->setDisplayHeight($display_height)->setDisplayWidth($display_width)->centerViewOnPoint(18, 18, 40, 80)->withMask(true); $mask5 = id(new PHUIImageMaskView())->addClass('ml')->setImage($image)->setDisplayHeight($display_height)->setDisplayWidth($display_width)->centerViewOnPoint(254, 272, 60, 240)->withMask(true); $box1 = id(new PHUIObjectBoxView())->setHeaderText(pht('Center is in the middle'))->appendChild($mask1); $box2 = id(new PHUIObjectBoxView())->setHeaderText(pht('Center is on an edge'))->appendChild($mask2); $box3 = id(new PHUIObjectBoxView())->setHeaderText(pht('Center Masked'))->appendChild($mask3); $box4 = id(new PHUIObjectBoxView())->setHeaderText(pht('Edge Masked'))->appendChild($mask4); $box5 = id(new PHUIObjectBoxView())->setHeaderText(pht('Wide Masked'))->appendChild($mask5); return phutil_tag('div', array(), array($box1, $box2, $box3, $box4, $box5)); }
public function renderExample() { $request = $this->getRequest(); $user = $request->getUser(); /* Basic Story */ $text = hsprintf('<strong><a>harding (Tom Harding)</a></strong> closed <a>' . 'D12: New spacer classes for blog views</a>.'); $story1 = id(new PHUIFeedStoryView())->setTitle($text)->setImage(celerity_get_resource_uri('/rsrc/image/people/harding.png'))->setImageHref('http://en.wikipedia.org/wiki/Warren_G._Harding')->setEpoch(1)->setAppIcon('fa-star')->setUser($user); /* Text Story, useful in Blogs, Ponders, Status */ $tokens = array('like-1', 'like-2', 'heart-1', 'heart-2'); $tokenview = array(); foreach ($tokens as $token) { $tokenview[] = id(new PHUIIconView())->setSpriteSheet(PHUIIconView::SPRITE_TOKENS)->setSpriteIcon($token); } $text = hsprintf('<strong><a>lincoln (Honest Abe)</a></strong> wrote a ' . 'new blog post.'); $story2 = id(new PHUIFeedStoryView())->setTitle($text)->setImage(celerity_get_resource_uri('/rsrc/image/people/lincoln.png'))->setImageHref('http://en.wikipedia.org/wiki/Abraham_Lincoln')->setEpoch(strtotime('November 19, 1863'))->setAppIcon('fa-star')->setUser($user)->setTokenBar($tokenview)->setPontification('Four score and seven years ago our fathers brought ' . 'forth on this continent, a new nation, conceived in Liberty, and ' . 'dedicated to the proposition that all men are created equal. ' . 'Now we are engaged in a great civil war, testing whether that ' . 'nation, or any nation so conceived and so dedicated, can long ' . 'endure. We are met on a great battle-field of that war. We have ' . 'come to dedicate a portion of that field, as a final resting ' . 'place for those who here gave their lives that that nation might ' . 'live. It is altogether fitting and proper that we should do this.', 'Gettysburg Address'); /* Action Story, let's give people tokens! */ $text = hsprintf('<strong><a>harding (Tom Harding)</a></strong> awarded ' . '<a>M10: Workboards</a> a token.'); $action1 = id(new PHUIIconView())->setIcon('fa-trophy bluegrey')->setHref('#'); $token = id(new PHUIIconView())->setSpriteSheet(PHUIIconView::SPRITE_TOKENS)->setSpriteIcon('like-1'); $story3 = id(new PHUIFeedStoryView())->setTitle($text)->setImage(celerity_get_resource_uri('/rsrc/image/people/harding.png'))->setImageHref('http://en.wikipedia.org/wiki/Warren_G._Harding')->appendChild($token)->setEpoch(1)->addAction($action1)->setAppIcon('fa-trophy')->setUser($user); /* Image Story, used in Pholio, Macro */ $text = hsprintf('<strong><a>wgharding (Warren Harding)</a></strong> ' . 'asked a new question.'); $action1 = id(new PHUIIconView())->setIcon('fa-chevron-up bluegrey')->setHref('#'); $action2 = id(new PHUIIconView())->setIcon('fa-chevron-down bluegrey')->setHref('#'); $story4 = id(new PHUIFeedStoryView())->setTitle($text)->setImage(celerity_get_resource_uri('/rsrc/image/people/harding.png'))->setImageHref('http://en.wikipedia.org/wiki/Warren_G._Harding')->setEpoch(1)->setAppIcon('fa-cogs')->setPontification('Why does inline-block add space under my spans and anchors?')->addAction($action1)->addAction($action2)->setUser($user); /* Text Story, useful in Blogs, Ponders, Status */ $text = hsprintf('<strong><a>lincoln (Honest Abe)</a></strong> updated ' . 'his status.'); $story5 = id(new PHUIFeedStoryView())->setTitle($text)->setImage(celerity_get_resource_uri('/rsrc/image/people/lincoln.png'))->setImageHref('http://en.wikipedia.org/wiki/Abraham_Lincoln')->setEpoch(strtotime('November 19, 1863'))->setAppIcon('fa-rocket')->setUser($user)->setPontification('If we ever create a lightweight status app ' . 'this story would be how that would be displayed.'); /* Basic "One Line" Story */ $text = hsprintf('<strong><a>harding (Tom Harding)</a></strong> updated <a>' . 'D12: New spacer classes for blog views</a>.'); $story6 = id(new PHUIFeedStoryView())->setTitle($text)->setImage(celerity_get_resource_uri('/rsrc/image/people/harding.png'))->setImageHref('http://en.wikipedia.org/wiki/Warren_G._Harding')->setEpoch(1)->setAppIcon('fa-wifi')->setUser($user); $head1 = id(new PHUIHeaderView())->setHeader(pht('Basic Story')); $head2 = id(new PHUIHeaderView())->setHeader(pht('Title / Text Story')); $head3 = id(new PHUIHeaderView())->setHeader(pht('Token Story')); $head4 = id(new PHUIHeaderView())->setHeader(pht('Action Story')); $head5 = id(new PHUIHeaderView())->setHeader(pht('Status Story')); $head6 = id(new PHUIHeaderView())->setHeader(pht('One Line Story')); $wrap1 = array(id(new PHUIBoxView())->appendChild($story1)->addMargin(PHUI::MARGIN_MEDIUM)->addPadding(PHUI::PADDING_SMALL)); $wrap2 = array(id(new PHUIBoxView())->appendChild($story2)->addMargin(PHUI::MARGIN_MEDIUM)->addPadding(PHUI::PADDING_SMALL)); $wrap3 = array(id(new PHUIBoxView())->appendChild($story3)->addMargin(PHUI::MARGIN_MEDIUM)->addPadding(PHUI::PADDING_SMALL)); $wrap4 = array(id(new PHUIBoxView())->appendChild($story4)->addMargin(PHUI::MARGIN_MEDIUM)->addPadding(PHUI::PADDING_SMALL)); $wrap5 = array(id(new PHUIBoxView())->appendChild($story5)->addMargin(PHUI::MARGIN_MEDIUM)->addPadding(PHUI::PADDING_SMALL)); $wrap6 = array(id(new PHUIBoxView())->appendChild($story6)->addMargin(PHUI::MARGIN_MEDIUM)->addPadding(PHUI::PADDING_SMALL)); return phutil_tag('div', array(), array($head1, $wrap1, $head2, $wrap2, $head3, $wrap3, $head4, $wrap4, $head5, $wrap5, $head6, $wrap6)); }
protected function renderInput() { require_celerity_resource('phabricator-flag-css'); $colors = PhabricatorFlagColor::getColorNameMap(); $value_map = array_fuse($this->getValue()); $file_map = array(PhabricatorFlagColor::COLOR_RED => 'red', PhabricatorFlagColor::COLOR_ORANGE => 'orange', PhabricatorFlagColor::COLOR_YELLOW => 'yellow', PhabricatorFlagColor::COLOR_GREEN => 'green', PhabricatorFlagColor::COLOR_BLUE => 'blue', PhabricatorFlagColor::COLOR_PINK => 'pink', PhabricatorFlagColor::COLOR_PURPLE => 'purple', PhabricatorFlagColor::COLOR_CHECKERED => 'finish'); $out = array(); foreach ($colors as $const => $name) { // TODO: This should probably be a sprite sheet. $partial = $file_map[$const]; $uri = '/rsrc/image/icon/fatcow/flag_' . $partial . '.png'; $uri = celerity_get_resource_uri($uri); $icon = id(new PHUIIconView())->setImage($uri); $input = phutil_tag('input', array('type' => 'checkbox', 'name' => $this->getName() . '[]', 'value' => $const, 'checked' => isset($value_map[$const]) ? 'checked' : null, 'class' => 'phabricator-flag-select-checkbox')); $label = phutil_tag('label', array('class' => 'phabricator-flag-select-label'), array($icon, $input)); $out[] = $label; } return $out; }
public function renderExample() { $request = $this->getRequest(); $user = $request->getUser(); $elements = array(); $diff_handle = $this->createBasicDummyHandle('D123', DifferentialRevisionPHIDType::TYPECONST, pht('Introduce cooler Differential Revisions')); $panel = $this->createPanel(pht('Differential Hovercard')); $panel->appendChild(id(new PhabricatorHovercardView())->setObjectHandle($diff_handle)->addField(pht('Author'), $user->getUsername())->addField(pht('Updated'), phabricator_datetime(time(), $user))->addAction(pht('Subscribe'), '/dev/random')->setUser($user)); $elements[] = $panel; $task_handle = $this->createBasicDummyHandle('T123', ManiphestTaskPHIDType::TYPECONST, pht('Improve Mobile Experience for Phabricator')); $tag = id(new PHUITagView())->setType(PHUITagView::TYPE_STATE)->setName(pht('Closed, Resolved')); $panel = $this->createPanel(pht('Maniphest Hovercard')); $panel->appendChild(id(new PhabricatorHovercardView())->setObjectHandle($task_handle)->setUser($user)->addField(pht('Assigned to'), $user->getUsername())->addField(pht('Dependent Tasks'), 'T123, T124, T125')->addAction(pht('Subscribe'), '/dev/random')->addAction(pht('Create Subtask'), '/dev/urandom')->addTag($tag)); $elements[] = $panel; $user_handle = $this->createBasicDummyHandle('gwashington', PhabricatorPeopleUserPHIDType::TYPECONST, 'George Washington'); $user_handle->setImageURI(celerity_get_resource_uri('/rsrc/image/people/washington.png')); $panel = $this->createPanel(pht('Whatevery Hovercard')); $panel->appendChild(id(new PhabricatorHovercardView())->setObjectHandle($user_handle)->addField(pht('Status'), pht('Available'))->addField(pht('Member since'), '30. February 1750')->addAction(pht('Send a Message'), '/dev/null')->setUser($user)); $elements[] = $panel; return phutil_implode_html('', $elements); }
public function renderExample() { $header1 = id(new PHUIHeaderView())->setHeader(pht('Conpherence')); $header2 = id(new PHUIHeaderView())->setHeader(pht('Diffusion')); $header3 = id(new PHUIHeaderView())->setHeader(pht('Backend Ops Projects')); $header4 = id(new PHUIHeaderView())->setHeader(pht('Revamp Liberty'))->setSubHeader(pht('For great justice'))->setImage(celerity_get_resource_uri('/rsrc/image/people/washington.png')); $header5 = id(new PHUIHeaderView())->setHeader(pht('Phacility Redesign'))->setSubHeader(pht('Move them pixels'))->setImage(celerity_get_resource_uri('/rsrc/image/people/harding.png')); $header6 = id(new PHUIHeaderView())->setHeader(pht('Python Phlux'))->setSubHeader(pht('No. Sleep. Till Brooklyn.'))->setImage(celerity_get_resource_uri('/rsrc/image/people/taft.png')); $column1 = id(new PHUIInfoPanelView())->setHeader($header1)->setColumns(3)->addInfoBlock(3, 'Needs Triage')->addInfoBlock(5, 'Unbreak Now')->addInfoBlock(0, 'High')->addInfoBlock(0, 'Normal')->addInfoBlock(12, 'Low')->addInfoBlock(123, 'Wishlist'); $column2 = id(new PHUIInfoPanelView())->setHeader($header2)->setColumns(3)->addInfoBlock(3, 'Needs Triage')->addInfoBlock(5, 'Unbreak Now')->addInfoBlock(0, 'High')->addInfoBlock(0, 'Normal')->addInfoBlock(12, 'Low')->addInfoBlock(123, 'Wishlist'); $column3 = id(new PHUIInfoPanelView())->setHeader($header3)->setColumns(3)->addInfoBlock(3, 'Needs Triage')->addInfoBlock(5, 'Unbreak Now')->addInfoBlock(0, 'High')->addInfoBlock(0, 'Normal')->addInfoBlock(12, 'Low')->addInfoBlock(123, 'Wishlist'); $column4 = id(new PHUIInfoPanelView())->setHeader($header4)->setColumns(3)->setProgress(90)->addInfoBlock(3, 'Needs Triage')->addInfoBlock(5, 'Unbreak Now')->addInfoBlock(0, 'High')->addInfoBlock(0, 'Normal')->addInfoBlock(0, 'Wishlist'); $column5 = id(new PHUIInfoPanelView())->setHeader($header5)->setColumns(2)->setProgress(25)->addInfoBlock(3, 'Needs Triage')->addInfoBlock(5, 'Unbreak Now')->addInfoBlock(0, 'High')->addInfoBlock(0, 'Normal'); $column6 = id(new PHUIInfoPanelView())->setHeader($header6)->setColumns(2)->setProgress(50)->addInfoBlock(3, 'Needs Triage')->addInfoBlock(5, 'Unbreak Now')->addInfoBlock(0, 'High')->addInfoBlock(0, 'Normal'); $layout1 = id(new AphrontMultiColumnView())->addColumn($column1)->addColumn($column2)->addColumn($column3)->setFluidLayout(true); $layout2 = id(new AphrontMultiColumnView())->addColumn($column4)->addColumn($column5)->addColumn($column6)->setFluidLayout(true); $head1 = id(new PHUIHeaderView())->setHeader(pht('Flagged')); $head2 = id(new PHUIHeaderView())->setHeader(pht('Sprints')); $wrap1 = id(new PHUIBoxView())->appendChild($layout1)->addMargin(PHUI::MARGIN_LARGE_BOTTOM); $wrap2 = id(new PHUIBoxView())->appendChild($layout2)->addMargin(PHUI::MARGIN_LARGE_BOTTOM); return phutil_tag('div', array(), array($head1, $wrap1, $head2, $wrap2)); }
private function buildDefaultTransformation(PhabricatorFile $file) { static $regexps = array('@application/zip@' => 'zip', '@image/@' => 'image', '@application/pdf@' => 'pdf', '@.*@' => 'default'); $type = $file->getMimeType(); $prefix = 'default'; foreach ($regexps as $regexp => $implied_prefix) { if (preg_match($regexp, $type)) { $prefix = $implied_prefix; break; } } switch ($this->transform) { case 'thumb-160x120': $suffix = '160x120'; break; case 'thumb-60x45': $suffix = '60x45'; break; default: throw new Exception("Unsupported transformation type!"); } $path = celerity_get_resource_uri("/rsrc/image/icon/fatcow/thumbnails/{$prefix}{$suffix}.png"); return id(new AphrontRedirectResponse())->setURI($path); }
public function getIconURI() { return celerity_get_resource_uri('/rsrc/image/app/app_differential.png'); }
public static function getDefaultProfileImageURI() { return celerity_get_resource_uri('/rsrc/image/avatar.png'); }
protected function willRenderPage() { parent::willRenderPage(); if (!$this->getRequest()) { throw new Exception(pht('You must set the %s to render a %s.', 'Request', __CLASS__)); } $console = $this->getConsole(); require_celerity_resource('phabricator-core-css'); require_celerity_resource('phabricator-zindex-css'); require_celerity_resource('phui-button-css'); require_celerity_resource('phui-spacing-css'); require_celerity_resource('phui-form-css'); require_celerity_resource('phabricator-standard-page-view'); require_celerity_resource('conpherence-durable-column-view'); require_celerity_resource('font-lato'); require_celerity_resource('font-roboto-slab'); Javelin::initBehavior('workflow', array()); $request = $this->getRequest(); $user = null; if ($request) { $user = $request->getUser(); } if ($user) { $default_img_uri = celerity_get_resource_uri('rsrc/image/icon/fatcow/document_black.png'); $download_form = phabricator_form($user, array('action' => '#', 'method' => 'POST', 'class' => 'lightbox-download-form', 'sigil' => 'download'), phutil_tag('button', array(), pht('Download'))); Javelin::initBehavior('lightbox-attachments', array('defaultImageUri' => $default_img_uri, 'downloadForm' => $download_form)); } Javelin::initBehavior('aphront-form-disable-on-submit'); Javelin::initBehavior('toggle-class', array()); Javelin::initBehavior('history-install'); Javelin::initBehavior('phabricator-gesture'); $current_token = null; if ($user) { $current_token = $user->getCSRFToken(); } Javelin::initBehavior('refresh-csrf', array('tokenName' => AphrontRequest::getCSRFTokenName(), 'header' => AphrontRequest::getCSRFHeaderName(), 'current' => $current_token)); Javelin::initBehavior('device'); Javelin::initBehavior('high-security-warning', $this->getHighSecurityWarningConfig()); if ($console) { require_celerity_resource('aphront-dark-console-css'); $headers = array(); if (DarkConsoleXHProfPluginAPI::isProfilerStarted()) { $headers[DarkConsoleXHProfPluginAPI::getProfilerHeader()] = 'page'; } if (DarkConsoleServicesPlugin::isQueryAnalyzerRequested()) { $headers[DarkConsoleServicesPlugin::getQueryAnalyzerHeader()] = true; } Javelin::initBehavior('dark-console', $this->getConsoleConfig()); // Change this to initBehavior when there is some behavior to initialize require_celerity_resource('javelin-behavior-error-log'); } if ($user) { $viewer = $user; } else { $viewer = new PhabricatorUser(); } $menu = id(new PhabricatorMainMenuView())->setUser($viewer); if ($this->getController()) { $menu->setController($this->getController()); } if ($this->getApplicationMenu()) { $menu->setApplicationMenu($this->getApplicationMenu()); } $this->menuContent = $menu->render(); }
private function postLink($account, $jira_key) { $provider = $this->getProvider(); $object = $this->getStoryObject(); $publisher = $this->getPublisher(); $icon_uri = celerity_get_resource_uri('rsrc/favicons/favicon-16x16.png'); $provider->newJIRAFuture($account, 'rest/api/2/issue/' . $jira_key . '/remotelink', 'POST', array('globalId' => $object->getPHID(), 'application' => array('type' => 'com.phacility.phabricator', 'name' => 'Phabricator'), 'relationship' => 'implemented in', 'object' => array('url' => $publisher->getObjectURI($object), 'title' => $publisher->getObjectTitle($object), 'icon' => array('url16x16' => $icon_uri, 'title' => 'Phabricator'), 'status' => array('resolved' => $publisher->isObjectClosed($object)))))->resolveJSON(); }
public function renderExample() { $colors = PHUIIconView::getFontIconColors(); $colors = array_merge(array(null), $colors); $fas = PHUIIconView::getFontIcons(); $trans = $this->listTransforms(); $cicons = array(); foreach ($colors as $color) { $cicons[] = id(new PHUIIconView())->addClass('phui-example-icon-transform')->setIcon('fa-tag ' . $color)->setText(pht('fa-tag %s', $color)); } $ficons = array(); sort($fas); foreach ($fas as $fa) { $ficons[] = id(new PHUIIconView())->addClass('phui-example-icon-name')->setIcon($fa)->setText($fa); } $person1 = new PHUIIconView(); $person1->setHeadSize(PHUIIconView::HEAD_MEDIUM); $person1->setHref('http://en.wikipedia.org/wiki/George_Washington'); $person1->setImage(celerity_get_resource_uri('/rsrc/image/people/washington.png')); $person2 = new PHUIIconView(); $person2->setHeadSize(PHUIIconView::HEAD_MEDIUM); $person2->setHref('http://en.wikipedia.org/wiki/Warren_G._Harding'); $person2->setImage(celerity_get_resource_uri('/rsrc/image/people/harding.png')); $person3 = new PHUIIconView(); $person3->setHeadSize(PHUIIconView::HEAD_MEDIUM); $person3->setHref('http://en.wikipedia.org/wiki/William_Howard_Taft'); $person3->setImage(celerity_get_resource_uri('/rsrc/image/people/taft.png')); $person4 = new PHUIIconView(); $person4->setHeadSize(PHUIIconView::HEAD_SMALL); $person4->setHref('http://en.wikipedia.org/wiki/George_Washington'); $person4->setImage(celerity_get_resource_uri('/rsrc/image/people/washington.png')); $person5 = new PHUIIconView(); $person5->setHeadSize(PHUIIconView::HEAD_SMALL); $person5->setHref('http://en.wikipedia.org/wiki/Warren_G._Harding'); $person5->setImage(celerity_get_resource_uri('/rsrc/image/people/harding.png')); $person6 = new PHUIIconView(); $person6->setHeadSize(PHUIIconView::HEAD_SMALL); $person6->setHref('http://en.wikipedia.org/wiki/William_Howard_Taft'); $person6->setImage(celerity_get_resource_uri('/rsrc/image/people/taft.png')); $tokens = array('like-1', 'like-2', 'heart-1', 'heart-2'); $tokenview = array(); foreach ($tokens as $token) { $tokenview[] = id(new PHUIIconView())->setSpriteSheet(PHUIIconView::SPRITE_TOKENS)->setSpriteIcon($token); } $logins = array('Asana', 'Dropbox', 'Google', 'Github'); $loginview = array(); foreach ($logins as $login) { $loginview[] = id(new PHUIIconView())->setSpriteSheet(PHUIIconView::SPRITE_LOGIN)->setSpriteIcon($login)->addClass(PHUI::MARGIN_SMALL_RIGHT); } $circles = array('fa-pencil', 'fa-chevron-left', 'fa-chevron-right'); $circleview = array(); foreach ($circles as $circle) { $circleview[] = id(new PHUIIconCircleView())->setIcon($circle)->setHref('#')->addClass('mmr'); } $circles = array('fa-plus', 'fa-bars', 'fa-paw'); foreach ($circles as $circle) { $circleview[] = id(new PHUIIconCircleView())->setIcon($circle)->setSize(PHUIIconCircleView::MEDIUM)->setHref('#')->addClass('mmr'); } $layout_cicons = id(new PHUIBoxView())->appendChild($cicons)->addMargin(PHUI::MARGIN_LARGE); $layout_fa = id(new PHUIBoxView())->appendChild($ficons)->addMargin(PHUI::MARGIN_LARGE); $layout2 = id(new PHUIBoxView())->appendChild(array($person1, $person2, $person3))->addMargin(PHUI::MARGIN_MEDIUM); $layout2a = id(new PHUIBoxView())->appendChild(array($person4, $person5, $person6))->addMargin(PHUI::MARGIN_MEDIUM); $layout3 = id(new PHUIBoxView())->appendChild($tokenview)->addMargin(PHUI::MARGIN_MEDIUM); $layout4 = id(new PHUIBoxView())->appendChild($circleview)->addMargin(PHUI::MARGIN_MEDIUM); $layout5 = id(new PHUIBoxView())->appendChild($loginview)->addMargin(PHUI::MARGIN_MEDIUM); $fa_link = phutil_tag('a', array('href' => 'http://fontawesome.io'), 'http://fontawesome.io'); $fa_text = pht('Font Awesome by Dave Gandy - %s', $fa_link); $fontawesome = id(new PHUIObjectBoxView())->setHeaderText($fa_text)->appendChild($layout_fa); $transforms = id(new PHUIObjectBoxView())->setHeaderText(pht('Colors and Transforms'))->appendChild($layout_cicons); $wrap2 = id(new PHUIObjectBoxView())->setHeaderText(pht('People!'))->appendChild(array($layout2, $layout2a)); $wrap3 = id(new PHUIObjectBoxView())->setHeaderText(pht('Tokens'))->appendChild($layout3); $wrap4 = id(new PHUIObjectBoxView())->setHeaderText(pht('Circles'))->appendChild($layout4); $wrap5 = id(new PHUIObjectBoxView())->setHeaderText(pht('Authentication'))->appendChild($layout5); return phutil_tag('div', array('class' => 'phui-icon-example'), array($fontawesome, $transforms, $wrap2, $wrap3, $wrap4, $wrap5)); }
public function getPaymentMethodIcon() { return celerity_get_resource_uri('/rsrc/image/phortune/test.png'); }
protected function willRenderPage() { parent::willRenderPage(); if (!$this->getRequest()) { throw new Exception(pht('You must set the Request to render a PhabricatorStandardPageView.')); } $console = $this->getConsole(); require_celerity_resource('phabricator-core-css'); require_celerity_resource('phabricator-zindex-css'); require_celerity_resource('phui-button-css'); require_celerity_resource('phui-spacing-css'); require_celerity_resource('phui-form-css'); require_celerity_resource('sprite-gradient-css'); require_celerity_resource('phabricator-standard-page-view'); Javelin::initBehavior('workflow', array()); $request = $this->getRequest(); $user = null; if ($request) { $user = $request->getUser(); } if ($user) { $default_img_uri = celerity_get_resource_uri('rsrc/image/icon/fatcow/document_black.png'); $download_form = phabricator_form($user, array('action' => '#', 'method' => 'POST', 'class' => 'lightbox-download-form', 'sigil' => 'download'), phutil_tag('button', array(), pht('Download'))); Javelin::initBehavior('lightbox-attachments', array('defaultImageUri' => $default_img_uri, 'downloadForm' => $download_form)); } Javelin::initBehavior('aphront-form-disable-on-submit'); Javelin::initBehavior('toggle-class', array()); Javelin::initBehavior('konami', array()); Javelin::initBehavior('history-install'); Javelin::initBehavior('phabricator-gesture'); $current_token = null; if ($user) { $current_token = $user->getCSRFToken(); } Javelin::initBehavior('refresh-csrf', array('tokenName' => AphrontRequest::getCSRFTokenName(), 'header' => AphrontRequest::getCSRFHeaderName(), 'current' => $current_token)); Javelin::initBehavior('device'); if ($user->hasSession()) { $hisec = $user->getSession()->getHighSecurityUntil() - time(); if ($hisec > 0) { $remaining_time = phutil_format_relative_time($hisec); Javelin::initBehavior('high-security-warning', array('uri' => '/auth/session/downgrade/', 'message' => pht('Your session is in high security mode. When you ' . 'finish using it, click here to leave.', $remaining_time))); } } if ($console) { require_celerity_resource('aphront-dark-console-css'); $headers = array(); if (DarkConsoleXHProfPluginAPI::isProfilerStarted()) { $headers[DarkConsoleXHProfPluginAPI::getProfilerHeader()] = 'page'; } if (DarkConsoleServicesPlugin::isQueryAnalyzerRequested()) { $headers[DarkConsoleServicesPlugin::getQueryAnalyzerHeader()] = true; } Javelin::initBehavior('dark-console', array('uri' => pht('Main Request'), 'selected' => $user ? $user->getConsoleTab() : null, 'visible' => $user ? (int) $user->getConsoleVisible() : true, 'headers' => $headers)); // Change this to initBehavior when there is some behavior to initialize require_celerity_resource('javelin-behavior-error-log'); } if ($user) { $viewer = $user; } else { $viewer = new PhabricatorUser(); } $menu = id(new PhabricatorMainMenuView())->setUser($viewer); if ($this->getController()) { $menu->setController($this->getController()); } if ($this->getApplicationMenu()) { $menu->setApplicationMenu($this->getApplicationMenu()); } $this->menuContent = $menu->render(); }
protected function willRenderPage() { parent::willRenderPage(); if (!$this->getRequest()) { throw new Exception(pht('You must set the %s to render a %s.', 'Request', __CLASS__)); } $console = $this->getConsole(); require_celerity_resource('phabricator-core-css'); require_celerity_resource('phabricator-zindex-css'); require_celerity_resource('phui-button-css'); require_celerity_resource('phui-spacing-css'); require_celerity_resource('phui-form-css'); require_celerity_resource('phabricator-standard-page-view'); require_celerity_resource('conpherence-durable-column-view'); require_celerity_resource('font-lato'); require_celerity_resource('font-aleo'); Javelin::initBehavior('workflow', array()); $request = $this->getRequest(); $user = null; if ($request) { $user = $request->getUser(); } if ($user) { if ($user->isUserActivated()) { $offset = $user->getTimeZoneOffset(); $ignore_key = PhabricatorTimezoneIgnoreOffsetSetting::SETTINGKEY; $ignore = $user->getUserSetting($ignore_key); Javelin::initBehavior('detect-timezone', array('offset' => $offset, 'uri' => '/settings/timezone/', 'message' => pht('Your browser timezone setting differs from the timezone ' . 'setting in your profile, click to reconcile.'), 'ignoreKey' => $ignore_key, 'ignore' => $ignore)); if ($user->getIsAdmin()) { $server_https = $request->isHTTPS(); $server_protocol = $server_https ? 'HTTPS' : 'HTTP'; $client_protocol = $server_https ? 'HTTP' : 'HTTPS'; $doc_name = 'Configuring a Preamble Script'; $doc_href = PhabricatorEnv::getDoclink($doc_name); Javelin::initBehavior('setup-check-https', array('server_https' => $server_https, 'doc_name' => pht('See Documentation'), 'doc_href' => $doc_href, 'message' => pht('Phabricator thinks you are using %s, but your ' . 'client is conviced that it is using %s. This is a serious ' . 'misconfiguration with subtle, but significant, consequences.', $server_protocol, $client_protocol))); } } $default_img_uri = celerity_get_resource_uri('rsrc/image/icon/fatcow/document_black.png'); $download_form = phabricator_form($user, array('action' => '#', 'method' => 'POST', 'class' => 'lightbox-download-form', 'sigil' => 'download'), phutil_tag('button', array(), pht('Download'))); Javelin::initBehavior('lightbox-attachments', array('defaultImageUri' => $default_img_uri, 'downloadForm' => $download_form)); } Javelin::initBehavior('aphront-form-disable-on-submit'); Javelin::initBehavior('toggle-class', array()); Javelin::initBehavior('history-install'); Javelin::initBehavior('phabricator-gesture'); $current_token = null; if ($user) { $current_token = $user->getCSRFToken(); } Javelin::initBehavior('refresh-csrf', array('tokenName' => AphrontRequest::getCSRFTokenName(), 'header' => AphrontRequest::getCSRFHeaderName(), 'viaHeader' => AphrontRequest::getViaHeaderName(), 'current' => $current_token)); Javelin::initBehavior('device'); Javelin::initBehavior('high-security-warning', $this->getHighSecurityWarningConfig()); if (PhabricatorEnv::isReadOnly()) { Javelin::initBehavior('read-only-warning', array('message' => PhabricatorEnv::getReadOnlyMessage(), 'uri' => PhabricatorEnv::getReadOnlyURI())); } if ($console) { require_celerity_resource('aphront-dark-console-css'); $headers = array(); if (DarkConsoleXHProfPluginAPI::isProfilerStarted()) { $headers[DarkConsoleXHProfPluginAPI::getProfilerHeader()] = 'page'; } if (DarkConsoleServicesPlugin::isQueryAnalyzerRequested()) { $headers[DarkConsoleServicesPlugin::getQueryAnalyzerHeader()] = true; } Javelin::initBehavior('dark-console', $this->getConsoleConfig()); // Change this to initBehavior when there is some behavior to initialize require_celerity_resource('javelin-behavior-error-log'); } if ($user) { $viewer = $user; } else { $viewer = new PhabricatorUser(); } $menu = id(new PhabricatorMainMenuView())->setUser($viewer); if ($this->getController()) { $menu->setController($this->getController()); } $application_menu = $this->getApplicationMenu(); if ($application_menu) { if ($application_menu instanceof PHUIApplicationMenuView) { $crumbs = $this->getCrumbs(); if ($crumbs) { $application_menu->setCrumbs($crumbs); } $application_menu = $application_menu->buildListView(); } $menu->setApplicationMenu($application_menu); } $this->menuContent = $menu->render(); }
public function getIconURI() { return celerity_get_resource_uri('/rsrc/image/app/app_flags.png'); }