Replaced the old application version code, so there is a table now that displays all

the compatible versions.
This commit is contained in:
bugzilla%micropipes.com 2006-03-05 06:35:34 +00:00
parent b460a1f1d3
commit da4359d404
3 changed files with 57 additions and 9 deletions

View File

@ -21,7 +21,16 @@ released on {$addon->VersionDateAdded|date_format}
<p>{$addon->Description}</p>
<p class="requires">
Requires: {$addon->AppName} {$addon->MinAppVer} - {$addon->MaxAppVer} <img src="{$config.webpath}/images/{$addon->AppName|lower}_icon.png" width="34" height="34" alt="{$addon->AppName}">
<b>Requires:</b>
<table>
{section name=AppVersions loop=$addon->AppVersions}
<tr>
<td><img src="{$config.webpath}/images/{$addon->AppVersions[AppVersions].AppName|lower}_icon.png" width="34" height="34" alt="{$addon->AppVersions[AppVersions].AppName}"></td>
<td>{$addon->AppVersions[AppVersions].AppName}</td>
<td>{$addon->AppVersions[AppVersions].MinAppVer} - {$addon->AppVersions[AppVersions].MaxAppVer}</td>
</tr>
{/section}
</table>
</p>
<div class="key-point install-box">

View File

@ -32,14 +32,13 @@ class AddOn extends AMO_Object {
// Current version information.
var $vID;
var $Version;
var $MinAppVer;
var $MaxAppVer;
var $Size;
var $URI;
var $Notes;
var $VersionDateAdded;
var $AppName;
var $OSName;
var $AppVersions;
// Preview information.
var $PreviewID;
@ -87,6 +86,7 @@ class AddOn extends AMO_Object {
$this->getCurrentVersion();
$this->getMainPreview();
$this->getUserInfo();
$this->getAppVersions();
}
/**
@ -189,18 +189,14 @@ class AddOn extends AMO_Object {
SELECT
version.vID,
version.Version,
version.MinAppVer,
version.MaxAppVer,
version.Size,
version.URI,
version.Notes,
version.DateAdded as VersionDateAdded,
applications.AppName,
os.OSName
applications.AppName
FROM
version
INNER JOIN applications ON version.AppID = applications.AppID
INNER JOIN os ON version.OSID = os.OSID
WHERE
version.ID = '{$this->ID}' AND
version.approved = 'YES'
@ -301,5 +297,41 @@ class AddOn extends AMO_Object {
$this->setVar('AddonCats',$this->db->record);
}
/**
* Retrieve all compatible applications and their versions. This only returns
* the applications that are marked as "supported" in the db!
*/
function getAppVersions() {
$_final = array();
$this->db->query("
SELECT
`applications`.`AppName`,
`version`.`MinAppVer`,
`version`.`MaxAppVer`
FROM
`version`
INNER JOIN
`applications`
ON
`version`.`AppID` = `applications`.`AppID`
WHERE
`version`.`Version`='{$this->Version}'
AND
`version`.`ID`={$this->ID}
AND
`applications`.`supported` = 1
", SQL_ALL, SQL_ASSOC);
foreach ($this->db->record as $var => $val) {
$_final[] = array (
'AppName' => $val['AppName'],
'MinAppVer' => $val['MinAppVer'],
'MaxAppVer' => $val['MaxAppVer'],
);
}
$this->setVar('AppVersions',$_final);
}
}
?>

View File

@ -18,3 +18,10 @@ CREATE TABLE `session_data` (
ALTER TABLE `feedback` ADD `UserID` INT( 11 ) AFTER `ID`;
ALTER TABLE `feedback` ADD INDEX ( `UserID` );
ALTER TABLE `feedback` ADD CONSTRAINT `feedback_ibfk_2` FOREIGN KEY (`UserID`) REFERENCES `userprofiles` (`UserID`) ON DELETE CASCADE ON UPDATE CASCADE;
-- If you want the app to show up on the "supported applications" table for the
-- extension this has to be '1'
ALTER TABLE `applications` ADD `supported` TINYINT( 1 ) DEFAULT '0' NOT NULL ;
-- Set the "supported" applications:
UPDATE `applications` SET `supported`=1 WHERE `AppName` IN('Firefox','Thunderbird','Mozilla');