';
+ $output.='
'.&mt($category_names{$cat}).'
';
+ $output.='
';
my %active=();
foreach my $menu_item (split(/\:/,$category_members{$cat})) {
if ($inlineremote[$menu_item]) {
@@ -1195,7 +1165,7 @@ sub inlinemenu {
$output.=$inlineremote[$item];
}
$output.='
';
- $output.='';
+ $output.='
';
}
}
$output.="";
@@ -1221,14 +1191,12 @@ sub rawconfig {
my $show_course=&Apache::loncommon::show_course();
my $author=$env{'user.author'};
my $crs='';
- my $crstype='';
if ($env{'request.course.id'}) {
$crs='/'.$env{'request.course.id'};
if ($env{'request.course.sec'}) {
$crs.='_'.$env{'request.course.sec'};
}
$crs=~s/\_/\//g;
- $crstype = &Apache::loncommon::course_type();
}
my $pub=($env{'request.state'} eq 'published');
my $con=($env{'request.state'} eq 'construct');
@@ -1238,18 +1206,13 @@ sub rawconfig {
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;
- if ($prt =~ /\$crs/) {
- next unless ($env{'request.course.id'});
- next if ($crstype eq 'Community');
- $prt=~s/\$crs/$crs/g;
- } elsif ($prt =~ /\$cmty/) {
- next unless ($env{'request.course.id'});
- next if ($crstype ne 'Community');
- $prt=~s/\$cmty/$crs/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') {
@@ -1276,69 +1239,26 @@ sub rawconfig {
$uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc,$cat);
}
} elsif (($pro=~/^p(\w+)/) && ($prt)) {
- my $priv = $1;
- if ($priv =~ /^mdc(Course|Community)/) {
- if ($crstype eq $1) {
- $priv = 'mdc';
- } else {
- next;
- }
- }
- if (&Apache::lonnet::allowed($priv,$prt)) {
- $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
- }
- } elsif ($pro eq 'course') {
- if (($env{'request.course.fn'}) && ($crstype ne 'Community')) {
+ if (&Apache::lonnet::allowed($1,$prt)) {
$output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
}
- } elsif ($pro eq 'community') {
- if (($env{'request.course.fn'}) && ($crstype eq 'Community')) {
+ } elsif ($pro eq 'course') {
+ if ($env{'request.course.fn'}) {
$output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
- }
+ }
} elsif ($pro =~ /^courseenv_(.*)$/) {
my $key = $1;
- if ($crstype ne 'Community') {
- my $coursepref = $env{'course.'.$env{'request.course.id'}.'.'.$key};
- if ($key eq 'canuse_pdfforms') {
- if ($env{'request.course.id'} && $coursepref eq '') {
- my %domdefs = &Apache::lonnet::get_domain_defaults($env{'course.'.$env{'request.course.id'}.'.domain'});
- $coursepref = $domdefs{'canuse_pdfforms'};
- }
- }
- if ($coursepref) {
- $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
- }
- }
- } elsif ($pro =~ /^communityenv_(.*)$/) {
- my $key = $1;
- if ($crstype eq 'Community') {
- my $coursepref = $env{'course.'.$env{'request.course.id'}.'.'.$key};
- if ($key eq 'canuse_pdfforms') {
- if ($env{'request.course.id'} && $coursepref eq '') {
- my %domdefs = &Apache::lonnet::get_domain_defaults($env{'course.'.$env{'request.course.id'}.'.domain'});
- $coursepref = $domdefs{'canuse_pdfforms'};
- }
- }
- if ($coursepref) {
- $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
- }
+ 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'}) && ($crstype ne 'Community') &&
+ 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,$cat);
- }
- } elsif ($pro =~ /^community_(.*)$/) {
- # Check for permissions inside of a community
- if (($env{'request.course.id'}) && ($crstype eq 'Community') &&
- (&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,$cat);
- }
+ }
} elsif ($pro eq 'author') {
if ($author) {
if ((($prt eq 'rca') && ($env{'request.role'}=~/^ca/)) ||
@@ -1371,14 +1291,16 @@ sub rawconfig {
$output.=&clear($row,$col);
next;
}
- } elsif (($prt eq 'reqcrsnsc') || ($prt eq 'reqcrsshc')) {
- if (($prt eq 'reqcrsnsc') && ($show_course)) {
- next;
- }
- if (($prt eq 'reqcrsshc') && (!$show_course)) {
- 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;
+ }
}
- my $showreqcrs = &check_for_rcrs();
if (!$showreqcrs) {
$output.=&clear($row,$col);
next;
@@ -1387,7 +1309,6 @@ sub rawconfig {
$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') ||
@@ -1401,28 +1322,6 @@ sub rawconfig {
return $output;
}
-sub check_for_rcrs {
- my $showreqcrs = 0;
- my @reqtypes = ('official','unofficial','community');
- foreach my $type (@reqtypes) {
- if (&Apache::lonnet::usertools_access($env{'user.name'},
- $env{'user.domain'},
- $type,undef,'requestcourses')) {
- $showreqcrs = 1;
- last;
- }
- }
- if (!$showreqcrs) {
- foreach my $type (@reqtypes) {
- if ($env{'environment.reqcrsotherdom.'.$type} ne '') {
- $showreqcrs = 1;
- last;
- }
- }
- }
- return $showreqcrs;
-}
-
# ======================================================================= Close
sub close {
@@ -1431,7 +1330,6 @@ sub close {
my $menuname = &get_menu_name();
return(<