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

bisitz bisitz@source.lon-capa.org
Wed, 13 Jan 2010 16:39:19 -0000


bisitz		Wed Jan 13 16:39:19 2010 EDT

  Modified files:              
    /loncom/interface	lonmsgdisplay.pm 
  Log:
  Optimized "Scrollbuttons" on "Send and display messages" page:
  - Optimized &mt() usages: Separate style and content
    (Localization still not optimal; work in progress)
  - Optimized display: Don't offer (in this case useless) buttons if only one page is shown
  
  
Index: loncom/interface/lonmsgdisplay.pm
diff -u loncom/interface/lonmsgdisplay.pm:1.139 loncom/interface/lonmsgdisplay.pm:1.140
--- loncom/interface/lonmsgdisplay.pm:1.139	Thu Nov 26 05:21:43 2009
+++ loncom/interface/lonmsgdisplay.pm	Wed Jan 13 16:39:19 2010
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines for messaging display
 #
-# $Id: lonmsgdisplay.pm,v 1.139 2009/11/26 05:21:43 faziophi Exp $
+# $Id: lonmsgdisplay.pm,v 1.140 2010/01/13 16:39:19 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -295,14 +295,26 @@
     } else {
         $status = $statushash{$msgstatus};
     }
-    return
-   '<b>'.&mt('Page').'</b>: '. 
-   '<input type="submit" name="firstview" value="|&lt;" />'.
-   '<input type="submit" name="prevview" value="&lt;" />'.
-   ' <input type="text" size="5" name="startdis" value="'.$start.'" onchange="this.form.submit()" /> / '.$maxdis.' '.
-   '<input type="submit" name="nextview" value="&gt;" />'.
-   '<input type="submit" name="lastview" value="&gt;|" /><br />'.
-   &mt('<b>[_1] messages</b>: showing messages [_2] through [_3] of [_4].',$status,$first,$finish,$total).'</form>';
+    my $output = '<b>'.&mt('Page:').'</b> ';
+    if ($maxdis == 1) {
+        # No buttons if only one page is displayed
+        $output .= '1/1';
+    } else {
+        $output .=
+           '<input type="submit" name="firstview" value="|&lt;" />'.
+           '<input type="submit" name="prevview" value="&lt;" />'.
+           ' <input type="text" size="5" name="startdis" value="'.$start.'" onchange="this.form.submit()" /> / '.$maxdis.' '.
+           '<input type="submit" name="nextview" value="&gt;" />'.
+           '<input type="submit" name="lastview" value="&gt;|" />';
+    }
+    $output .=
+        '<br />'
+       .'<b>'.&mt($status.' messages:').'</b> '
+       .&mt('showing messages [_1] through [_2] of [_3].',
+            $first,$finish,$total)
+       .'</form>';
+
+    return $output;
 }
 # =============================================================== Status Change