Merge branch 'install_23_STABLE' of git://git.moodle.cz/moodle-install into MOODLE_23...
authorDan Poltawski <dan@moodle.com>
Thu, 18 Apr 2013 11:43:54 +0000 (12:43 +0100)
committerDan Poltawski <dan@moodle.com>
Thu, 18 Apr 2013 11:43:54 +0000 (12:43 +0100)
19 files changed:
auth/cas/CAS/CAS.php
backup/moodle2/restore_stepslib.php
blocks/completionstatus/details.php
course/lib.php
lib/db/upgrade.php
lib/grade/grade_category.php
lib/navigationlib.php
lib/oauthlib.php
mod/quiz/report/statistics/lang/en/quiz_statistics.php
mod/quiz/report/statistics/statistics_question_table.php
mod/wiki/pagelib.php
question/format/xml/format.php
question/format/xml/tests/fixtures/multianswer.xml [new file with mode: 0644]
question/format/xml/tests/fixtures/sample_questions_with_old_image_tag.xml [new file with mode: 0644]
report/configlog/index.php
repository/dropbox/lib.php
theme/formal_white/style/block.css
user/lib.php
version.php

index e6bae3f..22dfefe 100644 (file)
@@ -32,8 +32,9 @@
 //\r
 // hack by Vangelis Haniotakis to handle the absence of $_SERVER['REQUEST_URI'] in IIS\r
 //\r
-if (!isset($_SERVER['REQUEST_URI'])) {\r
-       $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'] . '?' . $_SERVER['QUERY_STRING'];\r
+$_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'];\r
+if (isset($_SERVER['QUERY_STRING'])) {\r
+    $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];\r
 }\r
 \r
 //\r
index db1ab8a..aa5b79e 100644 (file)
@@ -1171,7 +1171,7 @@ class restore_section_structure_step extends restore_structure_step {
             // Otherwise, when you restore to an existing course, it will mess up
             // existing section availability entries.
             if (!$this->get_mappingid('course_sections_availability', $data->id, false)) {
-                return;
+                continue;
             }
 
             // Update source cmid / grade id to new value.
@@ -1184,7 +1184,12 @@ class restore_section_structure_step extends restore_structure_step {
                 $data->gradeitemid = null;
             }
 
-            $DB->update_record('course_sections_availability', $data);
+            // Delete the record if the condition wasn't found, otherwise update it.
+            if ($data->sourcecmid === null && $data->gradeitemid === null) {
+                $DB->delete_records('course_sections_availability', array('id' => $data->id));
+            } else {
+                $DB->update_record('course_sections_availability', $data);
+            }
         }
     }
 }
index 84406e3..39fb84e 100644 (file)
@@ -216,9 +216,9 @@ if (empty($completions)) {
                 echo '(<i>';
 
                 if ($agg == COMPLETION_AGGREGATION_ALL) {
-                    echo strtolower(get_string('aggregateall', 'completion'));
+                    echo strtolower(get_string('all', 'completion'));
                 } else {
-                    echo strtolower(get_string('aggregateany', 'completion'));
+                    echo strtolower(get_string('any', 'completion'));
                 }
 
                 echo '</i> '.strtolower(get_string('required')).')';
index c2ac680..045c9e5 100644 (file)
@@ -857,7 +857,9 @@ function print_overview($courses, array $remote_courses=array()) {
     foreach ($courses as $course) {
         $fullname = format_string($course->fullname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id)));
         echo $OUTPUT->box_start('coursebox');
-        $attributes = array('title' => s($fullname));
+        // decode &amp;'s. format_string above will have encoded them and html_writer will encode again when it processed the title
+        // attribute leading to double encoding.
+        $attributes = array('title' => str_replace('&amp;', '&', $fullname));
         if (empty($course->visible)) {
             $attributes['class'] = 'dimmed';
         }
@@ -1732,9 +1734,10 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
                         echo html_writer::end_tag('div');
                         echo html_writer::end_tag('form');
                     } else {
-                        // In auto mode, or when editing, the icon is just an image
-                        echo "<span class='autocompletion'>";
-                        echo "<img src='$imgsrc' alt='$imgalt' title='$imgalt' /></span>";
+                        // In auto mode, or when editing, the icon is just an image.
+                        echo html_writer::tag('span', html_writer::empty_tag('img', array(
+                                'src' => $imgsrc, 'alt' => $imgalt, 'title' => $imgalt)),
+                                array('class' => 'autocompletion'));
                     }
                 }
             }
index 6233a52..f261807 100644 (file)
@@ -1142,5 +1142,15 @@ function xmldb_main_upgrade($oldversion) {
         upgrade_main_savepoint(true, 2012062506.02);
     }
 
+    if ($oldversion < 2012062506.06) {
+        // MDL-29877 Some bad restores created grade items with no category information.
+        $sql = "UPDATE {grade_items}
+                   SET categoryid = courseid
+                 WHERE itemtype <> 'course' and itemtype <> 'category'
+                       AND categoryid IS NULL";
+        $DB->execute($sql);
+        upgrade_main_savepoint(true, 2012062506.06);
+    }
+
     return true;
 }
index 6f3deff..de50a32 100644 (file)
@@ -1152,13 +1152,17 @@ class grade_category extends grade_object {
 
             } else {
                 $categoryid = $item->categoryid;
+                if (empty($categoryid)) {
+                    debugging('Found a grade item that isnt in a category');
+                }
             }
 
             // prevent problems with duplicate sortorders in db
             $sortorder = $item->sortorder;
 
-            while (array_key_exists($sortorder, $cats[$categoryid]->children)) {
-                //debugging("$sortorder exists in item loop");
+            while (array_key_exists($categoryid, $cats)
+                && array_key_exists($sortorder, $cats[$categoryid]->children)) {
+
                 $sortorder++;
             }
 
index a97d462..72ab369 100644 (file)
@@ -2530,6 +2530,7 @@ class global_navigation extends navigation_node {
 
         $issite = ($course->id == $SITE->id);
         $shortname = format_string($course->shortname, true, array('context' => $coursecontext));
+        $fullname = format_string($course->fullname, true, array('context' => $coursecontext));
 
         if ($issite) {
             $parent = $this;
@@ -2565,7 +2566,9 @@ class global_navigation extends navigation_node {
         $coursenode = $parent->add($shortname, $url, self::TYPE_COURSE, $shortname, $course->id);
         $coursenode->nodetype = self::NODETYPE_BRANCH;
         $coursenode->hidden = (!$course->visible);
-        $coursenode->title(format_string($course->fullname, true, array('context' => get_context_instance(CONTEXT_COURSE, $course->id))));
+        // We need to decode &amp;'s here as they will have been added by format_string above and attributes will be encoded again
+        // later.
+        $coursenode->title(str_replace('&amp;', '&', $fullname));
         if (!$forcegeneric) {
             $this->addedcourses[$course->id] = $coursenode;
         }
index 7f5ea64..6fc4483 100644 (file)
@@ -264,6 +264,8 @@ class oauth_helper {
         $this->sign_secret = $this->consumer_secret.'&'.$secret;
         $params = $this->prepare_oauth_parameters($this->access_token_api, array('oauth_token'=>$token, 'oauth_verifier'=>$verifier), 'POST');
         $this->setup_oauth_http_header($params);
+        // Should never send the callback in this request.
+        unset($params['oauth_callback']);
         $content = $this->http->post($this->access_token_api, $params, $this->http_options);
         $keys = $this->parse_result($content);
         $this->set_access_token($keys['oauth_token'], $keys['oauth_token_secret']);
index 24db6f1..4a73c17 100644 (file)
@@ -69,6 +69,7 @@ Our equation for effective question weight cannot be calculated in this case. Th
 If you edit a quiz and give these question(s) with negative covariance a max grade of zero then the effective question weight of these questions will be zero and the real effective question weight of other questions will be as calculated now.';
 $string['nostudentsingroup'] = 'There are no students in this group yet';
 $string['optiongrade'] = 'Partial credit';
+$string['partofquestion'] = 'Part of question';
 $string['pluginname'] = 'Statistics';
 $string['position'] = 'Position';
 $string['positions'] = 'Position(s)';
index 8782389..a1223fa 100644 (file)
@@ -74,7 +74,7 @@ class quiz_statistics_question_table extends flexible_table {
 
         if ($responesstats->has_subparts()) {
             $columns[] = 'part';
-            $headers[] = 'Part of question';
+            $headers[] = get_string('partofquestion', 'quiz_statistics');
         }
 
         if ($responesstats->has_response_classes()) {
index 0cb5302..b4ab91f 100644 (file)
@@ -1110,7 +1110,7 @@ class page_wiki_diff extends page_wiki {
         global $PAGE, $CFG;
 
         parent::create_navbar();
-        $PAGE->navbar->add(get_string('history', 'wiki'), $CFG->wwwroot . '/mod/wiki/history.php?pageid' . $this->page->id);
+        $PAGE->navbar->add(get_string('history', 'wiki'), $CFG->wwwroot . '/mod/wiki/history.php?pageid=' . $this->page->id);
         $PAGE->navbar->add(get_string('diff', 'wiki'));
     }
 
@@ -2107,7 +2107,7 @@ class page_wiki_viewversion extends page_wiki {
         global $PAGE, $CFG;
 
         parent::create_navbar();
-        $PAGE->navbar->add(get_string('history', 'wiki'), $CFG->wwwroot . '/mod/wiki/history.php?pageid' . $this->page->id);
+        $PAGE->navbar->add(get_string('history', 'wiki'), $CFG->wwwroot . '/mod/wiki/history.php?pageid=' . $this->page->id);
         $PAGE->navbar->add(get_string('versionnum', 'wiki', $this->version->version));
     }
 
index 21b201d..9c8304c 100644 (file)
@@ -448,37 +448,43 @@ class qformat_xml extends qformat_default {
      * @return object question object
      */
     public function import_multianswer($question) {
+        global $USER;
         question_bank::get_qtype('multianswer');
 
-        $questiontext['text'] = $this->import_text($question['#']['questiontext'][0]['#']['text']);
-        $questiontext['format'] = FORMAT_HTML;
-        $questiontext['itemid'] = '';
+        $questiontext = $this->import_text_with_files($question,
+                array('#', 'questiontext', 0));
         $qo = qtype_multianswer_extract_question($questiontext);
 
         // 'header' parts particular to multianswer
         $qo->qtype = 'multianswer';
         $qo->course = $this->course;
-        $qo->generalfeedback = '';
 
         $qo->name = $this->clean_question_name($this->import_text($question['#']['name'][0]['#']['text']));
         $qo->questiontextformat = $questiontext['format'];
         $qo->questiontext = $qo->questiontext['text'];
-        $itemid = $this->import_files($this->getpath($question,
-                array('#', 'questiontext', 0, '#', 'file'), array(), false));
-        if (!empty($itemid)) {
-            $qo->questiontextitemid = $itemid;
+        if (!empty($questiontext['itemid'])) {
+            $qo->questiontextitemid = $questiontext['itemid'];
         }
+
         // Backwards compatibility, deal with the old image tag.
         $filedata = $this->getpath($question, array('#', 'image_base64', '0', '#'), null, false);
         $filename = $this->getpath($question, array('#', 'image', '0', '#'), null, false);
         if ($filedata && $filename) {
-            $data = new stdClass();
-            $data->content = $filedata;
-            $data->encoding = 'base64';
-            // Question file areas don't support subdirs, so convert path to filename if necessary.
-            $data->name = clean_param(str_replace('/', '_', $filename), PARAM_FILE);
-            $qo->questiontextfiles[] = $data;
-            $qo->questiontext .= ' <img src="@@PLUGINFILE@@/' . $data->name . '" />';
+            $fs = get_file_storage();
+            if (empty($qo->questiontextitemid)) {
+                $qo->questiontextitemid = file_get_unused_draft_itemid();
+            }
+            $filename = clean_param(str_replace('/', '_', $filename), PARAM_FILE);
+            $filerecord = array(
+                'contextid' => context_user::instance($USER->id)->id,
+                'component' => 'user',
+                'filearea'  => 'draft',
+                'itemid'    => $qo->questiontextitemid,
+                'filepath'  => '/',
+                'filename'  => $filename,
+            );
+            $fs->create_file_from_string($filerecord, base64_decode($filedata));
+            $qo->questiontext .= ' <img src="@@PLUGINFILE@@/' . $filename . '" />';
         }
 
         // restore files in generalfeedback
diff --git a/question/format/xml/tests/fixtures/multianswer.xml b/question/format/xml/tests/fixtures/multianswer.xml
new file mode 100644 (file)
index 0000000..5a3cc34
--- /dev/null
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<quiz>
+<!-- question: 0  -->
+  <question type="category">
+    <category>
+        <text>$course$/Default for Test images in backup</text>
+
+    </category>
+  </question>
+
+<!-- question: 166  -->
+  <question type="cloze">
+    <name>
+      <text>cloze with images</text>
+    </name>
+    <questiontext format="html">
+      <text><![CDATA[<p>Match the following cities with the correct state,</p>
+<p>California <img src="@@PLUGINFILE@@/california-state-flag.png" alt="California flag" width="50" height="50" /> or Arizona <img src="@@PLUGINFILE@@/arizona_2.png" alt="Arizona flag" width="50" height="50" /><br />* San Francisco: {1:MULTICHOICE:=California#OK~Arizona#Wrong}<br />* Tucson: {1:MULTICHOICE:California#Wrong~%100%Arizona#OK}<br />* Los Angeles: {1:MULTICHOICE:=California#OK~Arizona#Wrong}<br />* Phoenix: {1:MULTICHOICE:%0%California#Wrong~=Arizona#OK}<br />The capital of France is {1:SHORTANSWER:%100%Paris#Congratulations!<br />~%50%Marseille#No, that is the second largest city in France (after<br />Paris).~*#Wrong answer. The capital of France is Paris, of course.}.</p>]]></text>
+<file name="arizona_2.png" encoding="base64">iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAHjUlEQVRoBe1YaWhcVRT+3pt9y2SZZjVLs7RJrbbGWigGUVERhOKOQqsUS1uLCuICgmgVwT+K1YKgKOIC7lupUheqaAURbW3VpqbN1qyTfWYyycxk3ozn3DfvOUnfjM2GUObCnXdzzznfd+65955zWyDXchHIRSAXgVwEchHIRQDSd871SaM4FF4eRNOzXTC7EmeJJ9vsOHLXKiRnZF1mr4hi42etkFJTSUI93HIxEhF1QrYn0HL4OCRJN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Ialz6j1q8ukTqfT2tWYM0h7ti0Xr3tQa1fnmrPGt8qE6XfPzu1UVFYzQ9aO44f2CZAY39pWz29+/jzxaIz7Hn5Mzh6/FUUN+NwubHn5NL9/lFs/UyswFExZFhZW1lBz12pe++UOYpEwZouVunu/yrt/fp2oALLk2LHa7PR0tGkKD4cDfPf5X/DGy/WEhLzq5StZseY+jZixbhNmLZWdu9Z+kZYPjuH1/M+91BcGA17scsYoLJ4jbMbFQl5tPRkOBTh/tkX7pmq5MycbtbqkaCKyn0qIK+bY8zRLL1u1AZ1e9igiqqv6PIMaKVqD3CxWO7Ur115+HLPUbxcZs1c6Bl1OzrWcFBdIR69LZ2ZRiSiS0BResKSamyuWcPajE5QtupU5ZRXidg4WVtWQ6yigqKRUjvqKpnTFbdUE/T6KS+djyc7RTo95BYWsXP9lqYeElIA23iouddPsufi9HjLNZjJNJno72yi9ZdF4aqoZUg3BqS/p/3nphamPQhCkvVNWOD0soiXyaWAT+U9jMt9PdSyyjkwLz0IsMtVtkdI/xUCKgRQDKQZSDFw/A/8FhCTNxUlCcTsAAAAASUVORK5CYII=</file>    </questiontext>
+    <generalfeedback format="html">
+      <text><![CDATA[<p>This is a Moodle question <img src="@@PLUGINFILE@@/moodle.png" alt="Moodle logo" width="16" height="16" /></p>]]></text>
+<file name="moodle.png" encoding="base64">iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAHzSURBVDhPxZFbSJNhGIDXERsVGbKawWJaoyAYGeqNYgdl6zenrhhUlB0I6iJEbUl0WF1UUK2DYhDkGghu7Z+HraisPLAsu+0ygi66kCioqwg2t6f///YhzAVBXfTc/HzP9/J8L/wG/pG8QDw+TE+Xn/O+dva07MW5vZayys3yNp/ZwPPRBPuOHqGisordDc00Ki42bqhAjQ3Jid8jAvoL9vIt4qs463G73VRtrcFiseDvuSYG+TwB7y/zfdzHpzeDWachAjeuXyWkPqZ21zZ2Nrioa/JQarOjlK8jes7Eh/s18GwHRMxkgka+3lvEi1ubcgM63Zea6W5v5ESLB4fDwRVvNam+eRBey3TAxqObNl76rXwLFvAlsIyhC2W5gZ+JJmYixQS9q8RZZzpghwEr/R2LpYGPIYWZqJnYSWNugCkPPDDx1JddTyeZqCetasMdS6WB9OQB7Xet5kmbITeQntoP/YWEfSZxFoy5SA2YCXeukAJ+vD5MMl7Cw9YF2UAkGhIXmYSbZLgI9WKxOOukx52kVAvq6eXS6HOHyAyuRz0lN5hlwg19hcTOWqXQ0FxaXZPnGC4V7s+BsToRUM8YpdA2eHswG/DO2eDV7WpGWg30dpZIA5Nddkba5nP3+Epp4F2vwqh3CXeOLZyzwV/wvwPwC58bSNEdAkhaAAAAAElFTkSuQmCC</file>    </generalfeedback>
+    <penalty>0.3333333</penalty>
+    <hidden>0</hidden>
+  </question>
+
+</quiz>
\ No newline at end of file
diff --git a/question/format/xml/tests/fixtures/sample_questions_with_old_image_tag.xml b/question/format/xml/tests/fixtures/sample_questions_with_old_image_tag.xml
new file mode 100644 (file)
index 0000000..852e5bc
--- /dev/null
@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<quiz>
+
+
+<!-- question: 0  -->
+  <question type="category">
+    <category>
+        <text>$course$/Default for Test images in backup</text>
+
+    </category>
+  </question>
+
+
+
+<!-- question: 5  -->
+  <question type="cloze">
+    <name><text>cloze question with image</text>
+</name>
+    <questiontext>
+<text><![CDATA[This is a multianswer question with an image in the old &quot;image&quot; field that was used in moodle 1.9.<br />Match the following cities with the correct state:<br />* San Francisco: {1:MULTICHOICE:=California#OK~Arizona#Wrong}<br />* Tucson: {1:MULTICHOICE:California#Wrong~%100%Arizona#OK}<br />* Los Angeles: {1:MULTICHOICE:=California#OK~Arizona#Wrong}<br />* Phoenix: {1:MULTICHOICE:%0%California#Wrong~=Arizona#OK}<br />The capital of France is {1:SHORTANSWER:%100%Paris#Congratulations!<br />~%50%Marseille#No, that is the second largest city in France (after<br />Paris).~*#Wrong answer. The capital of France is Paris, of course.}.<br />]]></text>
+    </questiontext>
+<image>moodle.png</image>
+    <image_base64>
+iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAHzSURBVDhPxZFbSJNhGIDXERsVGbKawWJaoyAYGeqNYgdl6zenrhhUlB0I6iJEbUl0WF1UUK2DYhDkGghu7Z+HraisPLAsu+0ygi66kCioqwg2t6f///YhzAVBXfTc/HzP9/J8L/wG/pG8QDw+TE+Xn/O+dva07MW5vZayys3yNp/ZwPPRBPuOHqGisordDc00Ki42bqhAjQ3Jid8jAvoL9vIt4qs463G73VRtrcFiseDvuSYG+TwB7y/zfdzHpzeDWachAjeuXyWkPqZ21zZ2Nrioa/JQarOjlK8jes7Eh/s18GwHRMxkgka+3lvEi1ubcgM63Zea6W5v5ESLB4fDwRVvNam+eRBey3TAxqObNl76rXwLFvAlsIyhC2W5gZ+JJmYixQS9q8RZZzpghwEr/R2LpYGPIYWZqJnYSWNugCkPPDDx1JddTyeZqCetasMdS6WB9OQB7Xet5kmbITeQntoP/YWEfSZxFoy5SA2YCXeukAJ+vD5MMl7Cw9YF2UAkGhIXmYSbZLgI9WKxOOukx52kVAvq6eXS6HOHyAyuRz0lN5hlwg19hcTOWqXQ0FxaXZPnGC4V7s+BsToRUM8YpdA2eHswG/DO2eDV7WpGWg30dpZIA5Nddkba5nP3+Epp4F2vwqh3CXeOLZyzwV/wvwPwC58bSNEdAkhaAAAAAElFTkSuQmCC
+
+    </image_base64>
+    <generalfeedback>
+<text></text>
+    </generalfeedback>
+    <shuffleanswers>0</shuffleanswers>
+</question>
+
+
+
+<!-- question: 4  -->
+  <question type="multichoice">
+    <name><text>mcq with image</text>
+</name>
+    <questiontext format="html">
+<text><![CDATA[This is a multichoice question with an image in the old &quot;image&quot; field that was used in Moodle 1.9]]></text>
+    </questiontext>
+    <image>moodle.png</image>
+    <image_base64>
+iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsQAAA7EAZUrDhsAAAHzSURBVDhPxZFbSJNhGIDXERsVGbKawWJaoyAYGeqNYgdl6zenrhhUlB0I6iJEbUl0WF1UUK2DYhDkGghu7Z+HraisPLAsu+0ygi66kCioqwg2t6f///YhzAVBXfTc/HzP9/J8L/wG/pG8QDw+TE+Xn/O+dva07MW5vZayys3yNp/ZwPPRBPuOHqGisordDc00Ki42bqhAjQ3Jid8jAvoL9vIt4qs463G73VRtrcFiseDvuSYG+TwB7y/zfdzHpzeDWachAjeuXyWkPqZ21zZ2Nrioa/JQarOjlK8jes7Eh/s18GwHRMxkgka+3lvEi1ubcgM63Zea6W5v5ESLB4fDwRVvNam+eRBey3TAxqObNl76rXwLFvAlsIyhC2W5gZ+JJmYixQS9q8RZZzpghwEr/R2LpYGPIYWZqJnYSWNugCkPPDDx1JddTyeZqCetasMdS6WB9OQB7Xet5kmbITeQntoP/YWEfSZxFoy5SA2YCXeukAJ+vD5MMl7Cw9YF2UAkGhIXmYSbZLgI9WKxOOukx52kVAvq6eXS6HOHyAyuRz0lN5hlwg19hcTOWqXQ0FxaXZPnGC4V7s+BsToRUM8YpdA2eHswG/DO2eDV7WpGWg30dpZIA5Nddkba5nP3+Epp4F2vwqh3CXeOLZyzwV/wvwPwC58bSNEdAkhaAAAAAElFTkSuQmCC
+
+    </image_base64>
+    <generalfeedback>
+<text></text>
+    </generalfeedback>
+    <defaultgrade>1</defaultgrade>
+    <penalty>0.1</penalty>
+    <hidden>0</hidden>
+    <shuffleanswers>1</shuffleanswers>
+    <single>true</single>
+    <shuffleanswers>true</shuffleanswers>
+    <correctfeedback>      <text></text>
+</correctfeedback>
+    <partiallycorrectfeedback>      <text></text>
+</partiallycorrectfeedback>
+    <incorrectfeedback>      <text></text>
+</incorrectfeedback>
+    <answernumbering>abc</answernumbering>
+      <answer fraction="0">
+        <text>
+wrong answer
+        </text>
+      <feedback>
+          <text>
+
+          </text>
+      </feedback>
+    </answer>
+      <answer fraction="0">
+        <text>
+another wrong answer
+        </text>
+      <feedback>
+          <text>
+
+          </text>
+      </feedback>
+    </answer>
+      <answer fraction="100">
+        <text>
+right answer
+        </text>
+      <feedback>
+          <text>
+
+          </text>
+      </feedback>
+    </answer>
+</question>
+
+
+</quiz>
\ No newline at end of file
index 8372727..16cee04 100644 (file)
@@ -99,6 +99,9 @@ $table->data  = array();
 
 if ($sort == 'firstname' or $sort == 'lastname') {
     $orderby = "u.$sort $dir";
+} else if ($sort == 'value' or $sort == 'oldvalue') {
+    // cross-db text-compatible sorting.
+    $orderby = $DB->sql_order_by_text("cl.$sort", 255) . ' ' . $dir;
 } else {
     $orderby = "cl.$sort $dir";
 }
index 508c05e..eb5145c 100644 (file)
@@ -90,7 +90,7 @@ class repository_dropbox extends repository {
             'oauth_consumer_key'=>$this->dropbox_key,
             'oauth_consumer_secret'=>$this->dropbox_secret,
             'oauth_callback' => $callbackurl->out(false),
-            'api_root' => 'https://www.dropbox.com/1/oauth',
+            'api_root' => 'https://api.dropbox.com/1/oauth',
         );
 
         $this->dropbox = new dropbox($args);
index f8a7bfa..d3c4eb2 100644 (file)
@@ -7,7 +7,7 @@
 .block .header .title {background-image:url([[pix:theme|gradient_h]]);background-repeat:repeat-x;clear:both;line-height:2em;background-color:#E3DFD4;}
 .block .header .title .commands {padding-left:0.3em;text-align:right;}
 .block .content {background-color:[[setting:blockcontentbgc]];}
-.block img.icon {padding-right:0}
+.block img.icon {padding-right:5px}
 
 /* block login */
 .block_login .btn {margin-top:0.5em;text-align:center;}
 .block_login #login_username, .block_login #login_password {margin:4px 0 4px [[static:lb_fieldsmargin]];}
 .block_login #login_username, .block_login #login_password {width:[[static:lb_fieldswidth]];}
 
-/* block_settings */
-.block_settings .block_tree .tree_item a:link,
-.block_settings .block_tree .tree_item a:visited,
-.block_settings .block_tree .tree_item a:active,
-
 /* block_navigation */
 /*.block_navigation .block_tree li.type_category.contains_branch>p span {
     padding-left: 20px;
     background-repeat: no-repeat;
     background-position: 0 -1px;
 }*/
+
+/* block_settings links */
+/* block_navigation links */
+.block_settings .block_tree .tree_item a:link,
+.block_settings .block_tree .tree_item a:visited,
+.block_settings .block_tree .tree_item a:active,
 .block_navigation .block_tree .tree_item a:link,
 .block_navigation .block_tree .tree_item a:visited,
-.block_navigation .block_tree .tree_item a:active {
-    color:#000;
-}
+.block_navigation .block_tree .tree_item a:active {color:#000;}
+
 .block_navigation .block_tree .tree_item {padding-left:19px}
+
+.block.list_block .unlist > li > .column {margin-top:3px; margin-bottom:3px;}
index 2f8bc60..8ef2603 100644 (file)
@@ -316,11 +316,11 @@ function user_get_user_details($user, $course = null, array $userfields = array(
     }
 
     if ($user->phone1 && in_array('phone1', $userfields) &&
-            (isset($showuseridentityfields['phone1']) or $canviewhiddenuserfields)) {
+            (in_array('phone1', $showuseridentityfields) or $canviewhiddenuserfields)) {
         $userdetails['phone1'] = $user->phone1;
     }
     if ($user->phone2 && in_array('phone2', $userfields) &&
-            (isset($showuseridentityfields['phone2']) or $canviewhiddenuserfields)) {
+            (in_array('phone2', $showuseridentityfields) or $canviewhiddenuserfields)) {
         $userdetails['phone2'] = $user->phone2;
     }
 
@@ -386,7 +386,7 @@ function user_get_user_details($user, $course = null, array $userfields = array(
     if (in_array('email', $userfields) && ($isadmin // The admin is allowed the users email
       or $currentuser // Of course the current user is as well
       or $canviewuseremail  // this is a capability in course context, it will be false in usercontext
-      or isset($showuseridentityfields['email'])
+      or in_array('email', $showuseridentityfields)
       or $user->maildisplay == 1
       or ($user->maildisplay == 2 and enrol_sharing_course($user, $USER)))) {
         $userdetails['email'] = $user->email;
@@ -400,17 +400,17 @@ function user_get_user_details($user, $course = null, array $userfields = array(
     }
 
     //Departement/Institution/Idnumber are not displayed on any profile, however you can get them from editing profile.
-    if ($isadmin or $currentuser or isset($showuseridentityfields['idnumber'])) {
+    if ($isadmin or $currentuser or in_array('idnumber', $showuseridentityfields)) {
         if (in_array('idnumber', $userfields) && $user->idnumber) {
             $userdetails['idnumber'] = $user->idnumber;
         }
     }
-    if ($isadmin or $currentuser or isset($showuseridentityfields['institution'])) {
+    if ($isadmin or $currentuser or in_array('institution', $showuseridentityfields)) {
         if (in_array('institution', $userfields) && $user->institution) {
             $userdetails['institution'] = $user->institution;
         }
     }
-    if ($isadmin or $currentuser or isset($showuseridentityfields['department'])) {
+    if ($isadmin or $currentuser or in_array('department', $showuseridentityfields)) {
         if (in_array('department', $userfields) && isset($user->department)) { //isset because it's ok to have department 0
             $userdetails['department'] = $user->department;
         }
index 9f8242f..7a31246 100644 (file)
@@ -30,7 +30,7 @@
 defined('MOODLE_INTERNAL') || die();
 
 
-$version  = 2012062506.05;              // YYYYMMDD      = weekly release date of this DEV branch
+$version  = 2012062506.06;              // YYYYMMDD      = weekly release date of this DEV branch
                                         //         RR    = release increments - 00 in DEV branches
                                         //           .XX = incremental changes