function printBuildColumns($fileName, $parts)
{
    global $subdirDrops;
    // no file name, write empty column
    if ($fileName == "") {
        echo "<td status=\"status\">&nbsp;</td>\n";
        return;
    }
    // get build name, date and time
    $dropDir = "{$subdirDrops}/{$fileName}";
    if (count($parts) == 3) {
        $buildName = $parts[1];
        $buildDay = intval(substr($parts[2], 0, 8));
        $buildTime = intval(substr($parts[2], 8, 4));
        $buildType = $parts[0];
    }
    if (count($parts) == 2) {
        $buildName = $fileName;
        $buildDay = intval(substr($buildName, 1, 8));
        $buildTime = intval(substr($buildName, 10, 2)) * 60 + intval(substr($buildName, 12, 2));
        $buildType = substr($buildName, 0, 1);
    }
    // compute minutes elapsed since build started
    $day = intval(date("Ymd"));
    $time = intval(date("H")) * 60 + intval(date("i"));
    $diff = ($day - $buildDay) * 24 * 60 + $time - $buildTime;
    // Add icons
    echo "<td class=\"status\">\n";
    // hard code for now the build is done
    // https://bugs.eclipse.org/bugs/show_bug.cgi?id=378706
    // but later, changed ...
    // compute build done based on "buildPending" file, but if not
    // present, assume build is done
    // https://bugs.eclipse.org/bugs/show_bug.cgi?id=382196
    $build_done = true;
    if (file_exists("{$dropDir}/buildPending")) {
        $build_done = false;
    }
    if ($build_done) {
        // test results location changed. 'testresults' is new standard
        // but we check for 'results' for older stuff.
        // https://bugs.eclipse.org/bugs/show_bug.cgi?id=379408
        $testResultsDirName = "";
        if (file_exists("{$dropDir}/testresults")) {
            $testResultsDirName = "testresults";
        } else {
            if (file_exists("{$dropDir}/results")) {
                $testResultsDirName = "results";
            }
        }
        $boxes = calcTestConfigsRan($fileName, $testResultsDirName);
        // boxes == -1 is code that "bulid failed" and no tests are expected.
        if ($boxes == -1) {
            $buildimage = "build_failed.gif";
            $buildalt = "Build failed";
        } else {
            $buildimage = "build_done.gif";
            $buildalt = "Build is available";
        }
        echo "<a href=\"{$dropDir}/\"><img style=\"border:0px\" src=\"../images/{$buildimage}\" title=\"{$buildalt}\" alt=\"{$buildalt}\" /></a>\n";
        // set to zero globally, but computed in calcTestConfigsRan
        global $expectedtestConfigs;
        $boxesTitle = "";
        // We skip the main "tests" part for patch builds, since don't expect any (for now).
        if ($buildType !== "P" && $boxes !== -2) {
            // always put in links, since someone may want to look at logs, even if not tests results, per se
            // don't forget to end link, after images decided.
            if ($boxes > -1) {
                $boxesTitle = $boxes . " of " . $expectedtestConfigs . " test platforms finished.";
            }
            if ($testResultsDirName === "results") {
                echo "<a href=\"{$dropDir}/results/testResults.html\" title=\"{$boxesTitle}\" style=\"text-decoration: none\">";
            } else {
                echo "<a href=\"{$dropDir}/testResults.php\" title=\"{$boxesTitle}\" style=\"text-decoration: none\">";
            }
            if ($boxes == -1) {
                $testimage = "caution.gif";
                $testalt = "Integration tests did not run due to failed build";
            } elseif ($boxes == 0 && $diff > 720) {
                // assume if no results at all, after 12 hours, assume they didn't run for unknown reasons
                $testimage = "caution.gif";
                $testalt = "Integration tests did not run, due to unknown reasons.";
            } elseif ($boxes > 0 && $boxes < $expectedtestConfigs) {
                if ($diff > 1440) {
                    $testimage = "junit.gif";
                    $testalt = "Tests results are available but did not finish on all machines";
                } else {
                    $testimage = "runtests.gif";
                    $testalt = "Integration tests are running ...";
                }
            } elseif ($boxes == $expectedtestConfigs) {
                $testimage = "junit.gif";
                $testalt = "Tests results are available";
            } else {
                $testimage = "runtests.gif";
                $testalt = "Integration tests are running ...";
            }
            echo "<img style=\"border:0px\" src=\"../images/{$testimage}\" title=\"{$testalt}\" alt=\"{$testalt}\" />\n";
            if ($boxes > -1) {
                echo "&nbsp;(" . $boxes . " of " . $expectedtestConfigs . " platforms)\n";
            }
            echo "</a>\n";
        } else {
            echo "<a href=\"{$dropDir}/testResults.php\" title=\"{$boxesTitle}\" style=\"text-decoration: none\">";
            $testimage = "results.gif";
            $testalt = "Logs from build";
            echo "<img style=\"border:0px\" src=\"../images/{$testimage}\" title=\"{$testalt}\" alt=\"{$testalt}\" />";
            if ($buildType == "P") {
                echo "&nbsp;(No automated tests)";
            } elseif ($boxes == -2) {
                echo "&nbsp;(No expected tests)";
            } else {
                echo "&nbsp;(unexpected test boxes)";
            }
            echo "</a>\n";
        }
    }
    echo "</td>\n";
    return $buildName;
}
<div id="midcolumn">

<h3>Logs and Test Links</h3>

<?php 
    // for current (modern) builds, test results are always in
    // 'testresults'. That directory only exists after first results
    // have finished and been "published".
    if (file_exists("testresults")) {
        $testResultsDirName = "testresults";
    } elseif (file_exists("results")) {
        $testResultsDirName = "results";
    } else {
        $testResultsDirName = "";
    }
    $boxes = calcTestConfigsRan($testResultsDirName);
    if ($boxes < 0) {
        $boxesDisplay = 0;
    } else {
        $boxesDisplay = $boxes;
    }
    //  echo "<ul class='midlist'>";
    echo "<ul>";
    //  We will always display link to logs (as normal link, not using color:inherit;)
    echo "<li>View the <a  style=\"text-decoration:none\" title=\"Link to logs.\" href=\"testResults.php\">logs for the current build</a>.</li>\n";
    // This section if for overall status if anything failed, overall is failed
    // -3 is special code meaning no testResults directory exists yet.
    if ($boxes == -3) {
        $testResultsStatus = "pending";
    } else {
        /* since boxes is not -3, there must be at least one */
function printTestSummaryStatus()
{
    include_once "buildproperties.php";
    // date and time of build, and elapsed time
    $buildTime = timeOfBuild($TIMESTAMP);
    // compute minutes elapsed since build started
    $day = intval(date("Ymd"));
    $time = intval(date("H")) * 60 + intval(date("i"));
    $diff = ($day - $buildDay) * 24 * 60 + $time - $buildTime;
    if (file_exists("testresults")) {
        $testResultsDirName = "testresults";
    } elseif (file_exists("results")) {
        $testResultsDirName = "results";
    } else {
        // Neither directory exists at first ... until a tests completes and one result uploaded.
        $testResultsDirName = "";
    }
    $boxes = calcTestConfigsRan($fileName, $testResultsDirName);
    // boxes == -1 is code that "bulid failed" and no tests are expected.
    if ($boxes == -1) {
        $buildimage = "build_failed.gif";
        $buildalt = "Build failed";
    } else {
        $buildimage = "build_done.gif";
        $buildalt = "Build is available";
    }
    // set to zero globally, but computed in calcTestConfigsRan
    global $expectedtestConfigs;
    $boxesTitle = "";
    // We skip the main "tests" part for patch builds, since don't expect any (for now).
    if ($BUILD_TYPE !== "P" && $boxes !== -2) {
        // always put in links, since someone may want to look at logs, even if not tests results, per se
        // don't forget to end link, after images decided.
        if ($boxes > -1) {
            $boxesTitle = $boxes . " of " . count($expectedTestConfigs) . " test platforms finished.";
        }
        if ($testResultsDirName === "results") {
            echo "<a href=\"results/testResults.html\" title=\"{$boxesTitle}\" style=\"text-decoration: none\">";
        } else {
            echo "<a href=\"testResults.php\" title=\"{$boxesTitle}\" style=\"text-decoration: none\">";
        }
        if ($boxes == -1) {
            $testimage = "caution.gif";
            $testalt = "Integration tests did not run due to failed build";
        } elseif ($boxes == 0 && $diff > 720) {
            // assume if no results at all, after 12 hours, assume they didn't run for unknown reasosn
            $testimage = "caution.gif";
            $testalt = "Integration tests did not run, due to unknown reasons.";
        } elseif ($boxes > 0 && $boxes < count($expectedTestConfigs)) {
            if ($diff > 1440) {
                $testimage = "junit.gif";
                $testalt = "Tests results are available but did not finish on all machines";
            } else {
                $testimage = "runtests.gif";
                $testalt = "Integration tests are running ...";
            }
        } elseif ($boxes == count($expectedTestConfigs)) {
            $testimage = "junit.gif";
            $testalt = "Tests results are available";
        } else {
            $testimage = "runtests.gif";
            $testalt = "Integration tests are running ...";
        }
        echo "<img style=\"border:0px\" src=\"../images/{$testimage}\" title=\"{$testalt}\" alt=\"{$testalt}\" />";
        if ($boxes > -1) {
            echo "&nbsp;(" . $boxes . " of " . count($expectedTestConfigs) . " platforms)";
        }
        echo "</a>\n";
    } else {
        echo "<a href=\"testResults.php\" title=\"{$boxesTitle}\" style=\"text-decoration: none\">";
        $testimage = "results.gif";
        $testalt = "Logs from build";
        echo "<img style=\"border:0px\" src=\"../images/{$testimage}\" title=\"{$testalt}\" alt=\"{$testalt}\" />";
        if ($BUILD_TYPE == "P") {
            echo "&nbsp;(No automated tests)";
        } elseif ($boxes == -2) {
            echo "&nbsp;(No expected tests)";
        } else {
            echo "&nbsp;(unexpected test boxes)";
        }
    }
    echo "</a>\n";
}