[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 var CSS = { 2 ADDNEWQUESTIONBUTTONS: 'ul.menu a.addquestion', 3 CREATENEWQUESTION: 'div.createnewquestion', 4 CHOOSERDIALOGUE: 'div.chooserdialogue', 5 CHOOSERHEADER: 'div.choosertitle' 6 }; 7 8 /** 9 * The questionchooser class is responsible for instantiating and displaying the question chooser 10 * when viewing a quiz in editing mode. 11 * 12 * @class questionchooser 13 * @constructor 14 * @protected 15 * @extends M.core.chooserdialogue 16 */ 17 var QUESTIONCHOOSER = function() { 18 QUESTIONCHOOSER.superclass.constructor.apply(this, arguments); 19 }; 20 21 Y.extend(QUESTIONCHOOSER, M.core.chooserdialogue, { 22 initializer: function() { 23 Y.one('body').delegate('click', this.display_dialogue, CSS.ADDNEWQUESTIONBUTTONS, this); 24 }, 25 26 display_dialogue: function(e) { 27 e.preventDefault(); 28 var dialogue = Y.one(CSS.CREATENEWQUESTION + ' ' + CSS.CHOOSERDIALOGUE), 29 header = Y.one(CSS.CREATENEWQUESTION + ' ' + CSS.CHOOSERHEADER); 30 31 if (this.container === null) { 32 // Setup the dialogue, and then prepare the chooser if it's not already been set up. 33 this.setup_chooser_dialogue(dialogue, header, {}); 34 this.prepare_chooser(); 35 } 36 37 // Update all of the hidden fields within the questionbank form. 38 var parameters = Y.QueryString.parse(e.currentTarget.get('search').substring(1)); 39 var form = this.container.one('form'); 40 this.parameters_to_hidden_input(parameters, form, 'returnurl'); 41 this.parameters_to_hidden_input(parameters, form, 'cmid'); 42 this.parameters_to_hidden_input(parameters, form, 'category'); 43 this.parameters_to_hidden_input(parameters, form, 'addonpage'); 44 this.parameters_to_hidden_input(parameters, form, 'appendqnumstring'); 45 46 // Display the chooser dialogue. 47 this.display_chooser(e); 48 }, 49 50 parameters_to_hidden_input: function(parameters, form, name) { 51 var value; 52 if (parameters.hasOwnProperty(name)) { 53 value = parameters[name]; 54 } else { 55 value = ''; 56 } 57 var input = form.one('input[name=' + name + ']'); 58 if (!input) { 59 input = form.appendChild('<input type="hidden">'); 60 input.set('name', name); 61 } 62 input.set('value', value); 63 } 64 }, { 65 NAME: 'mod_quiz-questionchooser' 66 }); 67 68 M.mod_quiz = M.mod_quiz || {}; 69 M.mod_quiz.init_questionchooser = function() { 70 M.mod_quiz.question_chooser = new QUESTIONCHOOSER({}); 71 return M.mod_quiz.question_chooser; 72 };
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |