--- loncom/interface/loncoursegroups.pm 2014/02/11 17:09:30 1.123 +++ loncom/interface/loncoursegroups.pm 2016/02/27 03:06:38 1.129 @@ -1,6 +1,6 @@ # The LearningOnline Network with CAPA # -# $Id: loncoursegroups.pm,v 1.123 2014/02/11 17:09:30 bisitz Exp $ +# $Id: loncoursegroups.pm,v 1.129 2016/02/27 03:06:38 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -328,19 +328,22 @@ 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); + 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 +397,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 +414,35 @@ 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); + 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( '

' @@ -831,7 +858,7 @@ sub group_administration { } } if (warn_zero == 1) { - alert("You have indicated that the group portfolio should be enabled, but you have set the respository quota to 0 MB.\nThis will prevent any upload of files.\nPlease set a value or disable the repository feature."); + alert("You have indicated that the group portfolio should be enabled, but you have set the repository quota to 0 MB.\nThis will prevent any upload of files.\nPlease set a value or disable the repository feature."); return; } } @@ -1587,7 +1614,7 @@ sub group_members { future => 0, ); my $totalmembers = 0; - foreach my $member (keys %memberhash) { + foreach my $member (keys(%memberhash)) { $totalmembers ++; my ($end,$start) = split(/:/,$memberhash{$member}); unless ($start == -1) { @@ -1702,7 +1729,7 @@ sub groupsettings_options { if ($remnum) { $halfnum ++; } - my @allfunctions = sort(keys (%{$functions})); + my @allfunctions = sort(keys(%{$functions})); $r->print(&Apache::lonhtmlcommon::row_title($lt{'func'}) .'

' @@ -3503,7 +3530,7 @@ sub process_membership { if (grep/^$user$/,@reenable) { $start = $startdate; $end = $enddate; - $type = 'reenabled'; + $type = 're-enabled'; } } if ($type eq '') { @@ -3543,8 +3570,6 @@ sub process_membership { my $tmsg = "The following users were successfully $type"; if (!($type eq 'deleted' || $type eq 'expired')) { $tmsg .= ' with the following privileges'; - } else { - $tmsg .= ' with the following privileges'; } $message .= &mt($tmsg.':').'
'; foreach my $user (@{$added{$type}}) { @@ -4190,43 +4215,40 @@ sub validate_groupname { } my %lt = &Apache::lonlocal::texthash ( igna => "Invalid $gpterm name", - tgne => "The $gpterm name entered ", grna => "$ucgpterm names and section names used in a ". "$crstype must be unique.", - isno => "is not a valid name.", gnmo => "$ucgpterm names may only contain letters, ". "numbers or underscores.", - cnnb => "can not be used as it is the name of ", - inth => " in this $crstype", - thgr => "- does not correspond to the name of an ". - "existing $gpterm", ); - my $exitmsg = ''.$lt{'igna'}.'

'. - $lt{'tgne'}.' "'.$groupname.'" '; - my $dupmsg = $lt{'grna'}; - my $earlyout; + my $exitmsg = ''.$lt{'igna'}.'

'; + my $nameshown = &Apache::loncommon::cleanup_html($groupname); if (($groupname eq '') || ($groupname =~ /\W/)) { - $earlyout = $exitmsg.$lt{'isno'}.'
'.$lt{'gnmo'}; - return $earlyout; + return $exitmsg. + &mt("The $gpterm name entered '[_1]' is not a valid name.",$nameshown). + '
'.$lt{'gnmo'}; + } elsif ($groupname eq 'syllabus') { + return $exitmsg. + &mt("The $gpterm name entered '[_1]' is reserved for use by LON-CAPA.",$nameshown); } if (exists($sectioncount{$groupname})) { - return $exitmsg.$lt{'cnnb'}.&mt('a section').$lt{'inth'}. - '
'.$lt{'grna'}; + return $exitmsg. + &mt("The $gpterm name entered '[_1]' can not be used as it is the name of a section in this $crstype.",$nameshown). + '
'.$lt{'grna'}; } if ($action eq 'create') { if (exists($curr_groups{$groupname})) { - return $exitmsg.$lt{'cnnb'}.&mt("an existing $gpterm"). - $lt{'inth'}.'.
'.$lt{'grna'}; + return $exitmsg. + &mt("The $gpterm name entered '[_1]' can not be used as it is the name of an existing $gpterm in this $crstype.",$nameshown). + '
'.$lt{'grna'}; } elsif (exists($deleted_groups{$groupname})) { - return $exitmsg.$lt{'cnnb'}.&mt("a $gpterm which previously existed"). - $lt{'inth'}.'.
'.$lt{'grna'}; + return $exitmsg. + &mt("The $gpterm name entered '[_1]' can not be used as it is the name of a $gpterm which previously existed in this $crstype.",$nameshown). + '
'.$lt{'grna'}; } } elsif ($action eq 'modify') { unless(exists($curr_groups{$groupname})) { - $earlyout = &mt("$ucgpterm name:").' '.$groupname.$lt{'thgr'}. - $lt{'inth'}; - return $earlyout; + return &mt("$ucgpterm name: [_1] does not correspond to the name of an existing $gpterm in this $crstype.",$nameshown); } } return;