';
+ my $display_part=&get_display_part($partID,$symb);
+ $result.='
Part: '.$display_part.' '.
+ $resID.'
'.
+ '
Type: '.$responsetype.'
';
# '
Handgrade: '.$handgrade.'
';
+ }
}
$result.=''."\n";
return $result,$responseType,$hdgrade,$partlist,$handgrade;
@@ -589,7 +593,7 @@ sub verifyreceipt {
my $receipt = &Apache::lonnet::recprefix($courseid).'-'.
$env{'form.receipt'};
$receipt =~ s/[^\-\d]//g;
- my $symb = &Apache::lonnet::symbread();
+ my ($symb) = &get_symb($request);
my $title.='
Verifying Submission Receipt '.
$receipt.'
'."\n".
@@ -599,7 +603,8 @@ sub verifyreceipt {
my (undef,undef,$fullname) = &getclasslist('all','0');
my $receiptparts=0;
- if ($env{"course.$courseid.receiptalg"} eq 'receipt2') { $receiptparts=1; }
+ if ($env{"course.$courseid.receiptalg"} eq 'receipt2' ||
+ $env{"course.$courseid.receiptalg"} eq 'receipt3') { $receiptparts=1; }
my $parts=['0'];
if ($receiptparts) { ($parts)=&response_type($symb); }
foreach (sort
@@ -1470,7 +1475,8 @@ sub get_increment {
#--- displays the grading box, used in essay type problem and grading by page/sequence
sub gradeBox {
my ($request,$symb,$uname,$udom,$counter,$partid,$record) = @_;
- my $checkIcon = '';
my $wgt = &Apache::lonnet::EXT('resource.'.$partid.'.weight',$symb,$udom,$uname);
my $wgtmsg = ($wgt > 0 ? '(problem weight)' :
@@ -1493,10 +1499,10 @@ sub gradeBox {
my $increment = &get_increment();
$result.='
'."\n"; # display radio buttons in a nice table 10 across
while ($thisweight<=$wgt) {
- $result.= '
' : '');
$thisweight += $increment;
$ctr++;
@@ -1513,14 +1519,14 @@ sub gradeBox {
$result.=''."\n";
- $result.="  \n";
+ $result.=" \n";
$result.=''."\n".
''."\n".
''.$file_disp.'');
$result.=''."\n";
$result.=' ';
+ $result.='(File will be uploaded when you click on Save & Next below.) ';
$file_counter++;
}
}
@@ -1568,23 +1576,27 @@ sub handback_box {
}
sub show_problem {
- my ($request,$symb,$uname,$udom,$removeform,$viewon,$mode) = @_;
+ my ($request,$symb,$uname,$udom,$removeform,$viewon,$mode,$form) = @_;
my $rendered;
+ my %form = ((ref($form) eq 'HASH')? %{$form} : ());
&Apache::lonxml::remember_problem_counter();
if ($mode eq 'both' or $mode eq 'text') {
$rendered=&Apache::loncommon::get_student_view($symb,$uname,$udom,
- $env{'request.course.id'});
+ $env{'request.course.id'},
+ undef,\%form);
}
if ($removeform) {
$rendered=~s|||g;
- $rendered=~s|name="submit"|name="would_have_been_submit"|g;
+ $rendered=~s|(]*name\s*=\s*"?)(\w+)("?)|$1would_have_been_$2$3|g;
}
my $companswer;
if ($mode eq 'both' or $mode eq 'answer') {
&Apache::lonxml::restore_problem_counter();
- $companswer=&Apache::loncommon::get_student_answers($symb,$uname,$udom,
- $env{'request.course.id'});
+ $companswer=
+ &Apache::loncommon::get_student_answers($symb,$uname,$udom,
+ $env{'request.course.id'},
+ %form);
}
if ($removeform) {
$companswer=~s|
';
return $result;
}
-
+sub download_all_link {
+ my ($r,$symb) = @_;
+ my $courseid=$env{'request.course.id'};
+ my @stuchecked = &Apache::loncommon::get_env_multiple('form.stuinfo');
+ my $parts;
+ my $total = scalar(@stuchecked)-1;
+ my $all_students;
+ foreach my $stu_info (@stuchecked) {
+ $all_students .= $stu_info."\n";
+ }
+ foreach my $part (&Apache::loncommon::get_env_multiple('form.vPart')) {
+ $parts .= $part."\n";
+ }
+ my $identifier = &Apache::loncommon::get_cgi_id();
+ &Apache::lonnet::appenv('cgi.'.$identifier.'.students' => $all_students,
+ 'cgi.'.$identifier.'.symb' => $symb,
+ 'cgi.'.$identifier.'.parts' => $parts,
+ 'cgi.'.$identifier.'.courseid' => $courseid);
+ $r->print('Download All Submitted Documents');
+ return
+}
# --------------------------- show submissions of a student, option to grade
sub submission {
my ($request,$counter,$total) = @_;
@@ -1639,7 +1671,8 @@ sub submission {
if (!$env{'form.vProb'}) { $env{'form.vProb'} = 'yes'; }
if (!$env{'form.vAns'}) { $env{'form.vAns'} = 'yes'; }
my $last = ($env{'form.lastSub'} eq 'last' ? 'last' : '');
- my $checkIcon = '';
# header info
@@ -1648,7 +1681,7 @@ sub submission {
&sub_page_kw_js($request) if ($env{'form.handgrade'} eq 'yes');
$env{'form.probTitle'} = $env{'form.probTitle'} eq '' ?
&Apache::lonnet::gettitle($symb) : $env{'form.probTitle'};
-
+ &download_all_link($request,$symb);
$request->print('
Submission Record
'."\n".
' Resource: '.$env{'form.probTitle'}.''."\n");
@@ -1751,7 +1784,7 @@ KEYWORDS
# Load the other essays for similarity check
#
my (undef,undef,$essayurl) = &Apache::lonnet::decode_symb($symb);
- my ($adom,$aname,$apath)=($essayurl=~/^(\w+)\/(\w+)\/(.*)$/);
+ my ($adom,$aname,$apath)=($essayurl=~/^($LONCAPA::domain_re)\/($LONCAPA::username_re)\/(.*)$/);
$apath=&escape($apath);
$apath=~s/\W/\_/gs;
%oldessays=&Apache::lonnet::dump('nohist_essay_'.$apath,$adom,$aname);
@@ -1857,8 +1890,12 @@ KEYWORDS
$lastsubonly.='
'.$$string[0];
} else {
my %seenparts;
- for my $part (sort keys(%$handgrade)) {
- my ($partid,$respid) = split(/_/,$part);
+ my @part_response_id = &flatten_responseType($responseType);
+ foreach my $part (@part_response_id) {
+ next if ($env{'form.lastSub'} eq 'hdgrade'
+ && $$handgrade{$$part[0].'_'.$$part[1]} ne 'yes');
+
+ my ($partid,$respid) = @{ $part };
my $display_part=&get_display_part($partid,$symb);
if ($env{"form.$uname:$udom:$partid:submitted_by"}) {
if (exists($seenparts{$partid})) { next; }
@@ -1882,7 +1919,7 @@ KEYWORDS
}
foreach (@$string) {
my ($partid,$respid) = /^resource\.([^\.]*)\.([^\.]*)\.submission/;
- if ($part ne ($partid.'_'.$respid)) { next; }
+ if (join('_',@{$part}) ne ($partid.'_'.$respid)) { next; }
my ($ressub,$subval) = split(/:/,$_,2);
# Similarity check
my $similar='';
@@ -1902,10 +1939,10 @@ KEYWORDS
my $order=&get_order($partid,$respid,$symb,$uname,$udom);
if ($env{'form.lastSub'} eq 'lastonly' ||
($env{'form.lastSub'} eq 'hdgrade' &&
- $$handgrade{$part} eq 'yes')) {
+ $$handgrade{$$part[0].'_'.$$part[1]} eq 'yes')) {
my $display_part=&get_display_part($partid,$symb);
- $lastsubonly.='
Part: '.
- $display_part.' ( ID '.$respid.
+ $lastsubonly.='
Debug -'.'Part: '.
+ $display_part.' ( hhhh ID '.$respid.
' ) ';
my $files=&get_submitted_files($udom,$uname,$partid,$respid,\%record);
if (@$files) {
@@ -1992,11 +2029,14 @@ KEYWORDS
my %seen = ();
my @partlist;
my @gradePartRespid;
- for my $part_resp (sort(keys(%$handgrade))) {
- my ($partid,$respid) = split(/_/, $part_resp);
+ my @part_response_id = &flatten_responseType($responseType);
+ foreach my $part_response_id (@part_response_id) {
+ my ($partid,$respid) = @{ $part_response_id };
+ my $part_resp = join('_',@{ $part_response_id });
next if ($seen{$partid} > 0);
$seen{$partid}++;
- next if ($$handgrade{$part_resp} =~ /:no$/ && $env{'form.lastSub'} =~ /^(hdgrade)$/);
+ next if ($$handgrade{$part_resp} ne 'yes'
+ && $env{'form.lastSub'} eq 'hdgrade');
push @partlist,$partid;
push @gradePartRespid,$partid.'.'.$respid;
$request->print(&gradeBox($request,$symb,$uname,$udom,$counter,$partid,\%record));
@@ -2106,10 +2146,22 @@ sub processHandGrade {
}
my $includemsg = $env{'form.includemsg'.$ctr};
my ($subject,$message,$msgstatus) = ('','','');
+ my $restitle = &Apache::lonnet::gettitle($symb);
+ my $encrypturl=&Apache::lonnet::EXT('resource.0.encrypturl',
+ $symb,$udom,$uname);
+ my ($feedurl,$baseurl,$showsymb,$messagetail);
+ $feedurl = &Apache::lonnet::clutter($url);
+ if ($encrypturl =~ /^yes$/i) {
+ $baseurl = &Apache::lonenc::encrypted($feedurl,1);
+ $showsymb = &Apache::lonenc::encrypted($symb,1);
+ } else {
+ $baseurl = $feedurl;
+ $showsymb = $symb;
+ }
if ($includemsg =~ /savemsg|newmsg\Q$ctr\E/) {
$subject = $env{'form.msgsub'} if ($includemsg =~ /msgsub/);
unless ($subject=~/\w/) { $subject=&mt('Grading Feedback'); }
- $subject.=' ['.&Apache::lonnet::declutter($url).']';
+ $subject.=' ['.$restitle.']';
my (@msgnum) = split(/,/,$includemsg);
foreach (@msgnum) {
$message.=$env{'form.'.$_} if ($_ =~ /savemsg|newmsg/ && $_ ne '');
@@ -2117,14 +2169,16 @@ sub processHandGrade {
$message =&Apache::lonfeedback::clear_out_html($message);
if ($env{'form.withgrades'.$ctr}) {
$message.="\n\nPoint".($pts > 1 ? 's':'').' awarded = '.$pts.' out of '.$wgt;
- $message.=" for $env{'form.probTitle'}";
- }
- $msgstatus = &Apache::lonmsg::user_normal_msg($uname,$udom,
- $subject,
- $message);
- $request->print(' '.&mt('Sending message to [_1]@[_2]',$uname,$udom).': '.
+ $messagetail = " for $env{'form.probTitle'}";
+ }
+ $msgstatus =
+ &Apache::lonmsg::user_normal_msg($uname,$udom,$subject,
+ $message.$messagetail,
+ undef,$baseurl,undef,
+ undef,undef,$showsymb,
+ $restitle);
+ $request->print(' '.&mt('Sending message to [_1]:[_2]',$uname,$udom).': '.
$msgstatus);
}
if ($env{'form.collaborator'.$ctr}) {
@@ -2140,7 +2194,23 @@ sub processHandGrade {
next;
} else {
if ($message ne '') {
- $msgstatus = &Apache::lonmsg::user_normal_msg($collaborator,$udom,$subject,$message);
+ $encrypturl=
+ &Apache::lonnet::EXT('resource.0.encrypturl',
+ $symb,$udom,$collaborator);
+ if ($encrypturl =~ /^yes$/i) {
+ $baseurl = &Apache::lonenc::encrypted($feedurl,1);
+ $showsymb = &Apache::lonenc::encrypted($symb,1);
+ } else {
+ $baseurl = $feedurl;
+ $showsymb = $symb;
+ }
+ if ($env{'form.withgrades'.$ctr}) {
+ $messagetail = " for $env{'form.probTitle'}";
+
+ }
+ $msgstatus =
+ &Apache::lonmsg::user_normal_msg($collaborator,$udom,$subject,$message.$messagetail,undef,$baseurl,undef,undef,undef,$showsymb,$restitle);
}
}
}
@@ -2416,17 +2486,8 @@ sub saveHandGrade {
}
&Apache::lonnet::cstore(\%newrecord,$symb,
$env{'request.course.id'},$domain,$stuname);
- my @ungraded_parts;
- foreach my $part (@parts) {
- if ( !defined($record{'resource.'.$part.'.awarded'})
- && !defined($newrecord{'resource.'.$part.'.awarded'}) ) {
- push(@ungraded_parts, $part);
- }
- }
- if ( !@ungraded_parts ) {
- &Apache::bridgetask::remove_from_queue('gradingqueue',$symb,$cdom,
- $cnum,$domain,$stuname);
- }
+ &check_and_remove_from_queue(\@parts,\%record,\%newrecord,$symb,
+ $cdom,$cnum,$domain,$stuname);
}
if ($aggregateflag) {
&Apache::lonnet::cinc('nohist_resourcetracker',\%aggregate,
@@ -2435,12 +2496,33 @@ sub saveHandGrade {
return ('',$pts,$wgt);
}
+sub check_and_remove_from_queue {
+ my ($parts,$record,$newrecord,$symb,$cdom,$cnum,$domain,$stuname) = @_;
+ my @ungraded_parts;
+ foreach my $part (@{$parts}) {
+ if ( $record->{ 'resource.'.$part.'.awarded'} eq ''
+ && $record->{ 'resource.'.$part.'.solved' } ne 'excused'
+ && $newrecord->{'resource.'.$part.'.awarded'} eq ''
+ && $newrecord->{'resource.'.$part.'.solved' } ne 'excused'
+ ) {
+ push(@ungraded_parts, $part);
+ }
+ }
+ if ( !@ungraded_parts ) {
+ &Apache::bridgetask::remove_from_queue('gradingqueue',$symb,$cdom,
+ $cnum,$domain,$stuname);
+ }
+}
+
sub handback_files {
my ($request,$symb,$stuname,$domain,$newflg,$new_part,$newrecord) = @_;
my $portfolio_root = &propath($domain,$stuname).'/userfiles/portfolio';
my ($partlist,$handgrade,$responseType) = &response_type($symb);
- foreach my $part_resp (sort(keys(%$handgrade))) {
- my ($part_id, $resp_id) = split(/_/,$part_resp);
+
+ my @part_response_id = &flatten_responseType($responseType);
+ foreach my $part_response_id (@part_response_id) {
+ my ($part_id,$resp_id) = @{ $part_response_id };
+ my $part_resp = join('_',@{ $part_response_id });
if (($env{'form.'.$newflg.'_'.$part_resp.'_returndoc1'}) && ($new_part == $part_id)) {
# if multiple files are uploaded names will be 'returndoc2','returndoc3'
my $file_counter = 1;
@@ -2465,7 +2547,7 @@ sub handback_files {
} else {
# mark the file as read only
my @files = ($save_file_name);
- my @what = ($symb,'handback');
+ my @what = ($symb,$env{'request.course.id'},'handback');
&Apache::lonnet::mark_as_readonly($domain,$stuname,\@files,\@what);
if (exists($$newrecord{"resource.$new_part.$resp_id.handback"})) {
$$newrecord{"resource.$new_part.$resp_id.handback"}.=',';
@@ -2484,10 +2566,22 @@ sub handback_files {
$message .= ' The returned file(s) are named: '. $file_msg;
$message .= " and can be found in your portfolio space.";
my $url = (&Apache::lonnet::decode_symb($symb))[2];
- $url = &Apache::lonnet::declutter($url);
- my $msgstatus = &Apache::lonmsg::user_normal_msg($stuname,$domain,
- $subject.' (File Returned) ['.$url.']',$message);
-
+ my $feedurl = &Apache::lonnet::clutter($url);
+ my $encrypturl=&Apache::lonnet::EXT('resource.0.encrypturl',
+ $symb,$domain,$stuname);
+ my ($baseurl,$showsymb);
+ if ($encrypturl =~ /^yes$/i) {
+ $baseurl = &Apache::lonenc::encrypted($feedurl,1);
+ $showsymb = &Apache::lonenc::encrypted($symb,1);
+ } else {
+ $baseurl = $feedurl;
+ $showsymb = $symb;
+ }
+ my $restitle = &Apache::lonnet::gettitle($symb);
+ my $msgstatus =
+ &Apache::lonmsg::user_normal_msg($stuname,$domain,$subject.
+ ' (File Returned) ['.$restitle.']',$message,undef,
+ $baseurl,undef,undef,undef,$showsymb,$restitle);
}
}
return;
@@ -2873,16 +2967,18 @@ sub viewgrades {
'
';
#radio buttons/text box for assigning points for a section or class.
#handles different parts of a problem
- my ($partlist,$handgrade) = &response_type($symb);
+ my ($partlist,$handgrade,$responseType) = &response_type($symb);
my %weight = ();
my $ctsparts = 0;
$result.='
';
my %seen = ();
- for (sort keys(%$handgrade)) {
- my ($partid,$respid) = split (/_/,$_,2);
+ my @part_response_id = &flatten_responseType($responseType);
+ foreach my $part_response_id (@part_response_id) {
+ my ($partid,$respid) = @{ $part_response_id };
+ my $part_resp = join('_',@{ $part_response_id });
next if $seen{$partid};
$seen{$partid}++;
- my $handgrade=$$handgrade{$_};
+ my $handgrade=$$handgrade{$part_resp};
my $wgt = &Apache::lonnet::EXT('resource.'.$partid.'.weight',$symb);
$weight{$partid} = $wgt eq '' ? '1' : $wgt;
@@ -2917,7 +3013,7 @@ sub viewgrades {
}
$result.='
'.'
'.'
'."\n".
'';
- $result.='';
#table listing all the students in a section/class
@@ -3441,9 +3537,10 @@ sub upcsvScores_form {
$result.=$table;
$result.='
'."\n";
$result.='
'."\n";
- $result.=' Specify a file containing the class scores for current resource'.
+ $result.=' '.&mt('Specify a file containing the class scores for current resource').
'.
'."\n";
$result.='
'."\n";
+ my $upload=&mt("Upload Scores");
my $upfile_select=&Apache::loncommon::upfile_select_html();
my $ignore=&mt('Ignore First Line');
$result.=<
$upfile_select
-
+ $ignore
ENDUPFORM
- $result.='
'."\n";
+ $result.=&Apache::loncommon::help_open_topic("Course_Convert_To_CSV",
+ &mt("How do I create a CSV file from a spreadsheet"))
+ .'
' if ($ptr%2 == 0);
+ $studentTable.=''."\n";
$studentTable.='" />'."\n";
@@ -3809,9 +3911,10 @@ sub getSymbMap {
1,0,1);
for my $sequence ($navmap->getById('0.0'), @sequences) {
if ($navmap->hasResource($sequence, sub { shift->is_problem(); }, 0) ) {
- my $title = $minder.'.'.$sequence->compTitle();
- push @titles, $title; # minder in case two titles are identical
- $symbx{$title} = $sequence->symb();
+ my $title = $minder.'.'.
+ &HTML::Entities::encode($sequence->compTitle(),'"\'&');
+ push(@titles, $title); # minder in case two titles are identical
+ $symbx{$title} = &HTML::Entities::encode($sequence->symb(),'"\'&');
$minder++;
}
}
@@ -3847,6 +3950,11 @@ sub displayPage {
my $result='