- show correct number of comment

- remove unused function
This commit is contained in:
Jonathan Ernst
2005-02-09 23:48:01 +00:00
committed by WineHQ
parent b9b278e14b
commit ac052e6c84
3 changed files with 43 additions and 67 deletions

View File

@@ -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 "<tr class=$bgcolor>\n";
echo " <td><a href=\"appview.php?versionId=".$iVersionId."\">".$oVersion->sName."</a></td>\n";
echo " <td>$desc &nbsp;</td>\n";
echo " <td>".trim_description($oVersion->sDescription)."</td>\n";
echo " <td align=center>".$oVersion->sTestedRating."</td>\n";
echo " <td align=center>".$oVersion->sTestedVersion."</td>\n";
echo " <td align=center>$r_count</td>\n";
echo " <td align=center>".sizeof($oVersion->aCommentsIds)."</td>\n";
echo "</tr>\n\n";
$c++;

View File

@@ -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 "<table width='100%' border=0 cellpadding=3 cellspacing=1>\n\n";
echo "<tr class=color4>\n";
echo " <td><font color=white>Application Name</font></td>\n";
echo " <td><font color=white>Description</font></td>\n";
echo " <td>Application Name</td>\n";
echo " <td>Description</td>\n";
echo "</tr>\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 "<table width='100%' border=0 cellpadding=3 cellspacing=1>\n\n";
if ($aVersionsIds)
{
echo html_frame_start("","98%","",0);
echo "<table width='100%' border=0 cellpadding=3 cellspacing=1>\n\n";
echo "<tr class=color4>\n";
echo " <td width=80><font color=white>Version</font></td>\n";
echo " <td><font color=white>Description</font></td>\n";
echo " <td width=80><font color=white class=small>Rating With Windows</font></td>\n";
echo " <td width=80><font color=white class=small>Rating Without Windows</font></td>\n";
echo " <td width=40><font color=white class=small>Comments</font></td>\n";
echo "</tr>\n\n";
$c = 0;
while(list($idx, $ver) = each($versions))
{
//set row color
$bgcolor = (($c % 2) ? "color0" : "color1");
echo "<tr class=color4>\n";
echo " <td width=80>Version</td>\n";
echo " <td>Description</td>\n";
echo " <td width=80>Rating</td>\n";
echo " <td width=80>Wine version</td>\n";
echo " <td width=40>Comments</td>\n";
echo "</tr>\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 "<tr class=$bgcolor>\n";
echo " <td><a href='appview.php?appId=$appId&versionId=$ver->versionId'>".$ver->versionName."</a></td>\n";
echo " <td>$desc &nbsp;</td>\n";
echo " <td align=center>$r_win</td>\n";
echo " <td align=center>$r_fake</td>\n";
echo " <td align=center>$r_count</td>\n";
echo "</tr>\n\n";
// set row color
$bgcolor = ($c % 2 == 0) ? "color0" : "color1";
$c++;
}
echo "</table>\n";
echo html_frame_end("Click the Version Name to view the details of that Version");
}
//display row
echo "<tr class=$bgcolor>\n";
echo " <td><a href=\"appview.php?versionId=".$iVersionId."\">".$oVersion->sName."</a></td>\n";
echo " <td>".trim_description($oVersion->sDescription)."</td>\n";
echo " <td align=center>".$oVersion->sTestedRating."</td>\n";
echo " <td align=center>".$oVersion->sTestedVersion."</td>\n";
echo " <td align=center>".sizeof($oVersion->aCommentsIds)."</td>\n";
echo "</tr>\n\n";
$c++;
}
echo "</table>\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'];

View File

@@ -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);