--- loncom/homework/grades.pm 2010/04/01 00:58:43 1.604 +++ loncom/homework/grades.pm 2010/04/07 21:08:35 1.607 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Grading handler # -# $Id: grades.pm,v 1.604 2010/04/01 00:58:43 raeburn Exp $ +# $Id: grades.pm,v 1.607 2010/04/07 21:08:35 droeschl Exp $ # # Copyright Michigan State University Board of Trustees # @@ -637,7 +637,6 @@ sub jscriptNform { $jscript.= '
'."\n". ''."\n". ''."\n". - ''."\n". ''."\n". ''."\n". ''."\n". @@ -732,7 +731,7 @@ sub initialverifyreceipt { my $request = shift; &commonJSfunctions($request); my ($symb) = &get_symb($request); - return ''. + return ''. &Apache::lonnet::recprefix($env{'request.course.id'}). '-'. ''."\n". @@ -752,10 +751,8 @@ sub verifyreceipt { my $title.= '

'. - &mt('Verifying Receipt No. [_1]',$receipt). - '

'."\n". - '

'.&mt('Resource: [_1]',$env{'form.probTitle'}). - '

'."\n"; + &mt('Verifying Receipt Number [_1]',$receipt). + ''."\n"; my ($string,$contents,$matches) = ('','',0); my (undef,undef,$fullname) = &getclasslist('all','0'); @@ -842,8 +839,6 @@ sub listStudents { my $getgroup = $env{'form.group'} eq '' ? 'all' : $env{'form.group'}; my $submitonly= $env{'form.submitonly'} eq '' ? 'all' : $env{'form.submitonly'}; my $viewgrade = $env{'form.showgrading'} eq 'yes' ? 'View/Grade/Regrade' : 'View'; - $env{'form.probTitle'} = $env{'form.probTitle'} eq '' ? - &Apache::lonnet::gettitle($symb) : $env{'form.probTitle'}; my $result='

 ' .&mt("$viewgrade Submissions for a Student or a Group of Students") @@ -948,7 +943,6 @@ LISTJAVASCRIPT '
'."\n". '
'."\n". ''."\n". - ''."\n". ''."\n". ''."\n"; @@ -1918,7 +1912,8 @@ 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); + my $probtitle=&Apache::lonnet::gettitle($symb); if ($symb eq '') { $request->print("Unable to handle ambiguous references:."); return ''; } if (!&canview($usec)) { @@ -1942,13 +1937,10 @@ sub submission { if ($counter == 0) { &sub_page_js($request); &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'}; if ($env{'form.handgrade'} eq 'yes' && &files_exist($request, $symb)) { &download_all_link($request, $symb); } - $request->print('

 '.&mt('Submission Record').'

'."\n". - '

 '.&mt('Resource: [_1]',$env{'form.probTitle'}).'

'."\n"); + $request->print('

 '.&mt('Submission Record').'

'); # option to display problem, only once else it cause problems # with the form later since the problem has a form. @@ -1979,7 +1971,7 @@ sub submission { $env{'form.kwsize'} = $keyhash{$loginuser.'_kwsize'} ne '' ? $keyhash{$loginuser.'_kwsize'} : '0'; $env{'form.kwstyle'} = $keyhash{$loginuser.'_kwstyle'} ne '' ? $keyhash{$loginuser.'_kwstyle'} : ''; $env{'form.msgsub'} = $keyhash{$symb.'_subject'} ne '' ? - $keyhash{$symb.'_subject'} : $env{'form.probTitle'}; + $keyhash{$symb.'_subject'} : $probtitle; $env{'form.savemsgN'} = $keyhash{$symb.'_savemsgN'} ne '' ? $keyhash{$symb.'_savemsgN'} : '0'; } my $overRideScore = $env{'form.overRideScore'} eq '' ? 'no' : $env{'form.overRideScore'}; @@ -1989,7 +1981,6 @@ sub submission { ''."\n". ''."\n". ''."\n". - ''."\n". ''."\n". ''."\n". ''."\n". @@ -2537,7 +2528,7 @@ sub processHandGrade { if ($env{'form.withgrades'.$ctr}) { $message.="\n\nPoint".($pts > 1 ? 's':'').' awarded = '.$pts.' out of '.$wgt; $messagetail = " for $env{'form.probTitle'}"; + $feedurl."?symb=$showsymb\">$restitle"; } $msgstatus = &Apache::lonmsg::user_normal_msg($uname,$udom,$subject, @@ -2565,7 +2556,7 @@ sub processHandGrade { $udom); if ($env{'form.withgrades'.$ctr}) { $messagetail = " for $env{'form.probTitle'}"; + $baseurl."?symb=$showsymb\">$restitle"; } $msgstatus = &Apache::lonmsg::user_normal_msg($collaborator,$udom,$subject,$message.$messagetail,undef,$baseurl,undef,undef,undef,$showsymb,$restitle); @@ -2665,6 +2656,7 @@ sub processHandGrade { } return $a cmp $b; } (keys(%$fullname))) { +# FIXME: this is fishy, looks like the button label if ($nextflg == 1 && $button =~ /Next$/) { push(@parsedlist,$item); } @@ -2675,6 +2667,7 @@ sub processHandGrade { } } $ctr = 0; +# FIXME: this is fishy, looks like the button label @parsedlist = reverse @parsedlist if ($button eq 'Previous'); my $res_error; my ($partlist) = &response_type($symb,\$res_error); @@ -3310,7 +3303,6 @@ sub viewgrades { &Apache::lonnet::clear_EXT_cache_status(); my $result='

'.&mt('Manual Grading').'

'; - $result.='

'.&mt('Current Resource: [_1]',$env{'form.probTitle'}).'

'."\n"; #view individual student submission form - called using Javascript viewOneStudent $result.=&jscriptNform($symb); @@ -3323,7 +3315,6 @@ sub viewgrades { &build_section_inputs(). ''."\n". ''."\n". - ''."\n"; my ($common_header,$specific_header); if ($env{'form.section'} eq 'all') { @@ -3546,7 +3537,6 @@ sub editgrades { my $symb=&get_symb($request); my $section_display = join (", ",&Apache::loncommon::get_env_multiple('form.section')); my $title='

'.&mt('Current Grade Status').'

'; - $title.='

'.&mt('Current Resource: [_1]',$env{'form.probTitle'}).'

'."\n"; $title.='

'.&mt('Section: [_1]',$section_display).'

'."\n"; my $result= &Apache::loncommon::start_data_table(). @@ -3868,7 +3858,6 @@ sub csvuploadmap_header { $javascript=&csvupload_javascript_forward_associate(); } -# my ($result) = &showResourceInfo($symb,$env{'form.probTitle'}); my $result=''; my $checked=(($env{'form.noFirstLine'})?' checked="checked"':''); my $ignore=&mt('Ignore First Line'); @@ -3893,7 +3882,6 @@ to this page if the data selected is ins value="$env{'form.upfile_associate'}" /> -
ENDPICK @@ -3959,9 +3947,6 @@ sub upcsvScores_form { my ($symb)=&get_symb($request); if (!$symb) {return '';} my $result=&checkforfile_js(); - $env{'form.probTitle'} = &Apache::lonnet::gettitle($symb); -# my ($table) = &showResourceInfo($symb,$env{'form.probTitle'}); -# $result.=$table; $result.='
'."\n"; $result.=' + '.&Apache::loncommon::end_data_table_header_row().' + '.&Apache::loncommon::start_data_table_row().' + + '.&Apache::loncommon::end_data_table_row().' + '.&Apache::loncommon::end_data_table().' +'); + } + # Chunk of form to prompt for a file to grade and how: $result.= ' @@ -5254,51 +5283,7 @@ sub scantron_selectphase { $r->print($result); - if (&Apache::lonnet::allowed('usc',$env{'request.role.domain'}) || - &Apache::lonnet::allowed('usc',$env{'request.course.id'})) { - - # Chunk of form to prompt for a scantron file upload. - - $r->print(' -
- '.&Apache::loncommon::start_data_table('LC_scantron_action').' - '.&Apache::loncommon::start_data_table_header_row().' - - '.&Apache::loncommon::end_data_table_header_row().' - '.&Apache::loncommon::start_data_table_row().' - - '.&Apache::loncommon::end_data_table_row().' - '.&Apache::loncommon::end_data_table().' -'); - } # Chunk of the form that prompts to view a scoring office file, # corrected file, skipped records in a file. @@ -8481,10 +8466,8 @@ sub grading_menu { my ($request) = @_; my ($symb)=&get_symb($request); if (!$symb) {return '';} - my $probTitle = &Apache::lonnet::gettitle($symb); my %fields = ('symb'=>&Apache::lonenc::check_encrypt($symb), - 'probTitle'=>$probTitle, 'command'=>'individual', 'gradingMenu'=>1, 'showgrading'=>"yes"); @@ -8575,7 +8558,6 @@ sub grading_menu { $Str .= ''; $Str .= ''. ''."\n". - ''."\n". ''."\n". ''."\n"; @@ -8650,14 +8632,12 @@ sub submit_options { my ($request) = @_; my ($symb)=&get_symb($request); if (!$symb) {return '';} - my $probTitle = &Apache::lonnet::gettitle($symb); &commonJSfunctions($request); my $result; $result.=''."\n". ''."\n". - ''."\n". ''."\n". ''."\n"; @@ -8808,7 +8788,6 @@ sub process_clicker { my ($symb)=&get_symb($r); if (!$symb) {return '';} my $result=&checkforfile_js(); - $env{'form.probTitle'} = &Apache::lonnet::gettitle($symb); $result.='
'."\n"; $result.=' '.&mt('Specify a file containing the class scores for current resource.'). @@ -3975,7 +3960,6 @@ sub upcsvScores_form { - $upfile_select
@@ -4901,8 +4885,7 @@ the homework problem. sub defaultFormData { my ($symb)=@_; return ''."\n". - ''."\n". - ''."\n"; + ''; } @@ -5207,6 +5190,52 @@ sub scantron_selectphase { $ssi_error = 0; + if (&Apache::lonnet::allowed('usc',$env{'request.role.domain'}) || + &Apache::lonnet::allowed('usc',$env{'request.course.id'})) { + + # Chunk of form to prompt for a scantron file upload. + + $r->print(' +
+ '.&Apache::loncommon::start_data_table('LC_scantron_action').' + '.&Apache::loncommon::start_data_table_header_row().' +
+  '.&mt('Specify a bubblesheet data file to upload.').' + +'); + my $default_form_data=&defaultFormData(&get_symb($r,1)); + my $cdom= $env{'course.'.$env{'request.course.id'}.'.domain'}; + my $cnum= $env{'course.'.$env{'request.course.id'}.'.num'}; + $r->print(&Apache::lonhtmlcommon::scripttag(' + function checkUpload(formname) { + if (formname.upfile.value == "") { + alert("'.&mt('Please use the browse button to select a file from your local directory.').'"); + return false; + } + formname.submit(); + }')); + $r->print(' + + '.$default_form_data.' + + + + '.&mt('File to upload: [_1]','').' +
+ + +'); + + $r->print(' +
-  '.&mt('Specify a bubblesheet data file to upload.').' - -'); - my $default_form_data=&defaultFormData(&get_symb($r,1)); - my $cdom= $env{'course.'.$env{'request.course.id'}.'.domain'}; - my $cnum= $env{'course.'.$env{'request.course.id'}.'.num'}; - $r->print(&Apache::lonhtmlcommon::scripttag(' - function checkUpload(formname) { - if (formname.upfile.value == "") { - alert("'.&mt('Please use the browse button to select a file from your local directory.').'"); - return false; - } - formname.submit(); - }')); - $r->print(' -
- '.$default_form_data.' - - - - '.&mt('File to upload: [_1]','').' -
- -
-'); - $r->print(' -
'."\n"; $result.='
'."\n"; $result.=' '.&mt('Specify a file containing the clicker information for this resource.'). @@ -8886,7 +8865,6 @@ ENDUPFORM -
@@ -8918,7 +8896,6 @@ sub process_clicker_file { &Apache::loncommon::store_course_settings('grades_clicker', \%Saveable_Parameters); my $result=''; -# my ($result) = &showResourceInfo($symb,$env{'form.probTitle'}); if (($env{'form.gradingmechanism'} eq 'specific') && ($env{'form.specificid'}!~/\w/)) { $result.=''.&mt('You need to specify a clicker ID for the correct answer').''; return $result.&show_grading_menu_form($symb); @@ -8995,7 +8972,6 @@ sub process_clicker_file { - @@ -9158,7 +9134,6 @@ sub assign_clicker_grades { my $part=$$partlist[0]; # Start screen output my $result=''; -# my ($result) = &showResourceInfo($symb,$env{'form.probTitle'}); my $heading=&mt('Assigning grades based on clicker file'); $result.=(<',''). ''; } +sub startpage{ + my ($r,$crumbs) = @_; + + unshift(@$crumbs, {href=>"/adm/grades",text=>"Grading"}); + $r->print(&Apache::loncommon::start_page('Grading',undef, + {'bread_crumbs' => $crumbs})); +} sub handler { my $request=$_[0]; @@ -9283,11 +9265,8 @@ sub handler { if ($#commands > 0) { &Apache::lonnet::logthis("grades got multiple commands ".join(':',@commands)); } - + $ssi_error = 0; - my $brcrum = [{href=>"/adm/grades",text=>"Grading"}]; - $request->print(&Apache::loncommon::start_page('Grading',undef, - {'bread_crumbs' => $brcrum})); if ($symb eq '' && $command eq '') { # # Not called from a resource @@ -9296,6 +9275,7 @@ sub handler { } else { &init_perm(); if ($command eq 'submission' && $perm{'vgr'}) { + &startpage($request, [{href=>"", text=>"Student Submissions"}]); ($env{'form.student'} eq '' ? &listStudents($request) : &submission($request,0,0)); } elsif ($command eq 'pickStudentPage' && $perm{'vgr'}) { &pickStudentPage($request); @@ -9306,6 +9286,7 @@ sub handler { } elsif ($command eq 'processGroup' && $perm{'vgr'}) { &processGroup($request); } elsif ($command eq 'gradingmenu' && $perm{'vgr'}) { + &startpage($request); $request->print(&grading_menu($request)); } elsif ($command eq 'individual' && $perm{'vgr'}) { $request->print(&submit_options($request));