-
Bug
-
Resolution: Fixed
-
Minor
-
3.2
-
MOODLE_32_STABLE
-
MOODLE_32_STABLE
-
MDL-57417-master -
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
|