2014-12-02 17:26:55 +01:00
< script >
var PHPCI_PROJECT_ID = <?php print $project -> getId (); ?> ;
var PHPCI_PROJECT_BRANCH = '<?php print $branch ; ?> ';
< / script >
< div class = "clearfix" style = "margin-bottom: 20px;" >
< div class = "pull-right btn-group" >
< a class = "btn btn-success" href = " <?php print PHPCI_URL . 'project/build/' . $project -> getId (); ?> " > Build Now</ a >
< div class = "btn-group branch-btn pull-right" >
< button type = "button" class = "btn btn-default dropdown-toggle" data-toggle = "dropdown" >
Branch<?php print ! empty ( $branch ) ? ': ' . $branch : '' ; ?> < span class = "caret" ></ span >
< / button >
< ul class = "dropdown-menu" role = "menu" >
<?php foreach ( $branches as $curbranch ) : ?>
< li <?php echo ( $curbranch == $branch ) ? 'class="active"' : '' ?> >
< a href = " <?php echo PHPCI_URL ?> project/view/ <?php print $project -> getId (); ?> ?branch= <?php echo urlencode ( $curbranch ) ?> " >
<?php echo $curbranch ?>
< / a >
< / li >
<?php endforeach ; ?>
< li class = "divider" > < / li >
< li >< a href = " <?php echo PHPCI_URL ?> project/view/ <?php print $project -> getId (); ?> " > All</ a ></ li >
< / ul >
< / div >
2014-09-16 13:27:32 +02:00
< / div >
2014-12-02 17:26:55 +01:00
< / div >
2014-04-30 15:13:07 +02:00
2013-05-10 13:28:43 +02:00
< div class = "row" >
2014-12-02 17:26:55 +01:00
< div class = "col-lg-9 col-md-8 col-sm-8" >
< div class = "box box-primary" >
< div class = "box-header" >
2014-04-30 15:13:07 +02:00
2014-12-02 17:26:55 +01:00
< h3 class = "box-title" > Builds< / h3 >
2014-04-30 15:13:07 +02:00
< / div >
2014-12-02 17:26:55 +01:00
< table class = "table" >
< thead >
< tr >
< th > ID< / th >
< th > Project< / th >
< th class = "hidden-md hidden-sm hidden-xs" > Commit< / th >
< th > Branch< / th >
< th > Status< / th >
< th style = "width: 100px" > < / th >
< / tr >
< / thead >
< tbody id = "latest-builds" >
<?php print $builds ; ?>
< / tbody >
< / table >
2014-04-30 15:13:07 +02:00
< / div >
2014-12-02 17:26:55 +01:00
< / div >
< div class = "col-lg-3 col-md-4 col-sm-4" >
2013-05-10 13:28:43 +02:00
2014-05-01 19:00:46 +02:00
<?php if ( in_array ( $project -> getType (), array ( 'github' , 'gitlab' , 'bitbucket' ))) : ?>
2014-12-02 17:26:55 +01:00
< div class = "box box-info" >
< div class = "box-header" >
< h4 class = "box-title" > Webhooks< / h4 >
< / div >
2014-04-30 15:13:07 +02:00
2014-12-02 17:26:55 +01:00
< div class = "box-body" >
To automatically build this project when new commits are pushed, add the URL below
<?php
switch($project->getType())
{
case 'github':
$url = PHPCI_URL . 'webhook/github/' . $project->getId();
print ' as a new "Webhook" in the < a href = "https://github.com/' . $project->getReference() . '/settings/hooks" > Webhooks and Services< / a > section of your Github repository.< br > < br > < strong style = "word-wrap: break-word;" > ' . $url . '< / strong > ';
break;
case 'gitlab':
$url = PHPCI_URL. 'webhook/gitlab/' . $project->getId();
print ' as a "WebHook URL" in the Web Hooks section of your Gitlab repository.< br > < br > < strong style = "word-wrap: break-word;" > ' . $url . '< / strong > ';
break;
case 'bitbucket':
$url = PHPCI_URL . 'webhook/bitbucket/' . $project->getId();
print ' as a "POST" service in the < a href = "https://bitbucket.org/' . $project->getReference() . '/admin/services" > Services< / a > section of your Bitbucket repository.< br > < br > < strong style = "word-wrap: break-word;" > ' . $url . '< / strong > ';
break;
}
?>
< / div >
2014-04-30 15:13:07 +02:00
< / div >
2014-05-01 19:00:46 +02:00
<?php endif ; ?>
2014-04-30 15:13:07 +02:00
2014-05-14 10:27:41 +02:00
<?php if ( $project -> getSshPublicKey ()) : ?>
2014-12-02 17:26:55 +01:00
< div class = "box box-info" >
< div class = "box-header" > < h3 class = "box-title" > < a data-toggle = "collapse" data-parent = "#accordion" href = "#publicCollapse" > Public Key< / a > < / h3 > < / div >
< div class = "box-body" style = "word-break: break-word;" > <?php print $project -> getSshPublicKey (); ?> </ div >
2014-04-30 15:13:07 +02:00
< / div >
<?php endif ; ?>
2014-12-02 17:26:55 +01:00
< / div >
< / div >
2014-09-16 13:27:32 +02:00
2014-12-02 17:26:55 +01:00
<?php
2014-09-16 13:27:32 +02:00
2014-12-02 17:26:55 +01:00
print '< div > < ul class = "pagination" > ';
2014-09-16 13:27:32 +02:00
2014-12-02 17:26:55 +01:00
$project_url = PHPCI_URL . 'project/view/' . $project->getId() . ((!empty($branch)) ? '/' . urlencode($branch) : '');
2014-09-16 13:27:32 +02:00
2014-12-02 17:26:55 +01:00
if ($page > 1) {
print '< li > < a href = "' . $project_url . '?p='.($page == 1 ? '1' : $page - 1).'" > « Prev< / a > < / li > ';
}
2014-09-16 13:27:32 +02:00
2014-12-02 17:26:55 +01:00
if ($pages > 1) {
2014-04-30 15:13:07 +02:00
2014-12-02 17:26:55 +01:00
$start = $page - 3;
2014-04-30 15:13:07 +02:00
2014-12-02 17:26:55 +01:00
if ($start < = 0) {
$start = 1;
}
2013-05-10 13:28:43 +02:00
2014-12-02 17:26:55 +01:00
$end = $page + 3;
2014-09-16 13:27:32 +02:00
2014-12-02 17:26:55 +01:00
if ($end > $pages) {
$end = $pages;
}
2013-05-10 13:28:43 +02:00
2014-12-02 17:26:55 +01:00
if ($start > 1) {
print '< li > < a href = "' . $project_url . '" > 1...< / a > < / li > ';
}
2013-05-10 13:28:43 +02:00
2014-12-02 17:26:55 +01:00
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 > ';
2014-04-30 15:13:07 +02:00
}
2014-12-02 17:26:55 +01:00
}
2013-05-10 13:28:43 +02:00
2014-12-02 17:26:55 +01:00
if ($pages > $end) {
print '< li > < a href = "' . $project_url . '?p='.$pages.'" > ...'.$pages.'< / a > < / li > ';
}
}
2013-05-10 13:28:43 +02:00
2014-12-02 17:26:55 +01:00
if ($page < $pages - 1) {
print '< li > < a href = "' . $project_url . '?p='.($page == $pages ? $pages : $page + 1).'" > Next » < / a > < / li > ';
}
2013-05-10 13:28:43 +02:00
2014-12-02 17:26:55 +01:00
print '< / ul > < / div > ';
?>