[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 YUI.add('moodle-question-qbankmanager', function (Y, NAME) { 2 3 // This file is part of Moodle - http://moodle.org/ 4 // 5 // Moodle is free software: you can redistribute it and/or modify 6 // it under the terms of the GNU General Public License as published by 7 // the Free Software Foundation, either version 3 of the License, or 8 // (at your option) any later version. 9 // 10 // Moodle is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 // GNU General Public License for more details. 14 // 15 // You should have received a copy of the GNU General Public License 16 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 17 18 /* 19 * Question Bank Management. 20 * 21 * @package question 22 * @copyright 2014 Andrew Nicols 23 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 24 */ 25 26 /** 27 * Questionbank Management. 28 * 29 * @module moodle-question-qbankmanager 30 */ 31 32 /** 33 * Question Bank Management. 34 * 35 * @class M.question.qbankmanager 36 */ 37 38 var manager = { 39 /** 40 * A reference to the header checkbox. 41 * 42 * @property _header 43 * @type Node 44 * @private 45 */ 46 _header: null, 47 48 /** 49 * The ID of the first checkbox on the page. 50 * 51 * @property _firstCheckbox 52 * @type Node 53 * @private 54 */ 55 _firstCheckbox: null, 56 57 /** 58 * Set up the Question Bank Manager. 59 * 60 * @method init 61 */ 62 init: function() { 63 // Find the header checkbox, and set the initial values. 64 this._header = Y.one('#qbheadercheckbox'); 65 if (!this._header) { 66 return; 67 } 68 this._header.setAttrs({ 69 disabled: false, 70 title: M.util.get_string('selectall', 'moodle') 71 }); 72 73 this._header.on('click', this._headerClick, this); 74 75 // Store the first checkbox details. 76 var table = this._header.ancestor('table'); 77 this._firstCheckbox = table.one('tbody tr td.checkbox input'); 78 }, 79 80 /** 81 * Handle toggling of the header checkbox. 82 * 83 * @method _headerClick 84 * @private 85 */ 86 _headerClick: function() { 87 // Get the list of questions we affect. 88 var categoryQuestions = Y.one('#categoryquestions') 89 .all('[type=checkbox],[type=radio]'); 90 91 // We base the state of all of the questions on the state of the first. 92 if (this._firstCheckbox.get('checked')) { 93 categoryQuestions.set('checked', false); 94 this._header.setAttribute('title', M.util.get_string('selectall', 'moodle')); 95 } else { 96 categoryQuestions.set('checked', true); 97 this._header.setAttribute('title', M.util.get_string('deselectall', 'moodle')); 98 } 99 100 this._header.set('checked', false); 101 } 102 }; 103 104 M.question = M.question || {}; 105 M.question.qbankmanager = M.question.qbankmanager || manager; 106 107 108 }, '@VERSION@', {"requires": ["node", "selector-css3"]});
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 |