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

raeburn lon-capa-cvs@mail.lon-capa.org
Sat, 09 Dec 2006 16:07:35 -0000


raeburn		Sat Dec  9 11:07:35 2006 EDT

  Modified files:              
    /loncom/interface	lonfeedback.pm 
  Log:
  Restore blocking for bulletin boards.
  
  Provide a message about blocking if a user attempts to edit or reply to a post when he/she is subject to a blocking event.
  
  
Index: loncom/interface/lonfeedback.pm
diff -u loncom/interface/lonfeedback.pm:1.233 loncom/interface/lonfeedback.pm:1.234
--- loncom/interface/lonfeedback.pm:1.233	Fri Dec  8 17:35:56 2006
+++ loncom/interface/lonfeedback.pm	Sat Dec  9 11:07:34 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Feedback
 #
-# $Id: lonfeedback.pm,v 1.233 2006/12/08 22:35:56 raeburn Exp $
+# $Id: lonfeedback.pm,v 1.234 2006/12/09 16:07:34 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -102,10 +102,11 @@
 
     my ($blocked,$blocktext) = &blocking_posts('boards',1);
     if ($blocked) {
+        &Apache::lonenc::check_encrypt(\$ressymb);
         if ($mode ne 'board') {
-            &Apache::lonenc::check_encrypt(\$ressymb);
-            return $blocktext.'<br />'.&send_message_link($ressymb);
+            $blocktext.='<br />'.&send_message_link($ressymb);
         }
+        return $blocktext; 
     }
 
     my @bgcols = ("#cccccc","#eeeeee");
@@ -833,7 +834,7 @@
         if ($showstatus) {
             my $showstart = &Apache::lonlocal::locallocaltime($startblock);
             my $showend = &Apache::lonlocal::locallocaltime($endblock);
-            $output = &mt('Discussion postings will not be viewable for resources in this course between [_1] and [_2] because communication is being blocked.',$showstart, $showend).'<br />'.
+            $output = '<br />'.&mt('Discussion postings will not be viewable for resources in this course between [_1] and [_2] because communication is being blocked.',$showstart, $showend).'<br />'.
                     &Apache::loncommon::build_block_table($startblock,$endblock,
                                                          \%setters);
         }
@@ -2600,15 +2601,12 @@
 	    &Apache::lonnet::allowed('pch',
 				     $env{'request.course.id'}.
 				     ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))) {
-            my ($blocked) = &blocking_posts('boards');
-            if (!$blocked) {
-	        $discussoptions='<label><input type="radio" name="discuss" value="nonanon" checked="checked" /> '.
-		    &mt('Contribution to course discussion of resource');
+	    $discussoptions='<label><input type="radio" name="discuss" value="nonanon" checked="checked" /> '.
+		&mt('Contribution to course discussion of resource');
 	        $discussoptions.='</label><br /><label><input type="radio" name="discuss" value="anon" /> '.
-		    &mt('Anonymous contribution to course discussion of resource').
-		    ' <i>('.&mt('name only visible to course faculty').')</i></label> '.
-		    '<a href="/adm/preferences?action=changescreenname">'.&mt('Change Screenname').'</a>';
-            }
+		&mt('Anonymous contribution to course discussion of resource').
+		' <i>('.&mt('name only visible to course faculty').')</i></label> '.
+		'<a href="/adm/preferences?action=changescreenname">'.&mt('Change Screenname').'</a>';
         }
         my ($blockblog) = &blocking_posts('blogs');
         if (!$blockblog) {
@@ -3792,6 +3790,13 @@
           &Apache::lonenc::check_encrypt(\$feedurl);
 	  &Apache::loncommon::content_type($r,'text/html');
 	  $r->send_http_header;
+          if (($env{'form.replydisc'}) || ($env{'form.editdisc'})) {
+              my ($blocked,$blocktext) = &blocking_posts('boards',1);
+              if ($blocked) {
+                  $r->print(&blocked_reply_or_edit($blocktext));
+                  return OK;
+              }
+          }
 	  my $options=&screen_header($feedurl,$symb);
 	  if ($options) {
 	      &mail_screen($r,$feedurl,$options);
@@ -3883,6 +3888,15 @@
       &redirect_back($r,$feedurl,$typestyle,$numsent,$numpost,$blog,$status,$env{'form.previous'},undef,undef,undef,undef,undef,undef,$group);
   }
   return OK;
+}
+
+sub blocked_reply_or_edit {
+    my ($blocktext) = @_;
+    return 
+      &Apache::loncommon::start_page('Resource Feedback and Discussion').
+      $blocktext.'<br /><br /><a href="javascript:history.go(-1)">'.
+      &mt('Back to previous page').
+      &Apache::loncommon::end_page();
 } 
 
 sub wrap_symb {