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

Broken links with multiple parameters in select menu

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • 4.4
    • Navigation
    • None
    • MOODLE_404_STABLE

      Hi,

      links on select menu dropdown (i.e. tertiary navigation), under any group, are generated broken if they have more than 1 parameter, because the "&" of the second parameter of the query string is replaced by &
      If they are not under a group, they work correctly.

      More specifically, the problem occurs with the li items rendered by the line 111 of the select_menu.mustache file, the part under #isgroup case.
      Items rendered by line 119 under ^isgroup are correct.

      <ul class="dropdown-menu" role="listbox" id="{{baseid}}-listbox" {{#label}}aria-labelledby="{{baseid}}-label"{{/label}}>
          {{#options}}
              {{#isgroup}}
                  <li role="none">
                      <ul role="group" aria-labelledby="{{id}}">
                          <li role="presentation" id="{{id}}">{{name}}</li>
                          {{#options}}
                              <li class="dropdown-item" role="option" id="{{id}}" data-value="{{value}}" {{#selected}}aria-selected="true"{{/selected}}>
                                  {{name}}
                              </li>
                          {{/options}}
                      </ul>
                  </li>
              {{/isgroup}}
              {{^isgroup}}
                  <li class="dropdown-item" role="option" id="{{id}}" data-value="{{value}}" {{#selected}}aria-selected="true"{{/selected}}>
                      {{name}}
                  </li>
              {{/isgroup}}
          {{/options}}
      </ul> 

       

      This is not a problem for the moodle core but if a custom plugin implements mypplugin_extend_settings_navigation and puts a link with two parameters i.e. on the user node, the link won't work.

      A very fast way to check the problem without creating a plugin is to modify the core file lib/enrollib.php, editing the group element of tertiary navigation of the Participants page.

      // Manage groups in this course or even frontpage
      if (($course->groupmode || !$course->groupmodeforce) && has_capability('moodle/course:managegroups', $coursecontext)) {
          $url = new moodle_url('/group/index.php', array('id'=>$course->id));
          $usersnode->add(get_string('groups'), $url, navigation_node::TYPE_SETTING, null, 'groups', new pix_icon('i/group', ''));
      }

      becomes

      // Manage groups in this course or even frontpage
      if (($course->groupmode || !$course->groupmodeforce) && has_capability('moodle/course:managegroups', $coursecontext)) {
          $url = new moodle_url('/group/index.php', array('id'=>$course->id, 'dummy'=>1));
          $usersnode->add(get_string('groups'), $url, navigation_node::TYPE_SETTING, null, 'groups', new pix_icon('i/group', ''));
      }

      so now in the Partecipants -> Groups -> Groups menu of a course you can check how the data-value on the item is broken and the link doesn't pass the parameter correctly.
       
      Thanks,
      Giorgio

            Unassigned Unassigned
            kemmotar Giorgio Riva
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.