[ Index ]

PHP Cross Reference of Unnamed Project

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      },
  36  
  37      qppChanged: function() {
  38          Y.later(50, this, function() {
  39              if (!this.repaginateCheckbox.get('disabled')) {
  40                  this.repaginateCheckbox.set('checked', this.qppSelect.get('value') !== this.qppInitialValue);
  41              }
  42          });
  43      }
  44  
  45  });
  46  
  47  // Ensure that M.mod_quiz exists and that coursebase is initialised correctly
  48  M.mod_quiz = M.mod_quiz || {};
  49  M.mod_quiz.modform = M.mod_quiz.modform || new MODFORM();
  50  M.mod_quiz.modform.init = function() {
  51      return new MODFORM();
  52  };
  53  
  54  
  55  }, '@VERSION@', {"requires": ["base", "node", "event"]});


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1