[Date Index][Thread Index]
[Date Prev][Date Next][Thread Prev][Thread Next]

preselected nested navbar items-idea,patch



Hi!

What, if you could select the menu items, not only from <navbar:render>, but
predefined in <navbar:define>.  I don't know, if this is a good way, or
not,
because I am still new to WML, and I cannot see if this fits well in the
structure or fails.

I changed navbar.wml on some places, added two new items to navbar:define,
these are: "select" and "subselected". The only aim of these two
parameters is
to overwrite the same named settings from <navbar:render>. This way, if
you have the following structure:
<navbar:define name=mainmenu...
....
<button id=somesub ..... menu=somesub>
....

And later, another navbar:
<navbar:define name=somesub select=subitem1>
<button id=subitem1....

Then you can easily select an item in the submenu. Ofcourse this seems
to be precoded,
but ofcourse in templates you can use:
<navbar:define name=somesub select=$(submenuitem)>
You can even add: .... subselected> to have the button still active,
providing 3-4-5 or
more level submenusystem!

Comments are welcomed. The changes are listed above.
Original file: This is WML Version 2.0.8 (30-Oct-2001)

I changed the default "subselected" value of the nested navbars to 0 ("not
subselected") from the original behavior, which is "same as parent". 
This is because I don't know if there is a way to say:
<navbar:define name=somesub undefine subselected>

Ferenc
ps: I was happy to see Perl code inside, coz I am pretty good in it :)
Still the wml code parts are a bit confusing ;-)

File: WMLLIBINCLUDEDIR/des/navbar.wml

20c20,21
< <preserve name imgstar imgbase urlbase target txtcol_normal
txtcol_select />
---
  > <preserve name imgstar imgbase urlbase target txtcol_normal
txtcol_select select subselected />
  > <set-var subselected=* />
44a46,47
  >     $CFG->{SELECT} = '<get-var select />';
  >     $CFG->{SUBSELECTED} = (qq|<get-var subselected />| eq '' ? 1 : 0);
119c122
< <restore  name imgstar imgbase urlbase target txtcol_normal
txtcol_select />
---
  > <restore  name imgstar imgbase urlbase target txtcol_normal
txtcol_select select subselected />
371a375,376
  >     if ($CFG->{SELECT}) { $select = $CFG->{SELECT}; }
  >     if ($CFG->{SUBSELECTED}) { $subselected = $CFG->{SUBSELECTED}; }
564c569
<                 $select, $subselected, $txtcol_n, $txtcol_s,
---
  >                 $select, 0, $txtcol_n, $txtcol_s,
587c592
<                 $select, $subselected, $txtcol_n, $txtcol_s,
---
  >                 $select, 0, $txtcol_n, $txtcol_s,



______________________________________________________________________
Website META Language (WML)                www.engelschall.com/sw/wml/
Official Support Mailing List                   sw-wml@engelschall.com
Automated List Manager                       majordomo@engelschall.com