From ac052e6c84d75d8e1fc03003e6f8c79fb3fcb756 Mon Sep 17 00:00:00 2001 From: Jonathan Ernst Date: Wed, 9 Feb 2005 23:48:01 +0000 Subject: [PATCH] - show correct number of comment - remove unused function --- appview.php | 11 ++---- bugs.php | 85 +++++++++++++++++++++------------------------ include/comment.php | 14 +------- 3 files changed, 43 insertions(+), 67 deletions(-) diff --git a/appview.php b/appview.php index 624a8a4..b4380cb 100644 --- a/appview.php +++ b/appview.php @@ -9,7 +9,6 @@ include("path.php"); require(BASE."include/incl.php"); require(BASE."include/application.php"); -require(BASE."include/comment.php"); require(BASE."include/appdb.php"); require(BASE."include/vote.php"); require(BASE."include/category.php"); @@ -144,19 +143,13 @@ function display_versions($iAppId, $aVersionsIds) // set row color $bgcolor = ($c % 2 == 0) ? "color0" : "color1"; - // description - $desc = trim_description($oVersion->sDescription); - - // count comments - $r_count = count_comments($iAppId,$iVersionId); - //display row echo "\n"; echo " ".$oVersion->sName."\n"; - echo " $desc  \n"; + echo " ".trim_description($oVersion->sDescription)."\n"; echo " ".$oVersion->sTestedRating."\n"; echo " ".$oVersion->sTestedVersion."\n"; - echo " $r_count\n"; + echo " ".sizeof($oVersion->aCommentsIds)."\n"; echo "\n\n"; $c++; diff --git a/bugs.php b/bugs.php index 09767d3..ac90474 100644 --- a/bugs.php +++ b/bugs.php @@ -9,7 +9,6 @@ include("path.php"); require(BASE."include/incl.php"); require(BASE."include/application.php"); -require(BASE."include/comment.php"); require(BASE."include/appdb.php"); require(BASE."include/screenshot.php"); require(BASE."include/category.php"); @@ -40,8 +39,8 @@ function display_bundle($appId) echo "\n\n"; echo "\n"; - echo " \n"; - echo " \n"; + echo " \n"; + echo " \n"; echo "\n\n"; $c = 0; @@ -70,54 +69,50 @@ function display_bundle($appId) -/* display the versions */ -function display_versions($appId, $versions) +/** + * display the versions + */ +function display_versions($iAppId, $aVersionsIds) { - if ($versions) - { - - echo html_frame_start("","98%","",0); - echo "
Application NameDescriptionApplication NameDescription
\n\n"; + if ($aVersionsIds) + { + echo html_frame_start("","98%","",0); + echo "
\n\n"; - echo "\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "\n\n"; - - $c = 0; - while(list($idx, $ver) = each($versions)) - { - //set row color - $bgcolor = (($c % 2) ? "color0" : "color1"); + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "\n\n"; + + $c = 0; + foreach($aVersionsIds as $iVersionId) + { + $oVersion = new Version($iVersionId); - //format desc - $desc = trim_description($ver->description); - if(strlen($desc) == 75) - $desc .= " ..."; - - //count comments - $r_count = count_comments($appId,$ver->versionId); - - //display row - echo "\n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo " \n"; - echo "\n\n"; + // set row color + $bgcolor = ($c % 2 == 0) ? "color0" : "color1"; - $c++; - } - - echo "
VersionDescriptionRating With WindowsRating Without WindowsComments
VersionDescriptionRatingWine versionComments
".$ver->versionName."$desc  $r_win$r_fake$r_count
\n"; - echo html_frame_end("Click the Version Name to view the details of that Version"); - } + //display row + echo "\n"; + echo " ".$oVersion->sName."\n"; + echo " ".trim_description($oVersion->sDescription)."\n"; + echo " ".$oVersion->sTestedRating."\n"; + echo " ".$oVersion->sTestedVersion."\n"; + echo " ".sizeof($oVersion->aCommentsIds)."\n"; + echo "\n\n"; + + $c++; + + } + echo "\n"; + echo html_frame_end("Click the Version Name to view the details of that Version"); + } } + /* code to View an application's Bugs */ $appId = $_REQUEST['appId']; diff --git a/include/comment.php b/include/comment.php index 3265d61..1a3958e 100644 --- a/include/comment.php +++ b/include/comment.php @@ -263,19 +263,6 @@ function grab_comments($versionId, $parentId = -1) } -/** - * grab comments for appId / versionId - * if parentId is not -1 only comments for that thread are returned - */ -function count_comments($versionId) -{ - $qstring = "SELECT count(commentId) as hits FROM appComments WHERE versionId = $versionId"; - $result = query_appdb($qstring); - $ob = mysql_fetch_object($result); - return $ob->hits; -} - - /** * display nested comments * handle is a db result set @@ -295,6 +282,7 @@ function do_display_comments_nested($handle) } } + function display_comments_nested($versionId, $threadId) { $result = grab_comments($versionId, $threadId);