Uploaded image for project: 'Click'
  1. Click
  2. CLK-39

Non-menu pages associated with a menu

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • None
    • core
    • None

    Description

      The existing menu component allows hierarchical support of menus. A top menu can have several submenus etc. However, if you have a menu node to view a 'customerList' page and a link from that page takes the user to a page (editCustomer) that is not a menu node, then any mechanism that is in place to keep the menu hierarchy open fails, since the 'selected' menu node is no longer selected. What is required is that the 'customerList' menu node needs to know what sub pages can be displayed from 'customerList'.

      A suggested solution - allow a comma-separated list of pages to be added to a node, and change the select method to determine if the resourcePath is part of this comma-separated list.

      Eg: menu.xml
      <menu label="Management" path="customerList.htm">
      <menu label="Customers" path="customerList.htm" title="Customers"
      pages="/editCustomer.htm,deleteCustomer.htm,viewCustomer.htm"/>
      </menu>

      And, in Menu.java:

      public void select(Context context) {
      String pageToView = context.getResourcePath();
      if (pages.contains(pageToView))

      { // need to select the menu item selected = true; }

      else {
      String path = getPath();
      if (path != null)

      { path = path.startsWith("/") ? path : "/" + path; selected = path.equals(context.getResourcePath()); }

      else

      { selected = false; }

      }
      for (int i = 0; i < getChildren().size(); i++) {
      Menu menu = (Menu) getChildren().get;
      menu.select(context);
      if (menu.isSelected())

      { selected = true; }

      }
      }

      Obviously the page list needs to be parsed in the getRootMenu method into a 'pages' ArrayList, similar to the 'roles' code,

      Attachments

        Activity

          People

            medgar Malcolm Edgar
            ghopson Geoff Hopson
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: