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

raeburn raeburn at source.lon-capa.org
Tue Mar 6 13:10:23 EST 2012


raeburn		Tue Mar  6 18:10:23 2012 EDT

  Modified files:              
    /loncom/interface	lonfeedback.pm 
  Log:
  - Bug 5991
    - Only append username:domain to poster's nickname if viewer has priv to
      see identity behnid anonymous postings.
    - Only wrap poster's name with &aboutmewrapper() if aboutme page service 
      is available for the poster.
  
  
Index: loncom/interface/lonfeedback.pm
diff -u loncom/interface/lonfeedback.pm:1.335 loncom/interface/lonfeedback.pm:1.336
--- loncom/interface/lonfeedback.pm:1.335	Mon Feb 20 11:28:01 2012
+++ loncom/interface/lonfeedback.pm	Tue Mar  6 18:10:23 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Feedback
 #
-# $Id: lonfeedback.pm,v 1.335 2012/02/20 11:28:01 goltermann Exp $
+# $Id: lonfeedback.pm,v 1.336 2012/03/06 18:10:23 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1071,7 +1071,7 @@
                 my %subjects = ();
                 my %attachtxt = ();
                 my %allattachments = ();
-                my ($screenname,$plainname);
+                my ($screenname,$plainname,$showaboutme);
                 my $sender = &mt('Anonymous');
 # Anonymous users getting number within a discussion
 # Since idx is in static order, this should give the same sequence every time. 
@@ -1081,7 +1081,7 @@
 		    $$anonhash{$key}=&mt('Anonymous').' '.$anoncnt;
 		}
                 my ($message,$subject,$vgrlink,$ctlink);
-                &get_post_contents(\%contrib,$idx,$seeid,$outputtarget,\%messages,\%subjects,\%allattachments,\%attachtxt,$imsfiles,\$screenname,\$plainname,$numoldver);
+                &get_post_contents(\%contrib,$idx,$seeid,$outputtarget,\%messages,\%subjects,\%allattachments,\%attachtxt,$imsfiles,\$screenname,\$plainname,\$showaboutme,$numoldver);
 
 
 # Set up for sorting by subject
@@ -1111,12 +1111,18 @@
                             }
                         }
 		        if (!$contrib{$idx.':anonymous'} || $see_anonymous) {
-			    $sender=&Apache::loncommon::aboutmewrapper(
-					 $plainname,
-					 $contrib{$idx.':sendername'},
-					 $contrib{$idx.':senderdomain'}).' ('.
-					 $contrib{$idx.':sendername'}.':'.
-					 $contrib{$idx.':senderdomain'}.')';
+                            if ($showaboutme) {
+                                $sender = &Apache::loncommon::aboutmewrapper(
+                                              $plainname,
+                                              $contrib{$idx.':sendername'},
+                                              $contrib{$idx.':senderdomain'});
+                            } else {
+                                $sender = $plainname;
+                            }
+                            if ($see_anonymous) {
+                                $sender .= ' ('.$contrib{$idx.':sendername'}.':'.
+					   $contrib{$idx.':senderdomain'}.')';
+                            }
                             $sender = '<b>'.$sender.'</b>';
 			    if ($contrib{$idx.':anonymous'}) {
 			        $sender.=' <font color="red"><b>['.$$anonhash{$key}.']</b></font> '.
@@ -1468,7 +1474,7 @@
 
 
 sub get_post_contents {
-    my ($contrib,$idx,$seeid,$type,$messages,$subjects,$allattachments,$attachtxt,$imsfiles,$screenname,$plainname,$numver) = @_;
+    my ($contrib,$idx,$seeid,$type,$messages,$subjects,$allattachments,$attachtxt,$imsfiles,$screenname,$plainname,$showaboutme,$numver) = @_;
     my $discussion = '';
     my $start=$numver;
     my $end=$numver + 1;
@@ -1486,13 +1492,20 @@
                                         $$contrib{$idx.':sendername'},
                                         $$contrib{$idx.':senderdomain'});
     $$screenname=$$contrib{$idx.':screenname'};
-
-    my $sender=&Apache::loncommon::aboutmewrapper(
+    $$showaboutme = &Apache::lonnet::usertools_access($$contrib{$idx.':sendername'},
+                                                      $$contrib{$idx.':senderdomain'},
+                                                      'aboutme');
+    my $sender = $$plainname;
+    if ($$showaboutme) {
+        $sender = &Apache::loncommon::aboutmewrapper(
                                  $$plainname,
                                  $$contrib{$idx.':sendername'},
-                                 $$contrib{$idx.':senderdomain'}).' ('.
-                                 $$contrib{$idx.':sendername'}.':'.
-                                 $$contrib{$idx.':senderdomain'}.')';
+                                 $$contrib{$idx.':senderdomain'});
+    }
+    if ($seeid) {
+        $sender .= ' ('.$$contrib{$idx.':sendername'}.':'.
+                   $$contrib{$idx.':senderdomain'}.')';
+    }
     my $attachmenturls = $$contrib{$idx.':attachmenturl'};
     my @postversions = ();
     if ($type eq 'allversions' || $type eq 'export') {
@@ -3798,11 +3811,11 @@
           my %attachmsgs = ();
           my %allattachments = ();
           my %imsfiles = ();
-          my ($screenname,$plainname);
+          my ($screenname,$plainname,$showaboutme);
           my %contrib=&Apache::lonnet::restore($symb,$env{'request.course.id'},
                            $env{'course.'.$env{'request.course.id'}.'.domain'},
                            $env{'course.'.$env{'request.course.id'}.'.num'});
-          $r->print(&get_post_contents(\%contrib,$idx,$seeid,'allversions',\%messages,\%subjects,\%allattachments,\%attachmsgs,\%imsfiles,\$screenname,\$plainname));
+          $r->print(&get_post_contents(\%contrib,$idx,$seeid,'allversions',\%messages,\%subjects,\%allattachments,\%attachmsgs,\%imsfiles,\$screenname,\$plainname,\$showaboutme));
       }
       $r->print(&Apache::loncommon::end_page());
       return OK;




More information about the LON-CAPA-cvs mailing list