mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-05 02:39:47 +02:00
ajax loading thingy added to css, fixed random methods on rightbar and added a default sort to the browse methods
This commit is contained in:
parent
9030c16466
commit
705fba8f49
10 changed files with 76 additions and 14 deletions
|
@ -42,26 +42,31 @@ switch($_REQUEST['action']) {
|
|||
case 'file':
|
||||
case 'album':
|
||||
Browse::set_type('album');
|
||||
Browse::set_sort('name','ASC');
|
||||
$album_ids = Browse::get_objects();
|
||||
Browse::show_objects($album_ids);
|
||||
break;
|
||||
case 'artist':
|
||||
Browse::set_type('artist');
|
||||
Browse::set_sort('name','ASC');
|
||||
$artist_ids = Browse::get_objects();
|
||||
Browse::show_objects($artist_ids);
|
||||
break;
|
||||
case 'genre':
|
||||
Browse::set_type('genre');
|
||||
Browse::set_sort('name','ASC');
|
||||
$genre_ids = Browse::get_objects();
|
||||
Browse::show_objects($genre_ids);
|
||||
break;
|
||||
case 'song':
|
||||
Browse::set_type('song');
|
||||
Browse::set_sort('title','ASC');
|
||||
$song_ids = Browse::get_objects();
|
||||
Browse::show_objects($song_ids);
|
||||
break;
|
||||
case 'live_stream':
|
||||
Browse::set_type('live_stream');
|
||||
Browse::set_sort('name','ASC');
|
||||
$live_stream_ids = Browse::get_objects();
|
||||
Browse::show_objects($live_stream_ids);
|
||||
break;
|
||||
|
@ -70,6 +75,7 @@ switch($_REQUEST['action']) {
|
|||
break;
|
||||
case 'playlist':
|
||||
Browse::set_type('playlist');
|
||||
Browse::set_sort('name','ASC');
|
||||
$playlist_ids = Browse::get_objects();
|
||||
Browse::show_objects($playlist_ids);
|
||||
break;
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
|
||||
--------------------------------------------------------------------------
|
||||
v.3.4-Alpha3
|
||||
- Fixed Random methods (rightbar)
|
||||
- Added Loading box for ajax actions
|
||||
- Added ability to append to existing playlists
|
||||
- Modified Play Method to use hidden iframe
|
||||
- Fixed album random and by min random
|
||||
|
|
|
@ -119,7 +119,7 @@ class Browse {
|
|||
* set_sort
|
||||
* This sets the current sort(s)
|
||||
*/
|
||||
public static function set_sort($sort) {
|
||||
public static function set_sort($sort,$order='') {
|
||||
|
||||
switch ($_SESSION['browse']['type']) {
|
||||
case 'song':
|
||||
|
@ -145,9 +145,13 @@ class Browse {
|
|||
// If it's not in our list, smeg off!
|
||||
if (!in_array($sort,$valid_array)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($_SESSION['browse']['sort'][$sort] == 'DESC') {
|
||||
}
|
||||
|
||||
if ($order) {
|
||||
$_SESSION['browse']['sort'] = array();
|
||||
$_SESSION['browse']['sort'][$sort] = $order;
|
||||
}
|
||||
elseif ($_SESSION['browse']['sort'][$sort] == 'DESC') {
|
||||
// Reset it till I can figure out how to interface the hotness
|
||||
$_SESSION['browse']['sort'] = array();
|
||||
$_SESSION['browse']['sort'][$sort] = 'ASC';
|
||||
|
@ -572,6 +576,9 @@ class Browse {
|
|||
// First pull the objects
|
||||
$objects = self::get_saved();
|
||||
|
||||
// If there's nothing there don't do anything
|
||||
if (!count($objects)) { return false; }
|
||||
|
||||
foreach ($objects as $object_id) {
|
||||
$object_id = Dba::escape($object_id);
|
||||
$where_sql .= "`id`='$object_id' OR";
|
||||
|
|
|
@ -98,7 +98,7 @@ class Random {
|
|||
}
|
||||
|
||||
if (Config::get('require_session')) {
|
||||
$session_string = '&sid=' . session_id();
|
||||
$session_string = '&sid=' . Stream::get_session();
|
||||
}
|
||||
|
||||
$web_path = Config::get('web_path');
|
||||
|
|
|
@ -793,7 +793,7 @@ class Song {
|
|||
$session_string = "&sid=" . $session_id;
|
||||
}
|
||||
else {
|
||||
$session_string = "&sid=" . session_id();
|
||||
$session_string = "&sid=" . Stream::get_session();
|
||||
}
|
||||
} // if they are requiring a session
|
||||
|
||||
|
|
|
@ -53,9 +53,6 @@ class Stream {
|
|||
if (Config::get('force_http_play')) {
|
||||
$this->web_path = preg_replace("/https/", "http",$this->web_path);
|
||||
}
|
||||
|
||||
// Generate the session ID
|
||||
self::$session = md5(uniqid(rand(), true));;
|
||||
|
||||
} // Constructor
|
||||
|
||||
|
@ -103,6 +100,16 @@ class Stream {
|
|||
|
||||
} // manual_url_add
|
||||
|
||||
/**
|
||||
* get_session
|
||||
* This returns the current stream session
|
||||
*/
|
||||
public static function get_session() {
|
||||
|
||||
return self::$session;
|
||||
|
||||
} // get_session
|
||||
|
||||
/**
|
||||
* insert_session
|
||||
* This inserts a row into the session_stream table
|
||||
|
@ -207,7 +214,7 @@ class Stream {
|
|||
if ($GLOBALS['user']->prefs['play_type'] == 'downsample') {
|
||||
$ds = $GLOBALS['user']->prefs['sample_rate'];
|
||||
}
|
||||
echo $song->get_url(self::$session);
|
||||
echo $song->get_url();
|
||||
} // end foreach
|
||||
|
||||
/* Foreach the additional URLs */
|
||||
|
@ -443,7 +450,7 @@ class Stream {
|
|||
|
||||
// Foreach the stuff we've got and add it
|
||||
foreach ($this->objects as $object) {
|
||||
$localplay->add($object,self::$session);
|
||||
$localplay->add($object);
|
||||
}
|
||||
|
||||
$localplay->play();
|
||||
|
@ -474,7 +481,7 @@ class Stream {
|
|||
// Build up our object
|
||||
$song_id = $this->songs['0'];
|
||||
$song = new Song($song_id);
|
||||
$url = $song->get_url(self::$session);
|
||||
$url = $song->get_url();
|
||||
|
||||
// Append the fact we are downloading
|
||||
$url .= '&action=download';
|
||||
|
@ -496,11 +503,22 @@ class Stream {
|
|||
header("Content-Type: audio/x-pn-realaudio ram;");
|
||||
foreach ($this->songs as $song_id) {
|
||||
$song = new Song($song_id);
|
||||
echo $song->get_url(self::$session);
|
||||
echo $song->get_url();
|
||||
} // foreach songs
|
||||
|
||||
} // create_ram
|
||||
|
||||
/**
|
||||
* auto_init
|
||||
* This is called on class load it sets the session
|
||||
*/
|
||||
public static function auto_init() {
|
||||
|
||||
// Generate the session ID
|
||||
self::$session = md5(uniqid(rand(), true));;
|
||||
|
||||
} // auto_init
|
||||
|
||||
} //end of stream class
|
||||
|
||||
?>
|
||||
|
|
|
@ -46,6 +46,10 @@ function ajaxPut(url,source) {
|
|||
|
||||
|
||||
function getContents(http_request) {
|
||||
|
||||
// Display the loading doodly
|
||||
document.getElementById('ajax-loading').style.display = 'block';
|
||||
|
||||
if (http_request.readyState == 4) {
|
||||
if (http_request.status == 200) {
|
||||
var data = http_request.responseXML;
|
||||
|
@ -58,7 +62,7 @@ function getContents(http_request) {
|
|||
$(newID).update(newContent[i].firstChild.nodeValue);
|
||||
}
|
||||
}
|
||||
|
||||
document.getElementById('ajax-loading').style.display = 'none';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,6 +80,7 @@ if (Config::get('use_rss')) { ?>
|
|||
<!-- I hate IE...
|
||||
<table class="smeg-ie" width="100%"><tr><td> -->
|
||||
<!-- Tiny little iframe, used to cheat the system -->
|
||||
<div id="ajax-loading">Loading . . .</div>
|
||||
<iframe id="util_iframe" style="display:none;" src="<?php echo Config::get('web_path'); ?>/util.php"></iframe>
|
||||
<div id="content">
|
||||
<?php if (Config::get('int_config_version') != Config::get('config_version') AND $GLOBALS['user']->has_access(100)) { ?>
|
||||
|
|
|
@ -724,6 +724,18 @@ td.user_disabled {
|
|||
border:2px solid #000;
|
||||
}
|
||||
|
||||
#ajax-loading {
|
||||
position: absolute;
|
||||
right: 0px;
|
||||
top: 0px;
|
||||
float: right;
|
||||
z-index: 100;
|
||||
background: #99ccff;
|
||||
display: none;
|
||||
padding: 3px 25px 5px 25px;
|
||||
border: 1px solid #000;
|
||||
}
|
||||
|
||||
#mpdpl td {
|
||||
padding:0 2px 0 2px;
|
||||
text-align:left;
|
||||
|
|
|
@ -818,6 +818,18 @@ input.text_input {
|
|||
|
||||
.display {}
|
||||
|
||||
#ajax-loading {
|
||||
position: absolute;
|
||||
right: 0px;
|
||||
top: 0px;
|
||||
float: right;
|
||||
z-index: 100;
|
||||
background: #99ccff;
|
||||
display: none;
|
||||
padding: 3px 25px 5px 25px;
|
||||
border: 1px solid #000;
|
||||
}
|
||||
|
||||
#mpdpl td {
|
||||
padding: 0 2px 0 2px;
|
||||
text-align: left;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue