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

version 1.773, 2020/08/30 20:30:21 version 1.777, 2020/11/08 22:23:52
Line 293  sub showResourceInfo { Line 293  sub showResourceInfo {
         $result .= '</div></fieldset>';          $result .= '</div></fieldset>';
     }      }
     $result .= '</div><div style="padding:0;clear:both;margin:0;border:0"></div>';      $result .= '</div><div style="padding:0;clear:both;margin:0;border:0"></div>';
       if (!keys(%partsseen)) {
           $result = '';
           if ($uploads) {
               return '<div style="padding:0;clear:both;margin:0;border:0"></div>'.
                      '<p class="LC_info">'.
                       &mt('No dropbox items or essayresponse items with uploadedfiletypes set.').
                      '</p>';
           } else {
               return '<br clear="all" />';
           }
       }
     return $result;      return $result;
 }  }
   
Line 2576  sub submission { Line 2587  sub submission {
                     $rndseed = $record{"resource.$partid.rndseed"};                      $rndseed = $record{"resource.$partid.rndseed"};
                 }                  }
         if ($env{'form.checkPlag'}) {          if ($env{'form.checkPlag'}) {
        my ($oname,$odom,$ocrsid,$oessay,$osim)=      my ($oname,$odom,$ocrsid,$oessay,$osim)=
         &most_similar($uname,$udom,$symb,$subval);      &most_similar($uname,$udom,$symb,$subval);
     if ($osim) {      if ($osim) {
  $osim=int($osim*100.0);   $osim=int($osim*100.0);
                         if ($hide eq 'anon') {                          if ($hide eq 'anon') {
Line 2641  sub submission { Line 2652  sub submission {
                         '('.&mt('Response ID: [_1]',$respid).')'.                          '('.&mt('Response ID: [_1]',$respid).')'.
                         '</span>&nbsp; &nbsp;';                          '</span>&nbsp; &nbsp;';
     my $files=&get_submitted_files($udom,$uname,$partid,$respid,\%record);      my $files=&get_submitted_files($udom,$uname,$partid,$respid,\%record);
                           
     if (@$files) {      if (@$files) {
                         if ($hide eq 'anon') {                          if ($hide eq 'anon') {
                             $lastsubonly.='<br />'.&mt('[quant,_1,file] uploaded to this anonymous survey',scalar(@{$files}));                              $lastsubonly.='<br />'.&mt('[quant,_1,file] uploaded to this anonymous survey',scalar(@{$files}));
Line 2653  sub submission { Line 2663  sub submission {
                             } else {                              } else {
                                 $lastsubonly .= &mt('Like all files provided by users, these files may contain viruses!');                                  $lastsubonly .= &mt('Like all files provided by users, these files may contain viruses!');
                             }                              }
                             $lastsubonly .= '</span>';                                                       $lastsubonly .= '</span>';
                             foreach my $file (@$files) {                              foreach my $file (@$files) {
                                 &Apache::lonnet::allowuploaded('/adm/grades',$file);                                  &Apache::lonnet::allowuploaded('/adm/grades',$file);
                                 $lastsubonly.='<br /><a href="'.$file.'?rawmode=1" target="lonGRDs"><img src="'.&Apache::loncommon::icon($file).'" border="0" alt="" /> '.$file.'</a>';                                  $lastsubonly.='<br /><a href="'.$file.'?rawmode=1" target="lonGRDs"><img src="'.&Apache::loncommon::icon($file).'" border="0" alt="" /> '.$file.'</a>';
Line 2664  sub submission { Line 2674  sub submission {
                     if ($hide eq 'anon') {                      if ($hide eq 'anon') {
                         $lastsubonly.='<br /><b>'.&mt('Anonymous Survey').'</b>';                           $lastsubonly.='<br /><b>'.&mt('Anonymous Survey').'</b>'; 
                     } else {                      } else {
                      $lastsubonly.='<br /><b>'.&mt('Submitted Answer:').' </b>';                          $lastsubonly.='<br /><b>'.&mt('Submitted Answer:').' </b>';
                         if ($draft) {                          if ($draft) {
                             $lastsubonly.= ' <span class="LC_warning">'.&mt('Draft Copy').'</span>';                              $lastsubonly.= ' <span class="LC_warning">'.&mt('Draft Copy').'</span>';
                         }                          }
Line 2676  sub submission { Line 2686  sub submission {
                         }                          }
                         $lastsubonly.=$subval."\n";                          $lastsubonly.=$subval."\n";
                     }                      }
             if ($similar) {$lastsubonly.="<br /><br />$similar\n";}                      if ($similar) {$lastsubonly.="<br /><br />$similar\n";}
     $lastsubonly.='</div>';      $lastsubonly.='</div>';
  }   }
             }              }
Line 3242  sub processHandGrade { Line 3252  sub processHandGrade {
  # Keywords sorted in alphabatical order   # Keywords sorted in alphabatical order
  my $loginuser = $env{'user.name'}.':'.$env{'user.domain'};   my $loginuser = $env{'user.name'}.':'.$env{'user.domain'};
  $env{'form.keywords'}           =~ s/,\s{0,}|\s+/ /g;   $env{'form.keywords'}           =~ s/,\s{0,}|\s+/ /g;
  $env{'form.keywords'}           =~ s/^\s+|\s+$//;   $env{'form.keywords'}           =~ s/^\s+|\s+$//g;
  my (@keywords) = sort(split(/\s+/,$env{'form.keywords'}));   my (@keywords) = sort(split(/\s+/,$env{'form.keywords'}));
  $env{'form.keywords'} = join(' ',@keywords);   $env{'form.keywords'} = join(' ',@keywords);
  $keyhash{$symb.'_keywords'}     = $env{'form.keywords'};   $keyhash{$symb.'_keywords'}     = $env{'form.keywords'};
Line 9462  END Line 9472  END
                             if ($count > 1) {                              if ($count > 1) {
                                 $formatextra = '<div style="display:none" id="bubbletype">'.                                  $formatextra = '<div style="display:none" id="bubbletype">'.
                                                '<span class="LC_nobreak">'.                                                 '<span class="LC_nobreak">'.
                                                &mt('Bubblesheet type:').'&nbsp;'.                                                 &mt('Bubblesheet type').':&nbsp;'.
                                                &scantron_scantab().'</span></div>';                                                 &scantron_scantab().'</span></div>';
                                 $onclick = ' onclick="toggleScantab(this.form);"';                                  $onclick = ' onclick="toggleScantab(this.form);"';
                                 $formatjs = <<"END";                                  $formatjs = <<"END";
Line 11295  sub navmap_errormsg { Line 11305  sub navmap_errormsg {
 }  }
   
 sub startpage {  sub startpage {
     my ($r,$symb,$crumbs,$onlyfolderflag,$nodisplayflag,$stuvcurrent,$stuvdisp,$nomenu,$js,$onload,$divforres) = @_;      my ($r,$symb,$crumbs,$onlyfolderflag,$nodisplayflag,$stuvcurrent,$stuvdisp,$nomenu,$head_extra,$onload,$divforres) = @_;
     my %args;      my %args;
     if ($onload) {      if ($onload) {
          my %loaditems = (           my %loaditems = (
Line 11305  sub startpage { Line 11315  sub startpage {
     }      }
     if ($nomenu) {      if ($nomenu) {
         $args{'only_body'} = 1;           $args{'only_body'} = 1; 
         $r->print(&Apache::loncommon::start_page("Student's Version",$js,\%args));          $r->print(&Apache::loncommon::start_page("Student's Version",$head_extra,\%args));
     } else {      } else {
         unshift(@$crumbs,{href=>&href_symb_cmd($symb,'gradingmenu'),text=>"Grading"});          unshift(@$crumbs,{href=>&href_symb_cmd($symb,'gradingmenu'),text=>"Grading"});
         $args{'bread_crumbs'} = $crumbs;          $args{'bread_crumbs'} = $crumbs;
         $r->print(&Apache::loncommon::start_page('Grading',$js,\%args));          $r->print(&Apache::loncommon::start_page('Grading',$head_extra,\%args));
         if ($env{'request.course.id'}) {          if ($env{'request.course.id'}) {
             &Apache::lonquickgrades::startGradeScreen($r,($env{'form.symb'}?'probgrading':'grading'));              &Apache::lonquickgrades::startGradeScreen($r,($env{'form.symb'}?'probgrading':'grading'));
         }          }
Line 11327  sub select_problem { Line 11337  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 11392  sub handler { Line 11457  sub handler {
             } else {              } else {
                 $divforres = 1;                  $divforres = 1;
             }              }
             &startpage($request,$symb,[{href=>"", text=>"Student Submissions"}],undef,undef,$stuvcurrent,$stuvdisp,undef,$js,$onload,$divforres);              my $csslinks = &css_links($symb);
               my $head_extra = $js."\n".$csslinks;
               &startpage($request,$symb,[{href=>"", text=>"Student Submissions"}],undef,undef,
                          $stuvcurrent,$stuvdisp,undef,$head_extra,$onload,$divforres);
             if ($versionform) {              if ($versionform) {
                   if ($divforres) {
                       $request->print('<div style="padding:0;clear:both;margin:0;border:0"></div>');
                   }
                 $request->print($versionform);                  $request->print($versionform);
             }              }
     ($env{'form.student'} eq '' ? &listStudents($request,$symb,'',$divforres) : &submission($request,0,0,$symb,$divforres,$command));      ($env{'form.student'} eq '' ? &listStudents($request,$symb,'',$divforres) : &submission($request,0,0,$symb,$divforres,$command));
Line 11402  sub handler { Line 11473  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'});
             &startpage($request,$symb,[{href=>"", text=>"Previous Student Version"}],undef,undef,$stuvcurrent,$stuvdisp,$env{'form.inhibitmenu'},$js);              my $csslinks = &css_links($symb);
               my $head_extra = $js."\n".$csslinks;
               &startpage($request,$symb,[{href=>"", text=>"Previous Student Version"}],undef,undef,
                          $stuvcurrent,$stuvdisp,$env{'form.inhibitmenu'},$head_extra);
             if ($versionform) {              if ($versionform) {
                 $request->print($versionform);                  $request->print($versionform);
             }              }
Line 11413  sub handler { Line 11487  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');
             &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'},
                                        {href=>'',text=>'Grade student'}],1,1);                                         {href=>'',text=>'Grade student'}],1,1,undef,undef,undef,$csslinks);
     &displayPage($request,$symb);      &displayPage($request,$symb);
  } elsif ($command eq 'gradeByPage' && $perm{'mgr'}) {   } elsif ($command eq 'gradeByPage' && $perm{'mgr'}) {
             &startpage($request,$symb,[{href=>&href_symb_cmd($symb,'all_for_one'),text=>'Grade page/folder for one student'},              &startpage($request,$symb,[{href=>&href_symb_cmd($symb,'all_for_one'),text=>'Grade page/folder for one student'},
Line 11425  sub handler { Line 11500  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);
             &startpage($request,$symb,[{href=>'',text=>'...'},              &startpage($request,$symb,[{href=>'',text=>'...'},
                                        {href=>'',text=>'Modify grades'}],undef,undef,undef,undef,undef,undef,undef,1);                                         {href=>'',text=>'Modify grades'}],undef,undef,undef,undef,undef,$csslinks,undef,1);
     &processGroup($request,$symb);      &processGroup($request,$symb);
  } elsif ($command eq 'gradingmenu' && $perm{'vgr'}) {   } elsif ($command eq 'gradingmenu' && $perm{'vgr'}) {
             &startpage($request,$symb);              &startpage($request,$symb);
Line 11546  sub handler { Line 11622  sub handler {
    [{href=>&href_symb_cmd($symb,'downloadfilesselect'), text=>'Select which submissions to download'},     [{href=>&href_symb_cmd($symb,'downloadfilesselect'), text=>'Select which submissions to download'},
     {href=>'', text=>'Download submitted files'}],      {href=>'', text=>'Download submitted files'}],
                undef,undef,undef,undef,undef,undef,undef,1);                 undef,undef,undef,undef,undef,undef,undef,1);
               $request->print('<div style="padding:0;clear:both;margin:0;border:0"></div>');
             &submit_download_link($request,$symb);              &submit_download_link($request,$symb);
  } elsif ($command) {   } elsif ($command) {
             &startpage($request,$symb,[{href=>'', text=>'Access denied'}]);              &startpage($request,$symb,[{href=>'', text=>'Access denied'}]);

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


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