--- loncom/interface/lonmenu.pm 2008/06/13 01:07:50 1.238
+++ loncom/interface/lonmenu.pm 2008/12/13 15:55:40 1.239.4.2
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines to control the menu
#
-# $Id: lonmenu.pm,v 1.238 2008/06/13 01:07:50 www Exp $
+# $Id: lonmenu.pm,v 1.239.4.2 2008/12/13 15:55:40 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -251,10 +251,6 @@ ENDCRELOAD
}
my $form=&serverform();
my $utility=&utilityfunctions();
- my $remote;
- if ($env{'user.adv'}) {
- $remote = '
'.$lt{'launch'}.' | '
- }
my $helplink=&Apache::loncommon::top_nav_help('Help');
return (<$helplink
$lt{'exit'} |
@@ -1126,6 +1121,18 @@ sub rawconfig {
}
}
}
+ } 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)) {
+ $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') ||
@@ -1427,7 +1434,7 @@ sub hidden_button_check {
sub roles_selector {
my ($cdom,$cnum) = @_;
my $now = time;
- my %courseroles;
+ my (%courseroles,%seccount,%gotnosection);
my $is_cc;
my $role_selector;
if ($env{'user.role.cc./'.$cdom.'/'.$cnum}) {
@@ -1444,34 +1451,66 @@ sub roles_selector {
if ($is_cc) {
my %adv_roles =
&Apache::lonnet::get_course_adv_roles($env{'request.course.id'},1);
- foreach my $role (keys(%adv_roles),'st') {
+ foreach my $role (keys(%adv_roles)) {
my ($urole,$usec) = split(/:/,$role);
- @{$courseroles{$urole}} = 'none';
+ if (!$gotnosection{$urole}) {
+ $seccount{$urole} ++;
+ $gotnosection{$urole} = 1;
+ }
+ if (ref($courseroles{$urole}) eq 'ARRAY') {
+ if ($usec ne '') {
+ if (!grep(/^Q$usec\E$/,@{$courseroles{$urole}})) {
+ push(@{$courseroles{$urole}},$usec);
+ $seccount{$urole} ++;
+ }
+ }
+ } else {
+ @{$courseroles{$urole}} = ();
+ if ($usec ne '') {
+ $seccount{$urole} ++;
+ push(@{$courseroles{$urole}},$usec);
+ }
+ }
+ }
+ my %sections_count = &Apache::loncommon::get_sections($cdom,$cnum);
+ @{$courseroles{'st'}} = ();
+ if (keys(%sections_count) > 0) {
+ push(@{$courseroles{'st'}},keys(%sections_count));
}
} else {
foreach my $item (keys(%env)) {
- if ($item =~ m-^user\.role\.([^.]+)\./\Q$cdom\E/\Q$cnum\E(/?\w*)$-) {
+ if ($item =~ m-^user\.role\.([^.]+)\./\Q$cdom\E/\Q$cnum\E/?(\w*)$-) {
my $role = $1;
my $sec = $2;
next if ($role eq 'gr');
my ($start,$end) = split(/\./,$env{$item});
next if (($start && $start > $now) || ($end && $end < $now));
if ($sec eq '') {
- $sec = 'none';
+ if (!$gotnosection{$role}) {
+ $seccount{$role} ++;
+ $gotnosection{$role} = 1;
+ }
}
if (ref($courseroles{$role}) eq 'ARRAY') {
- if (!grep(/^Q$sec\E$/,@{$courseroles{$role}})) {
- push(@{$courseroles{$role}},$sec);
+ if ($sec ne '') {
+ if (!grep(/^Q$sec\E$/,@{$courseroles{$role}})) {
+ push(@{$courseroles{$role}},$sec);
+ $seccount{$role} ++;
+ }
}
} else {
- @{$courseroles{$role}} = ($sec);
+ @{$courseroles{$role}} = ();
+ if ($sec ne '') {
+ $seccount{$role} ++;
+ push(@{$courseroles{$role}},$sec);
+ }
}
}
}
}
my @roles_order = ('cc','in','ta','ep','ad','st');
if (keys(%courseroles) > 1) {
- $role_selector = &jump_to_role($cdom,$cnum);
+ $role_selector = &jump_to_role($cdom,$cnum,\%seccount,\%courseroles);
$role_selector .= '