Merge branch 'MDL-53170_levels-fix' of git://github.com/dmonllao/moodle
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Wed, 11 May 2016 09:54:01 +0000 (11:54 +0200)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Wed, 11 May 2016 09:54:01 +0000 (11:54 +0200)
13 files changed:
admin/tool/lp/amd/build/dragdrop-reorder.min.js
admin/tool/lp/amd/src/dragdrop-reorder.js
admin/tool/lp/yui/build/moodle-tool_lp-dragdrop-reorder/moodle-tool_lp-dragdrop-reorder-debug.js
admin/tool/lp/yui/build/moodle-tool_lp-dragdrop-reorder/moodle-tool_lp-dragdrop-reorder-min.js
admin/tool/lp/yui/build/moodle-tool_lp-dragdrop-reorder/moodle-tool_lp-dragdrop-reorder.js
admin/tool/lp/yui/src/dragdrop-reorder/js/dragdropreorder.js
enrol/lti/lang/en/enrol_lti.php
enrol/lti/settings.php
enrol/lti/tool.php
lib/yui/build/moodle-core-dragdrop/moodle-core-dragdrop-debug.js
lib/yui/build/moodle-core-dragdrop/moodle-core-dragdrop-min.js
lib/yui/build/moodle-core-dragdrop/moodle-core-dragdrop.js
lib/yui/src/dragdrop/js/dragdrop.js

index 77c33ba..48751b5 100644 (file)
Binary files a/admin/tool/lp/amd/build/dragdrop-reorder.min.js and b/admin/tool/lp/amd/build/dragdrop-reorder.min.js differ
index 433604d..d14c9dd 100644 (file)
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 define(['core/str', 'core/yui'], function(str, Y) {
-
     // Private variables and functions.
 
+    /**
+     * Store the current instance of the core drag drop.
+     *
+     * @property dragDropInstance M.tool_lp.dragdrop_reorder
+     */
+    var dragDropInstance = null;
+
     /**
      * Translate the drophit event from YUI
      * into simple drag and drop nodes.
@@ -70,7 +76,10 @@ define(['core/str', 'core/yui'], function(str, Y) {
                     var context = {
                         callback: callback
                     };
-                    M.tool_lp.dragdrop_reorder({
+                    if (dragDropInstance) {
+                        dragDropInstance.destroy();
+                    }
+                    dragDropInstance = M.tool_lp.dragdrop_reorder({
                         group: group,
                         dragHandleText: dragHandleText,
                         sameNodeText: sameNodeText,
index caebb22..159ec86 100644 (file)
Binary files a/admin/tool/lp/yui/build/moodle-tool_lp-dragdrop-reorder/moodle-tool_lp-dragdrop-reorder-debug.js and b/admin/tool/lp/yui/build/moodle-tool_lp-dragdrop-reorder/moodle-tool_lp-dragdrop-reorder-debug.js differ
index f91699e..47c197c 100644 (file)
Binary files a/admin/tool/lp/yui/build/moodle-tool_lp-dragdrop-reorder/moodle-tool_lp-dragdrop-reorder-min.js and b/admin/tool/lp/yui/build/moodle-tool_lp-dragdrop-reorder/moodle-tool_lp-dragdrop-reorder-min.js differ
index caebb22..159ec86 100644 (file)
Binary files a/admin/tool/lp/yui/build/moodle-tool_lp-dragdrop-reorder/moodle-tool_lp-dragdrop-reorder.js and b/admin/tool/lp/yui/build/moodle-tool_lp-dragdrop-reorder/moodle-tool_lp-dragdrop-reorder.js differ
index c2feccb..3624631 100644 (file)
@@ -63,5 +63,5 @@ Y.extend(DRAGREORDER, M.core.dragdrop, {
 
 M.tool_lp = M.tool_lp || {};
 M.tool_lp.dragdrop_reorder = function(params) {
-    new DRAGREORDER(params);
+    return new DRAGREORDER(params);
 };
index 122cbf1..3780910 100644 (file)
@@ -22,6 +22,7 @@
  * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
 
+$string['allowframembedding'] = 'In order to avoid problems embedding this site, please enable the \'Allow frame embedding\' setting in Admin > Security > HTTP security.';
 $string['enrolenddate'] = 'End date';
 $string['enrolenddate_help'] = 'If enabled, users can access until this date only.';
 $string['enrolenddateerror'] = 'Enrolment end date cannot be earlier than start date';
@@ -32,6 +33,7 @@ $string['enrolmentfinished'] = 'Enrolment finished.';
 $string['enrolmentnotstarted'] = 'Enrolment has not started.';
 $string['enrolstartdate'] = 'Start date';
 $string['enrolstartdate_help'] = 'If enabled, users can access from this date onward only.';
+$string['framembeddingnotenabled'] = 'The site you are connecting to does not have frame embedding enabled. To access the resource please click on the link below.';
 $string['globalsharedsecret'] = 'Global shared secret';
 $string['gradesync'] = 'Grade synchronisation';
 $string['gradesync_help'] = 'This determines if we want grade synchronisation to occur.';
@@ -48,6 +50,7 @@ $string['membersyncmodeunenrolmissing'] = 'Unenrol missing members';
 $string['notoolsprovided'] = 'No tools provided';
 $string['lti:config'] = 'Configure LTI enrol instances';
 $string['lti:unenrol'] = 'Unenrol users from the course';
+$string['opentool'] = 'Open tool';
 $string['pluginname'] = 'Shared external tool';
 $string['pluginname_desc'] = 'The shared external tool plugin allows externals users to access a course or an activity via a unique link - this requires the LTI authentication plugin to be enabled.';
 $string['remotesystem'] = 'Remote system';
index 6c92669..444ca3f 100644 (file)
@@ -29,6 +29,12 @@ if ($ADMIN->fulltree) {
     $settings->add(new admin_setting_heading('enrol_lti_user_default_values',
         get_string('userdefaultvalues', 'enrol_lti'), ''));
 
+    if (empty($CFG->allowframembedding)) {
+        $notify = new \core\output\notification(get_string('allowframembedding', 'enrol_lti'),
+            \core\output\notification::NOTIFY_WARNING);
+        $settings->add(new admin_setting_heading('enrol_lti_enable_embedding', '', $OUTPUT->render($notify)));
+    }
+
     $choices = array(0 => get_string('emaildisplayno'),
                      1 => get_string('emaildisplayyes'),
                      2 => get_string('emaildisplaycourse'));
index e267341..30a7560 100644 (file)
@@ -204,8 +204,15 @@ if ($ltirequest->valid) {
     // Finalise the user log in.
     complete_user_login($user);
 
-    // All done, redirect the user to where they want to go.
-    redirect($urltogo);
+    if (empty($CFG->allowframembedding)) {
+        // Provide an alternative link.
+        $stropentool = get_string('opentool', 'enrol_lti');
+        echo html_writer::tag('p', get_string('framembeddingnotenabled', 'enrol_lti'));
+        echo html_writer::link($urltogo, $stropentool, array('target' => '_blank'));
+    } else {
+        // All done, redirect the user to where they want to go.
+        redirect($urltogo);
+    }
 } else {
     echo $ltirequest->message;
 }
index d979ca0..d400c70 100644 (file)
Binary files a/lib/yui/build/moodle-core-dragdrop/moodle-core-dragdrop-debug.js and b/lib/yui/build/moodle-core-dragdrop/moodle-core-dragdrop-debug.js differ
index 1e72909..1043763 100644 (file)
Binary files a/lib/yui/build/moodle-core-dragdrop/moodle-core-dragdrop-min.js and b/lib/yui/build/moodle-core-dragdrop/moodle-core-dragdrop-min.js differ
index d979ca0..d400c70 100644 (file)
Binary files a/lib/yui/build/moodle-core-dragdrop/moodle-core-dragdrop.js and b/lib/yui/build/moodle-core-dragdrop/moodle-core-dragdrop.js differ
index 55d6ca4..12ff14e 100644 (file)
@@ -98,6 +98,15 @@ Y.extend(DRAGDROP, Y.Base, {
      */
     lastdroptarget: null,
 
+    /**
+     * Listeners.
+     *
+     * @property listeners
+     * @type Array
+     * @default null
+     */
+    listeners: null,
+
     /**
      * The initializer which sets up the move action.
      *
@@ -105,31 +114,43 @@ Y.extend(DRAGDROP, Y.Base, {
      * @protected
      */
     initializer: function() {
+        this.listeners = [];
+
         // Listen for all drag:start events.
-        Y.DD.DDM.on('drag:start', this.global_drag_start, this);
+        this.listeners.push(Y.DD.DDM.on('drag:start', this.global_drag_start, this));
 
         // Listen for all drag:end events.
-        Y.DD.DDM.on('drag:end', this.global_drag_end, this);
+        this.listeners.push(Y.DD.DDM.on('drag:end', this.global_drag_end, this));
 
         // Listen for all drag:drag events.
-        Y.DD.DDM.on('drag:drag', this.global_drag_drag, this);
+        this.listeners.push(Y.DD.DDM.on('drag:drag', this.global_drag_drag, this));
 
         // Listen for all drop:over events.
-        Y.DD.DDM.on('drop:over', this.global_drop_over, this);
+        this.listeners.push(Y.DD.DDM.on('drop:over', this.global_drop_over, this));
 
         // Listen for all drop:hit events.
-        Y.DD.DDM.on('drop:hit', this.global_drop_hit, this);
+        this.listeners.push(Y.DD.DDM.on('drop:hit', this.global_drop_hit, this));
 
         // Listen for all drop:miss events.
-        Y.DD.DDM.on('drag:dropmiss', this.global_drag_dropmiss, this);
+        this.listeners.push(Y.DD.DDM.on('drag:dropmiss', this.global_drag_dropmiss, this));
 
         // Add keybaord listeners for accessible drag/drop
-        Y.one(Y.config.doc.body).delegate('key', this.global_keydown,
-                'down:32, enter, esc', '.' + MOVEICON.cssclass, this);
+        this.listeners.push(Y.one(Y.config.doc.body).delegate('key', this.global_keydown,
+                'down:32, enter, esc', '.' + MOVEICON.cssclass, this));
 
         // Make the accessible drag/drop respond to a single click.
-        Y.one(Y.config.doc.body).delegate('click', this.global_keydown,
-                '.' + MOVEICON.cssclass , this);
+        this.listeners.push(Y.one(Y.config.doc.body).delegate('click', this.global_keydown,
+                '.' + MOVEICON.cssclass , this));
+    },
+
+    /**
+     * The destructor to shut down the instance of the dragdrop system.
+     *
+     * @method destructor
+     * @protected
+     */
+    destructor: function() {
+        new Y.EventHandle(this.listeners).detach();
     },
 
     /**