Wiki source code of Scope of a Panel Configuration
Last modified by Eleni Cojocariu on 2026/08/28 09:53
Show last authors
| author | version | line-number | content |
|---|---|---|---|
| 1 | A Panel configuration is not global: the same wiki can show one set of Panels on its home page and another on a blog post. Three levels decide what a reader finally sees, each narrower than the last. | ||
| 2 | |||
| 3 | {{plantuml}} | ||
| 4 | @startuml | ||
| 5 | !theme bluegray | ||
| 6 | start | ||
| 7 | if (does the page's own administration set a Panel configuration?) then (yes) | ||
| 8 | :read the values from the page's WebPreferences; | ||
| 9 | else (no) | ||
| 10 | :read the values from XWiki.XWikiPreferences; | ||
| 11 | endif | ||
| 12 | :render the Panels listed in leftPanels and rightPanels; | ||
| 13 | if (does a Panel's own content test the page?) then (yes) | ||
| 14 | :the Panel decides what, if anything, to output; | ||
| 15 | else (no) | ||
| 16 | :the Panel outputs its usual content; | ||
| 17 | endif | ||
| 18 | stop | ||
| 19 | @enduml | ||
| 20 | {{/plantuml}} | ||
| 21 | |||
| 22 | The **wiki level** is the Panel Wizard opened from the wiki administration. It writes ##leftPanels##, ##rightPanels##, ##showLeftPanels##, ##showRightPanels##, ##leftPanelsWidth## and ##rightPanelsWidth## onto the ##XWiki.XWikiPreferences## xobject, and applies to every page that does not override them. | ||
| 23 | |||
| 24 | The **page level** is the same Wizard opened from a page's administration. It writes the same six properties onto that page's ##WebPreferences##, and they replace the wiki values for that page and the pages under it. This is why the blog "Categories" Panel can appear beside a blog post and nowhere else. | ||
| 25 | |||
| 26 | The **Panel level** is the Panel's own "Content", and it is the only way to make a Panel conditional on something the two levels above cannot express, such as a single page or a group of users. A Panel that tests the current page before it outputs anything is placed once, at wiki level, and still shows up only where you want it: | ||
| 27 | |||
| 28 | {{code language="velocity"}} | ||
| 29 | #if ($doc.fullName == 'Main.WebHome') | ||
| 30 | #panelheader('Recent changes') | ||
| 31 | ... the Panel's usual content ... | ||
| 32 | #panelfooter() | ||
| 33 | #end | ||
| 34 | {{/code}} | ||
| 35 | |||
| 36 | What none of the three levels controls is the shape of a column the reader can see: whether it is collapsed, and how wide it is, is each reader's own choice, kept in their browser. |