summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2010-02-14 00:56:07 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2010-02-14 00:56:07 +0000
commit8bc17dd3f0ed4dc520bb64b20dac8a31e72e447f (patch)
tree49fc67aaf19bfbc749c54d22522f31cfea8fabb5
parent704e66d0b489a7d3b0d4dcedc79515e5300732ff (diff)
downloadampache-8bc17dd3f0ed4dc520bb64b20dac8a31e72e447f.tar.gz
ampache-8bc17dd3f0ed4dc520bb64b20dac8a31e72e447f.tar.bz2
ampache-8bc17dd3f0ed4dc520bb64b20dac8a31e72e447f.zip
Tweaked how features / bandwidth level is checked, not happy with it.
-rw-r--r--config/ampache.cfg.php.dist18
-rw-r--r--lib/class/browse.class.php31
-rw-r--r--lib/class/config.class.php5
-rw-r--r--lib/class/preference.class.php3
-rw-r--r--lib/class/song.class.php7
-rw-r--r--lib/class/update.class.php8
-rw-r--r--lib/class/user.class.php4
-rw-r--r--lib/preferences.php14
-rw-r--r--templates/base.css6
-rw-r--r--templates/show_album_row.inc.php12
-rw-r--r--templates/show_albums.inc.php8
-rw-r--r--templates/show_artist.inc.php4
-rw-r--r--templates/show_now_playing_row.inc.php11
-rw-r--r--templates/show_random_albums.inc.php8
14 files changed, 77 insertions, 62 deletions
diff --git a/config/ampache.cfg.php.dist b/config/ampache.cfg.php.dist
index 1082286d..82e8ffae 100644
--- a/config/ampache.cfg.php.dist
+++ b/config/ampache.cfg.php.dist
@@ -237,11 +237,12 @@ default_auth_level = "admin"
; DEFAULT: true
ratings = "true"
-; Index features
-; Vollmer will probably write better stuff here than I will -Vlet
-; POSSIBLE VALUES: shout, played, added, now, random
-; DEFAULT: hmm
-features = "shout, played, added, now, random"
+; Sociable
+; This turns on / off all of the "social" features of ampache
+; default is on, but if you don't care and just want music
+; turn this off to disable all social features.
+; DEFAULT: true
+sociable = "true"
; This options will turn on/off Demo Mode
; If Demo mode is on you can not play songs or update your catalog
@@ -289,13 +290,6 @@ features = "shout, played, added, now, random"
; DEFAULT: db,id3,folder,lastfm,google
album_art_order = "db,id3,folder,lastfm,google"
-; Album Art
-; Set this to true if you want album art displayed on pages besides the
-; Single Album view, if you have a slow machine, or limited bandwidth
-; turning this off can vastly improve performance
-; DEFAULT: true
-show_album_art = "true"
-
; Amazon Developer Key
; These are needed in order to actually use the amazon album art
; Your public key is your 'Access Key ID'
diff --git a/lib/class/browse.class.php b/lib/class/browse.class.php
index f36c47f6..ab0e0e29 100644
--- a/lib/class/browse.class.php
+++ b/lib/class/browse.class.php
@@ -92,6 +92,28 @@ class Browse extends Query {
} // get_supplemental_objects
+ /**
+ * is_enabled
+ * This checks if the specified function/feature
+ * of browsing is enabled, not sure if this is the best
+ * way to go about it, but hey. Returns boolean t/f
+ */
+ public static function is_enabled($item) {
+
+ switch ($item) {
+ case 'show_art':
+ if (Browse::get_filter('show_art')) {
+ return true;
+ }
+ if (Config::get('bandwidth') > 25) {
+ return true;
+ }
+ break;
+ } // end switch
+
+ return false;
+
+ } // is_enabled
/**
* show_objects
@@ -235,8 +257,11 @@ class Browse extends Query {
} // _auto_init
- public static function set_filter_from_request($r)
- {
+ /**
+ * set_filter_from_request
+ * //FIXME
+ */
+ public static function set_filter_from_request($r) {
foreach ($r as $k=>$v) {
//reinterpret v as a list of int
$vl = explode(',', $v);
@@ -253,6 +278,6 @@ class Browse extends Query {
else
self::set_filter($k, $vl);
}
- }
+ } // set_filter_from_request
} // browse
diff --git a/lib/class/config.class.php b/lib/class/config.class.php
index 64a45522..d846f225 100644
--- a/lib/class/config.class.php
+++ b/lib/class/config.class.php
@@ -28,11 +28,6 @@
* config overides and/or local configs (for like dba)
* The class should be a static var in the other classes
*/
-
-define('BANDWIDTH_LOW', 0);
-define('BANDWIDTH_MEDIUM', 1);
-define('BANDWIDTH_HIGH', 2);
-
class Config {
// These are the settings for this specific class
diff --git a/lib/class/preference.class.php b/lib/class/preference.class.php
index 04d7f2f7..5dc0138d 100644
--- a/lib/class/preference.class.php
+++ b/lib/class/preference.class.php
@@ -226,7 +226,8 @@ class Preference {
$sql = "SELECT `preference`.`name`,`preference`.`description`,`user_preference`.`value` FROM `preference` " .
" INNER JOIN `user_preference` ON `user_preference`.`preference`=`preference`.`id` " .
- " WHERE `user_preference`.`user`='$user_id' AND `preference`.`catagory` != 'internal' $user_limit order by `preference`.`description`";
+ " WHERE `user_preference`.`user`='$user_id' AND `preference`.`catagory` != 'internal' $user_limit " .
+ " ORDER BY `preference`.`description`";
$db_results = Dba::read($sql);
$results = array();
diff --git a/lib/class/song.class.php b/lib/class/song.class.php
index 6b68df94..2c9ed839 100644
--- a/lib/class/song.class.php
+++ b/lib/class/song.class.php
@@ -918,7 +918,7 @@ class Song extends database_object implements media {
* it uses the popular threshold to figure out how many to pull
* it will only return unique object
*/
- public static function get_recently_played($user_id='', $limit=null) {
+ public static function get_recently_played($user_id='') {
if ($user_id) {
$user_limit = " AND `object_count`.`user`='" . Dba::escape($user_id) . "'";
@@ -936,10 +936,7 @@ class Song extends database_object implements media {
while ($row = Dba::fetch_assoc($db_results)) {
if (isset($results[$row['object_id']])) { continue; }
$results[$row['object_id']] = $row;
- if (!is_null($limit))
- if (count($results) > $limit) { break; }
- else
- if (count($results) > Config::get('popular_threshold')) { break; }
+ if (count($results) > Config::get('popular_threshold')) { break; }
}
return $results;
diff --git a/lib/class/update.class.php b/lib/class/update.class.php
index d51510b1..d92a1532 100644
--- a/lib/class/update.class.php
+++ b/lib/class/update.class.php
@@ -1840,9 +1840,13 @@ class Update {
$db_results = Dba::write($sql);
// Now add in the min_object_count preference and the random_method
- $sql = "INSERT INTO `preferences` (`name`,`value`,`description`,`level`,`type`,`catagory`) " .
- "VALUES('bandwidth','1','Bandwidth','100','integer','interface')";
+ $sql = "INSERT INTO `preference` (`name`,`value`,`description`,`level`,`type`,`catagory`) " .
+ "VALUES ('bandwidth','50','Bandwidth','5','integer','interface')";
$db_results = Dba::write($sql);
+
+ $sql = "INSERT INTO `preference` (`name`,`value`,`descriptoin`,`level`,`type`,`catagory`) " .
+ "VALUES ('features','50','Features','5','integer','interface')";
+ $db_results = Dba::write($sql);
/* Fix every users preferences */
$sql = "SELECT `id` FROM `user`";
diff --git a/lib/class/user.class.php b/lib/class/user.class.php
index 40065922..27d901bf 100644
--- a/lib/class/user.class.php
+++ b/lib/class/user.class.php
@@ -197,7 +197,8 @@ class User extends database_object {
$sql = "SELECT preference.name, preference.description, preference.catagory, preference.level, user_preference.value " .
"FROM preference INNER JOIN user_preference ON user_preference.preference=preference.id " .
- "WHERE user_preference.user='$user_id' " . $user_limit . " ORDER BY preference.catagory, preference.description";
+ "WHERE user_preference.user='$user_id' " . $user_limit .
+ " ORDER BY preference.catagory, preference.description";
$db_results = Dba::read($sql);
@@ -207,7 +208,6 @@ class User extends database_object {
$admin = false;
if ($type == 'system') { $admin = true; }
$type_array[$type][$r['name']] = array('name'=>$r['name'],'level'=>$r['level'],'description'=>$r['description'],'value'=>$r['value']);
- //ksort($type_array[$type]); // sorted this via sql and added sub-category sorting - Vlet
$results[$type] = array ('title'=>ucwords($type),'admin'=>$admin,'prefs'=>$type_array[$type]);
} // end while
diff --git a/lib/preferences.php b/lib/preferences.php
index 5b496ba0..67e7a5c7 100644
--- a/lib/preferences.php
+++ b/lib/preferences.php
@@ -260,11 +260,19 @@ function create_preference_input($name,$value) {
case 'bandwidth':
${"bandwidth_$value"} = ' selected="selected"';
echo "<select name=\"$name\">\n";
- echo "\t<option value=\"0\"$bandwidth_0>" . _('Low') . "</option>\n";
- echo "\t<option value=\"1\"$bandwidth_1>" . _('Medium') . "</option>\n";
- echo "\t<option value=\"2\"$bandwidth_2>" . _('High') . "</option>\n";
+ echo "\t<option value=\"25\"$bandwidth_25>" . _('Low') . "</option>\n";
+ echo "\t<option value=\"50\"$bandwidth_50>" . _('Medium') . "</option>\n";
+ echo "\t<option value=\"75\"$bandwidth_75>" . _('High') . "</option>\n";
echo "</select>\n";
break;
+ case 'features':
+ ${"features_$value"} = ' selected="selected"';
+ echo "<select name=\"$name\">\n";
+ echo "\t<option value=\"25\"$features_25>" . _('Low') . "</option>\n";
+ echo "\t<option value=\"50\"$features_50>" . _('Medium') . "</option>\n";
+ echo "\t<option value=\"75\"$features_75>" . _('High') . "</option>\n";
+ echo "</select>\n";
+ break;
case 'transcode':
${$value} = ' selected="selected"';
echo "<select name=\"$name\">\n";
diff --git a/templates/base.css b/templates/base.css
index ca508c35..834e2c39 100644
--- a/templates/base.css
+++ b/templates/base.css
@@ -25,7 +25,6 @@
* Tag Definitions
*****************/
-/* why god why!?
.tag_size1 {
font-size:.6em;
}
@@ -38,12 +37,11 @@
.tag_size4 {
font-size:1.2em;
}
-*/
a.tag_size1, a.tag_size2, a.tag_size3, a.tag_size4 { text-decoration: none; }
-/* .hover-add:hover { font-weight:900; } */ /* why god why!? */
-.hover-remove:hover { text-decoration:line-through;}
+.hover-add:hover { color: #347C17; }
+.hover-remove:hover { color: #FF0000; }
/*****************
* Generic / Misc
diff --git a/templates/show_album_row.inc.php b/templates/show_album_row.inc.php
index 0ec8f058..42984465 100644
--- a/templates/show_album_row.inc.php
+++ b/templates/show_album_row.inc.php
@@ -24,16 +24,12 @@
<?php echo Ajax::button('?action=basket&type=album_random&id=' . $album->id,'random',_('Random'),'random_album_' . $album->id); ?>
</td>
<?php
- if (Config::get('bandwidth') > BANDWIDTH_LOW) {
- $name = '[' . $album->f_artist . '] ' . scrub_out($album->full_name);
-
- // This should not be hard coded, but it will likely break all the themes.
- //$image_size = Config::get('bandwidth') == BANDWIDTH_MEDIUM ? 75 : 128;
- $image_size = 75;
+if (Browse::is_enabled('show_art')) {
+ $name = '[' . $album->f_artist . '] ' . scrub_out($album->full_name);
?>
<td class="cel_cover">
<a href="<?php echo Config::get('web_path'); ?>/albums.php?action=show&amp;album=<?php echo $album->id; ?>">
- <img height="<?php echo $image_size; ?>" width="<?php echo $image_size; ?>" alt="<?php echo($name) ?>" title="<?php echo($name) ?>" src="<?php echo Config::get('web_path'); ?>/image.php?id=<?php echo $album->id; ?>&amp;thumb=<?php echo Config::get('bandwidth'); ?>" />
+ <img height="75" width="75" alt="<?php echo($name) ?>" title="<?php echo($name) ?>" src="<?php echo Config::get('web_path'); ?>/image.php?id=<?php echo $album->id; ?>&amp;thumb=1" />
</a>
</td>
<?php } ?>
@@ -44,9 +40,11 @@
<td class="cel_tags"><?php echo $album->f_tags; ?></td>
<td class="cel_rating" id="rating_<?php echo $album->id; ?>_album"><?php Rating::show($album->id,'album'); ?></td>
<td class="cel_action">
+ <?php if (Config::get('sociable')) {
<a href="<?php echo Config::get('web_path'); ?>/shout.php?action=show_add_shout&amp;type=album&amp;id=<?php echo $album->id; ?>">
<?php echo get_user_icon('comment',_('Post Shout')); ?>
</a>
+ <?php } ?>
<?php if (Access::check_function('batch_download')) { ?>
<a href="<?php echo Config::get('web_path'); ?>/batch.php?action=album&amp;id=<?php echo $album->id; ?>">
<?php echo get_user_icon('batch_download',_('Batch Download')); ?>
diff --git a/templates/show_albums.inc.php b/templates/show_albums.inc.php
index 82436c40..68a6a4ca 100644
--- a/templates/show_albums.inc.php
+++ b/templates/show_albums.inc.php
@@ -25,9 +25,9 @@ $ajax_url = Config::get('ajax_url');
<table class="tabledata" cellpadding="0" cellspacing="0">
<colgroup>
<col id="col_add" />
- <?php if (Config::get('bandwidth') > BANDWIDTH_LOW) { ?>
+<?php if (Browse::is_enabled('show_art') { ?>
<col id="col_cover" />
- <?php } ?>
+<?php } ?>
<col id="col_album" />
<col id="col_artist" />
<col id="col_songs" />
@@ -38,7 +38,7 @@ $ajax_url = Config::get('ajax_url');
</colgroup>
<tr class="th-top">
<th class="cel_add"><?php echo _('Add'); ?></th>
- <?php if (Config::get('bandwidth') > BANDWIDTH_LOW) { ?>
+ <?php if (Browse::is_enabled('show_art') { ?>
<th class="cel_cover"><?php echo _('Cover'); ?></th>
<?php } ?>
<th class="cel_album"><?php echo Ajax::text('?page=browse&action=set_sort&type=album&sort=name',_('Album'),'album_sort_name'); ?></th>
@@ -69,7 +69,7 @@ $ajax_url = Config::get('ajax_url');
<?php } ?>
<tr class="th-bottom">
<th class="cel_add"><?php echo _('Add'); ?></th>
- <?php if (Config::get('bandwidth') > BANDWIDTH_LOW) { ?>
+ <?php if (Browse::is_enabled('show_art') { ?>
<th class="cel_cover"><?php echo _('Cover'); ?></th>
<?php } ?>
<th class="cel_album"><?php echo Ajax::text('?page=browse&action=set_sort&type=album&sort=name',_('Album'),'album_sort_name_bottom'); ?></th>
diff --git a/templates/show_artist.inc.php b/templates/show_artist.inc.php
index 24033e8b..4e63835d 100644
--- a/templates/show_artist.inc.php
+++ b/templates/show_artist.inc.php
@@ -60,6 +60,10 @@ if (Config::get('ratings')) {
<a href="<?php echo $web_path; ?>/batch.php?action=artist&id=<?php echo $artist->id; ?>"><?php echo _('Download'); ?></a>
</li>
<?php } ?>
+<li>
+ <input type="checkbox" id="show_artist_artCB" <?php echo $string = Browse::get_filter('show_art') ? 'checked="checked"' : ''; ?>/> <?php echo _('Show Art'); ?>
+ <?php echo Ajax::observe('show_artist_artCB','click',Ajax::action('?page=browse&action=browse&key=show_art&value=1&type=album','')); ?>
+</ul>
</div>
<?php show_box_bottom(); ?>
<?php
diff --git a/templates/show_now_playing_row.inc.php b/templates/show_now_playing_row.inc.php
index 66b3639d..bbc67541 100644
--- a/templates/show_now_playing_row.inc.php
+++ b/templates/show_now_playing_row.inc.php
@@ -23,11 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
$title = scrub_out(truncate_with_ellipsis($media->title));
$album = scrub_out(truncate_with_ellipsis($media->f_album_full));
$artist = scrub_out(truncate_with_ellipsis($media->f_artist_full));
-
-// This should not be hard coded, but it will likely break all the themes.
-//$image_size = Config::get('bandwidth') == BANDWIDTH_MEDIUM ? 75 : 128;
-$image_size = 75;
-
?>
<div class="np_group">
<div class="np_cell cel_username">
@@ -77,11 +72,11 @@ $image_size = 75;
</div>
</div>
-<?php if (Config::get('bandwidth') > BANDWIDTH_LOW) { ?>
+<?php if (Browse::is_enabled('show_art')) { ?>
<div class="np_group">
<div class="np_cell cel_albumart">
- <a target="_blank" href="<?php echo $web_path; ?>/image.php?id=<?php echo $media->album; ?>&amp;type=popup&amp;sid=<?php echo session_id(); ?>" onclick="popup_art('<?php echo $web_path; ?>/image.php?id=<?php echo $media->album; ?>&amp;type=popup&amp;sid=<?php echo session_id(); ?>'); return false;">
- <img align="middle" src="<?php echo $web_path; ?>/image.php?id=<?php echo $media->album; ?>&amp;thumb=<?php echo 1; /* This should be dynamic, but until themes are fixed to be more fluid in regards to images, make it static. */ /* Config::get('bandwidth'); */ ?>&amp;sid=<?php echo session_id(); ?>" alt="<?php echo scrub_out($media->f_album_full); ?>" title="<?php echo scrub_out($media->f_album_full); ?>" height="<?php echo $image_size; ?>" width="<?php echo $image_size; ?>" />
+ <a target="_blank" href="<?php echo $web_path; ?>/image.php?id=<?php echo $media->album; ?>&amp;type=popup" onclick="popup_art('<?php echo $web_path; ?>/image.php?id=<?php echo $media->album; ?>&amp;type=popup'); return false;">
+ <img align="middle" src="<?php echo $web_path; ?>/image.php?id=<?php echo $media->album; ?>&amp;thumb=1&amp;sid=<?php echo session_id(); ?>" alt="<?php echo scrub_out($media->f_album_full); ?>" title="<?php echo scrub_out($media->f_album_full); ?>" height="75" width="75" />
</a>
</div>
</div>
diff --git a/templates/show_random_albums.inc.php b/templates/show_random_albums.inc.php
index 2dee7f85..167e50b6 100644
--- a/templates/show_random_albums.inc.php
+++ b/templates/show_random_albums.inc.php
@@ -29,15 +29,11 @@ $button = Ajax::button('?page=index&action=random_albums','random',_('Refresh'),
$album = new Album($album_id);
$album->format();
$name = '[' . $album->f_artist . '] ' . scrub_out($album->full_name);
-
- // This should not be hard coded, but it will likely break all the themes.
- //$image_size = Config::get('bandwidth') == BANDWIDTH_MEDIUM ? 75 : 128;
- $image_size = 75;
?>
<div class="random_album">
<a href="<?php echo $web_path; ?>/albums.php?action=show&amp;album=<?php echo $album_id; ?>">
- <?php if (Config::get('bandwidth') > BANDWIDTH_LOW) { ?>
- <img src="<?php echo $web_path; ?>/image.php?thumb=3&amp;id=<?php echo $album_id; ?>&amp;thumb=<?php echo 1; /* This should be dynamic, but until themes are fixed to be more fluid in regards to images, make it static. */ /* Config::get('bandwidth'); */ ?>" width="<?php echo $image_size; ?>" height="<?php echo $image_size; ?>" alt="<?php echo $name; ?>" title="<?php echo $name; ?>" />
+ <?php if (Browse::is_enabled('show_art')) { ?>
+ <img src="<?php echo $web_path; ?>/image.php?thumb=3&amp;id=<?php echo $album_id; ?>" width="80" height="80" alt="<?php echo $name; ?>" title="<?php echo $name; ?>" />
<?php } else { ?>
<?php echo '[' . $album->f_artist . '] ' . $album->f_name; ?>
<?php } ?>