Hello,
On Mon, Mar 7, 2011 at 12:39 AM, Ricardo Rodriguez [eBioTIC.] <
ricardo.rodriguez(a)ebiotic.net> wrote:
Hi all!
I'm still struggling to understand how expanded/collapsed state of
panels do work.
I'm currently using a 2.4.30451 XE/XEM installation.
Looking for macros controlling this state in macros.vm, I see:
***
#macro(panelheader $title)
#set($cookieName =
"${context.user.replaceAll(':','')}_${panel}")
#set($expanded = $xwiki.getUserPreferenceFromCookie($cookieName))
#if(!$expanded)
#set($expanded = 'expanded')
#end
## Note: We pass the Panel name as an HTML class attribute so that it's
possible to style
## the Panels selectively using CSS.
#set ($specialClassAttribute = "")
#if ($paneldoc && $paneldoc != "")
#set ($specialClassAttribute =
$util.convertToAlphaNumeric($paneldoc.name))
#end
<div class="panel $expanded $specialClassAttribute">
<h1 class="xwikipaneltitle"
onclick="togglePanelVisibility(this.parentNode,
'${cookieName}');">$title</h1>
<div class="xwikipanelcontents">
#end
***
This macro creates an expanded panel. By clicking the panel title, the
system creates a cookie that stores her current state.
But if I modify this macro and says...
#if(!$expanded)
#set($expanded = 'collapsed')
#end
No macro is created and panels are always collapsed when loaded and
after relaoding.
That is because 'collapsed' is used as a class name for the panel dom
element and there is also a CSS rule which says that panels with 'collapsed'
class name are being displayed as collapsed.
So, the default logic is like this:
1) take the $expanded value from a cookie
2) set the panel dom element class name as being the value of $expanded
3) on loading the page, with the help of CSS, display the panel as being
'collapsed' or 'expanded', depending on the value of $expanded
And in your case, this is the logic:
1) set the value of $expanded as being 'collapsed'
2) set the panel dom element class name as being the value of $expanded
(which is 'collapsed')
3) on loading the page, with the help of CSS, display the panel as being
'collapsed', this being the value of $expanded
I hope that this helps you understand the logic behind 'collapsed' and
'expanded' panels.
Raluca.
Please, could you me understand why?
Thank you so much!!!
Ricardo
--
Ricardo RodrÃguez
CTO
eBioTIC.
Life Sciences, Data Modeling and Information Management Systems
_______________________________________________
users mailing list
users(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/users