--- loncom/homework/grades.pm 2005/04/08 19:26:58 1.261 +++ loncom/homework/grades.pm 2005/05/26 21:26:24 1.268 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.261 2005/04/08 19:26:58 albertel Exp $ +# $Id: grades.pm,v 1.268 2005/05/26 21:26:24 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -284,6 +284,11 @@ sub cleanRecord { } $answer =~ s-\n-
-g; return '

'.&keywords_highlight($answer).'
'; + } elsif ( $response eq 'organic') { + my $result='Smile representation: "'.$answer.'"'; + my $jme=$record->{$version."resource.$partid.$respid.molecule"}; + $result.=&Apache::chemresponse::jme_img($jme,$answer,400); + return $result; } return $answer; } @@ -626,24 +631,24 @@ LISTJAVASCRIPT my $checklastsub = $checkhdgrade eq '' ? 'checked' : ''; my $gradeTable='
'. "\n".$table. - ' View Problem Text: no '."\n". - ' one student '."\n". - ' all students
'."\n". - ' View Answer: no '."\n". - ' one student '."\n". - ' all students
'."\n". + ' View Problem Text: '."\n". + ''."\n". + '
'."\n". + ' View Answer: '."\n". + ''."\n". + '
'."\n". ' Submissions: '."\n"; if ($env{'form.handgrade'} eq 'yes' && scalar(@$partlist) > 1) { - $gradeTable.=' essay part only'."\n"; + $gradeTable.=''."\n"; } my $saveStatus = $env{'form.Status'} eq '' ? 'Active' : $env{'form.Status'}; $env{'form.Status'} = $saveStatus; - $gradeTable.=' last submission only'."\n". - ' last submission & parts info'."\n". - ' by dates and submissions'."\n". - ' all details'."\n". + $gradeTable.=''."\n". + ''."\n". + ''."\n". + ''."\n". ''."\n". ''."\n". '
'."\n". @@ -671,7 +676,7 @@ LISTJAVASCRIPT 'onClick="javascript:checkSelect(this.form.stuinfo);" '."\n". 'value="Next->" />
'."\n"; $gradeTable.=&check_buttons(); - $gradeTable.='Check For Plagiarism'; + $gradeTable.=''; my ($classlist, undef, $fullname) = &getclasslist($getsec,'1'); $gradeTable.='
'. ''; @@ -2109,7 +2114,7 @@ sub processHandGrade { #---- Save the score and award for each student, if changed sub saveHandGrade { my ($request,$url,$symb,$stuname,$domain,$newflg,$submitter,$part) = @_; - my $v_flag=0; + my @v_flag; my $usec = &Apache::lonnet::getsection($domain,$stuname, $env{'request.course.id'}); if (!&canmodify($usec)) { return('not_allowed'); } @@ -2174,13 +2179,12 @@ sub saveHandGrade { } # unless problem has been graded, set flag to version the submitted files unless ($record{'resource.'.$new_part.'.solved'} =~ /^correct_/ || $record{'resource.'.$new_part.'.solved'} eq 'incorrect_by_override') { - $v_flag = 1; + push (@v_flag,$new_part); } } if (scalar(keys(%newrecord)) > 0) { - if ($v_flag) { - &Apache::lonnet::unmark_as_readonly($domain,$stuname,$symb.$env{'request.course.id'}); - &version_portfiles(\%record, \@parts_graded, $env{'request.course.id'}, $symb, $domain, $stuname); + if (scalar(@v_flag)) { + &version_portfiles(\%record, \@parts_graded, $env{'request.course.id'}, $symb, $domain, $stuname, \@v_flag); } &Apache::lonnet::cstore(\%newrecord,$symb, $env{'request.course.id'},$domain,$stuname); @@ -2190,18 +2194,20 @@ sub saveHandGrade { # ----------- Handles creating versions for portfolio files as answers sub version_portfiles { - my ($record, $parts_graded, $courseid, $symb, $domain, $stuname) = @_; + my ($record, $parts_graded, $courseid, $symb, $domain, $stuname, $v_flag) = @_; + my $version_parts = join('|',@$v_flag); my $parts = join('|', @$parts_graded); my $portfolio_root = &Apache::loncommon::propath($domain, $stuname). '/userfiles/portfolio'; foreach my $key(keys %$record) { - #&Apache::lonnet::logthis("key is $key, value is $$record{$key}"); my $new_portfiles; - if ($key =~ /^resource\.($parts)\./ && $key =~ /\.portfiles$/) { + if ($key =~ /^resource\.($version_parts)\./ && $key =~ /\.portfiles$/ ) { my @v_portfiles; my @portfiles = split(/,/,$$record{$key}); + # &Apache::lonnet::logthis("should be unmarking and remarking"); foreach my $file (@portfiles) { + &Apache::lonnet::unmark_as_readonly($domain,$stuname,[$symb,$env{'request.course.id'}],$file); my ($directory,$answer_file) =($file =~ /^(.*?)([^\/]*$)/); my $version = 0; my @answer_file_parts = split(/\./, $answer_file); @@ -2230,6 +2236,9 @@ sub version_portfiles { my $copy_result = &Apache::lonnet::finishuserfileupload($stuname,$domain,$home_server,'copy', '/portfolio'.$directory.$answer_file_parts[0].'.'.$version.'.'.$answer_file_parts[-1]); push(@v_portfiles, $answer_file_parts[0].'.'.$version.'.'.$answer_file_parts[-1]); + &Apache::lonnet::mark_as_readonly($domain,$stuname, + ['/portfolio'.$directory.$answer_file_parts[0].'.'.$version.'.'.$answer_file_parts[-1]], + [$symb,$env{'request.course.id'},'graded']); } } $$record{$key} = join(',',@v_portfiles); @@ -2304,6 +2313,7 @@ sub viewgrades_js { function writeRadText(partid,weight) { var selval = document.classgrade["SELVAL_"+partid]; var radioButton = document.classgrade["RADVAL_"+partid]; + var override = document.classgrade["FORCE_"+partid].checked; var textbox = document.classgrade["TEXTVAL_"+partid]; if (selval[1].selected || selval[2].selected) { for (var i=0; i '. ''. ''. - ''."\n"; + ''. + ''."\n"; $ctsparts++; } $result.='
'.'
'.''."\n". @@ -3781,7 +3792,7 @@ sub scantron_selectphase { - + @@ -4236,10 +4247,10 @@ sub scantron_do_warning { $r->print('

You have not selected a the format of the student\'s response data.

'); } } else { - my $warning=&scantron_warning_screen('Validate Records'); + my $warning=&scantron_warning_screen('Grading: Validate Records'); $r->print(< + STUFF }