summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpjmattal <pjmattal>2004-12-15 02:47:17 +0100
committerpjmattal <pjmattal>2004-12-15 02:47:17 +0100
commit294c14e7bb5a7c880821f145376d1d125662f4dc (patch)
tree8ee507bdc7a8ee35b8f416b236134419e0d7b692
parent19086f4f022cca17db33b608e09853a7e024eda0 (diff)
downloadaur-294c14e7bb5a7c880821f145376d1d125662f4dc.tar.gz
aur-294c14e7bb5a7c880821f145376d1d125662f4dc.tar.xz
renumber none to one, hide none from category/location dropdowns
-rw-r--r--support/schema/aur-schema.sql18
-rw-r--r--web/lib/pkgfuncs.inc13
2 files changed, 15 insertions, 16 deletions
diff --git a/support/schema/aur-schema.sql b/support/schema/aur-schema.sql
index c775af17..13e83d17 100644
--- a/support/schema/aur-schema.sql
+++ b/support/schema/aur-schema.sql
@@ -67,7 +67,7 @@ CREATE TABLE PackageCategories (
Category CHAR(32) NOT NULL,
PRIMARY KEY (ID)
);
-INSERT INTO PackageCategories (ID, Category) VALUES (0, 'none');
+INSERT INTO PackageCategories (Category) VALUES ('none');
INSERT INTO PackageCategories (Category) VALUES ('daemons');
INSERT INTO PackageCategories (Category) VALUES ('devel');
INSERT INTO PackageCategories (Category) VALUES ('editors');
@@ -94,12 +94,12 @@ CREATE TABLE PackageLocations (
Location CHAR(32) NOT NULL,
PRIMARY KEY (ID)
);
-INSERT INTO PackageLocations (ID, Location) VALUES (0, 'none');
-INSERT INTO PackageLocations (ID, Location) VALUES (1, 'Unsupported');
-INSERT INTO PackageLocations (ID, Location) VALUES (2, 'AUR');
-INSERT INTO PackageLocations (ID, Location) VALUES (3, 'Current');
-INSERT INTO PackageLocations (ID, Location) VALUES (4, 'Extra');
-INSERT INTO PackageLocations (ID, Location) VALUES (5, 'Unstable');
+INSERT INTO PackageLocations (Location) VALUES ('none');
+INSERT INTO PackageLocations (Location) VALUES ('Unsupported');
+INSERT INTO PackageLocations (Location) VALUES ('AUR');
+INSERT INTO PackageLocations (Location) VALUES ('Current');
+INSERT INTO PackageLocations (Location) VALUES ('Extra');
+INSERT INTO PackageLocations (Location) VALUES ('Unstable');
-- Information about the actual packages
@@ -108,13 +108,13 @@ CREATE TABLE Packages (
ID INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
Name CHAR(32) NOT NULL,
Version CHAR(32) NOT NULL DEFAULT '',
- CategoryID TINYINT UNSIGNED NOT NULL,
+ CategoryID TINYINT UNSIGNED NOT NULL DEFAULT 1,
Description CHAR(128) NOT NULL DEFAULT "An Arch Package",
URL CHAR(255) NOT NULL DEFAULT "http://www.archlinux.org",
DummyPkg TINYINT UNSIGNED NOT NULL DEFAULT 0, -- 1=>dummy
FSPath CHAR(255) NOT NULL DEFAULT '',
URLPath CHAR(255) NOT NULL DEFAULT '',
- LocationID TINYINT UNSIGNED NOT NULL,
+ LocationID TINYINT UNSIGNED NOT NULL DEFAULT 1,
NumVotes INTEGER UNSIGNED NOT NULL DEFAULT 0,
OutOfDate TINYINT UNSIGNED DEFAULT 0,
SubmittedTS BIGINT UNSIGNED NOT NULL,
diff --git a/web/lib/pkgfuncs.inc b/web/lib/pkgfuncs.inc
index 6ea38310..4ae7a4eb 100644
--- a/web/lib/pkgfuncs.inc
+++ b/web/lib/pkgfuncs.inc
@@ -56,7 +56,7 @@ function canManagePackage($uid=0,$AURMUID=0, $MUID=0, $SUID=0, $managed=0) {
function pkgCategories() {
$cats = array();
$dbh = db_connect();
- $q = "SELECT * FROM PackageCategories ";
+ $q = "SELECT * FROM PackageCategories WHERE ID != 1 ";
$q.= "ORDER BY Category ASC";
$result = db_query($q, $dbh);
if ($result) {
@@ -72,7 +72,7 @@ function pkgCategories() {
function pkgLocations() {
$locs = array();
$dbh = db_connect();
- $q = "SELECT * FROM PackageLocations ";
+ $q = "SELECT * FROM PackageLocations WHERE ID != 1 ";
$q.= "ORDER BY Location ASC";
$result = db_query($q, $dbh);
if ($result) {
@@ -130,11 +130,10 @@ function create_dummy($pname="", $sid="") {
if (!$result) {
# Insert the dummy
#
- $q = "INSERT INTO Packages (Name, CategoryID, Description, ";
- $q.= "URL, LocationID, SubmittedTS, SubmitterUID) VALUES ('";
- $q.= mysql_escape_string($pname)."', 0, ";
- $q.= "'A dummy package', '/#', 0, UNIX_TIMESTAMP(), ";
- $q.= $uid.")";
+ $q = "INSERT INTO Packages (Name, Description, URL, SubmittedTS, ";
+ $q.= "SubmitterUID) VALUES ('";
+ $q.= mysql_escape_string($pname)."', 'A dummy package', '/#', ";
+ $q.= "UNIX_TIMESTAMP(), ".$uid.")";
$result = db_query($q, $dbh);
if (!$result) {
return NULL;