version 1.1, 2001/01/03 16:20:59
|
version 1.2, 2001/05/20 19:05:43
|
Line 9
|
Line 9
|
# |
# |
# 3/1/1 Gerd Kortemeyer) |
# 3/1/1 Gerd Kortemeyer) |
# |
# |
# 3/1 Gerd Kortemeyer |
# 3/1,5/11,5/20 Gerd Kortemeyer |
# |
# |
package Apache::lonmydesk; |
package Apache::lonmydesk; |
|
|
use strict; |
use strict; |
use Apache::Constants qw(:common); |
use Apache::Constants qw(:common); |
|
use Apache::lonnet; |
|
use vars qw(@desklines $readdesk); |
|
|
sub handler { |
sub handler { |
my $r = shift; |
my $r = shift; |
$r->content_type('text/html'); |
$r->content_type('text/html'); |
Line 23 sub handler {
|
Line 25 sub handler {
|
return OK if $r->header_only; |
return OK if $r->header_only; |
|
|
# --------------------------------------------------- Print login screen header |
# --------------------------------------------------- Print login screen header |
$r->print(<<ENDDOCUMENT); |
$r->print(<<ENDHEADER); |
<html> |
<html> |
<head> |
<head> |
<title>The LearningOnline Network with CAPA</title> |
<title>The LearningOnline Network with CAPA</title> |
</head> |
</head> |
<body bgcolor="#FFFFFF"> |
<body bgcolor="#FFFFFF"> |
|
<img src="/adm/lonIcons/lonlogos.gif" align="right"> |
<h1>My Desk</h1> |
<h1>My Desk</h1> |
<img src="/adm/lonKaputt/lonconstruct.gif"> |
ENDHEADER |
</body> |
|
</html> |
# In a course |
ENDDOCUMENT |
|
|
unless ($ENV{'request.course.id'}) { |
|
$r->print('<h3>No specific course chosen</h3>'); |
|
} |
|
|
|
# Advanced User? |
|
|
|
my $adv=0; |
|
|
|
map { |
|
if ($_=~/user\.role\.(\w+)/) { |
|
if ($1 ne 'st') { $adv=1; } |
|
} |
|
} keys %ENV; |
|
|
|
# Print Options |
|
|
|
my $uname=$ENV{'user.name'}; |
|
my $udom=$ENV{'user.domain'}; |
|
|
|
map { |
|
my ($priv,$extent,$url,$text)=split(/\:/,$_); |
|
if ($priv eq 'cat') { |
|
if (($extent eq 'any')||($adv)) { |
|
$r->print('<h1>'.$url.'</h1>'); |
|
} |
|
} else { |
|
my $checkext; |
|
if ($extent eq 'sys') { |
|
$checkext='/'; |
|
} elsif ($extent eq 'dom') { |
|
$checkext='/'.$udom.'/'; |
|
} else { |
|
$checkext=$ENV{'request.course.id'}; |
|
} |
|
if ((&Apache::lonnet::allowed($priv,$checkext)) || |
|
($priv eq 'any')) { |
|
$url=~s/\$udom/$udom/g; |
|
$url=~s/\$uname/$uname/g; |
|
$r->print('<a href="'.$url.'">'.$text.'</a><br>'); |
|
} |
|
} |
|
} @desklines; |
|
|
|
$r->print('</body></html>'); |
return OK; |
return OK; |
} |
} |
|
# ================================================================ Main Program |
|
|
|
sub BEGIN { |
|
if ($readdesk ne 'done') { |
|
{ |
|
my $config=Apache::File->new($Apache::lonnet::perlvar{'lonTabDir'}. |
|
'/mydesk.tab'); |
|
while (my $configline=<$config>) { |
|
chomp($configline); |
|
$desklines[$#desklines+1]=$configline; |
|
} |
|
} |
|
} |
|
} |
1; |
1; |
__END__ |
__END__ |