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() {
|
public function processRequest() {
|
||||||
|
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
if ($request->isFormPost()) {
|
$phids = $request->getStrList('phids');
|
||||||
$phids = $request->getStrList('phids');
|
if ($phids) {
|
||||||
if ($phids) {
|
$handles = id(new PhabricatorObjectHandleData($phids))
|
||||||
$handles = id(new PhabricatorObjectHandleData($phids))
|
->loadHandles();
|
||||||
->loadHandles();
|
|
||||||
|
|
||||||
$rows = array();
|
$rows = array();
|
||||||
foreach ($handles as $handle) {
|
foreach ($handles as $handle) {
|
||||||
if ($handle->getURI()) {
|
if ($handle->getURI()) {
|
||||||
$link = phutil_render_tag(
|
$link = phutil_render_tag(
|
||||||
'a',
|
'a',
|
||||||
array(
|
array(
|
||||||
'href' => $handle->getURI(),
|
'href' => $handle->getURI(),
|
||||||
),
|
),
|
||||||
phutil_escape_html($handle->getURI()));
|
phutil_escape_html($handle->getURI()));
|
||||||
} else {
|
} else {
|
||||||
$link = null;
|
$link = null;
|
||||||
}
|
|
||||||
|
|
||||||
$rows[] = array(
|
|
||||||
phutil_escape_html($handle->getPHID()),
|
|
||||||
phutil_escape_html($handle->getType()),
|
|
||||||
phutil_escape_html($handle->getName()),
|
|
||||||
$link,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$table = new AphrontTableView($rows);
|
$rows[] = array(
|
||||||
$table->setHeaders(
|
phutil_escape_html($handle->getPHID()),
|
||||||
array(
|
phutil_escape_html($handle->getType()),
|
||||||
'PHID',
|
phutil_escape_html($handle->getName()),
|
||||||
'Type',
|
$link,
|
||||||
'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',
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$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();
|
$lookup_form = new AphrontFormView();
|
||||||
|
|
Loading…
Reference in a new issue