Annotation of loncom/auth/lonroles.pm, revision 1.113
1.1 harris41 1: # The LearningOnline Network with CAPA
2: # User Roles Screen
1.31 www 3: #
1.113 ! raeburn 4: # $Id: lonroles.pm,v 1.112 2004/11/23 07:29:24 raeburn 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");
342: $r->print("Resource: $fn\n");
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.6 www 379: $r->print('<input type=hidden name=orgurl value="'.$fn.'">');
380: $r->print('<input type=hidden name=selectrole value=1>');
381: }
1.63 www 382: if ($ENV{'user.adv'}) {
383: $r->print(
1.72 www 384: '<br />'.&mt('Show all roles').': <input type="checkbox" name="showall"');
1.63 www 385: if ($ENV{'form.showall'}) { $r->print(' checked'); }
1.72 www 386: $r->print('><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>");
608: }
609: }
610:
1.104 raeburn 611: if ($numdc > 0) {
1.112 raeburn 612: $r->print(&coursepick_jscript());
613: $r->print(&Apache::loncommon::coursebrowser_javascript());
1.108 raeburn 614: }
615: foreach my $type ('Construction Space','Course','Domain','System') {
616: my $output;
617: foreach my $which (sort {uc($a) cmp uc($b)} (keys(%sortrole))) {
618: if ($roleclass{$sortrole{$which}} =~ /^\Q$type\E/) {
619: $output.=$roletext{$sortrole{$which}};
620: if ($sortrole{$which} =~ m-dc\./(\w+)/-) {
621: if ($dcroles{$1}) {
622: $output .= &allcourses_row($1);
1.104 raeburn 623: }
624: }
1.76 albertel 625: }
1.108 raeburn 626: }
627: if ($output) {
628: if ($doheaders > 0) {
629: $r->print("<tr bgcolor='#BBffBB'>".
1.112 raeburn 630: "<td align='center' colspan='7'>".&mt($type)."</td></tr>");
1.76 albertel 631: }
1.108 raeburn 632: $r->print($output);
633: }
1.4 www 634: }
1.14 www 635: my $tremark='';
1.47 www 636: my $tfont='#003300';
1.14 www 637: if ($ENV{'request.role'} eq 'cm') {
1.19 www 638: $r->print('<tr bgcolor="#11CC55">');
1.72 www 639: $tremark=&mt('Currently selected. ');
1.47 www 640: $tfont='#002200';
1.14 www 641: } else {
642: $r->print('<tr bgcolor="#77FF77">');
643: }
644: unless ($nochoose) {
1.55 albertel 645: if ($ENV{'request.role'} ne 'cm') {
1.72 www 646: $r->print('<td><input type=submit value="'.
647: &mt('Select').'" name="cm"></td>');
1.55 albertel 648: } else {
649: $r->print('<td> </td>');
650: }
1.14 www 651: }
1.72 www 652: $r->print('<td colspan=5><font color="'.$tfont.'">'.&mt('No role specified').
1.47 www 653: '</font></td><td><font color="'.$tfont.'">'.$tremark.
654: ' </font></td></tr>'."\n");
1.4 www 655:
656: $r->print('</table>');
657: unless ($nochoose) {
658: $r->print("</form>\n");
659: }
1.22 harris41 660: # ------------------------------------------------------------ Privileges Info
1.55 albertel 661: if (($advanced) && (($ENV{'user.error.msg'}) || ($error))) {
662: $r->print('<hr><h2>Current Privileges</h2>');
1.4 www 663:
1.55 albertel 664: foreach $envkey (sort keys %ENV) {
665: if ($envkey=~/^user\.priv\.$ENV{'request.role'}\./) {
666: my $where=$envkey;
667: $where=~s/^user\.priv\.$ENV{'request.role'}\.//;
668: my $ttype;
669: my $twhere;
670: my ($tdom,$trest,$tsec)=
671: split(/\//,Apache::lonnet::declutter($where));
672: if ($trest) {
673: if ($ENV{'course.'.$tdom.'_'.$trest.'.description'} eq 'ca') {
674: $ttype='Construction Space';
675: $twhere='User: '.$trest.', Domain: '.$tdom;
676: } else {
677: $ttype='Course';
678: $twhere=$ENV{'course.'.$tdom.'_'.$trest.'.description'};
679: if ($tsec) {
680: $twhere.=' (Section/Group: '.$tsec.')';
681: }
682: }
683: } elsif ($tdom) {
684: $ttype='Domain';
685: $twhere=$tdom;
686: } else {
687: $ttype='System';
688: $twhere='/';
689: }
690: $r->print("\n<h3>".$ttype.': '.$twhere.'</h3><ul>');
691: foreach (sort split(/:/,$ENV{$envkey})) {
692: if ($_) {
693: my ($prv,$restr)=split(/\&/,$_);
694: my $trestr='';
695: if ($restr ne 'F') {
696: my $i;
697: $trestr.=' (';
698: for ($i=0;$i<length($restr);$i++) {
699: $trestr.=
700: Apache::lonnet::plaintext(substr($restr,$i,1));
701: if ($i<length($restr)-1) { $trestr.=', '; }
702: }
703: $trestr.=')';
704: }
705: $r->print('<li>'.
706: Apache::lonnet::plaintext($prv).$trestr.
707: '</li>');
708: }
709: }
710: $r->print('</ul>');
711: }
712: }
1.4 www 713: }
1.66 www 714: $r->print(&Apache::lonnet::getannounce());
1.65 www 715: if ($advanced) {
716: $r->print('<p><small><i>This is LON-CAPA '.
1.85 www 717: $r->dir_config('lonVersion').'</i><br />'.
718: '<a href="/adm/logout">'.&mt('Logout').'</a></small></p>');
1.65 www 719: }
1.1 harris41 720: $r->print("</body></html>\n");
721: return OK;
1.102 raeburn 722: }
723:
724: sub role_status {
725: my ($rolekey,$then,$now,$role,$where,$trolecode,$tstatus,$tstart,$tend) = @_;
726: my @pwhere = ();
727: if (exists($ENV{$rolekey}) && $ENV{$rolekey} ne '') {
728: (undef,undef,$$role,@pwhere)=split(/\./,$rolekey);
729: unless (!defined($$role) || $$role eq '') {
730: $$where=join('.',@pwhere);
731: $$trolecode=$$role.'.'.$$where;
732: ($$tstart,$$tend)=split(/\./,$ENV{$rolekey});
733: $$tstatus='is';
1.105 raeburn 734: if ($$tstart && $$tstart>$then) {
735: $$tstatus='future';
736: if ($$tstart<$now) { $$tstatus='will'; }
1.102 raeburn 737: }
738: if ($$tend) {
739: if ($$tend<$then) {
740: $$tstatus='expired';
1.103 raeburn 741: } elsif ($$tend<$now) {
1.104 raeburn 742: $$tstatus='will_not';
1.102 raeburn 743: }
744: }
745: }
746: }
747: }
1.1 harris41 748:
1.110 raeburn 749: sub build_roletext {
750: my ($trolecode,$tdom,$trest,$tstatus,$tryagain,$advanced,$tremark,$tbg,$tfont,$trole,$ttype,$twhere,$tpstart,$tpend,$nochoose,$button,$switchserver) = @_;
1.112 raeburn 751: my $roletext='<tr bgcolor="'.$tbg.'">';
1.110 raeburn 752: unless ($nochoose) {
753: if (!$button) {
754: if ($switchserver) {
755: $roletext.='<td><a href="/adm/logout?handover='.
756: $switchserver.'">'.&mt('Switch Server').'</a></td>';
757: } else {
758: $roletext.=('<td> </td>');
759: }
760: } elsif ($tstatus eq 'is') {
761: $roletext.=('<td><input type=submit value="'.
762: &mt('Select').'" name="'.
763: $trolecode.'"></td>');
764: } elsif ($tryagain) {
765: $roletext.=
766: '<td><input type=submit value="'.
767: &mt('Try Selecting Again').'" name="'.$trolecode.'"></td>';
768: } elsif ($advanced) {
769: $roletext.=
770: '<td><input type=submit value="'.
771: &mt('Re-Initialize').'" name="'.$trolecode.'"></td>';
772: } else {
773: $roletext.='<td> </td>';
774: }
775: }
776: $tremark.=&Apache::lonannounce::showday(time,1,
777: &Apache::lonannounce::readcalendar($tdom.'_'.$trest));
778:
779:
780: $roletext.='<td><font color="'.$tfont.'">'.$trole.
781: '</font></td><td><font color="'.$tfont.'">'.$ttype.
782: '</font></td><td><font color="'.$tfont.'">'.$twhere.
783: '</font></td><td><font color="'.$tfont.'">'.$tpstart.
784: '</font></td><td><font color="'.$tfont.'">'.$tpend.
785: '</font></td><td><font color="'.$tfont.'">'.$tremark.
786: ' </font></td></tr>'."\n";
787: return $roletext;
788: }
789:
790: sub check_privs {
791: my ($cckey,$then,$now) = @_;
792: if ($ENV{$cckey}) {
793: my ($role,$where,$trolecode,$tstart,$tend,$tremark,$tstatus,$tpstart,$tpend,$tfont);
794: &role_status($cckey,$then,$now,\$role,\$where,\$trolecode,\$tstatus,\$tstart,\$tend);
795: unless (($tstatus eq 'is') || ($tstatus eq 'will_not')) {
796: &set_privileges($1,$2);
797: }
798: } else {
799: &set_privileges($1,$2);
800: }
801: }
802:
1.104 raeburn 803: sub check_fordc {
804: my ($dcroles,$then) = @_;
805: my $numdc = 0;
806: if ($ENV{'user.adv'}) {
807: foreach my $envkey (sort keys %ENV) {
808: if ($envkey=~/^user\.role\.dc\.\/(\w+)\/$/) {
809: my $dcdom = $1;
810: my $livedc = 1;
811: my ($tstart,$tend)=split(/\./,$ENV{$envkey});
1.105 raeburn 812: if ($tstart && $tstart>$then) { $livedc = 0; }
813: if ($tend && $tend <$then) { $livedc = 0; }
1.104 raeburn 814: if ($livedc) {
815: $$dcroles{$dcdom} = $envkey;
1.105 raeburn 816: $numdc++;
1.104 raeburn 817: }
818: }
819: }
820: }
821: return $numdc;
822: }
823:
1.108 raeburn 824: sub courselink {
825: my ($dcdom) = @_;
1.109 raeburn 826: my $courseform=&Apache::loncommon::selectcourse_link
1.112 raeburn 827: ('rolechoice','dccourse_'.$dcdom,'dcdomain_'.$dcdom,'coursedesc_'.$dcdom,$dcdom);
1.109 raeburn 828: my $hiddenitems = '<input type="hidden" name="dcdomain_'.$dcdom.'" value="'.$dcdom.'" />'.
829: '<input type="hidden" name="origdom_'.$dcdom.'" value="'.$dcdom.'" />'.
830: '<input type="hidden" name="dccourse_'.$dcdom.'" value="" />'.
831: '<input type="hidden" name="coursedesc_'.$dcdom.'" value="" />';
1.112 raeburn 832: return $courseform.$hiddenitems;
1.109 raeburn 833: }
834:
835: sub coursepick_jscript {
1.104 raeburn 836: my $verify_script = <<"END";
837: <script>
1.108 raeburn 838: function verifyCoursePick(caller) {
839: var numbutton = getIndex(caller)
1.112 raeburn 840: var pickedCourse = document.rolechoice.elements[numbutton+4].value
841: var pickedDomain = document.rolechoice.elements[numbutton+2].value
842: if (document.rolechoice.elements[numbutton+2].value == document.rolechoice.elements[numbutton+3].value) {
1.104 raeburn 843: if (pickedCourse != '') {
1.108 raeburn 844: if (numbutton != -1) {
845: var courseTarget = "cc./"+pickedDomain+"/"+pickedCourse
846: document.rolechoice.elements[numbutton+1].name = courseTarget
847: document.rolechoice.submit()
848: }
1.104 raeburn 849: }
850: else {
851: alert("You must use the 'Select Course' link to open a separate pick course window which you can use to select the course you wish to enter");
852: }
853: }
854: else {
855: alert("You can only use this screen to select courses in the current domain")
856: }
857: }
1.109 raeburn 858: function getIndex(caller) {
1.108 raeburn 859: for (var i=0;i<document.rolechoice.elements.length;i++) {
1.109 raeburn 860: if (document.rolechoice.elements[i] == caller) {
1.108 raeburn 861: return i;
862: }
863: }
864: return -1;
865: }
1.104 raeburn 866: </script>
867: END
1.109 raeburn 868: return $verify_script;
1.104 raeburn 869: }
870:
1.109 raeburn 871: sub processpick {
872: my $dcdom = shift;
873: my $process_pick = <<"END";
874: <script>
875: function process_pick(dom) {
876: var numbutton = getIndex(dom)
877: var pickedCourse = opener.document.rolechoice.dccourse_$dcdom.value
878: var pickedDomain = opener.document.rolechoice.dcdomain_$dcdom.value
879: if (opener.document.rolechoice.dcdomain_$dcdom.value == opener.document.rolechoice.origdom_$dcdom.value) {
880: if (pickedCourse != '') {
881: if (numbutton != -1) {
882: var courseTarget = "cc./"+pickedDomain+"/"+pickedCourse
883: opener.document.rolechoice.elements[numbutton+1].name = courseTarget
884: opener.document.rolechoice.submit()
885: }
886: }
887: }
888: }
889:
890: function getIndex(dom) {
891: var callername = 'ccpick_'+dom
892: for (var i=0;i<opener.document.rolechoice.elements.length;i++) {
893: var elemname = opener.document.rolechoice.elements[i].name
894: if (elemname == callername) {
895: return i;
896: }
897: }
898: return -1;
899: }
900: </script>
901: END
902: return $process_pick;
903: }
1.108 raeburn 904:
1.113 ! raeburn 905: sub display_cc_role {
! 906: my $rolekey = shift;
! 907: my $roletext;
1.104 raeburn 908: my $advanced = $ENV{'user.adv'};
909: my $tryagain = $ENV{'form.tryagain'};
1.113 ! raeburn 910: unless ($rolekey =~/^error\:/) {
! 911: if ($rolekey =~ m-^user\.role.cc\./(\w+)/(\w+)$-) {
! 912: my $tcourseid = $1.'_'.$2;
! 913: my $trolecode = 'cc./'.$1.'/'.$2;
! 914: my $trole = Apache::lonnet::plaintext('cc');
! 915: my $twhere;
! 916: my $tbg='#77FF77';
! 917: my $tfont='#003300';
! 918: my %newhash=&Apache::lonnet::coursedescription($tcourseid);
! 919: if (%newhash) {
! 920: $twhere=$newhash{'description'}.
! 921: ' <font size="-2">'.
! 922: &Apache::loncommon::syllabuswrapper(&mt('Syllabus'),$2,$1,$tfont).
! 923: '</font>';
! 924: } else {
! 925: $twhere=&mt('Currently not available');
! 926: $ENV{'course.'.$tcourseid.'.description'}=$twhere;
1.110 raeburn 927: }
1.113 ! raeburn 928: $twhere.="<br />".&mt('Domain').":".$1;
! 929: $roletext = &build_roletext($trolecode,$1,$2,'is',$tryagain,$advanced,'',$tbg,$tfont,$trole,&mt('Course'),$twhere,'','','',1,'');
1.104 raeburn 930: }
931: }
1.113 ! raeburn 932: return $roletext;
1.104 raeburn 933: }
934:
1.108 raeburn 935: sub allcourses_row {
1.109 raeburn 936: my $dcdom = shift;
1.108 raeburn 937: my $ccrole = Apache::lonnet::plaintext('cc');
938: my $selectlink = &courselink($dcdom);
939: my $output = '<tr bgcolor="#77FF77">'.
940: '<td><input type="button" value="'.
1.109 raeburn 941: &mt('Select').'" name="ccpick_'.$dcdom.'"'.
1.108 raeburn 942: 'onClick="verifyCoursePick(this)">'.
943: '<input type="hidden" name="pick_'.$dcdom.'" value="1"></td>'.
944: '<td><font color="#002200">'.
945: $ccrole.'</font></td><td>'.&mt('Course').'</td>'.
946: '<td><font color="#002200">'.&mt('All courses').':<b> '.
947: $selectlink.'</b>'.
948: '<br />'.&mt('Domain').':'.$dcdom.'</font>'.
949: '<td colspan="4"><font color="#002200">'.
950: &mt('Course Coordinator access to all courses in domain').
951: ': <b>'.$dcdom.'</b></font></td></tr>'."\n";
952: return $output;
953: }
954:
1.104 raeburn 955: sub recent_filename {
956: my $area=shift;
957: return 'nohist_recent_'.&Apache::lonnet::escape($area);
958: }
959:
1.106 raeburn 960: sub set_privileges {
961: my ($dcdom,$pickedcourse) = @_;
962: my $area = '/'.$dcdom.'/'.$pickedcourse;
963: my $role = 'cc';
964: my $spec = $role.'.'.$area;
965: my $userroles = &Apache::lonnet::set_arearole($role,$area,'','',$dcdom,$ENV{'user.name'});
966: my %ccrole = ();
967: &Apache::lonnet::standard_roleprivs(\%ccrole,$role,$dcdom,$spec,$pickedcourse,$area);
1.107 raeburn 968: my ($author,$adv)= &Apache::lonnet::set_userprivs(\$userroles,\%ccrole);
969: my @newprivs = split/\n/,$userroles;
1.106 raeburn 970: my %newccroles = ();
971: foreach (@newprivs) {
972: my ($key,$val) = split/=/,$_;
973: $newccroles{$key} = $val;
974: }
975: &Apache::lonnet::appenv(%newccroles);
976: &Apache::lonnet::log($ENV{'user.domain'},
977: $ENV{'user.name'},
978: $ENV{'user.home'},
979: "Role ".$role);
980: &Apache::lonnet::appenv(
981: 'request.role' => $role,
982: 'request.role.domain' => $dcdom,
983: 'request.course.sec' => '');
984: my $tadv=0;
985: if (&Apache::lonnet::allowed('adv') eq 'F') { $tadv=1; }
986: &Apache::lonnet::appenv('request.role.adv' => $tadv);
987: }
988:
1.1 harris41 989: 1;
990: __END__
1.32 harris41 991:
992: =head1 NAME
993:
994: Apache::lonroles - User Roles Screen
995:
996: =head1 SYNOPSIS
997:
998: Invoked by /etc/httpd/conf/srm.conf:
999:
1000: <Location /adm/roles>
1001: PerlAccessHandler Apache::lonacc
1002: SetHandler perl-script
1003: PerlHandler Apache::lonroles
1004: ErrorDocument 403 /adm/login
1005: ErrorDocument 500 /adm/errorhandler
1006: </Location>
1.64 bowersj2 1007:
1008: =head1 OVERVIEW
1009:
1010: =head2 Choosing Roles
1011:
1012: C<lonroles> is a handler that allows a user to switch roles in
1013: mid-session. LON-CAPA attempts to work with "No Role Specified", the
1014: default role that a user has before selecting a role, as widely as
1015: possible, but certain handlers for example need specification which
1016: course they should act on, etc. Both in this scenario, and when the
1017: handler determines via C<lonnet>'s C<&allowed> function that a certain
1018: action is not allowed, C<lonroles> is used as error handler. This
1019: allows the user to select another role which may have permission to do
1020: what they were trying to do. C<lonroles> can also be accessed via the
1021: B<CRS> button in the Remote Control.
1022:
1023: =begin latex
1024:
1025: \begin{figure}
1026: \begin{center}
1027: \includegraphics[width=0.45\paperwidth,keepaspectratio]{Sample_Roles_Screen}
1028: \caption{\label{Sample_Roles_Screen}Sample Roles Screen}
1029: \end{center}
1030: \end{figure}
1031:
1032: =end latex
1033:
1034: =head2 Role Initialization
1035:
1036: 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 1037:
1038: =head1 INTRODUCTION
1039:
1040: This module enables a user to select what role he wishes to
1041: operate under (instructor, student, teaching assistant, course
1042: coordinator, etc). These roles are pre-established by the actions
1043: of upper-level users.
1044:
1045: This is part of the LearningOnline Network with CAPA project
1046: described at http://www.lon-capa.org.
1047:
1048: =head1 HANDLER SUBROUTINE
1049:
1050: This routine is called by Apache and mod_perl.
1051:
1052: =over 4
1053:
1054: =item *
1055:
1056: Roles Initialization (yes/no)
1057:
1058: =item *
1059:
1060: Get Error Message from Environment
1061:
1062: =item *
1063:
1064: Who is this?
1065:
1066: =item *
1067:
1068: Generate Page Output
1069:
1070: =item *
1071:
1072: Choice or no choice
1073:
1074: =item *
1075:
1076: Table
1077:
1078: =item *
1079:
1080: Privileges
1081:
1082: =back
1083:
1084: =cut
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>