appdb/ ./appview.php include/testResults.php

WineHQ wineowner at wine.codeweavers.com
Sat Jan 28 16:53:28 CST 2006


ChangeSet ID:	22581
CVSROOT:	/opt/cvs-commit
Module name:	appdb
Changes by:	wineowner at winehq.org	2006/01/28 16:53:28

Modified files:
	.              : appview.php 
	include        : testResults.php 

Log message:
	Jason Weisberger <jbdubbs at gmail.com>
	Allow the user to limit or show all of the testing results for a particular version

Patch: http://cvs.winehq.org/patch.py?id=22581

Old revision  New revision  Changes     Path
 1.77          1.78          +4 -1       appdb/appview.php
 1.8           1.9           +41 -9      appdb/include/testResults.php

Index: appdb/appview.php
diff -u -p appdb/appview.php:1.77 appdb/appview.php:1.78
--- appdb/appview.php:1.77	28 Jan 2006 22:53:28 -0000
+++ appdb/appview.php	28 Jan 2006 22:53:28 -0000
@@ -524,7 +524,10 @@ else if($_REQUEST['versionId'])
     $oTest = new TestData($_REQUEST['iTestingId']);
     $iCurrentTest = $oTest->ShowTestResult($oTest->iTestingId,$oVersion->iVersionId);
     if($iCurrentTest)
-        $oTest->ShowVersionsTestingTable($oVersion->iVersionId,$iCurrentTest,$_SERVER['PHP_SELF']."?versionId=".$oVersion->iVersionId."&iTestingId=");
+        $oTest->ShowVersionsTestingTable($oVersion->iVersionId,
+                                         $iCurrentTest,
+                                         $_SERVER['PHP_SELF']."?versionId=".$oVersion->iVersionId."&iTestingId=",
+                                         5);
     echo '<form method=post name=message action=testResults.php?sub=view&iVersionId='.$oVersion->iVersionId.'>';
     echo '<input type=submit value="Add Testing Data" class="button" />';
     echo '</form>';
Index: appdb/include/testResults.php
diff -u -p appdb/include/testResults.php:1.8 appdb/include/testResults.php:1.9
--- appdb/include/testResults.php:1.8	28 Jan 2006 22:53:28 -0000
+++ appdb/include/testResults.php	28 Jan 2006 22:53:28 -0000
@@ -347,13 +347,25 @@ class testData{
     }
 
     // Show the Test results for a application version
-    function ShowVersionsTestingTable($iVersionId, $iCurrentTest, $link)
+    function ShowVersionsTestingTable($iVersionId, $iCurrentTest, $link, $iDisplayLimit)
     {
-        $hResult = query_appdb("SELECT * 
-                                FROM testResults
-                                WHERE versionId = '".$iVersionId."'
-                                ORDER BY testedDate DESC;");
-        if(!$hResult || mysql_num_rows($hResult) == 0)
+        $showAll = $_REQUEST['showAll'];
+
+        $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($rowsUsed == 0)
              return;
         echo '<p><span class="title">Testing Results</span><br />',"\n";
         echo '<table width="100%" border="1" class="historyTable">',"\n";
@@ -376,10 +388,20 @@ class testData{
             $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
-                echo '    <td align="center" class="color2">[<a href="'.$link.$oTest->iTestingId.'">Show</a>]</td>',"\n";
+            } 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";
+            }
+
             echo '    <td>',"\n";
             echo '<a href="'.BASE.'distributionView.php?iDistributionId='.$oTest->iDistributionId.'">',"\n";
             echo $oDistribution->sName.'</a>',"\n";
@@ -393,9 +415,19 @@ class testData{
         }
 
         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" />';
+
+        if(is_string($showAll))
+        {
+            echo '<input class="button" name="hideAll" type=submit value="Limit to '.$iDisplayLimit.' Tests" />';
+        }
+        echo '</form>';
     }
+
     // show the fields for editing
     function OutputEditor($sDistribution, $bNewDist=false)
     {



More information about the wine-cvs mailing list