1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-04 18:29:40 +02:00

added paging to the localplay playlist, fixed some preferences issues I introduced with the form register and caching

This commit is contained in:
Karl 'vollmerk' Vollmer 2008-08-05 01:46:01 +00:00
parent f3b10721ac
commit 0dbace41fe
6 changed files with 35 additions and 12 deletions

View file

@ -4,6 +4,7 @@
-------------------------------------------------------------------------- --------------------------------------------------------------------------
v.3.5-Alpha1 v.3.5-Alpha1
- Added paging to the localplay playlist
- Updated German Translation (Thx Laurent) - Updated German Translation (Thx Laurent)
- Fixed issue where Remote songs would never be removed from - Fixed issue where Remote songs would never be removed from
the democratic playlist the democratic playlist

View file

@ -196,6 +196,7 @@ class Browse {
case 'album': case 'album':
case 'artist': case 'artist':
case 'tag': case 'tag':
case 'playlist_localplay':
case 'shoutbox': case 'shoutbox':
case 'live_stream': case 'live_stream':
// Set it // Set it
@ -215,7 +216,6 @@ class Browse {
// Rien a faire // Rien a faire
break; break;
} // end type whitelist } // end type whitelist
} // set_type } // set_type
/** /**
@ -790,7 +790,7 @@ class Browse {
* and requires the correct template based on the * and requires the correct template based on the
* type that we are currently browsing * type that we are currently browsing
*/ */
public static function show_objects($object_ids='', $ajax=false) { public static function show_objects($object_ids=false, $ajax=false) {
$object_ids = $object_ids ? $object_ids : self::get_saved(); $object_ids = $object_ids ? $object_ids : self::get_saved();
@ -818,7 +818,7 @@ class Browse {
Ajax::start_container('browse_content'); Ajax::start_container('browse_content');
// Switch on the type of browsing we're doing // Switch on the type of browsing we're doing
switch ($_SESSION['browse']['type']) { switch (self::$type) {
case 'song': case 'song':
show_box_top(_('Songs') . $match, $class); show_box_top(_('Songs') . $match, $class);
Song::build_cache($object_ids); Song::build_cache($object_ids);
@ -857,6 +857,11 @@ class Browse {
require_once Config::get('prefix') . '/templates/show_playlist_songs.inc.php'; require_once Config::get('prefix') . '/templates/show_playlist_songs.inc.php';
show_box_bottom(); show_box_bottom();
break; break;
case 'playlist_localplay':
show_box_top(_('Current Playlist'));
require_once Config::get('prefix') . '/templates/show_localplay_playlist.inc.php';
show_box_bottom();
break;
case 'catalog': case 'catalog':
show_box_top(_('Catalogs'), $class); show_box_top(_('Catalogs'), $class);
require_once Config::get('prefix') . '/templates/show_catalogs.inc.php'; require_once Config::get('prefix') . '/templates/show_catalogs.inc.php';

View file

@ -66,6 +66,7 @@ class Preference {
$sql = "UPDATE `user_preference` SET `value`='$value' " . $sql = "UPDATE `user_preference` SET `value`='$value' " .
"WHERE `preference`='$id'$user_check"; "WHERE `preference`='$id'$user_check";
$db_results = Dba::query($sql); $db_results = Dba::query($sql);
Preference::clear_from_session();
return true; return true;
} }
else { else {
@ -337,6 +338,17 @@ class Preference {
} // load_from_session } // load_from_session
/**
* clear_from_session
* This clears the users preferences, this is done whenever modifications are made to the preferences
* or the admin resets something
*/
public static function clear_from_session() {
unset($_SESSION['userdata']['preferences']);
} // clear_from_session
/** /**
* init * init
* This grabs the preferences and then loads them into conf it should be run on page load * This grabs the preferences and then loads them into conf it should be run on page load

View file

@ -76,6 +76,9 @@ function update_preferences($pref_id=0) {
} // end foreach preferences } // end foreach preferences
// Now that we've done that we need to invalidate the cached preverences
Preference::clear_from_session();
} // update_preferences } // update_preferences
/** /**

View file

@ -81,7 +81,10 @@ switch ($_REQUEST['action']) {
// Pull the current playlist and require the template // Pull the current playlist and require the template
$objects = $localplay->get(); $objects = $localplay->get();
require_once Config::get('prefix') . '/templates/show_localplay_status.inc.php'; require_once Config::get('prefix') . '/templates/show_localplay_status.inc.php';
require_once Config::get('prefix') . '/templates/show_localplay_playlist.inc.php'; Browse::set_type('playlist_localplay');
Browse::set_static_content(1);
Browse::save_objects($objects);
Browse::show_objects();
break; break;
} // end switch action } // end switch action

View file

@ -1,7 +1,7 @@
<?php <?php
/* /*
Copyright (c) 2001 - 2007 Ampache.org Copyright (c) Ampache.org
All rights reserved. All rights reserved.
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
@ -18,9 +18,9 @@
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
$localplay = new Localplay(Config::get('localplay_controller'));
?> ?>
<?php Ajax::start_container('localplay_playlist'); ?> <?php require Config::get('prefix') . '/templates/list_header.inc.php'; ?>
<?php show_box_top(_('Current Playlist')); ?>
<table class="tabledata" cellpadding="0" cellspacing="0"> <table class="tabledata" cellpadding="0" cellspacing="0">
<colgroup> <colgroup>
<col id="col_track" /> <col id="col_track" />
@ -33,7 +33,7 @@
<th class="cel_action"><?php echo _('Action'); ?></th> <th class="cel_action"><?php echo _('Action'); ?></th>
</tr> </tr>
<?php <?php
foreach ($objects as $object) { foreach ($object_ids as $object) {
$class = ' class="cel_name"'; $class = ' class="cel_name"';
if ($status['track'] == $object['track']) { $class=' class="cel_name lp_current"'; } if ($status['track'] == $object['track']) { $class=' class="cel_name lp_current"'; }
?> ?>
@ -48,7 +48,7 @@ foreach ($objects as $object) {
<?php echo Ajax::button('?page=localplay&action=delete_track&id=' . intval($object['id']),'delete',_('Delete'),'localplay_delete_' . intval($object['id'])); ?> <?php echo Ajax::button('?page=localplay&action=delete_track&id=' . intval($object['id']),'delete',_('Delete'),'localplay_delete_' . intval($object['id'])); ?>
</td> </td>
</tr> </tr>
<?php } if (!count($objects)) { ?> <?php } if (!count($object_ids)) { ?>
<tr class="<?php echo flip_class(); ?>"> <tr class="<?php echo flip_class(); ?>">
<td colspan="3"><span class="error"><?php echo _('No Records Found'); ?></span></td> <td colspan="3"><span class="error"><?php echo _('No Records Found'); ?></span></td>
</tr> </tr>
@ -59,5 +59,4 @@ foreach ($objects as $object) {
<th class="cel_action"><?php echo _('Action'); ?></th> <th class="cel_action"><?php echo _('Action'); ?></th>
</tr> </tr>
</table> </table>
<?php show_box_bottom(); ?> <?php require Config::get('prefix') . '/templates/list_header.inc.php'; ?>
<?php Ajax::end_container(); ?>