Allow moving test results to a different version
This commit is contained in:
committed by
Alexander Nicolaysen Sørnes
parent
1e1f1c971b
commit
5560eaaba3
@@ -923,7 +923,30 @@ class ObjectManager
|
||||
"color4");
|
||||
|
||||
$oParent = $oObject->objectGetParent();
|
||||
$oGrandFather = $oParent->objectGetParent();
|
||||
|
||||
if($oGrandFather)
|
||||
{
|
||||
$aParentSiblings = $oGrandFather->objectGetChildrenClassSpecific(get_class($oParent));
|
||||
|
||||
echo "Children of " . $oGrandFather->objectMakeLink() . " <br />";
|
||||
|
||||
$i = 0;
|
||||
foreach($aParentSiblings as $oCandidate)
|
||||
{
|
||||
if($oCandidate->objectGetState() != 'accepted')
|
||||
continue;
|
||||
|
||||
if($oCandidate->objectGetId() == $oParent->objectGetId())
|
||||
continue;
|
||||
|
||||
echo html_tr(array($oCandidate->objectMakeLink(),
|
||||
"<a href=\"".$this->makeUrl('changeParent', $this->iId). "&iNewId=".$oCandidate->objectGetId()."\">Move here</a>"),
|
||||
($i % 2) ? "color0" : "color1");
|
||||
$i++;
|
||||
}
|
||||
} else
|
||||
{
|
||||
/* We only allow moving to non-queued objects */
|
||||
if(!$hResult = $oParent->objectGetEntries('accepted'))
|
||||
{
|
||||
@@ -947,6 +970,7 @@ class ObjectManager
|
||||
"&iNewId=".$oCandidate->objectGetId()."\">Move here</a>"),
|
||||
($i % 2) ? "color0" : "color1");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
echo "</table>\n";
|
||||
@@ -1113,7 +1137,7 @@ class ObjectManager
|
||||
exit;
|
||||
}
|
||||
|
||||
private function displayChangeParent($oObject)
|
||||
private function displayChangeParent($oObject, $sLinkText = 'Move to another parent entry')
|
||||
{
|
||||
/* Display a link to the move child objects page if the class has the necessary
|
||||
functions and the user has edit rights. Not all classes have child objects. */
|
||||
@@ -1121,7 +1145,7 @@ class ObjectManager
|
||||
method_exists($oObject, "objectGetId") && $oObject->canEdit())
|
||||
{
|
||||
echo "<a href=\"".$this->makeUrl("showChangeParent", $this->iId,
|
||||
"Move to another parent entry")."\">Move to another parent entry</a>\n";
|
||||
"Move to another parent entry")."\">$sLinkText</a>\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -621,6 +621,7 @@ class testData{
|
||||
$oTableRow->AddTextCell('<a href="'.$oObject->makeUrl('edit', $this->iTestingId,
|
||||
'Edit Test Results').'&sReturnTo='.urlencode($_SERVER['REQUEST_URI']).'">'.
|
||||
'Edit</a> '."\n".
|
||||
'<a href="'.$oObject->makeUrl('showChangeParent', $this->iTestingId, 'Move test report to another version').'&sReturnTo='.urlencode($_SERVER['REQUEST_URI']).'">Move</a>'."\n".
|
||||
'<a href="'.$oObject->makeUrl('delete', $this->iTestingId, 'Delete+Test+Results').
|
||||
'&sReturnTo='.urlencode($_SERVER['REQUEST_URI']).'">Delete</a></td>'."\n");
|
||||
}
|
||||
@@ -1400,8 +1401,8 @@ class testData{
|
||||
|
||||
function objectMakeLink()
|
||||
{
|
||||
/* STUB */
|
||||
return TRUE;
|
||||
$oObject = new objectManager("testData", "Edit Test Results", $this->iTestingId);
|
||||
return '<a href="'.$oObject->makeUrl("edit", $this->iTestingId).'">test report</a>';
|
||||
}
|
||||
|
||||
public function isOld()
|
||||
@@ -1413,6 +1414,11 @@ class testData{
|
||||
return ((mktime() - mysqltimestamp_to_unixtimestamp($this->sSubmitTime)) > (60 * 60 * 24 * 175));
|
||||
}
|
||||
|
||||
public function objectSetParent($iNewId, $sClass = 'version')
|
||||
{
|
||||
$this->iVersionId = $iNewId;
|
||||
}
|
||||
|
||||
function objectGetParent()
|
||||
{
|
||||
return new version($this->iVersionId);
|
||||
|
||||
Reference in New Issue
Block a user