Annotation of loncom/auth/lonroles.pm, revision 1.116
1.1 harris41 1: # The LearningOnline Network with CAPA
2: # User Roles Screen
1.31 www 3: #
1.116 ! albertel 4: # $Id: lonroles.pm,v 1.115 2004/12/17 21:44:19 albertel 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.32 harris41 28: ###
1.22 harris41 29:
1.1 harris41 30: package Apache::lonroles;
31:
32: use strict;
33: use Apache::lonnet();
1.7 www 34: use Apache::lonuserstate();
1.1 harris41 35: use Apache::Constants qw(:common);
1.2 www 36: use Apache::File();
1.26 www 37: use Apache::lonmenu;
1.29 albertel 38: use Apache::loncommon;
1.104 raeburn 39: use Apache::lonhtmlcommon;
1.57 www 40: use Apache::lonannounce;
1.72 www 41: use Apache::lonlocal;
1.1 harris41 42:
1.62 matthew 43: sub redirect_user {
1.95 albertel 44: my ($r,$title,$url,$msg,$launch_nav) = @_;
1.62 matthew 45: $msg = $title if (! defined($msg));
1.73 www 46: &Apache::loncommon::content_type($r,'text/html');
1.62 matthew 47: &Apache::loncommon::no_cache($r);
48: $r->send_http_header;
49: my $swinfo=&Apache::lonmenu::rawconfig();
1.96 albertel 50: my $navwindow;
1.95 albertel 51: if ($launch_nav eq 'on') {
1.96 albertel 52: $navwindow.=&Apache::lonnavmaps::launch_win('now');
53: } else {
54: $navwindow.=&Apache::lonnavmaps::close();
1.95 albertel 55: }
1.62 matthew 56: my $bodytag=&Apache::loncommon::bodytag('Switching Role');
1.92 www 57: # Note to style police:
58: # This must only replace the spaces, nothing else, or it bombs elsewhere.
59: $url=~s/ /\%20/g;
1.93 albertel 60: $r->print(<<ENDREDIR);
1.62 matthew 61: <head><title>$title</title>
62: <meta HTTP-EQUIV="Refresh" CONTENT="1; url=$url">
63: </head>
64: <html>
65: $bodytag
1.96 albertel 66: <script type="text/javascript">
1.62 matthew 67: $swinfo
68: </script>
1.96 albertel 69: $navwindow
1.62 matthew 70: <h1>$msg</h1>
1.95 albertel 71: <a href="$url">Continue</a>
1.62 matthew 72: </body>
73: </html>
74: ENDREDIR
75: return;
76: }
77:
1.1 harris41 78: sub handler {
1.10 www 79:
1.1 harris41 80: my $r = shift;
81:
1.6 www 82: my $now=time;
83: my $then=$ENV{'user.login.time'};
84: my $envkey;
1.107 raeburn 85: my %dcroles = ();
86: my $numdc = &check_fordc(\%dcroles,$then);
1.10 www 87:
1.6 www 88: # ================================================================== Roles Init
89: if ($ENV{'form.selectrole'}) {
1.33 www 90: if ($ENV{'request.course.id'}) {
91: my %temp=('logout_'.$ENV{'request.course.id'} => time);
92: &Apache::lonnet::put('email_status',\%temp);
1.100 albertel 93: &Apache::lonnet::delenv('user.state.'.$ENV{'request.course.id'});
94: }
1.55 albertel 95: &Apache::lonnet::appenv("request.course.id" => '',
96: "request.course.fn" => '',
97: "request.course.uri" => '',
98: "request.course.sec" => '',
99: "request.role" => 'cm',
1.56 www 100: "request.role.adv" => $ENV{'user.adv'},
1.55 albertel 101: "request.role.domain" => $ENV{'user.domain'});
1.106 raeburn 102:
1.110 raeburn 103: # Check if user is a DC trying to enter a course and needs privs to be created
1.107 raeburn 104: if ($numdc > 0) {
105: foreach my $envkey (keys %ENV) {
106: if ($envkey =~ m-^form\.cc\./(\w+)/(\w+)$-) {
107: if ($dcroles{$1}) {
1.109 raeburn 108: my $cckey = 'user.role.cc./'.$1.'/'.$2;
1.110 raeburn 109: &check_privs($cckey,$then,$now);
1.107 raeburn 110: }
111: last;
112: }
113: }
114: }
115:
1.13 www 116: foreach $envkey (keys %ENV) {
1.40 matthew 117: next if ($envkey!~/^user\.role\./);
1.102 raeburn 118: my ($where,$trolecode,$role,$tstatus,$tend,$tstart);
119: &role_status($envkey,$then,$now,\$role,\$where,\$trolecode,\$tstatus,\$tstart,\$tend);
1.6 www 120: if ($ENV{'form.'.$trolecode}) {
1.55 albertel 121: if ($tstatus eq 'is') {
122: $where=~s/^\///;
123: my ($cdom,$cnum,$csec)=split(/\//,$where);
1.111 albertel 124: # store role if recent_role list being kept
125: if ($ENV{'environment.recentroles'}) {
126: &Apache::lonhtmlcommon::store_recent('roles',
127: $trolecode,' ');
128: }
129:
130:
1.53 www 131: # check for keyed access
1.55 albertel 132: if (($role eq 'st') &&
133: ($ENV{'course.'.$cdom.'_'.$cnum.'.keyaccess'} eq 'yes')) {
1.89 www 134: # who is key authority?
135: my $authdom=$cdom;
136: my $authnum=$cnum;
137: if ($ENV{'course.'.$cdom.'_'.$cnum.'.keyauth'}) {
138: ($authnum,$authdom)=
139: split(/\W/,$ENV{'course.'.$cdom.'_'.$cnum.'.keyauth'});
140: }
141: # check with key authority
142: unless (&Apache::lonnet::validate_access_key(
1.55 albertel 143: $ENV{'environment.key.'.$cdom.'_'.$cnum},
1.89 www 144: $authdom,$authnum)) {
1.53 www 145: # there is no valid key
1.55 albertel 146: if ($ENV{'form.newkey'}) {
1.53 www 147: # student attempts to register a new key
1.89 www 148: &Apache::loncommon::content_type($r,'text/html');
149: &Apache::loncommon::no_cache($r);
150: $r->send_http_header;
151: my $swinfo=&Apache::lonmenu::rawconfig();
152: my $bodytag=&Apache::loncommon::bodytag
153: ('Verifying Access Key to Unlock this Course');
1.90 www 154: my $buttontext=&mt('Enter Course');
155: my $message=&mt('Successfully registered key');
156: my $assignresult=
157: &Apache::lonnet::assign_access_key(
158: $ENV{'form.newkey'},
159: $authdom,$authnum,
1.91 www 160: $cdom,$cnum,
1.90 www 161: $ENV{'user.domain'},
162: $ENV{'user.name'},
163: 'Assigned from '.$ENV{'REMOTE_ADDR'}.' at '.localtime().' for '.
164: $trolecode);
165: unless ($assignresult eq 'ok') {
166: $assignresult=~s/^error\:\s*//;
167: $message=&mt($assignresult).
168: '<br /><a href="/adm/logout">'.
1.89 www 169: &mt('Logout').'</a>';
1.90 www 170: $buttontext=&mt('Re-Enter Key');
171: }
1.89 www 172: $r->print(<<ENDENTEREDKEY);
173: <head><title>Verifying Course Access Key</title>
174: </head>
175: <html>
176: $bodytag
177: <script>
178: $swinfo
179: </script>
180: <form method="post">
181: <input type="hidden" name="selectrole" value="1" />
182: <input type="hidden" name="$trolecode" value="1" />
1.90 www 183: <font size="+2">$message</font><br />
1.89 www 184: <input type="submit" value="$buttontext" />
185: </form>
186: </body></html>
187: ENDENTEREDKEY
188: return OK;
1.55 albertel 189: } else {
1.53 www 190: # print form to enter a new key
1.73 www 191: &Apache::loncommon::content_type($r,'text/html');
1.55 albertel 192: &Apache::loncommon::no_cache($r);
193: $r->send_http_header;
194: my $swinfo=&Apache::lonmenu::rawconfig();
195: my $bodytag=&Apache::loncommon::bodytag
196: ('Enter Access Key to Unlock this Course');
197: $r->print(<<ENDENTERKEY);
1.53 www 198: <head><title>Entering Course Access Key</title>
199: </head>
200: <html>
201: $bodytag
202: <script>
203: $swinfo
204: </script>
205: <form method="post">
1.89 www 206: <input type="hidden" name="selectrole" value="1" />
207: <input type="hidden" name="$trolecode" value="1" />
1.53 www 208: <input type="text" size="20" name="newkey" value="$ENV{'form.newkey'}" />
209: <input type="submit" value="Enter key" />
210: </form>
211: </body></html>
212: ENDENTERKEY
1.55 albertel 213: return OK;
214: }
215: }
216: }
1.87 www 217: &Apache::lonnet::log($ENV{'user.domain'},
218: $ENV{'user.name'},
219: $ENV{'user.home'},
220: "Role ".$trolecode);
1.101 albertel 221:
1.56 www 222: &Apache::lonnet::appenv(
1.101 albertel 223: 'request.role' => $trolecode,
1.56 www 224: 'request.role.domain' => $cdom,
225: 'request.course.sec' => $csec);
1.101 albertel 226: my $tadv=0;
227: if (&Apache::lonnet::allowed('adv') eq 'F') { $tadv=1; }
228: &Apache::lonnet::appenv('request.role.adv' => $tadv);
229:
1.72 www 230: my $msg=&mt('Entering course ...');
1.62 matthew 231:
1.55 albertel 232: if (($cnum) && ($role ne 'ca')) {
233: my ($furl,$ferr)=
234: &Apache::lonuserstate::readmap($cdom.'/'.$cnum);
235: if (($ENV{'form.orgurl'}) &&
236: ($ENV{'form.orgurl'}!~/^\/adm\/flip/)) {
1.67 albertel 237: my $dest=$ENV{'form.orgurl'};
1.71 albertel 238: if ( &Apache::lonnet::mod_perl_version() == 2 ) {
1.67 albertel 239: &Apache::lonnet::cleanenv();
1.69 albertel 240: }
1.67 albertel 241: $r->internal_redirect($dest);
1.55 albertel 242: return OK;
243: } else {
244: unless ($ENV{'request.course.id'}) {
245: &Apache::lonnet::appenv(
246: "request.course.id" => $cdom.'_'.$cnum);
1.61 www 247: $furl='/adm/roles?tryagain=1';
1.55 albertel 248: $msg=
1.72 www 249: '<h1><font color=red>'.
250: &mt('Could not initialize course at this time.').
251: '</font></h1><h3>'.&mt('Please try again.').'</h3>'.$ferr;
1.55 albertel 252: }
1.58 bowersj2 253:
254: # Check to see if the user is a CC entering a course
255: # for the first time
256: my (undef, undef, $role, $courseid) = split(/\./, $envkey);
257: if (substr($courseid, 0, 1) eq '/') {
258: $courseid = substr($courseid, 1);
259: }
260: $courseid =~ s/\//_/;
261: if ($role eq 'cc' && $ENV{'course.' . $courseid .
262: '.course.helper.not.run'}) {
263: $furl = "/adm/helper/course.initialization.helper";
264: }
1.62 matthew 265: # Send the user to the course they selected
1.78 sakharuk 266: &redirect_user($r,&mt('Entering Course'),
1.95 albertel 267: $furl,$msg,
268: $ENV{'environment.remotenavmap'});
1.20 www 269: return OK;
1.55 albertel 270: }
271: }
1.62 matthew 272: #
273: # Send the user to the construction space they selected
274: if ($role =~ /^(au|ca)$/) {
275: my $redirect_url = '/priv/';
276: if ($role eq 'au') {
277: $redirect_url.=$ENV{'user.name'};
278: } else {
279: $where =~ /\/(.*)$/;
280: $redirect_url .= $1;
281: }
282: $redirect_url .= '/';
1.78 sakharuk 283: &redirect_user($r,&mt('Entering Construction Space'),
1.62 matthew 284: $redirect_url);
285: return OK;
286: }
1.104 raeburn 287: if ($role eq 'dc') {
1.108 raeburn 288: my $redirect_url = '/adm/menu/';
289: &redirect_user($r,&mt('Loading Domain Coordinator Menu'),
1.104 raeburn 290: $redirect_url);
1.108 raeburn 291: return OK;
1.104 raeburn 292: }
1.55 albertel 293: }
294: }
1.6 www 295: }
1.40 matthew 296: }
1.44 www 297:
1.10 www 298:
1.6 www 299: # =============================================================== No Roles Init
1.10 www 300:
1.73 www 301: &Apache::loncommon::content_type($r,'text/html');
1.30 albertel 302: &Apache::loncommon::no_cache($r);
1.10 www 303: $r->send_http_header;
304: return OK if $r->header_only;
305:
1.52 www 306: my $swinfo=&Apache::lonmenu::rawconfig();
1.41 www 307: my $bodytag=&Apache::loncommon::bodytag('User Roles');
1.94 albertel 308: my $helptag='<table><tr><td>'.&Apache::loncommon::help_open_menu('','General Intro','General_Intro','User Roles',1,undef,undef,undef,undef,,&mt("Click here for help")).'</td></td></tr></table>';
1.10 www 309: $r->print(<<ENDHEADER);
310: <html>
311: <head>
312: <title>LON-CAPA User Roles</title>
1.41 www 313: </head>
314: $bodytag
1.45 www 315: $helptag<br />
1.26 www 316: <script>
317: $swinfo
318: window.focus();
319: </script>
1.10 www 320: ENDHEADER
1.6 www 321:
1.2 www 322: # ------------------------------------------ Get Error Message from Environment
323:
324: my ($fn,$priv,$nochoose,$error,$msg)=split(/:/,$ENV{'user.error.msg'});
1.12 www 325: if ($ENV{'user.error.msg'}) {
1.55 albertel 326: $r->log_reason(
327: "$msg for $ENV{'user.name'} domain $ENV{'user.domain'} access $priv",$fn);
1.12 www 328: }
1.1 harris41 329:
1.61 www 330: # ------------------------------------------------- Can this user re-init, etc?
1.6 www 331:
1.61 www 332: my $advanced=$ENV{'user.adv'};
333: &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},['tryagain']);
334: my $tryagain=$ENV{'form.tryagain'};
1.6 www 335:
1.2 www 336: # -------------------------------------------------------- Generate Page Output
1.6 www 337: # --------------------------------------------------------------- Error Header?
1.2 www 338: if ($error) {
339: $r->print("<h1>LON-CAPA Access Control</h1>");
1.4 www 340: $r->print("<hr><pre>Access : ".
341: Apache::lonnet::plaintext($priv)."\n");
1.115 albertel 342: $r->print("Resource: ".&Apache::lonenc::check_encrypt($fn)."\n");
1.4 www 343: $r->print("Action : $msg\n</pre><hr>");
1.2 www 344: } else {
1.25 www 345: if ($ENV{'user.error.msg'}) {
346: $r->print(
1.72 www 347: '<h3><font color=red>'.
348: &mt('You need to choose another user role or enter a specific course for this function').'</font></h3>');
1.25 www 349: }
1.2 www 350: }
1.6 www 351: # -------------------------------------------------------- Choice or no choice?
1.2 www 352: if ($nochoose) {
1.6 www 353: if ($advanced) {
1.72 www 354: $r->print("<h2>".&mt('Assigned User Roles')."</h2>\n");
1.6 www 355: } else {
1.72 www 356: $r->print("<h2>".&mt('Sorry ...')."</h2>\n".
357: &mt('This resource might be part of'));
1.55 albertel 358: if ($ENV{'request.course.id'}) {
1.72 www 359: $r->print(&mt(' another'));
1.55 albertel 360: } else {
1.72 www 361: $r->print(&mt(' a certain'));
1.55 albertel 362: }
1.72 www 363: $r->print(&mt(' course.').'</body></html>');
1.55 albertel 364: return OK;
1.6 www 365: }
366: } else {
367: if ($advanced) {
1.72 www 368: $r->print(&mt("Your home server is ").
1.55 albertel 369: $Apache::lonnet::hostname{&Apache::lonnet::homeserver
370: ($ENV{'user.name'},$ENV{'user.domain'})}.
371: "<br />\n");
1.72 www 372: $r->print(&mt(
373: "Author and Co-Author roles may not be available on servers other than your home server."));
1.17 www 374: }
1.18 www 375: if (($ENV{'REDIRECT_QUERY_STRING'}) && ($fn)) {
376: $fn.='?'.$ENV{'REDIRECT_QUERY_STRING'};
1.6 www 377: }
1.84 www 378: $r->print('<form method="post" name="rolechoice" action="'.(($fn)?$fn:$r->uri).'">');
1.116 ! albertel 379: $r->print('<input type="hidden" name="orgurl" value="'.$fn.'" />');
! 380: $r->print('<input type="hidden" name="selectrole" value="1" />');
1.6 www 381: }
1.63 www 382: if ($ENV{'user.adv'}) {
383: $r->print(
1.116 ! albertel 384: '<br /><label>'.&mt('Show all roles').': <input type="checkbox" name="showall"');
! 385: if ($ENV{'form.showall'}) { $r->print(' checked="checked" '); }
! 386: $r->print(' /></label><input type="submit" value="'.&mt('Display').'" />');
1.63 www 387: }
1.4 www 388:
1.75 albertel 389: my (%roletext,%sortrole,%roleclass);
1.84 www 390: my $countactive=0;
391: my $inrole=0;
392: my $possiblerole='';
1.3 albertel 393: foreach $envkey (sort keys %ENV) {
1.35 matthew 394: my $button = 1;
1.49 www 395: my $switchserver='';
1.75 albertel 396: my $roletext;
397: my $sortkey;
1.2 www 398: if ($envkey=~/^user\.role\./) {
1.102 raeburn 399: my ($role,$where,$trolecode,$tstart,$tend,$tremark,$tstatus,$tpstart,$tpend,$tfont);
400: &role_status($envkey,$then,$now,\$role,\$where,\$trolecode,\$tstatus,\$tstart,\$tend);
1.46 matthew 401: next if (!defined($role) || $role eq '');
1.102 raeburn 402: $tremark='';
403: $tpstart=' ';
404: $tpend=' ';
405: $tfont='#000000';
1.4 www 406: if ($tstart) {
1.74 www 407: $tpstart=&Apache::lonlocal::locallocaltime($tstart);
1.4 www 408: }
409: if ($tend) {
1.74 www 410: $tpend=&Apache::lonlocal::locallocaltime($tend);
1.4 www 411: }
1.6 www 412: if ($ENV{'request.role'} eq $trolecode) {
413: $tstatus='selected';
414: }
1.4 www 415: my $tbg;
1.35 matthew 416: if (($tstatus eq 'is') || ($tstatus eq 'selected') ||
417: ($ENV{'form.showall'})) {
418: if ($tstatus eq 'is') {
419: $tbg='#77FF77';
1.47 www 420: $tfont='#003300';
1.84 www 421: $possiblerole=$trolecode;
422: $countactive++;
1.35 matthew 423: } elsif ($tstatus eq 'future') {
424: $tbg='#FFFF77';
1.49 www 425: $button=0;
1.35 matthew 426: } elsif ($tstatus eq 'will') {
427: $tbg='#FFAA77';
1.72 www 428: $tremark.=&mt('Active at next login. ');
1.35 matthew 429: } elsif ($tstatus eq 'expired') {
430: $tbg='#FF7777';
1.47 www 431: $tfont='#330000';
1.49 www 432: $button=0;
1.35 matthew 433: } elsif ($tstatus eq 'will_not') {
434: $tbg='#AAFF77';
1.72 www 435: $tremark.=&mt('Expired after logout. ');
1.35 matthew 436: } elsif ($tstatus eq 'selected') {
437: $tbg='#11CC55';
1.47 www 438: $tfont='#002200';
1.84 www 439: $inrole=1;
1.86 albertel 440: $countactive++;
1.72 www 441: $tremark.=&mt('Currently selected. ');
1.35 matthew 442: }
443: my $trole;
444: if ($role =~ /^cr\//) {
445: my ($rdummy,$rdomain,$rauthor,$rrole)=split(/\//,$role);
1.72 www 446: $tremark.='<br>'.&mt('Defined by ').$rauthor.
447: &mt(' at ').$rdomain.'.';
1.35 matthew 448: $trole=$rrole;
1.8 www 449: } else {
1.35 matthew 450: $trole=Apache::lonnet::plaintext($role);
451: }
452: my $ttype;
453: my $twhere;
454: my ($tdom,$trest,$tsection)=
455: split(/\//,Apache::lonnet::declutter($where));
456: # First, Co-Authorship roles
457: if ($role eq 'ca') {
1.39 stredwic 458: my $home = &Apache::lonnet::homeserver($trest,$tdom);
1.83 albertel 459: my $allowed=0;
460: my @ids=&Apache::lonnet::current_machine_ids();
461: foreach my $id (@ids) { if ($id eq $home) { $allowed=1; } }
462: if (!$allowed) {
1.49 www 463: $button=0;
1.51 www 464: $switchserver=&Apache::lonnet::escape('http://'.
465: $Apache::lonnet::hostname{$home}.
466: '/adm/login?domain='.$ENV{'user.domain'}.
467: '&username='.$ENV{'user.name'}.
1.97 albertel 468: '&firsturl=/priv/'.$trest.'/');
1.49 www 469: }
1.35 matthew 470: #next if ($home eq 'no_host');
471: $home = $Apache::lonnet::hostname{$home};
1.78 sakharuk 472: $ttype='Construction Space';
1.72 www 473: $twhere=&mt('User').': '.$trest.'<br />'.&mt('Domain').
474: ': '.$tdom.'<br />'.
475: ' '.&mt('Server').': '.$home;
1.35 matthew 476: $ENV{'course.'.$tdom.'_'.$trest.'.description'}='ca';
1.82 www 477: $tremark.=&Apache::lonhtmlcommon::authorbombs('/res/'.$tdom.'/'.$trest.'/');
1.75 albertel 478: $sortkey=$role."$trest:$tdom";
1.35 matthew 479: } elsif ($role eq 'au') {
480: # Authors
481: my $home = &Apache::lonnet::homeserver
1.39 stredwic 482: ($ENV{'user.name'},$ENV{'user.domain'});
1.83 albertel 483: my $allowed=0;
484: my @ids=&Apache::lonnet::current_machine_ids();
485: foreach my $id (@ids) { if ($id eq $home) { $allowed=1; } }
486: if (!$allowed) {
1.49 www 487: $button=0;
1.51 www 488: $switchserver=&Apache::lonnet::escape('http://'.
489: $Apache::lonnet::hostname{$home}.
490: '/adm/login?domain='.$ENV{'user.domain'}.
491: '&username='.$ENV{'user.name'}.
1.97 albertel 492: '&firsturl=/priv/'.$ENV{'user.name'}.'/');
1.49 www 493: }
1.35 matthew 494: #next if ($home eq 'no_host');
495: $home = $Apache::lonnet::hostname{$home};
1.78 sakharuk 496: $ttype='Construction Space';
1.72 www 497: $twhere=&mt('Domain').': '.$tdom.'<br />'.&mt('Server').
498: ': '.$home;
1.35 matthew 499: $ENV{'course.'.$tdom.'_'.$trest.'.description'}='ca';
1.82 www 500: $tremark.=&Apache::lonhtmlcommon::authorbombs('/res/'.$tdom.'/'.$ENV{'user.name'}.'/');
1.75 albertel 501: $sortkey=$role;
1.35 matthew 502: } elsif ($trest) {
1.78 sakharuk 503: $ttype='Course';
1.35 matthew 504: if ($tsection) {
1.72 www 505: $ttype.='<br>'.&mt('Section/Group').': '.$tsection;
1.37 albertel 506: }
1.35 matthew 507: my $tcourseid=$tdom.'_'.$trest;
508: if ($ENV{'course.'.$tcourseid.'.description'}) {
1.47 www 509: $twhere=$ENV{'course.'.$tcourseid.'.description'};
1.80 albertel 510: $sortkey=$role."\0".$tdom."\0".$twhere."\0".$envkey;
1.72 www 511: unless ($twhere eq &mt('Currently not available')) {
1.55 albertel 512: $twhere.=' <font size="-2">'.
1.72 www 513: &Apache::loncommon::syllabuswrapper(&mt('Syllabus'),$trest,$tdom,$tfont).
1.49 www 514: '</font>';
1.55 albertel 515: }
1.8 www 516: } else {
1.105 raeburn 517: my %newhash=&Apache::lonnet::coursedescription($tcourseid);
1.35 matthew 518: if (%newhash) {
1.80 albertel 519: $sortkey=$role."\0".$tdom."\0".$newhash{'description'}.
1.77 albertel 520: "\0".$envkey;
1.49 www 521: $twhere=$newhash{'description'}.
522: ' <font size="-2">'.
1.72 www 523: &Apache::loncommon::syllabuswrapper(&mt('Syllabus'),$trest,$tdom,$tfont).
1.49 www 524: '</font>';
1.35 matthew 525: } else {
1.72 www 526: $twhere=&mt('Currently not available');
1.35 matthew 527: $ENV{'course.'.$tcourseid.'.description'}=$twhere;
1.80 albertel 528: $sortkey=$role."\0".$tdom."\0".$twhere."\0".$envkey;
1.35 matthew 529: }
1.8 www 530: }
1.72 www 531: if ($role ne 'st') { $twhere.="<br />".&mt('Domain').":".$tdom; }
1.35 matthew 532: } elsif ($tdom) {
1.78 sakharuk 533: $ttype='Domain';
1.35 matthew 534: $twhere=$tdom;
1.75 albertel 535: $sortkey=$role.$twhere;
1.35 matthew 536: } else {
1.78 sakharuk 537: $ttype='System';
1.72 www 538: $twhere=&mt('system wide');
1.75 albertel 539: $sortkey=$role.$twhere;
1.13 www 540: }
1.35 matthew 541:
1.110 raeburn 542: $roletext.=&build_roletext($trolecode,$tdom,$trest,$tstatus,$tryagain,$advanced,$tremark,$tbg,$tfont,$trole,$ttype,$twhere,$tpstart,$tpend,$nochoose,$button,$switchserver);
1.75 albertel 543: $roletext{$envkey}=$roletext;
544: if (!$sortkey) {$sortkey=$twhere."\0".$envkey;}
545: $sortrole{$sortkey}=$envkey;
546: $roleclass{$envkey}=$ttype;
1.55 albertel 547: }
1.4 www 548: }
1.75 albertel 549: }
1.84 www 550: # No active roles
551: if ($countactive==0) {
552: if ($inrole) {
553: $r->print('<h2>'.&mt('Currently no additional roles or courses').'</h2>');
554: } else {
555: $r->print('<h2>'.&mt('Currently no active roles or courses').'</h2>');
556: }
557: $r->print('</form></body></html>');
558: return OK;
559: # Is there only one choice?
1.88 www 560: } elsif (($countactive==1) && ($ENV{'request.role'} eq 'cm')) {
1.84 www 561: $r->print('<h3>'.&mt('Please stand by.').'</h3>'.
562: '<input type="hidden" name="'.$possiblerole.'" value="1" />');
563: $r->print("</form>\n");
564: $r->rflush();
565: $r->print('<script>document.forms.rolechoice.submit();</script>');
566: $r->print('</body></html>');
567: return OK;
568: }
569: # More than one possible role
570: # ----------------------------------------------------------------------- Table
571: unless (($advanced) || ($nochoose)) {
572: $r->print("<h2>".&mt('Select a Course to Enter')."</h2>\n");
573: }
574: $r->print('<br /><table><tr>');
575: unless ($nochoose) { $r->print('<th> </th>'); }
576: $r->print('<th>'.&mt('User Role').'</th><th colspan=2>'.&mt('Extent').
577: '</th><th>'.&mt('Start').'</th><th>'.&mt('End').'</th><th>'.
1.99 www 578: &mt('Remarks and Calendar Announcements').'</th></tr>'."\n");
1.76 albertel 579: my $doheaders=-1;
1.78 sakharuk 580: foreach my $type ('Construction Space','Course','Domain','System') {
1.76 albertel 581: my $haverole=0;
1.75 albertel 582: foreach my $which (sort {uc($a) cmp uc($b)} (keys(%sortrole))) {
583: if ($roleclass{$sortrole{$which}} =~ /^\Q$type\E/) {
1.76 albertel 584: $haverole=1;
1.75 albertel 585: }
1.76 albertel 586: }
587: if ($haverole) { $doheaders++; }
588: }
1.111 albertel 589:
590: if ($ENV{'environment.recentroles'}) {
591: my %recent_roles =
592: &Apache::lonhtmlcommon::get_recent('roles',$ENV{'environment.recentrolesn'});
593: my $output='';
594: foreach (sort(keys(%recent_roles))) {
595: if (defined($roletext{'user.role.'.$_})) {
596: $output.=$roletext{'user.role.'.$_};
1.113 raeburn 597: } elsif ($numdc > 0) {
598: unless ($_ =~/^error\:/) {
599: $output.=&display_cc_role('user.role.'.$_);
600: }
601: }
1.111 albertel 602: }
603: if ($output) {
604: $r->print("<tr bgcolor='#BBffBB'><td align='center' colspan='7'>".
605: &mt('Recent Roles')."</td>");
606: $r->print($output);
607: $r->print("</tr>");
1.114 raeburn 608: $doheaders ++;
1.111 albertel 609: }
610: }
611:
1.104 raeburn 612: if ($numdc > 0) {
1.112 raeburn 613: $r->print(&coursepick_jscript());
614: $r->print(&Apache::loncommon::coursebrowser_javascript());
1.108 raeburn 615: }
616: foreach my $type ('Construction Space','Course','Domain','System') {
617: my $output;
618: foreach my $which (sort {uc($a) cmp uc($b)} (keys(%sortrole))) {
619: if ($roleclass{$sortrole{$which}} =~ /^\Q$type\E/) {
620: $output.=$roletext{$sortrole{$which}};
621: if ($sortrole{$which} =~ m-dc\./(\w+)/-) {
622: if ($dcroles{$1}) {
623: $output .= &allcourses_row($1);
1.104 raeburn 624: }
625: }
1.76 albertel 626: }
1.108 raeburn 627: }
628: if ($output) {
629: if ($doheaders > 0) {
630: $r->print("<tr bgcolor='#BBffBB'>".
1.112 raeburn 631: "<td align='center' colspan='7'>".&mt($type)."</td></tr>");
1.76 albertel 632: }
1.108 raeburn 633: $r->print($output);
634: }
1.4 www 635: }
1.14 www 636: my $tremark='';
1.47 www 637: my $tfont='#003300';
1.14 www 638: if ($ENV{'request.role'} eq 'cm') {
1.19 www 639: $r->print('<tr bgcolor="#11CC55">');
1.72 www 640: $tremark=&mt('Currently selected. ');
1.47 www 641: $tfont='#002200';
1.14 www 642: } else {
643: $r->print('<tr bgcolor="#77FF77">');
644: }
645: unless ($nochoose) {
1.55 albertel 646: if ($ENV{'request.role'} ne 'cm') {
1.72 www 647: $r->print('<td><input type=submit value="'.
648: &mt('Select').'" name="cm"></td>');
1.55 albertel 649: } else {
650: $r->print('<td> </td>');
651: }
1.14 www 652: }
1.72 www 653: $r->print('<td colspan=5><font color="'.$tfont.'">'.&mt('No role specified').
1.47 www 654: '</font></td><td><font color="'.$tfont.'">'.$tremark.
655: ' </font></td></tr>'."\n");
1.4 www 656:
657: $r->print('</table>');
658: unless ($nochoose) {
659: $r->print("</form>\n");
660: }
1.22 harris41 661: # ------------------------------------------------------------ Privileges Info
1.55 albertel 662: if (($advanced) && (($ENV{'user.error.msg'}) || ($error))) {
663: $r->print('<hr><h2>Current Privileges</h2>');
1.4 www 664:
1.55 albertel 665: foreach $envkey (sort keys %ENV) {
666: if ($envkey=~/^user\.priv\.$ENV{'request.role'}\./) {
667: my $where=$envkey;
668: $where=~s/^user\.priv\.$ENV{'request.role'}\.//;
669: my $ttype;
670: my $twhere;
671: my ($tdom,$trest,$tsec)=
672: split(/\//,Apache::lonnet::declutter($where));
673: if ($trest) {
674: if ($ENV{'course.'.$tdom.'_'.$trest.'.description'} eq 'ca') {
675: $ttype='Construction Space';
676: $twhere='User: '.$trest.', Domain: '.$tdom;
677: } else {
678: $ttype='Course';
679: $twhere=$ENV{'course.'.$tdom.'_'.$trest.'.description'};
680: if ($tsec) {
681: $twhere.=' (Section/Group: '.$tsec.')';
682: }
683: }
684: } elsif ($tdom) {
685: $ttype='Domain';
686: $twhere=$tdom;
687: } else {
688: $ttype='System';
689: $twhere='/';
690: }
691: $r->print("\n<h3>".$ttype.': '.$twhere.'</h3><ul>');
692: foreach (sort split(/:/,$ENV{$envkey})) {
693: if ($_) {
694: my ($prv,$restr)=split(/\&/,$_);
695: my $trestr='';
696: if ($restr ne 'F') {
697: my $i;
698: $trestr.=' (';
699: for ($i=0;$i<length($restr);$i++) {
700: $trestr.=
701: Apache::lonnet::plaintext(substr($restr,$i,1));
702: if ($i<length($restr)-1) { $trestr.=', '; }
703: }
704: $trestr.=')';
705: }
706: $r->print('<li>'.
707: Apache::lonnet::plaintext($prv).$trestr.
708: '</li>');
709: }
710: }
711: $r->print('</ul>');
712: }
713: }
1.4 www 714: }
1.66 www 715: $r->print(&Apache::lonnet::getannounce());
1.65 www 716: if ($advanced) {
717: $r->print('<p><small><i>This is LON-CAPA '.
1.85 www 718: $r->dir_config('lonVersion').'</i><br />'.
719: '<a href="/adm/logout">'.&mt('Logout').'</a></small></p>');
1.65 www 720: }
1.1 harris41 721: $r->print("</body></html>\n");
722: return OK;
1.102 raeburn 723: }
724:
725: sub role_status {
726: my ($rolekey,$then,$now,$role,$where,$trolecode,$tstatus,$tstart,$tend) = @_;
727: my @pwhere = ();
728: if (exists($ENV{$rolekey}) && $ENV{$rolekey} ne '') {
729: (undef,undef,$$role,@pwhere)=split(/\./,$rolekey);
730: unless (!defined($$role) || $$role eq '') {
731: $$where=join('.',@pwhere);
732: $$trolecode=$$role.'.'.$$where;
733: ($$tstart,$$tend)=split(/\./,$ENV{$rolekey});
734: $$tstatus='is';
1.105 raeburn 735: if ($$tstart && $$tstart>$then) {
736: $$tstatus='future';
737: if ($$tstart<$now) { $$tstatus='will'; }
1.102 raeburn 738: }
739: if ($$tend) {
740: if ($$tend<$then) {
741: $$tstatus='expired';
1.103 raeburn 742: } elsif ($$tend<$now) {
1.104 raeburn 743: $$tstatus='will_not';
1.102 raeburn 744: }
745: }
746: }
747: }
748: }
1.1 harris41 749:
1.110 raeburn 750: sub build_roletext {
751: my ($trolecode,$tdom,$trest,$tstatus,$tryagain,$advanced,$tremark,$tbg,$tfont,$trole,$ttype,$twhere,$tpstart,$tpend,$nochoose,$button,$switchserver) = @_;
1.112 raeburn 752: my $roletext='<tr bgcolor="'.$tbg.'">';
1.110 raeburn 753: unless ($nochoose) {
754: if (!$button) {
755: if ($switchserver) {
756: $roletext.='<td><a href="/adm/logout?handover='.
757: $switchserver.'">'.&mt('Switch Server').'</a></td>';
758: } else {
759: $roletext.=('<td> </td>');
760: }
761: } elsif ($tstatus eq 'is') {
762: $roletext.=('<td><input type=submit value="'.
763: &mt('Select').'" name="'.
764: $trolecode.'"></td>');
765: } elsif ($tryagain) {
766: $roletext.=
767: '<td><input type=submit value="'.
768: &mt('Try Selecting Again').'" name="'.$trolecode.'"></td>';
769: } elsif ($advanced) {
770: $roletext.=
771: '<td><input type=submit value="'.
772: &mt('Re-Initialize').'" name="'.$trolecode.'"></td>';
773: } else {
774: $roletext.='<td> </td>';
775: }
776: }
777: $tremark.=&Apache::lonannounce::showday(time,1,
778: &Apache::lonannounce::readcalendar($tdom.'_'.$trest));
779:
780:
781: $roletext.='<td><font color="'.$tfont.'">'.$trole.
782: '</font></td><td><font color="'.$tfont.'">'.$ttype.
783: '</font></td><td><font color="'.$tfont.'">'.$twhere.
784: '</font></td><td><font color="'.$tfont.'">'.$tpstart.
785: '</font></td><td><font color="'.$tfont.'">'.$tpend.
786: '</font></td><td><font color="'.$tfont.'">'.$tremark.
787: ' </font></td></tr>'."\n";
788: return $roletext;
789: }
790:
791: sub check_privs {
792: my ($cckey,$then,$now) = @_;
793: if ($ENV{$cckey}) {
794: my ($role,$where,$trolecode,$tstart,$tend,$tremark,$tstatus,$tpstart,$tpend,$tfont);
795: &role_status($cckey,$then,$now,\$role,\$where,\$trolecode,\$tstatus,\$tstart,\$tend);
796: unless (($tstatus eq 'is') || ($tstatus eq 'will_not')) {
797: &set_privileges($1,$2);
798: }
799: } else {
800: &set_privileges($1,$2);
801: }
802: }
803:
1.104 raeburn 804: sub check_fordc {
805: my ($dcroles,$then) = @_;
806: my $numdc = 0;
807: if ($ENV{'user.adv'}) {
808: foreach my $envkey (sort keys %ENV) {
809: if ($envkey=~/^user\.role\.dc\.\/(\w+)\/$/) {
810: my $dcdom = $1;
811: my $livedc = 1;
812: my ($tstart,$tend)=split(/\./,$ENV{$envkey});
1.105 raeburn 813: if ($tstart && $tstart>$then) { $livedc = 0; }
814: if ($tend && $tend <$then) { $livedc = 0; }
1.104 raeburn 815: if ($livedc) {
816: $$dcroles{$dcdom} = $envkey;
1.105 raeburn 817: $numdc++;
1.104 raeburn 818: }
819: }
820: }
821: }
822: return $numdc;
823: }
824:
1.108 raeburn 825: sub courselink {
826: my ($dcdom) = @_;
1.109 raeburn 827: my $courseform=&Apache::loncommon::selectcourse_link
1.112 raeburn 828: ('rolechoice','dccourse_'.$dcdom,'dcdomain_'.$dcdom,'coursedesc_'.$dcdom,$dcdom);
1.109 raeburn 829: my $hiddenitems = '<input type="hidden" name="dcdomain_'.$dcdom.'" value="'.$dcdom.'" />'.
830: '<input type="hidden" name="origdom_'.$dcdom.'" value="'.$dcdom.'" />'.
831: '<input type="hidden" name="dccourse_'.$dcdom.'" value="" />'.
832: '<input type="hidden" name="coursedesc_'.$dcdom.'" value="" />';
1.112 raeburn 833: return $courseform.$hiddenitems;
1.109 raeburn 834: }
835:
836: sub coursepick_jscript {
1.104 raeburn 837: my $verify_script = <<"END";
838: <script>
1.108 raeburn 839: function verifyCoursePick(caller) {
840: var numbutton = getIndex(caller)
1.112 raeburn 841: var pickedCourse = document.rolechoice.elements[numbutton+4].value
842: var pickedDomain = document.rolechoice.elements[numbutton+2].value
843: if (document.rolechoice.elements[numbutton+2].value == document.rolechoice.elements[numbutton+3].value) {
1.104 raeburn 844: if (pickedCourse != '') {
1.108 raeburn 845: if (numbutton != -1) {
846: var courseTarget = "cc./"+pickedDomain+"/"+pickedCourse
847: document.rolechoice.elements[numbutton+1].name = courseTarget
848: document.rolechoice.submit()
849: }
1.104 raeburn 850: }
851: else {
1.114 raeburn 852: alert("Please use the 'Select Course' link to open a separate pick course window where you may select the course you wish to enter.");
1.104 raeburn 853: }
854: }
855: else {
856: alert("You can only use this screen to select courses in the current domain")
857: }
858: }
1.109 raeburn 859: function getIndex(caller) {
1.108 raeburn 860: for (var i=0;i<document.rolechoice.elements.length;i++) {
1.109 raeburn 861: if (document.rolechoice.elements[i] == caller) {
1.108 raeburn 862: return i;
863: }
864: }
865: return -1;
866: }
1.104 raeburn 867: </script>
868: END
1.109 raeburn 869: return $verify_script;
1.104 raeburn 870: }
871:
1.109 raeburn 872: sub processpick {
873: my $dcdom = shift;
874: my $process_pick = <<"END";
875: <script>
876: function process_pick(dom) {
877: var numbutton = getIndex(dom)
878: var pickedCourse = opener.document.rolechoice.dccourse_$dcdom.value
879: var pickedDomain = opener.document.rolechoice.dcdomain_$dcdom.value
880: if (opener.document.rolechoice.dcdomain_$dcdom.value == opener.document.rolechoice.origdom_$dcdom.value) {
881: if (pickedCourse != '') {
882: if (numbutton != -1) {
883: var courseTarget = "cc./"+pickedDomain+"/"+pickedCourse
884: opener.document.rolechoice.elements[numbutton+1].name = courseTarget
885: opener.document.rolechoice.submit()
886: }
887: }
888: }
889: }
890:
891: function getIndex(dom) {
892: var callername = 'ccpick_'+dom
893: for (var i=0;i<opener.document.rolechoice.elements.length;i++) {
894: var elemname = opener.document.rolechoice.elements[i].name
895: if (elemname == callername) {
896: return i;
897: }
898: }
899: return -1;
900: }
901: </script>
902: END
903: return $process_pick;
904: }
1.108 raeburn 905:
1.113 raeburn 906: sub display_cc_role {
907: my $rolekey = shift;
908: my $roletext;
1.104 raeburn 909: my $advanced = $ENV{'user.adv'};
910: my $tryagain = $ENV{'form.tryagain'};
1.113 raeburn 911: unless ($rolekey =~/^error\:/) {
912: if ($rolekey =~ m-^user\.role.cc\./(\w+)/(\w+)$-) {
913: my $tcourseid = $1.'_'.$2;
914: my $trolecode = 'cc./'.$1.'/'.$2;
915: my $trole = Apache::lonnet::plaintext('cc');
916: my $twhere;
917: my $tbg='#77FF77';
918: my $tfont='#003300';
919: my %newhash=&Apache::lonnet::coursedescription($tcourseid);
920: if (%newhash) {
921: $twhere=$newhash{'description'}.
922: ' <font size="-2">'.
923: &Apache::loncommon::syllabuswrapper(&mt('Syllabus'),$2,$1,$tfont).
924: '</font>';
925: } else {
926: $twhere=&mt('Currently not available');
927: $ENV{'course.'.$tcourseid.'.description'}=$twhere;
1.110 raeburn 928: }
1.113 raeburn 929: $twhere.="<br />".&mt('Domain').":".$1;
930: $roletext = &build_roletext($trolecode,$1,$2,'is',$tryagain,$advanced,'',$tbg,$tfont,$trole,&mt('Course'),$twhere,'','','',1,'');
1.104 raeburn 931: }
932: }
1.113 raeburn 933: return $roletext;
1.104 raeburn 934: }
935:
1.108 raeburn 936: sub allcourses_row {
1.109 raeburn 937: my $dcdom = shift;
1.108 raeburn 938: my $ccrole = Apache::lonnet::plaintext('cc');
939: my $selectlink = &courselink($dcdom);
940: my $output = '<tr bgcolor="#77FF77">'.
941: '<td><input type="button" value="'.
1.109 raeburn 942: &mt('Select').'" name="ccpick_'.$dcdom.'"'.
1.108 raeburn 943: 'onClick="verifyCoursePick(this)">'.
944: '<input type="hidden" name="pick_'.$dcdom.'" value="1"></td>'.
945: '<td><font color="#002200">'.
946: $ccrole.'</font></td><td>'.&mt('Course').'</td>'.
947: '<td><font color="#002200">'.&mt('All courses').':<b> '.
948: $selectlink.'</b>'.
949: '<br />'.&mt('Domain').':'.$dcdom.'</font>'.
950: '<td colspan="4"><font color="#002200">'.
951: &mt('Course Coordinator access to all courses in domain').
952: ': <b>'.$dcdom.'</b></font></td></tr>'."\n";
953: return $output;
954: }
955:
1.104 raeburn 956: sub recent_filename {
957: my $area=shift;
958: return 'nohist_recent_'.&Apache::lonnet::escape($area);
959: }
960:
1.106 raeburn 961: sub set_privileges {
962: my ($dcdom,$pickedcourse) = @_;
963: my $area = '/'.$dcdom.'/'.$pickedcourse;
964: my $role = 'cc';
965: my $spec = $role.'.'.$area;
966: my $userroles = &Apache::lonnet::set_arearole($role,$area,'','',$dcdom,$ENV{'user.name'});
967: my %ccrole = ();
968: &Apache::lonnet::standard_roleprivs(\%ccrole,$role,$dcdom,$spec,$pickedcourse,$area);
1.107 raeburn 969: my ($author,$adv)= &Apache::lonnet::set_userprivs(\$userroles,\%ccrole);
970: my @newprivs = split/\n/,$userroles;
1.106 raeburn 971: my %newccroles = ();
972: foreach (@newprivs) {
973: my ($key,$val) = split/=/,$_;
974: $newccroles{$key} = $val;
975: }
976: &Apache::lonnet::appenv(%newccroles);
977: &Apache::lonnet::log($ENV{'user.domain'},
978: $ENV{'user.name'},
979: $ENV{'user.home'},
980: "Role ".$role);
981: &Apache::lonnet::appenv(
982: 'request.role' => $role,
983: 'request.role.domain' => $dcdom,
984: 'request.course.sec' => '');
985: my $tadv=0;
986: if (&Apache::lonnet::allowed('adv') eq 'F') { $tadv=1; }
987: &Apache::lonnet::appenv('request.role.adv' => $tadv);
988: }
989:
1.1 harris41 990: 1;
991: __END__
1.32 harris41 992:
993: =head1 NAME
994:
995: Apache::lonroles - User Roles Screen
996:
997: =head1 SYNOPSIS
998:
999: Invoked by /etc/httpd/conf/srm.conf:
1000:
1001: <Location /adm/roles>
1002: PerlAccessHandler Apache::lonacc
1003: SetHandler perl-script
1004: PerlHandler Apache::lonroles
1005: ErrorDocument 403 /adm/login
1006: ErrorDocument 500 /adm/errorhandler
1007: </Location>
1.64 bowersj2 1008:
1009: =head1 OVERVIEW
1010:
1011: =head2 Choosing Roles
1012:
1013: C<lonroles> is a handler that allows a user to switch roles in
1014: mid-session. LON-CAPA attempts to work with "No Role Specified", the
1015: default role that a user has before selecting a role, as widely as
1016: possible, but certain handlers for example need specification which
1017: course they should act on, etc. Both in this scenario, and when the
1018: handler determines via C<lonnet>'s C<&allowed> function that a certain
1019: action is not allowed, C<lonroles> is used as error handler. This
1020: allows the user to select another role which may have permission to do
1021: what they were trying to do. C<lonroles> can also be accessed via the
1022: B<CRS> button in the Remote Control.
1023:
1024: =begin latex
1025:
1026: \begin{figure}
1027: \begin{center}
1028: \includegraphics[width=0.45\paperwidth,keepaspectratio]{Sample_Roles_Screen}
1029: \caption{\label{Sample_Roles_Screen}Sample Roles Screen}
1030: \end{center}
1031: \end{figure}
1032:
1033: =end latex
1034:
1035: =head2 Role Initialization
1036:
1037: The privileges for a user are established at login time and stored in the session environment. As a consequence, a new role does not become active till the next login. Handlers are able to query for privileges using C<lonnet>'s C<&allowed> function. When a user first logs in, their role is the "common" role, which means that they have the sum of all of their privileges. During a session it might become necessary to choose a particular role, which as a consequence also limits the user to only the privileges in that particular role.
1.32 harris41 1038:
1039: =head1 INTRODUCTION
1040:
1041: This module enables a user to select what role he wishes to
1042: operate under (instructor, student, teaching assistant, course
1043: coordinator, etc). These roles are pre-established by the actions
1044: of upper-level users.
1045:
1046: This is part of the LearningOnline Network with CAPA project
1047: described at http://www.lon-capa.org.
1048:
1049: =head1 HANDLER SUBROUTINE
1050:
1051: This routine is called by Apache and mod_perl.
1052:
1053: =over 4
1054:
1055: =item *
1056:
1057: Roles Initialization (yes/no)
1058:
1059: =item *
1060:
1061: Get Error Message from Environment
1062:
1063: =item *
1064:
1065: Who is this?
1066:
1067: =item *
1068:
1069: Generate Page Output
1070:
1071: =item *
1072:
1073: Choice or no choice
1074:
1075: =item *
1076:
1077: Table
1078:
1079: =item *
1080:
1081: Privileges
1082:
1083: =back
1084:
1085: =cut
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>