--- station_playlist.module 2009-08-07 11:52:15.000000000 -0400 +++ station_playlist.module 2009-08-07 11:53:45.000000000 -0400 @@ -251,6 +251,9 @@ function station_playlist_form(&$node) { '#type' => 'textfield', '#size' => 30, '#maxlength' => 255, '#default_value' => $track['link'], ); + $form['tracks'][$weight]['newtrack'] = array( + '#type' => 'checkbox', '#default_value' => $track['newtrack'], + ); $form['tracks'][$weight]['weight'] = array( '#type' => 'select', '#options' => $weights, '#default_value' => $weight, ); @@ -276,6 +279,9 @@ function station_playlist_form(&$node) { $form['tracks'][$weight]['link'] = array('#type'=>'textfield', '#size' => 30, '#maxlength' => 255, ); + $form['tracks'][$weight]['newtrack'] = array( + '#type' => 'checkbox', '#default_value' => 0, + ); $form['tracks'][$weight]['weight'] = array('#type' => 'select', '#options' => $weights, '#default_value' => $weight, ); @@ -286,7 +292,7 @@ function station_playlist_form(&$node) { } function theme_station_playlist_track_form($form) { - $header = array(t('Artist'), t('Title'), t('Album'), t('Label'), t('Link'), t('Weight')); + $header = array(t('Artist'), t('Title'), t('Album'), t('Label'), t('Link'), t('New Track'), t('Weight')); $rows = array(); foreach (element_children($form) as $key) { @@ -296,6 +302,7 @@ function theme_station_playlist_track_fo $row[] = drupal_render($form[$key]['album']); $row[] = drupal_render($form[$key]['label']); $row[] = drupal_render($form[$key]['link']); + $row[] = drupal_render($form[$key]['newtrack']); $row[] = drupal_render($form[$key]['weight']); $rows[] = $row; } @@ -363,7 +370,7 @@ function station_playlist_load($node) { // tracks $extras->tracks = array(); - $result = db_query('SELECT weight, album, artist, title, label, link FROM {station_playlist_track} WHERE nid = %d ORDER BY weight', $node->nid); + $result = db_query('SELECT weight, album, artist, title, label, link, newtrack FROM {station_playlist_track} WHERE nid = %d ORDER BY weight', $node->nid); while ($track = db_fetch_array($result)) { $extras->tracks[] = $track; } @@ -378,8 +385,8 @@ function station_playlist_insert($node) db_query("INSERT INTO {station_playlist} (nid, program_nid, timestamp) VALUES (%d, %d, %d)", $node->nid, $node->program_nid, $node->timestamp); foreach ($node->tracks as $track) { if ($track['artist'] || $track['title']) { - db_query("INSERT INTO {station_playlist_track} (nid, weight, artist, album, title, label, link) VALUES (%d, %d, '%s', '%s', '%s', '%s', '%s')", - $node->nid, trim($track['weight']), trim($track['artist']), trim($track['album']), trim($track['title']), trim($track['label']), trim($track['link'])); + db_query("INSERT INTO {station_playlist_track} (nid, weight, artist, album, title, label, link, newtrack) VALUES (%d, %d, '%s', '%s', '%s', '%s', '%s', %d)", + $node->nid, trim($track['weight']), trim($track['artist']), trim($track['album']), trim($track['title']), trim($track['label']), trim($track['link']), trim($track['newtrack'])); } } } @@ -401,8 +408,8 @@ function station_playlist_update($node) db_query('DELETE FROM {station_playlist_track} WHERE nid = %d', $node->nid); foreach ($node->tracks as $track) { if ($track['artist'] || $track['title']) { - db_query("INSERT INTO {station_playlist_track} (nid, weight, artist, album, title, label, link) VALUES (%d, %d, '%s', '%s', '%s', '%s', '%s')", - $node->nid, trim($track['weight']), trim($track['artist']), trim($track['album']), trim($track['title']), trim($track['label']), trim($track['link'])); + db_query("INSERT INTO {station_playlist_track} (nid, weight, artist, album, title, label, link, newtrack) VALUES (%d, %d, '%s', '%s', '%s', '%s', '%s', %d)", + $node->nid, trim($track['weight']), trim($track['artist']), trim($track['album']), trim($track['title']), trim($track['label']), trim($track['link']), trim($track['newtrack'])); } } } @@ -432,6 +439,7 @@ function station_playlist_view(&$node, $ $hasAlbum |= (bool) ($track['album']); $hasLabel |= (bool) ($track['label']); $hasLink |= (bool) ($track['link']); + $hasNewTrack |= (bool) ($track['newtrack']); } $header = array(t('Artist'), t('Title')); if ($hasAlbum) { @@ -443,6 +451,9 @@ function station_playlist_view(&$node, $ if ($hasLink) { $header[] = t('Link'); } + if ($hasNewTrack) { + $header[] = t('New'); + } // ...then put the into the table foreach ((array) $node->tracks as $track) { if ($track['artist'] || $track['title']) { @@ -466,6 +477,9 @@ function station_playlist_view(&$node, $ $row[] = ''; } } + if ($hasNewTrack) { + $row[] = ($track['newtrack']) ? "√" : ""; + } $rows[] = $row; } }