Merge branch 'MDL-34356-master' of git://github.com/andrewnicols/moodle
authorDamyon Wiese <damyon@moodle.com>
Tue, 7 Jan 2014 08:57:49 +0000 (16:57 +0800)
committerDamyon Wiese <damyon@moodle.com>
Tue, 7 Jan 2014 08:57:49 +0000 (16:57 +0800)
course/renderer.php
course/yui/build/moodle-course-modchooser/moodle-course-modchooser-debug.js
course/yui/build/moodle-course-modchooser/moodle-course-modchooser-min.js
course/yui/build/moodle-course-modchooser/moodle-course-modchooser.js
course/yui/src/modchooser/js/modchooser.js
lib/yui/build/moodle-core-chooserdialogue/moodle-core-chooserdialogue-debug.js
lib/yui/build/moodle-core-chooserdialogue/moodle-core-chooserdialogue-min.js
lib/yui/build/moodle-core-chooserdialogue/moodle-core-chooserdialogue.js
lib/yui/src/chooserdialogue/js/chooserdialogue.js

index e7f1b6b..eb6ab4a 100644 (file)
@@ -194,8 +194,6 @@ class core_course_renderer extends plugin_renderer_base {
         $formcontent .= html_writer::start_tag('div', array('id' => 'typeformdiv'));
         $formcontent .= html_writer::tag('input', '', array('type' => 'hidden', 'id' => 'course',
                 'name' => 'course', 'value' => $course->id));
-        $formcontent .= html_writer::tag('input', '',
-                array('type' => 'hidden', 'class' => 'jump', 'name' => 'jump', 'value' => ''));
         $formcontent .= html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'sesskey',
                 'value' => sesskey()));
         $formcontent .= html_writer::end_tag('div');
index 96126f3..d3bf0c1 100644 (file)
Binary files a/course/yui/build/moodle-course-modchooser/moodle-course-modchooser-debug.js and b/course/yui/build/moodle-course-modchooser/moodle-course-modchooser-debug.js differ
index 33f576f..f9bddf4 100644 (file)
Binary files a/course/yui/build/moodle-course-modchooser/moodle-course-modchooser-min.js and b/course/yui/build/moodle-course-modchooser/moodle-course-modchooser-min.js differ
index 96126f3..d3bf0c1 100644 (file)
Binary files a/course/yui/build/moodle-course-modchooser/moodle-course-modchooser.js and b/course/yui/build/moodle-course-modchooser/moodle-course-modchooser.js differ
index 0bd9825..b1033e3 100644 (file)
@@ -29,9 +29,6 @@ Y.extend(MODCHOOSER, M.core.chooserdialogue, {
     // The current section ID
     sectionid : null,
 
-    // The hidden element holding the jump param
-    jumplink : null,
-
     initializer : function() {
         var dialogue = Y.one('.chooserdialoguebody');
         var header = Y.one('.choosertitle');
@@ -155,8 +152,11 @@ Y.extend(MODCHOOSER, M.core.chooserdialogue, {
         e.preventDefault();
     },
     option_selected : function(thisoption) {
-        // Add the sectionid to the URL
-        this.jumplink.set('value', thisoption.get('value') + '&section=' + this.sectionid);
+        // Add the sectionid to the URL.
+        this.hiddenRadioValue.setAttrs({
+            name: 'jump',
+            value: thisoption.get('value') + '&section=' + this.sectionid
+        });
     }
 },
 {
index 0d1d0a2..1e19920 100644 (file)
Binary files a/lib/yui/build/moodle-core-chooserdialogue/moodle-core-chooserdialogue-debug.js and b/lib/yui/build/moodle-core-chooserdialogue/moodle-core-chooserdialogue-debug.js differ
index c044e7d..ed61bb1 100644 (file)
Binary files a/lib/yui/build/moodle-core-chooserdialogue/moodle-core-chooserdialogue-min.js and b/lib/yui/build/moodle-core-chooserdialogue/moodle-core-chooserdialogue-min.js differ
index 0d1d0a2..1e19920 100644 (file)
Binary files a/lib/yui/build/moodle-core-chooserdialogue/moodle-core-chooserdialogue.js and b/lib/yui/build/moodle-core-chooserdialogue/moodle-core-chooserdialogue.js differ
index 4506f5f..2371c65 100644 (file)
@@ -19,6 +19,9 @@ Y.extend(CHOOSERDIALOGUE, Y.Base, {
     headercontent : null,
     instanceconfig : null,
 
+    // The hidden field storing the disabled element values for submission.
+    hiddenRadioValue: null,
+
     setup_chooser_dialogue : function(bodycontent, headercontent, config) {
         this.bodycontent = bodycontent;
         this.headercontent = headercontent;
@@ -60,10 +63,15 @@ Y.extend(CHOOSERDIALOGUE, Y.Base, {
         this.panel.hide();
         this.panel.render();
 
-        // Set useful links
+        // Set useful links.
         this.container = this.panel.get('boundingBox').one('.choosercontainer');
         this.options = this.container.all('.option input[type=radio]');
 
+        // The hidden form element we use when submitting.
+        this.hiddenRadioValue = Y.Node.create('<input type="hidden" value="" />');
+        this.container.one('form').appendChild(this.hiddenRadioValue);
+
+
         // Add the chooserdialogue class to the container for styling
         this.panel.get('boundingBox').addClass('chooserdialogue');
     },
@@ -135,7 +143,6 @@ Y.extend(CHOOSERDIALOGUE, Y.Base, {
         this.listenevents.push(thisevent);
 
         // Add references to various elements we adjust
-        this.jumplink     = this.container.one('.jump');
         this.submitbutton = this.container.one('.submitbutton');
 
         // Disable the submit element until the user makes a selection
@@ -268,7 +275,14 @@ Y.extend(CHOOSERDIALOGUE, Y.Base, {
         }, this);
     },
 
-    option_selected : function() {
+    option_selected : function(e) {
+        // Set a hidden input field with the value and name of the radio button.  When we submit the form, we
+        // disable the radios to prevent duplicate submission. This has the result however that the value is never
+        // submitted so we set this value to a hidden field instead
+        this.hiddenRadioValue.setAttrs({
+            value: e.get('value'),
+            name: e.get('name')
+        });
     }
 },
 {