php-censor/src/PHPCensor/View/Project/view.phtml

269 lines
12 KiB
PHTML
Raw Normal View History

2016-07-19 20:28:11 +02:00
<?php use PHPCensor\Helper\Lang; ?>
<script>
2016-07-21 17:20:34 +02:00
var PROJECT_ID = <?php print $project->getId(); ?>;
2017-03-23 13:53:24 +01:00
var PROJECT_ENVIRONMENT = '<?php print $environment; ?>';
2016-07-21 17:20:34 +02:00
var PROJECT_BRANCH = '<?php print $branch; ?>';
var PER_PAGE = <?php print $perPage; ?>;
</script>
<div class="clearfix" style="margin-bottom: 20px;">
2016-07-21 17:20:34 +02:00
<a class="btn btn-default" href="<?php print APP_URL . 'project/edit/' . $project->getId(); ?>">
2015-10-08 17:33:01 +02:00
<?php Lang::out('edit_project'); ?>
</a>
<a class="btn btn-danger" id="delete-project">
2015-10-08 17:33:01 +02:00
<?php Lang::out('delete_project'); ?>
</a>
<div class="pull-right btn-group">
2017-01-15 16:35:42 +01:00
<?php if (!$project->getArchived()): ?>
<?php if($this->User()->getIsAdmin()): ?>
2017-03-23 13:53:24 +01:00
<div class="btn-group build-btn">
<button type="button" class="btn btn-danger dropdown-toggle" data-toggle="dropdown">
<?php Lang::out('build_now_debug'); ?>&nbsp;&nbsp;<span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<?php if(!empty($environments)): ?>
<?php foreach ($environments as $currentEnvironment) : ?>
<li <?php echo ($currentEnvironment == $environment) ? 'class="active"' : ''?>>
<a href="<?php echo APP_URL ?>project/build/<?php print $project->getId(); ?>/environment/<?php echo urlencode($currentEnvironment) ?>?debug=1">
<i class="fa fa-cog"></i><?php echo $currentEnvironment ?>
2017-03-23 13:53:24 +01:00
</a>
</li>
<?php endforeach; ?>
<li class="divider"></li>
<?php endif; ?>
<?php foreach ($branches as $currentBranch) : ?>
<li <?php echo ($currentBranch == $branch) ? 'class="active"' : ''?>>
<a href="<?php echo APP_URL ?>project/build/<?php print $project->getId(); ?>/branch/<?php echo urlencode($currentBranch) ?>?debug=1">
<i class="fa fa-code-fork"></i><?php echo $currentBranch ?>
2017-03-23 13:53:24 +01:00
</a>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
2017-03-23 13:53:24 +01:00
<div class="btn-group build-btn">
<button type="button" class="btn btn-success dropdown-toggle" data-toggle="dropdown">
<?php Lang::out('build_now'); ?>&nbsp;&nbsp;<span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
<?php if(!empty($environments)): ?>
<?php foreach ($environments as $currentEnvironment) : ?>
<li <?php echo ($currentEnvironment == $environment) ? 'class="active"' : ''?>>
<a href="<?php echo APP_URL ?>project/build/<?php print $project->getId(); ?>/environment/<?php echo urlencode($currentEnvironment) ?>">
<i class="fa fa-cog"></i><?php echo $currentEnvironment ?>
2017-03-23 13:53:24 +01:00
</a>
</li>
<?php endforeach; ?>
<li class="divider"></li>
<?php endif; ?>
<?php foreach ($branches as $currentBranch) : ?>
<li <?php echo ($currentBranch == $branch) ? 'class="active"' : ''?>>
<a href="<?php echo APP_URL ?>project/build/<?php print $project->getId(); ?>/branch/<?php echo urlencode($currentBranch) ?>">
<i class="fa fa-code-fork"></i><?php echo $currentBranch ?>
2017-03-23 13:53:24 +01:00
</a>
</li>
<?php endforeach; ?>
</ul>
</div>
2017-01-15 16:35:42 +01:00
<?php endif; ?>
2017-03-23 13:53:24 +01:00
<div class="btn-group environment-btn pull-right">
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown">
2017-03-23 13:53:24 +01:00
<?php
if (!empty($environment)) {
print Lang::get('environment_x', $environment);
} elseif (!empty($branch)) {
print Lang::get('branch_x', $branch);
} else {
print Lang::get('All');
}
?>&nbsp;&nbsp;<span class="caret"></span>
</button>
<ul class="dropdown-menu" role="menu">
2017-03-23 13:53:24 +01:00
<li><a href="<?php echo APP_URL ?>project/view/<?php print $project->getId(); ?>"><?php Lang::out('all'); ?></a></li>
<li class="divider"></li>
<?php if(!empty($environments)): ?>
<?php foreach ($environments as $currentEnvironment) : ?>
<li <?php echo ($currentEnvironment == $environment) ? 'class="active"' : ''?>>
<a href="<?php echo APP_URL ?>project/view/<?php print $project->getId(); ?>?environment=<?php echo urlencode($currentEnvironment) ?>">
<i class="fa fa-cog"></i><?php echo $currentEnvironment ?>
2017-03-23 13:53:24 +01:00
</a>
</li>
<?php endforeach; ?>
<li class="divider"></li>
<?php endif; ?>
<?php foreach ($branches as $currentBranch) : ?>
<li <?php echo ($currentBranch == $branch) ? 'class="active"' : ''?>>
<a href="<?php echo APP_URL ?>project/view/<?php print $project->getId(); ?>?branch=<?php echo urlencode($currentBranch) ?>">
<i class="fa fa-code-fork"></i><?php echo $currentBranch ?>
</a>
</li>
<?php endforeach; ?>
</ul>
</div>
</div>
</div>
2014-04-30 15:13:07 +02:00
2013-05-10 13:28:43 +02:00
<div class="row">
2017-01-06 12:39:04 +01:00
<div class="col-lg-9 col-md-8 col-sm-8">
<div class="box">
<div class="box-header">
<h3 class="box-title"><?php Lang::out('builds'); ?> (<?php print $total; ?>)</h3>
2014-04-30 15:13:07 +02:00
</div>
<table class="table table-hover">
<thead>
<tr>
<th><?php Lang::out('id'); ?></th>
<th><?php Lang::out('date'); ?></th>
<th class="hidden-md hidden-sm hidden-xs"><?php Lang::out('commit'); ?></th>
2017-03-23 13:53:24 +01:00
<th><?php Lang::out('environment'); ?></th>
<th><?php Lang::out('branch'); ?></th>
<th><?php Lang::out('status'); ?></th>
<th><?php Lang::out('duration'); ?></th>
<th></th>
</tr>
</thead>
<tbody id="latest-builds">
<?php print $builds; ?>
</tbody>
</table>
2014-04-30 15:13:07 +02:00
</div>
<?php
print '<div><ul class="pagination">';
$project_url = APP_URL . 'project/view/' . $project->getId() . ((!empty($branch)) ? '/' . urlencode($branch) : '');
if ($page > 1) {
print '<li><a href="' . $project_url . '?p='.($page == 1 ? '1' : $page - 1).'">'.Lang::get('prev_link').'</a></li>';
}
if ($pages > 1) {
$start = $page - 3;
if ($start <= 0) {
$start = 1;
}
$end = $page + 3;
if ($end > $pages) {
$end = $pages;
}
if ($start > 1) {
print '<li><a href="' . $project_url . '">1...</a></li>';
}
for($i = $start; $i <= $end; $i++)
{
if ($pages > $end && $i == $pages) continue;
if ($i == $page) {
print '<li class="bg-blue"><span>' . $i . '</span></li>';
} else {
print '<li><a href="' . $project_url . '?p=' . $i . '">' . $i . '</a></li>';
}
}
if ($pages > $end) {
print '<li><a href="' . $project_url . '?p='.$pages.'">...'.$pages.'</a></li>';
}
}
if ($page < $pages - 1) {
print '<li><a href="' . $project_url . '?p='.($page == $pages ? $pages : $page + 1).'">'.Lang::get('next_link').'</a></li>';
}
print '</ul></div>';
?>
2017-01-06 12:39:04 +01:00
</div>
<div class="col-lg-3 col-md-4 col-sm-4">
2013-05-10 13:28:43 +02:00
2017-01-19 15:58:45 +01:00
<?php if ($project->getAllowPublicStatus() && !$project->getArchived()): ?>
<div class="box">
<div class="box-header">
<h4 class="box-title"><?= Lang::get('public_status_title'); ?></h4>
</div>
<div class="box-body">
<span style="word-wrap: break-word;">
<a href="<?= APP_URL . 'build-status/view/' . $project->getId() . '?branch=master'; ?>">
<img src="<?= APP_URL . 'build-status/image/' . $project->getId() . '?branch=master&label=PHPCensor&style=flat-square'; ?>" />
</a>
<br /><br />
<?= Lang::get('public_status_image'); ?>:<br /><strong><?= APP_URL . 'build-status/image/' . $project->getId() . '?branch=master&label=PHPCensor&style=flat-square'; ?></strong>
<br /><br />
<?= Lang::get('public_status_page'); ?>:<br /><strong><?= APP_URL . 'build-status/view/' . $project->getId() . '?branch=master'; ?></strong>
</span>
</div>
</div>
<?php endif; ?>
2016-04-21 06:58:09 +02:00
<?php if (in_array($project->getType(), ['github', 'gitlab', 'bitbucket'])): ?>
2017-01-06 12:39:04 +01:00
<div class="box">
<div class="box-header">
2014-12-04 13:19:06 +01:00
<h4 class="box-title"><?php Lang::out('webhooks'); ?></h4>
</div>
2014-04-30 15:13:07 +02:00
<div class="box-body">
<?php
switch($project->getType())
{
case 'github':
$url = APP_URL . 'webhook/github/' . $project->getId();
2014-12-04 13:19:06 +01:00
Lang::out('webhooks_help_github', $project->getReference());
break;
case 'gitlab':
$url = APP_URL. 'webhook/gitlab/' . $project->getId();
2014-12-04 13:19:06 +01:00
Lang::out('webhooks_help_gitlab');
break;
case 'bitbucket':
case 'bitbuckethg':
$url = APP_URL . 'webhook/bitbucket/' . $project->getId();
2014-12-04 13:19:06 +01:00
Lang::out('webhooks_help_bitbucket', $project->getReference());
break;
}
?>
2014-12-04 13:19:06 +01:00
<br><br><strong style="word-wrap: break-word;"><?php print $url; ?></strong>
</div>
2014-04-30 15:13:07 +02:00
</div>
<?php endif; ?>
2014-04-30 15:13:07 +02:00
<?php if ($project->getSshPublicKey()): ?>
2017-01-06 12:39:04 +01:00
<div class="box">
<div class="box-header"><h3 class="box-title"><?php Lang::out('public_key'); ?></h3></div>
<div class="box-body" style="word-break: break-all;"><?php print $project->getSshPublicKey(); ?></div>
2014-04-30 15:13:07 +02:00
</div>
<?php endif; ?>
</div>
</div>
<script>
$(function() {
$('#delete-project').on('click', function (e) {
e.preventDefault();
confirmDelete("<?= APP_URL; ?>project/delete/<?= $project->getId(); ?>")
.onCloseConfirmed = function () {window.location = '/'};
});
})
</script>