summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-11-10 19:05:42 +0000
committerKarl 'vollmerk' Vollmer <vollmer@ampache.org>2007-11-10 19:05:42 +0000
commit0e26226af811a2a92c300ff28f3aa1ad47ae19f0 (patch)
treeb5c083da4160cc61d0ac3aec21d9129f54f49937
parent7114792a08c65a5429bfdf6bfaba267b9f88b019 (diff)
downloadampache-0e26226af811a2a92c300ff28f3aa1ad47ae19f0.tar.gz
ampache-0e26226af811a2a92c300ff28f3aa1ad47ae19f0.tar.bz2
ampache-0e26226af811a2a92c300ff28f3aa1ad47ae19f0.zip
initial work on democratic play, not finished, added drop down select for playtype switching back in, thinking about changing it and making it a row of icons... not sure
-rw-r--r--democratic.php26
-rwxr-xr-xdocs/CHANGELOG1
-rw-r--r--lib/class/democratic.class.php69
-rw-r--r--random.php1
-rw-r--r--server/stream.ajax.php10
-rw-r--r--templates/csshover2.htc (renamed from csshover2.htc)0
-rw-r--r--templates/header.inc.php3
-rw-r--r--templates/show_democratic.inc.php27
-rw-r--r--templates/show_democratic_playlist.inc.php (renamed from templates/show_tv_playlist.inc.php)4
-rw-r--r--templates/show_playtype_switch.inc.php24
-rw-r--r--templates/show_tv.inc.php68
-rw-r--r--templates/sidebar_home.inc.php8
-rw-r--r--themes/classic/templates/default.css7
-rw-r--r--themes/greysme/templates/default.css7
14 files changed, 158 insertions, 97 deletions
diff --git a/democratic.php b/democratic.php
index e41fb0e3..e14cc17a 100644
--- a/democratic.php
+++ b/democratic.php
@@ -1,12 +1,12 @@
<?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
modify it under the terms of the GNU General Public License v2
- as published by the Free Software Foundation
+ 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
@@ -18,22 +18,19 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-require_once('lib/init.php');
-$dbh = dbh();
-$web_path = conf('web_path');
+require_once 'lib/init.php';
/* Make sure they have access to this */
-if (!conf('allow_democratic_playback')) {
+if (!Config::get('allow_democratic_playback')) {
access_denied();
exit;
}
-/* Clean up the stuff we need */
-$action = scrub_in($_REQUEST['action']);
+show_header();
-
-switch ($action) {
+// Switch on their action
+switch ($_REQUEST['action']) {
case 'create_playlist':
/* Only Admins Here */
if (!$GLOBALS['user']->has_access(100)) {
@@ -77,6 +74,9 @@ switch ($action) {
$stream->start();
if ($stream_type != 'localplay') { exit; }
break;
+ case 'manage_playlists':
+
+ break;
case 'update_playlist':
/* Only Admins Here */
if (!$GLOBALS['user']->has_access(100)) {
@@ -85,11 +85,11 @@ switch ($action) {
}
$tmp_playlist = new tmpPlaylist($_REQUEST['tmp_playlist_id']);
$tmp_playlist->update_playlist($_REQUEST['playlist_id']);
- /* Display the default tv page */
+ case 'show_playlist':
default:
- $tmp_playlist = get_democratic_playlist('-1');
+ $tmp_playlist = Democratic::get_current_playlist();
$songs = $tmp_playlist->get_items();
- require_once(conf('prefix') . '/templates/show_tv.inc.php');
+ require_once Config::get('prefix') . '/templates/show_democratic.inc.php';
break;
} // end switch on action
diff --git a/docs/CHANGELOG b/docs/CHANGELOG
index ebe98a15..5d91af9e 100755
--- a/docs/CHANGELOG
+++ b/docs/CHANGELOG
@@ -4,6 +4,7 @@
--------------------------------------------------------------------------
v.3.4-Alpha3
+ - Added Play Select drop down back in
- Fixed ordering of catalogs
- Fixed multi-genre Random Play
- New Version of Flash player fixes playlist repeat bug (Thx hugoh)
diff --git a/lib/class/democratic.class.php b/lib/class/democratic.class.php
new file mode 100644
index 00000000..f1955aed
--- /dev/null
+++ b/lib/class/democratic.class.php
@@ -0,0 +1,69 @@
+<?php
+/*
+
+ Copyright (c) 2001 - 2007 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.
+
+*/
+
+/**
+ * Democratic
+ * This class handles democratic play, which is a fancy
+ * name for voting based playback. This uses the tmp playlist
+ * heavily
+ */
+class Democratic {
+
+ /**
+ * Constructor
+ * This doesn't do anything currently
+ */
+ public function __construct() {
+
+ return true;
+
+ } // Constructor
+
+ /**
+ * get_playlists
+ * This returns all of the current valid 'Democratic' Playlists
+ * that have been created.
+ */
+ public static function get_playlists() {
+
+
+
+ } // get_playlists
+
+ /**
+ * get_current_playlist
+ * This returns the curren users current playlist, or if specified
+ * this current playlist of the user
+ */
+ public static function get_current_playlist($user_id='') {
+
+ // If not passed user global
+ $user_id = $user_id ? $user_id : $GLOBALS['user']->id;
+
+
+ $object = new tmpPlaylist($playlist_id);
+
+ return $object;
+
+ } // get_playlist
+
+} // Democratic class
+?>
diff --git a/random.php b/random.php
index 237f7c03..883c194f 100644
--- a/random.php
+++ b/random.php
@@ -32,7 +32,6 @@ switch ($_REQUEST['action']) {
foreach ($object_ids as $object_id) {
$GLOBALS['user']->playlist->add_object($object_id,'song');
}
- // We need to refresh the playlist
case 'advanced':
default:
diff --git a/server/stream.ajax.php b/server/stream.ajax.php
index be29a545..7996b676 100644
--- a/server/stream.ajax.php
+++ b/server/stream.ajax.php
@@ -25,6 +25,16 @@
if (AJAX_INCLUDE != '1') { exit; }
switch ($_REQUEST['action']) {
+ case 'set_play_type':
+ // Make sure they have the rights to do this
+ if (!Preference::has_access('play_type')) {
+ $results['rfc3514'] = '0x1';
+ break;
+ }
+
+ // Go ahead and update their preference
+ Preference::update('play_type',$GLOBALS['user']->id,$_POST['type']);
+ break;
case 'basket':
// We need to set the basket up!
$_SESSION['iframe']['target'] = Config::get('web_path') . '/stream.php?action=basket';
diff --git a/csshover2.htc b/templates/csshover2.htc
index e2dcced3..e2dcced3 100644
--- a/csshover2.htc
+++ b/templates/csshover2.htc
diff --git a/templates/header.inc.php b/templates/header.inc.php
index c6400ada..60a7b473 100644
--- a/templates/header.inc.php
+++ b/templates/header.inc.php
@@ -66,8 +66,9 @@ if (Config::get('use_rss')) { ?>
</h1>
<div id="headerbox">
<?php show_box_top('','box box_headerbox'); ?>
- <span id="loginInfo"><?php echo _('You are currently logged in as') . " " . $GLOBALS['user']->fullname; ?></span>
<?php require_once Config::get('prefix') . '/templates/show_search_bar.inc.php'; ?>
+ <?php require_once Config::get('prefix') . '/templates/show_playtype_switch.inc.php'; ?>
+ <span id="loginInfo"><?php echo $GLOBALS['user']->fullname; ?> [<a href="<?php echo Config::get('web_path'); ?>/logout.php"><?php echo _('Log out'); ?></a>]</span>
<?php show_box_bottom(); ?>
</div> <!-- End headerbox -->
</div><!-- End header -->
diff --git a/templates/show_democratic.inc.php b/templates/show_democratic.inc.php
new file mode 100644
index 00000000..dc3972ba
--- /dev/null
+++ b/templates/show_democratic.inc.php
@@ -0,0 +1,27 @@
+<?php
+/*
+
+ Copyright (c) 2001 - 2007 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.
+
+*/
+
+show_box_top(_('Current Playlist'));
+?>
+<div id="democratic_playlist">
+<?php require_once Config::get('prefix') . '/templates/show_democratic_playlist.inc.php'; ?>
+</div>
+<?php show_box_bottom(); ?>
diff --git a/templates/show_tv_playlist.inc.php b/templates/show_democratic_playlist.inc.php
index f6fb87bb..4838457b 100644
--- a/templates/show_tv_playlist.inc.php
+++ b/templates/show_democratic_playlist.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
@@ -18,8 +18,6 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-/* Some defaults */
-$web_path = conf('web_path');
?>
<table class="tabledata" cellpadding="0" cellspacing="0">
<colgroup>
diff --git a/templates/show_playtype_switch.inc.php b/templates/show_playtype_switch.inc.php
index 3f30002f..406329e5 100644
--- a/templates/show_playtype_switch.inc.php
+++ b/templates/show_playtype_switch.inc.php
@@ -6,8 +6,8 @@
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation; either version 2
- of the License, or (at your option) any later version.
+ as published by the Free Software Foundation; Version 2 of the
+ licence.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -22,20 +22,26 @@
<?php
$name = "is_" . $GLOBALS['user']->prefs['play_type'];
${$name} = 'selected="selected" ';
-if (has_preference_access('play_type')){
+
+if (Preference::has_access('play_type')) {
?>
-<!--<select id="play_type_switch" style="font-size:0.9em;" name="type"> -->
-<select id="play_type_switch" name="type" onchange="ajaxPut('<?php echo $ajax_url; ?>?action=change_play_type<?php echo $required_info; ?>');return true;">
+<div id="play_type_switch">
+<form method="post" id="play_type_form" action="javascript.void(0);">
+<select id="play_type_select" name="type">
<?php if (Config::get('allow_stream_playback')) { ?>
<option value="stream" <?php echo $is_stream; ?>><?php echo _('Stream'); ?></option>
<?php } if (Config::get('allow_localplay_playback')) { ?>
<option value="localplay" <?php echo $is_localplay; ?>><?php echo _('Localplay'); ?></option>
- <?php } if (Config::get('allow_downsample_playback')) { ?>
- <option value="downsample" <?php echo $is_downsample; ?>><?php echo _('Downsample'); ?></option>
<?php } if (Config::get('allow_democratic_playback')) { ?>
<option value="democratic" <?php echo $is_democratic; ?>><?php echo _('Democratic'); ?></option>
<?php } ?>
- <option value="xspf_player" <?php echo $is_xspf_player; ?>><?php echo _('XSPF Player'); ?></option>
+ <option value="xspf_player" <?php echo $is_xspf_player; ?>><?php echo _('Flash Player'); ?></option>
</select>
+<?php echo Ajax::observe('play_type_select','change',Ajax::action('?page=stream&action=set_play_type','play_type_select','play_type_form'),'1'); ?>
+</form>
<?php
-} else { echo ucwords($GLOBALS['user']->prefs['play_type']);}
+} // if they have access
+// Else just show what it currently is
+else { echo ucwords($GLOBALS['user']->prefs['play_type']);}
+?>
+</div>
diff --git a/templates/show_tv.inc.php b/templates/show_tv.inc.php
deleted file mode 100644
index c01517ed..00000000
--- a/templates/show_tv.inc.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-/*
-
- Copyright (c) 2001 - 2006 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.
-
-*/
-
-$htmllang = str_replace("_","-",conf('lang'));
-$location = get_location();
-
-show_template('header');
-
-/**
- * Check for the refresh mojo, if it's there then require the
- * refresh_javascript include. Must be greater then 5, I'm not
- * going to let them break their servers
- */
-if (conf('refresh_limit') > 5) {
- $ajax_url = conf('ajax_url') . '?action=reload_np_tv' . conf('ajax_info');
- /* Can't have the &amp; stuff in the Javascript */
- $ajax_url = str_replace("&amp;","&",$ajax_url);
- require_once(conf('prefix') . '/templates/javascript_refresh.inc.php');
-}
-
-?>
-<!-- Left Col -->
-<div id="tv_left">
-<?php show_box_top(_('Controls')); ?>
-<!-- Control DIV -->
-<div id="tv_control">
-<?php
-/* If they are a admin */
-if ($GLOBALS['user']->has_access(100)) {
- require_once(conf('prefix') . '/templates/show_tv_adminctl.inc.php');
-}
-/* Else normal User */
-else {
-
-}
-?>
-</div>
-<?php show_box_bottom(); ?>
-<?php show_box_top(_('Current Playlist')); ?>
-<div id="tv_playlist">
-<?php require_once(conf('prefix') . '/templates/show_tv_playlist.inc.php'); ?>
-</div>
-<?php show_box_bottom(); ?>
-<!-- End of Left -->
-</div>
-<?php show_box_top(_('Now Playing')); ?>
-<div id="tv_np">
-<?php require_once(conf('prefix') . '/templates/show_tv_nowplaying.inc.php'); ?>
-</div>
-<?php show_box_bottom(); ?>
diff --git a/templates/sidebar_home.inc.php b/templates/sidebar_home.inc.php
index 62cf9a37..840fbfe1 100644
--- a/templates/sidebar_home.inc.php
+++ b/templates/sidebar_home.inc.php
@@ -6,6 +6,14 @@
<li id="sb_home_info_AddStationRadio"><a href="<?php echo $web_path; ?>/radio.php?action=show_create"><?php echo _('Add Radio Station'); ?></a></li>
</ul>
</li>
+<?php if (Config::get('allow_democratic_playback')) { ?>
+ <li><h4><?php echo _('Democratic'); ?></h4>
+ <ul class="sb3" id="sb_home_democratic">
+ <li id="sb_home_democratic_playlist"><a href="<?php echo $web_path; ?>/democratic.php?action=show_playlist"><?php echo _('Show Playlist'); ?></a></li>
+ <li id="sb_home_democratic_playlist"><a href="<?php echo $web_path; ?>/democratic.php?action=manage_playlists"><?php echo _('Manage Playlist'); ?></a></li>
+ </ul>
+ </li>
+<?php } ?>
<li><h4><?php echo _('Random'); ?></h4>
<ul class="sb3" id="sb_home_random">
<li id="sb_home_random_album"><?php echo Ajax::text('?page=random&action=album',_('Album'),'home_random_album'); ?></li>
diff --git a/themes/classic/templates/default.css b/themes/classic/templates/default.css
index 5778cc49..82825cec 100644
--- a/themes/classic/templates/default.css
+++ b/themes/classic/templates/default.css
@@ -70,7 +70,7 @@ input {
/* IE6 behaviors */
/* - csshover2: :hover support on any element */
/************************************************/
-body { behavior:url("csshover2.htc"); }
+body { behavior:url("templates/csshover2.htc"); }
/************************************************/
/* XSPF Player */
@@ -97,6 +97,11 @@ body { behavior:url("csshover2.htc"); }
.box_headerbox {display:table;}
.box_headerbox #loginInfo {font-weight:bold;display:block;text-align:right;margin-bottom:.3em;}
+#play_type_switch {
+ float:left;
+ margin-top:2px;
+}
+
/************************************************/
/* Footer */
/************************************************/
diff --git a/themes/greysme/templates/default.css b/themes/greysme/templates/default.css
index 308972a8..32dcc736 100644
--- a/themes/greysme/templates/default.css
+++ b/themes/greysme/templates/default.css
@@ -87,7 +87,7 @@ textarea { background-color: #111; color: #e9ad51; }
/* IE6 behaviors */
/* - csshover2: :hover support on any element */
/************************************************/
-body { behavior:url("csshover2.htc"); }
+body { behavior:url("templates/csshover2.htc"); }
/************************************************/
/* XSPF Player */
@@ -108,6 +108,11 @@ body { behavior:url("csshover2.htc"); }
#headerlogo a { }
.box_topbarright {display:table;}
+#play_type_switch {
+ float:left;
+ margin-top:2px;
+}
+
/************************************************/
/* Footer */
/************************************************/