summaryrefslogtreecommitdiffstats
path: root/templates/show_index.inc.php
diff options
context:
space:
mode:
authormartian <martian@ampache>2010-02-09 17:44:44 +0000
committermartian <martian@ampache>2010-02-09 17:44:44 +0000
commit1b35c20dd0a93b143d8b9542743a743e0db66386 (patch)
tree0500ae3eec1dfb70b66c3ca30e9a61da2c0daba8 /templates/show_index.inc.php
parent5e52f0d7ccb6183d7e1b4e5033adad0d08a48eb6 (diff)
downloadampache-1b35c20dd0a93b143d8b9542743a743e0db66386.tar.gz
ampache-1b35c20dd0a93b143d8b9542743a743e0db66386.tar.bz2
ampache-1b35c20dd0a93b143d8b9542743a743e0db66386.zip
Adding the bandwidth option to the preferences. This changes the complexity of the UI and toggles album art.
Diffstat (limited to 'templates/show_index.inc.php')
-rw-r--r--templates/show_index.inc.php116
1 files changed, 89 insertions, 27 deletions
diff --git a/templates/show_index.inc.php b/templates/show_index.inc.php
index f5b2558d..12c7aae8 100644
--- a/templates/show_index.inc.php
+++ b/templates/show_index.inc.php
@@ -28,32 +28,94 @@
</div><!-- End XSPF Player -->
+<?
-<div id="now_playing">
- <?php show_now_playing(); ?>
-</div> <!-- Close Now Playing Div -->
-<!-- Randomly selected albums of the moment -->
- <?php echo Ajax::observe('window','load',Ajax::action('?page=index&action=random_albums','random_albums')); ?>
-<div id="random_selection">
- <?php show_box_top(_('Albums of the Moment')); echo _('Loading...'); show_box_bottom(); ?>
-</div>
-<!-- Recently Played -->
-<div id="recently_played">
- <?php
- $data = Song::get_recently_played();
- Song::build_cache(array_keys($data));
- require_once Config::get('prefix') . '/templates/show_recently_played.inc.php';
- ?>
-</div>
-<!-- Shoutbox Objects, if shoutbox is enabled -->
-<?php if (Config::get('shoutbox')) { ?>
-<div id="shout_objects">
- <?php
- $shouts = shoutBox::get_top('5');
- if (count($shouts)) {
- require_once Config::get('prefix') . '/templates/show_shoutbox.inc.php';
- }
- ?>
-</div>
-<?php } ?>
+// Various settings for the 'bandwidth' option
+$feature_sets = array
+ (
+ BANDWIDTH_LOW => array('now', 'played'),
+ BANDWIDTH_MEDIUM => array('now', 'random', 'played'),
+ BANDWIDTH_HIGH => array('now', 'random', 'shout', 'played', 'added')
+ );
+
+$feature_limits = array (
+ BANDWIDTH_LOW => array
+ (
+ 'shout' => 7,
+ 'played' => 7,
+ 'added' => 7
+ ),
+ BANDWIDTH_MEDIUM => array
+ (
+ 'shout' => 10,
+ 'played' => 10,
+ 'added' => 10
+ ),
+ BANDWIDTH_HIGH => array
+ (
+ 'shout' => 10,
+ 'played' => 20,
+ 'added' => 20
+ )
+ );
+
+$features = $feature_sets[Config::get('bandwidth')];
+
+foreach ($features as $feature) {
+ switch ($feature) {
+ case 'shout':
+ ?><div id="shout_objects"><?
+
+ $shouts = shoutBox::get_top($feature_limits[Config::get('bandwidth')][$feature]);
+
+ if (count($shouts)) require_once Config::get('prefix') . '/templates/show_shoutbox.inc.php';
+
+ ?></div><?
+
+ break;
+ case 'played':
+ ?><div id="recently_played"><?
+
+ $data = Song::get_recently_played('', $feature_limits[Config::get('bandwidth')][$feature]);
+
+ Song::build_cache(array_keys($data));
+
+ require_once Config::get('prefix') . '/templates/show_recently_played.inc.php';
+
+ ?></div><?
+
+ break;
+ case 'added':
+ show_box_top("Recently Added Albums");
+
+ $object_ids = Stats::get_newest('album', $feature_limits[Config::get('bandwidth')][$feature]);
+
+ echo _('Newest Albums');
+
+ require_once Config::get('prefix') . '/templates/show_albums.inc.php';
+
+ show_box_bottom();
+
+ break;
+ case 'now':
+ ?><div id="now_playing"><?
+
+ show_now_playing();
+
+ ?></div><?
+
+ break;
+ case 'random':
+ echo Ajax::observe('window','load',Ajax::action('?page=index&action=random_albums','random_albums'));
+
+ ?><div id="random_selection"><?
+
+ show_box_top(_('Albums of the Moment')); echo _('Loading...'); show_box_bottom();
+
+ ?></div><?
+
+ break;
+ }
+}
+?>