Merge branch 'wip-MDL-34298-m23' of git://github.com/samhemelryk/moodle into MOODLE_2...
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Tue, 19 Feb 2013 23:46:29 +0000 (00:46 +0100)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Tue, 19 Feb 2013 23:46:29 +0000 (00:46 +0100)
34 files changed:
README.txt
blocks/html/backup/moodle1/lib.php
blocks/rss_client/backup/moodle1/lib.php
blog/edit_form.php
config-dist.php
course/dndupload.js
course/lib.php
course/tests/courselib_test.php
enrol/locallib.php
enrol/manual/ajax.php
enrol/manual/yui/quickenrolment/quickenrolment.js
grade/report/grader/module.js
lib/csslib.php
lib/db/upgrade.php
lib/filelib.php
lib/outputlib.php
lib/statslib.php
mod/data/renderer.php
mod/lti/locallib.php
mod/quiz/accessrule/openclosedate/rule.php
mod/scorm/report/basic/report.php
mod/scorm/report/graphs/graph.php
mod/scorm/report/interactions/report.php
question/format/blackboard/tests/fixtures/sample_blackboard.dat
question/format/blackboard_six/formatbase.php
question/format/blackboard_six/tests/fixtures/sample_blackboard_pool.dat
question/format/xml/format.php
question/format/xml/tests/fixtures/truefalse.xml
report/courseoverview/index.php
report/courseoverview/settings.php
theme/base/style/core.css
theme/mymobile/javascript/custom.js
theme/mymobile/style/core.css
version.php

index 245848b..b1017df 100644 (file)
@@ -8,7 +8,7 @@ a few minutes:
 1) Move the Moodle files into your web directory.
 
 2) Create a single database for Moodle to store all
-   it's tables in (or choose an existing database).
+   its tables in (or choose an existing database).
 
 3) Visit your Moodle site with a browser, you should
    be taken to the install.php script, which will lead
index d4a491f..6373a01 100644 (file)
@@ -1,46 +1,46 @@
-<?php\r
-\r
-/**\r
- * Provides support for the conversion of moodle1 backup to the moodle2 format\r
- *\r
- * @package    block_html\r
- * @copyright  2012 Paul Nicholls\r
- * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\r
- */\r
-\r
-defined('MOODLE_INTERNAL') || die();\r
-\r
-/**\r
- * Block conversion handler for html\r
- */\r
-class moodle1_block_html_handler extends moodle1_block_handler {\r
-    private $fileman = null;\r
-    protected function convert_configdata(array $olddata) {\r
-        $instanceid = $olddata['id'];\r
-        $contextid  = $this->converter->get_contextid(CONTEXT_BLOCK, $olddata['id']);\r
-        $configdata = unserialize(base64_decode($olddata['configdata']));\r
-\r
-        // get a fresh new file manager for this instance\r
-        $this->fileman = $this->converter->get_file_manager($contextid, 'block_html');\r
-\r
-        // convert course files embedded in the block content\r
-        $this->fileman->filearea = 'content';\r
-        $this->fileman->itemid   = 0;\r
-        $configdata->text = moodle1_converter::migrate_referenced_files($configdata->text, $this->fileman);\r
-        $configdata->format = FORMAT_HTML;\r
-\r
-        return base64_encode(serialize($configdata));\r
-    }\r
-\r
-    protected function write_inforef_xml($newdata, $data) {\r
-        $this->open_xml_writer("course/blocks/{$data['name']}_{$data['id']}/inforef.xml");\r
-        $this->xmlwriter->begin_tag('inforef');\r
-        $this->xmlwriter->begin_tag('fileref');\r
-        foreach ($this->fileman->get_fileids() as $fileid) {\r
-            $this->write_xml('file', array('id' => $fileid));\r
-        }\r
-        $this->xmlwriter->end_tag('fileref');\r
-        $this->xmlwriter->end_tag('inforef');\r
-        $this->close_xml_writer();\r
-    }\r
-}
\ No newline at end of file
+<?php
+
+/**
+ * Provides support for the conversion of moodle1 backup to the moodle2 format
+ *
+ * @package    block_html
+ * @copyright  2012 Paul Nicholls
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * Block conversion handler for html
+ */
+class moodle1_block_html_handler extends moodle1_block_handler {
+    private $fileman = null;
+    protected function convert_configdata(array $olddata) {
+        $instanceid = $olddata['id'];
+        $contextid  = $this->converter->get_contextid(CONTEXT_BLOCK, $olddata['id']);
+        $configdata = unserialize(base64_decode($olddata['configdata']));
+
+        // get a fresh new file manager for this instance
+        $this->fileman = $this->converter->get_file_manager($contextid, 'block_html');
+
+        // convert course files embedded in the block content
+        $this->fileman->filearea = 'content';
+        $this->fileman->itemid   = 0;
+        $configdata->text = moodle1_converter::migrate_referenced_files($configdata->text, $this->fileman);
+        $configdata->format = FORMAT_HTML;
+
+        return base64_encode(serialize($configdata));
+    }
+
+    protected function write_inforef_xml($newdata, $data) {
+        $this->open_xml_writer("course/blocks/{$data['name']}_{$data['id']}/inforef.xml");
+        $this->xmlwriter->begin_tag('inforef');
+        $this->xmlwriter->begin_tag('fileref');
+        foreach ($this->fileman->get_fileids() as $fileid) {
+            $this->write_xml('file', array('id' => $fileid));
+        }
+        $this->xmlwriter->end_tag('fileref');
+        $this->xmlwriter->end_tag('inforef');
+        $this->close_xml_writer();
+    }
+}
index 95da634..d698365 100644 (file)
@@ -1,34 +1,34 @@
-<?php\r
-\r
-/**\r
- * Provides support for the conversion of moodle1 backup to the moodle2 format\r
- *\r
- * @package    block_rss_client\r
- * @copyright  2012 Paul Nicholls\r
- * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\r
- */\r
-\r
-defined('MOODLE_INTERNAL') || die();\r
-\r
-/**\r
- * Block conversion handler for rss_client\r
- */\r
-class moodle1_block_rss_client_handler extends moodle1_block_handler {\r
-    public function process_block(array $data) {\r
-        parent::process_block($data);\r
-        $instanceid = $data['id'];\r
-        $contextid = $this->converter->get_contextid(CONTEXT_BLOCK, $data['id']);\r
-\r
-        // Moodle 1.9 backups do not include sufficient data to restore feeds, so we need an empty shell rss_client.xml\r
-        // for the restore process to find\r
-        $this->open_xml_writer("course/blocks/{$data['name']}_{$instanceid}/rss_client.xml");\r
-        $this->xmlwriter->begin_tag('block', array('id' => $instanceid, 'contextid' => $contextid, 'blockname' => 'rss_client'));\r
-        $this->xmlwriter->begin_tag('rss_client', array('id' => $instanceid));\r
-        $this->xmlwriter->full_tag('feeds', '');\r
-        $this->xmlwriter->end_tag('rss_client');\r
-        $this->xmlwriter->end_tag('block');\r
-        $this->close_xml_writer();\r
-\r
-        return $data;\r
-    }\r
-}
\ No newline at end of file
+<?php
+
+/**
+ * Provides support for the conversion of moodle1 backup to the moodle2 format
+ *
+ * @package    block_rss_client
+ * @copyright  2012 Paul Nicholls
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+/**
+ * Block conversion handler for rss_client
+ */
+class moodle1_block_rss_client_handler extends moodle1_block_handler {
+    public function process_block(array $data) {
+        parent::process_block($data);
+        $instanceid = $data['id'];
+        $contextid = $this->converter->get_contextid(CONTEXT_BLOCK, $data['id']);
+
+        // Moodle 1.9 backups do not include sufficient data to restore feeds, so we need an empty shell rss_client.xml
+        // for the restore process to find
+        $this->open_xml_writer("course/blocks/{$data['name']}_{$instanceid}/rss_client.xml");
+        $this->xmlwriter->begin_tag('block', array('id' => $instanceid, 'contextid' => $contextid, 'blockname' => 'rss_client'));
+        $this->xmlwriter->begin_tag('rss_client', array('id' => $instanceid));
+        $this->xmlwriter->full_tag('feeds', '');
+        $this->xmlwriter->end_tag('rss_client');
+        $this->xmlwriter->end_tag('block');
+        $this->close_xml_writer();
+
+        return $data;
+    }
+}
index 1def593..1d6df07 100644 (file)
@@ -87,8 +87,8 @@ class blog_edit_form extends moodleform {
                 }
 
                 if (has_capability('moodle/blog:associatecourse', $context)) {
-                    $mform->addElement('header', 'assochdr', get_string('associations', 'blog'));\r
-                    $mform->addElement('advcheckbox', 'courseassoc', get_string('associatewithcourse', 'blog', $a), null, null, array(0, $contextid));\r
+                    $mform->addElement('header', 'assochdr', get_string('associations', 'blog'));
+                    $mform->addElement('advcheckbox', 'courseassoc', get_string('associatewithcourse', 'blog', $a), null, null, array(0, $contextid));
                     $mform->setDefault('courseassoc', $contextid);
                 }
 
index eb0ab29..e43b2ef 100644 (file)
@@ -367,7 +367,8 @@ $CFG->admin = 'admin';
 //
 //     $CFG->themedir = '/location/of/extra/themes';
 //
-// It is possible to specify different cache and temp directories, use local fast filesystem.
+// It is possible to specify different cache and temp directories, use local fast filesystem
+// for normal web servers. Server clusters MUST use shared filesystem for cachedir!
 // The directories must not be accessible via web.
 //
 //     $CFG->tempdir = '/var/www/moodle/temp';
index fda43af..6f2766b 100644 (file)
@@ -548,7 +548,7 @@ M.course_dndupload = {
         var extension = '';
         var dotpos = file.name.lastIndexOf('.');
         if (dotpos != -1) {
-            extension = file.name.substr(dotpos+1, file.name.length);
+            extension = file.name.substr(dotpos+1, file.name.length).toLowerCase();
         }
 
         for (var i=0; i<filehandlers.length; i++) {
index eb42753..2aa6548 100644 (file)
@@ -2848,6 +2848,7 @@ function add_mod_to_section($mod, $beforemod=NULL) {
         }
 
         $DB->set_field("course_sections", "sequence", $newsequence, array("id"=>$section->id));
+        $DB->set_field("course_modules", "section", $section->id, array("id" => $mod->id));
         return $section->id;     // Return course_sections ID that was used.
 
     } else {  // Insert a new record
@@ -2857,7 +2858,9 @@ function add_mod_to_section($mod, $beforemod=NULL) {
         $section->summary  = "";
         $section->summaryformat = FORMAT_HTML;
         $section->sequence = $mod->coursemodule;
-        return $DB->insert_record("course_sections", $section);
+        $section->id = $DB->insert_record("course_sections", $section);
+        $DB->set_field("course_modules", "section", $section->id, array("id" => $mod->id));
+        return $section->id;
     }
 }
 
index acf5963..ab573d0 100644 (file)
@@ -226,4 +226,68 @@ class courselib_testcase extends advanced_testcase {
         $this->assertGreaterThanOrEqual($category2->sortorder, $category3->sortorder);
         $this->assertGreaterThanOrEqual($category1->sortorder, $category3->sortorder);
     }
+
+    public function test_move_module_in_course() {
+        global $DB;
+
+        $this->resetAfterTest(true);
+        // Setup fixture
+        $course = $this->getDataGenerator()->create_course(array('numsections'=>5), array('createsections' => true));
+        $forum = $this->getDataGenerator()->create_module('forum', array('course'=>$course->id));
+
+        $cms = get_fast_modinfo($course)->get_cms();
+        $cm = reset($cms);
+
+        $newsection = get_fast_modinfo($course)->get_section_info(3);
+        $oldsectionid = $cm->section;
+
+        // Perform the move
+        $result = moveto_module($cm, $newsection);
+        $this->assertTrue($result);
+
+        // get_fast_modinfo(reset) is usually called the code calling moveto_module so call it here
+        $reset = 'reset';
+        get_fast_modinfo($reset);
+        $cms = get_fast_modinfo($course)->get_cms();
+        $cm = reset($cms);
+
+        // Check that the old section's sequence no longer contains this ID
+        $oldsection = $DB->get_record('course_sections', array('id' => $oldsectionid));
+        $oldsequences = explode(',', $newsection->sequence);
+        $this->assertFalse(in_array($cm->id, $oldsequences));
+
+        // Check that the new section's sequence now contains this ID
+        $newsection = $DB->get_record('course_sections', array('id' => $newsection->id));
+        $newsequences = explode(',', $newsection->sequence);
+        $this->assertTrue(in_array($cm->id, $newsequences));
+
+        // Check that the section number has been changed in the cm
+        $this->assertEquals($newsection->id, $cm->section);
+
+
+        // Perform a second move as some issues were only seen on the second move
+        $newsection = get_fast_modinfo($course)->get_section_info(2);
+        $oldsectionid = $cm->section;
+        $result = moveto_module($cm, $newsection);
+        $this->assertTrue($result);
+
+        // get_fast_modinfo(reset) is usually called the code calling moveto_module so call it here
+        $reset = 'reset';
+        get_fast_modinfo($reset);
+        $cms = get_fast_modinfo($course)->get_cms();
+        $cm = reset($cms);
+
+        // Check that the old section's sequence no longer contains this ID
+        $oldsection = $DB->get_record('course_sections', array('id' => $oldsectionid));
+        $oldsequences = explode(',', $newsection->sequence);
+        $this->assertFalse(in_array($cm->id, $oldsequences));
+
+        // Check that the new section's sequence now contains this ID
+        $newsection = $DB->get_record('course_sections', array('id' => $newsection->id));
+        $newsequences = explode(',', $newsection->sequence);
+        $this->assertTrue(in_array($cm->id, $newsequences));
+
+        // Check that the section number has been changed in the cm
+        $this->assertEquals($newsection->id, $cm->section);
+    }
 }
index 1577265..095fe95 100644 (file)
@@ -272,9 +272,10 @@ class course_enrolment_manager {
      * @param bool $searchanywhere
      * @param int $page Defaults to 0
      * @param int $perpage Defaults to 25
+     * @param int $addedenrollment Defaults to 0
      * @return array Array(totalusers => int, users => array)
      */
-    public function get_potential_users($enrolid, $search='', $searchanywhere=false, $page=0, $perpage=25) {
+    public function get_potential_users($enrolid, $search='', $searchanywhere=false, $page=0, $perpage=25, $addedenrollment=0) {
         global $DB, $CFG;
 
         // Add some additional sensible conditions
@@ -312,7 +313,7 @@ class course_enrolment_manager {
         $order = ' ORDER BY u.lastname ASC, u.firstname ASC';
         $params['enrolid'] = $enrolid;
         $totalusers = $DB->count_records_sql($countfields . $sql, $params);
-        $availableusers = $DB->get_records_sql($fields . $sql . $order, $params, $page*$perpage, $perpage);
+        $availableusers = $DB->get_records_sql($fields . $sql . $order, $params, ($page*$perpage) - $addedenrollment, $perpage);
         return array('totalusers'=>$totalusers, 'users'=>$availableusers);
     }
 
index b599b95..d938d12 100644 (file)
@@ -67,7 +67,9 @@ switch ($action) {
         $enrolid = required_param('enrolid', PARAM_INT);
         $search  = optional_param('search', '', PARAM_RAW);
         $page = optional_param('page', 0, PARAM_INT);
-        $outcome->response = $manager->get_potential_users($enrolid, $search, true, $page);
+        $addedenrollment = optional_param('enrolcount', 0, PARAM_INT);
+        $perpage = optional_param('perpage', 25, PARAM_INT);  //  This value is hard-coded to 25 in quickenrolment.js
+        $outcome->response = $manager->get_potential_users($enrolid, $search, true, $page, $perpage, $addedenrollment);
         $extrafields = get_extra_user_fields($context);
         foreach ($outcome->response['users'] as &$user) {
             $user->picture = $OUTPUT->user_picture($user);
index 3236a75..bcc5f5b 100644 (file)
@@ -22,7 +22,9 @@ YUI.add('moodle-enrol_manual-quickenrolment', function(Y) {
         DEFAULTDURATION : 'defaultDuration',
         ASSIGNABLEROLES : 'assignableRoles',
         DISABLEGRADEHISTORY : 'disableGradeHistory',
-        RECOVERGRADESDEFAULT : 'recoverGradesDefault'
+        RECOVERGRADESDEFAULT : 'recoverGradesDefault',
+        ENROLCOUNT : 'enrolCount',
+        PERPAGE : 'perPage'
     };
     /** CSS classes for nodes in structure **/
     var CSS = {
@@ -304,6 +306,9 @@ YUI.add('moodle-enrol_manual-quickenrolment', function(Y) {
             params['action'] = 'searchusers';
             params['search'] = this.get(UEP.SEARCH).get('value');
             params['page'] = this.get(UEP.PAGE);
+            params['enrolcount'] = this.get(UEP.ENROLCOUNT);
+            params['perpage'] = this.get(UEP.PERPAGE);
+
             if (this.get(UEP.MULTIPLE)) {
                 alert('oh no there are multiple');
             } else {
@@ -371,7 +376,7 @@ YUI.add('moodle-enrol_manual-quickenrolment', function(Y) {
                 var content = create('<div class="'+CSS.SEARCHRESULTS+'"></div>')
                     .append(create('<div class="'+CSS.TOTALUSERS+'">'+usersstr+'</div>'))
                     .append(users);
-                if (result.response.totalusers > (this.get(UEP.PAGE)+1)*25) {
+                if (result.response.totalusers > (this.get(UEP.PAGE)+1)*this.get(UEP.PERPAGE)) {
                     var fetchmore = create('<div class="'+CSS.MORERESULTS+'"><a href="#">'+M.str.enrol.ajaxnext25+'</a></div>');
                     fetchmore.on('click', this.search, this, true);
                     content.append(fetchmore)
@@ -379,7 +384,7 @@ YUI.add('moodle-enrol_manual-quickenrolment', function(Y) {
                 this.setContent(content);
                 Y.delegate("click", this.enrolUser, users, '.'+CSS.USER+' .'+CSS.ENROL, this, args);
             } else {
-                if (result.response.totalusers <= (this.get(UEP.PAGE)+1)*25) {
+                if (result.response.totalusers <= (this.get(UEP.PAGE)+1)*this.get(UEP.PERPAGE)) {
                     this.get(UEP.BASE).one('.'+CSS.MORERESULTS).remove();
                 }
             }
@@ -415,6 +420,8 @@ YUI.add('moodle-enrol_manual-quickenrolment', function(Y) {
                                 args.userNode.addClass(CSS.ENROLLED);
                                 args.userNode.one('.'+CSS.ENROL).remove();
                                 this.set(UEP.REQUIREREFRESH, true);
+                                var countenrol = this.get(UEP.ENROLCOUNT)+1;
+                                this.set(UEP.ENROLCOUNT, countenrol);
                             }
                         } catch (e) {
                             new M.core.exception(e);
@@ -527,6 +534,14 @@ YUI.add('moodle-enrol_manual-quickenrolment', function(Y) {
             },
             recoverGradesDefault : {
                 value : ''
+            },
+            enrolCount : {
+                value : 0,
+                validator : Y.Lang.isNumber
+            },
+            perPage : {
+                value: 25,
+                Validator: Y.Lang.isNumber
             }
         }
     });
index 800f554..8f38012 100644 (file)
@@ -322,9 +322,9 @@ M.gradereport_grader.classes.ajax = function(report, cfg) {
                 this.existingfields[userid][itemid] = new M.gradereport_grader.classes.existingfield(this, userid, itemid);
             }
         }
-        // Hide the Update button
+        // Disable the Update button as we're saving using ajax.
         submitbutton = this.report.Y.one('#gradersubmit');
-        submitbutton.setStyle('visibility', 'hidden');
+        submitbutton.set('disabled', true);
     }
 };
 /**
index d160359..79f10f6 100644 (file)
@@ -1745,7 +1745,13 @@ class css_rule {
         $css = $this->out();
         $errors = array();
         foreach ($this->styles as $style) {
-            if ($style->has_error()) {
+            if (is_array($style)) {
+                foreach ($style as $s) {
+                    if ($style instanceof css_style && $style->has_error()) {
+                        $errors[] = "  * ".$style->get_last_error();
+                    }
+                }
+            } else if ($style instanceof css_style && $style->has_error()) {
                 $errors[] = "  * ".$style->get_last_error();
             }
         }
index 1ffa88a..ef4c5ae 100644 (file)
@@ -992,5 +992,72 @@ function xmldb_main_upgrade($oldversion) {
         upgrade_main_savepoint(true, 2012062503.07);
     }
 
+    if ($oldversion < 2012062504.07) {
+        // Fixing possible wrong MIME types for SMART Notebook files.
+        $extensions = array('%.gallery', '%.galleryitem', '%.gallerycollection', '%.nbk', '%.notebook', '%.xbk');
+        $select = $DB->sql_like('filename', '?', false);
+        foreach ($extensions as $extension) {
+            $DB->set_field_select(
+                'files',
+                'mimetype',
+                'application/x-smarttech-notebook',
+                $select,
+                array($extension)
+            );
+        }
+
+        // Main savepoint reached.
+        upgrade_main_savepoint(true, 2012062504.07);
+    }
+
+    if ($oldversion < 2012062504.08) {
+        // Retrieve the list of course_sections as a recordset to save memory
+        $coursesections = $DB->get_recordset('course_sections', null, 'course, id', 'id, course, sequence');
+        foreach ($coursesections as $coursesection) {
+            // Retrieve all of the actual modules in this course and section combination to reduce DB calls
+            $actualsectionmodules = $DB->get_records('course_modules',
+                    array('course' => $coursesection->course, 'section' => $coursesection->id), '', 'id, section');
+
+            // Break out the current sequence so that we can compare it
+            $currentsequence = explode(',', $coursesection->sequence);
+            $newsequence = array();
+
+            // Check each of the modules in the current sequence
+            foreach ($currentsequence as $module) {
+                if (isset($actualsectionmodules[$module])) {
+                    $newsequence[] = $module;
+                    // We unset the actualsectionmodules so that we don't get duplicates and that we can add orphaned
+                    // modules later
+                    unset($actualsectionmodules[$module]);
+                }
+            }
+
+            // Append any modules which have somehow been orphaned
+            foreach ($actualsectionmodules as $module) {
+                $newsequence[] = $module->id;
+            }
+
+            // Piece it all back together
+            $sequence = implode(',', $newsequence);
+
+            // Only update if there have been changes
+            if ($sequence !== $coursesection->sequence) {
+                $coursesection->sequence = $sequence;
+                $DB->update_record('course_sections', $coursesection);
+
+                // And clear the sectioncache and modinfo cache - they'll be regenerated on next use
+                $course = new stdClass();
+                $course->id = $coursesection->course;
+                $course->sectioncache = null;
+                $course->modinfo = null;
+                $DB->update_record('course', $course);
+            }
+        }
+        $coursesections->close();
+
+        // Main savepoint reached.
+        upgrade_main_savepoint(true, 2012062504.08);
+    }
+
     return true;
 }
index 529b9e4..3b2ef54 100644 (file)
@@ -1408,6 +1408,10 @@ function &get_mimetypes_array() {
         'fdf'  => array ('type'=>'application/pdf', 'icon'=>'pdf'),
         'flv'  => array ('type'=>'video/x-flv', 'icon'=>'flash', 'groups'=>array('video','web_video'), 'string'=>'video'),
         'f4v'  => array ('type'=>'video/mp4', 'icon'=>'flash', 'groups'=>array('video','web_video'), 'string'=>'video'),
+
+        'gallery'           => array ('type'=>'application/x-smarttech-notebook', 'icon'=>'archive'),
+        'galleryitem,'      => array ('type'=>'application/x-smarttech-notebook', 'icon'=>'archive'),
+        'gallerycollection' => array ('type'=>'application/x-smarttech-notebook', 'icon'=>'archive'),
         'gif'  => array ('type'=>'image/gif', 'icon'=>'gif', 'groups'=>array('image', 'web_image'), 'string'=>'image'),
         'gtar' => array ('type'=>'application/x-gtar', 'icon'=>'archive', 'groups'=>array('archive'), 'string'=>'archive'),
         'tgz'  => array ('type'=>'application/g-zip', 'icon'=>'archive', 'groups'=>array('archive'), 'string'=>'archive'),
@@ -1451,6 +1455,9 @@ function &get_mimetypes_array() {
         'mpe'  => array ('type'=>'video/mpeg', 'icon'=>'mpeg', 'groups'=>array('video','web_video'), 'string'=>'video'),
         'mpg'  => array ('type'=>'video/mpeg', 'icon'=>'mpeg', 'groups'=>array('video','web_video'), 'string'=>'video'),
 
+        'nbk'       => array ('type'=>'application/x-smarttech-notebook', 'icon'=>'archive'),
+        'notebook'  => array ('type'=>'application/x-smarttech-notebook', 'icon'=>'archive'),
+
         'odt'  => array ('type'=>'application/vnd.oasis.opendocument.text', 'icon'=>'writer', 'groups'=>array('document')),
         'ott'  => array ('type'=>'application/vnd.oasis.opendocument.text-template', 'icon'=>'writer', 'groups'=>array('document')),
         'oth'  => array ('type'=>'application/vnd.oasis.opendocument.text-web', 'icon'=>'oth', 'groups'=>array('document')),
@@ -1530,6 +1537,8 @@ function &get_mimetypes_array() {
         'webm'  => array ('type'=>'video/webm', 'icon'=>'video', 'groups'=>array('video'), 'string'=>'video'),
         'wmv'  => array ('type'=>'video/x-ms-wmv', 'icon'=>'wmv', 'groups'=>array('video'), 'string'=>'video'),
         'asf'  => array ('type'=>'video/x-ms-asf', 'icon'=>'wmv', 'groups'=>array('video'), 'string'=>'video'),
+
+        'xbk'  => array ('type'=>'application/x-smarttech-notebook', 'icon'=>'archive'),
         'xdp'  => array ('type'=>'application/pdf', 'icon'=>'pdf'),
         'xfd'  => array ('type'=>'application/pdf', 'icon'=>'pdf'),
         'xfdf' => array ('type'=>'application/pdf', 'icon'=>'pdf'),
@@ -1544,6 +1553,7 @@ function &get_mimetypes_array() {
 
         'xml'  => array ('type'=>'application/xml', 'icon'=>'markup'),
         'xsl'  => array ('type'=>'text/xml', 'icon'=>'markup'),
+
         'zip'  => array ('type'=>'application/zip', 'icon'=>'archive', 'groups'=>array('archive'), 'string'=>'archive')
     );
     return $mimearray;
index 7d963f3..8246b2c 100644 (file)
@@ -776,10 +776,12 @@ class theme_config {
     protected function css_files_get_contents($file, array $keys, css_optimiser $optimiser = null) {
         global $CFG;
         if (is_array($file)) {
+            // We use a separate array to keep everything in the exact same order.
+            $return = array();
             foreach ($file as $key=>$f) {
-                $file[$key] = $this->css_files_get_contents($f, array_merge($keys, array($key)), $optimiser);
+                $return[clean_param($key, PARAM_SAFEDIR)] = $this->css_files_get_contents($f, array_merge($keys, array($key)), $optimiser);
             }
-            return $file;
+            return $return;
         } else {
             $contents = file_get_contents($file);
             $contents = $this->post_process($contents);
@@ -867,7 +869,6 @@ class theme_config {
                 }
             }
         }
-
         return $js;
     }
 
index 4091dad..9b7f74d 100644 (file)
@@ -1368,6 +1368,18 @@ function stats_get_report_options($courseid,$mode) {
     return $reportoptions;
 }
 
+/**
+ * Fix missing entries in the statistics.
+ *
+ * This creates a dummy stat when nothing happened during a day/week/month.
+ *
+ * @param array $stats array of statistics.
+ * @param int $timeafter unused.
+ * @param string $timestr type of statistics to generate (dayly, weekly, monthly).
+ * @param boolean $line2
+ * @param boolean $line3
+ * @return array of fixed statistics.
+ */
 function stats_fix_zeros($stats,$timeafter,$timestr,$line2=true,$line3=false) {
 
     if (empty($stats)) {
@@ -1375,23 +1387,29 @@ function stats_fix_zeros($stats,$timeafter,$timestr,$line2=true,$line3=false) {
     }
 
     $timestr = str_replace('user_','',$timestr); // just in case.
-    $fun = 'stats_get_base_'.$timestr;
 
+    // Gets the current user base time.
+    $fun = 'stats_get_base_'.$timestr;
     $now = $fun();
 
-    $times = array();
-    // add something to timeafter since it is our absolute base
+    // Extract the ending time of the statistics.
     $actualtimes = array();
-    foreach ($stats as $statid=>$s) {
-        //normalize the times in stats - those might have been created in different timezone, DST etc.
-        $s->timeend = $fun($s->timeend + 60*60*5);
+    foreach ($stats as $statid => $s) {
+        // Normalise the month date to the 1st if for any reason it's set to later. But we ignore
+        // anything above or equal to 29 because sometimes we get the end of the month.
+        if ($timestr == 'monthly' && date('d', $s->timeend) > 1 && date('d', $s->timeend) < 29) {
+            $s->timeend = mktime(date('H', $s->timeend), date('i', $s->timeend), date('s', $s->timeend),
+                date('m', $s->timeend), 1, date('Y', $s->timeend));
+        }
         $stats[$statid] = $s;
-
         $actualtimes[] = $s->timeend;
     }
 
-    $timeafter = array_pop(array_values($actualtimes));
+    $actualtimesvalues = array_values($actualtimes);
+    $timeafter = array_pop($actualtimesvalues);
 
+    // Generate a base timestamp for each possible month/week/day.
+    $times = array();
     while ($timeafter < $now) {
         $times[] = $timeafter;
         if ($timestr == 'daily') {
@@ -1399,12 +1417,26 @@ function stats_fix_zeros($stats,$timeafter,$timestr,$line2=true,$line3=false) {
         } else if ($timestr == 'weekly') {
             $timeafter = stats_get_next_week_start($timeafter);
         } else if ($timestr == 'monthly') {
-            $timeafter = stats_get_next_month_start($timeafter);
+            // We can't just simply +1 month because the 31st Jan + 1 month = 2nd of March.
+            $year = date('Y', $timeafter);
+            $month = date('m', $timeafter);
+            $day = date('d', $timeafter);
+            $dayofnextmonth = $day;
+            if ($day >= 29) {
+                $daysinmonth = date('n', mktime(0, 0, 0, $month+1, 1, $year));
+                if ($day > $daysinmonth) {
+                    $dayofnextmonth = $daysinmonth;
+                }
+            }
+            $timeafter = mktime(date('H', $timeafter), date('i', $timeafter), date('s', $timeafter), $month+1,
+                $dayofnextmonth, $year);
         } else {
-            return $stats; // this will put us in a never ending loop.
+            // This will put us in a never ending loop.
+            return $stats;
         }
     }
 
+    // Add the base timestamp to the statistics if not present.
     foreach ($times as $count => $time) {
         if (!in_array($time,$actualtimes) && $count != count($times) -1) {
             $newobj = new StdClass;
@@ -1425,7 +1457,6 @@ function stats_fix_zeros($stats,$timeafter,$timestr,$line2=true,$line3=false) {
 
     usort($stats,"stats_compare_times");
     return $stats;
-
 }
 
 // helper function to sort arrays by $obj->timeend
index 3a23941..1dff332 100644 (file)
@@ -3,7 +3,7 @@
 defined('MOODLE_INTERNAL') || die();
 
 class mod_data_renderer extends plugin_renderer_base {
-    
+
     public function import_setting_mappings($datamodule, data_preset_importer $importer) {
 
         $strblank = get_string('blank', 'data');
@@ -24,7 +24,7 @@ class mod_data_renderer extends plugin_renderer_base {
         $html .= html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'action', 'value'=>'finishimport'));
         $html .= html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'sesskey', 'value'=>sesskey()));
         $html .= html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'d', 'value'=>$datamodule->id));
-        
+
         if ($importer instanceof data_preset_existing_importer) {
             $html .= html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'fullname', 'value'=>$importer->get_userid().'/'.$importer->get_directory()));
         } else {
@@ -60,7 +60,7 @@ class mod_data_renderer extends plugin_renderer_base {
                 } else {
                     $row[1] .= html_writer::tag('option', get_string('mapnewfield', 'data'), array('value'=>'-1', 'selected'=>'selected'));
                 }
-                
+
                 $row[1] .= html_writer::end_tag('select');
                 $table->data[] = $row;
             }
@@ -82,5 +82,5 @@ class mod_data_renderer extends plugin_renderer_base {
 
         return $html;
     }
-    
-}
\ No newline at end of file
+
+}
index 14e8723..645ec15 100644 (file)
@@ -162,18 +162,18 @@ function lti_view($instance) {
 
     if (empty($key) || empty($secret)) {
         $returnurlparams['unsigned'] = '1';
+    }
 
-        //Add the return URL. We send the launch container along to help us avoid frames-within-frames when the user returns
-        $url = new moodle_url('/mod/lti/return.php', $returnurlparams);
-        $returnurl = $url->out(false);
-
-        if ($typeconfig['forcessl'] == '1') {
-            $returnurl = lti_ensure_url_is_https($returnurl);
-        }
+    // Add the return URL. We send the launch container along to help us avoid frames-within-frames when the user returns.
+    $url = new moodle_url('/mod/lti/return.php', $returnurlparams);
+    $returnurl = $url->out(false);
 
-        $requestparams['launch_presentation_return_url'] = $returnurl;
+    if ($typeconfig['forcessl'] == '1') {
+        $returnurl = lti_ensure_url_is_https($returnurl);
     }
 
+    $requestparams['launch_presentation_return_url'] = $returnurl;
+
     if (!empty($key) && !empty($secret)) {
         $parms = lti_sign_parameters($requestparams, $endpoint, "POST", $key, $secret);
     } else {
index 639bb1a..98d6da5 100644 (file)
@@ -47,6 +47,9 @@ class quizaccess_openclosedate extends quiz_access_rule_base {
         if ($this->timenow < $this->quiz->timeopen) {
             $result[] = get_string('quiznotavailable', 'quizaccess_openclosedate',
                     userdate($this->quiz->timeopen));
+            if ($this->quiz->timeclose) {
+                $result[] = get_string('quizcloseson', 'quiz', userdate($this->quiz->timeclose));
+            }
 
         } else if ($this->quiz->timeclose && $this->timenow > $this->quiz->timeclose) {
             $result[] = get_string('quizclosed', 'quiz', userdate($this->quiz->timeclose));
index 954c0f3..b035216 100644 (file)
@@ -33,6 +33,7 @@ class scorm_basic_report extends scorm_default_report {
      */
     function display($scorm, $cm, $course, $download) {
         global $CFG, $DB, $OUTPUT, $PAGE;
+
         $contextmodule= get_context_instance(CONTEXT_MODULE, $cm->id);
         $action = optional_param('action', '', PARAM_ALPHA);
         $attemptids = optional_param_array('attemptid', array(), PARAM_RAW);
@@ -274,7 +275,7 @@ class scorm_basic_report extends scorm_default_report {
             $select = 'SELECT DISTINCT '.$DB->sql_concat('u.id', '\'#\'', 'COALESCE(st.attempt, 0)').' AS uniqueid, ';
             $select .= 'st.scormid AS scormid, st.attempt AS attempt, ' .
                     'u.id AS userid, u.idnumber, u.firstname, u.lastname, u.picture, u.imagealt, u.email' .
-                    get_extra_user_fields_sql($coursecontext, 'u', '', array('idnumber')) . ' ';
+                    get_extra_user_fields_sql($coursecontext, 'u', '', array('email', 'idnumber')) . ' ';
 
             // This part is the same for all cases - join users and scorm_scoes_track tables
             $from = 'FROM {user} u ';
index 2891739..8307098 100644 (file)
@@ -89,11 +89,11 @@ for ($i = 0; $i < $bands; $i++) {
 
 // Do this only if we have students to report
 if(!$nostudents) {
-    // Construct the SQL\r
-    $select = 'SELECT DISTINCT '.$DB->sql_concat('st.userid', '\'#\'', 'COALESCE(st.attempt, 0)').' AS uniqueid, ';\r
-    $select .= 'st.userid AS userid, st.scormid AS scormid, st.attempt AS attempt, st.scoid AS scoid ';\r
-    $from = 'FROM {scorm_scoes_track} st ';\r
-    $where = ' WHERE st.userid ' .$usql. ' and st.scoid = ?';\r
+    // Construct the SQL
+    $select = 'SELECT DISTINCT '.$DB->sql_concat('st.userid', '\'#\'', 'COALESCE(st.attempt, 0)').' AS uniqueid, ';
+    $select .= 'st.userid AS userid, st.scormid AS scormid, st.attempt AS attempt, st.scoid AS scoid ';
+    $from = 'FROM {scorm_scoes_track} st ';
+    $where = ' WHERE st.userid ' .$usql. ' and st.scoid = ?';
     $attempts = $DB->get_records_sql($select.$from.$where, $params);
 
     foreach ($attempts as $attempt) {
index 26e6a0c..f219074 100644 (file)
@@ -35,6 +35,7 @@ class scorm_interactions_report extends scorm_default_report {
      */
     function display($scorm, $cm, $course, $download) {
         global $CFG, $DB, $OUTPUT, $PAGE;
+
         $contextmodule = get_context_instance(CONTEXT_MODULE, $cm->id);
         $action = optional_param('action', '', PARAM_ALPHA);
         $attemptids = optional_param_array('attemptid', array(), PARAM_RAW);
@@ -159,7 +160,7 @@ class scorm_interactions_report extends scorm_default_report {
             $select = 'SELECT DISTINCT '.$DB->sql_concat('u.id', '\'#\'', 'COALESCE(st.attempt, 0)').' AS uniqueid, ';
             $select .= 'st.scormid AS scormid, st.attempt AS attempt, ' .
                     'u.id AS userid, u.idnumber, u.firstname, u.lastname, u.picture, u.imagealt, u.email'.
-                    get_extra_user_fields_sql($coursecontext, 'u', '', array('idnumber')) . ' ';
+                    get_extra_user_fields_sql($coursecontext, 'u', '', array('email', 'idnumber')) . ' ';
 
             // This part is the same for all cases - join users and scorm_scoes_track tables
             $from = 'FROM {user} u ';
index 93bb583..f4d9183 100644 (file)
-<?xml version='1.0' encoding='utf-8'?>\r
-<POOL>\r
-    <TITLE value='exam 3 2008-9'/>\r
-    <QUESTIONLIST>\r
-        <QUESTION id='q1' class='QUESTION_TRUEFALSE' points='1'/>\r
-        <QUESTION id='q7' class='QUESTION_MULTIPLECHOICE' points='1'/>\r
-        <QUESTION id='q8' class='QUESTION_MULTIPLEANSWER' points='1'/>\r
-        <QUESTION id='q39-44' class='QUESTION_MATCH' points='1'/>\r
-        <QUESTION id='q9' class='QUESTION_ESSAY' points='1'/>\r
-        <QUESTION id='q27' class='QUESTION_FILLINBLANK' points='1'/>\r
-    </QUESTIONLIST>\r
-    <QUESTION_TRUEFALSE id='q1'>\r
-        <BODY>\r
-            <TEXT><![CDATA[<span style="font-size:12pt">42 is the Absolute Answer to everything.</span>]]></TEXT>\r
-            <FLAGS>\r
-                <ISHTML value='true'/>\r
-                <ISNEWLINELITERAL value='false'/>\r
-            </FLAGS>\r
-        </BODY>\r
-        <ANSWER id='q1_a1'>\r
-            <TEXT>False</TEXT>\r
-        </ANSWER>\r
-        <ANSWER id='q1_a2'>\r
-            <TEXT>True</TEXT>\r
-        </ANSWER>\r
-        <GRADABLE>\r
-            <CORRECTANSWER answer_id='q1_a2'/>\r
-            <FEEDBACK_WHEN_CORRECT><![CDATA[You gave the right answer.]]></FEEDBACK_WHEN_CORRECT>\r
-            <FEEDBACK_WHEN_INCORRECT><![CDATA[42 is the Ultimate Answer.]]></FEEDBACK_WHEN_INCORRECT>\r
-        </GRADABLE>\r
-    </QUESTION_TRUEFALSE>\r
-    <QUESTION_MULTIPLECHOICE id='q7'>\r
-        <BODY>\r
-            <TEXT><![CDATA[<span style="font-size:12pt">What's between orange and green in the spectrum?</span>]]></TEXT>\r
-            <FLAGS>\r
-                <ISHTML value='true'/>\r
-                <ISNEWLINELITERAL value='false'/>\r
-            </FLAGS>\r
-        </BODY>\r
-        <ANSWER id='q7_a1' position='1'>\r
-        <TEXT><![CDATA[<span style="font-size:12pt">red</span>]]></TEXT>\r
-        </ANSWER>\r
-        <ANSWER id='q7_a2' position='2'>\r
-        <TEXT><![CDATA[<span style="font-size:12pt">yellow</span>]]></TEXT>\r
-        </ANSWER>\r
-        <ANSWER id='q7_a3' position='3'>\r
-        <TEXT><![CDATA[<span style="font-size:12pt">blue</span>]]></TEXT>\r
-        </ANSWER>\r
-        <GRADABLE>\r
-            <CORRECTANSWER answer_id='q7_a2'/>\r
-            <FEEDBACK_WHEN_CORRECT><![CDATA[You gave the right answer.]]></FEEDBACK_WHEN_CORRECT>\r
-            <FEEDBACK_WHEN_INCORRECT><![CDATA[Only yellow is between orange and green in the spectrum.]]></FEEDBACK_WHEN_INCORRECT>\r
-        </GRADABLE>\r
-    </QUESTION_MULTIPLECHOICE>\r
-    <QUESTION_MULTIPLEANSWER id='q8'>\r
-        <BODY>\r
-            <TEXT><![CDATA[<span style="font-size:12pt">What's between orange and green in the spectrum?</span>]]></TEXT>\r
-            <FLAGS>\r
-                <ISHTML value='true'/>\r
-                <ISNEWLINELITERAL value='false'/>\r
-            </FLAGS>\r
-        </BODY>\r
-        <ANSWER id='q8_a1' position='1'>\r
-        <TEXT><![CDATA[<span style="font-size:12pt">yellow</span>]]></TEXT>\r
-        </ANSWER>\r
-        <ANSWER id='q8_a2' position='2'>\r
-        <TEXT><![CDATA[<span style="font-size:12pt">red</span>]]></TEXT>\r
-        </ANSWER>\r
-        <ANSWER id='q8_a3' position='3'>\r
-        <TEXT><![CDATA[<span style="font-size:12pt">off-beige</span>]]></TEXT>\r
-        </ANSWER>\r
-        <ANSWER id='q8_a4' position='4'>\r
-        <TEXT><![CDATA[<span style="font-size:12pt">blue</span>]]></TEXT>\r
-        </ANSWER>\r
-        <GRADABLE>\r
-            <CORRECTANSWER answer_id='q8_a1'/>\r
-            <CORRECTANSWER answer_id='q8_a3'/>\r
-            <FEEDBACK_WHEN_CORRECT><![CDATA[You gave the right answer.]]></FEEDBACK_WHEN_CORRECT>\r
-            <FEEDBACK_WHEN_INCORRECT><![CDATA[Only yellow and off-beige are between orange and green in the spectrum.]]></FEEDBACK_WHEN_INCORRECT>\r
-        </GRADABLE>\r
-    </QUESTION_MULTIPLEANSWER>\r
-    <QUESTION_MATCH id='q39-44'>\r
-        <BODY>\r
-            <TEXT><![CDATA[<i>Classify the animals.</i>]]></TEXT>\r
-            <FLAGS>\r
-                <ISHTML value='true'/>\r
-                <ISNEWLINELITERAL value='false'/>\r
-            </FLAGS>\r
-        </BODY>\r
-        <ANSWER id='q39-44_a1' position='1'>\r
-            <TEXT><![CDATA[frog]]></TEXT>\r
-        </ANSWER>\r
-        <ANSWER id='q39-44_a2' position='2'>\r
-            <TEXT><![CDATA[cat]]></TEXT>\r
-        </ANSWER>\r
-        <ANSWER id='q39-44_a3' position='3'>\r
-            <TEXT><![CDATA[newt]]></TEXT>\r
-        </ANSWER>\r
-        <CHOICE id='q39-44_c1' position='1'>\r
-            <TEXT><![CDATA[mammal]]></TEXT>\r
-        </CHOICE>\r
-        <CHOICE id='q39-44_c2' position='2'>\r
-            <TEXT><![CDATA[insect]]></TEXT>\r
-        </CHOICE>\r
-        <CHOICE id='q39-44_c3' position='3'>\r
-            <TEXT><![CDATA[amphibian]]></TEXT>\r
-        </CHOICE>\r
-        <GRADABLE>\r
-            <CORRECTANSWER answer_id='q39-44_a1' choice_id='q39-44_c3'/>\r
-            <CORRECTANSWER answer_id='q39-44_a2' choice_id='q39-44_c1'/>\r
-            <CORRECTANSWER answer_id='q39-44_a3' choice_id='q39-44_c3'/>\r
-        </GRADABLE>\r
-    </QUESTION_MATCH>\r
-    <QUESTION_ESSAY id='q9'>\r
-        <BODY>\r
-            <TEXT><![CDATA[How are you?]]></TEXT>\r
-            <FLAGS>\r
-                <ISHTML value='true'/>\r
-                <ISNEWLINELITERAL value='false'/>\r
-            </FLAGS>\r
-        </BODY>\r
-        <ANSWER id='q9_a1'>\r
-            <TEXT><![CDATA[Blackboard answer for essay questions will be imported as informations for graders.]]></TEXT>\r
-        </ANSWER>\r
-        <GRADABLE>\r
-        </GRADABLE>\r
-    </QUESTION_ESSAY>\r
-    <QUESTION_FILLINBLANK id='q27'>\r
-        <BODY>\r
-            <TEXT><![CDATA[<span style="font-size:12pt">Name an amphibian: __________.</span>]]></TEXT>\r
-            <FLAGS>\r
-                <ISHTML value='true'/>\r
-                <ISNEWLINELITERAL value='false'/>\r
-            </FLAGS>\r
-        </BODY>\r
-        <ANSWER id='q27_a1' position='1'>\r
-            <TEXT>frog</TEXT>\r
-        </ANSWER>\r
-        <GRADABLE>\r
-        </GRADABLE>\r
-    </QUESTION_FILLINBLANK>\r
-</POOL>\r
+<?xml version='1.0' encoding='utf-8'?>
+<POOL>
+    <TITLE value='exam 3 2008-9'/>
+    <QUESTIONLIST>
+        <QUESTION id='q1' class='QUESTION_TRUEFALSE' points='1'/>
+        <QUESTION id='q7' class='QUESTION_MULTIPLECHOICE' points='1'/>
+        <QUESTION id='q8' class='QUESTION_MULTIPLEANSWER' points='1'/>
+        <QUESTION id='q39-44' class='QUESTION_MATCH' points='1'/>
+        <QUESTION id='q9' class='QUESTION_ESSAY' points='1'/>
+        <QUESTION id='q27' class='QUESTION_FILLINBLANK' points='1'/>
+    </QUESTIONLIST>
+    <QUESTION_TRUEFALSE id='q1'>
+        <BODY>
+            <TEXT><![CDATA[<span style="font-size:12pt">42 is the Absolute Answer to everything.</span>]]></TEXT>
+            <FLAGS>
+                <ISHTML value='true'/>
+                <ISNEWLINELITERAL value='false'/>
+            </FLAGS>
+        </BODY>
+        <ANSWER id='q1_a1'>
+            <TEXT>False</TEXT>
+        </ANSWER>
+        <ANSWER id='q1_a2'>
+            <TEXT>True</TEXT>
+        </ANSWER>
+        <GRADABLE>
+            <CORRECTANSWER answer_id='q1_a2'/>
+            <FEEDBACK_WHEN_CORRECT><![CDATA[You gave the right answer.]]></FEEDBACK_WHEN_CORRECT>
+            <FEEDBACK_WHEN_INCORRECT><![CDATA[42 is the Ultimate Answer.]]></FEEDBACK_WHEN_INCORRECT>
+        </GRADABLE>
+    </QUESTION_TRUEFALSE>
+    <QUESTION_MULTIPLECHOICE id='q7'>
+        <BODY>
+            <TEXT><![CDATA[<span style="font-size:12pt">What's between orange and green in the spectrum?</span>]]></TEXT>
+            <FLAGS>
+                <ISHTML value='true'/>
+                <ISNEWLINELITERAL value='false'/>
+            </FLAGS>
+        </BODY>
+        <ANSWER id='q7_a1' position='1'>
+        <TEXT><![CDATA[<span style="font-size:12pt">red</span>]]></TEXT>
+        </ANSWER>
+        <ANSWER id='q7_a2' position='2'>
+        <TEXT><![CDATA[<span style="font-size:12pt">yellow</span>]]></TEXT>
+        </ANSWER>
+        <ANSWER id='q7_a3' position='3'>
+        <TEXT><![CDATA[<span style="font-size:12pt">blue</span>]]></TEXT>
+        </ANSWER>
+        <GRADABLE>
+            <CORRECTANSWER answer_id='q7_a2'/>
+            <FEEDBACK_WHEN_CORRECT><![CDATA[You gave the right answer.]]></FEEDBACK_WHEN_CORRECT>
+            <FEEDBACK_WHEN_INCORRECT><![CDATA[Only yellow is between orange and green in the spectrum.]]></FEEDBACK_WHEN_INCORRECT>
+        </GRADABLE>
+    </QUESTION_MULTIPLECHOICE>
+    <QUESTION_MULTIPLEANSWER id='q8'>
+        <BODY>
+            <TEXT><![CDATA[<span style="font-size:12pt">What's between orange and green in the spectrum?</span>]]></TEXT>
+            <FLAGS>
+                <ISHTML value='true'/>
+                <ISNEWLINELITERAL value='false'/>
+            </FLAGS>
+        </BODY>
+        <ANSWER id='q8_a1' position='1'>
+        <TEXT><![CDATA[<span style="font-size:12pt">yellow</span>]]></TEXT>
+        </ANSWER>
+        <ANSWER id='q8_a2' position='2'>
+        <TEXT><![CDATA[<span style="font-size:12pt">red</span>]]></TEXT>
+        </ANSWER>
+        <ANSWER id='q8_a3' position='3'>
+        <TEXT><![CDATA[<span style="font-size:12pt">off-beige</span>]]></TEXT>
+        </ANSWER>
+        <ANSWER id='q8_a4' position='4'>
+        <TEXT><![CDATA[<span style="font-size:12pt">blue</span>]]></TEXT>
+        </ANSWER>
+        <GRADABLE>
+            <CORRECTANSWER answer_id='q8_a1'/>
+            <CORRECTANSWER answer_id='q8_a3'/>
+            <FEEDBACK_WHEN_CORRECT><![CDATA[You gave the right answer.]]></FEEDBACK_WHEN_CORRECT>
+            <FEEDBACK_WHEN_INCORRECT><![CDATA[Only yellow and off-beige are between orange and green in the spectrum.]]></FEEDBACK_WHEN_INCORRECT>
+        </GRADABLE>
+    </QUESTION_MULTIPLEANSWER>
+    <QUESTION_MATCH id='q39-44'>
+        <BODY>
+            <TEXT><![CDATA[<i>Classify the animals.</i>]]></TEXT>
+            <FLAGS>
+                <ISHTML value='true'/>
+                <ISNEWLINELITERAL value='false'/>
+            </FLAGS>
+        </BODY>
+        <ANSWER id='q39-44_a1' position='1'>
+            <TEXT><![CDATA[frog]]></TEXT>
+        </ANSWER>
+        <ANSWER id='q39-44_a2' position='2'>
+            <TEXT><![CDATA[cat]]></TEXT>
+        </ANSWER>
+        <ANSWER id='q39-44_a3' position='3'>
+            <TEXT><![CDATA[newt]]></TEXT>
+        </ANSWER>
+        <CHOICE id='q39-44_c1' position='1'>
+            <TEXT><![CDATA[mammal]]></TEXT>
+        </CHOICE>
+        <CHOICE id='q39-44_c2' position='2'>
+            <TEXT><![CDATA[insect]]></TEXT>
+        </CHOICE>
+        <CHOICE id='q39-44_c3' position='3'>
+            <TEXT><![CDATA[amphibian]]></TEXT>
+        </CHOICE>
+        <GRADABLE>
+            <CORRECTANSWER answer_id='q39-44_a1' choice_id='q39-44_c3'/>
+            <CORRECTANSWER answer_id='q39-44_a2' choice_id='q39-44_c1'/>
+            <CORRECTANSWER answer_id='q39-44_a3' choice_id='q39-44_c3'/>
+        </GRADABLE>
+    </QUESTION_MATCH>
+    <QUESTION_ESSAY id='q9'>
+        <BODY>
+            <TEXT><![CDATA[How are you?]]></TEXT>
+            <FLAGS>
+                <ISHTML value='true'/>
+                <ISNEWLINELITERAL value='false'/>
+            </FLAGS>
+        </BODY>
+        <ANSWER id='q9_a1'>
+            <TEXT><![CDATA[Blackboard answer for essay questions will be imported as informations for graders.]]></TEXT>
+        </ANSWER>
+        <GRADABLE>
+        </GRADABLE>
+    </QUESTION_ESSAY>
+    <QUESTION_FILLINBLANK id='q27'>
+        <BODY>
+            <TEXT><![CDATA[<span style="font-size:12pt">Name an amphibian: __________.</span>]]></TEXT>
+            <FLAGS>
+                <ISHTML value='true'/>
+                <ISNEWLINELITERAL value='false'/>
+            </FLAGS>
+        </BODY>
+        <ANSWER id='q27_a1' position='1'>
+            <TEXT>frog</TEXT>
+        </ANSWER>
+        <GRADABLE>
+        </GRADABLE>
+    </QUESTION_FILLINBLANK>
+</POOL>
index 4424f5f..468f00f 100644 (file)
@@ -123,15 +123,16 @@ class qformat_blackboard_six_base extends qformat_based_on_xml {
         $data = array();
         // Step one, find all file refs then add to array.
         preg_match_all('|<img[^>]+src="([^"]*)"|i', $text, $out); // Find all src refs.
-
+        $filepaths = array();
         foreach ($out[1] as $path) {
             $fullpath = $this->filebase . '/' . $path;
 
-            if (is_readable($fullpath)) {
+            if (is_readable($fullpath) && !in_array($path, $filepaths)) {
                 $dirpath = dirname($path);
                 $filename = basename($path);
                 $newfilename = $this->store_file_for_text_field($data, $this->filebase, $dirpath, $filename);
                 $text = preg_replace("|$path|", "@@PLUGINFILE@@/" . $newfilename, $text);
+                $filepaths[] = $path;
             }
 
         }
index 93bb583..f4d9183 100644 (file)
-<?xml version='1.0' encoding='utf-8'?>\r
-<POOL>\r
-    <TITLE value='exam 3 2008-9'/>\r
-    <QUESTIONLIST>\r
-        <QUESTION id='q1' class='QUESTION_TRUEFALSE' points='1'/>\r
-        <QUESTION id='q7' class='QUESTION_MULTIPLECHOICE' points='1'/>\r
-        <QUESTION id='q8' class='QUESTION_MULTIPLEANSWER' points='1'/>\r
-        <QUESTION id='q39-44' class='QUESTION_MATCH' points='1'/>\r
-        <QUESTION id='q9' class='QUESTION_ESSAY' points='1'/>\r
-        <QUESTION id='q27' class='QUESTION_FILLINBLANK' points='1'/>\r
-    </QUESTIONLIST>\r
-    <QUESTION_TRUEFALSE id='q1'>\r
-        <BODY>\r
-            <TEXT><![CDATA[<span style="font-size:12pt">42 is the Absolute Answer to everything.</span>]]></TEXT>\r
-            <FLAGS>\r
-                <ISHTML value='true'/>\r
-                <ISNEWLINELITERAL value='false'/>\r
-            </FLAGS>\r
-        </BODY>\r
-        <ANSWER id='q1_a1'>\r
-            <TEXT>False</TEXT>\r
-        </ANSWER>\r
-        <ANSWER id='q1_a2'>\r
-            <TEXT>True</TEXT>\r
-        </ANSWER>\r
-        <GRADABLE>\r
-            <CORRECTANSWER answer_id='q1_a2'/>\r
-            <FEEDBACK_WHEN_CORRECT><![CDATA[You gave the right answer.]]></FEEDBACK_WHEN_CORRECT>\r
-            <FEEDBACK_WHEN_INCORRECT><![CDATA[42 is the Ultimate Answer.]]></FEEDBACK_WHEN_INCORRECT>\r
-        </GRADABLE>\r
-    </QUESTION_TRUEFALSE>\r
-    <QUESTION_MULTIPLECHOICE id='q7'>\r
-        <BODY>\r
-            <TEXT><![CDATA[<span style="font-size:12pt">What's between orange and green in the spectrum?</span>]]></TEXT>\r
-            <FLAGS>\r
-                <ISHTML value='true'/>\r
-                <ISNEWLINELITERAL value='false'/>\r
-            </FLAGS>\r
-        </BODY>\r
-        <ANSWER id='q7_a1' position='1'>\r
-        <TEXT><![CDATA[<span style="font-size:12pt">red</span>]]></TEXT>\r
-        </ANSWER>\r
-        <ANSWER id='q7_a2' position='2'>\r
-        <TEXT><![CDATA[<span style="font-size:12pt">yellow</span>]]></TEXT>\r
-        </ANSWER>\r
-        <ANSWER id='q7_a3' position='3'>\r
-        <TEXT><![CDATA[<span style="font-size:12pt">blue</span>]]></TEXT>\r
-        </ANSWER>\r
-        <GRADABLE>\r
-            <CORRECTANSWER answer_id='q7_a2'/>\r
-            <FEEDBACK_WHEN_CORRECT><![CDATA[You gave the right answer.]]></FEEDBACK_WHEN_CORRECT>\r
-            <FEEDBACK_WHEN_INCORRECT><![CDATA[Only yellow is between orange and green in the spectrum.]]></FEEDBACK_WHEN_INCORRECT>\r
-        </GRADABLE>\r
-    </QUESTION_MULTIPLECHOICE>\r
-    <QUESTION_MULTIPLEANSWER id='q8'>\r
-        <BODY>\r
-            <TEXT><![CDATA[<span style="font-size:12pt">What's between orange and green in the spectrum?</span>]]></TEXT>\r
-            <FLAGS>\r
-                <ISHTML value='true'/>\r
-                <ISNEWLINELITERAL value='false'/>\r
-            </FLAGS>\r
-        </BODY>\r
-        <ANSWER id='q8_a1' position='1'>\r
-        <TEXT><![CDATA[<span style="font-size:12pt">yellow</span>]]></TEXT>\r
-        </ANSWER>\r
-        <ANSWER id='q8_a2' position='2'>\r
-        <TEXT><![CDATA[<span style="font-size:12pt">red</span>]]></TEXT>\r
-        </ANSWER>\r
-        <ANSWER id='q8_a3' position='3'>\r
-        <TEXT><![CDATA[<span style="font-size:12pt">off-beige</span>]]></TEXT>\r
-        </ANSWER>\r
-        <ANSWER id='q8_a4' position='4'>\r
-        <TEXT><![CDATA[<span style="font-size:12pt">blue</span>]]></TEXT>\r
-        </ANSWER>\r
-        <GRADABLE>\r
-            <CORRECTANSWER answer_id='q8_a1'/>\r
-            <CORRECTANSWER answer_id='q8_a3'/>\r
-            <FEEDBACK_WHEN_CORRECT><![CDATA[You gave the right answer.]]></FEEDBACK_WHEN_CORRECT>\r
-            <FEEDBACK_WHEN_INCORRECT><![CDATA[Only yellow and off-beige are between orange and green in the spectrum.]]></FEEDBACK_WHEN_INCORRECT>\r
-        </GRADABLE>\r
-    </QUESTION_MULTIPLEANSWER>\r
-    <QUESTION_MATCH id='q39-44'>\r
-        <BODY>\r
-            <TEXT><![CDATA[<i>Classify the animals.</i>]]></TEXT>\r
-            <FLAGS>\r
-                <ISHTML value='true'/>\r
-                <ISNEWLINELITERAL value='false'/>\r
-            </FLAGS>\r
-        </BODY>\r
-        <ANSWER id='q39-44_a1' position='1'>\r
-            <TEXT><![CDATA[frog]]></TEXT>\r
-        </ANSWER>\r
-        <ANSWER id='q39-44_a2' position='2'>\r
-            <TEXT><![CDATA[cat]]></TEXT>\r
-        </ANSWER>\r
-        <ANSWER id='q39-44_a3' position='3'>\r
-            <TEXT><![CDATA[newt]]></TEXT>\r
-        </ANSWER>\r
-        <CHOICE id='q39-44_c1' position='1'>\r
-            <TEXT><![CDATA[mammal]]></TEXT>\r
-        </CHOICE>\r
-        <CHOICE id='q39-44_c2' position='2'>\r
-            <TEXT><![CDATA[insect]]></TEXT>\r
-        </CHOICE>\r
-        <CHOICE id='q39-44_c3' position='3'>\r
-            <TEXT><![CDATA[amphibian]]></TEXT>\r
-        </CHOICE>\r
-        <GRADABLE>\r
-            <CORRECTANSWER answer_id='q39-44_a1' choice_id='q39-44_c3'/>\r
-            <CORRECTANSWER answer_id='q39-44_a2' choice_id='q39-44_c1'/>\r
-            <CORRECTANSWER answer_id='q39-44_a3' choice_id='q39-44_c3'/>\r
-        </GRADABLE>\r
-    </QUESTION_MATCH>\r
-    <QUESTION_ESSAY id='q9'>\r
-        <BODY>\r
-            <TEXT><![CDATA[How are you?]]></TEXT>\r
-            <FLAGS>\r
-                <ISHTML value='true'/>\r
-                <ISNEWLINELITERAL value='false'/>\r
-            </FLAGS>\r
-        </BODY>\r
-        <ANSWER id='q9_a1'>\r
-            <TEXT><![CDATA[Blackboard answer for essay questions will be imported as informations for graders.]]></TEXT>\r
-        </ANSWER>\r
-        <GRADABLE>\r
-        </GRADABLE>\r
-    </QUESTION_ESSAY>\r
-    <QUESTION_FILLINBLANK id='q27'>\r
-        <BODY>\r
-            <TEXT><![CDATA[<span style="font-size:12pt">Name an amphibian: __________.</span>]]></TEXT>\r
-            <FLAGS>\r
-                <ISHTML value='true'/>\r
-                <ISNEWLINELITERAL value='false'/>\r
-            </FLAGS>\r
-        </BODY>\r
-        <ANSWER id='q27_a1' position='1'>\r
-            <TEXT>frog</TEXT>\r
-        </ANSWER>\r
-        <GRADABLE>\r
-        </GRADABLE>\r
-    </QUESTION_FILLINBLANK>\r
-</POOL>\r
+<?xml version='1.0' encoding='utf-8'?>
+<POOL>
+    <TITLE value='exam 3 2008-9'/>
+    <QUESTIONLIST>
+        <QUESTION id='q1' class='QUESTION_TRUEFALSE' points='1'/>
+        <QUESTION id='q7' class='QUESTION_MULTIPLECHOICE' points='1'/>
+        <QUESTION id='q8' class='QUESTION_MULTIPLEANSWER' points='1'/>
+        <QUESTION id='q39-44' class='QUESTION_MATCH' points='1'/>
+        <QUESTION id='q9' class='QUESTION_ESSAY' points='1'/>
+        <QUESTION id='q27' class='QUESTION_FILLINBLANK' points='1'/>
+    </QUESTIONLIST>
+    <QUESTION_TRUEFALSE id='q1'>
+        <BODY>
+            <TEXT><![CDATA[<span style="font-size:12pt">42 is the Absolute Answer to everything.</span>]]></TEXT>
+            <FLAGS>
+                <ISHTML value='true'/>
+                <ISNEWLINELITERAL value='false'/>
+            </FLAGS>
+        </BODY>
+        <ANSWER id='q1_a1'>
+            <TEXT>False</TEXT>
+        </ANSWER>
+        <ANSWER id='q1_a2'>
+            <TEXT>True</TEXT>
+        </ANSWER>
+        <GRADABLE>
+            <CORRECTANSWER answer_id='q1_a2'/>
+            <FEEDBACK_WHEN_CORRECT><![CDATA[You gave the right answer.]]></FEEDBACK_WHEN_CORRECT>
+            <FEEDBACK_WHEN_INCORRECT><![CDATA[42 is the Ultimate Answer.]]></FEEDBACK_WHEN_INCORRECT>
+        </GRADABLE>
+    </QUESTION_TRUEFALSE>
+    <QUESTION_MULTIPLECHOICE id='q7'>
+        <BODY>
+            <TEXT><![CDATA[<span style="font-size:12pt">What's between orange and green in the spectrum?</span>]]></TEXT>
+            <FLAGS>
+                <ISHTML value='true'/>
+                <ISNEWLINELITERAL value='false'/>
+            </FLAGS>
+        </BODY>
+        <ANSWER id='q7_a1' position='1'>
+        <TEXT><![CDATA[<span style="font-size:12pt">red</span>]]></TEXT>
+        </ANSWER>
+        <ANSWER id='q7_a2' position='2'>
+        <TEXT><![CDATA[<span style="font-size:12pt">yellow</span>]]></TEXT>
+        </ANSWER>
+        <ANSWER id='q7_a3' position='3'>
+        <TEXT><![CDATA[<span style="font-size:12pt">blue</span>]]></TEXT>
+        </ANSWER>
+        <GRADABLE>
+            <CORRECTANSWER answer_id='q7_a2'/>
+            <FEEDBACK_WHEN_CORRECT><![CDATA[You gave the right answer.]]></FEEDBACK_WHEN_CORRECT>
+            <FEEDBACK_WHEN_INCORRECT><![CDATA[Only yellow is between orange and green in the spectrum.]]></FEEDBACK_WHEN_INCORRECT>
+        </GRADABLE>
+    </QUESTION_MULTIPLECHOICE>
+    <QUESTION_MULTIPLEANSWER id='q8'>
+        <BODY>
+            <TEXT><![CDATA[<span style="font-size:12pt">What's between orange and green in the spectrum?</span>]]></TEXT>
+            <FLAGS>
+                <ISHTML value='true'/>
+                <ISNEWLINELITERAL value='false'/>
+            </FLAGS>
+        </BODY>
+        <ANSWER id='q8_a1' position='1'>
+        <TEXT><![CDATA[<span style="font-size:12pt">yellow</span>]]></TEXT>
+        </ANSWER>
+        <ANSWER id='q8_a2' position='2'>
+        <TEXT><![CDATA[<span style="font-size:12pt">red</span>]]></TEXT>
+        </ANSWER>
+        <ANSWER id='q8_a3' position='3'>
+        <TEXT><![CDATA[<span style="font-size:12pt">off-beige</span>]]></TEXT>
+        </ANSWER>
+        <ANSWER id='q8_a4' position='4'>
+        <TEXT><![CDATA[<span style="font-size:12pt">blue</span>]]></TEXT>
+        </ANSWER>
+        <GRADABLE>
+            <CORRECTANSWER answer_id='q8_a1'/>
+            <CORRECTANSWER answer_id='q8_a3'/>
+            <FEEDBACK_WHEN_CORRECT><![CDATA[You gave the right answer.]]></FEEDBACK_WHEN_CORRECT>
+            <FEEDBACK_WHEN_INCORRECT><![CDATA[Only yellow and off-beige are between orange and green in the spectrum.]]></FEEDBACK_WHEN_INCORRECT>
+        </GRADABLE>
+    </QUESTION_MULTIPLEANSWER>
+    <QUESTION_MATCH id='q39-44'>
+        <BODY>
+            <TEXT><![CDATA[<i>Classify the animals.</i>]]></TEXT>
+            <FLAGS>
+                <ISHTML value='true'/>
+                <ISNEWLINELITERAL value='false'/>
+            </FLAGS>
+        </BODY>
+        <ANSWER id='q39-44_a1' position='1'>
+            <TEXT><![CDATA[frog]]></TEXT>
+        </ANSWER>
+        <ANSWER id='q39-44_a2' position='2'>
+            <TEXT><![CDATA[cat]]></TEXT>
+        </ANSWER>
+        <ANSWER id='q39-44_a3' position='3'>
+            <TEXT><![CDATA[newt]]></TEXT>
+        </ANSWER>
+        <CHOICE id='q39-44_c1' position='1'>
+            <TEXT><![CDATA[mammal]]></TEXT>
+        </CHOICE>
+        <CHOICE id='q39-44_c2' position='2'>
+            <TEXT><![CDATA[insect]]></TEXT>
+        </CHOICE>
+        <CHOICE id='q39-44_c3' position='3'>
+            <TEXT><![CDATA[amphibian]]></TEXT>
+        </CHOICE>
+        <GRADABLE>
+            <CORRECTANSWER answer_id='q39-44_a1' choice_id='q39-44_c3'/>
+            <CORRECTANSWER answer_id='q39-44_a2' choice_id='q39-44_c1'/>
+            <CORRECTANSWER answer_id='q39-44_a3' choice_id='q39-44_c3'/>
+        </GRADABLE>
+    </QUESTION_MATCH>
+    <QUESTION_ESSAY id='q9'>
+        <BODY>
+            <TEXT><![CDATA[How are you?]]></TEXT>
+            <FLAGS>
+                <ISHTML value='true'/>
+                <ISNEWLINELITERAL value='false'/>
+            </FLAGS>
+        </BODY>
+        <ANSWER id='q9_a1'>
+            <TEXT><![CDATA[Blackboard answer for essay questions will be imported as informations for graders.]]></TEXT>
+        </ANSWER>
+        <GRADABLE>
+        </GRADABLE>
+    </QUESTION_ESSAY>
+    <QUESTION_FILLINBLANK id='q27'>
+        <BODY>
+            <TEXT><![CDATA[<span style="font-size:12pt">Name an amphibian: __________.</span>]]></TEXT>
+            <FLAGS>
+                <ISHTML value='true'/>
+                <ISNEWLINELITERAL value='false'/>
+            </FLAGS>
+        </BODY>
+        <ANSWER id='q27_a1' position='1'>
+            <TEXT>frog</TEXT>
+        </ANSWER>
+        <GRADABLE>
+        </GRADABLE>
+    </QUESTION_FILLINBLANK>
+</POOL>
index f1472af..21b201d 100644 (file)
@@ -170,16 +170,23 @@ class qformat_xml extends qformat_default {
         }
         $fs = get_file_storage();
         $itemid = file_get_unused_draft_itemid();
+        $filenames = array();
         foreach ($xml as $file) {
+            $filename = $file['@']['name'];
+            if (in_array($filename, $filenames)) {
+                debugging('Duplicate file in XML: ' . $filename, DEBUG_DEVELOPER);
+                continue;
+            }
             $filerecord = array(
                 'contextid' => context_user::instance($USER->id)->id,
                 'component' => 'user',
                 'filearea'  => 'draft',
                 'itemid'    => $itemid,
                 'filepath'  => '/',
-                'filename'  => $file['@']['name'],
+                'filename'  => $filename,
             );
             $fs->create_file_from_string($filerecord, base64_decode($file['#']));
+            $filenames[] = $filename;
         }
         return $itemid;
     }
index 2453a30..f027530 100644 (file)
@@ -45,7 +45,7 @@
       <text><![CDATA[<p>Moodle¬†<img src="@@PLUGINFILE@@/logo.jpg" alt="Moodle logo" width="48" height="48" /> is an acronym for <span style="font-style: italic;">Modular Object-Oriented Dynamic Learning Environment</span>.</p>]]></text>
 <file name="logo.jpg" encoding="base64">/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBggGBQkIBwgKCQkKDRYODQwMDRoTFBAWHxwhICocHh4jJzIqIyUvLR4eNzssLy41ODg0JSo4QTAqPDwsNDUBCQoKDQsNGQ4OGTUkHiQ1NTU1NTU1NTU1NTUuNTU1LTU1NTU1NTQsMjU1NTU1NSk0KSw0MjQ2Miw1NDQyNDQ0Nf/AABEIADAAMAMBIgACEQEDEQH/xAAbAAEAAgIDAAAAAAAAAAAAAAAHAAYDBQEECP/EADUQAAEDAwEEBgcJAAAAAAAAAAECAwQABREGEiExURNBYXORsQcUFRZDYqEXIyQ2QnGywfD/xAAYAQEAAwEAAAAAAAAAAAAAAAAAAQMEAv/EACIRAAEEAgIBBQAAAAAAAAAAAAMAAQIEETESIeEFUYGhsf/aAAwDAQACEQMRAD8AcalSsT8lmMkKfdbaSeBWoJH1oiy1K0z+sbDGTly7Q+WEuhR8BWW16lt16dUm3vF9KeLiUKCM8tojGaItpUqVKIqRq7Xr9sBj2i3yZEg/FUyoIT2jPH/caHbtepdzubqr3ch06fhLXgp7N/DwFOMwx/f9MZxoEuQUuBRJI3OKGMcOsdtHOsNMRGLxNu7TilqcfUVNuIBAwcYBGKpKcYcc3xlWjFMueDaVEj3Bj2mwOi9ZZ6QBaUfqGeA516GsKbTAtTD7LiSgpGyAN6ezZHDFG1j9GsyVLXd0pSwlP3jTSgOXnXfuM+VDiNR4qg2uSpKARu3msNu7MBIwjHPL9WqtViaDzeWkie9ltSrZcW432qbOK2caUzLZDsdxLrauCknIo6XpCdbrYJ65q3hu20L5E43eNcaZubtq1emEFH1eUkko6goddViuHhYYB2bvWF3OsKQXKF9e6sdzVI+0SGCn8N6go7Xz9Kn+qquskj2fK71f8qTHojTzyHlIBcQMJV1gccfQUa6ptl7lPSYzVv2mluKUle2N4Jzzp6oEheHBs4dcUiRg8uT46V8s35fa7s+VHN8QBNtffN+YpItTTjdjbQUkL6PGDzo6m2q9yrnEDtvKG47ySVBQO4H96i+EhDilBum39KapIxHNnfaQruM6acHyJ8xVAaSB6QIGOSqQbsy+7px1uO30j2wnZRnGSCKoVstt3e1dFly4JZbbyCQoGoshJK8ObN02O/l0CSLVpRd+38L/2Q==</file>    </questiontext>
     <generalfeedback format="html">
-      <text><![CDATA[<p><img src="@@PLUGINFILE@@/infos.jpg" alt="Informations" width="34" height="49" />For further information, see the <a title="Moodle Docs - About Moodle" href="http://docs.moodle.org/en/About_Moodle">documentation about Moodle</a></p>\r
+      <text><![CDATA[<p><img src="@@PLUGINFILE@@/infos.jpg" alt="Informations" width="34" height="49" />For further information, see the <a title="Moodle Docs - About Moodle" href="http://docs.moodle.org/en/About_Moodle">documentation about Moodle</a></p>
 <p>.</p>]]></text>
 <file name="infos.jpg" encoding="base64">/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEAAkGBggGBQkIBwgKCQkKGRYaDQwMDRodFBAhKhwlIB8lHh4jIjIoIyQvJSQeKy8sLzMtODgsISo9QTs2QTIuMywBCQoKDQsNGQ4OGTUkHiQ1NTU1NTU1NTU1NTU1NTU1Ly82NTU1NDUtLTQ0NTU1MCwsLCw0KTU0LzU2NjMpKTQ2Kf/AABEIADEAIgMBIgACEQEDEQH/xAAaAAEAAwEBAQAAAAAAAAAAAAAABQYHBAID/8QALhAAAQMCBAMHBAMAAAAAAAAAAgABAwQFBhEhMUFRgRITIjJxsfAHYWKRFBVC/8QAGQEAAgMBAAAAAAAAAAAAAAAAAAEDBAUC/8QAIREAAgEDBAMBAAAAAAAAAAAAAAECAxExBBITISIjQQX/2gAMAwEAAhEDEQA/ANxXk5AiHtSGINzJ8lz3GvitlCdTOTCAcVl16xZU3SoMhMoof8iz65fdWaGmlXfWCOpUUMmrDVwGbCM8RE+zMbZuvqsdvzR2WSme3Xf+W8o5n3ZeX11dsn5PyVowJjUrof8AX1xN3w+Qufzbq3TuppHCHJF3RzGqnLa8l6REVMmKV9UpzhsMLA7sJF4v2yySe5OD9mPV+LvwW84osg3+xzUj6G7eF23+cfVmWAXW01Vnrnp62JwJn0LLwn6fNFt/mzi4OH0p6iLvuJ3HZi01EUEQQCTFm0YMLPtyUdg+eePFNI8RF2vFx/F392ZSGN7va7sVva0yHI0Ik0jlG46u7ZZZ77Kx/TPBdQFc1zr4ii7HkAm1bjryd9NOWee7KS/Fo/Zl3FbdV8TV0RFgF0LiuFmoboDjWU4SZ75t78H6rtRCdgISiwdaKCbvYKUBPg4gIu3UWZ1MhGEQMEYsAtswtoy9Im5OXbYrWCIiQwiIgAiIgAiIgD//2Q==</file>    </generalfeedback>
     <defaultgrade>1.0000000</defaultgrade>
index 637f80a..e135223 100644 (file)
@@ -33,7 +33,7 @@ $numcourses = optional_param('numcourses', 20, PARAM_INT);
 
 if (empty($CFG->enablestats)) {
     if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) {
-        redirect("$CFG->wwwroot/$CFG->admin/settings.php?section=stats", get_string('mustenablestats', 'admin'), 3);
+        redirect("$CFG->wwwroot/$CFG->admin/search.php?query=enablestats", get_string('mustenablestats', 'admin'), 3);
     } else {
         print_error('statsdisable');
     }
index e952338..5167670 100644 (file)
@@ -25,7 +25,7 @@
 
 defined('MOODLE_INTERNAL') || die;
 
-$ADMIN->add('reports', new admin_externalpage('reportcourseoverview', get_string('pluginname', 'report_courseoverview'), "$CFG->wwwroot/report/courseoverview/index.php",'report/courseoverview:view'));
+$ADMIN->add('reports', new admin_externalpage('reportcourseoverview', get_string('pluginname', 'report_courseoverview'), "$CFG->wwwroot/report/courseoverview/index.php",'report/courseoverview:view', empty($CFG->enablestats)));
 
 // no report settings
 $settings = null;
index 256cb0c..c746ff3 100644 (file)
@@ -69,7 +69,7 @@ a.dimmed_text:visited,
 .notifysuccess {color:#006600;}
 .reportlink {text-align:right;}
 a.autolink.glossary:hover {cursor: help;}
-/* Block which is hidden if javascript enabled, prevents fickering visible when JS from footer used! */
+/* Block which is hidden if javascript enabled, prevents flickering visible, when JS from footer used! */
 .collapsibleregioncaption {white-space: nowrap;}
 .collapsibleregioncaption img {vertical-align: middle;}
 .jsenabled .hiddenifjs {display: none;}
index b7c9a76..5458909 100644 (file)
@@ -250,19 +250,6 @@ $(document).ready(function() {
         $('.path-mod-hotpot button').attr("data-role", "none");
     });
 
-    //collapsed topic only stuff
-    $('div#page-course-view-topcollPAGE').live('pagebeforecreate',function(event, ui){
-        $('#page-course-view-topcollPAGE ul.section').attr("data-role", "none");
-        $('.section li img').removeClass("ui-li-icon");
-        $.getScript('../course/format/topcoll/module.js');
-        $('#page-course-view-topcollPAGE tr.cps a').attr("data-role", "button").attr("data-icon", "arrow-r");
-        $('#page-course-view-topcollPAGE #thetopics').attr("data-role", "controlgroup");
-        $('#page-course-view-topcollPAGE td.cps_centre').each(function(index) {
-            var cpsc = $(this).text().replace('<br>','').replace(')','');
-            $(this).prev('td').find('a').append('<span class="ui-li-count ui-btn-up-a ui-btn-corner-all">' + cpsc + '</span>');
-        });
-    });
-
     ///// functions below does stuff after creating page for some cleaning...
     $('div').live('pageinit',function(event, ui){
         $('.path-calendar div.ui-radio label:first-child, .path-mod-lesson div.ui-radio label:first-child, #page-mod-wiki-createPAGE div.ui-radio label:first-child').addClass("afirst");
index ef45f30..0aef6a5 100644 (file)
@@ -1345,49 +1345,7 @@ a.comment-link, .block_comments a.showcommentsnonjs, .block_comments .comment-ar
 .block_comments .comment-ctrl {
     display: block;
 }
-/*collapsed topic format*/
-#thetopics {
-    table-layout: inherit !important;
-    width: 100%;
-    display: block !important;
-}
-#page-course-view-topcollPAGE .section td.content, col.content {
-    text-align: left;
-    width: 100% !important;
-    overflow: hidden;
-}
-#page-course-view-topcollPAGE .section td.content {
-    padding: .5em;
-}
-#page-course-view-topcollPAGE td.left.side, #page-course-view-topcollPAGE td.right.side {
-    display: none;
-}
-#page-course-view-topcollPAGE tr.cps td a {
-    background: none !important;
-    color: inherit !important;
-    padding: 7px 0 7px 0px !important;
-}
-tr.cps td span {
-    font-style: inherit !important;
-    font-size: 1.12em !important;
-}
-#page-course-view-topcollPAGE .section.separator, td.cps_centre {
-    display: none;
-}
-tr.cps {
-    background-color: inherit !important;
-    color: inherit !important;
-}
-.opencps .ui-btn-inner .ui-icon-arrow-r {
-    background-position: -216px 50%;
-}
-tr.cps td span.ui-li-count {
-    font-size: .6em !important;
-    right: 12px;
-}
-#page-course-view-topcollPAGE .cps .ui-btn-inner {
-    white-space: normal;
-}
+
 /*filemanager fixes and other button fixes and adds */
 #page-mod-quiz-reportPAGE #commands input[type="submit"], #newmessagelinks a, .que input.submit {
     display: block !important;
@@ -1454,7 +1412,7 @@ overflow:auto !important;
     opacity: 0.8;
 }
 /*current highlight */
-.weeks .current .headingwrap, .topics .current div.headingwrap, .current .ui-bar-b, .current .left.side, .tabtree ul.tabrow0 li.selected a, .ui-btn-active, #page-course-view-topcollPAGE .current {
+.weeks .current .headingwrap, .topics .current div.headingwrap, .current .ui-bar-b, .current .left.side, .tabtree ul.tabrow0 li.selected a, .ui-btn-active {
     border: 1px solid #F7C942;
     background: #fadb4e;
     color: #333;
index 9a04ec9..6e9f091 100644 (file)
@@ -30,7 +30,7 @@
 defined('MOODLE_INTERNAL') || die();
 
 
-$version  = 2012062504.06;              // YYYYMMDD      = weekly release date of this DEV branch
+$version  = 2012062504.08;              // YYYYMMDD      = weekly release date of this DEV branch
                                         //         RR    = release increments - 00 in DEV branches
                                         //           .XX = incremental changes