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) {
@@ -1993,11 +2009,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));
@@ -2107,10 +2126,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 '');
@@ -2118,14 +2149,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}) {
@@ -2141,7 +2174,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);
}
}
}
@@ -2417,17 +2466,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,
@@ -2436,12 +2476,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;
@@ -2485,10 +2546,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;
@@ -2874,16 +2947,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;
@@ -2918,7 +2993,7 @@ sub viewgrades {
}
$result.=' '.' | '.' | |