Diff for /loncom/homework/grades.pm between versions 1.778 and 1.779

version 1.778, 2020/11/09 00:44:30 version 1.779, 2020/11/10 17:17:54
Line 11337  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 11459  sub handler { Line 11404  sub handler {
             }              }
             my $head_extra = $js;              my $head_extra = $js;
             unless ($env{'form.vProb'} eq 'no') {              unless ($env{'form.vProb'} eq 'no') {
                 my $csslinks = &css_links($symb);                  my $csslinks = &Apache::loncommon::css_links($symb);
                 if ($csslinks) {                  if ($csslinks) {
                     $head_extra .= "\n$csslinks";                      $head_extra .= "\n$csslinks";
                 }                  }
Line 11480  sub handler { Line 11425  sub handler {
                                           $env{'form.inhibitmenu'});                                            $env{'form.inhibitmenu'});
             my $head_extra = $js;              my $head_extra = $js;
             unless ($env{'form.vProb'} eq 'no') {              unless ($env{'form.vProb'} eq 'no') {
                 my $csslinks = &css_links($symb);                  my $csslinks = &Apache::loncommon::css_links($symb);
                 if ($csslinks) {                  if ($csslinks) {
                     $head_extra .= "\n$csslinks";                      $head_extra .= "\n$csslinks";
                 }                  }
Line 11499  sub handler { Line 11444  sub handler {
  } elsif ($command eq 'displayPage' && $perm{'vgr'}) {   } elsif ($command eq 'displayPage' && $perm{'vgr'}) {
             my $csslinks;              my $csslinks;
             unless ($env{'form.vProb'} eq 'no') {              unless ($env{'form.vProb'} eq 'no') {
                 $csslinks = &css_links($symb,'map');                  $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'},
Line 11515  sub handler { Line 11460  sub handler {
  } elsif ($command eq 'processGroup' && $perm{'vgr'}) {   } elsif ($command eq 'processGroup' && $perm{'vgr'}) {
             my $csslinks;              my $csslinks;
             unless ($env{'form.vProb'} eq 'no') {              unless ($env{'form.vProb'} eq 'no') {
                 $csslinks = &css_links($symb);                  $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);

Removed from v.1.778  
changed lines
  Added in v.1.779


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