Link Name: "
- +" Address:
<\\/center><\\/td>"
- +"<\\/tr><\\/table><\\/form><\\/center>"
+ +''
+'$end_page_bookmark' );
bmquery.document.close();
}
@@ -1404,19 +1724,6 @@ 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 '') {
@@ -1431,13 +1738,19 @@ sub hidden_button_check {
sub roles_selector {
my ($cdom,$cnum) = @_;
+ my $crstype = &Apache::loncommon::course_type();
my $now = time;
- my (%courseroles,%seccount,%gotnosection);
+ my (%courseroles,%seccount);
my $is_cc;
my $role_selector;
- if ($env{'user.role.cc./'.$cdom.'/'.$cnum}) {
- my ($start,$end) = split(/\./,$env{'user.role.cc./'.$cdom.'/'.$cnum});
-
+ my $ccrole;
+ 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 ((($start) && ($start<0)) ||
(($end) && ($end<$now)) ||
(($start) && ($now<$start))) {
@@ -1447,35 +1760,9 @@ 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)) {
- 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));
- }
+ &get_all_courseroles($cdom,$cnum,\%courseroles,\%seccount);
} else {
+ my %gotnosection;
foreach my $item (keys(%env)) {
if ($item =~ m-^user\.role\.([^.]+)\./\Q$cdom\E/\Q$cnum\E/?(\w*)$-) {
my $role = $1;
@@ -1506,15 +1793,22 @@ sub roles_selector {
}
}
}
- my @roles_order = ('cc','in','ta','ep','ad','st');
+ 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');
if (keys(%courseroles) > 1) {
$role_selector = &jump_to_role($cdom,$cnum,\%seccount,\%courseroles);
$role_selector .= ' |