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

Add node key to private files navigation node

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.2, 3.3
    • Fix Version/s: 3.2.4, 3.3.1
    • Component/s: Navigation
    • Labels:
    • Testing Instructions:
      Hide

      Before applying the patch:

      • Login to Moodle as any user who is allowed to use private files (e.g. a teacher)
      • Open the nav drawer
      • Look at the HTML code of the link to the private files. It is:

        <a class="list-group-item list-group-item-action " href="https://demo.moodle.net/user/files.php" data-key="8">
                        <div class="m-l-0">
                                Private files
                        </div>
                    </a>
        

      • You will see that this node has a data-key attribute with an arbitrary integer value.

      After applying the patch:

      • Login to Moodle as any user who is allowed to use private files (e.g. a teacher)
      • Open the nav drawer
      • Look at the HTML code of the link to the private files. It is:

        <a class="list-group-item list-group-item-action " href="https://demo.moodle.net/user/files.php" data-key="privatefiles">
                        <div class="m-l-0">
                                Private files
                        </div>
                    </a>
        

      • You will see that this node has a data-key attribute with the value "privatefiles"
      Show
      Before applying the patch: Login to Moodle as any user who is allowed to use private files (e.g. a teacher) Open the nav drawer Look at the HTML code of the link to the private files. It is: <a class="list-group-item list-group-item-action " href="https://demo.moodle.net/user/files.php" data-key="8"> <div class="m-l-0"> Private files </div> </a> You will see that this node has a data-key attribute with an arbitrary integer value. After applying the patch: Login to Moodle as any user who is allowed to use private files (e.g. a teacher) Open the nav drawer Look at the HTML code of the link to the private files. It is: <a class="list-group-item list-group-item-action " href="https://demo.moodle.net/user/files.php" data-key="privatefiles"> <div class="m-l-0"> Private files </div> </a> You will see that this node has a data-key attribute with the value "privatefiles"
    • Affected Branches:
      MOODLE_32_STABLE, MOODLE_33_STABLE
    • Fixed Branches:
      MOODLE_32_STABLE, MOODLE_33_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      MDL-58165-master

      Description

      Navigation nodes in Moodle's navigation can be found with their key and can be manipulated then (especially by Moodle plugins using the *_extend_navigation() hook).

      Unfortunately, the "Private files" navigation node is the only root navigation node which does not have a real string key, it only has a not-so-easy-to-guess integer key which is autogenerated when the navigation node is added to the navigation tree.

      Because of that it is difficult to find this root navigation node in the navigation tree (for example like it's done on https://github.com/moodleuulm/moodle-local_boostnavigation/blob/master/locallib.php#L34) and you can't select the navigation node in CSS with the node's data-key attribute if needed.

      I propose to add a string key to the private files root navigation node to overcome these obstacles.

      I classified this ticket as bug because it's rather a bug than an improvement and thereby it can be backported to 3.2

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  10/Jul/17