Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

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