Merge branch 'wip-MDL-27058-master' of git://github.com/samhemelryk/moodle.git (solve...
authorAparup Banerjee <aparup@moodle.com>
Tue, 11 Oct 2011 05:37:34 +0000 (13:37 +0800)
committerAparup Banerjee <aparup@moodle.com>
Tue, 11 Oct 2011 05:37:34 +0000 (13:37 +0800)
19 files changed:
course/editcategory.php
course/editcategory_form.php
course/user.php
enrol/cohort/yui/quickenrolment/quickenrolment.js
index.php
lang/en/moodle.php
lib/db/install.xml
lib/db/upgrade.php
lib/googleapi.php
lib/navigationlib.php
lib/simpletest/testpagelib_moodlepage.php
lib/xmldb/xmldb_key.php
mod/assignment/lib.php
mod/assignment/type/upload/assignment.class.php
mod/choice/renderer.php
mod/quiz/lib.php
theme/formal_white/style/core.css
theme/yui_combo.php
user/edit.php

index ceffc63..9752cce 100644 (file)
@@ -74,6 +74,7 @@ if ($mform->is_cancelled()) {
 } else if ($data = $mform->get_data()) {
     $newcategory = new stdClass();
     $newcategory->name = $data->name;
+    $newcategory->idnumber = $data->idnumber;
     $newcategory->description_editor = $data->description_editor;
     $newcategory->parent = $data->parent; // if $data->parent = 0, the new category will be a top-level category
 
index a708a02..3e3cfe3 100644 (file)
@@ -35,6 +35,8 @@ class editcategory_form extends moodleform {
         $mform->addElement('select', 'parent', get_string('parentcategory'), $options);
         $mform->addElement('text', 'name', get_string('categoryname'), array('size'=>'30'));
         $mform->addRule('name', get_string('required'), 'required', null);
+        $mform->addElement('text', 'idnumber', get_string('idnumbercoursecategory'),'maxlength="100"  size="10"');
+        $mform->addHelpButton('idnumber', 'idnumbercoursecategory');
         $mform->addElement('editor', 'description_editor', get_string('description'), null, $editoroptions);
         $mform->setType('description_editor', PARAM_RAW);
         if (!empty($CFG->allowcategorythemes)) {
@@ -54,5 +56,19 @@ class editcategory_form extends moodleform {
 
         $this->add_action_buttons(true, $strsubmit);
     }
+
+    function validation($data, $files) {
+        global $DB;
+        $errors = parent::validation($data, $files);
+        if (!empty($data['idnumber'])) {
+            if ($existing = $DB->get_record('course_categories', array('idnumber' => $data['idnumber']))) {
+                if (!$data['id'] || $existing->id != $data['id']) {
+                    $errors['idnumber']= get_string('idnumbertaken');
+                }
+            }
+        }
+
+        return $errors;
+    }
 }
 
index 1796f08..21af6d7 100644 (file)
@@ -270,6 +270,7 @@ switch ($mode) {
     case "complete" :
         get_all_mods($course->id, $mods, $modnames, $modnamesplural, $modnamesused);
         $sections = get_all_sections($course->id);
+        $itemsprinted = false;
 
         for ($i=0; $i<=$course->numsections; $i++) {
 
@@ -279,8 +280,10 @@ switch ($mode) {
                 $showsection = (has_capability('moodle/course:viewhiddensections', $coursecontext) or $section->visible or !$course->hiddensections);
 
                 if ($showsection) { // prevent hidden sections in user activity. Thanks to Geoff Wilbert!
-
+                    // Check the section has a sequence. This is the sequence of modules/resources.
+                    // If there is no sequence there is nothing to display.
                     if ($section->sequence) {
+                        $itemsprinted = true;
                         echo '<div class="section">';
                         echo '<h2>';
                         echo get_section_name($course, $section);
@@ -352,6 +355,11 @@ switch ($mode) {
                 }
             }
         }
+
+        if (!$itemsprinted) {
+            echo $OUTPUT->notification(get_string('nothingtodisplay'));
+        }
+
         break;
     case "coursecompletion":
     case "coursecompletions":
index 004acf1..6607566 100644 (file)
@@ -122,11 +122,7 @@ YUI.add('moodle-enrol_cohort-quickenrolment', function(Y) {
                     break;
                 case 'defaultcohortroleloaded':
                     defaultrole = this.get(DEFAULTCOHORTROLE);
-                    panel.get('contentBox').one('.'+CSS.PANELROLES).all('option').each(function(){
-                        if (this.get('value')==defaultrole) {
-                            this.setAttribute('selected', true);
-                        }
-                    });
+                    panel.get('contentBox').one('.'+CSS.PANELROLES+' select').set('value', defaultrole);
                     break;
             }
         },
@@ -339,4 +335,4 @@ YUI.add('moodle-enrol_cohort-quickenrolment', function(Y) {
         }
     }
 
-}, '@VERSION@', {requires:['base','node', 'overlay', 'io-base', 'test', 'json-parse', 'event-delegate', 'dd-plugin', 'event-key', 'moodle-enrol-notification']});
\ No newline at end of file
+}, '@VERSION@', {requires:['base','node', 'overlay', 'io-base', 'test', 'json-parse', 'event-delegate', 'dd-plugin', 'event-key', 'moodle-enrol-notification']});
index aff7187..d6424a5 100644 (file)
--- a/index.php
+++ b/index.php
         user_accesstime_log();
     }
 
+    $hassiteconfig = has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM));
+
     $PAGE->set_url('/');
     $PAGE->set_course($SITE);
 
 /// If the site is currently under maintenance, then print a message
-    if (!empty($CFG->maintenance_enabled) and !has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) {
+    if (!empty($CFG->maintenance_enabled) and !$hassiteconfig) {
         print_maintenance_message();
     }
 
-    if (has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM))) {
-        if (moodle_needs_upgrading()) {
-            redirect($CFG->wwwroot .'/'. $CFG->admin .'/index.php');
-        }
-    } else if (get_home_page() != HOMEPAGE_SITE) {
+    if ($hassiteconfig && moodle_needs_upgrading()) {
+        redirect($CFG->wwwroot .'/'. $CFG->admin .'/index.php');
+    }
+
+    if (get_home_page() != HOMEPAGE_SITE) {
         // Redirect logged-in users to My Moodle overview if required
         if (optional_param('setdefaulthome', false, PARAM_BOOL)) {
             set_user_preference('user_home_page_preference', HOMEPAGE_SITE);
-        } else if ($CFG->defaulthomepage == HOMEPAGE_MY && optional_param('redirect', true, PARAM_BOOL)) {
+        } else if ($CFG->defaulthomepage == HOMEPAGE_MY && (optional_param('redirect', true, PARAM_BOOL) || !$hassiteconfig)) {
             redirect($CFG->wwwroot .'/my/');
         } else if (!empty($CFG->defaulthomepage) && $CFG->defaulthomepage == HOMEPAGE_USER) {
             $PAGE->settingsnav->get('usercurrentsettings')->add(get_string('makethismyhome'), new moodle_url('/', array('setdefaulthome'=>true)), navigation_node::TYPE_SETTING);
             break;
 
             case FRONTPAGECOURSELIST:
-                if (isloggedin() and !has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM)) and !isguestuser() and empty($CFG->disablemycourses)) {
+                if (isloggedin() and !$hassiteconfig and !isguestuser() and empty($CFG->disablemycourses)) {
                     echo html_writer::tag('a', get_string('skipa', 'access', moodle_strtolower(get_string('mycourses'))), array('href'=>'#skipmycourses', 'class'=>'skip-block'));
                     echo $OUTPUT->heading(get_string('mycourses'), 2, 'headingblock header');
                     print_my_moodle();
                     echo html_writer::tag('span', '', array('class'=>'skip-block-to', 'id'=>'skipmycourses'));
-                } else if ((!has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM)) and !isguestuser()) or ($DB->count_records('course') <= FRONTPAGECOURSELIMIT)) {
+                } else if ((!$hassiteconfig and !isguestuser()) or ($DB->count_records('course') <= FRONTPAGECOURSELIMIT)) {
                     // admin should not see list of courses when there are too many of them
                     echo html_writer::tag('a', get_string('skipa', 'access', moodle_strtolower(get_string('availablecourses'))), array('href'=>'#skipavailablecourses', 'class'=>'skip-block'));
                     echo $OUTPUT->heading(get_string('availablecourses'), 2, 'headingblock header');
index a51008a..dc1bc8f 100644 (file)
@@ -216,6 +216,8 @@ $string['categorydeleted'] = 'The category \'{$a}\' was deleted';
 $string['categoryduplicate'] = 'A category named \'{$a}\' already exists!';
 $string['categorymodifiedcancel'] = 'Category was modified! Please cancel and try again.';
 $string['categoryname'] = 'Category name';
+$string['idnumbercoursecategory'] = 'Category ID number';
+$string['idnumbercoursecategory_help'] = 'The ID number of a course category  is only used when matching the category against external systems and is not displayed anywhere on the site. If the category has an official code name it may be entered, otherwise the field can be left blank.';
 $string['categoryupdated'] = 'The category \'{$a}\' was updated';
 $string['city'] = 'City/town';
 $string['clambroken'] = 'Your administrator has enabled virus checking for file uploads but has misconfigured something.<br />Your file upload was NOT successful. Your administrator has been emailed to notify them so they can fix it.<br />Maybe try uploading this file later.';
index c98f888..e05f3a6 100644 (file)
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" ?>
-<XMLDB PATH="lib/db" VERSION="20110926" COMMENT="XMLDB file for core Moodle tables"
+<XMLDB PATH="lib/db" VERSION="20111007" COMMENT="XMLDB file for core Moodle tables"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:noNamespaceSchemaLocation="../../lib/xmldb/xmldb.xsd"
 >
     <TABLE NAME="course_categories" COMMENT="Course categories" PREVIOUS="course" NEXT="course_completion_aggr_methd">
       <FIELDS>
         <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" SEQUENCE="true" NEXT="name"/>
-        <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" PREVIOUS="id" NEXT="description"/>
-        <FIELD NAME="description" TYPE="text" LENGTH="small" NOTNULL="false" SEQUENCE="false" PREVIOUS="name" NEXT="descriptionformat"/>
+        <FIELD NAME="name" TYPE="char" LENGTH="255" NOTNULL="true" SEQUENCE="false" PREVIOUS="id" NEXT="idnumber"/>
+        <FIELD NAME="idnumber" TYPE="char" LENGTH="100" NOTNULL="false" SEQUENCE="false" PREVIOUS="name" NEXT="description"/>
+        <FIELD NAME="description" TYPE="text" LENGTH="small" NOTNULL="false" SEQUENCE="false" PREVIOUS="idnumber" NEXT="descriptionformat"/>
         <FIELD NAME="descriptionformat" TYPE="int" LENGTH="2" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="description" NEXT="parent"/>
         <FIELD NAME="parent" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="descriptionformat" NEXT="sortorder"/>
         <FIELD NAME="sortorder" TYPE="int" LENGTH="10" NOTNULL="true" UNSIGNED="true" DEFAULT="0" SEQUENCE="false" PREVIOUS="parent" NEXT="coursecount"/>
index 8ab21df..ad4056b 100644 (file)
@@ -6778,6 +6778,20 @@ FROM
         upgrade_main_savepoint(true, 2011092800.03);
     }
 
+    if ($oldversion < 2011100700.02) {
+        // Define field idnumber to be added to course_categories
+        $table = new xmldb_table('course_categories');
+        $field = new xmldb_field('idnumber', XMLDB_TYPE_CHAR, '100', null, null, null, null, 'name');
+
+        // Conditionally launch add field idnumber
+        if (!$dbman->field_exists($table,$field)) {
+            $dbman->add_field($table, $field);
+        }
+
+        // Main savepoint reached
+        upgrade_main_savepoint(true, 2011100700.02);
+    }
+
     return true;
 }
 
index cb09710..af545a0 100644 (file)
@@ -241,8 +241,8 @@ class google_authsub extends google_auth_request {
  */
 class google_docs {
     // need both docs and the spreadsheets realm
-    const REALM            = 'http://docs.google.com/feeds/ http://spreadsheets.google.com/feeds/ http://docs.googleusercontent.com/';
-    const DOCUMENTFEED_URL = 'http://docs.google.com/feeds/default/private/full';
+    const REALM            = 'https://docs.google.com/feeds/ https://spreadsheets.google.com/feeds/ https://docs.googleusercontent.com/';
+    const DOCUMENTFEED_URL = 'https://docs.google.com/feeds/default/private/full';
     const USER_PREF_NAME   = 'google_authsub_sesskey';
 
     private $google_curl = null;
@@ -292,8 +292,6 @@ class google_docs {
         $xml = new SimpleXMLElement($content);
 
 
-
-
         $files = array();
         foreach($xml->entry as $gdoc){
             $docid  = (string) $gdoc->children('http://schemas.google.com/g/2005')->resourceId;
@@ -307,15 +305,15 @@ class google_docs {
             switch($type){
                 case 'document':
                     $title = $gdoc->title.'.rtf';
-                    $source = 'http://docs.google.com/feeds/download/documents/Export?id='.$docid.'&exportFormat=rtf';
+                    $source = 'https://docs.google.com/feeds/download/documents/Export?id='.$docid.'&exportFormat=rtf';
                     break;
                 case 'presentation':
                     $title = $gdoc->title.'.ppt';
-                    $source = 'http://docs.google.com/feeds/download/presentations/Export?id='.$docid.'&exportFormat=ppt';
+                    $source = 'https://docs.google.com/feeds/download/presentations/Export?id='.$docid.'&exportFormat=ppt';
                     break;
                 case 'spreadsheet':
                     $title = $gdoc->title.'.xls';
-                    $source = 'http://spreadsheets.google.com/feeds/download/spreadsheets/Export?key='.$docid.'&exportFormat=xls';
+                    $source = 'https://spreadsheets.google.com/feeds/download/spreadsheets/Export?key='.$docid.'&exportFormat=xls';
                     break;
                 case 'pdf':
                     $title  = (string)$gdoc->title;
@@ -374,10 +372,10 @@ class google_docs {
 class google_picasa {
     const REALM             = 'http://picasaweb.google.com/data/';
     const USER_PREF_NAME    = 'google_authsub_sesskey_picasa';
-    const UPLOAD_LOCATION   = 'http://picasaweb.google.com/data/feed/api/user/default/albumid/default';
-    const ALBUM_PHOTO_LIST  = 'http://picasaweb.google.com/data/feed/api/user/default/albumid/';
-    const PHOTO_SEARCH_URL  = 'http://picasaweb.google.com/data/feed/api/user/default?kind=photo&q=';
-    const LIST_ALBUMS_URL   = 'http://picasaweb.google.com/data/feed/api/user/default';
+    const UPLOAD_LOCATION   = 'https://picasaweb.google.com/data/feed/api/user/default/albumid/default';
+    const ALBUM_PHOTO_LIST  = 'https://picasaweb.google.com/data/feed/api/user/default/albumid/';
+    const PHOTO_SEARCH_URL  = 'https://picasaweb.google.com/data/feed/api/user/default?kind=photo&q=';
+    const LIST_ALBUMS_URL   = 'https://picasaweb.google.com/data/feed/api/user/default';
 
     private $google_curl = null;
 
index b8d3079..43ff1a2 100644 (file)
@@ -1608,6 +1608,7 @@ class global_navigation extends navigation_node {
                     $activity->hidden = (!$cm->visible);
                     $activity->modname = $cm->modname;
                     $activity->nodetype = navigation_node::NODETYPE_LEAF;
+                    $activity->onclick = $cm->get_on_click();
                     $url = $cm->get_url();
                     if (!$url) {
                         $activity->url = null;
@@ -1706,6 +1707,8 @@ class global_navigation extends navigation_node {
      * @return array Array of activity nodes
      */
     protected function load_section_activities(navigation_node $sectionnode, $sectionnumber, $activities) {
+        // A static counter for JS function naming
+        static $legacyonclickcounter = 0;
 
         if ($activities instanceof course_modinfo) {
             debugging('global_navigation::load_section_activities argument 3 should now recieve an array of activites. See that method for an example.', DEBUG_DEVELOPER);
@@ -1722,7 +1725,34 @@ class global_navigation extends navigation_node {
             } else {
                 $icon = new pix_icon('icon', get_string('modulename', $activity->modname), $activity->modname);
             }
-            $activitynode = $sectionnode->add(format_string($activity->name), $activity->url, navigation_node::TYPE_ACTIVITY, null, $activity->id, $icon);
+
+            // Prepare the default name and url for the node
+            $activityname = format_string($activity->name, true, array('context' => get_context_instance(CONTEXT_MODULE, $activity->id)));
+            $action = new moodle_url($activity->url);
+
+            // Check if the onclick property is set (puke!)
+            if (!empty($activity->onclick)) {
+                // Increment the counter so that we have a unique number.
+                $legacyonclickcounter++;
+                // Generate the function name we will use
+                $functionname = 'legacy_activity_onclick_handler_'.$legacyonclickcounter;
+                $propogrationhandler = '';
+                // Check if we need to cancel propogation. Remember inline onclick
+                // events would return false if they wanted to prevent propogation and the
+                // default action.
+                if (strpos($activity->onclick, 'return false')) {
+                    $propogrationhandler = 'e.halt();';
+                }
+                // Decode the onclick - it has already been encoded for display (puke)
+                $onclick = htmlspecialchars_decode($activity->onclick);
+                // Build the JS function the click event will call
+                $jscode = "function {$functionname}(e) { $propogrationhandler $onclick }";
+                $this->page->requires->js_init_code($jscode);
+                // Override the default url with the new action link
+                $action = new action_link($action, $activityname, new component_action('click', $functionname));
+            }
+
+            $activitynode = $sectionnode->add($activityname, $action, navigation_node::TYPE_ACTIVITY, null, $activity->id, $icon);
             $activitynode->title(get_string('modulename', $activity->modname));
             $activitynode->hidden = $activity->hidden;
             $activitynode->display = $activity->display;
@@ -2321,9 +2351,11 @@ class global_navigation extends navigation_node {
             $coursenode->add(get_string('tags', 'tag'), new moodle_url('/tag/search.php'));
         }
 
-        // Calendar
-        $calendarurl = new moodle_url('/calendar/view.php', array('view' => 'month'));
-        $coursenode->add(get_string('calendar', 'calendar'), $calendarurl, self::TYPE_CUSTOM, null, 'calendar');
+        if (isloggedin()) {
+            // Calendar
+            $calendarurl = new moodle_url('/calendar/view.php', array('view' => 'month'));
+            $coursenode->add(get_string('calendar', 'calendar'), $calendarurl, self::TYPE_CUSTOM, null, 'calendar');
+        }
 
         // View course reports
         if (has_capability('moodle/site:viewreports', $this->page->context)) { // basic capability for listing of reports
index 2c66b45..ccaf287 100644 (file)
@@ -67,7 +67,7 @@ class moodle_page_test extends UnitTestCase {
     }
 
     public function tearDown() {
-        global $COURSE;
+        global $COURSE, $PAGE;
         $this->testpage = NULL;
         $COURSE = $this->originalcourse;
         $PAGE = $this->originalpage;
index 6a1a132..96c6091 100644 (file)
@@ -59,7 +59,7 @@ class xmldb_key extends xmldb_object {
     /**
      * Set all the attributes of one xmldb_key
      *
-     * @param string type XMLDB_KEY_PRIMARY, XMLDB_KEY_UNIQUE, XMLDB_KEY_FOREIGN
+     * @param string type XMLDB_KEY_[PRIMARY|UNIQUE|FOREIGN|FOREIGN_UNIQUE]
      * @param array fields an array of fieldnames to build the key over
      * @param string reftable name of the table the FK points to or null
      * @param array reffields an array of fieldnames in the FK table or null
@@ -418,6 +418,9 @@ class xmldb_key extends xmldb_object {
             case XMLDB_KEY_FOREIGN:
                 $result .= 'XMLDB_KEY_FOREIGN' . ', ';
                 break;
+            case XMLDB_KEY_FOREIGN_UNIQUE:
+                $result .= 'XMLDB_KEY_FOREIGN_UNIQUE' . ', ';
+                break;
         }
     /// The fields
         $keyfields = $this->getFields();
@@ -427,7 +430,8 @@ class xmldb_key extends xmldb_object {
             $result .= 'null';
         }
     /// The FKs attributes
-        if ($this->getType() == XMLDB_KEY_FOREIGN) {
+        if ($this->getType() == XMLDB_KEY_FOREIGN ||
+            $this->getType() == XMLDB_KEY_FOREIGN_UNIQUE) {
         /// The reftable
             $reftable = $this->getRefTable();
             if (!empty($reftable)) {
index f698054..c4a390c 100644 (file)
@@ -1922,8 +1922,12 @@ class assignment_base {
                     $button->set_format_by_file($file);
                     $output .= $button->to_html(PORTFOLIO_ADD_ICON_LINK);
                 }
-                $output .= plagiarism_get_links(array('userid'=>$userid, 'file'=>$file, 'cmid'=>$this->cm->id, 'course'=>$this->course, 'assignment'=>$this->assignment));
-                $output .= '<br />';
+
+                if ($CFG->enableplagiarism) {
+                    require_once($CFG->libdir.'/plagiarismlib.php');
+                    $output .= plagiarism_get_links(array('userid'=>$userid, 'file'=>$file, 'cmid'=>$this->cm->id, 'course'=>$this->course, 'assignment'=>$this->assignment));
+                    $output .= '<br />';
+                }
             }
             if ($CFG->enableportfolios && count($files) > 1  && $this->portfolio_exportable() && has_capability('mod/assignment:exportownsubmission', $this->context)) {
                 $button->set_callback_options('assignment_portfolio_caller', array('id' => $this->cm->id, 'submissionid' => $submission->id), '/mod/assignment/locallib.php');
index 3cbcc2f..b909f25 100644 (file)
@@ -110,11 +110,6 @@ class assignment_upload extends assignment_base {
         }
 
         if (empty($submission->timemarked)) {   /// Nothing to show, so print nothing
-            if ($this->count_responsefiles($USER->id)) {
-                echo $OUTPUT->heading(get_string('responsefiles', 'assignment'), 3);
-                $responsefiles = $this->print_responsefiles($USER->id, true);
-                echo $OUTPUT->box($responsefiles, 'generalbox boxaligncenter');
-            }
             return;
         }
 
@@ -126,7 +121,12 @@ class assignment_upload extends assignment_base {
             return;
         }
 
-        if ($grade->grade === null and empty($grade->str_feedback)) {   /// Nothing to show yet
+        if ($grade->grade === null and empty($grade->str_feedback)) {   // No grade to show yet
+            if ($this->count_responsefiles($USER->id)) {   // but possibly response files are present
+                echo $OUTPUT->heading(get_string('responsefiles', 'assignment'), 3);
+                $responsefiles = $this->print_responsefiles($USER->id, true);
+                echo $OUTPUT->box($responsefiles, 'generalbox boxaligncenter');
+            }
             return;
         }
 
index 4df3f6a..4ef840d 100644 (file)
@@ -204,11 +204,11 @@ class mod_choice_renderer extends plugin_renderer_base {
         if ($choices->viewresponsecapability && $choices->deleterepsonsecapability) {
             $selecturl = new moodle_url('#');
 
-            $selectallactions = new component_action('click',"select_all_in", array('div',null,'tablecontainer'));
+            $selectallactions = new component_action('click',"checkall");
             $selectall = new action_link($selecturl, get_string('selectall'), $selectallactions);
             $actiondata .= $this->output->render($selectall) . ' / ';
 
-            $deselectallactions = new component_action('click',"deselect_all_in", array('div',null,'tablecontainer'));
+            $deselectallactions = new component_action('click',"checknone");
             $deselectall = new action_link($selecturl, get_string('deselectall'), $deselectallactions);
             $actiondata .= $this->output->render($deselectall);
 
index afc6572..18f0bcd 100644 (file)
@@ -1269,12 +1269,14 @@ function quiz_reset_userdata($data) {
             'error' => false);
 
         // Remove all grades from gradebook
+        $DB->delete_records_select('quiz_grades',
+                'quiz IN (SELECT id FROM {quiz} WHERE course = ?)', array($data->courseid));
         if (empty($data->reset_gradebook_grades)) {
             quiz_reset_gradebook($data->courseid);
         }
         $status[] = array(
             'component' => $componentstr,
-            'item' => get_string('attemptsdeleted', 'quiz'),
+            'item' => get_string('gradesdeleted', 'quiz'),
             'error' => false);
     }
 
index 44e2b7e..2e41f00 100644 (file)
@@ -1,11 +1,10 @@
 /************************************************************************
-    Non sono riuscito a trovare un modo per sovrascrivere la regola
+    I could not find a way to override the rule
         border: 2px solid #ddd;
-    presente nel file
+    belonging to the file
         /theme/canvas/style/core.css
-    Per questo questo file è stato creato a partire dalla copia del
-    foglio di stile core.css del tema canvas, ed è stato adeguato alle
-    esigenze del tema corrente.
+    Therefore this file has been created from the copy of that css file
+    and adapted to the needs of the current theme.
 ************************************************************************/
 
 .sitetopic {
@@ -40,6 +39,7 @@
 label {
     margin-right: 0.3em;
 }
+
 .navbutton .singlebutton {
     margin: 0;
 }
@@ -111,10 +111,10 @@ input[type="radio"] {
 }
 
 .loginbox .loginform .form-label {
-    float: none;
-    width: 100%;
     margin: 0 auto;
-    text-align: left;
+    float: left;
+    text-align: right;
+    width: 40%;
 }
 
 .dir-rtl .loginbox .loginform .form-label {
@@ -122,8 +122,8 @@ input[type="radio"] {
 }
 
 .loginbox .loginform .form-input {
-    float: none;
-    width: 100%;
+    float: right;
+    width: 59%;
     margin: 0 auto;
 }
 
index 8d46a1d..209f54f 100644 (file)
@@ -48,7 +48,7 @@ if (substr($parts, -3) === '.js') {
 // if they are requesting a revision that's not -1, and they have supplied an
 // If-Modified-Since header, we can send back a 304 Not Modified since the
 // content never changes (the rev number is increased any time the content changes)
-if (!empty($_SERVER['HTTP_IF_NONE_MATCH']) || !empty($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
+if (strpos($parts, '/-1/') === false and (!empty($_SERVER['HTTP_IF_NONE_MATCH']) || !empty($_SERVER['HTTP_IF_MODIFIED_SINCE']))) {
     $lifetime = 60*60*24*30; // 30 days
     header('HTTP/1.1 304 Not Modified');
     header('Expires: '. gmdate('D, d M Y H:i:s', time() + $lifetime) .' GMT');
index a8e7138..6fa1608 100644 (file)
@@ -36,7 +36,7 @@ $userid = optional_param('id', $USER->id, PARAM_INT);    // user id
 $course = optional_param('course', SITEID, PARAM_INT);   // course id (defaults to Site)
 $cancelemailchange = optional_param('cancelemailchange', 0, PARAM_INT);   // course id (defaults to Site)
 
-$PAGE->set_url('/user/edit.php', array('course'=>$course, 'id'=>$userid, 'cancelemailchange'=>$cancelemailchange));
+$PAGE->set_url('/user/edit.php', array('course'=>$course, 'id'=>$userid));
 
 if (!$course = $DB->get_record('course', array('id'=>$course))) {
     print_error('invalidcourseid');
@@ -50,7 +50,8 @@ if ($course->id != SITEID) {
     }
     redirect(get_login_url());
 } else {
-    $PAGE->set_course($course);
+    $PAGE->set_context(get_system_context());
+    $PAGE->set_pagelayout('standard');
 }
 
 // Guest can not edit