Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/site/app/views/addons/home.thtml
diff options
context:
space:
mode:
Diffstat (limited to 'site/app/views/addons/home.thtml')
-rw-r--r--site/app/views/addons/home.thtml311
1 files changed, 183 insertions, 128 deletions
diff --git a/site/app/views/addons/home.thtml b/site/app/views/addons/home.thtml
index 7d79eb0..0443155 100644
--- a/site/app/views/addons/home.thtml
+++ b/site/app/views/addons/home.thtml
@@ -24,7 +24,6 @@
* Frederic Wenzel <fwenzel@mozilla.com>
* Mike Morgan <morgamic@mozilla.com>
* Wil Clouser <clouserw@mozilla.com>
- * l.m.orchard <lorchard@mozilla.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@@ -39,142 +38,198 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
-
-// Pass a CSS class for the body tag up to the layout.
-$this->viewVars['bodyclass'] = 'home';
?>
-<?php ob_start() ?>
- <?= $javascript->link('amo2009/home.js') ?>
-<?php $this->viewVars['head_extra'] = ob_get_clean() ?>
-
-<?php /* Display locale-formatted site stats, if available (bug 492998). */ ?>
-<?php ob_start() ?>
- <?php $lc = localeconv(); ?>
- <ul class="stats">
- <?php if (!empty($stats_downloaded)): ?>
- <li><?=sprintf(
- n___('addons_home_stats_downloaded', 'addons_home_stats_downloaded', $stats_downloaded),
- $html->number_format($stats_downloaded, 0)
- )?></li>
- <?php endif ?>
- <?php if (!empty($stats_inuse)): ?>
- <li><?=sprintf(
- n___('addons_home_stats_inuse', 'addons_home_stats_inuse', $stats_inuse),
- $html->number_format($stats_inuse, 0)
- )?></li>
- <?php endif ?>
- </ul>
-<?php $this->viewVars['header_extra'] = ob_get_clean() ?>
-
-<div class="secondary" role="complementary">
- <?=$this->renderElement('amo2009/categories', array('clickable_header'=>FALSE))?>
-
- <?php /*
- TODO: Enable this when there's content for developer center, leaving it for
- the markup example
- */ ?>
- <?php if (false): ?>
- <div class="highlight">
- <h3>Create a Firefox Add-on</h3>
- <p>
- Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
- eiusmod tempor incididunt ut labore et dolore magna aliqua.
- </p>
- <p><strong><a href="#">Visit the Developer Center</a></strong></p>
- </div>
- <?php endif ?>
-
-</div>
-
-<div class="primary" role="main">
+<div id="content" class="main-page">
- <?=$this->renderElement('amo2009/search')?>
+<?=$this->renderElement('search')?>
- <? if(APP_ID == APP_FIREFOX): ?>
- <?=$this->renderElement('amo2009/teaser_collections', array(
- 'teaser_collection_promos' => $teaser_collection_promos,
- 'promoted_collections' => $promoted_collections
- ))?>
- <? endif; ?>
+<div id="content-main">
+ <?php
+ if (count($featureAddons) != 0) {
+ ?>
+ <h3><?=_('addons_home_feature_head')?></h3>
- <h2><?=___('addons_home_browse_title', 'Browse Add-ons')?></h2>
- <div class="primary">
- <div class="featured show-<?=$featured_type?> listing" id="featured">
- <div class="featured-inner">
- <div class="listing-header">
- <ul>
- <li<?= ('recommended'==$featured_type) ? ' class="selected"' : '' ?>>
- <a href="?featured=recommended#featured"><?=___('addons_home_browse_recommended', 'Recommended')?></a></li>
- <li<?= ('popular'==$featured_type) ? ' class="selected"' : '' ?>>
- <a href="?featured=popular#featured"><?=___('addons_home_browse_popular', 'Popular')?></a></li>
- <li<?= ('added'==$featured_type) ? ' class="selected"' : '' ?>>
- <a href="?featured=added#featured"><?=___('addons_home_browse_new', 'Just Added')?></a></li>
- <li<?= ('updated'==$featured_type) ? ' class="selected"' : '' ?>>
- <a href="?featured=updated#featured"><?=___('addons_home_browse_updated', 'Updated')?></a></li>
+ <div id="slider" class="slider_widget">
+ <div class="inner">
+ <div class="viewport">
+ <ul class="item_set">
+ <?php
+ $fyf_time = gmmktime(16, 00, 00, 11, 18, 2008);
+ $fyf = ($fyf_time < gmmktime() && LANG == 'en-US' && APP_ID == APP_FIREFOX); // is it FYF promo time?
+ $total_features = min(count($featureAddons), ($fyf ? 6 : 5)); // FYF promo
+ for ($idx=1; $idx<=$total_features; $idx++) {
+
+ $prev_idx = $idx - 1;
+ if ($prev_idx < 1) $prev_idx = $total_features;
+ $next_idx = $idx + 1;
+ if ($next_idx > $total_features) $next_idx = 1;
+
+ if (!$fyf || $idx > 1) // FYF promo
+ $feature1 = array_shift($featureAddons);
+ ?>
+ <li id="feature1_<?=$idx?>" class="item addon featured main">
+ <?php
+ if ($fyf && $idx == 1):
+ echo $this->renderElement('fyf_promotion');
+ else:
+ ?>
+ <?=$this->renderElement('feature', array(
+ 'addonIconPath' => $this->controller->Image->getAddonIconURL($feature1['Addon']['id']),
+ 'addonThumbPath' => $this->controller->Image->getHighlightedPreviewURL($feature1['Addon']['id']),
+ 'addonName' => $feature1['Translation']['name']['string'],
+ 'addonSummary' => $feature1['Translation']['summary']['string'],
+ 'addonId' => $feature1['Addon']['id'],
+ 'addonFiles' => $feature1['File'],
+ 'addonEULA' => $feature1['Translation']['eula']['string'],
+ 'addonStatus' => $feature1['Addon']['status'],
+ 'addonAuthors' => $feature1['User'],
+ 'addonTags' => $feature1['Tag'],
+ 'addonWeeklyDownloads' => $feature1['Addon']['weeklydownloads'],
+ 'allPlatforms' => $platforms,
+ 'compatible_apps' => $feature1['compatible_apps'],
+ 'addonType' => $feature1['Addon']['addontype_id'],
+ 'addonRating' => $feature1['Addon']['averagerating'],
+ 'addonReviews' => $feature1['Addon']['totalreviews'],
+ 'addonVersionCreated' => $feature1['Version'][0]['created']
+ ))?>
+ <?php endif; ?>
+ </li>
+ <?php
+ } ?>
</ul>
</div>
- <div class="addon-listing">
- <?=$this->renderElement('amo2009/homepage_addon_listing')?>
+ <div class="controls">
+ <div class="controls_inner">
+ <a href="#slider" title="Previous" class="prev">
+ <img src="<?=$html->urlImage("slider-prev-disabled.gif")?>"
+ width="30" height="30" alt="<?=___('addon_slider_tooltip_previous', 'Previous Add-on')?>"
+ title="<?=___('addon_slider_tooltip_previous', 'Previous Add-on')?>" />
+ </a>
+ <span class="indicator">
+ <span class="index">1</span>
+ /
+ <span class="total"><?=$total_features?></span>
+ </span>
+ <a href="#slider" title="Next" class="next">
+ <img src="<?=$html->urlImage("slider-next.gif")?>"
+ width="30" height="30" alt="<?=___('addon_slider_tooltip_next', 'Next Add-on')?>"
+ title="<?=___('addon_slider_tooltip_next', 'Next Add-on')?>" />
+ </a>
+ </div>
</div>
- <script type="text/javascript">
- $(document).ready(function(){
- $('.listing-header a').click(function(e){
- e.preventDefault();
- var link = $(this);
- link.addClass('loading');
- $('.listing-header .selected').removeClass('selected');
- link.parent().addClass('selected');
- $.get('<?=$html->url('/addons/ajaxy')?>' + link.attr('href'),
- function(content){
- $('.addon-listing').html(content);
- link.removeClass('loading');
- });
- });
- });
- </script>
</div>
+
+ <div class="vex"><span><!-- bottom edge --></span></div>
+ </div>
+ <?php
+ }
+ ?>
+
+ <div id="secondaries">
+ <?php
+ foreach($featureAddons as $id => $addon):
+ $idx = $id + 2;
+ ?>
+ <div id="feature<?=$idx?>" class="addon featured sub">
+ <div class="irk">
+ <?=$this->renderElement('feature', array(
+ 'addonIconPath' => $this->controller->Image->getAddonIconURL($addon['Addon']['id']),
+ 'addonThumbPath' => $this->controller->Image->getHighlightedPreviewURL($addon['Addon']['id']),
+ 'addonName' => $addon['Translation']['name']['string'],
+ 'addonSummary' => $addon['Translation']['summary']['string'],
+ 'addonId' => $addon['Addon']['id'],
+ 'addonEULA' => $addon['Translation']['eula']['string'],
+ 'addonStatus' => $addon['Addon']['status'],
+ 'addonAuthors' => $addon['User'],
+ 'addonWeeklyDownloads' => $addon['Addon']['weeklydownloads'],
+ 'allPlatforms' => $platforms,
+ 'addonType' => $addon['Addon']['addontype_id'],
+ 'addonRating' => $addon['Addon']['averagerating'],
+ 'addonReviews' => $addon['Addon']['totalreviews']
+ ))?>
+ </div>
+ <div class="vex"><span><!-- bottom edge --></span></div>
</div>
- </div>
+ <?php endforeach; ?>
+ </div><!-- /#secondaries -->
+
+ <div id="content-extra">
- <div class="secondary">
- <img class="pull-right" src="<?=$html->url('/img/amo2009/illustrations/logo-collections-100x125.png', null, false, false)?>" alt=""/>
- <h3><a href="<?=$html->url('/collections')?>"><?=___('addons_home_collections','Collections')?></a>
- <span class="new indicator"><?=___('addons_home_new_indicator', 'NEW!')?></span></h3>
- <p><?=___('addons_home_collections_intro', '
- Collections are a way for you to categorize, mix, match and mingle
- add-ons. Subscribe to collections created by other users or create your
- own.
- ')?></p>
+<?php
+ /**
+ * Developer tools
+ * Shows links to dev cp and admin stuff depending on user permissions.
+ * If the user is not logged in, they won't see any of this.
+ */
+ if ($this->controller->Session->check('User')) {
+?>
+ <div id="developer" class="extra">
+ <h3><?=(!empty($welcomeName) ? sprintf(_('sidebar_navlink_welcome_name'), $welcomeName) : _('sidebar_navlink_welcome'))?></h3>
+ <ul>
+ <li><?=$html->link(_('sidebar_navlink_developer_tools'), '/developers/dashboard')?></li>
+ <?php if ($this->controller->SimpleAcl->actionAllowed('Editors', '%', $this->controller->Session->read('User'))): ?>
+ <li><?=$html->link(_('sidebar_navlink_editor_tools'), '/editors')?></li>
+ <?php endif;
+ if ($this->controller->SimpleAcl->actionAllowed('Localizers', '%', $this->controller->Session->read('User'))): ?>
+ <li><?=$html->link('Localizer Tools', '/localizers')?></li>
+ <?php endif;
+ if ($this->controller->SimpleAcl->actionAllowed('Admin', '%', $this->controller->Session->read('User'))): ?>
+ <li><?=$html->link(_('sidebar_navlink_admin_tools'), '/admin')?></li>
+ <?php endif; ?>
+ </ul>
+ </div>
+<?php
+ }
+?>
- <?php if (!empty($popular_collections)): ?>
- <h4><?=___('addons_home_collection_popular_title', 'Popular Collections')?></h4>
- <?php foreach ($popular_collections as $c): ?>
- <div class="item">
- <h5>
- <img class="icon" src="<?=$c['icon_url']?>" width="32" height="32" alt="<?=$c['name']?>"/>
- <?=$link->collection(array(
- 'Collection' => array('uuid'=>$c['uuid'], 'nickname'=>$c['nickname']),
- 'Translation' => array('name'=>array('string'=>$c['name']))
- ))?>
- <span><?=_('addons_home_by')?> <?=$html->linkUsersFromModel($c['authors'], null);?></span>
- </h5>
- <blockquote cite="#">
- <p><?=$html->truncateChars(200, $c['description'])?></p>
- </blockquote>
- <div class="meta">
- <span class="addons"><?=sprintf(
- n___('addons_home_collections_addon_count','addons_home_collections_addon_count',$c['addons_count']),
- $c['addons_count']
- )?></span>
- <span class="subscribers"><?=sprintf(
- n___('addons_home_collections_subscribers','addons_home_collections_subscribers',$c['subscribers']),
- $c['subscribers'])
- ?></span>
- </div>
- </div>
- <?php endforeach ?>
- <?php endif ?>
- <p><a class="more-info" href="<?=$html->url('/collections')?>"><?=___('addons_home_collections_all', 'View All Collections')?></a></p>
- </div>
-</div>
+ <div id="recs" class="extra">
+ <h3><?=_('addons_home_recommended_header')?></h3>
+ <ul>
+ <? foreach ($recAddons as $recAddon): ?>
+ <li><?=$html->link($recAddon['Translation']['name']['string'], "/addon/{$recAddon['Addon']['id']}")?><br />
+ <span><?=isset($recAddon['Tag'][0]['Translation']['name']['string']) ? $recAddon['Tag'][0]['Translation']['name']['string'] : ''; ?></span>
+ </li>
+ <? endforeach; ?>
+ </ul>
+ <p class="view-all"><a href="<?=$html->url('/recommended')?>" class="view" title="<?=_('addons_home_view_all_recommended_title')?>"><?=_('addons_home_view_all')?></a></p>
+
+ <h3><?=_('addons_home_popular_header')?></h3>
+ <ul>
+ <? foreach ($popAddons as $popAddon): ?>
+ <li><?=$html->link($popAddon['Translation']['name']['string'], "/addon/{$popAddon['Addon']['id']}")?><br />
+ <span><?=isset($popAddon['Tag'][0]['Translation']['name']['string']) ? $popAddon['Tag'][0]['Translation']['name']['string'] : ''; ?></span>
+ </li>
+ <? endforeach; ?>
+ </ul>
+ <p class="view-all"><a href="<?=$html->url("/browse/type:1/cat:all?sort=popular")?>" class="view" title="<?=_('addons_home_view_all_popular_title')?>"><?=_('addons_home_view_all')?></a></p>
+
+ <h3><?=___('addons_home_newest_header','Newest:')?></h3>
+ <ul>
+ <? foreach ($newAddons as $newAddon): ?>
+ <li><?=$html->link($newAddon['Translation']['name']['string'], "/addon/{$newAddon['Addon']['id']}")?> <br />
+ <span><?= isset($newAddon['Tag'][0]['Translation']['name']['string']) ? $newAddon['Tag'][0]['Translation']['name']['string'] : '' ; ?></span>
+ </li>
+ <? endforeach; ?>
+ </ul>
+ <p class="view-all"><a href="<?=$html->url("/browse/type:1/cat:all?sort=newest")?>" class="view" title="<?=_('addons_home_view_all_newest_title')?>"><?=_('addons_home_view_all')?></a></p>
+
+ <h3><?=___('addons_home_updated_header', 'Recently Updated:')?></h3>
+ <ul>
+ <? foreach ($updAddons as $updAddon): ?>
+ <li><?=$html->link($updAddon['Translation']['name']['string'], "/addon/{$updAddon['Addon']['id']}")?><br />
+ <span><?= $updAddon['Tag'][0]['Translation']['name']['string']; ?></span>
+ </li>
+ <? endforeach; ?>
+ </ul>
+ <p class="view-all"><a href="<?=$html->url("/browse/type:1/cat:all?sort=updated")?>" class="view" title="<?=_('addons_home_view_all_updated_title')?>"><?=_('addons_home_view_all')?></a></p>
+ </div>
+ </div><!-- /#content-extra -->
+
+</div><!-- /#content-main -->
+
+<?=$this->renderElement('sidebar', array('pitch'=>true))?>
+
+<?=$this->renderElement('app_chooser')?>
+
+</div><!-- /#content -->