objectManager: Restructure some form processing code

This commit is contained in:
Alexander Nicolaysen Sørnes
2007-11-05 17:41:11 +01:00
committed by Chris Morgan
parent f851d9378f
commit 5db7f0f7fb

View File

@@ -75,15 +75,28 @@ $oOtherObject = new $sClass($oObject->getId());
on failure */ on failure */
$sErrors = $oObject->processForm($aClean); $sErrors = $oObject->processForm($aClean);
if(isset($aClean['sAction']) && $aClean['sAction'] == "add") if(array_key_exists("sAction", $aClean))
$oObject->handle_anonymous_submission(); $sAction = $aClean['sAction'];
else
$sAction = "";
/* Provided the necessary values are present, an object's children may be moved /* Handle things that need to be done before showing any output */
without any confirmation */ if($sAction)
if($oObject->getId() && $aClean['sAction'] == "moveChildren" && $aClean['iNewId']) {
$oObject->move_children($aClean['iNewId']); switch($aClean['sAction'])
{
case 'add':
$oObject->handle_anonymous_submission();
break;
$sAction = $aClean['sAction']; case 'moveChildren':
/* Provided the necessary values are present, an object's children may be moved
without any confirmation */
if($oObject->getId() && $aClean['iNewId'])
$oObject->move_children($aClean['iNewId']);
break;
}
}
/* If no action is specified, use a default depending on other parameters */ /* If no action is specified, use a default depending on other parameters */
if(!$sAction) if(!$sAction)
@@ -119,12 +132,17 @@ if($oObject->getId() && $sAction != "add")
$oObject->view($_SERVER['REQUEST_URI'], $aClean); $oObject->view($_SERVER['REQUEST_URI'], $aClean);
break; break;
} }
} else if ($sAction == "add")
{
$oObject->add_entry($aClean, $sErrors);
} else } else
{ {
$oObject->display_table($aClean); switch($sAction)
{
case 'add':
$oObject->add_entry($aClean, $sErrors);
break;
default:
$oObject->display_table($aClean);
}
} }
apidb_footer(); apidb_footer();