[LON-CAPA-cvs] cvs: loncom /interface groupboards.pm grouproster.pm lonbulletin.pm loncoursegroups.pm longroup.pm lonmenu.pm lonmsgdisplay.pm lonsimplepage.pm

raeburn raeburn at source.lon-capa.org
Fri Feb 26 16:44:40 EST 2016


raeburn		Fri Feb 26 21:44:40 2016 EDT

  Modified files:              
    /loncom/interface	groupboards.pm grouproster.pm lonbulletin.pm 
                     	loncoursegroups.pm longroup.pm lonmenu.pm 
                     	lonmsgdisplay.pm lonsimplepage.pm 
  Log:
  - Bug 6780. No "Groups" item in inline menu for users with unprivileged 
    course roles if all group home pages are hidden, and no group tools 
    enabled.
  
    Move &display_group_links() from lonsimplepage.pm to longroup.pm to
    facilitate re-use. 
  
  
-------------- next part --------------
Index: loncom/interface/groupboards.pm
diff -u loncom/interface/groupboards.pm:1.21 loncom/interface/groupboards.pm:1.22
--- loncom/interface/groupboards.pm:1.21	Sat Nov 23 20:40:57 2013
+++ loncom/interface/groupboards.pm	Fri Feb 26 21:44:39 2016
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Group Bulletin Boards Manager
 #
-# $Id: groupboards.pm,v 1.21 2013/11/23 20:40:57 raeburn Exp $
+# $Id: groupboards.pm,v 1.22 2016/02/26 21:44:39 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -33,6 +33,8 @@
 use Apache::loncommon();
 use Apache::lonnet;
 use Apache::lonuserstate();
+use Apache::longroup;
+use Apache::lonnavmaps;
 use LONCAPA::map();
 use Apache::lonlocal;
 use LONCAPA;
@@ -257,11 +259,21 @@
           text=>"Groups",
           title=>"View course groups"},);
     }
+    my $view_permission =
+          &Apache::lonnet::allowed('vcg',$env{'request.course.id'}.($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''));
+    my $navmap=Apache::lonnavmaps::navmap->new();
+    my $grouppagelink = &Apache::longroup::get_group_link($cdom,$cnum,$group,$navmap,$view_permission,$refarg);
+    if ($grouppagelink) {
+        &Apache::lonhtmlcommon::add_breadcrumb
+            ({href=>$grouppagelink,
+              text=>"$ucgpterm: $description",
+              title=>"Go to group's home page"});
+    } else {
+        &Apache::lonhtmlcommon::add_breadcrumb
+            ({text=>"$ucgpterm: $description",});
+    }
     &Apache::lonhtmlcommon::add_breadcrumb
-        ({href=>"/adm/$cdom/$cnum/$group/smppg?$refarg",
-          text=>"$ucgpterm: $description",
-          title=>"Go to group's home page"},
-         {href=>"/adm/groupboards?group=$group&$refarg",
+         ({href=>"/adm/groupboards?group=$group&$refarg",
           text=>"Discussion Boards",
           title=>"Display group discussion boards"},);
     $output .= &Apache::lonhtmlcommon::breadcrumbs(&mt('[_1] discussion boards - [_2]',$gpterm,$description));
Index: loncom/interface/grouproster.pm
diff -u loncom/interface/grouproster.pm:1.9 loncom/interface/grouproster.pm:1.10
--- loncom/interface/grouproster.pm:1.9	Mon Mar 22 20:11:22 2010
+++ loncom/interface/grouproster.pm	Fri Feb 26 21:44:39 2016
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: grouproster.pm,v 1.9 2010/03/22 20:11:22 droeschl Exp $
+# $Id: grouproster.pm,v 1.10 2016/02/26 21:44:39 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -33,6 +33,7 @@
 use Apache::lonhtmlcommon;
 use Apache::lonlocal;
 use Apache::longroup;
+use Apache::lonnavmaps;
 use LONCAPA;
 use Apache::Constants qw(:common :http);
 use lib '/home/httpd/lib/perl/';
@@ -157,11 +158,21 @@
         $output .= '<h3>'.&mt('Group membership status - [_1]',$description).
                    '</h3>';
     } else {
-        &Apache::lonhtmlcommon::add_breadcrumb
-            ({href=>"/adm/$cdom/$cnum/$group/smppg?$refarg",
+        my $view_permission =
+            &Apache::lonnet::allowed('vcg',$env{'request.course.id'}.($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''));
+        my $navmap=Apache::lonnavmaps::navmap->new();
+        my $grouppagelink = &Apache::longroup::get_group_link($cdom,$cnum,$group,$navmap,$view_permission,$refarg);
+        if ($grouppagelink) {
+            &Apache::lonhtmlcommon::add_breadcrumb
+            ({href=>$grouppagelink,
               text=>"$ucgpterm: $description",
-              title=>"Go to group's home page"},
-             {href=>'/adm/grouproster?group='.$group.'&'.$refarg,
+              title=>"Go to group's home page"},);
+        } else {
+            &Apache::lonhtmlcommon::add_breadcrumb
+            ({text=>"$ucgpterm: $description",});
+        }
+        &Apache::lonhtmlcommon::add_breadcrumb
+             ({href=>'/adm/grouproster?group='.$group.'&'.$refarg,
               text=>"Membership Roster",
               title=>"Display group membership"},);
         $output .= &Apache::lonhtmlcommon::breadcrumbs(&mt($gpterm.' membership status - [_1]',$description));
Index: loncom/interface/lonbulletin.pm
diff -u loncom/interface/lonbulletin.pm:1.67 loncom/interface/lonbulletin.pm:1.68
--- loncom/interface/lonbulletin.pm:1.67	Tue Sep 17 15:04:30 2013
+++ loncom/interface/lonbulletin.pm	Fri Feb 26 21:44:39 2016
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Bulletin Board Handler
 #
-# $Id: lonbulletin.pm,v 1.67 2013/09/17 15:04:30 raeburn Exp $
+# $Id: lonbulletin.pm,v 1.68 2016/02/26 21:44:39 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -37,6 +37,8 @@
 use Apache::lonhtmlgateway;
 use Apache::lonlocal;
 use Apache::lonhtmlcommon;
+use Apache::longroup;
+use Apache::lonnavmaps;
 use HTML::Entities();
 use LONCAPA;
 
@@ -314,10 +316,22 @@
                text=>"Groups",
                title=>"View course groups"});
     }
+    my $view_permission =
+          &Apache::lonnet::allowed('vcg',$env{'request.course.id'}.($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''));
+    my $navmap=Apache::lonnavmaps::navmap->new();
+    my $grouppagelink = &Apache::longroup::get_group_link($cdom,$cnum,$group,$navmap,$view_permission,$refarg);
+    if ($grouppagelink) {
+        push(@{$brcrum},
+            {href=>$grouppagelink,
+             text=>"$ucgpterm: $description",
+             title=>"Go to group's home page"},
+        );
+    } else {
+        push(@{$brcrum},
+            {text=>"$ucgpterm: $description",}
+        );
+    }
     push(@{$brcrum},
-           {href=>"/adm/$cdom/$cnum/$group/smppg?$refarg",
-            text=>"$ucgpterm: $description",
-            title=>"Go to group's home page"},
            {href=>"/adm/groupboards?group=$group&$refarg",
             text=>"Discussion Boards",
             title=>"Display group discussion boards"},
Index: loncom/interface/loncoursegroups.pm
diff -u loncom/interface/loncoursegroups.pm:1.127 loncom/interface/loncoursegroups.pm:1.128
--- loncom/interface/loncoursegroups.pm:1.127	Thu Dec 11 01:19:07 2014
+++ loncom/interface/loncoursegroups.pm	Fri Feb 26 21:44:39 2016
@@ -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 @@
                     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}.'</a>';
                     } 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}.'</a>';
+                        }  
                     }
-                    $link .= '">'.$lt{$action}.'</a>';
                     if ($action eq 'view') { 
                         if ($manage_permission) { 
                             $link .= '  '.$actionlinks{'modify'}.
@@ -394,6 +398,7 @@
     } else {
         my @coursegroups = split(/:/,$env{'request.course.groups'});
         if (@coursegroups > 0) {
+            my $numlinks = 0;
             $r->print('<br /><br />');
             my %curr_groups = &Apache::longroup::coursegroups($cdom,$cnum);
             if (%curr_groups) {
@@ -410,12 +415,36 @@
                                         $curr_groups{$group});
                     my $description = &unescape(
                                         $group_info{description});
-                    my $link = 
-                        &Apache::longroup::get_group_link($cdom,$cnum,$group,$navmap).
-                        '&ref=grouplist';
-                    $r->print('<span style="font-size: larger"><a href="'.$link.'">'.$group,'</a></span><br /><small>'.$description.'</small><br /><br />');
+                    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('<span style="font-size: larger"><a href="'.$link.'">'.
+                                  $description.'</a></span><br /><br />');
+                        $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('<span style="font-size: larger">'.$description.'</a></span>'.
+                                      '<br />'.$output.'<br /><br />');
+                            $numlinks ++;
+                        }
+                    }
                 }
             }
+            if (!$numlinks) {
+                $r->print(
+                    '<p class="LC_info">'
+                   .&mt('You do not currently have access to any '.$gpterm.'s'
+                   .' in this '.lc($crstype).'.')
+                   .'</p>'
+                );
+            }
         } else {
             $r->print(
                 '<p class="LC_info">'
Index: loncom/interface/longroup.pm
diff -u loncom/interface/longroup.pm:1.29 loncom/interface/longroup.pm:1.30
--- loncom/interface/longroup.pm:1.29	Tue Dec 18 15:26:03 2012
+++ loncom/interface/longroup.pm	Fri Feb 26 21:44:39 2016
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # accessor routines used to provide information about course groups 
 #
-# $Id: longroup.pm,v 1.29 2012/12/18 15:26:03 raeburn Exp $
+# $Id: longroup.pm,v 1.30 2016/02/26 21:44:39 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -683,23 +683,130 @@
 ###############################################
 
 sub get_group_link {
-    my ($cdom,$cnum,$group,$navmap) = @_;
+    my ($cdom,$cnum,$group,$navmap,$view_permission,$refarg) = @_;
     if (ref($navmap)) {
-        my $symb = 'uploaded/'.$cdom.'/'.$cnum.'/group_folder_'.$group.'.sequence___1___adm/'.$cdom.'/'.$cnum.'/'.$group.'/smppg';
+        my $map = "uploaded/$cdom/$cnum/group_folder_"."$group.sequence";
+        my $mapres = $navmap->getResourceByUrl("/$map");
+        my $hidden;
+        if (ref($mapres)) {
+            if ((!$viewpermission) && ($mapres->randomout())) {
+                $hidden = 1;
+            }
+        }
+        my $url = "adm/$cdom/$cnum/$group/smppg";
+        my $idx = '1';
+        my $symb = $map.'___'.$idx.'___'.$url;
         my $res = $navmap->getBySymb($symb);
+        $url = "/$url";
+        $map = "/$map";
         my $link;
         if (ref($res)) {
-            $link = $res->link();
-            $link .= (($link=~/\?/)?'&':'?').'symb='.$res->shown_symb();
+            if ((!$view_permission) && ($res->randomout())) {
+                $hidden = 1;
+            } else {
+                $hidden = 0;
+                if ($refarg) {
+                    $link = $url.'?'.$refarg;
+                } else {
+                    $link = $res->link();
+                    $link .= (($link=~/\?/)?'&':'?').'symb='.$res->shown_symb();
+                }
+            }
+        } elsif (&Apache::lonnet::is_on_map($url)) {
+            unless ($hidden) {
+                $link = $url;
+                if ($refarg) {
+                    $link = $url.'?'.$refarg;
+                }
+            }
+        }
+        if (wantarray) {
+            return ($link,$hidden);
         } else {
-            $link = '/adm/'.$cdom.'/'.$cnum.'/'.$group.'/smppg';
+            return $link;
         }
-        return $link; 
     }
     return;
 }
 
 ###############################################
 
+sub display_group_links {
+    my ($r,$target,$group,$context,$refarg,$numtoolsref,$hidehdr,%groupinfo) = @_;
+    my @available = ();
+    my %menu = ();
+    %{$menu{'email'}} = (
+                        text => 'Group Message',
+                        href => '/adm/email?compose=group&group='.$group.
+                                $refarg,
+                      );
+    %{$menu{'discussion'}} = (
+                        text => 'Discussion Boards',
+                        href => '/adm/groupboards?group='.$group.$refarg,
+                      );
+    %{$menu{'chat'}} = (
+                        text => 'Group Chat Room',
+                        href => "javascript:group_chat('$group')",
+                      );
+    %{$menu{'files'}} = (
+                        text => 'Group Portfolio',
+                        href => '/adm/coursegrp_portfolio?group='.$group.
+                                $refarg,
+                      );
+    %{$menu{'roster'}} = (
+                        text => 'Membership Roster',
+                        href => '/adm/grouproster?group='.$group.$refarg,
+                      );
+    foreach my $tool (sort(keys(%menu))) {
+        if ($groupinfo{functions}{$tool} eq 'on') {
+            push(@available,$tool);
+        }
+    }
+    my $output = '';
+    if (ref($numtoolsref) eq 'SCALAR') {
+        $$numtoolsref = scalar(@available);
+    }
+    if (@available > 0) {
+        if ($target eq 'tex') {
+            $output = '<table cellspacing="4" cellpadding="4">';
+        } else {
+            $output = &Apache::loncommon::start_data_table();
+        }
+        foreach my $tool (@available) {
+            if ($target eq 'tex') {
+                $output .= '<tr><td>'.&mt($menu{$tool}{text}).'</td></tr>';
+            } else {
+                $output .= &Apache::loncommon::start_data_table_row()
+                          .'<td><a href="'.$menu{$tool}{href}.'">'
+                          .&mt($menu{$tool}{text}).'</a></td>'
+                          .&Apache::loncommon::end_data_table_row();
+            }
+        }
+        if ($target eq 'tex') {
+            $output .= '</table>';
+        } else {
+            $output .= &Apache::loncommon::end_data_table();
+        }
+        if ($target eq 'tex') {
+            $output = &Apache::lonxml::xmlparse($r,'tex',&mt('Available functions').'<br /><br />'.$output);
+        } else {
+            unless ($hidehdr) {
+                $output = '<h3>'.&mt('Available Group Tools').'</h3>'.$output;
+            }
+        }
+    } else {
+        if ($context eq 'edit') {
+            $output = &mt('No group functionality.');
+        } else {
+            $output = &mt('No group functionality (e.g., e-mail, discussion, chat room or file upload) is currently available to you in this group: [_1].',
+                      '<b>'.&unescape($groupinfo{'description'}).'</b>');
+        }
+        if ($target eq 'tex') {
+            $output = &Apache::lonxml::xmlparse($r,'tex',$output);
+        }
+    }
+    return $output;
+}
+
 1;
 
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.438 loncom/interface/lonmenu.pm:1.439
--- loncom/interface/lonmenu.pm:1.438	Tue Jan 26 14:30:25 2016
+++ loncom/interface/lonmenu.pm	Fri Feb 26 21:44:39 2016
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.438 2016/01/26 14:30:25 raeburn Exp $
+# $Id: lonmenu.pm,v 1.439 2016/02/26 21:44:39 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -371,7 +371,8 @@
     my $canmgr        = &Apache::lonnet::allowed('mgr', $crs_sec); 
     my $author        = &getauthor();
 
-    my ($cdom,$cnum,$showsyllabus,$showfeeds,$showresv);
+    my ($cdom,$cnum,$showsyllabus,$showfeeds,$showresv,$grouptools);
+    $grouptools = 0;
     if ($env{'request.course.id'}) {
         $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
         $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
@@ -397,6 +398,17 @@
                 $showresv = 1;
             }
         }
+        my %groups = &Apache::lonnet::get_active_groups(
+                     $env{'user.domain'}, $env{'user.name'},$cdom,$cnum);
+        if (%groups) {
+            foreach my $group (keys(%groups)) {
+                my @privs = split(/:/,$env{"user.priv.$env{'request.role'}./$cdom/$cnum/$group"});
+                shift(@privs);
+                if (@privs) {
+                    $grouptools ++;
+                }
+            }
+        }
     }
 
     my ($canmodifycoauthor); 
@@ -407,12 +419,6 @@
             $canmodifycoauthor = 1;
         }
     }
-
-    my %groups = &Apache::lonnet::get_active_groups(
-                     $env{'user.domain'}, $env{'user.name'},
-                     $env{'course.' . $env{'request.course.id'} . '.domain'},
-                     $env{'course.' . $env{'request.course.id'} . '.num'});
-
     my ($roleswitcher_js,$roleswitcher_form);
 
     foreach my $menuitem (@secondary_menu) {
@@ -441,7 +447,7 @@
                 && !$canmodpara;
         next if    $$menuitem[4]   =~ /showgroups$/
                 && !$canviewgrps
-                && !%groups;
+                && !$grouptools;
         next if    $$menuitem[4]   eq 'showsyllabus'
                 && !$showsyllabus;
         next if    $$menuitem[4]   eq 'showfeeds'
Index: loncom/interface/lonmsgdisplay.pm
diff -u loncom/interface/lonmsgdisplay.pm:1.182 loncom/interface/lonmsgdisplay.pm:1.183
--- loncom/interface/lonmsgdisplay.pm:1.182	Thu Jun 18 20:19:06 2015
+++ loncom/interface/lonmsgdisplay.pm	Fri Feb 26 21:44:39 2016
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines for messaging display
 #
-# $Id: lonmsgdisplay.pm,v 1.182 2015/06/18 20:19:06 musolffc Exp $
+# $Id: lonmsgdisplay.pm,v 1.183 2016/02/26 21:44:39 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -102,6 +102,8 @@
 use Apache::Constants qw(:common);
 use Apache::loncommon();
 use Apache::lonhtmlcommon();
+use Apache::longroup;
+use Apache::lonnavmaps;
 use Apache::lontexconvert();
 use HTML::Entities();
 use Apache::lonlocal;
@@ -773,14 +775,24 @@
               text=>"Groups",
               title=>$brtitle});
     }
-    &Apache::lonhtmlcommon::add_breadcrumb
-        ({href=>"/adm/$cdom/$cnum/$group/smppg?$refarg",
-          text=>"Group: $description",
-          title=>"Go to group's home page"},
-         {href=>"/adm/email?compose=group&group=".
-                "$env{'form.group'}&$refarg",
-          text=>"Send a Message in a Group",
-          title=>"Compose Group Message"},);
+    my $view_permission =
+          &Apache::lonnet::allowed('vcg',$env{'request.course.id'}.($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''));
+    my $navmap=Apache::lonnavmaps::navmap->new();
+    my $grouppagelink = &Apache::longroup::get_group_link($cdom,$cnum,$group,$navmap,$view_permission,$refarg);
+    if ($grouppagelink) {
+        &Apache::lonhtmlcommon::add_breadcrumb
+            ({href=>$grouppagelink,
+              text=>"Group: $description",
+              title=>"Go to group's home page"},);
+    } else {
+        &Apache::lonhtmlcommon::add_breadcrumb
+            ({text=>"Group: $description",});
+    }
+    &Apache::lonhtmlcommon::add_breadcrumb   
+          ({href=>"/adm/email?compose=group&group=".
+                     "$env{'form.group'}&$refarg",
+               text=>"Send a Message in a Group",
+               title=>"Compose Group Message"},);
     if ($action eq 'sending') {
             &Apache::lonhtmlcommon::add_breadcrumb
                          ({text=>"Messages being sent.",
Index: loncom/interface/lonsimplepage.pm
diff -u loncom/interface/lonsimplepage.pm:1.103 loncom/interface/lonsimplepage.pm:1.104
--- loncom/interface/lonsimplepage.pm:1.103	Tue Sep 17 15:04:30 2013
+++ loncom/interface/lonsimplepage.pm	Fri Feb 26 21:44:39 2016
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Simple Page Editor
 #
-# $Id: lonsimplepage.pm,v 1.103 2013/09/17 15:04:30 raeburn Exp $
+# $Id: lonsimplepage.pm,v 1.104 2016/02/26 21:44:39 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -187,7 +187,8 @@
         if ($has_group_access) {
             if ((!$group_home_edit) && (!$group_home_view) &&
                 (!$group_view_perm) && (!$group_edit_perm)) {
-                &display_group_links($r,$target,$group,'view',$refarg,%groupinfo);
+                $r->print(&Apache::longroup::display_group_links($r,$env{'form.grade_target'},$group,
+                                                           'view',$refarg,undef,undef,%groupinfo));
                 if ($env{'form.grade_target'} ne 'tex') {
                     $r->print(&Apache::loncommon::end_page());
                 } else {
@@ -348,7 +349,8 @@
 				my %fields = %{$fields_ref};
 				$r->print('<br /><input type="hidden" name="'.$field.
 					'" value="'.$data{$field}.'" />');
-				&display_group_links($r, $target, $group, 'edit', $refarg, %groupinfo);
+                                $r->print(&Apache::longroup::display_group_links($r,$target,$group,'edit',
+				                                                 $refarg,undef,undef,%groupinfo));
 				$r->print('<br />');
 			}
         };
@@ -367,7 +369,7 @@
 
     } else {
         if ($group ne '') {
-            &display_group_links($r,$target,$group,'view',$refarg,%groupinfo);
+            $r->print(&Apache::longroup::display_group_links($r,$target,$group,'view',$refarg,undef,undef,%groupinfo));
         } else {
             my $text=&mt('No page information provided.');
             if ($target ne 'tex') {
@@ -385,79 +387,6 @@
     return OK;
 }
 
-sub display_group_links {
-    my ($r,$target,$group,$context,$refarg,%groupinfo) = @_;
-    my @available = ();
-    my %menu = ();
-    %{$menu{'email'}} = (
-                        text => 'Group Message',
-                        href => '/adm/email?compose=group&group='.$group.
-                                $refarg,
-                      );
-    %{$menu{'discussion'}} = (
-                        text => 'Discussion Boards',
-                        href => '/adm/groupboards?group='.$group.$refarg,
-                      );
-    %{$menu{'chat'}} = (
-                        text => 'Group Chat Room',
-                        href => "javascript:group_chat('$group')",
-                      );
-    %{$menu{'files'}} = (
-                        text => 'Group Portfolio',
-                        href => '/adm/coursegrp_portfolio?group='.$group.
-                                $refarg,
-                      );
-    %{$menu{'roster'}} = (
-                        text => 'Membership Roster',
-                        href => '/adm/grouproster?group='.$group.$refarg,
-                      );
-    foreach my $tool (sort(keys(%menu))) {
-        if ($groupinfo{functions}{$tool} eq 'on') {
-            push(@available,$tool);
-        }
-    }
-    if (@available > 0) {
-        my $output = '';
-        if ($target eq 'tex') {
-            $output = '<table cellspacing="4" cellpadding="4">';
-        } else {
-            $output = &Apache::loncommon::start_data_table();
-        }
-        foreach my $tool (@available) {
-            if ($target eq 'tex') {
-                $output .= '<tr><td>'.&mt($menu{$tool}{text}).'</td></tr>';
-            } else {
-                $output .= &Apache::loncommon::start_data_table_row()
-                          .'<td><a href="'.$menu{$tool}{href}.'">'
-                          .&mt($menu{$tool}{text}).'</a></td>'
-                          .&Apache::loncommon::end_data_table_row();
-            }
-        }
-        if ($target eq 'tex') {
-            $output .= '</table>';
-        } else {
-            $output .= &Apache::loncommon::end_data_table();
-        }
-        if ($target eq 'tex') {
-            $r->print(&Apache::lonxml::xmlparse($r,'tex',&mt('Available functions').'<br /><br />'.$output));
-        } else {
-            $r->print('<h3>'.&mt('Available Group Tools').'</h3>'.$output);
-        }
-    } else {
-        my $output;
-        if ($context eq 'edit') {
-            $output = &mt('No group functionality.');
-        } else {
-            $output = &mt('No group functionality (e.g., e-mail, discussion, chat room or file upload) is currently available to you in this group: [_1].','<b>'.&unescape($groupinfo{'description'}).'</b>');
-        }
-        if ($target eq 'tex') {
-            $r->print(&Apache::lonxml::xmlparse($r,'tex',$output));
-        } else {
-            $r->print($output);
-        }
-    }
-}
-
 sub grouppage_breadcrumbs {
     my ($cdom,$cnum,$group,$description) = @_;
     &Apache::lonhtmlcommon::clear_breadcrumbs();


More information about the LON-CAPA-cvs mailing list