diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2008-08-22 04:28:36 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2008-08-22 04:28:36 +0000 |
commit | 478c6618b0ee637334aefb20eead299b6975bef4 (patch) | |
tree | ba6d408597066b425066ff79e163f8958b44338a | |
parent | 666ed4e1ea7d7b7860e917c256479a26d4754b09 (diff) | |
download | ampache-478c6618b0ee637334aefb20eead299b6975bef4.tar.gz ampache-478c6618b0ee637334aefb20eead299b6975bef4.tar.bz2 ampache-478c6618b0ee637334aefb20eead299b6975bef4.zip |
fixed the search add result button and messed up some browse sort stuff
-rw-r--r-- | browse.php | 2 | ||||
-rw-r--r-- | lib/class/browse.class.php | 22 | ||||
-rw-r--r-- | server/ajax.server.php | 1 | ||||
-rw-r--r-- | templates/show_albums.inc.php | 2 | ||||
-rw-r--r-- | templates/show_search.inc.php | 4 | ||||
-rw-r--r-- | templates/show_search_options.inc.php | 2 |
6 files changed, 25 insertions, 8 deletions
@@ -42,8 +42,8 @@ switch ($_REQUEST['action']) { case 'playlist': case 'live_stream': case 'song': - Browse::reset_filters(); Browse::set_type($_REQUEST['action']); + Browse::reset(); Browse::set_simple_browse(1); break; } // end switch diff --git a/lib/class/browse.class.php b/lib/class/browse.class.php index 53edeb96..fd635d20 100644 --- a/lib/class/browse.class.php +++ b/lib/class/browse.class.php @@ -126,6 +126,7 @@ class Browse { self::reset_filters(); self::reset_total(); + self::reset_join(); self::reset_supplemental_objects(); self::set_simple_browse(0); self::set_start(0); @@ -133,6 +134,16 @@ class Browse { } // reset /** + * reset_join + * clears the joins if there are any + */ + public static function reset_join() { + + unset($_SESSION['browse']['join'][self::$type]); + + } // reset_join + + /** * reset_filter * This is a wrapper function that resets the filters */ @@ -284,13 +295,13 @@ class Browse { $valid_array = array('title','year','track','time','album','artist'); break; case 'artist': - $valid_array = array('name'); + $valid_array = array('name','album'); break; case 'tag': $valid_array = array('tag'); break; case 'album': - $valid_array = array('name','year'); + $valid_array = array('name','year','artist'); break; case 'playlist': $valid_array = array('name','user'); @@ -337,7 +348,7 @@ class Browse { */ public static function set_join($type,$table,$source,$dest) { - $_SESSION['browse']['join'][self::$type] = array($table=>strtoupper($type) . ' JOIN ' . $table . ' ON ' . $source . '=' . $dest); + $_SESSION['browse']['join'][self::$type][$table] = strtoupper($type) . ' JOIN ' . $table . ' ON ' . $source . '=' . $dest; } // set_join @@ -836,6 +847,11 @@ class Browse { case 'name': $sql = "`album`.`name` $order, `album`.`disk`"; break; + case 'artist': + $sql = "`artist`.`name`"; + self::set_join('left','`song`','`song`.`album`','`album`.`id`'); + self::set_join('left','`artist`','`song`.`artist`','`artist`.`id`'); + break; case 'year': $sql = "`album`.`year`"; break; diff --git a/server/ajax.server.php b/server/ajax.server.php index 11748866..6abaf89f 100644 --- a/server/ajax.server.php +++ b/server/ajax.server.php @@ -241,6 +241,7 @@ switch ($_REQUEST['action']) { } // end foreach break; case 'browse_set': + Browse::set_type($_REQUEST['object_type']); $objects = Browse::get_saved(); foreach ($objects as $object_id) { $GLOBALS['user']->playlist->add_object($object_id,'song'); diff --git a/templates/show_albums.inc.php b/templates/show_albums.inc.php index 02613803..8d12ca5a 100644 --- a/templates/show_albums.inc.php +++ b/templates/show_albums.inc.php @@ -41,7 +41,7 @@ $ajax_url = Config::get('ajax_url'); <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> - <th class="cel_artist"><?php echo _('Artist'); ?></th> + <th class="cel_artist"><?php echo Ajax::text('?page=browse&action=set_sort&type=album&sort=artist',_('Artist'),'album_sort_artist'); ?></th> <th class="cel_songs"><?php echo _('Songs'); ?></th> <th class="cel_year"><?php echo Ajax::text('?page=browse&action=set_sort&type=album&sort=year',_('Year'),'album_sort_year'); ?></th> <th class="col_rating"><?php echo _('Rating'); ?></th> diff --git a/templates/show_search.inc.php b/templates/show_search.inc.php index a23ccc70..7991fbee 100644 --- a/templates/show_search.inc.php +++ b/templates/show_search.inc.php @@ -51,9 +51,9 @@ <td> <input type="text" id="s_album" name="s_album" value="<?php echo scrub_out($_REQUEST['s_album']); ?>" /> </td> - <td><?php echo _('Genre'); ?></td> + <td><?php echo _('Tag'); ?></td> <td> - <input type="text" id="s_genre" name="s_genre" value="<?php echo scrub_out($_REQUEST['s_genre']); ?>" /> + <input type="text" id="s_tag" name="s_tag" value="<?php echo scrub_out($_REQUEST['s_tag']); ?>" /> </td> </tr> <tr class="<?php echo flip_class(); ?>"> diff --git a/templates/show_search_options.inc.php b/templates/show_search_options.inc.php index 71f7266d..57c1d9ae 100644 --- a/templates/show_search_options.inc.php +++ b/templates/show_search_options.inc.php @@ -23,7 +23,7 @@ <?php show_box_top(_('Options')); ?> <div id="search_options"> <ul> - <li><?php echo Ajax::text('?action=basket&type=browse_set',_('Add Search Results'),'add_search_results'); ?></li> + <li><?php echo Ajax::text('?action=basket&type=browse_set&object_type=song',_('Add Search Results'),'add_search_results'); ?></li> <?php if (Access::check_function('batch_download')) { ?> <li><a href="<?php echo Config::get('web_path'); ?>/batch.php?action=browse"><?php echo _('Batch Download'); ?></a></li> <?php } ?> |