--- loncom/homework/essayresponse.pm 2010/09/13 04:23:00 1.101.10.2
+++ loncom/homework/essayresponse.pm 2010/08/29 19:36:37 1.112
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# essay (ungraded) style responses
#
-# $Id: essayresponse.pm,v 1.101.10.2 2010/09/13 04:23:00 raeburn Exp $
+# $Id: essayresponse.pm,v 1.112 2010/08/29 19:36:37 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -58,25 +58,27 @@ sub start_essayresponse {
if (!defined($maxfilesize)) {
$maxfilesize = 10.0; #FIXME This should become a domain configuration
}
- if ( $Apache::lonhomework::type eq 'survey' ) {
- $result.= ' ';
+ if (($Apache::lonhomework::type eq 'survey') ||
+ ($Apache::lonhomework::type eq 'surveycred') ||
+ ($Apache::lonhomework::type eq 'anonsurvey') ||
+ ($Apache::lonhomework::type eq 'anonsurveycred')) {
+ $result.= '';
}
my $status_text = &mt('Submission type');
if ($Apache::lonhomework::history{"resource.$part.award"} eq 'DRAFT') {
$status_text .= '
'.&mt('(Currently -- draft)');
}
- $result.= '
'.&Apache::lonhtmlcommon::start_pick_box(); - if ( $Apache::lonhomework::type ne 'survey' ) { - if ($env{'request.uri'} eq '/res/gci/gci/internal/submission.problem') { - - $result .= ''; - } else { - $result .= &Apache::lonhtmlcommon::row_title($status_text); - my $closure; - unless ($ncol || $uploadedfiletypes) { - $closure = 1; - } - $result.= + $result.= '
'.&Apache::lonhtmlcommon::start_pick_box().
+ &Apache::lonhtmlcommon::row_title($status_text);
+ if (($Apache::lonhomework::type ne 'survey') &&
+ ($Apache::lonhomework::type ne 'surveycred') &&
+ ($Apache::lonhomework::type ne 'anonsurvey') &&
+ ($Apache::lonhomework::type ne 'anonsurveycred')) {
+ my $closure;
+ unless ($ncol || $uploadedfiletypes) {
+ $closure = 1;
+ }
+ $result.=
''.
- &Apache::lonhtmlcommon::row_closure($closure);
- }
+ &Apache::lonhtmlcommon::row_closure($closure);
}
+
if ($ncol > 0) {
$result.= &Apache::lonhtmlcommon::row_title(&mt('Collaborators')).
'
';
$result .= &check_collaborators($ncol,$coll) if ($coll =~ /\w+/);
- $result .= &Apache::lonhtmlcommon::row_closure();
+ $result .= &Apache::lonhtmlcommon::row_closure();
}
my $filesfrom = 'both';
my $stuname = &Apache::lonnet::EXT('user.name');
@@ -141,12 +143,14 @@ sub end_essayresponse {
my $increment = &Apache::response::repetition();
my $result;
if ( $target eq 'grade' ) {
- my $collaborators = $env{'form.HWCOL'.$part.'_'.$id};
- if ($collaborators =~ /[^\s]/) {
- my $previous_list= &HTML::Entities::encode($Apache::lonhomework::history{"resource.$part.$id.collaborators"},'<>&"');
- $Apache::lonhomework::results{"resource.$part.$id.collaborators"}=$collaborators
- if ($collaborators ne $previous_list);
- }
+# Deal with collaborators
+ my $collaborators = $env{'form.HWCOL'.$part.'_'.$id};
+ my $previous_list= &HTML::Entities::encode($Apache::lonhomework::history{"resource.$part.$id.collaborators"},'<>&"');
+ if ($collaborators ne $previous_list) {
+# &Apache::lonnet::logthis("New collaborators [$collaborators] [$previous_list]");
+ $Apache::lonhomework::results{"resource.$part.$id.collaborators"}=$collaborators;
+ }
+# Scantron
if ( &Apache::response::submitted('scantron') ) {
$increment=&Apache::response::scored_response($part,$id);
} elsif ( &Apache::response::submitted() ) {
@@ -166,9 +170,17 @@ sub end_essayresponse {
}
if (($response =~ /[^\s]/) || ($filename =~ /[^\s]/) || ($portfiles =~ /[^\s]/) ||
(@deletions > 0) || ($was_draft && $is_submit)) {
- my $award='DRAFT';
+ my $award='DRAFT';
if ($env{'form.HWDRAFT'.$part.'_'.$id} eq 'yes') {
- $award='SUBMITTED';
+ if ($Apache::lonhomework::type eq 'anonsurvey') {
+ $award='ANONYMOUS';
+ } elsif ($Apache::lonhomework::type eq 'anonsurveycred') {
+ $award='ANONYMOUS_CREDIT';
+ } elsif ($Apache::lonhomework::type eq 'surveycred') {
+ $award='SUBMITTED_CREDIT';
+ } else {
+ $award='SUBMITTED';
+ }
}
my $uploadedflag=0;
my $totalsize=0;
@@ -202,7 +214,7 @@ sub end_essayresponse {
{ $akey => $response },$adom,$aname);
}
}
- }
+ }
}
} elsif ($target eq 'edit') {
$result.=&Apache::edit::end_table();
@@ -295,7 +307,7 @@ sub file_submission {
if (grep(/^\Q$file\E$/,@portfiles)) {
$port_delete{$file} = 1;
} elsif ($file =~ m{^/uploaded/\Q$udom\E/\Q$uname\E/essayresponse/\Q$cdom\E/\Q$cnum\E/}) {
- $uploaded_delete = $file;
+ $uploaded_delete = $file;
} elsif ($file =~ m{^/uploaded/\Q$udom\E/\Q$uname\E/essayresponse/[^/]+$}) {
$uploaded_delete = $file;
}
@@ -387,7 +399,7 @@ sub file_submission {
if (ref($dirlist{$fullpath}) eq 'ARRAY') {
foreach my $dir_line (@{$dirlist{$fullpath}}) {
my ($fname,$dom,undef,$testdir,undef,undef,undef,undef,
- $size,undef,$mtime,undef,undef,undef,$obs,undef) =
+ $size,undef,$mtime,undef,undef,undef,$obs,undef) =
split(/\&/,$dir_line,16);
if ($filename eq $fname) {
my $mbsize = $size/(1024.0*1024.0);
@@ -493,9 +505,9 @@ sub file_submission {
$Apache::lonhomework::results{"resource.$part.$id.portfiles"} = $stored_upload;
push(@tolock,$stored_upload);
} else {
- $$award = 'INTERNAL_ERROR';
+ $$award = 'INTERNAL_ERROR';
}
- }
+ }
delete($env{'form.HWFILE'.$jspart.'_'.$id});
}
if (@accepted_portfiles) {