2004-12-11 22:33:01 +00:00
|
|
|
<?php
|
2006-07-06 18:37:34 +00:00
|
|
|
/**
|
|
|
|
|
* Displays an application or a version.
|
|
|
|
|
*
|
|
|
|
|
* Mandatory parameters:
|
|
|
|
|
* - iAppId, application identifier
|
|
|
|
|
* OR
|
|
|
|
|
* - iVersionId, version identifier
|
|
|
|
|
*
|
|
|
|
|
* Optional parameters:
|
|
|
|
|
* - sSub, action to perform ("delete", "unqueue", "Submit a new bug link.", "StartMonitoring", "StopMonitoring")
|
|
|
|
|
* - iBuglinkId, bug identifier to link a bug with a version
|
|
|
|
|
*
|
|
|
|
|
* TODO:
|
|
|
|
|
* - replace sSub with iAction and replace "delete", "unqueue", etc. with integer constants DELETE, UNQUEUE, etc.
|
2006-07-11 18:53:06 +00:00
|
|
|
* - move and rename display_bundle into its respective modules
|
2006-07-06 18:37:34 +00:00
|
|
|
* - replace require_once with require after checking that it won't break anything
|
2004-03-15 16:22:00 +00:00
|
|
|
*/
|
2006-07-06 18:37:34 +00:00
|
|
|
|
|
|
|
|
// application environment
|
2006-07-07 18:14:53 +00:00
|
|
|
require("path.php");
|
2005-02-02 00:35:49 +00:00
|
|
|
require(BASE."include/incl.php");
|
2006-07-07 18:14:53 +00:00
|
|
|
require_once(BASE."include/application.php");
|
|
|
|
|
require_once(BASE."include/appdb.php");
|
|
|
|
|
require_once(BASE."include/vote.php");
|
|
|
|
|
require_once(BASE."include/category.php");
|
|
|
|
|
require_once(BASE."include/maintainer.php");
|
|
|
|
|
require_once(BASE."include/monitor.php");
|
2004-11-09 22:41:18 +00:00
|
|
|
|
2006-07-06 17:27:54 +00:00
|
|
|
$oApp = new Application($aClean['iAppId']);
|
|
|
|
|
$oVersion = new Version($aClean['iVersionId']);
|
2005-02-19 01:23:02 +00:00
|
|
|
|
2004-12-11 03:25:13 +00:00
|
|
|
/**
|
2006-07-06 18:37:34 +00:00
|
|
|
* Displays the SUB apps that belong to this application.
|
2004-12-11 03:25:13 +00:00
|
|
|
*/
|
2006-06-27 19:16:27 +00:00
|
|
|
function display_bundle($iAppId)
|
2004-03-15 16:22:00 +00:00
|
|
|
{
|
2006-07-07 19:24:33 +00:00
|
|
|
$oApp = new Application($iAppId);
|
2006-06-27 19:16:27 +00:00
|
|
|
$hResult = query_parameters("SELECT appFamily.appId, appName, description FROM appBundle, appFamily ".
|
|
|
|
|
"WHERE appFamily.queued='false' AND bundleId = '?' AND appBundle.appId = appFamily.appId",
|
|
|
|
|
$iAppId);
|
2006-06-21 01:04:12 +00:00
|
|
|
if(!$hResult || mysql_num_rows($hResult) == 0)
|
2004-12-11 03:25:13 +00:00
|
|
|
{
|
|
|
|
|
return; // do nothing
|
|
|
|
|
}
|
2004-03-15 16:22:00 +00:00
|
|
|
|
|
|
|
|
echo html_frame_start("","98%","",0);
|
2005-02-11 23:42:50 +00:00
|
|
|
echo "<table width=\"100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"1\">\n\n";
|
2004-03-15 16:22:00 +00:00
|
|
|
|
2005-02-11 23:42:50 +00:00
|
|
|
echo "<tr class=\"color4\">\n";
|
2005-02-09 23:48:31 +00:00
|
|
|
echo " <td>Application Name</td>\n";
|
|
|
|
|
echo " <td>Description</td>\n";
|
2004-03-15 16:22:00 +00:00
|
|
|
echo "</tr>\n\n";
|
|
|
|
|
|
|
|
|
|
$c = 0;
|
2006-06-21 01:04:12 +00:00
|
|
|
while($ob = mysql_fetch_object($hResult))
|
|
|
|
|
{
|
2004-12-11 03:25:13 +00:00
|
|
|
//set row color
|
|
|
|
|
$bgcolor = ($c % 2 == 0) ? "color0" : "color1";
|
2004-03-15 16:22:00 +00:00
|
|
|
|
2004-12-11 03:25:13 +00:00
|
|
|
//display row
|
2005-02-11 23:42:50 +00:00
|
|
|
echo "<tr class=\"$bgcolor\">\n";
|
2006-07-06 17:27:54 +00:00
|
|
|
echo " <td><a href=\"appview.php?iAppId=$ob->appId\">".stripslashes($ob->appName)."</a></td>\n";
|
2006-06-29 16:07:19 +00:00
|
|
|
echo " <td>".util_trim_description($oApp->sDescription)."</td>\n";
|
2004-12-11 03:25:13 +00:00
|
|
|
echo "</tr>\n\n";
|
2004-03-15 16:22:00 +00:00
|
|
|
|
2004-12-11 03:25:13 +00:00
|
|
|
$c++;
|
|
|
|
|
}
|
2004-03-15 16:22:00 +00:00
|
|
|
|
|
|
|
|
echo "</table>\n\n";
|
|
|
|
|
echo html_frame_end();
|
|
|
|
|
}
|
|
|
|
|
|
2006-07-07 04:51:41 +00:00
|
|
|
// if both iAppId and iVersionId are empty we have a problem
|
|
|
|
|
if(empty($aClean['iAppId']) && empty($aClean['iVersionId']))
|
2006-07-06 18:44:56 +00:00
|
|
|
util_show_error_page_and_exit("Something went wrong with the application or version id");
|
2004-12-27 05:18:41 +00:00
|
|
|
|
2006-07-06 17:27:54 +00:00
|
|
|
if ($aClean['sSub'])
|
2005-07-13 01:16:37 +00:00
|
|
|
{
|
2006-07-06 17:27:54 +00:00
|
|
|
if(($aClean['sSub'] == 'delete' ) && ($aClean['iBuglinkId']))
|
2005-07-13 01:16:37 +00:00
|
|
|
{
|
|
|
|
|
if(($_SESSION['current']->hasPriv("admin") ||
|
|
|
|
|
$_SESSION['current']->isMaintainer($oVersion->iVersionId) ||
|
|
|
|
|
$_SESSION['current']->isSuperMaintainer($oVersion->iAppId)))
|
|
|
|
|
{
|
2006-09-06 01:43:30 +00:00
|
|
|
$oBuglink = new Bug($aClean['iBuglinkId']);
|
2005-07-13 01:16:37 +00:00
|
|
|
$oBuglink->delete();
|
2006-07-06 18:44:56 +00:00
|
|
|
util_redirect_and_exit(apidb_fullurl("appview.php?iVersionId=".$aClean['iVersionId']));
|
2005-07-13 01:16:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
2006-07-06 17:27:54 +00:00
|
|
|
if(($aClean['sSub'] == 'unqueue' ) && ($aClean['iBuglinkId']))
|
2005-07-13 01:16:37 +00:00
|
|
|
{
|
|
|
|
|
if(($_SESSION['current']->hasPriv("admin") ||
|
|
|
|
|
$_SESSION['current']->isMaintainer($oVersion->iVersionId) ||
|
|
|
|
|
$_SESSION['current']->isSuperMaintainer($oVersion->iAppId)))
|
|
|
|
|
{
|
2006-09-06 01:43:30 +00:00
|
|
|
$oBuglink = new Bug($aClean['iBuglinkId']);
|
2005-07-13 01:16:37 +00:00
|
|
|
$oBuglink->unqueue();
|
2006-07-06 18:44:56 +00:00
|
|
|
util_redirect_and_exit(apidb_fullurl("appview.php?iVersionId=".$aClean['iVersionId']));
|
2005-07-13 01:16:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
2006-07-06 17:27:54 +00:00
|
|
|
if(($aClean['sSub'] == 'Submit a new bug link.' ) && ($aClean['iBuglinkId']))
|
2005-07-13 01:16:37 +00:00
|
|
|
{
|
2006-09-06 01:43:30 +00:00
|
|
|
$oBuglink = new Bug();
|
2006-07-06 17:27:54 +00:00
|
|
|
$oBuglink->create($aClean['iVersionId'],$aClean['iBuglinkId']);
|
2006-07-06 18:44:56 +00:00
|
|
|
util_redirect_and_exit(apidb_fullurl("appview.php?iVersionId=".$aClean['iVersionId']));
|
2005-07-13 01:16:37 +00:00
|
|
|
}
|
2006-07-06 17:27:54 +00:00
|
|
|
if($aClean['sSub'] == 'StartMonitoring')
|
2005-09-30 01:55:51 +00:00
|
|
|
{
|
|
|
|
|
$oMonitor = new Monitor();
|
2006-07-06 17:27:54 +00:00
|
|
|
$oMonitor->create($_SESSION['current']->iUserId,$aClean['iAppId'],$aClean['iVersionId']);
|
2006-07-06 18:44:56 +00:00
|
|
|
util_redirect_and_exit(apidb_fullurl("appview.php?iVersionId=".$aClean['iVersionId']));
|
2005-09-30 01:55:51 +00:00
|
|
|
}
|
2006-07-06 17:27:54 +00:00
|
|
|
if($aClean['sSub'] == 'StopMonitoring')
|
2005-09-30 01:55:51 +00:00
|
|
|
{
|
|
|
|
|
$oMonitor = new Monitor();
|
2006-07-06 17:27:54 +00:00
|
|
|
$oMonitor->find($_SESSION['current']->iUserId,$aClean['iAppId'],$aClean['iVersionId']);
|
2005-09-30 01:55:51 +00:00
|
|
|
if($oMonitor->iMonitorId)
|
|
|
|
|
{
|
|
|
|
|
$oMonitor->delete();
|
|
|
|
|
}
|
2006-07-06 18:44:56 +00:00
|
|
|
util_redirect_and_exit(apidb_fullurl("appview.php?iVersionId=".$aClean['iVersionId']));
|
2005-09-30 01:55:51 +00:00
|
|
|
}
|
2004-12-27 05:18:41 +00:00
|
|
|
|
2005-07-13 01:16:37 +00:00
|
|
|
}
|
2005-02-06 17:49:48 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* We want to see an application family (=no version).
|
|
|
|
|
*/
|
2006-07-06 17:27:54 +00:00
|
|
|
if($aClean['iAppId'])
|
2004-03-15 20:39:12 +00:00
|
|
|
{
|
2006-07-06 17:27:54 +00:00
|
|
|
$oApp = new Application($aClean['iAppId']);
|
2006-01-29 04:04:46 +00:00
|
|
|
$oApp->display();
|
2006-07-06 17:27:54 +00:00
|
|
|
} else if($aClean['iVersionId']) // We want to see a particular version.
|
2004-03-15 16:22:00 +00:00
|
|
|
{
|
2006-07-06 17:27:54 +00:00
|
|
|
$oVersion = new Version($aClean['iVersionId']);
|
2006-07-08 22:10:56 +00:00
|
|
|
$oVersion->display($aClean['iTestingId']);
|
2006-01-29 04:04:46 +00:00
|
|
|
} else
|
2004-03-15 16:22:00 +00:00
|
|
|
{
|
2004-12-11 03:25:13 +00:00
|
|
|
// Oops! Called with no params, bad llamah!
|
2006-07-06 18:44:56 +00:00
|
|
|
util_show_error_page_and_exit('Page Called with No Params!');
|
2004-03-15 16:22:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
apidb_footer();
|
2004-12-11 22:33:01 +00:00
|
|
|
?>
|