ChangeSet ID: 31044 CVSROOT: /opt/cvs-commit Module name: appdb Changes by: wineowner@winehq.org 2007/04/16 18:10:08
Modified files: include : distribution.php testData.php version.php Added files: include : testData_queue.php
Log message: Alexander Nicolaysen Sørnes alex@thehandofagony.com Use objectManager for new test results
Patch: http://cvs.winehq.org/patch.py?id=31044
Old revision New revision Changes Path 1.21 1.22 +7 -3 appdb/include/distribution.php 1.38 1.39 +18 -18 appdb/include/testData.php 1.114 1.115 +3 -1 appdb/include/version.php Added 1.1 +0 -0 appdb/include/testData_queue.php
Index: appdb/include/distribution.php diff -u -p appdb/include/distribution.php:1.21 appdb/include/distribution.php:1.22 --- appdb/include/distribution.php:1.21 16 Apr 2007 23:10: 8 -0000 +++ appdb/include/distribution.php 16 Apr 2007 23:10: 8 -0000 @@ -347,12 +347,16 @@ class distribution {
// Name echo '<tr valign=top><td class="color1" width="20%"><b>Distribution Name</b></td>',"\n"; - echo '<td class="color0"><input type=text name="sName" value="'.$this->sName.'" size="50"></td></tr>',"\n"; + echo '<td class="color0"><input type=text name="sDistribution" value="'.$this->sName.'" size="50"></td></tr>',"\n"; // Url echo '<tr valign=top><td class="color1"><b>Distribution Url</b></td>',"\n"; echo '<td class="color0"><input type=text name="sUrl" value="'.$this->sUrl.'" size="50"></td></tr>',"\n";
- echo '<input type="hidden" name="iDistributionId" value="'.$this->iDistributionId.'">',"\n"; + if($this->iDistributionId) + { + echo '<input type="hidden" name="iDistributionId" '. + 'value="'.$this->iDistributionId.'">',"\n"; + }
echo "</table>\n"; } @@ -362,7 +366,7 @@ class distribution { function GetOutputEditorValues($aValues) { $this->iDistributionId = $aValues['iDistributionId']; - $this->sName = $aValues['sName']; + $this->sName = $aValues['sDistribution']; $this->sUrl = $aValues['sUrl']; }
Index: appdb/include/testData.php diff -u -p appdb/include/testData.php:1.38 appdb/include/testData.php:1.39 --- appdb/include/testData.php:1.38 16 Apr 2007 23:10: 8 -0000 +++ appdb/include/testData.php 16 Apr 2007 23:10: 8 -0000 @@ -63,15 +63,6 @@ class testData{ // Creates a new Test Results. function create() { - // Security, if we are not an administrator or a maintainer the test result must be queued. - $oVersion = new Version($this->iVersionId); - if(!$_SESSION['current']->hasPriv("admin") && - !$_SESSION['current']->hasAppVersionModifyPermission($oVersion)) - $this->sQueued = 'true'; - else - $this->sQueued = 'false'; - - $hResult = query_parameters("INSERT INTO testResults (versionId, whatWorks, whatDoesnt,". "whatNotTested, testedDate, distributionId, testedRelease,". "installs, runs, testedRating, comments, submitterId, queued)". @@ -80,8 +71,9 @@ class testData{ $this->iVersionId, $this->shWhatWorks, $this->shWhatDoesnt, $this->shWhatNotTested, $this->sTestedDate, $this->iDistributionId, $this->sTestedRelease, $this->sInstalls, $this->sRuns, - $this->sTestedRating, $this->sComments, $_SESSION['current']->iUserId, - $this->sQueued); + $this->sTestedRating, $this->sComments, + $_SESSION['current']->iUserId, + $this->canEdit() ? "false" : "true"); if($hResult) { $this->iTestingId = mysql_insert_id(); @@ -489,8 +481,16 @@ class testData{ }
// show the fields for editing - function outputEditor($sDistribution="", $bNewDist=false) + function outputEditor() { + global $aClean; + + /* Fill in some values */ + if(!$this->iVersionId) + $this->iVersionId = $aClean['iVersionId']; + if(!$this->sTestedDate) + $this->sTestedDate = date('Y-m-d H:i:s'); + HtmlAreaLoaderScript(array("Test1", "Test2", "Test3"));
$sName = version::fullName($this->iVersionId); @@ -516,11 +516,11 @@ class testData{ echo '<tr valign=top><td class="color1"></td><td class="color0"><p/>YYYY-MM-DD HH:MM:SS</td></tr>',"\n"; // Distribution echo '<tr valign=top><td class="color0"><b>Distribution</b></td class="color0">',"\n"; - if ($bNewDist) - { - echo '<td class="color0"><input type=text name="sDistribution" value="'.$sDistribution.'" size="20"></td></tr>',"\n"; - echo '<tr><td class=color0><b></b></td>',"\n"; - } + + echo '<td class="color0">If yours is not on the list, please add it using the form '. + 'below</td></tr>',"\n"; + echo '<tr><td class=color0><b></b></td>',"\n"; + echo '<td class=color0>',"\n"; distribution::make_distribution_list("iDistributionId", $this->iDistributionId); echo '</td></tr>',"\n"; @@ -823,7 +823,7 @@ class testData{ { if($_SESSION['current']->hasPriv("admin")) return TRUE; - else if($this->iTestingId) + else if($this->iVersionId) { $oVersion = new version($this->iVersionId); if($_SESSION['current']->hasAppVersionModifyPermission($oVersion)) Index: appdb/include/version.php diff -u -p appdb/include/version.php:1.114 appdb/include/version.php:1.115 --- appdb/include/version.php:1.114 16 Apr 2007 23:10: 8 -0000 +++ appdb/include/version.php 16 Apr 2007 23:10: 8 -0000 @@ -897,7 +897,9 @@ class Version { } if($_SESSION['current']->isLoggedIn()) { - echo '<form method=post name=sMessage action=testResults.php?sSub=view&iVersionId='.$this->iVersionId.'>'; + echo '<form method=post name=sMessage action=objectManager.php?'. + 'sClass=testData_queue&sAction=add&iVersionId='.$this->iVersionId. + '&sTitle=Add+Test+Data>'; echo '<input type=submit value="Add Test Data" class="button" />'; echo '</form>'; } else Index: appdb/include/testData_queue.php diff -u -p /dev/null appdb/include/testData_queue.php:1.1 --- /dev/null 16 Apr 2007 23:10: 8 -0000 +++ appdb/include/testData_queue.php 16 Apr 2007 23:10: 8 -0000 @@ -0,0 +1,62 @@ +<?php + +class testData_queue +{ + var $oTestData; + var $oDistribution; + + function testData_queue($iTestId = null) + { + $this->oTestData = new testData($iTestId); + $this->oDistribution = new distribution($this->oTestData->iDistributionId); + } + + function create() + { + if(!$this->oTestData->iDistributionId) + { + $this->oDistribution->create(); + $this->oTestData->iDistributionId = $this->oDistribution->iDistributionId; + } + $this->oTestData->create(); + } + + function update() + { + $this->oTestData->update(); + $this->oDistribution->update(); + } + + function outputEditor() + { + $this->oTestData->outputEditor(); + + /* If the testData is already associated with a distribution and the distribution is + un-queued, there is no need to display the distribution form here */ + if(!$this->oTestData->iDistributionId or $this->oDistributionId->sQueued != "false") + $this->oDistribution->outputEditor(); + } + + function getOutputEditorValues($aClean) + { + $this->oTestData->getOutputEditorValues($aClean); + $this->oDistribution->getOutputEditorValues($aClean); + } + + function checkOutputEditorInput($aClean) + { + return $this->oTestData->checkOutputEditorInput($aClean); + } + + function canEdit() + { + return $this->oTestData->canEdit(); + } + + function objectDisplayAddItemHelp() + { + $this->oTestData->objectDisplayAddItemHelp(); + } +} + +?>