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

Fixed #689: Count disappears when viewing album with multiple pages

This commit is contained in:
Afterster 2015-01-25 10:49:44 +01:00
parent 26b9332c0f
commit 36175c3e88
8 changed files with 44 additions and 30 deletions

View file

@ -54,7 +54,7 @@ switch ($_REQUEST['action']) {
if (isset($_GET['order'])) {
$songs = explode(";", $_GET['order']);
$track = 1;
$track = $_GET['offset'] ? (intval($_GET['offset']) + 1) : 1;
foreach ($songs as $song_id) {
if ($song_id != '') {
Song::update_track($track, $song_id);

View file

@ -193,6 +193,8 @@ class Browse extends Query
// Set the correct classes based on type
$class = "box browse_" . $type;
$argument_param = ($argument ? '&argument=' . scrub_in($argument) : '');
debug_event('browse', 'Show objects called for type {'.$type.'}', '5');
$limit_threshold = $this->get_threshold();
@ -345,25 +347,25 @@ class Browse extends Query
UI::show_box_bottom();
}
echo '<script type="text/javascript">';
echo Ajax::action('?page=browse&action=get_filters&browse_id=' . $this->id, '');
echo Ajax::action('?page=browse&action=get_filters&browse_id=' . $this->id . $argument_param, '');
echo ';</script>';
} else {
if (!$this->get_use_pages()) {
$this->show_next_link();
$this->show_next_link($argument);
}
}
Ajax::end_container();
} // show_object
public function show_next_link()
public function show_next_link($argument = null)
{
$limit = $this->get_offset();
$start = $this->get_start();
$total = $this->get_total();
$next_offset = $start + $limit;
if ($next_offset <= $total) {
echo '<a class="jscroll-next" href="' . AmpConfig::get('ajax_url') . '?page=browse&action=page&browse_id=' . $this->id . '&start=' . $next_offset . '&xoutput=raw&xoutputnode='. $this->get_content_div() . '&show_header=false">' . T_('More') . '</a>';
echo '<a class="jscroll-next" href="' . AmpConfig::get('ajax_url') . '?page=browse&action=page&browse_id=' . $this->id . '&start=' . $next_offset . '&xoutput=raw&xoutputnode='. $this->get_content_div() . '&show_header=false' . $argument_param . '">' . T_('More') . '</a>';
}
}

View file

@ -341,8 +341,13 @@ function submitNewItemsOrder(itemId, tableid, rowPrefix, updateUrl, refreshActio
var table = document.getElementById(tableid);
var rowLength = table.rows.length;
var offset = 0;
var finalOrder = '';
if ($('#' + tableid).attr('data-offset')) {
offset = $('#' + tableid).attr('data-offset');
}
for (var i = 0; i < rowLength; ++i) {
var row = table.rows[i];
if (row.id != '') {
@ -355,7 +360,7 @@ function submitNewItemsOrder(itemId, tableid, rowPrefix, updateUrl, refreshActio
$.ajax({
url: updateUrl,
type: 'GET',
data: 'order=' + finalOrder,
data: 'offset=' + offset + '&order=' + finalOrder,
success: function (resp) {
var url = jsAjaxServer + '/refresh_reordered.server.php?action=' + parent.refreshAction + '&id=' + parent.itemId;
// Reload only table

View file

@ -106,7 +106,7 @@ switch ($_REQUEST['action']) {
if (isset($_GET['order'])) {
$songs = explode(";", $_GET['order']);
$track = 1;
$track = $_GET['offset'] ? (intval($_GET['offset']) + 1) : 1;
foreach ($songs as $song_id) {
if ($song_id != '') {
$playlist->update_track_number($song_id, $track);

View file

@ -45,6 +45,11 @@ if (isset($_REQUEST['show_header']) && $_REQUEST['show_header']) {
$browse->set_show_header($_REQUEST['show_header'] == 'true');
}
$argument = null;
if ($_REQUEST['argument']) {
$argument = scrub_in($_REQUEST['argument']);
}
$results = array();
switch ($_REQUEST['action']) {
case 'browse':
@ -72,7 +77,7 @@ switch ($_REQUEST['action']) {
}
ob_start();
$browse->show_objects();
$browse->show_objects(null, $argument);
$results[$browse->get_content_div()] = ob_get_clean();
break;
case 'set_sort':
@ -85,7 +90,7 @@ switch ($_REQUEST['action']) {
}
ob_start();
$browse->show_objects();
$browse->show_objects(null, $argument);
$results[$browse->get_content_div()] = ob_get_clean();
break;
case 'toggle_tag':
@ -125,14 +130,14 @@ switch ($_REQUEST['action']) {
case 'page':
$browse->set_start($_REQUEST['start']);
ob_start();
$browse->show_objects();
$browse->show_objects(null, $argument);
$results[$browse->get_content_div()] = ob_get_clean();
break;
case 'show_art':
Art::set_enabled();
ob_start();
$browse->show_objects();
$browse->show_objects(null, $argument);
$results[$browse->get_content_div()] = ob_get_clean();
break;
case 'get_filters':
@ -184,7 +189,7 @@ switch ($_REQUEST['action']) {
}
ob_start();
$browse->show_objects();
$browse->show_objects(null, $argument);
$results[$browse->get_content_div()] = ob_get_clean();
break;
case 'get_share_links':

View file

@ -41,13 +41,15 @@ switch ($_REQUEST['action']) {
break;
case 'refresh_album_songs':
$browse = new Browse();
$browse->set_show_header(false);
$browse->set_show_header(true);
$browse->set_type('song');
$browse->set_simple_browse(true);
$browse->set_filter('album', $_REQUEST['id']);
$browse->set_sort('track', 'ASC');
$browse->get_objects();
echo "<div id='browse_content_song' class='browse_content'>";
$browse->show_objects(null, true); // true argument is set to show the reorder column
$browse->store();
echo "</div>";
break;
} // switch on the action

View file

@ -92,7 +92,7 @@ if ($limit > 0 && $total > $limit) {
if ($browse->get_filter('regex_match') == $filter) {
$value = '<b>' . $value . '</b>';
}
echo Ajax::text('?page=browse&action=browse&browse_id=' . $browse->id . '&key=regex_match&multi_alpha_filter=' . $filter, $value,'browse_' . $uid . '_alpha_' . $key,'');
echo Ajax::text('?page=browse&action=browse&browse_id=' . $browse->id . '&key=regex_match&multi_alpha_filter=' . $filter . $argument_param, $value,'browse_' . $uid . '_alpha_' . $key,'');
}
?>
</div>
@ -106,15 +106,15 @@ if ($limit > 0 && $total > $limit) {
if ($browse->get_use_pages()) {
?>
<span class="list-header-navmenu-border">
<span><?php echo Ajax::text('?page=browse&action=page&browse_id=' . $browse->id . '&start=' . $prev_offset . '&browse_uid=' . $uid, T_('Prev'),'browse_' . $uid . 'prev','','prev'); ?></span>
<span><?php echo Ajax::text('?page=browse&action=page&browse_id=' . $browse->id . '&start=' . $prev_offset . '&browse_uid=' . $uid . $argument_param, T_('Prev'),'browse_' . $uid . 'prev','','prev'); ?></span>
&nbsp;
<?php echo '&nbsp;' . T_('Page') . ':'; ?>
<input class="list-header-navmenu-input" type="text" id="browse_<?php echo $browse->id; ?>_custom_value_<?php echo $is_header; ?>" class="browse_custom_value" name="value" value="<?php echo ($current_page + 1); ?>" onKeyUp="delayRun(this, '750', 'ajaxState', '<?php echo Ajax::url('?page=browse&action=options&browse_id=' . $browse->id . '&option=custom'); ?>', 'browse_<?php echo $browse->id; ?>_custom_value_<?php echo $is_header; ?>');">
<input class="list-header-navmenu-input" type="text" id="browse_<?php echo $browse->id; ?>_custom_value_<?php echo $is_header; ?>" class="browse_custom_value" name="value" value="<?php echo ($current_page + 1); ?>" onKeyUp="delayRun(this, '750', 'ajaxState', '<?php echo Ajax::url('?page=browse&action=options&browse_id=' . $browse->id . '&option=custom' . $argument_param); ?>', 'browse_<?php echo $browse->id; ?>_custom_value_<?php echo $is_header; ?>');">
<?php echo T_('of') . '&nbsp;' . $pages; ?>
&nbsp;
<span><?php echo Ajax::text('?page=browse&action=page&browse_id=' . $browse->id . '&start=' . $next_offset . '&browse_uid=' . $uid, T_('Next'),'browse_' . $uid . 'next','','next'); ?></span>
<span><?php echo Ajax::text('?page=browse&action=page&browse_id=' . $browse->id . '&start=' . $next_offset . '&browse_uid=' . $uid . $argument_param, T_('Next'),'browse_' . $uid . 'next','','next'); ?></span>
&nbsp;
<span><?php echo Ajax::text('?page=browse&action=page&browse_id=' . $browse->id . '&start=-1&browse_uid=' . $uid, T_('All'),'browse_' . $uid . 'all','','all'); ?></span>
<span><?php echo Ajax::text('?page=browse&action=page&browse_id=' . $browse->id . '&start=-1&browse_uid=' . $uid . $argument_param, T_('All'),'browse_' . $uid . 'all','','all'); ?></span>
</span>
<?php
}
@ -123,10 +123,10 @@ if ($limit > 0 && $total > $limit) {
<span class="browse-options">
<a href="#" onClick="showFilters(this);" class="browse-options-link"><?php echo T_("Filters"); ?></a>
<span class="browse-options-content">
<span><input type="checkbox" id="browse_<?php echo $browse->id; ?>_use_pages_<?php echo $is_header; ?>" value="true" <?php echo (($browse->get_use_pages()) ? 'checked' : ''); ?> onClick="javascript:<?php echo Ajax::action("?page=browse&action=options&browse_id=" . $browse->id . "&option=use_pages&value=' + $('#browse_" . $browse->id . "_use_pages_" . $is_header . "').is(':checked') + '", "browse_" . $browse->id . "_use_pages_" . $is_header); ?>">Pages</span>
<span><input type="checkbox" id="browse_<?php echo $browse->id; ?>_use_scroll_<?php echo $is_header; ?>" value="true" <?php echo ((!$browse->get_use_pages()) ? 'checked' : ''); ?> onClick="javascript:<?php echo Ajax::action("?page=browse&action=options&browse_id=" . $browse->id . "&option=use_pages&value=' + !($('#browse_" . $browse->id . "_use_scroll_" . $is_header . "').is(':checked')) + '", "browse_" . $browse->id . "_use_scroll_" . $is_header); ?>">Infinite Scroll</span>
<span><input type="checkbox" id="browse_<?php echo $browse->id; ?>_use_pages_<?php echo $is_header; ?>" value="true" <?php echo (($browse->get_use_pages()) ? 'checked' : ''); ?> onClick="javascript:<?php echo Ajax::action("?page=browse&action=options&browse_id=" . $browse->id . "&option=use_pages&value=' + $('#browse_" . $browse->id . "_use_pages_" . $is_header . "').is(':checked') + '" . $argument_param, "browse_" . $browse->id . "_use_pages_" . $is_header); ?>">Pages</span>
<span><input type="checkbox" id="browse_<?php echo $browse->id; ?>_use_scroll_<?php echo $is_header; ?>" value="true" <?php echo ((!$browse->get_use_pages()) ? 'checked' : ''); ?> onClick="javascript:<?php echo Ajax::action("?page=browse&action=options&browse_id=" . $browse->id . "&option=use_pages&value=' + !($('#browse_" . $browse->id . "_use_scroll_" . $is_header . "').is(':checked')) + '" . $argument_param, "browse_" . $browse->id . "_use_scroll_" . $is_header); ?>">Infinite Scroll</span>
<?php if (!$browse->is_static_content()) { ?>
<span><input type="checkbox" id="browse_<?php echo $browse->id; ?>_use_alpha_<?php echo $is_header; ?>" value="true" <?php echo (($browse->get_use_alpha()) ? 'checked' : ''); ?> onClick="javascript:<?php echo Ajax::action("?page=browse&action=options&browse_id=" . $browse->id . "&option=use_alpha&value=' + $('#browse_" . $browse->id . "_use_alpha_" . $is_header . "').is(':checked') + '", "browse_" . $browse->id . "_use_alpha_" . $is_header); ?>">Alphabet</span>
<span><input type="checkbox" id="browse_<?php echo $browse->id; ?>_use_alpha_<?php echo $is_header; ?>" value="true" <?php echo (($browse->get_use_alpha()) ? 'checked' : ''); ?> onClick="javascript:<?php echo Ajax::action("?page=browse&action=options&browse_id=" . $browse->id . "&option=use_alpha&value=' + $('#browse_" . $browse->id . "_use_alpha_" . $is_header . "').is(':checked') + '" . $argument_param, "browse_" . $browse->id . "_use_alpha_" . $is_header); ?>">Alphabet</span>
<?php } ?>
<?php if ($browse->get_use_pages()) { ?>
<span>|</span>

View file

@ -24,16 +24,16 @@ $web_path = AmpConfig::get('web_path');
$thcount = 8;
?>
<?php if ($browse->get_show_header()) require AmpConfig::get('prefix') . '/templates/list_header.inc.php'; ?>
<table id="reorder_songs_table_<?php echo $browse->get_filter('album'); ?>" class="tabledata" cellpadding="0" cellspacing="0" data-objecttype="song">
<table id="reorder_songs_table_<?php echo $browse->get_filter('album'); ?>" class="tabledata" cellpadding="0" cellspacing="0" data-objecttype="song" data-offset="<?php echo $browse->get_start(); ?>">
<thead>
<tr class="th-top">
<th class="cel_play essential"></th>
<th class="cel_song essential persist"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&sort=title', T_('Song Title'), 'sort_song_title'.$browse->id); ?></th>
<th class="cel_song essential persist"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&sort=title' . $argument_param, T_('Song Title'), 'sort_song_title'.$browse->id); ?></th>
<th class="cel_add essential"></th>
<th class="cel_artist optional"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&sort=artist', T_('Artist'), 'sort_song_artist'.$browse->id); ?></th>
<th class="cel_album essential"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&sort=album', T_('Album'), 'sort_song_album'.$browse->id); ?></th>
<th class="cel_artist optional"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&sort=artist' . $argument_param, T_('Artist'), 'sort_song_artist'.$browse->id); ?></th>
<th class="cel_album essential"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&sort=album' . $argument_param, T_('Album'), 'sort_song_album'.$browse->id); ?></th>
<th class="cel_tags optional"><?php echo T_('Tags'); ?></th>
<th class="cel_time optional"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&sort=time', T_('Time'), 'sort_song_time'.$browse->id); ?></th>
<th class="cel_time optional"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&sort=time' . $argument_param, T_('Time'), 'sort_song_time'.$browse->id); ?></th>
<?php if (AmpConfig::get('show_played_times')) { ?>
<th class="cel_counter optional"><?php echo T_('# Played'); ?></th>
<?php } ?>
@ -77,12 +77,12 @@ $thcount = 8;
<tfoot>
<tr class="th-bottom">
<th class="cel_play"></th>
<th class="cel_song"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&sort=title', T_('Song Title'), 'sort_song_title'.$browse->id); ?></th>
<th class="cel_song"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&sort=title' . $argument_param, T_('Song Title'), 'sort_song_title'.$browse->id); ?></th>
<th class="cel_add"></th>
<th class="cel_artist"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&sort=artist', T_('Artist'), 'sort_song_artist'.$browse->id); ?></th>
<th class="cel_album"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&sort=album', T_('Album'), 'sort_song_album'.$browse->id); ?></th>
<th class="cel_artist"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&sort=artist' . $argument_param, T_('Artist'), 'sort_song_artist'.$browse->id); ?></th>
<th class="cel_album"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&sort=album' . $argument_param, T_('Album'), 'sort_song_album'.$browse->id); ?></th>
<th class="cel_tags"><?php echo T_('Tags'); ?></th>
<th class="cel_time"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&sort=time', T_('Time'), 'sort_song_time'.$browse->id); ?></th>
<th class="cel_time"><?php echo Ajax::text('?page=browse&action=set_sort&browse_id=' . $browse->id . '&sort=time' . $argument_param, T_('Time'), 'sort_song_time'.$browse->id); ?></th>
<?php if (AmpConfig::get('show_played_times')) { ?>
<th class="cel_counter optional"><?php echo T_('# Played'); ?></th>
<?php } ?>