public function render()
 {
     $handles = $this->handles;
     require_celerity_resource('maniphest-task-summary-css');
     $list = new PHUIObjectItemListView();
     if ($this->noDataString) {
         $list->setNoDataString($this->noDataString);
     } else {
         $list->setNoDataString(pht('No tasks.'));
     }
     $status_map = ManiphestTaskStatus::getTaskStatusMap();
     $color_map = ManiphestTaskPriority::getColorMap();
     $priority_map = ManiphestTaskPriority::getTaskPriorityMap();
     if ($this->showBatchControls) {
         Javelin::initBehavior('maniphest-list-editor');
     }
     foreach ($this->tasks as $task) {
         $item = id(new PHUIObjectItemView())->setUser($this->getUser())->setObject($task)->setObjectName('T' . $task->getID())->setHeader($task->getTitle())->setHref('/T' . $task->getID());
         if ($task->getOwnerPHID()) {
             $owner = $handles[$task->getOwnerPHID()];
             $item->addByline(pht('Assigned: %s', $owner->renderLink()));
         }
         $status = $task->getStatus();
         $pri = idx($priority_map, $task->getPriority());
         $status_name = idx($status_map, $task->getStatus());
         $tooltip = pht('%s, %s', $status_name, $pri);
         $icon = ManiphestTaskStatus::getStatusIcon($task->getStatus());
         $color = idx($color_map, $task->getPriority(), 'grey');
         if ($task->isClosed()) {
             $item->setDisabled(true);
             $color = 'grey';
         }
         $item->setStatusIcon($icon . ' ' . $color, $tooltip);
         $item->addIcon('none', phabricator_datetime($task->getDateModified(), $this->getUser()));
         if ($this->showSubpriorityControls) {
             $item->setGrippable(true);
         }
         if ($this->showSubpriorityControls || $this->showBatchControls) {
             $item->addSigil('maniphest-task');
         }
         $project_handles = array_select_keys($handles, array_reverse($task->getProjectPHIDs()));
         $item->addAttribute(id(new PHUIHandleTagListView())->setLimit(4)->setNoDataString(pht('No Projects'))->setSlim(true)->setHandles($project_handles));
         $item->setMetadata(array('taskID' => $task->getID()));
         if ($this->showBatchControls) {
             $href = new PhutilURI('/maniphest/task/edit/' . $task->getID() . '/');
             if (!$this->showSubpriorityControls) {
                 $href->setQueryParam('ungrippable', 'true');
             }
             $item->addAction(id(new PHUIListItemView())->setIcon('fa-pencil')->addSigil('maniphest-edit-task')->setHref($href));
         }
         $list->addItem($item);
     }
     return $list;
 }
 public function render()
 {
     $viewer = $this->getUser();
     $authorizations = $this->authorizations;
     $view = new PHUIObjectItemListView();
     $nodata = $this->getNoDataString();
     if ($nodata) {
         $view->setNoDataString($nodata);
     }
     $handles = $viewer->loadHandles(mpull($authorizations, 'getObjectPHID'));
     foreach ($authorizations as $authorization) {
         $id = $authorization->getID();
         $object_phid = $authorization->getObjectPHID();
         $handle = $handles[$object_phid];
         $item = id(new PHUIObjectItemView())->setHref("/drydock/authorization/{$id}/")->setObjectName(pht('Authorization %d', $id))->setHeader($handle->getFullName());
         $item->addAttribute($handle->getTypeName());
         $object_state = $authorization->getObjectAuthorizationState();
         $item->addAttribute(DrydockAuthorization::getObjectStateName($object_state));
         $state = $authorization->getBlueprintAuthorizationState();
         $icon = DrydockAuthorization::getBlueprintStateIcon($state);
         $name = DrydockAuthorization::getBlueprintStateName($state);
         $item->setStatusIcon($icon, $name);
         $view->addItem($item);
     }
     return $view;
 }
 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $this->getViewer();
     $configs = id(new PhabricatorAuthProviderConfigQuery())->setViewer($viewer)->execute();
     $list = new PHUIObjectItemListView();
     $can_manage = $this->hasApplicationCapability(AuthManageProvidersCapability::CAPABILITY);
     foreach ($configs as $config) {
         $item = new PHUIObjectItemView();
         $id = $config->getID();
         $edit_uri = $this->getApplicationURI('config/edit/' . $id . '/');
         $enable_uri = $this->getApplicationURI('config/enable/' . $id . '/');
         $disable_uri = $this->getApplicationURI('config/disable/' . $id . '/');
         $provider = $config->getProvider();
         if ($provider) {
             $name = $provider->getProviderName();
         } else {
             $name = $config->getProviderType() . ' (' . $config->getProviderClass() . ')';
         }
         $item->setHeader($name);
         if ($provider) {
             $item->setHref($edit_uri);
         } else {
             $item->addAttribute(pht('Provider Implementation Missing!'));
         }
         $domain = null;
         if ($provider) {
             $domain = $provider->getProviderDomain();
             if ($domain !== 'self') {
                 $item->addAttribute($domain);
             }
         }
         if ($config->getShouldAllowRegistration()) {
             $item->addAttribute(pht('Allows Registration'));
         } else {
             $item->addAttribute(pht('Does Not Allow Registration'));
         }
         if ($config->getIsEnabled()) {
             $item->setStatusIcon('fa-check-circle green');
             $item->addAction(id(new PHUIListItemView())->setIcon('fa-times')->setHref($disable_uri)->setDisabled(!$can_manage)->addSigil('workflow'));
         } else {
             $item->setStatusIcon('fa-ban red');
             $item->addIcon('fa-ban grey', pht('Disabled'));
             $item->addAction(id(new PHUIListItemView())->setIcon('fa-plus')->setHref($enable_uri)->setDisabled(!$can_manage)->addSigil('workflow'));
         }
         $list->addItem($item);
     }
     $list->setNoDataString(pht('%s You have not added authentication providers yet. Use "%s" to add ' . 'a provider, which will let users register new Phabricator accounts ' . 'and log in.', phutil_tag('strong', array(), pht('No Providers Configured:')), phutil_tag('a', array('href' => $this->getApplicationURI('config/new/')), pht('Add Authentication Provider'))));
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb(pht('Auth Providers'));
     $crumbs->setBorder(true);
     $guidance_context = new PhabricatorAuthProvidersGuidanceContext();
     $guidance = id(new PhabricatorGuidanceEngine())->setViewer($viewer)->setGuidanceContext($guidance_context)->newInfoView();
     $button = id(new PHUIButtonView())->setTag('a')->setColor(PHUIButtonView::SIMPLE)->setHref($this->getApplicationURI('config/new/'))->setIcon('fa-plus')->setDisabled(!$can_manage)->setText(pht('Add Provider'));
     $list->setFlush(true);
     $list = id(new PHUIObjectBoxView())->setHeaderText(pht('Providers'))->setBackground(PHUIObjectBoxView::BLUE_PROPERTY)->appendChild($list);
     $title = pht('Auth Providers');
     $header = id(new PHUIHeaderView())->setHeader($title)->setHeaderIcon('fa-key')->addActionLink($button);
     $view = id(new PHUITwoColumnView())->setHeader($header)->setFooter(array($guidance, $list));
     return $this->newPage()->setTitle($title)->setCrumbs($crumbs)->appendChild($view);
 }
 public function render()
 {
     $list = new PHUIObjectItemListView();
     $list->setFlush(true);
     foreach ($this->edits as $edit) {
         $name = nonempty($edit->getRuleName(), 'Unknown Rule');
         $rule_name = phutil_tag('strong', array(), $name);
         switch ($edit->getAction()) {
             case 'create':
                 $details = pht("Created rule '%s'.", $rule_name);
                 break;
             case 'delete':
                 $details = pht("Deleted rule '%s'.", $rule_name);
                 break;
             case 'edit':
             default:
                 $details = pht("Edited rule '%s'.", $rule_name);
                 break;
         }
         $editor = $this->handles[$edit->getEditorPHID()]->renderLink();
         $date = phabricator_datetime($edit->getDateCreated(), $this->user);
         $item = id(new PHUIObjectItemView())->setObjectName(pht('Rule %d', $edit->getRuleID()))->setSubHead($details)->addIcon('none', $date)->addByLine(pht('Editor: %s', $editor));
         $list->addItem($item);
     }
     $list->setNoDataString(pht('No edits for rule.'));
     return $list;
 }
 private function processImportRequest($request)
 {
     $admin = $request->getUser();
     $usernames = $request->getArr('usernames');
     $emails = $request->getArr('email');
     $names = $request->getArr('name');
     $notice_view = new PHUIInfoView();
     $notice_view->setSeverity(PHUIInfoView::SEVERITY_NOTICE);
     $notice_view->setTitle(pht('Import Successful'));
     $notice_view->setErrors(array(pht('Successfully imported users from LDAP')));
     $list = new PHUIObjectItemListView();
     $list->setNoDataString(pht('No users imported?'));
     foreach ($usernames as $username) {
         $user = new PhabricatorUser();
         $user->setUsername($username);
         $user->setRealname($names[$username]);
         $email_obj = id(new PhabricatorUserEmail())->setAddress($emails[$username])->setIsVerified(1);
         try {
             id(new PhabricatorUserEditor())->setActor($admin)->createNewUser($user, $email_obj);
             id(new PhabricatorExternalAccount())->setUserPHID($user->getPHID())->setAccountType('ldap')->setAccountDomain('self')->setAccountID($username)->save();
             $header = pht('Successfully added %s', $username);
             $attribute = null;
             $color = 'fa-check green';
         } catch (Exception $ex) {
             $header = pht('Failed to add %s', $username);
             $attribute = $ex->getMessage();
             $color = 'fa-times red';
         }
         $item = id(new PHUIObjectItemView())->setHeader($header)->addAttribute($attribute)->setStatusIcon($color);
         $list->addItem($item);
     }
     return array($notice_view, $list);
 }
 public function handleRequest(AphrontRequest $request)
 {
     $viewer = $request->getViewer();
     $view = $request->getURIData('view');
     if (!$view) {
         $view = 'all';
     }
     $pager = new PHUIPagerView();
     $pager->setOffset($request->getInt('page'));
     switch ($view) {
         case 'sampled':
             $clause = 'sampleRate > 0';
             $show_type = false;
             break;
         case 'my-runs':
             $clause = qsprintf(id(new PhabricatorXHProfSample())->establishConnection('r'), 'sampleRate = 0 AND userPHID = %s', $request->getUser()->getPHID());
             $show_type = false;
             break;
         case 'manual':
             $clause = 'sampleRate = 0';
             $show_type = false;
             break;
         case 'all':
         default:
             $clause = '1 = 1';
             $show_type = true;
             break;
     }
     $samples = id(new PhabricatorXHProfSample())->loadAllWhere('%Q ORDER BY id DESC LIMIT %d, %d', $clause, $pager->getOffset(), $pager->getPageSize() + 1);
     $samples = $pager->sliceResults($samples);
     $pager->setURI($request->getRequestURI(), 'page');
     $list = new PHUIObjectItemListView();
     foreach ($samples as $sample) {
         $file_phid = $sample->getFilePHID();
         $item = id(new PHUIObjectItemView())->setObjectName($sample->getID())->setHeader($sample->getRequestPath())->setHref($this->getApplicationURI('profile/' . $file_phid . '/'))->addAttribute(number_format($sample->getUsTotal()) . " μs");
         if ($sample->getController()) {
             $item->addAttribute($sample->getController());
         }
         $item->addAttribute($sample->getHostName());
         $rate = $sample->getSampleRate();
         if ($rate == 0) {
             $item->addIcon('flag-6', pht('Manual Run'));
         } else {
             $item->addIcon('flag-7', pht('Sampled (1/%d)', $rate));
         }
         $item->addIcon('none', phabricator_datetime($sample->getDateCreated(), $viewer));
         $list->addItem($item);
     }
     $list->setPager($pager);
     $list->setNoDataString(pht('There are no profiling samples.'));
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb(pht('XHProf Samples'));
     $title = pht('XHProf Samples');
     return $this->newPage()->setTitle($title)->setCrumbs($crumbs)->appendChild($list);
 }
 private function renderBlogList(array $blogs, PhabricatorUser $user, $nodata)
 {
     $view = new PHUIObjectItemListView();
     $view->setNoDataString($nodata);
     $view->setUser($user);
     foreach ($blogs as $blog) {
         $item = id(new PHUIObjectItemView())->setHeader($blog->getName())->setHref($this->getApplicationURI('blog/view/' . $blog->getID() . '/'))->setObject($blog);
         $view->addItem($item);
     }
     return $view;
 }
 private function renderBlogList(array $blogs, PhabricatorUser $viewer, $nodata)
 {
     $view = new PHUIObjectItemListView();
     $view->setNoDataString($nodata);
     $view->setUser($viewer);
     foreach ($blogs as $blog) {
         $id = $blog->getID();
         $item = id(new PHUIObjectItemView())->setUser($viewer)->setObject($blog)->setHeader($blog->getName())->setStatusIcon('fa-star')->setHref($this->getApplicationURI("/blog/view/{$id}/"))->addAttribute($blog->getSkin())->addAttribute($blog->getDomain());
         $view->addItem($item);
     }
     return $view;
 }
 private function buildApplyTranscriptPanel(HeraldTranscript $xscript)
 {
     $handles = $this->handles;
     $adapter = $this->getAdapter();
     $rule_type_global = HeraldRuleTypeConfig::RULE_TYPE_GLOBAL;
     $action_names = $adapter->getActionNameMap($rule_type_global);
     $list = new PHUIObjectItemListView();
     $list->setStates(true);
     $list->setNoDataString(pht('No actions were taken.'));
     foreach ($xscript->getApplyTranscripts() as $apply_xscript) {
         $target = $apply_xscript->getTarget();
         switch ($apply_xscript->getAction()) {
             case HeraldAdapter::ACTION_NOTHING:
                 $target = null;
                 break;
             case HeraldAdapter::ACTION_FLAG:
                 $target = PhabricatorFlagColor::getColorName($target);
                 break;
             case HeraldAdapter::ACTION_BLOCK:
                 // Target is a text string.
                 $target = $target;
                 break;
             default:
                 if (is_array($target) && $target) {
                     foreach ($target as $k => $phid) {
                         if (isset($handles[$phid])) {
                             $target[$k] = $handles[$phid]->getName();
                         }
                     }
                     $target = implode(', ', $target);
                 } else {
                     if (is_string($target)) {
                         $target = $target;
                     } else {
                         $target = '<empty>';
                     }
                 }
                 break;
         }
         $item = new PHUIObjectItemView();
         if ($apply_xscript->getApplied()) {
             $item->setState(PHUIObjectItemView::STATE_SUCCESS);
         } else {
             $item->setState(PHUIObjectItemView::STATE_FAIL);
         }
         $rule = idx($action_names, $apply_xscript->getAction(), pht('Unknown Action "%s"', $apply_xscript->getAction()));
         $item->setHeader(pht('%s: %s', $rule, $target));
         $item->addAttribute($apply_xscript->getReason());
         $item->addAttribute(pht('Outcome: %s', $apply_xscript->getAppliedReason()));
         $list->addItem($item);
     }
     $box = new PHUIObjectBoxView();
     $box->setHeaderText(pht('Actions Taken'));
     $box->appendChild($list);
     return $box;
 }
 private function processEditRequest()
 {
     $parent = $this->getDelegatingController();
     $request = $this->getRequest();
     $user = $request->getUser();
     $engine = $this->getSearchEngine();
     $nav = $this->getNavigation();
     if (!$nav) {
         $nav = $this->buildNavigation();
     }
     $named_queries = $engine->loadAllNamedQueries();
     $list_id = celerity_generate_unique_node_id();
     $list = new PHUIObjectItemListView();
     $list->setUser($user);
     $list->setID($list_id);
     Javelin::initBehavior('search-reorder-queries', array('listID' => $list_id, 'orderURI' => '/search/order/' . get_class($engine) . '/'));
     foreach ($named_queries as $named_query) {
         $class = get_class($engine);
         $key = $named_query->getQueryKey();
         $item = id(new PHUIObjectItemView())->setHeader($named_query->getQueryName())->setHref($engine->getQueryResultsPageURI($key));
         if ($named_query->getIsBuiltin() && $named_query->getIsDisabled()) {
             $icon = 'fa-plus';
         } else {
             $icon = 'fa-times';
         }
         $item->addAction(id(new PHUIListItemView())->setIcon($icon)->setHref('/search/delete/' . $key . '/' . $class . '/')->setWorkflow(true));
         if ($named_query->getIsBuiltin()) {
             if ($named_query->getIsDisabled()) {
                 $item->addIcon('fa-times lightgreytext', pht('Disabled'));
                 $item->setDisabled(true);
             } else {
                 $item->addIcon('fa-lock lightgreytext', pht('Builtin'));
             }
         } else {
             $item->addAction(id(new PHUIListItemView())->setIcon('fa-pencil')->setHref('/search/edit/' . $key . '/'));
         }
         $item->setGrippable(true);
         $item->addSigil('named-query');
         $item->setMetadata(array('queryKey' => $named_query->getQueryKey()));
         $list->addItem($item);
     }
     $list->setNoDataString(pht('No saved queries.'));
     $crumbs = $parent->buildApplicationCrumbs()->addTextCrumb(pht('Saved Queries'), $engine->getQueryManagementURI());
     $nav->selectFilter('query/edit');
     $box = id(new PHUIObjectBoxView())->setHeaderText(pht('Saved Queries'))->setObjectList($list);
     return $this->newPage()->setApplicationMenu($this->buildApplicationMenu())->setTitle(pht('Saved Queries'))->setCrumbs($crumbs)->setNavigation($nav)->appendChild($box);
 }
 public function renderExample()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $handle = id(new PhabricatorHandleQuery())->setViewer($user)->withPHIDs(array($user->getPHID()))->executeOne();
     $out = array();
     $head = id(new PHUIHeaderView())->setHeader(pht('Basic List'));
     $list = new PHUIObjectItemListView();
     $list->addItem(id(new PHUIObjectItemView())->setObjectName('FRUIT1')->setHeader(pht('Apple'))->setHref('#'));
     $list->addItem(id(new PHUIObjectItemView())->setObjectName('FRUIT2')->setHeader(pht('Banana'))->setHref('#'));
     $list->addItem(id(new PHUIObjectItemView())->setObjectName('FRUIT3')->setHeader(pht('Cherry'))->setHref('#'));
     $out[] = array($head, $list);
     $head = id(new PHUIHeaderView())->setHeader(pht('Empty List'));
     $list = new PHUIObjectItemListView();
     $list->setNoDataString(pht('This list is empty.'));
     $out[] = array($head, $list);
     $head = id(new PHUIHeaderView())->setHeader(pht('Stacked List'));
     $list = new PHUIObjectItemListView();
     $list->setStackable(true);
     $list->addItem(id(new PHUIObjectItemView())->setHeader(pht('Monday'))->setHref('#'));
     $list->addItem(id(new PHUIObjectItemView())->setHeader(pht('Tuesday'))->setHref('#'));
     $list->addItem(id(new PHUIObjectItemView())->setHeader(pht('Wednesday'))->setHref('#'));
     $list->addItem(id(new PHUIObjectItemView())->setHeader(pht('Thursday'))->setHref('#'));
     $out[] = array($head, $list);
     $head = id(new PHUIHeaderView())->setHeader(pht('Plain List'));
     $list = new PHUIObjectItemListView();
     $list->setPlain(true);
     $list->addItem(id(new PHUIObjectItemView())->setHeader(pht('Monday'))->setSubHead('I love cats')->setHref('#'));
     $list->addItem(id(new PHUIObjectItemView())->setHeader(pht('Tuesday'))->setSubHead('Cat, cats, cats')->setHref('#'));
     $list->addItem(id(new PHUIObjectItemView())->setHeader(pht('Wednesday'))->setSubHead('Meow, meow, meow')->setHref('#'));
     $list->addItem(id(new PHUIObjectItemView())->setHeader(pht('Thursday'))->setSubHead('Every single day')->setHref('#'));
     $out[] = array($head, $list);
     $head = id(new PHUIHeaderView())->setHeader(pht('Card List'));
     $list = new PHUIObjectItemListView();
     $list->addItem(id(new PHUIObjectItemView())->setHeader(pht('Business Card'))->setBarColor('red'));
     $list->addItem(id(new PHUIObjectItemView())->setHeader(pht('Playing Card'))->setBarColor('orange')->addIcon('fa-comment', pht('Royal Flush!')));
     $owner = phutil_tag('a', array('href' => '#'), pht('jackofclubs'));
     $list->addItem(id(new PHUIObjectItemView())->setHeader(pht('House of Cards'))->setBarColor('yellow')->setDisabled(true)->addByline(pht('Owner: %s', $owner)));
     $author = phutil_tag('a', array('href' => '#'), pht('agoat'));
     $list->addItem(id(new PHUIObjectItemView())->setHeader(pht('Cardigan'))->setBarColor('green')->addIcon('fa-star', pht('Warm!'))->addByline(pht('Author: %s', $author)));
     $list->addItem(id(new PHUIObjectItemView())->setHeader(pht('Cardamom'))->addFootIcon('fa-shield white', 'Spice')->setBarColor('blue'));
     $list->addItem(id(new PHUIObjectItemView())->setHeader(pht('The human cardiovascular system includes the heart, lungs, and ' . 'some other parts; most of these parts are pretty squishy'))->addFootIcon('fa-search white', pht('Respiration!'))->addHandleIcon($handle, pht('You have a cardiovascular system!'))->setBarColor('indigo'));
     $out[] = array($head, $list);
     $head = id(new PHUIHeaderView())->setHeader(pht('Grippable List'));
     $list = new PHUIObjectItemListView();
     $list->addItem(id(new PHUIObjectItemView())->setHeader(pht('Grab ahold!'))->setHref('#')->setGrippable(true)->setBarColor('red'));
     $list->addItem(id(new PHUIObjectItemView())->setHeader(pht('Hold on tight!'))->setHref('#')->setGrippable(true)->setBarColor('yellow'));
     $list->addItem(id(new PHUIObjectItemView())->setHeader(pht("Don't let go!"))->setHref('#')->setGrippable(true)->setBarColor('green')->addAction(id(new PHUIListItemView())->setHref('#')->setIcon('fa-times')));
     $out[] = array($head, $list);
     $head = id(new PHUIHeaderView())->setHeader(pht('List With Actions'));
     $list = new PHUIObjectItemListView();
     $list->addItem(id(new PHUIObjectItemView())->setHeader(pht('You Have The Power'))->setHref('#')->setBarColor('blue')->addAction(id(new PHUIListItemView())->setHref('#')->setName(pht('Moo'))->setIcon('fa-pencil')));
     $list->addItem(id(new PHUIObjectItemView())->setHeader(pht('Believe In Yourself'))->setHref('#')->setBarColor('violet')->addAction(id(new PHUIListItemView())->setHref('#')->setName(pht('Quack'))->setIcon('fa-pencil'))->addAction(id(new PHUIListItemView())->setHref('#')->setName(pht('Oink'))->setIcon('fa-times')));
     $out[] = array($head, $list);
     $head = id(new PHUIHeaderView())->setHeader(pht('Extras'));
     $list = new PHUIObjectItemListView();
     $list->addItem(id(new PHUIObjectItemView())->setHeader(pht('Ace of Hearts'))->setSubHead(pht('This is a powerful card in the game "Hearts".'))->setHref('#')->addAttribute(pht('Suit: Hearts'))->addAttribute(pht('Rank: Ace'))->addIcon('fa-heart', pht('Ace'))->addIcon('fa-heart red', pht('Hearts'))->addFootIcon('fa-heart white', pht('Ace'))->addFootIcon('fa-heart white', pht('Heart'))->addHandleIcon($handle, pht('You hold all the cards.'))->addHandleIcon($handle, pht('You make all the rules.')));
     $list->addItem(id(new PHUIObjectItemView())->setHeader(pht('Just A Handle'))->setHref('#')->addHandleIcon($handle, pht('Handle Here')));
     $list->addItem(id(new PHUIObjectItemView())->setHeader(pht('Poor Use of Space'))->setHref('#')->addAttribute('North West')->addHandleIcon($handle, pht('South East')));
     $list->addItem(id(new PHUIObjectItemView())->setHeader(pht('Crowded Eastern Edge'))->setHref('#')->addIcon('fa-circle red', pht('Stuff'))->addIcon('fa-circle yellow', pht('Stuff'))->addIcon('fa-circle green', pht('Stuff'))->addHandleIcon($handle, pht('More Stuff')));
     $out[] = array($head, $list);
     $head = id(new PHUIHeaderView())->setHeader(pht('Effects'));
     $list = new PHUIObjectItemListView();
     $list->addItem(id(new PHUIObjectItemView())->setObjectName('X1')->setHeader(pht('Normal'))->setHref('#'));
     $list->addItem(id(new PHUIObjectItemView())->setObjectName('X2')->setHeader(pht('Highlighted'))->setEffect('highlighted')->setHref('#'));
     $list->addItem(id(new PHUIObjectItemView())->setObjectName('X3')->setHeader(pht('Selected'))->setEffect('selected')->setHref('#'));
     $list->addItem(id(new PHUIObjectItemView())->setObjectName('X4')->setHeader(pht('Disabled'))->setDisabled(true)->setHref('#'));
     $out[] = array($head, $list);
     $head = id(new PHUIHeaderView())->setHeader(pht('Colors'));
     $list = new PHUIObjectItemListView();
     $bar_colors = array(null => pht('None'), 'red' => pht('Red'), 'orange' => pht('Orange'), 'yellow' => pht('Yellow'), 'green' => pht('Green'), 'sky' => pht('Sky'), 'blue' => pht('Blue'), 'indigo' => pht('Indigo'), 'violet' => pht('Violet'), 'grey' => pht('Grey'), 'black' => pht('Black'));
     foreach ($bar_colors as $bar_color => $bar_label) {
         $list->addItem(id(new PHUIObjectItemView())->setHeader($bar_label)->setBarColor($bar_color));
     }
     $out[] = array($head, $list);
     $head = id(new PHUIHeaderView())->setHeader(pht('Images'));
     $list = new PHUIObjectItemListView();
     $default_profile = PhabricatorFile::loadBuiltin($user, 'profile.png');
     $default_project = PhabricatorFile::loadBuiltin($user, 'project.png');
     $list->addItem(id(new PHUIObjectItemView())->setImageURI($default_profile->getViewURI())->setHeader(pht('Default User Profile Image'))->setBarColor('violet')->addAction(id(new PHUIListItemView())->setHref('#')->setIcon('fa-plus-square')));
     $list->addItem(id(new PHUIObjectItemView())->setImageURI($default_project->getViewURI())->setHeader(pht('Default Project Profile Image'))->setGrippable(true)->addAttribute(pht('This is the default project profile image.')));
     $out[] = array($head, $list);
     $head = id(new PHUIHeaderView())->setHeader(pht('States'));
     $list = id(new PHUIObjectItemListView())->setStates(true);
     $list->addItem(id(new PHUIObjectItemView())->setObjectName('X1200')->setHeader(pht('Action Passed'))->addAttribute(pht('That went swimmingly, go you'))->setHref('#')->setState(PHUIObjectItemView::STATE_SUCCESS));
     $list->addItem(id(new PHUIObjectItemView())->setObjectName('X1201')->setHeader(pht('Action Failed'))->addAttribute(pht('Whoopsies, might want to fix that'))->setHref('#')->setState(PHUIObjectItemView::STATE_FAIL));
     $list->addItem(id(new PHUIObjectItemView())->setObjectName('X1202')->setHeader(pht('Action Warning'))->addAttribute(pht('We need to talk about things'))->setHref('#')->setState(PHUIObjectItemView::STATE_WARN));
     $list->addItem(id(new PHUIObjectItemView())->setObjectName('X1203')->setHeader(pht('Action Noted'))->addAttribute(pht('The weather seems nice today'))->setHref('#')->setState(PHUIObjectItemView::STATE_NOTE));
     $list->addItem(id(new PHUIObjectItemView())->setObjectName('X1203')->setHeader(pht('Action In Progress'))->addAttribute(pht('Outlook fuzzy, try again later'))->setHref('#')->setState(PHUIObjectItemView::STATE_BUILD));
     $box = id(new PHUIObjectBoxView())->setHeaderText('Test Things')->appendChild($list);
     $out[] = array($head, $box);
     return $out;
 }
 public function processRequest()
 {
     $request = $this->getRequest();
     $viewer = $request->getUser();
     $configs = id(new PhabricatorAuthProviderConfigQuery())->setViewer($viewer)->execute();
     $list = new PHUIObjectItemListView();
     $can_manage = $this->hasApplicationCapability(AuthManageProvidersCapability::CAPABILITY);
     foreach ($configs as $config) {
         $item = new PHUIObjectItemView();
         $id = $config->getID();
         $edit_uri = $this->getApplicationURI('config/edit/' . $id . '/');
         $enable_uri = $this->getApplicationURI('config/enable/' . $id . '/');
         $disable_uri = $this->getApplicationURI('config/disable/' . $id . '/');
         $provider = $config->getProvider();
         if ($provider) {
             $name = $provider->getProviderName();
         } else {
             $name = $config->getProviderType() . ' (' . $config->getProviderClass() . ')';
         }
         $item->setHeader($name);
         if ($provider) {
             $item->setHref($edit_uri);
         } else {
             $item->addAttribute(pht('Provider Implementation Missing!'));
         }
         $domain = null;
         if ($provider) {
             $domain = $provider->getProviderDomain();
             if ($domain !== 'self') {
                 $item->addAttribute($domain);
             }
         }
         if ($config->getShouldAllowRegistration()) {
             $item->addAttribute(pht('Allows Registration'));
         } else {
             $item->addAttribute(pht('Does Not Allow Registration'));
         }
         if ($config->getIsEnabled()) {
             $item->setState(PHUIObjectItemView::STATE_SUCCESS);
             $item->addAction(id(new PHUIListItemView())->setIcon('fa-times')->setHref($disable_uri)->setDisabled(!$can_manage)->addSigil('workflow'));
         } else {
             $item->setState(PHUIObjectItemView::STATE_FAIL);
             $item->addIcon('fa-times grey', pht('Disabled'));
             $item->addAction(id(new PHUIListItemView())->setIcon('fa-plus')->setHref($enable_uri)->setDisabled(!$can_manage)->addSigil('workflow'));
         }
         $list->addItem($item);
     }
     $list->setNoDataString(pht('%s You have not added authentication providers yet. Use "%s" to add ' . 'a provider, which will let users register new Phabricator accounts ' . 'and log in.', phutil_tag('strong', array(), pht('No Providers Configured:')), phutil_tag('a', array('href' => $this->getApplicationURI('config/new/')), pht('Add Authentication Provider'))));
     $crumbs = $this->buildApplicationCrumbs();
     $crumbs->addTextCrumb(pht('Auth Providers'));
     $domains_key = 'auth.email-domains';
     $domains_link = $this->renderConfigLink($domains_key);
     $domains_value = PhabricatorEnv::getEnvConfig($domains_key);
     $approval_key = 'auth.require-approval';
     $approval_link = $this->renderConfigLink($approval_key);
     $approval_value = PhabricatorEnv::getEnvConfig($approval_key);
     $issues = array();
     if ($domains_value) {
         $issues[] = pht('Phabricator is configured with an email domain whitelist (in %s), so ' . 'only users with a verified email address at one of these %s ' . 'allowed domain(s) will be able to register an account: %s', $domains_link, phutil_count($domains_value), phutil_tag('strong', array(), implode(', ', $domains_value)));
     } else {
         $issues[] = pht('Anyone who can browse to this Phabricator install will be able to ' . 'register an account. To add email domain restrictions, configure ' . '%s.', $domains_link);
     }
     if ($approval_value) {
         $issues[] = pht('Administrative approvals are enabled (in %s), so all new users must ' . 'have their accounts approved by an administrator.', $approval_link);
     } else {
         $issues[] = pht('Administrative approvals are disabled, so users who register will ' . 'be able to use their accounts immediately. To enable approvals, ' . 'configure %s.', $approval_link);
     }
     if (!$domains_value && !$approval_value) {
         $severity = PHUIInfoView::SEVERITY_WARNING;
         $issues[] = pht('You can safely ignore this warning if the install itself has ' . 'access controls (for example, it is deployed on a VPN) or if all of ' . 'the configured providers have access controls (for example, they are ' . 'all private LDAP or OAuth servers).');
     } else {
         $severity = PHUIInfoView::SEVERITY_NOTICE;
     }
     $warning = id(new PHUIInfoView())->setSeverity($severity)->setErrors($issues);
     $image = id(new PHUIIconView())->setIconFont('fa-plus');
     $button = id(new PHUIButtonView())->setTag('a')->setColor(PHUIButtonView::SIMPLE)->setHref($this->getApplicationURI('config/new/'))->setIcon($image)->setDisabled(!$can_manage)->setText(pht('Add Provider'));
     $header = id(new PHUIHeaderView())->setHeader(pht('Authentication Providers'))->addActionLink($button);
     $list->setFlush(true);
     $list = id(new PHUIObjectBoxView())->setHeader($header)->setInfoView($warning)->appendChild($list);
     return $this->buildApplicationPage(array($crumbs, $list), array('title' => pht('Authentication Providers')));
 }
 public function renderExample()
 {
     $request = $this->getRequest();
     $user = $request->getUser();
     $handle = id(new PhabricatorHandleQuery())->setViewer($user)->withPHIDs(array($user->getPHID()))->executeOne();
     $out = array();
     $list = new PHUIObjectItemListView();
     $list->addItem(id(new PHUIObjectItemView())->setObjectName('FRUIT1')->setStatusIcon('fa-apple')->setHeader(pht('Apple'))->setHref('#'));
     $list->addItem(id(new PHUIObjectItemView())->setObjectName('FRUIT2')->setHeader(pht('Banana'))->setHref('#'));
     $list->addItem(id(new PHUIObjectItemView())->setObjectName('FRUIT3')->setHeader(pht('Cherry'))->setHref('#'));
     $box = id(new PHUIObjectBoxView())->setHeaderText('Basic List')->setObjectList($list);
     $out[] = $box;
     $list = new PHUIObjectItemListView();
     $list->setNoDataString(pht('This list is empty.'));
     $box = id(new PHUIObjectBoxView())->setHeaderText('Empty List')->setObjectList($list);
     $out[] = $box;
     $list = new PHUIObjectItemListView();
     $list->addItem(id(new PHUIObjectItemView())->setHeader(pht('Monday'))->setHref('#'));
     $list->addItem(id(new PHUIObjectItemView())->setHeader(pht('Tuesday'))->setHref('#'));
     $list->addItem(id(new PHUIObjectItemView())->setHeader(pht('Wednesday'))->setHref('#'));
     $list->addItem(id(new PHUIObjectItemView())->setHeader(pht('Thursday'))->setHref('#'));
     $box = id(new PHUIObjectBoxView())->setHeaderText('Stacked List')->setObjectList($list);
     $out[] = $box;
     $list = new PHUIObjectItemListView();
     $list->addItem(id(new PHUIObjectItemView())->setHeader(pht('Business Card'))->setStatusIcon('fa-warning red'));
     $list->addItem(id(new PHUIObjectItemView())->setHeader(pht('Playing Card'))->setStatusIcon('fa-warning orange')->addIcon('fa-comment', pht('Royal Flush!')));
     $owner = phutil_tag('a', array('href' => '#'), pht('jackofclubs'));
     $list->addItem(id(new PHUIObjectItemView())->setHeader(pht('House of Cards'))->setStatusIcon('fa-warning yellow')->setDisabled(true)->addByline(pht('Owner: %s', $owner)));
     $author = phutil_tag('a', array('href' => '#'), pht('agoat'));
     $list->addItem(id(new PHUIObjectItemView())->setHeader(pht('Cardigan'))->setStatusIcon('fa-check green')->addIcon('fa-star', pht('Warm!'))->addByline(pht('Author: %s', $author)));
     $list->addItem(id(new PHUIObjectItemView())->setHeader(pht('Cardamom'))->setStatusIcon('fa-check blue'));
     $list->addItem(id(new PHUIObjectItemView())->setHeader(pht('The human cardiovascular system includes the heart, lungs, and ' . 'some other parts; most of these parts are pretty squishy.'))->addHandleIcon($handle, pht('You have a cardiovascular system!'))->setStatusIcon('fa-check indigo'));
     $box = id(new PHUIObjectBoxView())->setHeaderText('Card List')->setObjectList($list);
     $out[] = $box;
     $list = new PHUIObjectItemListView();
     $list->addItem(id(new PHUIObjectItemView())->setHeader(pht('Grab ahold!'))->setHref('#')->setGrippable(true));
     $list->addItem(id(new PHUIObjectItemView())->setHeader(pht('Hold on tight!'))->setHref('#')->setGrippable(true));
     $list->addItem(id(new PHUIObjectItemView())->setHeader(pht("Don't let go!"))->setHref('#')->setGrippable(true)->addAction(id(new PHUIListItemView())->setHref('#')->setIcon('fa-times')));
     $box = id(new PHUIObjectBoxView())->setHeaderText('Grippable List')->setObjectList($list);
     $out[] = $box;
     $list = new PHUIObjectItemListView();
     $list->addItem(id(new PHUIObjectItemView())->setHeader(pht('You Have The Power'))->setHref('#')->setStatusIcon('fa-circle-o blue')->addAction(id(new PHUIListItemView())->setHref('#')->setName(pht('Moo'))->setIcon('fa-pencil')));
     $list->addItem(id(new PHUIObjectItemView())->setHeader(pht('Believe In Yourself'))->setHref('#')->setStatusIcon('fa-circle-o violet')->addAction(id(new PHUIListItemView())->setHref('#')->setName(pht('Quack'))->setIcon('fa-pencil'))->addAction(id(new PHUIListItemView())->setHref('#')->setName(pht('Oink'))->setIcon('fa-times')));
     $box = id(new PHUIObjectBoxView())->setHeaderText('Action Link List')->setObjectList($list);
     $head = id(new PHUIHeaderView())->setHeader(pht('Extras'));
     $list = new PHUIObjectItemListView();
     $list->addItem(id(new PHUIObjectItemView())->setHeader(pht('Ace of Hearts'))->setSubHead(pht('This is a powerful card in the game "Hearts".'))->setHref('#')->addAttribute(pht('Suit: Hearts'))->addAttribute(pht('Rank: Ace'))->addIcon('fa-heart', pht('Ace'))->addIcon('fa-heart red', pht('Hearts'))->addHandleIcon($handle, pht('You hold all the cards.'))->addHandleIcon($handle, pht('You make all the rules.')));
     $list->addItem(id(new PHUIObjectItemView())->setHeader(pht('Just A Handle'))->setHref('#')->addHandleIcon($handle, pht('Handle Here')));
     $list->addItem(id(new PHUIObjectItemView())->setHeader(pht('Poor Use of Space'))->setHref('#')->addAttribute('North West')->addHandleIcon($handle, pht('South East')));
     $list->addItem(id(new PHUIObjectItemView())->setHeader(pht('Crowded Eastern Edge'))->setHref('#')->addIcon('fa-circle red', pht('Stuff'))->addIcon('fa-circle yellow', pht('Stuff'))->addIcon('fa-circle green', pht('Stuff'))->addHandleIcon($handle, pht('More Stuff')));
     $box = id(new PHUIObjectBoxView())->setHeaderText('Action List')->setObjectList($list);
     $out[] = $box;
     $list = new PHUIObjectItemListView();
     $list->addItem(id(new PHUIObjectItemView())->setObjectName('X1')->setHeader(pht('Normal'))->setHref('#'));
     $list->addItem(id(new PHUIObjectItemView())->setObjectName('X2')->setHeader(pht('Highlighted'))->setEffect('highlighted')->setHref('#'));
     $list->addItem(id(new PHUIObjectItemView())->setObjectName('X3')->setHeader(pht('Selected'))->setEffect('selected')->setHref('#'));
     $list->addItem(id(new PHUIObjectItemView())->setObjectName('X4')->setHeader(pht('Disabled'))->setDisabled(true)->setHref('#'));
     $box = id(new PHUIObjectBoxView())->setHeaderText('Extra Things and Stuff')->setObjectList($list);
     $out[] = $box;
     $list = new PHUIObjectItemListView();
     $bar_colors = array(null => pht('None'), 'red' => pht('Red'), 'orange' => pht('Orange'), 'yellow' => pht('Yellow'), 'green' => pht('Green'), 'sky' => pht('Sky'), 'blue' => pht('Blue'), 'indigo' => pht('Indigo'), 'violet' => pht('Violet'), 'grey' => pht('Grey'), 'black' => pht('Black'));
     foreach ($bar_colors as $bar_color => $bar_label) {
         $list->addItem(id(new PHUIObjectItemView())->setHeader($bar_label)->setStatusIcon('fa-bell ' . $bar_color));
     }
     $box = id(new PHUIObjectBoxView())->setHeaderText('Color Icons')->setObjectList($list);
     $out[] = $box;
     $list = new PHUIObjectItemListView();
     $list->setFlush(true);
     $default_profile = PhabricatorFile::loadBuiltin($user, 'profile.png');
     $default_project = PhabricatorFile::loadBuiltin($user, 'project.png');
     $list->addItem(id(new PHUIObjectItemView())->setImageURI($default_profile->getViewURI())->setHeader(pht('Default User Profile Image'))->addAction(id(new PHUIListItemView())->setHref('#')->setIcon('fa-pencil-square'))->addAction(id(new PHUIListItemView())->setHref('#')->setIcon('fa-plus-square'))->addAction(id(new PHUIListItemView())->setHref('#')->setIcon('fa-minus-square')));
     $list->addItem(id(new PHUIObjectItemView())->setImageURI($default_project->getViewURI())->setHeader(pht('Default Project Profile Image'))->setGrippable(true)->addAttribute(pht('This is the default project profile image.')));
     $box = id(new PHUIObjectBoxView())->setHeaderText('Profile Images')->setObjectList($list);
     $out[] = $box;
     return $out;
 }
 public function buildList()
 {
     $user = $this->getUser();
     if (!$user) {
         throw new Exception(pht('You must %s before %s!', 'setUser()', __FUNCTION__ . '()'));
     }
     $rowc = array();
     $list = new PHUIObjectItemListView();
     foreach ($this->commits as $commit) {
         $commit_phid = $commit->getPHID();
         $commit_handle = $this->getHandle($commit_phid);
         $committed = null;
         $commit_name = $commit_handle->getName();
         $commit_link = $commit_handle->getURI();
         $commit_desc = $this->getCommitDescription($commit_phid);
         $committed = phabricator_datetime($commit->getEpoch(), $user);
         $audits = mpull($commit->getAudits(), null, 'getAuditorPHID');
         $auditors = array();
         $reasons = array();
         foreach ($audits as $audit) {
             $auditor_phid = $audit->getAuditorPHID();
             $auditors[$auditor_phid] = $this->getHandle($auditor_phid)->renderLink();
         }
         $auditors = phutil_implode_html(', ', $auditors);
         $authority_audits = array_select_keys($audits, $this->authorityPHIDs);
         if ($authority_audits) {
             $audit = reset($authority_audits);
         } else {
             $audit = reset($audits);
         }
         if ($audit) {
             $reasons = $audit->getAuditReasons();
             $reasons = phutil_implode_html(', ', $reasons);
             $status_code = $audit->getAuditStatus();
             $status_text = PhabricatorAuditStatusConstants::getStatusName($status_code);
             $status_color = PhabricatorAuditStatusConstants::getStatusColor($status_code);
             $status_icon = PhabricatorAuditStatusConstants::getStatusIcon($status_code);
         } else {
             $reasons = null;
             $status_text = null;
             $status_color = null;
             $status_icon = null;
         }
         $author_phid = $commit->getAuthorPHID();
         if ($author_phid) {
             $author_name = $this->getHandle($author_phid)->renderLink();
         } else {
             $author_name = $commit->getCommitData()->getAuthorName();
         }
         $item = id(new PHUIObjectItemView())->setObjectName($commit_name)->setHeader($commit_desc)->setHref($commit_link)->addAttribute(pht('Author: %s', $author_name))->addAttribute($reasons)->addIcon('none', $committed);
         if (!empty($auditors)) {
             $item->addByLine(pht('Auditors: %s', $auditors));
         }
         if ($status_color) {
             $item->setStatusIcon($status_icon . ' ' . $status_color, $status_text);
         }
         $list->addItem($item);
     }
     if ($this->noDataString) {
         $list->setNoDataString($this->noDataString);
     }
     return $list;
 }
 public function render()
 {
     $viewer = $this->getViewer();
     $this->initBehavior('phabricator-tooltips', array());
     $this->requireResource('aphront-tooltip-css');
     $list = new PHUIObjectItemListView();
     foreach ($this->revisions as $revision) {
         $item = id(new PHUIObjectItemView())->setUser($viewer);
         $icons = array();
         $phid = $revision->getPHID();
         $flag = $revision->getFlag($viewer);
         if ($flag) {
             $flag_class = PhabricatorFlagColor::getCSSClass($flag->getColor());
             $icons['flag'] = phutil_tag('div', array('class' => 'phabricator-flag-icon ' . $flag_class), '');
         }
         if ($revision->getDrafts($viewer)) {
             $icons['draft'] = true;
         }
         $modified = $revision->getDateModified();
         if (isset($icons['flag'])) {
             $item->addHeadIcon($icons['flag']);
         }
         $item->setObjectName('D' . $revision->getID());
         $item->setHeader($revision->getTitle());
         $item->setHref('/D' . $revision->getID());
         if (isset($icons['draft'])) {
             $draft = id(new PHUIIconView())->setIcon('fa-comment yellow')->addSigil('has-tooltip')->setMetadata(array('tip' => pht('Unsubmitted Comments')));
             $item->addAttribute($draft);
         }
         // Author
         $author_handle = $this->handles[$revision->getAuthorPHID()];
         $item->addByline(pht('Author: %s', $author_handle->renderLink()));
         $unlanded = idx($this->unlandedDependencies, $phid);
         if ($unlanded) {
             $item->addAttribute(array(id(new PHUIIconView())->setIcon('fa-chain-broken', 'red'), ' ', pht('Open Dependencies')));
         }
         $reviewers = array();
         // TODO: As above, this should be based on `getReviewerStatus()`.
         foreach ($revision->getReviewers() as $reviewer) {
             $reviewers[] = $this->handles[$reviewer]->renderLink();
         }
         if (!$reviewers) {
             $reviewers = phutil_tag('em', array(), pht('None'));
         } else {
             $reviewers = phutil_implode_html(', ', $reviewers);
         }
         $item->addAttribute(pht('Reviewers: %s', $reviewers));
         $item->setEpoch($revision->getDateModified());
         if ($revision->isClosed()) {
             $item->setDisabled(true);
         }
         $item->setStatusIcon($revision->getStatusIcon(), $revision->getStatusDisplayName());
         $list->addItem($item);
     }
     $list->setNoDataString($this->noDataString);
     if ($this->header && !$this->noBox) {
         $list->setFlush(true);
         $list = id(new PHUIObjectBoxView())->setBackground($this->background)->setObjectList($list);
         if ($this->header instanceof PHUIHeaderView) {
             $list->setHeader($this->header);
         } else {
             $list->setHeaderText($this->header);
         }
     } else {
         $list->setHeader($this->header);
     }
     return $list;
 }
 public function render()
 {
     $user = $this->user;
     if (!$user) {
         throw new PhutilInvalidStateException('setUser');
     }
     $fresh = PhabricatorEnv::getEnvConfig('differential.days-fresh');
     if ($fresh) {
         $fresh = PhabricatorCalendarHoliday::getNthBusinessDay(time(), -$fresh);
     }
     $stale = PhabricatorEnv::getEnvConfig('differential.days-stale');
     if ($stale) {
         $stale = PhabricatorCalendarHoliday::getNthBusinessDay(time(), -$stale);
     }
     $this->initBehavior('phabricator-tooltips', array());
     $this->requireResource('aphront-tooltip-css');
     $list = new PHUIObjectItemListView();
     foreach ($this->revisions as $revision) {
         $item = id(new PHUIObjectItemView())->setUser($user);
         $icons = array();
         $phid = $revision->getPHID();
         $flag = $revision->getFlag($user);
         if ($flag) {
             $flag_class = PhabricatorFlagColor::getCSSClass($flag->getColor());
             $icons['flag'] = phutil_tag('div', array('class' => 'phabricator-flag-icon ' . $flag_class), '');
         }
         if ($revision->getDrafts($user)) {
             $icons['draft'] = true;
         }
         $modified = $revision->getDateModified();
         $status = $revision->getStatus();
         $show_age = ($fresh || $stale) && $this->highlightAge && !$revision->isClosed();
         if ($stale && $modified < $stale) {
             $object_age = PHUIObjectItemView::AGE_OLD;
         } else {
             if ($fresh && $modified < $fresh) {
                 $object_age = PHUIObjectItemView::AGE_STALE;
             } else {
                 $object_age = PHUIObjectItemView::AGE_FRESH;
             }
         }
         $status_name = ArcanistDifferentialRevisionStatus::getNameForRevisionStatus($status);
         if (isset($icons['flag'])) {
             $item->addHeadIcon($icons['flag']);
         }
         $item->setObjectName('D' . $revision->getID());
         $item->setHeader($revision->getTitle());
         $item->setHref('/D' . $revision->getID());
         if (isset($icons['draft'])) {
             $draft = id(new PHUIIconView())->setIcon('fa-comment yellow')->addSigil('has-tooltip')->setMetadata(array('tip' => pht('Unsubmitted Comments')));
             $item->addAttribute($draft);
         }
         /* Most things 'Need Review', so accept it's the default */
         if ($status != ArcanistDifferentialRevisionStatus::NEEDS_REVIEW) {
             $item->addAttribute($status_name);
         }
         // Author
         $author_handle = $this->handles[$revision->getAuthorPHID()];
         $item->addByline(pht('Author: %s', $author_handle->renderLink()));
         $reviewers = array();
         // TODO: As above, this should be based on `getReviewerStatus()`.
         foreach ($revision->getReviewers() as $reviewer) {
             $reviewers[] = $this->handles[$reviewer]->renderLink();
         }
         if (!$reviewers) {
             $reviewers = phutil_tag('em', array(), pht('None'));
         } else {
             $reviewers = phutil_implode_html(', ', $reviewers);
         }
         $item->addAttribute(pht('Reviewers: %s', $reviewers));
         $item->setEpoch($revision->getDateModified(), $object_age);
         switch ($status) {
             case ArcanistDifferentialRevisionStatus::NEEDS_REVIEW:
                 $item->setStatusIcon('fa-code grey', pht('Needs Review'));
                 break;
             case ArcanistDifferentialRevisionStatus::NEEDS_REVISION:
                 $item->setStatusIcon('fa-refresh red', pht('Needs Revision'));
                 break;
             case ArcanistDifferentialRevisionStatus::CHANGES_PLANNED:
                 $item->setStatusIcon('fa-headphones red', pht('Changes Planned'));
                 break;
             case ArcanistDifferentialRevisionStatus::ACCEPTED:
                 $item->setStatusIcon('fa-check green', pht('Accepted'));
                 break;
             case ArcanistDifferentialRevisionStatus::CLOSED:
                 $item->setDisabled(true);
                 $item->setStatusIcon('fa-check-square-o black', pht('Closed'));
                 break;
             case ArcanistDifferentialRevisionStatus::ABANDONED:
                 $item->setDisabled(true);
                 $item->setStatusIcon('fa-plane black', pht('Abandoned'));
                 break;
         }
         $list->addItem($item);
     }
     $list->setNoDataString($this->noDataString);
     if ($this->header && !$this->noBox) {
         $list->setFlush(true);
         $list = id(new PHUIObjectBoxView())->setObjectList($list);
         if ($this->header instanceof PHUIHeaderView) {
             $list->setHeader($this->header);
         } else {
             $list->setHeaderText($this->header);
         }
     } else {
         $list->setHeader($this->header);
     }
     return $list;
 }
 protected function renderResultList(array $results, PhabricatorSavedQuery $query, array $handles)
 {
     $viewer = $this->requireViewer();
     $list = new PHUIObjectItemListView();
     $list->setNoDataString(pht('No results found.'));
     if ($results) {
         $objects = id(new PhabricatorObjectQuery())->setViewer($viewer)->withPHIDs(mpull($results, 'getPHID'))->execute();
         foreach ($results as $phid => $handle) {
             $view = id(new PhabricatorSearchResultView())->setHandle($handle)->setQuery($query)->setObject(idx($objects, $phid))->render();
             $list->addItem($view);
         }
     }
     $result = new PhabricatorApplicationSearchResultView();
     $result->setObjectList($list);
     return $result;
 }