mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-06 03:49:56 +02:00
fixed opera playback, added playlist mojo to the xml api doodly, konqueror is still broken as is the API and XML-RPC stuff, also updated prototype.js
This commit is contained in:
parent
7cbf829be1
commit
be699cab75
6 changed files with 1972 additions and 1027 deletions
|
@ -4,6 +4,10 @@
|
|||
|
||||
--------------------------------------------------------------------------
|
||||
v.3.4-Alpha4
|
||||
- Upgraded to Prototype 1.6
|
||||
- Added playlists and playlist_songs methods to API
|
||||
- Fixed a problem with the javascript that was causing Opera to not
|
||||
get the playlist correctly.
|
||||
- Migrated to 'new' auth system that unifies xml-rpc,api and normal
|
||||
sessions in a single table
|
||||
- Fixed some issues with downsampling + seeking and seeking in
|
||||
|
|
|
@ -206,6 +206,41 @@ class xmlData {
|
|||
|
||||
} // genres
|
||||
|
||||
/**
|
||||
* playlists
|
||||
* This takes an array of playlist ids and then returns a nice pretty XML document
|
||||
*/
|
||||
public static function playlists($playlists) {
|
||||
|
||||
if (count($playlists) > self::$limit) {
|
||||
$playlists = array_slice($playlists,self::$offset,self::$limit);
|
||||
}
|
||||
|
||||
$string = '';
|
||||
|
||||
// Foreach the playlist ids
|
||||
foreach ($playlists as $playlist_id) {
|
||||
$playlist = new Playlist($playlist_id);
|
||||
$playlist->format();
|
||||
$item_total = $playlist->get_song_count();
|
||||
|
||||
// Build this element
|
||||
$string .= "<playlist id=\"$playlist->id\">\n" .
|
||||
"\t<name><![CDATA[$playlist->name]]></name>\n" .
|
||||
"\t<owner><![CDATA[$playlist->f_user]]</owner>\n" .
|
||||
"\t<items>$item_total</items>\n" .
|
||||
"</playlist>\n";
|
||||
|
||||
|
||||
} // end foreach
|
||||
|
||||
// Build the final and then send her off
|
||||
$final = self::_header() . $string . self::_footer();
|
||||
|
||||
return $final;
|
||||
|
||||
} // playlists
|
||||
|
||||
/**
|
||||
* songs
|
||||
* This returns an xml document from an array of song ids spiffy isn't it!
|
||||
|
|
|
@ -44,42 +44,6 @@ function selectField(element)
|
|||
element_id.focus();
|
||||
}
|
||||
|
||||
var checkflag = "false";
|
||||
|
||||
function check_select(type,name) {
|
||||
if ( name == undefined){
|
||||
var name = '';
|
||||
}
|
||||
if ( checkflag == "false") {
|
||||
if ( eval("document.forms."+ type +"s"+ name +".elements[\""+ type +"[]\"].length") == undefined) {
|
||||
var zz = eval("document.forms."+ type +"s"+ name +".elements[\""+ type +"[]\"]");
|
||||
zz.checked = true;
|
||||
}
|
||||
else {
|
||||
for (i = 0; i < eval("document.forms."+ type +"s"+ name +".elements[\""+ type +"[]\"].length"); i++) {
|
||||
var zz = eval("document.forms."+ type +"s"+ name +".elements[\""+ type +"[]\"][i]");
|
||||
zz.checked = true;
|
||||
}
|
||||
}
|
||||
checkflag = "true";
|
||||
return "Unselect All";
|
||||
}
|
||||
else {
|
||||
if ( eval("document.forms."+ type +"s"+ name +".elements[\""+ type +"[]\"].length") == undefined) {
|
||||
var zz = eval("document.forms."+ type +"s"+ name +".elements[\""+ type +"[]\"]");
|
||||
zz.checked = false;
|
||||
}
|
||||
else {
|
||||
for (i = 0; i < eval("document.forms."+ type +"s"+ name +".elements[\""+ type +"[]\"].length"); i++) {
|
||||
var zz = eval("document.forms."+ type +"s"+ name +".elements[\""+ type +"[]\"][i]");
|
||||
zz.checked = false;
|
||||
}
|
||||
}
|
||||
checkflag = "false";
|
||||
return "Select All";
|
||||
}
|
||||
}
|
||||
|
||||
// function for the catalog mojo fluf
|
||||
function update_txt(value,field) {
|
||||
document.getElementById(field).innerHTML=value;
|
||||
|
@ -89,8 +53,18 @@ function update_txt(value,field) {
|
|||
// IE issue fixed by Spocky, we have to use the iframe for Democratic Play & Localplay
|
||||
// which don't actually prompt for a new file
|
||||
function reload_util(target) {
|
||||
|
||||
if (navigator.appName == 'Opera') {
|
||||
document.getElementById('util_iframe').contentWindow.location.reload(true);
|
||||
}
|
||||
else if (navigator.appName == 'Konqueror') {
|
||||
alert(document.getElementById('util_iframe').location.url);
|
||||
document.getElementById('util_iframe').location.url = document.getElementById('util_iframe').location.url
|
||||
}
|
||||
else {
|
||||
document.getElementById('util_iframe').src = document.getElementById('util_iframe').src;
|
||||
}
|
||||
}
|
||||
|
||||
// Log them out
|
||||
function reload_logout(target) {
|
||||
|
|
2724
modules/prototype/prototype.js
vendored
2724
modules/prototype/prototype.js
vendored
File diff suppressed because it is too large
Load diff
|
@ -178,6 +178,35 @@ switch ($_REQUEST['action']) {
|
|||
ob_end_clean();
|
||||
echo xmlData::songs($songs);
|
||||
break;
|
||||
case 'playlists':
|
||||
Browse::reset_filters();
|
||||
Browse::set_type('playlist');
|
||||
Browse::set_sort('name','ASC');
|
||||
|
||||
if ($_REQUEST['filter']) {
|
||||
Browse::set_filter('alpha_match',$_REQUEST['filter']);
|
||||
}
|
||||
|
||||
$playlist_ids = Browse::get_objects();
|
||||
|
||||
xmlData::set_offset($_REQUEST['offset']);
|
||||
ob_end_clean();
|
||||
echo xmlData::playlists($playlist_ids);
|
||||
break;
|
||||
case 'playlist_songs':
|
||||
$playlist = new Playlist($_REQUEST['filter']);
|
||||
$items = $playlist->get_items();
|
||||
|
||||
foreach ($items as $object) {
|
||||
if ($object['type'] == 'song') {
|
||||
$songs[] = $object['object_id'];
|
||||
}
|
||||
} // end foreach
|
||||
|
||||
xmlData::set_offset($_REQUEST['offset']);
|
||||
ob_end_clean();
|
||||
echo xmlData::songs($songs);
|
||||
break;
|
||||
default:
|
||||
ob_end_clean();
|
||||
echo xmlData::error('Invalid Request');
|
||||
|
|
5
util.php
5
util.php
|
@ -20,6 +20,11 @@
|
|||
*/
|
||||
require_once 'lib/init.php';
|
||||
|
||||
header("Expires: Tuesday, 27 Mar 1984 05:00:00 GMT");
|
||||
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
||||
header("Cache-Control: no-store, no-cache, must-revalidate");
|
||||
header("Pragma: no-cache");
|
||||
|
||||
// This is a little bit of a special file, it takes the
|
||||
// content of $_SESSION['iframe']['target'] and does a header
|
||||
// redirect to that spot!
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue