[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 var SELECTORS = { 2 CREATENEWQUESTION: 'div.createnewquestion', 3 CREATENEWQUESTIONFORM: 'div.createnewquestion form', 4 CHOOSERDIALOGUE: 'div.chooserdialogue', 5 CHOOSERHEADER: 'div.choosertitle' 6 }; 7 8 function Chooser() { 9 Chooser.superclass.constructor.apply(this, arguments); 10 } 11 12 Y.extend(Chooser, M.core.chooserdialogue, { 13 initializer: function() { 14 Y.all('form').each(function(node) { 15 if (/question\/addquestion\.php/.test(node.getAttribute('action'))) { 16 node.on('submit', this.displayQuestionChooser, this); 17 } 18 }, this); 19 }, 20 displayQuestionChooser: function(e) { 21 var dialogue = Y.one(SELECTORS.CREATENEWQUESTION + ' ' + SELECTORS.CHOOSERDIALOGUE), 22 header = Y.one(SELECTORS.CREATENEWQUESTION + ' ' + SELECTORS.CHOOSERHEADER); 23 24 if (this.container === null) { 25 // Setup the dialogue, and then prepare the chooser if it's not already been set up. 26 this.setup_chooser_dialogue(dialogue, header, {}); 27 this.prepare_chooser(); 28 } 29 30 // Update all of the hidden fields within the questionbank form. 31 var originForm = e.target.ancestor('form', true), 32 targetForm = this.container.one('form'), 33 hiddenElements = originForm.all('input[type="hidden"]'); 34 35 targetForm.all('input.customfield').remove(); 36 hiddenElements.each(function(field) { 37 targetForm.appendChild(field.cloneNode()) 38 .removeAttribute('id') 39 .addClass('customfield'); 40 }); 41 42 // Display the chooser dialogue. 43 this.display_chooser(e); 44 } 45 }, { 46 NAME: 'questionChooser' 47 }); 48 49 M.question = M.question || {}; 50 M.question.init_chooser = function(config) { 51 return new Chooser(config); 52 };
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 |