Don't show "Previous 50" if we have no next page

        Patch by kareila. 

diffs (70 lines):

diff -r a0378546aba2 -r 1884eac7aca8 htdocs/mobile/read.bml
--- a/htdocs/mobile/read.bml    Sat May 09 08:31:27 2009 +0000
+++ b/htdocs/mobile/read.bml    Sat May 09 09:00:17 2009 +0000
@@ -17,16 +17,12 @@
 
     my $skip = $GET{skip}+0 || 0;
 
-    my $prevcount = $skip + $itemsperpage;
-    my $nextcount = $skip ? $skip - $itemsperpage : -1;
-    my $nextlink  = $skip ? BML::ml( '.items.next', { aopts => 
"href='?skip=$nextcount'", items => $itemsperpage } ) : '';
-    my $prevlink  = BML::ml( '.items.previous', { aopts => 
"href='?skip=$prevcount'", items => $itemsperpage } );
-
     # Filter first to a "Mobile View" friends group if they have one,
     # then fall back to "Default View", and then just show them everything
 #    my $filter;
     my $groupname = "All friends";
 
+# FIXME: WTF reading groups
 #    foreach ("Mobile View", "Default View") {
 #        if (my $grp = LJ::get_friend_group($u, { 'name' => $_ })) {
 #            $groupname = $_;
@@ -34,12 +30,6 @@
 #            last;
 #        }
 #    }
-
-    $ret .= BML::ml( '.read.back', { aopts => "href='./'", sitename => 
$LJ::SITENAMESHORT } );
-    $ret .= qq(<div style="font-size: 16pt; font-weight: bold; margin: 
0.8em;">);
-    $ret .= qq($ML{'.page.title'}</div><div style="margin: 1em;"><div 
style="font-weight: bold;">);
-    $ret .= BML::ml( '.read.groupname', { groupname => $groupname } );
-    $ret .= qq(</div><div>$prevlink$nextlink</div><br/></div>);
 
     my @entries = $u->watch_items(
         'remote'            => $u->{'userid'},
@@ -50,6 +40,18 @@
         'userid'            => $u->{'userid'},
 #        'filter'            => $filter,
     );
+
+    my $numentries = @entries;
+    my $prevcount = $skip + $itemsperpage;
+    my $nextcount = $skip ? $skip - $itemsperpage : -1;
+    my $nextlink  = $skip ? BML::ml( '.items.next', { aopts => 
"href='?skip=$nextcount'", items => $itemsperpage } ) : '';
+    my $prevlink  = ( $numentries < $itemsperpage ) ? '' : BML::ml( 
'.items.previous', { aopts => "href='?skip=$prevcount'", items => $itemsperpage 
} );
+
+    $ret .= BML::ml( '.read.back', { aopts => "href='./'", sitename => 
$LJ::SITENAMESHORT } );
+    $ret .= qq(<div style="font-size: 16pt; font-weight: bold; margin: 
0.8em;">);
+    $ret .= qq($ML{'.page.title'}</div><div style="margin: 1em;"><div 
style="font-weight: bold;">);
+    $ret .= BML::ml( '.read.groupname', { groupname => $groupname } );
+    $ret .= qq(</div><div>$prevlink$nextlink</div><br/></div>);
 
     # how many characters to truncate entry at
     my $max_entry_length = 400;
@@ -79,6 +81,8 @@
 
         $ret .= "$who: " . "<a href='$url'>" . ($entry->subject_text || "(no 
subject)") . "</a><br />";
     }
+    
+    $ret .= BML::ml( '.read.noentries', { groupname => $groupname } ) unless 
$numentries;
 
     return $ret;
 }
diff -r a0378546aba2 -r 1884eac7aca8 htdocs/mobile/read.bml.text
--- a/htdocs/mobile/read.bml.text       Sat May 09 08:31:27 2009 +0000
+++ b/htdocs/mobile/read.bml.text       Sat May 09 09:00:17 2009 +0000
@@ -12,3 +12,4 @@
 
 .read.login=You must <a [[aopts]]>log in</a> to access your reading page.
 
+.read.noentries=<i>No further entries to display in group: [[groupname]]</i>
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog

Reply via email to