Diff for /loncom/auth/lonroles.pm between versions 1.17 and 1.23

version 1.17, 2000/12/08 15:52:43 version 1.23, 2001/03/03 00:55:36
Line 5 Line 5
 # 5/21/99,5/22,5/25,5/26,5/31,6/2,6/10,7/12,7/14 Gerd Kortemeyer)  # 5/21/99,5/22,5/25,5/26,5/31,6/2,6/10,7/12,7/14 Gerd Kortemeyer)
 # 11/23 Gerd Kortemeyer)  # 11/23 Gerd Kortemeyer)
 # 1/14,03/06,06/01,07/22,07/24,07/25,  # 1/14,03/06,06/01,07/22,07/24,07/25,
 # 09/04,09/06,09/28,09/29,09/30,10/2,10/5,10/26,10/28,12/08 Gerd Kortemeyer  # 09/04,09/06,09/28,09/29,09/30,10/2,10/5,10/26,10/28,
 #  # 12/08,12/28,
   # 01/15/01 Gerd Kortemeyer
   # 02/27/01 Scott Harrison
   # 03/02 Gerd Kortemeyer
   
 package Apache::lonroles;  package Apache::lonroles;
   
 use strict;  use strict;
Line 47  sub handler { Line 51  sub handler {
                }                 }
                if ($tend) {                 if ($tend) {
                   if ($tend<$then) { $tstatus='expired'; }                    if ($tend<$then) { $tstatus='expired'; }
                   if ($tend>$now) { $tstatus='will_not'; }                    if ($tend<$now) { $tstatus='will_not'; }
                }                 }
                if ($tstatus eq 'is') {                 if ($tstatus eq 'is') {
                    $where=~s/^\///;                     $where=~s/^\///;
Line 55  sub handler { Line 59  sub handler {
                    &Apache::lonnet::appenv('request.role' => $trolecode,                     &Apache::lonnet::appenv('request.role' => $trolecode,
                                            'request.course.sec' => $csec);                                             'request.course.sec' => $csec);
                    if ($cnum) {                     if ($cnum) {
       &Apache::lonuserstate::readmap($cdom.'/'.$cnum);        my ($furl,$ferr)=
                       if ($ENV{'form.orgurl'}) {    &Apache::lonuserstate::readmap($cdom.'/'.$cnum);
                         if (($ENV{'form.orgurl'}) && 
                             ($ENV{'form.orgurl'}!~/^\/adm\/flip/)) {
                          $r->internal_redirect($ENV{'form.orgurl'});                           $r->internal_redirect($ENV{'form.orgurl'});
                          return OK;                           return OK;
       }       } else {
                    $r->content_type('text/html');
                            $r->send_http_header;
                            print (<<ENDREDIR);
   <head><title>Entering Course</title>
   <meta HTTP-EQUIV="Refresh" CONTENT="1; url=$furl">
   </head>
   <html>
   <body bgcolor="#FFFFFF">
   Entering course ...
   </body>
   </html>
   ENDREDIR
                               return OK;
                        }
                    }                     }
                }                 }
             }               } 
   }    }
         }          }
     }     }
                   
   
 # =============================================================== No Roles Init  # =============================================================== No Roles Init
Line 79  sub handler { Line 99  sub handler {
 <head>  <head>
 <title>LON-CAPA User Roles</title>  <title>LON-CAPA User Roles</title>
 </head><body bgcolor="#FFFFFF">  </head><body bgcolor="#FFFFFF">
   <script>window.focus();</script>
 ENDHEADER  ENDHEADER
   
 # ------------------------------------------ Get Error Message from Environment  # ------------------------------------------ Get Error Message from Environment
Line 130  ENDHEADER Line 151  ENDHEADER
         } else {          } else {
    $r->print("<h2>Enter a Course</h2>\n");     $r->print("<h2>Enter a Course</h2>\n");
         }          }
         if ($ENV{'REDIRECT_QUERY_STRING'}) {          if (($ENV{'REDIRECT_QUERY_STRING'}) && ($fn)) {
     $fn.='?'.$ENV{'REDIRECT_QUERY_STRING'};         $fn.='?'.$ENV{'REDIRECT_QUERY_STRING'};
         }          }
         $r->print('<form method=post action="'.(($fn)?$fn:$r->uri).'">');          $r->print('<form method=post action="'.(($fn)?$fn:$r->uri).'">');
         $r->print('<input type=hidden name=orgurl value="'.$fn.'">');          $r->print('<input type=hidden name=orgurl value="'.$fn.'">');
Line 140  ENDHEADER Line 161  ENDHEADER
 # ----------------------------------------------------------------------- Table  # ----------------------------------------------------------------------- Table
     $r->print('<table><tr>');      $r->print('<table><tr>');
     unless ($nochoose) { $r->print('<th>&nbsp;</th>'); }      unless ($nochoose) { $r->print('<th>&nbsp;</th>'); }
     if ($advanced) {  
        $r->print('<th>User Role</th><th colspan=2>Extent</th>'.         $r->print('<th>User Role</th><th colspan=2>Extent</th>'.
                  '<th>Start</th><th>End</th><th>Remark</th></tr>'."\n");                   '<th>Start</th><th>End</th><th>Remark</th></tr>'."\n");
     } else {  
  $r->print('<th>Course</th></tr>'."\n");  
     }  
   
     foreach $envkey (sort keys %ENV) {      foreach $envkey (sort keys %ENV) {
         if ($envkey=~/^user\.role\./) {          if ($envkey=~/^user\.role\./) {
Line 165  ENDHEADER Line 182  ENDHEADER
                 $tpstart=localtime($tstart);                  $tpstart=localtime($tstart);
             }              }
             if ($tend) {              if ($tend) {
                 if ($tend<$then) { $tstatus='expired'; }                  if ($tend<$then) { 
                 if ($tend>$now) { $tstatus='will_not'; }                     $tstatus='expired'; 
                   } elsif ($tend<$now) { 
                      $tstatus='will_not'; 
                   }
                 $tpend=localtime($tend);                  $tpend=localtime($tend);
             }              }
             if ($ENV{'request.role'} eq $trolecode) {              if ($ENV{'request.role'} eq $trolecode) {
Line 186  ENDHEADER Line 206  ENDHEADER
                 $tbg='#AAFF77';                  $tbg='#AAFF77';
                 $tremark.='Expired after logout. ';                  $tremark.='Expired after logout. ';
             } elsif ($tstatus eq 'selected') {              } elsif ($tstatus eq 'selected') {
                 $tbg='#33FF33';                  $tbg='#11CC55';
                 $tremark.='Currently selected. ';                  $tremark.='Currently selected. ';
             }              }
             my $trole;              my $trole;
Line 243  ENDHEADER Line 263  ENDHEADER
     }      }
     my $tremark='';      my $tremark='';
     if ($ENV{'request.role'} eq 'cm') {      if ($ENV{'request.role'} eq 'cm') {
  $r->print('<tr bgcolor="#33FF33">');   $r->print('<tr bgcolor="#11CC55">');
         $tremark='Currently selected.';          $tremark='Currently selected.';
     } else {      } else {
         $r->print('<tr bgcolor="#77FF77">');          $r->print('<tr bgcolor="#77FF77">');
Line 262  ENDHEADER Line 282  ENDHEADER
     unless ($nochoose) {      unless ($nochoose) {
  $r->print("</form>\n");   $r->print("</form>\n");
     }      }
 # ------------------------------------------------------------ Priviledges Info  # ------------------------------------------------------------ Privileges Info
   if ($advanced) {    if ($advanced) {
     $r->print('<hr><h2>Current Priviledges</h2>');      $r->print('<hr><h2>Current Privileges</h2>');
   
     foreach $envkey (sort keys %ENV) {      foreach $envkey (sort keys %ENV) {
         if ($envkey=~/^user\.priv\.$ENV{'request.role'}\./) {          if ($envkey=~/^user\.priv\.$ENV{'request.role'}\./) {
Line 310  ENDHEADER Line 330  ENDHEADER
         }          }
     }      }
   }    }
 # -------------------------------------------------------------- Debug - remove  
   
     $->print("<hr><h1>Debugging</h1><hr>\n");  
       
     foreach $envkey (sort keys %ENV) {  
  $r->print("$envkey ---- $ENV{$envkey}<br>");  
     }  
   
 # ------------------------------------------------------------------- End Debug  
   
     $r->print("</body></html>\n");      $r->print("</body></html>\n");
     return OK;      return OK;

Removed from v.1.17  
changed lines
  Added in v.1.23


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