Hi Wouter,

On 06/08/2011 11:45 AM, Wouter de Vos wrote:
> Hi all,
>
> I use the recently changed documents panel on our wiki, and it works 
> perfectly.
>
> However, the panel shows me all the changes in all the documents in
> all the spaces.
> But I want that it shows only the changes in certain spaces, in the
> current space where the user is in, and in a global space that all
> users can see.
> I know I have to add something to the header code of the panel, but I
> cannot find what I need to add there.
>
> I hope someone out there can give me a hint, or better, a solution, to my 
> issue.

The quickest and less error prone solution for you is to edit the 
"Panels.Recently Modified" page and replace the first line:

#set($recentlyModified = $xwiki.searchDocuments('where 1=1 order by 
doc.date desc', 5, 0))

with these two lines:

#set($spaceList = ['Space1', 'Space2', $doc.space, 'GlobalSpace'])
#set($recentlyModified = $xwiki.searchDocuments('where doc.web in (?, ?, 
?, ?) order by doc.date desc', 5, 0, $spaceList))

Of course you should adjust the space list but make sure the number of ? 
(question marks) equals the number of spaces in the list).

Hope this helps,
Marius

P.S: @developers: I tried to use the query manager as follows:

#set($recentlyModified = $services.query.hql('select fullName from 
XWikiDocument where web in (:spaces) order by date 
desc').setLimit(5).setOffset(0).bindValue('spaces', $spaceList).execute())

but I get:

Caused by: com.xpn.xwiki.XWikiException: Error number 0 in 3: Exception 
while hibernate execute
Wrapped Exception: java.util.ArrayList cannot be cast to java.lang.String
        at 
com.xpn.xwiki.store.XWikiHibernateBaseStore.execute(XWikiHibernateBaseStore.java:1087)
        at 
com.xpn.xwiki.store.XWikiHibernateBaseStore.executeRead(XWikiHibernateBaseStore.java:1117)
        at 
com.xpn.xwiki.store.hibernate.query.HqlQueryExecutor.execute(HqlQueryExecutor.java:88)
        ... 169 more

We need to improve the XWikiHibernateBaseStore to support list parameters.

>
> Thanks in advance for your help,
>
> Wouter
> _______________________________________________
> users mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/users
_______________________________________________
users mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to