Use objectManager to display applications
This commit is contained in:
committed by
Chris Morgan
parent
72a250b2b0
commit
af87e89535
88
appview.php
88
appview.php
@@ -1,93 +1,39 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Displays an application or a version.
|
* Previously used to display an application or a version.
|
||||||
|
* It still does that, but only for compatibility with old links
|
||||||
*
|
*
|
||||||
* Mandatory parameters:
|
* Mandatory parameters:
|
||||||
* - iAppId, application identifier
|
* - iAppId, application identifier
|
||||||
* OR
|
* OR
|
||||||
* - iVersionId, version identifier
|
* - iVersionId, version identifier
|
||||||
*
|
*
|
||||||
* Optional parameters:
|
*/
|
||||||
* - sSub, action to perform ("delete", "unqueue", "Submit a new bug link.")
|
|
||||||
* - 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.
|
|
||||||
* - move and rename display_bundle into its respective modules
|
|
||||||
* - replace require_once with require after checking that it won't break anything
|
|
||||||
*/
|
|
||||||
|
|
||||||
// application environment
|
// Basic environment
|
||||||
require("path.php");
|
require("path.php");
|
||||||
require(BASE."include/incl.php");
|
require(BASE."include/incl.php");
|
||||||
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");
|
|
||||||
|
|
||||||
|
if(isset($aClean['iAppId']) || isset($aClean['iVersionId'])) // Valid args
|
||||||
/**
|
|
||||||
* Displays the SUB apps that belong to this application.
|
|
||||||
*/
|
|
||||||
function display_bundle($iAppId)
|
|
||||||
{
|
{
|
||||||
$oApp = new Application($iAppId);
|
if( isset($aClean['iAppId']) ) // Application
|
||||||
$hResult = query_parameters("SELECT appFamily.appId, appName, description FROM appBundle, appFamily ".
|
$oObject = new Application($aClean['iAppId']);
|
||||||
"WHERE appFamily.queued='false' AND bundleId = '?' AND appBundle.appId = appFamily.appId",
|
else // We want to see a particular version.
|
||||||
$iAppId);
|
$oObject = new Version($aClean['iVersionId']);
|
||||||
if(!$hResult || query_num_rows($hResult) == 0)
|
|
||||||
{
|
|
||||||
return; // do nothing
|
|
||||||
}
|
|
||||||
|
|
||||||
echo html_frame_start("","98%","",0);
|
|
||||||
echo "<table width=\"100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"1\">\n\n";
|
|
||||||
|
|
||||||
echo "<tr class=\"color4\">\n";
|
|
||||||
echo " <td>Application Name</td>\n";
|
|
||||||
echo " <td>Description</td>\n";
|
|
||||||
echo "</tr>\n\n";
|
|
||||||
|
|
||||||
$c = 0;
|
|
||||||
while($ob = query_fetch_object($hResult))
|
|
||||||
{
|
|
||||||
$oApp = new application($ob->appId);
|
|
||||||
//set row color
|
|
||||||
$bgcolor = ($c % 2 == 0) ? "color0" : "color1";
|
|
||||||
|
|
||||||
//display row
|
|
||||||
echo "<tr class=\"$bgcolor\">\n";
|
|
||||||
echo " <td>".$oApp->objectMakeLink()."</td>\n";
|
|
||||||
echo " <td>".util_trim_description($oApp->sDescription)."</td>\n";
|
|
||||||
echo "</tr>\n\n";
|
|
||||||
|
|
||||||
$c++;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "</table>\n\n";
|
|
||||||
echo html_frame_end();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* We want to see an application family (=no version).
|
|
||||||
*/
|
|
||||||
if( isset($aClean['iAppId']) )
|
|
||||||
{
|
|
||||||
$oApp = new Application($aClean['iAppId']);
|
|
||||||
$oApp->display();
|
|
||||||
} else if( isset($aClean['iVersionId']) ) // We want to see a particular version.
|
|
||||||
{
|
|
||||||
$oVersion = new Version($aClean['iVersionId']);
|
|
||||||
|
|
||||||
// header
|
// header
|
||||||
apidb_header("Viewing App: ".version::fullName($oVersion->iVersionId));
|
apidb_header($oObject->objectGetCustomTitle("display"));
|
||||||
$oVersion->display($aClean);
|
|
||||||
|
if(isset($aClean['iVersionId']))
|
||||||
|
$oObject->display($aClean);
|
||||||
|
else
|
||||||
|
$oObject->display();
|
||||||
|
|
||||||
|
apidb_footer();
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
// Oops! Called with no params, bad llamah!
|
// Oops! Called with no params, bad llamah!
|
||||||
util_show_error_page_and_exit('Page Called with No Params!');
|
util_show_error_page_and_exit('Page Called with No Params!');
|
||||||
}
|
}
|
||||||
|
|
||||||
apidb_footer();
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ Application Database.</p>
|
|||||||
<p><b>A:</b> The Application Database is a repository for
|
<p><b>A:</b> The Application Database is a repository for
|
||||||
Windows application compatibility information with Wine.
|
Windows application compatibility information with Wine.
|
||||||
In particular it provides the following information:<br>
|
In particular it provides the following information:<br>
|
||||||
(see the <a href="/appview.php?iAppId=296">Visual FoxPro</a> entry for an
|
(see the <a href="/objectManager.php?sClass=application&iId=296">Visual FoxPro</a> entry for an
|
||||||
example)<p>
|
example)<p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Whether a given application works at all with Wine.</li>
|
<li>Whether a given application works at all with Wine.</li>
|
||||||
|
|||||||
@@ -628,6 +628,56 @@ class Application {
|
|||||||
$this->iMaintainerRequest = $aValues['iMaintainerRequest'];
|
$this->iMaintainerRequest = $aValues['iMaintainerRequest'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Displays the SUB apps that belong to this application.
|
||||||
|
*/
|
||||||
|
function displayBundle()
|
||||||
|
{
|
||||||
|
$hResult = query_parameters("SELECT appFamily.appId, appName, description FROM appBundle, appFamily ".
|
||||||
|
"WHERE appFamily.queued='false' AND bundleId = '?' AND appBundle.appId = appFamily.appId",
|
||||||
|
$this->iAppId);
|
||||||
|
if(!$hResult || query_num_rows($hResult) == 0)
|
||||||
|
{
|
||||||
|
return; // do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
echo html_frame_start("","98%","",0);
|
||||||
|
echo "<table width=\"100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"1\">\n\n";
|
||||||
|
|
||||||
|
echo "<tr class=\"color4\">\n";
|
||||||
|
echo " <td>Application Name</td>\n";
|
||||||
|
echo " <td>Description</td>\n";
|
||||||
|
echo "</tr>\n\n";
|
||||||
|
|
||||||
|
for($c = 0; $ob = query_fetch_object($hResult); $c++)
|
||||||
|
{
|
||||||
|
$oApp = new application($ob->appId);
|
||||||
|
//set row color
|
||||||
|
$bgcolor = ($c % 2 == 0) ? "color0" : "color1";
|
||||||
|
|
||||||
|
//display row
|
||||||
|
echo "<tr class=\"$bgcolor\">\n";
|
||||||
|
echo " <td>".$oApp->objectMakeLink()."</td>\n";
|
||||||
|
echo " <td>".util_trim_description($oApp->sDescription)."</td>\n";
|
||||||
|
echo "</tr>\n\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "</table>\n\n";
|
||||||
|
echo html_frame_end();
|
||||||
|
}
|
||||||
|
|
||||||
|
function objectGetCustomTitle($sAction)
|
||||||
|
{
|
||||||
|
switch($sAction)
|
||||||
|
{
|
||||||
|
case "display":
|
||||||
|
return "Viewing App: ".$this->sName;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* display this application */
|
/* display this application */
|
||||||
function display()
|
function display()
|
||||||
{
|
{
|
||||||
@@ -635,9 +685,6 @@ class Application {
|
|||||||
if(!$_SESSION['current']->canViewApplication($this))
|
if(!$_SESSION['current']->canViewApplication($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");
|
||||||
|
|
||||||
// header
|
|
||||||
apidb_header("Viewing App - ".$this->sName);
|
|
||||||
|
|
||||||
// cat display
|
// cat display
|
||||||
$oCategory = new Category($this->iCatId);
|
$oCategory = new Category($this->iCatId);
|
||||||
$oCategory->display($this->iAppId);
|
$oCategory->display($this->iAppId);
|
||||||
@@ -755,7 +802,7 @@ class Application {
|
|||||||
Version::displayList($this->aVersionsIds);
|
Version::displayList($this->aVersionsIds);
|
||||||
|
|
||||||
// display bundle
|
// display bundle
|
||||||
display_bundle($this->iAppId);
|
$this->displayBundle();
|
||||||
}
|
}
|
||||||
|
|
||||||
function lookup_name($appId)
|
function lookup_name($appId)
|
||||||
@@ -816,7 +863,7 @@ class Application {
|
|||||||
|
|
||||||
function objectMakeUrl()
|
function objectMakeUrl()
|
||||||
{
|
{
|
||||||
$sUrl = APPDB_ROOT."appview.php?iAppId=$this->iAppId";
|
$sUrl = APPDB_ROOT."objectManager.php?sClass=application&iId=$this->iAppId";
|
||||||
return $sUrl;
|
return $sUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user