summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-12-10 04:35:26 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-12-10 04:35:26 +0000
commit0d2c89e90d7c64eba058ae375760a350d336578b (patch)
treeab689e3d203db1e0b2cce5e44e9f42aa95d1aff9
parent17a4516e29e9ce9d2583d8b06431dfcdf5722c11 (diff)
downloadampache-0d2c89e90d7c64eba058ae375760a350d336578b.tar.gz
ampache-0d2c89e90d7c64eba058ae375760a350d336578b.tar.bz2
ampache-0d2c89e90d7c64eba058ae375760a350d336578b.zip
fixed the last of the missing MPD features, added new ajax config hotness (not that special)
-rwxr-xr-xdocs/CHANGELOG1
-rw-r--r--lib/class/ajax.class.php25
-rw-r--r--lib/class/localplay.class.php5
-rw-r--r--server/localplay.ajax.php29
-rw-r--r--templates/show_localplay_playlist.inc.php2
-rw-r--r--templates/show_localplay_status.inc.php22
6 files changed, 70 insertions, 14 deletions
diff --git a/docs/CHANGELOG b/docs/CHANGELOG
index 1488a22b..70379d82 100755
--- a/docs/CHANGELOG
+++ b/docs/CHANGELOG
@@ -4,6 +4,7 @@
--------------------------------------------------------------------------
v.3.4-Alpha4
+ - Fixed last of the missing MPD functionality (Volume & Playlist Clear)
- Fixed HTTPQ and improved parsing for urls from MPD & HTTPQ
they now reconize Democratic Playlists
- Added paging to genre sub-pages
diff --git a/lib/class/ajax.class.php b/lib/class/ajax.class.php
index e4e4baf8..1a064395 100644
--- a/lib/class/ajax.class.php
+++ b/lib/class/ajax.class.php
@@ -157,5 +157,30 @@ class Ajax {
} // run
+ /**
+ * start_container
+ * This checks to see if we're AJAX'in if we aren't then it echos out the
+ * html needed to start a container that can be replaced by Ajax
+ */
+ public static function start_container($name) {
+
+ if (AJAX_INCLUDE == '1') { return true; }
+
+ echo '<div id="' . scrub_out($name) . '">';
+
+ } // start_container
+
+ /**
+ * end_container
+ * This ends the container if we're not doing the AJAX thing
+ */
+ public static function end_container() {
+
+ if (AJAX_INCLUDE == '1') { return true; }
+
+ echo "</div>";
+
+ } // end_container
+
} // end Ajax class
?>
diff --git a/lib/class/localplay.class.php b/lib/class/localplay.class.php
index 02276b13..15f945f2 100644
--- a/lib/class/localplay.class.php
+++ b/lib/class/localplay.class.php
@@ -593,10 +593,7 @@ class Localplay {
*/
public function delete_all() {
-
- $function = $this->_function_map['delete_all'];
-
- if (!$this->_player->$function($songs)) {
+ if (!$this->_player->clear_playlist()) {
debug_event('localplay','Error: Unable to delete entire playlist, check ' . $this->type . ' controller','1');
return false;
}
diff --git a/server/localplay.ajax.php b/server/localplay.ajax.php
index cd3ed212..ad572d23 100644
--- a/server/localplay.ajax.php
+++ b/server/localplay.ajax.php
@@ -58,11 +58,28 @@ switch ($_REQUEST['action']) {
case 'stop':
case 'play':
case 'pause':
+ $command = scrub_in($_REQUEST['command']);
+ $localplay->$command();
+ break;
case 'volume_up':
case 'volume_down':
case 'volume_mute':
$command = scrub_in($_REQUEST['command']);
$localplay->$command();
+
+ // We actually want to refresh something here
+ ob_start();
+ require_once Config::get('prefix') . '/templates/show_localplay_status.inc.php';
+ $results['localplay_status'] = ob_get_contents();
+ ob_end_clean();
+ break;
+ case 'delete_all':
+ $localplay->delete_all();
+
+ ob_start();
+ require_once Config::get('prefix') . '/templates/show_localplay_playlist.inc.php';
+ $results['localplay_playlist'] = ob_get_contents();
+ ob_end_clean();
break;
case 'skip':
$localplay->skip(intval($_REQUEST['id']));
@@ -104,6 +121,12 @@ switch ($_REQUEST['action']) {
$localplay = new Localplay($GLOBALS['user']->prefs['localplay_controller']);
$localplay->connect();
$localplay->repeat(make_bool($_REQUEST['value']));
+
+ ob_start();
+ require_once Config::get('prefix') . '/templates/show_localplay_status.inc.php';
+ $results['localplay_status'] = ob_get_contents();
+ ob_end_clean();
+
break;
case 'random':
// Make sure that they have access to do this again no clue... seems
@@ -113,6 +136,12 @@ switch ($_REQUEST['action']) {
$localplay = new Localplay($GLOBALS['user']->prefs['localplay_controller']);
$localplay->connect();
$localplay->random(make_bool($_REQUEST['value']));
+
+ ob_start();
+ require_once Config::get('prefix') . '/templates/show_localplay_status.inc.php';
+ $results['localplay_status'] = ob_get_contents();
+ ob_end_clean();
+
break;
default:
$results['rfc3514'] = '0x1';
diff --git a/templates/show_localplay_playlist.inc.php b/templates/show_localplay_playlist.inc.php
index 10f8ecb9..e9806a02 100644
--- a/templates/show_localplay_playlist.inc.php
+++ b/templates/show_localplay_playlist.inc.php
@@ -19,6 +19,7 @@
*/
?>
+<?php Ajax::start_container('localplay_playlist'); ?>
<?php show_box_top(_('Current Playlist')); ?>
<table class="tabledata" cellpadding="0" cellspacing="0">
<colgroup>
@@ -59,3 +60,4 @@ foreach ($objects as $object) {
</tr>
</table>
<?php show_box_bottom(); ?>
+<?php Ajax::end_container(); ?>
diff --git a/templates/show_localplay_status.inc.php b/templates/show_localplay_status.inc.php
index 058b6f98..9da440aa 100644
--- a/templates/show_localplay_status.inc.php
+++ b/templates/show_localplay_status.inc.php
@@ -22,19 +22,21 @@
$status = $localplay->status();
?>
+<?php Ajax::start_container('localplay_status'); ?>
<?php show_box_top(_('Localplay Control')); ?>
-<span id="lp_state"><?php echo $localplay->get_user_state($status['state']) ?></span><br />
-<div id="lp_box_vol">
- <?php echo Ajax::button('?page=localplay&action=command&command=volume_up','volumeup',_('Increase Volume'),'localplay_volume_up'); ?>
- <?php echo Ajax::button('?page=localplay&action=command&command=volume_down','volumedn',_('Decrease Volume'),'localplay_volume_dn'); ?>
- <?php echo Ajax::button('?page=localplay&action=command&command=volume_mute','volumemute',_('Mute'),'localplay_mute'); ?>
- <?php echo _('Volume'); ?>:<span id="lp_volume"><?php echo $status['volume']; ?></span>
-</div>
+<strong><?php echo $localplay->get_user_state($status['state']) ?></strong><br />
+
+<?php echo Ajax::button('?page=localplay&action=command&command=volume_up','volumeup',_('Increase Volume'),'localplay_volume_up'); ?>
+<?php echo Ajax::button('?page=localplay&action=command&command=volume_down','volumedn',_('Decrease Volume'),'localplay_volume_dn'); ?>
+<?php echo Ajax::button('?page=localplay&action=command&command=volume_mute','volumemute',_('Mute'),'localplay_mute'); ?>
+<strong><?php echo _('Volume'); ?>:</strong><?php echo $status['volume']; ?>%
<br />
- <?php echo _('Repeat') . ":" . print_boolean($status['repeat']); ?> |
+ <strong><?php echo _('Repeat') . ":"; ?></strong> <?php echo print_boolean($status['repeat']); ?> |
<?php echo Ajax::text('?page=localplay&action=repeat&value=' . invert_boolean($status['repeat']),print_boolean(invert_boolean($status['repeat'])),'localplay_repeat'); ?>
- <br />
- <?php echo _('Random') . ":" . print_boolean($status['random']); ?> |
+
+ <strong><?php echo _('Random') . ":"; ?></strong> <?php echo print_boolean($status['random']); ?> |
<?php echo Ajax::text('?page=localplay&action=random&value=' . invert_boolean($status['random']),print_boolean(invert_boolean($status['random'])),'localplay_random'); ?>
<br />
+<?php echo Ajax::text('?page=localplay&action=command&command=delete_all',_('Clear Playlist'),'localplay_clear_all'); ?>
<?php show_box_bottom(); ?>
+<?php Ajax::end_container(); ?>