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

legacy_activity_onclick_handler is broken in 32 and master

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.2.1
    • 3.2
    • Navigation
    • MOODLE_32_STABLE
    • MOODLE_32_STABLE
    • MDL-57417-master
    • Hide

      Must be tested in Boost and Clean

      On Clean (as admin/teacher):

      1. Make sure navigation block is enabled.
      2. Create an LTI activity in a course and make sure the display option is set to open in new window. You can use ltiapps.net/test/tp.php for the cartridge URL.
      3. Create an assignment and click it
      4. Check the nav block and make sure you can see the LTI activity
      5. Check the console and confirm that you see no errors.
      6. Click the LTI activity in the nav block
      7. Confirm that:
        • The tool opens in a new window/tab without the original window redirecting first
        • The original window/tab still shows the assignment grading summary page (i.e. not the tool)

      On Boost (as admin/teacher):

      1. Ensure editing is enabled
      2. Create an LTI activity in a course and make sure the display option is set to open in new window. You can use ltiapps.net/test/tp.php for the cartridge URL.
      3. Create an assignment and click it
      4. From the drawer, click 'Add a block' and add the nav block
      5. Check the nav block and make sure you can see the LTI activity
      6. Check the console - Confirm that you see no errors.
      7. Click the LTI activity in the nav block
      8. Confirm that:
        • The tool opens in a new window/tab without the original window redirecting first
        • The original window/tab still shows the assignment grading summary page (i.e. not the tool)
      Show
      Must be tested in Boost and Clean On Clean (as admin/teacher): Make sure navigation block is enabled. Create an LTI activity in a course and make sure the display option is set to open in new window. You can use ltiapps.net/test/tp.php for the cartridge URL. Create an assignment and click it Check the nav block and make sure you can see the LTI activity Check the console and confirm that you see no errors. Click the LTI activity in the nav block Confirm that : The tool opens in a new window/tab without the original window redirecting first The original window/tab still shows the assignment grading summary page (i.e. not the tool) On Boost (as admin/teacher): Ensure editing is enabled Create an LTI activity in a course and make sure the display option is set to open in new window. You can use ltiapps.net/test/tp.php for the cartridge URL. Create an assignment and click it From the drawer, click 'Add a block' and add the nav block Check the nav block and make sure you can see the LTI activity Check the console - Confirm that you see no errors. Click the LTI activity in the nav block Confirm that : The tool opens in a new window/tab without the original window redirecting first The original window/tab still shows the assignment grading summary page (i.e. not the tool)

      I came across this when working on MDL-57368. Basically, when an activity has the 'onclick' property set, we're supposed to use this when rendering the nav tree. This was set up by MDL-29224 originally and is a legacy function.

      For example, an activity like LTI might want to open in a new window, so it sets $activity->onclick to 'window.open('http://localhost/master/mod/lti/launch.php?id=22', 'lti-22'); return false;'. When accessing the activity via the course home page, this works fine - clicking the name opens the activity in a new popup window. Accessing this from the nav block is supposed to work the same way, but it's broken because the click callback function can't be found.

      The problem is that the callback is added in lib/navigationlib.php, but it's just dumping a function using js_init_code, which is nested so won't work. This callback needs to be declared at global level to work properly.

      The result is that when loading the page (navblock must be enabled and the relevant section expanded) the console throws the error (32 and master):

      Uncaught ReferenceError: legacy_activity_onclick_handler_1 is not defined
      

            jaked Jake Dallimore
            jaked Jake Dallimore
            Ankit Agarwal Ankit Agarwal
            Dan Poltawski Dan Poltawski
            Damyon Wiese Damyon Wiese
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

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