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

raeburn lon-capa-cvs@mail.lon-capa.org
Mon, 11 Dec 2006 18:50:41 -0000


raeburn		Mon Dec 11 13:50:41 2006 EDT

  Modified files:              
    /loncom/interface	lonfeedback.pm 
  Log:
  bug 5037 - destinations for resource content, course content, or course policy can now be filtered based on sender's group memberships.  
  
  
Index: loncom/interface/lonfeedback.pm
diff -u loncom/interface/lonfeedback.pm:1.235 loncom/interface/lonfeedback.pm:1.236
--- loncom/interface/lonfeedback.pm:1.235	Sun Dec 10 23:10:35 2006
+++ loncom/interface/lonfeedback.pm	Mon Dec 11 13:50:40 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Feedback
 #
-# $Id: lonfeedback.pm,v 1.235 2006/12/11 04:10:35 raeburn Exp $
+# $Id: lonfeedback.pm,v 1.236 2006/12/11 18:50:40 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -2667,13 +2667,18 @@
     my $defaultflag=shift;
     $rec=~s/\s+//g;
     $rec=~s/\@/\:/g;
-    my ($adr,$sections)=($rec=~/^([^\(]+)\(([^\)]+)\)/);
-    if ($sections) {
-	foreach my $sec (split(/\;/,$sections)) {
-            if (($sec eq $env{'request.course.sec'}) ||
-                ($defaultflag && ($sec eq '*'))) {
+    my ($adr,$sections_or_groups)=($rec=~/^([^\(]+)\(([^\)]+)\)/);
+    if ($sections_or_groups) {
+	foreach my $item (split(/\;/,$sections_or_groups)) {
+            if (($item eq $env{'request.course.sec'}) ||
+                ($defaultflag && ($item eq '*'))) {
                 return $adr; 
-            }
+            } elsif ($env{'request.course.groups'}) {
+                my @usersgroups = split(/:/,$env{'request.course.groups'});
+                if (grep(/^\Q$item\E$/,@usersgroups)) {
+                    return $adr;
+                }
+            } 
         }
     } else {
        return $rec;