Add first and last pagination for entries and media items

This commit is contained in:
Ian 2015-10-05 19:10:53 +02:00
parent 7c21de8aa8
commit 2b610dc791
6 changed files with 62 additions and 5 deletions

View File

@ -339,8 +339,10 @@ switch($serendipity['GET']['adminAction']) {
foreach ((array)$serendipity['GET']['filter'] as $k => $v) {
$qString .= '&serendipity[filter]['. $k .']='. $v;
}
$data['linkFirst'] = $qString . '&serendipity[page]=' . 0;
$data['linkPrevious'] = $qString . '&serendipity[page]=' . ($page-1);
$data['linkNext'] = $qString . '&serendipity[page]=' . ($page+1);
$data['linkLast'] = $qString . '&serendipity[page]='; // is done in tpl per $totalPages
$smartentries = array();
foreach ($entries as $ey) {

View File

@ -1604,8 +1604,11 @@ function serendipity_displayImageList($page = 0, $lineBreak = NULL, $manage = fa
);
$pages = ceil($totalImages / $perPage);
$linkPrevious = '?' . $extraParems . 'serendipity[page]=' . ($page-1);
$linkNext = '?' . $extraParems . 'serendipity[page]=' . ($page+1);
$linkPrevious = '?' . $extraParems . '&serendipity[page]=' . ($page-1);
$linkNext = '?' . $extraParems . '&serendipity[page]=' . ($page+1);
// Keep the inner to be build first. Now add first and last. Has to do with adding $param to $extraParems.
$linkFirst = '?' . $extraParems . '&serendipity[page]=' . 1;
$linkLast = '?' . $extraParems . '&serendipity[page]=' . $pages;
if (is_null($lineBreak)) {
$lineBreak = floor(750 / ($serendipity['thumbSize'] + 20));
}
@ -1647,8 +1650,10 @@ function serendipity_displayImageList($page = 0, $lineBreak = NULL, $manage = fa
'show_upload' => $show_upload,
'page' => $page,
'pages' => $pages,
'linkFirst' => $linkFirst,
'linkNext' => $linkNext,
'linkPrevious' => $linkPrevious,
'linkLast' => $linkLast,
'extraParems' => $extraParems,
'totalImages' => $totalImages
));

View File

@ -1,3 +1,5 @@
@define('MULTICHECK_NO_ITEM', 'Please checkmark an item before! Please return to the <a href="%s">referer</a> page.');
@define('MULTICHECK_NO_DIR', 'Please select a directory before! Please return to the <a href="%s">referer</a> page.');
@define('BULKMOVE_HELP_DESC', 'Checkmark the objects or images of choice and choose the place to remove to here. <b>Note:</b> This action will happen immediately and will not be asked back to proceed, likewise for the bulk delete action part. All selected items will move physically to the new location and all Blog entries are searched to replace the src and path links links to the new place too. With Staticpage versions from v.4.52(!) this also happens to staticpage entries.');
@define('FIRST', 'First Page');
@define('LAST', 'Last Page');

View File

@ -1,3 +1,15 @@
<svg display="none" width="0" height="0" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<symbol id="icon-pagination-first" viewBox="0 0 1024 1024">
<title>first</title>
<path d="M546.282 78.742q10.602 -10.602 17.856 -7.254t7.254 17.856v821.376q0 14.508 -7.254 17.856t-17.856 -7.254l-396.18 -396.18q-5.022 -5.022 -7.254 -10.602v378.324q0 14.508 -10.602 25.11t-25.11 10.602h-71.424q-14.508 0 -25.11 -10.602t-10.602 -25.11v-785.664q0 -14.508 10.602 -25.11t25.11 -10.602h71.424q14.508 0 25.11 10.602t10.602 25.11v378.324q2.232 -6.138 7.254 -10.602z" fill="#000000"/></path>
</symbol>
<symbol id="icon-pagination-last" viewBox="0 0 1024 1024">
<title>last</title>
<path d="M25.11 921.322q-10.602 10.602 -17.856 7.254t-7.254 -17.856v-821.376q0 -14.508 7.254 -17.856t17.856 7.254l396.18 396.18q4.464 4.464 7.254 10.602v-378.324q0 -14.508 10.602 -25.11t25.11 -10.602h71.424q14.508 0 25.11 10.602t10.602 25.11v785.664q0 14.508 -10.602 25.11t-25.11 10.602h-71.424q-14.508 0 -25.11 -10.602t-10.602 -25.11v-378.324q-2.79 5.58 -7.254 10.602z" fill="#000000"/></path>
</symbol>
</defs>
</svg>
{if $drawList}
<div class="has_toolbar">
<h2>{$CONST.EDIT_ENTRIES}</h2>
@ -185,7 +197,10 @@
<h3>{$CONST.PAGE_BROWSE_ENTRIES|sprintf:($page+1):$totalPages:$totalEntries}</h3>
<ul class="clearfix">
<li class="first">{if ($page) > 0}<a class="button_link" href="{$linkFirst}" title="{$CONST.FIRST}"><span class="visuallyhidden">{$CONST.FIRST} </span><svg class="icon icon-pagination-first"><use xlink:href="#icon-pagination-first"></use></svg></a>{/if}</li>
<li class="prev">{if ($offSet > 0)}<a class="button_link" href="{$linkPrevious}" title="{$CONST.PREVIOUS}"><span class="icon-left-dir"></span><span class="visuallyhidden"> {$CONST.PREVIOUS}</span></a>{else}<span class="visuallyhidden">{$CONST.NO_ENTRIES_TO_PRINT}</span>{/if}</li>
{* Looks weird, but last will be placed to end by the CSS float:right *}
<li class="last">{if ($page+1) < $totalPages}<a class="button_link" href="{$linkLast}{$totalPages-1}" title="{$CONST.LAST}"><span class="visuallyhidden">{$CONST.LAST} </span><svg class="icon icon-pagination-last"><use xlink:href="#icon-pagination-last"></use></svg></a>{/if}</li>
<li class="next">{if ($count > $perPage)}<a class="button_link" href="{$linkNext}" title="{$CONST.NEXT}"><span class="visuallyhidden">{$CONST.NEXT} </span><span class="icon-right-dir"></span></a>{else}<span class="visuallyhidden">{$CONST.NO_ENTRIES_TO_PRINT}</span>{/if}</li>
</ul>
</nav>

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

@ -1,3 +1,17 @@
<svg display="none" width="0" height="0" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<defs>
<symbol id="icon-pagination-first" viewBox="0 0 1024 1024">
<title>first</title>
<path d="M546.282 78.742q10.602 -10.602 17.856 -7.254t7.254 17.856v821.376q0 14.508 -7.254 17.856t-17.856 -7.254l-396.18 -396.18q-5.022 -5.022 -7.254 -10.602v378.324q0 14.508 -10.602 25.11t-25.11 10.602h-71.424q-14.508 0 -25.11 -10.602t-10.602 -25.11v-785.664q0 -14.508 10.602 -25.11t25.11 -10.602h71.424q14.508 0 25.11 10.602t10.602 25.11v378.324q2.232 -6.138 7.254 -10.602z" fill="#000000"/></path>
</symbol>
<symbol id="icon-pagination-last" viewBox="0 0 1024 1024">
<title>last</title>
<path d="M25.11 921.322q-10.602 10.602 -17.856 7.254t-7.254 -17.856v-821.376q0 -14.508 7.254 -17.856t17.856 7.254l396.18 396.18q4.464 4.464 7.254 10.602v-378.324q0 -14.508 10.602 -25.11t25.11 -10.602h71.424q14.508 0 25.11 10.602t10.602 25.11v785.664q0 14.508 -10.602 25.11t-25.11 10.602h-71.424q-14.508 0 -25.11 -10.602t-10.602 -25.11v-378.324q-2.79 5.58 -7.254 10.602z" fill="#000000"/></path>
</symbol>
</defs>
</svg>
<div class="has_toolbar">
<h2>{$CONST.MEDIA_LIBRARY}</h2>
@ -198,7 +212,10 @@
<h3>{$CONST.PAGE_BROWSE_ENTRIES|sprintf:$media.page:$media.pages:$media.totalImages}</h3>
<ul class="clearfix">
<li class="first">{if $media.page > 1}<a class="button_link" href="{$media.linkFirst}" title="{$CONST.FIRST}"><span class="visuallyhidden">{$CONST.FIRST} </span><svg class="icon icon-pagination-first"><use xlink:href="#icon-pagination-first"></use></svg></a>{/if}</li>
<li class="prev">{if $media.page != 1 AND $media.page <= $media.pages}<a class="button_link" href="{$media.linkPrevious}" title="{$CONST.PREVIOUS}"><span class="icon-left-dir"></span><span class="visuallyhidden"> {$CONST.PREVIOUS}</span></a>{else}<span class="visuallyhidden">{$CONST.NO_ENTRIES_TO_PRINT}</span>{/if}</li>
{* Looks weird, but last will be at end by the CSS float:right *}
<li class="last">{if $media.page < $media.pages}<a class="button_link" href="{$media.linkLast}" title="{$CONST.LAST}"><span class="visuallyhidden">{$CONST.LAST} </span><svg class="icon icon-pagination-last"><use xlink:href="#icon-pagination-last"></use></svg></a>{/if}</li>
<li class="next">{if $media.page != $media.pages}<a class="button_link" href="{$media.linkNext}" title="{$CONST.NEXT}"><span class="visuallyhidden">{$CONST.NEXT} </span><span class="icon-right-dir"></span></a>{else}<span class="visuallyhidden">{$CONST.NO_ENTRIES_TO_PRINT}</span>{/if}</li>
</ul>
</nav>

Before

Width:  |  Height:  |  Size: 13 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -456,6 +456,13 @@ progress div.progress-undefined {
.icon-block:before { content: '\e82a'; }
.icon-rocket:before { content: '\e82c'; }
/* svg based */
.icon-pagination-first,
.icon-pagination-last {
width: 0.75em;
height: 1em;
vertical-align: text-bottom;
}
/* BACKEND HELPER CLASSES */
.icon_link,
@ -1217,12 +1224,16 @@ summary {
.template_info dt,
.template_info dd,
#entries_list .form_check,
.pagination .first,
.pagination .prev,
.pagination .next,
.serendipity_customfields textarea,
#dashboard_header h2 {
float: left;
}
.pagination .next,
.pagination .last {
float: right;
}
#mediaPropertyForm .media_wrap_thumb {
display: inline-block;
@ -1271,12 +1282,16 @@ summary {
width: 48%;
}
.pagination .first,
.pagination .last,
.pagination .prev,
.pagination .next {
min-height: 1px;
width: 50%;
width: 2.2em;
}
.first .button_link, .last .button_link {
width: .5em;
}
.pagination > ul {
min-height: 1em;
}
@ -2220,6 +2235,7 @@ label .perm_name,
.pluginmanager_ownership,
.pluginmanager_move,
.pagination .next,
.pagination .last,
#login .form_buttons {
text-align: right;
}