protected function renderInput() { $name = $this->getName(); $values = nonempty($this->getValue(), array()); assert_instances_of($values, 'PhabricatorObjectHandle'); if ($this->getID()) { $id = $this->getID(); } else { $id = celerity_generate_unique_node_id(); } $placeholder = null; if (!strlen($this->placeholder)) { if ($this->datasource) { $placeholder = $this->datasource->getPlaceholderText(); } } else { $placeholder = $this->placeholder; } $template = new AphrontTokenizerTemplateView(); $template->setName($name); $template->setID($id); $template->setValue($values); $username = null; if ($this->user) { $username = $this->user->getUsername(); } $datasource_uri = null; if ($this->datasource) { $datasource_uri = $this->datasource->getDatasourceURI(); } if (!$this->disableBehavior) { Javelin::initBehavior('aphront-basic-tokenizer', array('id' => $id, 'src' => $datasource_uri, 'value' => mpull($values, 'getFullName', 'getPHID'), 'icons' => mpull($values, 'getIcon', 'getPHID'), 'limit' => $this->limit, 'username' => $username, 'placeholder' => $placeholder)); } return $template->render(); }
public function render() { $question = $this->question; $viewer = $this->user; $authors = mpull($question->getAnswers(), null, 'getAuthorPHID'); if (isset($authors[$viewer->getPHID()])) { return id(new PHUIInfoView())->setSeverity(PHUIInfoView::SEVERITY_NOTICE)->setTitle(pht('Already Answered'))->appendChild(pht('You have already answered this question. You can not answer ' . 'twice, but you can edit your existing answer.')); } $info_panel = null; if ($question->getStatus() != PonderQuestionStatus::STATUS_OPEN) { $info_panel = id(new PHUIInfoView())->setSeverity(PHUIInfoView::SEVERITY_NOTICE)->appendChild(pht('This question has been marked as closed, but you can still leave a new answer.')); } $box_style = null; $own_question = null; $hide_action_id = celerity_generate_unique_node_id(); $show_action_id = celerity_generate_unique_node_id(); if ($question->getAuthorPHID() == $viewer->getPHID()) { $box_style = 'display: none;'; $open_link = javelin_tag('a', array('sigil' => 'reveal-content', 'class' => 'mml', 'id' => $hide_action_id, 'href' => '#', 'meta' => array('showIDs' => array($show_action_id), 'hideIDs' => array($hide_action_id))), pht('Add an answer.')); $own_question = id(new PHUIInfoView())->setSeverity(PHUIInfoView::SEVERITY_WARNING)->setID($hide_action_id)->appendChild(pht('This is your own question. You are welcome to provide an answer if you have found a resolution.'))->appendChild($open_link); } $header = id(new PHUIHeaderView())->setHeader(pht('Add Answer')); $form = new AphrontFormView(); $form->setUser($this->user)->setAction($this->actionURI)->setWorkflow(true)->addHiddenInput('question_id', $question->getID())->appendChild(id(new PhabricatorRemarkupControl())->setName('answer')->setLabel(pht('Answer'))->setError(true)->setID('answer-content')->setUser($this->user))->appendChild(id(new AphrontFormSubmitControl())->setValue(pht('Add Answer'))); $box = id(new PHUIObjectBoxView())->setHeader($header)->appendChild($form); if ($info_panel) { $box->setInfoView($info_panel); } $box = phutil_tag('div', array('style' => $box_style, 'class' => 'mlt', 'id' => $show_action_id), $box); return array($own_question, $box); }
public function getID() { if (!$this->id) { $this->id = celerity_generate_unique_node_id(); } return $this->id; }
public function processRequest(AphrontRequest $request) { $viewer = $this->getViewer(); $preferences = $this->getPreferences(); $notifications_key = PhabricatorDesktopNotificationsSetting::SETTINGKEY; $notifications_value = $preferences->getSettingValue($notifications_key); if ($request->isFormPost()) { $this->writeSetting($preferences, $notifications_key, $request->getInt($notifications_key)); return id(new AphrontRedirectResponse())->setURI($this->getPanelURI('?saved=true')); } $title = pht('Desktop Notifications'); $control_id = celerity_generate_unique_node_id(); $status_id = celerity_generate_unique_node_id(); $browser_status_id = celerity_generate_unique_node_id(); $cancel_ask = pht('The dialog asking for permission to send desktop notifications was ' . 'closed without granting permission. Only application notifications ' . 'will be sent.'); $accept_ask = pht('Click "Save Preference" to persist these changes.'); $reject_ask = pht('Permission for desktop notifications was denied. Only application ' . 'notifications will be sent.'); $no_support = pht('This web browser does not support desktop notifications. Only ' . 'application notifications will be sent for this browser regardless of ' . 'this preference.'); $default_status = phutil_tag('span', array(), array(pht('This browser has not yet granted permission to send desktop ' . 'notifications for this Phabricator instance.'), phutil_tag('br'), phutil_tag('br'), javelin_tag('button', array('sigil' => 'desktop-notifications-permission-button', 'class' => 'green'), pht('Grant Permission')))); $granted_status = phutil_tag('span', array(), pht('This browser has been granted permission to send desktop ' . 'notifications for this Phabricator instance.')); $denied_status = phutil_tag('span', array(), pht('This browser has denied permission to send desktop notifications ' . 'for this Phabricator instance. Consult your browser settings / ' . 'documentation to figure out how to clear this setting, do so, ' . 'and then re-visit this page to grant permission.')); $status_box = id(new PHUIInfoView())->setSeverity(PHUIInfoView::SEVERITY_NOTICE)->setID($status_id)->setIsHidden(true)->appendChild($accept_ask); $control_config = array('controlID' => $control_id, 'statusID' => $status_id, 'browserStatusID' => $browser_status_id, 'defaultMode' => 0, 'desktopMode' => 1, 'cancelAsk' => $cancel_ask, 'grantedAsk' => $accept_ask, 'deniedAsk' => $reject_ask, 'defaultStatus' => $default_status, 'deniedStatus' => $denied_status, 'grantedStatus' => $granted_status, 'noSupport' => $no_support); $form = id(new AphrontFormView())->setUser($viewer)->appendChild(id(new AphrontFormSelectControl())->setLabel($title)->setControlID($control_id)->setName($notifications_key)->setValue($notifications_value)->setOptions(array(1 => pht('Send Desktop Notifications Too'), 0 => pht('Send Application Notifications Only')))->setCaption(pht('Should Phabricator send desktop notifications? These are sent ' . 'in addition to the notifications within the Phabricator ' . 'application.'))->initBehavior('desktop-notifications-control', $control_config))->appendChild(id(new AphrontFormSubmitControl())->setValue(pht('Save Preference'))); $test_button = id(new PHUIButtonView())->setTag('a')->setWorkflow(true)->setText(pht('Send Test Notification'))->setHref('/notification/test/')->setIcon('fa-exclamation-triangle'); $form_box = id(new PHUIObjectBoxView())->setHeader(id(new PHUIHeaderView())->setHeader(pht('Desktop Notifications'))->addActionLink($test_button))->setForm($form)->setInfoView($status_box)->setFormSaved($request->getBool('saved')); $browser_status_box = id(new PHUIInfoView())->setID($browser_status_id)->setSeverity(PHUIInfoView::SEVERITY_NOTICE)->setIsHidden(true)->appendChild($default_status); return array($form_box, $browser_status_box); }
private function renderNotificationMenu() { $user = $this->user; require_celerity_resource('phabricator-notification-css'); require_celerity_resource('phabricator-notification-menu-css'); $indicator_id = celerity_generate_unique_node_id(); $dropdown_id = celerity_generate_unique_node_id(); $menu_id = celerity_generate_unique_node_id(); $notification_count = id(new PhabricatorFeedStoryNotification())->countUnread($user); $classes = array('phabricator-main-menu-alert-indicator'); if ($notification_count) { $classes[] = 'phabricator-main-menu-alert-indicator-unread'; } $notification_indicator = javelin_render_tag('span', array('id' => $indicator_id, 'class' => implode(' ', $classes)), $notification_count); $classes = array(); $classes[] = 'phabricator-main-menu-alert-item'; $classes[] = 'phabricator-main-menu-alert-item-notification'; $classes[] = 'autosprite'; $classes[] = 'main-menu-item-icon-notifications'; $notification_icon = javelin_render_tag('a', array('href' => '/notification/', 'class' => implode(' ', $classes), 'id' => $menu_id), $notification_indicator); $notification_menu = javelin_render_tag('div', array('class' => 'phabricator-main-menu-alert'), $notification_icon); Javelin::initBehavior('aphlict-dropdown', array('menuID' => $menu_id, 'indicatorID' => $indicator_id, 'dropdownID' => $dropdown_id)); $notification_dropdown = javelin_render_tag('div', array('id' => $dropdown_id, 'class' => 'phabricator-notification-menu', 'sigil' => 'phabricator-notification-menu', 'style' => 'display: none;'), ''); return array($notification_menu, $notification_dropdown); }
public function render() { $content = $this->renderChildren(); if (!$content) { return null; } require_celerity_resource('aphront-list-filter-view-css'); $content = phutil_tag('div', array('class' => 'aphront-list-filter-view-content'), $content); $classes = array(); $classes[] = 'aphront-list-filter-view'; if ($this->showAction !== null) { $classes[] = 'aphront-list-filter-view-collapsible'; Javelin::initBehavior('phabricator-reveal-content'); $hide_action_id = celerity_generate_unique_node_id(); $show_action_id = celerity_generate_unique_node_id(); $content_id = celerity_generate_unique_node_id(); $hide_action = javelin_tag('a', array('class' => 'button grey', 'sigil' => 'reveal-content', 'id' => $hide_action_id, 'href' => $this->showHideHref, 'meta' => array('hideIDs' => array($hide_action_id), 'showIDs' => array($content_id, $show_action_id))), $this->showAction); $content_description = phutil_tag('div', array('class' => 'aphront-list-filter-description'), $this->showHideDescription); $show_action = javelin_tag('a', array('class' => 'button grey', 'sigil' => 'reveal-content', 'style' => 'display: none;', 'href' => '#', 'id' => $show_action_id, 'meta' => array('hideIDs' => array($content_id, $show_action_id), 'showIDs' => array($hide_action_id))), $this->hideAction); $reveal_block = phutil_tag('div', array('class' => 'aphront-list-filter-reveal'), array($content_description, $hide_action, $show_action)); $content = array($reveal_block, phutil_tag('div', array('id' => $content_id, 'style' => 'display: none;'), $content)); } $content = phutil_tag('div', array('class' => implode(' ', $classes)), $content); return phutil_tag('div', array('class' => 'aphront-list-filter-wrap'), $content); }
protected function getTagContent() { if ($this->previewURI === null) { throw new PhutilInvalidStateException('setPreviewURI'); } if ($this->controlID === null) { throw new PhutilInvalidStateException('setControlID'); } $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; }
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')->setIconFont('fa-align-left')->setColor(PHUIButtonView::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); } $content_inner = phutil_tag('div', array('class' => 'phui-document-inner'), array($table_of_contents, $this->header, $main_content)); $content = phutil_tag('div', array('class' => 'phui-document-content'), $content_inner); $view = phutil_tag('div', array('class' => implode(' ', $classes)), $content); $list = null; if ($this->propertyList) { $list = phutil_tag_div('phui-document-properties', $this->propertyList); } return array($view, $list); }
public function getContentID() { if ($this->contentID === null) { $this->contentID = celerity_generate_unique_node_id(); } return $this->contentID; }
public function handleRequest(AphrontRequest $request) { $viewer = $request->getViewer(); $id = $request->getURIData('id'); // NOTE: We require CAN_EDIT to view this page. $document = id(new LegalpadDocumentQuery())->setViewer($viewer)->withIDs(array($id))->needDocumentBodies(true)->needContributors(true)->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT))->executeOne(); if (!$document) { return new Aphront404Response(); } $subscribers = PhabricatorSubscribersQuery::loadSubscribersForPHID($document->getPHID()); $document_body = $document->getDocumentBody(); $engine = id(new PhabricatorMarkupEngine())->setViewer($viewer); $engine->addObject($document_body, LegalpadDocumentBody::MARKUP_FIELD_TEXT); $timeline = $this->buildTransactionTimeline($document, new LegalpadTransactionQuery(), $engine); $title = $document_body->getTitle(); $header = id(new PHUIHeaderView())->setHeader($title)->setUser($viewer)->setPolicyObject($document); $actions = $this->buildActionView($document); $properties = $this->buildPropertyView($document, $engine, $actions); $comment_form_id = celerity_generate_unique_node_id(); $add_comment = $this->buildAddCommentView($document, $comment_form_id); $crumbs = $this->buildApplicationCrumbs($this->buildSideNav()); $crumbs->addTextCrumb($document->getMonogram(), '/' . $document->getMonogram()); $crumbs->addTextCrumb(pht('Manage')); $object_box = id(new PHUIObjectBoxView())->setHeader($header)->addPropertyList($properties)->addPropertyList($this->buildDocument($engine, $document_body)); $content = array($crumbs, $object_box, $timeline, $add_comment); return $this->buildApplicationPage($content, array('title' => $title, 'pageObjects' => array($document->getPHID()))); }
public function buildMainMenuItems(PhabricatorUser $user, PhabricatorController $controller = null) { $application = null; if ($controller) { $application = $controller->getCurrentApplication(); } $items = array(); $help_id = celerity_generate_unique_node_id(); Javelin::initBehavior('aphlict-dropdown', array('bubbleID' => $help_id, 'dropdownID' => 'phabricator-help-menu', 'applicationClass' => __CLASS__, 'local' => true, 'desktop' => true, 'right' => true)); $item = id(new PHUIListItemView())->setIcon('fa-life-ring')->addClass('core-menu-item')->setID($help_id)->setOrder(200); $hide = true; if ($application) { $help_name = pht('%s Help', $application->getName()); $item->setName($help_name)->setHref('/help/documentation/' . get_class($application) . '/')->setAural($help_name); $help_items = $application->getHelpMenuItems($user); if ($help_items) { $hide = false; } } if ($hide) { $item->setStyle('display: none'); } $items[] = $item; return $items; }
protected function processDiffusionRequest(AphrontRequest $request) { $user = $request->getUser(); $drequest = $this->getDiffusionRequest(); $callsign = $drequest->getRepository()->getCallsign(); $repository = $drequest->getRepository(); $commit = $drequest->loadCommit(); $data = $commit->loadCommitData(); $page_title = pht('Edit Diffusion Commit'); if (!$commit) { return new Aphront404Response(); } $commit_phid = $commit->getPHID(); $edge_type = PhabricatorProjectObjectHasProjectEdgeType::EDGECONST; $current_proj_phids = PhabricatorEdgeQuery::loadDestinationPHIDs($commit_phid, $edge_type); if ($request->isFormPost()) { $xactions = array(); $proj_phids = $request->getArr('projects'); $xactions[] = id(new PhabricatorAuditTransaction())->setTransactionType(PhabricatorTransactions::TYPE_EDGE)->setMetadataValue('edge:type', $edge_type)->setNewValue(array('=' => array_fuse($proj_phids))); $editor = id(new PhabricatorAuditEditor())->setActor($user)->setContinueOnNoEffect(true)->setContentSourceFromRequest($request); $xactions = $editor->applyTransactions($commit, $xactions); return id(new AphrontRedirectResponse())->setURI('/r' . $callsign . $commit->getCommitIdentifier()); } $tokenizer_id = celerity_generate_unique_node_id(); $form = id(new AphrontFormView())->setUser($user)->setAction($request->getRequestURI()->getPath())->appendControl(id(new AphrontFormTokenizerControl())->setLabel(pht('Projects'))->setName('projects')->setValue($current_proj_phids)->setID($tokenizer_id)->setCaption(javelin_tag('a', array('href' => '/project/create/', 'mustcapture' => true, 'sigil' => 'project-create'), pht('Create New Project')))->setDatasource(new PhabricatorProjectDatasource())); $reason = $data->getCommitDetail('autocloseReason', false); $reason = PhabricatorRepository::BECAUSE_AUTOCLOSE_FORCED; if ($reason !== false) { switch ($reason) { case PhabricatorRepository::BECAUSE_REPOSITORY_IMPORTING: $desc = pht('No, Repository Importing'); break; case PhabricatorRepository::BECAUSE_AUTOCLOSE_DISABLED: $desc = pht('No, Autoclose Disabled'); break; case PhabricatorRepository::BECAUSE_NOT_ON_AUTOCLOSE_BRANCH: $desc = pht('No, Not On Autoclose Branch'); break; case PhabricatorRepository::BECAUSE_AUTOCLOSE_FORCED: $desc = pht('Yes, Forced Via bin/repository CLI Tool.'); break; case null: $desc = pht('Yes'); break; default: $desc = pht('Unknown'); break; } $doc_href = PhabricatorEnv::getDoclink('Diffusion User Guide: Autoclose'); $doc_link = phutil_tag('a', array('href' => $doc_href, 'target' => '_blank'), pht('Learn More')); $form->appendChild(id(new AphrontFormMarkupControl())->setLabel(pht('Autoclose?'))->setValue(array($desc, " · ", $doc_link))); } Javelin::initBehavior('project-create', array('tokenizerID' => $tokenizer_id)); $submit = id(new AphrontFormSubmitControl())->setValue(pht('Save'))->addCancelButton('/r' . $callsign . $commit->getCommitIdentifier()); $form->appendChild($submit); $crumbs = $this->buildCrumbs(array('commit' => true)); $crumbs->addTextCrumb(pht('Edit')); $form_box = id(new PHUIObjectBoxView())->setHeaderText($page_title)->setForm($form); return $this->buildApplicationPage(array($crumbs, $form_box), array('title' => $page_title)); }
protected function getTagContent() { if ($this->previewURI === null) { throw new PhutilInvalidStateException('setPreviewURI'); } if ($this->controlID === null) { throw new PhutilInvalidStateException('setControlID'); } $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...'))); $preview = phutil_tag('div', array('id' => $preview_id, 'class' => 'phabricator-remarkup phui-preview-body'), $loading); if (!$this->previewType) { $header = null; if ($this->header) { $header = phutil_tag('div', array('class' => 'phui-preview-header'), $this->header); } $content = array($header, $preview); } else { if ($this->previewType == self::DOCUMENT) { $header = id(new PHUIHeaderView())->setHeader(pht('%s (Preview)', $this->header)); $content = id(new PHUIDocumentViewPro())->setHeader($header)->appendChild($preview); } } return id(new PHUIObjectBoxView())->appendChild($content)->setCollapsed(true); }
protected function renderInput() { $name = $this->getName(); $values = nonempty($this->getValue(), array()); if ($this->getID()) { $id = $this->getID(); } else { $id = celerity_generate_unique_node_id(); } $placeholder = null; if (!$this->placeholder) { $placeholder = $this->getDefaultPlaceholder(); } $template = new AphrontTokenizerTemplateView(); $template->setName($name); $template->setID($id); $template->setValue($values); $username = null; if ($this->user) { $username = $this->user->getUsername(); } if (!$this->disableBehavior) { Javelin::initBehavior('aphront-basic-tokenizer', array('id' => $id, 'src' => $this->datasource, 'value' => $values, 'limit' => $this->limit, 'ondemand' => PhabricatorEnv::getEnvConfig('tokenizer.ondemand'), 'username' => $username, 'placeholder' => $placeholder)); } return $template->render(); }
public function processRequest() { $request = $this->getRequest(); $user = $request->getUser(); $timer = id(new PhabricatorTimer())->load($this->id); if (!$timer) { return new Aphront404Response(); } require_celerity_resource('phabricator-countdown-css'); $chrome_visible = $request->getBool('chrome', true); $chrome_new = $chrome_visible ? false : null; $chrome_link = phutil_render_tag('a', array('href' => $request->getRequestURI()->alter('chrome', $chrome_new), 'class' => 'phabricator-timer-chrome-link'), $chrome_visible ? 'Disable Chrome' : 'Enable Chrome'); $container = celerity_generate_unique_node_id(); $content = '<div class="phabricator-timer" id="' . $container . '"> <h1 class="phabricator-timer-header">' . phutil_escape_html($timer->getTitle()) . ' · ' . phabricator_datetime($timer->getDatePoint(), $user) . '</h1> <div class="phabricator-timer-pane"> <table class="phabricator-timer-table"> <tr> <th>Days</th> <th>Hours</th> <th>Minutes</th> <th>Seconds</th> </tr> <tr>' . javelin_render_tag('td', array('sigil' => 'phabricator-timer-days'), '') . javelin_render_tag('td', array('sigil' => 'phabricator-timer-hours'), '') . javelin_render_tag('td', array('sigil' => 'phabricator-timer-minutes'), '') . javelin_render_tag('td', array('sigil' => 'phabricator-timer-seconds'), '') . '</tr> </table> </div>' . $chrome_link . '</div>'; Javelin::initBehavior('countdown-timer', array('timestamp' => $timer->getDatepoint(), 'container' => $container)); $panel = $content; return $this->buildStandardPageResponse($panel, array('title' => 'Countdown: ' . $timer->getTitle(), 'chrome' => $chrome_visible)); }
public function renderDashboard() { require_celerity_resource('phabricator-dashboard-css'); $dashboard = $this->dashboard; $viewer = $this->viewer; $layout_config = $dashboard->getLayoutConfigObject(); $panel_grid_locations = $layout_config->getPanelLocations(); $panels = mpull($dashboard->getPanels(), null, 'getPHID'); $dashboard_id = celerity_generate_unique_node_id(); $result = id(new AphrontMultiColumnView())->setID($dashboard_id)->setFluidlayout(true)->setGutter(AphrontMultiColumnView::GUTTER_LARGE); if ($this->arrangeMode) { $h_mode = PhabricatorDashboardPanelRenderingEngine::HEADER_MODE_EDIT; } else { $h_mode = PhabricatorDashboardPanelRenderingEngine::HEADER_MODE_NORMAL; } foreach ($panel_grid_locations as $column => $panel_column_locations) { $panel_phids = $panel_column_locations; $column_panels = array_select_keys($panels, $panel_phids); $column_result = array(); foreach ($column_panels as $panel) { $column_result[] = id(new PhabricatorDashboardPanelRenderingEngine())->setViewer($viewer)->setPanel($panel)->setDashboardID($dashboard->getID())->setEnableAsyncRendering(true)->setParentPanelPHIDs(array())->setHeaderMode($h_mode)->renderPanel(); } $column_class = $layout_config->getColumnClass($column, $this->arrangeMode); if ($this->arrangeMode) { $column_result[] = $this->renderAddPanelPlaceHolder($column); $column_result[] = $this->renderAddPanelUI($column); } $result->addColumn($column_result, $column_class, $sigil = 'dashboard-column', $metadata = array('columnID' => $column)); } if ($this->arrangeMode) { Javelin::initBehavior('dashboard-move-panels', array('dashboardID' => $dashboard_id, 'moveURI' => '/dashboard/movepanel/' . $dashboard->getID() . '/')); } $view = id(new PHUIBoxView())->addClass('dashboard-view')->appendChild($result); return $view; }
protected function getTagContent() { require_celerity_resource('ponder-view-css'); $answer = $this->answer; $viewer = $this->getUser(); $status = $answer->getStatus(); $author_phid = $answer->getAuthorPHID(); $actions = $this->buildAnswerActions(); $handle = $this->handle; $id = $answer->getID(); if ($status == PonderAnswerStatus::ANSWER_STATUS_HIDDEN) { $can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $answer, PhabricatorPolicyCapability::CAN_EDIT); $message = array(); $message[] = phutil_tag('em', array(), pht('This answer has been hidden.')); if ($can_edit) { $message[] = phutil_tag('a', array('href' => "/ponder/answer/edit/{$id}/"), pht('Edit Answer')); } $message = phutil_implode_html(' ', $message); return id(new PHUIInfoView())->setSeverity(PHUIInfoView::SEVERITY_NODATA)->appendChild($message); } $action_button = id(new PHUIButtonView())->setTag('a')->setText(pht('Actions'))->setHref('#')->setIcon('fa-bars')->setDropdownMenu($actions); $header_name = phutil_tag('a', array('href' => $handle->getURI()), $handle->getName()); $header = id(new PHUIHeaderView())->setUser($viewer)->setEpoch($answer->getDateModified())->setHeader($header_name)->addActionLink($action_button)->setImage($handle->getImageURI())->setImageURL($handle->getURI()); $content = phutil_tag('div', array('class' => 'phabricator-remarkup'), PhabricatorMarkupEngine::renderOneObject($answer, $answer->getMarkupField(), $viewer)); $anchor = id(new PhabricatorAnchorView())->setAnchorName("A{$id}"); $content_id = celerity_generate_unique_node_id(); $footer = id(new PonderFooterView())->setContentID($content_id)->setCount(count($this->transactions)); $content = phutil_tag_div('ponder-answer-content', array($anchor, $content, $footer)); $answer_view = id(new PHUIObjectBoxView())->setHeader($header)->setBackground(PHUIObjectBoxView::GREY)->addClass('ponder-answer')->appendChild($content); $comment_view = id(new PhabricatorApplicationTransactionCommentView())->setUser($viewer)->setObjectPHID($answer->getPHID())->setShowPreview(false)->setHeaderText(pht('Answer Comment'))->setAction("/ponder/answer/comment/{$id}/")->setSubmitButtonName(pht('Comment')); $hidden_view = phutil_tag('div', array('id' => $content_id, 'style' => 'display: none;'), array($this->timeline, $comment_view)); return array($answer_view, $hidden_view); }
protected function renderInput() { $drop_id = celerity_generate_unique_node_id(); Javelin::initBehavior('conpherence-drag-and-drop-photo', array('target' => $drop_id, 'form_pane' => 'conpherence-form', 'upload_uri' => '/file/dropupload/', 'activated_class' => 'conpherence-dialogue-upload-photo')); require_celerity_resource('conpherence-update-css'); return phutil_tag('div', array('id' => $drop_id, 'class' => 'conpherence-dialogue-drag-photo'), pht('Drag and drop an image here to upload it.')); }
public function getFormID() { if (!$this->formID) { $this->formID = celerity_generate_unique_node_id(); } return $this->formID; }
protected function getTagContent() { require_celerity_resource('ponder-view-css'); $answer = $this->answer; $viewer = $this->getUser(); $author_phid = $answer->getAuthorPHID(); $actions = $this->buildAnswerActions(); $action_button = id(new PHUIButtonView())->setTag('a')->setText(pht('Actions'))->setHref('#')->setIconFont('fa-bars')->setDropdownMenu($actions); $header = id(new PHUIHeaderView())->setUser($viewer)->setEpoch($answer->getDateCreated())->setHeader($viewer->renderHandle($author_phid))->addActionLink($action_button); $content = phutil_tag('div', array('class' => 'phabricator-remarkup mlt mlb msr msl'), PhabricatorMarkupEngine::renderOneObject($answer, $answer->getMarkupField(), $viewer)); $id = $answer->getID(); $anchor = id(new PhabricatorAnchorView())->setAnchorName("A{$id}"); $content_id = celerity_generate_unique_node_id(); $footer = id(new PonderFooterView())->setContentID($content_id)->setCount(count($this->transactions)); $votes = $answer->getVoteCount(); if ($votes) { $icon = id(new PHUIIconView())->setIconFont('fa-thumbs-up'); $helpful = phutil_tag('span', array('class' => 'ponder-footer-action'), array($votes, $icon)); $footer->addAction($helpful); } $answer_view = id(new PHUIObjectBoxView())->setHeader($header)->appendChild($anchor)->appendChild($content)->appendChild($footer); $transaction_view = id(new PhabricatorApplicationTransactionView())->setUser($viewer)->setObjectPHID($answer->getPHID())->setTransactions($this->transactions)->setMarkupEngine($this->engine); $comment_view = id(new PhabricatorApplicationTransactionCommentView())->setUser($viewer)->setObjectPHID($answer->getPHID())->setShowPreview(false)->setHeaderText(pht('Answer Comment'))->setAction("/ponder/answer/comment/{$id}/")->setSubmitButtonName(pht('Comment')); $hidden_view = phutil_tag('div', array('id' => $content_id, 'style' => 'display: none;'), array($transaction_view, $comment_view)); return array($answer_view, $hidden_view); }
public function handleRequest(AphrontRequest $request) { $viewer = $request->getUser(); $file = PhabricatorFile::initializeNewFile(); $e_file = true; $errors = array(); if ($request->isFormPost()) { $view_policy = $request->getStr('viewPolicy'); if (!$request->getFileExists('file')) { $e_file = pht('Required'); $errors[] = pht('You must select a file to upload.'); } else { $file = PhabricatorFile::newFromPHPUpload(idx($_FILES, 'file'), array('name' => $request->getStr('name'), 'authorPHID' => $viewer->getPHID(), 'viewPolicy' => $view_policy, 'isExplicitUpload' => true)); } if (!$errors) { return id(new AphrontRedirectResponse())->setURI($file->getInfoURI()); } $file->setViewPolicy($view_policy); } $support_id = celerity_generate_unique_node_id(); $instructions = id(new AphrontFormMarkupControl())->setControlID($support_id)->setControlStyle('display: none')->setValue(hsprintf('<br /><br /><strong>%s</strong> %s<br /><br />', pht('Drag and Drop:'), pht('You can also upload files by dragging and dropping them from your ' . 'desktop onto this page or the Phabricator home page.'))); $policies = id(new PhabricatorPolicyQuery())->setViewer($viewer)->setObject($file)->execute(); $form = id(new AphrontFormView())->setUser($viewer)->setEncType('multipart/form-data')->appendChild(id(new AphrontFormFileControl())->setLabel(pht('File'))->setName('file')->setError($e_file))->appendChild(id(new AphrontFormTextControl())->setLabel(pht('Name'))->setName('name')->setValue($request->getStr('name')))->appendChild(id(new AphrontFormPolicyControl())->setUser($viewer)->setCapability(PhabricatorPolicyCapability::CAN_VIEW)->setPolicyObject($file)->setPolicies($policies)->setName('viewPolicy'))->appendChild(id(new AphrontFormSubmitControl())->setValue(pht('Upload'))->addCancelButton('/file/'))->appendChild($instructions); $crumbs = $this->buildApplicationCrumbs(); $crumbs->addTextCrumb(pht('Upload'), $request->getRequestURI()); $crumbs->setBorder(true); $title = pht('Upload File'); $global_upload = id(new PhabricatorGlobalUploadTargetView())->setUser($viewer)->setShowIfSupportedID($support_id); $form_box = id(new PHUIObjectBoxView())->setHeaderText(pht('File'))->setFormErrors($errors)->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)->setForm($form); $header = id(new PHUIHeaderView())->setHeader($title)->setHeaderIcon('fa-upload'); $view = id(new PHUITwoColumnView())->setHeader($header)->setFooter(array($form_box, $global_upload)); return $this->newPage()->setTitle($title)->setCrumbs($crumbs)->appendChild($view); }
protected function renderInput() { Javelin::initBehavior('choose-control'); $set = $this->getIconSet(); $input_id = celerity_generate_unique_node_id(); $display_id = celerity_generate_unique_node_id(); $is_disabled = $this->getDisabled(); $classes = array(); $classes[] = 'button'; $classes[] = 'grey'; if ($is_disabled) { $classes[] = 'disabled'; } $button = javelin_tag('a', array('href' => '#', 'class' => implode(' ', $classes), 'sigil' => 'phui-form-iconset-button'), $set->getChooseButtonText()); $icon = $set->getIcon($this->getValue()); if ($icon) { $display = $set->renderIconForControl($icon); } else { $display = null; } $display_cell = phutil_tag('td', array('class' => 'phui-form-iconset-display-cell', 'id' => $display_id), $display); $button_cell = phutil_tag('td', array('class' => 'phui-form-iconset-button-cell'), $button); $row = phutil_tag('tr', array(), array($display_cell, $button_cell)); $layout = javelin_tag('table', array('class' => 'phui-form-iconset-table', 'sigil' => 'phui-form-iconset', 'meta' => array('uri' => $set->getSelectURI(), 'inputID' => $input_id, 'displayID' => $display_id)), $row); $hidden_input = phutil_tag('input', array('type' => 'hidden', 'disabled' => $is_disabled ? 'disabled' : null, 'name' => $this->getName(), 'value' => $this->getValue(), 'id' => $input_id)); return array($hidden_input, $layout); }
public function renderInput() { $id = celerity_generate_unique_node_id(); $div = phutil_tag('div', array('style' => 'position: relative;', 'id' => $id), phutil_tag('input', array('autocomplete' => 'off', 'type' => 'text', 'name' => $this->getName()), '')); require_celerity_resource('releeph-request-typeahead-css'); Javelin::initBehavior('releeph-request-typeahead', array('id' => $id, 'src' => '/releeph/request/typeahead/', 'placeholder' => self::PLACEHOLDER, 'value' => $this->getValue(), 'aux' => array('repo' => $this->repo->getID(), 'callsign' => $this->repo->getCallsign(), 'since' => $this->startTime, 'limit' => 16))); return $div; }
protected function getTagAttributes() { if (!$this->getID()) { $this->setID(celerity_generate_unique_node_id()); } Javelin::initBehavior('aphlict-status', array('nodeID' => $this->getID(), 'pht' => array('setup' => pht('Setting Up Client'), 'open' => pht('Connected'), 'closed' => pht('Disconnected')))); return array('class' => 'aphlict-connection-status'); }
protected function getTagAttributes() { if (!$this->getID()) { $this->setID(celerity_generate_unique_node_id()); } Javelin::initBehavior('aphlict-status', array('nodeID' => $this->getID(), 'pht' => array('setup' => pht('Setting Up Client'), 'start' => pht('Starting Client'), 'ready' => pht('Ready to Connect'), 'connecting' => pht('Connecting...'), 'connected' => pht('Connected'), 'error' => pht('Connection Error'), 'client' => pht('Connected Locally'), 'error.flash.xdomain' => pht('Unable to connect to Flash Policy Server. Check that the ' . 'notification server is running and port 843 is not firewalled.'), 'error.flash.disconnected' => pht('Disconnected from notification server.')))); return array('class' => 'aphlict-connection-status'); }
public function render() { $form_id = celerity_generate_unique_node_id(); require_celerity_resource('stripe-payment-form-css'); require_celerity_resource('aphront-tooltip-css'); Javelin::initBehavior('phabricator-tooltips'); $form = id(new AphrontFormView())->setID($form_id)->setUser($this->getUser())->appendChild(id(new AphrontFormMarkupControl())->setLabel('')->setValue(javelin_render_tag('div', array('class' => 'credit-card-logos', 'sigil' => 'has-tooltip', 'meta' => array('tip' => 'We support Visa, Mastercard, American Express, ' . 'Discover, JCB, and Diners Club.', 'size' => 440)))))->appendChild(id(new AphrontFormTextControl())->setLabel('Card Number')->setDisableAutocomplete(true)->setSigil('number-input')->setError($this->getCardNumberError()))->appendChild(id(new AphrontFormTextControl())->setLabel('CVC')->setDisableAutocomplete(true)->setSigil('cvc-input')->setError($this->getCardCVCError()))->appendChild(id(new PhortuneMonthYearExpiryControl())->setLabel('Expiration')->setUser($this->getUser())->setError($this->getCardExpirationError()))->appendChild(javelin_render_tag('input', array('hidden' => true, 'name' => 'stripeToken', 'sigil' => 'stripe-token-input')))->appendChild(javelin_render_tag('input', array('hidden' => true, 'name' => 'cardErrors', 'sigil' => 'card-errors-input')))->appendChild(phutil_render_tag('input', array('hidden' => true, 'name' => 'stripeKey', 'value' => $this->getStripeKey())))->appendChild(id(new AphrontFormSubmitControl())->setValue('Submit Payment')); Javelin::initBehavior('stripe-payment-form', array('stripePublishKey' => $this->getStripeKey(), 'root' => $form_id)); return $form->render(); }
public function handleRequest(AphrontRequest $request) { $viewer = $request->getViewer(); $color_map = PhabricatorFilesComposeIconBuiltinFile::getAllColors(); $icon_map = $this->getIconMap(); if ($request->isFormPost()) { $project_phid = $request->getStr('projectPHID'); if ($project_phid) { $project = id(new PhabricatorProjectQuery())->setViewer($viewer)->withPHIDs(array($project_phid))->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_EDIT))->executeOne(); if (!$project) { return new Aphront404Response(); } } $icon = $request->getStr('icon'); $color = $request->getStr('color'); $composer = id(new PhabricatorFilesComposeIconBuiltinFile())->setIcon($icon)->setColor($color); $data = $composer->loadBuiltinFileData(); $file = PhabricatorFile::buildFromFileDataOrHash($data, array('name' => $composer->getBuiltinDisplayName(), 'profile' => true, 'canCDN' => true)); if ($project_phid) { $edit_uri = '/project/history/' . $project->getID() . '/'; $xactions = array(); $xactions[] = id(new PhabricatorProjectTransaction())->setTransactionType(PhabricatorProjectTransaction::TYPE_IMAGE)->setNewValue($file->getPHID()); $editor = id(new PhabricatorProjectTransactionEditor())->setActor($viewer)->setContentSourceFromRequest($request)->setContinueOnMissingFields(true)->setContinueOnNoEffect(true); $editor->applyTransactions($project, $xactions); return id(new AphrontRedirectResponse())->setURI($edit_uri); } else { $content = array('phid' => $file->getPHID()); return id(new AphrontAjaxResponse())->setContent($content); } } $value_color = head_key($color_map); $value_icon = head_key($icon_map); require_celerity_resource('people-profile-css'); $buttons = array(); foreach ($color_map as $color => $info) { $quip = idx($info, 'quip'); $buttons[] = javelin_tag('button', array('class' => 'grey profile-image-button', 'sigil' => 'has-tooltip compose-select-color', 'style' => 'margin: 0 8px 8px 0', 'meta' => array('color' => $color, 'tip' => $quip)), id(new PHUIIconView())->addClass('compose-background-' . $color)); } $icons = array(); foreach ($icon_map as $icon => $spec) { $quip = idx($spec, 'quip'); $icons[] = javelin_tag('button', array('class' => 'grey profile-image-button', 'sigil' => 'has-tooltip compose-select-icon', 'style' => 'margin: 0 8px 8px 0', 'meta' => array('icon' => $icon, 'tip' => $quip)), id(new PHUIIconView())->setIconFont($icon)->addClass('compose-icon-bg')); } $dialog_id = celerity_generate_unique_node_id(); $color_input_id = celerity_generate_unique_node_id(); $icon_input_id = celerity_generate_unique_node_id(); $preview_id = celerity_generate_unique_node_id(); $preview = id(new PHUIIconView())->setID($preview_id)->addClass('compose-background-' . $value_color)->setIconFont($value_icon)->addClass('compose-icon-bg'); $color_input = javelin_tag('input', array('type' => 'hidden', 'name' => 'color', 'value' => $value_color, 'id' => $color_input_id)); $icon_input = javelin_tag('input', array('type' => 'hidden', 'name' => 'icon', 'value' => $value_icon, 'id' => $icon_input_id)); Javelin::initBehavior('phabricator-tooltips'); Javelin::initBehavior('icon-composer', array('dialogID' => $dialog_id, 'colorInputID' => $color_input_id, 'iconInputID' => $icon_input_id, 'previewID' => $preview_id, 'defaultColor' => $value_color, 'defaultIcon' => $value_icon)); $dialog = id(new AphrontDialogView())->setUser($viewer)->setFormID($dialog_id)->setClass('compose-dialog')->setTitle(pht('Compose Image'))->appendChild(phutil_tag('div', array('class' => 'compose-header'), pht('Choose Background Color')))->appendChild($buttons)->appendChild(phutil_tag('div', array('class' => 'compose-header'), pht('Choose Icon')))->appendChild($icons)->appendChild(phutil_tag('div', array('class' => 'compose-header'), pht('Preview')))->appendChild($preview)->appendChild($color_input)->appendChild($icon_input)->addCancelButton('/')->addSubmitButton(pht('Save Image')); return id(new AphrontDialogResponse())->setDialog($dialog); }
public function processRequest() { $request = $this->getRequest(); if ($request->isFormPost()) { $mail = new PhabricatorMetaMTAMail(); $mail->addTos($request->getArr('to')); $mail->addCCs($request->getArr('cc')); $mail->setSubject($request->getStr('subject')); $mail->setBody($request->getStr('body')); $files = $request->getArr('files'); if ($files) { foreach ($files as $phid) { $file = id(new PhabricatorFile())->loadOneWhere('phid = %s', $phid); $mail->addAttachment(new PhabricatorMetaMTAAttachment($file->loadFileData(), $file->getName(), $file->getMimeType())); } } $mail->setFrom($request->getUser()->getPHID()); $mail->setSimulatedFailureCount($request->getInt('failures')); $mail->setIsHTML($request->getInt('html')); $mail->setIsBulk($request->getInt('bulk')); $mail->setMailTags($request->getStrList('mailtags')); $mail->save(); if ($request->getInt('immediately')) { $mail->sendNow(); } return id(new AphrontRedirectResponse())->setURI($this->getApplicationURI('/view/' . $mail->getID() . '/')); } $failure_caption = "Enter a number to simulate that many consecutive send failures before " . "really attempting to deliver via the underlying MTA."; $doclink_href = PhabricatorEnv::getDoclink('article/Configuring_Outbound_Email.html'); $doclink = phutil_render_tag('a', array('href' => $doclink_href, 'target' => '_blank'), 'Configuring Outbound Email'); $instructions = '<p class="aphront-form-instructions">This form will send a normal ' . 'email using the settings you have configured for Phabricator. For more ' . 'information, see ' . $doclink . '.</p>'; $adapter = PhabricatorEnv::getEnvConfig('metamta.mail-adapter'); $warning = null; if ($adapter == 'PhabricatorMailImplementationTestAdapter') { $warning = new AphrontErrorView(); $warning->setTitle('Email is Disabled'); $warning->setSeverity(AphrontErrorView::SEVERITY_WARNING); $warning->appendChild('<p>This installation of Phabricator is currently set to use ' . '<tt>PhabricatorMailImplementationTestAdapter</tt> to deliver ' . 'outbound email. This completely disables outbound email! All ' . 'outbound email will be thrown in a deep, dark hole until you ' . 'configure a real adapter.</p>'); } $panel_id = celerity_generate_unique_node_id(); $phdlink_href = PhabricatorEnv::getDoclink('article/Managing_Daemons_with_phd.html'); $phdlink = phutil_render_tag('a', array('href' => $phdlink_href, 'target' => '_blank'), '"phd start"'); $form = new AphrontFormView(); $form->setUser($request->getUser()); $form->appendChild($instructions)->appendChild(id(new AphrontFormStaticControl())->setLabel('Adapter')->setValue($adapter))->appendChild(id(new AphrontFormTokenizerControl())->setLabel('To')->setName('to')->setDatasource('/typeahead/common/mailable/'))->appendChild(id(new AphrontFormTokenizerControl())->setLabel('CC')->setName('cc')->setDatasource('/typeahead/common/mailable/'))->appendChild(id(new AphrontFormTextControl())->setLabel('Subject')->setName('subject'))->appendChild(id(new AphrontFormTextAreaControl())->setLabel('Body')->setName('body'))->appendChild(id(new AphrontFormTextControl())->setLabel('Mail Tags')->setName('mailtags')->setCaption('Example: <tt>differential-cc, differential-comment</tt>'))->appendChild(id(new AphrontFormDragAndDropUploadControl())->setLabel('Attach Files')->setName('files')->setDragAndDropTarget($panel_id)->setActivatedClass('aphront-panel-view-drag-and-drop'))->appendChild(id(new AphrontFormTextControl())->setLabel('Simulate Failures')->setName('failures')->setCaption($failure_caption))->appendChild(id(new AphrontFormCheckboxControl())->setLabel('HTML')->addCheckbox('html', '1', 'Send as HTML email.'))->appendChild(id(new AphrontFormCheckboxControl())->setLabel('Bulk')->addCheckbox('bulk', '1', 'Send with bulk email headers.'))->appendChild(id(new AphrontFormCheckboxControl())->setLabel('Send Now')->addCheckbox('immediately', '1', 'Send immediately. (Do not enqueue for daemons.)', PhabricatorEnv::getEnvConfig('metamta.send-immediately'))->setCaption('Daemons can be started with ' . $phdlink . '.'))->appendChild(id(new AphrontFormSubmitControl())->setValue('Send Mail')); $panel = new AphrontPanelView(); $panel->setHeader('Send Email'); $panel->appendChild($form); $panel->setID($panel_id); $panel->setWidth(AphrontPanelView::WIDTH_FORM); $nav = $this->buildSideNavView(); $nav->selectFilter('send'); $nav->appendChild(array($warning, $panel)); return $this->buildApplicationPage($nav, array('title' => 'Send Test')); }
protected function getTagAttributes() { require_celerity_resource('phui-badge-view-css'); $id = celerity_generate_unique_node_id(); $classes = array(); $classes[] = 'phui-badge-view'; if ($this->quality) { $classes[] = 'phui-badge-view-' . $this->quality; } return array('class' => implode(' ', $classes), 'sigil' => 'jx-toggle-class', 'id' => $id, 'meta' => array('map' => array($id => 'card-flipped'))); }
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; }