- adds a panel for administrating vendors

- removed corresponding TODO entry
This commit is contained in:
Jonathan Ernst
2004-12-29 03:44:17 +00:00
committed by WineHQ
parent 487bcb9264
commit 844babf8a0
4 changed files with 95 additions and 2 deletions

2
TODO
View File

@@ -39,8 +39,6 @@ In particular globally registered vars should be replaced by superglobals (nearl
# add distro table and administration screens for it. (Chris)
# We need an administration screen for vendors.
# add wineversion, distro, source/package fields to the user_list table.
# add wineversion, distro, source/package fields to the appComments table.

85
admin/adminVendors.php Normal file
View File

@@ -0,0 +1,85 @@
<?php
/*************************************************************/
/* code to view and maintain the list of application vendors */
/*************************************************************/
/*
* application environment
*/
include("path.php");
require(BASE."include/incl.php");
//deny access if not logged in
if(!loggedin())
{
errorpage("You need to be logged in to use this page.");
exit;
} else if(!havepriv("admin"))
{
errorpage("You must be an administrator to use this page.");
exit;
}
apidb_header("Admin Vendors");
echo '<form name="qform" action="adminVendors.php" method="post" enctype="multipart/form-data">',"\n";
if ($_REQUEST['sub'])
{
if($_REQUEST['sub'] == 'delete')
{
$sQuery = "DELETE FROM vendor WHERE vendorId = ".$_REQUEST['vendorId'].";";
echo "$sQuery";
$hResult = query_appdb($sQuery);
echo html_frame_start("Delete vendor: ".$_REQUEST['vendorId'],400,"",0);
if($hResult)
{
//success
echo "<p>Vendor was successfully deleted</p>\n";
}
echo html_frame_end("&nbsp;");
echo html_back_link(1,'adminVendors.php');
}
} else
{
//get available vendors
$sQuery = "SELECT * from vendor;";
$hResult = query_appdb($sQuery);
if(!$hResult || !mysql_num_rows($hResult))
{
// no vendors
echo html_frame_start("","90%");
echo '<p><b>There are no application vendors.</b></p>',"\n";
echo html_frame_end("&nbsp;");
}
else
{
// show vendorlist
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><font color=white>Vendor name</font></td>\n";
echo " <td><font color=white>Vendor url</font></td>\n";
echo " <td>&nbsp;</td>\n";
echo "</tr>\n\n";
$c = 1;
while($ob = mysql_fetch_object($hResult))
{
if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; }
echo "<tr class=$bgcolor>\n";
echo " <td>".$ob->vendorName."</td>\n";
echo " <td><a href=\"".$ob->vendorURL."\">".$ob->vendorURL."</a></td>\n";
echo " <td>[<a href='adminVendors.php?sub=delete&vendorId=$ob->vendorId'>delete</a>]</td>\n";
echo "</tr>\n\n";
$c++;
}
echo "</table>\n\n";
echo html_frame_end("&nbsp;");
}
}
echo "</form>";
apidb_footer();
?>

View File

@@ -17,6 +17,7 @@ function global_admin_menu() {
$g->add("View App Data Queue (".getQueuedAppDataCount().")", BASE."admin/adminAppDataQueue.php");
$g->add("View Maintainer Queue (".getQueuedMaintainerCount().")", BASE."admin/adminMaintainerQueue.php");
$g->add("View Maintainers (".getMaintainerCount().")", BASE."admin/adminMaintainers.php");
$g->add("View Vendors (".getVendorCount().")", BASE."admin/adminVendors.php");
$g->addmisc("&nbsp;");
$g->add("Comment manager", BASE."admin/adminCommentView.php");

View File

@@ -265,6 +265,15 @@ function getMaintainerCount()
return $ob->maintainers;
}
/* get the total number of vendors from the vendor table */
function getVendorCount()
{
$qstring = "SELECT count(*) as vendors FROM vendor";
$result = mysql_query($qstring);
$ob = mysql_fetch_object($result);
return $ob->vendors;
}
/* Get the number of users in the database */
function getNumberOfComments()
{