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

raeburn lon-capa-cvs@mail.lon-capa.org
Mon, 11 Dec 2006 04:10:37 -0000


raeburn		Sun Dec 10 23:10:37 2006 EDT

  Modified files:              
    /loncom/interface	lonfeedback.pm 
  Log:
  Use loncommon::blocking_status() to call block checking and generate information for display if discussion board access is blocked.
  
  
Index: loncom/interface/lonfeedback.pm
diff -u loncom/interface/lonfeedback.pm:1.234 loncom/interface/lonfeedback.pm:1.235
--- loncom/interface/lonfeedback.pm:1.234	Sat Dec  9 11:07:34 2006
+++ loncom/interface/lonfeedback.pm	Sun Dec 10 23:10:35 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Feedback
 #
-# $Id: lonfeedback.pm,v 1.234 2006/12/09 16:07:34 raeburn Exp $
+# $Id: lonfeedback.pm,v 1.235 2006/12/11 04:10:35 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -100,7 +100,8 @@
         }
     }
 
-    my ($blocked,$blocktext) = &blocking_posts('boards',1);
+    my ($blocked,$blocktext) = 
+        &Apache::loncommon::blocking_status('boards');
     if ($blocked) {
         &Apache::lonenc::check_encrypt(\$ressymb);
         if ($mode ne 'board') {
@@ -823,25 +824,6 @@
     return $discussion;
 }
 
-sub blocking_posts {
-    my ($type,$showstatus) = @_;
-    my %setters;
-    my ($blocked,$output);
-    my ($startblock,$endblock) =
-          &Apache::loncommon::blockcheck(\%setters,$type);
-    if ($startblock && $endblock) {
-        $blocked = 1;
-        if ($showstatus) {
-            my $showstart = &Apache::lonlocal::locallocaltime($startblock);
-            my $showend = &Apache::lonlocal::locallocaltime($endblock);
-            $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);
-        }
-    }
-    return ($blocked,$output);
-}
-
 sub postingform_display {
     my ($mode,$ressymb,$now,$subject,$comment,$outputtarget,$attachnum,
         $currnewattach,$currdelold,$group) = @_;
@@ -878,7 +860,7 @@
     if ($group ne '') {
         $postingform .='<input type="hidden" name="group" value="'.$group.'" />';
     }
-    my ($blockblog) = &blocking_posts('blogs');
+    my $blockblog = &Apache::loncommon::blocking_status('blogs');
     if (!$blockblog) {
         $postingform .= &add_blog_checkbox();
     }
@@ -1764,7 +1746,7 @@
         if (@currnewattach > 0) {
             $attachnum += @currnewattach;
         }
-        my ($blockblog) = &blocking_posts('blogs');
+        my $blockblog = &Apache::loncommon::blocking_status('blogs');
         $r->print(&generate_attachments_button($postidx,$attachnum,$ressymb,$now,\@currnewattach,\@currdelold,$numoldver,'',$blockblog));
         if ($attachnum > 0) {
             if (@currnewattach > 0) {
@@ -2608,7 +2590,7 @@
 		' <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');
+        my $blockblog = &Apache::loncommon::blocking_status('blogs');
         if (!$blockblog) {
             $discussoptions.= &add_blog_checkbox();
         }
@@ -3791,7 +3773,8 @@
 	  &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);
+              my ($blocked,$blocktext) = 
+                     &Apache::loncommon::blocking_status('boards');
               if ($blocked) {
                   $r->print(&blocked_reply_or_edit($blocktext));
                   return OK;