Sorry, this has been sitting in my inbox for awhile now. Can you please enter this as a bug in Struts Menu?

http://sourceforge.net/tracker/?func=add&group_id=48726&atid=453974

Thanks,

Matt

On Dec 25, 2004, at 10:40 PM, Kelvin Yap wrote:

I suppose there is a minor bug in the
CoolMenuDisplayer when it is used to display mixture
of "allowed" & "not-allowed" menu items.

The problem is occured due to incorrect "Menu Item
Name" & "Menu Item Parent Name". Below is the
problematic generated JavaScript code...

oCMenu.makeMenu('Admin2','Admin', ...
oCMenu.makeMenu('null1','Admin2', ...
oCMenu.makeMenu('null2','Admin2', ...
oCMenu.makeMenu('null3','Admin2', ...

oCMenu.makeMenu('null4','Admin2', ...
oCMenu.makeMenu('null1','null4', ...
oCMenu.makeMenu('null2','null4', ...
oCMenu.makeMenu('null3','null4', ...


I have to find a workaround for the "Menu Item Name" & "Menu Item Parent Name". Therefore, I have modified the net.sf.navigator.displayer.CoolMenuDisplayer accordingly...


public void display(MenuComponent menu) throws JspException, IOException { StringBuffer sb = new StringBuffer(); buildMenuString( menu, menu.getName(), getParentName(menu), sb, isAllowed(menu)); out.print(sb); }

  protected void buildMenuString(
    MenuComponent menu,
    String name,
    String parentName,
    StringBuffer sb,
    boolean allowed)
  {
    sb.append(menuMessage.format(getArgs(
      menu, name, parentName, allowed)));
    sb.append((allowed) ? HOVER : DIS_HOVER);
    sb.append(",'");
    sb.append((menu.getOnClick() == null) ?
      EMPTY : menu.getOnClick());
    sb.append("')\n");

    MenuComponent[] subMenus =
      menu.getMenuComponents();

    if (subMenus.length > 0)
    {
      for (int i = 0; i < subMenus.length; i++)
      {
        buildMenuString(
          subMenus[i],
          name + "_" + i,
          name,
          sb,
          (allowed) ?
            isAllowed(subMenus[i]) : allowed);
      }
    }
  }

  protected String[] getArgs(
    MenuComponent menu,
    String name,
    String parentName,
    boolean allowed)
  {
    String[] args = new String[10];
    args[0] = name;
    args[1] = parentName;

    ...
    ...
    ...
  }


cheers, kelvin yap




__________________________________ Do you Yahoo!? Take Yahoo! Mail with you! Get it on your mobile phone. http://mobile.yahoo.com/maildemo


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://productguide.itmanagersjournal.com/
_______________________________________________
struts-menu-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/struts-menu-user



------------------------------------------------------- This SF.net email is sponsored by Microsoft Mobile & Embedded DevCon 2005 Attend MEDC 2005 May 9-12 in Vegas. Learn more about the latest Windows Embedded(r) & Windows Mobile(tm) platforms, applications & content. Register by 3/29 & save $300 http://ads.osdn.com/?ad_id=6883&alloc_id=15149&op=click _______________________________________________ struts-menu-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/struts-menu-user

Reply via email to