From fbab0ebea531927baf98e6144599057db464c49b Mon Sep 17 00:00:00 2001 From: Karl 'vollmerk' Vollmer Date: Wed, 21 Jun 2006 16:38:27 +0000 Subject: fixed nowplaying refresh issues and switched it to div layout --- config/ampache.cfg.php.dist | 9 ++- docs/CHANGELOG | 2 + index.php | 12 ++++ server/ajax.server.php | 3 + templates/basestyle.inc.php | 4 ++ templates/javascript_refresh.inc | 94 ---------------------------- templates/javascript_refresh.inc.php | 26 ++++++++ templates/show_now_playing.inc | 111 +++++++-------------------------- templates/show_now_playing_row.inc.php | 45 +++++++++++++ 9 files changed, 122 insertions(+), 184 deletions(-) delete mode 100644 templates/javascript_refresh.inc create mode 100644 templates/javascript_refresh.inc.php create mode 100644 templates/show_now_playing_row.inc.php diff --git a/config/ampache.cfg.php.dist b/config/ampache.cfg.php.dist index 12a0cd16..bb0adc7a 100644 --- a/config/ampache.cfg.php.dist +++ b/config/ampache.cfg.php.dist @@ -259,9 +259,16 @@ site_charset = iso-8859-1 # This is disabled by default, enabled only # if needed. It's specifically needed for Russian # so that is the default -# Default: cp1251 +# DEFAULT: cp1251 #lc_charset = cp1251 +# Refresh Limit +# This defines the default refresh limit in seconds for +# pages with dynamic content, such as now playing +# DEFAULT: 60 +# Possible Values: Int > 5 +refresh_limit = "60" + ########################################################## # Public Registration settings, defaults to disabled # ########################################################## diff --git a/docs/CHANGELOG b/docs/CHANGELOG index c0475e6b..651e168c 100755 --- a/docs/CHANGELOG +++ b/docs/CHANGELOG @@ -4,6 +4,8 @@ -------------------------------------------------------------------------- v.3.3.2-Beta3 + - Fixed Nowplaying, now div based layout and AJAX refreshed + based on config files refresh_limit - Moved /modules/init.php to /lib/init.php - Removed Checkboxes from Search page and added ability to search on Comment and Rating diff --git a/index.php b/index.php index 3ea40c23..6e0c0f56 100644 --- a/index.php +++ b/index.php @@ -31,6 +31,18 @@ require_once('lib/init.php'); show_template('header'); $action = scrub_in($_REQUEST['action']); + +/** + * 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('web_path') . '/server/ajax.server.php?action=reloadnp&user_id=' . $GLOBALS['user']->id . + '&sessid=' . session_id(); + $ajax_object = 'nowplaying'; + require_once(conf('prefix') . '/templates/javascript_refresh.inc.php'); +} ?> diff --git a/server/ajax.server.php b/server/ajax.server.php index 42189c6e..aa519c3f 100644 --- a/server/ajax.server.php +++ b/server/ajax.server.php @@ -57,6 +57,9 @@ switch ($action) { require_once(conf('prefix') . '/templates/show_localplay_switch.inc.php'); break; + case 'reloadnp': + show_now_playing(); + break; default: echo "Default Action"; break; diff --git a/templates/basestyle.inc.php b/templates/basestyle.inc.php index f9c1a88d..f08b1486 100644 --- a/templates/basestyle.inc.php +++ b/templates/basestyle.inc.php @@ -278,5 +278,9 @@ color: ; border:1px solid ; } + .np_cell { + float: left; + margin: 10px; + } --> diff --git a/templates/javascript_refresh.inc b/templates/javascript_refresh.inc deleted file mode 100644 index d8d56a67..00000000 --- a/templates/javascript_refresh.inc +++ /dev/null @@ -1,94 +0,0 @@ - - diff --git a/templates/javascript_refresh.inc.php b/templates/javascript_refresh.inc.php new file mode 100644 index 00000000..6fbdd9b6 --- /dev/null +++ b/templates/javascript_refresh.inc.php @@ -0,0 +1,26 @@ + + diff --git a/templates/show_now_playing.inc b/templates/show_now_playing.inc index 9aff071c..98fd71eb 100644 --- a/templates/show_now_playing.inc +++ b/templates/show_now_playing.inc @@ -19,101 +19,34 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/*! -@header Show Now Playing Ajax -*/ +/** + * This is the now playing container, it holds the master div for now playing + * and loops through what's current playing as passed and includes + * the now_playing_row's This will display regardless, but potentially + * goes all ajaxie if you've got javascript on + */ -// would change this to input some with the current now playing data. -// so this same script can be used even if the ajax doesnt refresh it. -$c=0; if (count($results)) { +?> +
+
+

+
+'; - if (!$np_user->fullname) { $np_user->fullname = "Unknown User"; } - if (conf('use_auth')) { $result = $result.''.$np_user->fullname.'';} - else { $result = $result.''; } -?> -
- - - - - -
- - - - - - - - - - -
- -
- fullname; } ?> -
-
- - - - -
- - Album Art - -
-
-
-fullname) { $np_user->fullname = "Unknown User"; } + + require(conf('prefix') . '/templates/show_now_playing_row.inc.php'); + +} // end foreach ?> - -
- + diff --git a/templates/show_now_playing_row.inc.php b/templates/show_now_playing_row.inc.php new file mode 100644 index 00000000..33ac673b --- /dev/null +++ b/templates/show_now_playing_row.inc.php @@ -0,0 +1,45 @@ + +
+
fullname); ?>
+ + + +
+ + Album Art + +
+ +
-- cgit