version 1.7, 2000/09/30 17:25:04
|
version 1.10, 2000/10/04 14:09:01
|
Line 5
|
Line 5
|
# 5/21/99,5/22,5/25,5/26,5/31,6/2,6/10,7/12,7/14 Gerd Kortemeyer) |
# 5/21/99,5/22,5/25,5/26,5/31,6/2,6/10,7/12,7/14 Gerd Kortemeyer) |
# 11/23 Gerd Kortemeyer) |
# 11/23 Gerd Kortemeyer) |
# 1/14,03/06,06/01,07/22,07/24,07/25, |
# 1/14,03/06,06/01,07/22,07/24,07/25, |
# 09/04,09/06,09/28,09/29,09/30 Gerd Kortemeyer |
# 09/04,09/06,09/28,09/29,09/30,10/2 Gerd Kortemeyer |
# |
# |
package Apache::lonroles; |
package Apache::lonroles; |
|
|
Line 16 use Apache::Constants qw(:common);
|
Line 16 use Apache::Constants qw(:common);
|
use Apache::File(); |
use Apache::File(); |
|
|
sub handler { |
sub handler { |
my $r = shift; |
|
$r->content_type('text/html'); |
|
$r->send_http_header; |
|
return OK if $r->header_only; |
|
|
|
# ---------------------------------------------------------------- Print Header |
my $r = shift; |
$r->print(<<ENDHEADER); |
|
<html> |
|
<head> |
|
<title>LON-CAPA User Roles</title> |
|
</head> |
|
<body bgcolor="#FFFFFF"> |
|
ENDHEADER |
|
|
|
my $now=time; |
my $now=time; |
my $then=$ENV{'user.login.time'}; |
my $then=$ENV{'user.login.time'}; |
my $envkey; |
my $envkey; |
|
|
|
|
# ================================================================== Roles Init |
# ================================================================== Roles Init |
|
|
if ($ENV{'form.selectrole'}) { |
if ($ENV{'form.selectrole'}) { |
Line 58 ENDHEADER
|
Line 48 ENDHEADER
|
&Apache::lonnet::appenv('request.role' => $trolecode); |
&Apache::lonnet::appenv('request.role' => $trolecode); |
my ($cdom,$cnum)=split(/\//,$where); |
my ($cdom,$cnum)=split(/\//,$where); |
if ($cnum) { |
if ($cnum) { |
$r->print( &Apache::lonuserstate::readmap($where) ); |
&Apache::lonuserstate::readmap($where); |
|
$r->internal_redirect($ENV{'form.orgurl'}); |
|
return OK; |
} |
} |
} |
} |
} |
} |
} |
} |
} |
} |
|
|
$r->print('<h1>Role not active</h1></body></html>'); |
|
return OK; |
|
} |
} |
|
|
|
|
# =============================================================== No Roles Init |
# =============================================================== No Roles Init |
|
|
|
$r->content_type('text/html'); |
|
$r->send_http_header; |
|
return OK if $r->header_only; |
|
|
|
$r->print(<<ENDHEADER); |
|
<html> |
|
<head> |
|
<title>LON-CAPA User Roles</title> |
|
</head><body bgcolor="#FFFFFF"> |
|
ENDHEADER |
|
|
# ------------------------------------------ Get Error Message from Environment |
# ------------------------------------------ Get Error Message from Environment |
|
|
my ($fn,$priv,$nochoose,$error,$msg)=split(/:/,$ENV{'user.error.msg'}); |
my ($fn,$priv,$nochoose,$error,$msg)=split(/:/,$ENV{'user.error.msg'}); |
Line 86 ENDHEADER
|
Line 88 ENDHEADER
|
} |
} |
} |
} |
|
|
|
# ---------------------------------------------- Get cached course descriptions |
|
|
|
my %cdes=Apache::lonnet::dump('coursedescriptions'); |
|
|
# -------------------------------------------------------- Generate Page Output |
# -------------------------------------------------------- Generate Page Output |
# --------------------------------------------------------------- Error Header? |
# --------------------------------------------------------------- Error Header? |
if ($error) { |
if ($error) { |
Line 183 ENDHEADER
|
Line 189 ENDHEADER
|
} |
} |
my $ttype; |
my $ttype; |
my $twhere; |
my $twhere; |
my ($tres,$tdom,$trest)=split(/\//,$where); |
my ($tdom,$trest)= |
|
split(/\//,Apache::lonnet::declutter($where)); |
if ($trest) { |
if ($trest) { |
$ttype='Course'; |
$ttype='Course'; |
$twhere=$tdom.'/'.$trest; |
my $tcourseid=$tdom.'/'.$trest; |
|
if ($cdes{$tcourseid}) { |
|
$twhere=$cdes{$tcourseid}; |
|
} else { |
|
my %newhash=Apache::lonnet::coursedescription($tcourseid); |
|
if (%newhash) { |
|
$twhere=$newhash{'description'}; |
|
} else { |
|
$twhere='Currently not available'; |
|
} |
|
$cdes{$tcourseid}=$twhere; |
|
} |
} elsif ($tdom) { |
} elsif ($tdom) { |
$ttype='Domain'; |
$ttype='Domain'; |
$twhere=$tdom; |
$twhere=$tdom; |
} else { |
} else { |
$ttype='System'; |
$ttype='System'; |
$twhere='/'; |
$twhere='system wide'; |
} |
} |
|
|
$r->print('<tr bgcolor='.$tbg.'>'); |
$r->print('<tr bgcolor='.$tbg.'>'); |
Line 225 ENDHEADER
|
Line 243 ENDHEADER
|
my $where=join('.',@pwhere); |
my $where=join('.',@pwhere); |
my $ttype; |
my $ttype; |
my $twhere; |
my $twhere; |
my ($tres,$tdom,$trest)=split(/\//,$where); |
my ($tdom,$trest)= |
|
split(/\//,Apache::lonnet::declutter($where)); |
if ($trest) { |
if ($trest) { |
$ttype='Course'; |
$ttype='Course'; |
$twhere=$tdom.'/'.$trest; |
$twhere=$cdes{$tdom.'/'.$trest}; |
} elsif ($tdom) { |
} elsif ($tdom) { |
$ttype='Domain'; |
$ttype='Domain'; |
$twhere=$tdom; |
$twhere=$tdom; |