From f76a38ad7669e044205ab544016d953243d36b29 Mon Sep 17 00:00:00 2001 From: pjmattal Date: Thu, 10 Aug 2006 01:42:35 +0000 Subject: committed dsa's user stats and user links patch this will require some translation updates --- web/html/index.php | 72 +++++++++++++++++++++++++++++++++++++++++++++ web/lang/en/index_po.inc | 4 +++ web/lang/pt/index_po.inc | 4 +++ web/lang/pt/pkgfuncs_po.inc | 2 +- web/lib/pkgfuncs.inc | 6 +++- 5 files changed, 86 insertions(+), 2 deletions(-) diff --git a/web/html/index.php b/web/html/index.php index 65fa564f..462d3bb6 100644 --- a/web/html/index.php +++ b/web/html/index.php @@ -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 +$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 ""; + + print ""; + print ""; + print ""; + + # Number of packages in unsupported + print ""; + print ""; + print ""; + print ""; + + # 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 ""; + print ""; + print ""; + print ""; + } + + # Number of outdated packages + print ""; + print ""; + print ""; + print ""; + + # Number of safe packages + print ""; + print ""; + print ""; + print ""; + + print "
"; + print "".__("User Statistics").""; + print "
"; + print "".__("Packages in unsupported").""; + print "$maintainer_unsupported_count
"; + print "".__("Packages in [community]").""; + print "$maintainer_community_count
"; + print "".__("Out-of-date").""; + print "$flagged_outdated
"; + print "".__("Safe").""; + print "$flagged_safe

"; +} + print ""; print ""; diff --git a/web/lang/en/index_po.inc b/web/lang/en/index_po.inc index 0d26e56c..d988bfa4 100644 --- a/web/lang/en/index_po.inc +++ b/web/lang/en/index_po.inc @@ -67,6 +67,8 @@ $_t["en"]["Contributed PKGBUILDs must 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"; + ?> \ No newline at end of file diff --git a/web/lang/pt/index_po.inc b/web/lang/pt/index_po.inc index 872d6479..2a001066 100644 --- a/web/lang/pt/index_po.inc +++ b/web/lang/pt/index_po.inc @@ -67,6 +67,8 @@ $_t["pt"]["Contributed PKGBUILDs must 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"; + ?> \ No newline at end of file diff --git a/web/lang/pt/pkgfuncs_po.inc b/web/lang/pt/pkgfuncs_po.inc index 6e423995..4c08a0fc 100644 --- a/web/lang/pt/pkgfuncs_po.inc +++ b/web/lang/pt/pkgfuncs_po.inc @@ -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."; diff --git a/web/lib/pkgfuncs.inc b/web/lib/pkgfuncs.inc index 0d86ee40..e57ceba9 100644 --- a/web/lib/pkgfuncs.inc +++ b/web/lib/pkgfuncs.inc @@ -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 + $user = $users[$row["MaintainerUID"]]["Username"]; + print "".$users[$row["MaintainerUID"]]["Username"].""; } else { print ""; print __("orphan"); -- cgit v1.2.3-24-g4f1b