diff options
-rw-r--r-- | browse.php | 6 | ||||
-rwxr-xr-x | docs/CHANGELOG | 3 | ||||
-rw-r--r-- | lib/class/browse.class.php | 57 | ||||
-rw-r--r-- | templates/show_song_row.inc.php | 3 | ||||
-rw-r--r-- | templates/show_songs.inc.php | 4 |
5 files changed, 64 insertions, 9 deletions
@@ -43,6 +43,7 @@ switch($_REQUEST['action']) { case 'album': Browse::reset_filters(); Browse::set_type('album'); + Browse::set_simple_browse(1); Browse::set_sort('name','ASC'); $album_ids = Browse::get_objects(); Browse::show_objects($album_ids); @@ -50,6 +51,7 @@ switch($_REQUEST['action']) { case 'artist': Browse::reset_filters(); Browse::set_type('artist'); + Browse::set_simple_browse(1); Browse::set_sort('name','ASC'); $artist_ids = Browse::get_objects(); Browse::show_objects($artist_ids); @@ -57,6 +59,7 @@ switch($_REQUEST['action']) { case 'genre': Browse::reset_filters(); Browse::set_type('genre'); + Browse::set_simple_browse(1); Browse::set_sort('name','ASC'); $genre_ids = Browse::get_objects(); Browse::show_objects($genre_ids); @@ -64,6 +67,7 @@ switch($_REQUEST['action']) { case 'song': Browse::reset_filters(); Browse::set_type('song'); + Browse::set_simple_browse(1); Browse::set_sort('title','ASC'); $song_ids = Browse::get_objects(); Browse::show_objects($song_ids); @@ -71,6 +75,7 @@ switch($_REQUEST['action']) { case 'live_stream': Browse::reset_filters(); Browse::set_type('live_stream'); + Browse::set_simple_browse(1); Browse::set_sort('name','ASC'); $live_stream_ids = Browse::get_objects(); Browse::show_objects($live_stream_ids); @@ -81,6 +86,7 @@ switch($_REQUEST['action']) { case 'playlist': Browse::reset_filters(); Browse::set_type('playlist'); + Browse::set_simple_browse(1); Browse::set_sort('name','ASC'); $playlist_ids = Browse::get_objects(); Browse::show_objects($playlist_ids); diff --git a/docs/CHANGELOG b/docs/CHANGELOG index 3d2d4876..eca88a38 100755 --- a/docs/CHANGELOG +++ b/docs/CHANGELOG @@ -4,6 +4,9 @@ -------------------------------------------------------------------------- v.3.4-Alpha4 + - Massive speed improvement on display and sorting of standard + browse functions + - Put Ratings back into single song view - Corrected potential consistancy issue with Play Type dropdown - Made Access Denied page more friendly, added verbage for demo access diff --git a/lib/class/browse.class.php b/lib/class/browse.class.php index cad974ed..020f486b 100644 --- a/lib/class/browse.class.php +++ b/lib/class/browse.class.php @@ -33,6 +33,9 @@ class Browse { public static $start = '0'; public static $total_objects; + // Boolean if this is a simple browse method (use different paging code) + public static $simple_browse; + /** * constructor * This should never be called @@ -121,6 +124,8 @@ class Browse { case 'genre': case 'live_stream': $_SESSION['browse']['type'] = $type; + // Resets the simple browse + self::set_simple_browse(0); break; default: // Rien a faire @@ -193,6 +198,20 @@ class Browse { } // set_start /** + * set_simple_browse + * This sets the current browse object to a 'simple' browse method + * which means use the base query provided and expand from there + */ + public static function set_simple_browse($value) { + + $value = make_bool($value); + self::$simple_browse = $value; + + $_SESSION['browse']['simple'] = $value; + + } // set_simple_browse + + /** * get_saved * This looks in the session for the saved * stuff and returns what it finds @@ -592,19 +611,28 @@ class Browse { */ private static function resort_objects() { - // First pull the objects - $objects = self::get_saved(); + // There are two ways to do this.. the easy way... + // and the vollmer way, hopefully we don't have to + // do it the vollmer way + if (self::$simple_browse) { + $sql = self::get_base_sql(); + } + else { + // First pull the objects + $objects = self::get_saved(); + + // If there's nothing there don't do anything + if (!count($objects)) { return false; } - // If there's nothing there don't do anything - if (!count($objects)) { return false; } + foreach ($objects as $object_id) { + $object_id = Dba::escape($object_id); + $where_sql .= "`id`='$object_id' OR"; + } + $where_sql = rtrim($where_sql,'OR'); - foreach ($objects as $object_id) { - $object_id = Dba::escape($object_id); - $where_sql .= "`id`='$object_id' OR"; + $sql = self::get_base_sql() . ' WHERE ' . $where_sql; } - $where_sql = rtrim($where_sql,'OR'); - $sql = self::get_base_sql() . ' WHERE ' . $where_sql; $order_sql = "ORDER BY "; @@ -628,4 +656,15 @@ class Browse { } // resort_objects + /** + * _auto_init + * this function reloads information back from the session + * it is called on creation of the class + */ + public static function _auto_init() { + + self::$simple_browse = make_bool($_SESSION['browse']['simple']); + + } // _auto_init + } // browse diff --git a/templates/show_song_row.inc.php b/templates/show_song_row.inc.php index 492609eb..fb3b69ae 100644 --- a/templates/show_song_row.inc.php +++ b/templates/show_song_row.inc.php @@ -28,6 +28,9 @@ <td class="cel_genre"><?php echo $song->f_genre_link; ?></td> <td class="cel_track"><?php echo $song->f_track; ?></td> <td class="cel_time"><?php echo $song->f_time; ?></td> +<?php if (Config::get('ratings')) { ?> +<td class="cel_rating" id="rating_<?php echo $song->id; ?>_song"><?php Rating::show($song->id,'song'); ?></td> +<?php } ?> <td class="cel_action"> <?php if ($GLOBALS['user']->prefs['download']) { ?> <a href="<?php echo Config::get('web_path'); ?>/stream.php?action=download&song_id=<?php echo $song->id; ?>"> diff --git a/templates/show_songs.inc.php b/templates/show_songs.inc.php index 1dd4988f..05d8e679 100644 --- a/templates/show_songs.inc.php +++ b/templates/show_songs.inc.php @@ -33,6 +33,7 @@ $ajax_url = Config::get('ajax_url'); <col id="col_genre" /> <col id="col_track" /> <col id="col_time" /> + <col id="col_rating" /> <col id="col_action" /> </colgroup> <tr class="th-top"> @@ -43,6 +44,9 @@ $ajax_url = Config::get('ajax_url'); <th class="cel_genre"><?php echo _('Genre'); ?></th> <th class="cel_track"><?php echo Ajax::text('?page=browse&action=set_sort&sort=track',_('Track'),'sort_song_track'); ?></th> <th class="cel_time"><?php echo Ajax::text('?page=browse&action=set_sort&sort=time',_('Time'),'sort_song_time'); ?></th> +<?php if (Config::get('ratings')) { ?> + <th class="cel_rating"><?php echo _('Rating'); ?></th> +<?php } ?> <th class="cel_action"><?php echo _('Action'); ?></th> </tr> <?php |