Ordering/"Drag-and-Drop" Question Trouble

Re: Ordering/"Drag-and-Drop" Question Trouble

by Gordon Bateson -
Number of replies: 0
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

William,

I have seen a situation before where a theme was including JQuery script itself and overwriting the JavaScript of other plugins such as the Ordering plugin, "qtype_ordering". 

  • layout/frontapage.php
  • layout/general.php

In that case, the solution was to amend the theme files to include JQuery using the Moodle API, as follows:

if (method_exists($PAGE->theme, 'get_theme_name')) {
// Moodle >= 2.2
$name = $PAGE->theme->get_theme_name();
} else {
// Moodle >= 2.0
$name = $PAGE->theme->name;
} if (method_exists($PAGE->requires, 'jquery')) {
// Moodle >= 2.5
$PAGE->requires->jquery();
$PAGE->requires->jquery_plugin('cycle_lite', 'theme_'.$name);
$PAGE->requires->jquery_plugin('picfade', 'theme_'.$name);
} else {
// Moodle <= 2.4
$PAGE->requires->js('/theme/'.$name.'/jquery/jquery.js', true);
$PAGE->requires->js('/theme/'.$name.'/jquery/cycle_lite.js', true);
$PAGE->requires->js('/theme/'.$name.'/jquery/picfade.js', true);
}

And the theme should then put all its jquery files into a subfolder, "jquery", of the theme, along with a plugins.php formatted as per the Moodle docs page: JQuery

For example, here is the plugins.php for the above theme's JQuery folder:

$plugins = array(
    'cycle_lite' => array('files' => array('cycle_lite.js')),
    'picfade'    => array('files' => array('picfade.js'))
);

As long as all plugins are including JQuery using the Moodle API, then as far as I know, the Ordering question type works on all standard Moodle Themes, in all Moodle versions, on all common devices, i.e. PC's, tablets and Smartphones. If you find a situation where the Ordering plugin doesn't work, I would be grateful if you could tell me your Moodle version, theme, device and browser, so that I can investigate and fix the issue.

regards
Gordon