Merge branch 'wip-MDL-40136-m26' of git://github.com/samhemelryk/moodle
authorDan Poltawski <dan@moodle.com>
Mon, 17 Jun 2013 05:37:18 +0000 (13:37 +0800)
committerDan Poltawski <dan@moodle.com>
Mon, 17 Jun 2013 05:37:18 +0000 (13:37 +0800)
12 files changed:
blocks/dock.js
blocks/navigation/yui/build/moodle-block_navigation-navigation/moodle-block_navigation-navigation-debug.js
blocks/navigation/yui/build/moodle-block_navigation-navigation/moodle-block_navigation-navigation-min.js
blocks/navigation/yui/build/moodle-block_navigation-navigation/moodle-block_navigation-navigation.js
blocks/navigation/yui/src/navigation/js/navigation.js
mod/assign/locallib.php
mod/book/edit.php
mod/lesson/locallib.php
mod/lesson/pagetypes/matching.php
mod/lesson/pagetypes/multichoice.php
mod/scorm/mod_form.php
user/index.php

index bb2fa22..95d0a3e 100644 (file)
@@ -836,8 +836,15 @@ M.core_dock.genericblock.prototype = {
         }
 
         // Must set the image src seperatly of we get an error with XML strict headers
-        var moveto = Y.Node.create('<input type="image" class="moveto customcommand requiresjs" alt="'+M.str.block.addtodock+'" title="'+
-            Y.Escape.html(M.util.get_string('dockblock', 'block', node.one('.header .title h2').getHTML())) +'" />');
+        var moveto = Y.Node.create('<input type="image" class="moveto customcommand requiresjs" />');
+        var header = node.one('.header .title h2');
+        moveto.setAttribute('alt', Y.Escape.html(M.util.get_string('addtodock', 'block')));
+        if (header) {
+            moveto.setAttribute('title', Y.Escape.html(M.util.get_string('dockblock', 'block', header.getHTML())));
+        } else {
+            moveto.setAttribute('title', Y.Escape.html(M.util.get_string('addtodock', 'block')));
+        }
+
         var icon = 't/block_to_dock';
         if (right_to_left()) {
             icon = 't/block_to_dock_rtl';
index 0772f6d..e6bc954 100644 (file)
Binary files a/blocks/navigation/yui/build/moodle-block_navigation-navigation/moodle-block_navigation-navigation-debug.js and b/blocks/navigation/yui/build/moodle-block_navigation-navigation/moodle-block_navigation-navigation-debug.js differ
index 30b9e85..b9cd9b2 100644 (file)
Binary files a/blocks/navigation/yui/build/moodle-block_navigation-navigation/moodle-block_navigation-navigation-min.js and b/blocks/navigation/yui/build/moodle-block_navigation-navigation/moodle-block_navigation-navigation-min.js differ
index 0772f6d..e6bc954 100644 (file)
Binary files a/blocks/navigation/yui/build/moodle-block_navigation-navigation/moodle-block_navigation-navigation.js and b/blocks/navigation/yui/build/moodle-block_navigation-navigation/moodle-block_navigation-navigation.js differ
index a6d0ed0..2141a95 100644 (file)
@@ -389,11 +389,15 @@ BRANCH.prototype = {
     },
     /**
      * Attaches required events to the branch structure.
+     *
+     * @chainable
+     * @method wire
+     * @return {BRANCH} This function is chainable, it always returns itself.
      */
     wire : function() {
         this.node = this.node || Y.one('#'+this.get('id'));
         if (!this.node) {
-            return false;
+            return this;
         }
         if (this.get('expandable')) {
             this.node.setAttribute('data-expandable', '1');
index 763d590..f4fde92 100644 (file)
@@ -4445,7 +4445,9 @@ class assign {
                 // Give each submission plugin a chance to process the submission.
                 $plugins = $this->get_submission_plugins();
                 foreach ($plugins as $plugin) {
-                    $plugin->submit_for_grading($submission);
+                    if ($plugin->is_enabled() && $plugin->is_visible()) {
+                        $plugin->submit_for_grading($submission);
+                    }
                 }
 
                 $submission->status = ASSIGN_SUBMISSION_STATUS_SUBMITTED;
@@ -5034,7 +5036,7 @@ class assign {
             $allempty = true;
             $pluginerror = false;
             foreach ($this->submissionplugins as $plugin) {
-                if ($plugin->is_enabled()) {
+                if ($plugin->is_enabled() && $plugin->is_visible()) {
                     if (!$plugin->save($submission, $data)) {
                         $notices[] = $plugin->get_error();
                         $pluginerror = true;
index e379ec0..ea21820 100644 (file)
@@ -72,6 +72,7 @@ if ($mform->is_cancelled()) {
         // store the files
         $data = file_postupdate_standard_editor($data, 'content', $options, $context, 'mod_book', 'chapter', $data->id);
         $DB->update_record('book_chapters', $data);
+        $DB->set_field('book', 'revision', $book->revision+1, array('id'=>$book->id));
 
         add_to_log($course->id, 'course', 'update mod', '../mod/book/view.php?id='.$cm->id, 'book '.$book->id);
         add_to_log($course->id, 'book', 'update chapter', 'view.php?id='.$cm->id.'&chapterid='.$data->id, $data->id, $cm->id);
index c043fe0..314e4c7 100644 (file)
@@ -762,14 +762,12 @@ abstract class lesson_add_page_form_base extends moodleform {
         if ($label === null) {
             $label = get_string("score", "lesson");
         }
-        $elname = $name;
+
         if (is_int($name)) {
             $name = "score[$name]";
-            $elname = 'score';
         }
         $this->_form->addElement('text', $name, $label, array('size'=>5));
-        // Temporary fix until MDL-38885 gets integrated.
-        $this->_form->setType($elname, PARAM_INT);
+        $this->_form->setType($name, PARAM_INT);
         if ($value !== null) {
             $this->_form->setDefault($name, $value);
         }
index 83c175a..82bfdb2 100644 (file)
@@ -477,8 +477,7 @@ class lesson_add_page_form_matching extends lesson_add_page_form_base {
             $label = get_string('matchesanswer','lesson');
             $count = $i;
             $this->_form->addElement('text', 'response_editor['.$count.']', $label, array('size'=>'50'));
-            // Temporary fix until MDL-38885 gets integrated.
-            $this->_form->setType('response_editor', PARAM_TEXT);
+            $this->_form->setType('response_editor['.$count.']', PARAM_NOTAGS);
             $this->_form->setDefault('response_editor['.$count.']', '');
             if ($required) {
                 $this->_form->addRule('response_editor['.$count.']', get_string('required'), 'required', null, 'client');
@@ -527,8 +526,7 @@ class lesson_display_answer_form_matching extends moodleform {
                 if ($hasattempt) {
                     $responseid = 'response_'.$answer->id;
                     $mform->addElement('hidden', 'response['.$answer->id.']', htmlspecialchars(trim($answers[$useranswers[$i]]->response)));
-                    // Temporary fixed until MDL-38885 gets integrated
-                    $mform->setType('response', PARAM_TEXT);
+                    $mform->setType('response', PARAM_NOTAGS);
                 }
                 $mform->addElement('select', $responseid, format_text($answer->answer,$answer->answerformat,$options), $responseoptions, $disabled);
                 $mform->setType($responseid, PARAM_TEXT);
index 9025f92..aaf762d 100644 (file)
@@ -553,8 +553,7 @@ class lesson_display_answer_form_multichoice_multianswer extends moodleform {
             if ($hasattempt && in_array($answer->id, $useranswers)) {
                 $answerid = 'answer_'.$answer->id;
                 $mform->addElement('hidden', 'answer['.$answer->id.']', $answer->answer);
-                // Temporary fix until MDL-38885 gets integrated.
-                $mform->setType('answer', PARAM_TEXT);
+                $mform->setType('answer['.$answer->id.']', PARAM_NOTAGS);
                 $mform->setDefault($answerid, true);
                 $mform->setDefault('answer['.$answer->id.']', true);
             }
index 4460deb..e44bb6c 100644 (file)
@@ -35,7 +35,7 @@ class mod_scorm_mod_form extends moodleform_mod {
         //-------------------------------------------------------------------------------
         $mform->addElement('header', 'general', get_string('general', 'form'));
 
-        // Name
+        // Name.
         $mform->addElement('text', 'name', get_string('name'));
         if (!empty($CFG->formatstringstriptags)) {
             $mform->setType('name', PARAM_TEXT);
@@ -45,14 +45,14 @@ class mod_scorm_mod_form extends moodleform_mod {
         $mform->addRule('name', null, 'required', null, 'client');
         $mform->addRule('name', get_string('maximumchars', '', 255), 'maxlength', 255, 'client');
 
-        // Summary
+        // Summary.
         $this->add_intro_editor(true);
 
         // Package.
         $mform->addElement('header', 'packagehdr', get_string('packagehdr', 'scorm'));
         $mform->setExpanded('packagehdr', true);
 
-        // Scorm types
+        // Scorm types.
         $scormtypes = array(SCORM_TYPE_LOCAL => get_string('typelocal', 'scorm'));
 
         if ($cfg_scorm->allowtypeexternal) {
@@ -67,7 +67,7 @@ class mod_scorm_mod_form extends moodleform_mod {
             $scormtypes[SCORM_TYPE_AICCURL] = get_string('typeaiccurl', 'scorm');
         }
 
-        // Reference
+        // Reference.
         if (count($scormtypes) > 1) {
             $mform->addElement('select', 'scormtype', get_string('scormtype', 'scorm'), $scormtypes);
             $mform->setType('scormtype', PARAM_ALPHA);
@@ -93,7 +93,7 @@ class mod_scorm_mod_form extends moodleform_mod {
             $mform->setType('updatefreq', PARAM_INT);
         }
 
-        // New local package upload
+        // New local package upload.
         $mform->addElement('filepicker', 'packagefile', get_string('package', 'scorm'));
         $mform->addHelpButton('packagefile', 'package', 'scorm');
         $mform->disabledIf('packagefile', 'scormtype', 'noteq', SCORM_TYPE_LOCAL);
@@ -101,26 +101,26 @@ class mod_scorm_mod_form extends moodleform_mod {
         // Display Settings.
         $mform->addElement('header', 'displaysettings', get_string('appearance'));
 
-        // Framed / Popup Window
+        // Framed / Popup Window.
         $mform->addElement('select', 'popup', get_string('display', 'scorm'), scorm_get_popup_display_array());
         $mform->setDefault('popup', $cfg_scorm->popup);
         $mform->setAdvanced('popup', $cfg_scorm->popup_adv);
 
-        // Width
+        // Width.
         $mform->addElement('text', 'width', get_string('width', 'scorm'), 'maxlength="5" size="5"');
         $mform->setDefault('width', $cfg_scorm->framewidth);
         $mform->setType('width', PARAM_INT);
         $mform->setAdvanced('width', $cfg_scorm->framewidth_adv);
         $mform->disabledIf('width', 'popup', 'eq', 0);
 
-        // Height
+        // Height.
         $mform->addElement('text', 'height', get_string('height', 'scorm'), 'maxlength="5" size="5"');
         $mform->setDefault('height', $cfg_scorm->frameheight);
         $mform->setType('height', PARAM_INT);
         $mform->setAdvanced('height', $cfg_scorm->frameheight_adv);
         $mform->disabledIf('height', 'popup', 'eq', 0);
 
-        // Window Options
+        // Window Options.
         $winoptgrp = array();
         foreach (scorm_get_popup_options_array() as $key => $value) {
             $winoptgrp[] = &$mform->createElement('checkbox', $key, '', get_string($key, 'scorm'));
@@ -130,7 +130,7 @@ class mod_scorm_mod_form extends moodleform_mod {
         $mform->disabledIf('winoptgrp', 'popup', 'eq', 0);
         $mform->setAdvanced('winoptgrp', $cfg_scorm->winoptgrp_adv);
 
-        // Skip view page
+        // Skip view page.
         $skipviewoptions = scorm_get_skip_view_array();
         if ($COURSE->format == 'scorm') { // Remove option that would cause a constant redirect.
             unset($skipviewoptions[SCORM_SKIPVIEW_ALWAYS]);
@@ -143,31 +143,31 @@ class mod_scorm_mod_form extends moodleform_mod {
         $mform->setDefault('skipview', $cfg_scorm->skipview);
         $mform->setAdvanced('skipview', $cfg_scorm->skipview_adv);
 
-        // Hide Browse
+        // Hide Browse.
         $mform->addElement('selectyesno', 'hidebrowse', get_string('hidebrowse', 'scorm'));
         $mform->addHelpButton('hidebrowse', 'hidebrowse', 'scorm');
         $mform->setDefault('hidebrowse', $cfg_scorm->hidebrowse);
         $mform->setAdvanced('hidebrowse', $cfg_scorm->hidebrowse_adv);
 
-        // Display course structure
+        // Display course structure.
         $mform->addElement('selectyesno', 'displaycoursestructure', get_string('displaycoursestructure', 'scorm'));
         $mform->addHelpButton('displaycoursestructure', 'displaycoursestructure', 'scorm');
         $mform->setDefault('displaycoursestructure', $cfg_scorm->displaycoursestructure);
         $mform->setAdvanced('displaycoursestructure', $cfg_scorm->displaycoursestructure_adv);
 
-        // Toc display
+        // Toc display.
         $mform->addElement('select', 'hidetoc', get_string('hidetoc', 'scorm'), scorm_get_hidetoc_array());
         $mform->addHelpButton('hidetoc', 'hidetoc', 'scorm');
         $mform->setDefault('hidetoc', $cfg_scorm->hidetoc);
         $mform->setAdvanced('hidetoc', $cfg_scorm->hidetoc_adv);
 
-        // Hide Navigation panel
+        // Hide Navigation panel.
         $mform->addElement('selectyesno', 'hidenav', get_string('hidenav', 'scorm'));
         $mform->setDefault('hidenav', $cfg_scorm->hidenav);
         $mform->setAdvanced('hidenav', $cfg_scorm->hidenav_adv);
         $mform->disabledIf('hidenav', 'hidetoc', 'noteq', 0);
 
-        // Display attempt status
+        // Display attempt status.
         $mform->addElement('select', 'displayattemptstatus', get_string('displayattemptstatus', 'scorm'), scorm_get_attemptstatus_array());
         $mform->addHelpButton('displayattemptstatus', 'displayattemptstatus', 'scorm');
         $mform->setDefault('displayattemptstatus', $cfg_scorm->displayattemptstatus);
@@ -183,12 +183,12 @@ class mod_scorm_mod_form extends moodleform_mod {
         // Grade Settings.
         $mform->addElement('header', 'gradesettings', get_string('grade'));
 
-        // Grade Method
+        // Grade Method.
         $mform->addElement('select', 'grademethod', get_string('grademethod', 'scorm'), scorm_get_grade_method_array());
         $mform->addHelpButton('grademethod', 'grademethod', 'scorm');
         $mform->setDefault('grademethod', $cfg_scorm->grademethod);
 
-        // Maximum Grade
+        // Maximum Grade.
         for ($i=0; $i<=100; $i++) {
             $grades[$i] = "$i";
         }
@@ -199,23 +199,23 @@ class mod_scorm_mod_form extends moodleform_mod {
         // Attempts management.
         $mform->addElement('header', 'attemptsmanagementhdr', get_string('attemptsmanagement', 'scorm'));
 
-        // Max Attempts
+        // Max Attempts.
         $mform->addElement('select', 'maxattempt', get_string('maximumattempts', 'scorm'), scorm_get_attempts_array());
         $mform->addHelpButton('maxattempt', 'maximumattempts', 'scorm');
         $mform->setDefault('maxattempt', $cfg_scorm->maxattempt);
 
-        // What Grade
+        // What Grade.
         $mform->addElement('select', 'whatgrade', get_string('whatgrade', 'scorm'),  scorm_get_what_grade_array());
         $mform->disabledIf('whatgrade', 'maxattempt', 'eq', 1);
         $mform->addHelpButton('whatgrade', 'whatgrade', 'scorm');
         $mform->setDefault('whatgrade', $cfg_scorm->whatgrade);
 
-        // Force new attempt
+        // Force new attempt.
         $mform->addElement('selectyesno', 'forcenewattempt', get_string('forcenewattempt', 'scorm'));
         $mform->addHelpButton('forcenewattempt', 'forcenewattempt', 'scorm');
         $mform->setDefault('forcenewattempt', $cfg_scorm->forcenewattempt);
 
-        // Last attempt lock - lock the enter button after the last available attempt has been made
+        // Last attempt lock - lock the enter button after the last available attempt has been made.
         $mform->addElement('selectyesno', 'lastattemptlock', get_string('lastattemptlock', 'scorm'));
         $mform->addHelpButton('lastattemptlock', 'lastattemptlock', 'scorm');
         $mform->setDefault('lastattemptlock', $cfg_scorm->lastattemptlock);
@@ -223,18 +223,18 @@ class mod_scorm_mod_form extends moodleform_mod {
         // Compatibility settings.
         $mform->addElement('header', 'compatibilitysettingshdr', get_string('compatibilitysettings', 'scorm'));
 
-        // Force completed
+        // Force completed.
         $mform->addElement('selectyesno', 'forcecompleted', get_string('forcecompleted', 'scorm'));
         $mform->addHelpButton('forcecompleted', 'forcecompleted', 'scorm');
         $mform->setDefault('forcecompleted', $cfg_scorm->forcecompleted);
 
-        // Autocontinue
+        // Autocontinue.
         $mform->addElement('selectyesno', 'auto', get_string('autocontinue', 'scorm'));
         $mform->addHelpButton('auto', 'autocontinue', 'scorm');
         $mform->setDefault('auto', $cfg_scorm->auto);
 
         //-------------------------------------------------------------------------------
-        // Hidden Settings
+        // Hidden Settings.
         $mform->addElement('hidden', 'datadir', null);
         $mform->setType('datadir', PARAM_RAW);
         $mform->addElement('hidden', 'pkgtype', null);
@@ -249,7 +249,7 @@ class mod_scorm_mod_form extends moodleform_mod {
         //-------------------------------------------------------------------------------
         $this->standard_coursemodule_elements();
         //-------------------------------------------------------------------------------
-        // buttons
+        // Buttons.
         $this->add_action_buttons();
     }
 
@@ -302,9 +302,9 @@ class mod_scorm_mod_form extends moodleform_mod {
             $default_values['timeclose'] = 0;
         }
 
-        // Set some completion default data
+        // Set some completion default data.
         if (!empty($default_values['completionstatusrequired']) && !is_array($default_values['completionstatusrequired'])) {
-            // Unpack values
+            // Unpack values.
             $cvalues = array();
             foreach (scorm_status_options() as $key => $value) {
                 if (($default_values['completionstatusrequired'] & $key) == $key) {
@@ -329,7 +329,7 @@ class mod_scorm_mod_form extends moodleform_mod {
 
         if ($type === SCORM_TYPE_LOCAL) {
             if (!empty($data['update'])) {
-                //ok, not required
+                // OK, not required.
 
             } else if (empty($data['packagefile'])) {
                 $errors['packagefile'] = get_string('required');
@@ -414,7 +414,7 @@ class mod_scorm_mod_form extends moodleform_mod {
         return $errors;
     }
 
-    //need to translate the "options" and "reference" field.
+    // Need to translate the "options" and "reference" field.
     function set_data($default_values) {
         $default_values = (array)$default_values;
 
@@ -446,7 +446,7 @@ class mod_scorm_mod_form extends moodleform_mod {
         $mform =& $this->_form;
         $items = array();
 
-        // Require score
+        // Require score.
         $group = array();
         $group[] =& $mform->createElement('text', 'completionscorerequired', '', array('size' => 5));
         $group[] =& $mform->createElement('checkbox', 'completionscoredisabled', null, get_string('disable'));
@@ -459,7 +459,7 @@ class mod_scorm_mod_form extends moodleform_mod {
         $items[] = 'completionscoregroup';
 
 
-        // Require status
+        // Require status.
         $first = true;
         $firstkey = null;
         foreach (scorm_status_options(true) as $key => $value) {
@@ -493,18 +493,22 @@ class mod_scorm_mod_form extends moodleform_mod {
             return false;
         }
 
+        // Convert completionstatusrequired to a proper integer, if any.
+        $total = 0;
+        if (isset($data->completionstatusrequired) && is_array($data->completionstatusrequired)) {
+            foreach (array_keys($data->completionstatusrequired) as $state) {
+                $total |= $state;
+            }
+            $data->completionstatusrequired = $total;
+        }
+
         if (!empty($data->completionunlocked)) {
-            // Turn off completion settings if the checkboxes aren't ticked
+            // Turn off completion settings if the checkboxes aren't ticked.
             $autocompletion = isset($data->completion) && $data->completion == COMPLETION_TRACKING_AUTOMATIC;
 
-            if (isset($data->completionstatusrequired) &&
-                    is_array($data->completionstatusrequired) && $autocompletion) {
-                $total = 0;
-                foreach (array_keys($data->completionstatusrequired) as $state) {
-                    $total |= $state;
-                }
-
-                $data->completionstatusrequired = $total;
+            if (isset($data->completionstatusrequired) && $autocompletion) {
+                // Do nothing: completionstatusrequired has been already converted
+                //             into a correct integer representation.
             } else {
                 $data->completionstatusrequired = null;
             }
index 39ea25f..59fa416 100644 (file)
         $PAGE->requires->js_init_call('M.core_user.init_participation', null, false, $module);
     }
 
-    if (has_capability('moodle/site:viewparticipants', $context) && $totalcount > ($perpage*3)) {
+    // Show a search box if all participants don't fit on a single screen
+    if ($totalcount > $perpage) {
         echo '<form action="index.php" class="searchform"><div><input type="hidden" name="id" value="'.$course->id.'" />';
         echo '<label for="search">' . get_string('search', 'search') . ' </label>';
         echo '<input type="text" id="search" name="search" value="'.s($search).'" />&nbsp;<input type="submit" value="'.get_string('search').'" /></div></form>'."\n";