blob: b88357cbb595e8b6b3d4bd369915e6bf5e37a5b8 [file] [log] [blame]
<?
require_once($_SERVER['DOCUMENT_ROOT'] . "/home/categories/scripts/globalsPIX.php");
$App->useProjectInfo();
function retrieveDescription($path)
{
$path = $_SERVER['DOCUMENT_ROOT'] . $path;
$handle = @fopen($path, 'r');
$contents = @fread($handle, filesize($path));
@fclose($handle);
$contents = strip_tags($contents);
$contents = mb_convert_encoding($contents, "HTML-ENTITIES");
return $contents;
}
function ProjectSortList($projectInfoList, $projectToCheck){
if (!function_exists("cmp_obj"))
{
function cmp_obj($a, $b)
{
$al = trim(strtolower($a->projectID));
$bl = trim(strtolower($b->projectID));
if ($al == "webtools") return -99;
if ($bl == "webtools") return 99;
if ($al == $bl) { return 0; }
// IF a has webtools, and b doesnt then easy sort a -1
if ( (stripos($al, 'webtools.') === 0) && (stripos($bl, 'webtools.') ) !== 0 ){
return -1;
}
// IF b has webtools, and a doesnt then easy sort a +1
elseif ( (stripos($al, 'webtools.') !== 0) && (stripos($bl, 'webtools.') ) === 0 ){
return +1;
}
// If a and b has webtools then we need to sort
elseif ( (stripos($al, 'webtools.') === 0) && (stripos($bl, 'webtools.') ) === 0 ){
return ($al < $bl) ? -1 : +1;
}
else {
return ($al < $bl) ? -1 : +1;
}
}
}
usort($projectInfoList->list, "cmp_obj");
}
function projectTable($pillarType)
{
ob_start();
# Lets Create the Table Layout and Header
?>
<table cellspacing=0 class="projectTable">
<tr>
<td class="tableHeader" width="35%">Project Name</td>
<td class="tableHeader" width="10%" align="center">Homepage</td>
<td class="tableHeader" width="12%" align="center">Forums</td>
<td class="tableHeader" width="13%" align="center">Mailing Lists</td>
<td class="tableHeader" width="7%" align="center">Wiki</td>
<td class="tableHeader" width="8%" align="center">Docs</td>
<td class="tableHeader" width="10%" align="center">Download</td>
</tr>
<?
# Now Create the ProjectInfoListObject with the right filter
$projectInfoList = new ProjectInfoList();
$projectInfoList->selectProjectInfoList(NULL, "categories", NULL, $pillarType, NULL, NULL);
$numProjects = $projectInfoList->getCount();
#Sort WebTools to the top if Enterprise
if ($pillarType == "ENT"){
ProjectSortList($projectInfoList, 'webtools');
}
# We have the data now to iterate through it.
for ($i = 0; $i < $numProjects; $i++)
{
$projectInfoIterator = $projectInfoList->getItemAt($i);
$projectName = $projectInfoIterator->projectname;
$projectShortName = $projectInfoIterator->projectshortname;
$projectDesc = trim(retrieveDescription($projectInfoIterator->paragraphurl));
$projectLink = $projectInfoIterator->projecturl;
$projectWiki = $projectInfoIterator->wikiurl;
$download = $projectInfoIterator->downloadsurl;
$docs = $projectInfoIterator->documentationurl;
$mailingListArray = $projectInfoIterator->mailinglists;
$newsgroupArray = $projectInfoIterator->newsgroups;
$mailingList = "";
$newsgroup = "";
if (count($mailingListArray))
{
foreach($mailingListArray as $rr)
{
if ($rr->type == "main")
{
$mailingList = "http://dev.eclipse.org/mailman/listinfo/" . $rr->name;
}
}
}
if (count($newsgroupArray))
{
foreach($newsgroupArray as $rr)
{
if ($rr->type == "main")
{
$newsgroup = "http://www.eclipse.org/newsportal/thread.php?group=" . $rr->name;
}
}
}
?>
<tr>
<td>
<div class="invisible" id="<?=$projectName;?>">
<? if (strlen($projectDesc) > 0) { ?>
<a name="<?=$projectName;?>" class="norgie" <? if (!$projectDesc) echo "style=\"display:none;\"";?> onClick="t('<?=$projectName;?>','<?=$projectName;?>a')"></a>
<a name="<?=$projectName;?>" <? if (!$projectDesc) echo "style=\"margin-left:12px;\""; else { ?> onClick="t('<?=$projectName;?>','<?=$projectName;?>a')" <? } ?>><?=$projectName;?></a>
<? } else {?>
<b><?=$projectName;?></b>
<? } ?>
</div>
</td>
<td align="center"><a href="<?=$projectLink;?>" Title="<?=$projectLink;?>"><img src="http://dev.eclipse.org/large_icons/apps/internet-web-browser.png"></a></td>
<td align="center"><? if ($newsgroup != "") { ?><a href="<?=$newsgroup;?>" Title="<?=$newsgroup;?>"><img src="http://dev.eclipse.org/large_icons/apps/internet-group-chat.png"></a><? } ?></td>
<td align="center"><? if ($mailingList != "") { ?><a href="<?=$mailingList;?>" Title="Subscribe"><img src="http://dev.eclipse.org/large_icons/actions/mail-reply-all.png"></a><? } ?></td>
<td align="center"><? if ($projectWiki != "") { ?><a href="<?=$projectWiki;?>" Title="<?=$projectWiki;?>"><img src="http://dev.eclipse.org/large_icons/apps/accessories-text-editor.png"></a><? } ?></td>
<td align="center"><? if ($docs != "") { ?><a href="<?=$docs;?>" Title="Docs"><img src="http://dev.eclipse.org/large_icons/apps/help-browser.png"></a><? } ?></td>
<td align="center"><? if ($download != "") { ?><a href="<?=$download;?>" Title="Download"><img src="http://dev.eclipse.org/large_icons/actions/go-bottom.png"></a><? } ?></td>
</tr>
<tr>
<td class="tableRow" colspan=7>
<div class="invisible" id="<?=$projectName;?>a">
<div class="item_contents">
<?=$projectDesc;?>
</div>
</div>
</td>
</tr>
<? } ?>
</table>
<?
$html = ob_get_contents();
ob_end_clean();
return $html;
} ?>