appdb/ ./distributionView.php include/distribu ...

WineHQ wineowner at wine.codeweavers.com
Tue Jan 30 20:18:18 CST 2007


ChangeSet ID:	30919
CVSROOT:	/opt/cvs-commit
Module name:	appdb
Changes by:	wineowner at winehq.org	2007/01/30 20:18:18

Modified files:
	.              : distributionView.php 
	include        : distribution.php 

Log message:
	Alexander Nicolaysen Sørnes <alex at thehandofagony.com>
	Add and use distribution::display()

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

Old revision  New revision  Changes     Path
 1.24          1.25          +2 -73      appdb/distributionView.php
 1.9           1.10          +77 -1      appdb/include/distribution.php

Index: appdb/distributionView.php
diff -u -p appdb/distributionView.php:1.24 appdb/distributionView.php:1.25
--- appdb/distributionView.php:1.24	31 Jan 2007  2:18:18 -0000
+++ appdb/distributionView.php	31 Jan 2007  2:18:18 -0000
@@ -43,7 +43,7 @@ if(!$oDistribution->iDistributionId) 
     {
         $oDistribution = distribution::ObjectGetInstanceFromRow($oRow);
 
-        $oDistribution->display(($c % 2) ? "color0" : "color1");
+        $oDistribution->objectOutputTableRow(($c % 2) ? "color0" : "color1");
     }
     echo "</table>\n\n";
     echo html_frame_end("&nbsp;");
@@ -57,78 +57,7 @@ else
     apidb_header("View Distribution");
     echo html_frame_start("Distribution Information",500);
 
-    echo "Distribution Name:";
-
-    if($oDistribution->sUrl)
-        echo "<a href='".$oDistribution->sUrl."'>";
-
-    echo $oDistribution->sName;
-
-    if ($oDistribution->sUrl) 
-    {
-        echo " (".$oDistribution->sUrl.")";
-        echo "</a> <br />\n";
-    } else 
-    {
-        echo "<br />\n";
-    }
-
-    if($oDistribution->aTestingIds)
-    {
-        echo '<p><span class="title">Testing Results for '.$oDistribution->sName.'</span><br />',"\n";
-        echo '<table width="100%" border="1">',"\n";
-        echo '<thead class="historyHeader">',"\n";
-        echo '<tr>',"\n";
-        echo '<td>Application Version</td>',"\n";
-        echo '<td>Submitter</td>',"\n";
-        echo '<td>Date Submitted</td>',"\n";
-        echo '<td>Wine version</td>',"\n";
-        echo '<td>Installs?</td>',"\n";
-        echo '<td>Runs?</td>',"\n";
-        echo '<td>Rating</td>',"\n";
-        echo '</tr></thead>',"\n";
-        foreach($oDistribution->aTestingIds as $iTestingId)
-        {
-            $oTest = new testData($iTestingId);
-            $oVersion = new Version($oTest->iVersionId);
-            $oApp  = new Application($oVersion->iAppId);
-            $oSubmitter = new User($oTest->iSubmitterId);
-            $bgcolor = $oTest->sTestedRating;
-
-            /* make sure the user can view the versions we list in the table */
-            /* otherwise skip over displaying the entries in this table */
-            if(!$_SESSION[current]->canViewApplication($oApp))
-                continue;
-            if(!$_SESSION[current]->canViewVersion($oVersion))
-                continue;
-
-            echo '<tr class='.$bgcolor.'>',"\n";
-            echo '<td><a href="'.BASE.'appview.php?iVersionId='.$oTest->iVersionId.'&iTestingId='.$oTest->iTestingId.'">',"\n";
-            echo $oApp->sName.' '.$oVersion->sName.'</a></td>',"\n";
-            echo '<td>',"\n";
-            if($_SESSION['current']->isLoggedIn())
-            {
-                echo $oSubmitter->sEmail ? "<a href=\"mailto:".$oSubmitter->sEmail."\">":"";
-                echo $oSubmitter->sRealname;
-                echo $oSubmitter->sEmail ? "</a>":"";
-            }
-            else
-                echo $oSubmitter->sRealname;
-            echo '</td>',"\n";
-            echo '<td>'.date("M d Y", mysqltimestamp_to_unixtimestamp($oTest->sSubmitTime)).'</td>',"\n";
-            echo '<td>'.$oTest->sTestedRelease.'&nbsp</td>',"\n";
-            echo '<td>'.$oTest->sInstalls.'&nbsp</td>',"\n";
-            echo '<td>'.$oTest->sRuns.'&nbsp</td>',"\n";
-            echo '<td>'.$oTest->sTestedRating.'&nbsp</td>',"\n";
-            if ($_SESSION['current']->hasAppVersionModifyPermission($oVersion))
-            {
-                echo '<td><a href="'.BASE.'admin/adminTestResults.php?sSub=view&iTestingId='.$oTest->iTestingId.'">',"\n";
-                echo 'Edit</a></td>',"\n";
-            }
-            echo '</tr>',"\n";
-        }
-        echo '</table>',"\n";
-    }
+    $oDistribution->display();
 
     echo html_frame_end();
     echo html_back_link(1);
Index: appdb/include/distribution.php
diff -u -p appdb/include/distribution.php:1.9 appdb/include/distribution.php:1.10
--- appdb/include/distribution.php:1.9	31 Jan 2007  2:18:18 -0000
+++ appdb/include/distribution.php	31 Jan 2007  2:18:18 -0000
@@ -464,7 +464,7 @@ class distribution {
         return new distribution($oRow->distributionId);
     }
 
-    function display($sClass = "")
+    function objectOutputTableRow($sClass = "")
     {
         $aCells = array(
              "<a href=\"".BASE."distributionView.php?iDistributionId=".
@@ -496,6 +496,82 @@ class distribution {
 
         return FALSE;
     }
+
+    function display()
+    {
+        echo "Distribution Name:";
+
+        if($this->sUrl)
+            echo "<a href='".$this->sUrl."'>";
+
+        echo $this->sName;
+
+        if ($this->sUrl) 
+        {
+            echo " (".$this->sUrl.")";
+            echo "</a> <br />\n";
+        } else 
+        {
+            echo "<br />\n";
+        }
+
+        if($this->aTestingIds)
+        {
+            echo '<p><span class="title">Testing Results for '.$this->sName.'</span><br />',"\n";
+            echo '<table width="100%" border="1">',"\n";
+            echo '<thead class="historyHeader">',"\n";
+            echo '<tr>',"\n";
+            echo '<td>Application Version</td>',"\n";
+            echo '<td>Submitter</td>',"\n";
+            echo '<td>Date Submitted</td>',"\n";
+            echo '<td>Wine version</td>',"\n";
+            echo '<td>Installs?</td>',"\n";
+            echo '<td>Runs?</td>',"\n";
+            echo '<td>Rating</td>',"\n";
+            echo '</tr></thead>',"\n";
+            foreach($this->aTestingIds as $iTestingId)
+            {
+                $oTest = new testData($iTestingId);
+                $oVersion = new Version($oTest->iVersionId);
+                $oApp  = new Application($oVersion->iAppId);
+                $oSubmitter = new User($oTest->iSubmitterId);
+                $bgcolor = $oTest->sTestedRating;
+
+                /* make sure the user can view the versions we list in the table */
+                /* otherwise skip over displaying the entries in this table */
+                if(!$_SESSION[current]->canViewApplication($oApp))
+                    continue;
+                if(!$_SESSION[current]->canViewVersion($oVersion))
+                    continue;
+
+                echo '<tr class='.$bgcolor.'>',"\n";
+                echo '<td><a href="'.BASE.'appview.php?iVersionId='.$oTest->iVersionId.'&iTestingId='.$oTest->iTestingId.'">',"\n";
+                echo $oApp->sName.' '.$oVersion->sName.'</a></td>',"\n";
+                echo '<td>',"\n";
+                if($_SESSION['current']->isLoggedIn())
+                {
+                    echo $oSubmitter->sEmail ? "<a href=\"mailto:".$oSubmitter->sEmail."\">":"";
+                    echo $oSubmitter->sRealname;
+                    echo $oSubmitter->sEmail ? "</a>":"";
+                }
+                else
+                    echo $oSubmitter->sRealname;
+                echo '</td>',"\n";
+                echo '<td>'.date("M d Y", mysqltimestamp_to_unixtimestamp($oTest->sSubmitTime)).'</td>',"\n";
+                echo '<td>'.$oTest->sTestedRelease.'&nbsp</td>',"\n";
+                echo '<td>'.$oTest->sInstalls.'&nbsp</td>',"\n";
+                echo '<td>'.$oTest->sRuns.'&nbsp</td>',"\n";
+                echo '<td>'.$oTest->sTestedRating.'&nbsp</td>',"\n";
+                if ($_SESSION['current']->hasAppVersionModifyPermission($oVersion))
+                {
+                    echo '<td><a href="'.BASE.'admin/adminTestResults.php?sSub=view&iTestingId='.$oTest->iTestingId.'">',"\n";
+                    echo 'Edit</a></td>',"\n";
+                }
+                echo '</tr>',"\n";
+            }
+            echo '</table>',"\n";
+        }
+    }
 }
 
 ?>



More information about the wine-cvs mailing list