diff options
-rwxr-xr-x | docs/CHANGELOG | 1 | ||||
-rw-r--r-- | lib/class/random.class.php | 5 | ||||
-rw-r--r-- | random.php | 11 | ||||
-rw-r--r-- | server/ajax.server.php | 24 | ||||
-rw-r--r-- | templates/show_random.inc.php | 14 |
5 files changed, 30 insertions, 25 deletions
diff --git a/docs/CHANGELOG b/docs/CHANGELOG index 5c785341..d0755d6d 100755 --- a/docs/CHANGELOG +++ b/docs/CHANGELOG @@ -4,6 +4,7 @@ -------------------------------------------------------------------------- v.3.4-Alpha3 + - Fixed multi-genre Random Play - New Version of Flash player fixes playlist repeat bug (Thx hugoh) - Fixed catalog update and album art dump command line tools - Removed dead link for renaming an Artist diff --git a/lib/class/random.class.php b/lib/class/random.class.php index 8887bd28..38ff2d13 100644 --- a/lib/class/random.class.php +++ b/lib/class/random.class.php @@ -266,15 +266,13 @@ class Random { if (is_array($matchlist)) { foreach ($matchlist as $type => $value) { if (is_array($value)) { - $where .= "("; foreach ($value as $v) { if (!strlen($v)) { continue; } $v = Dba::escape($v); if ($v != $value[0]) { $where .= " OR $type='$v' "; } else { $where .= " AND ( $type='$v'"; } } - $where .= ")"; - $where = rtrim($where,"()"); + $where .= ")"; } elseif (strlen($value)) { $value = Dba::escape($value); @@ -282,7 +280,6 @@ class Random { } } // end foreach } // end if matchlist - if ($data['random_type'] == 'full_album') { $query = "SELECT `album`.`id` FROM `song` INNER JOIN `album` ON `song`.`album`=`album`.`id` " . @@ -25,8 +25,17 @@ require_once 'lib/init.php'; show_header(); switch ($_REQUEST['action']) { - default: + case 'get_advanced': + $object_ids = Random::advanced($_POST); + + // We need to add them to the active playlist + foreach ($object_ids as $object_id) { + $GLOBALS['user']->playlist->add_object($object_id,'song'); + } + // We need to refresh the playlist + case 'advanced': + default: require_once Config::get('prefix') . '/templates/show_random.inc.php'; break; } // end switch diff --git a/server/ajax.server.php b/server/ajax.server.php index d6d1f421..21b19f7a 100644 --- a/server/ajax.server.php +++ b/server/ajax.server.php @@ -67,6 +67,9 @@ switch ($_REQUEST['page']) { } // end switch on page switch ($_REQUEST['action']) { + case 'refresh_rightbar': + $results['rightbar'] = ajax_include('rightbar.inc.php'); + break; /* Controls the editing of objects */ case 'show_edit_object': @@ -119,7 +122,6 @@ switch ($_REQUEST['action']) { require Config::get('prefix') . '/templates/show_edit_' . $_GET['type'] . '_row.inc.php'; $results[$key] = ob_get_contents(); ob_end_clean(); - echo xml_from_array($results); break; case 'edit_object': @@ -184,7 +186,6 @@ switch ($_REQUEST['action']) { require Config::get('prefix') . '/templates/show_' . $_POST['type'] . '_row.inc.php'; $results[$key] = ob_get_contents(); ob_end_clean(); - echo xml_from_array($results); break; /* Controls Localplay */ case 'localplay': @@ -219,8 +220,6 @@ switch ($_REQUEST['action']) { $results['3514'] = '0x1'; break; } // end switch on cmd - $xml_doc = xml_from_array($results); - echo $xml_doc; break; case 'current_playlist': switch ($_REQUEST['type']) { @@ -230,7 +229,6 @@ switch ($_REQUEST['action']) { } // end switch $results['rightbar'] = ajax_include('rightbar.inc.php'); - echo xml_from_array($results); break; // Handle the users basketcases... case 'basket': @@ -290,7 +288,6 @@ switch ($_REQUEST['action']) { } // end switch $results['rightbar'] = ajax_include('rightbar.inc.php'); - echo xml_from_array($results); break; /* For changing the current play type FIXME:: need to allow select of any type */ case 'change_play_type': @@ -299,8 +296,6 @@ switch ($_REQUEST['action']) { /* Uses a drop down, no need to replace text */ $results['play_type'] = ''; - $xml_doc = xml_from_array($results); - echo $xml_doc; break; /* reloading the now playing information */ case 'reloadnp': @@ -316,7 +311,6 @@ switch ($_REQUEST['action']) { } $results['recently_played'] = ob_get_contents(); ob_end_clean(); - echo xml_from_array($results); break; /* Setting ratings */ case 'set_rating': @@ -327,7 +321,6 @@ switch ($_REQUEST['action']) { $key = "rating_" . $_GET['object_id'] . "_" . $_GET['rating_type']; $results[$key] = ob_get_contents(); ob_end_clean(); - echo xml_from_array($results); break; /* This can be a positve (1) or negative (-1) vote */ case 'vote': @@ -347,8 +340,6 @@ switch ($_REQUEST['action']) { require_once(conf('prefix') . '/templates/show_tv_playlist.inc.php'); $results['tv_playlist'] = ob_get_contents(); ob_end_clean(); - $xml_doc = xml_from_array($results); - echo $xml_doc; break; // Used to change filter/settings on browse case 'browse': @@ -368,8 +359,6 @@ switch ($_REQUEST['action']) { Browse::show_objects($object_ids); $results['browse_content'] = ob_get_contents(); ob_end_clean(); - $xml_doc = xml_from_array($results); - echo $xml_doc; break; case 'page': Browse::set_start($_REQUEST['start']); @@ -378,7 +367,6 @@ switch ($_REQUEST['action']) { Browse::show_objects(); $results['browse_content'] = ob_get_contents(); ob_end_clean(); - echo xml_from_array($results); break; case 'sidebar': switch ($_REQUEST['button']) { @@ -403,11 +391,13 @@ switch ($_REQUEST['action']) { require_once Config::get('prefix') . '/templates/sidebar.inc.php'; $results['sidebar'] = ob_get_contents(); ob_end_clean(); - echo xml_from_array($results); break; default: $results['rfc3514'] = '0x1'; - echo xml_from_array($results); break; } // end switch action + +// Go ahead and do the echo +echo xml_from_array($results); + ?> diff --git a/templates/show_random.inc.php b/templates/show_random.inc.php index 5cfdc9a0..64415570 100644 --- a/templates/show_random.inc.php +++ b/templates/show_random.inc.php @@ -19,7 +19,7 @@ */ ?> -<form id="random" method="post" enctype="multipart/form-data" action="<?php echo Config::get('web_path'); ?>/random.php"> +<form id="random" method="post" enctype="multipart/form-data" action="<?php echo Config::get('web_path'); ?>/random.php?action=get_advanced"> <?php show_box_top(_('Play Random Selection')); ?> <table class="table-data" cellspacing="0" cellpadding="3"> <tr> @@ -76,12 +76,20 @@ </tr> <tr> <td colspan="4"> - <?php echo Ajax::text("?page=random&action=advanced_random",_('Enqueue'),'advanced_random_enqueue','random','button'); ?> + <input type="submit" value="<?php echo _('Enqueue'); ?>" /> </td> </tr> </table> <?php show_box_bottom(); ?> </form> <div id="browse"> - +<?php + if (is_array($object_ids)) { + Browse::reset_filters(); + Browse::set_type('song'); + Browse::save_objects($object_ids); + Browse::show_objects(); + echo Ajax::observe('window','load',Ajax::action('?action=refresh_rightbar','playlist_refresh_load')); + } +?> </div> |