mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-27 01:02:42 +01:00
Allow querying PHIDs with GET
Summary: I want to link this page from outside. Test Plan: /phid/?phids=PHID-USER-gsraq7yc66r4stl4c6u3 Reviewers: epriestley Reviewed By: epriestley CC: aran, Korvin Differential Revision: https://secure.phabricator.com/D3060
This commit is contained in:
parent
7ffe802671
commit
1b3da47fb0
1 changed files with 47 additions and 49 deletions
|
@ -22,59 +22,57 @@ final class PhabricatorPHIDLookupController
|
|||
public function processRequest() {
|
||||
|
||||
$request = $this->getRequest();
|
||||
if ($request->isFormPost()) {
|
||||
$phids = $request->getStrList('phids');
|
||||
if ($phids) {
|
||||
$handles = id(new PhabricatorObjectHandleData($phids))
|
||||
->loadHandles();
|
||||
$phids = $request->getStrList('phids');
|
||||
if ($phids) {
|
||||
$handles = id(new PhabricatorObjectHandleData($phids))
|
||||
->loadHandles();
|
||||
|
||||
$rows = array();
|
||||
foreach ($handles as $handle) {
|
||||
if ($handle->getURI()) {
|
||||
$link = phutil_render_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => $handle->getURI(),
|
||||
),
|
||||
phutil_escape_html($handle->getURI()));
|
||||
} else {
|
||||
$link = null;
|
||||
}
|
||||
|
||||
$rows[] = array(
|
||||
phutil_escape_html($handle->getPHID()),
|
||||
phutil_escape_html($handle->getType()),
|
||||
phutil_escape_html($handle->getName()),
|
||||
$link,
|
||||
);
|
||||
$rows = array();
|
||||
foreach ($handles as $handle) {
|
||||
if ($handle->getURI()) {
|
||||
$link = phutil_render_tag(
|
||||
'a',
|
||||
array(
|
||||
'href' => $handle->getURI(),
|
||||
),
|
||||
phutil_escape_html($handle->getURI()));
|
||||
} else {
|
||||
$link = null;
|
||||
}
|
||||
|
||||
$table = new AphrontTableView($rows);
|
||||
$table->setHeaders(
|
||||
array(
|
||||
'PHID',
|
||||
'Type',
|
||||
'Name',
|
||||
'URI',
|
||||
));
|
||||
$table->setColumnClasses(
|
||||
array(
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
'wide',
|
||||
));
|
||||
|
||||
$panel = new AphrontPanelView();
|
||||
$panel->setHeader('PHID Handles');
|
||||
$panel->appendChild($table);
|
||||
|
||||
return $this->buildStandardPageResponse(
|
||||
$panel,
|
||||
array(
|
||||
'title' => 'PHID Lookup Results',
|
||||
));
|
||||
$rows[] = array(
|
||||
phutil_escape_html($handle->getPHID()),
|
||||
phutil_escape_html($handle->getType()),
|
||||
phutil_escape_html($handle->getName()),
|
||||
$link,
|
||||
);
|
||||
}
|
||||
|
||||
$table = new AphrontTableView($rows);
|
||||
$table->setHeaders(
|
||||
array(
|
||||
'PHID',
|
||||
'Type',
|
||||
'Name',
|
||||
'URI',
|
||||
));
|
||||
$table->setColumnClasses(
|
||||
array(
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
'wide',
|
||||
));
|
||||
|
||||
$panel = new AphrontPanelView();
|
||||
$panel->setHeader('PHID Handles');
|
||||
$panel->appendChild($table);
|
||||
|
||||
return $this->buildStandardPageResponse(
|
||||
$panel,
|
||||
array(
|
||||
'title' => 'PHID Lookup Results',
|
||||
));
|
||||
}
|
||||
|
||||
$lookup_form = new AphrontFormView();
|
||||
|
|
Loading…
Reference in a new issue