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

Deprecate ajaxenabled() function

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.2, 2.7
    • 2.7
    • JavaScript
    • MOODLE_22_STABLE, MOODLE_27_STABLE
    • MOODLE_27_STABLE
    • MDL-33099-master
    • 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

    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

              dobedobedoh Andrew Lyons
              dobedobedoh Andrew Lyons
              Petr Skoda Petr Skoda
              Dan Poltawski Dan Poltawski
              Frédéric Massart Frédéric Massart
              David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                12/May/14