Diff for /loncom/interface/lonquickgrades.pm between versions 1.110 and 1.111

version 1.110, 2017/06/26 01:56:58 version 1.111, 2017/11/16 13:41:56
Line 77  sub real_handler { Line 77  sub real_handler {
     }      }
   
     my $cangrade=&Apache::lonnet::allowed('mgr');      my $cangrade=&Apache::lonnet::allowed('mgr');
       my $showPoints =
           (($env{'course.'.$env{'request.course.id'}.'.grading'} eq 'standard')
         || ($env{'course.'.$env{'request.course.id'}.'.grading'} eq 'categories'));
   
       my $reinitresult;
   
     unless ($cangrade) {      unless ($cangrade) {
         # Check for critical messages and redirect if present.          # Check for critical messages and redirect if present.
Line 89  sub real_handler { Line 94  sub real_handler {
   
         # Check if course needs to be re-initialized          # Check if course needs to be re-initialized
         my $loncaparev = $r->dir_config('lonVersion');          my $loncaparev = $r->dir_config('lonVersion');
         my ($result,@reinit) = &Apache::loncommon::needs_coursereinit($loncaparev);          ($reinitresult,my @reinit) = &Apache::loncommon::needs_coursereinit($loncaparev);
   
         if ($result eq 'switch') {          if ($reinitresult eq 'switch') {
             &Apache::loncommon::content_type($r,'text/html');              &Apache::loncommon::content_type($r,'text/html');
             $r->send_http_header;              $r->send_http_header;
             $r->print(&Apache::loncommon::check_release_result(@reinit));              $r->print(&Apache::loncommon::check_release_result(@reinit));
             return OK;              return OK;
         } elsif ($result eq 'update') {          } elsif ($reinitresult eq 'update') {
             my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};              my $cid = $env{'request.course.id'};
             my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};              my $cnum = $env{'course.'.$cid.'.num'};
               my $cdom = $env{'course.'.$cid.'.domain'};
               &Apache::loncommon::content_type($r,'text/html');
               $r->send_http_header;
               &startpage($r,$showPoints);
               my $preamble = '<div id="LC_update_'.$cid.'" class="LC_info">'.
                              '<br />'.
                              &mt('Your course session is being updated because of recent changes by course personnel.').
                              ' '.&mt('Please be patient.').'<br /></div>'.
                              '<div style="padding:0;clear:both;margin:0;border:0"></div>';
               %prog_state = &Apache::lonhtmlcommon::Create_PrgWin($r,undef,$preamble);
               &Apache::lonhtmlcommon::Update_PrgWin($r,\%prog_state,&mt('Updating course'));
               $r->rflush();
             my ($furl,$ferr) = &Apache::lonuserstate::readmap("$cdom/$cnum");              my ($furl,$ferr) = &Apache::lonuserstate::readmap("$cdom/$cnum");
               &Apache::lonhtmlcommon::Update_PrgWin($r,\%prog_state,&mt('Finished')); 
               &Apache::lonhtmlcommon::Close_PrgWin($r,\%prog_state);
               my $closure = <<ENDCLOSE;
   <script type="text/javascript">
   // <![CDATA[
   \$("#LC_update_$cid").hide('slow');
   // ]]>
   </script>
   ENDCLOSE
             if ($ferr) {              if ($ferr) {
                   $r->print($closure.&Apache::loncommon::end_page());
                 my $requrl = $r->uri;                  my $requrl = $r->uri;
                 $env{'user.error.msg'}="$requrl:bre:0:0:Course not initialized";                  $env{'user.error.msg'}="$requrl:bre:0:0:Course not initialized";
                 $env{'user.reinit'} = 1;                  $env{'user.reinit'} = 1;
                 return HTTP_NOT_ACCEPTABLE;                  return HTTP_NOT_ACCEPTABLE;
               } else {
                  $r->print($closure);
             }              }
         } elsif ((&Apache::loncommon::course_type() eq 'Placement') &&          } elsif ((&Apache::loncommon::course_type() eq 'Placement') &&
                  (!$env{'request.role.adv'})) {                   (!$env{'request.role.adv'})) {
Line 115  sub real_handler { Line 144  sub real_handler {
         }          }
     }      }
   
     # Send header, don't cache this page      unless ($reinitresult eq 'update') {
     &Apache::loncommon::no_cache($r);          # Send header, don't cache this page
     $r->send_http_header;          &Apache::loncommon::no_cache($r);
           $r->send_http_header;
     my $showPoints =          &startpage($r,$showPoints);
         (($env{'course.'.$env{'request.course.id'}.'.grading'} eq 'standard')      }
       || ($env{'course.'.$env{'request.course.id'}.'.grading'} eq 'categories'));      $r->rflush();
     my $notshowSPRSlink =  
         (($env{'course.'.$env{'request.course.id'}.'.grading'} eq 'external')  
       || ($env{'course.'.$env{'request.course.id'}.'.grading'} eq 'externalnototals'));  
     my $notshowTotals=  
         $env{'course.'.$env{'request.course.id'}.'.grading'} eq 'externalnototals';  
     my $showCategories=  
         $env{'course.'.$env{'request.course.id'}.'.grading'} eq 'categories';  
   
   
     my $title = "Grading and Statistics";#$showPoints ? "Points Display" : "Completed Problems Display";  
     my $brcrum = [{href=>"/adm/quickgrades",text => "Points Display"}];  
     $r->print(&Apache::loncommon::start_page($title,undef,  
                                             {'bread_crumbs' => $brcrum})  
              );  
   
     &startGradeScreen($r,'quick');      &startGradeScreen($r,'quick');
   
Line 204  sub real_handler { Line 219  sub real_handler {
     }      }
     $r->rflush();      $r->rflush();
   
       my $notshowSPRSlink =
           (($env{'course.'.$env{'request.course.id'}.'.grading'} eq 'external')
         || ($env{'course.'.$env{'request.course.id'}.'.grading'} eq 'externalnototals'));
       my $notshowTotals=
           $env{'course.'.$env{'request.course.id'}.'.grading'} eq 'externalnototals';
       my $showCategories=
           $env{'course.'.$env{'request.course.id'}.'.grading'} eq 'categories';
   
     my ($navmap,$totalParts,$totalPossible,$totalRight,$totalAttempted,$topLevelParts,$topLevelRight,$topLevelAttempted)=      my ($navmap,$totalParts,$totalPossible,$totalRight,$totalAttempted,$topLevelParts,$topLevelRight,$topLevelAttempted)=
        &getData($showPoints,$uname,$udom);         &getData($showPoints,$uname,$udom);
   
Line 248  sub getAllStudentData { Line 271  sub getAllStudentData {
     }      }
 }  }
   
   sub startpage {
       my ($r,$showPoints) = @_;
       my $title = "Grading and Statistics";#$showPoints ? "Points Display" : "Completed Problems Display";
       my $brcrum = [{href=>"/adm/quickgrades",text => "Points Display"}];
       $r->print(&Apache::loncommon::start_page($title,undef,
                                               {'bread_crumbs' => $brcrum})
                );
   }
   
 sub startGradeScreen {  sub startGradeScreen {
     my ($r,$mode)=@_;      my ($r,$mode)=@_;

Removed from v.1.110  
changed lines
  Added in v.1.111


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