Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15411716
D9024.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
54 KB
Referenced Files
None
Subscribers
None
D9024.diff
View Options
diff --git a/src/__phutil_library_map__.php b/src/__phutil_library_map__.php
--- a/src/__phutil_library_map__.php
+++ b/src/__phutil_library_map__.php
@@ -3507,11 +3507,7 @@
),
'HeraldTranscriptController' => 'HeraldController',
'HeraldTranscriptGarbageCollector' => 'PhabricatorGarbageCollector',
- 'HeraldTranscriptListController' =>
- array(
- 0 => 'HeraldController',
- 1 => 'PhabricatorApplicationSearchResultsControllerInterface',
- ),
+ 'HeraldTranscriptListController' => 'HeraldController',
'HeraldTranscriptQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'HeraldTranscriptSearchEngine' => 'PhabricatorApplicationSearchEngine',
'HeraldTranscriptTestCase' => 'PhabricatorTestCase',
@@ -3538,11 +3534,7 @@
'LegalpadDocumentCommentController' => 'LegalpadController',
'LegalpadDocumentEditController' => 'LegalpadController',
'LegalpadDocumentEditor' => 'PhabricatorApplicationTransactionEditor',
- 'LegalpadDocumentListController' =>
- array(
- 0 => 'LegalpadController',
- 1 => 'PhabricatorApplicationSearchResultsControllerInterface',
- ),
+ 'LegalpadDocumentListController' => 'LegalpadController',
'LegalpadDocumentQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'LegalpadDocumentRemarkupRule' => 'PhabricatorRemarkupRuleObject',
'LegalpadDocumentSearchEngine' => 'PhabricatorApplicationSearchEngine',
@@ -3777,11 +3769,7 @@
'PassphraseCredentialCreateController' => 'PassphraseController',
'PassphraseCredentialDestroyController' => 'PassphraseController',
'PassphraseCredentialEditController' => 'PassphraseController',
- 'PassphraseCredentialListController' =>
- array(
- 0 => 'PassphraseController',
- 1 => 'PhabricatorApplicationSearchResultsControllerInterface',
- ),
+ 'PassphraseCredentialListController' => 'PassphraseController',
'PassphraseCredentialLockController' => 'PassphraseController',
'PassphraseCredentialPublicController' => 'PassphraseController',
'PassphraseCredentialQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
@@ -3931,11 +3919,7 @@
'PhabricatorApplicationUninstallController' => 'PhabricatorApplicationsController',
'PhabricatorApplicationXHProf' => 'PhabricatorApplication',
'PhabricatorApplicationsController' => 'PhabricatorController',
- 'PhabricatorApplicationsListController' =>
- array(
- 0 => 'PhabricatorApplicationsController',
- 1 => 'PhabricatorApplicationSearchResultsControllerInterface',
- ),
+ 'PhabricatorApplicationsListController' => 'PhabricatorApplicationsController',
'PhabricatorAsanaConfigOptions' => 'PhabricatorApplicationConfigOptions',
'PhabricatorAuditAddCommentController' => 'PhabricatorAuditController',
'PhabricatorAuditComment' =>
@@ -4456,11 +4440,7 @@
'PhabricatorMacroDisableController' => 'PhabricatorMacroController',
'PhabricatorMacroEditController' => 'PhabricatorMacroController',
'PhabricatorMacroEditor' => 'PhabricatorApplicationTransactionEditor',
- 'PhabricatorMacroListController' =>
- array(
- 0 => 'PhabricatorMacroController',
- 1 => 'PhabricatorApplicationSearchResultsControllerInterface',
- ),
+ 'PhabricatorMacroListController' => 'PhabricatorMacroController',
'PhabricatorMacroMailReceiver' => 'PhabricatorObjectMailReceiver',
'PhabricatorMacroMemeController' => 'PhabricatorMacroController',
'PhabricatorMacroMemeDialogController' => 'PhabricatorMacroController',
@@ -4493,11 +4473,7 @@
'PhabricatorMailingListSearchEngine' => 'PhabricatorApplicationSearchEngine',
'PhabricatorMailingListsController' => 'PhabricatorController',
'PhabricatorMailingListsEditController' => 'PhabricatorMailingListsController',
- 'PhabricatorMailingListsListController' =>
- array(
- 0 => 'PhabricatorMailingListsController',
- 1 => 'PhabricatorApplicationSearchResultsControllerInterface',
- ),
+ 'PhabricatorMailingListsListController' => 'PhabricatorMailingListsController',
'PhabricatorMainMenuGroupView' => 'AphrontView',
'PhabricatorMainMenuIconView' => 'AphrontView',
'PhabricatorMainMenuSearchView' => 'AphrontView',
@@ -4560,11 +4536,7 @@
'PhabricatorOAuthClientBaseController' => 'PhabricatorOAuthServerController',
'PhabricatorOAuthClientDeleteController' => 'PhabricatorOAuthClientBaseController',
'PhabricatorOAuthClientEditController' => 'PhabricatorOAuthClientBaseController',
- 'PhabricatorOAuthClientListController' =>
- array(
- 0 => 'PhabricatorOAuthClientBaseController',
- 1 => 'PhabricatorApplicationSearchResultsControllerInterface',
- ),
+ 'PhabricatorOAuthClientListController' => 'PhabricatorOAuthClientBaseController',
'PhabricatorOAuthClientViewController' => 'PhabricatorOAuthClientBaseController',
'PhabricatorOAuthResponse' => 'AphrontResponse',
'PhabricatorOAuthServerAccessToken' => 'PhabricatorOAuthServerDAO',
@@ -4758,11 +4730,7 @@
'PhabricatorProjectEditMainController' => 'PhabricatorProjectController',
'PhabricatorProjectEditPictureController' => 'PhabricatorProjectController',
'PhabricatorProjectEditorTestCase' => 'PhabricatorTestCase',
- 'PhabricatorProjectListController' =>
- array(
- 0 => 'PhabricatorProjectController',
- 1 => 'PhabricatorApplicationSearchResultsControllerInterface',
- ),
+ 'PhabricatorProjectListController' => 'PhabricatorProjectController',
'PhabricatorProjectMembersEditController' => 'PhabricatorProjectController',
'PhabricatorProjectMembersRemoveController' => 'PhabricatorProjectController',
'PhabricatorProjectMoveController' => 'PhabricatorProjectController',
@@ -5278,11 +5246,7 @@
'PholioMockEditor' => 'PhabricatorApplicationTransactionEditor',
'PholioMockEmbedView' => 'AphrontView',
'PholioMockImagesView' => 'AphrontView',
- 'PholioMockListController' =>
- array(
- 0 => 'PholioController',
- 1 => 'PhabricatorApplicationSearchResultsControllerInterface',
- ),
+ 'PholioMockListController' => 'PholioController',
'PholioMockMailReceiver' => 'PhabricatorObjectMailReceiver',
'PholioMockQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PholioMockSearchEngine' => 'PhabricatorApplicationSearchEngine',
@@ -5396,11 +5360,7 @@
'PhragmentZIPController' => 'PhragmentController',
'PhrequentController' => 'PhabricatorController',
'PhrequentDAO' => 'PhabricatorLiskDAO',
- 'PhrequentListController' =>
- array(
- 0 => 'PhrequentController',
- 1 => 'PhabricatorApplicationSearchResultsControllerInterface',
- ),
+ 'PhrequentListController' => 'PhrequentController',
'PhrequentSearchEngine' => 'PhabricatorApplicationSearchEngine',
'PhrequentTimeBlock' => 'Phobject',
'PhrequentTimeBlockTestCase' => 'PhabricatorTestCase',
@@ -5440,11 +5400,7 @@
'PhrictionDocumentTestCase' => 'PhabricatorTestCase',
'PhrictionEditController' => 'PhrictionController',
'PhrictionHistoryController' => 'PhrictionController',
- 'PhrictionListController' =>
- array(
- 0 => 'PhrictionController',
- 1 => 'PhabricatorApplicationSearchResultsControllerInterface',
- ),
+ 'PhrictionListController' => 'PhrictionController',
'PhrictionMoveController' => 'PhrictionController',
'PhrictionNewController' => 'PhrictionController',
'PhrictionPHIDTypeDocument' => 'PhabricatorPHIDType',
@@ -5496,11 +5452,7 @@
'PonderQuestionEditController' => 'PonderController',
'PonderQuestionEditor' => 'PonderEditor',
'PonderQuestionHistoryController' => 'PonderController',
- 'PonderQuestionListController' =>
- array(
- 0 => 'PonderController',
- 1 => 'PhabricatorApplicationSearchResultsControllerInterface',
- ),
+ 'PonderQuestionListController' => 'PonderController',
'PonderQuestionMailReceiver' => 'PhabricatorObjectMailReceiver',
'PonderQuestionQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
'PonderQuestionReplyHandler' => 'PhabricatorMailReplyHandler',
diff --git a/src/applications/herald/controller/HeraldTranscriptListController.php b/src/applications/herald/controller/HeraldTranscriptListController.php
--- a/src/applications/herald/controller/HeraldTranscriptListController.php
+++ b/src/applications/herald/controller/HeraldTranscriptListController.php
@@ -1,7 +1,6 @@
<?php
-final class HeraldTranscriptListController extends HeraldController
- implements PhabricatorApplicationSearchResultsControllerInterface {
+final class HeraldTranscriptListController extends HeraldController {
private $queryKey;
@@ -47,49 +46,4 @@
return $this->delegateToController($controller);
}
-
- public function renderResultsList(
- array $transcripts,
- PhabricatorSavedQuery $query) {
- assert_instances_of($transcripts, 'HeraldTranscript');
-
- $viewer = $this->getRequest()->getUser();
-
- // Render the table.
- $handles = array();
- if ($transcripts) {
- $phids = mpull($transcripts, 'getObjectPHID', 'getObjectPHID');
- $handles = $this->loadViewerHandles($phids);
- }
-
- $list = new PHUIObjectItemListView();
- $list->setCards(true);
- foreach ($transcripts as $xscript) {
- $view_href = phutil_tag(
- 'a',
- array(
- 'href' => '/herald/transcript/'.$xscript->getID().'/',
- ),
- pht('View Full Transcript'));
-
- $item = new PHUIObjectItemView();
- $item->setObjectName($xscript->getID());
- $item->setHeader($view_href);
- if ($xscript->getDryRun()) {
- $item->addAttribute(pht('Dry Run'));
- }
- $item->addAttribute($handles[$xscript->getObjectPHID()]->renderLink());
- $item->addAttribute(
- number_format((int)(1000 * $xscript->getDuration())).' ms');
- $item->addIcon(
- 'none',
- phabricator_datetime($xscript->getTime(), $viewer));
-
- $list->addItem($item);
- }
-
- return $list;
-
- }
-
}
diff --git a/src/applications/herald/query/HeraldTranscriptSearchEngine.php b/src/applications/herald/query/HeraldTranscriptSearchEngine.php
--- a/src/applications/herald/query/HeraldTranscriptSearchEngine.php
+++ b/src/applications/herald/query/HeraldTranscriptSearchEngine.php
@@ -3,6 +3,10 @@
final class HeraldTranscriptSearchEngine
extends PhabricatorApplicationSearchEngine {
+ public function getApplicationClassName() {
+ return 'PhabricatorApplicationHerald';
+ }
+
public function buildSavedQueryFromRequest(AphrontRequest $request) {
$saved = new PhabricatorSavedQuery();
@@ -89,4 +93,47 @@
return parent::buildSavedQueryFromBuiltin($query_key);
}
+ protected function getRequiredHandlePHIDsForResultList(
+ array $transcripts,
+ PhabricatorSavedQuery $query) {
+ return mpull($transcripts, 'getObjectPHID');
+ }
+
+ protected function renderResultList(
+ array $transcripts,
+ PhabricatorSavedQuery $query,
+ array $handles) {
+ assert_instances_of($transcripts, 'HeraldTranscript');
+
+ $viewer = $this->requireViewer();
+
+ $list = new PHUIObjectItemListView();
+ $list->setCards(true);
+ foreach ($transcripts as $xscript) {
+ $view_href = phutil_tag(
+ 'a',
+ array(
+ 'href' => '/herald/transcript/'.$xscript->getID().'/',
+ ),
+ pht('View Full Transcript'));
+
+ $item = new PHUIObjectItemView();
+ $item->setObjectName($xscript->getID());
+ $item->setHeader($view_href);
+ if ($xscript->getDryRun()) {
+ $item->addAttribute(pht('Dry Run'));
+ }
+ $item->addAttribute($handles[$xscript->getObjectPHID()]->renderLink());
+ $item->addAttribute(
+ number_format((int)(1000 * $xscript->getDuration())).' ms');
+ $item->addIcon(
+ 'none',
+ phabricator_datetime($xscript->getTime(), $viewer));
+
+ $list->addItem($item);
+ }
+
+ return $list;
+ }
+
}
diff --git a/src/applications/legalpad/controller/LegalpadDocumentListController.php b/src/applications/legalpad/controller/LegalpadDocumentListController.php
--- a/src/applications/legalpad/controller/LegalpadDocumentListController.php
+++ b/src/applications/legalpad/controller/LegalpadDocumentListController.php
@@ -1,10 +1,6 @@
<?php
-/**
- * @group legalpad
- */
-final class LegalpadDocumentListController extends LegalpadController
- implements PhabricatorApplicationSearchResultsControllerInterface {
+final class LegalpadDocumentListController extends LegalpadController {
private $queryKey;
@@ -22,39 +18,4 @@
return $this->delegateToController($controller);
}
- public function renderResultsList(
- array $documents,
- PhabricatorSavedQuery $query) {
- assert_instances_of($documents, 'LegalpadDocument');
-
- $user = $this->getRequest()->getUser();
-
- $contributors = array_mergev(
- mpull($documents, 'getRecentContributorPHIDs'));
- $this->loadHandles($contributors);
-
- $list = new PHUIObjectItemListView();
- $list->setUser($user);
- foreach ($documents as $document) {
- $last_updated = phabricator_date($document->getDateModified(), $user);
- $recent_contributors = $document->getRecentContributorPHIDs();
- $updater = $this->getHandle(reset($recent_contributors))->renderLink();
-
- $title = $document->getTitle();
-
- $item = id(new PHUIObjectItemView())
- ->setObjectName('L'.$document->getID())
- ->setHeader($title)
- ->setHref($this->getApplicationURI('view/'.$document->getID()))
- ->setObject($document)
- ->addIcon('none', pht('Last updated: %s', $last_updated))
- ->addByline(pht('Updated by: %s', $updater))
- ->addAttribute(pht('Versions: %d', $document->getVersions()));
-
- $list->addItem($item);
- }
-
- return $list;
- }
-
}
diff --git a/src/applications/legalpad/query/LegalpadDocumentSearchEngine.php b/src/applications/legalpad/query/LegalpadDocumentSearchEngine.php
--- a/src/applications/legalpad/query/LegalpadDocumentSearchEngine.php
+++ b/src/applications/legalpad/query/LegalpadDocumentSearchEngine.php
@@ -1,11 +1,12 @@
<?php
-/**
- * @group legalpad
- */
final class LegalpadDocumentSearchEngine
extends PhabricatorApplicationSearchEngine {
+ public function getApplicationClassName() {
+ return 'PhabricatorApplicationLegalpad';
+ }
+
public function buildSavedQueryFromRequest(AphrontRequest $request) {
$saved = new PhabricatorSavedQuery();
$saved->setParameter(
@@ -103,4 +104,42 @@
return parent::buildSavedQueryFromBuiltin($query_key);
}
+ protected function getRequiredHandlePHIDsForResultList(
+ array $documents,
+ PhabricatorSavedQuery $query) {
+ return array_mergev(mpull($documents, 'getRecentContributorPHIDs'));
+ }
+
+ protected function renderResultList(
+ array $documents,
+ PhabricatorSavedQuery $query,
+ array $handles) {
+ assert_instances_of($documents, 'LegalpadDocument');
+
+ $viewer = $this->requireViewer();
+
+ $list = new PHUIObjectItemListView();
+ $list->setUser($viewer);
+ foreach ($documents as $document) {
+ $last_updated = phabricator_date($document->getDateModified(), $viewer);
+ $recent_contributors = $document->getRecentContributorPHIDs();
+ $updater = $handles[reset($recent_contributors)]->renderLink();
+
+ $title = $document->getTitle();
+
+ $item = id(new PHUIObjectItemView())
+ ->setObjectName('L'.$document->getID())
+ ->setHeader($title)
+ ->setHref($this->getApplicationURI('view/'.$document->getID()))
+ ->setObject($document)
+ ->addIcon('none', pht('Last updated: %s', $last_updated))
+ ->addByline(pht('Updated by: %s', $updater))
+ ->addAttribute(pht('Versions: %d', $document->getVersions()));
+
+ $list->addItem($item);
+ }
+
+ return $list;
+ }
+
}
diff --git a/src/applications/macro/controller/PhabricatorMacroListController.php b/src/applications/macro/controller/PhabricatorMacroListController.php
--- a/src/applications/macro/controller/PhabricatorMacroListController.php
+++ b/src/applications/macro/controller/PhabricatorMacroListController.php
@@ -1,7 +1,6 @@
<?php
-final class PhabricatorMacroListController extends PhabricatorMacroController
- implements PhabricatorApplicationSearchResultsControllerInterface {
+final class PhabricatorMacroListController extends PhabricatorMacroController {
private $key;
@@ -23,64 +22,4 @@
return $this->delegateToController($controller);
}
- public function renderResultsList(
- array $macros,
- PhabricatorSavedQuery $query) {
-
- assert_instances_of($macros, 'PhabricatorFileImageMacro');
- $viewer = $this->getRequest()->getUser();
-
- $author_phids = mpull($macros, 'getAuthorPHID', 'getAuthorPHID');
- $this->loadHandles($author_phids);
- $author_handles = array_select_keys(
- $this->getLoadedHandles(),
- $author_phids);
-
- $pinboard = new PHUIPinboardView();
- foreach ($macros as $macro) {
- $file = $macro->getFile();
-
- $item = new PHUIPinboardItemView();
- if ($file) {
- $item->setImageURI($file->getThumb280x210URI());
- $item->setImageSize(280, 210);
- }
-
- 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 = $this->getHandle($macro->getAuthorPHID());
- $item->appendChild(
- pht('Created by %s', $author_handle->renderLink()));
- }
-
- $item->setURI($this->getApplicationURI('/view/'.$macro->getID().'/'));
-
- $name = $macro->getName();
- if ($macro->getIsDisabled()) {
- $name = pht('%s (Disabled)', $name);
- }
- $item->setHeader($name);
-
- $pinboard->addItem($item);
- }
-
- return $pinboard;
-
- }
}
diff --git a/src/applications/macro/query/PhabricatorMacroSearchEngine.php b/src/applications/macro/query/PhabricatorMacroSearchEngine.php
--- a/src/applications/macro/query/PhabricatorMacroSearchEngine.php
+++ b/src/applications/macro/query/PhabricatorMacroSearchEngine.php
@@ -3,6 +3,10 @@
final class PhabricatorMacroSearchEngine
extends PhabricatorApplicationSearchEngine {
+ public function getApplicationClassName() {
+ return 'PhabricatorApplicationMacro';
+ }
+
public function buildSavedQueryFromRequest(AphrontRequest $request) {
$saved = new PhabricatorSavedQuery();
$saved->setParameter(
@@ -153,4 +157,65 @@
return parent::buildSavedQueryFromBuiltin($query_key);
}
+ protected function getRequiredHandlePHIDsForResultList(
+ array $macros,
+ PhabricatorSavedQuery $query) {
+ return mpull($macros, 'getAuthorPHID');
+ }
+
+ protected function renderResultList(
+ array $macros,
+ PhabricatorSavedQuery $query,
+ array $handles) {
+
+ assert_instances_of($macros, 'PhabricatorFileImageMacro');
+ $viewer = $this->requireViewer();
+
+ $pinboard = new PHUIPinboardView();
+ foreach ($macros as $macro) {
+ $file = $macro->getFile();
+
+ $item = new PHUIPinboardItemView();
+ if ($file) {
+ $item->setImageURI($file->getThumb280x210URI());
+ $item->setImageSize(280, 210);
+ }
+
+ 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().'/'));
+
+ $name = $macro->getName();
+ if ($macro->getIsDisabled()) {
+ $name = pht('%s (Disabled)', $name);
+ }
+ $item->setHeader($name);
+
+ $pinboard->addItem($item);
+ }
+
+ return $pinboard;
+ }
+
}
diff --git a/src/applications/mailinglists/controller/PhabricatorMailingListsListController.php b/src/applications/mailinglists/controller/PhabricatorMailingListsListController.php
--- a/src/applications/mailinglists/controller/PhabricatorMailingListsListController.php
+++ b/src/applications/mailinglists/controller/PhabricatorMailingListsListController.php
@@ -1,8 +1,7 @@
<?php
final class PhabricatorMailingListsListController
- extends PhabricatorMailingListsController
- implements PhabricatorApplicationSearchResultsControllerInterface {
+ extends PhabricatorMailingListsController {
private $queryKey;
@@ -24,28 +23,4 @@
return $this->delegateToController($controller);
}
- public function renderResultsList(
- array $lists,
- PhabricatorSavedQuery $query) {
- assert_instances_of($lists, 'PhabricatorMetaMTAMailingList');
-
- $view = id(new PHUIObjectItemListView());
-
- foreach ($lists as $list) {
- $item = new PHUIObjectItemView();
-
- $item->setHeader($list->getName());
- $item->setHref($list->getURI());
- $item->addAttribute($list->getEmail());
- $item->addAction(
- id(new PHUIListItemView())
- ->setIcon('edit')
- ->setHref($this->getApplicationURI('/edit/'.$list->getID().'/')));
-
- $view->addItem($item);
- }
-
- return $view;
- }
-
}
diff --git a/src/applications/mailinglists/query/PhabricatorMailingListSearchEngine.php b/src/applications/mailinglists/query/PhabricatorMailingListSearchEngine.php
--- a/src/applications/mailinglists/query/PhabricatorMailingListSearchEngine.php
+++ b/src/applications/mailinglists/query/PhabricatorMailingListSearchEngine.php
@@ -3,6 +3,10 @@
final class PhabricatorMailingListSearchEngine
extends PhabricatorApplicationSearchEngine {
+ public function getApplicationClassName() {
+ return 'PhabricatorApplicationMailingLists';
+ }
+
public function buildSavedQueryFromRequest(AphrontRequest $request) {
$saved = new PhabricatorSavedQuery();
@@ -51,4 +55,29 @@
return parent::buildSavedQueryFromBuiltin($query_key);
}
+ protected function renderResultList(
+ array $lists,
+ PhabricatorSavedQuery $query,
+ array $handles) {
+ assert_instances_of($lists, 'PhabricatorMetaMTAMailingList');
+
+ $view = id(new PHUIObjectItemListView());
+
+ foreach ($lists as $list) {
+ $item = new PHUIObjectItemView();
+
+ $item->setHeader($list->getName());
+ $item->setHref($list->getURI());
+ $item->addAttribute($list->getEmail());
+ $item->addAction(
+ id(new PHUIListItemView())
+ ->setIcon('edit')
+ ->setHref($this->getApplicationURI('/edit/'.$list->getID().'/')));
+
+ $view->addItem($item);
+ }
+
+ return $view;
+ }
+
}
diff --git a/src/applications/meta/controller/PhabricatorApplicationsListController.php b/src/applications/meta/controller/PhabricatorApplicationsListController.php
--- a/src/applications/meta/controller/PhabricatorApplicationsListController.php
+++ b/src/applications/meta/controller/PhabricatorApplicationsListController.php
@@ -1,8 +1,7 @@
<?php
final class PhabricatorApplicationsListController
- extends PhabricatorApplicationsController
- implements PhabricatorApplicationSearchResultsControllerInterface {
+ extends PhabricatorApplicationsController {
private $queryKey;
@@ -20,33 +19,4 @@
return $this->delegateToController($controller);
}
- public function renderResultsList(
- array $applications,
- PhabricatorSavedQuery $query) {
- assert_instances_of($applications, 'PhabricatorApplication');
-
- $list = new PHUIObjectItemListView();
-
- $applications = msort($applications, 'getName');
-
- foreach ($applications as $application) {
- $item = id(new PHUIObjectItemView())
- ->setHeader($application->getName())
- ->setHref('/applications/view/'.get_class($application).'/')
- ->addAttribute($application->getShortDescription());
-
- if (!$application->isInstalled()) {
- $item->addIcon('delete', pht('Uninstalled'));
- }
-
- if ($application->isBeta()) {
- $item->addIcon('lint-warning', pht('Beta'));
- }
-
- $list->addItem($item);
- }
-
- return $list;
- }
-
}
diff --git a/src/applications/meta/query/PhabricatorAppSearchEngine.php b/src/applications/meta/query/PhabricatorAppSearchEngine.php
--- a/src/applications/meta/query/PhabricatorAppSearchEngine.php
+++ b/src/applications/meta/query/PhabricatorAppSearchEngine.php
@@ -3,6 +3,10 @@
final class PhabricatorAppSearchEngine
extends PhabricatorApplicationSearchEngine {
+ public function getApplicationClassName() {
+ return 'PhabricatorApplicationApplications';
+ }
+
public function getPageSize(PhabricatorSavedQuery $saved) {
return INF;
}
@@ -124,4 +128,34 @@
return parent::buildSavedQueryFromBuiltin($query_key);
}
+ protected function renderResultList(
+ array $applications,
+ PhabricatorSavedQuery $query,
+ array $handle) {
+ assert_instances_of($applications, 'PhabricatorApplication');
+
+ $list = new PHUIObjectItemListView();
+
+ $applications = msort($applications, 'getName');
+
+ foreach ($applications as $application) {
+ $item = id(new PHUIObjectItemView())
+ ->setHeader($application->getName())
+ ->setHref('/applications/view/'.get_class($application).'/')
+ ->addAttribute($application->getShortDescription());
+
+ if (!$application->isInstalled()) {
+ $item->addIcon('delete', pht('Uninstalled'));
+ }
+
+ if ($application->isBeta()) {
+ $item->addIcon('lint-warning', pht('Beta'));
+ }
+
+ $list->addItem($item);
+ }
+
+ return $list;
+ }
+
}
diff --git a/src/applications/oauthserver/controller/client/PhabricatorOAuthClientListController.php b/src/applications/oauthserver/controller/client/PhabricatorOAuthClientListController.php
--- a/src/applications/oauthserver/controller/client/PhabricatorOAuthClientListController.php
+++ b/src/applications/oauthserver/controller/client/PhabricatorOAuthClientListController.php
@@ -1,8 +1,7 @@
<?php
final class PhabricatorOAuthClientListController
- extends PhabricatorOAuthClientBaseController
- implements PhabricatorApplicationSearchResultsControllerInterface {
+ extends PhabricatorOAuthClientBaseController {
private $queryKey;
@@ -24,32 +23,6 @@
return $this->delegateToController($controller);
}
- public function renderResultsList(
- array $clients,
- PhabricatorSavedQuery $query) {
- assert_instances_of($clients, 'PhabricatorOauthServerClient');
-
- $viewer = $this->getRequest()->getUser();
- $this->loadHandles(mpull($clients, 'getCreatorPHID'));
-
- $list = id(new PHUIObjectItemListView())
- ->setUser($viewer);
- foreach ($clients as $client) {
- $creator = $this->getHandle($client->getCreatorPHID());
-
- $item = id(new PHUIObjectItemView())
- ->setObjectName(pht('Application %d', $client->getID()))
- ->setHeader($client->getName())
- ->setHref($client->getViewURI())
- ->setObject($client)
- ->addByline(pht('Creator: %s', $creator->renderLink()));
-
- $list->addItem($item);
- }
-
- return $list;
- }
-
public function buildApplicationCrumbs() {
$crumbs = parent::buildApplicationCrumbs();
diff --git a/src/applications/oauthserver/query/PhabricatorOAuthServerClientSearchEngine.php b/src/applications/oauthserver/query/PhabricatorOAuthServerClientSearchEngine.php
--- a/src/applications/oauthserver/query/PhabricatorOAuthServerClientSearchEngine.php
+++ b/src/applications/oauthserver/query/PhabricatorOAuthServerClientSearchEngine.php
@@ -3,6 +3,10 @@
final class PhabricatorOAuthServerClientSearchEngine
extends PhabricatorApplicationSearchEngine {
+ public function getApplicationClassName() {
+ return 'PhabricatorApplicationOAuthServer';
+ }
+
public function buildSavedQueryFromRequest(AphrontRequest $request) {
$saved = new PhabricatorSavedQuery();
@@ -76,4 +80,37 @@
return parent::buildSavedQueryFromBuiltin($query_key);
}
+
+ protected function getRequiredHandlePHIDsForResultList(
+ array $clients,
+ PhabricatorSavedQuery $query) {
+ return mpull($clients, 'getCreatorPHID');
+ }
+
+ protected function renderResultList(
+ array $clients,
+ PhabricatorSavedQuery $query,
+ array $handles) {
+ assert_instances_of($clients, 'PhabricatorOauthServerClient');
+
+ $viewer = $this->requireViewer();
+
+ $list = id(new PHUIObjectItemListView())
+ ->setUser($viewer);
+ foreach ($clients as $client) {
+ $creator = $handles[$client->getCreatorPHID()];
+
+ $item = id(new PHUIObjectItemView())
+ ->setObjectName(pht('Application %d', $client->getID()))
+ ->setHeader($client->getName())
+ ->setHref($client->getViewURI())
+ ->setObject($client)
+ ->addByline(pht('Creator: %s', $creator->renderLink()));
+
+ $list->addItem($item);
+ }
+
+ return $list;
+ }
+
}
diff --git a/src/applications/passphrase/controller/PassphraseCredentialListController.php b/src/applications/passphrase/controller/PassphraseCredentialListController.php
--- a/src/applications/passphrase/controller/PassphraseCredentialListController.php
+++ b/src/applications/passphrase/controller/PassphraseCredentialListController.php
@@ -1,7 +1,6 @@
<?php
-final class PassphraseCredentialListController extends PassphraseController
- implements PhabricatorApplicationSearchResultsControllerInterface {
+final class PassphraseCredentialListController extends PassphraseController {
private $queryKey;
@@ -23,41 +22,4 @@
return $this->delegateToController($controller);
}
- public function renderResultsList(
- array $credentials,
- PhabricatorSavedQuery $query) {
- assert_instances_of($credentials, 'PassphraseCredential');
-
- $viewer = $this->getRequest()->getUser();
-
- $list = new PHUIObjectItemListView();
- $list->setUser($viewer);
- foreach ($credentials as $credential) {
-
- $item = id(new PHUIObjectItemView())
- ->setObjectName('K'.$credential->getID())
- ->setHeader($credential->getName())
- ->setHref('/K'.$credential->getID())
- ->setObject($credential);
-
- $item->addAttribute(
- pht('Login: %s', $credential->getUsername()));
-
- if ($credential->getIsDestroyed()) {
- $item->addIcon('disable', pht('Destroyed'));
- $item->setDisabled(true);
- }
-
- $type = PassphraseCredentialType::getTypeByConstant(
- $credential->getCredentialType());
- if ($type) {
- $item->addIcon('wrench', $type->getCredentialTypeName());
- }
-
- $list->addItem($item);
- }
-
- return $list;
- }
-
}
diff --git a/src/applications/passphrase/query/PassphraseCredentialSearchEngine.php b/src/applications/passphrase/query/PassphraseCredentialSearchEngine.php
--- a/src/applications/passphrase/query/PassphraseCredentialSearchEngine.php
+++ b/src/applications/passphrase/query/PassphraseCredentialSearchEngine.php
@@ -3,6 +3,10 @@
final class PassphraseCredentialSearchEngine
extends PhabricatorApplicationSearchEngine {
+ public function getApplicationClassName() {
+ return 'PhabricatorApplicationPassphrase';
+ }
+
public function buildSavedQueryFromRequest(AphrontRequest $request) {
$saved = new PhabricatorSavedQuery();
@@ -70,4 +74,43 @@
return parent::buildSavedQueryFromBuiltin($query_key);
}
+ protected function renderResultList(
+ array $credentials,
+ PhabricatorSavedQuery $query,
+ array $handles) {
+ assert_instances_of($credentials, 'PassphraseCredential');
+
+ $viewer = $this->requireViewer();
+
+ $list = new PHUIObjectItemListView();
+ $list->setUser($viewer);
+ foreach ($credentials as $credential) {
+
+ $item = id(new PHUIObjectItemView())
+ ->setObjectName('K'.$credential->getID())
+ ->setHeader($credential->getName())
+ ->setHref('/K'.$credential->getID())
+ ->setObject($credential);
+
+ $item->addAttribute(
+ pht('Login: %s', $credential->getUsername()));
+
+ if ($credential->getIsDestroyed()) {
+ $item->addIcon('disable', pht('Destroyed'));
+ $item->setDisabled(true);
+ }
+
+ $type = PassphraseCredentialType::getTypeByConstant(
+ $credential->getCredentialType());
+ if ($type) {
+ $item->addIcon('wrench', $type->getCredentialTypeName());
+ }
+
+ $list->addItem($item);
+ }
+
+ return $list;
+ }
+
+
}
diff --git a/src/applications/pholio/application/PhabricatorApplicationPholio.php b/src/applications/pholio/application/PhabricatorApplicationPholio.php
--- a/src/applications/pholio/application/PhabricatorApplicationPholio.php
+++ b/src/applications/pholio/application/PhabricatorApplicationPholio.php
@@ -1,8 +1,5 @@
<?php
-/**
- * @group pholio
- */
final class PhabricatorApplicationPholio extends PhabricatorApplication {
public function getBaseURI() {
diff --git a/src/applications/pholio/controller/PholioMockListController.php b/src/applications/pholio/controller/PholioMockListController.php
--- a/src/applications/pholio/controller/PholioMockListController.php
+++ b/src/applications/pholio/controller/PholioMockListController.php
@@ -1,8 +1,6 @@
<?php
-final class PholioMockListController
- extends PholioController
- implements PhabricatorApplicationSearchResultsControllerInterface {
+final class PholioMockListController extends PholioController {
private $queryKey;
@@ -24,40 +22,4 @@
return $this->delegateToController($controller);
}
- public function renderResultsList(
- array $mocks,
- PhabricatorSavedQuery $query) {
- assert_instances_of($mocks, 'PholioMock');
-
- $viewer = $this->getRequest()->getUser();
-
- $author_phids = array();
- foreach ($mocks as $mock) {
- $author_phids[] = $mock->getAuthorPHID();
- }
- $this->loadHandles($author_phids);
-
- $board = new PHUIPinboardView();
- foreach ($mocks as $mock) {
- $item = id(new PHUIPinboardItemView())
- ->setHeader('M'.$mock->getID().' '.$mock->getName())
- ->setURI('/M'.$mock->getID())
- ->setImageURI($mock->getCoverFile()->getThumb280x210URI())
- ->setImageSize(280, 210)
- ->addIconCount('image', count($mock->getImages()))
- ->addIconCount('like', $mock->getTokenCount());
-
- if ($mock->getAuthorPHID()) {
- $author_handle = $this->getHandle($mock->getAuthorPHID());
- $datetime = phabricator_date($mock->getDateCreated(), $viewer);
- $item->appendChild(
- pht('By %s on %s', $author_handle->renderLink(), $datetime));
- }
-
- $board->addItem($item);
- }
-
- return $board;
- }
-
}
diff --git a/src/applications/pholio/query/PholioMockSearchEngine.php b/src/applications/pholio/query/PholioMockSearchEngine.php
--- a/src/applications/pholio/query/PholioMockSearchEngine.php
+++ b/src/applications/pholio/query/PholioMockSearchEngine.php
@@ -3,6 +3,10 @@
final class PholioMockSearchEngine
extends PhabricatorApplicationSearchEngine {
+ public function getApplicationClassName() {
+ return 'PhabricatorApplicationPholio';
+ }
+
public function buildSavedQueryFromRequest(AphrontRequest $request) {
$saved = new PhabricatorSavedQuery();
$saved->setParameter(
@@ -74,4 +78,41 @@
return parent::buildSavedQueryFromBuiltin($query_key);
}
+ protected function getRequiredHandlePHIDsForResultList(
+ array $mocks,
+ PhabricatorSavedQuery $query) {
+ return mpull($mocks, 'getAuthorPHID');
+ }
+
+ protected function renderResultList(
+ array $mocks,
+ PhabricatorSavedQuery $query,
+ array $handles) {
+ assert_instances_of($mocks, 'PholioMock');
+
+ $viewer = $this->requireViewer();
+
+ $board = new PHUIPinboardView();
+ foreach ($mocks as $mock) {
+ $item = id(new PHUIPinboardItemView())
+ ->setHeader('M'.$mock->getID().' '.$mock->getName())
+ ->setURI('/M'.$mock->getID())
+ ->setImageURI($mock->getCoverFile()->getThumb280x210URI())
+ ->setImageSize(280, 210)
+ ->addIconCount('image', count($mock->getImages()))
+ ->addIconCount('like', $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);
+ }
+
+ return $board;
+ }
+
}
diff --git a/src/applications/phrequent/controller/PhrequentListController.php b/src/applications/phrequent/controller/PhrequentListController.php
--- a/src/applications/phrequent/controller/PhrequentListController.php
+++ b/src/applications/phrequent/controller/PhrequentListController.php
@@ -1,7 +1,6 @@
<?php
-final class PhrequentListController extends PhrequentController
- implements PhabricatorApplicationSearchResultsControllerInterface {
+final class PhrequentListController extends PhrequentController {
private $queryKey;
@@ -23,86 +22,4 @@
return $this->delegateToController($controller);
}
- public function renderResultsList(
- array $usertimes,
- PhabricatorSavedQuery $query) {
- assert_instances_of($usertimes, 'PhrequentUserTime');
- $viewer = $this->getRequest()->getUser();
-
- $phids = array();
- $phids[] = mpull($usertimes, 'getUserPHID');
- $phids[] = mpull($usertimes, 'getObjectPHID');
- $phids = array_mergev($phids);
-
- $handles = $this->loadViewerHandles($phids);
-
- $view = id(new PHUIObjectItemListView())
- ->setUser($viewer);
-
- foreach ($usertimes as $usertime) {
- $item = new PHUIObjectItemView();
-
- if ($usertime->getObjectPHID() === null) {
- $item->setHeader($usertime->getNote());
- } else {
- $obj = $handles[$usertime->getObjectPHID()];
- $item->setHeader($obj->getLinkName());
- $item->setHref($obj->getURI());
- }
- $item->setObject($usertime);
-
- $item->addByline(
- pht(
- 'Tracked: %s',
- $handles[$usertime->getUserPHID()]->renderLink()));
-
- $started_date = phabricator_date($usertime->getDateStarted(), $viewer);
- $item->addIcon('none', $started_date);
-
- if ($usertime->getDateEnded() !== null) {
- $time_spent = $usertime->getDateEnded() - $usertime->getDateStarted();
- $time_ended = phabricator_datetime($usertime->getDateEnded(), $viewer);
- } else {
- $time_spent = time() - $usertime->getDateStarted();
- }
-
- $time_spent = $time_spent == 0 ? 'none' :
- phabricator_format_relative_time_detailed($time_spent);
-
- if ($usertime->getDateEnded() !== null) {
- $item->addAttribute(
- pht(
- 'Tracked %s',
- $time_spent));
- $item->addAttribute(
- pht(
- 'Ended on %s',
- $time_ended));
- } else {
- $item->addAttribute(
- pht(
- 'Tracked %s so far',
- $time_spent));
- if ($usertime->getObjectPHID() !== null &&
- $usertime->getUserPHID() === $viewer->getPHID()) {
- $item->addAction(
- id(new PHUIListItemView())
- ->setIcon('history')
- ->addSigil('phrequent-stop-tracking')
- ->setWorkflow(true)
- ->setRenderNameAsTooltip(true)
- ->setName(pht("Stop"))
- ->setHref(
- '/phrequent/track/stop/'.
- $usertime->getObjectPHID().'/'));
- }
- $item->setBarColor('green');
- }
-
- $view->addItem($item);
- }
-
- return $view;
- }
-
}
diff --git a/src/applications/phrequent/query/PhrequentSearchEngine.php b/src/applications/phrequent/query/PhrequentSearchEngine.php
--- a/src/applications/phrequent/query/PhrequentSearchEngine.php
+++ b/src/applications/phrequent/query/PhrequentSearchEngine.php
@@ -3,6 +3,10 @@
final class PhrequentSearchEngine
extends PhabricatorApplicationSearchEngine {
+ public function getApplicationClassName() {
+ return 'PhabricatorApplicationPhrequent';
+ }
+
public function getPageSize(PhabricatorSavedQuery $saved) {
return $saved->getParameter('limit', 1000);
}
@@ -110,4 +114,89 @@
return parent::buildSavedQueryFromBuiltin($query_key);
}
+ protected function getRequiredHandlePHIDsForResultList(
+ array $usertimes,
+ PhabricatorSavedQuery $query) {
+ return array_mergev(
+ array(
+ mpull($usertimes, 'getUserPHID'),
+ mpull($usertimes, 'getObjectPHID'),
+ ));
+ }
+
+ protected function renderResultList(
+ array $usertimes,
+ PhabricatorSavedQuery $query,
+ array $handles) {
+ assert_instances_of($usertimes, 'PhrequentUserTime');
+ $viewer = $this->requireViewer();
+
+ $view = id(new PHUIObjectItemListView())
+ ->setUser($viewer);
+
+ foreach ($usertimes as $usertime) {
+ $item = new PHUIObjectItemView();
+
+ if ($usertime->getObjectPHID() === null) {
+ $item->setHeader($usertime->getNote());
+ } else {
+ $obj = $handles[$usertime->getObjectPHID()];
+ $item->setHeader($obj->getLinkName());
+ $item->setHref($obj->getURI());
+ }
+ $item->setObject($usertime);
+
+ $item->addByline(
+ pht(
+ 'Tracked: %s',
+ $handles[$usertime->getUserPHID()]->renderLink()));
+
+ $started_date = phabricator_date($usertime->getDateStarted(), $viewer);
+ $item->addIcon('none', $started_date);
+
+ if ($usertime->getDateEnded() !== null) {
+ $time_spent = $usertime->getDateEnded() - $usertime->getDateStarted();
+ $time_ended = phabricator_datetime($usertime->getDateEnded(), $viewer);
+ } else {
+ $time_spent = time() - $usertime->getDateStarted();
+ }
+
+ $time_spent = $time_spent == 0 ? 'none' :
+ phabricator_format_relative_time_detailed($time_spent);
+
+ if ($usertime->getDateEnded() !== null) {
+ $item->addAttribute(
+ pht(
+ 'Tracked %s',
+ $time_spent));
+ $item->addAttribute(
+ pht(
+ 'Ended on %s',
+ $time_ended));
+ } else {
+ $item->addAttribute(
+ pht(
+ 'Tracked %s so far',
+ $time_spent));
+ if ($usertime->getObjectPHID() !== null &&
+ $usertime->getUserPHID() === $viewer->getPHID()) {
+ $item->addAction(
+ id(new PHUIListItemView())
+ ->setIcon('history')
+ ->addSigil('phrequent-stop-tracking')
+ ->setWorkflow(true)
+ ->setRenderNameAsTooltip(true)
+ ->setName(pht("Stop"))
+ ->setHref(
+ '/phrequent/track/stop/'.
+ $usertime->getObjectPHID().'/'));
+ }
+ $item->setBarColor('green');
+ }
+
+ $view->addItem($item);
+ }
+
+ return $view;
+ }
}
diff --git a/src/applications/phriction/controller/PhrictionListController.php b/src/applications/phriction/controller/PhrictionListController.php
--- a/src/applications/phriction/controller/PhrictionListController.php
+++ b/src/applications/phriction/controller/PhrictionListController.php
@@ -1,8 +1,7 @@
<?php
final class PhrictionListController
- extends PhrictionController
- implements PhabricatorApplicationSearchResultsControllerInterface {
+ extends PhrictionController {
private $queryKey;
@@ -24,68 +23,4 @@
return $this->delegateToController($controller);
}
- public function renderResultsList(
- array $documents,
- PhabricatorSavedQuery $query) {
- assert_instances_of($documents, 'PhrictionDocument');
-
- $viewer = $this->getRequest()->getUser();
-
- $phids = array();
- foreach ($documents as $document) {
- $content = $document->getContent();
- if ($document->hasProject()) {
- $phids[] = $document->getProject()->getPHID();
- }
- $phids[] = $content->getAuthorPHID();
- }
-
- $this->loadHandles($phids);
-
- $list = new PHUIObjectItemListView();
- $list->setUser($viewer);
- foreach ($documents as $document) {
- $content = $document->getContent();
- $slug = $document->getSlug();
- $author_phid = $content->getAuthorPHID();
- $slug_uri = PhrictionDocument::getSlugURI($slug);
-
- $byline = pht(
- 'Edited by %s',
- $this->getHandle($author_phid)->renderLink());
-
- $updated = phabricator_datetime(
- $content->getDateCreated(),
- $viewer);
-
- $item = id(new PHUIObjectItemView())
- ->setHeader($content->getTitle())
- ->setHref($slug_uri)
- ->addByline($byline)
- ->addIcon('none', $updated);
-
- if ($document->hasProject()) {
- $item->addAttribute(
- $this->getHandle($document->getProject()->getPHID())->renderLink());
- }
-
- $item->addAttribute($slug_uri);
-
- switch ($document->getStatus()) {
- case PhrictionDocumentStatus::STATUS_DELETED:
- $item->setDisabled(true);
- $item->addIcon('delete', pht('Deleted'));
- break;
- case PhrictionDocumentStatus::STATUS_MOVED:
- $item->setDisabled(true);
- $item->addIcon('arrow-right', pht('Moved Away'));
- break;
- }
-
- $list->addItem($item);
- }
-
- return $list;
- }
-
}
diff --git a/src/applications/phriction/query/PhrictionSearchEngine.php b/src/applications/phriction/query/PhrictionSearchEngine.php
--- a/src/applications/phriction/query/PhrictionSearchEngine.php
+++ b/src/applications/phriction/query/PhrictionSearchEngine.php
@@ -109,4 +109,75 @@
);
}
+ protected function getRequiredHandlePHIDsForResultList(
+ array $documents,
+ PhabricatorSavedQuery $query) {
+
+ $phids = array();
+ foreach ($documents as $document) {
+ $content = $document->getContent();
+ if ($document->hasProject()) {
+ $phids[] = $document->getProject()->getPHID();
+ }
+ $phids[] = $content->getAuthorPHID();
+ }
+
+ return $phids;
+ }
+
+
+ protected function renderResultList(
+ array $documents,
+ PhabricatorSavedQuery $query,
+ array $handles) {
+ assert_instances_of($documents, 'PhrictionDocument');
+
+ $viewer = $this->requireViewer();
+
+ $list = new PHUIObjectItemListView();
+ $list->setUser($viewer);
+ foreach ($documents as $document) {
+ $content = $document->getContent();
+ $slug = $document->getSlug();
+ $author_phid = $content->getAuthorPHID();
+ $slug_uri = PhrictionDocument::getSlugURI($slug);
+
+ $byline = pht(
+ 'Edited by %s',
+ $handles[$author_phid]->renderLink());
+
+ $updated = phabricator_datetime(
+ $content->getDateCreated(),
+ $viewer);
+
+ $item = id(new PHUIObjectItemView())
+ ->setHeader($content->getTitle())
+ ->setHref($slug_uri)
+ ->addByline($byline)
+ ->addIcon('none', $updated);
+
+ if ($document->hasProject()) {
+ $item->addAttribute(
+ $handles[$document->getProject()->getPHID()]->renderLink());
+ }
+
+ $item->addAttribute($slug_uri);
+
+ switch ($document->getStatus()) {
+ case PhrictionDocumentStatus::STATUS_DELETED:
+ $item->setDisabled(true);
+ $item->addIcon('delete', pht('Deleted'));
+ break;
+ case PhrictionDocumentStatus::STATUS_MOVED:
+ $item->setDisabled(true);
+ $item->addIcon('arrow-right', pht('Moved Away'));
+ break;
+ }
+
+ $list->addItem($item);
+ }
+
+ return $list;
+ }
+
}
diff --git a/src/applications/ponder/controller/PonderQuestionListController.php b/src/applications/ponder/controller/PonderQuestionListController.php
--- a/src/applications/ponder/controller/PonderQuestionListController.php
+++ b/src/applications/ponder/controller/PonderQuestionListController.php
@@ -1,7 +1,6 @@
<?php
-final class PonderQuestionListController extends PonderController
- implements PhabricatorApplicationSearchResultsControllerInterface {
+final class PonderQuestionListController extends PonderController {
private $queryKey;
@@ -23,46 +22,4 @@
return $this->delegateToController($controller);
}
- public function renderResultsList(
- array $questions,
- PhabricatorSavedQuery $query) {
- assert_instances_of($questions, 'PonderQuestion');
- $viewer = $this->getRequest()->getUser();
-
- $phids = array();
- $phids[] = mpull($questions, 'getAuthorPHID');
- $phids = array_mergev($phids);
-
- $handles = $this->loadViewerHandles($phids);
-
-
- $view = id(new PHUIObjectItemListView())
- ->setUser($viewer);
-
- foreach ($questions as $question) {
- $item = new PHUIObjectItemView();
- $item->setObjectName('Q'.$question->getID());
- $item->setHeader($question->getTitle());
- $item->setHref('/Q'.$question->getID());
- $item->setObject($question);
- $item->setBarColor(
- PonderQuestionStatus::getQuestionStatusTagColor(
- $question->getStatus()));
-
- $created_date = phabricator_date($question->getDateCreated(), $viewer);
- $item->addIcon('none', $created_date);
- $item->addByline(
- pht(
- 'Asked by %s',
- $handles[$question->getAuthorPHID()]->renderLink()));
-
- $item->addAttribute(
- pht('%d Answer(s)', $question->getAnswerCount()));
-
- $view->addItem($item);
- }
-
- return $view;
- }
-
}
diff --git a/src/applications/ponder/query/PonderQuestionSearchEngine.php b/src/applications/ponder/query/PonderQuestionSearchEngine.php
--- a/src/applications/ponder/query/PonderQuestionSearchEngine.php
+++ b/src/applications/ponder/query/PonderQuestionSearchEngine.php
@@ -3,6 +3,10 @@
final class PonderQuestionSearchEngine
extends PhabricatorApplicationSearchEngine {
+ public function getApplicationClassName() {
+ return 'PhabricatorApplicationPonder';
+ }
+
public function buildSavedQueryFromRequest(AphrontRequest $request) {
$saved = new PhabricatorSavedQuery();
@@ -124,4 +128,47 @@
return parent::buildSavedQueryFromBuiltin($query_key);
}
+ protected function getRequiredHandlePHIDsForResultList(
+ array $questions,
+ PhabricatorSavedQuery $query) {
+ return mpull($questions, 'getAuthorPHID');
+ }
+
+ protected function renderResultList(
+ array $questions,
+ PhabricatorSavedQuery $query,
+ array $handles) {
+ assert_instances_of($questions, 'PonderQuestion');
+
+ $viewer = $this->requireViewer();
+
+ $view = id(new PHUIObjectItemListView())
+ ->setUser($viewer);
+
+ foreach ($questions as $question) {
+ $item = new PHUIObjectItemView();
+ $item->setObjectName('Q'.$question->getID());
+ $item->setHeader($question->getTitle());
+ $item->setHref('/Q'.$question->getID());
+ $item->setObject($question);
+ $item->setBarColor(
+ PonderQuestionStatus::getQuestionStatusTagColor(
+ $question->getStatus()));
+
+ $created_date = phabricator_date($question->getDateCreated(), $viewer);
+ $item->addIcon('none', $created_date);
+ $item->addByline(
+ pht(
+ 'Asked by %s',
+ $handles[$question->getAuthorPHID()]->renderLink()));
+
+ $item->addAttribute(
+ pht('%d Answer(s)', $question->getAnswerCount()));
+
+ $view->addItem($item);
+ }
+
+ return $view;
+ }
+
}
diff --git a/src/applications/project/controller/PhabricatorProjectListController.php b/src/applications/project/controller/PhabricatorProjectListController.php
--- a/src/applications/project/controller/PhabricatorProjectListController.php
+++ b/src/applications/project/controller/PhabricatorProjectListController.php
@@ -1,8 +1,7 @@
<?php
final class PhabricatorProjectListController
- extends PhabricatorProjectController
- implements PhabricatorApplicationSearchResultsControllerInterface {
+ extends PhabricatorProjectController {
private $queryKey;
@@ -24,33 +23,6 @@
return $this->delegateToController($controller);
}
- public function renderResultsList(
- array $projects,
- PhabricatorSavedQuery $query) {
- assert_instances_of($projects, 'PhabricatorProject');
- $viewer = $this->getRequest()->getUser();
-
- $list = new PHUIObjectItemListView();
- $list->setUser($viewer);
- foreach ($projects as $project) {
- $id = $project->getID();
-
- $item = id(new PHUIObjectItemView())
- ->setHeader($project->getName())
- ->setHref($this->getApplicationURI("view/{$id}/"))
- ->setImageURI($project->getProfileImageURI());
-
- if ($project->getStatus() == PhabricatorProjectStatus::STATUS_ARCHIVED) {
- $item->addIcon('delete-grey', pht('Archived'));
- $item->setDisabled(true);
- }
-
- $list->addItem($item);
- }
-
- return $list;
- }
-
public function buildApplicationCrumbs() {
$crumbs = parent::buildApplicationCrumbs();
diff --git a/src/applications/project/query/PhabricatorProjectSearchEngine.php b/src/applications/project/query/PhabricatorProjectSearchEngine.php
--- a/src/applications/project/query/PhabricatorProjectSearchEngine.php
+++ b/src/applications/project/query/PhabricatorProjectSearchEngine.php
@@ -3,6 +3,10 @@
final class PhabricatorProjectSearchEngine
extends PhabricatorApplicationSearchEngine {
+ public function getApplicationClassName() {
+ return 'PhabricatorApplicationProject';
+ }
+
public function getCustomFieldObject() {
return new PhabricatorProject();
}
@@ -122,4 +126,32 @@
);
}
+ protected function renderResultList(
+ array $projects,
+ PhabricatorSavedQuery $query,
+ array $handles) {
+ assert_instances_of($projects, 'PhabricatorProject');
+ $viewer = $this->requireViewer();
+
+ $list = new PHUIObjectItemListView();
+ $list->setUser($viewer);
+ foreach ($projects as $project) {
+ $id = $project->getID();
+
+ $item = id(new PHUIObjectItemView())
+ ->setHeader($project->getName())
+ ->setHref($this->getApplicationURI("view/{$id}/"))
+ ->setImageURI($project->getProfileImageURI());
+
+ if ($project->getStatus() == PhabricatorProjectStatus::STATUS_ARCHIVED) {
+ $item->addIcon('delete-grey', pht('Archived'));
+ $item->setDisabled(true);
+ }
+
+ $list->addItem($item);
+ }
+
+ return $list;
+ }
+
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Mar 20, 9:33 AM (2 w, 3 h ago)
Storage Engine
amazon-s3
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
phabricator/secure/yl/qk/dyfquj2om26xxgu6
Default Alt Text
D9024.diff (54 KB)
Attached To
Mode
D9024: Move more rendering into SearchEngines for panels
Attached
Detach File
Event Timeline
Log In to Comment