diff --git a/TODO b/TODO index 9559d1c..e880e2e 100644 --- a/TODO +++ b/TODO @@ -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. diff --git a/admin/adminVendors.php b/admin/adminVendors.php new file mode 100644 index 0000000..39b6682 --- /dev/null +++ b/admin/adminVendors.php @@ -0,0 +1,85 @@ +',"\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 "

Vendor was successfully deleted

\n"; + } + echo html_frame_end(" "); + 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 '

There are no application vendors.

',"\n"; + echo html_frame_end(" "); + } + else + { + // show vendorlist + echo html_frame_start("","90%","",0); + echo "\n\n"; + + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "\n\n"; + + $c = 1; + while($ob = mysql_fetch_object($hResult)) + { + if ($c % 2 == 1) { $bgcolor = 'color0'; } else { $bgcolor = 'color1'; } + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "\n\n"; + $c++; + } + echo "
Vendor nameVendor url 
".$ob->vendorName."vendorURL."\">".$ob->vendorURL."[delete]
\n\n"; + echo html_frame_end(" "); + } +} + +echo ""; +apidb_footer(); +?> diff --git a/include/sidebar_admin.php b/include/sidebar_admin.php index ce90db3..8c3b8c3 100644 --- a/include/sidebar_admin.php +++ b/include/sidebar_admin.php @@ -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(" "); $g->add("Comment manager", BASE."admin/adminCommentView.php"); diff --git a/include/util.php b/include/util.php index aefc4d6..883c5e6 100644 --- a/include/util.php +++ b/include/util.php @@ -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() {