Commit d4fe48669904a3acc54e2de5f43710eeda296f5a
1 parent
0c13a3ce
Make sure the pagination deals well with a truly large number of
documents in a single folder. Being somewhat UI-code, this probably needs a review. git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@4951 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
39 additions
and
5 deletions
templates/kt3/document_collection.smarty
| ... | ... | @@ -42,6 +42,7 @@ |
| 42 | 42 | <tr> |
| 43 | 43 | <td colspan="{$columncount}"><span class="descriptiveText"> |
| 44 | 44 | {i18n arg_itemCount=$context->itemCount arg_batchSize=$context->batchSize}#itemCount# items, #batchSize# per page{/i18n}</span> |
| 45 | + <span class="collectionNavigation"> | |
| 45 | 46 | {if ($pagecount > 1)} |
| 46 | 47 | {if ($currentpage == 0)} |
| 47 | 48 | <span class="notactive">« prev</a> |
| ... | ... | @@ -54,15 +55,48 @@ |
| 54 | 55 | {else} |
| 55 | 56 | <a href="{$context->pageLink($currentpage+1)}">next »</a> |
| 56 | 57 | {/if} |
| 57 | - {foreach item=showPage from=1|range:$pagecount} | |
| 58 | - · | |
| 59 | - {if ($showPage-1 != $currentpage)} | |
| 60 | - <a href="{$context->pageLink($showPage-1)}">{$showPage}</a> | |
| 58 | + {assign var=shownEllipsis value=false} | |
| 59 | + {foreach item=showPage from=1|range:$pagecount name=pagecrumbs} | |
| 60 | + {assign var=showCrumb value=false} | |
| 61 | + {capture assign=relative}{$showPage-1-$currentpage}{/capture} | |
| 62 | + {if $smarty.foreach.pagecrumbs.total <= 27} | |
| 63 | + {assign var=showCrumb value=true} | |
| 64 | + {elseif $showPage <= 5} | |
| 65 | + {assign var=showCrumb value=true} | |
| 66 | + {elseif abs($relative) <= 5} | |
| 67 | + {assign var=showCrumb value=true} | |
| 68 | + {elseif $relative > 0 and $relative <= 10} | |
| 69 | + {assign var=showCrumb value=true} | |
| 70 | + {elseif abs($smarty.foreach.pagecrumbs.total - ($showPage - 1)) <= 3 } | |
| 71 | + {assign var=showCrumb value=true} | |
| 72 | + {elseif $currentpage < 13 && $showPage <= 23} | |
| 73 | +{*ie, show up to 23 always, 13 = 23 - 10 (forward)*} | |
| 74 | + {assign var=showCrumb value=true} | |
| 75 | + {elseif ($smarty.foreach.pagecrumbs.total - $currentpage) < 16 && ($smarty.foreach.pagecrumbs.total - $showPage) < 20} | |
| 76 | +{*ie, always show back 20 if we're in the last 20, | |
| 77 | +(not 23, since we show 5 from the front if not in the front 23 or so, | |
| 78 | +and only 3 from the back if we're not in the back 20 or so. 20 - 16 = 5 | |
| 79 | +(according to my math)*} | |
| 80 | + {assign var=showCrumb value=true} | |
| 81 | + {/if} | |
| 82 | + | |
| 83 | + {if $showCrumb} | |
| 84 | + · | |
| 85 | + {if ($showPage-1 != $currentpage)} | |
| 86 | + <a href="{$context->pageLink($showPage-1)}">{$showPage}</a> | |
| 87 | + {else} | |
| 88 | + <span class="batchCurrent">{$showPage}</span> | |
| 89 | + {/if} | |
| 90 | + {assign var=shownEllipsis value=false} | |
| 61 | 91 | {else} |
| 62 | - <span class="batchCurrent">{$showPage}</span> | |
| 92 | + {if not $shownEllipsis} | |
| 93 | + · … | |
| 94 | + {assign var=shownEllipsis value=true} | |
| 95 | + {/if} | |
| 63 | 96 | {/if} |
| 64 | 97 | {/foreach} |
| 65 | 98 | {/if} |
| 99 | + </span> | |
| 66 | 100 | </td> |
| 67 | 101 | </tr> |
| 68 | 102 | </tfoot> | ... | ... |