[LON-CAPA-cvs] cvs: loncom /interface lonsimplepage.pm

raeburn lon-capa-cvs@mail.lon-capa.org
Sat, 08 Jul 2006 01:12:53 -0000


raeburn		Fri Jul  7 21:12:53 2006 EDT

  Modified files:              
    /loncom/interface	lonsimplepage.pm 
  Log:
  Adding breadcrumbs when group page is accessed from "Groups" menu.  Not displayed if reached from NAVMAPS or via standard navigation using fwd or backwd arrows.    
  
  
Index: loncom/interface/lonsimplepage.pm
diff -u loncom/interface/lonsimplepage.pm:1.43 loncom/interface/lonsimplepage.pm:1.44
--- loncom/interface/lonsimplepage.pm:1.43	Fri Jul  7 17:25:02 2006
+++ loncom/interface/lonsimplepage.pm	Fri Jul  7 21:12:53 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Simple Page Editor
 #
-# $Id: lonsimplepage.pm,v 1.43 2006/07/07 21:25:02 raeburn Exp $
+# $Id: lonsimplepage.pm,v 1.44 2006/07/08 01:12:53 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -38,6 +38,7 @@
 use Apache::lonprintout;
 use Apache::lonxml;
 use Apache::longroup;
+use LONCAPA;
 
 sub handler {
     my $r = shift;
@@ -64,8 +65,7 @@
     my $crs = $env{'course.'.$env{'request.course.id'}.'.num'};
     my $grp_view_permission = &Apache::lonnet::allowed('vcg',
                                                    $env{'request.course.id'});
-    my $namespace;
-    my $group;
+    my ($namespace,$group,$grp_desc);
 
     my %curr_group = ();
     my %groupinfo = ();
@@ -79,6 +79,7 @@
         }
         %groupinfo = 
 	    &Apache::longroup::get_group_settings($curr_groups{$group});
+        $grp_desc = &unescape($groupinfo{'description'});
         $namespace = 'grppage_'.$group;
     } else {
         $marker=~s/\D//g;
@@ -102,7 +103,8 @@
 
 # ------------------------------------------------------------ Get query string
     &Apache::loncommon::get_unprocessed_cgi
-                        ($ENV{'QUERY_STRING'},['forcestudent','forceedit','register']);
+                        ($ENV{'QUERY_STRING'},['forcestudent','forceedit',
+                                               'register','ref']);
 # --------------------------------------------------------------- Force Student
     my $forcestudent='';
     if ($env{'form.forcestudent'} || $target eq 'tex' ) { $forcestudent='student'; };
@@ -130,11 +132,18 @@
 
     if ($group ne '') {
         if (($grp_view_permission) || 
-                           (&Apache::longroup::check_group_access($caller))) {
+                            (&Apache::longroup::check_group_access($caller))) {
             if ((!&Apache::lonnet::allowed('vgh',
                                       $env{'request.course.id'}.'/'.$marker))
                 && (!&Apache::lonnet::allowed('mdg',
-                                      $env{'request.course.id'}.'/'.$marker))) {
+                                     $env{'request.course.id'}.'/'.$marker))) {
+                if ($env{'form.ref'} eq 'grouplist') {
+                    my $gpterm =  &Apache::loncommon::group_term();
+                    my $ucgpterm = $gpterm;
+                    $ucgpterm =~ s/^(\w)/uc($1)/e;
+                    $r->print(&grouppage_breadcrumbs($dom,$crs,$group,$gpterm,
+                                                     $ucgpterm,$grp_desc));
+                }
                 &display_group_links($r,$target,$marker,'view',%groupinfo);
                 return OK;
             }
@@ -308,15 +317,20 @@
 
 sub display_group_links {
     my ($r,$target,$marker,$context,%groupinfo) = @_;
+    my $refarg;
+    if ($env{'form.ref'} eq 'grouplist') {
+        $refarg = '&ref=grouplist';
+    }
     my @available = ();
     my %menu = ();
     %{$menu{'email'}} = (
                         text => 'Group e-mail',
-                        href => '/adm/email?compose=group&group='.$marker,
+                        href => '/adm/email?compose=group&group='.$marker.
+                        $refarg,
                       );
     %{$menu{'discussion'}} = (
                         text => 'Discussion Boards',
-                        href => '/adm/groupboards?group='.$marker,
+                        href => '/adm/groupboards?group='.$marker.$refarg,
                       );
     %{$menu{'chat'}} = (
                         text => 'Group chat',
@@ -324,11 +338,11 @@
                       );
     %{$menu{'files'}} = (
                         text => 'File repository',
-                        href => '/adm/coursegrp_portfolio?group='.$marker,
+                        href => '/adm/coursegrp_portfolio?group='.$marker.$refarg,
                       );
     %{$menu{'roster'}} = (
                         text => 'Membership roster',
-                        href => '/adm/grouproster?group='.$marker,
+                        href => '/adm/grouproster?group='.$marker.$refarg,
                       );
     foreach my $tool (sort(keys(%menu))) {
         if ($groupinfo{functions}{$tool} eq 'on') {
@@ -365,7 +379,21 @@
         }
     }
 }
- 
+
+sub grouppage_breadcrumbs {
+    my ($cdom,$cnum,$group,$gpterm,$ucgpterm,$description) = @_;
+    &Apache::lonhtmlcommon::clear_breadcrumbs();
+    &Apache::lonhtmlcommon::add_breadcrumb
+        ({href=>"/adm/coursegroups",
+          text=>"$ucgpterm".'s',
+          title=>"Display $ucgpterm".'s'},
+        {href=>"/adm/$cdom/$cnum/$group/smppg?ref=grouplist",
+          text=>"$ucgpterm: $description",
+          title=>"Go to group's home page"},
+        );
+    my $output .= &Apache::lonhtmlcommon::breadcrumbs(&mt('[_1] page - [_2]',$gpterm,$description));
+    return $output;
+}
 
 1;
 __END__