Skip to content

Commit

Permalink
Fixed|Homepage|Build Repository: Homepage build stream widgets do not…
Browse files Browse the repository at this point in the history
… offset if no previous build

When generating the previous|current|next build stream widgets, the
build event chain was not offset if no previous build exists in the
chain.
  • Loading branch information
danij-deng committed Sep 24, 2012
1 parent 1fd4dfc commit 2bff158
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions web/plugins/buildrepository/buildrepository.php
Expand Up @@ -881,13 +881,17 @@ public function InterpretRequest($request)
private function outputBuildStreamNavigation(&$event)
{
$headEvent = $event->prevForStartDate();
$offset = 0;
if(!$headEvent instanceof BuildEvent)
{
$headEvent = $event;
$offset = 1;
}

?><div id="buildsnav" class="hnav"><h3><span>&larr;Older</span> <a href="builds" title="Back to the Build Repository index">Index</a> <span>Newer&rarr;</span></h3><?php
?><div class="buildstreamlist"><?php

$this->outputBuildStreamWidget($headEvent, 'startdate', TRUE/*ascend*/, 3,
$this->outputBuildStreamWidget($headEvent, 'startdate', TRUE/*ascend*/, 3, $offset,
NULL/*no release header*/,
TRUE/*use the horiztonal variant*/,
$event, TRUE/*current is inactive*/);
Expand Down Expand Up @@ -1423,12 +1427,14 @@ private function populateReleases(&$releases)
return $numEventsAdded;
}

private function outputBuildStreamWidget(&$headEvent, $chainProperty='version',
$chainDirection=FALSE, $chainLengthMax=-1, $releaseInfo=NULL, $horizontal=FALSE,
$currentEvent=NULL, $currentInactive=FALSE)
private function outputBuildStreamWidget(&$headEvent, $chainProperty = 'version',
$chainDirection = FALSE, $chainLengthMax = -1, $chainOffset = 0,
$releaseInfo = NULL, $horizontal = FALSE,
$currentEvent = NULL, $currentInactive = FALSE)
{
$chainDirection = (boolean)$chainDirection;
$chainLengthMax = (integer)$chainLengthMax;
$chainDirection = (boolean)$chainDirection;
$chainLengthMax = (integer)$chainLengthMax;
$chainOffset = (integer)$chainOffset;
$currentInactive = (boolean)$currentInactive;

?><div class="buildstream<?php echo ($horizontal ? ' hnav' : ''); ?>"><ul><?php
Expand Down Expand Up @@ -1458,7 +1464,12 @@ private function outputBuildStreamWidget(&$headEvent, $chainProperty='version',

if($headEvent instanceof BuildEvent)
{
$n = (integer) 0;
$n = $chainOffset;
while($chainOffset-- > 0)
{
?><li></li><?php
}

for($event = $headEvent; !is_null($event);
$event = $chainProperty === 'version' ? ($chainDirection? $event->nextForVersion() : $event->prevForVersion())
: ($chainDirection? $event->nextForStartDate() : $event->prevForStartDate()))
Expand Down Expand Up @@ -1517,7 +1528,7 @@ private function outputEventMatrix(&$releases)

$current = $event;

$this->outputBuildStreamWidget($event, 'version', FALSE/*descend*/, -1/*no length limit*/,
$this->outputBuildStreamWidget($event, 'version', FALSE/*descend*/, -1/*no length limit*/, 0/*no offset*/,
$releaseInfo, FALSE/*vertical*/, $current, FALSE);
}

Expand Down

0 comments on commit 2bff158

Please sign in to comment.