Версия 28.1 от HRlink на 22.08.2025

Последние авторы
1 {{velocity}}
2 #set($PERPAGE = 10)
3
4 ## Текущее пространство (space) категории. Для WebHome это именно нужная ветка.
5 #set($SPACE = $doc.space)
6
7 ## Пагинация
8 #set($p = $request.get('p')) #if(!$p) #set($p = 1) #end
9 #set($p = $numbertool.toInteger($p)) #if($p < 1) #set($p = 1) #end
10 #set($offset = ($p - 1) * $PERPAGE)
11
12 ## Сколько документов в этом space (исключаем сам WebHome)
13 #set($total = $services.query.xwql(
14 "select count(doc.fullName) from Document doc " +
15 "where doc.space = :sp and doc.name <> 'WebHome'"
16 ).bindValue('sp', $SPACE).execute().get(0))
17
18 ## Берём текущую порцию документов, новые сверху
19 #set($rows = $services.query.xwql(
20 "select doc.fullName from Document doc " +
21 "where doc.space = :sp and doc.name <> 'WebHome' " +
22 "order by doc.date desc"
23 ).bindValue('sp', $SPACE).setLimit($PERPAGE).setOffset($offset).execute())
24
25 #if($total == 0)
26 <p>Пока нет публикаций в этой ветке.</p>
27 #else
28 #foreach($fn in $rows)
29 #set($d = $xwiki.getDocument($fn))
30 <article style="margin:14px 0; padding-bottom:10px; border-bottom:1px solid #e5e7eb">
31 <div style="color:#6b7280; font-size:.9em">$datetool.format('dd MMM yyyy', $d.date)</div>
32 <h3 style="margin:.2rem 0"><a href="$d.getURL('view')">$escapetool.html($d.displayTitle)</a></h3>
33 <div>$!d.getPlainContent().substring(0,300)…</div>
34 </article>
35 #end
36
37 #if($total > $PERPAGE)
38 #set($pages = ($total + $PERPAGE - 1) / $PERPAGE)
39 #set($base = $doc.getURL('view'))
40 #set($prev = $math.sub($p, 1))
41 #set($next = $math.add($p, 1))
42 <nav style="margin-top:1em; display:flex; gap:1em; align-items:center">
43 #if($p > 1)<a href="$base?p=$prev">← Назад</a>#else<span style="opacity:.5">← Назад</span>#end
44 <span>Стр. $p / $pages</span>
45 #if($p < $pages)<a href="$base?p=$next">Далее →</a>#else<span style="opacity:.5">Далее →</span>#end
46 </nav>
47 #end
48 #end
49 {{/velocity}}