wisest owl (wisest_owl) wrote in changelog,
wisest owl
wisest_owl
changelog

[livejournal] r17824: LJSUP-7482. don't working worker bin/wor...

Committer: gprochaev
LJSUP-7482. don't working worker bin/worker/category-recent-posts

U   trunk/cgi-bin/LJ/Widget/Browse.pm
U   trunk/cgi-bin/ljlib.pl
U   trunk/htdocs/admin/browse/recent_posts.bml
Modified: trunk/cgi-bin/LJ/Widget/Browse.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/Browse.pm	2010-11-30 04:58:08 UTC (rev 17823)
+++ trunk/cgi-bin/LJ/Widget/Browse.pm	2010-11-30 07:15:57 UTC (rev 17824)
@@ -248,7 +248,7 @@
 
             my @images = ();
             my $fb_photo_big = '';
-            @images = $entry->event_raw =~ m#img\s+src="(.*?)"#gi;
+            @images = $entry->event_raw =~ m#img.*?src="(.*?)"#gi;
 
             if (scalar @images) {
                 my $r = LJ::crop_picture_from_web(

Modified: trunk/cgi-bin/ljlib.pl
===================================================================
--- trunk/cgi-bin/ljlib.pl	2010-11-30 04:58:08 UTC (rev 17823)
+++ trunk/cgi-bin/ljlib.pl	2010-11-30 07:15:57 UTC (rev 17824)
@@ -1179,7 +1179,7 @@
     my $after_sql = '';
     my $afterid = $opts->{'afterid'} + 0;
     if ($afterid) {
-        $after_sql = "AND jitemid >= $afterid";
+        $after_sql = "AND jitemid > $afterid";
     }
 
     my $posterwhere;
@@ -1195,11 +1195,11 @@
                DATE_FORMAT(logtime, "$dateformat") AS 'system_alldatepart',
                allowmask, eventtime, logtime
         FROM log2 USE INDEX ($sort_key)
-        WHERE journalid=$userid $sql_select $secwhere $jitemidwhere $securitywhere $posterwhere $suspend_where
+        WHERE journalid=$userid $sql_select $secwhere $jitemidwhere $securitywhere $posterwhere $after_sql $suspend_where
         ORDER BY journalid, $sort_key
         $sql_limit
     };
-    
+
     unless ($logdb) {
         $$err = "nodb" if ref $err eq "SCALAR";
         return ();

Modified: trunk/htdocs/admin/browse/recent_posts.bml
===================================================================
--- trunk/htdocs/admin/browse/recent_posts.bml	2010-11-30 04:58:08 UTC (rev 17823)
+++ trunk/htdocs/admin/browse/recent_posts.bml	2010-11-30 07:15:57 UTC (rev 17824)
@@ -27,7 +27,7 @@
     # Don't include the top level categories and get the unique URI for each
 
     my @vert_ids = map { { value => $_->vert_id, text => $_->name } } @verticals;
-    @vert_ids = sort { $a cmp $b } @vert_ids;
+    @vert_ids = sort { $a->{'text'} cmp $b->{'text'} } @vert_ids;
 
     $ret .= "<p>Select vertical: ";
     $ret .= LJ::html_select({
@@ -48,7 +48,7 @@
 
     my $page_size = 10;
 
-    my $page = 1;
+    my $page = $GET{'page'} || 1;
 
     if ($vert_id) {
         my $vertical = LJ::Vertical->load_by_id($vert_id);
@@ -62,6 +62,10 @@
                 if $c->{communities};
         };
 
+        my $posts_cnt = LJ::Browse->count_posts ( comms => \@communities, vertical => $vertical);
+
+        my $pages = $posts_cnt / $page_size;
+        $pages += 1 if $posts_cnt % $page_size;
         my $skip = ($page-1) * $page_size;
         my $last = $skip + $page_size;
 
@@ -82,7 +86,12 @@
             $ret .= "</form></li>";
         }
         $ret .= "</ul>";
+        $ret .= "<a href='?vert_id=".$vertical->vert_id."&page=".($page-1)."'>Back</a>&nbsp;"
+            if $page > 1;
+        $ret .= "<a href='?vert_id=".$vertical->vert_id."&page=".($page+1)."'>Next</a><br/>"
+            if $page < $pages - 1;
     }
+
     $ret .= "<p><a href='/admin/browse/'>Back to main page</a></p>";
 
 

Tags: bml, livejournal, pl, pm, wisest-owl
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments