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;
 }
 protected function renderResultList(array $mocks, PhabricatorSavedQuery $query, array $handles)
 {
     assert_instances_of($mocks, 'PholioMock');
     $viewer = $this->requireViewer();
     $handles = $viewer->loadHandles(mpull($mocks, 'getAuthorPHID'));
     $xform = PhabricatorFileTransform::getTransformByKey(PhabricatorFileThumbnailTransform::TRANSFORM_PINBOARD);
     $board = new PHUIPinboardView();
     foreach ($mocks as $mock) {
         $image = $mock->getCoverFile();
         $image_uri = $image->getURIForTransform($xform);
         list($x, $y) = $xform->getTransformedDimensions($image);
         $header = 'M' . $mock->getID() . ' ' . $mock->getName();
         $item = id(new PHUIPinboardItemView())->setUser($viewer)->setHeader($header)->setObject($mock)->setURI('/M' . $mock->getID())->setImageURI($image_uri)->setImageSize($x, $y)->setDisabled($mock->isClosed())->addIconCount('fa-picture-o', count($mock->getImages()))->addIconCount('fa-trophy', $mock->getTokenCount());
         if ($mock->getAuthorPHID()) {
             $author_handle = $handles[$mock->getAuthorPHID()];
             $datetime = phabricator_date($mock->getDateCreated(), $viewer);
             $item->appendChild(pht('By %s on %s', $author_handle->renderLink(), $datetime));
         }
         $board->addItem($item);
     }
     $result = new PhabricatorApplicationSearchResultView();
     $result->setContent($board);
     return $result;
 }
 protected function renderResultList(array $macros, PhabricatorSavedQuery $query, array $handles)
 {
     assert_instances_of($macros, 'PhabricatorFileImageMacro');
     $viewer = $this->requireViewer();
     $handles = $viewer->loadHandles(mpull($macros, 'getAuthorPHID'));
     $xform = PhabricatorFileTransform::getTransformByKey(PhabricatorFileThumbnailTransform::TRANSFORM_PINBOARD);
     $pinboard = new PHUIPinboardView();
     foreach ($macros as $macro) {
         $file = $macro->getFile();
         $item = id(new PHUIPinboardItemView())->setUser($viewer)->setObject($macro);
         if ($file) {
             $item->setImageURI($file->getURIForTransform($xform));
             list($x, $y) = $xform->getTransformedDimensions($file);
             $item->setImageSize($x, $y);
         }
         if ($macro->getDateCreated()) {
             $datetime = phabricator_date($macro->getDateCreated(), $viewer);
             $item->appendChild(phutil_tag('div', array(), pht('Created on %s', $datetime)));
         } else {
             // Very old macros don't have a creation date. Rendering something
             // keeps all the pins at the same height and avoids flow issues.
             $item->appendChild(phutil_tag('div', array(), pht('Created in ages long past')));
         }
         if ($macro->getAuthorPHID()) {
             $author_handle = $handles[$macro->getAuthorPHID()];
             $item->appendChild(pht('Created by %s', $author_handle->renderLink()));
         }
         $item->setURI($this->getApplicationURI('/view/' . $macro->getID() . '/'));
         $item->setDisabled($macro->getisDisabled());
         $item->setHeader($macro->getName());
         $pinboard->addItem($item);
     }
     $result = new PhabricatorApplicationSearchResultView();
     $result->setContent($pinboard);
     return $result;
 }
 protected function renderResultList(array $commits, PhabricatorSavedQuery $query, array $handles)
 {
     assert_instances_of($commits, 'PhabricatorRepositoryCommit');
     $viewer = $this->requireViewer();
     $nodata = pht('No matching audits.');
     $view = id(new PhabricatorAuditListView())->setUser($viewer)->setCommits($commits)->setAuthorityPHIDs(PhabricatorAuditCommentEditor::loadAuditPHIDsForUser($viewer))->setNoDataString($nodata);
     $phids = $view->getRequiredHandlePHIDs();
     if ($phids) {
         $handles = id(new PhabricatorHandleQuery())->setViewer($viewer)->withPHIDs($phids)->execute();
     } else {
         $handles = array();
     }
     $view->setHandles($handles);
     $list = $view->buildList();
     $result = new PhabricatorApplicationSearchResultView();
     $result->setContent($list);
     return $result;
 }
 protected function renderResultList(array $tasks, PhabricatorSavedQuery $saved, array $handles)
 {
     $viewer = $this->requireViewer();
     if ($this->isPanelContext()) {
         $can_edit_priority = false;
         $can_bulk_edit = false;
     } else {
         $can_edit_priority = PhabricatorPolicyFilter::hasCapability($viewer, $this->getApplication(), ManiphestEditPriorityCapability::CAPABILITY);
         $can_bulk_edit = PhabricatorPolicyFilter::hasCapability($viewer, $this->getApplication(), ManiphestBulkEditCapability::CAPABILITY);
     }
     $list = id(new ManiphestTaskResultListView())->setUser($viewer)->setTasks($tasks)->setSavedQuery($saved)->setCanEditPriority($can_edit_priority)->setCanBatchEdit($can_bulk_edit)->setShowBatchControls($this->showBatchControls);
     $result = new PhabricatorApplicationSearchResultView();
     $result->setContent($list);
     return $result;
 }
 protected function renderResultList(array $revisions, PhabricatorSavedQuery $query, array $handles)
 {
     assert_instances_of($revisions, 'DifferentialRevision');
     $viewer = $this->requireViewer();
     $template = id(new DifferentialRevisionListView())->setUser($viewer)->setNoBox($this->isPanelContext());
     $views = array();
     if ($query->getQueryKey() == 'active') {
         $split = DifferentialRevisionQuery::splitResponsible($revisions, $query->getParameter('responsiblePHIDs'));
         list($blocking, $active, $waiting) = $split;
         $views[] = id(clone $template)->setHeader(pht('Blocking Others'))->setNoDataString(pht('No revisions are blocked on your action.'))->setHighlightAge(true)->setRevisions($blocking)->setHandles(array());
         $views[] = id(clone $template)->setHeader(pht('Action Required'))->setNoDataString(pht('No revisions require your action.'))->setHighlightAge(true)->setRevisions($active)->setHandles(array());
         $views[] = id(clone $template)->setHeader(pht('Waiting on Others'))->setNoDataString(pht('You have no revisions waiting on others.'))->setRevisions($waiting)->setHandles(array());
     } else {
         $views[] = id(clone $template)->setRevisions($revisions)->setHandles(array());
     }
     $phids = array_mergev(mpull($views, 'getRequiredHandlePHIDs'));
     if ($phids) {
         $handles = id(new PhabricatorHandleQuery())->setViewer($viewer)->withPHIDs($phids)->execute();
     } else {
         $handles = array();
     }
     foreach ($views as $view) {
         $view->setHandles($handles);
     }
     if (count($views) == 1) {
         // Reduce this to a PHUIObjectItemListView so we can get the free
         // support from ApplicationSearch.
         $list = head($views)->render();
     } else {
         $list = $views;
     }
     $result = new PhabricatorApplicationSearchResultView();
     $result->setContent($list);
     return $result;
 }
 private function buildCalendarDayView(array $statuses, PhabricatorSavedQuery $query, array $handles)
 {
     $viewer = $this->requireViewer();
     list($start_year, $start_month, $start_day) = $this->getDisplayYearAndMonthAndDay($this->getQueryDateFrom($query)->getEpoch(), $this->getQueryDateTo($query)->getEpoch(), $query->getParameter('display'));
     $day_view = id(new PHUICalendarDayView($this->getQueryDateFrom($query)->getEpoch(), $this->getQueryDateTo($query)->getEpoch(), $start_year, $start_month, $start_day))->setQuery($query->getQueryKey());
     $day_view->setUser($viewer);
     $phids = mpull($statuses, 'getUserPHID');
     foreach ($statuses as $status) {
         if ($status->getIsCancelled()) {
             continue;
         }
         $viewer_is_invited = $status->getIsUserInvited($viewer->getPHID());
         $can_edit = PhabricatorPolicyFilter::hasCapability($viewer, $status, PhabricatorPolicyCapability::CAN_EDIT);
         $event = new AphrontCalendarEventView();
         $event->setCanEdit($can_edit);
         $event->setEventID($status->getID());
         $event->setEpochRange($status->getDateFrom(), $status->getDateTo());
         $event->setIsAllDay($status->getIsAllDay());
         $event->setIcon($status->getIcon());
         $event->setViewerIsInvited($viewer_is_invited);
         $event->setName($status->getName());
         $event->setURI($status->getURI());
         $day_view->addEvent($event);
     }
     $day_view->setBrowseURI($this->getURI('query/' . $query->getQueryKey() . '/'));
     $result = new PhabricatorApplicationSearchResultView();
     $result->setContent($day_view);
     return $result;
 }
 protected function renderResultList(array $conpherences, PhabricatorSavedQuery $query, array $handles)
 {
     assert_instances_of($conpherences, 'ConpherenceThread');
     $viewer = $this->requireViewer();
     $policy_objects = ConpherenceThread::loadViewPolicyObjects($viewer, $conpherences);
     $engines = array();
     $fulltext = $query->getParameter('fulltext');
     if (strlen($fulltext) && $conpherences) {
         $context = $this->loadContextMessages($conpherences, $fulltext);
         $author_phids = array();
         foreach ($context as $phid => $messages) {
             $conpherence = $conpherences[$phid];
             $engine = id(new PhabricatorMarkupEngine())->setViewer($viewer)->setContextObject($conpherence);
             foreach ($messages as $group) {
                 foreach ($group as $message) {
                     $xaction = $message['xaction'];
                     if ($xaction) {
                         $author_phids[] = $xaction->getAuthorPHID();
                         $engine->addObject($xaction->getComment(), PhabricatorApplicationTransactionComment::MARKUP_FIELD_COMMENT);
                     }
                 }
             }
             $engine->process();
             $engines[$phid] = $engine;
         }
         $handles = $viewer->loadHandles($author_phids);
         $handles = iterator_to_array($handles);
     } else {
         $context = array();
     }
     $content = array();
     $list = new PHUIObjectItemListView();
     $list->setUser($viewer);
     foreach ($conpherences as $conpherence_phid => $conpherence) {
         $created = phabricator_date($conpherence->getDateCreated(), $viewer);
         $title = $conpherence->getDisplayTitle($viewer);
         $monogram = $conpherence->getMonogram();
         $icon_name = $conpherence->getPolicyIconName($policy_objects);
         $icon = id(new PHUIIconView())->setIcon($icon_name);
         if (!strlen($fulltext)) {
             $item = id(new PHUIObjectItemView())->setObjectName($conpherence->getMonogram())->setHeader($title)->setHref('/' . $conpherence->getMonogram())->setObject($conpherence)->setImageURI($conpherence->getProfileImageURI())->addIcon('none', $created)->addIcon('none', pht('Messages: %d', $conpherence->getMessageCount()))->addAttribute(array($icon, ' ', pht('Last updated %s', phabricator_datetime($conpherence->getDateModified(), $viewer))));
             $list->addItem($item);
         } else {
             $messages = idx($context, $conpherence_phid);
             $box = array();
             $list = null;
             if ($messages) {
                 foreach ($messages as $group) {
                     $rows = array();
                     foreach ($group as $message) {
                         $xaction = $message['xaction'];
                         if (!$xaction) {
                             continue;
                         }
                         $view = id(new ConpherenceTransactionView())->setUser($viewer)->setHandles($handles)->setMarkupEngine($engines[$conpherence_phid])->setConpherenceThread($conpherence)->setConpherenceTransaction($xaction)->setSearchResult(true)->addClass('conpherence-fulltext-result');
                         if ($message['match']) {
                             $view->addClass('conpherence-fulltext-match');
                         }
                         $rows[] = $view;
                     }
                     $box[] = id(new PHUIBoxView())->appendChild($rows)->addClass('conpherence-fulltext-results');
                 }
             }
             $header = id(new PHUIHeaderView())->setHeader($title)->setHeaderIcon($icon_name)->setHref('/' . $monogram);
             $content[] = id(new PHUIObjectBoxView())->setHeader($header)->appendChild($box);
         }
     }
     if ($list) {
         $content = $list;
     } else {
         $content = id(new PHUIBoxView())->addClass('conpherence-search-room-results')->appendChild($content);
     }
     $result = new PhabricatorApplicationSearchResultView();
     $result->setContent($content);
     $result->setNoDataString(pht('No results found.'));
     return $result;
 }
 protected function renderResultList(array $all_applications, PhabricatorSavedQuery $query, array $handle)
 {
     assert_instances_of($all_applications, 'PhabricatorApplication');
     $all_applications = msort($all_applications, 'getName');
     if ($query->getQueryKey() == 'launcher') {
         $groups = mgroup($all_applications, 'getApplicationGroup');
     } else {
         $groups = array($all_applications);
     }
     $group_names = PhabricatorApplication::getApplicationGroups();
     $groups = array_select_keys($groups, array_keys($group_names)) + $groups;
     $results = array();
     foreach ($groups as $group => $applications) {
         if (count($groups) > 1) {
             $results[] = phutil_tag('h1', array('class' => 'phui-object-item-list-header'), idx($group_names, $group, $group));
         }
         $list = new PHUIObjectItemListView();
         foreach ($applications as $application) {
             $icon = $application->getFontIcon();
             if (!$icon) {
                 $icon = 'application';
             }
             // TODO: This sheet doesn't work the same way other sheets do so it
             // ends up with the wrong classes if we try to use PHUIIconView. This
             // is probably all changing in the redesign anyway.
             $icon_view = javelin_tag('span', array('class' => 'phui-icon-view phui-font-fa ' . $icon, 'aural' => false), '');
             $description = $application->getShortDescription();
             $configure = id(new PHUIButtonView())->setTag('a')->setHref('/applications/view/' . get_class($application) . '/')->setText(pht('Configure'))->setColor(PHUIButtonView::GREY);
             $name = $application->getName();
             if ($application->isPrototype()) {
                 $name = $name . ' ' . pht('(Prototype)');
             }
             $item = id(new PHUIObjectItemView())->setHeader($name)->setImageIcon($icon_view)->setSubhead($description)->setLaunchButton($configure);
             if ($application->getBaseURI() && $application->isInstalled()) {
                 $item->setHref($application->getBaseURI());
             }
             if (!$application->isInstalled()) {
                 $item->addAttribute(pht('Uninstalled'));
                 $item->setDisabled(true);
             }
             if (!$application->isFirstParty()) {
                 $item->addAttribute(pht('Extension'));
             }
             $list->addItem($item);
         }
         $results[] = $list;
     }
     $result = new PhabricatorApplicationSearchResultView();
     $result->setContent($results);
     return $result;
 }
 protected function renderResultList(array $methods, PhabricatorSavedQuery $query, array $handles)
 {
     assert_instances_of($methods, 'ConduitAPIMethod');
     $viewer = $this->requireViewer();
     $out = array();
     $last = null;
     $list = null;
     foreach ($methods as $method) {
         $app = $method->getApplicationName();
         if ($app !== $last) {
             $last = $app;
             if ($list) {
                 $out[] = $list;
             }
             $list = id(new PHUIObjectItemListView());
             $list->setHeader($app);
             $app_object = $method->getApplication();
             if ($app_object) {
                 $app_name = $app_object->getName();
             } else {
                 $app_name = $app;
             }
         }
         $method_name = $method->getAPIMethodName();
         $item = id(new PHUIObjectItemView())->setHeader($method_name)->setHref($this->getApplicationURI('method/' . $method_name . '/'))->addAttribute($method->getMethodSummary());
         switch ($method->getMethodStatus()) {
             case ConduitAPIMethod::METHOD_STATUS_STABLE:
                 break;
             case ConduitAPIMethod::METHOD_STATUS_UNSTABLE:
                 $item->addIcon('fa-warning', pht('Unstable'));
                 $item->setStatusIcon('fa-warning yellow');
                 break;
             case ConduitAPIMethod::METHOD_STATUS_DEPRECATED:
                 $item->addIcon('fa-warning', pht('Deprecated'));
                 $item->setStatusIcon('fa-warning red');
                 break;
         }
         $list->addItem($item);
     }
     if ($list) {
         $out[] = $list;
     }
     $result = new PhabricatorApplicationSearchResultView();
     $result->setContent($out);
     return $result;
 }
 protected function renderResultList(array $files, PhabricatorSavedQuery $query, array $handles)
 {
     assert_instances_of($files, 'PhabricatorFile');
     $request = $this->getRequest();
     if ($request) {
         $highlighted_ids = $request->getStrList('h');
     } else {
         $highlighted_ids = array();
     }
     $viewer = $this->requireViewer();
     $highlighted_ids = array_fill_keys($highlighted_ids, true);
     $list_view = id(new PHUIObjectItemListView())->setUser($viewer);
     foreach ($files as $file) {
         $id = $file->getID();
         $phid = $file->getPHID();
         $name = $file->getName();
         $file_uri = $this->getApplicationURI("/info/{$phid}/");
         $date_created = phabricator_date($file->getDateCreated(), $viewer);
         $author_phid = $file->getAuthorPHID();
         if ($author_phid) {
             $author_link = $handles[$author_phid]->renderLink();
             $uploaded = pht('Uploaded by %s on %s', $author_link, $date_created);
         } else {
             $uploaded = pht('Uploaded on %s', $date_created);
         }
         $item = id(new PHUIObjectItemView())->setObject($file)->setObjectName("F{$id}")->setHeader($name)->setHref($file_uri)->addAttribute($uploaded)->addIcon('none', phutil_format_bytes($file->getByteSize()));
         $ttl = $file->getTTL();
         if ($ttl !== null) {
             $item->addIcon('blame', pht('Temporary'));
         }
         if ($file->getIsPartial()) {
             $item->addIcon('fa-exclamation-triangle orange', pht('Partial'));
         }
         if (isset($highlighted_ids[$id])) {
             $item->setEffect('highlighted');
         }
         $list_view->addItem($item);
     }
     $list_view->appendChild(id(new PhabricatorGlobalUploadTargetView())->setUser($viewer));
     $result = new PhabricatorApplicationSearchResultView();
     $result->setContent($list_view);
     return $result;
 }
 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();
     $list = phutil_tag_div('phabricator-feed-frame', $view);
     $result = new PhabricatorApplicationSearchResultView();
     $result->setContent($list);
     return $result;
 }
 protected function renderResultList(array $all_applications, PhabricatorSavedQuery $query, array $handle)
 {
     assert_instances_of($all_applications, 'PhabricatorApplication');
     $all_applications = msort($all_applications, 'getName');
     if ($query->getQueryKey() == 'launcher') {
         $groups = mgroup($all_applications, 'getApplicationGroup');
     } else {
         $groups = array($all_applications);
     }
     $group_names = PhabricatorApplication::getApplicationGroups();
     $groups = array_select_keys($groups, array_keys($group_names)) + $groups;
     $results = array();
     foreach ($groups as $group => $applications) {
         if (count($groups) > 1) {
             $results[] = phutil_tag('h1', array('class' => 'phui-object-item-list-header'), idx($group_names, $group, $group));
         }
         $list = new PHUIObjectItemListView();
         foreach ($applications as $application) {
             $icon = $application->getFontIcon();
             if (!$icon) {
                 $icon = 'application';
             }
             // TODO: This sheet doesn't work the same way other sheets do so it
             // ends up with the wrong classes if we try to use PHUIIconView. This
             // is probably all changing in the redesign anyway.
             $icon_view = javelin_tag('span', array('class' => 'phui-icon-view phui-font-fa ' . $icon, 'aural' => false), '');
             $description = phutil_tag('div', array('style' => 'white-space: nowrap; ' . 'overflow: hidden; ' . 'text-overflow: ellipsis;'), $application->getShortDescription());
             $item = id(new PHUIObjectItemView())->setHeader($application->getName())->setImageIcon($icon_view)->addAttribute($description)->addAction(id(new PHUIListItemView())->setName(pht('Help/Options'))->setIcon('fa-cog')->setHref('/applications/view/' . get_class($application) . '/'));
             if ($application->getBaseURI() && $application->isInstalled()) {
                 $item->setHref($application->getBaseURI());
             }
             if (!$application->isInstalled()) {
                 $item->addIcon('fa-times', pht('Uninstalled'));
             }
             if ($application->isPrototype()) {
                 $item->addIcon('fa-bomb grey', pht('Prototype'));
             }
             if (!$application->isFirstParty()) {
                 $item->addIcon('fa-puzzle-piece', pht('Extension'));
             }
             $list->addItem($item);
         }
         $results[] = $list;
     }
     $result = new PhabricatorApplicationSearchResultView();
     $result->setContent($results);
     return $result;
 }
 protected function renderResultList(array $revisions, PhabricatorSavedQuery $query, array $handles)
 {
     assert_instances_of($revisions, 'DifferentialRevision');
     $viewer = $this->requireViewer();
     $template = id(new DifferentialRevisionListView())->setUser($viewer)->setNoBox($this->isPanelContext());
     $bucket = $this->getResultBucket($query);
     $unlanded = $this->loadUnlandedDependencies($revisions);
     $views = array();
     if ($bucket) {
         $bucket->setViewer($viewer);
         try {
             $groups = $bucket->newResultGroups($query, $revisions);
             foreach ($groups as $group) {
                 $views[] = id(clone $template)->setHeader($group->getName())->setNoDataString($group->getNoDataString())->setRevisions($group->getObjects());
             }
         } catch (Exception $ex) {
             $this->addError($ex->getMessage());
         }
     } else {
         $views[] = id(clone $template)->setRevisions($revisions)->setHandles(array());
     }
     $phids = array_mergev(mpull($views, 'getRequiredHandlePHIDs'));
     if ($phids) {
         $handles = id(new PhabricatorHandleQuery())->setViewer($viewer)->withPHIDs($phids)->execute();
     } else {
         $handles = array();
     }
     foreach ($views as $view) {
         $view->setHandles($handles);
         $view->setUnlandedDependencies($unlanded);
     }
     if (count($views) == 1) {
         // Reduce this to a PHUIObjectItemListView so we can get the free
         // support from ApplicationSearch.
         $list = head($views)->render();
     } else {
         $list = $views;
     }
     $result = new PhabricatorApplicationSearchResultView();
     $result->setContent($list);
     return $result;
 }
 protected function renderResultList(array $all_applications, PhabricatorSavedQuery $query, array $handle)
 {
     assert_instances_of($all_applications, 'PhabricatorApplication');
     $all_applications = msort($all_applications, 'getName');
     if ($query->getQueryKey() == 'launcher') {
         $groups = mgroup($all_applications, 'getApplicationGroup');
     } else {
         $groups = array($all_applications);
     }
     $group_names = PhabricatorApplication::getApplicationGroups();
     $groups = array_select_keys($groups, array_keys($group_names)) + $groups;
     $results = array();
     foreach ($groups as $group => $applications) {
         if (count($groups) > 1) {
             $results[] = phutil_tag('h1', array('class' => 'phui-object-item-list-header'), idx($group_names, $group, $group));
         }
         $list = new PHUIObjectItemListView();
         foreach ($applications as $application) {
             $icon = $application->getIcon();
             if (!$icon) {
                 $icon = 'application';
             }
             $description = $application->getShortDescription();
             $configure = id(new PHUIButtonView())->setTag('a')->setHref('/applications/view/' . get_class($application) . '/')->setText(pht('Configure'))->setColor(PHUIButtonView::GREY);
             $name = $application->getName();
             if ($application->isPrototype()) {
                 $name = $name . ' ' . pht('(Prototype)');
             }
             $item = id(new PHUIObjectItemView())->setHeader($name)->setImageIcon($icon)->setSubhead($description)->setLaunchButton($configure);
             if ($application->getBaseURI() && $application->isInstalled()) {
                 $item->setHref($application->getBaseURI());
             }
             if (!$application->isInstalled()) {
                 $item->addAttribute(pht('Uninstalled'));
                 $item->setDisabled(true);
             }
             if (!$application->isFirstParty()) {
                 $item->addAttribute(pht('Extension'));
             }
             $list->addItem($item);
         }
         $results[] = $list;
     }
     $result = new PhabricatorApplicationSearchResultView();
     $result->setContent($results);
     return $result;
 }