Added rotating features to the front page. These will be controlled using the "reviews manager" of the existing developer tools.

The rotating feature on the front page assumes that:
    a) there is already a feature that exists -- it barfs when there are zero features in the database for a given application
    b) the main preview (preview='yes' in previews):
        i) exists
        ii) is a reasonable size

Some additions to the reviews manager would be:
    a) adding the "feature" screenshot along with the review so admins have control over what the actual feature looks like
    b) possibly requireing screenshots marked as "preview" to be a certain dimension so we can actually rely on the pixel width assumption
This commit is contained in:
mike.morgan%oregonstate.edu 2006-01-30 08:44:02 +00:00
Родитель 475fdad335
Коммит 1dc0a2d8dc
4 изменённых файлов: 56 добавлений и 31 удалений

Просмотреть файл

@ -35,34 +35,12 @@ switch( $_GET['app'] ) {
// We have to ucfirst() it because the DB has caps.
$sql['app'] = $clean['app'];
// Get most popular extensions based on application.
$db->query("
SELECT DISTINCT
TM.ID ID,
TM.Name name,
TM.downloadcount dc
FROM
main TM
INNER JOIN version TV ON TM.ID = TV.ID
INNER JOIN applications TA ON TV.AppID = TA.AppID
INNER JOIN os TOS ON TV.OSID = TOS.OSID
WHERE
AppName = '{$sql['app']}' AND
downloadcount > '0' AND
approved = 'YES' AND
Type = 'E'
ORDER BY
downloadcount DESC
LIMIT
5
", SQL_ALL, SQL_ASSOC);
$popularExtensions = $db->record;
$amo = new AMO_Object();
// Assign template variables.
$tpl->assign(
array( 'popularExtensions' => $popularExtensions,
array( 'popularExtensions' => $amo->getPopularAddons($sql['app'],'E',5),
'feature' => $amo->getFeature($sql['app']),
'title' => $clean['app'].' Addons',
'currentTab' => $currentTab)
);

Просмотреть файл

@ -3,13 +3,13 @@
<div class="split-feature-one">
<div class="feature-download">
<!-- Feature Image must be 200px wide... any height is fine, but around 170-200 is preferred -->
<a href="{$config.webpath}/addon.php?id=1532"><img src="{$config.webpath}/images/features/del.icio.us.png" width="200" height="213" alt="del.icio.us Extension"></a>
<h3><a href="http://releases.mozilla.org/pub/mozilla.org/extensions/del.icio.us/del.icio.us-1.0.2-fx.xpi" onclick="return install(event,'del.icio.us 1.0.2', '{$config.webpath}/images/default.png');" title="Install del.icio.us 1.0.2 (Right-Click to Download)">Install Extension (62 KB)</a> </h3>
<a href="{$config.webpath}/{$app}/{$feature.id}/"><img src="{$config.webpath}{$feature.previewuri}" alt="{$feature.name} Extension"></a>
<h3><a href="{$feature.uri}" onclick="return install(event,'{$feature.name} {$feature.version}', '{$config.webpath}/images/default.png');" title="Install {$feature.name} {$feature.version} (Right-Click to Download)">Install Extension ({$feature.size} KB)</a> </h3>
</div>
<h2>Featured Extension</h2>
<h2><a href="{$config.webpath}/addon.php?id=1532">del.icio.us</a></h2>
<p class="first">Harness the power of social bookmarking right in your browser with the del.icio.us Firefox extension! The del.icio.us extension for Firefox offers everything you need to seamlessly integrate the del.icio.us service with your Firefox browser. <a href="{$config.webpath}/addon.php?id=1532">Learn more...</a></p>
<h2><a href="{$config.webpath}/{$app}/{$feature.id}/">{$feature.name}</a></h2>
<p class="first">{$feature.body|nl2br} <a href="{$config.webpath}/{$app}/{$feature.id}/">Learn more...</a></p>
</div>
<a class="top-feature" href="{$config.webpath}/{$app}/recommended/"><img src="{$config.webpath}/images/feature-recommend.png" width="213" height="128" style="padding-left: 12px;" alt="We Recommend: See some of our favorite extensions to get you started."></a>

Просмотреть файл

@ -1,7 +1,7 @@
<div id="mBody">
<h1>Getting Started with Extensions</h1>
<p>With over 300 extensions available for Firefox, there's something for everyone. To get you started, here's a list of some of our recommended extensions that make use of popular online services.</p>
<p>With over thousands of extensions available, there's something for everyone. To get you started, here's a list of some of our recommended extensions that make use of popular online services.</p>
{section name=re loop=$recommendedExtensions step=1 start=0}
<div class="recommended">

Просмотреть файл

@ -215,7 +215,7 @@ class AMO_Object
}
/**
* Get most popular addons.
* Get recommended addons.
*
* @param string $app
* @param string $type
@ -262,5 +262,52 @@ class AMO_Object
return $this->db->record;
}
/**
* Get feature for front page.
*
* @param string $app
* @param string $type
* @return array
*/
function getFeature($app='firefox',$type='E') {
// Return a random feature.
// Yes, rand(now()) is a random (hehe) way to do it.
// I'm open to suggestions.
$this->db->query("
SELECT DISTINCT
m.id,
m.name,
m.downloadcount,
v.dateupdated,
v.uri,
r.body,
r.title,
v.size,
v.version,
p.previewuri
FROM
main m
INNER JOIN version v ON m.ID = v.ID
INNER JOIN applications TA ON v.AppID = TA.AppID
INNER JOIN os o ON v.OSID = o.OSID
INNER JOIN reviews r ON m.ID = r.ID
INNER JOIN previews p ON p.ID = m.ID
WHERE
AppName = '{$app}' AND
downloadcount > '0' AND
approved = 'YES' AND
Type = '{$type}' AND
r.featured = 'YES' AND
p.preview = 'YES'
GROUP BY
m.ID
ORDER BY
rand(now())
LIMIT 1
", SQL_INIT, SQL_ASSOC);
return $this->db->record;
}
}
?>