Added config vars to influence dashboard limit

http://board.s9y.org/posting.php?mode=quote&f=10&p=10442506
This commit is contained in:
Garvin Hicking 2015-03-16 10:47:56 +01:00
parent 863db549f7
commit 872d978d63
2 changed files with 22 additions and 3 deletions

View File

@ -3,6 +3,18 @@
Version 2.1 ()
------------------------------------------------------------------------
* Added two configuration variables that can be set in
serendipity_config_local.inc.php to influence the dashboard
entry limit:
- $serendipity['dashboardLimit']: How many future entries to
fetch (default: 5)
- $serendipity['dashboardDraftLimit']: How many entries in total
shall be displayed in the dashboard section (default: 5)
(Draft entries will only be fetched if there are less future entries
than the total entry limit)
* Fix: the syndication plugin now always uses absolute links for
the subtome-button

View File

@ -74,10 +74,17 @@ if (is_array($comments) && count($comments) > 0) {
$data['comments'] = $comments;
if (!isset($serendipity['dashboardLimit'])) {
$serendipity['dashboardLimit'] = 5;
}
if (!isset($serendipity['dashboardDraftLimit'])) {
$serendipity['dashboardDraftLimit'] = 5;
}
$entries = serendipity_fetchEntries(
false,
false,
5,
(int)$serendipity['dashboardLimit'],
true,
false,
'timestamp DESC',
@ -85,12 +92,12 @@ $entries = serendipity_fetchEntries(
);
$entriesAmount = count($entries);
if ($entriesAmount < 5) {
if ($entriesAmount < (int)$serendipity['dashboardDraftLimit']) {
// there is still space for drafts
$drafts = serendipity_fetchEntries(
false,
false,
5- $entriesAmount,
(int)$serendipity['dashboardDraftLimit'] - $entriesAmount,
true,
false,
'timestamp DESC',