diff options
author | Paul 'flowerysong' Arthur <flowerysong00@yahoo.com> | 2010-04-28 05:32:10 +0000 |
---|---|---|
committer | Paul 'flowerysong' Arthur <flowerysong00@yahoo.com> | 2010-04-28 05:32:10 +0000 |
commit | 1a0c72d524221419e1ba9ca5ff6049de04199911 (patch) | |
tree | d65d71e977fa5f3d7bf0bafd82a91338d4b6b105 | |
parent | 34739b2af797e3e981a30a41ec9db19bdf5c158f (diff) | |
download | ampache-1a0c72d524221419e1ba9ca5ff6049de04199911.tar.gz ampache-1a0c72d524221419e1ba9ca5ff6049de04199911.tar.bz2 ampache-1a0c72d524221419e1ba9ca5ff6049de04199911.zip |
Add the ability to edit or delete a playlist from the normal playlist display,
not just while browsing. Fixes FS#16
-rw-r--r-- | playlist.php | 15 | ||||
-rw-r--r-- | templates/show_edit_playlist_full_row.inc.php | 43 | ||||
-rw-r--r-- | templates/show_edit_playlist_row.inc.php | 2 | ||||
-rw-r--r-- | templates/show_playlist.inc.php | 19 | ||||
-rw-r--r-- | templates/show_playlist_full_row.inc.php | 24 |
5 files changed, 101 insertions, 2 deletions
diff --git a/playlist.php b/playlist.php index 226c0e35..db68c8b0 100644 --- a/playlist.php +++ b/playlist.php @@ -27,6 +27,17 @@ require_once 'lib/init.php'; +// We special-case this so we can send a 302 if the delete succeeded +if ($_REQUEST['action'] == 'delete_playlist') { + // Check rights + $playlist = new Playlist($_REQUEST['playlist_id']); + if ($playlist->has_access()) { + $playlist->delete(); + // Go elsewhere + header('Location: ' . Config::get('web_path') . '/browse.php?action=playlist'); + } +} + show_header(); @@ -57,6 +68,10 @@ switch ($_REQUEST['action']) { $_SESSION['data']['playlist_id'] = $playlist->id; show_confirmation(_('Playlist Created'),$playlist_name . ' (' . $playlist_type . ') ' . _(' has been created'),'playlist.php'); break; + case 'delete_playlist': + // If we made it here, we didn't have sufficient rights. + access_denied(); + break; case 'remove_song': /* Check em for rights */ if (!$playlist->has_access()) { diff --git a/templates/show_edit_playlist_full_row.inc.php b/templates/show_edit_playlist_full_row.inc.php new file mode 100644 index 00000000..74af6972 --- /dev/null +++ b/templates/show_edit_playlist_full_row.inc.php @@ -0,0 +1,43 @@ +<?php +/* vim:set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab: */ +/* + + Copyright (c) 2001 - 2007 Ampache.org + All rights reserved. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License v2 + as published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ +?> +<form method="post" id="edit_playlist_<?php echo $playlist->id; ?>" action="javascript:void(0);"> +<table cellpadding="0" cellspacing="0"> +<tr> + <td> + <input type="text" name="name" size="25" value="<?php echo scrub_out($playlist->name); ?>" /> + </td> + <td> + <?php $name = 'select_' . $playlist->type; ${$name} = ' selected="selected"'; ?> + <select name="pl_type"> + <option value="public"<?php echo $select_public; ?>><?php echo _('Public'); ?></option> + <option value="private"<?php echo $select_private; ?>><?php echo _('Private'); ?></option> + </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); ?> + </td> +</tr> +</table> +</form> + diff --git a/templates/show_edit_playlist_row.inc.php b/templates/show_edit_playlist_row.inc.php index 3bb3cd5a..ff06a9c3 100644 --- a/templates/show_edit_playlist_row.inc.php +++ b/templates/show_edit_playlist_row.inc.php @@ -25,7 +25,7 @@ <table cellpadding="0" cellspacing="0"> <tr> <td> - <input type="text" name="name" size="9" value="<?php echo scrub_out($playlist->name); ?>" /> + <input type="text" name="name" size="25" value="<?php echo scrub_out($playlist->name); ?>" /> </td> <td> <?php $name = 'select_' . $playlist->type; ${$name} = ' selected="selected"'; ?> diff --git a/templates/show_playlist.inc.php b/templates/show_playlist.inc.php index 225b1e70..a18289aa 100644 --- a/templates/show_playlist.inc.php +++ b/templates/show_playlist.inc.php @@ -24,7 +24,12 @@ * It changes depending on where it is */ ?> -<?php /* HINT: Playlist Type, Playlist Name */ show_box_top(sprintf(_('%s %s Playlist'), $playlist->f_type, $playlist->name)); ?> +<?php +/* HINT: Playlist Type, Playlist Name */ +show_box_top('<div id="playlist_row_' . $playlist->id . '">' . + sprintf(_('%s %s Playlist'), $playlist->f_type, $playlist->name) . + '</div>'); +?> <div id="information_actions"> <ul> <li> @@ -45,6 +50,18 @@ <?php echo Ajax::button('?action=basket&type=playlist_random&id=' . $playlist->id,'random',_('Add Random'),'play_playlist_random'); ?> <?php echo _('Add Random'); ?> </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 _('Edit'); ?> + </li> + <li> + <a href="<?php echo Config::get('web_path'); ?>/playlist.php?action=delete_playlist&playlist_id=<?php echo $playlist->id; ?>"> + <?php echo get_user_icon('delete'); ?> + </a> + <?php echo _('Delete'); ?> + </li> + <?php } ?> </ul> </div> <?php show_box_bottom(); ?> diff --git a/templates/show_playlist_full_row.inc.php b/templates/show_playlist_full_row.inc.php new file mode 100644 index 00000000..cd480582 --- /dev/null +++ b/templates/show_playlist_full_row.inc.php @@ -0,0 +1,24 @@ +<?php +/* vim:set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab: */ +/* + + Copyright (c) 2001 - 2007 Ampache.org + All rights reserved. + + This program is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License v2 + as published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +*/ +?> + +<?php echo sprintf(_('%s %s Playlist'), $playlist->f_type, $playlist->name); ?> |