[xwiki-users] collapsed panels (continued)
I want to maintain the "expanded/collapsed"-status of my panels when surfing my xwiki. I've seen the post http://lists.xwiki.org/pipermail/users/2008-March/010746.html :
On Mar 2, 2008, at 12:01 PM, [Ricardo Rodriguez] Your EPEC Network ICT Team wrote:
Hi all,
After googling for a while, I realize that the collapsing/expanding trick is a quite vaste issue!
Please, is it possible to force XWiki to deliver collapsed panels? Or even better: is it possible to set a panels to be delivered , by default, collapsed or expanded?
Yes, that's what we do now.... :) Check in edit mode for example, there are panels that are collapsed. Edit those panels and you'll see how it's done.
Moreover we even remember when a user has collapsed/expanded a panel in a cookie... :)
-Vincent
However, I can't see the code used for XWiki panels since I can't enter edit mode. I really want to see how to implement those cookies, so if I'm looking in the wrong place, where can I search it? rgds, Joao
Hi João, Joao Henrique Silva Santos wrote:
I want to maintain the "expanded/collapsed"-status of my panels when surfing my xwiki.
I've seen the post http://lists.xwiki.org/pipermail/users/2008-March/010746.html :
I think it would be ok to follow the original thread ;-) To maintain the status while surfing the wiki is the default behavior. Do you get a different thing? Does your browser accept cookies?
However, I can't see the code used for XWiki panels since I can't enter edit mode. I really want to see how to implement those cookies, so if I'm looking in the wrong place, where can I search it?
I read "your wiki", thus if you have installed it I don't understand why can you not enter edit mode? Even tough you have installed the default .xar, you can gain access by using Admin as username and admin as pasword. See this... http://platform.xwiki.org/xwiki/bin/view/AdminGuide/Installation#HInstalling... The code controlling status cookies is in macro.vm template. Look for it in the /templates folder under /xwiki. You must want to find macros panelheader and largepaneheader. Hope this helps, Ricardo -- Ricardo Rodríguez Your EPEC Network ICT Team
Hi Ricardo. First, I would like to say thanks for the reply. The reason I didn't reply to the original thread is because I was not registered at the time, and so I did not have the post on my inbox to reply. As for cookies, yes, my browser does accept them (I'm using firefox but there is also this behaviour for IE 6 and 7 browsers). When I say I can't enter edit mode I wasn't refering to "my wiki" :), but to Xwiki's wiki. I've already seen macro.* (I even edited so that my panels are collapsed by default), but can't find anything regarding the "memory" of the collapsed status.
From your post I gather that in the Xwiki's wiki there is not anything special for that effect, and my wiki should already behave the same way. Am I correct?
regards, Joao On 07/03/2008, [Ricardo Rodriguez] Your EPEC Network ICT Team <[email protected]> wrote:
Hi João,
Joao Henrique Silva Santos wrote: I want to maintain the "expanded/collapsed"-status of my panels when surfing my xwiki.
I've seen the post http://lists.xwiki.org/pipermail/users/2008-March/010746.html :
I think it would be ok to follow the original thread ;-)
To maintain the status while surfing the wiki is the default behavior. Do you get a different thing? Does your browser accept cookies?
However, I can't see the code used for XWiki panels since I can't enter edit mode. I really want to see how to implement those cookies, so if I'm looking in the wrong place, where can I search it?
I read "your wiki", thus if you have installed it I don't understand why can you not enter edit mode? Even tough you have installed the default .xar, you can gain access by using Admin as username and admin as pasword. See this...
http://platform.xwiki.org/xwiki/bin/view/AdminGuide/Installation#HInstalling...
The code controlling status cookies is in macro.vm template. Look for it in the /templates folder under /xwiki. You must want to find macros panelheader and largepaneheader.
Hope this helps,
Ricardo
-- Ricardo Rodríguez Your EPEC Network ICT Team
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
I've opened again the the macros.vm file, and in fact the lines #set($expanded = $xwiki.getUserPreferenceFromCookie($cookieName)) and onclick="if(eltHasClass(this.parentNode, 'expanded')) createCookie('$cookieName','collapsed', ''); else eraseCookie('$cookieName'); togglePanelVisibility(this.parentNode);">$title</h5> do seem to control the collapsed status. However, I do not get that behaviour Joao On 07/03/2008, [Ricardo Rodriguez] Your EPEC Network ICT Team <[email protected]> wrote:
Hi João,
Joao Henrique Silva Santos wrote: I want to maintain the "expanded/collapsed"-status of my panels when surfing my xwiki.
I've seen the post http://lists.xwiki.org/pipermail/users/2008-March/010746.html :
I think it would be ok to follow the original thread ;-)
To maintain the status while surfing the wiki is the default behavior. Do you get a different thing? Does your browser accept cookies?
However, I can't see the code used for XWiki panels since I can't enter edit mode. I really want to see how to implement those cookies, so if I'm looking in the wrong place, where can I search it?
I read "your wiki", thus if you have installed it I don't understand why can you not enter edit mode? Even tough you have installed the default .xar, you can gain access by using Admin as username and admin as pasword. See this...
http://platform.xwiki.org/xwiki/bin/view/AdminGuide/Installation#HInstalling...
The code controlling status cookies is in macro.vm template. Look for it in the /templates folder under /xwiki. You must want to find macros panelheader and largepaneheader.
Hope this helps,
Ricardo
-- Ricardo Rodríguez Your EPEC Network ICT Team
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
Okay, I've tested every single panel on my wiki, and I came to realize that some of the panels do behave properly (maintain their collapsed-status while browsing the wiki). Actually, all panels from the left panel-column and about half of the right panel-column do not behave properly. I do not understand this behaviour, since most of them have the same code, which is an adaptation of the regular panelheader macro: #macro(collapsedpanelheader $title) #set($cookieName = "${context.user}_${panel}") #set($expanded = "collapsed") #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, 'collapsed')) createCookie('$cookieName','expanded', ''); else eraseCookie('$cookieName'); togglePanelVisibility(this.parentNode);">$title</h5> <div class="xwikipanelcontents"> #end I have no experience with cookies, but I feel that the only thing that may be wrong here is on the tag <h5>, and I may have the "expanded" swaped with "collapsed". Changed that, and got the same behaviour. Finally, even a panel which uses the standard panelheader does not behave properly. Does anybody have a possible explanation / common problems? best regards, Joao On 10/03/2008, Joao Henrique Silva Santos <[email protected]> wrote:
I've opened again the the macros.vm file, and in fact the lines
#set($expanded = $xwiki.getUserPreferenceFromCookie($cookieName))
and
onclick="if(eltHasClass(this.parentNode, 'expanded')) createCookie('$cookieName','collapsed', ''); else eraseCookie('$cookieName'); togglePanelVisibility(this.parentNode);">$title</h5>
do seem to control the collapsed status.
However, I do not get that behaviour
Joao
On 07/03/2008, [Ricardo Rodriguez] Your EPEC Network ICT Team
<[email protected]> wrote:
Hi João,
Joao Henrique Silva Santos wrote: I want to maintain the "expanded/collapsed"-status of my panels when surfing my xwiki.
I've seen the post http://lists.xwiki.org/pipermail/users/2008-March/010746.html :
I think it would be ok to follow the original thread ;-)
To maintain the status while surfing the wiki is the default behavior. Do you get a different thing? Does your browser accept cookies?
However, I can't see the code used for XWiki panels since I can't enter edit mode. I really want to see how to implement those cookies, so if I'm looking in the wrong place, where can I search it?
I read "your wiki", thus if you have installed it I don't understand why can you not enter edit mode? Even tough you have installed the default .xar, you can gain access by using Admin as username and admin as pasword. See this...
http://platform.xwiki.org/xwiki/bin/view/AdminGuide/Installation#HInstalling...
The code controlling status cookies is in macro.vm template. Look for it in the /templates folder under /xwiki. You must want to find macros panelheader and largepaneheader.
Hope this helps,
Ricardo
-- Ricardo Rodríguez Your EPEC Network ICT Team
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
Hi Joao! Sorry for being late with this answer... Joao Henrique Silva Santos wrote:
Hi Ricardo. First, I would like to say thanks for the reply.
The reason I didn't reply to the original thread is because I was not registered at the time, and so I did not have the post on my inbox to reply.
OK. I should have supposed something like this. Perhaps Nabble could help in this situations. Although you have already found this, it could be helpful to follow any other thread of which you have not the starting point in your inbox... http://www.nabble.com/XWiki-f2563.html I also use this tool when the account I have registered with in the list can not be used to send from a given location. I frequently have this problem. I have not a clear idea about how frequently Nabble synchronizes with lists contents. But it eventually works!
As for cookies, yes, my browser does accept them (I'm using firefox but there is also this behaviour for IE 6 and 7 browsers).
When I say I can't enter edit mode I wasn't refering to "my wiki" :), but to Xwiki's wiki. I've already seen macro.* (I even edited so that my panels are collapsed by default), but can't find anything regarding...
New messages give more information than this entry, thus I am moving there to follow the flow! Cheers, Ricardo -- Ricardo Rodríguez Your EPEC Network ICT Team
Hi Joao, Joao Henrique Silva Santos wrote:
Finally, even a panel which uses the standard panelheader does not behave properly. Does anybody have a possible explanation / common problems?
I am not able to reproduce what you are describing. The macro works fine for me. I've modified it a bit. Perhaps it is clearer now. See this... #set($initialState= "collapsed") #set($alternativeState="expanded") #macro(panelheaderc $title) #set($cookieName = "${context.user}_${panel}") #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 Initial state can be easily moved to each panel content. Alternative state can be easily set with a if-else-end structure. I am falling while evaluating the value of $initialState, but this is only a matter of looking for the right syntax. If you are using a modified macros.vm including the customized macros, I am not able to figure out any problem other than a malfunction at your browser level. Have you tried with several browsers from the same box? Could you try this version I am proposing? It works fine here. But if you are using a #includemacros("macrosFile") statement, it could be a matter of where you use it. I don't know how to put it this macro's call to affect the whole site without modifying macro.vm. I don't know if this is possible or we must include it in all and any documents needing the macros included there. I will do some more research prior to posting a question about this. Any input will be welcome!!!! Thanks. Best, Ricardo -- Ricardo Rodríguez Your EPEC Network ICT Team
Hi. Thanks again for the detailed reply and your macro I tested different browsers (IE 7 , IE6, Firefox) in different machines (1 browser <> 1 machine). Also, i've modified the macros.vm to include the new macro. I will test your macro and post again when I'm done with testing. regard, Joao On 13/03/2008, [Ricardo Rodriguez] Your EPEC Network ICT Team <[email protected]> wrote:
Hi Joao,
Joao Henrique Silva Santos wrote:
Finally, even a panel which uses the standard panelheader does not behave properly. Does anybody have a possible explanation / common problems?
I am not able to reproduce what you are describing. The macro works fine for me. I've modified it a bit. Perhaps it is clearer now. See this...
#set($initialState= "collapsed") #set($alternativeState="expanded")
#macro(panelheaderc $title)
#set($cookieName = "${context.user}_${panel}")
#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
Initial state can be easily moved to each panel content. Alternative state can be easily set with a if-else-end structure. I am falling while evaluating the value of $initialState, but this is only a matter of looking for the right syntax.
If you are using a modified macros.vm including the customized macros, I am not able to figure out any problem other than a malfunction at your browser level. Have you tried with several browsers from the same box? Could you try this version I am proposing? It works fine here.
But if you are using a #includemacros("macrosFile") statement, it could be a matter of where you use it. I don't know how to put it this macro's call to affect the whole site without modifying macro.vm. I don't know if this is possible or we must include it in all and any documents needing the macros included there. I will do some more research prior to posting a question about this. Any input will be welcome!!!! Thanks.
Best,
Ricardo
-- Ricardo Rodríguez Your EPEC Network ICT Team
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
Hi, Ricardo I've tested your macro and it behaves just as before.. I guess I'll try to upgrade the wiki and see if it is one of the solved bugs. regards, Joao On 13/03/2008, Joao Henrique Silva Santos <[email protected]> wrote:
Hi. Thanks again for the detailed reply and your macro
I tested different browsers (IE 7 , IE6, Firefox) in different machines (1 browser <> 1 machine). Also, i've modified the macros.vm to include the new macro.
I will test your macro and post again when I'm done with testing.
regard, Joao
On 13/03/2008, [Ricardo Rodriguez] Your EPEC Network ICT Team
<[email protected]> wrote:
Hi Joao,
Joao Henrique Silva Santos wrote:
Finally, even a panel which uses the standard panelheader does not behave properly. Does anybody have a possible explanation / common problems?
I am not able to reproduce what you are describing. The macro works fine for me. I've modified it a bit. Perhaps it is clearer now. See this...
#set($initialState= "collapsed") #set($alternativeState="expanded")
#macro(panelheaderc $title)
#set($cookieName = "${context.user}_${panel}")
#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
Initial state can be easily moved to each panel content. Alternative state can be easily set with a if-else-end structure. I am falling while evaluating the value of $initialState, but this is only a matter of looking for the right syntax.
If you are using a modified macros.vm including the customized macros, I am not able to figure out any problem other than a malfunction at your browser level. Have you tried with several browsers from the same box? Could you try this version I am proposing? It works fine here.
But if you are using a #includemacros("macrosFile") statement, it could be a matter of where you use it. I don't know how to put it this macro's call to affect the whole site without modifying macro.vm. I don't know if this is possible or we must include it in all and any documents needing the macros included there. I will do some more research prior to posting a question about this. Any input will be welcome!!!! Thanks.
Best,
Ricardo
-- Ricardo Rodríguez Your EPEC Network ICT Team
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
Joao Henrique Silva Santos wrote:
Hi, Ricardo
I've tested your macro and it behaves just as before.. I guess I'll try to upgrade the wiki and see if it is one of the solved bugs.
regards, Joao Could I access to your wiki to see how do the panels behave from here?
I will set some panel in our wikis using this same macro to see if they work fine for you as they do for me. Cheers, Ricardo -- Ricardo Rodríguez Your EPEC Network ICT Team
Hi, Ricardo Thanks for your proposal to test my wiki. It's url is: http://baco.cfn.ist.utl.pt:8080/xwiki Currently, the panels on the left panel-column are using your macro, and the ones at the right are using mine (only "XWiki tutorial" and "Create" are expanded by default). Some of them do behave properly: "Networking", "Database", and "Quick links". rgds, Joao On 13/03/2008, [Ricardo Rodriguez] Your EPEC Network ICT Team <[email protected]> wrote:
Joao Henrique Silva Santos wrote:
Hi, Ricardo
I've tested your macro and it behaves just as before.. I guess I'll try to upgrade the wiki and see if it is one of the solved bugs.
regards, Joao
Could I access to your wiki to see how do the panels behave from here?
I will set some panel in our wikis using this same macro to see if they work fine for you as they do for me.
Cheers,
Ricardo
-- Ricardo Rodríguez Your EPEC Network ICT Team
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
Joao Henrique Silva Santos wrote:
Hi, Ricardo Thanks for your proposal to test my wiki.
It's url is: http://baco.cfn.ist.utl.pt:8080/xwiki
Currently, the panels on the left panel-column are using your macro, and the ones at the right are using mine (only "XWiki tutorial" and "Create" are expanded by default). Some of them do behave properly: "Networking", "Database", and "Quick links".
Your links work as you described. So, now the other term of the cross-comparison: http://environmentalchange.net Most of the contents are behind the login, but you must be able to see the Blog Entries panel on the right, bottom right. It is set as collapsed by default. It you get a correct behavior there, I can only think of a possibility: the port. Yours is using 8080, mine 80. But this does not make sense as far as they are panels doing fine... :-( I will try here by changing the port to my test box, but it will faster if you can check our place. If this is not the reason, we must wait for your upgrade and see what happen. Joao, don't you think that you could move to the war/xar distribution? I think small tokamaks deserve it! :-) Saúde e sorte, Ricardo -- Ricardo Rodríguez Your EPEC Network ICT Team
Your site's panels do behave correctly. As for migrating to the war distribution, is there a way to export the whole current wiki? I only found how to export single pages to XAR file. Obrigado Joao On 13/03/2008, [Ricardo Rodriguez] Your EPEC Network ICT Team <[email protected]> wrote:
Joao Henrique Silva Santos wrote:
Hi, Ricardo
Thanks for your proposal to test my wiki.
It's url is: http://baco.cfn.ist.utl.pt:8080/xwiki
Currently, the panels on the left panel-column are using your macro, and the ones at the right are using mine (only "XWiki tutorial" and "Create" are expanded by default). Some of them do behave properly: "Networking", "Database", and "Quick links".
Your links work as you described. So, now the other term of the cross-comparison:
http://environmentalchange.net
Most of the contents are behind the login, but you must be able to see the Blog Entries panel on the right, bottom right. It is set as collapsed by default.
It you get a correct behavior there, I can only think of a possibility: the port. Yours is using 8080, mine 80. But this does not make sense as far as they are panels doing fine... :-( I will try here by changing the port to my test box, but it will faster if you can check our place.
If this is not the reason, we must wait for your upgrade and see what happen.
Joao, don't you think that you could move to the war/xar distribution? I think small tokamaks deserve it! :-)
Saúde e sorte,
Ricardo
-- Ricardo Rodríguez Your EPEC Network ICT Team
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
Hi. I've upgraded the xwiki to 1.3 using the zip distribution, but since I could not find where I should make some changes on the albatross skin I copied the entire albatross folder. The problem with the panels is still there, but that could be due to a bug on the albatross skin (bug either already existent or made by me). I will look further into the new albatross skin structure, and try to adapt it to my changes. If I can use the new albatross skin that will probably help debugging (or solving) my problems. Joao On 13/03/2008, Joao Henrique Silva Santos <[email protected]> wrote:
Your site's panels do behave correctly. As for migrating to the war distribution, is there a way to export the whole current wiki? I only found how to export single pages to XAR file.
Obrigado
Joao
On 13/03/2008, [Ricardo Rodriguez] Your EPEC Network ICT Team
<[email protected]> wrote:
Joao Henrique Silva Santos wrote:
Hi, Ricardo
Thanks for your proposal to test my wiki.
It's url is: http://baco.cfn.ist.utl.pt:8080/xwiki
Currently, the panels on the left panel-column are using your macro, and the ones at the right are using mine (only "XWiki tutorial" and "Create" are expanded by default). Some of them do behave properly: "Networking", "Database", and "Quick links".
Your links work as you described. So, now the other term of the cross-comparison:
http://environmentalchange.net
Most of the contents are behind the login, but you must be able to see the Blog Entries panel on the right, bottom right. It is set as collapsed by default.
It you get a correct behavior there, I can only think of a possibility: the port. Yours is using 8080, mine 80. But this does not make sense as far as they are panels doing fine... :-( I will try here by changing the port to my test box, but it will faster if you can check our place.
If this is not the reason, we must wait for your upgrade and see what happen.
Joao, don't you think that you could move to the war/xar distribution? I think small tokamaks deserve it! :-)
Saúde e sorte,
Ricardo
-- Ricardo Rodríguez Your EPEC Network ICT Team
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
Hi, Joao Henrique Silva Santos wrote:
Your site's panels do behave correctly. As for migrating to the war distribution, is there a way to export the whole current wiki? I only found how to export single pages to XAR file.
So, the update is our best shot now! As for export, I think to export the whole wiki is what Export utility does. See this... http://platform.xwiki.org/xwiki/bin/view/AdminGuide/ImportExport To reach this Export you must login as an user with administration rights and go to Administration, from the link in the right top area close to your name . One you have exported the whole thing you probably want to edit the resulting XAR file to import those content pages you want to preserve in the new installation. HTH, Ricardo -- Ricardo Rodríguez Your EPEC Network ICT Team
Joao Henrique Silva Santos wrote:
Hi. I've upgraded the xwiki to 1.3 using the zip distribution, but since I could not find where I should make some changes on the albatross skin I copied the entire albatross folder. The problem with the panels is still there, but that could be due to a bug on the albatross skin (bug either already existent or made by me).
I will look further into the new albatross skin structure, and try to adapt it to my changes. If I can use the new albatross skin that will probably help debugging (or solving) my problems.
As posted in another issue, I think you must try with the updated Albatross skin and see if the panels work there. It all is OK with the new release, you must create a new skin and reproduce there the changes you formerly did in albatross files. Any other way will make a new upgrade much more complicated. Cheers, Ricardo -- Ricardo Rodríguez Your EPEC Network ICT Team
Joao Henrique Silva Santos wrote:
Hi, Ricardo Thanks for your proposal to test my wiki.
It's url is: http://baco.cfn.ist.utl.pt:8080/xwiki
Currently, the panels on the left panel-column are using your macro, and the ones at the right are using mine (only "XWiki tutorial" and "Create" are expanded by default). Some of them do behave properly: "Networking", "Database", and "Quick links".
Found the problem. The panels that have a space in the document name don't work. Cookie names cannot contain spaces, so when setting and checking the cookie the script should remove any spaces. -- Sergiu Dumitriu http://purl.org/net/sergiu/
Sergiu Dumitriu wrote:
Found the problem. The panels that have a space in the document name don't work. Cookie names cannot contain spaces, so when setting and checking the cookie the script should remove any spaces.
Experience again! And systematic... :-) Thanks! Cheers, Ricardo -- Ricardo Rodríguez Your EPEC Network ICT Team
[Ricardo Rodriguez] Your EPEC Network ICT Team wrote:
Sergiu Dumitriu wrote:
Found the problem. The panels that have a space in the document name don't work. Cookie names cannot contain spaces, so when setting and checking the cookie the script should remove any spaces.
Experience again! And systematic... :-) Thanks!
Cheers,
Ricardo
Can you try and fix the js? Thanks -- Sergiu Dumitriu http://purl.org/net/sergiu/
wow, just like that :) Thanks! I think I'll make a post on the FAQ. Joao On 13/03/2008, Sergiu Dumitriu <[email protected]> wrote:
Joao Henrique Silva Santos wrote:
Hi, Ricardo
Thanks for your proposal to test my wiki.
It's url is: http://baco.cfn.ist.utl.pt:8080/xwiki
Currently, the panels on the left panel-column are using your macro, and the ones at the right are using mine (only "XWiki tutorial" and "Create" are expanded by default). Some of them do behave properly: "Networking", "Database", and "Quick links".
Found the problem. The panels that have a space in the document name don't work. Cookie names cannot contain spaces, so when setting and checking the cookie the script should remove any spaces.
-- Sergiu Dumitriu http://purl.org/net/sergiu/
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
Hi, Sergiu Dumitriu wrote:
Can you try and fix the js? Thanks
I see updateName() extensively used in XWiki to remove spaces and "forbidden characters" from document titles and I was wondering if this XWiki helper javascript method could be used to remove spaces from panels names. I have failed so far, but I don't know if it is a matter of syntax or if I am trying to use the wrong tool. Could you help me with this issue? Thanks! Another option could be to use the panel ID instead of its name to construct the name of the cookie. But I am also failing when trying to obtain this id. Is it not a getId() method available for panels? Thank you so much for your help, Ricardio -- Ricardo Rodríguez Your EPEC Network ICT Team
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
Well, that is what I meant by fixing the js. Thanks. [Ricardo Rodriguez] Your EPEC Network ICT Team wrote:
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
-- Sergiu Dumitriu http://purl.org/net/sergiu/
Sergiu Dumitriu wrote:
Well, that is what I meant by fixing the js. Thanks.
[Ricardo Rodriguez] Your EPEC Network ICT Team wrote:
Thanks, Sergiu. There is still at least a change lacking. This is why I've not created the Jira Issue yet. In its current state, $initialState must be set in each panel. And that means to edit all and each of them. I think it must be set to a given value by default within the macro. Something like this... #if("$initialState" == "collapsed" || ) #set($initialState = "collapsed") #set($alternativeState = "expanded") #else #set($alternativeState = "collapsed") #end But I don't know yet how to check if a variable is not defined or has a NULL value yet. I've to leave now. Come back later on this issue. Greetings, Ricardo -- Ricardo Rodríguez Your EPEC Network ICT Team
participants (3)
-
[Ricardo Rodriguez] Your EPEC Network ICT Team -
Joao Henrique Silva Santos -
Sergiu Dumitriu