This repository has been archived on 2025-05-24. You can view files and clone it, but cannot push or open issues or pull requests.
Files
qemudb/appview.php

207 lines
6.0 KiB
PHP
Raw Normal View History

<?php
/**********************************/
/* code to display an application */
/**********************************/
2004-03-15 16:22:00 +00:00
2004-12-25 20:08:00 +00:00
/*
2004-12-27 23:54:55 +00:00
* application environment
2004-03-15 16:22:00 +00:00
*/
include("path.php");
require(BASE."include/incl.php");
require(BASE."include/application.php");
require(BASE."include/appdb.php");
require(BASE."include/vote.php");
require(BASE."include/category.php");
require(BASE."include/maintainer.php");
require(BASE."include/mail.php");
require(BASE."include/monitor.php");
require_once(BASE."include/testResults.php");
2004-03-15 16:22:00 +00:00
2005-02-19 01:23:02 +00:00
$oApp = new Application($_REQUEST['appId']);
$oVersion = new Version($_REQUEST['versionId']);
/**
* display the full path of the Category we are looking at
*/
function display_catpath($catId, $appId, $versionId = '')
2004-03-15 16:22:00 +00:00
{
$cat = new Category($catId);
$catFullPath = make_cat_path($cat->getCategoryPath(), $appId, $versionId);
2004-03-15 16:22:00 +00:00
echo html_frame_start("",'98%','',2);
echo "<p><b>Category: ". $catFullPath ."</b><br />\n";
2004-03-15 16:22:00 +00:00
echo html_frame_end();
}
/**
* display the SUB apps that belong to this app
*/
2004-03-15 16:22:00 +00:00
function display_bundle($appId)
{
$oApp = new Application($appId);
$result = query_appdb("SELECT appFamily.appId, appName, description FROM appBundle, appFamily ".
2005-02-19 01:21:14 +00:00
"WHERE appFamily.queued='false' AND bundleId = $appId AND appBundle.appId = appFamily.appId");
2004-03-15 16:22:00 +00:00
if(!$result || mysql_num_rows($result) == 0)
{
return; // do nothing
}
2004-03-15 16:22:00 +00:00
echo html_frame_start("","98%","",0);
echo "<table width=\"100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"1\">\n\n";
2004-03-15 16:22:00 +00:00
echo "<tr class=\"color4\">\n";
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;
while($ob = mysql_fetch_object($result)) {
//set row color
$bgcolor = ($c % 2 == 0) ? "color0" : "color1";
2004-03-15 16:22:00 +00:00
//display row
echo "<tr class=\"$bgcolor\">\n";
echo " <td><a href=\"appview.php?appId=$ob->appId\">".stripslashes($ob->appName)."</a></td>\n";
echo " <td>".trim_description($oApp->sDescription)."</td>\n";
echo "</tr>\n\n";
2004-03-15 16:22:00 +00:00
$c++;
}
2004-03-15 16:22:00 +00:00
echo "</table>\n\n";
echo html_frame_end();
}
/* Show note */
function show_note($sType,$oData){
2005-02-19 01:23:02 +00:00
global $oVersion;
switch($sType)
{
case 'WARNING':
$color = 'red';
$title = 'Warning';
break;
2004-03-15 16:22:00 +00:00
case 'HOWTO';
$color = 'green';
$title = 'HOWTO';
break;
default:
if(!empty($oData->noteTitle))
$title = $oData->noteTitle;
else
$title = 'Note';
$color = 'blue';
2004-03-15 16:22:00 +00:00
}
$s = html_frame_start("","98%",'',0);
$s .= "<table width=\"100%\" border=\"0\" cellspacing=\"0\">\n";
$s .= "<tr bgcolor=\"".$color."\" align=\"center\" valign=\"top\"><td><b>".$title."</b></td></tr>\n";
$s .= "<tr><td class=\"note\">\n";
$s .= $oData->noteDesc;
$s .= "</td></tr>\n";
2005-02-19 01:23:02 +00:00
if ($_SESSION['current']->hasPriv("admin") || $_SESSION['current']->isMaintainer($oVersion->iVersionId) || $_SESSION['current']->isSuperMaintainer($oVersion->iAppId))
{
$s .= "<tr class=\"color1\" align=\"center\" valign=\"top\"><td>";
$s .= "<form method=\"post\" name=\"message\" action=\"admin/editAppNote.php?noteId={$oData->noteId}\">";
$s .= '<input type="submit" value="Edit Note" class="button">';
$s .= '</form></td></tr>';
}
2004-03-15 16:22:00 +00:00
$s .= "</table>\n";
$s .= html_frame_end();
return $s;
2004-03-15 16:22:00 +00:00
}
if(!is_numeric($_REQUEST['appId']) && !is_numeric($_REQUEST['versionId']))
2004-12-27 05:18:41 +00:00
{
errorpage("Something went wrong with the application or version id");
2004-12-27 05:18:41 +00:00
exit;
}
if ($_REQUEST['sub'])
{
if(($_REQUEST['sub'] == 'delete' ) && ($_REQUEST['buglinkId']))
{
if(($_SESSION['current']->hasPriv("admin") ||
$_SESSION['current']->isMaintainer($oVersion->iVersionId) ||
$_SESSION['current']->isSuperMaintainer($oVersion->iAppId)))
{
$oBuglink = new bug($_REQUEST['buglinkId']);
$oBuglink->delete();
redirect(apidb_fullurl("appview.php?versionId=".$_REQUEST['versionId']));
exit;
}
}
if(($_REQUEST['sub'] == 'unqueue' ) && ($_REQUEST['buglinkId']))
{
if(($_SESSION['current']->hasPriv("admin") ||
$_SESSION['current']->isMaintainer($oVersion->iVersionId) ||
$_SESSION['current']->isSuperMaintainer($oVersion->iAppId)))
{
$oBuglink = new bug($_REQUEST['buglinkId']);
$oBuglink->unqueue();
redirect(apidb_fullurl("appview.php?versionId=".$_REQUEST['versionId']));
exit;
}
}
if(($_REQUEST['sub'] == 'Submit a new bug link.' ) && ($_REQUEST['buglinkId']))
{
$oBuglink = new bug();
$oBuglink->create($_REQUEST['versionId'],$_REQUEST['buglinkId']);
redirect(apidb_fullurl("appview.php?versionId=".$_REQUEST['versionId']));
exit;
}
if($_REQUEST['sub'] == 'StartMonitoring')
{
$oMonitor = new Monitor();
$oMonitor->create($_SESSION['current']->iUserId,$_REQUEST['appId'],$_REQUEST['versionId']);
redirect(apidb_fullurl("appview.php?versionId=".$_REQUEST['versionId']));
exit;
}
if($_REQUEST['sub'] == 'StopMonitoring')
{
$oMonitor = new Monitor();
$oMonitor->find($_SESSION['current']->iUserId,$_REQUEST['appId'],$_REQUEST['versionId']);
if($oMonitor->iMonitorId)
{
$oMonitor->delete();
}
redirect(apidb_fullurl("appview.php?versionId=".$_REQUEST['versionId']));
exit;
}
2004-12-27 05:18:41 +00:00
}
/**
* We want to see an application family (=no version).
*/
if($_REQUEST['appId'])
{
$oApp = new Application($_REQUEST['appId']);
$oApp->display();
} else if($_REQUEST['versionId']) // We want to see a particular version.
2004-03-15 16:22:00 +00:00
{
$oVersion = new Version($_REQUEST['versionId']);
$oVersion->display();
} else
2004-03-15 16:22:00 +00:00
{
// Oops! Called with no params, bad llamah!
errorpage('Page Called with No Params!');
exit;
2004-03-15 16:22:00 +00:00
}
apidb_footer();
?>