summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-10-02 04:14:41 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-10-02 04:14:41 +0000
commite496a54bfa8271e727410dc66a82992a89081283 (patch)
treec70986355f9b33210639b2b6ce294cb92c6664b3
parent7ddeb585a05051ce9750a1daff0e688c8b6e9371 (diff)
downloadampache-e496a54bfa8271e727410dc66a82992a89081283.tar.gz
ampache-e496a54bfa8271e727410dc66a82992a89081283.tar.bz2
ampache-e496a54bfa8271e727410dc66a82992a89081283.zip
fixed the localplay controls, per limeds recommendation currently under rightbar actions, not happy with location
-rwxr-xr-xdocs/CHANGELOG1
-rw-r--r--lib/class/localplay.class.php17
-rw-r--r--server/localplay.ajax.php23
-rw-r--r--templates/rightbar.inc.php1
-rw-r--r--templates/show_localplay_control.inc.php39
-rw-r--r--themes/classic/templates/default.css8
6 files changed, 44 insertions, 45 deletions
diff --git a/docs/CHANGELOG b/docs/CHANGELOG
index 36df5e8e..a88e57d3 100755
--- a/docs/CHANGELOG
+++ b/docs/CHANGELOG
@@ -4,6 +4,7 @@
--------------------------------------------------------------------------
v.3.4-Alpha3
+ - Fixed the Localplay Controls
- Fixed Gathering album art to only gather for changed albums
- Fixed display of catalog to correctly show catalog stats
- Gather album art now only gathers for the specified catalog
diff --git a/lib/class/localplay.class.php b/lib/class/localplay.class.php
index dc367b28..2b0d6b12 100644
--- a/lib/class/localplay.class.php
+++ b/lib/class/localplay.class.php
@@ -256,9 +256,7 @@ class Localplay {
*/
public function stop() {
- $function = $this->_function_map['stop'];
-
- if (!$this->_player->$function()) {
+ if (!$this->_player->stop()) {
debug_event('localplay','Error Unable to stop playback, check ' . $this->type . ' controller','1');
return false;
}
@@ -466,8 +464,6 @@ class Localplay {
*/
public function skip($song_id) {
- $function = $this->_function_map['skip'];
-
if (!$this->_player->$function($song_id)) {
debug_event('localplay','Error: Unable to skip to next song, check ' . $this->type . ' controller','1');
return false;
@@ -484,9 +480,7 @@ class Localplay {
*/
public function next() {
- $function = $this->_function_map['next'];
-
- if (!$this->_player->$function()) {
+ if (!$this->_player->next()) {
debug_event('localplay','Error: Unable to skip to next song, check ' . $this->type . ' controller','1');
return false;
}
@@ -502,9 +496,8 @@ class Localplay {
*/
public function prev() {
- $function = $this->_function_map['prev'];
- if (!$this->_player->$function()) {
+ if (!$this->_player->prev()) {
debug_event('localplay','Error: Unable to skip to previous song, check ' . $this->type . ' controller','1');
return false;
}
@@ -520,9 +513,7 @@ class Localplay {
*/
public function pause() {
- $function = $this->_function_map['pause'];
-
- if (!$this->_player->$function()) {
+ if (!$this->_player->pause()) {
debug_event('localplay','Error: Unable to pause song, check ' . $this->type . ' controller','1');
return false;
}
diff --git a/server/localplay.ajax.php b/server/localplay.ajax.php
index 5cc048f2..49212bfd 100644
--- a/server/localplay.ajax.php
+++ b/server/localplay.ajax.php
@@ -44,6 +44,29 @@ switch ($_REQUEST['action']) {
$results['sidebar'] = ob_get_contents();
ob_end_clean();
break;
+ case 'command':
+ // Make sure they are allowed to do this
+ // ok I still don't know what that means... but I'm thinking about it
+
+ $localplay = new Localplay($GLOBALS['user']->prefs['localplay_controller']);
+ $localplay->connect();
+
+ // Switch on valid commands
+ switch ($_REQUEST['command']) {
+ case 'prev':
+ case 'next':
+ case 'stop':
+ case 'play':
+ case 'pause':
+ $command = scrub_in($_REQUEST['command']);
+ $localplay->$command();
+ break;
+ default:
+ // Nothing
+ break;
+ } // end whitelist
+
+ break;
default:
$results['rfc3514'] = '0x1';
break;
diff --git a/templates/rightbar.inc.php b/templates/rightbar.inc.php
index 4e0fe287..a6f15779 100644
--- a/templates/rightbar.inc.php
+++ b/templates/rightbar.inc.php
@@ -70,6 +70,7 @@
</ul>
</li>
</ul>
+<?php if ($GLOBALS['user']->prefs['play_type'] == 'localplay') { require_once Config::get('prefix') . '/templates/show_localplay_control.inc.php'; } ?>
<ul id="rb_current_playlist">
<?php
//FIXME :: this feels kludgy
diff --git a/templates/show_localplay_control.inc.php b/templates/show_localplay_control.inc.php
index 8d5f7fec..4962a8a0 100644
--- a/templates/show_localplay_control.inc.php
+++ b/templates/show_localplay_control.inc.php
@@ -1,7 +1,7 @@
<?php
/*
- Copyright (c) 2001 - 2006 Ampache.org
+ Copyright (c) 2001 - 2007 Ampache.org
All rights reserved.
This program is free software; you can redistribute it and/or
@@ -20,36 +20,11 @@
*/
-$web_path = conf('web_path');
-$localplay = init_localplay();
-
-$required_info = conf('ajax_info') . $add_info;
-$ajax_url = conf('ajax_url');
-
-/* If we actually got something back */
-if (is_object($localplay)) {
?>
-<div class="localplaycontrol" style="display:table-cell;cursor:pointer;padding:2px;">
-<?php if ($localplay->has_function('prev')) { ?>
-<span class="prev_button" onclick="ajaxPut('<?php echo $ajax_url; ?>?action=localplay&amp;cmd=prev<?php echo $required_info; ?>');return true;">
- <?php echo get_user_icon('prev','prev_hover'); ?>
-</span>
-<?php } ?>
-<span class="stop_button" onclick="ajaxPut('<?php echo $ajax_url; ?>?action=localplay&amp;cmd=stop<?php echo $required_info; ?>');return true;">
- <?php echo get_user_icon('stop','stop_hover'); ?>
-</span>
-<?php if ($localplay->has_function('pause')) { ?>
-<span class="pause_button" onclick="ajaxPut('<?php echo $ajax_url; ?>?action=localplay&amp;cmd=pause<?php echo $required_info; ?>');return true;">
- <?php echo get_user_icon('pause','pause_hover'); ?>
-</span>
-<?php } ?>
-<span class="play_button" onclick="ajaxPut('<?php echo $ajax_url; ?>?action=localplay&amp;cmd=play<?php echo $required_info; ?>');return true;">
- <?php echo get_user_icon('play','play_hover'); ?>
-</span>
-<?php if ($localplay->has_function('next')) { ?>
-<span class="next_button" onclick="ajaxPut('<?php echo $ajax_url; ?>?action=localplay&amp;cmd=next<?php echo $required_info; ?>');return true;">
- <?php echo get_user_icon('next','next_hover'); ?>
-</span>
-<?php } ?>
+<div id="localplay-control">
+<?php echo Ajax::button('?page=localplay&action=command&command=prev','prev',_('Previous'),'localplay_control_previous'); ?>
+<?php echo Ajax::button('?page=localplay&action=command&command=stop','stop',_('Stop'),'localplay_control_stop'); ?>
+<?php echo Ajax::button('?page=localplay&action=command&command=pause','pause',_('Pause'),'localplay_control_pause'); ?>
+<?php echo Ajax::button('?page=localplay&action=command&command=play','play',_('Play'),'localplay_control_play'); ?>
+<?php echo Ajax::button('?page=localplay&action=command&command=next','next',_('Next'),'localplay_control_next'); ?>
</div>
-<?php } // End if localplay object ?>
diff --git a/themes/classic/templates/default.css b/themes/classic/templates/default.css
index aea53c4c..3b6ab80d 100644
--- a/themes/classic/templates/default.css
+++ b/themes/classic/templates/default.css
@@ -226,6 +226,14 @@ h3#content_title span {
#rightbar #rb_current_playlist li a { display:block; padding:0.2em;}
#rightbar .delitem { position:absolute;right:0;top:0; }
+/* Rightbar Localplay Controls */
+#rightbar #localplay-control {
+ padding-left: 5px;
+}
+#localplay-control span {
+ cursor: pointer;
+}
+
/************************************************/
/* Sidebar */
/************************************************/