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

www lon-capa-cvs@mail.lon-capa.org
Wed, 15 Dec 2004 02:35:17 -0000


www		Tue Dec 14 21:35:17 2004 EDT

  Modified files:              
    /loncom/interface	lonmsg.pm 
  Log:
  Bug #3668: "Back to Folder" goes back to correct position in folder
  Bug #3709: additional safeguards against ISE on undefined first message number
  Bug #3710: should not forget #messages anymore
  
  
Index: loncom/interface/lonmsg.pm
diff -u loncom/interface/lonmsg.pm:1.124 loncom/interface/lonmsg.pm:1.125
--- loncom/interface/lonmsg.pm:1.124	Tue Dec 14 20:17:09 2004
+++ loncom/interface/lonmsg.pm	Tue Dec 14 21:35:17 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines for messaging
 #
-# $Id: lonmsg.pm,v 1.124 2004/12/15 01:17:09 www Exp $
+# $Id: lonmsg.pm,v 1.125 2004/12/15 02:35:17 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -527,9 +527,11 @@
                               'critical' => &mt('Critical'),
 			      'sent' => &mt('Sent Messages'),
 			      map { $_ => $_ } @allfolders)).
-			      ' '.&mt('Show').' '.
-	    &Apache::loncommon::select_form($interdis,'interdis',
-(' 10' => '10', ' 20' => '20', ' 50' => '50', '100' => '100', '200' => '200')).	
+			      ' '.&mt('Show').
+			      '<select name="interdis">'.
+			      join("\n",map { '<option value="'.$_.'"'.
+	 ($_==$interdis?' selected="selected"':'').'>'.$_.'</option>' }
+				   (10,20,50,100,200)).'</select>'.	
    '<input type="submit" value="'.&mt('View Folder').'" /><br />'.
     '<input type="hidden" name="sortedby" value="'.$ENV{'form.sortedby'}.'" />'.
 			      ($folder=~/^(new|critical)/?'</form>':'');
@@ -918,6 +920,9 @@
 	$r->print('<h2>'.&mt('Empty Folder').'</h2>');
 	return;
     }
+    unless ($interdis) {
+	$interdis=20;
+    }
     my $number=int($totalnumber/$interdis);
     if (($startdis<0) || ($startdis>$number)) { $startdis=$number; }
     my $firstdis=$interdis*$startdis;
@@ -1736,9 +1741,8 @@
 	      '"><b>'.&mt('Mark Unread').'</b></a></td>'.
 	      '<td><a href="/adm/email?markdel='.&Apache::lonnet::escape($msgid).$sqs.
 	      '"><b>Delete</b></a></td>'.
-	      '<td><a href="/adm/email?sortedby='.$ENV{'form.sortedby'}.
-	      '&folder='.&Apache::lonnet::escape($folder).
-	      '"><b>'.&mt('Display all Messages').'</b></a></td>');
+	      '<td><a href="/adm/email?'.$sqs.
+	      '"><b>'.&mt('Back to Folder Display').'</b></a></td>');
     if ($counter > 0){
 	$r->print('<td><a href="/adm/email?display='.$messages[$counter-1]->[5].$sqs.
 		  '"><b>'.&mt('Previous').'</b></a></td>');
@@ -1986,9 +1990,7 @@
          'sendreply','compose','sendmail','critical','recname','recdom',
          'recordftf','sortedby','block','folder','startdis','interdis',
 	 'showcommentbaseurl']);
-    $sqs='&sortedby='.$ENV{'form.sortedby'}.
-	 '&startdis='.$ENV{'form.startdis'}.
-	 '&interdis='.$ENV{'form.interdis'};
+    $sqs='&sortedby='.$ENV{'form.sortedby'};
 
 # ------------------------------------------------------ They checked for email
     unless ($ENV{'form.block'}) {
@@ -2009,7 +2011,7 @@
     unless ($folder) { 
 	$folder=''; 
     } else {
-	$sqs='&folder='.&Apache::lonnet::escape($folder);
+	$sqs.='&folder='.&Apache::lonnet::escape($folder);
     }
 
 # --------------------------------------------------------------------- Display
@@ -2017,8 +2019,11 @@
     $startdis=$ENV{'form.startdis'};
     $startdis--;
     unless ($startdis) { $startdis=0; }
+
     $interdis=$ENV{'form.interdis'};
     unless ($interdis) { $interdis=20; }
+    $sqs.='&interdis='.$interdis;
+
     if ($ENV{'form.firstview'}) {
 	$startdis=0;
     }
@@ -2031,7 +2036,8 @@
     if ($ENV{'form.nextview'}) {
 	$startdis++;
     }
-
+    my $postedstartdis=$startdis+1;
+    $sqs.='&startdis='.$postedstartdis;
 
 # --------------------------------------------------------------- Render Output