--- loncom/homework/grades.pm 2013/08/16 15:36:08 1.596.2.12.2.19 +++ loncom/homework/grades.pm 2012/08/09 23:25:48 1.596.2.13 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.596.2.12.2.19 2013/08/16 15:36:08 raeburn Exp $ +# $Id: grades.pm,v 1.596.2.13 2012/08/09 23:25:48 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -125,16 +125,13 @@ sub getpartlist { # --- Get the symbolic name of a problem and the url sub get_symb { my ($request,$silent) = @_; - my $symb=$env{'form.symb'}; - unless ($symb) { - (my $url=$env{'form.url'}) =~ s-^http://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--; - $symb = &Apache::lonnet::symbread($url); - if ($symb eq '') { - if (!$silent) { - $request->print(&mt("Unable to handle ambiguous references: [_1].",$url)); - return (); - } - } + (my $url=$env{'form.url'}) =~ s-^http://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--; + my $symb=($env{'form.symb'} ne '' ? $env{'form.symb'} : (&Apache::lonnet::symbread($url))); + if ($symb eq '') { + if (!$silent) { + $request->print(&mt("Unable to handle ambiguous references: [_1].",$url)); + return (); + } } &Apache::lonenc::check_decrypt(\$symb); return ($symb); @@ -253,7 +250,7 @@ sub showResourceInfo { $result.=''.$display_part.'' .''.''.$resID.'' .''.&mt($responsetype).'' -# .''.&mt('Handgrade: [_1]',$handgrade).'' +# .''.&mt('Handgrade: [_1]',$handgrade).'' .&Apache::loncommon::end_data_table_row(); } } @@ -277,7 +274,7 @@ sub reset_caches { } sub get_analyze { - my ($symb,$uname,$udom,$no_increment,$add_to_hash,$type,$trial,$rndseed,$bubbles_per_row)=@_; + my ($symb,$uname,$udom,$no_increment,$add_to_hash,$type,$trial,$rndseed)=@_; my $key = "$symb\0$uname\0$udom"; if ($type eq 'randomizetry') { if ($trial ne '') { @@ -311,9 +308,6 @@ sub reset_caches { 'grade_courseid' => $env{'request.course.id'}, 'grade_username' => $uname, 'grade_noincrement' => $no_increment); - if ($bubbles_per_row ne '') { - $form{'bubbles_per_row'} = $bubbles_per_row; - } if ($type eq 'randomizetry') { $form{'grade_questiontype'} = $type; if ($rndseed ne '') { @@ -354,7 +348,7 @@ sub reset_caches { } sub scantron_partids_tograde { - my ($resource,$cid,$uname,$udom,$check_for_randomlist,$bubbles_per_row) = @_; + my ($resource,$cid,$uname,$udom,$check_for_randomlist) = @_; my (%analysis,@parts); if (ref($resource)) { my $symb = $resource->symb(); @@ -362,9 +356,7 @@ sub reset_caches { if ($check_for_randomlist) { $add_to_form = { 'check_parts_withrandomlist' => 1,}; } - my $analyze = - &get_analyze($symb,$uname,$udom,undef,$add_to_form, - undef,undef,undef,$bubbles_per_row); + my $analyze = &get_analyze($symb,$uname,$udom,undef,$add_to_form); if (ref($analyze) eq 'HASH') { %analysis = %{$analyze}; } @@ -1619,15 +1611,17 @@ INNERJS function savedMsgHeader(Nmsg,usrctr,fullname) { var height = 70*Nmsg+250; + var scrollbar = "no"; if (height > 600) { height = 600; + scrollbar = "yes"; } var xpos = (screen.width-600)/2; xpos = (xpos < 0) ? '0' : xpos; var ypos = (screen.height-height)/2-30; ypos = (ypos < 0) ? '0' : ypos; - pWin = window.open('', 'MessageCenter', 'resizable=yes,toolbar=no,location=no,scrollbars=yes,screenx='+xpos+',screeny='+ypos+',width=700,height='+height); + pWin = window.open('', 'MessageCenter', 'resizable=yes,toolbar=no,location=no,scrollbars='+scrollbar+',screenx='+xpos+',screeny='+ypos+',width=700,height='+height); pWin.focus(); pDoc = pWin.document; pDoc.$docopen; @@ -1793,7 +1787,7 @@ sub gradeBox { $wgt = ($wgt > 0 ? $wgt : '1'); my $score = ($$record{'resource.'.$partid.'.awarded'} eq '' ? '' : &compute_points($$record{'resource.'.$partid.'.awarded'},$wgt)); - my $data_WGT=''."\n"; + my $result=''."\n"; my $display_part= &get_display_part($partid,$symb); my %last_resets = &get_last_resets($symb,$env{'request.course.id'}, [$partid]); @@ -1801,7 +1795,7 @@ sub gradeBox { if ($last_resets{$partid}) { $aggtries = &get_num_tries($record,$last_resets{$partid},$partid); } - my $result=&Apache::loncommon::start_data_table_row(); + $result.=&Apache::loncommon::start_data_table_row(); my $ctr = 0; my $thisweight = 0; my $increment = &get_increment(); @@ -1837,9 +1831,10 @@ sub gradeBox { $line.=''."\n"; + #&mt('Part:[_1]Points:[_2]or[_3]',$display_part,$radio,$line); $result .= - ''.$data_WGT.$display_part.''.$radio.''.&mt('or').''.$line.''; - $result.=&Apache::loncommon::end_data_table_row().''; + ''.$display_part.''.$radio.''.&mt('or').''.$line.''; + $result.=&Apache::loncommon::end_data_table_row(); $result.=''."\n". ''."\n". ''."\n"; my $res_error; $result.=&handback_box($symb,$uname,$udom,$counter,$partid,$record,\$res_error); - $result.=''.&Apache::loncommon::end_data_table_row(); if ($res_error) { return &navmap_errormsg(); } @@ -1924,27 +1918,14 @@ sub show_problem { $companswer=~s|||g; $companswer=~s|name="submit"|name="would_have_been_submit"|g; } - my $renderheading = &mt('View of the problem'); - my $answerheading = &mt('Correct answer'); - if (($uname ne $env{'user.name'}) || ($udom ne $env{'user.domain'})) { - my $stu_fullname = $env{'form.fullname'}; - if ($stu_fullname eq '') { - $stu_fullname = &Apache::loncommon::plainname($uname,$udom,'lastname'); - } - my $forwhom = &nameUserString(undef,$stu_fullname,$uname,$udom); - if ($forwhom ne '') { - $renderheading = &mt('View of the problem for[_1]',$forwhom); - $answerheading = &mt('Correct answer for[_1]',$forwhom); - } - } $rendered= '
' - .'

'.$renderheading.'

' + .'

'.&mt('View of the problem').'

' .$rendered .'
'; $companswer= '
' - .'

'.$answerheading.'

' + .'

'.&mt('Correct answer').'

' .$companswer .'
'; my $result; @@ -2015,7 +1996,7 @@ sub submission { $udom = ($udom eq '' ? $env{'user.domain'} : $udom); #has form.userdom changed for a student? my $usec = &Apache::lonnet::getsection($udom,$uname,$env{'request.course.id'}); $env{'form.fullname'} = &Apache::loncommon::plainname($uname,$udom,'lastname') if $env{'form.fullname'} eq ''; - my ($symb) = &get_symb($request); + my $symb = &get_symb($request); if ($symb eq '') { $request->print("Unable to handle ambiguous references:."); return ''; } if (!&canview($usec)) { @@ -2139,7 +2120,7 @@ sub submission {  $lt{'keyw'}:  $lt{'list'}    $lt{'past'}    + CLASS="page">$lt{'past'}    $lt{'high'}

KEYWORDS # @@ -2149,7 +2130,7 @@ KEYWORDS my ($adom,$aname,$apath)=($essayurl=~/^($LONCAPA::domain_re)\/($LONCAPA::username_re)\/(.*)$/); $apath=&escape($apath); $apath=~s/\W/\_/gs; - &init_old_essays($symb,$apath,$adom,$aname); + &init_old_essays($symb,$apath,$adom,$aname); } } @@ -2253,14 +2234,13 @@ KEYWORDS if ($env{"form.$uname:$udom:$partid:submitted_by"}) { if (exists($seenparts{$partid})) { next; } $seenparts{$partid}=1; - $request->print( - ''.&mt('Part: [_1]',$display_part).''. - ' '.&mt('Collaborative submission by: [_1]', - ''. - $$fullname{$env{"form.$uname:$udom:$partid:submitted_by"}}.''). - '
'); + my $submitby='Part: '.$display_part. + ' Collaborative submission by: '. + ''. + $$fullname{$env{"form.$uname:$udom:$partid:submitted_by"}}.'
'; + $request->print($submitby); next; } my $responsetype = $responseType->{$partid}->{$respid}; @@ -2327,26 +2307,18 @@ KEYWORDS if ($hide eq 'anon') { $lastsubonly.='
'.&mt('[quant,_1,file] uploaded to this anonymous survey',scalar(@{$files})); } else { - $lastsubonly.='

'.''.&mt('Submitted Files:').'' - .'
'; - if(@$files == 1) { - $lastsubonly .= &mt('Like all files provided by users, this file may contain viruses!'); - } else { - $lastsubonly .= &mt('Like all files provided by users, these files may contain viruses!'); - } - $lastsubonly .= ''; - + $lastsubonly.='
'.&mt('Like all files provided by users, this file may contain viruses').'
'; foreach my $file (@$files) { &Apache::lonnet::allowuploaded('/adm/grades',$file); - $lastsubonly.='
'.$file.''; + $lastsubonly.='
'.$file.''; } } $lastsubonly.='
'; } if ($hide eq 'anon') { - $lastsubonly.='
'.&mt('Anonymous Survey').''; + $lastsubonly.=''.&mt('Anonymous Survey').''; } else { - $lastsubonly.='
'.&mt('Submitted Answer:').' '. + $lastsubonly.=''.&mt('Submitted Answer:').' '. &cleanRecord($subval,$responsetype,$symb,$partid, $respid,\%record,$order,undef,$uname,$udom,$type,$trial,$rndseed); } @@ -2403,9 +2375,9 @@ KEYWORDS ''."\n"; $result.=' '. - &mt('Compose message to student'.(scalar(@$col_fullnames) >= 1 ? 's' : '')).'