Изменения документа HRlink. Новости об обновлениях
Редактировал(а) HRlink 22.08.2025
Сводка
-
Свойства страницы (1 изменено, 0 добавлено, 0 удалено)
Подробности
- Свойства страницы
-
- Содержимое
-
... ... @@ -1,36 +1,31 @@ 1 +{{blog space="Blog.HRlink.-Novosti-ob-obnovleniiakh-" /}} 1 1 {{velocity}} 2 -## === НАСТРОЙКИ === 3 3 #set($PERPAGE = 10) 4 4 5 -## 1) Текущаястраницакатегориии её "пространство" какпрефикс для документов6 -#set($full = $doc.fullName) ## например: Blog.HRlink.-Novosti-ob-obnovleniiakh-.WebHome5 +## префикс ветки, например: Blog.HRlink.-Novosti-ob-obnovleniiakh-. 6 +#set($full = $doc.fullName) 7 7 #set($lastDot = $full.lastIndexOf('.')) 8 -#set($ SPACE_PREFIX = $full.substring(0, $lastDot) + ".")## например: Blog.HRlink.-Novosti-ob-obnovleniiakh-.8 +#set($PREFIX = $full.substring(0, $lastDot) + ".") 9 9 10 -## 2) Текущая страницапагинации11 -#set($p = $request.get('p') )#if(!$p) #set($p =1)#end12 -# set($p = $numbertool.toInteger($p)) #if($p < 1) #set($p = 1) #end10 +## пагинация 11 +#set($p = $numbertool.toInteger($!request.get('p') ?: 1)) 12 +#if($p < 1) #set($p = 1) #end 13 13 #set($offset = ($p - 1) * $PERPAGE) 14 14 15 -## 3) Считаемвсепостывэтойветке(по Blog.BlogPostClass и префиксу полного имени)15 +## всего документов в ветке 16 16 #set($total = $services.query.hql( 17 - "select count(doc.fullName) " + 18 - "from XWikiDocument doc, BaseObject o " + 19 - "where o.name = doc.fullName and o.className = 'Blog.BlogPostClass' " + 20 - "and doc.fullName like :prefix" 21 -).bindValue("prefix", $SPACE_PREFIX + "%").execute().get(0)) 17 + "select count(doc.fullName) from XWikiDocument doc " + 18 + "where doc.fullName like :prefix" 19 +).bindValue("prefix", $PREFIX + "%").execute().get(0)) 22 22 23 -## 4) Берём текущую страницу постов 24 -#set($posts = $services.query.hql( 25 - "select doc.fullName " + 26 - "from XWikiDocument doc, BaseObject o " + 27 - "where o.name = doc.fullName and o.className = 'Blog.BlogPostClass' " + 28 - "and doc.fullName like :prefix " + 21 +## текущая страница документов (новые сверху) 22 +#set($docs = $services.query.hql( 23 + "select doc.fullName from XWikiDocument doc " + 24 + "where doc.fullName like :prefix " + 29 29 "order by doc.date desc" 30 -).bindValue("prefix", $ SPACE_PREFIX + "%").setLimit($PERPAGE).setOffset($offset).execute())26 +).bindValue("prefix", $PREFIX + "%").setLimit($PERPAGE).setOffset($offset).execute()) 31 31 32 -## 5) Рисуем ленту 33 -#foreach($fn in $posts) 28 +#foreach($fn in $docs) 34 34 #set($d = $xwiki.getDocument($fn)) 35 35 <article style="margin:14px 0; padding-bottom:10px; border-bottom:1px solid #e5e7eb"> 36 36 <div style="color:#6b7280; font-size:.9em">$datetool.format('dd MMM yyyy', $d.date)</div> ... ... @@ -39,7 +39,6 @@ 39 39 </article> 40 40 #end 41 41 42 -## 6) Пагинация 43 43 #if($total > $PERPAGE) 44 44 #set($pages = ($total + $PERPAGE - 1) / $PERPAGE) 45 45 #set($base = $doc.getURL('view'))