diff --git a/include/objectManager.php b/include/objectManager.php
index 7635f22..f49c757 100644
--- a/include/objectManager.php
+++ b/include/objectManager.php
@@ -923,29 +923,53 @@ class ObjectManager
"color4");
$oParent = $oObject->objectGetParent();
+ $oGrandFather = $oParent->objectGetParent();
- /* We only allow moving to non-queued objects */
- if(!$hResult = $oParent->objectGetEntries('accepted'))
+ if($oGrandFather)
{
- echo "Failed to get list of objects.
\n";
- return FALSE;
- }
+ $aParentSiblings = $oGrandFather->objectGetChildrenClassSpecific(get_class($oParent));
- for($i = 0; $oRow = query_fetch_object($hResult); $i++)
- {
- $sParentClass = get_class($oParent);
- $oCandidate = new $sParentClass(null, $oRow);
- if($oCandidate->objectGetId() == $oParent->objectGetId())
+ echo "Children of " . $oGrandFather->objectMakeLink() . "
";
+
+ $i = 0;
+ foreach($aParentSiblings as $oCandidate)
{
+ if($oCandidate->objectGetState() != 'accepted')
+ continue;
+
+ if($oCandidate->objectGetId() == $oParent->objectGetId())
+ continue;
+
+ echo html_tr(array($oCandidate->objectMakeLink(),
+ "makeUrl('changeParent', $this->iId). "&iNewId=".$oCandidate->objectGetId()."\">Move here"),
+ ($i % 2) ? "color0" : "color1");
$i++;
- continue;
+ }
+ } else
+ {
+ /* We only allow moving to non-queued objects */
+ if(!$hResult = $oParent->objectGetEntries('accepted'))
+ {
+ echo "Failed to get list of objects.
\n";
+ return FALSE;
}
- echo html_tr(array(
- $oCandidate->objectMakeLink(),
- "makeUrl('changeParent', $this->iId).
- "&iNewId=".$oCandidate->objectGetId()."\">Move here"),
- ($i % 2) ? "color0" : "color1");
+ for($i = 0; $oRow = query_fetch_object($hResult); $i++)
+ {
+ $sParentClass = get_class($oParent);
+ $oCandidate = new $sParentClass(null, $oRow);
+ if($oCandidate->objectGetId() == $oParent->objectGetId())
+ {
+ $i++;
+ continue;
+ }
+
+ echo html_tr(array(
+ $oCandidate->objectMakeLink(),
+ "makeUrl('changeParent', $this->iId).
+ "&iNewId=".$oCandidate->objectGetId()."\">Move here"),
+ ($i % 2) ? "color0" : "color1");
+ }
}
@@ -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 "makeUrl("showChangeParent", $this->iId,
- "Move to another parent entry")."\">Move to another parent entry\n";
+ "Move to another parent entry")."\">$sLinkText\n";
}
}
diff --git a/include/testData.php b/include/testData.php
index 57f51ee..8217220 100644
--- a/include/testData.php
+++ b/include/testData.php
@@ -621,6 +621,7 @@ class testData{
$oTableRow->AddTextCell(''.
'Edit '."\n".
+ 'Move'."\n".
'Delete'."\n");
}
@@ -1400,8 +1401,8 @@ class testData{
function objectMakeLink()
{
- /* STUB */
- return TRUE;
+ $oObject = new objectManager("testData", "Edit Test Results", $this->iTestingId);
+ return 'iTestingId).'">test report';
}
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);