Loading...
 
Features / Usability

Features / Usability


Bug in tiki-user_menu.tpl

posts: 21

Some people noticed that dynamic sections in custom menus automatically collapse whenever a page is loaded (Tiki 1.8.3). The standard application menu however "remembers" expanded and collapsed sections.

The reason for this is apparently a bug in tiki-user_menu.tpl. The current state of each section is stored in a separate cookie. When *reading* this cookie its name is supposed do be something like 400_12 (thats's the menu id and position). When *writing* it the name is being prefixed by 'menu', like menu400_12.

To fix this, look for this string:
'menu{$cname}' (three occurences)
and replace it by
'{$cname}'

Thus the name of the cookie is not altered and remains consistent between reading and writing.

Optional enhancement:

It's probably a good idea to make the names of menu cookies indeed start with 'menu' in order to avoid possible name clashes. So look for this line:
{assign var=cname value=$menu_info.menuId|cat:'__'|cat:$chdata.position}

and replace it by
{assign var=cname value='menu'|cat:$menu_info.menuId|cat:'__'|cat:$chdata.position}

Hagix

posts: 2881 United Kingdom

The other cause is also that Tiki is sending out too many Cookies. A single domain in a browser is limited to 20 cookies. Tiki uses many many cookies. For background info you can read CookieMonster, and its currently being fixed in 1.9 RC series and probably be backported to a 1.8.4 or .5 release when it works.

Damian


posts: 21

Read and understood the CookieMonster article... thanks! As we use only a few of the Tiki features 20 cookies should be sufficient for now, but of course a fix is very welcome. Please remove the bug in tiki-user_menu.tpl I described anyway else the code won't work even with a perfect cookie management...

Hagix


posts: 21

Uh-oh, I just switched on folder display in menus (nice icons instead of :: or + -) and found that there's a related bug there: when loading a page an "open folder" icon resets to a "closed folder" icon (though the sub-menu items still remain visible with the bugfix I proposed).

I'm willing to supply the full code fix here but it contains some HTML and I didn't figure out yet how to post "code" in Tiki forums. Can some friendly soul give me a hint?

Thanks,
Hagix


posts: 21

I should have read the *complete* code... Actually, if you change
{assign var=cname value=$menu_info.menuId|cat:'__'|cat:$chdata.position}
to
{assign var=cname value='menu'|cat:$menu_info.menuId|cat:'__'|cat:$chdata.position}
you must do the same once more at the end of the file. Change
setfolderstate('{$menu_info.menuId|cat:'__'|cat:$chdata.position}');
to
setfoldericonstate('{'menu'|cat:$menu_info.menuId|cat:'__'|cat:$chdata.position}');
and everything works fine.


posts: 6 United States

Does this fix work for version 1.9 using custom user-menus?
It appears that a cookie is NOT set when I toggle the menus, which would explain why they do not retain their state.

posts: 1092

Is your menu an extended menu? In this case, I fixed one bug this morning in 1.9 cvs?
I hope it is the good one
sylvie

posts: 6 United States

I think you fixed it! All menus appear to be retaining their state now.

thank you,
-Benj


Upcoming Events

1)  18 Apr 2024 14:00 GMT-0000
Tiki Roundtable Meeting
2)  16 May 2024 14:00 GMT-0000
Tiki Roundtable Meeting
3)  20 Jun 2024 14:00 GMT-0000
Tiki Roundtable Meeting
4)  18 Jul 2024 14:00 GMT-0000
Tiki Roundtable Meeting
5)  15 Aug 2024 14:00 GMT-0000
Tiki Roundtable Meeting
6)  19 Sep 2024 14:00 GMT-0000
Tiki Roundtable Meeting
7) 
Tiki birthday
8)  17 Oct 2024 14:00 GMT-0000
Tiki Roundtable Meeting
9)  21 Nov 2024 14:00 GMT-0000
Tiki Roundtable Meeting
10)  19 Dec 2024 14:00 GMT-0000
Tiki Roundtable Meeting