1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-04 10:19:25 +02:00

Prompt for new playlist name

This commit is contained in:
Afterster 2015-12-27 14:20:59 +01:00
parent 961c9c6a6b
commit 435500ee66
3 changed files with 13 additions and 2 deletions

View file

@ -87,6 +87,14 @@ function handlePlaylistAction(url, id) {
$("#playlistdialog").dialog("close");
}
function createNewPlaylist(title, url, id) {
var plname = window.prompt(title, '');
if (plname != null) {
url += '&name=' + plname;
handlePlaylistAction(url, id);
}
}
/************************************************************/
/* Dialog selection to start a broadcast */
/************************************************************/

View file

@ -61,7 +61,10 @@ switch ($_REQUEST['action']) {
break;
}
$name = $_REQUEST['name'];
if (empty($name)) {
$name = $GLOBALS['user']->username . ' - ' . date("Y-m-d H:i:s",time());
}
$playlist_id = Playlist::create($name, 'private');
if (!$playlist_id) {
break;

View file

@ -23,7 +23,7 @@
<ul>
<li>
<a href="javascript:void(0);" id="rb_append_dplaylist_new" onclick="handlePlaylistAction('<?php echo AmpConfig::get('ajax_url') . '?page=playlist&action=append_item&item_type=' . $object_type . '&item_id=' . $object_id; ?>', 'rb_append_dplaylist_new');">
<a href="javascript:void(0);" id="rb_append_dplaylist_new" onclick="createNewPlaylist('<?php echo T_('Playlist name'); ?>', '<?php echo AmpConfig::get('ajax_url') . '?page=playlist&action=append_item&item_type=' . $object_type . '&item_id=' . $object_id; ?>', 'rb_append_dplaylist_new');">
<?php echo T_('Add to New Playlist'); ?>
</a>
</li>