Diff for /loncom/auth/lonroles.pm between versions 1.149 and 1.150

version 1.149, 2006/05/30 12:45:24 version 1.150, 2006/05/30 17:15:00
Line 77  ENDREDIR Line 77  ENDREDIR
     return;      return;
 }  }
   
   sub error_page {
       my ($r,$error,$dest)=@_;
       &Apache::loncommon::content_type($r,'text/html');
       &Apache::loncommon::no_cache($r);
       $r->send_http_header;
       return OK if $r->header_only;
       $r->print(&Apache::loncommon::start_page('Problems during Course Initialization').
         '<script type="text/javascript">'.
         &Apache::lonmenu::rawconfig().'</script>'.
         '<p>'.&mt('The following problems occurred:').
         $error.
         '</p><br /><a href="'.$dest.'>'.&mt('Continue').'</a>'.
         &Apache::loncommon::end_page());
   }
   
 sub handler {  sub handler {
   
     my $r = shift;      my $r = shift;
Line 242  ENDENTERKEY Line 257  ENDENTERKEY
     my $dest=$env{'form.orgurl'};      my $dest=$env{'form.orgurl'};
     if (&Apache::lonnet::allowed('adv') eq 'F') { $tadv=1; }      if (&Apache::lonnet::allowed('adv') eq 'F') { $tadv=1; }
     &Apache::lonnet::appenv('request.role.adv'=>$tadv);      &Apache::lonnet::appenv('request.role.adv'=>$tadv);
     $r->internal_redirect($dest);                              if (($ferr) && ($tadv)) {
    &error_page($r,$ferr,$dest);
       } else {
    $r->internal_redirect($dest);
       }
     return OK;      return OK;
  } else {   } else {
     unless ($env{'request.course.id'}) {      unless ($env{'request.course.id'}) {
Line 256  ENDENTERKEY Line 275  ENDENTERKEY
     }      }
     if (&Apache::lonnet::allowed('adv') eq 'F') { $tadv=1; }      if (&Apache::lonnet::allowed('adv') eq 'F') { $tadv=1; }
     &Apache::lonnet::appenv('request.role.adv'=>$tadv);      &Apache::lonnet::appenv('request.role.adv'=>$tadv);
       if (($ferr) && ($tadv)) {
     # Check to see if the user is a CC entering a course    &error_page($r,$ferr,$furl);
     # for the first time      } else {
     my (undef, undef, $role, $courseid) = split(/\./, $envkey);   # Check to see if the user is a CC entering a course 
     if (substr($courseid, 0, 1) eq '/') {   # for the first time
  $courseid = substr($courseid, 1);   my (undef, undef, $role, $courseid) = split(/\./, $envkey);
    if (substr($courseid, 0, 1) eq '/') {
       $courseid = substr($courseid, 1);
    }
    $courseid =~ s/\//_/;
    if ($role eq 'cc' && $env{'course.' . $courseid . 
         '.course.helper.not.run'}) {
       $furl = "/adm/helper/course.initialization.helper";
       # Send the user to the course they selected
    } elsif ($env{'request.course.id'}) {
       if (&Apache::lonnet::allowed('whn',
    $env{'request.course.id'})
    || &Apache::lonnet::allowed('whn',
       $env{'request.course.id'}.'/'
       .$env{'request.course.sec'})
    ) {
    my $startpage = &courseloadpage($courseid);
    unless ($startpage eq 'firstres') {         
       $msg = &mt('Entering course ....');
       &redirect_user($r,&mt('New in course'),
      '/adm/whatsnew?refpage=start',$msg,
      $env{'environment.remotenavmap'});
       return OK;
    }
       }
    }
    &redirect_user($r,&mt('Entering Course'),
          $furl,$msg,
          $env{'environment.remotenavmap'});
     }      }
     $courseid =~ s/\//_/;  
     if ($role eq 'cc' && $env{'course.' . $courseid .   
   '.course.helper.not.run'}) {  
  $furl = "/adm/helper/course.initialization.helper";  
  # Send the user to the course they selected  
     } elsif ($env{'request.course.id'}) {  
                                 if (&Apache::lonnet::allowed('whn',  
                                                   $env{'request.course.id'})  
     || &Apache::lonnet::allowed('whn',  
        $env{'request.course.id'}.'/'  
       .$env{'request.course.sec'})  
     ) {  
                                     my $startpage = &courseloadpage($courseid);  
                                     unless ($startpage eq 'firstres') {           
         $msg = &mt('Entering course ....');  
         &redirect_user($r,&mt('New in course'),  
      '/adm/whatsnew?refpage=start',$msg,  
      $env{'environment.remotenavmap'});  
         return OK;  
                                     }  
                                 }  
     }  
     &redirect_user($r,&mt('Entering Course'),  
                                            $furl,$msg,  
    $env{'environment.remotenavmap'});  
     return OK;      return OK;
  }   }
     }      }
Line 395  ENDHEADER Line 417  ENDHEADER
     }      }
 # -------------------------------------------------------- Choice or no choice?  # -------------------------------------------------------- Choice or no choice?
     if ($nochoose) {      if ($nochoose) {
         if ($advanced) {   $r->print("<h2>".&mt('Sorry ...')."</h2>\n".
     $r->print("<h2>".&mt('Assigned User Roles')."</h2>\n");    &mt('This action is currently not authorized.').
         } else {    &Apache::loncommon::end_page());
     $r->print("<h2>".&mt('Sorry ...')."</h2>\n".   return OK;
       &mt('This resource might be part of'));  
     if ($env{'request.course.id'}) {  
  $r->print(&mt(' another'));  
     } else {  
  $r->print(&mt(' a certain'));  
     }   
     $r->print(&mt(' course.').  
       &Apache::loncommon::end_page());  
     return OK;  
         }   
     } else {      } else {
         if ($advanced) {          if ($advanced) {
     $r->print(&mt("Your home server is ").      $r->print(&mt("Your home server is ").

Removed from v.1.149  
changed lines
  Added in v.1.150


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