iDisplay Limit User Variable
Jason Weisberger
jbdubbs at gmail.com
Tue Feb 7 12:27:45 CST 2006
Skipped content of type multipart/alternative-------------- next part --------------
Index: appdb/include/testResults.php
===================================================================
RCS file: /home/wine/appdb/include/testResults.php,v
retrieving revision 1.9
diff -u -r1.9 testResults.php
--- appdb/include/testResults.php 28 Jan 2006 22:53:28 -0000 1.9
+++ appdb/include/testResults.php 7 Feb 2006 18:23:52 -0000
@@ -349,23 +349,25 @@
// Show the Test results for a application version
function ShowVersionsTestingTable($iVersionId, $iCurrentTest, $link, $iDisplayLimit)
{
- $showAll = $_REQUEST['showAll'];
+ $iDisplayLimit = $_REQUEST['iDisplayLimit'];
+
+ if(!$iDisplayLimit) {
+ $iDisplayLimit = 5;
+ }
- $sQuery = "SELECT *
+ $sQuery = "SELECT *
FROM testResults
WHERE versionId = '".$iVersionId."'
ORDER BY testedDate DESC";
-
- if(!$showAll)
- $sQuery.=" LIMIT 0,".$iDisplayLimit;
-
- $hResult = query_appdb($sQuery);
- if(!$hResult)
- return;
-
- $rowsUsed = mysql_num_rows($hResult);
+ if($iDisplayLimit !== "ALL") {
+ $sQuery.=" LIMIT 0,".$iDisplayLimit;
+ }
+ $sQuery.=";";
+
+ $hResult = query_appdb($sQuery);
+ $rowsUsed = mysql_num_rows($hResult);
- if($rowsUsed == 0)
+ if(!$hResult || $rowsUsed == 0)
return;
echo '<p><span class="title">Testing Results</span><br />',"\n";
echo '<table width="100%" border="1" class="historyTable">',"\n";
@@ -388,20 +390,12 @@
$oDistribution = new distribution($oTest->iDistributionId);
$bgcolor = $oTest->sTestedRating;
echo '<tr class='.$bgcolor.'>',"\n";
-
if ($oTest->iTestingId == $iCurrentTest)
- {
echo ' <td align="center" class="color2"><b>Current</b></td>',"\n";
- } else
- {
+ else
echo ' <td align="center" class="color2">[<a href="'.$link.$oTest->iTestingId;
-
- if(is_string($showAll))
- echo '&showAll='.$showAll.'">Show</a>]</td>',"\n";
- else
- echo '">Show</a>]</td>',"\n";
- }
-
+ if($iDisplayLimit) echo '&iDisplayLimit='.$iDisplayLimit.'">Show</a>]</td>',"\n";
+ else echo '">Show</a>]</td>',"\n";
echo ' <td>',"\n";
echo '<a href="'.BASE.'distributionView.php?iDistributionId='.$oTest->iDistributionId.'">',"\n";
echo $oDistribution->sName.'</a>',"\n";
@@ -416,16 +410,21 @@
echo '</table>',"\n";
- echo '<form method=get action="'.$PHP_SELF.'">';
- echo '<input name="versionId" type=hidden value="',$iVersionId,'" />';
- if($rowsUsed >= $iDisplayLimit && !is_string($showAll))
- echo '<input class="button" name="showAll" type=submit value="Show All Tests" />';
+ echo '<form method=get action="'.$PHP_SELF.'">';
+ echo '<input name="versionId" type=hidden value="',$iVersionId,'" />';
+ if($rowsUsed >= 5) {
+ echo 'Tests:<select name="iDisplayLimit">';
+ echo '<option value="5"'; if($iDisplayLimit == 5) { echo ' selected="selected"';} echo '>5</option>';
+ echo '<option value="10"'; if($iDisplayLimit == 10) { echo ' selected="selected"';} echo '>10</option>';
+ echo '<option value="15"'; if($iDisplayLimit == 15) { echo ' selected="selected"';} echo '>15</option>';
+ echo '<option value="20"'; if($iDisplayLimit == 20) { echo ' selected="selected"';} echo '>20</option>';
+ echo '<option value="ALL"'; if($iDisplayLimit == "ALL") { echo ' selected="selected"';} echo '>ALL</option>';
+ echo '</select>';
+ echo '<input type="submit" name="Submit" value="Go!" />';
+ }
+ echo '</form>';
+
- if(is_string($showAll))
- {
- echo '<input class="button" name="hideAll" type=submit value="Limit to '.$iDisplayLimit.' Tests" />';
- }
- echo '</form>';
}
// show the fields for editing
More information about the wine-patches
mailing list