[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/mod/quiz/yui/build/moodle-mod_quiz-modform/ -> moodle-mod_quiz-modform-debug.js (source)

   1  YUI.add('moodle-mod_quiz-modform', function (Y, NAME) {
   2  
   3  /**
   4   * The modform class has all the JavaScript specific to mod/quiz/mod_form.php.
   5   *
   6   * @module moodle-mod_quiz-modform
   7   */
   8  
   9  var MODFORM = function() {
  10      MODFORM.superclass.constructor.apply(this, arguments);
  11  };
  12  
  13  /**
  14   * The coursebase class to provide shared functionality to Modules within
  15   * Moodle.
  16   *
  17   * @class M.course.coursebase
  18   * @constructor
  19   */
  20  Y.extend(MODFORM, Y.Base, {
  21      repaginateCheckbox: null,
  22      qppSelect: null,
  23      qppInitialValue: 0,
  24  
  25      initializer: function () {
  26          this.repaginateCheckbox = Y.one('#id_repaginatenow');
  27          if (!this.repaginateCheckbox) {
  28              // The checkbox only appears when editing an existing quiz.
  29              return;
  30          }
  31  
  32          this.qppSelect = Y.one('#id_questionsperpage');
  33          this.qppInitialValue = this.qppSelect.get('value');
  34          this.qppSelect.on('change', this.qppChanged, this);
  35          Y.one('#id_shufflequestions').on('change', this.qppChanged, this);
  36      },
  37  
  38      qppChanged: function() {
  39          Y.later(50, this, function() {
  40              if (!this.repaginateCheckbox.get('disabled')) {
  41                  this.repaginateCheckbox.set('checked', this.qppSelect.get('value') !== this.qppInitialValue);
  42              }
  43          });
  44      }
  45  
  46  });
  47  
  48  // Ensure that M.course exists and that coursebase is initialised correctly
  49  M.mod_quiz = M.mod_quiz || {};
  50  M.mod_quiz.modform = M.mod_quiz.modform || new MODFORM();
  51  M.mod_quiz.modform.init = function() {
  52      return new MODFORM();
  53  };
  54  
  55  
  56  }, '@VERSION@', {"requires": ["base", "node", "event"]});


Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1