From e3587ddf94ba742beabdaa8a68023f8ee0234b58 Mon Sep 17 00:00:00 2001 From: eric Date: Sun, 6 Mar 2005 21:44:56 +0000 Subject: started working on pkgedit for comments --- web/lib/pkgfuncs.inc | 70 +++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 66 insertions(+), 4 deletions(-) (limited to 'web/lib') diff --git a/web/lib/pkgfuncs.inc b/web/lib/pkgfuncs.inc index 0b451ce..f832111 100644 --- a/web/lib/pkgfuncs.inc +++ b/web/lib/pkgfuncs.inc @@ -148,6 +148,27 @@ function create_dummy($pname="", $sid="") { } +# grab package comments +# +function package_comments($pkgid=0) { + $comments = array(); + if ($pkgid) { + $dbh = db_connect(); + $q = "SELECT UserName, Comments, CommentTS "; + $q.= "FROM PackageComments, Users "; + $q.= "WHERE PackageComments.UsersID = Users.ID"; + $q.= " AND PackageID = ".mysql_escape_string($pkgid); + $q.= " AND DelUsersID = 0"; # only display non-deleted comments + $q.= " ORDER BY CommentTS ASC"; + $result = db_query($q, $dbh); + if (!$result) {return array();} + while ($row = mysql_fetch_assoc($result)) { + $comments[] = $row; + } + } + return $comments; +} + # grab package sources # function package_sources($pkgid=0) { @@ -217,7 +238,7 @@ function package_details($id=0) { print "\n"; print "\n"; print " \n"; + print "".__("Package Details")."\n"; print "\n"; print "\n"; print "
"; - print "Package Details
\n"; @@ -267,7 +288,7 @@ function package_details($id=0) { print " "; print ""; print "\n"; + print __("Dependencies")."\n"; print ""; + print "\n"; + + # Display package comments + # + $comments = package_comments($row["ID"]); + if (!empty($comments)) { + while (list($indx, $carr) = each($comments)) { + print "\n"; + print " \n"; + + print "\n"; + print " \n"; + print "\n"; + } + } + print "\n"; + print " \n"; + print "\n"; + print " "; print "\n"; print "
"; - print "Dependencies
"; $deps = package_dependencies($row["ID"]); # $deps[0] = array('id','name', 'dummy'); while (list($k, $darr) = each($deps)) { @@ -289,7 +310,7 @@ function package_details($id=0) { print " "; print ""; print "\n"; + print __("Sources")."\n"; print "\n"; print "
"; - print "Sources
"; $sources = package_sources($row["ID"]); # $sources[0] = 'src'; while (list($k, $src) = each($sources)) { @@ -302,12 +323,53 @@ function package_details($id=0) { else { //It is presumably an internal source - print "".$src."
\n"; + print "".$src."
\n"; } } print "
"; + print "
"; + print ""; + print "\n"; + print "\n"; + print "
"; + print __("Comment by: %h%s%h on %h%s%h", + array("",$carr["UserName"],"", + "",date("Ymd [H:i:s]",$carr["CommentTS"]),"")); + print "
"; + print "
\n";
+					print str_replace('"',""", stripslashes($carr["Comments"]));
+					print "
\n"; + print "
\n"; + print "
"; + print "
"; + print "
\n"; + print "\n"; + print ""; + print "
\n"; + print "
\n"; -- cgit v1.2.3-70-g09d2