diff --git a/question/type/ordering/renderer.php b/question/type/ordering/renderer.php index 0b385ab0141..3689b55ba04 100644 --- a/question/type/ordering/renderer.php +++ b/question/type/ordering/renderer.php @@ -100,15 +100,23 @@ class qtype_ordering_renderer extends qtype_with_combined_feedback_renderer { $script .= " containment: '#$ablockid',\n"; $script .= " opacity: 0.6,\n"; $script .= " update: function(event, ui) {\n"; - $script .= " var ItemsOrder = $(this).sortable('toArray').toString();\n"; - $script .= " $('#$responseid').attr('value', ItemsOrder);\n"; + $script .= " if (typeof($(this).sortable)=='function') {\n"; + $script .= " var ItemsOrder = $(this).sortable('toArray');\n"; + $script .= " } else {\n"; + $script .= " // fix for Moodle 3.4, in which 'sortable' method disappears !!\n"; + $script .= " var ItemsOrder = [];\n"; + $script .= " $(this).children('li.sortableitem').each(function(){\n"; + $script .= " ItemsOrder.push($(this).prop('id'));\n"; + $script .= " });\n"; + $script .= " }\n"; + $script .= " $('#$responseid').val(ItemsOrder.toString());\n"; $script .= " }\n"; $script .= " });\n"; $script .= " $('#$sortableid').disableSelection();\n"; $script .= " });\n"; $script .= " $(document).ready(function() {\n"; - $script .= " var ItemsOrder = $('#$sortableid').sortable('toArray').toString();\n"; - $script .= " $('#$responseid').attr('value', ItemsOrder);\n"; + $script .= " var ItemsOrder = $('#$sortableid').sortable('toArray');\n"; + $script .= " $('#$responseid').val(ItemsOrder).toString();\n"; $script .= " });\n"; $script .= "}\n"; $script .= "//]]>\n"; diff --git a/question/type/ordering/version.php b/question/type/ordering/version.php index cc8f31cb5b9..7f359897424 100644 --- a/question/type/ordering/version.php +++ b/question/type/ordering/version.php @@ -29,5 +29,5 @@ $plugin->cron = 0; $plugin->component = 'qtype_ordering'; $plugin->maturity = MATURITY_STABLE; $plugin->requires = 2010112400; // Moodle 2.0 -$plugin->version = 2017080164; -$plugin->release = '2017-08-01 (64)'; +$plugin->version = 2017112265; +$plugin->release = '2017-11-22 (65)';