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

albertel lon-capa-cvs-allow@mail.lon-capa.org
Mon, 06 Aug 2007 22:00:54 -0000


albertel		Mon Aug  6 18:00:54 2007 EDT

  Modified files:              
    /loncom/interface	lonmsgdisplay.pm 
  Log:
  - some more BUG#5350
  
  
  
Index: loncom/interface/lonmsgdisplay.pm
diff -u loncom/interface/lonmsgdisplay.pm:1.81 loncom/interface/lonmsgdisplay.pm:1.82
--- loncom/interface/lonmsgdisplay.pm:1.81	Tue Jul 17 14:35:54 2007
+++ loncom/interface/lonmsgdisplay.pm	Mon Aug  6 18:00:53 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines for messaging display
 #
-# $Id: lonmsgdisplay.pm,v 1.81 2007/07/17 18:35:54 albertel Exp $
+# $Id: lonmsgdisplay.pm,v 1.82 2007/08/06 22:00:53 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2073,6 +2073,22 @@
 	$counter++;
     }
     $r->print('</pre>');
+
+    my $see_anonymous;
+    my $from_student = 0;
+    if ($env{'request.course.id'} eq $content{'courseid'}) {
+	my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+	my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+	my $username = $content{'sendername'}.':'.$content{'senderdomain'};
+	my %classlist_entry =
+	    &Apache::lonnet::get('classlist',[$username],$cdom,$cnum);
+	if (exists($classlist_entry{$username})) {
+	    $from_student = 1;
+	    $see_anonymous = &Apache::lonnet::allowed('rin',$env{'request.course.id'}.($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''));
+	}
+    }
+
+
     my $number_of_messages = scalar(@messages); #subtract 1 for last index
 # start output
     &printheader($r,'/adm/email?display='.&escape($msgid),'Display a Message','',$content{'baseurl'});
@@ -2107,6 +2123,7 @@
         $symb=&Apache::lonnet::symbread($content{'baseurl'});
     }
     if ($env{'user.adv'}) {
+	my $adv_actions;
 	$r->print('<table border="2" width="100%"><tr bgcolor="#FFAAAA"><td>'.&mt('Currently available actions (will open extra window)').':</td>');
 	if (&Apache::lonnet::allowed('vgr',$env{'request.course.id'})) {
 		$r->print('<td><b>'.&Apache::loncommon::track_student_link(&mt('View recent activity'),$content{'sendername'},$content{'senderdomain'},'check').'</b></td>');
@@ -2146,7 +2163,10 @@
     if (defined($content{'baseurl'})) {
         $baseurl = &Apache::lonenc::check_encrypt($content{'baseurl'});
     }
-    $r->print(&Apache::loncommon::student_image_tag($content{'senderdomain'},$content{'sendername'}));
+    if ($from_student && $see_anonymous ) {
+	$r->print(&Apache::loncommon::student_image_tag($content{'senderdomain'},$content{'sendername'}));
+    }
+
     $r->print('<br /><b>'.&mt('Subject').':</b> '.$content{'subject'});
     if ($folder eq 'sent') {
         $r->print('<br /><b>'.&mt('To').':</b> '.$tolist);