document_collection.smarty
5.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<table class="kt_collection" cellspacing="0" name="browseForm">
<thead>
<tr>
{foreach item=oColumn from=$context->columns}
{if $oColumn->getSortedOn() }
<th class="sort_on sort_{$oColumn->getSortDirection()}">
{else}
<th>
{/if}
{$oColumn->renderHeader($context->returnURL)}</th>
{/foreach}
</tr>
</thead>
<tbody>
{if ($context->itemCount != 0)}
{foreach item=folder_row_id from=$context->activeset.folders name=rowiter}{* For folders *}
<tr class="{cycle name=rows values=",odd"} folder_row">
{foreach item=oColumn from=$context->columns name=coliter}
<td class="browse_column {$oColumn->name} {if $oColumn->getSortedOn()}sort_on{/if}">
{$oColumn->renderData($context->getFolderInfo($folder_row_id.id))}
</td>
{/foreach}
</tr>
{/foreach}
{foreach item=document_row_id from=$context->activeset.documents name=rowiter}{* For files *}
<tr class="{cycle name=rows values=",odd"}">
{foreach item=oColumn from=$context->columns name=coliter}
<td class="browse_column {$oColumn->name} {if $oColumn->getSortedOn()}sort_on{/if}">
{$oColumn->renderData($context->getDocumentInfo($document_row_id.id))}
</td>
{/foreach}
</tr>
{/foreach}
{else}
<tr><td colspan="{$columncount}">{$context->empty_message}</td></tr>
{/if}
</tbody>
<tfoot>
<tr>
{if ($bIsBrowseCollection)}
<td colspan="{$columncount-1}"><span class="descriptiveText">
{else}
<td colspan="{$columncount}"><span class="descriptiveText">
{/if}
{i18n arg_itemCount=$context->itemCount arg_batchSize=$context->batchSize}#itemCount# items, #batchSize# per page{/i18n}</span>
<span class="collectionNavigation">
{if ($pagecount > 1)}
{if ($currentpage == 0)}
<span class="notactive">« prev</a>
{else}
<a href="{$context->pageLink($currentpage-1)}">« {i18n}prev{/i18n}</a>
{/if}
·
{if ($currentpage == $pagecount-1)}
<span class="notactive">{i18n}next{/i18n} »</a>
{else}
<a href="{$context->pageLink($currentpage+1)}">{i18n}next{/i18n} »</a>
{/if}
{assign var=shownEllipsis value=false}
{foreach item=showPage from=1|range:$pagecount name=pagecrumbs}
{assign var=showCrumb value=false}
{capture assign=relative}{$showPage-1-$currentpage}{/capture}
{if $smarty.foreach.pagecrumbs.total <= 27}
{assign var=showCrumb value=true}
{elseif $showPage <= 5}
{assign var=showCrumb value=true}
{elseif abs($relative) <= 5}
{assign var=showCrumb value=true}
{elseif $relative > 0 and $relative <= 10}
{assign var=showCrumb value=true}
{elseif abs($smarty.foreach.pagecrumbs.total - ($showPage - 1)) <= 3 }
{assign var=showCrumb value=true}
{elseif $currentpage < 13 && $showPage <= 23}
{*ie, show up to 23 always, 13 = 23 - 10 (forward)*}
{assign var=showCrumb value=true}
{elseif ($smarty.foreach.pagecrumbs.total - $currentpage) < 16 && ($smarty.foreach.pagecrumbs.total - $showPage) < 20}
{*ie, always show back 20 if we're in the last 20,
(not 23, since we show 5 from the front if not in the front 23 or so,
and only 3 from the back if we're not in the back 20 or so. 20 - 16 = 5
(according to my math)*}
{assign var=showCrumb value=true}
{/if}
{if $showCrumb}
·
{if ($showPage-1 != $currentpage)}
<a href="{$context->pageLink($showPage-1)}">{$showPage}</a>
{else}
<span class="batchCurrent">{$showPage}</span>
{/if}
{assign var=shownEllipsis value=false}
{else}
{if not $shownEllipsis}
· …
{assign var=shownEllipsis value=true}
{/if}
{/if}
{/foreach}
{/if}
</span>
</td>
{if ($bIsBrowseCollection)}
<td>
<select name="perpage" onchange="document_collection_setbatching(this.value, '{$returnURL|htmlentities}');">
<option value="10" {if ($batch_size == 10)}selected="true"{/if}>10</option>
<option value="25" {if ($batch_size == 25)}selected="true"{/if}>25</option>
<option value="50" {if ($batch_size == 50)}selected="true"{/if}>50</option>
</select> {i18n}per page{/i18n}
</td>
{/if}
</tr>
</tfoot>
</table>