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

version 1.61, 2003/06/18 15:05:32 version 1.63, 2003/07/05 10:07:11
Line 52  use Apache::lonmenu; Line 52  use Apache::lonmenu;
 use Apache::loncommon;  use Apache::loncommon;
 use Apache::lonannounce;  use Apache::lonannounce;
   
   sub redirect_user {
       my ($r,$title,$url,$msg) = @_;
       $msg = $title if (! defined($msg));
       $r->content_type('text/html');
       &Apache::loncommon::no_cache($r);
       $r->send_http_header;
       my $swinfo=&Apache::lonmenu::rawconfig();
       my $bodytag=&Apache::loncommon::bodytag('Switching Role');
       $r->print (<<ENDREDIR);
   <head><title>$title</title>
   <meta HTTP-EQUIV="Refresh" CONTENT="1; url=$url">
   </head>
   <html>
   $bodytag
   <script>
   $swinfo
   </script>
   <h1>$msg</h1>
   </body>
   </html>
   ENDREDIR
       return;
   }
   
 sub handler {  sub handler {
   
     my $r = shift;      my $r = shift;
Line 141  ENDENTERKEY Line 165  ENDENTERKEY
    'request.role.domain' => $cdom,     'request.role.domain' => $cdom,
    'request.course.sec'  => $csec);     '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)=
     &Apache::lonuserstate::readmap($cdom.'/'.$cnum);      &Apache::lonuserstate::readmap($cdom.'/'.$cnum);
Line 168  ENDENTERKEY Line 193  ENDENTERKEY
   '.course.helper.not.run'}) {    '.course.helper.not.run'}) {
  $furl = "/adm/helper/course.initialization.helper";   $furl = "/adm/helper/course.initialization.helper";
     }      }
                               #
     $r->content_type('text/html');                              # Send the user to the course they selected
     &Apache::loncommon::no_cache($r);                              &redirect_user($r,'Entering Course',
     $r->send_http_header;                                             $furl,$msg);
     my $swinfo=&Apache::lonmenu::rawconfig();  
     my $bodytag=&Apache::loncommon::bodytag('Switching Role');  
     print (<<ENDREDIR);  
 <head><title>Entering Course</title>  
 <meta HTTP-EQUIV="Refresh" CONTENT="1; url=$furl">  
 </head>  
 <html>  
 $bodytag  
 <script>  
 $swinfo  
 </script>  
 <h1>$msg</h1>  
 </body>  
 </html>  
 ENDREDIR  
                             return OK;                              return OK;
  }   }
     }      }
                       #
                       # Send the user to the construction space they selected
                       if ($role =~ /^(au|ca)$/) {
                           my $redirect_url = '/priv/';
                           if ($role eq 'au') {
                               $redirect_url.=$ENV{'user.name'};
                           } else {
                               $where =~ /\/(.*)$/;
                               $redirect_url .= $1;
                           }
                           $redirect_url .= '/';
                           &redirect_user($r,'Entering Construction Space',
                                          $redirect_url);
                           return OK;
                       }
  }   }
             }              }
         }          }
Line 281  ENDHEADER Line 306  ENDHEADER
         $r->print('<input type=hidden name=orgurl value="'.$fn.'">');          $r->print('<input type=hidden name=orgurl value="'.$fn.'">');
         $r->print('<input type=hidden name=selectrole value=1>');          $r->print('<input type=hidden name=selectrole value=1>');
     }      }
     $r->print('<br>Show all roles: <input type=checkbox name=showall');      if ($ENV{'user.adv'}) {
     if ($ENV{'form.showall'}) { $r->print(' checked'); }   $r->print(
     $r->print('><input type=submit value="Display"><br>');        '<br />Show all roles: <input type="checkbox" name="showall"');
    if ($ENV{'form.showall'}) { $r->print(' checked'); }
    $r->print('><input type=submit value="Display">');
       }
 # ----------------------------------------------------------------------- Table  # ----------------------------------------------------------------------- Table
     $r->print('<table><tr>');      $r->print('<br /><table><tr>');
     unless ($nochoose) { $r->print('<th>&nbsp;</th>'); }      unless ($nochoose) { $r->print('<th>&nbsp;</th>'); }
     $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");

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


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