',"\n";
@@ -523,76 +496,118 @@ class testData{
$oTableRowHeader->AddTextCell("Submitter");
$oTable->SetHeader($oTableRowHeader);
+ return $oTable;
+ }
+
+ /* Creates and returns a table row for a test result table */
+ function CreateTestTableRow($iCurrentId, $sLink)
+ {
+ $oVersion = new Version($this->iVersionId);
+ $oApp = new Application($oVersion->iAppId);
+ $oSubmitter = new User($this->iSubmitterId);
+ $oDistribution = new distribution($this->iDistributionId);
+ $bgcolor = $this->sTestedRating;
+
+ // initialize the array ech time we loop
+ $oTableRowClick = null;
+
+ $oTableRow = new TableRow();
+
+ /* if the test we are displaying is this test then */
+ /* mark it as the current test */
+ if ($this->iTestingId == $iCurrentId)
+ {
+ $sTRClass = $bgcolor;
+
+ $oTableCell = new TableCell("
Current");
+ $oTableCell->SetAlign("center");
+ } else /* make all non-current rows clickable so clicking on them selects the test as current */
+ {
+ $sTRClass = $bgcolor;
+
+ $oInactiveColor = new color();
+ $oInactiveColor->SetColorByName($this->sTestedRating);
+
+ $oHighlightColor = GetHighlightColorFromInactiveColor($oInactiveColor);
+
+ $oTableRowHighlight = new TableRowHighlight($oHighlightColor, $oInactiveColor);
+
+ $sUrl = $sLink.$this->iTestingId;
+
+ $oTableRowClick = new TableRowClick($sUrl);
+ $oTableRowClick->SetHighlight($oTableRowHighlight);
+
+ // add the table element indicating that the user can show the row by clicking on it
+ $oTableCell = new TableCell("Show");
+ $oTableCell->SetCellLink($sUrl);
+ $oTableCell->SetAlign("center");
+ }
+
+ $oTableRow->AddCell($oTableCell);
+ $oTableRow->SetClass($sTRClass);
+
+ $oTableRow->AddTextCell($oDistribution->objectMakeLink());
+ $oTableRow->AddTextCell(date("M d Y", mysqldatetime_to_unixtimestamp($this->sTestedDate)));
+ $oTableRow->AddTextCell($this->sTestedRelease.' ');
+ $oTableRow->AddTextCell($this->sInstalls.' ');
+ $oTableRow->AddTextCell($this->sRuns.' ');
+ $oTableRow->AddTextCell($this->sTestedRating.' ');
+ $oTableRow->AddTextCell($oSubmitter->objectMakeLink().' ');
+ if ($this->iTestingId && $_SESSION['current']->hasAppVersionModifyPermission($oVersion))
+ {
+ $oObject = new objectManager("testData");
+ $oTableRow->AddTextCell('
iTestingId,
+ "Edit Test Results").'">'.
+ 'Edit ',"\n".
+ '
Delete',"\n");
+ }
+
+ // if this is a clickable row, set the appropriate property
+ if($oTableRowClick)
+ $oTableRow->SetRowClick($oTableRowClick);
+
+ return $oTableRow;
+ }
+
+ // Show the Test results for a application version
+ function ShowVersionsTestingTable($sLink, $iDisplayLimit)
+ {
+ global $aClean;
+
+ /* escape input parameters */
+ $sLink = query_escape_string($sLink);
+ $iDisplayLimit = query_escape_string($iDisplayLimit);
+
+ $bShowAll = ($aClean['bShowAll'] == "true") ? true : false;
+
+ $sQuery = "SELECT *
+ FROM testResults
+ WHERE versionId = '?'
+ AND
+ queued = '?'
+ ORDER BY testedDate DESC";
+
+ if(!$bShowAll)
+ $sQuery.=" LIMIT 0,".$iDisplayLimit;
+
+ $hResult = query_parameters($sQuery, $this->iVersionId, "false");
+ if(!$hResult)
+ return;
+
+ $rowsUsed = query_num_rows($hResult);
+
+ if($rowsUsed == 0)
+ return;
+
+ $oTable = $this->CreateTestTable();
+
$iIndex = 0;
while($oRow = query_fetch_object($hResult))
{
$oTest = new testData($oRow->testingId);
- $oVersion = new Version($oTest->iVersionId);
- $oApp = new Application($oVersion->iAppId);
- $oSubmitter = new User($oTest->iSubmitterId);
- $oDistribution = new distribution($oTest->iDistributionId);
- $bgcolor = $oTest->sTestedRating;
-
- // initialize the array ech time we loop
- $oTableRowClick = null;
-
- $oTableRow = new TableRow();
-
- /* if the test we are displaying is this test then */
- /* mark it as the current test */
- if ($oTest->iTestingId == $this->iTestingId)
- {
- $sTRClass = $bgcolor;
-
- $oTableCell = new TableCell("
Current");
- $oTableCell->SetAlign("center");
- } else /* make all non-current rows clickable so clicking on them selects the test as current */
- {
- $sTRClass = $bgcolor;
-
- $oInactiveColor = new color();
- $oInactiveColor->SetColorByName($oTest->sTestedRating);
-
- $oHighlightColor = GetHighlightColorFromInactiveColor($oInactiveColor);
-
- $oTableRowHighlight = new TableRowHighlight($oHighlightColor, $oInactiveColor);
-
- $sUrl = $sLink.$oTest->iTestingId;
-
- $oTableRowClick = new TableRowClick($sUrl);
- $oTableRowClick->SetHighlight($oTableRowHighlight);
-
- // add the table element indicating that the user can show the row by clicking on it
- $oTableCell = new TableCell("Show");
- $oTableCell->SetCellLink($sUrl);
- $oTableCell->SetAlign("center");
- }
-
- $oTableRow->AddCell($oTableCell);
- $oTableRow->SetClass($sTRClass);
-
- $oTableRow->AddTextCell($oDistribution->objectMakeLink());
- $oTableRow->AddTextCell(date("M d Y", mysqldatetime_to_unixtimestamp($oTest->sTestedDate)));
- $oTableRow->AddTextCell($oTest->sTestedRelease.' ');
- $oTableRow->AddTextCell($oTest->sInstalls.' ');
- $oTableRow->AddTextCell($oTest->sRuns.' ');
- $oTableRow->AddTextCell($oTest->sTestedRating.' ');
- $oTableRow->AddTextCell($oSubmitter->objectMakeLink().' ');
- if ($_SESSION['current']->hasAppVersionModifyPermission($oVersion))
- {
- $oObject = new objectManager("testData");
- $oTableRow->AddTextCell('
iTestingId,
- "Edit Test Results").'">'.
- 'Edit ',"\n".
- '
Delete',"\n");
- }
-
- // if this is a clickable row, set the appropriate property
- if($oTableRowClick)
- $oTableRow->SetRowClick($oTableRowClick);
-
+ $oTableRow = $oTest->CreateTestTableRow($this->iTestingId, $sLink);
// add the row to the table
$oTable->AddRow($oTableRow);
@@ -1114,10 +1129,21 @@ class testData{
"you can submit it into the AppDB, reject it or delete it.\n";
}
+ function objectShowPreview()
+ {
+ return TRUE;
+ }
+
function display()
{
- /* STUB */
- return TRUE;
+ $this->ShowTestResult();
+ $this->iSubmitterId = $_SESSION['current']->iUserId;
+
+ $oTable = $this->CreateTestTable();
+
+ $oTable->AddRow($this->CreateTestTableRow($this->iTestingId, ""));
+
+ echo $oTable->GetString();
}
diff --git a/include/testData_queue.php b/include/testData_queue.php
index f6c7d02..190d19e 100644
--- a/include/testData_queue.php
+++ b/include/testData_queue.php
@@ -148,6 +148,11 @@ class testData_queue
$oTest->objectDisplayQueueProcessingHelp();
}
+ function objectShowPreview()
+ {
+ return $this->oTestData->objectShowPreview();
+ }
+
function display()
{
return $this->oTestData->display();