[LON-CAPA-cvs] cvs: loncom(version_2_9_X) /interface lonuserutils.pm

raeburn raeburn@source.lon-capa.org
Mon, 07 Sep 2009 13:49:49 -0000


raeburn		Mon Sep  7 13:49:49 2009 EDT

  Modified files:              (Branch: version_2_9_X)
    /loncom/interface	lonuserutils.pm 
  Log:
  - Backport 1.98, 1.99.
  
  
Index: loncom/interface/lonuserutils.pm
diff -u loncom/interface/lonuserutils.pm:1.97.2.1 loncom/interface/lonuserutils.pm:1.97.2.2
--- loncom/interface/lonuserutils.pm:1.97.2.1	Fri Aug 14 11:03:59 2009
+++ loncom/interface/lonuserutils.pm	Mon Sep  7 13:49:49 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Utility functions for managing LON-CAPA user accounts
 #
-# $Id: lonuserutils.pm,v 1.97.2.1 2009/08/14 11:03:59 raeburn Exp $
+# $Id: lonuserutils.pm,v 1.97.2.2 2009/09/07 13:49:49 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,11 @@
             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 '') {
@@ -4828,14 +4845,18 @@
     my ($context,$custom) = @_;
     my @allroles;
     if ($context eq 'course') {
-        @allroles = ('st','ad','ta','ep','in','cc');
+        @allroles = ('st');
+        if ($env{'request.role'} =~ m{^dc\./}) {
+            push(@allroles,'ad');
+        }
+        push(@allroles,('ta','ep','in','cc'));
         if ($custom) {
             push(@allroles,'cr');
         }
     } elsif ($context eq 'author') {
         @allroles = ('ca','aa');
     } elsif ($context eq 'domain') {
-        @allroles = ('li','dg','sc','au','dc');
+        @allroles = ('li','ad','dg','sc','au','dc');
     }
     return @allroles;
 }