summaryrefslogtreecommitdiffstats
path: root/lib/class
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-10-18 05:52:06 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-10-18 05:52:06 +0000
commitf64a2f4d00b801408b558917bae8f6a428931fe7 (patch)
tree3640a6ac0a94c00d021835a6cf94d83ec7377ccb /lib/class
parent15c56f21f2a74c8d25e8d74b2cc4b4020e9db74f (diff)
downloadampache-f64a2f4d00b801408b558917bae8f6a428931fe7.tar.gz
ampache-f64a2f4d00b801408b558917bae8f6a428931fe7.tar.bz2
ampache-f64a2f4d00b801408b558917bae8f6a428931fe7.zip
fixed admin prefs, flushed out localplay stuff, tweaked filters on browse
Diffstat (limited to 'lib/class')
-rw-r--r--lib/class/ajax.class.php6
-rw-r--r--lib/class/browse.class.php14
-rw-r--r--lib/class/localplay.abstract.php2
-rw-r--r--lib/class/localplay.class.php45
4 files changed, 25 insertions, 42 deletions
diff --git a/lib/class/ajax.class.php b/lib/class/ajax.class.php
index f5984912..e4e4baf8 100644
--- a/lib/class/ajax.class.php
+++ b/lib/class/ajax.class.php
@@ -82,12 +82,6 @@ class Ajax {
$source_txt = "'$source'";
}
- /*
- Replaces ampersand with &amp; for w3c conformance.
- Fixme: ajax doesn't seem to work anymore with this...
- */
- //$url = htmlspecialchars($url);
-
if ($post) {
$ajax_string = "ajaxPost('$url','$post',$source_txt)";
}
diff --git a/lib/class/browse.class.php b/lib/class/browse.class.php
index fbcc2948..cb8acbb7 100644
--- a/lib/class/browse.class.php
+++ b/lib/class/browse.class.php
@@ -78,6 +78,20 @@ class Browse {
} // set_filter
/**
+ * reset_filter
+ * This is a wrapper function that resets the filters
+ */
+ public static function reset_filters() {
+
+ if (!is_array($_SESSION['browse']['filter'])) { return true; }
+
+ foreach ($_SESSION['browse']['filter'] AS $key=>$value) {
+ self::set_filter($key,'');
+ }
+
+ } // reset_filters
+
+ /**
* get_filter
* returns the specified filter value
*/
diff --git a/lib/class/localplay.abstract.php b/lib/class/localplay.abstract.php
index 12df43cb..0d870b05 100644
--- a/lib/class/localplay.abstract.php
+++ b/lib/class/localplay.abstract.php
@@ -26,7 +26,7 @@ abstract class localplay_controller {
// Required Functions
abstract public function add($objects); // Takes an array of song_ids
- abstract public function delete($objects); // Takes an array of song_ids
+ abstract public function delete_track($object_id); // Takes a single object_id and removes it from the playlist
abstract public function play();
abstract public function stop();
abstract public function get();
diff --git a/lib/class/localplay.class.php b/lib/class/localplay.class.php
index 6f996e3f..7b2ffbd6 100644
--- a/lib/class/localplay.class.php
+++ b/lib/class/localplay.class.php
@@ -120,22 +120,6 @@ class Localplay {
} // _load_player
/**
- * has_function
- * This is used to check the function map and see if the current
- * player type supports the indicated function.
- */
- public function has_function($function_name) {
-
- /* Check the function map, if it's got a value it must
- * be possible
- */
- if (strlen($this->_function_map[$function_name]) > 0) { return true; }
-
- return false;
-
- } // has_function
-
- /**
* format_name
* This function takes the track name and checks to see if 'skip'
* is supported in the current player, if so it returns a 'skip to'
@@ -144,13 +128,7 @@ class Localplay {
public function format_name($name,$id) {
$name = scrub_out($name);
-
- if ($this->has_function('skip')) {
- $url = conf('ajax_url') . "?action=localplay&amp;cmd=skip&amp;value=$id" . conf('ajax_info');
-
- $name = "<span style=\"cursor:pointer;text-decoration:underline;\" onclick=\"ajaxPut('$url');return true;\">$name</span>";
- }
-
+ $name = Ajax::text('?page=localplay&action=command&command=skip&id=' . $id,$name,'localplay_skip_' . $id);
return $name;
} // format_name
@@ -385,10 +363,8 @@ class Localplay {
*/
public function get() {
- $function = $this->_function_map['get'];
-
- $data = $this->_player->$function();
-
+ $data = $this->_player->get();
+
if (!count($data) OR !is_array($data)) {
debug_event('localplay','Error Unable to get song info, check ' . $this->type . ' controller','1');
return array();
@@ -481,9 +457,9 @@ class Localplay {
* skip
* This isn't a required function, it tells the daemon to skip to the specified song
*/
- public function skip($song_id) {
+ public function skip($track_id) {
- if (!$this->_player->$function($song_id)) {
+ if (!$this->_player->skip($track_id)) {
debug_event('localplay','Error: Unable to skip to next song, check ' . $this->type . ' controller','1');
return false;
}
@@ -608,14 +584,13 @@ class Localplay {
} // set_active_instance
/**
- * delete
- * This removes songs from the players playlist as defined get function
+ * delete_track
+ * This removes songs from the players playlist it takes a single ID as provided
+ * by the get command
*/
- public function delete($songs) {
+ public function delete_track($object_id) {
- $function = $this->_function_map['delete'];
-
- if (!$this->_player->$function($songs)) {
+ if (!$this->_player->delete_track($object_id)) {
debug_event('localplay','Error: Unable to remove songs, check ' . $this->type . ' controller','1');
return false;
}