svnno****@sourc*****
svnno****@sourc*****
2008年 6月 26日 (木) 18:28:45 JST
Revision: 675 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=slashdotjp&view=rev&rev=675 Author: tach Date: 2008-06-26 18:28:45 +0900 (Thu, 26 Jun 2008) Log Message: ----------- * enable to show divided top journal pages - top_recent - top_posters - top_friends * add "start" parameter for $journal->top() and $journal->topRecent() - due to enable pagination for top journals Modified Paths: -------------- slashjp/branches/2.5.0.192/plugins/Journal/Journal.pm slashjp/branches/2.5.0.192/plugins/Journal/journal.pl -------------- next part -------------- Modified: slashjp/branches/2.5.0.192/plugins/Journal/Journal.pm =================================================================== --- slashjp/branches/2.5.0.192/plugins/Journal/Journal.pm 2008-06-26 09:08:37 UTC (rev 674) +++ slashjp/branches/2.5.0.192/plugins/Journal/Journal.pm 2008-06-26 09:28:45 UTC (rev 675) @@ -295,15 +295,16 @@ } sub top { - my($self, $limit) = @_; + my($self, $limit, $start) = @_; $limit ||= getCurrentStatic('journal_top') || 10; + $start ||= 0; $self->sqlConnect; my $sql = <<EOT; SELECT count AS c,nickname,users_journal.uid,date,jid AS id FROM users_journal JOIN users USING (uid) ORDER BY count DESC -LIMIT $limit +LIMIT $start, $limit EOT my $losers = $self->{_dbh}->selectall_arrayref($sql); @@ -323,8 +324,9 @@ } sub topRecent { - my($self, $limit) = @_; + my($self, $limit, $start) = @_; $limit ||= getCurrentStatic('journal_top') || 10; + $start ||= 0; $self->sqlConnect; my $sql = <<EOT; @@ -333,7 +335,7 @@ JOIN journals ON jid=journals.id JOIN journals_text ON jid=journals_text.id ORDER BY date DESC -LIMIT $limit +LIMIT $start, $limit EOT my $losers = $self->{_dbh}->selectall_arrayref($sql); Modified: slashjp/branches/2.5.0.192/plugins/Journal/journal.pl =================================================================== --- slashjp/branches/2.5.0.192/plugins/Journal/journal.pl 2008-06-26 09:08:37 UTC (rev 674) +++ slashjp/branches/2.5.0.192/plugins/Journal/journal.pl 2008-06-26 09:28:45 UTC (rev 675) @@ -68,6 +68,9 @@ list => [ 1, \&listArticle ], display => [ 1, \&displayArticle ], top => [ $top_ok, \&displayTop ], + top_posters => [ $top_ok, \&displayTop ], + top_friend => [ $top_ok, \&displayTop ], + top_recent => [ $top_ok, \&displayTop ], searchusers => [ 1, \&searchUsers ], friends => [ 1, \&displayFriends ], friendview => [ 1, \&displayArticleFriends ], @@ -117,20 +120,23 @@ my $journals; _printHead('mainhead') or return; + my $start = $form->{start} || 0; # this should probably be in a separate template, so the site admins # can select the order themselves -- pudge - if ($constants->{journal_top_recent}) { - $journals = $journal_reader->topRecent; + if ($constants->{journal_top_recent} && $form->{op} =~ /^top(_recent)?$/) { + $journals = $user->{mobile} ? $journal_reader->topRecent($constants->{mobile_top_journal_count} || 10, $start) + : $journal_reader->topRecent; slashDisplay('journaltop', { journals => $journals, type => 'recent' }); } - if ($constants->{journal_top_posters}) { - $journals = $journal_reader->top; + if ($constants->{journal_top_posters} && $form->{op} =~ /^top(_posters)?$/) { + $journals = $user->{mobile} ? $journal_reader->top($constants->{mobile_top_journal_count} || 10, $start) + : $journal_reader->top; slashDisplay('journaltop', { journals => $journals, type => 'top' }); } - if ($constants->{journal_top_friend}) { + if ($constants->{journal_top_friend} && $form->{op} =~ /^top(_friend)?$/) { my $zoo = getObject('Slash::Zoo'); $journals = $zoo->topFriends; slashDisplay('journaltop', { journals => $journals, type => 'friend' }); @@ -526,6 +532,7 @@ push @sorted_articles, $collection; my $theme = _checkTheme($form->{theme} || $journal_reader->getUser($uid, 'journal_theme')); + $theme = 'mobile' if ($user->{mobile}); my $show_discussion = $form->{id} && !$constants->{journal_no_comments_item} && $discussion; my $zoo = getObject('Slash::Zoo');