diff options
author | tardo <tardo@nagi-fanboi.net> | 2007-09-22 17:09:26 -0400 |
---|---|---|
committer | tardo <tardo@nagi-fanboi.net> | 2007-09-22 17:09:26 -0400 |
commit | 61ddbc18e7836a3b2e334b23ea637a2a0eea9006 (patch) | |
tree | 9dcfd76c3b0e85958f97539c8cf560ab2162df31 /web/lib | |
parent | 6a39da70fb9cfd6050deb1016fe0183157d8fb46 (diff) | |
download | aurweb-61ddbc18e7836a3b2e334b23ea637a2a0eea9006.tar.xz |
Reverse dependency lookup. FS 4556, 5269.
Ugly hack, could use beautification.
Also includes english translation addition.
If url sources are too long, page could ugly...
Signed-off-by: tardo <tardo@nagi-fanboi.net>
Diffstat (limited to 'web/lib')
-rw-r--r-- | web/lib/pkgfuncs.inc | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/web/lib/pkgfuncs.inc b/web/lib/pkgfuncs.inc index cd339c1..395200b 100644 --- a/web/lib/pkgfuncs.inc +++ b/web/lib/pkgfuncs.inc @@ -152,6 +152,25 @@ function package_dependencies($pkgid=0) { return $deps; } +# reverse deps by tardo +# +function package_required($pkgid=0) { + $deps = array(); + if ($pkgid) { + $dbh = db_connect(); + $q = "SELECT PackageID, Name, DummyPkg from PackageDepends, Packages "; + $q.= "WHERE PackageDepends.PackageID = Packages.ID "; + $q.= "AND PackageDepends.DepPkgID = "; + $q.= mysql_real_escape_string($pkgid); + $result = db_query($q, $dbh); + if (!$result) {return array();} + while ($row = mysql_fetch_row($result)) { + $deps[] = $row; + } + } + return $deps; +} + # create a dummy package and return it's Packages.ID if it already exists, # return the existing ID # @@ -410,6 +429,32 @@ function package_details($id=0, $SID="") { print "</td></tr>\n"; print "</table></td>"; + # reverse-deps by tardo - could use some beautification + print " <td valign='top'>"; + print "<table class='boxSoft' style='width: 200px'>"; + print "<tr><td class='boxSoftTitle'><span class='f3'>"; + print __("Required by")."</span></td></tr>\n"; + print "<tr><td class='boxSoft'>"; + $deps = package_required($row["ID"]); + while (list($k, $darr) = each($deps)) { + $url = "<a href='/packages.php?do_Details=1&ID=".$darr[0]; + while(list($k, $var) = each($pkgsearch_vars)) { + if (($var == "do_MyPackages" || $var == "do_Orphans") && $_REQUEST[$var]) { + $url .= "&".$var."=1"; + } else { + $url .= "&".$var."=".rawurlencode(stripslashes($_REQUEST[$var])); + } + } + reset($pkgsearch_vars); + + // $darr[3] is the DepCondition + + if ($darr[2] == 0) print $url."'>".$darr[1].$darr[3]."</a><br />\n"; + else print "<a href='#'>".$darr[1].$darr[3]."</a><br />\n"; + } + print "</td></tr>\n"; + print "</table></td>"; + print " <td valign='top'>"; print "<table class='boxSoft' style='width: 200px'>"; print "<tr><td class='boxSoftTitle'><span class='f3'>"; |