Sergiu Dumitriu wrote:
On 11/10/2010 02:32 PM, [Ricardo Rodriguez] eBioTIC. wrote:
Hi!
Following these lines in the panelheader macro un macros.vm...
#macro(panelheader $title) #set($cookieName = "${context.user}_${panel}") #set($expanded = $xwiki.getUserPreferenceFromCookie($cookieName)) #if(!$expanded) #set($expanded = 'expanded') #end
I understand that the default value, expanded, for XWiki panels is set there. This code says:
1. Set the name of the cookie that fixes the expanded/collapsed state for a given user and panel. 2. If this cookie exists and it has this preference set, it takes the value from it. 3. If fails to get the value from the cookie, set the value as 'expanded'
Thus, all panels are shown expanded by default and, to the best of my understanding, setting:
#set($expanded = 'collapsed')
Must show all the panels closed.
I'm not able to get this working. Please, where am I wrong?
It should work (just tried it locally), but changing macros.vm requires that you restart the server, since the macros are loaded at startup and cached.
Thanks, Sergiu. I've done such an amount of trials that I do need to confirm the process step by step to avoid mess up things. Yes, it does work. If I #set($expanded = 'collapsed') and restart the server, all panels are shown collapsed by default. BUT, they are showed collapsed each time a refresh the page: the cookie is not able to "remember" their state. It does work if $expanded = 'expanded', but it doesn't work if $expanded = 'collapsed'. I'm making trials with e XE 2.6-SNAPSHOT.32286 Could you figure out why? Thanks! Ricardo -- Ricardo RodrÃguez CTO eBioTIC. Life Sciences, Data Modeling and Information Management Systems