';
+ for (my $col=1; $col<=2; $col++) {
+ $output.='';
+ for (my $row=1; $row<=8; $row++) {
+ foreach my $cat (keys(%category_members)) {
+ if ($category_positions{$cat} ne "$col,$row") { next; }
+ #$output.=' ';
+ $output.='';
+ $output.=' '.&mt($category_names{$cat}).'';
+ $output.=' ';
+ my %active=();
+ foreach my $menu_item (split(/\:/,$category_members{$cat})) {
+ if ($inlineremote[$menu_item]) {
+ $active{$menu_item}=1;
+ }
+ }
+ foreach my $item (sort(keys(%active))) {
+ $output.=$inlineremote[$item];
+ }
+ $output.=' ';
+ $output.=' ';
+ }
+ }
+ $output.="";
+ }
+ $output.=" ";
+ return $output;
}
sub rawconfig {
my $textualoverride=shift;
my $output='';
- unless (($ENV{'browser.interface'} eq 'textual') ||
- ($ENV{'environment.remote'} eq 'off')) {
+ unless (($env{'browser.interface'} eq 'textual') ||
+ ($env{'environment.remote'} eq 'off')) {
$output.=
"window.status='Opening Remote Control';var swmenu=".&openmenu().
"\nwindow.status='Configuring Remote Control ';";
} else {
unless ($textualoverride) { return ''; }
}
- my $uname=$ENV{'user.name'};
- my $udom=$ENV{'user.domain'};
- my $adv=$ENV{'user.adv'};
- my $author=$ENV{'user.author'};
+ my $uname=$env{'user.name'};
+ my $udom=$env{'user.domain'};
+ my $adv=$env{'user.adv'};
+ my $show_course=&show_course();
+ my $author=$env{'user.author'};
my $crs='';
- if ($ENV{'request.course.id'}) {
- $crs='/'.$ENV{'request.course.id'};
- if ($ENV{'request.course.sec'}) {
- $crs.='_'.$ENV{'request.course.sec'};
+ if ($env{'request.course.id'}) {
+ $crs='/'.$env{'request.course.id'};
+ if ($env{'request.course.sec'}) {
+ $crs.='_'.$env{'request.course.sec'};
}
$crs=~s/\_/\//g;
}
- my $pub=($ENV{'request.state'} eq 'published');
- my $con=($ENV{'request.state'} eq 'construct');
- my $rol=$ENV{'request.role'};
- my $requested_domain = $ENV{'request.role.domain'};
- foreach (@desklines) {
- my ($row,$col,$pro,$prt,$img,$top,$bot,$act,$desc)=split(/\:/,$_);
+ my $pub=($env{'request.state'} eq 'published');
+ my $con=($env{'request.state'} eq 'construct');
+ my $rol=$env{'request.role'};
+ my $requested_domain = $env{'request.role.domain'};
+ foreach my $line (@desklines) {
+ my ($row,$col,$pro,$prt,$img,$top,$bot,$act,$desc,$cat)=split(/\:/,$line);
$prt=~s/\$uname/$uname/g;
$prt=~s/\$udom/$udom/g;
$prt=~s/\$crs/$crs/g;
$prt=~s/\$requested_domain/$requested_domain/g;
+ if ($category_names{$cat}!~/\w/) { $cat='oth'; }
+ my $type = &Apache::loncommon::course_type();
+ if ($type eq 'Group') {
+ $desc = &convert_menu_function($desc,$type);
+ }
if ($pro eq 'clear') {
$output.=&clear($row,$col);
} elsif ($pro eq 'any') {
$output.=&secondlevel(
- $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc);
+ $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc,$cat);
} elsif ($pro eq 'smp') {
unless ($adv) {
$output.=&secondlevel(
- $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc);
+ $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc,$cat);
}
} elsif ($pro eq 'adv') {
if ($adv) {
$output.=&secondlevel(
- $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc);
+ $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc,$cat);
+ }
+ } elsif ($pro eq 'shc') {
+ if ($show_course) {
+ $output.=&secondlevel(
+ $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc,$cat);
+ }
+ } elsif ($pro eq 'nsc') {
+ if (!$show_course) {
+ $output.=&secondlevel(
+ $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc,$cat);
}
} elsif (($pro=~/^p(\w+)/) && ($prt)) {
if (&Apache::lonnet::allowed($1,$prt)) {
- $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc);
+ $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
}
} elsif ($pro eq 'course') {
- if ($ENV{'request.course.fn'}) {
- $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc);
+ if ($env{'request.course.fn'}) {
+ $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
}
} elsif ($pro =~ /^courseenv_(.*)$/) {
my $key = $1;
- if ($ENV{'course.'.$ENV{'request.course.id'}.'.'.$key}) {
- $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc);
+ if ($env{'course.'.$env{'request.course.id'}.'.'.$key}) {
+ $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
}
} elsif ($pro =~ /^course_(.*)$/) {
# Check for permissions inside of a course
- if (($ENV{'request.course.id'}) &&
- (&Apache::lonnet::allowed($1,$ENV{'request.course.id'}.
- ($ENV{'request.course.sec'}?'/'.$ENV{'request.course.sec'}:''))
+ if (($env{'request.course.id'}) &&
+ (&Apache::lonnet::allowed($1,$env{'request.course.id'}.
+ ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))
)) {
- $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc);
+ $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
}
} elsif ($pro eq 'author') {
if ($author) {
- if ((($prt eq 'rca') && ($ENV{'request.role'}=~/^ca/)) ||
- (($prt eq 'rau') && ($ENV{'request.role'}=~/^au/))) {
+ if ((($prt eq 'rca') && ($env{'request.role'}=~/^ca/)) ||
+ (($prt eq 'raa') && ($env{'request.role'}=~/^aa/)) ||
+ (($prt eq 'rau') && ($env{'request.role'}=~/^au/))) {
# Check that we are on the correct machine
my $cadom=$requested_domain;
- my $caname=$ENV{'user.name'};
- if ($prt eq 'rca') {
+ my $caname=$env{'user.name'};
+ if (($prt eq 'rca') || ($prt eq 'raa')) {
($cadom,$caname)=
- ($ENV{'request.role'}=~/(\w+)\/(\w+)$/);
+ ($env{'request.role'}=~/($match_domain)\/($match_username)$/);
}
$act =~ s/\$caname/$caname/g;
my $home = &Apache::lonnet::homeserver($caname,$cadom);
@@ -915,15 +1222,42 @@ sub rawconfig {
my @ids=&Apache::lonnet::current_machine_ids();
foreach my $id (@ids) { if ($id eq $home) { $allowed=1; } }
if ($allowed) {
- $output.=switch($caname,$cadom,
- $row,$col,$img,$top,$bot,$act,$desc);
+ $output.=&switch($caname,$cadom,
+ $row,$col,$img,$top,$bot,$act,$desc,$cat);
+ }
+ }
+ }
+ } elsif ($pro eq 'tools') {
+ my @tools = ('aboutme','blog','portfolio');
+ if (grep(/^\Q$prt\E$/,@tools)) {
+ if (!&Apache::lonnet::usertools_access($env{'user.name'},
+ $env{'user.domain'},
+ $prt,undef,'tools')) {
+ $output.=&clear($row,$col);
+ next;
+ }
+ } elsif ($prt eq 'reqcrs') {
+ my $showreqcrs = 0;
+ foreach my $type ('official','unofficial') {
+ if (&Apache::lonnet::usertools_access($env{'user.name'},
+ $env{'user.domain'},
+ $type,undef,'requestcourses')) {
+ $showreqcrs = 1;
+ last;
}
}
+ if (!$showreqcrs) {
+ $output.=&clear($row,$col);
+ next;
+ }
}
+ $prt='any';
+ $output.=&secondlevel(
+ $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc,$cat);
}
}
- unless (($ENV{'browser.interface'} eq 'textual') ||
- ($ENV{'environment.remote'} eq 'off')) {
+ unless (($env{'browser.interface'} eq 'textual') ||
+ ($env{'environment.remote'} eq 'off')) {
$output.="\nwindow.status='Synchronizing Time';swmenu.syncclock(1000*".time.");\nwindow.status='Remote Control Configured.';";
if (&Apache::lonmsg::newmail()) {
$output.='swmenu.setstatus("you have","messages");';
@@ -936,11 +1270,11 @@ sub rawconfig {
# ======================================================================= Close
sub close {
- if (($ENV{'browser.interface'} eq 'textual') ||
- ($ENV{'environment.remote'} eq 'off')) { return ''; }
- my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'};
+ if (($env{'browser.interface'} eq 'textual') ||
+ ($env{'environment.remote'} eq 'off')) { return ''; }
+ my $menuname = &get_menu_name();
return(<
+
+END
+ return $output;
}
+
# ================================================================ Main Program
BEGIN {
- if (! defined($readdesk)) {
- {
- my $tabfile = $Apache::lonnet::perlvar{'lonTabDir'}.'/mydesk.tab';
- if ( CORE::open( my $config,"<$tabfile") ) {
- while (my $configline=<$config>) {
- $configline=(split(/\#/,$configline))[0];
- $configline=~s/^\s+//;
- chomp($configline);
- if ($configline) {
- $desklines[$#desklines+1]=$configline;
- }
- }
- CORE::close($config);
+ if (! defined($readdesk)) {
+ {
+ my $tabfile = $Apache::lonnet::perlvar{'lonTabDir'}.'/mydesk.tab';
+ if ( CORE::open( my $config,"<$tabfile") ) {
+ while (my $configline=<$config>) {
+ $configline=(split(/\#/,$configline))[0];
+ $configline=~s/^\s+//;
+ chomp($configline);
+ if ($configline=~/^cat\:/) {
+ my @entries=split(/\:/,$configline);
+ $category_positions{$entries[2]}=$entries[1];
+ $category_names{$entries[2]}=$entries[3];
+ } elsif ($configline) {
+ push(@desklines,$configline);
+ }
+ }
+ CORE::close($config);
+ }
+ }
+ $readdesk='done';
}
- }
- $readdesk='done';
- }
}
1;
|