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

raeburn raeburn@source.lon-capa.org
Sat, 20 Nov 2010 01:07:05 -0000


raeburn		Sat Nov 20 01:07:05 2010 EDT

  Modified files:              
    /loncom/interface	lonfeedback.pm 
  Log:
  - If pgd priv is used to allow feedback, check that symb is for a group
    bulletin board.
  - Fix a typo in regexp used to check symb when showing posters in group board.   
  
  
Index: loncom/interface/lonfeedback.pm
diff -u loncom/interface/lonfeedback.pm:1.303 loncom/interface/lonfeedback.pm:1.304
--- loncom/interface/lonfeedback.pm:1.303	Fri Nov 19 20:32:38 2010
+++ loncom/interface/lonfeedback.pm	Sat Nov 20 01:07:05 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Feedback
 #
-# $Id: lonfeedback.pm,v 1.303 2010/11/19 20:32:38 raeburn Exp $
+# $Id: lonfeedback.pm,v 1.304 2010/11/20 01:07:05 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -724,7 +724,8 @@
         }
 	if ((&discussion_open($status)) && ($outputtarget ne 'tex')) {
             if (($group ne '') && ($mode eq 'board')) {  
-                if (&check_group_priv($group,'pgd') eq 'ok') {
+                if ((&check_group_priv($group,'pgd') eq 'ok') && 
+                   ($ressymb =~ m{^bulletin___\d+___adm/wrapper/adm/\Q$cdom\E/\Q$cnum\E/\d+/bulletinboard$})) {
                     $discussion .=
 			&postingform_display($mode,$ressymb,$now,$subject,
 					     $comment,$outputtarget,$attachnum,
@@ -2296,7 +2297,7 @@
     my $group = $env{'form.group'};
     my $ressymb = &wrap_symb($symb);
     if (($group ne '') &&
-        ($ressymb =~ m|^bulletin___ \d+___adm/wrapper/adm/\Q$cdom\E/\Q$cnum\E/\d+/bulletinboard$|)) {
+        ($ressymb =~ m|^bulletin___\d+___adm/wrapper/adm/\Q$cdom\E/\Q$cnum\E/\d+/bulletinboard$|)) {
         if (&check_group_priv($group,'dgp') eq 'ok') {
             $seeid = 1;
         }
@@ -2678,6 +2679,8 @@
     }
     if (($env{'request.course.id'}) && (!$env{'form.sendmessageonly'})) {
         my ($blocked,$blocktext) = &Apache::loncommon::blocking_status('boards');
+        my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+        my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
         my $realsymb = $symb;
         if ($symb=~/^bulletin___/) {
             my $filename=(&Apache::lonnet::decode_symb($symb))[2];
@@ -2687,7 +2690,8 @@
         if (!$blocked && &discussion_open(undef,$realsymb) && 
 	    (&Apache::lonnet::allowed('pch',
 				      $env{'request.course.id'}.
-				      ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:'')) || (($group ne '') && (&check_group_priv($group,'pgd') eq 'ok')))) {
+				      ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:'')) || 
+            (($group ne '') && ($symb =~ m{^bulletin___\d+___adm/wrapper/adm/\Q$cdom\E/\Q$cnum\E/\d+/bulletinboard$}) && (&check_group_priv($group,'pgd') eq 'ok')))) {
 	    $discussoptions='<label><input type="radio" name="discuss" value="nonanon" checked="checked" /> '.
 		$contribdisc.
 	        '</label><br /><label><input type="radio" name="discuss" value="anon" /> '.
@@ -2834,10 +2838,16 @@
 	$filename=~s|^adm/wrapper/||;
 	$realsymb=&Apache::lonnet::symbread($filename);
     }
+    my ($cnum,$cdom);
+    if ($env{'request.course.id'}) {
+        $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+        $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+    }
     if (&discussion_open(undef,$realsymb) &&
 	(&Apache::lonnet::allowed('pch',$env{'request.course.id'}.
          ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:'')) || 
-         ($group ne '' && &check_group_priv($group,'pgd')))) {
+         (($group ne '') && (&check_group_priv($group,'pgd') eq 'ok') && 
+         ($symb =~ m{^bulletin___\d+___adm/wrapper/adm/\Q$cdom\E/\Q$cnum\E/\d+/bulletinboard$})))) {
 
     my %contrib=('message'      => $email,
                  'sendername'   => $env{'user.name'},