Hi,
Sergiu Dumitriu wrote:
Can you try and fix the js?
Thanks
I didn't fix the js, but this works for me. It works with any (well, at
least one, two or three) white spaces between words in the panel
document name. I've only removed the spaces from the cookieName by using
the replace() method. Thanks to Jonathan Revusky in the Velocity Users List!
$initialState must be set in the panel code. It has two posible
values/states: collapsed or expanded. Thus, the schema of a new panel
would be...
#set($initialState= "[collapsed|expanded]")
#panelheaderc ("Panel Title")
[panel content]
#panelfooter ( )
May I use this syntaxis, [collapsed|expanded], to represent alternative
content?
And the macro will be...
#macro(panelheaderc $title)
#if("$initialState" == "collapsed")
#set($alternativeState = "expanded")
#else
#set($alternativeState = "collapsed")
#end
#set($cookieName = "${context.user}_${panel}")
#set($cookieName = $cookieName.replace(" ", ""))
#set($expanded = $initialState)
#set($expanded = $xwiki.getUserPreferenceFromCookie($cookieName))
## 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">
<h5 class="xwikipaneltitle" onclick="if(eltHasClass(this.parentNode,
'$initialState')) createCookie('$cookieName','$alternativeState',
'');
else eraseCookie('$cookieName');
togglePanelVisibility(this.parentNode);">$title</h5>
<div class="xwikipanelcontents">
#end
I will move this to an ad hoc Jira issue. Thanks!
Cheers,
Ricardo
--
Ricardo RodrÃguez
Your EPEC Network ICT Team