From 14a3d83d515cc4c5f8e8749335d76b7ea2d19143 Mon Sep 17 00:00:00 2001 From: Tony Lambregts Date: Fri, 21 Oct 2005 02:48:27 +0000 Subject: [PATCH] Let users view distributions --- admin/adminDistributions.php | 69 ------------------------------------ admin/editDistribution.php | 4 +-- admin/editVendor.php | 57 +++++++++++++++-------------- apidb.css | 2 ++ distributionView.php | 66 +++++++++++++++++++++++++++++++--- include/sidebar.php | 3 ++ include/sidebar_admin.php | 2 -- 7 files changed, 99 insertions(+), 104 deletions(-) delete mode 100644 admin/adminDistributions.php diff --git a/admin/adminDistributions.php b/admin/adminDistributions.php deleted file mode 100644 index 5a4e222..0000000 --- a/admin/adminDistributions.php +++ /dev/null @@ -1,69 +0,0 @@ -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 "\n\n"; - - echo "\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'; } - $oDistribution = new distribution($ob->distributionId); - echo "\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "\n\n"; - $c++; - } - echo "
Distribution nameDistribution urlLinked TestsAction
iDistributionId."\">","\n"; - echo $oDistribution->sName."sUrl."\">".$oDistribution->sUrl."".sizeof($oDistribution->aTestingIds).""; - echo "[edit]"; - if(!sizeof($oDistribution->aTestingIds)) - echo "   [delete]"; - echo "
\n\n"; - echo html_frame_end(" "); - -} - -apidb_footer(); -?> diff --git a/admin/editDistribution.php b/admin/editDistribution.php index 8a05007..1108675 100644 --- a/admin/editDistribution.php +++ b/admin/editDistribution.php @@ -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 diff --git a/admin/editVendor.php b/admin/editVendor.php index 6144a66..c135e1c 100644 --- a/admin/editVendor.php +++ b/admin/editVendor.php @@ -1,41 +1,44 @@ 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

\n"; - - $t->edit($query); + apidb_header("Edit Vendor"); + echo "
+ iVendorId."\" /> + + + + + + + + + + + + +
Vendor name + sName."\" /> +
Vendor URL + sWebpage."\" /> +
+ +
+
"; + apidb_footer(); } - -apidb_footer(); - ?> diff --git a/apidb.css b/apidb.css index b0c5c02..4fbd427 100644 --- a/apidb.css +++ b/apidb.css @@ -135,6 +135,8 @@ p.indent { padding-left: 1em; padding-right: 1em;} /* App Support status */ .gold { background-color: #fff600; } .silver { background-color: silver; } +.bronze { background-color: #fcba0a; } +.Garbage { background-color: #999966; } /*******************************************************************/ diff --git a/distributionView.php b/distributionView.php index b68a51c..7ac5451 100644 --- a/distributionView.php +++ b/distributionView.php @@ -11,13 +11,70 @@ require(BASE."include/incl.php"); require(BASE."include/distributions.php"); require(BASE."include/testResults.php"); +if ($_REQUEST['sub']) +{ + if(!$_SESSION['current']->hasPriv("admin")) + { + errorpage("Insufficient privileges."); + exit; + } + + if($_REQUEST['sub'] == 'delete') + { + $oDistribution = new distribution($_REQUEST['iDistributionId']); + $oDistribution->delete(); + redirect($_SERVER['PHP_SELF']); + } +} $oDistribution = new distribution($_REQUEST['iDistributionId']); //exit with error if no vendor if(!$oDistribution->iDistributionId) { - errorpage("No Distribution ID specified!"); - exit; + apidb_header("View 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 "\n\n"; + + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + if ($_SESSION['current']->hasPriv("admin")) + echo " \n"; + echo "\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 "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + if ($_SESSION['current']->hasPriv("admin")) + { + echo " \n"; + } + echo "\n"; + $c++; + } + echo "
Distribution nameDistribution urlLinked TestsAction
iDistributionId."\">","\n"; + echo $oDistribution->sName."sUrl."\">".$oDistribution->sUrl."".sizeof($oDistribution->aTestingIds).""; + echo "[edit]"; + if(!sizeof($oDistribution->aTestingIds)) + echo "   [iDistributionId."'>delete]"; + echo "
\n\n"; + echo html_frame_end(" "); + if ($_SESSION['current']->hasPriv("admin")) + echo "[Add New Distribution]"; + apidb_footer(); } else { @@ -36,9 +93,10 @@ else { echo " (".$oDistribution->sUrl.")"; echo "
\n"; - } - else + } else + { echo "
\n"; + } if($oDistribution->aTestingIds) { diff --git a/include/sidebar.php b/include/sidebar.php index e45ee30..6855813 100644 --- a/include/sidebar.php +++ b/include/sidebar.php @@ -2,6 +2,7 @@ /***********/ /* SideBar */ /***********/ +require_once(BASE."include/distributions.php"); function global_sidebar_menu() { @@ -17,6 +18,8 @@ function global_sidebar_menu() { $g->add("Submit Application", BASE."appsubmit.php?apptype=1"); $g->add("Help & Documentation", BASE."help/"); $g->add("AppDB Stats", BASE."appdbStats.php"); + $g->add("View Distributions (".getNumberOfDistributions().")", BASE."distributionView.php"); + $g->add("Email your suggestions for improving the AppDB", "mailto:appdb@winehq.org"); $g->done(); diff --git a/include/sidebar_admin.php b/include/sidebar_admin.php index 93b87da..7758eb4 100644 --- a/include/sidebar_admin.php +++ b/include/sidebar_admin.php @@ -11,7 +11,6 @@ function global_admin_menu() { $g->add("Add Category", BASE."admin/addCategory.php"); $g->add("Add Vendor", BASE."admin/addVendor.php"); - $g->add("Add Distribution", BASE."admin/editDistribution.php"); $g->addmisc(" "); $g->add("View App Queue (".$_SESSION['current']->getQueuedAppCount()."/".$_SESSION['current']->getQueuedVersionCount().")", BASE."admin/adminAppQueue.php"); @@ -21,7 +20,6 @@ function global_admin_menu() { $g->add("View Vendors (".getVendorCount().")", BASE."admin/adminVendors.php"); $g->add("View Bug Links (".getNumberOfQueuedBugLinks()."/".getNumberOfBugLinks().")", BASE."admin/adminBugs.php"); $g->add("View Test Results Queue (".getNumberOfQueuedTests().")", BASE."admin/adminTestResults.php"); - $g->add("View Distributions (".getNumberOfDistributions().")", BASE."admin/adminDistributions.php"); $g->addmisc(" "); $g->add("Users Management", BASE."admin/adminUsers.php");