svnno****@sourc*****
svnno****@sourc*****
2008年 10月 3日 (金) 21:46:49 JST
Revision: 782 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=slashdotjp&view=rev&rev=782 Author: tach Date: 2008-10-03 21:46:49 +0900 (Fri, 03 Oct 2008) Log Message: ----------- Add pagination to journal list page Modified Paths: -------------- slashjp/branches/2.5.0.192/debian/changelog slashjp/branches/2.5.0.192/plugins/Journal/Journal.pm slashjp/branches/2.5.0.192/plugins/Journal/journal.pl slashjp/branches/2.5.0.192/sql/mysql/defaults.sql -------------- next part -------------- Modified: slashjp/branches/2.5.0.192/debian/changelog =================================================================== --- slashjp/branches/2.5.0.192/debian/changelog 2008-10-03 12:45:44 UTC (rev 781) +++ slashjp/branches/2.5.0.192/debian/changelog 2008-10-03 12:46:49 UTC (rev 782) @@ -2,8 +2,9 @@ * Back to default only 'slashboxes' when 'restore_default_slashbox' * Fix journal preview to use new theme system + * Add pagination to journal list page - -- Taku YASUI <tach****@osdn*****> Wed, 1 Oct 2008 07:25:38 +0000 + -- Taku YASUI <tach****@osdn*****> Fri, 3 Oct 2008 12:46:08 +0000 slash (2.5.0.192-19) unstable; urgency=low Modified: slashjp/branches/2.5.0.192/plugins/Journal/Journal.pm =================================================================== --- slashjp/branches/2.5.0.192/plugins/Journal/Journal.pm 2008-10-03 12:45:44 UTC (rev 781) +++ slashjp/branches/2.5.0.192/plugins/Journal/Journal.pm 2008-10-03 12:46:49 UTC (rev 782) @@ -157,11 +157,13 @@ } sub list { - my($self, $uid, $limit) = @_; + my($self, $uid, $limit, $start) = @_; $uid ||= 0; # no SQL syntax error + $start ||= 0; my $order = "ORDER BY date DESC"; - $order .= " LIMIT $limit" if $limit; - my $answer = $self->sqlSelectAll('id, date, description', 'journals', "uid = $uid", $order); + $order .= " LIMIT $start, $limit" if $limit; + my $answer = $self->sqlSelectAll('SQL_CALC_FOUND_ROWS id, date, description', 'journals', "uid = $uid", $order); + $self->sqlDo('SET @totalhits = FOUND_ROWS();'); return $answer; } Modified: slashjp/branches/2.5.0.192/plugins/Journal/journal.pl =================================================================== --- slashjp/branches/2.5.0.192/plugins/Journal/journal.pl 2008-10-03 12:45:44 UTC (rev 781) +++ slashjp/branches/2.5.0.192/plugins/Journal/journal.pl 2008-10-03 12:46:49 UTC (rev 782) @@ -931,13 +931,16 @@ sub listArticle { my($journal, $constants, $user, $form, $journal_reader) = @_; + my $limit = $constants->{journal_list_default_display} || $constants->{journal_default_display} || 10; + my $start = $form->{start} || 0; my $uid = $form->{uid} || $user->{uid}; if (isAnon($uid)) { return displayFriends(@_); } - my $list = $journal_reader->list($uid); + my $list = $journal_reader->list($uid, $limit, $start); + my $totalhits = $journal_reader->sqlSelect('@totalhits'); my $themes = $journal_reader->themes; my $theme = _checkTheme($user->{'journal_theme'}); my $nickname = $form->{uid} @@ -955,6 +958,9 @@ articles => $list, uid => $form->{uid} || $user->{uid}, nickname => $nickname, + start => $start, + limit => $limit, + totalhits => $totalhits, }); } elsif (!$user->{is_anon} && (!$form->{uid} || $form->{uid} == $user->{uid})) { print getData('noentries'); Modified: slashjp/branches/2.5.0.192/sql/mysql/defaults.sql =================================================================== --- slashjp/branches/2.5.0.192/sql/mysql/defaults.sql 2008-10-03 12:45:44 UTC (rev 781) +++ slashjp/branches/2.5.0.192/sql/mysql/defaults.sql 2008-10-03 12:46:49 UTC (rev 782) @@ -1148,6 +1148,7 @@ INSERT IGNORE INTO vars (name, value, description) VALUES ('related_cid_disabled','0','If set, then disable inserting cid to related story list'); INSERT IGNORE INTO vars (name, value, description) VALUES ('modreasons_select_disabled','','Comma separated "modreasons.id"s disable to select when moderation'); INSERT IGNORE INTO vars (name, value, description) VALUES ('search_query_name','query','alternative query string form name for search.pl'); +INSERT IGNORE INTO vars (name, value, description) VALUES ('journal_list_default_display', '50', 'Number of journals to display on a journal title list page'); UPDATE vars SET value='text/html; charset=UTF-8' WHERE name='content_type_webpage'; UPDATE vars SET value='0' WHERE name='draconian_charset'; UPDATE vars SET value='UTF-8' WHERE name='rdfencoding';