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

raeburn lon-capa-cvs@mail.lon-capa.org
Mon, 22 Jan 2007 21:51:07 -0000


raeburn		Mon Jan 22 16:51:07 2007 EDT

  Modified files:              
    /loncom/interface	lonmsgdisplay.pm 
  Log:
  If there are blocked messages display information about them when there are no other messages in the folder which pass the display filter.
  
  When a folder is deleted, set the $env value for the "folder" form element to '', otherwise "Empty Folder" will be reported for the INBOX, even if that is not true.
  
  
Index: loncom/interface/lonmsgdisplay.pm
diff -u loncom/interface/lonmsgdisplay.pm:1.64 loncom/interface/lonmsgdisplay.pm:1.65
--- loncom/interface/lonmsgdisplay.pm:1.64	Wed Jan 17 13:05:57 2007
+++ loncom/interface/lonmsgdisplay.pm	Mon Jan 22 16:51:05 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines for messaging display
 #
-# $Id: lonmsgdisplay.pm,v 1.64 2007/01/17 18:05:57 raeburn Exp $
+# $Id: lonmsgdisplay.pm,v 1.65 2007/01/22 21:51:05 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -980,6 +980,10 @@
         } else { 
             $r->print('<h2>'.&mt('There are no '.lc($statushash{$msgstatus}).' messages in this folder.').'</h2>');
         }
+        if ($numblocked > 0) {
+            $r->print(&blocked_in_folder($numblocked,$startblock,$endblock,
+                                         \%setters));
+        }
 	return;
     }
     my $interdis = $env{'form.interdis'};
@@ -1136,15 +1140,22 @@
     my $postedstartdis=$startdis+1;
     $r->print('<input type="hidden" name="folder" value="'.$folder.'" /><input type="hidden" name="startdis" value="'.$postedstartdis.'" /><input type="hidden" name="interdis" value="'.$env{'form.interdis'}.'" /><input type="hidden" name="msgstatus" value="'.$msgstatus.'" ><input type="hidden" name="markedaction" value="" /></form>');
     if ($numblocked > 0) {
-        my $beginblock = &Apache::lonlocal::locallocaltime($startblock);
-        my $finishblock = &Apache::lonlocal::locallocaltime($endblock);
-        $r->print('<br /><br />'.
-                  &mt('[quant,_1,message is, messages are] not viewable because display of LON-CAPA messages sent to you by other students between [_2] and [_3] is currently being blocked because of online exams.',$numblocked,$beginblock,$finishblock));
-        $r->print(&Apache::loncommon::build_block_table($startblock,$endblock,
-                                                        \%setters));
+        $r->print(&blocked_in_folder($numblocked,$startblock,$endblock,
+                                     \%setters));
     }
 }
 
+sub blocked_in_folder {
+    my ($numblocked,$startblock,$endblock,$setters) = @_;
+    my $beginblock = &Apache::lonlocal::locallocaltime($startblock);
+    my $finishblock = &Apache::lonlocal::locallocaltime($endblock);
+    my $output = '<br /><br />'.
+                  &mt('[quant,_1,message is, messages are] not viewable because display of LON-CAPA messages sent to you by other students between [_2] and [_3] is currently being blocked because of online exams.',$numblocked,$beginblock,$finishblock);
+    $output .= &Apache::loncommon::build_block_table($startblock,$endblock,
+                                                     $setters);
+    return $output;
+}
+
 # ============================================================== Compose output
 
 sub compout {
@@ -2716,6 +2727,7 @@
         my $delresult = &deletefolder($folder);
         if ($delresult eq 'ok') {
             $r->print(&mt('Mail folder "[_1]" deleted.',$folder).'<br />');
+            $env{'form.folder'} = '';
         } else {
             $r->print(&mt('Deletion failed.').' '.$delresult.'<br />');
             $showfolder = $folder;