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

www lon-capa-cvs@mail.lon-capa.org
Mon, 15 Nov 2004 21:28:58 -0000


www		Mon Nov 15 16:28:58 2004 EDT

  Modified files:              
    /loncom/interface	lonmsg.pm 
  Log:
  Make menu nicer for people than for Perl.
  
  
Index: loncom/interface/lonmsg.pm
diff -u loncom/interface/lonmsg.pm:1.117 loncom/interface/lonmsg.pm:1.118
--- loncom/interface/lonmsg.pm:1.117	Sat Nov 13 09:45:57 2004
+++ loncom/interface/lonmsg.pm	Mon Nov 15 16:28:58 2004
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines for messaging
 #
-# $Id: lonmsg.pm,v 1.117 2004/11/13 14:45:57 www Exp $
+# $Id: lonmsg.pm,v 1.118 2004/11/15 21:28:58 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -531,13 +531,18 @@
 	    &Apache::loncommon::select_form($interdis,'interdis',
 (' 10' => '10', ' 20' => '20', ' 50' => '50', '100' => '100', '200' => '200')).	
    '<input type="submit" value="'.&mt('View Folder').'" /><br />'.
-			      ($folder!~/^(new|critical)/?
+			      ($folder=~/^(new|critical)/?'</form>':'');
+}
+
+sub scrollbuttons {
+    my ($start,$maxdis,$first,$finish,$total)=@_;
+    $start++; $maxdis++;$first++;$finish++;
    '<input type="submit" name="firstview" value="'.&mt('First').'" />'.
    '<input type="submit" name="prevview" value="'.&mt('Previous').'" />'.
-   '<input type="text" size="5" name="startdis" value="'.$startdis.'" onChange="this.form.submit()" />'.
+   '<input type="text" size="5" name="startdis" value="'.$start.'" onChange="this.form.submit()" /> of '.$maxdis.
    '<input type="submit" name="nextview" value="'.&mt('Next').'" />'.
-   '<input type="submit" name="lastview" value="'.&mt('Last').'" />':'').
-	    '</form>';
+   '<input type="submit" name="lastview" value="'.&mt('Last').'" /><br />'.
+   &mt('Messages [_1] through [_2] of [_3]',$first,$finish,$total).'</form>';
 }
 
 # =============================================================== Folder suffix
@@ -907,11 +912,13 @@
     my $fsqs='&folder='.$folder;
     my @temp=sortedmessages(\%blocked,$startblock,$endblock,\$numblocked,$folder);
     my $totalnumber=$#temp+1;
-    my $number=int($totalnumber/$interdis)+1;
+    my $number=int($totalnumber/$interdis);
+    if (($startdis<0) || ($startdis>$number)) { $startdis=$number; }
     my $firstdis=$interdis*$startdis;
     if ($firstdis>$#temp) { $firstdis=$#temp-$interdis+1; }
     my $lastdis=$firstdis+$interdis-1;
     if ($lastdis>$#temp) { $lastdis=$#temp; }
+    $r->print(&scrollbuttons($startdis,$number,$firstdis,$lastdis,$totalnumber));
     $r->print('<form method="post" name="disall" action="/adm/email">'.
 	      '<table border=2><tr><th colspan="3">&nbsp</th><th>');
     if ($ENV{'form.sortedby'} eq "revdate") {
@@ -977,7 +984,7 @@
 	$r->print(
 	      '<p><input type="submit" name="markeddel" value="'.&mt('Delete Checked').'" /></p>');
     }
-$r->print('<p><input type="submit" name="markedmove" value="'.&mt('Move Checked to Folder').'" />');
+    $r->print('<p><input type="submit" name="markedmove" value="'.&mt('Move Checked to Folder').'" />');
     my @allfolders=&Apache::lonnet::getkeys('email_folders');
     if ($allfolders[0]=~/^error:/) { @allfolders=(); }
     $r->print(
@@ -1956,6 +1963,7 @@
 # --------------------------------------------------------------------- Display
 
     $startdis=$ENV{'form.startdis'};
+    $startdis--;
     unless ($startdis) { $startdis=0; }
     $interdis=$ENV{'form.interdis'};
     unless ($interdis) { $interdis=20; }