[LON-CAPA-cvs] cvs: loncom /homework imageresponse.pm inputtags.pm matchresponse.pm optionresponse.pm radiobuttonresponse.pm rankresponse.pm
raeburn
raeburn at source.lon-capa.org
Mon Apr 29 23:03:34 EDT 2013
raeburn Tue Apr 30 03:03:34 2013 EDT
Modified files:
/loncom/homework optionresponse.pm imageresponse.pm
matchresponse.pm radiobuttonresponse.pm
rankresponse.pm inputtags.pm
Log:
- Can view own submissions in anonymous surveys.
-------------- next part --------------
Index: loncom/homework/optionresponse.pm
diff -u loncom/homework/optionresponse.pm:1.189 loncom/homework/optionresponse.pm:1.190
--- loncom/homework/optionresponse.pm:1.189 Tue Dec 18 16:30:23 2012
+++ loncom/homework/optionresponse.pm Tue Apr 30 03:03:34 2013
@@ -1,7 +1,7 @@
# LearningOnline Network with CAPA
# option list style responses
#
-# $Id: optionresponse.pm,v 1.189 2012/12/18 16:30:23 raeburn Exp $
+# $Id: optionresponse.pm,v 1.190 2013/04/30 03:03:34 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -523,8 +523,15 @@
foreach $name (@whichopt) {
my $text=$Apache::response::foilgroup{$name.'.text'};
my $lastresp;
- unless ((($Apache::lonhomework::history{"resource.$part.type"} eq 'anonsurvey') || ($Apache::lonhomework::history{"resource.$part.type"} eq 'anonsurveycred')) && (defined($env{'form.grade_symb'}))) {
+ 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'}))) {
$lastresp = $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')) {
+ $lastresp = $Apache::lonhomework::history{"resource.$part.$id.submission"};
+ }
}
my %lastresponse=&Apache::lonnet::str2hash($lastresp);
my $lastopt=$lastresponse{$name};
@@ -563,7 +570,18 @@
}
}
unless ($newvariation) {
- %lastresponse=&Apache::lonnet::str2hash($Apache::lonhomework::history{"resource.$part.$id.submission"});
+ 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::lonnet::str2hash($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::lonnet::str2hash($Apache::lonhomework::history{"resource.$part.$id.submission"});
+ }
+ }
}
my $internal_counter=$Apache::lonxml::counter;
my $checkboxopt=&check_box_opt($target,$checkboxvalue, at opt);
Index: loncom/homework/imageresponse.pm
diff -u loncom/homework/imageresponse.pm:1.104 loncom/homework/imageresponse.pm:1.105
--- loncom/homework/imageresponse.pm:1.104 Fri Oct 12 12:45:46 2012
+++ loncom/homework/imageresponse.pm Tue Apr 30 03:03:34 2013
@@ -2,7 +2,7 @@
# The LearningOnline Network with CAPA
# image click response style
#
-# $Id: imageresponse.pm,v 1.104 2012/10/12 12:45:46 raeburn Exp $
+# $Id: imageresponse.pm,v 1.105 2013/04/30 03:03:34 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -391,7 +391,17 @@
@whichopt = @{$curropt};
@images = @{$currimages};
}
- my $submission = $Apache::lonhomework::history{$sub_key};
+ my $submission;
+ 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'}))) {
+ $submission = $Apache::lonhomework::history{$sub_key};
+ } else {
+ unless (($Apache::lonhomework::history{"resource.$part.type"} eq 'anonsurvey') ||
+ ($Apache::lonhomework::history{"resource.$part.type"} eq 'anonsurveycred')) {
+ $submission = $Apache::lonhomework::history{$sub_key};
+ }
+ }
my $output = &format_prior_response('grade',$submission,
[\@images,\@whichopt]);
if (defined($output)) {
@@ -543,8 +553,29 @@
if (!defined($string)) {
my $part=$Apache::inputtags::part;
my $respid=$Apache::inputtags::response['-1'];
- $string =
- $Apache::lonhomework::history{"resource.$part.$respid.submission"};
+ my $newvariation;
+ if ((($Apache::lonhomework::history{"resource.$part.type"} eq 'randomizetry') ||
+ ($Apache::lonhomework::type eq 'randomizetry')) &&
+ ($Apache::inputtags::status[-1] eq 'CAN_ANSWER')) {
+ if ($env{'form.'.$part.'.rndseed'} ne
+ $Apache::lonhomework::history{"resource.$part.rndseed"}) {
+ $newvariation = 1;
+ }
+ }
+ 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'}))) {
+ $string =
+ $Apache::lonhomework::history{"resource.$part.$respid.submission"};
+ } else {
+ unless (($Apache::lonhomework::history{"resource.$part.type"} eq 'anonsurvey') ||
+ ($Apache::lonhomework::history{"resource.$part.type"} eq 'anonsurveycred')) {
+ $string =
+ $Apache::lonhomework::history{"resource.$part.$respid.submission"};
+ }
+ }
+ }
}
if ($string !~ /=/) {
@@ -558,7 +589,7 @@
sub end_foilgroup {
my ($target,$token,$tagstack,$parstack,$parser,$safeeval,$style)=@_;
my $result='';
- my @whichopt;
+ my (@images, at whichopt);
if ($target eq 'web' || $target eq 'grade' || $target eq 'tex' ||
$target eq 'analyze' || $target eq 'answer') {
@@ -573,7 +604,7 @@
$result=&displayfoils($target, at whichopt);
if ($Apache::lonhomework::type eq 'randomizetry') {
if ($target eq 'web') {
- &get_prior_options($target, at whichopt);
+ &get_prior_options(\@images,\@whichopt);
}
}
$Apache::lonxml::post_evaluate=0;
Index: loncom/homework/matchresponse.pm
diff -u loncom/homework/matchresponse.pm:1.88 loncom/homework/matchresponse.pm:1.89
--- loncom/homework/matchresponse.pm:1.88 Thu Apr 25 17:58:32 2013
+++ loncom/homework/matchresponse.pm Tue Apr 30 03:03:34 2013
@@ -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.89 2013/04/30 03:03:34 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -652,9 +652,19 @@
$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));
Index: loncom/homework/radiobuttonresponse.pm
diff -u loncom/homework/radiobuttonresponse.pm:1.156 loncom/homework/radiobuttonresponse.pm:1.157
--- loncom/homework/radiobuttonresponse.pm:1.156 Thu Apr 25 17:58:32 2013
+++ loncom/homework/radiobuttonresponse.pm Tue Apr 30 03:03:34 2013
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# mutliple choice style responses
#
-# $Id: radiobuttonresponse.pm,v 1.156 2013/04/25 17:58:32 bisitz Exp $
+# $Id: radiobuttonresponse.pm,v 1.157 2013/04/30 03:03:34 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -376,24 +376,19 @@
}
}
$showanswer = &Apache::response::show_answer();
- unless (
- (
- (
- $Apache::lonhomework::history{"resource.$part.type"} eq
- 'anonsurvey'
- )
- || ( $Apache::lonhomework::history{"resource.$part.type"} eq
- 'anonsurveycred' )
- )
- && ( defined( $env{'form.grade_symb'} ) )
- || ( $newvariation && !$showanswer )
- )
- {
- $lastresponse =
- $Apache::lonhomework::history{"resource.$part.$id.submission"};
+ unless ($newvariation && !$showanswer) {
+ 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);
-
return \%lastresponse;
@@ -874,9 +869,21 @@
}
}
unless ($newvariation) {
- $lastresponse =
- $Apache::lonhomework::history{"resource.$part.$id.submission"};
+ 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);
return \%lastresponse;
Index: loncom/homework/rankresponse.pm
diff -u loncom/homework/rankresponse.pm:1.68 loncom/homework/rankresponse.pm:1.69
--- loncom/homework/rankresponse.pm:1.68 Fri Oct 12 12:45:46 2012
+++ loncom/homework/rankresponse.pm Tue Apr 30 03:03:34 2013
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# rank style response
#
-# $Id: rankresponse.pm,v 1.68 2012/10/12 12:45:46 raeburn Exp $
+# $Id: rankresponse.pm,v 1.69 2013/04/30 03:03:34 raeburn Exp $
# Copyright Michigan State University Board of Trustees
#
# This file is part of the LearningOnline Network with CAPA (LON-CAPA).
@@ -377,8 +377,17 @@
$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 @alp = splice @alphabet, 0, $#whichopt + 1;
Index: loncom/homework/inputtags.pm
diff -u loncom/homework/inputtags.pm:1.316 loncom/homework/inputtags.pm:1.317
--- loncom/homework/inputtags.pm:1.316 Fri Apr 26 18:08:48 2013
+++ loncom/homework/inputtags.pm Tue Apr 30 03:03:34 2013
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# input definitons
#
-# $Id: inputtags.pm,v 1.316 2013/04/26 18:08:48 bisitz Exp $
+# $Id: inputtags.pm,v 1.317 2013/04/30 03:03:34 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -216,7 +216,16 @@
}
}
unless ($newvariation) {
- $oldresponse = $Apache::lonhomework::history{"resource.$partid.$resid.submission"};
+ 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'}))) {
+ $oldresponse = $Apache::lonhomework::history{"resource.$partid.$resid.submission"};
+ } elsif (($Apache::lonhomework::history{"resource.$partid.type"} eq 'anonsurvey') ||
+ ($Apache::lonhomework::history{"resource.$partid.type"} eq 'anonsurveycred')) {
+ $oldresponse = '* '.&mt('only shown to submitter').' *';
+ } else {
+ $oldresponse = $Apache::lonhomework::history{"resource.$partid.$resid.submission"};
+ }
}
if ($Apache::inputtags::status[-1] eq 'CAN_ANSWER') {
my $cols = &Apache::lonxml::get_param('cols',$parstack,$safeeval);
@@ -407,7 +416,18 @@
}
}
unless ($newvariation) {
- $oldresponse = $Apache::lonhomework::history{"resource.$partid.$id.submission"};
+ 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'}))) {
+ $oldresponse = $Apache::lonhomework::history{"resource.$partid.$id.submission"};
+ } elsif (($Apache::lonhomework::history{"resource.$partid.type"} eq 'anonsurvey') ||
+ ($Apache::lonhomework::history{"resource.$partid.type"} eq 'anonsurveycred') ||
+ ($Apache::lonhomework::type eq 'anonsurvey') ||
+ ($Apache::lonhomework::type eq 'anonsurveycred')) {
+ $oldresponse = '* '.&mt('only shown to submitter').' *';
+ } else {
+ $oldresponse = $Apache::lonhomework::history{"resource.$partid.$id.submission"};
+ }
&Apache::lonxml::debug("oldresponse $oldresponse is ".ref($oldresponse));
if (ref($oldresponse) eq 'ARRAY') {
$oldresponse = $oldresponse->[$#Apache::inputtags::inputlist];
More information about the LON-CAPA-cvs
mailing list