Diff for /loncom/auth/lonroles.pm between versions 1.55 and 1.61

version 1.55, 2003/03/24 18:46:44 version 1.61, 2003/06/18 15:05:32
Line 50  use Apache::Constants qw(:common); Line 50  use Apache::Constants qw(:common);
 use Apache::File();  use Apache::File();
 use Apache::lonmenu;  use Apache::lonmenu;
 use Apache::loncommon;  use Apache::loncommon;
   use Apache::lonannounce;
   
 sub handler {  sub handler {
   
Line 72  sub handler { Line 73  sub handler {
  "request.course.uri"  => '',   "request.course.uri"  => '',
  "request.course.sec"  => '',   "request.course.sec"  => '',
  "request.role"        => 'cm',   "request.role"        => 'cm',
                                   "request.role.adv"    => $ENV{'user.adv'},
  "request.role.domain" => $ENV{'user.domain'});   "request.role.domain" => $ENV{'user.domain'});
         foreach $envkey (keys %ENV) {          foreach $envkey (keys %ENV) {
             next if ($envkey!~/^user\.role\./);              next if ($envkey!~/^user\.role\./);
Line 129  ENDENTERKEY Line 131  ENDENTERKEY
      }       }
  }   }
      }       }
     &Apache::lonnet::appenv('request.role'        => $trolecode,                      my $tadv=0;
     'request.role.domain' => $cdom,                      if (($trolecode!~/^st/) && 
     'request.course.sec'  => $csec);                          ($trolecode!~/^ta/) && 
                           ($trolecode!~/^cm/)) { $tadv=1; }
       &Apache::lonnet::appenv(
                                              'request.role'        => $trolecode,
      'request.role.adv'    => $tadv,
      'request.role.domain' => $cdom,
      'request.course.sec'  => $csec);
     my $msg='Entering course ...';      my $msg='Entering course ...';
     if (($cnum) && ($role ne 'ca')) {      if (($cnum) && ($role ne 'ca')) {
  my ($furl,$ferr)=   my ($furl,$ferr)=
Line 144  ENDENTERKEY Line 152  ENDENTERKEY
     unless ($ENV{'request.course.id'}) {      unless ($ENV{'request.course.id'}) {
  &Apache::lonnet::appenv(   &Apache::lonnet::appenv(
       "request.course.id"  => $cdom.'_'.$cnum);        "request.course.id"  => $cdom.'_'.$cnum);
  $furl='/adm/notfound.html';   $furl='/adm/roles?tryagain=1';
  $msg=   $msg=
  '<h1><font color=red>Could not initialize top-level map.</font></h1>';   '<h1><font color=red>Could not initialize course at this time.</font></h1><h3>Please try again.</h3>';
     }      }
   
       # Check to see if the user is a CC entering a course 
       # for the first time
       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";
       }
   
     $r->content_type('text/html');      $r->content_type('text/html');
     &Apache::loncommon::no_cache($r);      &Apache::loncommon::no_cache($r);
     $r->send_http_header;      $r->send_http_header;
Line 207  ENDHEADER Line 228  ENDHEADER
    "$msg for $ENV{'user.name'} domain $ENV{'user.domain'} access $priv",$fn);     "$msg for $ENV{'user.name'} domain $ENV{'user.domain'} access $priv",$fn);
     }      }
   
 # ---------------------------------------------------------------- Who is this?  # ------------------------------------------------- Can this user re-init, etc?
   
     my $advanced=0;      my $advanced=$ENV{'user.adv'};
     foreach $envkey (keys %ENV) {      &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['tryagain']);
         if ($envkey=~/^user\.role\./) {      my $tryagain=$ENV{'form.tryagain'};
     my (undef,undef,$role,@pwhere)=split(/\./,$envkey);  
             if ($role ne 'st') { $advanced=1; }  
         }  
     }  
   
 # -------------------------------------------------------- Generate Page Output  # -------------------------------------------------------- Generate Page Output
 # --------------------------------------------------------------- Error Header?  # --------------------------------------------------------------- Error Header?
Line 255  ENDHEADER Line 272  ENDHEADER
     $r->print("Author and Co-Author roles may not be available on ".      $r->print("Author and Co-Author roles may not be available on ".
       "servers other than your home server.");        "servers other than your home server.");
         } else {          } else {
     $r->print("<h2>Enter a Course</h2>\n");      $r->print("<h2>Select a Course to Enter</h2>\n");
         }          }
         if (($ENV{'REDIRECT_QUERY_STRING'}) && ($fn)) {          if (($ENV{'REDIRECT_QUERY_STRING'}) && ($fn)) {
        $fn.='?'.$ENV{'REDIRECT_QUERY_STRING'};         $fn.='?'.$ENV{'REDIRECT_QUERY_STRING'};
Line 422  ENDHEADER Line 439  ENDHEADER
                     } elsif ($tstatus eq 'is') {                      } elsif ($tstatus eq 'is') {
                         $r->print('<td><input type=submit value=Select name="'.                          $r->print('<td><input type=submit value=Select name="'.
                                   $trolecode.'"></td>');                                    $trolecode.'"></td>');
                     } elsif ($ENV{'user.adv'}) {                      } elsif ($tryagain) {
                           $r->print
                           ('<td><input type=submit value="Try Selecting Again"'.
                                ' name="'.$trolecode.'"></td>');
                       } elsif ($advanced) {
                         $r->print                          $r->print
                             ('<td><input type=submit value="Re-Initialize"'.                              ('<td><input type=submit value="Re-Initialize"'.
                              ' name="'.$trolecode.'"></td>');                               ' name="'.$trolecode.'"></td>');
Line 430  ENDHEADER Line 451  ENDHEADER
                         $r->print('<td>&nbsp;</td>');                          $r->print('<td>&nbsp;</td>');
                     }                      }
                 }                  }
                   $tremark.=&Apache::lonannounce::showday(time,1,
                            &Apache::lonannounce::readcalendar($tdom.'_'.$trest));
                   
  $r->print('<td><font color="'.$tfont.'">'.$trole.   $r->print('<td><font color="'.$tfont.'">'.$trole.
                       '</font></td><td><font color="'.$tfont.'">'.$ttype.                        '</font></td><td><font color="'.$tfont.'">'.$ttype.
                       '</font></td><td><font color="'.$tfont.'">'.$twhere.                        '</font></td><td><font color="'.$tfont.'">'.$twhere.

Removed from v.1.55  
changed lines
  Added in v.1.61


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