Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-29174

Modules' navigation nodes incorrectly flagged as branches due to stubs

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.0, 2.1, 2.2
    • Fix Version/s: 2.2.3
    • Component/s: Navigation
    • Labels:
    • Testing Instructions:
      Hide

      1. Add one each of the following types of module to a course: Folder, IMS CP, Lesson, Page, Scorm, Survey, URL.

      2. Look at the navigation block for the added modules. Verify that none of these entries have an expand arrow, and they are all shown as 'leaf' nodes.

      Show
      1. Add one each of the following types of module to a course: Folder, IMS CP, Lesson, Page, Scorm, Survey, URL. 2. Look at the navigation block for the added modules. Verify that none of these entries have an expand arrow, and they are all shown as 'leaf' nodes.
    • Affected Branches:
      MOODLE_20_STABLE, MOODLE_21_STABLE, MOODLE_22_STABLE
    • Fixed Branches:
      MOODLE_22_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-29174-master

      Description

      Lines 1591 and 1720 of lib/navigationlib.php flag modules' navigation nodes as being branches (navigation_node::NODETYPE_BRANCH) purely because the module defines a modname_extend_navigation function - although at least in some cases (such as mod/page), the function is just a stub which attempts to set the node to navigation_mode::NODETYPE_LEAF.

      Is there any point in setting them to NODETYPE_BRANCH purely based on having the _extend_navigation function, given that if the _extend_navigation function adds any nodes, the add_node function will flag the node as NODETYPE_BRANCH anyway? Leaving it to add_node to flag it as a branch means that if the _extend_navigation function is either a stub (i.e. about half the standard modules including page, folder, lesson, url and survey) or has conditional logic controlling the addition of child nodes, it'll be correctly flagged as NODETYPE_LEAF unless children are added.

      Incorrectly flagging module nodes with no children as branches results in these nodes having expansion arrows in the navigation block which, when clicked, don't expand the navigation (as there's nothing to add under that node). They should really be drawn without the expansion arrow, as there are no children to expand to.

      You can see this in action by adding a module which contains a stub, such as a Page, to a course. Check the module's node in the navigation block - it'll have an expansion arrow, but won't give any new content if you try to expand it. Adding a forum, which does NOT have the stub (or a full _expand_navigation function), results in a node with no expansion arrow, as expected.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Votes:
                3 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  14/May/12