예제 #1
0
 protected function getTagContent()
 {
     require_celerity_resource('phui-two-column-view-css');
     $main = phutil_tag('div', array('class' => 'phui-main-column'), $this->mainColumn);
     $side = phutil_tag('div', array('class' => 'phui-side-column'), $this->sideColumn);
     return phutil_tag_div('phui-two-column-row', array($main, $side));
 }
 public function render()
 {
     require_celerity_resource('differential-core-view-css');
     require_celerity_resource('differential-revision-detail-css');
     $revision = $this->revision;
     $rows = array();
     foreach ($this->auxiliaryFields as $field) {
         $value = $field->renderValueForRevisionView();
         if (strlen($value)) {
             $label = $field->renderLabelForRevisionView();
             $rows[] = '<tr>' . '<th>' . $label . '</th>' . '<td>' . $value . '</td>' . '</tr>';
         }
     }
     $properties = '<table class="differential-revision-properties">' . implode("\n", $rows) . '</table>';
     $actions = array();
     foreach ($this->actions as $action) {
         $obj = new AphrontHeadsupActionView();
         $obj->setName($action['name']);
         $obj->setURI(idx($action, 'href'));
         $obj->setWorkflow(idx($action, 'sigil') == 'workflow');
         $obj->setClass(idx($action, 'class'));
         $obj->setInstant(idx($action, 'instant'));
         $obj->setUser($this->user);
         $actions[] = $obj;
     }
     $action_list = new AphrontHeadsupActionListView();
     $action_list->setActions($actions);
     return '<div class="differential-revision-detail differential-panel">' . $action_list->render() . '<div class="differential-keyboard-shortcuts">' . id(new AphrontKeyboardShortcutsAvailableView())->render() . '</div>' . '<div class="differential-revision-detail-core">' . '<h1>' . '<span class="aphront-headsup-object-name">' . phutil_escape_html('D' . $revision->getID()) . '</span>' . ' ' . phutil_escape_html($revision->getTitle()) . '</h1>' . $properties . '</div>' . '<div style="clear: both;"></div>' . '</div>';
 }
 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');
     $content = '<div class="phabricator-timer">
     <h1 class="phabricator-timer-header">' . phutil_escape_html($timer->getTitle()) . ' &middot; ' . 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>
           <td id="phabricator-timer-days"></td>
           <td id="phabricator-timer-hours"></td>
           <td id="phabricator-timer-minutes"></td>
           <td id="phabricator-timer-seconds"></td>
       </table>
     </div>' . $chrome_link . '</div>';
     Javelin::initBehavior('countdown-timer', array('timestamp' => $timer->getDatepoint()));
     $panel = $content;
     return $this->buildStandardPageResponse($panel, array('title' => 'Countdown: ' . $timer->getTitle(), 'chrome' => $chrome_visible));
 }
 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 handleRequest(AphrontRequest $request)
 {
     $id = $request->getURIData('class');
     $classes = id(new PhutilSymbolLoader())->setAncestorClass('PhabricatorUIExample')->loadObjects();
     $classes = msort($classes, 'getName');
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI($this->getApplicationURI('view/')));
     foreach ($classes as $class => $obj) {
         $name = $obj->getName();
         $nav->addFilter($class, $name);
     }
     $selected = $nav->selectFilter($id, head_key($classes));
     $example = $classes[$selected];
     $example->setRequest($this->getRequest());
     $result = $example->renderExample();
     if ($result instanceof AphrontResponse) {
         // This allows examples to generate dialogs, etc., for demonstration.
         return $result;
     }
     require_celerity_resource('phabricator-ui-example-css');
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb($example->getName());
     $note = id(new PHUIInfoView())->setTitle(pht('%s (%s)', $example->getName(), get_class($example)))->appendChild($example->getDescription())->setSeverity(PHUIInfoView::SEVERITY_NODATA);
     $nav->appendChild(array($crumbs, $note, $result));
     return $this->buildApplicationPage($nav, array('title' => $example->getName()));
 }
 public final function render()
 {
     require_celerity_resource('aphront-error-view-css');
     $errors = $this->errors;
     if ($errors) {
         $list = array();
         foreach ($errors as $error) {
             $list[] = phutil_render_tag('li', array(), phutil_escape_html($error));
         }
         $list = '<ul>' . implode("\n", $list) . '</ul>';
     } else {
         $list = null;
     }
     $title = $this->title;
     if (strlen($title)) {
         $title = '<h1>' . phutil_escape_html($title) . '</h1>';
     } else {
         $title = null;
     }
     $this->severity = nonempty($this->severity, self::SEVERITY_ERROR);
     $this->width = nonempty($this->width, self::WIDTH_DEFAULT);
     $more_classes = array();
     $more_classes[] = 'aphront-error-severity-' . $this->severity;
     $more_classes[] = 'aphront-error-width-' . $this->width;
     $more_classes = implode(' ', $more_classes);
     return phutil_render_tag('div', array('id' => $this->id, 'class' => 'aphront-error-view ' . $more_classes), $title . $this->renderChildren() . $list);
 }
 public function render()
 {
     $viewer = $this->getUser();
     if (!$viewer) {
         throw new PhutilInvalidStateException('setUser');
     }
     require_celerity_resource('conpherence-transaction-css');
     $transaction = $this->getConpherenceTransaction();
     switch ($transaction->getTransactionType()) {
         case ConpherenceTransaction::TYPE_DATE_MARKER:
             return javelin_tag('div', array('class' => 'conpherence-transaction-view date-marker', 'sigil' => 'conpherence-transaction-view', 'meta' => array('id' => $transaction->getID() + 0.5)), array(phutil_tag('span', array('class' => 'date'), phabricator_format_local_time($transaction->getDateCreated(), $viewer, 'M jS, Y'))));
             break;
     }
     $info = $this->renderTransactionInfo();
     $actions = $this->renderTransactionActions();
     $image = $this->renderTransactionImage();
     $content = $this->renderTransactionContent();
     $classes = implode(' ', $this->classes);
     $transaction_dom_id = null;
     if ($this->getFullDisplay()) {
         $transaction_dom_id = 'anchor-' . $transaction->getID();
     }
     $header = phutil_tag_div('conpherence-transaction-header grouped', array($actions, $info));
     return javelin_tag('div', array('class' => 'conpherence-transaction-view ' . $classes, 'id' => $transaction_dom_id, 'sigil' => 'conpherence-transaction-view', 'meta' => array('id' => $transaction->getID())), array($image, phutil_tag_div('conpherence-transaction-detail grouped', array($header, $content))));
 }
 public function render()
 {
     if (empty($this->user)) {
         throw new Exception("Call setUser() before render()!");
     }
     $days = $this->getDatesInMonth();
     require_celerity_resource('aphront-calendar-view-css');
     $first = reset($days);
     $empty = $first->format('w');
     $markup = array();
     for ($ii = 0; $ii < $empty; $ii++) {
         $markup[] = null;
     }
     foreach ($days as $day) {
         $markup[] = '<div class="aphront-calendar-day-of-month">' . $day->format('j') . '</div>';
     }
     $table = array();
     $rows = array_chunk($markup, 7);
     foreach ($rows as $row) {
         $table[] = '<tr>';
         while (count($row) < 7) {
             $row[] = null;
         }
         foreach ($row as $cell) {
             $table[] = '<td>' . $cell . '</td>';
         }
         $table[] = '</tr>';
     }
     $table = '<table class="aphront-calendar-view">' . '<tr class="aphront-calendar-month-year-header">' . '<th colspan="7">' . $first->format('F Y') . '</th>' . '</tr>' . '<tr class="aphront-calendar-day-of-week-header">' . '<th>Sun</th>' . '<th>Mon</th>' . '<th>Tue</th>' . '<th>Wed</th>' . '<th>Thu</th>' . '<th>Fri</th>' . '<th>Sat</th>' . '</tr>' . implode("\n", $table) . '</table>';
     return $table;
 }
 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $request->getViewer();
     $id = $request->getURIData('id');
     $paste = id(new PhabricatorPasteQuery())->setViewer($viewer)->withIDs(array($id))->needContent(true)->executeOne();
     if (!$paste) {
         return new Aphront404Response();
     }
     $file = id(new PhabricatorFileQuery())->setViewer($viewer)->withPHIDs(array($paste->getFilePHID()))->executeOne();
     if (!$file) {
         return new Aphront400Response();
     }
     $forks = id(new PhabricatorPasteQuery())->setViewer($viewer)->withParentPHIDs(array($paste->getPHID()))->execute();
     $fork_phids = mpull($forks, 'getPHID');
     $header = $this->buildHeaderView($paste);
     $actions = $this->buildActionView($viewer, $paste, $file);
     $properties = $this->buildPropertyView($paste, $fork_phids, $actions);
     $object_box = id(new PHUIObjectBoxView())->setHeader($header)->addPropertyList($properties);
     $source_code = $this->buildSourceCodeView($paste, null, $this->highlightMap);
     require_celerity_resource('paste-css');
     $source_code = phutil_tag('div', array('class' => 'container-of-paste'), $source_code);
     $crumbs = $this->buildApplicationCrumbs($this->buildSideNavView())->addTextCrumb('P' . $paste->getID(), '/P' . $paste->getID());
     $timeline = $this->buildTransactionTimeline($paste, new PhabricatorPasteTransactionQuery());
     $is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
     $add_comment_header = $is_serious ? pht('Add Comment') : pht('Eat Paste');
     $draft = PhabricatorDraft::newFromUserAndKey($viewer, $paste->getPHID());
     $add_comment_form = id(new PhabricatorApplicationTransactionCommentView())->setUser($viewer)->setObjectPHID($paste->getPHID())->setDraft($draft)->setHeaderText($add_comment_header)->setAction($this->getApplicationURI('/comment/' . $paste->getID() . '/'))->setSubmitButtonName(pht('Add Comment'));
     return $this->buildApplicationPage(array($crumbs, $object_box, $source_code, $timeline, $add_comment_form), array('title' => $paste->getFullName(), 'pageObjects' => array($paste->getPHID())));
 }
 public function render()
 {
     $view = new AphrontNullView();
     $view->appendChild($this->items);
     require_celerity_resource('aphront-side-nav-view-css');
     return '<table class="aphront-side-nav-view">' . '<tr>' . '<th class="aphront-side-nav-navigation">' . $view->render() . '</th>' . '<td class="aphront-side-nav-content">' . $this->renderChildren() . '</td>' . '</tr>' . '</table>';
 }
 public function processRequest()
 {
     $drequest = $this->diffusionRequest;
     $content = array();
     $diff_query = DiffusionDiffQuery::newFromDiffusionRequest($drequest);
     $changeset = $diff_query->loadChangeset();
     if (!$changeset) {
         // TODO: Refine this.
         return new Aphront404Response();
     }
     $callsign = $drequest->getRepository()->getCallsign();
     $changesets = array(0 => $changeset);
     $changeset_view = new DifferentialChangesetListView();
     $changeset_view->setChangesets($changesets);
     $changeset_view->setVisibleChangesets($changesets);
     $changeset_view->setRenderingReferences(array(0 => $diff_query->getRenderingReference()));
     $raw_params = array('action' => 'browse', 'params' => array('view' => 'raw'));
     $right_uri = $drequest->generateURI($raw_params);
     $raw_params['params']['before'] = $drequest->getRawCommit();
     $left_uri = $drequest->generateURI($raw_params);
     $changeset_view->setRawFileURIs($left_uri, $right_uri);
     $changeset_view->setRenderURI('/diffusion/' . $callsign . '/diff/');
     $changeset_view->setWhitespace(DifferentialChangesetParser::WHITESPACE_SHOW_ALL);
     $changeset_view->setUser($this->getRequest()->getUser());
     $content[] = $this->buildCrumbs(array('branch' => true, 'path' => true, 'view' => 'change'));
     // TODO: This is pretty awkward, unify the CSS between Diffusion and
     // Differential better.
     require_celerity_resource('differential-core-view-css');
     $content[] = '<div class="differential-primary-pane">' . $changeset_view->render() . '</div>';
     $nav = $this->buildSideNav('change', true);
     $nav->appendChild($content);
     return $this->buildStandardPageResponse($nav, array('title' => 'Change'));
 }
예제 #12
0
 public function render()
 {
     require_celerity_resource('ponder-core-view-css');
     require_celerity_resource('ponder-feed-view-css');
     $user = $this->user;
     $qoffset = $this->questionoffset;
     $aoffset = $this->answeroffset;
     $questions = $this->questions;
     $answers = $this->answers;
     $handles = $this->handles;
     $uri = $this->uri;
     $qparam = $this->qparam;
     $aparam = $this->aparam;
     $pagesize = $this->pagesize;
     // display questions
     $question_panel = id(new AphrontPanelView())->setHeader("Your Questions")->addClass("ponder-panel");
     $question_panel->addButton(phutil_render_tag('a', array('href' => "/ponder/question/ask/", 'class' => 'green button'), "Ask a question"));
     $qpagebuttons = id(new AphrontPagerView())->setPageSize($pagesize)->setOffset($qoffset)->setURI($uri->alter($aparam, $aoffset), $qparam);
     $questions = $qpagebuttons->sliceResults($questions);
     foreach ($questions as $question) {
         $cur = id(new PonderQuestionSummaryView())->setUser($user)->setQuestion($question)->setHandles($handles);
         $question_panel->appendChild($cur);
     }
     $question_panel->appendChild($qpagebuttons);
     // display answers
     $answer_panel = id(new AphrontPanelView())->setHeader("Your Answers")->addClass("ponder-panel")->appendChild(phutil_render_tag('a', array('id' => 'answers'), ""));
     $apagebuttons = id(new AphrontPagerView())->setPageSize($pagesize)->setOffset($aoffset)->setURI($uri->alter($qparam, $qoffset)->setFragment("answers"), $aparam);
     $answers = $apagebuttons->sliceResults($answers);
     foreach ($answers as $answer) {
         $cur = id(new PonderAnswerSummaryView())->setUser($user)->setAnswer($answer)->setHandles($handles);
         $answer_panel->appendChild($cur);
     }
     $answer_panel->appendChild($apagebuttons);
     return $question_panel->render() . $answer_panel->render();
 }
 public function render()
 {
     $handle = $this->handle;
     $type_name = nonempty($handle->getTypeName(), 'Document');
     require_celerity_resource('phabricator-search-results-css');
     $link = phutil_render_tag('a', array('href' => $handle->getURI()), PhabricatorEnv::getProductionURI($handle->getURI()));
     $img = $handle->getImageURI();
     if ($img) {
         $img = phutil_render_tag('div', array('class' => 'result-image', 'style' => "background-image: url('{$img}');"), '');
     }
     switch ($handle->getType()) {
         case PhabricatorPHIDConstants::PHID_TYPE_CMIT:
             $object_name = $handle->getName();
             if ($this->object) {
                 $data = $this->object->getCommitData();
                 $summary = $data->getSummary();
                 if (strlen($summary)) {
                     $object_name = $handle->getName() . ': ' . $data->getSummary();
                 }
             }
             break;
         default:
             $object_name = $handle->getFullName();
             break;
     }
     return '<div class="phabricator-search-result">' . $img . '<div class="result-desc">' . phutil_render_tag('a', array('class' => 'result-name', 'href' => $handle->getURI()), $this->emboldenQuery($object_name)) . '<div class="result-type">' . $type_name . ' &middot; ' . $link . '</div>' . '</div>' . '<div style="clear: both;"></div>' . '</div>';
 }
 public function processRequest()
 {
     $classes = id(new PhutilSymbolLoader())->setAncestorClass('PhabricatorUIExample')->selectAndLoadSymbols();
     $classes = ipull($classes, 'name', 'name');
     $selected = null;
     foreach ($classes as $class => $ignored) {
         $classes[$class] = newv($class, array());
         if ($this->class == $classes[$class]->getName()) {
             $selected = $class;
         }
     }
     if (!$selected) {
         reset($classes);
         $selected = key($classes);
     }
     $nav = new AphrontSideNavView();
     foreach ($classes as $class => $obj) {
         $name = $obj->getName();
         $nav->addNavItem(phutil_render_tag('a', array('href' => '/uiexample/view/' . $name . '/', 'class' => $selected == $class ? 'aphront-side-nav-selected' : null), phutil_escape_html($obj->getName())));
     }
     require_celerity_resource('phabricator-ui-example-css');
     $example = $classes[$selected];
     $example->setRequest($this->getRequest());
     $nav->appendChild('<div class="phabricator-ui-example-header">' . '<h1 class="phabricator-ui-example-name">' . phutil_escape_html($example->getName()) . ' (' . get_class($example) . ')' . '</h1>' . '<p class="phabricator-ui-example-description">' . $example->getDescription() . '</p>' . '</div>');
     $nav->appendChild($example->renderExample());
     return $this->buildStandardPageResponse($nav, array('title' => 'UI Example'));
 }
 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 getTagContent()
 {
     $viewer = $this->getUser();
     require_celerity_resource('phui-object-item-list-view-css');
     $header = null;
     if (strlen($this->header)) {
         $header = phutil_tag('h1', array('class' => 'phui-object-item-list-header'), $this->header);
     }
     if ($this->items) {
         if ($viewer) {
             foreach ($this->items as $item) {
                 $item->setUser($viewer);
             }
         }
         foreach ($this->items as $item) {
             $item->addClass($this->itemClass);
         }
         $items = $this->items;
     } else {
         if ($this->allowEmptyList) {
             $items = null;
         } else {
             $string = nonempty($this->noDataString, pht('No data.'));
             $string = id(new PHUIInfoView())->setSeverity(PHUIInfoView::SEVERITY_NODATA)->appendChild($string);
             $items = phutil_tag('li', array('class' => 'phui-object-item-empty'), $string);
         }
     }
     $pager = null;
     if ($this->pager) {
         $pager = $this->pager;
     }
     return array($header, $items, $pager, $this->renderChildren());
 }
 protected function getTagContent()
 {
     require_celerity_resource('diviner-shared-css');
     $header = id(new PHUIHeaderView())->setBleedHeader(true)->setHeader($this->header);
     $content = id(new PHUIBoxView())->addPadding(PHUI::PADDING_LARGE_LEFT)->addPadding(PHUI::PADDING_LARGE_RIGHT)->appendChild($this->content);
     return array($header, $content);
 }
 private function buildPropertyView(PhameBlog $blog)
 {
     $viewer = $this->getViewer();
     require_celerity_resource('aphront-tooltip-css');
     Javelin::initBehavior('phabricator-tooltips');
     $properties = id(new PHUIPropertyListView())->setUser($viewer)->setObject($blog);
     $domain = $blog->getDomain();
     if (!$domain) {
         $domain = phutil_tag('em', array(), pht('No external domain'));
     }
     $properties->addProperty(pht('Domain'), $domain);
     $feed_uri = PhabricatorEnv::getProductionURI($this->getApplicationURI('blog/feed/' . $blog->getID() . '/'));
     $properties->addProperty(pht('Atom URI'), javelin_tag('a', array('href' => $feed_uri, 'sigil' => 'has-tooltip', 'meta' => array('tip' => pht('Atom URI does not support custom domains.'), 'size' => 320)), $feed_uri));
     $descriptions = PhabricatorPolicyQuery::renderPolicyDescriptions($viewer, $blog);
     $properties->addProperty(pht('Editable By'), $descriptions[PhabricatorPolicyCapability::CAN_EDIT]);
     $engine = id(new PhabricatorMarkupEngine())->setViewer($viewer)->addObject($blog, PhameBlog::MARKUP_FIELD_DESCRIPTION)->process();
     $properties->invokeWillRenderEvent();
     $description = $blog->getDescription();
     if (strlen($description)) {
         $description = new PHUIRemarkupView($viewer, $description);
         $properties->addSectionHeader(pht('Description'), PHUIPropertyListView::ICON_SUMMARY);
         $properties->addTextContent($description);
     }
     return $properties;
 }
 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $request->getViewer();
     $engine = new PhabricatorSetupEngine();
     $response = $engine->execute();
     if ($response) {
         return $response;
     }
     $issues = $engine->getIssues();
     $unresolved_count = count($engine->getUnresolvedIssues());
     if ($issues) {
         require_celerity_resource('phabricator-notification-menu-css');
         $items = array();
         foreach ($issues as $issue) {
             $classes = array();
             $classes[] = 'phabricator-notification';
             if ($issue->getIsIgnored()) {
                 $classes[] = 'phabricator-notification-read';
             } else {
                 $classes[] = 'phabricator-notification-unread';
             }
             $uri = '/config/issue/' . $issue->getIssueKey() . '/';
             $title = $issue->getName();
             $summary = $issue->getSummary();
             $items[] = javelin_tag('div', array('class' => implode(' ', $classes), 'sigil' => 'notification', 'meta' => array('href' => $uri)), $title);
         }
         $content = phutil_tag_div('setup-issue-menu', $items);
     } else {
         $content = phutil_tag_div('phabricator-notification no-notifications', pht('You have no unresolved setup issues.'));
     }
     $content = hsprintf('<div class="phabricator-notification-header">%s</div>' . '%s', phutil_tag('a', array('href' => '/config/issue/'), pht('Unresolved Setup Issues')), $content);
     $json = array('content' => $content, 'number' => (int) $unresolved_count);
     return id(new AphrontAjaxResponse())->setContent($json);
 }
예제 #20
0
 protected function getTagContent()
 {
     $action_list = $this->actionList;
     require_celerity_resource('phui-curtain-view-css');
     $panels = $this->renderPanels();
     return id(new PHUIObjectBoxView())->appendChild($action_list)->appendChild($panels)->addClass('phui-two-column-properties');
 }
예제 #21
0
 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);
 }
예제 #22
0
 public function render()
 {
     require_celerity_resource('pholio-edit-css');
     $image = $this->image;
     $file = $image->getFile();
     $phid = $file->getPHID();
     $replaces_phid = $this->replacesPHID;
     $remove = $this->renderRemoveElement();
     $title = id(new AphrontFormTextControl())->setName('title_' . $phid)->setValue($image->getName())->setSigil('image-title')->setLabel(pht('Title'));
     $description = id(new PhabricatorRemarkupControl())->setName('description_' . $phid)->setValue($image->getDescription())->setSigil('image-description')->setLabel(pht('Description'));
     $thumb_frame = phutil_tag('div', array('class' => 'pholio-thumb-frame', 'style' => 'background-image: url(' . $file->getThumb280x210URI() . ');'));
     $handle = javelin_tag('div', array('class' => 'pholio-drag-handle', 'sigil' => 'pholio-drag-handle'));
     $content = hsprintf('<div class="pholio-thumb-box">
     <div class="pholio-thumb-title">
       %s
       <div class="pholio-thumb-name">%s</div>
     </div>
     %s
   </div>
   <div class="pholio-image-details">
     %s
     %s
   </div>', $remove, $file->getName(), $thumb_frame, $title, $description);
     $input = phutil_tag('input', array('type' => 'hidden', 'name' => 'file_phids[]', 'value' => $phid));
     $replaces_input = phutil_tag('input', array('type' => 'hidden', 'name' => 'replaces[' . $replaces_phid . ']', 'value' => $phid));
     return javelin_tag('div', array('class' => 'pholio-uploaded-image', 'sigil' => 'pholio-drop-image', 'meta' => array('filePHID' => $file->getPHID(), 'replacesPHID' => $replaces_phid)), array($handle, $content, $input, $replaces_input));
 }
 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;
 }
예제 #24
0
 public function render()
 {
     require_celerity_resource('phui-info-panel-css');
     $trs = array();
     $rows = ceil(count($this->infoblock) / $this->columns);
     for ($i = 0; $i < $rows; $i++) {
         $tds = array();
         $ii = 1;
         foreach ($this->infoblock as $key => $cell) {
             $tds[] = $this->renderCell($cell);
             unset($this->infoblock[$key]);
             $ii++;
             if ($ii > $this->columns) {
                 break;
             }
         }
         $trs[] = phutil_tag('tr', array('class' => 'phui-info-panel-table-row'), $tds);
     }
     $table = phutil_tag('table', array('class' => 'phui-info-panel-table'), $trs);
     $table = id(new PHUIBoxView())->addPadding(PHUI::PADDING_MEDIUM)->appendChild($table);
     $progress = null;
     if ($this->progress) {
         $progress = phutil_tag('div', array('class' => 'phui-info-panel-progress', 'style' => 'width: ' . (int) $this->progress . '%;'), null);
     }
     $box = id(new PHUIObjectBoxView())->setHeader($this->header)->appendChild($table)->appendChild($progress);
     return phutil_tag('div', array('class' => 'phui-info-panel'), $box);
 }
 public function renderPropertyViewValue(array $handles)
 {
     $requested_object = $this->getObject()->getRequestedObject();
     if (!$requested_object instanceof DifferentialRevision) {
         return null;
     }
     $diff_rev = $requested_object;
     $diffs = $diff_rev->loadRelatives(new DifferentialDiff(), 'revisionID', 'getID', 'creationMethod <> "commit"');
     $all_changesets = array();
     $most_recent_changesets = null;
     foreach ($diffs as $diff) {
         $changesets = $diff->loadRelatives(new DifferentialChangeset(), 'diffID');
         $all_changesets += $changesets;
         $most_recent_changesets = $changesets;
     }
     // The score is based on all changesets for all versions of this diff
     $all_changes = $this->countLinesAndPaths($all_changesets);
     $points = self::LINES_WEIGHT * $all_changes['code']['lines'] + self::PATHS_WEIGHT * count($all_changes['code']['paths']);
     // The blurb is just based on the most recent version of the diff
     $mr_changes = $this->countLinesAndPaths($most_recent_changesets);
     $test_tag = '';
     if ($mr_changes['tests']['paths']) {
         Javelin::initBehavior('phabricator-tooltips');
         require_celerity_resource('aphront-tooltip-css');
         $test_blurb = pht('%d line(s)', $mr_changes['tests']['lines']) . ' and ' . pht('%d path(s)', count($mr_changes['tests']['paths'])) . " contain changes to test code:\n";
         foreach ($mr_changes['tests']['paths'] as $mr_test_path) {
             $test_blurb .= pht("%s\n", $mr_test_path);
         }
         $test_tag = javelin_tag('span', array('sigil' => 'has-tooltip', 'meta' => array('tip' => $test_blurb, 'align' => 'E', 'size' => 'auto'), 'style' => ''), ' + tests');
     }
     $blurb = hsprintf('%s%s.', pht('%d line(s)', $mr_changes['code']['lines']) . ' and ' . pht('%d path(s)', count($mr_changes['code']['paths'])) . ' over ' . pht('%d diff(s)', count($diffs)), $test_tag);
     return id(new AphrontProgressBarView())->setValue($points)->setMax(self::MAX_POINTS)->setCaption($blurb)->render();
 }
 public function processRequest()
 {
     $classes = id(new PhutilSymbolLoader())->setAncestorClass('PhabricatorUIExample')->setConcreteOnly(true)->selectAndLoadSymbols();
     $classes = ipull($classes, 'name', 'name');
     foreach ($classes as $class => $ignored) {
         $classes[$class] = newv($class, array());
     }
     $classes = msort($classes, 'getName');
     $nav = new AphrontSideNavFilterView();
     $nav->setBaseURI(new PhutilURI($this->getApplicationURI('view/')));
     foreach ($classes as $class => $obj) {
         $name = $obj->getName();
         $nav->addFilter($class, $name);
     }
     $selected = $nav->selectFilter($this->class, head_key($classes));
     require_celerity_resource('phabricator-ui-example-css');
     $example = $classes[$selected];
     $example->setRequest($this->getRequest());
     $result = $example->renderExample();
     if ($result instanceof AphrontResponse) {
         // This allows examples to generate dialogs, etc., for demonstration.
         return $result;
     }
     $nav->appendChild('<div class="phabricator-ui-example-header">' . '<h1 class="phabricator-ui-example-name">' . phutil_escape_html($example->getName()) . ' (' . get_class($example) . ')' . '</h1>' . '<p class="phabricator-ui-example-description">' . $example->getDescription() . '</p>' . '</div>');
     $nav->appendChild($result);
     return $this->buildApplicationPage($nav, array('title' => 'UI Example', 'device' => true));
 }
예제 #27
0
 public final function render()
 {
     require_celerity_resource('aphront-error-view-css');
     $errors = $this->errors;
     if ($errors) {
         $list = array();
         foreach ($errors as $error) {
             $list[] = phutil_tag('li', array(), $error);
         }
         $list = phutil_tag('ul', array('class' => 'aphront-error-view-list'), $list);
     } else {
         $list = null;
     }
     $title = $this->title;
     if (strlen($title)) {
         $title = phutil_tag('h1', array('class' => 'aphront-error-view-head'), $title);
     } else {
         $title = null;
     }
     $this->severity = nonempty($this->severity, self::SEVERITY_ERROR);
     $classes = array();
     $classes[] = 'aphront-error-view';
     $classes[] = 'aphront-error-severity-' . $this->severity;
     $classes = implode(' ', $classes);
     $children = $this->renderChildren();
     $children[] = $list;
     return phutil_tag('div', array('id' => $this->id, 'class' => $classes), array($title, phutil_tag('div', array('class' => 'aphront-error-view-body'), $children)));
 }
예제 #28
0
 protected function getTagAttributes()
 {
     require_celerity_resource('phui-icon-view-css');
     $style = null;
     $classes = array();
     $classes[] = 'phui-icon-view';
     if ($this->spriteIcon) {
         require_celerity_resource('sprite-' . $this->spriteSheet . '-css');
         $classes[] = 'sprite-' . $this->spriteSheet;
         $classes[] = $this->spriteSheet . '-' . $this->spriteIcon;
     } else {
         if ($this->iconFont) {
             require_celerity_resource('phui-font-icon-base-css');
             require_celerity_resource('font-fontawesome');
             $classes[] = 'phui-font-fa';
             $classes[] = $this->iconFont;
             if ($this->iconColor) {
                 $classes[] = $this->iconColor;
             }
         } else {
             if ($this->headSize) {
                 $classes[] = $this->headSize;
             }
             $style = 'background-image: url(' . $this->image . ');';
         }
     }
     if ($this->text) {
         $classes[] = 'phui-icon-has-text';
         $this->appendChild($this->text);
     }
     return array('href' => $this->href, 'style' => $style, 'aural' => false, 'class' => $classes);
 }
 public function render()
 {
     $rows = array();
     $any_hidden = false;
     foreach ($this->rows as $row) {
         $style = idx($row, 'style');
         switch ($style) {
             case 'section':
                 $cells = phutil_render_tag('th', array('colspan' => 2), idx($row, 'name'));
                 break;
             default:
                 $name = phutil_render_tag('th', array(), idx($row, 'name'));
                 $value = phutil_render_tag('td', array(), idx($row, 'value'));
                 $cells = $name . $value;
                 break;
         }
         $show = idx($row, 'show');
         $rows[] = javelin_render_tag('tr', array('style' => $show ? null : 'display: none', 'sigil' => $show ? null : 'differential-results-row-toggle', 'class' => 'differential-results-row-' . $style), $cells);
         if (!$show) {
             $any_hidden = true;
         }
     }
     if ($any_hidden) {
         $show_more = javelin_render_tag('a', array('href' => '#', 'mustcapture' => true), $this->showMoreString);
         $hide_more = javelin_render_tag('a', array('href' => '#', 'mustcapture' => true), 'Hide');
         $rows[] = javelin_render_tag('tr', array('class' => 'differential-results-row-show', 'sigil' => 'differential-results-row-show'), '<th colspan="2">' . $show_more . '</td>');
         $rows[] = javelin_render_tag('tr', array('class' => 'differential-results-row-show', 'sigil' => 'differential-results-row-hide', 'style' => 'display: none'), '<th colspan="2">' . $hide_more . '</th>');
         Javelin::initBehavior('differential-show-field-details');
     }
     require_celerity_resource('differential-results-table-css');
     return javelin_render_tag('table', array('class' => 'differential-results-table', 'sigil' => 'differential-results-table'), implode("\n", $rows));
 }
예제 #30
0
 public function render()
 {
     $view = new AphrontNullView();
     $view->appendChild($this->buttons);
     require_celerity_resource('aphront-contextbar-view-css');
     return phutil_tag_div('aphront-contextbar-view', array(phutil_tag_div('aphront-contextbar-core', array(phutil_tag_div('aphront-contextbar-buttons', $view->render()), phutil_tag_div('aphront-contextbar-content', $this->renderChildren()))), phutil_tag('div', array('style' => 'clear: both;'))));
 }