--- loncom/homework/grades.pm 2010/04/01 00:58:43 1.604 +++ loncom/homework/grades.pm 2010/04/12 22:19:53 1.613 @@ -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.613 2010/04/12 22:19:53 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -123,25 +123,6 @@ sub getpartlist { return @stores; } -# --- Get the symbolic name of a problem and the url -# Generate an error message if symb could not be found unless silent flag is set -# Takes $env{'form.symb'} by default; if not present, takes $env{'form.url'} and tries to get symb from that -# - -sub get_symb { - my ($request,$silent) = @_; - (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); -} - #--- Format fullname, username:domain if different for display #--- Use anywhere where the student names are listed sub nameUserString { @@ -636,8 +617,6 @@ sub jscriptNform { "\n"); $jscript.= '
'."\n". ''."\n". - ''."\n". - ''."\n". ''."\n". ''."\n". ''."\n". @@ -729,10 +708,9 @@ sub most_similar { # sub initialverifyreceipt { - my $request = shift; + my ($request,$symb) = @_; &commonJSfunctions($request); - my ($symb) = &get_symb($request); - return ''. + return ''. &Apache::lonnet::recprefix($env{'request.course.id'}). '-'. ''."\n". @@ -742,20 +720,17 @@ sub initialverifyreceipt { #--- Check whether a receipt number is valid.--- sub verifyreceipt { - my $request = shift; + my ($request,$symb) = @_; my $courseid = $env{'request.course.id'}; my $receipt = &Apache::lonnet::recprefix($courseid).'-'. $env{'form.receipt'}; $receipt =~ s/[^\-\d]//g; - my ($symb) = &get_symb($request); 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'); @@ -833,17 +808,14 @@ sub verifyreceipt { #--- Also called directly when one clicks on the subm button # on the problem page. sub listStudents { - my ($request) = shift; + my ($request,$symb) = @_; - my ($symb) = &get_symb($request); my $cdom = $env{"course.$env{'request.course.id'}.domain"}; my $cnum = $env{"course.$env{'request.course.id'}.num"}; my $getsec = $env{'form.section'} eq '' ? 'all' : $env{'form.section'}; 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") @@ -947,8 +919,6 @@ LISTJAVASCRIPT ''."\n". '
'."\n". '
'."\n". - ''."\n". - ''."\n". ''."\n". ''."\n"; @@ -1913,12 +1883,13 @@ sub build_section_inputs { # --------------------------- show submissions of a student, option to grade sub submission { - my ($request,$counter,$total) = @_; + my ($request,$counter,$total,$symb) = @_; my ($uname,$udom) = ($env{'form.student'},$env{'form.userdom'}); $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 $probtitle=&Apache::lonnet::gettitle($symb); if ($symb eq '') { $request->print("Unable to handle ambiguous references:."); return ''; } if (!&canview($usec)) { @@ -1942,13 +1913,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,17 +1947,15 @@ 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'}; my $stu_status = join(':',&Apache::loncommon::get_env_multiple('form.Status')); $request->print(''."\n". ''."\n". - ''."\n". ''."\n". ''."\n". - ''."\n". ''."\n". ''."\n". ''."\n". @@ -2496,8 +2462,7 @@ sub keywords_highlight { #--- Called from submission routine sub processHandGrade { - my ($request) = shift; - my $symb = &get_symb($request); + my ($request,$symb) = @_; my (undef,undef,$url) = &Apache::lonnet::decode_symb($symb); my $button = $env{'form.gradeOpt'}; my $ngrade = $env{'form.NCT'}; @@ -2537,7 +2502,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 +2530,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 +2630,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 +2641,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); @@ -3298,10 +3265,9 @@ VIEWJAVASCRIPT #--- show scores for a section or whole class w/ option to change/update a score sub viewgrades { - my ($request) = shift; + my ($request,$symb) = @_; &viewgrades_js($request); - my ($symb) = &get_symb($request); #need to make sure we have the correct data for later EXT calls, #thus invalidate the cache &Apache::lonnet::devalidatecourseresdata( @@ -3310,7 +3276,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); @@ -3321,9 +3286,7 @@ sub viewgrades { ''."\n". ''."\n". &build_section_inputs(). - ''."\n". ''."\n". - ''."\n"; my ($common_header,$specific_header); if ($env{'form.section'} eq 'all') { @@ -3541,12 +3504,10 @@ sub viewstudentgrade { #--- change scores for all the students in a section/class # record does not get update if unchanged sub editgrades { - my ($request) = @_; + my ($request,$symb) = @_; - 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 +3829,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'); @@ -3892,8 +3852,6 @@ to this page if the data selected is ins - -
ENDPICK @@ -3955,13 +3913,9 @@ CSVFORMJS } sub upcsvScores_form { - my ($request) = shift; - my ($symb)=&get_symb($request); + my ($request,$symb) = @_; 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 +5241,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. @@ -6258,8 +6201,7 @@ sub scantron_warning_screen { =cut sub scantron_do_warning { - my ($r)=@_; - my ($symb)=&get_symb($r); + my ($r,$symb)=@_; if (!$symb) {return '';} my $default_form_data=&defaultFormData($symb); $r->print(&scantron_form_start().$default_form_data); @@ -6340,8 +6282,7 @@ SCANTRONFORM =cut sub scantron_validate_file { - my ($r) = @_; - my ($symb)=&get_symb($r); + my ($r,$symb) = @_; if (!$symb) {return '';} my $default_form_data=&defaultFormData($symb); @@ -7613,10 +7554,9 @@ sub scantron_validate_missingbubbles { sub scantron_process_students { - my ($r) = @_; + my ($r,$symb) = @_; my (undef,undef,$sequence)=&Apache::lonnet::decode_symb($env{'form.selectpage'}); - my ($symb)=&get_symb($r); if (!$symb) { return ''; } @@ -7916,7 +7856,7 @@ sub grade_student_bubbles { } sub scantron_upload_scantron_data { - my ($r)=@_; + my ($r,$symb)=@_; my $dom = $env{'request.role.domain'}; my $domdesc = &Apache::lonnet::domain($dom,'description'); $r->print(&Apache::loncommon::coursebrowser_javascript($dom)); @@ -7925,7 +7865,7 @@ sub scantron_upload_scantron_data { 'coursename',$dom); my $syllabuslink = ''.&mt('Syllabus').''. (' 'x2).&mt('(shows course personnel)'); - my $default_form_data=&defaultFormData(&get_symb($r,1)); + my $default_form_data=&defaultFormData($symb); my $nofile_alert = &mt('Please use the browse button to select a file from your local directory.'); my $nocourseid_alert = &mt("Please use the 'Select Course' link to open a separate window where you can search for a course to which a file can be uploaded."); $r->print(&Apache::lonhtmlcommon::scripttag(' @@ -7985,8 +7925,7 @@ sub scantron_upload_scantron_data { sub scantron_upload_scantron_data_save { - my($r)=@_; - my ($symb)=&get_symb($r,1); + my($r,$symb)=@_; my $doanotherupload= '
'."\n". ''."\n". @@ -8026,7 +7965,7 @@ sub scantron_upload_scantron_data_save { } } if ($symb) { - $r->print(&scantron_selectphase($r,$uploadedfile)); + $r->print(&scantron_selectphase($r,$uploadedfile,$symb)); } else { $r->print($doanotherupload); } @@ -8128,8 +8067,8 @@ sub valid_file { } sub scantron_download_scantron_data { - my ($r)=@_; - my $default_form_data=&defaultFormData(&get_symb($r,1)); + my ($r,$symb)=@_; + my $default_form_data=&defaultFormData($symb); my $cname=$env{'course.'.$env{'request.course.id'}.'.num'}; my $cdom=$env{'course.'.$env{'request.course.id'}.'.domain'}; my $file=$env{'form.scantron_selectfile'}; @@ -8139,7 +8078,7 @@ sub scantron_download_scantron_data { '.&mt('The requested file name was invalid.').'

'); - $r->print(&show_grading_menu_form(&get_symb($r,1))); + $r->print(&show_grading_menu_form($symb)); return; } my $orig='/uploaded/'.$cdom.'/'.$cname.'/scantron_orig_'.$file; @@ -8162,13 +8101,12 @@ sub scantron_download_scantron_data { '','').'

'); - $r->print(&show_grading_menu_form(&get_symb($r,1))); + $r->print(&show_grading_menu_form($symb)); return ''; } sub checkscantron_results { - my ($r) = @_; - my ($symb)=&get_symb($r); + my ($r,$symb) = @_; if (!$symb) {return '';} my $grading_menu_button=&show_grading_menu_form($symb); my $cid = $env{'request.course.id'}; @@ -8470,7 +8408,6 @@ sub show_grading_menu_form { my ($symb)=@_; my $result.='
'."\n". ''."\n". - ''."\n". ''."\n". ''."\n". ''."\n"; @@ -8478,13 +8415,10 @@ sub show_grading_menu_form { } sub grading_menu { - my ($request) = @_; - my ($symb)=&get_symb($request); + my ($request,$symb) = @_; 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 +8509,6 @@ sub grading_menu { $Str .= ''; $Str .= ''. ''."\n". - ''."\n". ''."\n". ''."\n"; @@ -8590,8 +8523,7 @@ sub ungraded { } sub submit_options_sequence { - my ($request) = @_; - my ($symb)=&get_symb($request); + my ($request,$symb) = @_; if (!$symb) {return '';} &commonJSfunctions($request); my $result; @@ -8617,8 +8549,7 @@ sub submit_options_sequence { } sub submit_options_table { - my ($request) = @_; - my ($symb)=&get_symb($request); + my ($request,$symb) = @_; if (!$symb) {return '';} &commonJSfunctions($request); my $result; @@ -8647,17 +8578,14 @@ sub submit_options_table { #--- Displays the submissions first page ------- sub submit_options { - my ($request) = @_; - my ($symb)=&get_symb($request); + my ($request,$symb) = @_; if (!$symb) {return '';} - my $probTitle = &Apache::lonnet::gettitle($symb); &commonJSfunctions($request); my $result; $result.=''."\n". ''."\n". - ''."\n". ''."\n". ''."\n"; @@ -8804,11 +8732,9 @@ sub clicker_grading_parameters { } sub process_clicker { - my ($r)=@_; - my ($symb)=&get_symb($r); + my ($r,$symb)=@_; 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,8 +3929,6 @@ sub upcsvScores_form { - - $upfile_select
@@ -3992,8 +3944,7 @@ ENDUPFORM sub csvuploadmap { - my ($request)= @_; - my ($symb)=&get_symb($request); + my ($request,$symb)= @_; if (!$symb) {return '';} my $datatoken; @@ -4040,8 +3991,7 @@ sub csvuploadmap { } sub csvuploadoptions { - my ($request)= @_; - my ($symb)=&get_symb($request); + my ($request,$symb)= @_; my $checked=(($env{'form.noFirstLine'})?'1':'0'); my $ignore=&mt('Ignore First Line'); $request->print(<print(&Apache::lonhtmlcommon::scripttag(<'."\n". ''."\n". - ''."\n". - ''."
\n"; + ''."
\n"; $result.=' '.&mt('Use CODE').':
'."\n"; @@ -4377,9 +4325,7 @@ sub getSymbMap { # #--- Displays a page/sequence w/wo problems, w/wo submissions sub displayPage { - my ($request) = shift; - - my ($symb) = &get_symb($request); + my ($request,$symb) = @_; my $cdom = $env{"course.$env{'request.course.id'}.domain"}; my $cnum = $env{"course.$env{'request.course.id'}.num"}; my $getsec = $env{'form.section'} eq '' ? 'all' : $env{'form.section'}; @@ -4435,8 +4381,7 @@ sub displayPage { ''."\n". ''."\n". ''."\n". - ''."\n". - ''."\n"; + ''."\n"; if (defined($env{'form.CODE'})) { $studentTable.= @@ -4665,7 +4610,7 @@ sub displaySubByDates { } sub updateGradeByPage { - my ($request) = shift; + my ($request,$symb) = @_; my $cdom = $env{"course.$env{'request.course.id'}.domain"}; my $cnum = $env{"course.$env{'request.course.id'}.num"}; @@ -4695,7 +4640,6 @@ sub updateGradeByPage { my $map = $navmap->getResourceByUrl($resUrl); # add to navmaps if (!$map) { $request->print(''.&mt('Unable to grade requested sequence ([_1]).',$resUrl).''); - my ($symb)=&get_symb($request); $request->print(&show_grading_menu_form($symb)); return; } @@ -4900,9 +4844,7 @@ the homework problem. sub defaultFormData { my ($symb)=@_; - return ''."\n". - ''."\n". - ''."\n"; + return ''; } @@ -5188,8 +5130,7 @@ sub scantron_CODEunique { =cut sub scantron_selectphase { - my ($r,$file2grade) = @_; - my ($symb)=&get_symb($r); + my ($r,$file2grade,$symb) = @_; if (!$symb) {return '';} my $map_error; my $sequence_selector=&getSequenceDropDown($symb,\$map_error); @@ -5207,6 +5148,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($symb); + 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,8 +8812,6 @@ ENDUPFORM - -

@@ -8910,15 +8834,13 @@ ENDUPFORM } sub process_clicker_file { - my ($r)=@_; - my ($symb)=&get_symb($r); + my ($r,$symb)=@_; if (!$symb) {return '';} my %Saveable_Parameters=&clicker_grading_parameters(); &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,8 +8917,6 @@ sub process_clicker_file { - - @@ -9145,8 +9065,7 @@ sub interwrite_eval { } sub assign_clicker_grades { - my ($r)=@_; - my ($symb)=&get_symb($r); + my ($r,$symb)=@_; if (!$symb) {return '';} # See which part we are saving to my $res_error; @@ -9158,7 +9077,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,$symb,$crumbs,$onlyfolderflag,$nodisplayflag) = @_; + unshift(@$crumbs,{href=>"/adm/grades?command=gradingmenu&symb=".&HTML::Entities::encode($symb,'<>&"'),text=>"Grading"}); + $r->print(&Apache::loncommon::start_page('Grading',undef, + {'bread_crumbs' => $crumbs})); + unless ($nodisplayflag) { + $r->print(&Apache::lonhtmlcommon::resource_info_box($symb,$onlyfolderflag)); + } +} + sub handler { my $request=$_[0]; &reset_caches(); @@ -9276,7 +9204,9 @@ sub handler { $request->send_http_header; return '' if $request->header_only; &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}); - my $symb=&get_symb($request,1); + +# see what command we need to execute + my @commands=&Apache::loncommon::get_env_multiple('form.command'); my $command=$commands[0]; @@ -9284,10 +9214,16 @@ sub handler { &Apache::lonnet::logthis("grades got multiple commands ".join(':',@commands)); } +# see what the symb is + + my $symb=$env{'form.symb'}; + unless ($symb) { + (my $url=$env{'form.url'}) =~ s-^https*://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--; + $symb=&Apache::lonnet::symbread($url); + } + &Apache::lonenc::check_decrypt(\$symb); + $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,82 +9232,115 @@ sub handler { } else { &init_perm(); if ($command eq 'submission' && $perm{'vgr'}) { - ($env{'form.student'} eq '' ? &listStudents($request) : &submission($request,0,0)); + &startpage($request,$symb,[{href=>"", text=>"Student Submissions"}]); + ($env{'form.student'} eq '' ? &listStudents($request,$symb) : &submission($request,0,0,$symb)); } elsif ($command eq 'pickStudentPage' && $perm{'vgr'}) { - &pickStudentPage($request); + &startpage($request,$symb); + &pickStudentPage($request,$symb); } elsif ($command eq 'displayPage' && $perm{'vgr'}) { - &displayPage($request); + &startpage($request,$symb); + &displayPage($request,$symb); } elsif ($command eq 'gradeByPage' && $perm{'mgr'}) { - &updateGradeByPage($request); + &startpage($request,$symb); + &updateGradeByPage($request,$symb); } elsif ($command eq 'processGroup' && $perm{'vgr'}) { - &processGroup($request); + &startpage($request,$symb); + &processGroup($request,$symb); } elsif ($command eq 'gradingmenu' && $perm{'vgr'}) { - $request->print(&grading_menu($request)); + &startpage($request,$symb); + $request->print(&grading_menu($request,$symb)); } elsif ($command eq 'individual' && $perm{'vgr'}) { - $request->print(&submit_options($request)); + &startpage($request,$symb); + $request->print(&submit_options($request,$symb)); } elsif ($command eq 'ungraded' && $perm{'vgr'}) { - $request->print(&submit_options($request)); + &startpage($request,$symb); + $request->print(&submit_options($request,$symb)); } elsif ($command eq 'table' && $perm{'vgr'}) { - $request->print(&submit_options_table($request)); + &startpage($request,$symb,[{href=>"", text=>"Grading table"}],1); + $request->print(&submit_options_table($request,$symb)); } elsif ($command eq 'all_for_one' && $perm{'vgr'}) { - $request->print(&submit_options_sequence($request)); + &startpage($request,$symb); + $request->print(&submit_options_sequence($request,$symb)); } elsif ($command eq 'viewgrades' && $perm{'vgr'}) { - $request->print(&viewgrades($request)); + &startpage($request,$symb,[{href=>"/adm/grades?symb=".&HTML::Entities::encode($symb,'<>&"')."&command=table", text=>"Grading table"},{href=>'', text=>"Modify grades"}],1); + $request->print(&viewgrades($request,$symb)); } elsif ($command eq 'handgrade' && $perm{'mgr'}) { - $request->print(&processHandGrade($request)); + &startpage($request,$symb); + $request->print(&processHandGrade($request,$symb)); } elsif ($command eq 'editgrades' && $perm{'mgr'}) { - $request->print(&editgrades($request)); + &startpage($request,$symb); + $request->print(&editgrades($request,$symb)); } elsif ($command eq 'initialverifyreceipt' && $perm{'vgr'}) { - $request->print(&initialverifyreceipt($request)); + &startpage($request,$symb); + $request->print(&initialverifyreceipt($request,$symb)); } elsif ($command eq 'verify' && $perm{'vgr'}) { - $request->print(&verifyreceipt($request)); + &startpage($request,$symb); + $request->print(&verifyreceipt($request,$symb)); } elsif ($command eq 'processclicker' && $perm{'mgr'}) { - $request->print(&process_clicker($request)); + &startpage($request,$symb); + $request->print(&process_clicker($request,$symb)); } elsif ($command eq 'processclickerfile' && $perm{'mgr'}) { - $request->print(&process_clicker_file($request)); + &startpage($request,$symb); + $request->print(&process_clicker_file($request,$symb)); } elsif ($command eq 'assignclickergrades' && $perm{'mgr'}) { - $request->print(&assign_clicker_grades($request)); + &startpage($request,$symb); + $request->print(&assign_clicker_grades($request,$symb)); } elsif ($command eq 'csvform' && $perm{'mgr'}) { - $request->print(&upcsvScores_form($request)); + &startpage($request,$symb); + $request->print(&upcsvScores_form($request,$symb)); } elsif ($command eq 'csvupload' && $perm{'mgr'}) { - $request->print(&csvupload($request)); + &startpage($request,$symb); + $request->print(&csvupload($request,$symb)); } elsif ($command eq 'csvuploadmap' && $perm{'mgr'} ) { - $request->print(&csvuploadmap($request)); + &startpage($request,$symb); + $request->print(&csvuploadmap($request,$symb)); } elsif ($command eq 'csvuploadoptions' && $perm{'mgr'}) { if ($env{'form.associate'} ne 'Reverse Association') { - $request->print(&csvuploadoptions($request)); + &startpage($request,$symb); + $request->print(&csvuploadoptions($request,$symb)); } else { if ( $env{'form.upfile_associate'} ne 'reverse' ) { $env{'form.upfile_associate'} = 'reverse'; } else { $env{'form.upfile_associate'} = 'forward'; } - $request->print(&csvuploadmap($request)); + &startpage($request,$symb); + $request->print(&csvuploadmap($request,$symb)); } } elsif ($command eq 'csvuploadassign' && $perm{'mgr'} ) { - $request->print(&csvuploadassign($request)); + &startpage($request,$symb); + $request->print(&csvuploadassign($request,$symb)); } elsif ($command eq 'scantron_selectphase' && $perm{'mgr'}) { - $request->print(&scantron_selectphase($request)); + &startpage($request,$symb); + $request->print(&scantron_selectphase($request,undef,$symb)); } elsif ($command eq 'scantron_warning' && $perm{'mgr'}) { - $request->print(&scantron_do_warning($request)); + &startpage($request,$symb); + $request->print(&scantron_do_warning($request,$symb)); } elsif ($command eq 'scantron_validate' && $perm{'mgr'}) { - $request->print(&scantron_validate_file($request)); + &startpage($request,$symb); + $request->print(&scantron_validate_file($request,$symb)); } elsif ($command eq 'scantron_process' && $perm{'mgr'}) { - $request->print(&scantron_process_students($request)); + &startpage($request,$symb); + $request->print(&scantron_process_students($request,$symb)); } elsif ($command eq 'scantronupload' && (&Apache::lonnet::allowed('usc',$env{'request.role.domain'})|| &Apache::lonnet::allowed('usc',$env{'request.course.id'}))) { - $request->print(&scantron_upload_scantron_data($request)); + &startpage($request,$symb); + $request->print(&scantron_upload_scantron_data($request,$symb)); } elsif ($command eq 'scantronupload_save' && (&Apache::lonnet::allowed('usc',$env{'request.role.domain'})|| &Apache::lonnet::allowed('usc',$env{'request.course.id'}))) { - $request->print(&scantron_upload_scantron_data_save($request)); + &startpage($request,$symb); + $request->print(&scantron_upload_scantron_data_save($request,$symb)); } elsif ($command eq 'scantron_download' && &Apache::lonnet::allowed('usc',$env{'request.course.id'})) { - $request->print(&scantron_download_scantron_data($request)); + &startpage($request,$symb); + $request->print(&scantron_download_scantron_data($request,$symb)); } elsif ($command eq 'checksubmissions' && $perm{'vgr'}) { - $request->print(&checkscantron_results($request)); + &startpage($request,$symb); + $request->print(&checkscantron_results($request,$symb)); } elsif ($command) { + &startpage($request,$symb); $request->print('

'.&mt('Access Denied ([_1])',$command).'

'); } }