mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-05 19:41:55 +02:00
minor tweaks to playlist stuff, not finished by a longshot, added in licence to kajax js file
This commit is contained in:
parent
19f4dd21d3
commit
d5231c592c
4 changed files with 58 additions and 105 deletions
|
@ -4,6 +4,7 @@
|
|||
|
||||
--------------------------------------------------------------------------
|
||||
v.3.4-Alpha2
|
||||
- Fixed copyright notices (Thx porthose)
|
||||
- Fixed single downloads
|
||||
- Fixed weird CSS issue with a crafty little hack
|
||||
- Fixed a session fixation issue
|
||||
|
|
|
@ -1,8 +1,21 @@
|
|||
var http_request = false;
|
||||
var IE = true;
|
||||
|
||||
// uid is an array of uids that need to be replaced
|
||||
function ajaxPut(url,source) {
|
||||
// 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.
|
||||
//
|
||||
// uid is an array of uids that need to be replaced
|
||||
function ajaxPut(url,source) {
|
||||
|
||||
if (document.getElementById(source)) {
|
||||
Event.stopObserving(source,'click',function(){ajaxPut(url,source);});
|
||||
|
@ -29,9 +42,10 @@
|
|||
http_request.onreadystatechange = function() { getContents(http_request); };
|
||||
http_request.open('GET', url, true);
|
||||
http_request.send(null);
|
||||
}
|
||||
}
|
||||
|
||||
function getContents(http_request) {
|
||||
|
||||
function getContents(http_request) {
|
||||
if (http_request.readyState == 4) {
|
||||
if (http_request.status == 200) {
|
||||
var data = http_request.responseXML;
|
||||
|
@ -47,9 +61,9 @@
|
|||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function ajaxPost(url,input,source) {
|
||||
function ajaxPost(url,input,source) {
|
||||
|
||||
if (document.getElementById(source)) {
|
||||
Event.stopObserving(source,'click',function(){ajaxPost(url,input,source);});
|
||||
|
@ -91,6 +105,5 @@
|
|||
http_request.setRequestHeader("Connection", "close");
|
||||
http_request.send(post_data);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
70
playlist.php
70
playlist.php
|
@ -28,63 +28,9 @@ require_once 'lib/init.php';
|
|||
|
||||
show_header();
|
||||
|
||||
/* Get the Vars we need for later cleaned up */
|
||||
$action = strtolower(scrub_in($_REQUEST['action']));
|
||||
$playlist = new Playlist(scrub_in($_REQUEST['playlist_id']));
|
||||
|
||||
/* Switch on the action passed in */
|
||||
switch ($action) {
|
||||
case 'delete_playlist':
|
||||
/* Make sure they have the rights */
|
||||
if (!$playlist->has_access()) {
|
||||
access_denied();
|
||||
break;
|
||||
}
|
||||
/* Go for it! */
|
||||
$playlist->delete();
|
||||
show_confirmation(_('Playlist Deleted'),_('The Requested Playlist has been deleted'),'/playlist.php');
|
||||
break;
|
||||
case 'show_delete_playlist':
|
||||
/* Make sure they have the rights */
|
||||
if (!$playlist->has_access()) {
|
||||
access_denied();
|
||||
break;
|
||||
}
|
||||
|
||||
/* Show Confirmation Question */
|
||||
$message = _('Are you sure you want to delete this playlist') . " " . $playlist->name . "?";
|
||||
show_confirmation(_('Confirm Action'),$message,'/playlist.php?action=delete_playlist&playlist_id=' . $playlist->id,1);
|
||||
break;
|
||||
case 'add_to':
|
||||
case 'add to':
|
||||
/* If we don't already have a playlist */
|
||||
if (!$playlist->id && $GLOBALS['user']->has_access(25)) {
|
||||
$playlist_name = _('New Playlist') . " - " . date('m/j/y, g:i a');
|
||||
$id = $playlist->create($playlist_name, 'private');
|
||||
$playlist = new Playlist($id);
|
||||
}
|
||||
|
||||
if (!$playlist->has_access()) {
|
||||
access_denied();
|
||||
break;
|
||||
}
|
||||
|
||||
if ($_REQUEST['type'] == 'album') {
|
||||
$song_ids = get_songs_from_type($_REQUEST['type'],$_REQUEST['song'],$_REQUEST['artist_id']);
|
||||
}
|
||||
else {
|
||||
$song_ids = $_REQUEST['song'];
|
||||
}
|
||||
|
||||
/* Add the songs */
|
||||
$playlist->add_songs($song_ids);
|
||||
|
||||
/* Show the Playlist */
|
||||
$_REQUEST['playlist_id'] = $playlist->id;
|
||||
/* Store this new id in the session for later use */
|
||||
$_SESSION['data']['playlist_id'] = $playlist->id;
|
||||
show_playlist($playlist);
|
||||
break;
|
||||
switch ($_REQUEST['action']) {
|
||||
case 'add_dyn_song':
|
||||
/* Check Rights */
|
||||
if (!$playlist->has_access()) {
|
||||
|
@ -97,7 +43,6 @@ switch ($action) {
|
|||
show_playlist($playlist);
|
||||
break;
|
||||
case 'create_playlist':
|
||||
case 'create':
|
||||
/* Check rights */
|
||||
if (!$GLOBALS['user']->has_access(25)) {
|
||||
access_denied();
|
||||
|
@ -111,14 +56,7 @@ switch ($action) {
|
|||
$_SESSION['data']['playlist_id'] = $playlist->id;
|
||||
show_confirmation(_('Playlist Created'),$playlist_name . ' (' . $playlist_type . ') ' . _(' has been created'),'playlist.php');
|
||||
break;
|
||||
case 'edit':
|
||||
show_playlist_edit($_REQUEST['playlist_id']);
|
||||
break;
|
||||
case 'new':
|
||||
require (conf('prefix') . '/templates/show_add_playlist.inc.php');
|
||||
break;
|
||||
case 'remove_song':
|
||||
case _('Remote Selected Tracks'):
|
||||
/* Check em for rights */
|
||||
if (!$playlist->has_access()) {
|
||||
access_denied();
|
||||
|
@ -194,6 +132,8 @@ switch ($action) {
|
|||
show_confirmation($title,$body,$url);
|
||||
break;
|
||||
case 'normalize_tracks':
|
||||
$playlist = new Playlist($_REQUEST['playlist_id']);
|
||||
|
||||
/* Make sure they have permission */
|
||||
if (!$playlist->has_access()) {
|
||||
access_denied();
|
||||
|
@ -203,11 +143,9 @@ switch ($action) {
|
|||
/* Normalize the tracks */
|
||||
$playlist->normalize_tracks();
|
||||
|
||||
/* Show our wonderful work */
|
||||
show_playlist($playlist);
|
||||
break;
|
||||
default:
|
||||
show_playlists();
|
||||
require_once Config::get('prefix') . '/templates/show_playlist.inc.php';
|
||||
break;
|
||||
} // switch on the action
|
||||
|
||||
|
|
|
@ -26,9 +26,10 @@ $web_path = Config::get('web_path');
|
|||
?>
|
||||
<?php show_box_top($playlist->name . ' ' . _('Playlist')); ?>
|
||||
<ul class="text-action">
|
||||
<li><a href="<?php echo $web_path; ?>/playlist.php?action=normalize_tracks&playlist_id=<?php echo $playlist_id; ?>"><?php echo _('Normalize Tracks'); ?></a></li>
|
||||
<li><a href="<?php echo $web_path; ?>/stream.php?action=play_selected&playlist_id=<?php echo $playlist_id; ?>"><?php echo _('Play This Playlist'); ?></a></li>
|
||||
<li><a href="<?php echo $web_path; ?>/stream.php?action=playlist_random&playlist_id=<?php echo $playlist_id; ?>"><?php echo _('Play Random'); ?></a></li>
|
||||
<li><a href="<?php echo $web_path; ?>/playlist.php?action=normalize_tracks&playlist_id=<?php echo $playlist->id; ?>"><?php echo _('Normalize Tracks'); ?></a></li>
|
||||
<li><a href="<?php echo $web_path; ?>/stream.php?action=play_selected&playlist_id=<?php echo $playlist->id; ?>"><?php echo _('Play This Playlist'); ?></a></li>
|
||||
<li><a href="<?php echo $web_path; ?>/stream.php?action=playlist_random&playlist_id=<?php echo $playlist->id; ?>"><?php echo _('Play Random'); ?></a></li>
|
||||
</ul>
|
||||
<?php show_box_bottom(); ?>
|
||||
|
||||
<div id="browse_content">
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue