Allow moving test results to a different version
This commit is contained in:
committed by
Alexander Nicolaysen Sørnes
parent
1e1f1c971b
commit
5560eaaba3
@@ -923,29 +923,53 @@ class ObjectManager
|
|||||||
"color4");
|
"color4");
|
||||||
|
|
||||||
$oParent = $oObject->objectGetParent();
|
$oParent = $oObject->objectGetParent();
|
||||||
|
$oGrandFather = $oParent->objectGetParent();
|
||||||
|
|
||||||
/* We only allow moving to non-queued objects */
|
if($oGrandFather)
|
||||||
if(!$hResult = $oParent->objectGetEntries('accepted'))
|
|
||||||
{
|
{
|
||||||
echo "Failed to get list of objects.<br>\n";
|
$aParentSiblings = $oGrandFather->objectGetChildrenClassSpecific(get_class($oParent));
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
for($i = 0; $oRow = query_fetch_object($hResult); $i++)
|
echo "Children of " . $oGrandFather->objectMakeLink() . " <br />";
|
||||||
{
|
|
||||||
$sParentClass = get_class($oParent);
|
$i = 0;
|
||||||
$oCandidate = new $sParentClass(null, $oRow);
|
foreach($aParentSiblings as $oCandidate)
|
||||||
if($oCandidate->objectGetId() == $oParent->objectGetId())
|
|
||||||
{
|
{
|
||||||
|
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++;
|
$i++;
|
||||||
continue;
|
}
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
/* We only allow moving to non-queued objects */
|
||||||
|
if(!$hResult = $oParent->objectGetEntries('accepted'))
|
||||||
|
{
|
||||||
|
echo "Failed to get list of objects.<br>\n";
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo html_tr(array(
|
for($i = 0; $oRow = query_fetch_object($hResult); $i++)
|
||||||
$oCandidate->objectMakeLink(),
|
{
|
||||||
"<a href=\"".$this->makeUrl('changeParent', $this->iId).
|
$sParentClass = get_class($oParent);
|
||||||
"&iNewId=".$oCandidate->objectGetId()."\">Move here</a>"),
|
$oCandidate = new $sParentClass(null, $oRow);
|
||||||
($i % 2) ? "color0" : "color1");
|
if($oCandidate->objectGetId() == $oParent->objectGetId())
|
||||||
|
{
|
||||||
|
$i++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
echo html_tr(array(
|
||||||
|
$oCandidate->objectMakeLink(),
|
||||||
|
"<a href=\"".$this->makeUrl('changeParent', $this->iId).
|
||||||
|
"&iNewId=".$oCandidate->objectGetId()."\">Move here</a>"),
|
||||||
|
($i % 2) ? "color0" : "color1");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1113,7 +1137,7 @@ class ObjectManager
|
|||||||
exit;
|
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
|
/* 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. */
|
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())
|
method_exists($oObject, "objectGetId") && $oObject->canEdit())
|
||||||
{
|
{
|
||||||
echo "<a href=\"".$this->makeUrl("showChangeParent", $this->iId,
|
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,
|
$oTableRow->AddTextCell('<a href="'.$oObject->makeUrl('edit', $this->iTestingId,
|
||||||
'Edit Test Results').'&sReturnTo='.urlencode($_SERVER['REQUEST_URI']).'">'.
|
'Edit Test Results').'&sReturnTo='.urlencode($_SERVER['REQUEST_URI']).'">'.
|
||||||
'Edit</a> '."\n".
|
'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').
|
'<a href="'.$oObject->makeUrl('delete', $this->iTestingId, 'Delete+Test+Results').
|
||||||
'&sReturnTo='.urlencode($_SERVER['REQUEST_URI']).'">Delete</a></td>'."\n");
|
'&sReturnTo='.urlencode($_SERVER['REQUEST_URI']).'">Delete</a></td>'."\n");
|
||||||
}
|
}
|
||||||
@@ -1400,8 +1401,8 @@ class testData{
|
|||||||
|
|
||||||
function objectMakeLink()
|
function objectMakeLink()
|
||||||
{
|
{
|
||||||
/* STUB */
|
$oObject = new objectManager("testData", "Edit Test Results", $this->iTestingId);
|
||||||
return TRUE;
|
return '<a href="'.$oObject->makeUrl("edit", $this->iTestingId).'">test report</a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function isOld()
|
public function isOld()
|
||||||
@@ -1413,6 +1414,11 @@ class testData{
|
|||||||
return ((mktime() - mysqltimestamp_to_unixtimestamp($this->sSubmitTime)) > (60 * 60 * 24 * 175));
|
return ((mktime() - mysqltimestamp_to_unixtimestamp($this->sSubmitTime)) > (60 * 60 * 24 * 175));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function objectSetParent($iNewId, $sClass = 'version')
|
||||||
|
{
|
||||||
|
$this->iVersionId = $iNewId;
|
||||||
|
}
|
||||||
|
|
||||||
function objectGetParent()
|
function objectGetParent()
|
||||||
{
|
{
|
||||||
return new version($this->iVersionId);
|
return new version($this->iVersionId);
|
||||||
|
|||||||
Reference in New Issue
Block a user