id = $data['id'];
}
public function processRequest() {
$request = $this->getRequest();
$user = $request->getUser();
$package = id(new PhabricatorOwnersPackage())->load($this->id);
if (!$package) {
return new Aphront404Response();
}
$this->package = $package;
$paths = $package->loadPaths();
$owners = $package->loadOwners();
$phids = array();
foreach ($paths as $path) {
$phids[$path->getRepositoryPHID()] = true;
}
foreach ($owners as $owner) {
$phids[$owner->getUserPHID()] = true;
}
$phids = array_keys($phids);
$handles = id(new PhabricatorObjectHandleData($phids))->loadHandles();
$rows = array();
$rows[] = array(
'Name',
phutil_escape_html($package->getName()));
$rows[] = array(
'Description',
phutil_escape_html($package->getDescription()));
$primary_owner = null;
$primary_phid = $package->getPrimaryOwnerPHID();
if ($primary_phid && isset($handles[$primary_phid])) {
$primary_owner =
''.$handles[$primary_phid]->renderLink().'';
}
$rows[] = array(
'Primary Owner',
$primary_owner,
);
$owner_links = array();
foreach ($owners as $owner) {
$owner_links[] = $handles[$owner->getUserPHID()]->renderLink();
}
$owner_links = implode('
', $owner_links);
$rows[] = array(
'Owners',
$owner_links);
$rows[] = array(
'Auditing',
$package->getAuditingEnabled() ? 'Enabled' : 'Disabled',
);
$rows[] = array(
'Related Commits',
phutil_render_tag(
'a',
array(
'href' => '/owners/related/package/?phid='.$package->getPHID(),
),
phutil_escape_html('Related Commits'))
);
$path_links = array();
foreach ($paths as $path) {
$callsign = $handles[$path->getRepositoryPHID()]->getName();
$repo = ''.phutil_escape_html($callsign).'';
$path_link = phutil_render_tag(
'a',
array(
'href' => '/diffusion/'.$callsign.'/browse/:'.$path->getPath(),
),
phutil_escape_html($path->getPath()));
$path_links[] = $repo.' '.$path_link;
}
$path_links = implode('
', $path_links);
$rows[] = array(
'Paths',
$path_links);
$table = new AphrontTableView($rows);
$table->setColumnClasses(
array(
'header',
'wide',
));
$panel = new AphrontPanelView();
$panel->setHeader(
'Package Details for "'.phutil_escape_html($package->getName()).'"');
$panel->addButton(
javelin_render_tag(
'a',
array(
'href' => '/owners/delete/'.$package->getID().'/',
'class' => 'button grey',
'sigil' => 'workflow',
),
'Delete Package'));
$panel->addButton(
phutil_render_tag(
'a',
array(
'href' => '/owners/edit/'.$package->getID().'/',
'class' => 'button',
),
'Edit Package'));
$panel->appendChild($table);
$key = 'package/'.$package->getID();
$this->setSideNavFilter($key);
return $this->buildStandardPageResponse(
$panel,
array(
'title' => "Package '".$package->getName()."'",
));
}
protected function getExtraPackageViews() {
$package = $this->package;
return array(
array('name' => 'Details',
'key' => 'package/'.$package->getID(),
));
}
}