mirror of
https://github.com/friendica/friendica
synced 2024-12-22 16:40:16 +00:00
Add node-wide default items per page config
This commit is contained in:
parent
efbafce2d5
commit
e0d03615bc
9 changed files with 66 additions and 21 deletions
|
@ -228,14 +228,12 @@ function networkPager(App $a, Pager $pager, $update)
|
|||
return ' LIMIT 100';
|
||||
}
|
||||
|
||||
// check if we serve a mobile device and get the user settings
|
||||
// accordingly
|
||||
if (DI::mode()->isMobile()) {
|
||||
$itemspage_network = DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network');
|
||||
$itemspage_network = ((intval($itemspage_network)) ? $itemspage_network : 20);
|
||||
$itemspage_network = DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network',
|
||||
DI::config()->get('system', 'itemspage_network_mobile'));
|
||||
} else {
|
||||
$itemspage_network = DI::pConfig()->get(local_user(), 'system', 'itemspage_network');
|
||||
$itemspage_network = ((intval($itemspage_network)) ? $itemspage_network : 40);
|
||||
$itemspage_network = DI::pConfig()->get(local_user(), 'system', 'itemspage_network',
|
||||
DI::config()->get('system', 'itemspage_network'));
|
||||
}
|
||||
|
||||
// now that we have the user settings, see if the theme forces
|
||||
|
|
|
@ -69,7 +69,15 @@ function notes_content(App $a, $update = false)
|
|||
$condition = ['uid' => local_user(), 'post-type' => Item::PT_PERSONAL_NOTE, 'gravity' => GRAVITY_PARENT,
|
||||
'contact-id'=> $a->contact['id']];
|
||||
|
||||
$pager = new Pager(DI::l10n(), DI::args()->getQueryString(), 40);
|
||||
if (DI::mode()->isMobile()) {
|
||||
$itemsPerPage = DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network',
|
||||
DI::config()->get('system', 'itemspage_network_mobile'));
|
||||
} else {
|
||||
$itemsPerPage = DI::pConfig()->get(local_user(), 'system', 'itemspage_network',
|
||||
DI::config()->get('system', 'itemspage_network'));
|
||||
}
|
||||
|
||||
$pager = new Pager(DI::l10n(), DI::args()->getQueryString(), $itemsPerPage);
|
||||
|
||||
$params = ['order' => ['created' => true],
|
||||
'limit' => [$pager->getStart(), $pager->getItemsPerPage()]];
|
||||
|
|
|
@ -356,11 +356,15 @@ function settings_post(App $a)
|
|||
}
|
||||
}
|
||||
|
||||
$itemspage_network = !empty($_POST['itemspage_network']) ? intval($_POST['itemspage_network']) : 40;
|
||||
$itemspage_network = !empty($_POST['itemspage_network']) ?
|
||||
intval($_POST['itemspage_network']) :
|
||||
DI::config()->get('system', 'itemspage_network');
|
||||
if ($itemspage_network > 100) {
|
||||
$itemspage_network = 100;
|
||||
}
|
||||
$itemspage_mobile_network = !empty($_POST['itemspage_mobile_network']) ? intval($_POST['itemspage_mobile_network']) : 20;
|
||||
$itemspage_mobile_network = !empty($_POST['itemspage_mobile_network']) ?
|
||||
intval($_POST['itemspage_mobile_network']) :
|
||||
DI::config()->get('system', 'itemspage_network_mobile');
|
||||
if ($itemspage_mobile_network > 100) {
|
||||
$itemspage_mobile_network = 100;
|
||||
}
|
||||
|
@ -938,9 +942,9 @@ function settings_content(App $a)
|
|||
}
|
||||
|
||||
$itemspage_network = intval(DI::pConfig()->get(local_user(), 'system', 'itemspage_network'));
|
||||
$itemspage_network = (($itemspage_network > 0 && $itemspage_network < 101) ? $itemspage_network : 40); // default if not set: 40 items
|
||||
$itemspage_network = (($itemspage_network > 0 && $itemspage_network < 101) ? $itemspage_network : DI::config()->get('system', 'itemspage_network'));
|
||||
$itemspage_mobile_network = intval(DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network'));
|
||||
$itemspage_mobile_network = (($itemspage_mobile_network > 0 && $itemspage_mobile_network < 101) ? $itemspage_mobile_network : 20); // default if not set: 20 items
|
||||
$itemspage_mobile_network = (($itemspage_mobile_network > 0 && $itemspage_mobile_network < 101) ? $itemspage_mobile_network : DI::config()->get('system', 'itemspage_network_mobile'));
|
||||
|
||||
$nosmile = DI::pConfig()->get(local_user(), 'system', 'no_smilies', 0);
|
||||
$first_day_of_week = DI::pConfig()->get(local_user(), 'system', 'first_day_of_week', 0);
|
||||
|
|
|
@ -1805,7 +1805,15 @@ class Contact
|
|||
$cid, GRAVITY_PARENT, GRAVITY_COMMENT, local_user()];
|
||||
}
|
||||
|
||||
$pager = new Pager(DI::l10n(), DI::args()->getQueryString());
|
||||
if (DI::mode()->isMobile()) {
|
||||
$itemsPerPage = DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network',
|
||||
DI::config()->get('system', 'itemspage_network_mobile'));
|
||||
} else {
|
||||
$itemsPerPage = DI::pConfig()->get(local_user(), 'system', 'itemspage_network',
|
||||
DI::config()->get('system', 'itemspage_network'));
|
||||
}
|
||||
|
||||
$pager = new Pager(DI::l10n(), DI::args()->getQueryString(), $itemsPerPage);
|
||||
|
||||
$params = ['order' => ['received' => true],
|
||||
'limit' => [$pager->getStart(), $pager->getItemsPerPage()]];
|
||||
|
|
|
@ -81,7 +81,15 @@ class BaseSearch extends BaseModule
|
|||
$header = DI::l10n()->t('Forum Search - %s', $search);
|
||||
}
|
||||
|
||||
$pager = new Pager(DI::l10n(), DI::args()->getQueryString());
|
||||
if (DI::mode()->isMobile()) {
|
||||
$itemsPerPage = DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network',
|
||||
DI::config()->get('system', 'itemspage_network_mobile'));
|
||||
} else {
|
||||
$itemsPerPage = DI::pConfig()->get(local_user(), 'system', 'itemspage_network',
|
||||
DI::config()->get('system', 'itemspage_network'));
|
||||
}
|
||||
|
||||
$pager = new Pager(DI::l10n(), DI::args()->getQueryString(), $itemsPerPage);
|
||||
|
||||
if ($localSearch && empty($results)) {
|
||||
$pager->setItemsPerPage(80);
|
||||
|
|
|
@ -195,11 +195,12 @@ class Community extends BaseModule
|
|||
}
|
||||
}
|
||||
|
||||
// check if we serve a mobile device and get the user settings accordingly
|
||||
if (DI::mode()->isMobile()) {
|
||||
self::$itemsPerPage = DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network', 20);
|
||||
self::$itemsPerPage = DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network',
|
||||
DI::config()->get('system', 'itemspage_network_mobile'));
|
||||
} else {
|
||||
self::$itemsPerPage = DI::pConfig()->get(local_user(), 'system', 'itemspage_network', 40);
|
||||
self::$itemsPerPage = DI::pConfig()->get(local_user(), 'system', 'itemspage_network',
|
||||
DI::config()->get('system', 'itemspage_network'));
|
||||
}
|
||||
|
||||
// now that we have the user settings, see if the theme forces
|
||||
|
@ -272,6 +273,7 @@ class Community extends BaseModule
|
|||
* @param $itemspage
|
||||
* @return array
|
||||
* @throws \Exception
|
||||
* @TODO Move to repository/factory
|
||||
*/
|
||||
private static function selectItems($since_id, $max_id, $itemspage)
|
||||
{
|
||||
|
|
|
@ -166,12 +166,12 @@ class Status extends BaseProfile
|
|||
$sql_extra3 = "";
|
||||
}
|
||||
|
||||
// check if we serve a mobile device and get the user settings
|
||||
// accordingly
|
||||
if (DI::mode()->isMobile()) {
|
||||
$itemspage_network = DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network', 10);
|
||||
$itemspage_network = DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network',
|
||||
DI::config()->get('system', 'itemspage_network_mobile'));
|
||||
} else {
|
||||
$itemspage_network = DI::pConfig()->get(local_user(), 'system', 'itemspage_network', 20);
|
||||
$itemspage_network = DI::pConfig()->get(local_user(), 'system', 'itemspage_network',
|
||||
DI::config()->get('system', 'itemspage_network'));
|
||||
}
|
||||
|
||||
// now that we have the user settings, see if the theme forces
|
||||
|
|
|
@ -137,7 +137,15 @@ class Index extends BaseSearch
|
|||
// OR your own posts if you are a logged in member
|
||||
// No items will be shown if the member has a blocked profile wall.
|
||||
|
||||
$pager = new Pager(DI::l10n(), DI::args()->getQueryString());
|
||||
if (DI::mode()->isMobile()) {
|
||||
$itemsPerPage = DI::pConfig()->get(local_user(), 'system', 'itemspage_mobile_network',
|
||||
DI::config()->get('system', 'itemspage_network_mobile'));
|
||||
} else {
|
||||
$itemsPerPage = DI::pConfig()->get(local_user(), 'system', 'itemspage_network',
|
||||
DI::config()->get('system', 'itemspage_network'));
|
||||
}
|
||||
|
||||
$pager = new Pager(DI::l10n(), DI::args()->getQueryString(), $itemsPerPage);
|
||||
|
||||
if ($tag) {
|
||||
Logger::info('Start tag search.', ['q' => $search]);
|
||||
|
|
|
@ -227,6 +227,15 @@ return [
|
|||
// If set true registration is only possible after a current member of the node has send an invitation.
|
||||
'invitation_only' => false,
|
||||
|
||||
// itemspage_network (Integer)
|
||||
// default number of items per page in stream pages (network, community, profile/contact statuses, search)
|
||||
'itemspage_network' => 40,
|
||||
|
||||
// itemspage_network_mobile (Integer)
|
||||
// default number of items per page in stream pages (network, community, profile/contact statuses, search)
|
||||
// on detected mobile devices
|
||||
'itemspage_network_mobile' => 20,
|
||||
|
||||
// like_no_comment (Boolean)
|
||||
// Don't update the "commented" value of an item when it is liked.
|
||||
'like_no_comment' => false,
|
||||
|
|
Loading…
Reference in a new issue