mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
working on action box for packages
This commit is contained in:
parent
dc3b13064c
commit
efcca46f26
5 changed files with 86 additions and 55 deletions
Binary file not shown.
|
@ -15,10 +15,10 @@ DB_USER = "aur"
|
||||||
DB_PASS = "aur"
|
DB_PASS = "aur"
|
||||||
USER_ID = 5 # Users.ID of first user
|
USER_ID = 5 # Users.ID of first user
|
||||||
PKG_ID = 1 # Packages.ID of first package
|
PKG_ID = 1 # Packages.ID of first package
|
||||||
MAX_USERS = 100 # how many users to 'register'
|
MAX_USERS = 200 # how many users to 'register'
|
||||||
MAX_DEVS = .1 # what percentage of MAX_USERS are Developers
|
MAX_DEVS = .1 # what percentage of MAX_USERS are Developers
|
||||||
MAX_TUS = .2 # what percentage of MAX_USERS are Trusted Users
|
MAX_TUS = .2 # what percentage of MAX_USERS are Trusted Users
|
||||||
MAX_PKGS = 250 # how many packages to load
|
MAX_PKGS = 2500 # how many packages to load
|
||||||
PKG_FILES = (8, 30) # min/max number of files in a package
|
PKG_FILES = (8, 30) # min/max number of files in a package
|
||||||
VOTING = (.3, .8) # percentage range for package voting
|
VOTING = (.3, .8) # percentage range for package voting
|
||||||
RANDOM_PATHS = [ # random path locations for package files
|
RANDOM_PATHS = [ # random path locations for package files
|
||||||
|
@ -78,13 +78,16 @@ user_keys = []
|
||||||
|
|
||||||
# some functions to generate random data
|
# some functions to generate random data
|
||||||
#
|
#
|
||||||
def genVersion():
|
def genVersion(location_id=0):
|
||||||
major = random.randrange(0,10)
|
ver = []
|
||||||
minor = random.randrange(0,20)
|
ver.append("%d" % random.randrange(0,10))
|
||||||
|
ver.append("%d" % random.randrange(0,20))
|
||||||
if random.randrange(0,2) == 0:
|
if random.randrange(0,2) == 0:
|
||||||
revision = random.randrange(0,100)
|
ver.append("%d" % random.randrange(0,100))
|
||||||
return "%d.%d.%d" % (major, minor, revision)
|
if location_id == 2: # the package is in the AUR
|
||||||
return "%d.%d" % (major, minor)
|
return ".".join(ver) + "-u%d" % random.randrange(1,11)
|
||||||
|
else:
|
||||||
|
return ".".join(ver) + "%d" % random.randrange(1,11)
|
||||||
def genCategory():
|
def genCategory():
|
||||||
return categories[category_keys[random.randrange(0,len(category_keys))]]
|
return categories[category_keys[random.randrange(0,len(category_keys))]]
|
||||||
def genLocation():
|
def genLocation():
|
||||||
|
@ -194,10 +197,7 @@ for u in user_keys:
|
||||||
#
|
#
|
||||||
pass
|
pass
|
||||||
|
|
||||||
s = """\
|
s = "INSERT INTO Users (ID, AccountTypeID, Username, Email, Passwd) VALUES (%d, %d, '%s', '%s@example.com', '%s');\n" % (seen_users[u], account_type, u, u, u)
|
||||||
INSERT INTO Users (ID, AccountTypeID, Username, Email, Passwd)
|
|
||||||
VALUES (%d, %d, '%s', '%s@example.com', '%s');
|
|
||||||
""" % (seen_users[u], account_type, u, u, u)
|
|
||||||
out.write(s)
|
out.write(s)
|
||||||
if count % 10 == 0:
|
if count % 10 == 0:
|
||||||
if DBUG: print ".",
|
if DBUG: print ".",
|
||||||
|
@ -225,12 +225,8 @@ for p in seen_pkgs.keys():
|
||||||
if location_id == 1: # unsupported pkgs don't have a maintainer
|
if location_id == 1: # unsupported pkgs don't have a maintainer
|
||||||
muid = 0
|
muid = 0
|
||||||
|
|
||||||
s = """\
|
s = "INSERT INTO Packages (ID, Name, Version, CategoryID, LocationID, SubmittedTS, SubmitterUID, MaintainerUID) VALUES (%d, '%s', '%s', %d, %d, %d, %d, %d);\n" % (seen_pkgs[p], p, genVersion(location_id), genCategory(),
|
||||||
INSERT INTO Packages (ID, Name, Version, CategoryID, LocationID,
|
location_id, long(time.time()), genUID(), muid)
|
||||||
SubmittedTS, SubmitterUID, MaintainerUID)
|
|
||||||
VALUES (%d, '%s', '%s', %d, %d, %d, %d, %d);
|
|
||||||
""" % (seen_pkgs[p], p, genVersion(), genCategory(), location_id,
|
|
||||||
long(time.time()), genUID(), muid)
|
|
||||||
out.write(s)
|
out.write(s)
|
||||||
if count % 100 == 0:
|
if count % 100 == 0:
|
||||||
if DBUG: print ".",
|
if DBUG: print ".",
|
||||||
|
@ -238,56 +234,35 @@ INSERT INTO Packages (ID, Name, Version, CategoryID, LocationID,
|
||||||
|
|
||||||
if location_id == 1: # Unsupported - just a PKGBUILD and maybe other stuff
|
if location_id == 1: # Unsupported - just a PKGBUILD and maybe other stuff
|
||||||
others = random.randrange(0,3)
|
others = random.randrange(0,3)
|
||||||
s = """\
|
s = "INSERT INTO PackageContents (PackageID, FileName, Path, FileSize) VALUES (%d, '%s', '%s', %d);\n" % (seen_pkgs[p], "PKGBUILD", "/home/aur/incoming/%s/PKGBUILD" % p,
|
||||||
INSERT INTO PackageContents (PackageID, FileName, Path, FileSize)
|
|
||||||
VALUES (%d, '%s', '%s', %d);
|
|
||||||
""" % (seen_pkgs[p], "PKGBUILD", "/home/aur/incoming/%s/PKGBUILD" % p,
|
|
||||||
random.randrange(0,999))
|
random.randrange(0,999))
|
||||||
out.write(s)
|
out.write(s)
|
||||||
if others == 0:
|
if others == 0:
|
||||||
s = """\
|
s = "INSERT INTO PackageContents (PackageID, FileName, Path, FileSize) VALUES (%d, '%s', '%s', %d);\n" % (seen_pkgs[p], "%s.patch" % p,
|
||||||
INSERT INTO PackageContents (PackageID, FileName, Path, FileSize)
|
|
||||||
VALUES (%d, '%s', '%s', %d);
|
|
||||||
""" % (seen_pkgs[p], "%s.patch" % p,
|
|
||||||
"/home/aur/incoming/%s/%s.patch" % (p,p),
|
"/home/aur/incoming/%s/%s.patch" % (p,p),
|
||||||
random.randrange(0,999))
|
random.randrange(0,999))
|
||||||
out.write(s)
|
out.write(s)
|
||||||
|
|
||||||
elif others == 1:
|
elif others == 1:
|
||||||
s = """\
|
s = "INSERT INTO PackageContents (PackageID, FileName, Path, FileSize) VALUES (%d, '%s', '%s', %d);\n" % (seen_pkgs[p], "%s.patch" % p,
|
||||||
INSERT INTO PackageContents (PackageID, FileName, Path, FileSize)
|
|
||||||
VALUES (%d, '%s', '%s', %d);
|
|
||||||
""" % (seen_pkgs[p], "%s.patch" % p,
|
|
||||||
"/home/aur/incoming/%s/%s.patch" % (p,p),
|
"/home/aur/incoming/%s/%s.patch" % (p,p),
|
||||||
random.randrange(0,999))
|
random.randrange(0,999))
|
||||||
out.write(s)
|
out.write(s)
|
||||||
s = """\
|
s = "INSERT INTO PackageContents (PackageID, FileName, Path, FileSize) VALUES (%d, '%s', '%s', %d);\n" % (seen_pkgs[p], "arch.patch",
|
||||||
INSERT INTO PackageContents (PackageID, FileName, Path, FileSize)
|
|
||||||
VALUES (%d, '%s', '%s', %d);
|
|
||||||
""" % (seen_pkgs[p], "arch.patch",
|
|
||||||
"/home/aur/incoming/%s/arch.patch" % p,
|
"/home/aur/incoming/%s/arch.patch" % p,
|
||||||
random.randrange(0,999))
|
random.randrange(0,999))
|
||||||
out.write(s)
|
out.write(s)
|
||||||
|
|
||||||
elif others == 2:
|
elif others == 2:
|
||||||
s = """\
|
s = "INSERT INTO PackageContents (PackageID, FileName, Path, FileSize) VALUES (%d, '%s', '%s', %d);\n" % (seen_pkgs[p], "%s.patch" % p,
|
||||||
INSERT INTO PackageContents (PackageID, FileName, Path, FileSize)
|
|
||||||
VALUES (%d, '%s', '%s', %d);
|
|
||||||
""" % (seen_pkgs[p], "%s.patch" % p,
|
|
||||||
"/home/aur/incoming/%s/%s.patch" % (p,p),
|
"/home/aur/incoming/%s/%s.patch" % (p,p),
|
||||||
random.randrange(0,999))
|
random.randrange(0,999))
|
||||||
out.write(s)
|
out.write(s)
|
||||||
s = """\
|
s = "INSERT INTO PackageContents (PackageID, FileName, Path, FileSize) VALUES (%d, '%s', '%s', %d);\n" % (seen_pkgs[p], "arch.patch",
|
||||||
INSERT INTO PackageContents (PackageID, FileName, Path, FileSize)
|
|
||||||
VALUES (%d, '%s', '%s', %d);
|
|
||||||
""" % (seen_pkgs[p], "arch.patch",
|
|
||||||
"/home/aur/incoming/%s/arch.patch" % p,
|
"/home/aur/incoming/%s/arch.patch" % p,
|
||||||
random.randrange(0,999))
|
random.randrange(0,999))
|
||||||
out.write(s)
|
out.write(s)
|
||||||
s = """\
|
s = "INSERT INTO PackageContents (PackageID, FileName, Path, FileSize) VALUES (%d, '%s', '%s', %d);\n" % (seen_pkgs[p], "%s.install" % p,
|
||||||
INSERT INTO PackageContents (PackageID, FileName, Path, FileSize)
|
|
||||||
VALUES (%d, '%s', '%s', %d);
|
|
||||||
""" % (seen_pkgs[p], "%s.install" % p,
|
|
||||||
"/home/aur/incoming/%s/%s.install" % (p,p),
|
"/home/aur/incoming/%s/%s.install" % (p,p),
|
||||||
random.randrange(0,999))
|
random.randrange(0,999))
|
||||||
out.write(s)
|
out.write(s)
|
||||||
|
@ -317,10 +292,7 @@ INSERT INTO PackageContents (PackageID, FileName, Path, FileSize)
|
||||||
path = loc + "/" + p
|
path = loc + "/" + p
|
||||||
if not files.has_key(path):
|
if not files.has_key(path):
|
||||||
files[path] = 1
|
files[path] = 1
|
||||||
s = """\
|
s = "INSERT INTO PackageContents (PackageID, FileName, Path, FileSize) VALUES (%d, '%s', '%s', %d);\n" % (seen_pkgs[p], os.path.basename(path), path,
|
||||||
INSERT INTO PackageContents (PackageID, FileName, Path, FileSize)
|
|
||||||
VALUES (%d, '%s', '%s', %d);
|
|
||||||
""" % (seen_pkgs[p], os.path.basename(path), path,
|
|
||||||
random.randrange(0,99999999))
|
random.randrange(0,99999999))
|
||||||
out.write(s)
|
out.write(s)
|
||||||
if DBUG: print "."
|
if DBUG: print "."
|
||||||
|
@ -336,9 +308,7 @@ for u in user_keys:
|
||||||
for v in range(num_votes):
|
for v in range(num_votes):
|
||||||
pkg = random.randrange(0, len(seen_pkgs))
|
pkg = random.randrange(0, len(seen_pkgs))
|
||||||
if not pkgvote.has_key(pkg):
|
if not pkgvote.has_key(pkg):
|
||||||
s = """\
|
s = "INSERT INTO PackageVotes (UsersID, PackageID) VALUES (%d, %d);\n" % (seen_users[u], pkg)
|
||||||
INSERT INTO PackageVotes (UsersID, PackageID) VALUES (%d, %d);
|
|
||||||
""" % (seen_users[u], pkg)
|
|
||||||
pkgvote[pkg] = 1
|
pkgvote[pkg] = 1
|
||||||
out.write(s)
|
out.write(s)
|
||||||
if count % 100 == 0:
|
if count % 100 == 0:
|
||||||
|
|
|
@ -91,4 +91,29 @@ $_t["en"]["Out-of-date"] = "Out-of-date";
|
||||||
# $_t["fr"]["Out-of-date"] = "--> Traduction française ici. <--";
|
# $_t["fr"]["Out-of-date"] = "--> Traduction française ici. <--";
|
||||||
# $_t["de"]["Out-of-date"] = "--> Deutsche Übersetzung hier. <--";
|
# $_t["de"]["Out-of-date"] = "--> Deutsche Übersetzung hier. <--";
|
||||||
|
|
||||||
|
$_t["en"]["Flag Out-of-date"] = "Flag Out-of-date";
|
||||||
|
# $_t["es"]["Flag Out-of-date"] = "--> Traducción española aquí. <--";
|
||||||
|
# $_t["fr"]["Flag Out-of-date"] = "--> Traduction française ici. <--";
|
||||||
|
# $_t["de"]["Flag Out-of-date"] = "--> Deutsche Übersetzung hier. <--";
|
||||||
|
|
||||||
|
$_t["en"]["Actions"] = "Actions";
|
||||||
|
# $_t["es"]["Actions"] = "--> Traducción española aquí. <--";
|
||||||
|
# $_t["fr"]["Actions"] = "--> Traduction française ici. <--";
|
||||||
|
# $_t["de"]["Actions"] = "--> Deutsche Übersetzung hier. <--";
|
||||||
|
|
||||||
|
$_t["en"]["Adopt Packages"] = "Adopt Packages";
|
||||||
|
# $_t["es"]["Adopt Packages"] = "--> Traducción española aquí. <--";
|
||||||
|
# $_t["fr"]["Adopt Packages"] = "--> Traduction française ici. <--";
|
||||||
|
# $_t["de"]["Adopt Packages"] = "--> Deutsche Übersetzung hier. <--";
|
||||||
|
|
||||||
|
$_t["en"]["Disown Packages"] = "Disown Packages";
|
||||||
|
# $_t["es"]["Disown Packages"] = "--> Traducción española aquí. <--";
|
||||||
|
# $_t["fr"]["Disown Packages"] = "--> Traduction française ici. <--";
|
||||||
|
# $_t["de"]["Disown Packages"] = "--> Deutsche Übersetzung hier. <--";
|
||||||
|
|
||||||
|
$_t["en"]["Vote"] = "Vote";
|
||||||
|
# $_t["es"]["Vote"] = "--> Traducción española aquí. <--";
|
||||||
|
# $_t["fr"]["Vote"] = "--> Traduction française ici. <--";
|
||||||
|
# $_t["de"]["Vote"] = "--> Deutsche Übersetzung hier. <--";
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -406,13 +406,14 @@ function html_footer($ver="") {
|
||||||
print " </td>\n";
|
print " </td>\n";
|
||||||
print " </tr>\n";
|
print " </tr>\n";
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
print "<p>\n";
|
|
||||||
if ($ver) {
|
if ($ver) {
|
||||||
|
print "<p>\n";
|
||||||
print "<table border='0' cellpadding='0' cellspacing='0' width='97%'>\n";
|
print "<table border='0' cellpadding='0' cellspacing='0' width='97%'>\n";
|
||||||
print "<tr><td align='right'><span class='fix'>".$ver."</span></td></tr>\n";
|
print "<tr><td align='right'><span class='fix'>".$ver."</span></td></tr>\n";
|
||||||
print "</table>\n";
|
print "</table>\n";
|
||||||
}
|
|
||||||
print "</p>\n";
|
print "</p>\n";
|
||||||
|
}
|
||||||
|
print "<br />\n";
|
||||||
print "</body>\n</html>";
|
print "</body>\n</html>";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -181,6 +181,41 @@ function pkg_search_page($SID="",$L="",$C="",$K="",$SB="",$M=0,$O=0,$PP=25) {
|
||||||
# name will be a link that goes to 'details'. There should also be
|
# name will be a link that goes to 'details'. There should also be
|
||||||
# a column for 'manage/edit'
|
# a column for 'manage/edit'
|
||||||
|
|
||||||
|
if ($SID) {
|
||||||
|
print "<center>\n";
|
||||||
|
print "<form action='/pkgsearch.php' method='post'>\n";
|
||||||
|
print "<table cellspacing='3' class='boxSoft'>\n";
|
||||||
|
print "<tr>\n";
|
||||||
|
print " <td class='boxSoftTitle' align='right'>\n";
|
||||||
|
print " <span class='f3'>".__("Actions")."</span>\n";
|
||||||
|
print " </td>\n";
|
||||||
|
print "</tr>\n";
|
||||||
|
print "<tr>\n";
|
||||||
|
print " <td class='boxSoft'>\n";
|
||||||
|
print "<input type='hidden' name='Action' value='DoSomething'>\n";
|
||||||
|
print "<table style='width: 100%' align='center'>\n";
|
||||||
|
print "<tr>\n";
|
||||||
|
print " <td align='center'>";
|
||||||
|
print "<input type='submit' class='button' name='do_Flag'";
|
||||||
|
print " value='".__("Flag Out-of-date")."'></td>\n";
|
||||||
|
print " <td align='center'>";
|
||||||
|
print "<input type='submit' class='button' name='do_Disown'";
|
||||||
|
print " value='".__("Disown Packages")."'></td>\n";
|
||||||
|
print " <td align='center'>";
|
||||||
|
print "<input type='submit' class='button' name='do_Adopt'";
|
||||||
|
print " value='".__("Adopt Packages")."'></td>\n";
|
||||||
|
print " <td align='center'>";
|
||||||
|
print "<input type='submit' class='button' name='do_Vote'";
|
||||||
|
print " value='".__("Vote")."'></td>\n";
|
||||||
|
print "</tr>\n";
|
||||||
|
print "</table>\n";
|
||||||
|
print " </td>\n";
|
||||||
|
print "</tr>\n";
|
||||||
|
print "</table>\n";
|
||||||
|
print "</form>\n";
|
||||||
|
print "</center>\n";
|
||||||
|
print "<br />\n";
|
||||||
|
}
|
||||||
|
|
||||||
# query to pull out package info
|
# query to pull out package info
|
||||||
#
|
#
|
||||||
|
|
Loading…
Add table
Reference in a new issue