Изменения документа HRlink. Новости об обновлениях
Редактировал(а) HRlink 22.08.2025
Сводка
-
Свойства страницы (1 изменено, 0 добавлено, 0 удалено)
Подробности
- Свойства страницы
-
- Содержимое
-
... ... @@ -1,26 +1,37 @@ 1 1 {{velocity}} 2 2 #set($PERPAGE = 10) 3 3 4 -## Родитель =текущая страница категории/подкатегории4 +## 1) Родитель — текущая страница категории 5 5 #set($PARENT = $doc.fullName) 6 6 7 -## Пагинация 7 +## 2) Пагинация 8 8 #set($p = $request.get('p')) #if(!$p) #set($p = 1) #end 9 9 #set($p = $numbertool.toInteger($p)) #if($p < 1) #set($p = 1) #end 10 10 #set($offset = ($p - 1) * $PERPAGE) 11 11 12 -## С колькодочернихстраницу этойкатегории13 -#set($total = $services.query. xwql(14 - "select count(d oc.fullName) from Document docwhere doc.parent = :parent"12 +## 3) Сначала пробуем просто по parent (все дочерние документы) 13 +#set($total = $services.query.hql( 14 + "select count(d.fullName) from XWikiDocument d where d.parent = :parent" 15 15 ).bindValue("parent", $PARENT).execute().get(0)) 16 16 17 -## Берём текущую порцию детей, новые сверху 18 -#set($rows = $services.query.xwql( 19 - "select doc.fullName from Document doc " + 20 - "where doc.parent = :parent order by doc.date desc" 17 +#set($rows = $services.query.hql( 18 + "select d.fullName from XWikiDocument d " + 19 + "where d.parent = :parent order by d.date desc" 21 21 ).bindValue("parent", $PARENT).setLimit($PERPAGE).setOffset($offset).execute()) 22 22 22 +## 4) Если вдруг пусто (редкие конфигурации), подстрахуемся выборкой по space 23 23 #if($total == 0) 24 + #set($SPACE = $doc.space) 25 + #set($total = $services.query.hql( 26 + "select count(d.fullName) from XWikiDocument d where d.space = :space" 27 + ).bindValue("space", $SPACE).execute().get(0)) 28 + #set($rows = $services.query.hql( 29 + "select d.fullName from XWikiDocument d where d.space = :space order by d.date desc" 30 + ).bindValue("space", $SPACE).setLimit($PERPAGE).setOffset($offset).execute()) 31 +#end 32 + 33 +## 5) Рендер ленты 34 +#if($total == 0) 24 24 <p>Пока нет публикаций в этой ветке.</p> 25 25 #else 26 26 #foreach($fn in $rows) ... ... @@ -32,6 +32,7 @@ 32 32 </article> 33 33 #end 34 34 46 + ## Пагинация 35 35 #if($total > $PERPAGE) 36 36 #set($pages = ($total + $PERPAGE - 1) / $PERPAGE) 37 37 #set($base = $doc.getURL('view'))