committed dsa's user stats and user links patch

this will require some translation updates
This commit is contained in:
pjmattal 2006-08-10 01:42:35 +00:00
parent 1e9149b170
commit f76a38ad76
5 changed files with 86 additions and 2 deletions

View file

@ -218,6 +218,78 @@ $result = db_query($q, $dbh);
$row = mysql_fetch_row($result);
$safe_count = $row[0];
# Added the user statistcs.
# Added by: dsa <dsandrade@gmail.com>
$user = username_from_sid($_COOKIE["AURSID"]);
if (!empty($user)) {
$q = "SELECT count(*) FROM Packages,PackageLocations,Users WHERE Packages.MaintainerUID = Users.ID AND Packages.LocationID = PackageLocations.ID AND PackageLocations.Location = 'unsupported' AND Users.Username='$user'";
$result = db_query($q, $dbh);
$row = mysql_fetch_row($result);
$maintainer_unsupported_count = $row[0];
$q = "SELECT count(*) FROM Packages,Users WHERE Packages.OutOfDate = 1 AND Packages.MaintainerUID = Users.ID AND Users.Username='$user'";
$result = db_query($q, $dbh);
$row = mysql_fetch_row($result);
$flagged_outdated = $row[0];
$q = "SELECT count(*) FROM Packages,Users WHERE Packages.Safe = 1 AND Packages.MaintainerUID = Users.ID AND Users.Username='$user'";
$result = db_query($q, $dbh);
$row = mysql_fetch_row($result);
$flagged_safe = $row[0];
print "<table class='boxSoft'>";
print "<tr>";
print "<th colspan='2' class='boxSoftTitle' style='text-align: right'>";
print "<span class='f3'>".__("User Statistics")."</span>";
print "</th>";
print "</tr>";
# Number of packages in unsupported
print "<tr>";
print "<td class='boxSoft'>";
print "<span class='f4'>".__("Packages in unsupported")."</span>";
print "</td>";
print "<td class='boxSoft'><span class='f4'>$maintainer_unsupported_count</span></td>";
print "</tr>";
# If the user is a TU calculate the number of the packages
$atype = account_from_sid($_COOKIE["AURSID"]);
if ($atype == 'Trusted User') {
$q = "SELECT count(*) FROM Packages,PackageLocations,Users WHERE Packages.MaintainerUID = Users.ID AND Packages.LocationID = PackageLocations.ID AND PackageLocations.Location = 'community' AND Users.Username='$user'";
$result = db_query($q, $dbh);
$row = mysql_fetch_row($result);
$maintainer_community_count = $row[0];
print "<tr>";
print "<td class='boxSoft'>";
print "<span class='f4'>".__("Packages in [community]")."</span>";
print "</td>";
print "<td class='boxSoft'><span class='f4'>$maintainer_community_count</span></td>";
print "</tr>";
}
# Number of outdated packages
print "<tr>";
print "<td class='boxSoft'>";
print "<span class='f4'>".__("Out-of-date")."</span>";
print "</td>";
print "<td class='boxSoft'><span class='f4'>$flagged_outdated</span></td>";
print "</tr>";
# Number of safe packages
print "<tr>";
print "<td class='boxSoft'>";
print "<span class='f4'>".__("Safe")."</span>";
print "</td>";
print "<td class='boxSoft'><span class='f4'>$flagged_safe</span></td>";
print "</tr>";
print "</table><br />";
}
print "<table class='boxSoft'>";
print "<tr>";

View file

@ -67,6 +67,8 @@ $_t["en"]["Contributed PKGBUILDs <b>must</b> conform to the %hArch Packaging Sta
$_t["en"]["Statistics"] = "Statistics";
$_t["en"]["User Statistics"] = "User Statistics";
$_t["en"]["Registered Users"] = "Registered Users";
$_t["en"]["Trusted Users"] = "Trusted Users";
@ -85,4 +87,6 @@ $_t["en"]["The most popular packages will be provided as binary packages in [com
$_t["en"]["Packages added or updated in the past 7 days"] = "Packages added or updated in the past 7 days";
$_t["en"]["Out-of-date"] = "Out-of-date";
?>

View file

@ -67,6 +67,8 @@ $_t["pt"]["Contributed PKGBUILDs <b>must</b> conform to the %hArch Packaging Sta
$_t["pt"]["Statistics"] = "Estatísticas";
$_t["pt"]["User Statistics"] = "Estatísticas do Usuário";
$_t["pt"]["Registered Users"] = "Usuários Registrados";
$_t["pt"]["Trusted Users"] = "Usuários Confiáveis";
@ -85,4 +87,6 @@ $_t["pt"]["The most popular packages will be provided as binary packages in [com
$_t["pt"]["Packages added or updated in the past 7 days"] = "Pacotes adicionados ou atualizados nos últimos 7 dias";
$_t["pt"]["Out-of-date"] = "Desatualizados";
?>

View file

@ -25,7 +25,7 @@ $_t["pt"]["Go"] = "Ir";
$_t["pt"]["Unflag Out-of-date"] = "Retirar marcador de Desatualizado";
$_t["pt"]["Go back to %hpackage details view%h."] = "Retornar para a %visualização dos detalhes do pacote%h.";
$_t["pt"]["Go back to %hpackage details view%h."] = "Retornar para a %hvisualização dos detalhes do pacote%h.";
$_t["pt"]["Error retrieving package details."] = "Erro ao retornar os detalhes do pacote.";

View file

@ -1075,7 +1075,11 @@ function pkg_search_page($SID="") {
# if (isset($tus[$row["MaintainerUID"]])) {
# print $tus[$row["MaintainerUID"]]["Username"];
if (isset($users[$row["MaintainerUID"]])) {
print $users[$row["MaintainerUID"]]["Username"];
# Add a link to the user packages, e.g, if you click on the Solve the sorting problem, so we can force the
# maintainer name, you will be redirected to a page with the user packages.
# Added by: dsa <dsandrade@gmail.com>
$user = $users[$row["MaintainerUID"]]["Username"];
print "<a href='packages.php?K=".$user."&SeB=m'>".$users[$row["MaintainerUID"]]["Username"]."</a>";
} else {
print "<span style='color: blue; font-style: italic;'>";
print __("orphan");