blob: 8140d8e0efef7ad404d5c74ad75c4f9b5bd80359 [file] [log] [blame]
<?php
require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/app.class.php");
require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/nav.class.php");
require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/menu.class.php");
$App = new App();
$Nav = new Nav();
$Menu = new Menu();
include($App->getProjectCommon()); # All on the same line to unclutter the user's desktop'
$pageTitle = "Master Timeline";
$pageKeywords = "timeline";
$pageAuthor = "Bjorn Freeman-Benson Nov 20/05";
if(isset($_REQUEST['debug']))
{
if($_REQUEST['debug'] == 1)
{
ini_set('error_reporting', E_ALL);
}
else
{
error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
}
ini_set('display_errors', true);
}
ob_start();
?>
<div id="maincontent">
<div id="midcolumn">
<h1><?= $pageTitle ?></h1>
<?php
require_once($_SERVER['DOCUMENT_ROOT'] . "/projects/common/projects-info.class.php");
/**
* Translates from the project-info.xml date formats:
* DD/MM/YYYY (e.g., 22/03/2005), MM/YYYY (e.g., 10/2005), NQYYYY (e.g., 3Q2005)
* to
* its MM/YYYY format needed in this script
*/
function getTheDateRight($_date)
{
$mes = 02;
$anho = 2004;
$date = explode("/", $_date);
$num = count($date);
if($num == 1)
{
$quarter = strpos(strtoupper($date[0]), "Q");
if(!($quarter === false))
{
$mes = substr($date[0], 0, $quarter);
if($mes == 1)
$mes = 2;
elseif($mes == 2)
$mes = 6;
elseif($mes == 3)
$mes = 10;
$anho = substr($date[0], $quarter+1);
}
else
{
$mes = $date[0];
$anho = $date[1];
}
}
elseif($num == 2)
{
$anho = $date[1];
$mes = $date[0];
}
elseif($num == 3)
{
$anho = $date[2];
$mes = $date[1];
}
return ($mes ."/". $anho);
}
define("QUARTERS_TO_DISPLAY",8);
define("TOTAL_COLSPAN",24);
define ("DATES_TXT",".dates.txt");
$rows = array();
$baseyear = date('Y'); // This year
function getfile($file){
$fp = fopen($file,"r");
while(!feof($fp))
$output .= fgets($fp,1024);
fclose($fp);
return $output;
}
$rows = array();
$baseyear = date('Y'); // This year
$basemonth = date('m');
switch($basemonth){
case ($basemonth <= 3) : $basemonth = 10;
$baseyear--;
break;
case ($basemonth <= 6) : $basemonth = 1;
break;
case ($basemonth <= 9) : $basemonth = 4;
break;
case ($basemonth <= 12): $basemonth = 7;
break;
}
function makedates($year,$month){
$lastyear = 0;
$i = 0;
$totalspan = 0;
if ($month <= 3){
$firstquarter = 1;
$firstcolspan = 12;
$lastcolspan = 12;
}else if ($month <= 6){
$firstquarter = 2;
$firstcolspan = 9;
$lastcolspan = 3;
}else if ($month <= 9){
$firstquarter = 3;
$firstcolspan = 6;
$lastcolspan = 6;
}else{
$firstquarter = 4;
$firstcolspan = 3;
$lastcolspan = 9;
}
$quarter = $firstquarter;
while($i<QUARTERS_TO_DISPLAY){
if ($i == 0){
$colspan = $firstcolspan;
$totalspan += $colspan;
}else if ($lastyear != $year){
$colspan = TOTAL_COLSPAN - $totalspan - $lastcolspan;
if ($colspan == 0)
$colspan += $lastcolspan;
$totalspan += $colspan;
}
if ($lastyear != $year){
$years[] = array($year,$colspan);
$lastyear = $year;
}
if ($quarter % 4 == 0)
$year++;
$q = array('Q'.$quarter,3);
$quarters[$i++] = $q;
$quarter = (++$quarter % 4);
if ($quarter == 0)
$quarter = 4;
}
return array($years,$quarters);
}
list($years,$quarters) = makedates($baseyear,$basemonth);
$c = count($years)-1;
$lastyear = $years[$c][0];
$c = count($quarters)-1;
$lastmonth = substr($quarters[$c][0],1,1); // Get last quarter
$lastmonth *= 3; // 3 months in each quarter
switch($basemonth){
case ($basemonth <= 3) : $firstmonth = 1;
break;
case ($basemonth <= 6) : $firstmonth = 4;
break;
case ($basemonth <= 9) : $firstmonth = 7;
break;
case ($basemonth <= 12): $firstmonth = 10;
break;
}
if(isset( $_REQUEST['fetch']))
$projects = new ProjectsInfo(0,$_REQUEST['fetch']);
else
$projects = new ProjectsInfo();
$localpath = $_SERVER['DOCUMENT_ROOT'] . "/projects/timeline/local/";
$localsdir = dir($localpath);
while(($file = $localsdir ->read()) !== false) {
if(!is_dir($localpath."/".$file))
{
if(!(FALSE === strpos($file, "xml")))
{
$xml = @file($localpath."/".$file);
if(is_array($xml) && count($xml) > 0)
{
$xml = implode('',$xml);
$project = new ProjectInfo("Local");
$project->getUrlIndex = "#";
$project->xmlsource = "local $file";
$project->dom = $xml;
$project->dom = preg_replace( "/\<\!--.*?--\>/s", "", $project->dom );
$project->xml = $project->dom;
$project->parseToArray();
$projects->_projects[] = $project;
}
}
}
}
$localsdir->close();
for($p = 0; $p < $projects->hasProjects(); $p++)
{
$project = $projects->getProject($p);
$projectName = $project->getName();
$url = $project->getUrlIndex();
$shortname = $project->getShortname();
unset($arow);
if(($project->hasReleases() > 0 || $project->hasShippings() > 0))
{
$num_releases = $project->hasReleases();
$num_shippings = $project->hasShippings();
for($r = 0; $r < $num_releases; $r++)
{
$release = $project->getRelease($r);
$release_date = $release->getDate();
$release_name = $release->getName();
$release_status = $release->getStatus();
$release_plan_url = $release->getPlan();
$date = getTheDateRight($release_date);
list($month, $year) = sscanf($date, "%d/%d");
if (($year == $lastyear) && ($month > $lastmonth))
continue;
if (($year == $baseyear) && ($month < $firstmonth))
continue;
if (($month >= 1) && ($month <= 12) && ($year >= $baseyear))
{
if(!isset($arow))
$arow = array($projectName, $url, array(), $shortname);
$x = $month + (($year - $baseyear) * 12) - $basemonth + 1;
$arow[2][] = array($x, $release_name, $release_status ,$release_plan_url,$release_date);
}
}
for($r = 0; $r < $num_shippings; $r++)
{
$shipping = $project->getShipping($r);
$shipping_date = $shipping->getDate();
$shipping_name = $shipping->getName();
$shipping_status = $shipping->getStatus();
$shipping_url = $shipping->getDownload();
$date = getTheDateRight($shipping_date);
list($month, $year) = sscanf($date, "%d/%d");
if (($year == $lastyear) && ($month > $lastmonth))
continue;
if (($year == $baseyear) && ($month < $firstmonth))
continue;
if (($month >= 1) && ($month <= 12) && ($year >= $baseyear))
{
if(!isset($arow))
$arow = array($projectName, $url, array(), $shortname);
$x = $month + (($year - $baseyear) * 12) - $basemonth + 1;
$arow[2][] = array($x, $shipping_name, $shipping_status , $shipping_url,$shipping_date);
}
}
if(isset($arow))
$rows[] = $arow;
}
}
?>
<table border=0 cellspacing="0" cellpadding="0">
<!-- YEARS -->
<tr><tr><td width="350"></td>
<?php
$max_month = 0;
foreach($years as $v2){
echo "<td colspan=".$v2[1]." align=\"center\" bgcolor=#006600><table width=\"100%\" cellspacing=\"1\" cellpadding=\"0\">";
echo "<tr width=\"100%\"><td bgcolor=\"#0000FF\" align=\"center\"><font color=\"#FFFF00\">" .$v2[0]."</font>";
echo "</td></tr></table></td>\n";
$max_month += $v2[1];
}
?>
</tr>
<!-- QUARTERS -->
<tr><td></td>
<?php
foreach($quarters as $v2){
echo "<td colspan=".$v2[1]." align=\"center\" bgcolor=#006600><table width=\"100%\" cellspacing=\"1\" cellpadding=\"0\">";
echo "<tr width=\"100%\"><td bgcolor=\"#0000FF\" align=\"center\"><font color=\"#FFFF00\">" .$v2[0]."</font>";
echo "</td></tr></table></td>\n";
}
?>
</tr>
<!-- INITIAL ARROWS -->
<tr>
<?php
$arrows = array();
$arrows[0] = "&nbsp;";
for($i=1;$i<=$max_month;$i++)
$arrows[$i] = "&nbsp;";
foreach($rows as $arow)
foreach ($arow[2] as $releases)
$arrows[$releases[0]] = "<img src=\"arrow.gif\"/>";
foreach($arrows as $cell)
echo "<td align=\"center\">".$cell."</td>\n";
?>
</tr>
<!-- ROWS -->
<?php
$cells = array();
for($y=0;$y<count($rows);$y++){
$cells[$y] = array();
$arow = $rows[$y];
$cells[$y][0] = "<td align=right><font face=\"Arial,Helvetica\" size=2><b><a href=\"".$arow[1]."\" title=\"". $arow[0] ."\"><img valign='middle' src='text2image.php?string=$arow[3]&type=link' alt='$arow[3]' title='$arow[3]'/></a></b></font></td>\n";
for($i=1;$i<=$max_month;$i++)
$cells[$y][$i] = " ";
$items = $arow[2];
for($i=count($items)-1;$i>=0;$i--){
$item = $items[$i];
$idx = $item[0];
$string = $item[1];
if (strtolower($item[2]) == "tentative")
$string = "<center><font color=gray><em><img valign='middle' src='text2image.php?string=$string&type=tentative' title='Tentative: $string - $item[4]' alt='$string'></em></font></center>";
else
if (strtolower($item[2]) == "completed")
$string = "<center><font color=\"#006600\"><img valign='middle' src='text2image.php?string=$string&type=completed' title='Completed: $string - $item[4]' alt='$string'></font></center>";
else
$string = "<center><font color=black><img valign='middle' src='text2image.php?string=$string&type=scheduled' title='Scheduled: $string - $item[4]' alt='$string'></font></center>";
if ($item[3] != "")
$string = "<a href=\"".$item[3]."\">".$string."</a>";
$cells[$y][$idx] = $string;
for ($z =$y-1;$z>=0;$z--)
if ($cells[$z][$idx] == " ")
$cells[$z][$idx] = "|";
}
}
for($y=0;$y<count($cells);$y++){
for($x=count($cells[$y])-1;$x>1;$x--)
if (strlen($cells[$y][$x]) > 1)
break;
for(;$x>0;$x--){
if ($cells[$y][$x] == " ")
$cells[$y][$x] = "@";
if ($cells[$y][$x] == "|")
$cells[$y][$x] = "#";
}
}
foreach($cells as $cellrow){
echo "<tr>\n";
$first = 0;
foreach($cellrow as $cell){
if ($first == 0){
$first = 1;
echo $cell;
}else
if (strlen($cell) == 1){
if ($cell == " ")
echo "<td width=\"25\" >&nbsp;</td>\n";
if ($cell == "@")
echo "<td width=\"25\" align=center><img src=\"dots.gif\"/></td>\n";
if ($cell == "#")
echo "<td width=\"25\" align=center><img src=\"line-dots.gif\"/></td>\n";
if ($cell == "|")
echo "<td width=\"25\" align=center><img src=\"line.gif\"/></td>\n";
}else
echo "<td width=\"25\" align=center>".$cell."</td>\n";
}
echo "</tr>\n";
}
?>
</table>
<p>&nbsp;</p>
<p><em>Hover</em> over a Release to see its details, if avaliable <em>Click</em> it to go to its URL</p>
<p><font color="#006600"><img align="top" src="text2image.php?string=Green&type=completed&size=14" alt="Green" title="Completed"></font> releases are completed.
<img align="top" src="text2image.php?string=Normal black&type=scheduled&size=14" title="Scheduled" alt="Normal black"> releases are planned.
<font color=gray><em><img align="top" src="text2image.php?string=Grey italic&type=tentative&size=14" alt="Grey italic" title="Tentative"></em></font> releases are tentative.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><em>The timeline is generated from the <a href="/projects/dev_process/project-status-infrastructure.php">project status infrastructure</a>, specifically
the <code>&lt;releases&gt;</code> tag. Projects that do not show up in the timeline are missing those files.</em></p>
</div>
</div>
<?php
# Paste your HTML content between the EOHTML markers!
$html = ob_get_contents();
ob_end_clean();
# Generate the web page
$App->generatePage($theme, $Menu, $Nav, $pageAuthor, $pageKeywords, $pageTitle, $html);
?>