ChangeSet ID: 25977 CVSROOT: /opt/cvs-commit Module name: appdb Changes by: wineowner@winehq.org 2006/06/22 16:41:41
Modified files: include : screenshot.php util.php
Log message: Chris Morgan cmorgan@alum.wpi.edu 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
Patch: http://cvs.winehq.org/patch.py?id=25977
Old revision New revision Changes Path 1.35 1.36 +17 -5 appdb/include/screenshot.php 1.55 1.56 +2 -2 appdb/include/util.php
Index: appdb/include/screenshot.php diff -u -p appdb/include/screenshot.php:1.35 appdb/include/screenshot.php:1.36 --- appdb/include/screenshot.php:1.35 22 Jun 2006 21:41:41 -0000 +++ appdb/include/screenshot.php 22 Jun 2006 21:41:41 -0000 @@ -303,8 +303,10 @@ class Screenshot { /** * Get a random image for a particular version of an app. * 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 if($iAppId && !$iVersionId) @@ -325,16 +327,24 @@ function get_screenshot_img($iAppId = nu AND queued = 'false' ORDER BY rand"); } + + if($bFormatting) + $sImgFile .= '<center>'; + 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 { $oRow = mysql_fetch_object($hResult); - $sImgFile = '<center><img src="appimage.php?thumbnail=true&id='.$oRow->id.'" alt="'.$oRow->description.'" /></center>'; + $sImgFile = '<img src="appimage.php?thumbnail=true&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 */ if(mysql_num_rows($hResult)) @@ -350,7 +360,9 @@ function get_screenshot_img($iAppId = nu { $sImg .= $sImgFile; } - $sImg .= html_frame_end()."<br />"; + + if($bFormatting) + $sImg .= html_frame_end()."<br />";
return $sImg; } Index: appdb/include/util.php diff -u -p appdb/include/util.php:1.55 appdb/include/util.php:1.56 --- appdb/include/util.php:1.55 22 Jun 2006 21:41:41 -0000 +++ appdb/include/util.php 22 Jun 2006 21:41:41 -0000 @@ -266,12 +266,12 @@ function outputTopXRow($oRow) { $oVersion = new Version($oRow->versionId); $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 ' <tr class="white"> <td><a href="appview.php?versionId='.$oRow->versionId.'">'.$oApp->sName.' '.$oVersion->sName.'</a></td> <td>'.trim_description($oApp->sDescription).'</td> - <td>'.$img.'</td> + <td><center>'.$img.'</center></td> </tr>'; }