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

albertel lon-capa-cvs@mail.lon-capa.org
Sat, 23 Dec 2006 07:21:01 -0000


albertel		Sat Dec 23 02:21:01 2006 EDT

  Modified files:              
    /loncom/interface	lonmsgdisplay.pm 
  Log:
  - save and rember settings between visists
     - sorting (bug#2437)
     - msgstatus
     - folder 
     - number to show (bug#4093)
  
  
  
Index: loncom/interface/lonmsgdisplay.pm
diff -u loncom/interface/lonmsgdisplay.pm:1.56 loncom/interface/lonmsgdisplay.pm:1.57
--- loncom/interface/lonmsgdisplay.pm:1.56	Sat Dec 23 01:19:10 2006
+++ loncom/interface/lonmsgdisplay.pm	Sat Dec 23 02:21:00 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines for messaging display
 #
-# $Id: lonmsgdisplay.pm,v 1.56 2006/12/23 06:19:10 albertel Exp $
+# $Id: lonmsgdisplay.pm,v 1.57 2006/12/23 07:21:00 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -132,7 +132,6 @@
 # Querystring component with sorting type
 my $sqs;
 my $startdis;
-my $interdis;
 
 # ============================================================ List all folders
 
@@ -230,6 +229,10 @@
     }
 }
 </script>|;
+    my %show = ('select_form_order' => [10,20,50,100,200],
+		map {$_=>$_} (10,20,50,100,200));
+		
+		   
     $output .= '
 <form method="post" action="/adm/email" name="folderlist">
 <table border="0" cellspacing="2" cellpadding="2">
@@ -240,12 +243,9 @@
      <td align="center"><b>'.$lt{'fold'}.'</b><br />'."\n".
          &Apache::loncommon::select_form($folder,'folder',%formhash).'
      </td>
-     <td align="center"><b>'.$lt{'show'}.'</b><br />
-      <select name="interdis">'.
-          join("\n",map { '<option value="'.$_.'"'.
-			      ($_==$interdis?' selected="selected"':'').'>'.$_.'</option>' 
-			}
-	       (10,20,50,100,200)).'</select>
+     <td align="center"><b>'.$lt{'show'}.'</b><br />'."\n".
+         &Apache::loncommon::select_form($env{'form.interdis'},'interdis',
+					 %show).'
      </td>
      <td align="center"><b>'.$lt{'status'}.'</b><br />'."\n".
        &Apache::loncommon::select_form($msgstatus,'msgstatus',%statushash).'
@@ -892,6 +892,17 @@
 
 sub disall {
     my ($r,$folder,$msgstatus)=@_;
+    my %saveable = ('folder'    => 'scalar',
+		    'msgstatus' => 'scalar',
+		    'sortedby'  => 'scalar',
+		    'interdis'  => 'scalar',
+		    );
+    &Apache::loncommon::store_settings('user','mail',\%saveable);
+    &Apache::loncommon::restore_settings('user','mail',\%saveable);
+    $folder    ||= $env{'form.folder'};
+    $msgstatus ||= $env{'form.msgstatus'};
+    $env{'form.interdis'} ||= 20;
+
     $r->print(&folderlist($folder,$msgstatus));
     if ($folder eq 'critical') {
 	&discrit($r);
@@ -974,14 +985,10 @@
         }
 	return;
     }
-    unless ($interdis) {
-	$interdis=20;
-    }
+    my $interdis = $env{'form.interdis'};
     my $number=int($totalnumber/$interdis);
-    if ($interdis) {
-        if ($totalnumber%$interdis == 0) {
-            $number--; 
-        }
+    if ($totalnumber%$interdis == 0) {
+	$number--; 
     }
 
     if (($startdis<0) || ($startdis>$number)) { $startdis=$number; }
@@ -2399,10 +2406,6 @@
     }
     unless ($startdis) { $startdis=0; }
 
-    $interdis=$env{'form.interdis'};
-    unless ($interdis) { $interdis=20; }
-    $sqs.='&interdis='.$interdis;
-
     if ($env{'form.firstview'}) {
 	$startdis=0;
     }