Let users view distributions

This commit is contained in:
Tony Lambregts
2005-10-21 02:48:27 +00:00
committed by WineHQ
parent 382d08032c
commit 14a3d83d51
7 changed files with 99 additions and 104 deletions

View File

@@ -1,69 +0,0 @@
<?php
/*******************************************************/
/* code to view and maintain the list of Distributions */
/*******************************************************/
/*
* application environment
*/
include("path.php");
require(BASE."include/incl.php");
require_once(BASE."include/distributions.php");
if(!$_SESSION['current']->hasPriv("admin"))
{
errorpage("Insufficient privileges.");
exit;
}
if ($_REQUEST['sub'])
{
if($_REQUEST['sub'] == 'delete')
{
$oDistribution = new distribution($_REQUEST['iDistributionId']);
$oDistribution->delete();
redirect(apidb_fullurl("admin/adminDistributions.php"));
}
} else
{
apidb_header("Admin Distributions");
//get available Distributions
$sQuery = "SELECT distributionId FROM distributions ORDER BY name, distributionId;";
$hResult = query_appdb($sQuery);
// 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>Linked Tests</td>\n";
echo " <td align=\"center\">Action</td>\n";
echo "</tr>\n\n";
$c = 1;
while($ob = mysql_fetch_object($hResult))
{
if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; }
$oDistribution = new distribution($ob->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>".sizeof($oDistribution->aTestingIds)."</td>\n";
echo " <td align=\"center\">";
echo "[<a href='editDistribution.php?iDistributionId=".$oDistribution->iDistributionId."'>edit</a>]";
if(!sizeof($oDistribution->aTestingIds))
echo " &nbsp; [<a href='adminDistributions.php?sub=delete&iDistributionId=".$oDistribution->iDistributionId."'>delete</a>]";
echo " </td>\n";
echo "</tr>\n\n";
$c++;
}
echo "</table>\n\n";
echo html_frame_end("&nbsp;");
}
apidb_footer();
?>

View File

@@ -5,7 +5,7 @@ require(BASE."include/distributions.php");
if(!$_SESSION['current']->hasPriv("admin"))
{
errorpage();
errorpage("Insufficient privileges.");
exit;
}
@@ -22,7 +22,7 @@ if($_REQUEST['Submit'])
$oDistribution->create();
}
redirect(apidb_fullurl("admin/adminDistributions.php"));
redirect(apidb_fullurl("distributionView.php"));
exit;
}
else

View File

@@ -1,41 +1,44 @@
<?php
include("path.php");
include(BASE."include/"."incl.php");
include(BASE."include/"."tableve.php");
require(BASE."include/incl.php");
require(BASE."include/vendor.php");
if(!$_SESSION['current']->hasPriv("admin"))
{
errorpage();
exit;
}
else
$oVendor = new Vendor($_REQUEST['vendorId']);
if($_REQUEST['submit'])
{
global $admin_mode;
$admin_mode = 1;
}
$vendorId = $_REQUEST['vendorId'];
apidb_header("Edit Vendor Information");
$t = new TableVE("edit");
if($_POST)
{
$t->update($_POST);
$oVendor->update($_REQUEST['name'],$_REQUEST['webpage']);
redirect(apidb_fullurl("admin/adminVendors.php"));
}
else
{
$table = "vendor";
$query = "SELECT * FROM $table WHERE vendorId = $vendorId";
if(debugging())
echo "$query <br><br>\n";
$t->edit($query);
apidb_header("Edit Vendor");
echo "<form method=\"post\" action=\"addVendor.php\">
<input type=\"hidden\" name=\"vendorId\" value=\"".$oVendor->iVendorId."\" />
<table border=\"0\" width=\"100%\" cellspacing=\"0\" cellpadding=\"2\">
<tr>
<td width=\"15%\" class=\"box-label\"><b>Vendor name</b></td>
<td class=\"box-body\">
<input type=\"text\" size=\"50\" name=\"name\" value=\"".$oVendor->sName."\" />
</td>
</tr>
<tr>
<td width=\"15%\" class=\"box-label\"><b>Vendor URL</b></td>
<td class=\"box-body\">
<input type=\"text\" size=\"50\" name=\"webpage\" value=\"".$oVendor->sWebpage."\" />
</td>
</tr>
<tr>
<td colspan=\"2\" class=\"box-body\">
<input type=\"submit\" name=\"submit\" value=\"Submit\" />
</td>
</tr>
</table>
</form>";
apidb_footer();
}
apidb_footer();
?>