mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-03 17:59:21 +02:00
Change Browse from static to instantiable. Among other things, fixes FS#13;
probably also breaks things. Most things appear to still work, but I may have missed some cases.
This commit is contained in:
parent
c1ed41a16d
commit
7f36693353
39 changed files with 754 additions and 673 deletions
|
@ -293,19 +293,23 @@ switch ($_REQUEST['action']) {
|
||||||
break;
|
break;
|
||||||
case 'show_disabled':
|
case 'show_disabled':
|
||||||
$disabled = Flag::get_disabled();
|
$disabled = Flag::get_disabled();
|
||||||
Browse::set_type('song');
|
$browse = new Browse();
|
||||||
Browse::set_static_content(1);
|
$browse->set_type('song');
|
||||||
Browse::save_objects($disabled);
|
$browse->set_static_content(true);
|
||||||
Browse::show_objects($disabled);
|
$browse->save_objects($disabled);
|
||||||
|
$browse->show_objects($disabled);
|
||||||
|
$browse->store();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
case 'show_flagged':
|
case 'show_flagged':
|
||||||
$flagged = Flag::get_all();
|
$flagged = Flag::get_all();
|
||||||
Flag::build_cache($flagged);
|
Flag::build_cache($flagged);
|
||||||
Browse::set_type('flagged');
|
$browse = new Browse();
|
||||||
Browse::set_static_content(1);
|
$browse->set_type('flagged');
|
||||||
Browse::save_objects($flagged);
|
$browse->set_static_content(true);
|
||||||
Browse::show_objects($flagged);
|
$browse->save_objects($flagged);
|
||||||
|
$browse->show_objects($flagged);
|
||||||
|
$browse->store();
|
||||||
break;
|
break;
|
||||||
} // end switch
|
} // end switch
|
||||||
|
|
||||||
|
|
|
@ -33,8 +33,12 @@ switch ($_REQUEST['action']) {
|
||||||
default:
|
default:
|
||||||
// Show Catalogs
|
// Show Catalogs
|
||||||
$catalog_ids = Catalog::get_catalogs();
|
$catalog_ids = Catalog::get_catalogs();
|
||||||
Browse::set_type('catalog');
|
$browse = new Browse();
|
||||||
Browse::show_objects($catalog_ids);
|
$browse->set_type('catalog');
|
||||||
|
$browse->set_static_content(true);
|
||||||
|
$browse->save_objects($catalog_ids);
|
||||||
|
$browse->show_objects($catalog_ids);
|
||||||
|
$browse->store();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -48,10 +48,12 @@ switch ($_REQUEST['action']) {
|
||||||
show_confirmation(_('Shoutbox Post Deleted'),'',Config::get('web_path').'/admin/shout.php');
|
show_confirmation(_('Shoutbox Post Deleted'),'',Config::get('web_path').'/admin/shout.php');
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Browse::set_type('shoutbox');
|
$browse = new Browse();
|
||||||
Browse::set_simple_browse(1);
|
$browse->set_type('shoutbox');
|
||||||
$shoutbox_ids = Browse::get_objects();
|
$browse->set_simple_browse(true);
|
||||||
Browse::show_objects($shoutbox_ids);
|
$shoutbox_ids = $browse->get_objects();
|
||||||
|
$browse->show_objects($shoutbox_ids);
|
||||||
|
$browse->store();
|
||||||
break;
|
break;
|
||||||
} // end switch on action
|
} // end switch on action
|
||||||
|
|
||||||
|
|
|
@ -193,12 +193,14 @@ switch ($_REQUEST['action']) {
|
||||||
require_once Config::get('prefix') . '/templates/show_user_preferences.inc.php';
|
require_once Config::get('prefix') . '/templates/show_user_preferences.inc.php';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Browse::reset_filters();
|
$browse = new Browse();
|
||||||
Browse::set_type('user');
|
$browse->reset_filters();
|
||||||
Browse::set_simple_browse(1);
|
$browse->set_type('user');
|
||||||
Browse::set_sort('name','ASC');
|
$browse->set_simple_browse(1);
|
||||||
$user_ids = Browse::get_objects();
|
$browse->set_sort('name','ASC');
|
||||||
Browse::show_objects($user_ids);
|
$user_ids = $browse->get_objects();
|
||||||
|
$browse->show_objects($user_ids);
|
||||||
|
$browse->store();
|
||||||
break;
|
break;
|
||||||
} // end switch on action
|
} // end switch on action
|
||||||
|
|
||||||
|
|
|
@ -173,7 +173,6 @@ switch ($_REQUEST['action']) {
|
||||||
case 'show':
|
case 'show':
|
||||||
$album = new Album($_REQUEST['album']);
|
$album = new Album($_REQUEST['album']);
|
||||||
$album->format();
|
$album->format();
|
||||||
Browse::reset_filters();
|
|
||||||
require Config::get('prefix') . '/templates/show_album.inc.php';
|
require Config::get('prefix') . '/templates/show_album.inc.php';
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -53,7 +53,9 @@ switch ($_REQUEST['action']) {
|
||||||
$name = $artist->name;
|
$name = $artist->name;
|
||||||
break;
|
break;
|
||||||
case 'browse':
|
case 'browse':
|
||||||
$media_ids = Browse::get_saved();
|
$id = scrub_in($_REQUEST['browse_id']);
|
||||||
|
$browse = new Browse($id);
|
||||||
|
$media_ids = $browse->get_saved();
|
||||||
$name = 'Batch-' . date("dmY",time());
|
$name = 'Batch-' . date("dmY",time());
|
||||||
default:
|
default:
|
||||||
// Rien a faire
|
// Rien a faire
|
||||||
|
|
51
browse.php
51
browse.php
|
@ -25,15 +25,17 @@
|
||||||
* Browse By Page
|
* Browse By Page
|
||||||
* This page shows the browse menu, which allows you to browse by many different
|
* This page shows the browse menu, which allows you to browse by many different
|
||||||
* fields including genre, artist, album, catalog, ???
|
* fields including genre, artist, album, catalog, ???
|
||||||
* this page also handles the actuall browse action
|
* This page also handles the actual browse action
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Base Require */
|
/* Base Require */
|
||||||
require_once 'lib/init.php';
|
require_once 'lib/init.php';
|
||||||
|
|
||||||
// This page is a little wonky we don't want the sidebar until we know what type we're dealing with
|
// This page is a little wonky we don't want the sidebar until we know what
|
||||||
// so we've got a little switch here that creates the type.. this feels hackish...
|
// type we're dealing with so we've got a little switch here that creates the
|
||||||
|
// type.. this feels hackish...
|
||||||
|
$browse = new Browse();
|
||||||
switch ($_REQUEST['action']) {
|
switch ($_REQUEST['action']) {
|
||||||
case 'tag':
|
case 'tag':
|
||||||
case 'file':
|
case 'file':
|
||||||
|
@ -43,9 +45,8 @@ switch ($_REQUEST['action']) {
|
||||||
case 'live_stream':
|
case 'live_stream':
|
||||||
case 'video':
|
case 'video':
|
||||||
case 'song':
|
case 'song':
|
||||||
Browse::set_type($_REQUEST['action']);
|
$browse->set_type($_REQUEST['action']);
|
||||||
Browse::reset();
|
$browse->set_simple_browse(true);
|
||||||
Browse::set_simple_browse(true);
|
|
||||||
break;
|
break;
|
||||||
} // end switch
|
} // end switch
|
||||||
|
|
||||||
|
@ -55,51 +56,53 @@ switch($_REQUEST['action']) {
|
||||||
case 'file':
|
case 'file':
|
||||||
break;
|
break;
|
||||||
case 'album':
|
case 'album':
|
||||||
Browse::set_sort('name','ASC');
|
$browse->set_sort('name','ASC');
|
||||||
Browse::show_objects();
|
$browse->show_objects();
|
||||||
break;
|
break;
|
||||||
case 'tag':
|
case 'tag':
|
||||||
Browse::set_sort('count','ASC');
|
$browse->set_sort('count','ASC');
|
||||||
// This one's a doozy
|
// This one's a doozy
|
||||||
Browse::set_simple_browse(0);
|
$browse->set_simple_browse(false);
|
||||||
Browse::save_objects(Tag::get_tags(Config::get('offset_limit'),array()));
|
$browse->save_objects(Tag::get_tags(Config::get('offset_limit'),array()));
|
||||||
$keys = array_keys(Browse::get_saved());
|
$object_ids = $browse->get_saved();
|
||||||
|
$keys = array_keys($object_ids);
|
||||||
Tag::build_cache($keys);
|
Tag::build_cache($keys);
|
||||||
$object_ids = Browse::get_saved();
|
|
||||||
show_box_top(_('Tag Cloud'),$class);
|
show_box_top(_('Tag Cloud'),$class);
|
||||||
require_once Config::get('prefix') . '/templates/show_tagcloud.inc.php';
|
require_once Config::get('prefix') . '/templates/show_tagcloud.inc.php';
|
||||||
show_box_bottom();
|
show_box_bottom();
|
||||||
require_once Config::get('prefix') . '/templates/browse_content.inc.php';
|
require_once Config::get('prefix') . '/templates/browse_content.inc.php';
|
||||||
break;
|
break;
|
||||||
case 'artist':
|
case 'artist':
|
||||||
Browse::set_sort('name','ASC');
|
$browse->set_sort('name','ASC');
|
||||||
Browse::show_objects();
|
$browse->show_objects();
|
||||||
break;
|
break;
|
||||||
case 'song':
|
case 'song':
|
||||||
Browse::set_sort('title','ASC');
|
$browse->set_sort('title','ASC');
|
||||||
Browse::show_objects();
|
$browse->show_objects();
|
||||||
break;
|
break;
|
||||||
case 'live_stream':
|
case 'live_stream':
|
||||||
Browse::set_sort('name','ASC');
|
$browse->set_sort('name','ASC');
|
||||||
Browse::show_objects();
|
$browse->show_objects();
|
||||||
break;
|
break;
|
||||||
case 'catalog':
|
case 'catalog':
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'playlist':
|
case 'playlist':
|
||||||
Browse::set_sort('type','ASC');
|
$browse->set_sort('type','ASC');
|
||||||
Browse::set_filter('playlist_type','1');
|
$browse->set_filter('playlist_type','1');
|
||||||
Browse::show_objects();
|
$browse->show_objects();
|
||||||
break;
|
break;
|
||||||
case 'video':
|
case 'video':
|
||||||
Browse::set_sort('title','ASC');
|
$browse->set_sort('title','ASC');
|
||||||
Browse::show_objects();
|
$browse->show_objects();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
||||||
break;
|
break;
|
||||||
} // end Switch $action
|
} // end Switch $action
|
||||||
|
|
||||||
|
$browse->store();
|
||||||
|
|
||||||
/* Show the Footer */
|
/* Show the Footer */
|
||||||
show_footer();
|
show_footer();
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -114,10 +114,11 @@ switch ($_REQUEST['action']) {
|
||||||
$objects = $democratic->get_items();
|
$objects = $democratic->get_items();
|
||||||
Song::build_cache($democratic->object_ids);
|
Song::build_cache($democratic->object_ids);
|
||||||
Democratic::build_vote_cache($democratic->vote_ids);
|
Democratic::build_vote_cache($democratic->vote_ids);
|
||||||
Browse::set_type('democratic');
|
$browse = new Browse();
|
||||||
Browse::reset();
|
$browse->set_type('democratic');
|
||||||
Browse::set_static_content(1);
|
$browse->set_static_content(true);
|
||||||
Browse::show_objects($objects);
|
$browse->show_objects($objects);
|
||||||
|
$browse->store();
|
||||||
break;
|
break;
|
||||||
} // end switch on action
|
} // end switch on action
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
--------------------------------------------------------------------------
|
--------------------------------------------------------------------------
|
||||||
v.3.6-Alpha1
|
v.3.6-Alpha1
|
||||||
|
- Changed Browse from a singleton to multiple instances
|
||||||
- Fixed setting access levels for plugin passwords
|
- Fixed setting access levels for plugin passwords
|
||||||
- Fixed handling of unusual characters in passwords
|
- Fixed handling of unusual characters in passwords
|
||||||
- Fixed support for requesting different thumbnail sizes
|
- Fixed support for requesting different thumbnail sizes
|
||||||
|
|
|
@ -22,13 +22,16 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API Class
|
* API Class
|
||||||
* This handles functions relating to the API written for ampache, initially this is very focused
|
* This handles functions relating to the API written for ampache, initially
|
||||||
* on providing functionality for Amarok so it can integrate with Ampache
|
* this is very focused on providing functionality for Amarok so it can
|
||||||
|
* integrate with Ampache.
|
||||||
*/
|
*/
|
||||||
class Api {
|
class Api {
|
||||||
|
|
||||||
public static $version = '350001';
|
public static $version = '350001';
|
||||||
|
|
||||||
|
private static $browse = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* constructor
|
* constructor
|
||||||
* This really isn't anything to do here, so it's private
|
* This really isn't anything to do here, so it's private
|
||||||
|
@ -39,6 +42,16 @@ class Api {
|
||||||
|
|
||||||
} // constructor
|
} // constructor
|
||||||
|
|
||||||
|
/**
|
||||||
|
* _auto_init
|
||||||
|
* Automatically called when this class is loaded.
|
||||||
|
*/
|
||||||
|
public static function _auto_init() {
|
||||||
|
if (is_null(self::$browse)) {
|
||||||
|
self::$browse = new Browse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set_filter
|
* set_filter
|
||||||
* This is a play on the browse function, it's different as we expose
|
* This is a play on the browse function, it's different as we expose
|
||||||
|
@ -55,29 +68,29 @@ class Api {
|
||||||
// Check for a range, if no range default to gt
|
// Check for a range, if no range default to gt
|
||||||
if (strpos($value,'/')) {
|
if (strpos($value,'/')) {
|
||||||
$elements = explode('/',$value);
|
$elements = explode('/',$value);
|
||||||
Browse::set_filter('add_lt',strtotime($elements['1']));
|
self::$browse->set_filter('add_lt',strtotime($elements['1']));
|
||||||
Browse::set_filter('add_gt',strtotime($elements['0']));
|
self::$browse->set_filter('add_gt',strtotime($elements['0']));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Browse::set_filter('add_gt',strtotime($value));
|
self::$browse->set_filter('add_gt',strtotime($value));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'update':
|
case 'update':
|
||||||
// Check for a range, if no range default to gt
|
// Check for a range, if no range default to gt
|
||||||
if (strpos($value,'/')) {
|
if (strpos($value,'/')) {
|
||||||
$elements = explode('/',$value);
|
$elements = explode('/',$value);
|
||||||
Browse::set_filter('update_lt',strtotime($elements['1']));
|
self::$browse->set_filter('update_lt',strtotime($elements['1']));
|
||||||
Browse::set_filter('update_gt',strtotime($elements['0']));
|
self::$browse->set_filter('update_gt',strtotime($elements['0']));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Browse::set_filter('update_gt',strtotime($value));
|
self::$browse->set_filter('update_gt',strtotime($value));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'alpha_match':
|
case 'alpha_match':
|
||||||
Browse::set_filter('alpha_match',$value);
|
self::$browse->set_filter('alpha_match',$value);
|
||||||
break;
|
break;
|
||||||
case 'exact_match':
|
case 'exact_match':
|
||||||
Browse::set_filter('exact_match',$value);
|
self::$browse->set_filter('exact_match',$value);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// Rien a faire
|
// Rien a faire
|
||||||
|
@ -242,9 +255,9 @@ class Api {
|
||||||
*/
|
*/
|
||||||
public static function artists($input) {
|
public static function artists($input) {
|
||||||
|
|
||||||
Browse::reset_filters();
|
self::$browse->reset_filters();
|
||||||
Browse::set_type('artist');
|
self::$browse->set_type('artist');
|
||||||
Browse::set_sort('name','ASC');
|
self::$browse->set_sort('name','ASC');
|
||||||
|
|
||||||
$method = $input['exact'] ? 'exact_match' : 'alpha_match';
|
$method = $input['exact'] ? 'exact_match' : 'alpha_match';
|
||||||
Api::set_filter($method,$input['filter']);
|
Api::set_filter($method,$input['filter']);
|
||||||
|
@ -255,7 +268,7 @@ class Api {
|
||||||
xmlData::set_offset($input['offset']);
|
xmlData::set_offset($input['offset']);
|
||||||
xmlData::set_limit($input['limit']);
|
xmlData::set_limit($input['limit']);
|
||||||
|
|
||||||
$artists = Browse::get_objects();
|
$artists = self::$browse->get_objects();
|
||||||
// echo out the resulting xml document
|
// echo out the resulting xml document
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
echo xmlData::artists($artists);
|
echo xmlData::artists($artists);
|
||||||
|
@ -315,15 +328,15 @@ class Api {
|
||||||
*/
|
*/
|
||||||
public static function albums($input) {
|
public static function albums($input) {
|
||||||
|
|
||||||
Browse::reset_filters();
|
self::$browse->reset_filters();
|
||||||
Browse::set_type('album');
|
self::$browse->set_type('album');
|
||||||
Browse::set_sort('name','ASC');
|
self::$browse->set_sort('name','ASC');
|
||||||
$method = $input['exact'] ? 'exact_match' : 'alpha_match';
|
$method = $input['exact'] ? 'exact_match' : 'alpha_match';
|
||||||
Api::set_filter($method,$input['filter']);
|
Api::set_filter($method,$input['filter']);
|
||||||
Api::set_filter('add',$input['add']);
|
Api::set_filter('add',$input['add']);
|
||||||
Api::set_filter('update',$input['update']);
|
Api::set_filter('update',$input['update']);
|
||||||
|
|
||||||
$albums = Browse::get_objects();
|
$albums = self::$browse->get_objects();
|
||||||
|
|
||||||
// Set the offset
|
// Set the offset
|
||||||
xmlData::set_offset($input['offset']);
|
xmlData::set_offset($input['offset']);
|
||||||
|
@ -368,13 +381,13 @@ class Api {
|
||||||
*/
|
*/
|
||||||
public static function tags($input) {
|
public static function tags($input) {
|
||||||
|
|
||||||
Browse::reset_filters();
|
self::$browse->reset_filters();
|
||||||
Browse::set_type('tag');
|
self::$browse->set_type('tag');
|
||||||
Browse::set_sort('name','ASC');
|
self::$browse->set_sort('name','ASC');
|
||||||
|
|
||||||
$method = $input['exact'] ? 'exact_match' : 'alpha_match';
|
$method = $input['exact'] ? 'exact_match' : 'alpha_match';
|
||||||
Api::set_filter($method,$input['filter']);
|
Api::set_filter($method,$input['filter']);
|
||||||
$tags = Browse::get_objects();
|
$tags = self::$browse->get_objects();
|
||||||
|
|
||||||
// Set the offset
|
// Set the offset
|
||||||
xmlData::set_offset($input['offset']);
|
xmlData::set_offset($input['offset']);
|
||||||
|
@ -451,16 +464,16 @@ class Api {
|
||||||
*/
|
*/
|
||||||
public static function songs($input) {
|
public static function songs($input) {
|
||||||
|
|
||||||
Browse::reset_filters();
|
self::$browse->reset_filters();
|
||||||
Browse::set_type('song');
|
self::$browse->set_type('song');
|
||||||
Browse::set_sort('title','ASC');
|
self::$browse->set_sort('title','ASC');
|
||||||
|
|
||||||
$method = $input['exact'] ? 'exact_match' : 'alpha_match';
|
$method = $input['exact'] ? 'exact_match' : 'alpha_match';
|
||||||
Api::set_filter($method,$input['filter']);
|
Api::set_filter($method,$input['filter']);
|
||||||
Api::set_filter('add',$input['add']);
|
Api::set_filter('add',$input['add']);
|
||||||
Api::set_filter('update',$input['update']);
|
Api::set_filter('update',$input['update']);
|
||||||
|
|
||||||
$songs = Browse::get_objects();
|
$songs = self::$browse->get_objects();
|
||||||
|
|
||||||
// Set the offset
|
// Set the offset
|
||||||
xmlData::set_offset($input['offset']);
|
xmlData::set_offset($input['offset']);
|
||||||
|
@ -506,14 +519,14 @@ class Api {
|
||||||
*/
|
*/
|
||||||
public static function playlists($input) {
|
public static function playlists($input) {
|
||||||
|
|
||||||
Browse::reset_filters();
|
self::$browse->reset_filters();
|
||||||
Browse::set_type('playlist');
|
self::$browse->set_type('playlist');
|
||||||
Browse::set_sort('name','ASC');
|
self::$browse->set_sort('name','ASC');
|
||||||
|
|
||||||
$method = $input['exact'] ? 'exact_match' : 'alpha_match';
|
$method = $input['exact'] ? 'exact_match' : 'alpha_match';
|
||||||
Api::set_filter($method,$input['filter']);
|
Api::set_filter($method,$input['filter']);
|
||||||
|
|
||||||
$playlist_ids = Browse::get_objects();
|
$playlist_ids = self::$browse->get_objects();
|
||||||
|
|
||||||
xmlData::set_offset($input['offset']);
|
xmlData::set_offset($input['offset']);
|
||||||
xmlData::set_limit($input['limit']);
|
xmlData::set_limit($input['limit']);
|
||||||
|
@ -586,14 +599,14 @@ class Api {
|
||||||
*/
|
*/
|
||||||
public static function videos($input) {
|
public static function videos($input) {
|
||||||
|
|
||||||
Browse::reset_filters();
|
self::$browse->reset_filters();
|
||||||
Browse::set_type('video');
|
self::$browse->set_type('video');
|
||||||
Browse::set_sort('title','ASC');
|
self::$browse->set_sort('title','ASC');
|
||||||
|
|
||||||
$method = $input['exact'] ? 'exact_match' : 'alpha_match';
|
$method = $input['exact'] ? 'exact_match' : 'alpha_match';
|
||||||
Api::set_filter($method,$input['filter']);
|
Api::set_filter($method,$input['filter']);
|
||||||
|
|
||||||
$video_ids = Browse::get_objects();
|
$video_ids = self::$browse->get_objects();
|
||||||
|
|
||||||
xmlData::set_offset($input['offset']);
|
xmlData::set_offset($input['offset']);
|
||||||
xmlData::set_limit($input['limit']);
|
xmlData::set_limit($input['limit']);
|
||||||
|
|
|
@ -36,6 +36,7 @@ class Art extends database_object {
|
||||||
public $thumb;
|
public $thumb;
|
||||||
public $thumb_mime;
|
public $thumb_mime;
|
||||||
|
|
||||||
|
private static $enabled;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
@ -49,6 +50,41 @@ class Art extends database_object {
|
||||||
|
|
||||||
} // constructor
|
} // constructor
|
||||||
|
|
||||||
|
/**
|
||||||
|
* _auto_init
|
||||||
|
* Called on creation of the class
|
||||||
|
*/
|
||||||
|
public static function _auto_init() {
|
||||||
|
self::$enabled = make_bool($_SESSION['art_enabled']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* is_enabled
|
||||||
|
* Checks whether the user currently wants art
|
||||||
|
*/
|
||||||
|
public static function is_enabled() {
|
||||||
|
if (self::$enabled || (Config::get('bandwidth') > 25)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* set_enabled
|
||||||
|
* Changes the value of enabled
|
||||||
|
*/
|
||||||
|
public static function set_enabled($value = null) {
|
||||||
|
if (is_null($value)) {
|
||||||
|
self::$enabled = self::$enabled ? false : true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
self::$enabled = make_bool($value);
|
||||||
|
}
|
||||||
|
|
||||||
|
$_SESSION['art_enabled'] = self::$enabled;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* validate_type
|
* validate_type
|
||||||
* This validates the type
|
* This validates the type
|
||||||
|
|
|
@ -29,40 +29,14 @@
|
||||||
*/
|
*/
|
||||||
class Browse extends Query {
|
class Browse extends Query {
|
||||||
|
|
||||||
// Public static vars that are cached
|
|
||||||
public static $sql;
|
|
||||||
public static $start;
|
|
||||||
public static $offset;
|
|
||||||
public static $total_objects;
|
|
||||||
public static $type;
|
|
||||||
|
|
||||||
// Boolean if this is a simple browse method (use different paging code)
|
|
||||||
public static $simple_browse;
|
|
||||||
|
|
||||||
// Static Content, this is defaulted to false, if set to true then when we can't
|
|
||||||
// apply any filters that would change the result set.
|
|
||||||
public static $static_content = false;
|
|
||||||
private static $_cache = array();
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* constructor
|
|
||||||
* This should never be called
|
|
||||||
*/
|
|
||||||
private function __construct() {
|
|
||||||
|
|
||||||
// Rien a faire
|
|
||||||
|
|
||||||
} // __construct
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set_simple_browse
|
* set_simple_browse
|
||||||
* This sets the current browse object to a 'simple' browse method
|
* This sets the current browse object to a 'simple' browse method
|
||||||
* which means use the base query provided and expand from there
|
* which means use the base query provided and expand from there
|
||||||
*/
|
*/
|
||||||
public static function set_simple_browse($value) {
|
public function set_simple_browse($value) {
|
||||||
|
|
||||||
parent::set_is_simple($value);
|
$this->set_is_simple($value);
|
||||||
|
|
||||||
} // set_simple_browse
|
} // set_simple_browse
|
||||||
|
|
||||||
|
@ -70,9 +44,9 @@ class Browse extends Query {
|
||||||
* add_supplemental_object
|
* add_supplemental_object
|
||||||
* Legacy function, need to find a better way to do that
|
* Legacy function, need to find a better way to do that
|
||||||
*/
|
*/
|
||||||
public static function add_supplemental_object($class,$uid) {
|
public function add_supplemental_object($class, $uid) {
|
||||||
|
|
||||||
$_SESSION['browse']['supplemental'][$class] = intval($uid);
|
$_SESSION['browse']['supplemental'][$this->id][$class] = intval($uid);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -80,12 +54,12 @@ class Browse extends Query {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get_supplemental_objects
|
* get_supplemental_objects
|
||||||
* This returns an array of 'class','id' for additional objects that need to be
|
* This returns an array of 'class','id' for additional objects that
|
||||||
* created before we start this whole browsing thing
|
* need to be created before we start this whole browsing thing.
|
||||||
*/
|
*/
|
||||||
public static function get_supplemental_objects() {
|
public function get_supplemental_objects() {
|
||||||
|
|
||||||
$objects = $_SESSION['browse']['supplemental'];
|
$objects = $_SESSION['browse']['supplemental'][$this->id];
|
||||||
|
|
||||||
if (!is_array($objects)) { $objects = array(); }
|
if (!is_array($objects)) { $objects = array(); }
|
||||||
|
|
||||||
|
@ -93,74 +67,58 @@ class Browse extends Query {
|
||||||
|
|
||||||
} // get_supplemental_objects
|
} // get_supplemental_objects
|
||||||
|
|
||||||
/**
|
|
||||||
* is_enabled
|
|
||||||
* This checks if the specified function/feature
|
|
||||||
* of browsing is enabled, not sure if this is the best
|
|
||||||
* way to go about it, but hey. Returns boolean t/f
|
|
||||||
*/
|
|
||||||
public static function is_enabled($item) {
|
|
||||||
|
|
||||||
switch ($item) {
|
|
||||||
case 'show_art':
|
|
||||||
if (Browse::get_filter('show_art')) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (Config::get('bandwidth') > 25) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
} // end switch
|
|
||||||
|
|
||||||
return false;
|
|
||||||
|
|
||||||
} // is_enabled
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* show_objects
|
* show_objects
|
||||||
* This takes an array of objects
|
* This takes an array of objects
|
||||||
* and requires the correct template based on the
|
* and requires the correct template based on the
|
||||||
* type that we are currently browsing
|
* type that we are currently browsing
|
||||||
*/
|
*/
|
||||||
public static function show_objects($object_ids=false) {
|
public function show_objects($object_ids = null) {
|
||||||
|
|
||||||
if (parent::is_simple()) {
|
if ($this->is_simple() || ! is_array($object_ids)) {
|
||||||
$object_ids = parent::get_saved();
|
$object_ids = $this->get_saved();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$object_ids = is_array($object_ids) ? $object_ids : parent::get_saved();
|
$this->save_objects($object_ids);
|
||||||
parent::save_objects($object_ids);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset the total items
|
// Limit is based on the user's preferences if this is not a
|
||||||
self::$total_objects = parent::get_total($object_ids);
|
// simple browse because we've got too much here
|
||||||
|
if ((count($object_ids) > $this->get_start()) &&
|
||||||
// Limit is based on the users preferences if this is not a simple browse because we've got too much here
|
! $this->is_simple() &&
|
||||||
if (count($object_ids) > parent::get_start() AND !parent::is_simple()) {
|
! $this->is_static_content()) {
|
||||||
$object_ids = array_slice($object_ids,parent::get_start(),parent::get_offset(),TRUE);
|
$object_ids = array_slice(
|
||||||
|
$object_ids,
|
||||||
|
$this->get_start(),
|
||||||
|
$this->get_offset(),
|
||||||
|
true
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load any additional object we need for this
|
// Load any additional object we need for this
|
||||||
$extra_objects = self::get_supplemental_objects();
|
$extra_objects = $this->get_supplemental_objects();
|
||||||
|
$browse = $this;
|
||||||
|
|
||||||
foreach ($extra_objects as $class_name => $id) {
|
foreach ($extra_objects as $class_name => $id) {
|
||||||
${$class_name} = new $class_name($id);
|
${$class_name} = new $class_name($id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Format any matches we have so we can show them to the masses
|
// Format any matches we have so we can show them to the masses
|
||||||
if ($filter_value = parent::get_filter('alpha_match')) {
|
if ($filter_value = $this->get_filter('alpha_match')) {
|
||||||
$match = ' (' . $filter_value . ')';
|
$match = ' (' . $filter_value . ')';
|
||||||
}
|
}
|
||||||
elseif ($filter_value = parent::get_filter('starts_with')) {
|
elseif ($filter_value = $this->get_filter('starts_with')) {
|
||||||
$match = ' (' . $filter_value . ')';
|
$match = ' (' . $filter_value . ')';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$type = $this->get_type();
|
||||||
|
|
||||||
// Set the correct classes based on type
|
// Set the correct classes based on type
|
||||||
$class = "box browse_".self::$type;
|
$class = "box browse_" . $type;
|
||||||
|
|
||||||
Ajax::start_container('browse_content');
|
Ajax::start_container('browse_content');
|
||||||
// Switch on the type of browsing we're doing
|
// Switch on the type of browsing we're doing
|
||||||
switch (parent::get_type()) {
|
switch ($type) {
|
||||||
case 'song':
|
case 'song':
|
||||||
show_box_top(_('Songs') . $match, $class);
|
show_box_top(_('Songs') . $match, $class);
|
||||||
Song::build_cache($object_ids);
|
Song::build_cache($object_ids);
|
||||||
|
@ -241,45 +199,34 @@ class Browse extends Query {
|
||||||
// Rien a faire
|
// Rien a faire
|
||||||
break;
|
break;
|
||||||
} // end switch on type
|
} // end switch on type
|
||||||
|
echo '<script type="text/javascript">ajaxPut("' . Config::get('ajax_url') . '?page=browse&action=get_filters&browse_id=' . $this->id . '","");</script>';
|
||||||
|
|
||||||
Ajax::end_container();
|
Ajax::end_container();
|
||||||
|
|
||||||
} // show_object
|
} // show_object
|
||||||
|
|
||||||
/**
|
|
||||||
* _auto_init
|
|
||||||
* this function reloads information back from the session
|
|
||||||
* it is called on creation of the class
|
|
||||||
*/
|
|
||||||
public static function _auto_init() {
|
|
||||||
|
|
||||||
$offset = Config::get('offset_limit') ? Config::get('offset_limit') : '25';
|
|
||||||
parent::set_offset($offset);
|
|
||||||
|
|
||||||
} // _auto_init
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* set_filter_from_request
|
* set_filter_from_request
|
||||||
* //FIXME
|
* //FIXME
|
||||||
*/
|
*/
|
||||||
public static function set_filter_from_request($r) {
|
public function set_filter_from_request($request) {
|
||||||
foreach($r as $k=>$v) {
|
foreach($request as $key => $value) {
|
||||||
//reinterpret v as a list of int
|
//reinterpret v as a list of int
|
||||||
$vl = explode(',', $v);
|
$list = explode(',', $value);
|
||||||
$ok = 1;
|
$ok = true;
|
||||||
foreach($vl as $i) {
|
foreach($list as $item) {
|
||||||
if (!is_numeric($i)) {
|
if (!is_numeric($item)) {
|
||||||
$ok = 0;
|
$ok = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($ok) {
|
if ($ok) {
|
||||||
if (sizeof($vl) == 1) {
|
if (sizeof($list) == 1) {
|
||||||
self::set_filter($k, $vl[0]);
|
$this->set_filter($key, $list[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
self::set_filter($k, $vl);
|
$this->set_filter($key, $list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // set_filter_from_request
|
} // set_filter_from_request
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -344,6 +344,9 @@ class Update {
|
||||||
$update_string = '- Add uniqueness constraint to ratings.<br />';
|
$update_string = '- Add uniqueness constraint to ratings.<br />';
|
||||||
$version[] = array('version' => '360004','description' => $update_string);
|
$version[] = array('version' => '360004','description' => $update_string);
|
||||||
|
|
||||||
|
$update_string = '- Modify tmp_browse to allow caching of multiple browses per session.<br />';
|
||||||
|
$version[] = array('version' => '360005','description' => $update_string);
|
||||||
|
|
||||||
return $version;
|
return $version;
|
||||||
|
|
||||||
} // populate_version
|
} // populate_version
|
||||||
|
@ -1929,5 +1932,25 @@ class Update {
|
||||||
self::set_version('db_version','360004');
|
self::set_version('db_version','360004');
|
||||||
} // update_360004
|
} // update_360004
|
||||||
|
|
||||||
|
/**
|
||||||
|
* update_360005
|
||||||
|
* This changes the tmp_browse table around.
|
||||||
|
*/
|
||||||
|
public static function update_360005() {
|
||||||
|
$sql = "DROP TABLE `tmp_browse`";
|
||||||
|
$db_results = Dba::write($sql);
|
||||||
|
|
||||||
|
$sql = "CREATE TABLE `tmp_browse` (" .
|
||||||
|
"`id` int(13) NOT NULL auto_increment," .
|
||||||
|
"`sid` varchar(128) character set utf8 NOT NULL default ''," .
|
||||||
|
"`data` longtext collate utf8_unicode_ci NOT NULL," .
|
||||||
|
"`object_data` longtext collate utf8_unicode_ci," .
|
||||||
|
"PRIMARY KEY (`sid`,`id`)" .
|
||||||
|
") ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
|
||||||
|
$db_results = Dba::write($sql);
|
||||||
|
|
||||||
|
self::set_version('db_version','360005');
|
||||||
|
} // update_360005
|
||||||
|
|
||||||
} // end update class
|
} // end update class
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -82,9 +82,11 @@ switch ($_REQUEST['action']) {
|
||||||
// Pull the current playlist and require the template
|
// Pull the current playlist and require the template
|
||||||
$objects = $localplay->get();
|
$objects = $localplay->get();
|
||||||
require_once Config::get('prefix') . '/templates/show_localplay_status.inc.php';
|
require_once Config::get('prefix') . '/templates/show_localplay_status.inc.php';
|
||||||
Browse::set_type('playlist_localplay');
|
$browse = new Browse();
|
||||||
Browse::set_static_content(1);
|
$browse->set_type('playlist_localplay');
|
||||||
Browse::show_objects($objects);
|
$browse->set_static_content(true);
|
||||||
|
$browse->show_objects($objects);
|
||||||
|
$browse->store();
|
||||||
break;
|
break;
|
||||||
} // end switch action
|
} // end switch action
|
||||||
|
|
||||||
|
|
|
@ -41,12 +41,13 @@ switch ($_REQUEST['action']) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 'search':
|
case 'search':
|
||||||
|
$browse = new Browse();
|
||||||
require_once Config::get('prefix') . '/templates/show_search.inc.php';
|
require_once Config::get('prefix') . '/templates/show_search.inc.php';
|
||||||
require_once Config::get('prefix') . '/templates/show_search_options.inc.php';
|
require_once Config::get('prefix') . '/templates/show_search_options.inc.php';
|
||||||
$results = run_search($_REQUEST);
|
$results = run_search($_REQUEST);
|
||||||
Browse::set_type('song');
|
$browse->set_type('song');
|
||||||
Browse::reset();
|
$browse->show_objects($results);
|
||||||
Browse::show_objects($results);
|
$browse->store();
|
||||||
break;
|
break;
|
||||||
case 'save_as_track':
|
case 'save_as_track':
|
||||||
$playlist_id = save_search($_REQUEST);
|
$playlist_id = save_search($_REQUEST);
|
||||||
|
|
|
@ -268,8 +268,8 @@ switch ($_REQUEST['action']) {
|
||||||
} // end foreach
|
} // end foreach
|
||||||
break;
|
break;
|
||||||
case 'browse_set':
|
case 'browse_set':
|
||||||
Browse::set_type($_REQUEST['object_type']);
|
$browse = new Browse($_REQUEST['browse_id']);
|
||||||
$objects = Browse::get_saved();
|
$objects = $browse->get_saved();
|
||||||
foreach ($objects as $object_id) {
|
foreach ($objects as $object_id) {
|
||||||
$GLOBALS['user']->playlist->add_object($object_id,'song');
|
$GLOBALS['user']->playlist->add_object($object_id,'song');
|
||||||
}
|
}
|
||||||
|
@ -341,25 +341,6 @@ switch ($_REQUEST['action']) {
|
||||||
$results[$key] = ob_get_contents();
|
$results[$key] = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
break;
|
break;
|
||||||
// Used to change filter/settings on browse
|
|
||||||
case 'browse':
|
|
||||||
if ($_REQUEST['key'] && $_REQUEST['value']) {
|
|
||||||
// Set any new filters we've just added
|
|
||||||
Browse::set_filter($_REQUEST['key'],$_REQUEST['value']);
|
|
||||||
}
|
|
||||||
if ($_REQUEST['sort']) {
|
|
||||||
// Set the new sort value
|
|
||||||
Browse::set_sort($_REQUEST['sort']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Refresh the browse div with our new filter options
|
|
||||||
$object_ids = Browse::get_objects();
|
|
||||||
|
|
||||||
ob_start();
|
|
||||||
Browse::show_objects($object_ids, true);
|
|
||||||
$results['browse_content'] = ob_get_contents();
|
|
||||||
ob_end_clean();
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
$results['rfc3514'] = '0x1';
|
$results['rfc3514'] = '0x1';
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -25,44 +25,48 @@
|
||||||
*/
|
*/
|
||||||
if (AJAX_INCLUDE != '1') { exit; }
|
if (AJAX_INCLUDE != '1') { exit; }
|
||||||
|
|
||||||
|
if (isset($_REQUEST['browse_id'])) {
|
||||||
|
$browse_id = $_REQUEST['browse_id'];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$browse_id = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$browse = new Browse($browse_id);
|
||||||
|
|
||||||
switch ($_REQUEST['action']) {
|
switch ($_REQUEST['action']) {
|
||||||
case 'browse':
|
case 'browse':
|
||||||
|
|
||||||
$object_ids = array();
|
$object_ids = array();
|
||||||
|
|
||||||
Browse::set_type($_REQUEST['type']);
|
|
||||||
|
|
||||||
// Check 'value' with isset because it can null
|
// Check 'value' with isset because it can null
|
||||||
//(user type a "start with" word and deletes it)
|
//(user type a "start with" word and deletes it)
|
||||||
if ($_REQUEST['key'] && (isset($_REQUEST['multi_alpha_filter']) OR isset($_REQUEST['value']))) {
|
if ($_REQUEST['key'] && (isset($_REQUEST['multi_alpha_filter']) OR isset($_REQUEST['value']))) {
|
||||||
// Set any new filters we've just added
|
// Set any new filters we've just added
|
||||||
Browse::set_filter($_REQUEST['key'],$_REQUEST['multi_alpha_filter']);
|
$browse->set_filter($_REQUEST['key'],$_REQUEST['multi_alpha_filter']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_REQUEST['sort']) {
|
if ($_REQUEST['sort']) {
|
||||||
// Set the new sort value
|
// Set the new sort value
|
||||||
Browse::set_sort($_REQUEST['sort']);
|
$browse->set_sort($_REQUEST['sort']);
|
||||||
}
|
}
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
Browse::show_objects(false);
|
$browse->show_objects();
|
||||||
$results['browse_content'] = ob_get_clean();
|
$results['browse_content'] = ob_get_clean();
|
||||||
break;
|
break;
|
||||||
case 'set_sort':
|
case 'set_sort':
|
||||||
|
|
||||||
Browse::set_type($_REQUEST['type']);
|
|
||||||
|
|
||||||
if ($_REQUEST['sort']) {
|
if ($_REQUEST['sort']) {
|
||||||
Browse::set_sort($_REQUEST['sort']);
|
$browse->set_sort($_REQUEST['sort']);
|
||||||
}
|
}
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
Browse::show_objects(false);
|
$browse->show_objects();
|
||||||
$results['browse_content'] = ob_get_clean();
|
$results['browse_content'] = ob_get_clean();
|
||||||
break;
|
break;
|
||||||
case 'toggle_tag':
|
case 'toggle_tag':
|
||||||
$type = $_SESSION['tagcloud_type'] ? $_SESSION['tagcloud_type'] : 'song';
|
$type = $_SESSION['tagcloud_type'] ? $_SESSION['tagcloud_type'] : 'song';
|
||||||
Browse::set_type($type);
|
$browse->set_type($type);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -94,19 +98,30 @@ switch ($_REQUEST['action']) {
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'page':
|
case 'page':
|
||||||
Browse::set_type($_REQUEST['type']);
|
$browse->set_start($_REQUEST['start']);
|
||||||
Browse::set_start($_REQUEST['start']);
|
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
Browse::show_objects();
|
$browse->show_objects();
|
||||||
$results['browse_content'] = ob_get_clean();
|
$results['browse_content'] = ob_get_clean();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
case 'show_art':
|
||||||
|
Art::set_enabled();
|
||||||
|
|
||||||
|
ob_start();
|
||||||
|
$browse->show_objects();
|
||||||
|
$results['browse_content'] = ob_get_clean();
|
||||||
|
break;
|
||||||
|
case 'get_filters':
|
||||||
|
ob_start();
|
||||||
|
require_once Config::get('prefix') . '/templates/browse_filters.inc.php';
|
||||||
|
$results['browse_filters'] = ob_get_clean();
|
||||||
default:
|
default:
|
||||||
$results['rfc3514'] = '0x1';
|
$results['rfc3514'] = '0x1';
|
||||||
break;
|
break;
|
||||||
} // switch on action;
|
} // switch on action;
|
||||||
|
|
||||||
|
$browse->store();
|
||||||
|
|
||||||
// We always do this
|
// We always do this
|
||||||
echo xml_from_array($results);
|
echo xml_from_array($results);
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -25,63 +25,30 @@
|
||||||
*/
|
*/
|
||||||
if (AJAX_INCLUDE != '1') { exit; }
|
if (AJAX_INCLUDE != '1') { exit; }
|
||||||
|
|
||||||
|
$democratic = Democratic::get_current_playlist();
|
||||||
|
$democratic->set_parent();
|
||||||
|
|
||||||
switch ($_REQUEST['action']) {
|
switch ($_REQUEST['action']) {
|
||||||
case 'delete_vote':
|
case 'delete_vote':
|
||||||
$democratic = Democratic::get_current_playlist();
|
|
||||||
$democratic->set_parent();
|
|
||||||
$democratic->remove_vote($_REQUEST['row_id']);
|
$democratic->remove_vote($_REQUEST['row_id']);
|
||||||
|
$show_browse = true;
|
||||||
ob_start();
|
|
||||||
$object_ids = $democratic->get_items();
|
|
||||||
Browse::set_type('democratic');
|
|
||||||
Browse::reset();
|
|
||||||
Browse::set_static_content(1);
|
|
||||||
Browse::show_objects($object_ids);
|
|
||||||
|
|
||||||
require_once Config::get('prefix') . '/templates/show_democratic_playlist.inc.php';
|
|
||||||
$results['browse_content'] = ob_get_contents();
|
|
||||||
ob_end_clean();
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'add_vote':
|
case 'add_vote':
|
||||||
|
|
||||||
$democratic = Democratic::get_current_playlist();
|
|
||||||
$democratic->set_parent();
|
|
||||||
$democratic->add_vote($_REQUEST['object_id'],$_REQUEST['type']);
|
$democratic->add_vote($_REQUEST['object_id'],$_REQUEST['type']);
|
||||||
|
$show_browse = true;
|
||||||
ob_start();
|
|
||||||
$object_ids = $democratic->get_items();
|
|
||||||
Browse::set_type('democratic');
|
|
||||||
Browse::reset();
|
|
||||||
Browse::set_static_content(1);
|
|
||||||
Browse::show_objects($object_ids);
|
|
||||||
|
|
||||||
require_once Config::get('prefix') . '/templates/show_democratic_playlist.inc.php';
|
|
||||||
$results['browse_content'] = ob_get_contents();
|
|
||||||
ob_end_clean();
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'delete':
|
case 'delete':
|
||||||
if (!$GLOBALS['user']->has_access('75')) {
|
if (!$GLOBALS['user']->has_access('75')) {
|
||||||
|
echo xml_from_array(array('rfc3514' => '0x1'));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$democratic = Democratic::get_current_playlist();
|
|
||||||
$democratic->set_parent();
|
|
||||||
$democratic->delete_votes($_REQUEST['row_id']);
|
$democratic->delete_votes($_REQUEST['row_id']);
|
||||||
|
$show_browse = true;
|
||||||
ob_start();
|
|
||||||
$object_ids = $democratic->get_items();
|
|
||||||
Browse::set_type('democratic');
|
|
||||||
Browse::reset();
|
|
||||||
Browse::set_static_content(1);
|
|
||||||
Browse::show_objects($object_ids);
|
|
||||||
$results['browse_content'] = ob_get_contents();
|
|
||||||
ob_end_clean();
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'send_playlist':
|
case 'send_playlist':
|
||||||
if (!Access::check('interface','75')) {
|
if (!Access::check('interface','75')) {
|
||||||
|
echo xml_from_array(array('rfc3514' => '0x1'));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,8 +56,8 @@ switch ($_REQUEST['action']) {
|
||||||
$results['rfc3514'] = '<script type="text/javascript">reload_util("'.$_SESSION['iframe']['target'].'")</script>';
|
$results['rfc3514'] = '<script type="text/javascript">reload_util("'.$_SESSION['iframe']['target'].'")</script>';
|
||||||
break;
|
break;
|
||||||
case 'clear_playlist':
|
case 'clear_playlist':
|
||||||
|
|
||||||
if (!Access::check('interface','100')) {
|
if (!Access::check('interface','100')) {
|
||||||
|
echo xml_from_array(array('rfc3514' => '0x1'));
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,21 +65,25 @@ switch ($_REQUEST['action']) {
|
||||||
$democratic->set_parent();
|
$democratic->set_parent();
|
||||||
$democratic->clear();
|
$democratic->clear();
|
||||||
|
|
||||||
ob_start();
|
$show_browse = true;
|
||||||
$object_ids = array();
|
|
||||||
Browse::set_type('democratic');
|
|
||||||
Browse::reset();
|
|
||||||
Browse::set_static_content(1);
|
|
||||||
Browse::show_objects($object_ids);
|
|
||||||
$results['browse_content'] = ob_get_contents();
|
|
||||||
ob_end_clean();
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$results['rfc3514'] = '0x1';
|
$results['rfc3514'] = '0x1';
|
||||||
break;
|
break;
|
||||||
} // switch on action;
|
} // switch on action;
|
||||||
|
|
||||||
|
if ($show_browse) {
|
||||||
|
ob_start();
|
||||||
|
$object_ids = $democratic->get_items();
|
||||||
|
$browse = new Browse();
|
||||||
|
$browse->set_type('democratic');
|
||||||
|
$browse->set_static_content(true);
|
||||||
|
$browse->show_objects($object_ids);
|
||||||
|
$browse->store();
|
||||||
|
$results['browse_content'] = ob_get_contents();
|
||||||
|
ob_end_clean();
|
||||||
|
}
|
||||||
|
|
||||||
// We always do this
|
// We always do this
|
||||||
echo xml_from_array($results);
|
echo xml_from_array($results);
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -38,10 +38,12 @@ switch ($_REQUEST['action']) {
|
||||||
|
|
||||||
$flagged = Flag::get_all();
|
$flagged = Flag::get_all();
|
||||||
ob_start();
|
ob_start();
|
||||||
Browse::set_type('flagged');
|
$browse = new Browse();
|
||||||
Browse::set_static_content(1);
|
$browse->set_type('flagged');
|
||||||
Browse::save_objects($flagged);
|
$browse->set_static_content(true);
|
||||||
Browse::show_objects($flagged);
|
$browse->save_objects($flagged);
|
||||||
|
$browse->show_objects($flagged);
|
||||||
|
$browse->store();
|
||||||
$results['browse_content'] = ob_get_contents();
|
$results['browse_content'] = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
|
|
||||||
|
|
|
@ -79,9 +79,13 @@ switch ($_REQUEST['action']) {
|
||||||
break;
|
break;
|
||||||
case 'delete_all':
|
case 'delete_all':
|
||||||
$localplay->delete_all();
|
$localplay->delete_all();
|
||||||
Browse::save_objects(array());
|
|
||||||
ob_start();
|
ob_start();
|
||||||
Browse::show_objects();
|
$browse = new Browse();
|
||||||
|
$browse->set_type('playlist_localplay');
|
||||||
|
$browse->set_static_content(true);
|
||||||
|
$browse->save_objects(array());
|
||||||
|
$browse->show_objects(array());
|
||||||
|
$browse->store();
|
||||||
$results['browse_content'] = ob_get_contents();
|
$results['browse_content'] = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
break;
|
break;
|
||||||
|
@ -89,9 +93,12 @@ switch ($_REQUEST['action']) {
|
||||||
$localplay->skip(intval($_REQUEST['id']));
|
$localplay->skip(intval($_REQUEST['id']));
|
||||||
$objects = $localplay->get();
|
$objects = $localplay->get();
|
||||||
ob_start();
|
ob_start();
|
||||||
Browse::set_type('playlist_localplay');
|
$browse = new Browse();
|
||||||
Browse::set_static_content(1);
|
$browse->set_type('playlist_localplay');
|
||||||
Browse::show_objects($objects);
|
$browse->set_static_content(true);
|
||||||
|
$browse->save_objects($objects);
|
||||||
|
$browse->show_objects($objects);
|
||||||
|
$browse->store();
|
||||||
$results['browse_content'] = ob_get_contents();
|
$results['browse_content'] = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
break;
|
break;
|
||||||
|
@ -121,9 +128,12 @@ switch ($_REQUEST['action']) {
|
||||||
$status = $localplay->status();
|
$status = $localplay->status();
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
Browse::set_type('playlist_localplay');
|
$browse = new Browse();
|
||||||
Browse::set_static_content(1);
|
$browse->set_type('playlist_localplay');
|
||||||
Browse::show_objects($objects);
|
$browse->set_static_content(true);
|
||||||
|
$browse->save_objects($objects);
|
||||||
|
$browse->show_objects($objects);
|
||||||
|
$browse->store();
|
||||||
$results['browse_content'] = ob_get_contents();
|
$results['browse_content'] = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
|
|
||||||
|
|
|
@ -36,10 +36,12 @@ switch ($_REQUEST['action']) {
|
||||||
|
|
||||||
$object_ids = $playlist->get_items();
|
$object_ids = $playlist->get_items();
|
||||||
ob_start();
|
ob_start();
|
||||||
Browse::set_type('playlist_song');
|
$browse = new Browse();
|
||||||
Browse::add_supplemental_object('playlist',$playlist->id);
|
$browse->set_type('playlist_song');
|
||||||
Browse::save_objects($object_ids);
|
$browse->add_supplemental_object('playlist',$playlist->id);
|
||||||
Browse::show_objects($object_ids);
|
$browse->save_objects($object_ids);
|
||||||
|
$browse->show_objects($object_ids);
|
||||||
|
$browse->store();
|
||||||
$results['browse_content'] = ob_get_clean();
|
$results['browse_content'] = ob_get_clean();
|
||||||
break;
|
break;
|
||||||
case 'edit_track':
|
case 'edit_track':
|
||||||
|
|
|
@ -75,10 +75,11 @@ switch ($_REQUEST['action']) {
|
||||||
$results['rightbar'] = ajax_include('rightbar.inc.php');
|
$results['rightbar'] = ajax_include('rightbar.inc.php');
|
||||||
|
|
||||||
// Now setup the browse and show them below!
|
// Now setup the browse and show them below!
|
||||||
Browse::set_type('song');
|
$browse = new Browse();
|
||||||
Browse::save_objects($object_ids);
|
$browse->set_type('song');
|
||||||
|
$browse->save_objects($object_ids);
|
||||||
ob_start();
|
ob_start();
|
||||||
Browse::show_objects();
|
$browse->show_objects();
|
||||||
$results['browse'] = ob_get_contents();
|
$results['browse'] = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
|
|
||||||
|
|
|
@ -37,20 +37,19 @@ switch ($_REQUEST['action']) {
|
||||||
$tag->remove_map($_GET['type'],$_GET['object_id']);
|
$tag->remove_map($_GET['type'],$_GET['object_id']);
|
||||||
break;
|
break;
|
||||||
case 'browse_type':
|
case 'browse_type':
|
||||||
Browse::set_type('tag');
|
$browse = new Browse($_GET['browse_id']);
|
||||||
Browse::set_filter('object_type',$_GET['type']);
|
$browse->set_filter('object_type', $_GET['type']);
|
||||||
|
$browse->store();
|
||||||
break;
|
break;
|
||||||
case 'add_filter':
|
case 'add_filter':
|
||||||
|
$browse = new Browse($_GET['browse_id']);
|
||||||
// Set browse method
|
$browse->set_filter('tag', $_GET['tag_id']);
|
||||||
Browse::set_type('song');
|
$object_ids = $browse->get_objects();
|
||||||
Browse::set_filter('tag',$_GET['tag_id']);
|
|
||||||
$object_ids = Browse::get_objects();
|
|
||||||
ob_start();
|
ob_start();
|
||||||
Browse::show_objects($object_ids);
|
$browse->show_objects($object_ids);
|
||||||
$results['browse_content'] = ob_get_clean();
|
$results['browse_content'] = ob_get_clean();
|
||||||
|
$browse->store();
|
||||||
// Retrive current objects of type based on combined filters
|
// Retrieve current objects of type based on combined filters
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$results['rfc3514'] = '0x1';
|
$results['rfc3514'] = '0x1';
|
||||||
|
|
70
templates/browse_filters.inc.php
Normal file
70
templates/browse_filters.inc.php
Normal file
|
@ -0,0 +1,70 @@
|
||||||
|
<?php
|
||||||
|
/* vim:set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab: */
|
||||||
|
/*
|
||||||
|
|
||||||
|
Copyright (c) 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.
|
||||||
|
|
||||||
|
*/
|
||||||
|
$ajax_info = Config::get('ajax_url'); $web_path = Config::get('web_path');
|
||||||
|
?>
|
||||||
|
<?php $allowed_filters = Browse::get_allowed_filters($browse->get_type()); ?>
|
||||||
|
<li><h4><?php echo _('Filters'); ?></h4>
|
||||||
|
<div class="sb3">
|
||||||
|
<?php if (in_array('starts_with',$allowed_filters)) { ?>
|
||||||
|
<form id="multi_alpha_filter_form" method="post" action="javascript:void(0);">
|
||||||
|
<label id="multi_alpha_filterLabel" for="multi_alpha_filter"><?php echo _('Starts With'); ?></label>
|
||||||
|
<input type="text" id="multi_alpha_filter" name="multi_alpha_filter" value="<?php echo scrub_out($browse->get_filter('starts_with')); ?>" onKeyUp="DelayRun(this, '400', 'ajaxState', '<?php echo $ajax_info; ?>?page=browse&action=browse&browse_id=<?php echo $browse->id; ?>&key=starts_with', 'multi_alpha_filter');">
|
||||||
|
</form>
|
||||||
|
<?php } // end if alpha_match ?>
|
||||||
|
<?php if (in_array('minimum_count',$allowed_filters)) { ?>
|
||||||
|
<input id="mincountCB" type="checkbox" value="1" />
|
||||||
|
<label id="mincountLabel" for="mincountCB"><?php echo _('Minimum Count'); ?></label><br />
|
||||||
|
<?php echo Ajax::observe('mincountCB', 'click', Ajax::action('?page=browse&action=browse&browse_id=' . $browse->id . '&key=min_count&value=1', '')); ?>
|
||||||
|
<?php } ?>
|
||||||
|
<?php if (in_array('rated',$allowed_filters)) { ?>
|
||||||
|
<input id="ratedCB" type="checkbox" value="1" />
|
||||||
|
<label id="ratedLabel" for="ratedCB"><?php echo _('Rated'); ?></label><br />
|
||||||
|
<?php echo Ajax::observe('ratedCB', 'click', Ajax::action('?page=browse&action=browse&browse_id=' . $browse->id . '&key=rated&value=1', '')); ?>
|
||||||
|
<?php } ?>
|
||||||
|
<?php if (in_array('unplayed',$allowed_filters)) { ?>
|
||||||
|
<input id="unplayedCB" type="checkbox" <?php echo $string = $browse->get_filter('unplayed') ? 'checked="checked"' : ''; ?>/>
|
||||||
|
<label id="unplayedLabel" for="unplayedCB"><?php echo _('Unplayed'); ?></label><br />
|
||||||
|
<?php } ?>
|
||||||
|
<?php if (in_array('show_art',$allowed_filters)) { ?>
|
||||||
|
<input id="show_artCB" type="checkbox" <?php echo $string = $browse->get_filter('show_art') ? 'checked="checked"' : ''; ?>/>
|
||||||
|
<label id="show_artLabel" for="show_artCB"><?php echo _('Show Art'); ?></label><br />
|
||||||
|
<?php echo Ajax::observe('show_artCB','click',Ajax::action('?page=browse&action=show_art&browse_id=' . $browse->id, '')); ?>
|
||||||
|
<?php } // if show_art ?>
|
||||||
|
<?php if (in_array('playlist_type',$allowed_filters)) { ?>
|
||||||
|
<input id="show_allplCB" type="checkbox" <?php echo $string = $browse->get_filter('playlist_type') ? 'checked="checked"' : ''; ?>/>
|
||||||
|
<label id="show_allplLabel" for="showallplCB"><?php echo _('All Playlists'); ?></label><br />
|
||||||
|
<?php echo Ajax::observe('show_allplCB','click',Ajax::action('?page=browse&action=browse&browse_id=' . $browse->id . '&key=playlist_type&value=1','')); ?>
|
||||||
|
<?php } // if playlist_type ?>
|
||||||
|
<?php if (in_array('object_type',$allowed_filters)) { ?>
|
||||||
|
<?php $string = 'otype_' . $browse->get_filter('object_type'); ${$string} = 'selected="selected"'; ?>
|
||||||
|
<input id="typeSongRadio" type="radio" name="object_type" value="1" <?php echo $otype_song; ?>/>
|
||||||
|
<label id="typeSongLabel" for="typeSongRadio"><?php echo _('Song Title'); ?></label><br />
|
||||||
|
<?php echo Ajax::observe('typeSongRadio','click',Ajax::action('?page=tag&action=browse_type&browse_id=' . $browse->id . '&type=song','')); ?>
|
||||||
|
<input id="typeAlbumRadio" type="radio" name="object_type" value="1" />
|
||||||
|
<label id="typeAlbumLabel" for="typeAlbumRadio"><?php echo _('Albums'); ?></label><br />
|
||||||
|
<?php echo Ajax::observe('typeAlbumRadio','click',Ajax::action('?page=tag&action=browse_type&browse_id=' . $browse->id . '&type=album','')); ?>
|
||||||
|
<input id="typeArtistRadio" type="radio" name="object_type" value="1" />
|
||||||
|
<label id="typeArtistLabel" for="typeArtistRadio"><?php echo _('Artist'); ?></label><br />
|
||||||
|
<?php echo Ajax::observe('typeArtistRadio','click',Ajax::action('?page=tag&action=browse_type&browse_id=' . $browse->id . '&type=artist','')); ?>
|
||||||
|
<?php } ?>
|
||||||
|
</div>
|
||||||
|
</li>
|
|
@ -28,9 +28,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Pull these variables out to allow shorthand (easier for lazy programmers)
|
// Pull these variables out to allow shorthand (easier for lazy programmers)
|
||||||
$limit = Config::get('offset_limit') ? Config::get('offset_limit') : '25';
|
$limit = $browse->get_offset();
|
||||||
$start = Browse::get_start();
|
$start = $browse->get_start();
|
||||||
$total = Browse::$total_objects;
|
$total = $browse->get_total();
|
||||||
$uid = Config::get('list_header_uid');
|
$uid = Config::get('list_header_uid');
|
||||||
$sides = 5;
|
$sides = 5;
|
||||||
|
|
||||||
|
@ -91,15 +91,14 @@ while ($page <= $pages) {
|
||||||
// Sort These Arrays of Hotness
|
// Sort These Arrays of Hotness
|
||||||
ksort($page_data['up']);
|
ksort($page_data['up']);
|
||||||
ksort($page_data['down']);
|
ksort($page_data['down']);
|
||||||
$browse_type = Browse::get_type();
|
|
||||||
|
|
||||||
// are there enough items to even need this view?
|
// are there enough items to even need this view?
|
||||||
if ($pages > 1) {
|
if ($pages > 1) {
|
||||||
?>
|
?>
|
||||||
<div class="list-header">
|
<div class="list-header">
|
||||||
|
|
||||||
<?php echo Ajax::text('?page=browse&action=page&type=' . $browse_type . '&start=' . $prev_offset,_('Prev'),'browse_' . $uid . 'prev','','prev'); ?>
|
<?php echo Ajax::text('?page=browse&action=page&browse_id=' . $browse->id . '&start=' . $prev_offset,_('Prev'),'browse_' . $uid . 'prev','','prev'); ?>
|
||||||
<?php echo Ajax::text('?page=browse&action=page&type=' . $browse_type . '&start=' . $next_offset,_('Next'),'browse_' . $uid . 'next','','next'); ?>
|
<?php echo Ajax::text('?page=browse&action=page&browse_id=' . $browse->id . '&start=' . $next_offset,_('Next'),'browse_' . $uid . 'next','','next'); ?>
|
||||||
<?php
|
<?php
|
||||||
/* Echo Everything below us */
|
/* Echo Everything below us */
|
||||||
foreach ($page_data['down'] as $page => $offset) {
|
foreach ($page_data['down'] as $page => $offset) {
|
||||||
|
@ -107,7 +106,7 @@ if ($pages > 1) {
|
||||||
else {
|
else {
|
||||||
// Hack Alert
|
// Hack Alert
|
||||||
$page++;
|
$page++;
|
||||||
echo Ajax::text('?page=browse&action=page&type=' . $browse_type .'&start=' . $offset,$page,'browse_' . $uid . 'page_' . $page,'','page-nb');
|
echo Ajax::text('?page=browse&action=page&browse_id=' . $browse->id . '&start=' . $offset,$page,'browse_' . $uid . 'page_' . $page,'','page-nb');
|
||||||
}
|
}
|
||||||
} // end foreach down
|
} // end foreach down
|
||||||
|
|
||||||
|
@ -121,7 +120,7 @@ if ($pages > 1) {
|
||||||
foreach ($page_data['up'] as $page=>$offset) {
|
foreach ($page_data['up'] as $page=>$offset) {
|
||||||
if ($offset === '...') { echo '... '; }
|
if ($offset === '...') { echo '... '; }
|
||||||
else {
|
else {
|
||||||
echo Ajax::text('?page=browse&action=page&type=' . $browse_type . '&start=' . $offset,$page,'browse_' . $uid . 'page_' . $page,'','page-nb');
|
echo Ajax::text('?page=browse&action=page&browse_id=' . $browse->id . '&start=' . $offset,$page,'browse_' . $uid . 'page_' . $page,'','page-nb');
|
||||||
} // end else
|
} // end else
|
||||||
} // end foreach up
|
} // end foreach up
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -85,10 +85,12 @@ $title = scrub_out($album->name) . ' (' . $album->year . ')' . $disk .'&nb
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
Browse::set_type('song');
|
$browse = new Browse();
|
||||||
Browse::set_simple_browse(1);
|
$browse->set_type('song');
|
||||||
Browse::set_filter('album', $album->id);
|
$browse->set_simple_browse(true);
|
||||||
Browse::set_sort('track','ASC');
|
$browse->set_filter('album', $album->id);
|
||||||
Browse::get_objects();
|
$browse->set_sort('track', 'ASC');
|
||||||
Browse::show_objects();
|
$browse->get_objects();
|
||||||
|
$browse->show_objects();
|
||||||
|
$browse->store();
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
<?php echo Ajax::button('?action=basket&type=album_random&id=' . $album->id,'random',_('Random'),'random_album_' . $album->id); ?>
|
<?php echo Ajax::button('?action=basket&type=album_random&id=' . $album->id,'random',_('Random'),'random_album_' . $album->id); ?>
|
||||||
</td>
|
</td>
|
||||||
<?php
|
<?php
|
||||||
if (Browse::is_enabled('show_art')) {
|
if (Art::is_enabled()) {
|
||||||
$name = '[' . $album->f_artist . '] ' . scrub_out($album->full_name);
|
$name = '[' . $album->f_artist . '] ' . scrub_out($album->full_name);
|
||||||
?>
|
?>
|
||||||
<td class="cel_cover">
|
<td class="cel_cover">
|
||||||
|
|
|
@ -26,7 +26,7 @@ $ajax_url = Config::get('ajax_url');
|
||||||
<table class="tabledata" cellpadding="0" cellspacing="0">
|
<table class="tabledata" cellpadding="0" cellspacing="0">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col id="col_add" />
|
<col id="col_add" />
|
||||||
<?php if (Browse::is_enabled('show_art')) { ?>
|
<?php if (Art::is_enabled()) { ?>
|
||||||
<col id="col_cover" />
|
<col id="col_cover" />
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<col id="col_album" />
|
<col id="col_album" />
|
||||||
|
@ -39,13 +39,13 @@ $ajax_url = Config::get('ajax_url');
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<tr class="th-top">
|
<tr class="th-top">
|
||||||
<th class="cel_add"><?php echo _('Add'); ?></th>
|
<th class="cel_add"><?php echo _('Add'); ?></th>
|
||||||
<?php if (Browse::is_enabled('show_art')) { ?>
|
<?php if (Art::is_enabled()) { ?>
|
||||||
<th class="cel_cover"><?php echo _('Cover'); ?></th>
|
<th class="cel_cover"><?php echo _('Cover'); ?></th>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<th class="cel_album"><?php echo Ajax::text('?page=browse&action=set_sort&type=album&sort=name',_('Album'),'album_sort_name'); ?></th>
|
<th class="cel_album"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&sort=name',_('Album'),'album_sort_name'); ?></th>
|
||||||
<th class="cel_artist"><?php echo Ajax::text('?page=browse&action=set_sort&type=album&sort=artist',_('Artist'),'album_sort_artist'); ?></th>
|
<th class="cel_artist"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&sort=artist',_('Artist'),'album_sort_artist'); ?></th>
|
||||||
<th class="cel_songs"><?php echo _('Songs'); ?></th>
|
<th class="cel_songs"><?php echo _('Songs'); ?></th>
|
||||||
<th class="cel_year"><?php echo Ajax::text('?page=browse&action=set_sort&type=album&sort=year',_('Year'),'album_sort_year'); ?></th>
|
<th class="cel_year"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&sort=year',_('Year'),'album_sort_year'); ?></th>
|
||||||
<th class="cel_tags"><?php echo _('Tags'); ?></th>
|
<th class="cel_tags"><?php echo _('Tags'); ?></th>
|
||||||
<th class="col_rating"><?php echo _('Rating'); ?></th>
|
<th class="col_rating"><?php echo _('Rating'); ?></th>
|
||||||
<th class="cel_action"><?php echo _('Actions'); ?></th>
|
<th class="cel_action"><?php echo _('Actions'); ?></th>
|
||||||
|
@ -70,13 +70,13 @@ $ajax_url = Config::get('ajax_url');
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<tr class="th-bottom">
|
<tr class="th-bottom">
|
||||||
<th class="cel_add"><?php echo _('Add'); ?></th>
|
<th class="cel_add"><?php echo _('Add'); ?></th>
|
||||||
<?php if (Browse::is_enabled('show_art')) { ?>
|
<?php if (Art::is_enabled()) { ?>
|
||||||
<th class="cel_cover"><?php echo _('Cover'); ?></th>
|
<th class="cel_cover"><?php echo _('Cover'); ?></th>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<th class="cel_album"><?php echo Ajax::text('?page=browse&action=set_sort&type=album&sort=name',_('Album'),'album_sort_name_bottom'); ?></th>
|
<th class="cel_album"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&sort=name',_('Album'),'album_sort_name_bottom'); ?></th>
|
||||||
<th class="cel_artist"><?php echo _('Artist'); ?></th>
|
<th class="cel_artist"><?php echo _('Artist'); ?></th>
|
||||||
<th class="cel_songs"><?php echo _('Songs'); ?></th>
|
<th class="cel_songs"><?php echo _('Songs'); ?></th>
|
||||||
<th class="cel_year"><?php echo Ajax::text('?page=browse&action=set_sort&type=album&sort=year',_('Year'),'album_sort_year_bottom'); ?></th>
|
<th class="cel_year"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&sort=year',_('Year'),'album_sort_year_bottom'); ?></th>
|
||||||
<th class="cel_tags"><?php echo _('Tags'); ?></th>
|
<th class="cel_tags"><?php echo _('Tags'); ?></th>
|
||||||
<th class="col_rating"><?php echo _('Rating'); ?></th>
|
<th class="col_rating"><?php echo _('Rating'); ?></th>
|
||||||
<th class="cel_action"><?php echo _('Actions'); ?></th>
|
<th class="cel_action"><?php echo _('Actions'); ?></th>
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
$web_path = Config::get('web_path');
|
$web_path = Config::get('web_path');
|
||||||
?>
|
?>
|
||||||
<?php
|
<?php
|
||||||
|
$browse = new Browse();
|
||||||
|
$browse->set_type($object_type);
|
||||||
show_box_top($artist->f_name, 'info-box');
|
show_box_top($artist->f_name, 'info-box');
|
||||||
if (Config::get('ratings')) {
|
if (Config::get('ratings')) {
|
||||||
?>
|
?>
|
||||||
|
@ -65,13 +67,12 @@ if (Config::get('ratings')) {
|
||||||
</li>
|
</li>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<li>
|
<li>
|
||||||
<input type="checkbox" id="show_artist_artCB" <?php echo $string = Browse::get_filter('show_art') ? 'checked="checked"' : ''; ?>/> <?php echo _('Show Art'); ?>
|
<input type="checkbox" id="show_artist_artCB" <?php echo $string = Art::is_enabled() ? 'checked="checked"' : ''; ?>/> <?php echo _('Show Art'); ?>
|
||||||
<?php echo Ajax::observe('show_artist_artCB','click',Ajax::action('?page=browse&action=browse&key=show_art&value=1&type=album','')); ?>
|
<?php echo Ajax::observe('show_artist_artCB', 'click', Ajax::action('?page=browse&action=show_art&browse_id=' . $browse->id,'')); ?>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<?php show_box_bottom(); ?>
|
<?php show_box_bottom(); ?>
|
||||||
<?php
|
<?php
|
||||||
Browse::set_type($object_type);
|
$browse->show_objects($object_ids);
|
||||||
Browse::reset();
|
$browse->store();
|
||||||
Browse::show_objects($object_ids);
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
</div> <!-- Close Now Playing Div -->
|
</div> <!-- Close Now Playing Div -->
|
||||||
<!-- Randomly selected albums of the moment -->
|
<!-- Randomly selected albums of the moment -->
|
||||||
<?php
|
<?php
|
||||||
if (Browse::is_enabled('show_art')) {
|
if (Art::is_enabled()) {
|
||||||
echo Ajax::observe('window','load',Ajax::action('?page=index&action=random_albums','random_albums'));
|
echo Ajax::observe('window','load',Ajax::action('?page=index&action=random_albums','random_albums'));
|
||||||
?>
|
?>
|
||||||
<div id="random_selection">
|
<div id="random_selection">
|
||||||
|
|
|
@ -49,8 +49,11 @@
|
||||||
<?php show_box_bottom(); ?>
|
<?php show_box_bottom(); ?>
|
||||||
<?php
|
<?php
|
||||||
$catalog_ids = Catalog::get_catalogs();
|
$catalog_ids = Catalog::get_catalogs();
|
||||||
Browse::set_type('catalog');
|
$browse = new Browse();
|
||||||
Browse::set_static_content(1);
|
$browse->set_type('catalog');
|
||||||
Browse::show_objects($catalog_ids);
|
$browse->set_static_content(true);
|
||||||
|
$browse->save_objects($catalog_ids);
|
||||||
|
$browse->show_objects($catalog_ids);
|
||||||
|
$browse->store();
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ $artist = scrub_out(truncate_with_ellipsis($media->f_artist_full));
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<?php if (Browse::is_enabled('show_art')) { ?>
|
<?php if (Art::is_enabled()) { ?>
|
||||||
<div class="np_group">
|
<div class="np_group">
|
||||||
<div class="np_cell cel_albumart">
|
<div class="np_cell cel_albumart">
|
||||||
<a target="_blank" href="<?php echo $web_path; ?>/image.php?id=<?php echo $media->album; ?>&type=popup" onclick="popup_art('<?php echo $web_path; ?>/image.php?id=<?php echo $media->album; ?>&type=popup'); return false;">
|
<a target="_blank" href="<?php echo $web_path; ?>/image.php?id=<?php echo $media->album; ?>&type=popup" onclick="popup_art('<?php echo $web_path; ?>/image.php?id=<?php echo $media->album; ?>&type=popup'); return false;">
|
||||||
|
|
|
@ -68,8 +68,10 @@ show_box_top('<div id="playlist_row_' . $playlist->id . '">' . $title .
|
||||||
</div>
|
</div>
|
||||||
<?php show_box_bottom(); ?>
|
<?php show_box_bottom(); ?>
|
||||||
<?php
|
<?php
|
||||||
Browse::set_type('playlist_song');
|
$browse = new Browse();
|
||||||
Browse::add_supplemental_object('playlist',$playlist->id);
|
$browse->set_type('playlist_song');
|
||||||
Browse::set_static_content(1);
|
$browse->add_supplemental_object('playlist', $playlist->id);
|
||||||
Browse::show_objects($object_ids);
|
$browse->set_static_content(true);
|
||||||
|
$browse->show_objects($object_ids);
|
||||||
|
$browse->store();
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -101,10 +101,11 @@
|
||||||
<div id="browse">
|
<div id="browse">
|
||||||
<?php
|
<?php
|
||||||
if (is_array($object_ids)) {
|
if (is_array($object_ids)) {
|
||||||
Browse::reset_filters();
|
$browse = new Browse();
|
||||||
Browse::set_type('song');
|
$browse->set_type('song');
|
||||||
Browse::save_objects($object_ids);
|
$browse->save_objects($object_ids);
|
||||||
Browse::show_objects();
|
$browse->show_objects();
|
||||||
|
$browse->store();
|
||||||
echo Ajax::observe('window','load',Ajax::action('?action=refresh_rightbar','playlist_refresh_load'));
|
echo Ajax::observe('window','load',Ajax::action('?action=refresh_rightbar','playlist_refresh_load'));
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -33,7 +33,7 @@ $button = Ajax::button('?page=index&action=random_albums','random',_('Refresh'),
|
||||||
?>
|
?>
|
||||||
<div class="random_album">
|
<div class="random_album">
|
||||||
<a href="<?php echo $web_path; ?>/albums.php?action=show&album=<?php echo $album_id; ?>">
|
<a href="<?php echo $web_path; ?>/albums.php?action=show&album=<?php echo $album_id; ?>">
|
||||||
<?php if (Browse::is_enabled('show_art')) { ?>
|
<?php if (Art::is_enabled()) { ?>
|
||||||
<img src="<?php echo $web_path; ?>/image.php?thumb=3&id=<?php echo $album_id; ?>" width="80" height="80" alt="<?php echo $name; ?>" title="<?php echo $name; ?>" />
|
<img src="<?php echo $web_path; ?>/image.php?thumb=3&id=<?php echo $album_id; ?>" width="80" height="80" alt="<?php echo $name; ?>" title="<?php echo $name; ?>" />
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
<?php echo '[' . $album->f_artist . '] ' . $album->f_name; ?>
|
<?php echo '[' . $album->f_artist . '] ' . $album->f_name; ?>
|
||||||
|
|
|
@ -25,12 +25,12 @@
|
||||||
<div id="information_actions">
|
<div id="information_actions">
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<?php echo Ajax::button('?action=basket&type=browse_set&object_type=song','add',_('Add Search Results'),'add_search_results'); ?>
|
<?php echo Ajax::button('?action=basket&type=browse_set&browse_id=' . $browse->id,'add',_('Add Search Results'),'add_search_results'); ?>
|
||||||
<?php echo _('Add Search Results'); ?>
|
<?php echo _('Add Search Results'); ?>
|
||||||
</li>
|
</li>
|
||||||
<?php if (Access::check_function('batch_download')) { ?>
|
<?php if (Access::check_function('batch_download')) { ?>
|
||||||
<li>
|
<li>
|
||||||
<a href="<?php echo Config::get('web_path'); ?>/batch.php?action=browse"><?php echo get_user_icon('batch_download', _('Batch Download')); ?></a>
|
<a href="<?php echo Config::get('web_path'); ?>/batch.php?action=browse&browse_id=<?php echo $browse->id; ?>"><?php echo get_user_icon('batch_download', _('Batch Download')); ?></a>
|
||||||
<?php echo _('Batch Download'); ?>
|
<?php echo _('Batch Download'); ?>
|
||||||
</li>
|
</li>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
|
@ -38,12 +38,12 @@ $ajax_url = Config::get('ajax_url');
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<tr class="th-top">
|
<tr class="th-top">
|
||||||
<th class="cel_add"><?php echo _('Add'); ?></th>
|
<th class="cel_add"><?php echo _('Add'); ?></th>
|
||||||
<th class="cel_song"><?php echo Ajax::text('?page=browse&action=set_sort&type=song&sort=title',_('Song Title'),'sort_song_title'); ?></th>
|
<th class="cel_song"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&sort=title', _('Song Title'), 'sort_song_title'); ?></th>
|
||||||
<th class="cel_artist"><?php echo Ajax::text('?page=browse&action=set_sort&type=song&sort=artist',_('Artist'),'sort_song_artist'); ?></th>
|
<th class="cel_artist"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&sort=artist', _('Artist'), 'sort_song_artist'); ?></th>
|
||||||
<th class="cel_album"><?php echo Ajax::text('?page=browse&action=set_sort&type=song&sort=album',_('Album'),'sort_song_album'); ?></th>
|
<th class="cel_album"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&sort=album', _('Album'), 'sort_song_album'); ?></th>
|
||||||
<th class="cel_tags"><?php echo _('Tags'); ?></th>
|
<th class="cel_tags"><?php echo _('Tags'); ?></th>
|
||||||
<th class="cel_track"><?php echo Ajax::text('?page=browse&action=set_sort&type=song&sort=track',_('Track'),'sort_song_track'); ?></th>
|
<th class="cel_track"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&sort=track', _('Track'), 'sort_song_track'); ?></th>
|
||||||
<th class="cel_time"><?php echo Ajax::text('?page=browse&action=set_sort&type=song&sort=time',_('Time'),'sort_song_time'); ?></th>
|
<th class="cel_time"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&sort=time', _('Time'), 'sort_song_time'); ?></th>
|
||||||
<?php if (Config::get('ratings')) {
|
<?php if (Config::get('ratings')) {
|
||||||
Rating::build_cache('song', $object_ids);
|
Rating::build_cache('song', $object_ids);
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -24,7 +24,6 @@ $ajax_info = Config::get('ajax_url'); $web_path = Config::get('web_path');
|
||||||
<ul class="sb2" id="sb_home">
|
<ul class="sb2" id="sb_home">
|
||||||
<li><h4><?php echo _('Browse'); ?></h4>
|
<li><h4><?php echo _('Browse'); ?></h4>
|
||||||
<?php
|
<?php
|
||||||
$allowed_filters = Browse::get_allowed_filters();
|
|
||||||
// Build the selected dealie
|
// Build the selected dealie
|
||||||
$text = scrub_in($_REQUEST['action']) . '_ac';
|
$text = scrub_in($_REQUEST['action']) . '_ac';
|
||||||
${$text} = ' selected="selected"';
|
${$text} = ' selected="selected"';
|
||||||
|
@ -39,52 +38,8 @@ $ajax_info = Config::get('ajax_url'); $web_path = Config::get('web_path');
|
||||||
<li id="sb_browse_bb_Video"><a href="<?php echo $web_path; ?>/browse.php?action=video"><?php echo _('Videos'); ?></a></li>
|
<li id="sb_browse_bb_Video"><a href="<?php echo $web_path; ?>/browse.php?action=video"><?php echo _('Videos'); ?></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<?php if (count($allowed_filters)) { ?>
|
<?php Ajax::start_container('browse_filters'); ?>
|
||||||
<li><h4><?php echo _('Filters'); ?></h4>
|
<?php Ajax::end_container(); ?>
|
||||||
<div class="sb3">
|
|
||||||
<?php if (in_array('starts_with',$allowed_filters)) { ?>
|
|
||||||
<form id="multi_alpha_filter_form" method="post" action="javascript:void(0);">
|
|
||||||
<label id="multi_alpha_filterLabel" for="multi_alpha_filter"><?php echo _('Starts With'); ?></label>
|
|
||||||
<input type="text" id="multi_alpha_filter" name="multi_alpha_filter" value="<?php echo scrub_out(Browse::get_filter('starts_with')); ?>" onKeyUp="DelayRun(this,'400','ajaxState','<?php echo Config::get('ajax_url'); ?>?page=browse&action=browse&type=<?php echo Browse::get_type(); ?>&key=starts_with','multi_alpha_filter');">
|
|
||||||
</form>
|
|
||||||
<?php } // end if alpha_match ?>
|
|
||||||
<?php if (in_array('minimum_count',$allowed_filters)) { ?>
|
|
||||||
<input id="mincountCB" type="checkbox" onclick="ajaxPut('<?php echo $ajax_info; ?>?action=browse&key=min_count&type=<?php echo Browse::get_type(); ?>&value=1');return true;" value="1" />
|
|
||||||
<label id="mincountLabel" for="mincountCB"><?php echo _('Minimum Count'); ?></label><br />
|
|
||||||
<?php } ?>
|
|
||||||
<?php if (in_array('rated',$allowed_filters)) { ?>
|
|
||||||
<input id="ratedCB" type="checkbox" onclick="ajaxPut('<?php echo $ajax_info; ?>?action=browse&type=<?php echo Browse::get_type(); ?>&key=rated&value=1');return true;" value="1" />
|
|
||||||
<label id="ratedLabel" for="ratedCB"><?php echo _('Rated'); ?></label><br />
|
|
||||||
<?php } ?>
|
|
||||||
<?php if (in_array('unplayed',$allowed_filters)) { ?>
|
|
||||||
<input id="unplayedCB" type="checkbox" <?php echo $string = Browse::get_filter('unplayed') ? 'checked="checked"' : ''; ?>/>
|
|
||||||
<label id="unplayedLabel" for="unplayedCB"><?php echo _('Unplayed'); ?></label><br />
|
|
||||||
<?php } ?>
|
|
||||||
<?php if (in_array('show_art',$allowed_filters)) { ?>
|
|
||||||
<input id="show_artCB" type="checkbox" <?php echo $string = Browse::get_filter('show_art') ? 'checked="checked"' : ''; ?>/>
|
|
||||||
<label id="show_artLabel" for="show_artCB"><?php echo _('Show Art'); ?></label><br />
|
|
||||||
<?php echo Ajax::observe('show_artCB','click',Ajax::action('?page=browse&action=browse&type=' . Browse::get_type() . '&key=show_art&value=1','')); ?>
|
|
||||||
<?php } // if show_art ?>
|
|
||||||
<?php if (in_array('playlist_type',$allowed_filters)) { ?>
|
|
||||||
<input id="show_allplCB" type="checkbox" <?php echo $string = Browse::get_filter('playlist_type') ? 'checked="checked"' : ''; ?>/>
|
|
||||||
<label id="show_allplLabel" for="showallplCB"><?php echo _('All Playlists'); ?></label><br />
|
|
||||||
<?php echo Ajax::observe('show_allplCB','click',Ajax::action('?page=browse&action=browse&type=' . Browse::get_type() . '&key=playlist_type&value=1','')); ?>
|
|
||||||
<?php } // if playlist_type ?>
|
|
||||||
<?php if (in_array('object_type',$allowed_filters)) { ?>
|
|
||||||
<?php $string = 'otype_' . Browse::get_filter('object_type'); ${$string} = 'selected="selected"'; ?>
|
|
||||||
<input id="typeSongRadio" type="radio" name="object_type" value="1" <?php echo $otype_song; ?>/>
|
|
||||||
<label id="typeSongLabel" for="typeSongRadio"><?php echo _('Song Title'); ?></label><br />
|
|
||||||
<?php echo Ajax::observe('typeSongRadio','click',Ajax::action('?page=tag&action=browse_type&type=song','')); ?>
|
|
||||||
<input id="typeAlbumRadio" type="radio" name="object_type" value="1" />
|
|
||||||
<label id="typeAlbumLabel" for="typeAlbumRadio"><?php echo _('Albums'); ?></label><br />
|
|
||||||
<?php echo Ajax::observe('typeAlbumRadio','click',Ajax::action('?page=tag&action=browse_type&type=album','')); ?>
|
|
||||||
<input id="typeArtistRadio" type="radio" name="object_type" value="1" />
|
|
||||||
<label id="typeArtistLabel" for="typeArtistRadio"><?php echo _('Artist'); ?></label><br />
|
|
||||||
<?php echo Ajax::observe('typeArtistRadio','click',Ajax::action('?page=tag&action=browse_type&type=artist','')); ?>
|
|
||||||
<?php } ?>
|
|
||||||
</div>
|
|
||||||
</li>
|
|
||||||
<?php } ?>
|
|
||||||
<li><h4><?php echo _('Playlist'); ?></h4>
|
<li><h4><?php echo _('Playlist'); ?></h4>
|
||||||
<ul class="sb3" id="sb_home_info">
|
<ul class="sb3" id="sb_home_info">
|
||||||
<li id="sb_home_info_CurrentlyPlaying"><a href="<?php echo $web_path; ?>/index.php"><?php echo _('Currently Playing'); ?></a></li>
|
<li id="sb_home_info_CurrentlyPlaying"><a href="<?php echo $web_path; ?>/index.php"><?php echo _('Currently Playing'); ?></a></li>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue