Merge branch 'MDL-38973-master' of https://github.com/damyon/moodle
authorDan Poltawski <dan@moodle.com>
Wed, 10 Apr 2013 06:48:49 +0000 (14:48 +0800)
committerDan Poltawski <dan@moodle.com>
Wed, 10 Apr 2013 06:48:49 +0000 (14:48 +0800)
lib/form/yui/dateselector/dateselector.js
lib/outputrenderers.php
mod/assign/locallib.php
mod/assignment/lib.php
mod/assignment/type/online/assignment.class.php
mod/assignment/type/uploadsingle/assignment.class.php
question/format/xhtml/format.php

index 4d490e4..08beea6 100644 (file)
@@ -86,9 +86,11 @@ YUI.add('moodle-form-dateselector', function(Y) {
                     node.on('click', this.toggle_calendar_image, this);
                     // Set the node to the enablecheckbox variable.
                     this.enablecheckbox = node;
+                }
+                // Ensure that the calendarimage and enablecheckbox values have been set.
+                if (this.calendarimage && this.enablecheckbox) {
                     // Set the calendar icon status depending on the value of the checkbox.
-                    // QUICK HACK to keep JS working. MDL-26649. FIXME!
-                    // this.toggle_calendar_image();
+                    this.toggle_calendar_image();
                 }
             }, this);
         },
index f2bfe9c..04fed8f 100644 (file)
@@ -563,7 +563,9 @@ class core_renderer extends renderer_base {
             $realuser = session_get_realuser();
             $fullname = fullname($realuser, true);
             if ($withlinks) {
-                $realuserinfo = " [<a href=\"$CFG->wwwroot/course/loginas.php?id=$course->id&amp;sesskey=".sesskey()."\">$fullname</a>] ";
+                $loginastitle = get_string('loginas');
+                $realuserinfo = " [<a href=\"$CFG->wwwroot/course/loginas.php?id=$course->id&amp;sesskey=".sesskey()."\"";
+                $realuserinfo .= "title =\"".$loginastitle."\">$fullname</a>] ";
             } else {
                 $realuserinfo = " [$fullname] ";
             }
@@ -582,7 +584,8 @@ class core_renderer extends renderer_base {
             $fullname = fullname($USER, true);
             // Since Moodle 2.0 this link always goes to the public profile page (not the course profile page)
             if ($withlinks) {
-                $username = "<a href=\"$CFG->wwwroot/user/profile.php?id=$USER->id\">$fullname</a>";
+                $linktitle = get_string('viewprofile');
+                $username = "<a href=\"$CFG->wwwroot/user/profile.php?id=$USER->id\" title=\"$linktitle\">$fullname</a>";
             } else {
                 $username = $fullname;
             }
index 96fb47b..5ba28a6 100644 (file)
@@ -5315,7 +5315,7 @@ class assign {
         }
 
         $flags = $this->get_user_flags($userid, true);
-        $flags->locked = 1;
+        $flags->locked = 0;
         $this->update_user_flags($flags);
 
         $user = $DB->get_record('user', array('id' => $userid), '*', MUST_EXIST);
index 7bd8064..5d4d136 100644 (file)
@@ -165,6 +165,12 @@ class assignment_base {
 
         $this->view_dates();
 
+        if ($this->isopen() && $this->assignment->timedue > 0 && $this->assignment->timedue < time()) {
+            echo $OUTPUT->heading(get_string('closedassignment','assignment'), 3);
+        } else if ($this->assignment->timeavailable > time()) {
+            echo $OUTPUT->heading(get_string('futureaassignment','assignment'), 3);
+        }
+
         $this->view_feedback();
 
         $this->view_footer();
index a917d31..103a8dd 100644 (file)
@@ -127,7 +127,9 @@ class assignment_online extends assignment_base {
                         $button->render();
                     }
                 } else if ($this->isopen()){    //fix for #4206
-                    echo '<div style="text-align:center">'.get_string('emptysubmission', 'assignment').'</div>';
+                    echo $OUTPUT->heading(get_string('emptysubmission','assignment'), 3);
+                } else if ($this->assignment->timeavailable > time()) {
+                    echo $OUTPUT->heading(get_string('futureaassignment','assignment'), 3);
                 }
             }
             echo $OUTPUT->box_end();
index 039071c..7f399e7 100644 (file)
@@ -85,8 +85,12 @@ class assignment_uploadsingle extends assignment_base {
             }
         }
 
-        if (is_enrolled($this->context, $USER, 'mod/assignment:submit') && $this->isopen() && (!$filecount || $this->assignment->resubmit || !$submission->timemarked)) {
-            $this->view_upload_form();
+        if (is_enrolled($this->context, $USER, 'mod/assignment:submit') && (!$filecount || $this->assignment->resubmit || !$submission->timemarked)) {
+            if ($this->isopen()) {
+                $this->view_upload_form();
+            } else if ($this->assignment->timeavailable > time()) {
+                echo $OUTPUT->heading(get_string('futureaassignment','assignment'), 3);
+            }
         }
 
         $this->view_footer();
index 256db70..21db81d 100644 (file)
@@ -130,11 +130,13 @@ class qformat_xhtml extends qformat_default {
             foreach($question->options->subquestions as $subquestion) {
                 // build drop down for answers
                 $quest_text = $this->repchar( $subquestion->questiontext );
-                $dropdown = html_writer::label(get_string('answer', 'qtype_match', $option+1), 'quest_'.$id.'_'.$option, false, array('class' => 'accesshide'));
-                $dropdown .= html_writer::select($selectoptions, "quest_{$id}_{$option}", '', false, array('id' => "quest_{$id}_{$option}"));
-                $expout .= html_writer::tag('li', $quest_text);
-                $expout .= $dropdown;
-                $option++;
+                if ($quest_text != '') {
+                    $dropdown = html_writer::label(get_string('answer', 'qtype_match', $option+1), 'quest_'.$id.'_'.$option, false, array('class' => 'accesshide'));
+                    $dropdown .= html_writer::select($selectoptions, "quest_{$id}_{$option}", '', false, array('id' => "quest_{$id}_{$option}"));
+                    $expout .= html_writer::tag('li', $quest_text);
+                    $expout .= $dropdown;
+                    $option++;
+                }
             }
             $expout .= html_writer::end_tag('ul');
             break;