Diff for /loncom/homework/grades.pm between versions 1.777 and 1.781

version 1.777, 2020/11/08 22:23:52 version 1.781, 2021/01/05 21:53:44
Line 1166  LISTJAVASCRIPT Line 1166  LISTJAVASCRIPT
         $nocompmsg = '';          $nocompmsg = '';
     }      }
     $gradeTable .= &Apache::lonhtmlcommon::row_title($viewtitle)      $gradeTable .= &Apache::lonhtmlcommon::row_title($viewtitle)
                   .$submission_options                    .$submission_options;
                   .&Apache::lonhtmlcommon::row_closure()  # Check if any gradable
       my $showmore;
       if ($perm{'mgr'}) {
           my @sections;
           if ($env{'request.course.sec'} ne '') {
               @sections = ($env{'request.course.sec'});
           } else {
               @sections = &Apache::loncommon::get_env_multiple('form.section');
           }
           if (grep(/^all$/,@sections)) {
               $showmore = 1;
           } else {
               foreach my $sec (@sections) {
                   if (&canmodify($sec)) {
                       $showmore = 1;
                       last;
                   }
               }
           }
       }
   
       if ($showmore) {
           $gradeTable .=
                      &Apache::lonhtmlcommon::row_closure()
                   .&Apache::lonhtmlcommon::row_title(&mt('Send Messages'))                    .&Apache::lonhtmlcommon::row_title(&mt('Send Messages'))
                   .'<span class="LC_nobreak">'                    .'<span class="LC_nobreak">'
                   .'<label><input type="radio" name="compmsg" value="0"'.$nocompmsg.' />'                    .'<label><input type="radio" name="compmsg" value="0"'.$nocompmsg.' />'
Line 1176  LISTJAVASCRIPT Line 1199  LISTJAVASCRIPT
                   .&mt('Yes').('&nbsp;'x2).'</label>'                    .&mt('Yes').('&nbsp;'x2).'</label>'
                   .&Apache::lonhtmlcommon::row_closure();                    .&Apache::lonhtmlcommon::row_closure();
   
     $gradeTable .= &Apache::lonhtmlcommon::row_title(&mt('Grading Increments'))          $gradeTable .= 
                      &Apache::lonhtmlcommon::row_title(&mt('Grading Increments'))
                   .'<select name="increment">'                    .'<select name="increment">'
                   .'<option value="1">'.&mt('Whole Points').'</option>'                    .'<option value="1">'.&mt('Whole Points').'</option>'
                   .'<option value=".5">'.&mt('Half Points').'</option>'                    .'<option value=".5">'.&mt('Half Points').'</option>'
                   .'<option value=".25">'.&mt('Quarter Points').'</option>'                    .'<option value=".25">'.&mt('Quarter Points').'</option>'
                   .'<option value=".1">'.&mt('Tenths of a Point').'</option>'                    .'<option value=".1">'.&mt('Tenths of a Point').'</option>'
                   .'</select>';                    .'</select>';
       }
     $gradeTable .=       $gradeTable .= 
         &build_section_inputs().          &build_section_inputs().
  '<input type="hidden" name="submitonly"  value="'.$submitonly.'" />'."\n".   '<input type="hidden" name="submitonly"  value="'.$submitonly.'" />'."\n".
Line 3977  sub viewgrades { Line 4002  sub viewgrades {
     }      }
   
     my ($common_header,$specific_header,@sections,$section_display);      my ($common_header,$specific_header,@sections,$section_display);
     @sections = &Apache::loncommon::get_env_multiple('form.section');      if ($env{'request.course.sec'} ne '') {
           @sections = ($env{'request.course.sec'});
       } else {
           @sections = &Apache::loncommon::get_env_multiple('form.section');
       }
   
   # Check if Save button should be usable
       my $disabled = ' disabled="disabled"';
       if ($perm{'mgr'}) {
           if (grep(/^all$/,@sections)) {
               undef($disabled);
           } else {
               foreach my $sec (@sections) {
                   if (&canmodify($sec)) {
                       undef($disabled);
                       last;
                   }
               }
           }
       }
     if (grep(/^all$/,@sections)) {      if (grep(/^all$/,@sections)) {
         @sections = ('all');          @sections = ('all');
         if ($group_display) {          if ($group_display) {
Line 4169  sub viewgrades { Line 4213  sub viewgrades {
     }      }
     $result.=&Apache::loncommon::end_data_table();      $result.=&Apache::loncommon::end_data_table();
     $result.='<input type="hidden" name="total" value="'.$ctr.'" />'."\n";      $result.='<input type="hidden" name="total" value="'.$ctr.'" />'."\n";
     $result.='<input type="button" value="'.&mt('Save').'" '.      $result.='<input type="button" value="'.&mt('Save').'"'.$disabled.' '.
  'onclick="javascript:submit();" target="_self" /></form>'."\n";   'onclick="javascript:submit();" target="_self" /></form>'."\n";
     if ($ctr == 0) {      if ($ctr == 0) {
         my $stu_status = join(' or ',&Apache::loncommon::get_env_multiple('form.Status'));          my $stu_status = join(' or ',&Apache::loncommon::get_env_multiple('form.Status'));
Line 5409  sub displayPage { Line 5453  sub displayPage {
  }   }
         $curRes = $iterator->next();          $curRes = $iterator->next();
     }      }
       my $disabled;
       unless (&canmodify($usec)) {
           $disabled = ' disabled="disabled"';
       }
   
     $studentTable.=      $studentTable.=
         '</table>'."\n".          '</table>'."\n".
         '<input type="button" value="'.&mt('Save').'" '.          '<input type="button" value="'.&mt('Save').'"'.$disabled.' '.
         'onclick="javascript:checkSubmitPage(this.form,'.$question.');" />'.          'onclick="javascript:checkSubmitPage(this.form,'.$question.');" />'.
         '</form>'."\n";          '</form>'."\n";
     $request->print($studentTable);      $request->print($studentTable);
Line 10382  sub grading_menu { Line 10430  sub grading_menu {
   
     $fields{'command'} = 'initialverifyreceipt';      $fields{'command'} = 'initialverifyreceipt';
     my $url5 = &Apache::lonhtmlcommon::build_url('grades/',\%fields);      my $url5 = &Apache::lonhtmlcommon::build_url('grades/',\%fields);
       
       my %permissions;
       if ($perm{'mgr'}) {
           $permissions{'either'} = 'F';
           $permissions{'mgr'} = 'F';
       }
       if ($perm{'vgr'}) {
           $permissions{'either'} = 'F';
           $permissions{'vgr'} = 'F';
       }
   
     my @menu = ({ categorytitle=>'Hand Grading',      my @menu = ({ categorytitle=>'Hand Grading',
             items =>[              items =>[
                         { linktext => 'Select individual students to grade',                          { linktext => 'Select individual students to grade',
                     url => $url1a,                      url => $url1a,
                     permission => 'F',                      permission => $permissions{'either'},
                     icon => 'grade_students.png',                      icon => 'grade_students.png',
                     linktitle => 'Grade current resource for a selection of students.'                      linktitle => 'Grade current resource for a selection of students.'
                         },                           }, 
                         {       linktext => 'Grade ungraded submissions',                          {       linktext => 'Grade ungraded submissions',
                                 url => $url1b,                                  url => $url1b,
                                 permission => 'F',                                  permission => $permissions{'either'},
                                 icon => 'ungrade_sub.png',                                  icon => 'ungrade_sub.png',
                                 linktitle => 'Grade all submissions that have not been graded yet.'                                  linktitle => 'Grade all submissions that have not been graded yet.'
                         },                          },
   
                         {       linktext => 'Grading table',                          {       linktext => 'Grading table',
                                 url => $url1c,                                  url => $url1c,
                                 permission => 'F',                                  permission => $permissions{'either'},
                                 icon => 'grading_table.png',                                  icon => 'grading_table.png',
                                 linktitle => 'Grade current resource for all students.'                                  linktitle => 'Grade current resource for all students.'
                         },                          },
                         {       linktext => 'Grade page/folder for one student',                          {       linktext => 'Grade page/folder for one student',
                                 url => $url1d,                                  url => $url1d,
                                 permission => 'F',                                  permission => $permissions{'either'},
                                 icon => 'grade_PageFolder.png',                                  icon => 'grade_PageFolder.png',
                                 linktitle => 'Grade all resources in current page/sequence/folder for one student.'                                  linktitle => 'Grade all resources in current page/sequence/folder for one student.'
                         },                          },
                         {       linktext => 'Download submissions',                          {       linktext => 'Download submissions',
                                 url => $url1e,                                  url => $url1e,
                                 permission => 'F',                                  permission => $permissions{'either'},
                                 icon => 'download_sub.png',                                  icon => 'download_sub.png',
                                 linktitle => 'Download all students submissions.'                                  linktitle => 'Download all students submissions.'
                         }]},                          }]},
Line 10421  sub grading_menu { Line 10479  sub grading_menu {
   
                    { linktext => 'Upload Scores',                     { linktext => 'Upload Scores',
                     url => $url2,                      url => $url2,
                     permission => 'F',                      permission => $permissions{'mgr'},
                     icon => 'uploadscores.png',                      icon => 'uploadscores.png',
                     linktitle => 'Specify a file containing the class scores for current resource.'                      linktitle => 'Specify a file containing the class scores for current resource.'
                    },                     },
                    { linktext => 'Process Clicker',                     { linktext => 'Process Clicker',
                     url => $url3,                      url => $url3,
                     permission => 'F',                      permission => $permissions{'mgr'},
                     icon => 'addClickerInfoFile.png',                      icon => 'addClickerInfoFile.png',
                     linktitle => 'Specify a file containing the clicker information for this resource.'                      linktitle => 'Specify a file containing the clicker information for this resource.'
                    },                     },
                    { linktext => 'Grade/Manage/Review Bubblesheets',                     { linktext => 'Grade/Manage/Review Bubblesheets',
                     url => $url4,                      url => $url4,
                     permission => 'F',                      permission => $permissions{'mgr'},
                     icon => 'bubblesheet.png',                      icon => 'bubblesheet.png',
                     linktitle => 'Grade bubblesheet exams, upload/download bubblesheet data files, and review previously graded bubblesheet exams.'                      linktitle => 'Grade bubblesheet exams, upload/download bubblesheet data files, and review previously graded bubblesheet exams.'
                    },                     },
                             {   linktext => 'Verify Receipt Number',                              {   linktext => 'Verify Receipt Number',
                                 url => $url5,                                  url => $url5,
                                 permission => 'F',                                  permission => $permissions{'either'},
                                 icon => 'receipt_number.png',                                  icon => 'receipt_number.png',
                                 linktitle => 'Verify a system-generated receipt number for correct problem solution.'                                  linktitle => 'Verify a system-generated receipt number for correct problem solution.'
                             }                              }
Line 11337  sub select_problem { Line 11395  sub select_problem {
     $r->print('<input type="submit" value="'.&mt('Next').' &rarr;" /></form>');      $r->print('<input type="submit" value="'.&mt('Next').' &rarr;" /></form>');
 }  }
   
 sub css_links {  
     my ($currsymb,$level) = @_;  
     my ($links,@symbs,%cssrefs,%httpref);  
     if ($level eq 'map') {  
         my $navmap = Apache::lonnavmaps::navmap->new();  
         if (ref($navmap)) {  
             my ($map,undef,$url)=&Apache::lonnet::decode_symb($currsymb);  
             my @resources = $navmap->retrieveResources($map,sub { $_[0]->is_problem() },0,0);  
             foreach my $res (@resources) {  
                 if (ref($res)) {  
                     if ($res->symb()) {  
                         push(@symbs,$res->symb());  
                     }  
                 }  
             }  
         }  
     } else {  
         @symbs = ($currsymb);  
     }  
     foreach my $symb (@symbs) {  
         my $css_href = &Apache::lonnet::EXT('resource.0.cssfile',$symb);  
         if ($css_href =~ /\S/) {  
             unless ($css_href =~ m{https?://}) {  
                 my ($map,undef,$url)=&Apache::lonnet::decode_symb($symb);  
                 my $proburl =  &Apache::lonnet::clutter($url);  
                 my ($probdir) = ($proburl =~ m{(.+)/[^/]+$});  
                 unless ($css_href =~ m{^/}) {  
                     $css_href = &Apache::lonnet::hreflocation($probdir,$css_href);  
                 }  
                 if ($css_href =~ m{^/(res|uploaded)/}) {  
                     unless (($httpref{'httpref.'.$css_href}) |  
                             (&Apache::lonnet::is_on_map($css_href))) {  
                         my $thisurl = $proburl;  
                         if ($env{'httpref.'.$proburl}) {  
                             $thisurl = $env{'httpref.'.$proburl};  
                         }  
                         $httpref{'httpref.'.$css_href} = $thisurl;  
                     }  
                 }  
             }  
             $cssrefs{$css_href} = 1;  
         }  
     }  
     if (keys(%httpref)) {  
         &Apache::lonnet::appenv(\%httpref);  
     }  
     if (keys(%cssrefs)) {  
         foreach my $css_href (keys(%cssrefs)) {  
             next unless ($css_href =~ m{^(/res/|/uploaded/|https?://)});  
             $links .= '<link rel="stylesheet" type="text/css" href="'.$css_href.'" />'."\n";  
         }  
     }  
     return $links;  
 }  
   
 sub handler {  sub handler {
     my $request=$_[0];      my $request=$_[0];
     &reset_caches();      &reset_caches();
Line 11457  sub handler { Line 11460  sub handler {
             } else {              } else {
                 $divforres = 1;                  $divforres = 1;
             }              }
             my $csslinks = &css_links($symb);              my $head_extra = $js;
             my $head_extra = $js."\n".$csslinks;              unless ($env{'form.vProb'} eq 'no') {
                   my $csslinks = &Apache::loncommon::css_links($symb);
                   if ($csslinks) {
                       $head_extra .= "\n$csslinks";
                   }
               }
             &startpage($request,$symb,[{href=>"", text=>"Student Submissions"}],undef,undef,              &startpage($request,$symb,[{href=>"", text=>"Student Submissions"}],undef,undef,
                        $stuvcurrent,$stuvdisp,undef,$head_extra,$onload,$divforres);                         $stuvcurrent,$stuvdisp,undef,$head_extra,$onload,$divforres);
             if ($versionform) {              if ($versionform) {
Line 11473  sub handler { Line 11481  sub handler {
                 &choose_task_version_form($symb,$env{'form.student'},                  &choose_task_version_form($symb,$env{'form.student'},
                                           $env{'form.userdom'},                                            $env{'form.userdom'},
                                           $env{'form.inhibitmenu'});                                            $env{'form.inhibitmenu'});
             my $csslinks = &css_links($symb);              my $head_extra = $js;
             my $head_extra = $js."\n".$csslinks;              unless ($env{'form.vProb'} eq 'no') {
                   my $csslinks = &Apache::loncommon::css_links($symb);
                   if ($csslinks) {
                       $head_extra .= "\n$csslinks";
                   }
               }
             &startpage($request,$symb,[{href=>"", text=>"Previous Student Version"}],undef,undef,              &startpage($request,$symb,[{href=>"", text=>"Previous Student Version"}],undef,undef,
                        $stuvcurrent,$stuvdisp,$env{'form.inhibitmenu'},$head_extra);                         $stuvcurrent,$stuvdisp,$env{'form.inhibitmenu'},$head_extra);
             if ($versionform) {              if ($versionform) {
Line 11487  sub handler { Line 11500  sub handler {
                                        {href=>'',text=>'Select student'}],1,1);                                         {href=>'',text=>'Select student'}],1,1);
     &pickStudentPage($request,$symb);      &pickStudentPage($request,$symb);
  } elsif ($command eq 'displayPage' && $perm{'vgr'}) {   } elsif ($command eq 'displayPage' && $perm{'vgr'}) {
             my $csslinks = &css_links($symb,'map');              my $csslinks;
               unless ($env{'form.vProb'} eq 'no') {
                   $csslinks = &Apache::loncommon::css_links($symb,'map');
               }
             &startpage($request,$symb,              &startpage($request,$symb,
                                       [{href=>&href_symb_cmd($symb,'all_for_one'),text=>'Grade page/folder for one student'},                                        [{href=>&href_symb_cmd($symb,'all_for_one'),text=>'Grade page/folder for one student'},
                                        {href=>'',text=>'Select student'},                                         {href=>'',text=>'Select student'},
Line 11500  sub handler { Line 11516  sub handler {
                                        {href=>'',text=>'Store grades'}],1,1);                                         {href=>'',text=>'Store grades'}],1,1);
     &updateGradeByPage($request,$symb);      &updateGradeByPage($request,$symb);
  } elsif ($command eq 'processGroup' && $perm{'vgr'}) {   } elsif ($command eq 'processGroup' && $perm{'vgr'}) {
             my $csslinks = &css_links($symb);              my $csslinks;
               unless ($env{'form.vProb'} eq 'no') {
                   $csslinks = &Apache::loncommon::css_links($symb);
               }
             &startpage($request,$symb,[{href=>'',text=>'...'},              &startpage($request,$symb,[{href=>'',text=>'...'},
                                        {href=>'',text=>'Modify grades'}],undef,undef,undef,undef,undef,$csslinks,undef,1);                                         {href=>'',text=>'Modify grades'}],undef,undef,undef,undef,undef,$csslinks,undef,1);
     &processGroup($request,$symb);      &processGroup($request,$symb);

Removed from v.1.777  
changed lines
  Added in v.1.781


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>