1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-03 09:49:30 +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:
Paul 'flowerysong' Arthur 2010-06-10 05:33:57 +00:00
parent c1ed41a16d
commit 7f36693353
39 changed files with 754 additions and 673 deletions

View file

@ -293,19 +293,23 @@ switch ($_REQUEST['action']) {
break;
case 'show_disabled':
$disabled = Flag::get_disabled();
Browse::set_type('song');
Browse::set_static_content(1);
Browse::save_objects($disabled);
Browse::show_objects($disabled);
$browse = new Browse();
$browse->set_type('song');
$browse->set_static_content(true);
$browse->save_objects($disabled);
$browse->show_objects($disabled);
$browse->store();
break;
default:
case 'show_flagged':
$flagged = Flag::get_all();
Flag::build_cache($flagged);
Browse::set_type('flagged');
Browse::set_static_content(1);
Browse::save_objects($flagged);
Browse::show_objects($flagged);
$browse = new Browse();
$browse->set_type('flagged');
$browse->set_static_content(true);
$browse->save_objects($flagged);
$browse->show_objects($flagged);
$browse->store();
break;
} // end switch

View file

@ -33,8 +33,12 @@ switch ($_REQUEST['action']) {
default:
// Show Catalogs
$catalog_ids = Catalog::get_catalogs();
Browse::set_type('catalog');
Browse::show_objects($catalog_ids);
$browse = new Browse();
$browse->set_type('catalog');
$browse->set_static_content(true);
$browse->save_objects($catalog_ids);
$browse->show_objects($catalog_ids);
$browse->store();
break;
}

View file

@ -48,10 +48,12 @@ switch ($_REQUEST['action']) {
show_confirmation(_('Shoutbox Post Deleted'),'',Config::get('web_path').'/admin/shout.php');
break;
default:
Browse::set_type('shoutbox');
Browse::set_simple_browse(1);
$shoutbox_ids = Browse::get_objects();
Browse::show_objects($shoutbox_ids);
$browse = new Browse();
$browse->set_type('shoutbox');
$browse->set_simple_browse(true);
$shoutbox_ids = $browse->get_objects();
$browse->show_objects($shoutbox_ids);
$browse->store();
break;
} // end switch on action

View file

@ -193,12 +193,14 @@ switch ($_REQUEST['action']) {
require_once Config::get('prefix') . '/templates/show_user_preferences.inc.php';
break;
default:
Browse::reset_filters();
Browse::set_type('user');
Browse::set_simple_browse(1);
Browse::set_sort('name','ASC');
$user_ids = Browse::get_objects();
Browse::show_objects($user_ids);
$browse = new Browse();
$browse->reset_filters();
$browse->set_type('user');
$browse->set_simple_browse(1);
$browse->set_sort('name','ASC');
$user_ids = $browse->get_objects();
$browse->show_objects($user_ids);
$browse->store();
break;
} // end switch on action

View file

@ -173,7 +173,6 @@ switch ($_REQUEST['action']) {
case 'show':
$album = new Album($_REQUEST['album']);
$album->format();
Browse::reset_filters();
require Config::get('prefix') . '/templates/show_album.inc.php';
break;

View file

@ -53,7 +53,9 @@ switch ($_REQUEST['action']) {
$name = $artist->name;
break;
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());
default:
// Rien a faire

View file

@ -25,15 +25,17 @@
* Browse By Page
* This page shows the browse menu, which allows you to browse by many different
* fields including genre, artist, album, catalog, ???
* this page also handles the actuall browse action
* This page also handles the actual browse action
*
*/
/* Base Require */
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
// so we've got a little switch here that creates the type.. this feels hackish...
// This page is a little wonky we don't want the sidebar until we know what
// 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']) {
case 'tag':
case 'file':
@ -43,9 +45,8 @@ switch ($_REQUEST['action']) {
case 'live_stream':
case 'video':
case 'song':
Browse::set_type($_REQUEST['action']);
Browse::reset();
Browse::set_simple_browse(true);
$browse->set_type($_REQUEST['action']);
$browse->set_simple_browse(true);
break;
} // end switch
@ -55,51 +56,53 @@ switch($_REQUEST['action']) {
case 'file':
break;
case 'album':
Browse::set_sort('name','ASC');
Browse::show_objects();
$browse->set_sort('name','ASC');
$browse->show_objects();
break;
case 'tag':
Browse::set_sort('count','ASC');
$browse->set_sort('count','ASC');
// This one's a doozy
Browse::set_simple_browse(0);
Browse::save_objects(Tag::get_tags(Config::get('offset_limit'),array()));
$keys = array_keys(Browse::get_saved());
$browse->set_simple_browse(false);
$browse->save_objects(Tag::get_tags(Config::get('offset_limit'),array()));
$object_ids = $browse->get_saved();
$keys = array_keys($object_ids);
Tag::build_cache($keys);
$object_ids = Browse::get_saved();
show_box_top(_('Tag Cloud'),$class);
require_once Config::get('prefix') . '/templates/show_tagcloud.inc.php';
show_box_bottom();
require_once Config::get('prefix') . '/templates/browse_content.inc.php';
break;
case 'artist':
Browse::set_sort('name','ASC');
Browse::show_objects();
$browse->set_sort('name','ASC');
$browse->show_objects();
break;
case 'song':
Browse::set_sort('title','ASC');
Browse::show_objects();
$browse->set_sort('title','ASC');
$browse->show_objects();
break;
case 'live_stream':
Browse::set_sort('name','ASC');
Browse::show_objects();
$browse->set_sort('name','ASC');
$browse->show_objects();
break;
case 'catalog':
break;
case 'playlist':
Browse::set_sort('type','ASC');
Browse::set_filter('playlist_type','1');
Browse::show_objects();
$browse->set_sort('type','ASC');
$browse->set_filter('playlist_type','1');
$browse->show_objects();
break;
case 'video':
Browse::set_sort('title','ASC');
Browse::show_objects();
$browse->set_sort('title','ASC');
$browse->show_objects();
break;
default:
break;
} // end Switch $action
$browse->store();
/* Show the Footer */
show_footer();
?>

View file

@ -114,10 +114,11 @@ switch ($_REQUEST['action']) {
$objects = $democratic->get_items();
Song::build_cache($democratic->object_ids);
Democratic::build_vote_cache($democratic->vote_ids);
Browse::set_type('democratic');
Browse::reset();
Browse::set_static_content(1);
Browse::show_objects($objects);
$browse = new Browse();
$browse->set_type('democratic');
$browse->set_static_content(true);
$browse->show_objects($objects);
$browse->store();
break;
} // end switch on action

View file

@ -4,6 +4,7 @@
--------------------------------------------------------------------------
v.3.6-Alpha1
- Changed Browse from a singleton to multiple instances
- Fixed setting access levels for plugin passwords
- Fixed handling of unusual characters in passwords
- Fixed support for requesting different thumbnail sizes

View file

@ -22,13 +22,16 @@
/**
* API Class
* This handles functions relating to the API written for ampache, initially this is very focused
* on providing functionality for Amarok so it can integrate with Ampache
* This handles functions relating to the API written for ampache, initially
* this is very focused on providing functionality for Amarok so it can
* integrate with Ampache.
*/
class Api {
public static $version = '350001';
private static $browse = null;
/**
* constructor
* This really isn't anything to do here, so it's private
@ -39,6 +42,16 @@ class Api {
} // 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
* 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
if (strpos($value,'/')) {
$elements = explode('/',$value);
Browse::set_filter('add_lt',strtotime($elements['1']));
Browse::set_filter('add_gt',strtotime($elements['0']));
self::$browse->set_filter('add_lt',strtotime($elements['1']));
self::$browse->set_filter('add_gt',strtotime($elements['0']));
}
else {
Browse::set_filter('add_gt',strtotime($value));
self::$browse->set_filter('add_gt',strtotime($value));
}
break;
case 'update':
// Check for a range, if no range default to gt
if (strpos($value,'/')) {
$elements = explode('/',$value);
Browse::set_filter('update_lt',strtotime($elements['1']));
Browse::set_filter('update_gt',strtotime($elements['0']));
self::$browse->set_filter('update_lt',strtotime($elements['1']));
self::$browse->set_filter('update_gt',strtotime($elements['0']));
}
else {
Browse::set_filter('update_gt',strtotime($value));
self::$browse->set_filter('update_gt',strtotime($value));
}
break;
case 'alpha_match':
Browse::set_filter('alpha_match',$value);
self::$browse->set_filter('alpha_match',$value);
break;
case 'exact_match':
Browse::set_filter('exact_match',$value);
self::$browse->set_filter('exact_match',$value);
break;
default:
// Rien a faire
@ -242,9 +255,9 @@ class Api {
*/
public static function artists($input) {
Browse::reset_filters();
Browse::set_type('artist');
Browse::set_sort('name','ASC');
self::$browse->reset_filters();
self::$browse->set_type('artist');
self::$browse->set_sort('name','ASC');
$method = $input['exact'] ? 'exact_match' : 'alpha_match';
Api::set_filter($method,$input['filter']);
@ -255,7 +268,7 @@ class Api {
xmlData::set_offset($input['offset']);
xmlData::set_limit($input['limit']);
$artists = Browse::get_objects();
$artists = self::$browse->get_objects();
// echo out the resulting xml document
ob_end_clean();
echo xmlData::artists($artists);
@ -315,15 +328,15 @@ class Api {
*/
public static function albums($input) {
Browse::reset_filters();
Browse::set_type('album');
Browse::set_sort('name','ASC');
self::$browse->reset_filters();
self::$browse->set_type('album');
self::$browse->set_sort('name','ASC');
$method = $input['exact'] ? 'exact_match' : 'alpha_match';
Api::set_filter($method,$input['filter']);
Api::set_filter('add',$input['add']);
Api::set_filter('update',$input['update']);
$albums = Browse::get_objects();
$albums = self::$browse->get_objects();
// Set the offset
xmlData::set_offset($input['offset']);
@ -368,13 +381,13 @@ class Api {
*/
public static function tags($input) {
Browse::reset_filters();
Browse::set_type('tag');
Browse::set_sort('name','ASC');
self::$browse->reset_filters();
self::$browse->set_type('tag');
self::$browse->set_sort('name','ASC');
$method = $input['exact'] ? 'exact_match' : 'alpha_match';
Api::set_filter($method,$input['filter']);
$tags = Browse::get_objects();
$tags = self::$browse->get_objects();
// Set the offset
xmlData::set_offset($input['offset']);
@ -451,16 +464,16 @@ class Api {
*/
public static function songs($input) {
Browse::reset_filters();
Browse::set_type('song');
Browse::set_sort('title','ASC');
self::$browse->reset_filters();
self::$browse->set_type('song');
self::$browse->set_sort('title','ASC');
$method = $input['exact'] ? 'exact_match' : 'alpha_match';
Api::set_filter($method,$input['filter']);
Api::set_filter('add',$input['add']);
Api::set_filter('update',$input['update']);
$songs = Browse::get_objects();
$songs = self::$browse->get_objects();
// Set the offset
xmlData::set_offset($input['offset']);
@ -506,14 +519,14 @@ class Api {
*/
public static function playlists($input) {
Browse::reset_filters();
Browse::set_type('playlist');
Browse::set_sort('name','ASC');
self::$browse->reset_filters();
self::$browse->set_type('playlist');
self::$browse->set_sort('name','ASC');
$method = $input['exact'] ? 'exact_match' : 'alpha_match';
Api::set_filter($method,$input['filter']);
$playlist_ids = Browse::get_objects();
$playlist_ids = self::$browse->get_objects();
xmlData::set_offset($input['offset']);
xmlData::set_limit($input['limit']);
@ -586,14 +599,14 @@ class Api {
*/
public static function videos($input) {
Browse::reset_filters();
Browse::set_type('video');
Browse::set_sort('title','ASC');
self::$browse->reset_filters();
self::$browse->set_type('video');
self::$browse->set_sort('title','ASC');
$method = $input['exact'] ? 'exact_match' : 'alpha_match';
Api::set_filter($method,$input['filter']);
$video_ids = Browse::get_objects();
$video_ids = self::$browse->get_objects();
xmlData::set_offset($input['offset']);
xmlData::set_limit($input['limit']);

View file

@ -36,6 +36,7 @@ class Art extends database_object {
public $thumb;
public $thumb_mime;
private static $enabled;
/**
* Constructor
@ -49,6 +50,41 @@ class Art extends database_object {
} // 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
* This validates the type

View file

@ -29,40 +29,14 @@
*/
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
* This sets the current browse object to a 'simple' browse method
* 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
@ -70,9 +44,9 @@ class Browse extends Query {
* add_supplemental_object
* 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;
@ -80,12 +54,12 @@ class Browse extends Query {
/**
* get_supplemental_objects
* This returns an array of 'class','id' for additional objects that need to be
* created before we start this whole browsing thing
* This returns an array of 'class','id' for additional objects that
* 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(); }
@ -93,74 +67,58 @@ class Browse extends Query {
} // 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
* This takes an array of objects
* and requires the correct template based on the
* 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()) {
$object_ids = parent::get_saved();
if ($this->is_simple() || ! is_array($object_ids)) {
$object_ids = $this->get_saved();
}
else {
$object_ids = is_array($object_ids) ? $object_ids : parent::get_saved();
parent::save_objects($object_ids);
$this->save_objects($object_ids);
}
// Reset the total items
self::$total_objects = parent::get_total($object_ids);
// Limit is based on the users preferences if this is not a simple browse because we've got too much here
if (count($object_ids) > parent::get_start() AND !parent::is_simple()) {
$object_ids = array_slice($object_ids,parent::get_start(),parent::get_offset(),TRUE);
// Limit is based on the user's preferences if this is not a
// simple browse because we've got too much here
if ((count($object_ids) > $this->get_start()) &&
! $this->is_simple() &&
! $this->is_static_content()) {
$object_ids = array_slice(
$object_ids,
$this->get_start(),
$this->get_offset(),
true
);
}
// 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) {
${$class_name} = new $class_name($id);
}
// 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 . ')';
}
elseif ($filter_value = parent::get_filter('starts_with')) {
elseif ($filter_value = $this->get_filter('starts_with')) {
$match = ' (' . $filter_value . ')';
}
$type = $this->get_type();
// Set the correct classes based on type
$class = "box browse_".self::$type;
$class = "box browse_" . $type;
Ajax::start_container('browse_content');
// Switch on the type of browsing we're doing
switch (parent::get_type()) {
switch ($type) {
case 'song':
show_box_top(_('Songs') . $match, $class);
Song::build_cache($object_ids);
@ -241,45 +199,34 @@ class Browse extends Query {
// Rien a faire
break;
} // 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();
} // 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
* //FIXME
*/
public static function set_filter_from_request($r) {
foreach($r as $k=>$v) {
public function set_filter_from_request($request) {
foreach($request as $key => $value) {
//reinterpret v as a list of int
$vl = explode(',', $v);
$ok = 1;
foreach($vl as $i) {
if (!is_numeric($i)) {
$ok = 0;
$list = explode(',', $value);
$ok = true;
foreach($list as $item) {
if (!is_numeric($item)) {
$ok = false;
break;
}
}
if ($ok) {
if (sizeof($vl) == 1) {
self::set_filter($k, $vl[0]);
if (sizeof($list) == 1) {
$this->set_filter($key, $list[0]);
}
}
else {
self::set_filter($k, $vl);
$this->set_filter($key, $list);
}
}
} // set_filter_from_request

File diff suppressed because it is too large Load diff

View file

@ -344,6 +344,9 @@ class Update {
$update_string = '- Add uniqueness constraint to ratings.<br />';
$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;
} // populate_version
@ -1929,5 +1932,25 @@ class Update {
self::set_version('db_version','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
?>

View file

@ -82,9 +82,11 @@ switch ($_REQUEST['action']) {
// Pull the current playlist and require the template
$objects = $localplay->get();
require_once Config::get('prefix') . '/templates/show_localplay_status.inc.php';
Browse::set_type('playlist_localplay');
Browse::set_static_content(1);
Browse::show_objects($objects);
$browse = new Browse();
$browse->set_type('playlist_localplay');
$browse->set_static_content(true);
$browse->show_objects($objects);
$browse->store();
break;
} // end switch action

View file

@ -41,12 +41,13 @@ switch ($_REQUEST['action']) {
break;
}
case 'search':
$browse = new Browse();
require_once Config::get('prefix') . '/templates/show_search.inc.php';
require_once Config::get('prefix') . '/templates/show_search_options.inc.php';
$results = run_search($_REQUEST);
Browse::set_type('song');
Browse::reset();
Browse::show_objects($results);
$browse->set_type('song');
$browse->show_objects($results);
$browse->store();
break;
case 'save_as_track':
$playlist_id = save_search($_REQUEST);

View file

@ -268,8 +268,8 @@ switch ($_REQUEST['action']) {
} // end foreach
break;
case 'browse_set':
Browse::set_type($_REQUEST['object_type']);
$objects = Browse::get_saved();
$browse = new Browse($_REQUEST['browse_id']);
$objects = $browse->get_saved();
foreach ($objects as $object_id) {
$GLOBALS['user']->playlist->add_object($object_id,'song');
}
@ -341,25 +341,6 @@ switch ($_REQUEST['action']) {
$results[$key] = ob_get_contents();
ob_end_clean();
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:
$results['rfc3514'] = '0x1';
break;

View file

@ -25,44 +25,48 @@
*/
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']) {
case 'browse':
$object_ids = array();
Browse::set_type($_REQUEST['type']);
// Check 'value' with isset because it can null
//(user type a "start with" word and deletes it)
if ($_REQUEST['key'] && (isset($_REQUEST['multi_alpha_filter']) OR isset($_REQUEST['value']))) {
// 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']) {
// Set the new sort value
Browse::set_sort($_REQUEST['sort']);
$browse->set_sort($_REQUEST['sort']);
}
ob_start();
Browse::show_objects(false);
$browse->show_objects();
$results['browse_content'] = ob_get_clean();
break;
case 'set_sort':
Browse::set_type($_REQUEST['type']);
if ($_REQUEST['sort']) {
Browse::set_sort($_REQUEST['sort']);
$browse->set_sort($_REQUEST['sort']);
}
ob_start();
Browse::show_objects(false);
$browse->show_objects();
$results['browse_content'] = ob_get_clean();
break;
case 'toggle_tag':
$type = $_SESSION['tagcloud_type'] ? $_SESSION['tagcloud_type'] : 'song';
Browse::set_type($type);
$browse->set_type($type);
@ -94,19 +98,30 @@ switch ($_REQUEST['action']) {
break;
case 'page':
Browse::set_type($_REQUEST['type']);
Browse::set_start($_REQUEST['start']);
$browse->set_start($_REQUEST['start']);
ob_start();
Browse::show_objects();
$browse->show_objects();
$results['browse_content'] = ob_get_clean();
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:
$results['rfc3514'] = '0x1';
break;
} // switch on action;
$browse->store();
// We always do this
echo xml_from_array($results);
?>

View file

@ -25,63 +25,30 @@
*/
if (AJAX_INCLUDE != '1') { exit; }
$democratic = Democratic::get_current_playlist();
$democratic->set_parent();
switch ($_REQUEST['action']) {
case 'delete_vote':
$democratic = Democratic::get_current_playlist();
$democratic->set_parent();
$democratic->remove_vote($_REQUEST['row_id']);
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();
$show_browse = true;
break;
case 'add_vote':
$democratic = Democratic::get_current_playlist();
$democratic->set_parent();
$democratic->add_vote($_REQUEST['object_id'],$_REQUEST['type']);
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();
$show_browse = true;
break;
case 'delete':
if (!$GLOBALS['user']->has_access('75')) {
echo xml_from_array(array('rfc3514' => '0x1'));
exit;
}
$democratic = Democratic::get_current_playlist();
$democratic->set_parent();
$democratic->delete_votes($_REQUEST['row_id']);
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();
$show_browse = true;
break;
case 'send_playlist':
if (!Access::check('interface','75')) {
echo xml_from_array(array('rfc3514' => '0x1'));
exit;
}
@ -89,8 +56,8 @@ switch ($_REQUEST['action']) {
$results['rfc3514'] = '<script type="text/javascript">reload_util("'.$_SESSION['iframe']['target'].'")</script>';
break;
case 'clear_playlist':
if (!Access::check('interface','100')) {
echo xml_from_array(array('rfc3514' => '0x1'));
exit;
}
@ -98,21 +65,25 @@ switch ($_REQUEST['action']) {
$democratic->set_parent();
$democratic->clear();
ob_start();
$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();
$show_browse = true;
break;
default:
$results['rfc3514'] = '0x1';
break;
} // 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
echo xml_from_array($results);
?>

View file

@ -38,10 +38,12 @@ switch ($_REQUEST['action']) {
$flagged = Flag::get_all();
ob_start();
Browse::set_type('flagged');
Browse::set_static_content(1);
Browse::save_objects($flagged);
Browse::show_objects($flagged);
$browse = new Browse();
$browse->set_type('flagged');
$browse->set_static_content(true);
$browse->save_objects($flagged);
$browse->show_objects($flagged);
$browse->store();
$results['browse_content'] = ob_get_contents();
ob_end_clean();

View file

@ -79,9 +79,13 @@ switch ($_REQUEST['action']) {
break;
case 'delete_all':
$localplay->delete_all();
Browse::save_objects(array());
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();
ob_end_clean();
break;
@ -89,9 +93,12 @@ switch ($_REQUEST['action']) {
$localplay->skip(intval($_REQUEST['id']));
$objects = $localplay->get();
ob_start();
Browse::set_type('playlist_localplay');
Browse::set_static_content(1);
Browse::show_objects($objects);
$browse = new Browse();
$browse->set_type('playlist_localplay');
$browse->set_static_content(true);
$browse->save_objects($objects);
$browse->show_objects($objects);
$browse->store();
$results['browse_content'] = ob_get_contents();
ob_end_clean();
break;
@ -121,9 +128,12 @@ switch ($_REQUEST['action']) {
$status = $localplay->status();
ob_start();
Browse::set_type('playlist_localplay');
Browse::set_static_content(1);
Browse::show_objects($objects);
$browse = new Browse();
$browse->set_type('playlist_localplay');
$browse->set_static_content(true);
$browse->save_objects($objects);
$browse->show_objects($objects);
$browse->store();
$results['browse_content'] = ob_get_contents();
ob_end_clean();

View file

@ -36,10 +36,12 @@ switch ($_REQUEST['action']) {
$object_ids = $playlist->get_items();
ob_start();
Browse::set_type('playlist_song');
Browse::add_supplemental_object('playlist',$playlist->id);
Browse::save_objects($object_ids);
Browse::show_objects($object_ids);
$browse = new Browse();
$browse->set_type('playlist_song');
$browse->add_supplemental_object('playlist',$playlist->id);
$browse->save_objects($object_ids);
$browse->show_objects($object_ids);
$browse->store();
$results['browse_content'] = ob_get_clean();
break;
case 'edit_track':

View file

@ -75,10 +75,11 @@ switch ($_REQUEST['action']) {
$results['rightbar'] = ajax_include('rightbar.inc.php');
// Now setup the browse and show them below!
Browse::set_type('song');
Browse::save_objects($object_ids);
$browse = new Browse();
$browse->set_type('song');
$browse->save_objects($object_ids);
ob_start();
Browse::show_objects();
$browse->show_objects();
$results['browse'] = ob_get_contents();
ob_end_clean();

View file

@ -37,20 +37,19 @@ switch ($_REQUEST['action']) {
$tag->remove_map($_GET['type'],$_GET['object_id']);
break;
case 'browse_type':
Browse::set_type('tag');
Browse::set_filter('object_type',$_GET['type']);
$browse = new Browse($_GET['browse_id']);
$browse->set_filter('object_type', $_GET['type']);
$browse->store();
break;
case 'add_filter':
// Set browse method
Browse::set_type('song');
Browse::set_filter('tag',$_GET['tag_id']);
$object_ids = Browse::get_objects();
$browse = new Browse($_GET['browse_id']);
$browse->set_filter('tag', $_GET['tag_id']);
$object_ids = $browse->get_objects();
ob_start();
Browse::show_objects($object_ids);
$browse->show_objects($object_ids);
$results['browse_content'] = ob_get_clean();
// Retrive current objects of type based on combined filters
$browse->store();
// Retrieve current objects of type based on combined filters
break;
default:
$results['rfc3514'] = '0x1';

View 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>

View file

@ -28,9 +28,9 @@
*/
// Pull these variables out to allow shorthand (easier for lazy programmers)
$limit = Config::get('offset_limit') ? Config::get('offset_limit') : '25';
$start = Browse::get_start();
$total = Browse::$total_objects;
$limit = $browse->get_offset();
$start = $browse->get_start();
$total = $browse->get_total();
$uid = Config::get('list_header_uid');
$sides = 5;
@ -91,15 +91,14 @@ while ($page <= $pages) {
// Sort These Arrays of Hotness
ksort($page_data['up']);
ksort($page_data['down']);
$browse_type = Browse::get_type();
// are there enough items to even need this view?
if ($pages > 1) {
?>
<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&type=' . $browse_type . '&start=' . $next_offset,_('Next'),'browse_' . $uid . 'next','','next'); ?>
<?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&browse_id=' . $browse->id . '&start=' . $next_offset,_('Next'),'browse_' . $uid . 'next','','next'); ?>
<?php
/* Echo Everything below us */
foreach ($page_data['down'] as $page => $offset) {
@ -107,7 +106,7 @@ if ($pages > 1) {
else {
// Hack Alert
$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
@ -121,7 +120,7 @@ if ($pages > 1) {
foreach ($page_data['up'] as $page=>$offset) {
if ($offset === '...') { echo '...&nbsp;'; }
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 foreach up
?>

View file

@ -85,10 +85,12 @@ $title = scrub_out($album->name) . '&nbsp;(' . $album->year . ')' . $disk .'&nb
&nbsp;
</div>
<?php
Browse::set_type('song');
Browse::set_simple_browse(1);
Browse::set_filter('album', $album->id);
Browse::set_sort('track','ASC');
Browse::get_objects();
Browse::show_objects();
$browse = new Browse();
$browse->set_type('song');
$browse->set_simple_browse(true);
$browse->set_filter('album', $album->id);
$browse->set_sort('track', 'ASC');
$browse->get_objects();
$browse->show_objects();
$browse->store();
?>

View file

@ -25,7 +25,7 @@
<?php echo Ajax::button('?action=basket&type=album_random&id=' . $album->id,'random',_('Random'),'random_album_' . $album->id); ?>
</td>
<?php
if (Browse::is_enabled('show_art')) {
if (Art::is_enabled()) {
$name = '[' . $album->f_artist . '] ' . scrub_out($album->full_name);
?>
<td class="cel_cover">

View file

@ -26,7 +26,7 @@ $ajax_url = Config::get('ajax_url');
<table class="tabledata" cellpadding="0" cellspacing="0">
<colgroup>
<col id="col_add" />
<?php if (Browse::is_enabled('show_art')) { ?>
<?php if (Art::is_enabled()) { ?>
<col id="col_cover" />
<?php } ?>
<col id="col_album" />
@ -39,13 +39,13 @@ $ajax_url = Config::get('ajax_url');
</colgroup>
<tr class="th-top">
<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>
<?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_artist"><?php echo Ajax::text('?page=browse&action=set_sort&type=album&sort=artist',_('Artist'),'album_sort_artist'); ?></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&browse_id=' . $browse->id . '&sort=artist',_('Artist'),'album_sort_artist'); ?></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="col_rating"><?php echo _('Rating'); ?></th>
<th class="cel_action"><?php echo _('Actions'); ?></th>
@ -70,13 +70,13 @@ $ajax_url = Config::get('ajax_url');
<?php } ?>
<tr class="th-bottom">
<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>
<?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_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="col_rating"><?php echo _('Rating'); ?></th>
<th class="cel_action"><?php echo _('Actions'); ?></th>

View file

@ -22,6 +22,8 @@
$web_path = Config::get('web_path');
?>
<?php
$browse = new Browse();
$browse->set_type($object_type);
show_box_top($artist->f_name, 'info-box');
if (Config::get('ratings')) {
?>
@ -65,13 +67,12 @@ if (Config::get('ratings')) {
</li>
<?php } ?>
<li>
<input type="checkbox" id="show_artist_artCB" <?php echo $string = Browse::get_filter('show_art') ? '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','')); ?>
<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=show_art&browse_id=' . $browse->id,'')); ?>
</ul>
</div>
<?php show_box_bottom(); ?>
<?php
Browse::set_type($object_type);
Browse::reset();
Browse::show_objects($object_ids);
$browse->show_objects($object_ids);
$browse->store();
?>

View file

@ -25,7 +25,7 @@
</div> <!-- Close Now Playing Div -->
<!-- Randomly selected albums of the moment -->
<?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'));
?>
<div id="random_selection">

View file

@ -48,9 +48,12 @@
</div>
<?php show_box_bottom(); ?>
<?php
$catalog_ids = Catalog::get_catalogs();
Browse::set_type('catalog');
Browse::set_static_content(1);
Browse::show_objects($catalog_ids);
$catalog_ids = Catalog::get_catalogs();
$browse = new Browse();
$browse->set_type('catalog');
$browse->set_static_content(true);
$browse->save_objects($catalog_ids);
$browse->show_objects($catalog_ids);
$browse->store();
?>

View file

@ -73,7 +73,7 @@ $artist = scrub_out(truncate_with_ellipsis($media->f_artist_full));
</div>
</div>
<?php if (Browse::is_enabled('show_art')) { ?>
<?php if (Art::is_enabled()) { ?>
<div class="np_group">
<div class="np_cell cel_albumart">
<a target="_blank" href="<?php echo $web_path; ?>/image.php?id=<?php echo $media->album; ?>&amp;type=popup" onclick="popup_art('<?php echo $web_path; ?>/image.php?id=<?php echo $media->album; ?>&amp;type=popup'); return false;">

View file

@ -68,8 +68,10 @@ show_box_top('<div id="playlist_row_' . $playlist->id . '">' . $title .
</div>
<?php show_box_bottom(); ?>
<?php
Browse::set_type('playlist_song');
Browse::add_supplemental_object('playlist',$playlist->id);
Browse::set_static_content(1);
Browse::show_objects($object_ids);
$browse = new Browse();
$browse->set_type('playlist_song');
$browse->add_supplemental_object('playlist', $playlist->id);
$browse->set_static_content(true);
$browse->show_objects($object_ids);
$browse->store();
?>

View file

@ -101,10 +101,11 @@
<div id="browse">
<?php
if (is_array($object_ids)) {
Browse::reset_filters();
Browse::set_type('song');
Browse::save_objects($object_ids);
Browse::show_objects();
$browse = new Browse();
$browse->set_type('song');
$browse->save_objects($object_ids);
$browse->show_objects();
$browse->store();
echo Ajax::observe('window','load',Ajax::action('?action=refresh_rightbar','playlist_refresh_load'));
}
?>

View file

@ -33,7 +33,7 @@ $button = Ajax::button('?page=index&action=random_albums','random',_('Refresh'),
?>
<div class="random_album">
<a href="<?php echo $web_path; ?>/albums.php?action=show&amp;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&amp;id=<?php echo $album_id; ?>" width="80" height="80" alt="<?php echo $name; ?>" title="<?php echo $name; ?>" />
<?php } else { ?>
<?php echo '[' . $album->f_artist . '] ' . $album->f_name; ?>

View file

@ -25,12 +25,12 @@
<div id="information_actions">
<ul>
<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'); ?>
</li>
<?php if (Access::check_function('batch_download')) { ?>
<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'); ?>
</li>
<?php } ?>

View file

@ -38,12 +38,12 @@ $ajax_url = Config::get('ajax_url');
</colgroup>
<tr class="th-top">
<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_artist"><?php echo Ajax::text('?page=browse&action=set_sort&type=song&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_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&browse_id=' . $browse->id . '&sort=artist', _('Artist'), 'sort_song_artist'); ?></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_track"><?php echo Ajax::text('?page=browse&action=set_sort&type=song&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_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&browse_id=' . $browse->id . '&sort=time', _('Time'), 'sort_song_time'); ?></th>
<?php if (Config::get('ratings')) {
Rating::build_cache('song', $object_ids);
?>

View file

@ -24,7 +24,6 @@ $ajax_info = Config::get('ajax_url'); $web_path = Config::get('web_path');
<ul class="sb2" id="sb_home">
<li><h4><?php echo _('Browse'); ?></h4>
<?php
$allowed_filters = Browse::get_allowed_filters();
// Build the selected dealie
$text = scrub_in($_REQUEST['action']) . '_ac';
${$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>
</ul>
</li>
<?php if (count($allowed_filters)) { ?>
<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 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&amp;key=min_count&amp;type=<?php echo Browse::get_type(); ?>&amp;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&amp;type=<?php echo Browse::get_type(); ?>&amp;key=rated&amp;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 } ?>
<?php Ajax::start_container('browse_filters'); ?>
<?php Ajax::end_container(); ?>
<li><h4><?php echo _('Playlist'); ?></h4>
<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>