loading more items on ViewFolder page obeys sort order

This commit is contained in:
Uwe Steinmann 2021-01-13 07:42:35 +01:00
parent cb03dacf45
commit 0767dadf39
2 changed files with 6 additions and 5 deletions

View File

@ -4,6 +4,7 @@
- remove document/folder from index before adding a new one after editing the
meta data
- fix potential clickjacking attack with manipulated email address of a user
- loading more items on ViewFolder page obeys sort order
--------------------------------------------------------------------------------
Changes in version 5.1.21

View File

@ -130,7 +130,7 @@ function folderSelectedmaintree(id, name) {
<?php } ?>
}
<?php if($maxItemsPerPage) { ?>
function loadMoreObjects(element, limit) {
function loadMoreObjects(element, limit, orderby) {
if(!$(element).is(":visible"))
return;
element.text('<?= getMLText('more_objects_loading') ?>');
@ -138,7 +138,7 @@ function loadMoreObjects(element, limit) {
var folder = element.data('folder')
var offset = element.data('offset')
// var limit = element.data('limit')
url = seeddms_webroot+"out/out.ViewFolder.php?action=entries&folderid="+folder+"&offset="+offset+"&limit="+limit<?= $orderby ? '+"&orderby='.$orderby.'"' : "" ?>;
url = seeddms_webroot+"out/out.ViewFolder.php?action=entries&folderid="+folder+"&offset="+offset+"&limit="+limit+"&orderby="+orderby;
$.ajax({
type: 'GET',
url: url,
@ -158,11 +158,11 @@ function loadMoreObjects(element, limit) {
}
$(window).scroll(function() {
if($(window).scrollTop() + $(window).height() == $(document).height()) {
loadMoreObjects($('#loadmore'), $('#loadmore').data('limit'));
loadMoreObjects($('#loadmore'), $('#loadmore').data('limit'), $('#loadmore').data('orderby'));
}
});
$('body').on('click', '#loadmore', function(e) {
loadMoreObjects($(this), $(this).data('all'));
loadMoreObjects($(this), $(this).data('all'), $(this).data('orderby'));
});
<?php } ?>
@ -426,7 +426,7 @@ $('body').on('click', '.order-btn', function(ev) {
echo "</tbody>\n</table>\n";
if($maxItemsPerPage && $i > $maxItemsPerPage)
echo "<button id=\"loadmore\" style=\"width: 100%; margin-bottom: 20px;\" class=\"btn btn-secondary\" data-folder=\"".$folder->getId()."\"data-offset=\"".$maxItemsPerPage."\" data-limit=\"".$incItemsPerPage."\" data-all=\"".($i-$maxItemsPerPage)."\">".getMLText('x_more_objects', array('number'=>($i-$maxItemsPerPage)))."</button>";
echo "<button id=\"loadmore\" style=\"width: 100%; margin-bottom: 20px;\" class=\"btn btn-secondary\" data-folder=\"".$folder->getId()."\"data-offset=\"".$maxItemsPerPage."\" data-limit=\"".$incItemsPerPage."\" data-orderby=\"".$orderby."\" data-all=\"".($i-$maxItemsPerPage)."\">".getMLText('x_more_objects', array('number'=>($i-$maxItemsPerPage)))."</button>";
}
else printMLText("empty_folder_list");