Compact the top 'X' lists on the main page by adding a flag to get_screenshot_img() that disables the output of

html that was putting the image inside of another table
This commit is contained in:
Chris Morgan
2006-06-22 21:41:41 +00:00
committed by WineHQ
parent 2076ff9efc
commit b55c2776a5
2 changed files with 19 additions and 7 deletions

View File

@@ -303,8 +303,10 @@ class Screenshot {
/** /**
* Get a random image for a particular version of an app. * Get a random image for a particular version of an app.
* If the version is not set, get a random app image * If the version is not set, get a random app image
*
* $bFormatting == false turns off all extranious formatting applied to the returned image html
*/ */
function get_screenshot_img($iAppId = null, $iVersionId = null) function get_screenshot_img($iAppId = null, $iVersionId = null, $bFormatting = true)
{ {
// we want a random screenshots for this app // we want a random screenshots for this app
if($iAppId && !$iVersionId) if($iAppId && !$iVersionId)
@@ -325,16 +327,24 @@ function get_screenshot_img($iAppId = null, $iVersionId = null)
AND queued = 'false' AND queued = 'false'
ORDER BY rand"); ORDER BY rand");
} }
if($bFormatting)
$sImgFile .= '<center>';
if(!$hResult || !mysql_num_rows($hResult)) if(!$hResult || !mysql_num_rows($hResult))
{ {
$sImgFile = '<center><img src="images/no_screenshot.png" alt="No Screenshot" /></center>'; $sImgFile = '<img src="images/no_screenshot.png" alt="No Screenshot" />';
} else } else
{ {
$oRow = mysql_fetch_object($hResult); $oRow = mysql_fetch_object($hResult);
$sImgFile = '<center><img src="appimage.php?thumbnail=true&amp;id='.$oRow->id.'" alt="'.$oRow->description.'" /></center>'; $sImgFile = '<img src="appimage.php?thumbnail=true&amp;id='.$oRow->id.'" alt="'.$oRow->description.'" />';
} }
if($bFormatting)
$sImgFile .= '</center>';
$sImg = html_frame_start("",'128','',2); if($bFormatting)
$sImg = html_frame_start("",'128','',2);
/* we have screenshots */ /* we have screenshots */
if(mysql_num_rows($hResult)) if(mysql_num_rows($hResult))
@@ -350,7 +360,9 @@ function get_screenshot_img($iAppId = null, $iVersionId = null)
{ {
$sImg .= $sImgFile; $sImg .= $sImgFile;
} }
$sImg .= html_frame_end()."<br />";
if($bFormatting)
$sImg .= html_frame_end()."<br />";
return $sImg; return $sImg;
} }

View File

@@ -266,12 +266,12 @@ function outputTopXRow($oRow)
{ {
$oVersion = new Version($oRow->versionId); $oVersion = new Version($oRow->versionId);
$oApp = new Application($oVersion->iAppId); $oApp = new Application($oVersion->iAppId);
$img = get_screenshot_img(null, $oRow->versionId); // image $img = get_screenshot_img(null, $oRow->versionId, false); // image, disable extra formatting
echo ' echo '
<tr class="white"> <tr class="white">
<td><a href="appview.php?versionId='.$oRow->versionId.'">'.$oApp->sName.' '.$oVersion->sName.'</a></td> <td><a href="appview.php?versionId='.$oRow->versionId.'">'.$oApp->sName.' '.$oVersion->sName.'</a></td>
<td>'.trim_description($oApp->sDescription).'</td> <td>'.trim_description($oApp->sDescription).'</td>
<td>'.$img.'</td> <td><center>'.$img.'</center></td>
</tr>'; </tr>';
} }