On Fri, Jan 13, 2012 at 10:46 AM, Hamster <[email protected]> wrote:
> This should be easy, but I am stuck :-(
>

> I have created a new panel. The panel shows all the document in the current
> space.

Are you aware of Panels.SpaceDocs ? It does exactly this. Check out
the code by editing in "Inline form" edit mode.

>
> But if the user is in the Main Space, I don't want to show any documents, I
> want to show all the spaces (except for a couple default spaces).
>
> #if $currentSpace = "Main"
>  #set ($hiddenSpaces = ["AnnotationCode", "ColorThemes", "Invitation",
> "Panels", "Scheduler", "Stats", "XWiki"])
>  #set($spacesSorted=$xwiki.sort($xwiki.spaces) )
>  #foreach($space in $spacesSorted)
>  #if (!$hiddenSpaces.contains($space))
>   * [[$space>>${space}.WebHome]]
>  #end
>  #end
> #else
>  // Code which shows all documents
> #end
>

> How do I know when I am in the Main Space?

See http://platform.xwiki.org/xwiki/bin/view/DevGuide/Scripting#HBindings
. You can get the current space from the current document.

Hope this helps,
Marius

>
> --
> View this message in context: 
> http://xwiki.475771.n2.nabble.com/Get-current-space-velocity-tp7183403p7183403.html
> Sent from the XWiki- Dev mailing list archive at Nabble.com.
> _______________________________________________
> devs mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to