Prepare for viewing versions using objectManager
This commit is contained in:
committed by
Chris Morgan
parent
43e3e6bebc
commit
93d71f630a
@@ -80,7 +80,9 @@ if( isset($aClean['iAppId']) )
|
|||||||
{
|
{
|
||||||
$oVersion = new Version($aClean['iVersionId']);
|
$oVersion = new Version($aClean['iVersionId']);
|
||||||
$iTestingId = isset($aClean['iTestingId']) ? $aClean['iTestingId'] : null;
|
$iTestingId = isset($aClean['iTestingId']) ? $aClean['iTestingId'] : null;
|
||||||
$oVersion->display($iTestingId);
|
// header
|
||||||
|
apidb_header("Viewing App: ".version::fullName($oVersion->iVersionId));
|
||||||
|
$oVersion->display($aClean);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
// Oops! Called with no params, bad llamah!
|
// Oops! Called with no params, bad llamah!
|
||||||
|
|||||||
@@ -699,14 +699,42 @@ class ObjectManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Gets the custom variables, if any, from a class depending on
|
||||||
|
the action which is being taken, such as viewing an entry,
|
||||||
|
editing one etc.
|
||||||
|
Returns null if there are no custom vars, or a labelled array
|
||||||
|
with the variable contents otherwise */
|
||||||
|
function get_custom_vars($aClean, $sAction)
|
||||||
|
{
|
||||||
|
$oObject = new $this->sClass($this->iId);
|
||||||
|
|
||||||
|
if(!method_exists($oObject, "objectGetCustomVars"))
|
||||||
|
return null; /* No vars */
|
||||||
|
|
||||||
|
$aVars = array();
|
||||||
|
|
||||||
|
foreach($oObject->objectGetCustomVars($aClean, $sAction) as $sVar)
|
||||||
|
$aVars[$sVar] = $aClean[$sVar];
|
||||||
|
|
||||||
|
if(!sizeof($aVars))
|
||||||
|
return null; /* No vars */
|
||||||
|
else
|
||||||
|
return $aVars;
|
||||||
|
}
|
||||||
|
|
||||||
/* View an entry */
|
/* View an entry */
|
||||||
function view($sBackLink)
|
function view($sBackLink, $aClean)
|
||||||
{
|
{
|
||||||
$this->checkMethods(array("display"));
|
$this->checkMethods(array("display"));
|
||||||
|
|
||||||
$oObject = new $this->sClass($this->iId);
|
$oObject = new $this->sClass($this->iId);
|
||||||
|
|
||||||
|
$aVars = $this->get_custom_vars($aClean, "display");
|
||||||
|
|
||||||
|
if(!$aVars)
|
||||||
$oObject->display();
|
$oObject->display();
|
||||||
|
else
|
||||||
|
$oObject->display($aVars);
|
||||||
|
|
||||||
// display the move children entry
|
// display the move children entry
|
||||||
$this->displayMoveChildren($oObject);
|
$this->displayMoveChildren($oObject);
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ require_once(BASE."include/util.php");
|
|||||||
require_once(BASE."include/testData.php");
|
require_once(BASE."include/testData.php");
|
||||||
require_once(BASE."include/downloadurl.php");
|
require_once(BASE."include/downloadurl.php");
|
||||||
require_once(BASE."include/monitor.php");
|
require_once(BASE."include/monitor.php");
|
||||||
|
require_once(BASE."include/vote.php");
|
||||||
|
|
||||||
define("LICENSE_OPENSOURCE", "Open Source");
|
define("LICENSE_OPENSOURCE", "Open Source");
|
||||||
define("LICENSE_FREEWARE", "Freeware");
|
define("LICENSE_FREEWARE", "Freeware");
|
||||||
@@ -718,12 +719,28 @@ class version {
|
|||||||
$this->iObsoleteBy = 0;
|
$this->iObsoleteBy = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function display($iTestingId)
|
function objectGetCustomVars($aClean, $sAction)
|
||||||
|
{
|
||||||
|
switch($sAction)
|
||||||
|
{
|
||||||
|
case "display":
|
||||||
|
/* Allow the user to select which test report is
|
||||||
|
shown in the version view */
|
||||||
|
return array("iTestingId");
|
||||||
|
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function display($aVars)
|
||||||
{
|
{
|
||||||
/* is this user supposed to view this version? */
|
/* is this user supposed to view this version? */
|
||||||
if(!$_SESSION['current']->canViewVersion($this))
|
if(!$_SESSION['current']->canViewVersion($this))
|
||||||
util_show_error_page_and_exit("Something went wrong with the application or version id");
|
util_show_error_page_and_exit("Something went wrong with the application or version id");
|
||||||
|
|
||||||
|
$iTestingId = $aVars['iTestingId'];
|
||||||
|
|
||||||
$oApp = new Application($this->iAppId);
|
$oApp = new Application($this->iAppId);
|
||||||
|
|
||||||
// Oops! application not found or other error. do something
|
// Oops! application not found or other error. do something
|
||||||
@@ -738,10 +755,6 @@ class version {
|
|||||||
if($_SESSION['current']->isLoggedIn())
|
if($_SESSION['current']->isLoggedIn())
|
||||||
apidb_sidebar_add("vote_menu");
|
apidb_sidebar_add("vote_menu");
|
||||||
|
|
||||||
|
|
||||||
// header
|
|
||||||
apidb_header("Viewing App- ".$oApp->sName." Version - ".$this->sName);
|
|
||||||
|
|
||||||
// cat
|
// cat
|
||||||
$oCategory = new Category($oApp->iCatId);
|
$oCategory = new Category($oApp->iCatId);
|
||||||
$oCategory->display($oApp->iAppId, $this->iVersionId);
|
$oCategory->display($oApp->iAppId, $this->iVersionId);
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ if($oObject->iId)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
$oObject->view($_SERVER['REQUEST_URI']);
|
$oObject->view($_SERVER['REQUEST_URI'], $aClean);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (isset($aClean['sAction']) && $aClean['sAction'] == "add")
|
} else if (isset($aClean['sAction']) && $aClean['sAction'] == "add")
|
||||||
|
|||||||
Reference in New Issue
Block a user