private function buildCommentForm(PhamePost $post)
 {
     $viewer = $this->getViewer();
     $draft = PhabricatorDraft::newFromUserAndKey($viewer, $post->getPHID());
     $box = id(new PhabricatorApplicationTransactionCommentView())->setUser($viewer)->setObjectPHID($post->getPHID())->setDraft($draft)->setHeaderText(pht('Add Comment'))->setAction($this->getApplicationURI('post/comment/' . $post->getID() . '/'))->setSubmitButtonName(pht('Add Comment'));
     return phutil_tag_div('phui-document-view-pro-box', $box);
 }
 public function renderExample()
 {
     $view = id(new AphrontMultiColumnView())->setFluidLayout(true)->setBorder(true);
     /* Action Panels */
     $panel1 = id(new PHUIActionPanelView())->setFontIcon('fa-book')->setHeader(pht('Read Documentation'))->setHref('#')->setSubHeader(pht('Reading is a common way to learn about things.'))->setStatus(pht('Carrots help you see better.'))->setState(PHUIActionPanelView::STATE_NONE);
     $view->addColumn($panel1);
     $panel2 = id(new PHUIActionPanelView())->setFontIcon('fa-server')->setHeader(pht('Launch Instance'))->setHref('#')->setSubHeader(pht("Maybe this is what you're likely here for."))->setStatus(pht('You have no instances.'))->setState(PHUIActionPanelView::STATE_ERROR);
     $view->addColumn($panel2);
     $panel3 = id(new PHUIActionPanelView())->setFontIcon('fa-group')->setHeader(pht('Code with Friends'))->setHref('#')->setSubHeader(pht('Writing code is much more fun with friends!'))->setStatus(pht('You need more friends.'))->setState(PHUIActionPanelView::STATE_WARN);
     $view->addColumn($panel3);
     $panel4 = id(new PHUIActionPanelView())->setFontIcon('fa-cloud-download')->setHeader(pht('Download Data'))->setHref('#')->setSubHeader(pht('Need a backup of all your kitten memes?'))->setStatus(pht('Building Download'))->setState(PHUIActionPanelView::STATE_PROGRESS);
     $view->addColumn($panel4);
     $view2 = id(new AphrontMultiColumnView())->setFluidLayout(true)->setBorder(true);
     /* Action Panels */
     $panel1 = id(new PHUIActionPanelView())->setFontIcon('fa-credit-card')->setHeader(pht('Account Balance'))->setHref('#')->setSubHeader(pht('You were last billed $2,245.12 on Dec 12, 2014.'))->setStatus(pht('Account in good standing.'))->setState(PHUIActionPanelView::STATE_SUCCESS);
     $view2->addColumn($panel1);
     $panel2 = id(new PHUIActionPanelView())->setBigText('148')->setHeader(pht('Instance Users'))->setHref('#')->setSubHeader(pht('You currently have 140 active and 8 inactive accounts'));
     $view2->addColumn($panel2);
     $panel3 = id(new PHUIActionPanelView())->setBigText('March 12')->setHeader(pht('Next Maintenance Window'))->setHref('#')->setSubHeader(pht('At 6:00 am PST, Phacility will conduct weekly maintenence.'))->setStatus(pht('Very Important!'))->setState(PHUIActionPanelView::STATE_ERROR);
     $view2->addColumn($panel3);
     $panel4 = id(new PHUIActionPanelView())->setBigText('1,113,377')->setHeader(pht('Lines of Code'))->setHref('#')->setSubHeader(pht('Your team has reviewed lots of code!'));
     $view2->addColumn($panel4);
     $view = phutil_tag_div('mlb', $view);
     return phutil_tag_div('ml', array($view, $view2));
 }
 public function processRequest()
 {
     require_celerity_resource('phabricator-profile-css');
     $viewer = $this->getRequest()->getUser();
     $user = id(new PhabricatorPeopleQuery())->setViewer($viewer)->withUsernames(array($this->username))->needProfileImage(true)->executeOne();
     if (!$user) {
         return new Aphront404Response();
     }
     $query = new PhabricatorFeedQuery();
     $query->setFilterPHIDs(array($user->getPHID()));
     $query->setLimit(100);
     $query->setViewer($viewer);
     $stories = $query->execute();
     $builder = new PhabricatorFeedBuilder($stories);
     $builder->setUser($viewer);
     $builder->setShowHovercards(true);
     $builder->setNoDataString(pht('To begin on such a grand journey, requires but just a single step.'));
     $view = $builder->buildView();
     $feed = phutil_tag_div('phabricator-project-feed', $view->render());
     $name = $user->getUsername();
     $nav = $this->buildIconNavView($user);
     $nav->selectFilter("{$name}/feed/");
     $nav->appendChild($feed);
     return $this->buildApplicationPage($nav, array('title' => pht('Feed')));
 }
 public function handleRequest(AphrontRequest $request)
 {
     $user = $request->getUser();
     $id = $request->getURIData('id');
     if ($id) {
         $post = id(new PhamePostQuery())->setViewer($user)->withIDs(array($id))->requireCapabilities(array(PhabricatorPolicyCapability::CAN_EDIT))->executeOne();
         if (!$post) {
             return new Aphront404Response();
         }
         $cancel_uri = $this->getApplicationURI('/post/view/' . $id . '/');
         $submit_button = pht('Save Changes');
         $page_title = pht('Edit Post');
     } else {
         $blog = id(new PhameBlogQuery())->setViewer($user)->withIDs(array($request->getInt('blog')))->requireCapabilities(array(PhabricatorPolicyCapability::CAN_VIEW, PhabricatorPolicyCapability::CAN_JOIN))->executeOne();
         if (!$blog) {
             return new Aphront404Response();
         }
         $post = PhamePost::initializePost($user, $blog);
         $cancel_uri = $this->getApplicationURI('/blog/view/' . $blog->getID() . '/');
         $submit_button = pht('Save Draft');
         $page_title = pht('Create Post');
     }
     $title = $post->getTitle();
     $phame_title = $post->getPhameTitle();
     $body = $post->getBody();
     $comments_widget = $post->getCommentsWidget();
     $e_title = true;
     $e_phame_title = true;
     $validation_exception = null;
     if ($request->isFormPost()) {
         $title = $request->getStr('title');
         $phame_title = $request->getStr('phame_title');
         $phame_title = PhabricatorSlug::normalize($phame_title);
         $body = $request->getStr('body');
         $comments_widget = $request->getStr('comments_widget');
         $xactions = array(id(new PhamePostTransaction())->setTransactionType(PhamePostTransaction::TYPE_TITLE)->setNewValue($title), id(new PhamePostTransaction())->setTransactionType(PhamePostTransaction::TYPE_PHAME_TITLE)->setNewValue($phame_title), id(new PhamePostTransaction())->setTransactionType(PhamePostTransaction::TYPE_BODY)->setNewValue($body), id(new PhamePostTransaction())->setTransactionType(PhamePostTransaction::TYPE_COMMENTS_WIDGET)->setNewValue($comments_widget));
         $editor = id(new PhamePostEditor())->setActor($user)->setContentSourceFromRequest($request)->setContinueOnNoEffect(true);
         try {
             $editor->applyTransactions($post, $xactions);
             $uri = $this->getApplicationURI('/post/view/' . $post->getID() . '/');
             return id(new AphrontRedirectResponse())->setURI($uri);
         } catch (PhabricatorApplicationTransactionValidationException $ex) {
             $validation_exception = $ex;
             $e_title = $validation_exception->getShortMessage(PhamePostTransaction::TYPE_TITLE);
             $e_phame_title = $validation_exception->getShortMessage(PhamePostTransaction::TYPE_PHAME_TITLE);
         }
     }
     $handle = id(new PhabricatorHandleQuery())->setViewer($user)->withPHIDs(array($post->getBlogPHID()))->executeOne();
     $form = id(new AphrontFormView())->setUser($user)->addHiddenInput('blog', $request->getInt('blog'))->appendChild(id(new AphrontFormMarkupControl())->setLabel(pht('Blog'))->setValue($handle->renderLink()))->appendChild(id(new AphrontFormTextControl())->setLabel(pht('Title'))->setName('title')->setValue($title)->setID('post-title')->setError($e_title))->appendChild(id(new AphrontFormTextControl())->setLabel(pht('Phame Title'))->setName('phame_title')->setValue(rtrim($phame_title, '/'))->setID('post-phame-title')->setCaption(pht('Up to 64 alphanumeric characters ' . 'with underscores for spaces. ' . 'Formatting is enforced.'))->setError($e_phame_title))->appendChild(id(new PhabricatorRemarkupControl())->setLabel(pht('Body'))->setName('body')->setValue($body)->setHeight(AphrontFormTextAreaControl::HEIGHT_VERY_TALL)->setID('post-body')->setUser($user)->setDisableMacros(true))->appendChild(id(new AphrontFormSelectControl())->setLabel(pht('Comments Widget'))->setName('comments_widget')->setvalue($comments_widget)->setOptions($post->getCommentsWidgetOptionsForSelect()))->appendChild(id(new AphrontFormSubmitControl())->addCancelButton($cancel_uri)->setValue($submit_button));
     $loading = phutil_tag_div('aphront-panel-preview-loading-text', pht('Loading preview...'));
     $preview_panel = phutil_tag_div('aphront-panel-preview', array(phutil_tag_div('phame-post-preview-header', pht('Post Preview')), phutil_tag('div', array('id' => 'post-preview'), $loading)));
     require_celerity_resource('phame-css');
     Javelin::initBehavior('phame-post-preview', array('preview' => 'post-preview', 'body' => 'post-body', 'title' => 'post-title', 'phame_title' => 'post-phame-title', 'uri' => '/phame/post/preview/'));
     $form_box = id(new PHUIObjectBoxView())->setHeaderText($page_title)->setValidationException($validation_exception)->setForm($form);
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb($page_title, $this->getApplicationURI('/post/view/' . $id . '/'));
     $nav = $this->renderSideNavFilterView(null);
     $nav->appendChild(array($crumbs, $form_box, $preview_panel));
     return $this->buildApplicationPage($nav, array('title' => $page_title));
 }
 public function processRequest()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $query = id(new PhabricatorNotificationQuery())->setViewer($user)->withUserPHIDs(array($user->getPHID()))->setLimit(15);
     $stories = $query->execute();
     $clear_ui_class = 'phabricator-notification-clear-all';
     $clear_uri = id(new PhutilURI('/notification/clear/'));
     if ($stories) {
         $builder = new PhabricatorNotificationBuilder($stories);
         $notifications_view = $builder->buildView();
         $content = $notifications_view->render();
         $clear_uri->setQueryParam('chronoKey', head($stories)->getChronologicalKey());
     } else {
         $content = phutil_tag_div('phabricator-notification no-notifications', pht('You have no notifications.'));
         $clear_ui_class .= ' disabled';
     }
     $clear_ui = javelin_tag('a', array('sigil' => 'workflow', 'href' => (string) $clear_uri, 'class' => $clear_ui_class), pht('Mark All Read'));
     $notifications_link = phutil_tag('a', array('href' => '/notification/'), pht('Notifications'));
     if (PhabricatorEnv::getEnvConfig('notification.enabled')) {
         $connection_status = new PhabricatorNotificationStatusView();
     } else {
         $connection_status = phutil_tag('a', array('href' => PhabricatorEnv::getDoclink('Notifications User Guide: Setup and Configuration')), pht('Notification Server not enabled.'));
     }
     $connection_ui = phutil_tag('div', array('class' => 'phabricator-notification-footer'), $connection_status);
     $header = phutil_tag('div', array('class' => 'phabricator-notification-header'), array($notifications_link, $clear_ui));
     $content = hsprintf('%s%s%s', $header, $content, $connection_ui);
     $unread_count = id(new PhabricatorFeedStoryNotification())->countUnread($user);
     $json = array('content' => $content, 'number' => (int) $unread_count);
     return id(new AphrontAjaxResponse())->setContent($json);
 }
Example #6
0
 public function render()
 {
     if ($this->header !== null) {
         $header = phutil_tag('h1', array(), $this->header);
     } else {
         $header = null;
     }
     if ($this->caption !== null) {
         $caption = phutil_tag_div('aphront-panel-view-caption', $this->caption);
     } else {
         $caption = null;
     }
     $buttons = null;
     if ($this->buttons) {
         $buttons = phutil_tag_div('aphront-panel-view-buttons', phutil_implode_html(' ', $this->buttons));
     }
     $header_elements = phutil_tag_div('aphront-panel-header', array($buttons, $header, $caption));
     $table = phutil_implode_html('', $this->renderChildren());
     require_celerity_resource('aphront-panel-view-css');
     $classes = $this->classes;
     $classes[] = 'aphront-panel-view';
     if ($this->width) {
         $classes[] = 'aphront-panel-width-' . $this->width;
     }
     return phutil_tag('div', array('class' => implode(' ', $classes), 'id' => $this->id), array($header_elements, $table));
 }
 protected function getTagContent()
 {
     require_celerity_resource('diviner-shared-css');
     $header = id(new PHUIHeaderView())->setBleedHeader(true)->addClass('diviner-section-header')->setHeader($this->header);
     $content = phutil_tag_div('diviner-section-content', $this->content);
     return array($header, $content);
 }
 protected function renderResultList(array $notifications, PhabricatorSavedQuery $query, array $handles)
 {
     assert_instances_of($notifications, 'PhabricatorFeedStory');
     $viewer = $this->requireViewer();
     $image = id(new PHUIIconView())->setIconFont('fa-eye-slash');
     $button = id(new PHUIButtonView())->setTag('a')->addSigil('workflow')->setColor(PHUIButtonView::SIMPLE)->setIcon($image)->setText(pht('Mark All Read'));
     switch ($query->getQueryKey()) {
         case 'unread':
             $header = pht('Unread Notifications');
             $no_data = pht('You have no unread notifications.');
             break;
         default:
             $header = pht('Notifications');
             $no_data = pht('You have no notifications.');
             break;
     }
     $clear_uri = id(new PhutilURI('/notification/clear/'));
     if ($notifications) {
         $builder = id(new PhabricatorNotificationBuilder($notifications))->setUser($viewer);
         $view = $builder->buildView();
         $clear_uri->setQueryParam('chronoKey', head($notifications)->getChronologicalKey());
     } else {
         $view = phutil_tag_div('phabricator-notification no-notifications', $no_data);
         $button->setDisabled(true);
     }
     $button->setHref((string) $clear_uri);
     $view = id(new PHUIBoxView())->addPadding(PHUI::PADDING_MEDIUM)->addClass('phabricator-notification-list')->appendChild($view);
     $result = new PhabricatorApplicationSearchResultView();
     $result->addAction($button);
     $result->setContent($view);
     return $result;
 }
 public function renderExample()
 {
     $view = id(new AphrontMultiColumnView())->setFluidLayout(true);
     /* Action Panels */
     $panel1 = id(new PHUIActionPanelView())->setIcon('fa-book')->setHeader(pht('Read Documentation'))->setHref('#')->setSubHeader(pht('Reading is a common way to learn about things.'))->setState(PHUIActionPanelView::COLOR_BLUE);
     $view->addColumn($panel1);
     $panel2 = id(new PHUIActionPanelView())->setIcon('fa-server')->setHeader(pht('Launch Instance'))->setHref('#')->setSubHeader(pht("Maybe this is what you're likely here for."))->setState(PHUIActionPanelView::COLOR_RED);
     $view->addColumn($panel2);
     $panel3 = id(new PHUIActionPanelView())->setIcon('fa-group')->setHeader(pht('Code with Friends'))->setHref('#')->setSubHeader(pht('Writing code is much more fun with friends!'))->setState(PHUIActionPanelView::COLOR_YELLOW);
     $view->addColumn($panel3);
     $panel4 = id(new PHUIActionPanelView())->setIcon('fa-cloud-download')->setHeader(pht('Download Data'))->setHref('#')->setSubHeader(pht('Need a backup of all your kitten memes?'))->setState(PHUIActionPanelView::COLOR_PINK);
     $view->addColumn($panel4);
     $view2 = id(new AphrontMultiColumnView())->setFluidLayout(true);
     /* Action Panels */
     $panel1 = id(new PHUIActionPanelView())->setIcon('fa-credit-card')->setHeader(pht('Account Balance'))->setHref('#')->setSubHeader(pht('You were last billed $2,245.12 on Dec 12, 2014.'))->setState(PHUIActionPanelView::COLOR_GREEN);
     $view2->addColumn($panel1);
     $panel2 = id(new PHUIActionPanelView())->setBigText(true)->setHeader(pht('Instance Users'))->setHref('#')->setSubHeader(pht('148'));
     $view2->addColumn($panel2);
     $panel3 = id(new PHUIActionPanelView())->setBigText(true)->setHeader(pht('Next Maintenance Window'))->setHref('#')->setSubHeader(pht('March 12'))->setState(PHUIActionPanelView::COLOR_ORANGE);
     $view2->addColumn($panel3);
     $panel4 = id(new PHUIActionPanelView())->setBigText(true)->setHeader(pht('Lines of Code'))->setHref('#')->setSubHeader(pht('1,113,377'))->setState(PHUIActionPanelView::COLOR_INDIGO);
     $view2->addColumn($panel4);
     $view = phutil_tag_div('mlb', $view);
     return phutil_tag_div('ml', array($view, $view2));
 }
 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $this->getViewer();
     $username = $request->getURIData('username');
     $user = id(new PhabricatorPeopleQuery())->setViewer($viewer)->withUsernames(array($username))->needBadges(true)->needProfileImage(true)->needAvailability(true)->executeOne();
     if (!$user) {
         return new Aphront404Response();
     }
     $this->setUser($user);
     $profile = $user->loadUserProfile();
     $picture = $user->getProfileImageURI();
     $profile_icon = PhabricatorPeopleIconSet::getIconIcon($profile->getIcon());
     $profile_icon = id(new PHUIIconView())->setIcon($profile_icon);
     $profile_title = $profile->getDisplayTitle();
     $header = id(new PHUIHeaderView())->setHeader($user->getFullName())->setSubheader(array($profile_icon, $profile_title))->setImage($picture)->setProfileHeader(true);
     $can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $user, PhabricatorPolicyCapability::CAN_EDIT);
     if ($can_edit) {
         $id = $user->getID();
         $header->setImageEditURL($this->getApplicationURI("picture/{$id}/"));
     }
     $properties = $this->buildPropertyView($user);
     $name = $user->getUsername();
     $feed = $this->buildPeopleFeed($user, $viewer);
     $feed = phutil_tag_div('project-view-feed', $feed);
     $projects = $this->buildProjectsView($user);
     $badges = $this->buildBadgesView($user);
     $columns = id(new PHUITwoColumnView())->addClass('project-view-badges')->setMainColumn(array($properties, $feed))->setSideColumn(array($projects, $badges));
     $nav = $this->getProfileMenu();
     $nav->selectFilter(PhabricatorPeopleProfilePanelEngine::PANEL_PROFILE);
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->setBorder(true);
     require_celerity_resource('project-view-css');
     $home = phutil_tag('div', array('class' => 'project-view-home'), array($header, $columns));
     return $this->newPage()->setTitle($user->getUsername())->setNavigation($nav)->setCrumbs($crumbs)->appendChild(array($home));
 }
 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);
 }
 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()
 {
     $question = $this->question;
     $viewer = $this->getViewer();
     $authors = mpull($question->getAnswers(), null, 'getAuthorPHID');
     if (isset($authors[$viewer->getPHID()])) {
         $view = 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.'));
         return phutil_tag_div('ponder-add-answer-view', $view);
     }
     $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;
     $header = id(new PHUIHeaderView())->setHeader(pht('New Answer'))->addClass('ponder-add-answer-header');
     $form = new AphrontFormView();
     $form->setViewer($viewer)->setAction($this->actionURI)->setWorkflow(true)->addHiddenInput('question_id', $question->getID())->appendChild(id(new PhabricatorRemarkupControl())->setName('answer')->setLabel(pht('Answer'))->setError(true)->setID('answer-content')->setViewer($viewer))->appendChild(id(new AphrontFormSubmitControl())->setValue(pht('Add Answer')));
     if (!$viewer->isLoggedIn()) {
         $login_href = id(new PhutilURI('/auth/start/'))->setQueryParam('next', '/Q' . $question->getID());
         $form = id(new PHUIFormLayoutView())->addClass('login-to-participate')->appendChild(id(new PHUIButtonView())->setTag('a')->setText(pht('Login to Answer'))->setHref((string) $login_href));
     }
     $box = id(new PHUIObjectBoxView())->appendChild($form)->setHeaderText('Answer')->addClass('ponder-add-answer-view');
     if ($info_panel) {
         $box->setInfoView($info_panel);
     }
     return array($header, $box);
 }
 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $request->getViewer();
     $blogs = id(new PhameBlogQuery())->setViewer($viewer)->withStatuses(array(PhameBlog::STATUS_ACTIVE))->needProfileImage(true)->execute();
     $post_list = null;
     if ($blogs) {
         $blog_phids = mpull($blogs, 'getPHID');
         $pager = id(new AphrontCursorPagerView())->readFromRequest($request);
         $posts = id(new PhamePostQuery())->setViewer($viewer)->withBlogPHIDs($blog_phids)->withVisibility(array(PhameConstants::VISIBILITY_PUBLISHED))->setOrder('datePublished')->executeWithCursorPager($pager);
         if ($posts) {
             $post_list = id(new PhamePostListView())->setPosts($posts)->setViewer($viewer)->showBlog(true);
         } else {
             $post_list = id(new PHUIBigInfoView())->setIcon('fa-star')->setTitle('No Visible Posts')->setDescription(pht('There aren\'t any visible blog posts.'));
         }
     } else {
         $create_button = id(new PHUIButtonView())->setTag('a')->setText(pht('Create a Blog'))->setHref('/phame/blog/edit/')->setColor(PHUIButtonView::GREEN);
         $post_list = id(new PHUIBigInfoView())->setIcon('fa-star')->setTitle('Welcome to Phame')->setDescription(pht('There aren\'t any visible blog posts.'))->addAction($create_button);
     }
     $view_all = id(new PHUIButtonView())->setTag('a')->setText(pht('View All'))->setHref($this->getApplicationURI('post/'))->setIcon('fa-list-ul');
     $title = pht('Recent Posts');
     $header = id(new PHUIHeaderView())->setHeader($title)->addActionLink($view_all);
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->setBorder(true);
     $crumbs->addTextCrumb(pht('Recent Posts'), $this->getApplicationURI('post/'));
     $page = id(new PHUIDocumentViewPro())->setHeader($header)->appendChild($post_list);
     $blog_list = id(new PhameBlogListView())->setBlogs($blogs)->setViewer($viewer);
     $draft_list = null;
     if ($viewer->isLoggedIn() && $blogs) {
         $drafts = id(new PhamePostQuery())->setViewer($viewer)->withBloggerPHIDs(array($viewer->getPHID()))->withBlogPHIDs(mpull($blogs, 'getPHID'))->withVisibility(array(PhameConstants::VISIBILITY_DRAFT))->setLimit(5)->execute();
         $draft_list = id(new PhameDraftListView())->setPosts($drafts)->setBlogs($blogs)->setViewer($viewer);
     }
     $phame_view = id(new PHUITwoColumnView())->setMainColumn(array($page))->setSideColumn(array($blog_list, $draft_list))->addClass('phame-home-container');
     $phame_home = phutil_tag_div('phame-home-view', $phame_view);
     return $this->newPage()->setTitle($title)->setCrumbs($crumbs)->appendChild(array($phame_home));
 }
 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);
 }
Example #16
0
 public function render()
 {
     $right_button = $desc = '';
     $hidden_inputs = array();
     foreach ($this->hidden as $inp) {
         list($key, $value) = $inp;
         $hidden_inputs[] = phutil_tag('input', array('type' => 'hidden', 'name' => $key, 'value' => $value));
     }
     if ($this->rightButton) {
         $right_button = phutil_tag('div', array('style' => 'float: right;'), $this->rightButton);
         $right_button = phutil_tag_div('grouped', $right_button);
     }
     if ($this->description) {
         $desc = phutil_tag('p', array(), $this->description);
     }
     $div_attributes = $this->divAttributes;
     $classes = array('phui-form-inset');
     if (isset($div_attributes['class'])) {
         $classes[] = $div_attributes['class'];
     }
     $div_attributes['class'] = implode(' ', $classes);
     $content = $hidden_inputs;
     $content[] = $right_button;
     $content[] = $desc;
     if ($this->title != '') {
         array_unshift($content, phutil_tag('h1', array(), $this->title));
     }
     if ($this->content) {
         $content[] = $this->content;
     }
     $content = array_merge($content, $this->renderChildren());
     return phutil_tag('div', $div_attributes, $content);
 }
 public final function render()
 {
     require_celerity_resource('aphront-request-failure-view-css');
     $head = phutil_tag_div('aphront-request-failure-head', phutil_tag('h1', array(), $this->header));
     $body = phutil_tag_div('aphront-request-failure-body', $this->renderChildren());
     return phutil_tag_div('aphront-request-failure-view', array($head, $body));
 }
Example #18
0
 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);
 }
 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;'))));
 }
 public function render()
 {
     $viewer = $this->getViewer();
     $this->requireResource('differential-revision-add-comment-css');
     $revision = $this->revision;
     $action = null;
     if ($this->draft) {
         $action = idx($this->draft->getMetadata(), 'action');
     }
     $enable_reviewers = DifferentialAction::allowReviewers($action);
     $enable_ccs = $action == DifferentialAction::ACTION_ADDCCS;
     $add_reviewers_labels = array('add_reviewers' => pht('Add Reviewers'), 'request_review' => pht('Add Reviewers'), 'resign' => pht('Suggest Reviewers'));
     $mailable_source = new PhabricatorMetaMTAMailableDatasource();
     // TODO: This should be a reviewers datasource, but it's a mess.
     $reviewer_source = new PhabricatorMetaMTAMailableDatasource();
     $form = new AphrontFormView();
     $form->setWorkflow(true)->setViewer($viewer)->setAction($this->actionURI)->addHiddenInput('revision_id', $revision->getID())->appendChild(id(new AphrontFormSelectControl())->setLabel(pht('Action'))->setName('action')->setValue($action)->setID('comment-action')->setOptions($this->actions))->appendControl(id(new AphrontFormTokenizerControl())->setLabel($enable_reviewers ? $add_reviewers_labels[$action] : $add_reviewers_labels['add_reviewers'])->setName('reviewers')->setControlID('add-reviewers')->setControlStyle($enable_reviewers ? null : 'display: none')->setID('add-reviewers-tokenizer')->setDisableBehavior(true)->setDatasource($reviewer_source))->appendControl(id(new AphrontFormTokenizerControl())->setLabel(pht('Add Subscribers'))->setName('ccs')->setControlID('add-ccs')->setControlStyle($enable_ccs ? null : 'display: none')->setID('add-ccs-tokenizer')->setDisableBehavior(true)->setDatasource($mailable_source))->appendChild(id(new PhabricatorRemarkupControl())->setName('comment')->setID('comment-content')->setLabel(pht('Comment'))->setValue($this->draft ? $this->draft->getDraft() : null)->setViewer($viewer))->appendChild(id(new AphrontFormSubmitControl())->setValue(pht('Submit')));
     Javelin::initBehavior('differential-add-reviewers-and-ccs', array('dynamic' => array('add-reviewers-tokenizer' => array('actions' => array('request_review' => 1, 'add_reviewers' => 1, 'resign' => 1), 'src' => $reviewer_source->getDatasourceURI(), 'value' => $this->reviewers, 'row' => 'add-reviewers', 'labels' => $add_reviewers_labels, 'placeholder' => $reviewer_source->getPlaceholderText()), 'add-ccs-tokenizer' => array('actions' => array('add_ccs' => 1), 'src' => $mailable_source->getDatasourceURI(), 'value' => $this->ccs, 'row' => 'add-ccs', 'placeholder' => $mailable_source->getPlaceholderText())), 'select' => 'comment-action'));
     $diff = $revision->loadActiveDiff();
     $rev_id = $revision->getID();
     Javelin::initBehavior('differential-feedback-preview', array('uri' => '/differential/comment/preview/' . $rev_id . '/', 'preview' => 'comment-preview', 'action' => 'comment-action', 'content' => 'comment-content', 'previewTokenizers' => array('reviewers' => 'add-reviewers-tokenizer', 'ccs' => 'add-ccs-tokenizer'), 'inlineuri' => '/differential/comment/inline/preview/' . $rev_id . '/', 'inline' => 'inline-comment-preview'));
     $is_serious = PhabricatorEnv::getEnvConfig('phabricator.serious-business');
     $header_text = $is_serious ? pht('Add Comment') : pht('Leap Into Action!');
     $header = id(new PHUIHeaderView())->setHeader($header_text);
     $anchor = id(new PhabricatorAnchorView())->setAnchorName('comment')->setNavigationMarker(true);
     $loading = phutil_tag('span', array('class' => 'aphront-panel-preview-loading-text'), pht('Loading comment preview...'));
     $preview = phutil_tag_div('aphront-panel-preview aphront-panel-flush', array(phutil_tag('div', array('id' => 'comment-preview'), $loading), phutil_tag('div', array('id' => 'inline-comment-preview'))));
     $comment_box = id(new PHUIObjectBoxView())->setHeader($header)->appendChild($anchor)->appendChild($form);
     if ($this->errorView) {
         $comment_box->setInfoView($this->errorView);
     }
     return array($comment_box, $preview);
 }
 protected function getTagContent()
 {
     require_celerity_resource('phame-css');
     $description = phutil_tag_div('phame-blog-description-content', $this->description);
     $image = phutil_tag($this->imageHref ? 'a' : 'div', array('class' => 'phame-blog-description-image', 'style' => 'background-image: url(' . $this->image . ');', 'href' => $this->imageHref));
     $header = phutil_tag('div', array('class' => 'phame-blog-description-name'), $this->title);
     return array($image, $header, $description);
 }
 public function render()
 {
     require_celerity_resource('aphront-bars');
     $ratio = $this->getRatio();
     $width = self::WIDTH * $ratio;
     $color = $this->getColor();
     return phutil_tag_div("aphront-bar progress color-{$color}", array(phutil_tag('div', array('title' => $this->alt), phutil_tag('div', array('style' => "width: {$width}px;"), '')), phutil_tag('span', array(), $this->getCaption())));
 }
Example #23
0
 /**
  * @task markup
  */
 public function didMarkupText($field, $output, PhutilMarkupEngine $engine)
 {
     $toc = PhutilRemarkupHeaderBlockRule::renderTableOfContents($engine);
     if ($toc) {
         $toc = phutil_tag_div('phabricator-remarkup-toc', array(phutil_tag_div('phabricator-remarkup-toc-header', pht('Table of Contents')), $toc));
     }
     return phutil_tag_div('phabricator-remarkup', array($toc, $output));
 }
 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $request->getViewer();
     $body = $request->getStr('body');
     $post = id(new PhamePost())->setBody($body);
     $content = PhabricatorMarkupEngine::renderOneObject($post, PhamePost::MARKUP_FIELD_BODY, $viewer);
     $content = phutil_tag_div('phabricator-remarkup', $content);
     return id(new AphrontAjaxResponse())->setContent($content);
 }
 private function renderStories(array $stories)
 {
     assert_instances_of($stories, 'PhabricatorFeedStory');
     $builder = new PhabricatorFeedBuilder($stories);
     $builder->setUser($this->getRequest()->getUser());
     $builder->setShowHovercards(true);
     $view = $builder->buildView();
     return phutil_tag_div('profile-feed', $view->render());
 }
 public function processRequest()
 {
     $request = $this->getRequest();
     $description = $request->getStr('description');
     $task = new ManiphestTask();
     $task->setDescription($description);
     $output = PhabricatorMarkupEngine::renderOneObject($task, ManiphestTask::MARKUP_FIELD_DESCRIPTION, $request->getUser());
     $content = phutil_tag_div('phabricator-remarkup', $output);
     return id(new AphrontAjaxResponse())->setContent($content);
 }
 /**
  * @task markup
  */
 public function didMarkupText($field, $output, PhutilMarkupEngine $engine)
 {
     $classes = array();
     $classes[] = 'phabricator-remarkup';
     $toc = PhutilRemarkupHeaderBlockRule::renderTableOfContents($engine);
     if ($toc) {
         $classes[] = 'remarkup-has-toc';
         $toc = phutil_tag_div('phabricator-remarkup-toc', array(phutil_tag_div('phabricator-remarkup-toc-header', pht('Table of Contents')), $toc));
     }
     return phutil_tag('div', array('class' => implode(' ', $classes)), array($toc, $output));
 }
Example #28
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);
     if ($this->getDisplay() == self::DISPLAY_LEFT) {
         $order = array($side, $main);
     } else {
         $order = array($main, $side);
     }
     return phutil_tag_div('phui-two-column-row', $order);
 }
 protected function renderResultList(array $objects, PhabricatorSavedQuery $query, array $handles)
 {
     $builder = new PhabricatorFeedBuilder($objects);
     if ($this->isPanelContext()) {
         $builder->setShowHovercards(false);
     } else {
         $builder->setShowHovercards(true);
     }
     $builder->setUser($this->requireViewer());
     $view = $builder->buildView();
     return phutil_tag_div('phabricator-feed-frame', $view);
 }
 private function buildPhameHeader(PhameBlog $blog)
 {
     $image = null;
     if ($blog->getHeaderImagePHID()) {
         $image = phutil_tag('div', array('class' => 'phame-header-hero'), phutil_tag('img', array('src' => $blog->getHeaderImageURI(), 'class' => 'phame-header-image')));
     }
     $title = phutil_tag_div('phame-header-title', $blog->getName());
     $subtitle = null;
     if ($blog->getSubtitle()) {
         $subtitle = phutil_tag_div('phame-header-subtitle', $blog->getSubtitle());
     }
     return phutil_tag_div('phame-mega-header', array($image, $title, $subtitle));
 }