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

Deprecate ajaxenabled() function

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.2, 2.7
    • Fix Version/s: 2.7
    • Component/s: JavaScript
    • Labels:
    • Testing Instructions:
      Hide
      • Open a course
      • Turn editing on
      • Confirm that JS features generally work for all relevant course formats:
        • Activity chooser
        • Block moving
        • Activity + Section moving
        • Activity + Section show/hide
      • Edit course/format/topics/lib.php, find the support_ajax() function and change ->capable = true to ->capabale = false;
        • Confirm that the JS is not used
      • Open Course admin -> Users -> Groups
      • Autocreate some groups
      • Confirm that the groups UI works as expected:
        • 'Edit group settings' button should be displayed
        • 'Delete selected group' button should be displayed
        • 'Add/remove users' button should be displayed
      • Run behat tests

      As a user who has course enrolments

      • View the 'My home' page
      • Turn editing on
      • Ensure that you can drag/drop the courses to change their order
      Show
      Open a course Turn editing on Confirm that JS features generally work for all relevant course formats : Activity chooser Block moving Activity + Section moving Activity + Section show/hide Edit course/format/topics/lib.php, find the support_ajax() function and change ->capable = true to ->capabale = false; Confirm that the JS is not used Open Course admin -> Users -> Groups Autocreate some groups Confirm that the groups UI works as expected : 'Edit group settings' button should be displayed 'Delete selected group' button should be displayed 'Add/remove users' button should be displayed Run behat tests As a user who has course enrolments View the 'My home' page Turn editing on Ensure that you can drag/drop the courses to change their order
    • Affected Branches:
      MOODLE_22_STABLE, MOODLE_27_STABLE
    • Fixed Branches:
      MOODLE_27_STABLE
    • Pull Master Branch:
      MDL-33099-master

      Description

      The ajaxenabled function in lib/ajax/ajaxlib.php is thoroughly outdated and IMHO is no longer required.
      It is used in a few places:

      • course/view.php
      • group/index.php
      • lib/moodlelib.php (to determine whether the user is using firefox version 2.0 or above for rotated text)
      • tag/edit.php

      Most of this function is checking browser versions against hardcoded numbers which haven't been updated in five years. The remainder checks:

      • $CFG->enableajax (fair enough)
      • $USER->ajax - no longer used and only appears in the unit test for this file
      • isloggedin() - because apparently you can't use javascript if you aren't logged in

      We should remove this function and update the places it's in use to use appropriate JS or alternative checks such as course/lib.php::course_ajax_enabled().

      We should also probably split out the $CFG->enableajax test in course_ajax_enabled into lib/moodlelib.php::ajax_enabled().

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              dobedobedoh Andrew Lyons
              Reporter:
              dobedobedoh Andrew Lyons
              Peer reviewer:
              Petr Skoda Petr Skoda
              Integrator:
              Dan Poltawski Dan Poltawski
              Tester:
              Frédéric Massart Frédéric Massart
              Participants:
              Component watchers:
              Andrew Lyons, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

                Dates

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