mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-19 12:00:55 +01:00
Move more rendering into SearchEngines for panels
Summary: Ref T4986. Getting closer. Nothing out of the ordinary in this group. Test Plan: For each application: - Viewed the normal search results. - Created a panel version and viewed it. Reviewers: btrahan Reviewed By: btrahan Subscribers: epriestley Maniphest Tasks: T4986 Differential Revision: https://secure.phabricator.com/D9024
This commit is contained in:
parent
78b89711cb
commit
352d9f6b06
26 changed files with 601 additions and 601 deletions
|
@ -3507,11 +3507,7 @@ phutil_register_library_map(array(
|
||||||
),
|
),
|
||||||
'HeraldTranscriptController' => 'HeraldController',
|
'HeraldTranscriptController' => 'HeraldController',
|
||||||
'HeraldTranscriptGarbageCollector' => 'PhabricatorGarbageCollector',
|
'HeraldTranscriptGarbageCollector' => 'PhabricatorGarbageCollector',
|
||||||
'HeraldTranscriptListController' =>
|
'HeraldTranscriptListController' => 'HeraldController',
|
||||||
array(
|
|
||||||
0 => 'HeraldController',
|
|
||||||
1 => 'PhabricatorApplicationSearchResultsControllerInterface',
|
|
||||||
),
|
|
||||||
'HeraldTranscriptQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
'HeraldTranscriptQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||||
'HeraldTranscriptSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
'HeraldTranscriptSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
||||||
'HeraldTranscriptTestCase' => 'PhabricatorTestCase',
|
'HeraldTranscriptTestCase' => 'PhabricatorTestCase',
|
||||||
|
@ -3538,11 +3534,7 @@ phutil_register_library_map(array(
|
||||||
'LegalpadDocumentCommentController' => 'LegalpadController',
|
'LegalpadDocumentCommentController' => 'LegalpadController',
|
||||||
'LegalpadDocumentEditController' => 'LegalpadController',
|
'LegalpadDocumentEditController' => 'LegalpadController',
|
||||||
'LegalpadDocumentEditor' => 'PhabricatorApplicationTransactionEditor',
|
'LegalpadDocumentEditor' => 'PhabricatorApplicationTransactionEditor',
|
||||||
'LegalpadDocumentListController' =>
|
'LegalpadDocumentListController' => 'LegalpadController',
|
||||||
array(
|
|
||||||
0 => 'LegalpadController',
|
|
||||||
1 => 'PhabricatorApplicationSearchResultsControllerInterface',
|
|
||||||
),
|
|
||||||
'LegalpadDocumentQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
'LegalpadDocumentQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||||
'LegalpadDocumentRemarkupRule' => 'PhabricatorRemarkupRuleObject',
|
'LegalpadDocumentRemarkupRule' => 'PhabricatorRemarkupRuleObject',
|
||||||
'LegalpadDocumentSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
'LegalpadDocumentSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
||||||
|
@ -3777,11 +3769,7 @@ phutil_register_library_map(array(
|
||||||
'PassphraseCredentialCreateController' => 'PassphraseController',
|
'PassphraseCredentialCreateController' => 'PassphraseController',
|
||||||
'PassphraseCredentialDestroyController' => 'PassphraseController',
|
'PassphraseCredentialDestroyController' => 'PassphraseController',
|
||||||
'PassphraseCredentialEditController' => 'PassphraseController',
|
'PassphraseCredentialEditController' => 'PassphraseController',
|
||||||
'PassphraseCredentialListController' =>
|
'PassphraseCredentialListController' => 'PassphraseController',
|
||||||
array(
|
|
||||||
0 => 'PassphraseController',
|
|
||||||
1 => 'PhabricatorApplicationSearchResultsControllerInterface',
|
|
||||||
),
|
|
||||||
'PassphraseCredentialLockController' => 'PassphraseController',
|
'PassphraseCredentialLockController' => 'PassphraseController',
|
||||||
'PassphraseCredentialPublicController' => 'PassphraseController',
|
'PassphraseCredentialPublicController' => 'PassphraseController',
|
||||||
'PassphraseCredentialQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
'PassphraseCredentialQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||||
|
@ -3931,11 +3919,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorApplicationUninstallController' => 'PhabricatorApplicationsController',
|
'PhabricatorApplicationUninstallController' => 'PhabricatorApplicationsController',
|
||||||
'PhabricatorApplicationXHProf' => 'PhabricatorApplication',
|
'PhabricatorApplicationXHProf' => 'PhabricatorApplication',
|
||||||
'PhabricatorApplicationsController' => 'PhabricatorController',
|
'PhabricatorApplicationsController' => 'PhabricatorController',
|
||||||
'PhabricatorApplicationsListController' =>
|
'PhabricatorApplicationsListController' => 'PhabricatorApplicationsController',
|
||||||
array(
|
|
||||||
0 => 'PhabricatorApplicationsController',
|
|
||||||
1 => 'PhabricatorApplicationSearchResultsControllerInterface',
|
|
||||||
),
|
|
||||||
'PhabricatorAsanaConfigOptions' => 'PhabricatorApplicationConfigOptions',
|
'PhabricatorAsanaConfigOptions' => 'PhabricatorApplicationConfigOptions',
|
||||||
'PhabricatorAuditAddCommentController' => 'PhabricatorAuditController',
|
'PhabricatorAuditAddCommentController' => 'PhabricatorAuditController',
|
||||||
'PhabricatorAuditComment' =>
|
'PhabricatorAuditComment' =>
|
||||||
|
@ -4456,11 +4440,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorMacroDisableController' => 'PhabricatorMacroController',
|
'PhabricatorMacroDisableController' => 'PhabricatorMacroController',
|
||||||
'PhabricatorMacroEditController' => 'PhabricatorMacroController',
|
'PhabricatorMacroEditController' => 'PhabricatorMacroController',
|
||||||
'PhabricatorMacroEditor' => 'PhabricatorApplicationTransactionEditor',
|
'PhabricatorMacroEditor' => 'PhabricatorApplicationTransactionEditor',
|
||||||
'PhabricatorMacroListController' =>
|
'PhabricatorMacroListController' => 'PhabricatorMacroController',
|
||||||
array(
|
|
||||||
0 => 'PhabricatorMacroController',
|
|
||||||
1 => 'PhabricatorApplicationSearchResultsControllerInterface',
|
|
||||||
),
|
|
||||||
'PhabricatorMacroMailReceiver' => 'PhabricatorObjectMailReceiver',
|
'PhabricatorMacroMailReceiver' => 'PhabricatorObjectMailReceiver',
|
||||||
'PhabricatorMacroMemeController' => 'PhabricatorMacroController',
|
'PhabricatorMacroMemeController' => 'PhabricatorMacroController',
|
||||||
'PhabricatorMacroMemeDialogController' => 'PhabricatorMacroController',
|
'PhabricatorMacroMemeDialogController' => 'PhabricatorMacroController',
|
||||||
|
@ -4493,11 +4473,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorMailingListSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
'PhabricatorMailingListSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
||||||
'PhabricatorMailingListsController' => 'PhabricatorController',
|
'PhabricatorMailingListsController' => 'PhabricatorController',
|
||||||
'PhabricatorMailingListsEditController' => 'PhabricatorMailingListsController',
|
'PhabricatorMailingListsEditController' => 'PhabricatorMailingListsController',
|
||||||
'PhabricatorMailingListsListController' =>
|
'PhabricatorMailingListsListController' => 'PhabricatorMailingListsController',
|
||||||
array(
|
|
||||||
0 => 'PhabricatorMailingListsController',
|
|
||||||
1 => 'PhabricatorApplicationSearchResultsControllerInterface',
|
|
||||||
),
|
|
||||||
'PhabricatorMainMenuGroupView' => 'AphrontView',
|
'PhabricatorMainMenuGroupView' => 'AphrontView',
|
||||||
'PhabricatorMainMenuIconView' => 'AphrontView',
|
'PhabricatorMainMenuIconView' => 'AphrontView',
|
||||||
'PhabricatorMainMenuSearchView' => 'AphrontView',
|
'PhabricatorMainMenuSearchView' => 'AphrontView',
|
||||||
|
@ -4560,11 +4536,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorOAuthClientBaseController' => 'PhabricatorOAuthServerController',
|
'PhabricatorOAuthClientBaseController' => 'PhabricatorOAuthServerController',
|
||||||
'PhabricatorOAuthClientDeleteController' => 'PhabricatorOAuthClientBaseController',
|
'PhabricatorOAuthClientDeleteController' => 'PhabricatorOAuthClientBaseController',
|
||||||
'PhabricatorOAuthClientEditController' => 'PhabricatorOAuthClientBaseController',
|
'PhabricatorOAuthClientEditController' => 'PhabricatorOAuthClientBaseController',
|
||||||
'PhabricatorOAuthClientListController' =>
|
'PhabricatorOAuthClientListController' => 'PhabricatorOAuthClientBaseController',
|
||||||
array(
|
|
||||||
0 => 'PhabricatorOAuthClientBaseController',
|
|
||||||
1 => 'PhabricatorApplicationSearchResultsControllerInterface',
|
|
||||||
),
|
|
||||||
'PhabricatorOAuthClientViewController' => 'PhabricatorOAuthClientBaseController',
|
'PhabricatorOAuthClientViewController' => 'PhabricatorOAuthClientBaseController',
|
||||||
'PhabricatorOAuthResponse' => 'AphrontResponse',
|
'PhabricatorOAuthResponse' => 'AphrontResponse',
|
||||||
'PhabricatorOAuthServerAccessToken' => 'PhabricatorOAuthServerDAO',
|
'PhabricatorOAuthServerAccessToken' => 'PhabricatorOAuthServerDAO',
|
||||||
|
@ -4758,11 +4730,7 @@ phutil_register_library_map(array(
|
||||||
'PhabricatorProjectEditMainController' => 'PhabricatorProjectController',
|
'PhabricatorProjectEditMainController' => 'PhabricatorProjectController',
|
||||||
'PhabricatorProjectEditPictureController' => 'PhabricatorProjectController',
|
'PhabricatorProjectEditPictureController' => 'PhabricatorProjectController',
|
||||||
'PhabricatorProjectEditorTestCase' => 'PhabricatorTestCase',
|
'PhabricatorProjectEditorTestCase' => 'PhabricatorTestCase',
|
||||||
'PhabricatorProjectListController' =>
|
'PhabricatorProjectListController' => 'PhabricatorProjectController',
|
||||||
array(
|
|
||||||
0 => 'PhabricatorProjectController',
|
|
||||||
1 => 'PhabricatorApplicationSearchResultsControllerInterface',
|
|
||||||
),
|
|
||||||
'PhabricatorProjectMembersEditController' => 'PhabricatorProjectController',
|
'PhabricatorProjectMembersEditController' => 'PhabricatorProjectController',
|
||||||
'PhabricatorProjectMembersRemoveController' => 'PhabricatorProjectController',
|
'PhabricatorProjectMembersRemoveController' => 'PhabricatorProjectController',
|
||||||
'PhabricatorProjectMoveController' => 'PhabricatorProjectController',
|
'PhabricatorProjectMoveController' => 'PhabricatorProjectController',
|
||||||
|
@ -5278,11 +5246,7 @@ phutil_register_library_map(array(
|
||||||
'PholioMockEditor' => 'PhabricatorApplicationTransactionEditor',
|
'PholioMockEditor' => 'PhabricatorApplicationTransactionEditor',
|
||||||
'PholioMockEmbedView' => 'AphrontView',
|
'PholioMockEmbedView' => 'AphrontView',
|
||||||
'PholioMockImagesView' => 'AphrontView',
|
'PholioMockImagesView' => 'AphrontView',
|
||||||
'PholioMockListController' =>
|
'PholioMockListController' => 'PholioController',
|
||||||
array(
|
|
||||||
0 => 'PholioController',
|
|
||||||
1 => 'PhabricatorApplicationSearchResultsControllerInterface',
|
|
||||||
),
|
|
||||||
'PholioMockMailReceiver' => 'PhabricatorObjectMailReceiver',
|
'PholioMockMailReceiver' => 'PhabricatorObjectMailReceiver',
|
||||||
'PholioMockQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
'PholioMockQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||||
'PholioMockSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
'PholioMockSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
||||||
|
@ -5396,11 +5360,7 @@ phutil_register_library_map(array(
|
||||||
'PhragmentZIPController' => 'PhragmentController',
|
'PhragmentZIPController' => 'PhragmentController',
|
||||||
'PhrequentController' => 'PhabricatorController',
|
'PhrequentController' => 'PhabricatorController',
|
||||||
'PhrequentDAO' => 'PhabricatorLiskDAO',
|
'PhrequentDAO' => 'PhabricatorLiskDAO',
|
||||||
'PhrequentListController' =>
|
'PhrequentListController' => 'PhrequentController',
|
||||||
array(
|
|
||||||
0 => 'PhrequentController',
|
|
||||||
1 => 'PhabricatorApplicationSearchResultsControllerInterface',
|
|
||||||
),
|
|
||||||
'PhrequentSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
'PhrequentSearchEngine' => 'PhabricatorApplicationSearchEngine',
|
||||||
'PhrequentTimeBlock' => 'Phobject',
|
'PhrequentTimeBlock' => 'Phobject',
|
||||||
'PhrequentTimeBlockTestCase' => 'PhabricatorTestCase',
|
'PhrequentTimeBlockTestCase' => 'PhabricatorTestCase',
|
||||||
|
@ -5440,11 +5400,7 @@ phutil_register_library_map(array(
|
||||||
'PhrictionDocumentTestCase' => 'PhabricatorTestCase',
|
'PhrictionDocumentTestCase' => 'PhabricatorTestCase',
|
||||||
'PhrictionEditController' => 'PhrictionController',
|
'PhrictionEditController' => 'PhrictionController',
|
||||||
'PhrictionHistoryController' => 'PhrictionController',
|
'PhrictionHistoryController' => 'PhrictionController',
|
||||||
'PhrictionListController' =>
|
'PhrictionListController' => 'PhrictionController',
|
||||||
array(
|
|
||||||
0 => 'PhrictionController',
|
|
||||||
1 => 'PhabricatorApplicationSearchResultsControllerInterface',
|
|
||||||
),
|
|
||||||
'PhrictionMoveController' => 'PhrictionController',
|
'PhrictionMoveController' => 'PhrictionController',
|
||||||
'PhrictionNewController' => 'PhrictionController',
|
'PhrictionNewController' => 'PhrictionController',
|
||||||
'PhrictionPHIDTypeDocument' => 'PhabricatorPHIDType',
|
'PhrictionPHIDTypeDocument' => 'PhabricatorPHIDType',
|
||||||
|
@ -5496,11 +5452,7 @@ phutil_register_library_map(array(
|
||||||
'PonderQuestionEditController' => 'PonderController',
|
'PonderQuestionEditController' => 'PonderController',
|
||||||
'PonderQuestionEditor' => 'PonderEditor',
|
'PonderQuestionEditor' => 'PonderEditor',
|
||||||
'PonderQuestionHistoryController' => 'PonderController',
|
'PonderQuestionHistoryController' => 'PonderController',
|
||||||
'PonderQuestionListController' =>
|
'PonderQuestionListController' => 'PonderController',
|
||||||
array(
|
|
||||||
0 => 'PonderController',
|
|
||||||
1 => 'PhabricatorApplicationSearchResultsControllerInterface',
|
|
||||||
),
|
|
||||||
'PonderQuestionMailReceiver' => 'PhabricatorObjectMailReceiver',
|
'PonderQuestionMailReceiver' => 'PhabricatorObjectMailReceiver',
|
||||||
'PonderQuestionQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
'PonderQuestionQuery' => 'PhabricatorCursorPagedPolicyAwareQuery',
|
||||||
'PonderQuestionReplyHandler' => 'PhabricatorMailReplyHandler',
|
'PonderQuestionReplyHandler' => 'PhabricatorMailReplyHandler',
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
final class HeraldTranscriptListController extends HeraldController
|
final class HeraldTranscriptListController extends HeraldController {
|
||||||
implements PhabricatorApplicationSearchResultsControllerInterface {
|
|
||||||
|
|
||||||
private $queryKey;
|
private $queryKey;
|
||||||
|
|
||||||
|
@ -47,49 +46,4 @@ final class HeraldTranscriptListController extends HeraldController
|
||||||
return $this->delegateToController($controller);
|
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;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,10 @@
|
||||||
final class HeraldTranscriptSearchEngine
|
final class HeraldTranscriptSearchEngine
|
||||||
extends PhabricatorApplicationSearchEngine {
|
extends PhabricatorApplicationSearchEngine {
|
||||||
|
|
||||||
|
public function getApplicationClassName() {
|
||||||
|
return 'PhabricatorApplicationHerald';
|
||||||
|
}
|
||||||
|
|
||||||
public function buildSavedQueryFromRequest(AphrontRequest $request) {
|
public function buildSavedQueryFromRequest(AphrontRequest $request) {
|
||||||
$saved = new PhabricatorSavedQuery();
|
$saved = new PhabricatorSavedQuery();
|
||||||
|
|
||||||
|
@ -89,4 +93,47 @@ final class HeraldTranscriptSearchEngine
|
||||||
return parent::buildSavedQueryFromBuiltin($query_key);
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
final class LegalpadDocumentListController extends LegalpadController {
|
||||||
* @group legalpad
|
|
||||||
*/
|
|
||||||
final class LegalpadDocumentListController extends LegalpadController
|
|
||||||
implements PhabricatorApplicationSearchResultsControllerInterface {
|
|
||||||
|
|
||||||
private $queryKey;
|
private $queryKey;
|
||||||
|
|
||||||
|
@ -22,39 +18,4 @@ final class LegalpadDocumentListController extends LegalpadController
|
||||||
return $this->delegateToController($controller);
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
|
||||||
* @group legalpad
|
|
||||||
*/
|
|
||||||
final class LegalpadDocumentSearchEngine
|
final class LegalpadDocumentSearchEngine
|
||||||
extends PhabricatorApplicationSearchEngine {
|
extends PhabricatorApplicationSearchEngine {
|
||||||
|
|
||||||
|
public function getApplicationClassName() {
|
||||||
|
return 'PhabricatorApplicationLegalpad';
|
||||||
|
}
|
||||||
|
|
||||||
public function buildSavedQueryFromRequest(AphrontRequest $request) {
|
public function buildSavedQueryFromRequest(AphrontRequest $request) {
|
||||||
$saved = new PhabricatorSavedQuery();
|
$saved = new PhabricatorSavedQuery();
|
||||||
$saved->setParameter(
|
$saved->setParameter(
|
||||||
|
@ -103,4 +104,42 @@ final class LegalpadDocumentSearchEngine
|
||||||
return parent::buildSavedQueryFromBuiltin($query_key);
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
final class PhabricatorMacroListController extends PhabricatorMacroController
|
final class PhabricatorMacroListController extends PhabricatorMacroController {
|
||||||
implements PhabricatorApplicationSearchResultsControllerInterface {
|
|
||||||
|
|
||||||
private $key;
|
private $key;
|
||||||
|
|
||||||
|
@ -23,64 +22,4 @@ final class PhabricatorMacroListController extends PhabricatorMacroController
|
||||||
return $this->delegateToController($controller);
|
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;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,10 @@
|
||||||
final class PhabricatorMacroSearchEngine
|
final class PhabricatorMacroSearchEngine
|
||||||
extends PhabricatorApplicationSearchEngine {
|
extends PhabricatorApplicationSearchEngine {
|
||||||
|
|
||||||
|
public function getApplicationClassName() {
|
||||||
|
return 'PhabricatorApplicationMacro';
|
||||||
|
}
|
||||||
|
|
||||||
public function buildSavedQueryFromRequest(AphrontRequest $request) {
|
public function buildSavedQueryFromRequest(AphrontRequest $request) {
|
||||||
$saved = new PhabricatorSavedQuery();
|
$saved = new PhabricatorSavedQuery();
|
||||||
$saved->setParameter(
|
$saved->setParameter(
|
||||||
|
@ -153,4 +157,65 @@ final class PhabricatorMacroSearchEngine
|
||||||
return parent::buildSavedQueryFromBuiltin($query_key);
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
final class PhabricatorMailingListsListController
|
final class PhabricatorMailingListsListController
|
||||||
extends PhabricatorMailingListsController
|
extends PhabricatorMailingListsController {
|
||||||
implements PhabricatorApplicationSearchResultsControllerInterface {
|
|
||||||
|
|
||||||
private $queryKey;
|
private $queryKey;
|
||||||
|
|
||||||
|
@ -24,28 +23,4 @@ final class PhabricatorMailingListsListController
|
||||||
return $this->delegateToController($controller);
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,10 @@
|
||||||
final class PhabricatorMailingListSearchEngine
|
final class PhabricatorMailingListSearchEngine
|
||||||
extends PhabricatorApplicationSearchEngine {
|
extends PhabricatorApplicationSearchEngine {
|
||||||
|
|
||||||
|
public function getApplicationClassName() {
|
||||||
|
return 'PhabricatorApplicationMailingLists';
|
||||||
|
}
|
||||||
|
|
||||||
public function buildSavedQueryFromRequest(AphrontRequest $request) {
|
public function buildSavedQueryFromRequest(AphrontRequest $request) {
|
||||||
$saved = new PhabricatorSavedQuery();
|
$saved = new PhabricatorSavedQuery();
|
||||||
|
|
||||||
|
@ -51,4 +55,29 @@ final class PhabricatorMailingListSearchEngine
|
||||||
return parent::buildSavedQueryFromBuiltin($query_key);
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
final class PhabricatorApplicationsListController
|
final class PhabricatorApplicationsListController
|
||||||
extends PhabricatorApplicationsController
|
extends PhabricatorApplicationsController {
|
||||||
implements PhabricatorApplicationSearchResultsControllerInterface {
|
|
||||||
|
|
||||||
private $queryKey;
|
private $queryKey;
|
||||||
|
|
||||||
|
@ -20,33 +19,4 @@ final class PhabricatorApplicationsListController
|
||||||
return $this->delegateToController($controller);
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,10 @@
|
||||||
final class PhabricatorAppSearchEngine
|
final class PhabricatorAppSearchEngine
|
||||||
extends PhabricatorApplicationSearchEngine {
|
extends PhabricatorApplicationSearchEngine {
|
||||||
|
|
||||||
|
public function getApplicationClassName() {
|
||||||
|
return 'PhabricatorApplicationApplications';
|
||||||
|
}
|
||||||
|
|
||||||
public function getPageSize(PhabricatorSavedQuery $saved) {
|
public function getPageSize(PhabricatorSavedQuery $saved) {
|
||||||
return INF;
|
return INF;
|
||||||
}
|
}
|
||||||
|
@ -124,4 +128,34 @@ final class PhabricatorAppSearchEngine
|
||||||
return parent::buildSavedQueryFromBuiltin($query_key);
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
final class PhabricatorOAuthClientListController
|
final class PhabricatorOAuthClientListController
|
||||||
extends PhabricatorOAuthClientBaseController
|
extends PhabricatorOAuthClientBaseController {
|
||||||
implements PhabricatorApplicationSearchResultsControllerInterface {
|
|
||||||
|
|
||||||
private $queryKey;
|
private $queryKey;
|
||||||
|
|
||||||
|
@ -24,32 +23,6 @@ final class PhabricatorOAuthClientListController
|
||||||
return $this->delegateToController($controller);
|
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() {
|
public function buildApplicationCrumbs() {
|
||||||
$crumbs = parent::buildApplicationCrumbs();
|
$crumbs = parent::buildApplicationCrumbs();
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,10 @@
|
||||||
final class PhabricatorOAuthServerClientSearchEngine
|
final class PhabricatorOAuthServerClientSearchEngine
|
||||||
extends PhabricatorApplicationSearchEngine {
|
extends PhabricatorApplicationSearchEngine {
|
||||||
|
|
||||||
|
public function getApplicationClassName() {
|
||||||
|
return 'PhabricatorApplicationOAuthServer';
|
||||||
|
}
|
||||||
|
|
||||||
public function buildSavedQueryFromRequest(AphrontRequest $request) {
|
public function buildSavedQueryFromRequest(AphrontRequest $request) {
|
||||||
$saved = new PhabricatorSavedQuery();
|
$saved = new PhabricatorSavedQuery();
|
||||||
|
|
||||||
|
@ -76,4 +80,37 @@ final class PhabricatorOAuthServerClientSearchEngine
|
||||||
return parent::buildSavedQueryFromBuiltin($query_key);
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
final class PassphraseCredentialListController extends PassphraseController
|
final class PassphraseCredentialListController extends PassphraseController {
|
||||||
implements PhabricatorApplicationSearchResultsControllerInterface {
|
|
||||||
|
|
||||||
private $queryKey;
|
private $queryKey;
|
||||||
|
|
||||||
|
@ -23,41 +22,4 @@ final class PassphraseCredentialListController extends PassphraseController
|
||||||
return $this->delegateToController($controller);
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,10 @@
|
||||||
final class PassphraseCredentialSearchEngine
|
final class PassphraseCredentialSearchEngine
|
||||||
extends PhabricatorApplicationSearchEngine {
|
extends PhabricatorApplicationSearchEngine {
|
||||||
|
|
||||||
|
public function getApplicationClassName() {
|
||||||
|
return 'PhabricatorApplicationPassphrase';
|
||||||
|
}
|
||||||
|
|
||||||
public function buildSavedQueryFromRequest(AphrontRequest $request) {
|
public function buildSavedQueryFromRequest(AphrontRequest $request) {
|
||||||
$saved = new PhabricatorSavedQuery();
|
$saved = new PhabricatorSavedQuery();
|
||||||
|
|
||||||
|
@ -70,4 +74,43 @@ final class PassphraseCredentialSearchEngine
|
||||||
return parent::buildSavedQueryFromBuiltin($query_key);
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
|
||||||
* @group pholio
|
|
||||||
*/
|
|
||||||
final class PhabricatorApplicationPholio extends PhabricatorApplication {
|
final class PhabricatorApplicationPholio extends PhabricatorApplication {
|
||||||
|
|
||||||
public function getBaseURI() {
|
public function getBaseURI() {
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
final class PholioMockListController
|
final class PholioMockListController extends PholioController {
|
||||||
extends PholioController
|
|
||||||
implements PhabricatorApplicationSearchResultsControllerInterface {
|
|
||||||
|
|
||||||
private $queryKey;
|
private $queryKey;
|
||||||
|
|
||||||
|
@ -24,40 +22,4 @@ final class PholioMockListController
|
||||||
return $this->delegateToController($controller);
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,10 @@
|
||||||
final class PholioMockSearchEngine
|
final class PholioMockSearchEngine
|
||||||
extends PhabricatorApplicationSearchEngine {
|
extends PhabricatorApplicationSearchEngine {
|
||||||
|
|
||||||
|
public function getApplicationClassName() {
|
||||||
|
return 'PhabricatorApplicationPholio';
|
||||||
|
}
|
||||||
|
|
||||||
public function buildSavedQueryFromRequest(AphrontRequest $request) {
|
public function buildSavedQueryFromRequest(AphrontRequest $request) {
|
||||||
$saved = new PhabricatorSavedQuery();
|
$saved = new PhabricatorSavedQuery();
|
||||||
$saved->setParameter(
|
$saved->setParameter(
|
||||||
|
@ -74,4 +78,41 @@ final class PholioMockSearchEngine
|
||||||
return parent::buildSavedQueryFromBuiltin($query_key);
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
final class PhrequentListController extends PhrequentController
|
final class PhrequentListController extends PhrequentController {
|
||||||
implements PhabricatorApplicationSearchResultsControllerInterface {
|
|
||||||
|
|
||||||
private $queryKey;
|
private $queryKey;
|
||||||
|
|
||||||
|
@ -23,86 +22,4 @@ final class PhrequentListController extends PhrequentController
|
||||||
return $this->delegateToController($controller);
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,10 @@
|
||||||
final class PhrequentSearchEngine
|
final class PhrequentSearchEngine
|
||||||
extends PhabricatorApplicationSearchEngine {
|
extends PhabricatorApplicationSearchEngine {
|
||||||
|
|
||||||
|
public function getApplicationClassName() {
|
||||||
|
return 'PhabricatorApplicationPhrequent';
|
||||||
|
}
|
||||||
|
|
||||||
public function getPageSize(PhabricatorSavedQuery $saved) {
|
public function getPageSize(PhabricatorSavedQuery $saved) {
|
||||||
return $saved->getParameter('limit', 1000);
|
return $saved->getParameter('limit', 1000);
|
||||||
}
|
}
|
||||||
|
@ -110,4 +114,89 @@ final class PhrequentSearchEngine
|
||||||
return parent::buildSavedQueryFromBuiltin($query_key);
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
final class PhrictionListController
|
final class PhrictionListController
|
||||||
extends PhrictionController
|
extends PhrictionController {
|
||||||
implements PhabricatorApplicationSearchResultsControllerInterface {
|
|
||||||
|
|
||||||
private $queryKey;
|
private $queryKey;
|
||||||
|
|
||||||
|
@ -24,68 +23,4 @@ final class PhrictionListController
|
||||||
return $this->delegateToController($controller);
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,4 +109,75 @@ final class PhrictionSearchEngine
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
final class PonderQuestionListController extends PonderController
|
final class PonderQuestionListController extends PonderController {
|
||||||
implements PhabricatorApplicationSearchResultsControllerInterface {
|
|
||||||
|
|
||||||
private $queryKey;
|
private $queryKey;
|
||||||
|
|
||||||
|
@ -23,46 +22,4 @@ final class PonderQuestionListController extends PonderController
|
||||||
return $this->delegateToController($controller);
|
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,10 @@
|
||||||
final class PonderQuestionSearchEngine
|
final class PonderQuestionSearchEngine
|
||||||
extends PhabricatorApplicationSearchEngine {
|
extends PhabricatorApplicationSearchEngine {
|
||||||
|
|
||||||
|
public function getApplicationClassName() {
|
||||||
|
return 'PhabricatorApplicationPonder';
|
||||||
|
}
|
||||||
|
|
||||||
public function buildSavedQueryFromRequest(AphrontRequest $request) {
|
public function buildSavedQueryFromRequest(AphrontRequest $request) {
|
||||||
$saved = new PhabricatorSavedQuery();
|
$saved = new PhabricatorSavedQuery();
|
||||||
|
|
||||||
|
@ -124,4 +128,47 @@ final class PonderQuestionSearchEngine
|
||||||
return parent::buildSavedQueryFromBuiltin($query_key);
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
final class PhabricatorProjectListController
|
final class PhabricatorProjectListController
|
||||||
extends PhabricatorProjectController
|
extends PhabricatorProjectController {
|
||||||
implements PhabricatorApplicationSearchResultsControllerInterface {
|
|
||||||
|
|
||||||
private $queryKey;
|
private $queryKey;
|
||||||
|
|
||||||
|
@ -24,33 +23,6 @@ final class PhabricatorProjectListController
|
||||||
return $this->delegateToController($controller);
|
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() {
|
public function buildApplicationCrumbs() {
|
||||||
$crumbs = parent::buildApplicationCrumbs();
|
$crumbs = parent::buildApplicationCrumbs();
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,10 @@
|
||||||
final class PhabricatorProjectSearchEngine
|
final class PhabricatorProjectSearchEngine
|
||||||
extends PhabricatorApplicationSearchEngine {
|
extends PhabricatorApplicationSearchEngine {
|
||||||
|
|
||||||
|
public function getApplicationClassName() {
|
||||||
|
return 'PhabricatorApplicationProject';
|
||||||
|
}
|
||||||
|
|
||||||
public function getCustomFieldObject() {
|
public function getCustomFieldObject() {
|
||||||
return new PhabricatorProject();
|
return new PhabricatorProject();
|
||||||
}
|
}
|
||||||
|
@ -122,4 +126,32 @@ final class PhabricatorProjectSearchEngine
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue