Annotation of loncom/auth/lonroles.pm, revision 1.52

1.1       harris41    1: # The LearningOnline Network with CAPA
                      2: # User Roles Screen
1.31      www         3: #
1.52    ! www         4: # $Id: lonroles.pm,v 1.51 2003/02/04 16:25:37 www Exp $
1.31      www         5: #
                      6: # Copyright Michigan State University Board of Trustees
                      7: #
                      8: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
                      9: #
                     10: # LON-CAPA is free software; you can redistribute it and/or modify
                     11: # it under the terms of the GNU General Public License as published by
                     12: # the Free Software Foundation; either version 2 of the License, or
                     13: # (at your option) any later version.
                     14: #
                     15: # LON-CAPA is distributed in the hope that it will be useful,
                     16: # but WITHOUT ANY WARRANTY; without even the implied warranty of
                     17: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
                     18: # GNU General Public License for more details.
                     19: #
                     20: # You should have received a copy of the GNU General Public License
                     21: # along with LON-CAPA; if not, write to the Free Software
                     22: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
                     23: #
                     24: # /home/httpd/html/adm/gpl.txt
                     25: #
                     26: # http://www.lon-capa.org/
                     27: #
1.1       harris41   28: # (Directory Indexer
                     29: # (Login Screen
1.32      harris41   30: # YEAR=1999
1.1       harris41   31: # 5/21/99,5/22,5/25,5/26,5/31,6/2,6/10,7/12,7/14 Gerd Kortemeyer)
                     32: # 11/23 Gerd Kortemeyer)
1.32      harris41   33: # YEAR=2000
1.7       www        34: # 1/14,03/06,06/01,07/22,07/24,07/25,
1.19      www        35: # 09/04,09/06,09/28,09/29,09/30,10/2,10/5,10/26,10/28,
1.20      www        36: # 12/08,12/28,
1.32      harris41   37: # YEAR=2001
1.20      www        38: # 01/15/01 Gerd Kortemeyer
1.28      www        39: # 03/02,05/03,05/25,05/30,06/01,07/06,08/06 Gerd Kortemeyer
1.33      www        40: # 12/29 Gerd Kortemeyer
1.32      harris41   41: #
                     42: ###
1.22      harris41   43: 
1.1       harris41   44: package Apache::lonroles;
                     45: 
                     46: use strict;
                     47: use Apache::lonnet();
1.7       www        48: use Apache::lonuserstate();
1.1       harris41   49: use Apache::Constants qw(:common);
1.2       www        50: use Apache::File();
1.26      www        51: use Apache::lonmenu;
1.29      albertel   52: use Apache::loncommon;
1.1       harris41   53: 
                     54: sub handler {
1.10      www        55: 
1.1       harris41   56:     my $r = shift;
                     57: 
1.6       www        58:     my $now=time;
                     59:     my $then=$ENV{'user.login.time'};
                     60:     my $envkey;
                     61: 
1.10      www        62: 
1.6       www        63: # ================================================================== Roles Init
                     64: 
                     65:     if ($ENV{'form.selectrole'}) {
1.33      www        66: 	if ($ENV{'request.course.id'}) {
                     67: 	    my %temp=('logout_'.$ENV{'request.course.id'} => time);
                     68: 	    &Apache::lonnet::put('email_status',\%temp);
                     69:         }
1.40      matthew    70:        &Apache::lonnet::appenv("request.course.id"   => '',
                     71:                                "request.course.fn"   => '',
                     72:                                "request.course.uri"  => '',
                     73:                                "request.course.sec"  => '',
                     74:                                "request.role"        => 'cm',
                     75:                                "request.role.domain" => $ENV{'user.domain'}); 
1.13      www        76:         foreach $envkey (keys %ENV) {
1.40      matthew    77:             next if ($envkey!~/^user\.role\./);
                     78: 	    my (undef,undef,$role,@pwhere)=split(/\./,$envkey);
1.6       www        79:             my $where=join('.',@pwhere);
                     80:             my $trolecode=$role.'.'.$where;
                     81:             if ($ENV{'form.'.$trolecode}) {
                     82:                my ($tstart,$tend)=split(/\./,$ENV{$envkey});
                     83:                my $tstatus='is';
                     84:                if ($tstart) {
                     85:       		  if ($tstart>$then) { 
                     86:                      $tstatus='future';
                     87:                   }
                     88:                }
                     89:                if ($tend) {
                     90:                   if ($tend<$then) { $tstatus='expired'; }
1.19      www        91:                   if ($tend<$now) { $tstatus='will_not'; }
1.6       www        92:                }
                     93:                if ($tstatus eq 'is') {
1.13      www        94:                    $where=~s/^\///;
                     95:                    my ($cdom,$cnum,$csec)=split(/\//,$where);
1.40      matthew    96:                    &Apache::lonnet::appenv('request.role'        => $trolecode,
                     97:                                            'request.role.domain' => $cdom,
                     98:                                            'request.course.sec'  => $csec);
1.27      www        99:                    my $msg='Entering course ...';
1.25      www       100:                    if (($cnum) && ($role ne 'ca')) {
1.19      www       101: 		      my ($furl,$ferr)=
                    102: 			  &Apache::lonuserstate::readmap($cdom.'/'.$cnum);
1.20      www       103:                       if (($ENV{'form.orgurl'}) && 
                    104:                           ($ENV{'form.orgurl'}!~/^\/adm\/flip/)) {
1.11      www       105:                          $r->internal_redirect($ENV{'form.orgurl'});
                    106:                          return OK;
1.19      www       107: 		     } else {
1.27      www       108:                          unless ($ENV{'request.course.id'}) {
                    109:                              &Apache::lonnet::appenv(
                    110: 				 "request.course.id"  => $cdom.'_'.$cnum);
                    111:                              $furl='/adm/notfound.html';
                    112:                              $msg=
                    113: 	 '<h1><font color=red>Could not initialize top-level map.</font></h1>';
                    114:                           }
1.20      www       115: 	                 $r->content_type('text/html');
1.30      albertel  116:                          &Apache::loncommon::no_cache($r);
1.20      www       117:                          $r->send_http_header;
1.52    ! www       118:                          my $swinfo=&Apache::lonmenu::rawconfig();
1.43      www       119:                          my $bodytag=&Apache::loncommon::bodytag('Switching Role');
1.20      www       120:                          print (<<ENDREDIR);
                    121: <head><title>Entering Course</title>
                    122: <meta HTTP-EQUIV="Refresh" CONTENT="1; url=$furl">
                    123: </head>
                    124: <html>
1.43      www       125: $bodytag
1.26      www       126: <script>
                    127: $swinfo
                    128: </script>
1.43      www       129: <h1>$msg</h1>
1.20      www       130: </body>
                    131: </html>
                    132: ENDREDIR
                    133:                             return OK;
1.19      www       134:                      }
1.7       www       135:                    }
1.6       www       136:                }
                    137:             } 
                    138:         }
1.40      matthew   139:     }
1.44      www       140: 
1.10      www       141: 
1.6       www       142: # =============================================================== No Roles Init
1.10      www       143: 
                    144:     $r->content_type('text/html');
1.30      albertel  145:     &Apache::loncommon::no_cache($r);
1.10      www       146:     $r->send_http_header;
                    147:     return OK if $r->header_only;
                    148: 
1.52    ! www       149:     my $swinfo=&Apache::lonmenu::rawconfig();
1.41      www       150:     my $bodytag=&Apache::loncommon::bodytag('User Roles');
1.48      www       151:     my $helptag=&Apache::loncommon::help_open_topic
1.52    ! www       152:      ("General_Intro","Click here for help");
1.10      www       153:     $r->print(<<ENDHEADER);
                    154: <html>
                    155: <head>
                    156: <title>LON-CAPA User Roles</title>
1.41      www       157: </head>
                    158: $bodytag
1.45      www       159: $helptag<br />
1.26      www       160: <script>
                    161: $swinfo
                    162: window.focus();
                    163: </script>
1.10      www       164: ENDHEADER
1.6       www       165: 
1.2       www       166: # ------------------------------------------ Get Error Message from Environment
                    167: 
                    168:     my ($fn,$priv,$nochoose,$error,$msg)=split(/:/,$ENV{'user.error.msg'});
1.12      www       169:     if ($ENV{'user.error.msg'}) {
                    170:        $r->log_reason(
                    171:      "$msg for $ENV{'user.name'} domain $ENV{'user.domain'} access $priv",$fn);
                    172:     }
1.1       harris41  173: 
1.6       www       174: # ---------------------------------------------------------------- Who is this?
                    175: 
                    176:     my $advanced=0;
                    177:     foreach $envkey (keys %ENV) {
                    178:         if ($envkey=~/^user\.role\./) {
1.40      matthew   179: 	    my (undef,undef,$role,@pwhere)=split(/\./,$envkey);
1.6       www       180:             if ($role ne 'st') { $advanced=1; }
                    181:         }
                    182:     }
                    183: 
1.2       www       184: # -------------------------------------------------------- Generate Page Output
1.6       www       185: # --------------------------------------------------------------- Error Header?
1.2       www       186:     if ($error) {
                    187: 	$r->print("<h1>LON-CAPA Access Control</h1>");
1.4       www       188:         $r->print("<hr><pre>Access  : ".
                    189:                   Apache::lonnet::plaintext($priv)."\n");
                    190:         $r->print("Resource: $fn\n");
                    191:         $r->print("Action  : $msg\n</pre><hr>");
1.2       www       192:     } else {
1.25      www       193:         if ($ENV{'user.error.msg'}) {
                    194: 	    $r->print(
                    195:  '<h3><font color=red>You need to choose another user role or '.
                    196:  'enter a specific course for this function</font></h3>');
                    197: 	}
1.2       www       198:     }
1.6       www       199: # -------------------------------------------------------- Choice or no choice?
1.2       www       200:     if ($nochoose) {
1.6       www       201:         if ($advanced) {
                    202: 	   $r->print("<h2>Assigned User Roles</h2>\n");
                    203:         } else {
                    204:            $r->print("<h2>Sorry ...</h2>\nThis resource might be part of");
                    205:            if ($ENV{'request.course.id'}) {
                    206: 	       $r->print(' another');
                    207:            } else {
                    208:                $r->print(' a certain');
                    209:            } 
                    210:            $r->print(' course.</body></html>');
                    211:            return OK;
                    212:         } 
                    213:     } else {
                    214:         if ($advanced) {
1.35      matthew   215:            $r->print("Your home server is ".
                    216:                      $Apache::lonnet::hostname{&Apache::lonnet::homeserver
1.39      stredwic  217:                      ($ENV{'user.name'},$ENV{'user.domain'})}.
1.38      stredwic  218: 		     "<br />\n");
1.35      matthew   219:            $r->print("Author and Co-Author roles may not be available on ".
                    220:                      "servers other than your home server.");
1.6       www       221:         } else {
                    222: 	   $r->print("<h2>Enter a Course</h2>\n");
1.17      www       223:         }
1.18      www       224:         if (($ENV{'REDIRECT_QUERY_STRING'}) && ($fn)) {
                    225:     	    $fn.='?'.$ENV{'REDIRECT_QUERY_STRING'};
1.6       www       226:         }
1.11      www       227:         $r->print('<form method=post action="'.(($fn)?$fn:$r->uri).'">');
1.6       www       228:         $r->print('<input type=hidden name=orgurl value="'.$fn.'">');
                    229:         $r->print('<input type=hidden name=selectrole value=1>');
                    230:     }
1.27      www       231:     $r->print('<br>Show all roles: <input type=checkbox name=showall');
                    232:     if ($ENV{'form.showall'}) { $r->print(' checked'); }
                    233:     $r->print('><input type=submit value="Display"><br>');
1.6       www       234: # ----------------------------------------------------------------------- Table
                    235:     $r->print('<table><tr>');
                    236:     unless ($nochoose) { $r->print('<th>&nbsp;</th>'); }
                    237:        $r->print('<th>User Role</th><th colspan=2>Extent</th>'.
                    238:                  '<th>Start</th><th>End</th><th>Remark</th></tr>'."\n");
1.4       www       239: 
1.3       albertel  240:     foreach $envkey (sort keys %ENV) {
1.35      matthew   241:         my $button = 1;
1.49      www       242:         my $switchserver='';
1.2       www       243:         if ($envkey=~/^user\.role\./) {
1.40      matthew   244: 	    my (undef,undef,$role,@pwhere)=split(/\./,$envkey);
1.46      matthew   245:             next if (!defined($role) || $role eq '');
1.4       www       246:             my $where=join('.',@pwhere);
1.6       www       247:             my $trolecode=$role.'.'.$where;
1.4       www       248:             my ($tstart,$tend)=split(/\./,$ENV{$envkey});
                    249:             my $tremark='';
                    250:             my $tstatus='is';
                    251:             my $tpstart='&nbsp;';
                    252:             my $tpend='&nbsp;';
1.47      www       253:             my $tfont='#000000';
1.4       www       254:             if ($tstart) {
                    255: 		if ($tstart>$then) { 
1.35      matthew   256:                     $tstatus='future';
                    257:                     if ($tstart<$now) { $tstatus='will'; }
1.4       www       258:                 }
                    259:                 $tpstart=localtime($tstart);
                    260:             }
                    261:             if ($tend) {
1.23      www       262:                 if ($tend<$then) { 
1.35      matthew   263:                     $tstatus='expired'; 
1.23      www       264:                 } elsif ($tend<$now) { 
1.35      matthew   265:                     $tstatus='will_not'; 
1.23      www       266:                 }
1.4       www       267:                 $tpend=localtime($tend);
                    268:             }
1.6       www       269:             if ($ENV{'request.role'} eq $trolecode) {
                    270: 		$tstatus='selected';
                    271:             }
1.4       www       272:             my $tbg;
1.35      matthew   273:             if (($tstatus eq 'is') || ($tstatus eq 'selected') ||
                    274:                 ($ENV{'form.showall'})) {
                    275:                 if ($tstatus eq 'is') {
                    276:                     $tbg='#77FF77';
1.47      www       277:                     $tfont='#003300';
1.35      matthew   278:                 } elsif ($tstatus eq 'future') {
                    279:                     $tbg='#FFFF77';
1.49      www       280:                     $button=0;
1.35      matthew   281:                 } elsif ($tstatus eq 'will') {
                    282:                     $tbg='#FFAA77';
                    283:                     $tremark.='Active at next login. ';
                    284:                 } elsif ($tstatus eq 'expired') {
                    285:                     $tbg='#FF7777';
1.47      www       286:                     $tfont='#330000';
1.49      www       287:                     $button=0;
1.35      matthew   288:                 } elsif ($tstatus eq 'will_not') {
                    289:                     $tbg='#AAFF77';
                    290:                     $tremark.='Expired after logout. ';
                    291:                 } elsif ($tstatus eq 'selected') {
                    292:                     $tbg='#11CC55';
1.47      www       293:                     $tfont='#002200';
1.35      matthew   294:                     $tremark.='Currently selected. ';
                    295:                 }
                    296:                 my $trole;
                    297:                 if ($role =~ /^cr\//) {
                    298:                     my ($rdummy,$rdomain,$rauthor,$rrole)=split(/\//,$role);
                    299:                     $tremark.='<br>Defined by '.$rauthor.' at '.$rdomain.'.';
                    300:                     $trole=$rrole;
1.8       www       301:                 } else {
1.35      matthew   302:                     $trole=Apache::lonnet::plaintext($role);
                    303:                 }
                    304:                 my $ttype;
                    305:                 my $twhere;
                    306:                 my ($tdom,$trest,$tsection)=
                    307:                     split(/\//,Apache::lonnet::declutter($where));
                    308:                 # First, Co-Authorship roles
                    309:                 if ($role eq 'ca') {
1.39      stredwic  310:                     my $home = &Apache::lonnet::homeserver($trest,$tdom);
1.49      www       311:                     if ($home ne $r->dir_config('lonHostID')) {
                    312: 			$button=0;
1.51      www       313:                         $switchserver=&Apache::lonnet::escape('http://'.
                    314:                          $Apache::lonnet::hostname{$home}.
                    315:                          '/adm/login?domain='.$ENV{'user.domain'}.
                    316: 			  '&username='.$ENV{'user.name'}.
                    317:                           '&firsturl=/priv/'.$trest);
1.49      www       318:                     }
1.35      matthew   319:                     #next if ($home eq 'no_host');
                    320:                     $home = $Apache::lonnet::hostname{$home};
                    321:                     $ttype='Construction Space';
                    322:                     $twhere='User: '.$trest.'<br />Domain: '.$tdom.'<br />'.
                    323:                         ' Server:&nbsp;'.$home;
                    324:                     $ENV{'course.'.$tdom.'_'.$trest.'.description'}='ca';
                    325:                 } elsif ($role eq 'au') {
                    326:                     # Authors
                    327:                     my $home = &Apache::lonnet::homeserver
1.39      stredwic  328:                         ($ENV{'user.name'},$ENV{'user.domain'});
1.49      www       329:                     if ($home ne $r->dir_config('lonHostID')) {
                    330: 			$button=0;
1.51      www       331:                         $switchserver=&Apache::lonnet::escape('http://'.
                    332:                          $Apache::lonnet::hostname{$home}.
                    333:                           '/adm/login?domain='.$ENV{'user.domain'}.
                    334: 			   '&username='.$ENV{'user.name'}.
                    335:                            '&firsturl=/priv/'.$ENV{'user.name'});
1.49      www       336:                     }
1.35      matthew   337:                     #next if ($home eq 'no_host');
                    338:                     $home = $Apache::lonnet::hostname{$home};
                    339:                     $ttype='Construction Space';
                    340:                     $twhere='Domain: '.$tdom.'<br />Server:&nbsp;'.$home;
                    341:                     $ENV{'course.'.$tdom.'_'.$trest.'.description'}='ca';
                    342:                 } elsif ($trest) {
                    343:                     $ttype='Course';
                    344:                     if ($tsection) {
                    345:                         $ttype.='<br>Section/Group: '.$tsection;
1.37      albertel  346: 		    }
1.35      matthew   347:                     my $tcourseid=$tdom.'_'.$trest;
                    348:                     if ($ENV{'course.'.$tcourseid.'.description'}) {
1.47      www       349:                         $twhere=$ENV{'course.'.$tcourseid.'.description'};
                    350:                         unless ($twhere eq 'Currently not available') {
1.49      www       351:                            $twhere.=' <font size="-2">'.
                    352:         &Apache::loncommon::syllabuswrapper('Syllabus',$trest,$tdom,$tfont).
                    353:                                     '</font>';
1.47      www       354: 		       }
1.8       www       355:                     } else {
1.35      matthew   356:                         my %newhash=Apache::lonnet::coursedescription
                    357:                             ($tcourseid);
                    358:                         if (%newhash) {
1.49      www       359:                             $twhere=$newhash{'description'}.
                    360:                               ' <font size="-2">'.
                    361:         &Apache::loncommon::syllabuswrapper('Syllabus',$trest,$tdom,$tfont).
                    362:                               '</font>';
1.35      matthew   363:                         } else {
                    364:                             $twhere='Currently not available';
                    365:                             $ENV{'course.'.$tcourseid.'.description'}=$twhere;
                    366:                         }
1.8       www       367:                     }
1.37      albertel  368: 		    if ($role ne 'st') { $twhere.="<br />Domain:".$tdom; }
1.35      matthew   369:                 } elsif ($tdom) {
                    370:                     $ttype='Domain';
                    371:                     $twhere=$tdom;
                    372:                 } else {
                    373:                     $ttype='System';
                    374:                     $twhere='system wide';
1.13      www       375:                 }
1.35      matthew   376:  
                    377: # ----- do not trust the indention below here -----              
                    378:                 $r->print('<tr bgcolor='.$tbg.'>');
                    379:                 unless ($nochoose) {
                    380:                     if (!$button) {
1.49      www       381: 			if ($switchserver) {
                    382: 			    $r->print('<td><a href="/adm/logout?handover='.
                    383:                               $switchserver.'">Switch Server</a></td>');
                    384:                         } else {
                    385:                             $r->print('<td>&nbsp;</td>');
                    386:                         }
1.35      matthew   387:                     } elsif ($tstatus eq 'is') {
                    388:                         $r->print('<td><input type=submit value=Select name="'.
                    389:                                   $trolecode.'"></td>');
                    390:                     } elsif ($ENV{'user.adv'}) {
                    391:                         $r->print
                    392:                             ('<td><input type=submit value="Re-Initialize"'.
                    393:                              ' name="'.$trolecode.'"></td>');
                    394:                     } else {
                    395:                         $r->print('<td>&nbsp;</td>');
                    396:                     }
1.6       www       397:                 }
1.47      www       398:             $r->print('<td><font color="'.$tfont.'">'.$trole.
                    399:                       '</font></td><td><font color="'.$tfont.'">'.$ttype.
                    400:                       '</font></td><td><font color="'.$tfont.'">'.$twhere.
                    401:                       '</font></td><td><font color="'.$tfont.'">'.$tpstart.
                    402:                       '</font></td><td><font color="'.$tfont.'">'.$tpend.
                    403:                       '</font></td><td><font color="'.$tfont.'">'.$tremark.
                    404:                       '&nbsp;</font></td></tr>'."\n");
1.27      www       405: 	}
1.4       www       406:         }
                    407:     }
1.14      www       408:     my $tremark='';
1.47      www       409:     my $tfont='#003300';
1.14      www       410:     if ($ENV{'request.role'} eq 'cm') {
1.19      www       411: 	$r->print('<tr bgcolor="#11CC55">');
1.14      www       412:         $tremark='Currently selected.';
1.47      www       413:         $tfont='#002200';
1.14      www       414:     } else {
                    415:         $r->print('<tr bgcolor="#77FF77">');
                    416:     }
                    417:     unless ($nochoose) {
                    418:        if ($ENV{'request.role'} ne 'cm') {
                    419:           $r->print('<td><input type=submit value=Select name="cm"></td>');
                    420:        } else {
                    421:           $r->print('<td>&nbsp;</td>');
                    422:        }
                    423:     }
1.47      www       424:     $r->print('<td colspan=5><font color="'.$tfont.'">No role specified'.
                    425:       '</font></td><td><font color="'.$tfont.'">'.$tremark.
                    426:       '&nbsp;</font></td></tr>'."\n");
1.4       www       427: 
                    428:     $r->print('</table>');
                    429:     unless ($nochoose) {
                    430: 	$r->print("</form>\n");
                    431:     }
1.22      harris41  432: # ------------------------------------------------------------ Privileges Info
1.43      www       433:   if (($advanced) && (($ENV{'user.error.msg'}) || ($error))) {
1.22      harris41  434:     $r->print('<hr><h2>Current Privileges</h2>');
1.4       www       435: 
                    436:     foreach $envkey (sort keys %ENV) {
1.15      www       437:         if ($envkey=~/^user\.priv\.$ENV{'request.role'}\./) {
                    438:             my $where=$envkey;
                    439:             $where=~s/^user\.priv\.$ENV{'request.role'}\.//;
1.4       www       440:             my $ttype;
                    441:             my $twhere;
1.15      www       442:             my ($tdom,$trest,$tsec)=
1.8       www       443:                split(/\//,Apache::lonnet::declutter($where));
1.6       www       444:             if ($trest) {
1.24      www       445: 	      if ($ENV{'course.'.$tdom.'_'.$trest.'.description'} eq 'ca') {
                    446: 	        $ttype='Construction Space';
                    447:                 $twhere='User: '.$trest.', Domain: '.$tdom;
                    448:               } else {
1.4       www       449: 		$ttype='Course';
1.16      www       450:                 $twhere=$ENV{'course.'.$tdom.'_'.$trest.'.description'};
1.15      www       451:                 if ($tsec) {
                    452: 		    $twhere.=' (Section/Group: '.$tsec.')';
                    453:                 }
1.24      www       454: 	      }
1.4       www       455:             } elsif ($tdom) {
                    456:                 $ttype='Domain';
                    457:                 $twhere=$tdom;
                    458:             } else {
                    459:                 $ttype='System';
                    460:                 $twhere='/';
                    461:             }
                    462:             $r->print("\n<h3>".$ttype.': '.$twhere.'</h3><ul>');
1.32      harris41  463:             foreach (sort split(/:/,$ENV{$envkey})) {
1.4       www       464:               if ($_) {
                    465: 		  my ($prv,$restr)=split(/\&/,$_);
                    466:                   my $trestr='';
                    467:                   if ($restr ne 'F') {
                    468:                       my $i;
1.5       www       469:                       $trestr.=' (';
1.4       www       470:                       for ($i=0;$i<length($restr);$i++) {
1.5       www       471: 		         $trestr.=
                    472:                            Apache::lonnet::plaintext(substr($restr,$i,1));
                    473:                          if ($i<length($restr)-1) { $trestr.=', '; }
                    474: 		      }
                    475:                       $trestr.=')';
1.4       www       476:                   }
                    477:                   $r->print('<li>'.Apache::lonnet::plaintext($prv).$trestr.
                    478:                             '</li>');
                    479: 	      }
1.32      harris41  480:             }
1.4       www       481:             $r->print('</ul>');
1.2       www       482:         }
1.4       www       483:     }
1.6       www       484:   }
1.2       www       485: 
1.1       harris41  486:     $r->print("</body></html>\n");
                    487:     return OK;
                    488: } 
                    489: 
                    490: 1;
                    491: __END__
1.32      harris41  492: 
                    493: =head1 NAME
                    494: 
                    495: Apache::lonroles - User Roles Screen
                    496: 
                    497: =head1 SYNOPSIS
                    498: 
                    499: Invoked by /etc/httpd/conf/srm.conf:
                    500: 
                    501:  <Location /adm/roles>
                    502:  PerlAccessHandler       Apache::lonacc
                    503:  SetHandler perl-script
                    504:  PerlHandler Apache::lonroles
                    505:  ErrorDocument     403 /adm/login
                    506:  ErrorDocument	  500 /adm/errorhandler
                    507:  </Location>
                    508: 
                    509: =head1 INTRODUCTION
                    510: 
                    511: This module enables a user to select what role he wishes to
                    512: operate under (instructor, student, teaching assistant, course
                    513: coordinator, etc).  These roles are pre-established by the actions
                    514: of upper-level users.
                    515: 
                    516: This is part of the LearningOnline Network with CAPA project
                    517: described at http://www.lon-capa.org.
                    518: 
                    519: =head1 HANDLER SUBROUTINE
                    520: 
                    521: This routine is called by Apache and mod_perl.
                    522: 
                    523: =over 4
                    524: 
                    525: =item *
                    526: 
                    527: Roles Initialization (yes/no)
                    528: 
                    529: =item *
                    530: 
                    531: Get Error Message from Environment
                    532: 
                    533: =item *
                    534: 
                    535: Who is this?
                    536: 
                    537: =item *
                    538: 
                    539: Generate Page Output
                    540: 
                    541: =item *
                    542: 
                    543: Choice or no choice
                    544: 
                    545: =item *
                    546: 
                    547: Table
                    548: 
                    549: =item *
                    550: 
                    551: Privileges
                    552: 
                    553: =back
                    554: 
                    555: =cut

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