Diff for /loncom/auth/lonroles.pm between versions 1.243 and 1.246

version 1.243, 2010/01/18 16:47:17 version 1.246, 2010/03/22 20:11:08
Line 57  course they should act on, etc. Both in Line 57  course they should act on, etc. Both in
 handler determines via C<lonnet>'s C<&allowed> function that a certain  handler determines via C<lonnet>'s C<&allowed> function that a certain
 action is not allowed, C<lonroles> is used as error handler. This  action is not allowed, C<lonroles> is used as error handler. This
 allows the user to select another role which may have permission to do  allows the user to select another role which may have permission to do
 what they were trying to do. C<lonroles> can also be accessed via the  what they were trying to do.
 B<CRS> button in the Remote Control.   
   
 =begin latex  =begin latex
   
Line 145  use HTML::Entities; Line 144  use HTML::Entities;
     
   
 sub redirect_user {  sub redirect_user {
     my ($r,$title,$url,$msg,$launch_nav) = @_;      my ($r,$title,$url,$msg) = @_;
     $msg = $title if (! defined($msg));      $msg = $title if (! defined($msg));
     &Apache::loncommon::content_type($r,'text/html');      &Apache::loncommon::content_type($r,'text/html');
     &Apache::loncommon::no_cache($r);      &Apache::loncommon::no_cache($r);
     $r->send_http_header;      $r->send_http_header;
     my $swinfo=&Apache::lonmenu::rawconfig();  
     my $navwindow;  
     if ($launch_nav eq 'on') {  
  $navwindow.=&Apache::lonnavdisplay::launch_win('now',undef,undef,  
        ($url =~ m-^/adm/whatsnew-));  
     } else {  
  $navwindow.=&Apache::lonnavmaps::close();  
     }  
   
     # Breadcrumbs      # Breadcrumbs
     my $brcrum = [{'href' => $url,      my $brcrum = [{'href' => $url,
Line 172  sub redirect_user { Line 163  sub redirect_user {
     $url=~s/ /\%20/g;      $url=~s/ /\%20/g;
     $r->print(<<ENDREDIR);      $r->print(<<ENDREDIR);
 $start_page  $start_page
 <script type="text/javascript">  
 // <![CDATA[  
 $swinfo  
 // ]]>  
 </script>  
 $navwindow  
 <p>$msg</p>  <p>$msg</p>
 $end_page  $end_page
 ENDREDIR  ENDREDIR
Line 503  ENDENTERKEY Line 488  ENDENTERKEY
                                             my $esc_symb = &HTML::Entities::encode($env{'form.destsymb'},'"<>&');                                              my $esc_symb = &HTML::Entities::encode($env{'form.destsymb'},'"<>&');
                                             $dest .= '?symb='.$esc_symb;                                              $dest .= '?symb='.$esc_symb;
                                         }                                          }
                                         &redirect_user($r,&mt('Entering [_1]',                                          &redirect_user($r, &mt('Entering [_1]',
                                                       $env{'course.'.$courseid.'.description'}),                                                         $env{'course.'.$courseid.'.description'}),
                                                $dest,$msg,                                                         $dest, $msg);
                                                $env{'environment.remotenavmap'});  
                                         return OK;                                          return OK;
                                     }                                      }
     if (&Apache::lonnet::allowed('whn',      if (&Apache::lonnet::allowed('whn',
Line 519  ENDENTERKEY Line 503  ENDENTERKEY
  unless ($startpage eq 'firstres') {            unless ($startpage eq 'firstres') {         
     $msg = &mt('Entering [_1] ...',      $msg = &mt('Entering [_1] ...',
        $env{'course.'.$courseid.'.description'});         $env{'course.'.$courseid.'.description'});
     &redirect_user($r,&mt('New in course'),      &redirect_user($r, &mt('New in course'),
    '/adm/whatsnew?refpage=start',$msg,                                         '/adm/whatsnew?refpage=start', $msg);
    $env{'environment.remotenavmap'});  
     return OK;      return OK;
  }   }
     }      }
Line 533  ENDENTERKEY Line 516  ENDENTERKEY
  }   }
                                 $msg = &mt('Entering [_1] ...',                                  $msg = &mt('Entering [_1] ...',
    $env{'course.'.$courseid.'.description'});     $env{'course.'.$courseid.'.description'});
  &redirect_user($r,&mt('Entering [_1]',   &redirect_user($r, &mt('Entering [_1]',
       $env{'course.'.$courseid.'.description'}),                                 $env{'course.'.$courseid.'.description'}),
        $furl,$msg,                                 $furl, $msg);
        $env{'environment.remotenavmap'});  
     }      }
     return OK;      return OK;
  }   }
Line 1233  sub requestcourse_advice { Line 1215  sub requestcourse_advice {
     return;      return;
 }  }
   
 sub queued_selfenrollment {  
     my ($r) = @_;  
     my %selfenrollrequests = &Apache::lonnet::dump('selfenrollrequests');  
     my %reqs_by_date;  
     foreach my $item (keys(%selfenrollrequests)) {  
         if (ref($selfenrollrequests{$item}) eq 'HASH') {  
             if ($selfenrollrequests{$item}{'status'} eq 'request') {  
                 if ($selfenrollrequests{$item}{'timestamp'}) {  
                     push(@{$reqs_by_date{$selfenrollrequests{$item}{'timestamp'}}},$item);  
                 }  
             }   
         }  
     }  
     if (keys(%reqs_by_date)) {  
         my $rolename = &Apache::lonnet::plaintext('st');  
         $r->print('<b>'.&mt('Enrollment requests pending Course Coordinator approval').'</b><br />'.  
                   &Apache::loncommon::start_data_table().  
                   &Apache::loncommon::start_data_table_header_row().  
                   '<th>'.&mt('Date requested').'</th><th>'.&mt('Course title').'</th>'.  
                   '<th>'.&mt('User role').'</th><th>'.&mt('Section').'</th>'.  
                  &Apache::loncommon::end_data_table_header_row());  
         my @sorted = sort { $a <=> $b } (keys(%reqs_by_date));  
         foreach my $item (@sorted) {  
             if (ref($reqs_by_date{$item}) eq 'ARRAY') {  
                 foreach my $crs (@{$reqs_by_date{$item}}) {  
                     my %courseinfo = &Apache::lonnet::coursedescription($crs);  
                     my $usec = $selfenrollrequests{$crs}{'section'};  
                     if ($usec eq '') {  
                         $usec = &mt('No section');   
                     }  
                     $r->print(&Apache::loncommon::start_data_table_row().  
                              '<td>'.&Apache::lonlocal::locallocaltime($item).'</td>'.  
                              '<td>'.$courseinfo{'description'}.'</td>'.  
                              '<td>'.$rolename.'</td><td>'.$usec.'</td>'.  
                              &Apache::loncommon::end_data_table_row());  
                 }  
             }  
         }  
         $r->print(&Apache::loncommon::end_data_table());  
     }  
     return;  
 }  
   
 sub privileges_info {  sub privileges_info {
     my ($which) = @_;      my ($which) = @_;
     my $output;      my $output;
Line 1694  course they should act on, etc. Both in Line 1633  course they should act on, etc. Both in
 handler determines via C<lonnet>'s C<&allowed> function that a certain  handler determines via C<lonnet>'s C<&allowed> function that a certain
 action is not allowed, C<lonroles> is used as error handler. This  action is not allowed, C<lonroles> is used as error handler. This
 allows the user to select another role which may have permission to do  allows the user to select another role which may have permission to do
 what they were trying to do. C<lonroles> can also be accessed via the  what they were trying to do.
 B<CRS> button in the Remote Control.   
   
 =begin latex  =begin latex
   

Removed from v.1.243  
changed lines
  Added in v.1.246


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