--- loncom/homework/matchresponse.pm 2013/04/25 17:58:32 1.88
+++ loncom/homework/matchresponse.pm 2018/06/08 11:57:57 1.92.2.1
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Full matching style response
#
-# $Id: matchresponse.pm,v 1.88 2013/04/25 17:58:32 bisitz Exp $
+# $Id: matchresponse.pm,v 1.92.2.1 2018/06/08 11:57:57 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -55,7 +55,7 @@ sub start_matchresponse {
$result=&Apache::response::meta_package_write('matchresponse');
} elsif ($target eq 'edit' ) {
$result.=&Apache::edit::start_table($token).
- '
'.&Apache::lonxml::description($token).' | '
+ '
'.&Apache::loncommon::insert_folding_button().&Apache::lonxml::description($token).' | '
.''.&mt('Delete?').' '
.&Apache::edit::deletelist($target,$token)
.' | '
@@ -319,7 +319,8 @@ sub start_foilgroup {
&Apache::response::pushrandomnumber(undef,$target);
if ($target eq 'edit') {
$result.=&Apache::edit::start_table($token)
- .'
'.&mt('Collection Of Foils').' | '
+ .'
'.&Apache::loncommon::insert_folding_button()
+ .&mt('Collection Of Foils').' | '
.''.&mt('Delete?')
.&Apache::edit::deletelist($target,$token)
.' | '
@@ -580,7 +581,10 @@ sub format_prior_answer {
my $output;
foreach my $name (@{ $foil_order }) {
- my $item=shift(@items);
+ my $item = &HTML::Entities::encode(shift(@items),'<>&"');
+ if ($item eq '') {
+ $item = ' ';
+ }
$output .= '
'.$item.' |
';
}
return if (!defined($output));
@@ -652,9 +656,19 @@ sub displayfoils {
$newvariation = 1;
}
}
- unless ((($Apache::lonhomework::history{"resource.$part.type"} eq 'anonsurvey') || ($Apache::lonhomework::history{"resource.$part.type"} eq 'anonsurveycred') && (defined($env{'form.grade_symb'}))) || $newvariation) {
- $lastresponse=$Apache::lonhomework::history{"resource.$part.$id.submission"};
+ unless ($newvariation) {
+ if ((($env{'form.grade_username'} eq '') && ($env{'form.grade_domain'} eq '')) ||
+ (($env{'form.grade_username'} eq $env{'user.name'}) &&
+ ($env{'form.grade_domain'} eq $env{'user.domain'}))) {
+ $lastresponse=$Apache::lonhomework::history{"resource.$part.$id.submission"};
+ } else {
+ unless (($Apache::lonhomework::history{"resource.$part.type"} eq 'anonsurvey') ||
+ ($Apache::lonhomework::history{"resource.$part.type"} eq 'anonsurveycred')) {
+ $lastresponse=$Apache::lonhomework::history{"resource.$part.$id.submission"};
+ }
+ }
}
+
my %lastresponse=&Apache::lonnet::str2hash($lastresponse);
my @alphabet=('A'..'Z');
my @used_letters=sort(keys(%letter_name_map));
@@ -671,7 +685,7 @@ sub displayfoils {
my $last_letter=$name_letter_map{$lastopt};
my $optionlist = '';
if ($target ne 'tex') {
- $optionlist="\n";
+ $optionlist="\n";
} else {
if ($Apache::lonhomework::type ne 'exam') {
if($env{'form.pdfFormFields'} eq 'yes'
@@ -688,7 +702,7 @@ sub displayfoils {
foreach $option (@used_letters) {
if ($option eq $last_letter) {
if ($target ne 'tex') {
- $optionlist.="\n";
+ $optionlist.="\n";
} elsif ($target eq 'tex' && $env{'form.pdfFormFields'} eq 'yes'
&& $Apache::inputtags::status['-1'] eq 'CAN_ANSWER'
&& $Apache::lonhomework::type ne 'exam') {
@@ -696,7 +710,7 @@ sub displayfoils {
}
} else {
if ($target ne 'tex') {
- $optionlist.="\n";
+ $optionlist.="\n";
} elsif ($target eq 'tex' && $env{'form.pdfFormFields'} eq 'yes'
&& $Apache::inputtags::status['-1'] eq 'CAN_ANSWER'
&& $Apache::lonhomework::type ne 'exam') {