Add distribution functions and use them. Based on a patch by Chris Morgan

This commit is contained in:
Alexander Nicolaysen Sørnes
2007-01-27 00:30:00 +00:00
committed by WineHQ
parent 83164089ae
commit 5bb8448821
2 changed files with 79 additions and 30 deletions

View File

@@ -25,46 +25,25 @@ if ($aClean['sSub'])
}
$oDistribution = new distribution($aClean['iDistributionId']);
//exit with error if no distribution
/* Display distribution list if no id given */
if(!$oDistribution->iDistributionId)
{
apidb_header("View Distributions");
//get available Distributions
$hResult = query_parameters("SELECT distributionId FROM distributions ORDER BY name, distributionId;");
$hResult = distribution::ObjectGetEntries(false);
// show Distribution list
echo html_frame_start("","90%","",0);
echo "<table width='100%' border=0 cellpadding=3 cellspacing=0>\n\n";
echo "<tr class=color4>\n";
echo " <td>Distribution name</td>\n";
echo " <td>Distribution url</td>\n";
echo " <td align=\"right\">Linked Tests</td>\n";
if ($_SESSION['current']->hasPriv("admin"))
echo " <td align=\"center\">Action</td>\n";
echo "</tr>\n\n";
$c = 1;
while($oRow = mysql_fetch_object($hResult))
distribution::ObjectOutputHeader("color4");
for($c = 1; $oRow = mysql_fetch_object($hResult); $c++)
{
if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; }
$oDistribution = new distribution($oRow->distributionId);
echo "<tr class=\"$bgcolor\">\n";
echo " <td><a href=\"".BASE."distributionView.php?iDistributionId=".$oDistribution->iDistributionId."\">","\n";
echo $oDistribution->sName."</a></td>\n";
echo " <td><a href=\"".$oDistribution->sUrl."\">".$oDistribution->sUrl."</a></td>\n";
echo " <td align=\"right\">".sizeof($oDistribution->aTestingIds)."</td>\n";
if ($_SESSION['current']->hasPriv("admin"))
{
echo " <td align=\"center\">";
echo "[<a href='".BASE."admin/editDistribution.php?iDistributionId=".$oDistribution->iDistributionId."'>edit</a>]";
if(!sizeof($oDistribution->aTestingIds))
echo " &nbsp; [<a href='".$_SERVER['PHP_SELF']."?sSub=delete&iDistributionId=".$oDistribution->iDistributionId."'>delete</a>]";
echo " </td>\n";
}
echo "</tr>\n";
$c++;
$oDistribution = distribution::ObjectGetInstanceFromRow($oRow);
$oDistribution->display(($c % 2) ? "color0" : "color1");
}
echo "</table>\n\n";
echo html_frame_end("&nbsp;");