diff --git a/browse.php b/browse.php index 01a8c1b0..500fb2dd 100644 --- a/browse.php +++ b/browse.php @@ -78,7 +78,8 @@ switch ($_REQUEST['action']) { Tag::build_cache($keys); UI::show_box_top(T_('Tag Cloud'), 'box box_tag_cloud'); $browse2 = new Browse(); - $browse2->set_type('song'); + $browse_type = isset($_GET['type']) ? $_GET['type'] : 'song'; + $browse2->set_type($browse_type); $browse2->store(); require_once AmpConfig::get('prefix') . '/templates/show_tagcloud.inc.php'; UI::show_box_bottom(); diff --git a/lib/class/album.class.php b/lib/class/album.class.php index 8ed75649..89dec118 100644 --- a/lib/class/album.class.php +++ b/lib/class/album.class.php @@ -447,7 +447,7 @@ class Album extends database_object } $this->tags = Tag::get_top_tags('album', $this->id); - $this->f_tags = Tag::get_display($this->tags); + $this->f_tags = Tag::get_display($this->tags, true, 'album'); } // format diff --git a/lib/class/artist.class.php b/lib/class/artist.class.php index 532ff3c5..3f0ccded 100644 --- a/lib/class/artist.class.php +++ b/lib/class/artist.class.php @@ -333,7 +333,7 @@ class Artist extends database_object $this->f_time = ltrim($hours . ':' . $min . ':' . $sec,'0:'); $this->tags = Tag::get_top_tags('artist', $this->id); - $this->f_tags = Tag::get_display($this->tags); + $this->f_tags = Tag::get_display($this->tags, true, 'artist'); $this->object_cnt = $extra_info['object_cnt']; diff --git a/lib/class/broadcast.class.php b/lib/class/broadcast.class.php index 7007a19f..23a0e9c5 100644 --- a/lib/class/broadcast.class.php +++ b/lib/class/broadcast.class.php @@ -112,7 +112,7 @@ class Broadcast extends database_object $this->f_name = $this->name; $this->f_link = '' . scrub_out($this->f_name) . ''; $this->tags = Tag::get_top_tags('broadcast', $this->id); - $this->f_tags = Tag::get_display($this->tags); + $this->f_tags = Tag::get_display($this->tags, true, 'broadcast'); } public static function get_broadcast_list_sql() diff --git a/lib/class/channel.class.php b/lib/class/channel.class.php index 4b3f4a5f..14bd1e30 100644 --- a/lib/class/channel.class.php +++ b/lib/class/channel.class.php @@ -181,7 +181,7 @@ class Channel extends database_object public function format() { $this->tags = Tag::get_top_tags('channel', $this->id); - $this->f_tags = Tag::get_display($this->tags); + $this->f_tags = Tag::get_display($this->tags, true, 'channel'); } public function get_target_object() diff --git a/lib/class/query.class.php b/lib/class/query.class.php index 4575a713..ac41f46c 100644 --- a/lib/class/query.class.php +++ b/lib/class/query.class.php @@ -1131,7 +1131,7 @@ class Query switch ($filter) { case 'tag': $this->set_join('left', '`tag_map`', '`tag_map`.`object_id`', '`song`.`id`', 100); - $filter_sql = " `tag_map`.`object_type`='song' AND ("; + $filter_sql = " `tag_map`.`object_type`='" . $this->get_type() . "' AND ("; foreach ($value as $tag_id) { $filter_sql .= " `tag_map`.`tag_id`='" . Dba::escape($tag_id) . "' AND"; @@ -1193,6 +1193,15 @@ class Query break; case 'album': switch ($filter) { + case 'tag': + $this->set_join('left', '`tag_map`', '`tag_map`.`object_id`', '`album`.`id`', 100); + $filter_sql = " `tag_map`.`object_type`='" . $this->get_type() . "' AND ("; + + foreach ($value as $tag_id) { + $filter_sql .= " `tag_map`.`tag_id`='" . Dba::escape($tag_id) . "' AND"; + } + $filter_sql = rtrim($filter_sql,'AND') . ') AND '; + break; case 'exact_match': $filter_sql = " `album`.`name` = '" . Dba::escape($value) . "' AND "; break; @@ -1250,6 +1259,15 @@ class Query break; case 'artist': switch ($filter) { + case 'tag': + $this->set_join('left', '`tag_map`', '`tag_map`.`object_id`', '`artist`.`id`', 100); + $filter_sql = " `tag_map`.`object_type`='" . $this->get_type() . "' AND ("; + + foreach ($value as $tag_id) { + $filter_sql .= " `tag_map`.`tag_id`='" . Dba::escape($tag_id) . "' AND"; + } + $filter_sql = rtrim($filter_sql,'AND') . ') AND '; + break; case 'catalog': if ($value != 0) { $this->set_join('left','`song`','`artist`.`id`','`song`.`artist`', 100); @@ -1392,6 +1410,15 @@ class Query break; case 'video': switch ($filter) { + case 'tag': + $this->set_join('left', '`tag_map`', '`tag_map`.`object_id`', '`video`.`id`', 100); + $filter_sql = " `tag_map`.`object_type`='" . $this->get_type() . "' AND ("; + + foreach ($value as $tag_id) { + $filter_sql .= " `tag_map`.`tag_id`='" . Dba::escape($tag_id) . "' AND"; + } + $filter_sql = rtrim($filter_sql,'AND') . ') AND '; + break; case 'alpha_match': $filter_sql = " `video`.`title` LIKE '%" . Dba::escape($value) . "%' AND "; break; diff --git a/lib/class/song.class.php b/lib/class/song.class.php index a5c49aa7..a3161bf1 100644 --- a/lib/class/song.class.php +++ b/lib/class/song.class.php @@ -889,7 +889,7 @@ class Song extends database_object implements media // Get the top tags $this->tags = Tag::get_top_tags('song', $this->id); - $this->f_tags = Tag::get_display($this->tags); + $this->f_tags = Tag::get_display($this->tags, true, 'song'); // Format the size $this->f_size = UI::format_bytes($this->size); diff --git a/lib/class/tag.class.php b/lib/class/tag.class.php index c926b93c..841e6d8b 100644 --- a/lib/class/tag.class.php +++ b/lib/class/tag.class.php @@ -478,7 +478,7 @@ class Tag extends database_object * it also takes a type so that it knows how to return it, this is used * by the formating functions of the different objects */ - public static function get_display($tags) + public static function get_display($tags, $link=false, $filter_type='') { //debug_event('tag.class.php', 'Get display tags called...', '5'); if (!is_array($tags)) { return ''; } @@ -491,7 +491,14 @@ class Tag extends database_object foreach ($value as $vid=>$v) { debug_event('tag.class.php', $vid.' = {'.$v.'}', '5'); }*/ - $results .= $value['name'] . ', '; + if ($link) { + $results .= ''; + } + $results .= $value['name']; + if ($link) { + $results .= ''; + } + $results .= ', '; } $results = rtrim($results, ', '); diff --git a/templates/show_album_row.inc.php b/templates/show_album_row.inc.php index 5554c5d9..1c86f3a3 100644 --- a/templates/show_album_row.inc.php +++ b/templates/show_album_row.inc.php @@ -54,7 +54,7 @@ if (Art::is_enabled()) {