--- loncom/interface/loncoursegroups.pm 2014/12/11 01:19:07 1.127 +++ loncom/interface/loncoursegroups.pm 2016/02/26 21:44:39 1.128 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: loncoursegroups.pm,v 1.127 2014/12/11 01:19:07 raeburn Exp $ +# $Id: loncoursegroups.pm,v 1.128 2016/02/26 21:44:39 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -328,19 +328,23 @@ END if (!$functionality) { $functionality = &mt('None available'); } - my $link = $actionlinks{$action}; + my $link; if ($action eq 'modify' || $action eq 'delete' || $action eq 'reenable') { - $link .= $group; + $link = $actionlinks{$action}.$group.'">'.$lt{$action}.''; } else { - $link .= - &Apache::longroup::get_group_link($cdom,$cnum,$group,$navmap); - $link .= (($link=~/\?/)?'&':'?').'ref=grouplist'; - if (exists($env{'form.refpage'})) { - $link .= '&refpage='.$env{'form.refpage'}; - } + $link = + &Apache::longroup::get_group_link($cdom,$cnum,$group,$navmap,$view_permission); +print STDERR "link is ||$link||\n"; + if ($link) { + $link = $actionlinks{$action}.$link; + $link .= (($link=~/\?/)?'&':'?').'ref=grouplist'; + if (exists($env{'form.refpage'})) { + $link .= '&refpage='.$env{'form.refpage'}; + } + $link .= '">'.$lt{$action}.''; + } } - $link .= '">'.$lt{$action}.''; if ($action eq 'view') { if ($manage_permission) { $link .= '  '.$actionlinks{'modify'}. @@ -394,6 +398,7 @@ END } else { my @coursegroups = split(/:/,$env{'request.course.groups'}); if (@coursegroups > 0) { + my $numlinks = 0; $r->print('

'); my %curr_groups = &Apache::longroup::coursegroups($cdom,$cnum); if (%curr_groups) { @@ -410,12 +415,36 @@ END $curr_groups{$group}); my $description = &unescape( $group_info{description}); - my $link = - &Apache::longroup::get_group_link($cdom,$cnum,$group,$navmap). - '&ref=grouplist'; - $r->print(''.$group,'
'.$description.'

'); + my ($link,$hidden) = + &Apache::longroup::get_group_link($cdom,$cnum,$group,$navmap,$view_permission); +print STDERR "link is ||$link||\n"; + if ($link) { + $link .= '&ref=grouplist'; + $r->print(''. + $description.'

'); + $numlinks ++; + } elsif ($hidden) { + my $numtools = 0; + my $refarg = '&ref=grouplist'; + my $output = + &Apache::longroup::display_group_links($r,$env{'form.grade_target'},$group,'view', + $refarg,\$numtools,$hidden,%group_info); + if ($numtools) { + $r->print(''.$description.''. + '
'.$output.'

'); + $numlinks ++; + } + } } } + if (!$numlinks) { + $r->print( + '

' + .&mt('You do not currently have access to any '.$gpterm.'s' + .' in this '.lc($crstype).'.') + .'

' + ); + } } else { $r->print( '

'