Page MenuHomec4science

PhabricatorRepositoryListController.php
No OneTemporary

File Metadata

Created
Wed, Jul 10, 20:29

PhabricatorRepositoryListController.php

<?php
/*
* Copyright 2011 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
class PhabricatorRepositoryListController
extends PhabricatorRepositoryController {
public function processRequest() {
$repos = id(new PhabricatorRepository())->loadAll();
$rows = array();
foreach ($repos as $repo) {
if ($repo->getDetail('tracking-enabled')) {
$diffusion_link = phutil_render_tag(
'a',
array(
'href' => '/diffusion/'.$repo->getCallsign().'/',
),
'View in Diffusion');
} else {
$diffusion_link = '<em>Not Tracked</em>';
}
$rows[] = array(
phutil_escape_html($repo->getCallsign()),
phutil_escape_html($repo->getName()),
PhabricatorRepositoryType::getNameForRepositoryType(
$repo->getVersionControlSystem()),
$diffusion_link,
phutil_render_tag(
'a',
array(
'class' => 'button small grey',
'href' => '/repository/edit/'.$repo->getID().'/',
),
'Edit'),
javelin_render_tag(
'a',
array(
'class' => 'button small grey',
'href' => '/repository/delete/'.$repo->getID().'/',
'sigil' => 'workflow',
),
'Delete'),
);
}
$table = new AphrontTableView($rows);
$table->setHeaders(
array(
'Callsign',
'Repository',
'Type',
'Diffusion',
'',
''
));
$table->setColumnClasses(
array(
null,
'wide',
null,
null,
'action',
'action',
));
$panel = new AphrontPanelView();
$panel->setHeader('Repositories');
$panel->setCreateButton('Create New Repository', '/repository/create/');
$panel->appendChild($table);
$projects = id(new PhabricatorRepositoryArcanistProject())->loadAll();
$rows = array();
foreach ($projects as $project) {
$repo = idx($repos, $project->getRepositoryID());
if ($repo) {
$repo_name = phutil_escape_html($repo->getName());
} else {
$repo_name = '-';
}
$rows[] = array(
phutil_escape_html($project->getName()),
$repo_name,
phutil_render_tag(
'a',
array(
'href' => '/repository/project/'.$project->getID().'/',
'class' => 'button grey small',
),
'Edit'),
);
}
$project_table = new AphrontTableView($rows);
$project_table->setHeaders(
array(
'Project ID',
'Repository',
'',
));
$project_table->setColumnClasses(
array(
'',
'wide',
'action',
));
$project_panel = new AphrontPanelView();
$project_panel->setHeader('Arcanist Projects');
$project_panel->appendChild($project_table);
return $this->buildStandardPageResponse(
array(
$panel,
$project_panel,
),
array(
'title' => 'Repository List',
));
}
}

Event Timeline