summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-09-28 05:39:50 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2006-09-28 05:39:50 +0000
commitebdb7573bf4176b81264d2c66dd567fa3c3ee0bd (patch)
treef16da64cdfec967a34bc71d5902ca59c64d7b9ac
parent6232e0f8d78c2555e64672341c54916cc0e8b3ed (diff)
downloadampache-ebdb7573bf4176b81264d2c66dd567fa3c3ee0bd.tar.gz
ampache-ebdb7573bf4176b81264d2c66dd567fa3c3ee0bd.tar.bz2
ampache-ebdb7573bf4176b81264d2c66dd567fa3c3ee0bd.zip
fixed up localplay a little more, to the point of it basicly working... added check for mysql on installer langue page, tweaked some css as well
-rwxr-xr-xdocs/CHANGELOG4
-rw-r--r--install.php6
-rw-r--r--lib/class/localplay.class.php61
-rw-r--r--lib/general.lib.php15
-rw-r--r--localplay.php10
-rw-r--r--modules/localplay/mpd.controller.php10
-rw-r--r--templates/default.css1
-rw-r--r--templates/show_localplay.inc.php21
-rw-r--r--templates/show_localplay_control.inc.php18
-rw-r--r--templates/show_localplay_status.inc.php39
10 files changed, 151 insertions, 34 deletions
diff --git a/docs/CHANGELOG b/docs/CHANGELOG
index d3c58f6e..6fdfd26b 100755
--- a/docs/CHANGELOG
+++ b/docs/CHANGELOG
@@ -4,6 +4,10 @@
--------------------------------------------------------------------------
v.3.3.2
+ - Added check for MySQL support to first install page, redirects
+ to /test.php if mysql support is non-existant
+ - Added ability to turn Random/Repeat on and off in localplay
+ and also improved localplay page a tiny bit.
- Fixed a problem with pagination on the admin/users.php page
- Added ability to turn on User/IP/Date Login history tracking
viewable only by Administrators
diff --git a/install.php b/install.php
index 44c4d17d..031654e4 100644
--- a/install.php
+++ b/install.php
@@ -224,6 +224,12 @@ switch ($action) {
break;
default:
+ /* Do some basic tests here... most common error, no mysql */
+ if (!function_exists('mysql_query')) {
+ header ("Location: test.php");
+ }
+
+
/* Show the language options first */
require_once('templates/show_install_lang.inc.php');
break;
diff --git a/lib/class/localplay.class.php b/lib/class/localplay.class.php
index 4d027579..488714ea 100644
--- a/lib/class/localplay.class.php
+++ b/lib/class/localplay.class.php
@@ -242,6 +242,43 @@ class Localplay {
} // add
+ /**
+ * repeat
+ * This turns the repeat feature of a localplay method on or
+ * off, takes a 0/1 value
+ */
+ function repeat($state) {
+
+ $function = $this->_function_map['repeat'];
+
+ $data = $this->_player->$function($state);
+
+ if (!$data) {
+ debug_event('localplay',"Error Unable to set Repeat to $state",'1');
+ }
+
+ return $data;
+
+ } // repeat
+
+ /**
+ * random
+ * This turns on the random feature of a localplay method
+ * It takes a 0/1 value
+ */
+ function random($state) {
+
+ $function = $this->_function_map['random'];
+
+ $data = $this->_player->$function($state);
+
+ if (!$data) {
+ debug_event('localplay',"Error Unable to set Random to $state",'1');
+ }
+
+ return $data;
+
+ } // random
/**
* status
@@ -485,6 +522,30 @@ class Localplay {
} // delete_all
+ /**
+ * get_user_state
+ * This function returns a user friendly version
+ * of the current player state
+ */
+ function get_user_state($state) {
+
+ switch ($state) {
+ case 'play':
+ return _('Now Playing');
+ break;
+ case 'stop':
+ return _('Stopped');
+ break;
+ case 'pause':
+ return _('Paused');
+ break;
+ default:
+ return _('Unknown');
+ break;
+ } // switch on state
+
+ } // get_user_state
+
} //end localplay class
?>
diff --git a/lib/general.lib.php b/lib/general.lib.php
index 7fcb86e9..13951642 100644
--- a/lib/general.lib.php
+++ b/lib/general.lib.php
@@ -944,4 +944,19 @@ function print_boolean($value) {
} // print_boolean
+/**
+ * invert_boolean
+ * This returns the opposite of what you've got
+ */
+function invert_boolean($value) {
+
+ if (make_bool($value)) {
+ return '0';
+ }
+ else {
+ return '1';
+ }
+
+} // invert_boolean
+
?>
diff --git a/localplay.php b/localplay.php
index adf2c2c9..0f593946 100644
--- a/localplay.php
+++ b/localplay.php
@@ -60,6 +60,16 @@ switch ($action) {
$body = '';
show_confirmation($title,$body,$url);
break;
+ case 'repeat':
+ $localplay = init_localplay();
+ $localplay->repeat(make_bool($_REQUEST['value']));
+ require_once (conf('prefix') . '/templates/show_localplay.inc.php');
+ break;
+ case 'random':
+ $localplay = init_localplay();
+ $localplay->random(make_bool($_REQUEST['value']));
+ require_once (conf('prefix') . '/templates/show_localplay.inc.php');
+ break;
default:
require_once (conf('prefix') . '/templates/show_localplay.inc.php');
break;
diff --git a/modules/localplay/mpd.controller.php b/modules/localplay/mpd.controller.php
index 3c99e63f..b195744e 100644
--- a/modules/localplay/mpd.controller.php
+++ b/modules/localplay/mpd.controller.php
@@ -72,8 +72,8 @@ class AmpacheMpd {
$map['pause'] = 'pause';
$map['volume_up'] = 'volume_up';
$map['volume_down'] = 'volume_down';
- $map['loop'] = 'loop';
$map['random'] = 'random';
+ $map['repeat'] = 'loop';
/* Optional Functions */
$map['move'] = 'move';
@@ -268,10 +268,10 @@ class AmpacheMpd {
* loop
* This tells MPD to set the repeating the playlist (i.e. loop) to either on or off
*/
- function loop($onoff) {
-
- if (is_null($this->_mpd->SetRepeat($onoff))) { return false; }
- return true;
+ function loop($state) {
+
+ if (is_null($this->_mpd->SetRepeat($state))) { return false; }
+ return true;
} // loop
diff --git a/templates/default.css b/templates/default.css
index 656a3cbf..bf7cce65 100644
--- a/templates/default.css
+++ b/templates/default.css
@@ -584,6 +584,7 @@ li.current-rating{
.np_row {
padding-top: 3px;
padding-bottom: 3px;
+ display: block;
}
.np_cell {
display: inline;
diff --git a/templates/show_localplay.inc.php b/templates/show_localplay.inc.php
index 72fa4c51..0ad5938c 100644
--- a/templates/show_localplay.inc.php
+++ b/templates/show_localplay.inc.php
@@ -24,15 +24,22 @@ $web_path = conf('web_path');
$localplay = init_localplay();
$songs = $localplay->get();
?>
-
<?php show_box_top(ucfirst($localplay->type) . ' ' . _('Localplay')); ?>
-<ul class="text-action">
-<?php if ($localplay->has_function('delete_all')) { ?>
- <li><a href="<?php echo $web_path; ?>/localplay.php?action=delete_all"><?php echo _('Clear Playlist'); ?></a></li>
-<?php } ?>
-</ul>
-<?php require_once(conf('prefix') . '/templates/show_localplay_status.inc.php'); ?>
+<table>
+<tr>
+ <td valign="top">
+ <strong><?php echo _('Actions'); ?>:</strong><br />
+ <?php if ($localplay->has_function('delete_all')) { ?>
+ &nbsp;&nbsp;&nbsp;<a href="<?php echo $web_path; ?>/localplay.php?action=delete_all"><?php echo _('Clear Playlist'); ?></a>
+ <?php } ?>
+ </td><td>
+ <?php require_once(conf('prefix') . '/templates/show_localplay_status.inc.php'); ?>
+ </td>
+</tr>
+</table>
<?php show_box_bottom(); ?>
+
+
<?php show_box_top(_('Current Playlist')); ?>
<table class="border" cellspacing="0" border="0">
<tr class="table-header">
diff --git a/templates/show_localplay_control.inc.php b/templates/show_localplay_control.inc.php
index b9558ade..fa11c700 100644
--- a/templates/show_localplay_control.inc.php
+++ b/templates/show_localplay_control.inc.php
@@ -27,7 +27,7 @@ $required_info = "&amp;user_id=" . $GLOBALS['user']->id . "&amp;sessid=" . sess
$ajax_url = $web_path . '/server/ajax.server.php';
?>
-<div class="localplaycontrol" style="display:table-cell;cursor:pointer;border:1px solid black;padding:2px;">
+<div class="localplaycontrol" style="display:table-cell;cursor:pointer;padding:2px;">
<?php if ($localplay->has_function('prev')) { ?>
<span id="prev_button" onclick="ajaxPut('<?php echo $ajax_url; ?>?action=localplay&amp;cmd=prev<?php echo $required_info; ?>','localplay_state');return true;">
<img src="<?php echo $web_path; ?>/images/localplay/prev.gif" alt="prev" />
@@ -49,20 +49,4 @@ $ajax_url = $web_path . '/server/ajax.server.php';
<img src="<?php echo $web_path; ?>/images/localplay/next.gif" alt="next" />
</span>
<?php } ?>
-<br />
-<?php if ($localplay->has_function('volume_up')) { ?>
-<span id="up_button" onclick="ajaxPut('<?php echo $ajax_url; ?>?action=localplay&amp;cmd=volume_up<?php echo $required_info; ?>','localplay_state');return true;">
- <img src="<?php echo $web_path; ?>/images/localplay/volup.gif" alt="volume up" />
-</span>
-<?php } ?>
-<?php if ($localplay->has_function('volume_down')) { ?>
-<span id="down_button" onclick="ajaxPut('<?php echo $ajax_url; ?>?action=localplay&amp;cmd=volume_down<?php echo $required_info; ?>','localplay_state');return true;">
- <img src="<?php echo $web_path; ?>/images/localplay/voldn.gif" alt="volume down" />
-</span>
-<?php } ?>
-<?php if ($localplay->has_function('volume_mute')) { ?>
-<span id="mute_button" onclick="ajaxPut('<?php echo $ajax_url; ?>?action=localplay&amp;cmd=volume_mute<?php echo $required_info; ?>','localplay_state');return true;">
- <img src="<?php echo $web_path; ?>/images/localplay/volmute.gif" alt="volume mute" />
-</span>
-<?php } ?>
</div>
diff --git a/templates/show_localplay_status.inc.php b/templates/show_localplay_status.inc.php
index c4352323..28918a35 100644
--- a/templates/show_localplay_status.inc.php
+++ b/templates/show_localplay_status.inc.php
@@ -36,9 +36,38 @@ $track_name = $status['track_artist'] . ' - ' . $status['track_album'] . ' - ' .
$track_name = ltrim(ltrim($track_name,' - '));
?>
-<?php echo _('State') .": ". ucfirst($status['state']); ?><br />
-<?php echo _('Repeat') . ":" . print_boolean($status['repeat']); ?>&nbsp;|&nbsp;
-<?php echo _('Random') . ":" . print_boolean($status['random']); ?><br />
-<?php echo _('Volume') . ":" . $status['volume']; ?><br />
+<strong><?php echo $localplay->get_user_state($status['state']) ?></strong><br />
+&nbsp;&nbsp;<?php echo '[' . $status['track'] . '] - ' . $track_name . '<br />'; ?>
+<div align="center"><?php require (conf('prefix') . '/templates/show_localplay_control.inc.php'); ?></div>
+<div align="center">
+ <?php if ($localplay->has_function('volume_up')) { ?>
+ <span id="up_button" onclick="ajaxPut('<?php echo $ajax_url; ?>?action=localplay&amp;cmd=volume_up<?php echo $required_info; ?>','localplay_state');return true;">
+ <img src="<?php echo $web_path; ?>/images/localplay/volup.gif" alt="volume up" />
+ </span>
+ <?php } ?>
+ <?php if ($localplay->has_function('volume_down')) { ?>
+ <span id="down_button" onclick="ajaxPut('<?php echo $ajax_url; ?>?action=localplay&amp;cmd=volume_down<?php echo $required_info; ?>','localplay_state');return true;">
+ <img src="<?php echo $web_path; ?>/images/localplay/voldn.gif" alt="volume down" />
+ </span>
+ <?php } ?>
+ <?php if ($localplay->has_function('volume_mute')) { ?>
+ <span id="mute_button" onclick="ajaxPut('<?php echo $ajax_url; ?>?action=localplay&amp;cmd=volume_mute<?php echo $required_info; ?>','localplay_state');return true;">
+ <img src="<?php echo $web_path; ?>/images/localplay/volmute.gif" alt="volume mute" />
+ </span>
+ <?php } ?>
+ <br />
+ <?php echo _('Volume') . ":" . $status['volume']; ?>
+</div>
<br />
-<span class="header2"><?php echo _('Now Playing') . '</span><br />[' . $status['track'] . '] - ' . $track_name . '<br />'; ?>
+<?php if ($localplay->has_function('repeat')) { ?>
+ <?php echo _('Repeat') . ":" . print_boolean($status['repeat']); ?> |
+ <a href="<?php echo $web_path; ?>/localplay.php?action=repeat&value=<?php echo invert_boolean($status['repeat']); ?>">
+ <?php echo print_boolean(invert_boolean($status['repeat'])); ?>
+ </a><br />
+ <?php } ?>
+<?php if ($localplay->has_function('random')) { ?>
+ <?php echo _('Random') . ":" . print_boolean($status['random']); ?> |
+ <a href="<?php echo $web_path; ?>/localplay.php?action=random&value=<?php echo invert_boolean($status['random']); ?>">
+ <?php echo print_boolean(invert_boolean($status['random'])); ?>
+ </a><br />
+<?php } ?>