mirror of
https://github.com/Yetangitu/ampache
synced 2025-10-05 19:41:55 +02:00
Change Browse from static to instantiable. Among other things, fixes FS#13;
probably also breaks things. Most things appear to still work, but I may have missed some cases.
This commit is contained in:
parent
c1ed41a16d
commit
7f36693353
39 changed files with 754 additions and 673 deletions
|
@ -25,63 +25,30 @@
|
|||
*/
|
||||
if (AJAX_INCLUDE != '1') { exit; }
|
||||
|
||||
$democratic = Democratic::get_current_playlist();
|
||||
$democratic->set_parent();
|
||||
|
||||
switch ($_REQUEST['action']) {
|
||||
case 'delete_vote':
|
||||
$democratic = Democratic::get_current_playlist();
|
||||
$democratic->set_parent();
|
||||
$democratic->remove_vote($_REQUEST['row_id']);
|
||||
|
||||
ob_start();
|
||||
$object_ids = $democratic->get_items();
|
||||
Browse::set_type('democratic');
|
||||
Browse::reset();
|
||||
Browse::set_static_content(1);
|
||||
Browse::show_objects($object_ids);
|
||||
|
||||
require_once Config::get('prefix') . '/templates/show_democratic_playlist.inc.php';
|
||||
$results['browse_content'] = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
$show_browse = true;
|
||||
break;
|
||||
case 'add_vote':
|
||||
|
||||
$democratic = Democratic::get_current_playlist();
|
||||
$democratic->set_parent();
|
||||
$democratic->add_vote($_REQUEST['object_id'],$_REQUEST['type']);
|
||||
|
||||
ob_start();
|
||||
$object_ids = $democratic->get_items();
|
||||
Browse::set_type('democratic');
|
||||
Browse::reset();
|
||||
Browse::set_static_content(1);
|
||||
Browse::show_objects($object_ids);
|
||||
|
||||
require_once Config::get('prefix') . '/templates/show_democratic_playlist.inc.php';
|
||||
$results['browse_content'] = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
$show_browse = true;
|
||||
break;
|
||||
case 'delete':
|
||||
if (!$GLOBALS['user']->has_access('75')) {
|
||||
echo xml_from_array(array('rfc3514' => '0x1'));
|
||||
exit;
|
||||
}
|
||||
|
||||
$democratic = Democratic::get_current_playlist();
|
||||
$democratic->set_parent();
|
||||
$democratic->delete_votes($_REQUEST['row_id']);
|
||||
|
||||
ob_start();
|
||||
$object_ids = $democratic->get_items();
|
||||
Browse::set_type('democratic');
|
||||
Browse::reset();
|
||||
Browse::set_static_content(1);
|
||||
Browse::show_objects($object_ids);
|
||||
$results['browse_content'] = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
$show_browse = true;
|
||||
break;
|
||||
case 'send_playlist':
|
||||
if (!Access::check('interface','75')) {
|
||||
echo xml_from_array(array('rfc3514' => '0x1'));
|
||||
exit;
|
||||
}
|
||||
|
||||
|
@ -89,8 +56,8 @@ switch ($_REQUEST['action']) {
|
|||
$results['rfc3514'] = '<script type="text/javascript">reload_util("'.$_SESSION['iframe']['target'].'")</script>';
|
||||
break;
|
||||
case 'clear_playlist':
|
||||
|
||||
if (!Access::check('interface','100')) {
|
||||
echo xml_from_array(array('rfc3514' => '0x1'));
|
||||
exit;
|
||||
}
|
||||
|
||||
|
@ -98,21 +65,25 @@ switch ($_REQUEST['action']) {
|
|||
$democratic->set_parent();
|
||||
$democratic->clear();
|
||||
|
||||
ob_start();
|
||||
$object_ids = array();
|
||||
Browse::set_type('democratic');
|
||||
Browse::reset();
|
||||
Browse::set_static_content(1);
|
||||
Browse::show_objects($object_ids);
|
||||
$results['browse_content'] = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
$show_browse = true;
|
||||
break;
|
||||
default:
|
||||
$results['rfc3514'] = '0x1';
|
||||
break;
|
||||
} // switch on action;
|
||||
|
||||
if ($show_browse) {
|
||||
ob_start();
|
||||
$object_ids = $democratic->get_items();
|
||||
$browse = new Browse();
|
||||
$browse->set_type('democratic');
|
||||
$browse->set_static_content(true);
|
||||
$browse->show_objects($object_ids);
|
||||
$browse->store();
|
||||
$results['browse_content'] = ob_get_contents();
|
||||
ob_end_clean();
|
||||
}
|
||||
|
||||
// We always do this
|
||||
echo xml_from_array($results);
|
||||
?>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue