diff options
-rw-r--r-- | server/ajax.server.php | 61 | ||||
-rw-r--r-- | templates/show_album_row.inc.php | 2 | ||||
-rw-r--r-- | templates/show_artist_row.inc.php | 2 | ||||
-rw-r--r-- | templates/show_edit_album_row.inc.php | 4 | ||||
-rw-r--r-- | templates/show_edit_artist_row.inc.php | 5 | ||||
-rw-r--r-- | templates/show_edit_live_stream_row.inc.php | 4 | ||||
-rw-r--r-- | templates/show_edit_playlist_row.inc.php | 4 | ||||
-rw-r--r-- | templates/show_edit_playlist_title.inc.php (renamed from templates/show_edit_playlist_full_row.inc.php) | 4 | ||||
-rw-r--r-- | templates/show_edit_song_row.inc.php | 4 | ||||
-rw-r--r-- | templates/show_live_stream_row.inc.php | 2 | ||||
-rw-r--r-- | templates/show_playlist.inc.php | 10 | ||||
-rw-r--r-- | templates/show_playlist_row.inc.php | 2 | ||||
-rw-r--r-- | templates/show_playlist_title.inc.php (renamed from templates/show_playlist_full_row.inc.php) | 0 | ||||
-rw-r--r-- | templates/show_song_row.inc.php | 2 |
14 files changed, 69 insertions, 37 deletions
diff --git a/server/ajax.server.php b/server/ajax.server.php index 653b6173..d2fce49c 100644 --- a/server/ajax.server.php +++ b/server/ajax.server.php @@ -98,28 +98,28 @@ switch ($_REQUEST['action']) { $level = '50'; switch ($_GET['type']) { - case 'album': + case 'album_row': $key = 'album_' . $_GET['id']; $album = new Album($_GET['id']); $album->format(); break; - case 'artist': + case 'artist_row': $key = 'artist_' . $_GET['id']; $artist = new Artist($_GET['id']); $artist->format(); break; - case 'song': + case 'song_row': $key = 'song_' . $_GET['id']; $song = new Song($_GET['id']); $song->format(); break; - case 'live_stream': + case 'live_stream_row': $key = 'live_stream_' . $_GET['id']; $radio = new Radio($_GET['id']); $radio->format(); break; - case 'playlist': - case 'playlist_full': + case 'playlist_row': + case 'playlist_title': $key = 'playlist_row_' . $_GET['id']; $playlist = new Playlist($_GET['id']); $playlist->format(); @@ -128,6 +128,15 @@ switch ($_REQUEST['action']) { $level = '25'; } break; + case 'smartplaylist_row': + case 'smartplaylist_title': + $key = 'playlist_row_' . $_GET['id']; + $playlist = new Search('song', $_GET['id']); + $playlist->format(); + if ($playlist->user == $GLOBALS['user']->id) { + $level = '25'; + } + break; default: $key = 'rfc3514'; echo xml_from_array(array($key=>'0x1')); @@ -142,7 +151,7 @@ switch ($_REQUEST['action']) { } ob_start(); - require Config::get('prefix') . '/templates/show_edit_' . $_GET['type'] . '_row.inc.php'; + require Config::get('prefix') . '/templates/show_edit_' . $_GET['type'] . '.inc.php'; $results[$key] = ob_get_contents(); ob_end_clean(); break; @@ -150,12 +159,19 @@ switch ($_REQUEST['action']) { $level = '50'; - if ($_POST['type'] == 'playlist' || $_POST['type'] == 'playlist_full') { + if ($_POST['type'] == 'playlist_row' || $_POST['type'] == 'playlist_title') { $playlist = new Playlist($_POST['id']); if ($GLOBALS['user']->id == $playlist->user) { $level = '25'; } } + if ($_POST['type'] == 'smartplaylist_row' || + $_POST['type'] == 'smartplaylist_title') { + $playlist = new Search('song', $_POST['id']); + if ($GLOBALS['user']->id == $playlist->user) { + $level = '25'; + } + } // Make sure we've got them rights if (!Access::check('interface',$level) || Config::get('demo_mode')) { @@ -164,7 +180,7 @@ switch ($_REQUEST['action']) { } switch ($_POST['type']) { - case 'album': + case 'album_row': $key = 'album_' . $_POST['id']; $album = new Album($_POST['id']); $songs = $album->get_songs(); @@ -177,7 +193,7 @@ switch ($_REQUEST['action']) { } $album->format(); break; - case 'artist': + case 'artist_row': $key = 'artist_' . $_POST['id']; $artist = new Artist($_POST['id']); $songs = $artist->get_songs(); @@ -190,21 +206,29 @@ switch ($_REQUEST['action']) { } $artist->format(); break; - case 'song': + case 'song_row': $key = 'song_' . $_POST['id']; $song = new Song($_POST['id']); Flag::add($song->id,'song','retag','Inline Single Song Update'); $song->update($_POST); $song->format(); break; - case 'playlist': - case 'playlist_full': + case 'playlist_row': + case 'playlist_title': $key = 'playlist_row_' . $_POST['id']; $playlist->update($_POST); $playlist->format(); $count = $playlist->get_song_count(); break; - case 'live_stream': + case 'smartplaylist_row': + case 'smartplaylist_title': + $key = 'playlist_row_' . $_POST['id']; + $playlist->name = $_POST['name']; + $playlist->type = $_POST['pl_type']; + $playlist->update(); + $playlist->format(); + break; + case 'live_stream_row': $key = 'live_stream_' . $_POST['id']; Radio::update($_POST); $radio = new Radio($_POST['id']); @@ -218,7 +242,7 @@ switch ($_REQUEST['action']) { } // end switch on type ob_start(); - require Config::get('prefix') . '/templates/show_' . $_POST['type'] . '_row.inc.php'; + require Config::get('prefix') . '/templates/show_' . $_POST['type'] . '.inc.php'; $results[$key] = ob_get_contents(); ob_end_clean(); break; @@ -275,6 +299,13 @@ switch ($_REQUEST['action']) { $GLOBALS['user']->playlist->add_object($item['object_id'],$item['type']); } break; + case 'smartplaylist': + $playlist = new Search('song', $_REQUEST['id']); + $items = $playlist->get_items(); + foreach ($items as $item) { + $GLOBALS['user']->playlist->add_object($item['object_id'],$item['type']); + } + break; case 'clear_all': $GLOBALS['user']->playlist->clear(); break; diff --git a/templates/show_album_row.inc.php b/templates/show_album_row.inc.php index fe395342..a413b6ae 100644 --- a/templates/show_album_row.inc.php +++ b/templates/show_album_row.inc.php @@ -52,6 +52,6 @@ if (Browse::is_enabled('show_art')) { </a> <?php } ?> <?php if (Access::check('interface','50')) { ?> - <?php echo Ajax::button('?action=show_edit_object&type=album&id=' . $album->id,'edit',_('Edit'),'edit_album_' . $album->id); ?> + <?php echo Ajax::button('?action=show_edit_object&type=album_row&id=' . $album->id,'edit',_('Edit'),'edit_album_' . $album->id); ?> <?php } ?> </td> diff --git a/templates/show_artist_row.inc.php b/templates/show_artist_row.inc.php index c02b27cf..e61aca56 100644 --- a/templates/show_artist_row.inc.php +++ b/templates/show_artist_row.inc.php @@ -37,6 +37,6 @@ </a> <?php } ?> <?php if (Access::check('interface','50')) { ?> - <?php echo Ajax::button('?action=show_edit_object&type=artist&id=' . $artist->id,'edit',_('Edit'),'edit_artist_' . $artist->id); ?> + <?php echo Ajax::button('?action=show_edit_object&type=artist_row&id=' . $artist->id,'edit',_('Edit'),'edit_artist_' . $artist->id); ?> <?php } ?> </td> diff --git a/templates/show_edit_album_row.inc.php b/templates/show_edit_album_row.inc.php index 0f4d5324..b103a2cd 100644 --- a/templates/show_edit_album_row.inc.php +++ b/templates/show_edit_album_row.inc.php @@ -45,8 +45,8 @@ </td> <td> <input type="hidden" name="id" value="<?php echo $album->id; ?>" /> - <input type="hidden" name="type" value="album" /> - <?php echo Ajax::button('?action=edit_object&id=' . $album->id . '&type=album','download',_('Save Changes'),'save_album_' . $album->id,'edit_album_' . $album->id); ?> + <input type="hidden" name="type" value="album_row" /> + <?php echo Ajax::button('?action=edit_object&id=' . $album->id . '&type=album_row','download',_('Save Changes'),'save_album_' . $album->id,'edit_album_' . $album->id); ?> </td> </tr> </table> diff --git a/templates/show_edit_artist_row.inc.php b/templates/show_edit_artist_row.inc.php index 341f4b9e..d8e925f8 100644 --- a/templates/show_edit_artist_row.inc.php +++ b/templates/show_edit_artist_row.inc.php @@ -29,9 +29,8 @@ </td> <td> <input type="hidden" name="id" value="<?php echo $artist->id; ?>" /> - <input type="hidden" name="type" value="artist" /> - <?php echo Ajax::button('?action=edit_object&id=' . $artist->id . '&type=artist','download',_('Save Changes'),'save_artist_' . $artist->id,'edit_artist_' . $artist->id); ?> - <?php echo Ajax::observe('edit_artist_' . $artist->id,'submit',Ajax::action('?action=edit_object&id=' . $artist->id . '&type=artist','edit_artist_' . $artist->id,'edit_artist_' . $artist->id),1); ?> + <input type="hidden" name="type" value="artist_row" /> + <?php echo Ajax::button('?action=edit_object&id=' . $artist->id . '&type=artist_row','download',_('Save Changes'),'save_artist_' . $artist->id,'edit_artist_' . $artist->id); ?> </tr> </table> diff --git a/templates/show_edit_live_stream_row.inc.php b/templates/show_edit_live_stream_row.inc.php index cf5b903e..2bde6f78 100644 --- a/templates/show_edit_live_stream_row.inc.php +++ b/templates/show_edit_live_stream_row.inc.php @@ -49,8 +49,8 @@ </td> <td> <input type="hidden" name="id" value="<?php echo $radio->id; ?>" /> - <input type="hidden" name="type" value="live_stream" /> - <?php echo Ajax::button('?action=edit_object&id=' . $radio->id . '&type=live_stream','download',_('Save Changes'),'save_live_stream_' . $radio->id,'edit_live_stream_' . $radio->id); ?> + <input type="hidden" name="type" value="live_stream_row" /> + <?php echo Ajax::button('?action=edit_object&id=' . $radio->id . '&type=live_stream_row','download',_('Save Changes'),'save_live_stream_' . $radio->id,'edit_live_stream_' . $radio->id); ?> </td> </tr> </table> diff --git a/templates/show_edit_playlist_row.inc.php b/templates/show_edit_playlist_row.inc.php index ff06a9c3..755c7c75 100644 --- a/templates/show_edit_playlist_row.inc.php +++ b/templates/show_edit_playlist_row.inc.php @@ -35,8 +35,8 @@ </select> <td> <input type="hidden" name="id" value="<?php echo $playlist->id; ?>" /> - <input type="hidden" name="type" value="playlist" /> - <?php echo Ajax::button('?action=edit_object&id=' . $playlist->id . '&type=playlist','download',_('Save Changes'),'save_playlist_' . $playlist->id,'edit_playlist_' . $playlist->id); ?> + <input type="hidden" name="type" value="playlist_row" /> + <?php echo Ajax::button('?action=edit_object&id=' . $playlist->id . '&type=playlist_row','download',_('Save Changes'),'save_playlist_' . $playlist->id,'edit_playlist_' . $playlist->id); ?> </td> </tr> </table> diff --git a/templates/show_edit_playlist_full_row.inc.php b/templates/show_edit_playlist_title.inc.php index 74af6972..1b85f7d4 100644 --- a/templates/show_edit_playlist_full_row.inc.php +++ b/templates/show_edit_playlist_title.inc.php @@ -34,8 +34,8 @@ </select> <td> <input type="hidden" name="id" value="<?php echo $playlist->id; ?>" /> - <input type="hidden" name="type" value="playlist_full" /> - <?php echo Ajax::button('?action=edit_object&id=' . $playlist->id . '&type=playlist_full','download',_('Save Changes'),'save_playlist_' . $playlist->id,'edit_playlist_' . $playlist->id); ?> + <input type="hidden" name="type" value="playlist_title" /> + <?php echo Ajax::button('?action=edit_object&id=' . $playlist->id . '&type=playlist_title','download',_('Save Changes'),'save_playlist_' . $playlist->id,'edit_playlist_' . $playlist->id); ?> </td> </tr> </table> diff --git a/templates/show_edit_song_row.inc.php b/templates/show_edit_song_row.inc.php index 40c8e57f..60dec7df 100644 --- a/templates/show_edit_song_row.inc.php +++ b/templates/show_edit_song_row.inc.php @@ -42,8 +42,8 @@ </td> <td> <input type="hidden" name="id" value="<?php echo $song->id; ?>" /> - <input type="hidden" name="type" value="song" /> - <?php echo Ajax::button('?action=edit_object&id=' . $song->id . '&type=song','download',_('Save Changes'),'save_song_' . $song->id,'edit_song_' . $song->id); ?> + <input type="hidden" name="type" value="song_row" /> + <?php echo Ajax::button('?action=edit_object&id=' . $song->id . '&type=song_row','download',_('Save Changes'),'save_song_' . $song->id,'edit_song_' . $song->id); ?> </td> </tr> </table> diff --git a/templates/show_live_stream_row.inc.php b/templates/show_live_stream_row.inc.php index c73d0176..baf91c90 100644 --- a/templates/show_live_stream_row.inc.php +++ b/templates/show_live_stream_row.inc.php @@ -29,7 +29,7 @@ <td class="cel_tag"><?php echo $radio->f_tag; ?></td> <td class="cel_action"> <?php if (Access::check('interface','50')) { ?> - <?php echo Ajax::button('?action=show_edit_object&type=live_stream&id=' . $radio->id,'edit',_('Edit'),'edit_radio_' . $radio->id); ?> + <?php echo Ajax::button('?action=show_edit_object&type=live_stream_row&id=' . $radio->id,'edit',_('Edit'),'edit_radio_' . $radio->id); ?> <?php } ?> <?php if (Access::check('interface','75')) { ?> <?php echo Ajax::button('?page=browse&action=delete_object&type=live_stream&id=' . $radio->id,'delete',_('Delete'),'delete_radio_' . $radio->id); ?> diff --git a/templates/show_playlist.inc.php b/templates/show_playlist.inc.php index a6d702ea..a38fdee1 100644 --- a/templates/show_playlist.inc.php +++ b/templates/show_playlist.inc.php @@ -25,9 +25,11 @@ */ ?> <?php -/* HINT: Playlist Type, Playlist Name */ -show_box_top('<div id="playlist_row_' . $playlist->id . '">' . - sprintf(_('%s %s (Playlist)'), $playlist->f_type, $playlist->name) . +ob_start(); +require Config::get('prefix') . '/templates/show_playlist_title.inc.php'; +$title = ob_get_contents(); +ob_end_clean(); +show_box_top('<div id="playlist_row_' . $playlist->id . '">' . $title . '</div>'); ?> <div id="information_actions"> @@ -52,7 +54,7 @@ show_box_top('<div id="playlist_row_' . $playlist->id . '">' . </li> <?php if ($playlist->has_access()) { ?> <li> - <?php echo Ajax::button('?action=show_edit_object&type=playlist_full&id=' . $playlist->id,'edit',_('Edit'),'edit_playlist_' . $playlist->id); ?> + <?php echo Ajax::button('?action=show_edit_object&type=playlist_title&id=' . $playlist->id,'edit',_('Edit'),'edit_playlist_' . $playlist->id); ?> <?php echo _('Edit'); ?> </li> <li> diff --git a/templates/show_playlist_row.inc.php b/templates/show_playlist_row.inc.php index e4ac5cd4..cc746c9b 100644 --- a/templates/show_playlist_row.inc.php +++ b/templates/show_playlist_row.inc.php @@ -35,7 +35,7 @@ </a> <?php } ?> <?php if ($playlist->has_access()) { ?> - <?php echo Ajax::button('?action=show_edit_object&type=playlist&id=' . $playlist->id,'edit',_('Edit'),'edit_playlist_' . $playlist->id); ?> + <?php echo Ajax::button('?action=show_edit_object&type=playlist_row&id=' . $playlist->id,'edit',_('Edit'),'edit_playlist_' . $playlist->id); ?> <?php echo Ajax::button('?page=browse&action=delete_object&type=playlist&id=' . $playlist->id,'delete',_('Delete'),'delete_playlist_' . $playlist->id); ?> <?php } ?> </td> diff --git a/templates/show_playlist_full_row.inc.php b/templates/show_playlist_title.inc.php index 5d315540..5d315540 100644 --- a/templates/show_playlist_full_row.inc.php +++ b/templates/show_playlist_title.inc.php diff --git a/templates/show_song_row.inc.php b/templates/show_song_row.inc.php index ca4ca4e4..a7174d8b 100644 --- a/templates/show_song_row.inc.php +++ b/templates/show_song_row.inc.php @@ -45,7 +45,7 @@ </a> <?php } ?> <?php if (Access::check('interface','75')) { ?> - <?php echo Ajax::button('?action=show_edit_object&type=song&id=' . $song->id,'edit',_('Edit'),'edit_song_' . $song->id); ?> + <?php echo Ajax::button('?action=show_edit_object&type=song_row&id=' . $song->id,'edit',_('Edit'),'edit_song_' . $song->id); ?> <?php $icon = $song->enabled ? 'disable' : 'enable'; ?> <?php $button_flip_state_id = 'button_flip_state_' . $song_id; ?> <span id="<?php echo($button_flip_state_id); ?>"> |