1 // This file is part of Moodle - http://moodle.org/
3 // Moodle is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, either version 3 of the License, or
6 // (at your option) any later version.
8 // Moodle is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
13 // You should have received a copy of the GNU General Public License
14 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
17 * Javascript extensions for LTI submission viewer.
21 * @copyright Copyright (c) 2011 Moodlerooms Inc. (http://www.moodlerooms.com)
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23 * @author Chris Scribner
28 M.mod_lti = M.mod_lti || {};
30 M.mod_lti.submissions = {
39 setupTable: function(){
40 var lti_submissions_table = Y.YUI2.util.Dom.get('lti_submissions_table');
42 var dataSource = new Y.YUI2.util.DataSource(lti_submissions_table);
44 var configuredColumns = [
45 { key: "user", label: "User", sortable:true },
46 { key: "date", label: "Submission Date", sortable:true, formatter: 'date' },
50 formatter: function(cell, record, column, data){
51 cell.innerHTML = parseFloat(data).toFixed(1) + '%';
56 dataSource.responseType = Y.YUI2.util.DataSource.TYPE_HTMLTABLE;
57 dataSource.responseSchema = {
60 { key: "date", parser: "date" },
61 { key: "grade", parser: "number" },
65 new Y.YUI2.widget.DataTable("lti_submissions_table_container", configuredColumns, dataSource,
67 sortedBy: {key:"date", dir:"desc"}
71 Y.one('#lti_submissions_table_container').setStyle('display', '');