Link Name: "
+ +" Address:
<\\/center><\\/td>"
+ +"<\\/tr><\\/table><\\/form><\\/center>"
+'$end_page_bookmark' );
bmquery.document.close();
}
@@ -1690,6 +1499,19 @@ sub get_nav_status {
return $navstatus;
}
+#FIXME this needs to move into mydesktab and the other locations
+# the text is generated
+sub convert_menu_function {
+ my ($rolename,$type) = @_;
+ if ($type eq 'Group') {
+ $rolename =~ s/student/member/g;
+ $rolename =~ s/group/team/g;
+ $rolename =~ s/course/group/g;
+ $rolename =~ s/Course/Group/g;
+ }
+ return $rolename;
+}
+
sub hidden_button_check {
my $hidden;
if ($env{'request.course.id'} eq '') {
@@ -1704,18 +1526,13 @@ sub hidden_button_check {
sub roles_selector {
my ($cdom,$cnum) = @_;
- my $crstype = &Apache::loncommon::course_type();
my $now = time;
- my (%courseroles,%seccount);
+ my (%courseroles,%seccount,%gotnosection);
my $is_cc;
my $role_selector;
- if ($crstype eq 'Community') {
- $ccrole = 'co';
- } else {
- $ccrole = 'cc';
- }
- if ($env{'user.role.'.$ccrole.'./'.$cdom.'/'.$cnum}) {
- my ($start,$end) = split(/\./,$env{'user.role.'.$ccrole.'./'.$cdom.'/'.$cnum});
+ if ($env{'user.role.cc./'.$cdom.'/'.$cnum}) {
+ my ($start,$end) = split(/\./,$env{'user.role.cc./'.$cdom.'/'.$cnum});
+
if ((($start) && ($start<0)) ||
(($end) && ($end<$now)) ||
(($start) && ($now<$start))) {
@@ -1725,9 +1542,35 @@ sub roles_selector {
}
}
if ($is_cc) {
- &get_all_courseroles($cdom,$cnum,\%courseroles,\%seccount);
+ my %adv_roles =
+ &Apache::lonnet::get_course_adv_roles($env{'request.course.id'},1);
+ foreach my $role (keys(%adv_roles)) {
+ my ($urole,$usec) = split(/:/,$role);
+ 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 {
- my %gotnosection;
foreach my $item (keys(%env)) {
if ($item =~ m-^user\.role\.([^.]+)\./\Q$cdom\E/\Q$cnum\E/?(\w*)$-) {
my $role = $1;
@@ -1758,22 +1601,15 @@ sub roles_selector {
}
}
}
- my $switchtext;
- if ($crstype eq 'Community') {
- $switchtext = &mt('Switch community role to...')
- } else {
- $switchtext = &mt('Switch course role to...')
- }
-
- my @roles_order = ($ccrole,'in','ta','ep','ad','st');
+ my @roles_order = ('cc','in','ta','ep','ad','st');
if (keys(%courseroles) > 1) {
$role_selector = &jump_to_role($cdom,$cnum,\%seccount,\%courseroles);
$role_selector .= ' |