2007-02-03 19:03:42 +00:00
|
|
|
<?php
|
2007-04-18 23:18:45 +00:00
|
|
|
/**
|
|
|
|
|
* Code for displaying and processing objects that have object management
|
|
|
|
|
* methods.
|
|
|
|
|
*
|
|
|
|
|
* Required parameters
|
|
|
|
|
* sClass: The class that is to be handled
|
|
|
|
|
*
|
|
|
|
|
* Optional parameters
|
|
|
|
|
* sTitle: Set the title of the page
|
|
|
|
|
* iId: The object id when handling a specific entry
|
|
|
|
|
* bIsQueue: Whether we are handling a queue, set automatically if bIsRejected is true
|
|
|
|
|
* bIsRejected: Whether we are handling rejected entries, sets bIsQueue to true
|
|
|
|
|
* if enabled
|
|
|
|
|
* sAction: What to do, defaults to viewing the item if iId is given and to
|
|
|
|
|
* displaying a table of objects with the specified queue status otherwise
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
require_once('path.php');
|
|
|
|
|
require_once(BASE.'include/incl.php');
|
2007-02-03 19:03:42 +00:00
|
|
|
require_once(BASE.'include/objectManager.php');
|
2007-04-24 23:48:14 +00:00
|
|
|
require_once(BASE.'include/application_queue.php');
|
2007-04-19 23:45:15 +00:00
|
|
|
require_once(BASE.'include/version_queue.php');
|
2007-04-18 23:18:45 +00:00
|
|
|
require_once(BASE.'include/testData_queue.php');
|
2007-07-16 03:04:07 +00:00
|
|
|
require_once(BASE.'include/browse_newest_apps.php');
|
2007-08-27 03:48:44 +00:00
|
|
|
require_once(BASE.'include/bugs.php');
|
2007-02-03 19:03:42 +00:00
|
|
|
|
|
|
|
|
/* if we have no valid class name we should abort */
|
2007-07-24 01:45:19 +00:00
|
|
|
if(!isset($aClean['sClass']))
|
2007-02-03 19:03:42 +00:00
|
|
|
{
|
|
|
|
|
echo "No class defined.\n";
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* make sure the class is defined */
|
|
|
|
|
if(!class_exists($aClean['sClass']))
|
|
|
|
|
{
|
|
|
|
|
echo "Class ".$aClean['sClass']." doesn't exist";
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
|
2007-07-24 01:45:19 +00:00
|
|
|
$aClean['iId'] = isset($aClean['iId']) ? $aClean['iId'] : 0;
|
|
|
|
|
|
2007-02-03 19:03:42 +00:00
|
|
|
$oObject = new objectManager($aClean['sClass'], $aClean['sTitle'], $aClean['iId']);
|
|
|
|
|
|
2007-07-24 01:45:19 +00:00
|
|
|
if(isset($aClean['bIsQueue']) && $aClean['bIsQueue'] == 'true')
|
2007-09-28 21:25:33 -04:00
|
|
|
$oObject->setIsQueue(true);
|
2007-03-24 18:30:16 +00:00
|
|
|
else
|
2007-09-28 21:25:33 -04:00
|
|
|
$oObject->setIsQueue(false);
|
2007-02-03 19:03:42 +00:00
|
|
|
|
2007-10-21 15:42:29 +02:00
|
|
|
if(isset($aClean['sReturnToTitle']))
|
|
|
|
|
$oObject->setReturnToTitle($aClean['sReturnToTitle']);
|
|
|
|
|
|
2007-09-14 23:02:12 -04:00
|
|
|
if(isset($aClean['sReturnTo']))
|
2007-09-28 21:25:33 -04:00
|
|
|
$oObject->setReturnTo($aClean['sReturnTo']);
|
2007-09-14 23:02:12 -04:00
|
|
|
|
2007-07-24 01:45:19 +00:00
|
|
|
$aClean['bIsRejected'] = isset($aClean['bIsRejected']) ? $aClean['bIsRejected'] : false;
|
2007-03-24 18:30:16 +00:00
|
|
|
/* If it is rejected it is defined as queued */
|
|
|
|
|
if($aClean['bIsRejected'] == 'true')
|
|
|
|
|
{
|
2007-09-28 21:25:33 -04:00
|
|
|
$oObject->setIsRejected(true);
|
|
|
|
|
$oObject->setIsQueue(true);
|
2007-03-24 18:30:16 +00:00
|
|
|
} else
|
2007-09-08 01:38:35 +00:00
|
|
|
{
|
2007-09-28 21:25:33 -04:00
|
|
|
$oObject->setIsRejected(false);
|
2007-09-08 01:38:35 +00:00
|
|
|
}
|
2007-02-03 19:03:42 +00:00
|
|
|
|
2007-09-28 21:25:33 -04:00
|
|
|
$oObject->getMultiPageDataFromInput($aClean);
|
2007-06-15 04:10:42 +00:00
|
|
|
|
2007-09-28 21:25:33 -04:00
|
|
|
$sClass = $oObject->getClass();
|
|
|
|
|
$oOtherObject = new $sClass($oObject->getId());
|
2007-02-03 19:03:42 +00:00
|
|
|
|
2007-06-14 01:27:59 +00:00
|
|
|
/* Certain actions must be performed before the header is set. */
|
|
|
|
|
/* processForm returns TRUE on success, or a user-readable list of errors
|
2007-03-25 18:52:19 +00:00
|
|
|
on failure */
|
|
|
|
|
$sErrors = $oObject->processForm($aClean);
|
2007-02-03 19:03:42 +00:00
|
|
|
|
2007-11-05 17:41:11 +01:00
|
|
|
if(array_key_exists("sAction", $aClean))
|
|
|
|
|
$sAction = $aClean['sAction'];
|
|
|
|
|
else
|
|
|
|
|
$sAction = "";
|
2007-04-23 23:31:24 +00:00
|
|
|
|
2007-11-05 17:41:11 +01:00
|
|
|
/* Handle things that need to be done before showing any output */
|
|
|
|
|
if($sAction)
|
|
|
|
|
{
|
|
|
|
|
switch($aClean['sAction'])
|
|
|
|
|
{
|
|
|
|
|
case 'add':
|
|
|
|
|
$oObject->handle_anonymous_submission();
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
}
|
2007-09-18 13:18:50 +02:00
|
|
|
|
|
|
|
|
/* If no action is specified, use a default depending on other parameters */
|
|
|
|
|
if(!$sAction)
|
|
|
|
|
{
|
2007-09-28 21:25:33 -04:00
|
|
|
if($oObject->getId())
|
2007-09-24 21:35:35 -04:00
|
|
|
$sAction = "view";
|
2007-09-18 13:18:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
apidb_header($oObject->get_title($sAction));
|
2007-02-03 19:03:42 +00:00
|
|
|
|
|
|
|
|
/* display a particular element */
|
2007-09-28 21:25:33 -04:00
|
|
|
if($oObject->getId() && $sAction != "add")
|
2007-02-03 19:03:42 +00:00
|
|
|
{
|
2007-09-18 13:18:50 +02:00
|
|
|
switch($sAction)
|
2007-02-03 19:03:42 +00:00
|
|
|
{
|
|
|
|
|
case "cancel":
|
2007-06-09 17:07:02 +00:00
|
|
|
$oObject->display_table($aClean); /* go back to the queue */
|
2007-02-03 19:03:42 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case "edit":
|
2007-10-09 21:10:29 +02:00
|
|
|
$oObject->display_entry_for_editing($aClean, $sErrors);
|
2007-02-03 19:03:42 +00:00
|
|
|
break;
|
|
|
|
|
|
2007-04-27 23:43:43 +00:00
|
|
|
case "showMoveChildren":
|
|
|
|
|
$oObject->display_move_children();
|
|
|
|
|
break;
|
|
|
|
|
|
2007-09-14 23:02:12 -04:00
|
|
|
case "delete":
|
|
|
|
|
$oObject->delete_prompt();
|
|
|
|
|
break;
|
|
|
|
|
|
2007-09-24 21:35:35 -04:00
|
|
|
case "view":
|
2007-09-18 12:28:37 +02:00
|
|
|
$oObject->view($_SERVER['REQUEST_URI'], $aClean);
|
2007-02-03 19:03:42 +00:00
|
|
|
break;
|
|
|
|
|
}
|
2007-04-22 15:52:06 +00:00
|
|
|
} else
|
2007-02-03 19:03:42 +00:00
|
|
|
{
|
2007-11-05 17:41:11 +01:00
|
|
|
switch($sAction)
|
|
|
|
|
{
|
|
|
|
|
case 'add':
|
|
|
|
|
$oObject->add_entry($aClean, $sErrors);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
$oObject->display_table($aClean);
|
|
|
|
|
}
|
2007-02-03 19:03:42 +00:00
|
|
|
}
|
|
|
|
|
|
2007-05-26 15:48:42 +00:00
|
|
|
apidb_footer();
|
|
|
|
|
|
2007-02-03 19:03:42 +00:00
|
|
|
?>
|