';
+ $request->print($result);
+}
+
# --------------------------- show submissions of a student, option to grade
sub submission {
my ($request,$counter,$total) = @_;
@@ -809,7 +836,7 @@ sub submission {
my $symb=($ENV{'form.symb'} ne '' ? $ENV{'form.symb'} : (&Apache::lonnet::symbread($url)));
if ($symb eq '') { $request->print("Unable to handle ambiguous references:$url:."); return ''; }
my $last = ($ENV{'form.lastSub'} eq 'last' ? 'last' : '');
- $ENV{'form.vProb'} = $ENV{'form.vProb'} ne '' ? $ENV{'form.vProb'} : 'yes';
+# $ENV{'form.vProb'} = $ENV{'form.vProb'} ne '' ? $ENV{'form.vProb'} : 'yes';
# header info
if ($counter == 0) {
@@ -820,18 +847,7 @@ sub submission {
# option to display problem, only once else it cause problems
# with the form later since the problem has a form.
if ($ENV{'form.vProb'} eq 'yes') {
- my $rendered=&Apache::loncommon::get_student_view($symb,$uname,$udom,
- $ENV{'request.course.id'});
- my $companswer=&Apache::loncommon::get_student_answers($symb,$uname,$udom,
- $ENV{'request.course.id'});
- my $result.='
';
- $result.='
';
- $result.=' View of the problem - '.$ENV{'form.fullname'}.
- '
';
- $request->print($result);
+ &show_problem($request,$symb,$uname,$udom,0);
}
# kwclr is the only variable that is guaranteed to be non blank
@@ -894,6 +910,11 @@ KEYWORDS
}
}
+ if ($ENV{'form.vProb'} eq 'all') {
+ $request->print('
');
+ &show_problem($request,$symb,$uname,$udom,1);
+ }
+
my %record = &Apache::lonnet::restore($symb,$ENV{'request.course.id'},$udom,$uname);
my ($partlist,$handgrade) = &response_type($url);
@@ -916,44 +937,55 @@ KEYWORDS
($classlist,undef,$fullname) = &getclasslist('all','0');
for (keys (%$handgrade)) {
my $ncol = &Apache::lonnet::EXT('resource.'.$_.
- '.maxcollaborators',$symb,$udom,$uname);
- if ($ncol > 0) {
- s/\_/\./g;
- if ($record{'resource.'.$_.'.collaborators'} ne '') {
- my (@collaborators) = split(/,?\s+/,
- $record{'resource.'.$_.'.collaborators'});
- my (@badcollaborators);
- if (scalar(@collaborators) != 0) {
- $result.='Collaborators: ';
- foreach my $collaborator (@collaborators) {
- $collaborator = $collaborator =~ /\@|:/ ?
- (split(/@|:/,$collaborator))[0] : $collaborator;
- next if ($collaborator eq $uname);
- if (!grep /^$collaborator:/i,keys %$classlist) {
- push @badcollaborators,$collaborator;
- next;
- }
- push @col_list, $collaborator;
- my ($lastname,$givenn) = split(/,/,$$fullname{$collaborator.':'.$udom});
- push @col_fullnames, $givenn.' '.$lastname;
- $result.=$$fullname{$collaborator.':'.$udom}.' ';
- }
- $result.=' '."\n";
- $result.='
'."\n";
$request->print($result);
@@ -1135,9 +1173,9 @@ sub get_last_submission {
for ($version=1;$version<=$returnhash{'version'};$version++) {
foreach (sort(split(/\:/,$returnhash{$version.':keys'}))) {
$lasthash{$_}=$returnhash{$version.':'.$_};
- if ($returnhash{$version.':'.$_} =~ /(SUBMITTED|DRAFT)$/) {
+# if ($returnhash{$version.':'.$_} =~ /(SUBMITTED|DRAFT)$/) {
$timestamp = scalar(localtime($returnhash{$version.':timestamp'}));
- }
+# }
}
}
foreach ((keys %lasthash)) {
@@ -1161,8 +1199,13 @@ sub keywords_highlight {
(my $styleoff = $styleon) =~ s/\\<\//;
my @keylist = split(/[,\s+]/,$ENV{'form.keywords'});
foreach (@keylist) {
- $string =~ s/\b$_(\b|\.)/\$styleon$_$styleoff\<\/font\>/gi;
+ $string =~ s/\b\Q$_\E(\b|\.)/\$styleon$_$styleoff\<\/font\>/gi;
}
+ # This is not really the right place to do this, but I cannot find a
+ # better one at this time. So here we go - the m in the s:::mg causes
+ # ^ to match the beginning of a new line. So we replace(???) the beginning
+ # of the line with to make things formatted a little better.
+ $string =~ s:^: :mg;
return $string;
}
@@ -1183,7 +1226,7 @@ sub processHandGrade {
my $includemsg = $ENV{'form.includemsg'.$ctr};
my ($subject,$message,$msgstatus) = ('','','');
- if ($includemsg =~ /savemsg|new$ctr/) {
+ if ($includemsg =~ /savemsg|newmsg\Q$ctr\E/) {
$subject = $ENV{'form.msgsub'} if ($includemsg =~ /^msgsub/);
my (@msgnum) = split(/,/,$includemsg);
foreach (@msgnum) {
@@ -1333,8 +1376,12 @@ sub saveHandGrade {
my %newrecord;
foreach (split(/:/,$ENV{'form.partlist'.$newflg})) {
if ($ENV{'form.GD_SEL'.$newflg.'_'.$_} eq 'excused') {
- $newrecord{'resource.'.$_.'.solved'} = 'excused'
- if ($record{'resource.'.$_.'.solved'} ne 'excused');
+ if ($record{'resource.'.$_.'.solved'} ne 'excused') {
+ $newrecord{'resource.'.$_.'.solved'} = 'excused';
+ if (exists($record{'resource.'.$_.'.awarded'})) {
+ $newrecord{'resource.'.$_.'.awarded'} = '';
+ }
+ }
} else {
my $pts = ($ENV{'form.GD_BOX'.$newflg.'_'.$_} ne '' ?
$ENV{'form.GD_BOX'.$newflg.'_'.$_} :
@@ -1610,7 +1657,7 @@ sub viewgrades {
$weight{$partid}.' (problem weight)'."\n";
$result.= '