[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm lontrackstudent.pm lonuserutils.pm

raeburn raeburn@source.lon-capa.org
Fri, 28 Aug 2009 22:47:07 -0000


raeburn		Fri Aug 28 22:47:07 2009 EDT

  Modified files:              
    /loncom/interface	lonuserutils.pm lontrackstudent.pm loncommon.pm 
  Log:
  - Bug 5985.
  - Username in classlist can link to display of user activity (/adm/trackstudent).  
  
  
Index: loncom/interface/lonuserutils.pm
diff -u loncom/interface/lonuserutils.pm:1.97 loncom/interface/lonuserutils.pm:1.98
--- loncom/interface/lonuserutils.pm:1.97	Fri Aug 14 10:37:22 2009
+++ loncom/interface/lonuserutils.pm	Fri Aug 28 22:47:07 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Utility functions for managing LON-CAPA user accounts
 #
-# $Id: lonuserutils.pm,v 1.97 2009/08/14 10:37:22 raeburn Exp $
+# $Id: lonuserutils.pm,v 1.98 2009/08/28 22:47:07 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2122,6 +2122,17 @@
             document.location.href = '/adm/'+domain+'/'+username+'/aboutme';
         }
     }
+    if (target == 'track') {
+        if (document.$formname.userwin.checked == true) {
+            var url = '/adm/trackstudent?selected_student='+username+':'+domain+'&only_body=1';
+            var options = 'height=600,width=800,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no';
+            var trackwin = window.open(url,'',options,1);
+            trackwin.focus();
+            return;
+        } else {
+            document.location.href = '/adm/trackstudent?selected_student='+username+':'+domain;
+        }
+    }
 }
 // ]]>
 </script>
@@ -2156,6 +2167,7 @@
                        'aboutme'    => "Display a user's personal information page",
                        'owin'       => "Open in a new window",
                        'modify'     => "Modify a user's information",
+                       'track'      => "View a user's recent activity",
                        'clicker'    => "Clicker-ID",
                       );
     if ($context eq 'domain' && $env{'form.roletype'} eq 'course') {
@@ -2269,6 +2281,12 @@
             if ($permission->{'cusr'}) {
                 unshift (@linkdests,'modify');
             }
+            if (&Apache::lonnet::allowed('vsa', $env{'request.course.id'}) ||
+                &Apache::lonnet::allowed('vsa', $env{'request.course.id'}.'/'.
+                                         $env{'request.course.sec'})) {
+                push(@linkdests,'track');
+            }
+
             $output .= '<td>';
             my $usernamelink = $env{'form.usernamelink'};
             if ($usernamelink eq '') {
Index: loncom/interface/lontrackstudent.pm
diff -u loncom/interface/lontrackstudent.pm:1.29 loncom/interface/lontrackstudent.pm:1.30
--- loncom/interface/lontrackstudent.pm:1.29	Thu May 14 14:23:56 2009
+++ loncom/interface/lontrackstudent.pm	Fri Aug 28 22:47:07 2009
@@ -1,6 +1,6 @@
 # The LearningOnline Network with CAPA
 #
-# $Id: lontrackstudent.pm,v 1.29 2009/05/14 14:23:56 bisitz Exp $
+# $Id: lontrackstudent.pm,v 1.30 2009/08/28 22:47:07 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -119,14 +119,16 @@
 	$text = 'View more activity by this student';
 	$inc  = $num_records;
 	$r->print(&Apache::loncommon::track_student_link($text,$sname,$sdom,undef,
-							 ($env{'form.start'}+$inc)
+							 ($env{'form.start'}+$inc),
+                                                         $env{'form.only_body'}
 							 ));
 	$r->print('<br />');
     }
     $r->print('<hr />');
     $text = 'Resubmit last request to check for newer data';
     $r->print(&Apache::loncommon::track_student_link($text,$sname,$sdom,undef,
-						     $env{'form.start'}));
+						     $env{'form.start'},
+                                                     $env{'form.only_body'}));
 
     &Apache::lonhtmlcommon::Update_PrgWin($r,$prog_state,&mt('Finished!'));
     return;
@@ -554,7 +556,7 @@
     #
     # Extract form elements from query string
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
-                                            ['selected_student','start']);
+                      ['selected_student','start','only_body']);
     #
     # We will almost always need this...
     my $navmap = Apache::lonnavmaps::navmap->new();
@@ -572,7 +574,11 @@
                                             bug=>'instructor interface'});
     #
     # Give the LON-CAPA page header
-    $r->print(&Apache::loncommon::start_page('Student Activity',&styles()).
+    my $args;
+    if ($env{'form.only_body'}) {
+        $args = { only_body => 1, };
+    }
+    $r->print(&Apache::loncommon::start_page('Student Activity',&styles(),$args).
               &Apache::lonhtmlcommon::breadcrumbs('Student Activity'));
     $r->rflush();
     #
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.886 loncom/interface/loncommon.pm:1.887
--- loncom/interface/loncommon.pm:1.886	Wed Aug 19 19:43:38 2009
+++ loncom/interface/loncommon.pm	Fri Aug 28 22:47:07 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.886 2009/08/19 19:43:38 raeburn Exp $
+# $Id: loncommon.pm,v 1.887 2009/08/28 22:47:07 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2971,7 +2971,7 @@
 # -----------------------------------------------------------------------------
 
 sub track_student_link {
-    my ($linktext,$sname,$sdom,$target,$start) = @_;
+    my ($linktext,$sname,$sdom,$target,$start,$only_body) = @_;
     my $link ="/adm/trackstudent?";
     my $title = 'View recent activity';
     if (defined($sname) && $sname !~ /^\s*$/ &&
@@ -2985,6 +2985,7 @@
         $target = '';
     }
     if ($start) { $link.='&amp;start='.$start; }
+    if ($only_body) { $link .= '&amp;only_body=1'; }
     $title = &mt($title);
     $linktext = &mt($linktext);
     return qq{<a href="$link" title="$title" $target>$linktext</a>}.