Změny dokumentu Macro - changedpages1 - forTest
Naposledy upravil David Brazda 28.04.2021 07:58
Popis verze:
Update average rating
Přehled
-
Objects (1 změněno, 0 přidáno, 0 odstraněno)
Rozpis
- XWiki.WikiMacroClass[0]
-
- Macro code
-
... ... @@ -1,19 +1,21 @@ 1 1 {{velocity}} 2 -##fetches last 5created pages in 30days2 +##fetches last 6 created pages in 30days 3 3 #set($howManyDays = 30) 4 4 #set($limit = 5) 5 5 #set($fromDate = $datetool.systemCalendar) 6 -#set($discard = $fromDate.add(6,-$howManyDays)) 7 -#set ($list = $services.query.xwql('where doc.date > :date and doc.hidden = 0 order by doc.date desc').bindValue('date', $datetool.toDate($fromDate)).setLimit($limit).execute()) 6 +#set($discard = $fromDate.add(7,-$howManyDays)) 7 +#set ($list = $services.query.xwql('where doc.creationDate > :date and doc.hidden = 0 order by doc.creationDate desc').bindValue('date', $datetool.toDate($fromDate)).setLimit($limit).execute()) 8 +##if there are less than $limit pages created in 30 days, then repeat the query without 30days limitation 9 +#if ($list.size() < $limit) 10 +#set ($list = $services.query.xwql('where doc.hidden = 0 order by doc.creationDate desc').setLimit($limit).execute()) 11 +#end 8 8 #if ($list.size() != 0) 9 -N aposledyupravené13 +Nově vytvořené stránky 10 10 #foreach($reference in $list) 11 11 #set ($document = $xwiki.getDocument($reference)) 12 - #set ($parentDoc = $xwiki.getDocument($document.parent)) 13 - ## nezobrazujeme skryte stranky a stranky na ktere zrovna jsme a ty na ktere nema autor prave (getTitle vraci null) 14 - #if ((!$document.isHidden()) && ($document != $doc) && ($document.getTitle())) 15 - * [[$document.getTitle()>>$document]] reference $reference v sekci #if ($document.parent) [[$parentDoc.getTitle()>>$parentDoc]] #end 16 - 16 + #if (!$document.isHidden() && ($document.getTitle())) 17 + #set ($label = $document.getTitle()) 18 + * [[$label>>$document]] 17 17 #end 18 18 #end 19 19 #end