? station_347665_0.patch ? station_477724.patch ? schedule/before.sql ? schedule/working.patch Index: playlist/station_playlist.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/station/playlist/station_playlist.module,v retrieving revision 1.19 diff -u -p -r1.19 station_playlist.module --- playlist/station_playlist.module 19 Apr 2009 21:34:12 -0000 1.19 +++ playlist/station_playlist.module 1 Jun 2009 06:25:14 -0000 @@ -372,56 +372,18 @@ function station_playlist_view(&$node, $ } if (!$teaser) { - $rows = array(); - // make one pass to figure out what fields we've got... - $has_album = $has_label = $has_link = FALSE; - foreach ((array) $node->tracks as $track) { - $has_album |= !empty($track['album']); - $has_label |= !empty($track['label']); - $has_link |= !empty($track['link']); - } - $header = array(t('Artist'), t('Title')); - if ($has_album) { - $header[] = t('Album'); - } - if ($has_label) { - $header[] = t('Label'); - } - if ($has_link) { - $header[] = t('Link'); - } - // ...then put the into the table - foreach ((array) $node->tracks as $track) { - if ($track['artist'] || $track['title']) { - $row = array( - check_plain($track['artist']), - check_plain($track['title']), - ); - if ($has_album) { - $row[] = check_plain($track['album']); + if ($view = views_get_view('station_playlist_tracks')) { + $display_id = 'default'; + if ($view->access($display_id)) { + if ($output = $view->preview($display_id, array($node->nid))) { + $node->content['tracks'] = array( + '#value' => $output, + '#title' => 'Tracks', + '#weight' => 0, + ); } - if ($has_label) { - $row[] = check_plain($track['label']); - } - if ($has_link) { - if ($track['link']) { - // Use the host name as a link text - $parts = parse_url(url($track['link'], array('absolute' => TRUE))); - $row[] = l($parts['host'], $track['link']); - } - else { - $row[] = ''; - } - } - $rows[] = $row; } - } - if (count($rows)) { - $node->content['tracks'] = array( - '#value' => theme('table', $header, $rows, array('class' => 'station-playlist-tracks')), - '#title' => 'Tracks', - '#weight' => 0, - ); + $view->destroy(); } } return $node; @@ -439,7 +401,7 @@ function station_playlist_nodeapi(&$node foreach ($block_content_mapping as $display_id => $content_key) { if ($view = views_get_view('station_program_playlists')) { if ($view->access($display_id)) { - $block = $view->execute_display($display_id); + $block = $view->preview($display_id); $node->content[$content_key]['#type'] = 'item'; $node->content[$content_key]['#title'] = $block['subject']; $node->content[$content_key]['#value'] = $block['content']; @@ -504,5 +466,6 @@ function station_playlist_content_extra_ function station_playlist_views_api() { return array( 'api' => 2.0, + 'path' => drupal_get_path('module', 'station_playlist'), ); } Index: playlist/station_playlist.views.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/station/playlist/station_playlist.views.inc,v retrieving revision 1.1 diff -u -p -r1.1 station_playlist.views.inc --- playlist/station_playlist.views.inc 11 Mar 2009 07:47:02 -0000 1.1 +++ playlist/station_playlist.views.inc 1 Jun 2009 06:25:14 -0000 @@ -10,11 +10,11 @@ function station_playlist_views_data() { // Define the base group of this table. Fields that don't // have a group defined will go into this field by default. $data['station_playlist_track']['table']['group'] = t('Station playlist track'); - $data['station_playlist_track']['table']['base'] = array( - 'field' => 'iid', - 'title' => t('Station Playlist Track'), - 'help' => t('Station playlist track entries.'), - ); +// $data['station_playlist_track']['table']['base'] = array( +// 'field' => 'iid', +// 'title' => t('Station Playlist Track'), +// 'help' => t('Station playlist track entries.'), +// ); // For other base tables, explain how we join $data['station_playlist_track']['table']['join'] = array( @@ -37,6 +37,21 @@ function station_playlist_views_data() { 'label' => t('Playlist'), ), ); + $data['station_playlist_track']['weight'] = array( + 'title' => t('Weight'), + 'help' => t('The track weight field.'), + 'field' => array( + 'handler' => 'views_handler_field', + 'click sortable' => TRUE, + ), + 'filter' => array( + 'handler' => 'views_handler_filter_numeric', + 'label' => t('Weight'), + ), + 'sort' => array( + 'handler' => 'views_handler_sort', + ), + ); $data['station_playlist_track']['artist'] = array( 'title' => t('Artist'), 'help' => t("Album artist name."), @@ -47,14 +62,14 @@ function station_playlist_views_data() { 'filter' => array( 'handler' => 'views_handler_filter_string', 'label' => t('Artist'), - ), + ), 'sort' => array( 'handler' => 'views_handler_sort', ), ); $data['station_playlist_track']['album'] = array( - 'title' => t('Album title'), - 'help' => t("Title of the album album."), + 'title' => t('Album'), + 'help' => t("Title of the album."), 'field' => array( 'handler' => 'views_handler_field', 'click sortable' => TRUE, @@ -62,7 +77,7 @@ function station_playlist_views_data() { 'filter' => array( 'handler' => 'views_handler_filter_string', 'label' => t('Album'), - ), + ), 'sort' => array( 'handler' => 'views_handler_sort', ), @@ -76,8 +91,34 @@ function station_playlist_views_data() { ), 'filter' => array( 'handler' => 'views_handler_filter_string', - 'label' => t('Label'), - ), + 'label' => t('Title'), + ), + 'sort' => array( + 'handler' => 'views_handler_sort', + ), + ); + $data['station_playlist_track']['label'] = array( + 'title' => t('Label'), + 'help' => t("Name of the label that released the album."), + 'field' => array( + 'handler' => 'views_handler_field', + 'click sortable' => TRUE, + ), + 'filter' => array( + 'handler' => 'views_handler_filter_string', + 'label' => t('Label'), + ), + 'sort' => array( + 'handler' => 'views_handler_sort', + ), + ); + $data['station_playlist_track']['link'] = array( + 'title' => t('Link'), + 'help' => t("Link to more info on the track."), + 'field' => array( + 'handler' => 'views_handler_field_url', + 'click sortable' => TRUE, + ), 'sort' => array( 'handler' => 'views_handler_sort', ), Index: playlist/station_playlist.views_default.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/station/playlist/station_playlist.views_default.inc,v retrieving revision 1.5 diff -u -p -r1.5 station_playlist.views_default.inc --- playlist/station_playlist.views_default.inc 19 Apr 2009 21:34:12 -0000 1.5 +++ playlist/station_playlist.views_default.inc 1 Jun 2009 06:25:15 -0000 @@ -6,10 +6,228 @@ * Implementation of hook_views_default_views(). */ function station_playlist_views_default_views() { + /* + * View 'station_playlist_tracks' + */ + $view = new view; + $view->name = 'station_playlist_tracks'; + $view->description = 'Listing of tracks on a playlist node.'; + $view->tag = 'station_playlist'; + $view->view_php = ''; + $view->base_table = 'node'; + $view->is_cacheable = FALSE; + $view->api_version = 2; + $view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */ + $handler = $view->new_display('default', 'Defaults', 'default'); + $handler->override_option('fields', array( + 'artist' => array( + 'label' => 'Artist', + 'alter' => array( + 'alter_text' => 0, + 'text' => '', + 'make_link' => 0, + 'path' => '', + 'alt' => '', + 'prefix' => '', + 'suffix' => '', + 'help' => '', + 'trim' => 0, + 'max_length' => '', + 'word_boundary' => 1, + 'ellipsis' => 1, + 'strip_tags' => 0, + 'html' => 0, + ), + 'exclude' => 0, + 'id' => 'artist', + 'table' => 'station_playlist_track', + 'field' => 'artist', + 'relationship' => 'none', + ), + 'title' => array( + 'label' => 'Title', + 'alter' => array( + 'alter_text' => 0, + 'text' => '', + 'make_link' => 0, + 'path' => '', + 'alt' => '', + 'prefix' => '', + 'suffix' => '', + 'help' => '', + 'trim' => 0, + 'max_length' => '', + 'word_boundary' => 1, + 'ellipsis' => 1, + 'strip_tags' => 0, + 'html' => 0, + ), + 'exclude' => 0, + 'id' => 'title', + 'table' => 'station_playlist_track', + 'field' => 'title', + 'relationship' => 'none', + ), + 'album' => array( + 'label' => 'Album', + 'alter' => array( + 'alter_text' => 0, + 'text' => '', + 'make_link' => 0, + 'path' => '', + 'alt' => '', + 'prefix' => '', + 'suffix' => '', + 'help' => '', + 'trim' => 0, + 'max_length' => '', + 'word_boundary' => 1, + 'ellipsis' => 1, + 'strip_tags' => 0, + 'html' => 0, + ), + 'exclude' => 0, + 'id' => 'album', + 'table' => 'station_playlist_track', + 'field' => 'album', + 'relationship' => 'none', + ), + 'label' => array( + 'label' => 'Label', + 'alter' => array( + 'alter_text' => 0, + 'text' => '', + 'make_link' => 0, + 'path' => '', + 'alt' => '', + 'prefix' => '', + 'suffix' => '', + 'help' => '', + 'trim' => 0, + 'max_length' => '', + 'word_boundary' => 1, + 'ellipsis' => 1, + 'strip_tags' => 0, + 'html' => 0, + ), + 'exclude' => 0, + 'id' => 'label', + 'table' => 'station_playlist_track', + 'field' => 'label', + 'relationship' => 'none', + ), + 'link' => array( + 'label' => 'Link', + 'alter' => array( + 'alter_text' => 0, + 'text' => '', + 'make_link' => 0, + 'path' => '', + 'alt' => '', + 'prefix' => '', + 'suffix' => '', + 'help' => '', + 'trim' => 0, + 'max_length' => '', + 'word_boundary' => 1, + 'ellipsis' => 1, + 'strip_tags' => 0, + 'html' => 0, + ), + 'exclude' => 0, + 'id' => 'link', + 'table' => 'station_playlist_track', + 'field' => 'link', + 'relationship' => 'none', + ), + )); + $handler->override_option('sorts', array( + 'weight' => array( + 'order' => 'ASC', + 'id' => 'weight', + 'table' => 'station_playlist_track', + 'field' => 'weight', + 'relationship' => 'none', + ), + )); + $handler->override_option('arguments', array( + 'nid' => array( + 'default_action' => 'summary asc', + 'style_plugin' => 'default_summary', + 'style_options' => array( + 'count' => 1, + 'override' => 0, + 'items_per_page' => '25', + ), + 'wildcard' => 'all', + 'wildcard_substitution' => 'All', + 'title' => '', + 'default_argument_type' => 'node', + 'default_argument' => '', + 'validate_type' => 'node', + 'validate_fail' => 'not found', + 'break_phrase' => 0, + 'not' => 0, + 'id' => 'nid', + 'table' => 'node', + 'field' => 'nid', + 'validate_user_argument_type' => 'uid', + 'validate_user_roles' => array( + '2' => 0, + ), + 'relationship' => 'none', + 'default_options_div_prefix' => '', + 'default_argument_user' => 0, + 'default_argument_fixed' => '', + 'default_argument_php' => '', + 'validate_argument_node_type' => array( + 'station_playlist' => 'station_playlist', + 'station_program' => 0, + 'station_schedule' => 0, + 'page' => 0, + 'story' => 0, + ), + 'validate_argument_node_access' => 1, + 'validate_argument_nid_type' => 'nid', + 'validate_argument_vocabulary' => array(), + 'validate_argument_type' => 'tid', + 'validate_argument_transform' => 0, + 'validate_user_restrict_roles' => 0, + 'validate_argument_php' => '', + ), + )); + $handler->override_option('filters', array( + 'type' => array( + 'operator' => 'in', + 'value' => array( + 'station_playlist' => 'station_playlist', + ), + 'group' => '0', + 'exposed' => FALSE, + 'expose' => array( + 'operator' => FALSE, + 'label' => '', + ), + 'id' => 'type', + 'table' => 'node', + 'field' => 'type', + 'relationship' => 'none', + ), + )); + $handler->override_option('access', array( + 'type' => 'perm', + 'perm' => 'view station playlist content', + )); + $handler->override_option('style_plugin', 'table'); + $views[$view->name] = $view; + + /* + * View 'station_program_playlists' + */ $view = new view; $view->name = 'station_program_playlists'; $view->description = 'Station Program\'s associated Playlists'; - $view->tag = 'station'; + $view->tag = 'station_playlist'; $view->view_php = ''; $view->base_table = 'node'; $view->is_cacheable = FALSE; @@ -293,17 +511,19 @@ function station_playlist_views_default_ $handler->override_option('menu', array( 'type' => 'normal', 'title' => 'Playlists', + 'description' => '', 'weight' => '0', 'name' => 'navigation', )); $handler->override_option('tab_options', array( 'type' => 'none', 'title' => '', + 'description' => '', 'weight' => 0, )); $views[$view->name] = $view; - - return $views; } + +