зеркало из https://github.com/mozilla/pjs.git
Add initial support for viewing an item's history.
This needs some more work to improve it, but committing anyway.
This commit is contained in:
Родитель
21be94846d
Коммит
7b9d7cb7e5
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
/**
|
||||
* Addon history page. Displays all the previous releases for a particular
|
||||
* addon or theme
|
||||
*
|
||||
* @package amo
|
||||
* @subpackage docs
|
||||
*/
|
||||
|
||||
// Arrays to store clean inputs.
|
||||
$clean = array(); // General array for verified inputs.
|
||||
$sql = array(); // Trusted for SQL.
|
||||
|
||||
// Get our addon ID.
|
||||
$clean['ID'] = intval($_GET['id']);
|
||||
$sql['ID'] =& $clean['ID'];
|
||||
|
||||
$addon = new AddOn($sql['ID']);
|
||||
$addon->getHistory();
|
||||
// Assign template variables.
|
||||
$tpl->assign(
|
||||
array( 'addon' => $addon,
|
||||
'title' => $addon->Name,
|
||||
'content' => 'history.tpl')
|
||||
);
|
|
@ -52,6 +52,9 @@ class AddOn extends AMO_Object
|
|||
|
||||
// Categories.
|
||||
var $Cats;
|
||||
|
||||
// History of releases
|
||||
var $History;
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
|
@ -207,5 +210,34 @@ class AddOn extends AMO_Object
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
function getHistory()
|
||||
{
|
||||
// Gather history of an addon
|
||||
$this->db->query("
|
||||
SELECT
|
||||
TV.vID,
|
||||
TV.Version,
|
||||
TV.MinAppVer,
|
||||
TV.MaxAppVer,
|
||||
TV.Size,
|
||||
TV.URI,
|
||||
TV.Notes,
|
||||
UNIX_TIMESTAMP(TV.DateAdded) AS VerDateAdded,
|
||||
TA.AppName,
|
||||
TOS.OSName
|
||||
FROM
|
||||
version TV
|
||||
INNER JOIN applications TA ON TV.AppID = TA.AppID
|
||||
INNER JOIN os TOS ON TV.OSID = TOS.OSID
|
||||
WHERE
|
||||
TV.ID = {$this->ID} AND
|
||||
approved = 'YES'
|
||||
ORDER BY
|
||||
VerDateAdded DESC
|
||||
", SQL_ALL, SQL_ASSOC);
|
||||
|
||||
$this->History = $this->db->record;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
<h2><strong>{$addon->Name}</strong></h2>
|
||||
<p class="first">
|
||||
<strong><a href="./addon.php?id={$addon->ID}">{$addon->Name} {$addon->Version}</a></strong>,
|
||||
by <a href="./author.php?id={$addon->UserID}">{$addon->UserName}</a>,
|
||||
released on {$addon->VersionDateAdded|date_format}
|
||||
</p>
|
||||
|
||||
<h3>History of {$addon->Name}</h3>
|
||||
{section name=version loop=$addon->History}
|
||||
<div>
|
||||
<h3><a href="addon.php?id={$addon->ID}&vid=$vid">{$addon->Name} {$addon->History[version].Version}</a></h3>
|
||||
Released on {$addon->History[version].VerDateAdded|date_format:"%B %d, %Y"}<br>
|
||||
{if $addon->History[version].Notes}
|
||||
{$addon->History[version].Notes|nl2br}<br><br>
|
||||
{/if}
|
||||
|
||||
<div style="height: 34px">
|
||||
<div class="iconbar"><img src="{$config.webpath}/img/download.png" height="34" width="34" title="Install {$addon->History[version].Name} (Right-Click to Download)" alt="">Install</a><br><span class="filesize">Size: {$addon->History[version].Size|escape} kb</span></div>
|
||||
<div class="iconbar"><img src="{$config.webpath}/img/{$addon->History[version].AppName|lower}_icon.png" width="34" height="34" alt="{$addon->History[version].AppName}"> For {$addon->History[version].AppName}:<BR> {$addon->History[version].MinAppVer} - {$addon->History[version].MaxAppVer}</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
{/section}
|
Загрузка…
Ссылка в новой задаче