Changeset 1679

Show
Ignore:
Timestamp:
08/20/08 22:22:33 (3 months ago)
Author:
vollmerk
Message:

fix filter + paging and add sort by artist and album on song browse

Location:
trunk
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/docs/CHANGELOG

    r1670 r1679  
    55-------------------------------------------------------------------------- 
    66  v.3.5-Alpha1 
     7        - Add ability to sort by artist name, album name on song browse 
    78        - Implemented caching on artist and album browse, added total 
    89                artist time to the many artist view 
  • trunk/lib/class/browse.class.php

    r1675 r1679  
    111111                } // end switch 
    112112 
     113                // If we've set a filter we need to reset the totals 
     114                self::reset_total();  
     115                self::set_start(0);  
     116 
    113117                return true;  
    114118         
     
    125129                self::reset_supplemental_objects();  
    126130                self::set_simple_browse(0);  
     131                self::set_start(0);  
    127132 
    128133        } // reset 
     
    277282                        case 'playlist_song':  
    278283                        case 'song':  
    279                                 $valid_array = array('title','year','track','time');  
     284                                $valid_array = array('title','year','track','time','album','artist');  
    280285                        break; 
    281286                        case 'artist':  
     
    333338        public static function set_join($type,$table,$source,$dest) {  
    334339 
    335                 $_SESSION['browse']['join'][self::$type] = strtoupper($type) . ' JOIN ' . $table . ' ON ' . $source . '=' . $dest;  
     340                $_SESSION['browse']['join'][self::$type] = array($table=>strtoupper($type) . ' JOIN ' . $table . ' ON ' . $source . '=' . $dest);  
    336341 
    337342        } // set_join 
     
    565570         */ 
    566571        private static function get_sort_sql() {  
    567  
     572                 
    568573                if (!is_array($_SESSION['browse']['sort'][self::$type])) { return ''; }  
    569574 
     
    600605         */ 
    601606        private static function get_join_sql() {  
    602  
     607                 
    603608                if (!is_array($_SESSION['browse']['join'][self::$type])) {  
    604609                        return '';  
     
    610615                        $sql .= $join . ' ';  
    611616                }  
    612          
     617 
    613618                return $sql;     
    614619 
     
    816821                                        case 'album':  
    817822                                                $sql = '`album`.`name`';  
    818                                                 self::set_join('left','`album`','`album`.`id`','`song`.`id`');  
     823                                                self::set_join('left','`album`','`album`.`id`','`song`.`album`');  
     824                                        break;  
     825                                        case 'artist':  
     826                                                $sql = '`artist`.`name`';  
     827                                                self::set_join('left','`artist`','`artist`.`id`','`song`.`artist`');  
    819828                                        break;  
    820829                                        default:  
     
    10801089                        $order_sql = rtrim($order_sql,"ORDER BY "); 
    10811090                        $order_sql = rtrim($order_sql,","); 
    1082                         $sql = $sql . $order_sql; 
     1091                        $sql = $sql . self::get_join_sql() . $order_sql; 
    10831092                } // if not simple 
    10841093 
  • trunk/templates/show_songs.inc.php

    r1672 r1679  
    3939        <th class="cel_add"><?php echo _('Add'); ?></th> 
    4040        <th class="cel_song"><?php echo Ajax::text('?page=browse&action=set_sort&type=song&sort=title',_('Song Title'),'sort_song_title'); ?></th> 
    41         <th class="cel_artist"><?php echo _('Artist'); ?></th> 
     41        <th class="cel_artist"><?php echo Ajax::text('?page=browse&action=set_sort&type=song&sort=artist',_('Artist'),'sort_song_artist'); ?></th> 
    4242        <th class="cel_album"><?php echo Ajax::text('?page=browse&action=set_sort&type=song&sort=album',_('Album'),'sort_song_album'); ?></th> 
    4343        <th class="cel_tags"><?php echo _('Tags'); ?></th> 
     
    6868        <th class="cel_add"><?php echo _('Add'); ?></th> 
    6969        <th class="cel_song"><?php echo Ajax::text('?page=browse&action=set_sort&type=song&sort=title',_('Song Title'),'sort_song_title_bottom'); ?></th> 
    70         <th class="cel_artist"><?php echo _('Artist'); ?></th> 
    71         <th class="cel_album"><?php echo _('Album'); ?></th> 
     70        <th class="cel_artist"><?php echo Ajax::text('?page=browse&action=set_sort&type=song&sort=artist',_('Artist'),'sort_song_artist_bottom'); ?></th> 
     71        <th class="cel_album"><?php echo Ajax::text('?page=browse&action=set_sort&type=song&sort=album',_('Album'),'sort_song_album_bottom'); ?></th> 
    7272        <th class="cel_tags"><?php echo _('Tags'); ?></th> 
    7373        <th class="cel_track"><?php echo Ajax::text('?page=browse&action=set_sort&type=song&sort=track',_('Track'),'sort_song_track_bottom'); ?></th>