svnno****@sourc*****
svnno****@sourc*****
2009年 2月 23日 (月) 15:26:14 JST
Revision: 1029 http://svn.sourceforge.jp/view?root=slashdotjp&view=rev&rev=1029 Author: tach Date: 2009-02-23 15:26:14 +0900 (Mon, 23 Feb 2009) Log Message: ----------- Change printCommentsSuffix() internal Modified Paths: -------------- slashjp/trunk/Slash/Utility/Comments/Comments.pm slashjp/trunk/debian/changelog -------------- next part -------------- Modified: slashjp/trunk/Slash/Utility/Comments/Comments.pm =================================================================== --- slashjp/trunk/Slash/Utility/Comments/Comments.pm 2009-02-23 06:13:31 UTC (rev 1028) +++ slashjp/trunk/Slash/Utility/Comments/Comments.pm 2009-02-23 06:26:14 UTC (rev 1029) @@ -2637,21 +2637,64 @@ sub printCommentsSuffix { my ($discussion, $options) = @_; my $constants = getCurrentStatic(); + my $currentPage = getCurrentUser('currentPage'); my $reader = getObject('Slash::DB', { db_type => 'reader' }); - my $stories = {}; + my $stories = []; my $ret = ''; return $ret if (!$discussion || ref($discussion) ne "HASH"); my $sid = $reader->getStorySidFromDiscussion($discussion->{id}); - if ($sid) { + my $kinds = $reader->getDescriptions('discussion_kinds'); + my $kind = $kinds->{ $discussion->{dkid} }; +#print STDERR "kind = $kind\n"; +#print STDERR "currentPage = $currentPage\n"; + + # story + if ($kind =~ /story$/ && $currentPage =~ /^(?:article|comments)$/ && $sid) { my $story = $reader->getStory($sid); if ($constants->{use_prev_next_link}) { - $stories->{prev} = $reader->getStoryByTime('<', $story); - $stories->{next} = $reader->getStoryByTime('>', $story) unless $story->{is_future}; + my $item = { 'prev' => {}, 'next' => {}, 'up' => {} }; + if (my $prev = $reader->getStoryByTime('<', $story)) { + $prev = linkStory($prev); + $item->{prev} = { url => $prev->[0], title => $prev->[1] } + } + if (!$story->{is_future} && (my $next = $reader->getStoryByTime('>', $story))) { + $next = linkStory($next); + $item->{next} = { url => $next->[0], title => $next->[1] } + } + my $skin = $reader->getSkin($story->{primaryskid}); + $item->{up}->{title} = $skin->{title}; + $item->{up}->{url} = $skin->{url}; + push(@$stories, $item); } } + # journal + if ($kind =~ /^journal/ && $currentPage =~ /^(?:journal|comments)$/) { + my $journal_reader = getObject("Slash::Journal"); + my $journal = $journal_reader->getJournalByDiscussion($discussion->{id}); + my $item = { 'prev' => {}, 'next' => {}, 'up' => {} }; + if (my $prev = $journal_reader->getJournalByTime('<', [ $journal->{date} ], { uid => $journal->{uid} })) { + $item->{prev} = { url => $journal_reader->createJournalUrl($prev), title => $prev->{description} }; + } + if (my $next = $journal_reader->getJournalByTime('>', [ $journal->{date} ], { uid => $journal->{uid} })) { + $item->{next} = { url => $journal_reader->createJournalUrl($next), title => $next->{description} }; + } + $item->{up}->{title} = Slash::getData('s_journal', { nickname => $reader->getUser($journal->{uid}, 'nickname') }, 'misc'); + $item->{up}->{url} = $journal_reader->createJournalUrl({ uid => $journal->{uid} }); + push(@$stories, $item); + } +#use Data::Dumper; print STDERR Dumper($stories); + + # poll + + # feed + + # submission + + # project + $ret = slashDisplay('printCommentsSuffix', { stories => $stories, }, { Return => $options->{return} }); Modified: slashjp/trunk/debian/changelog =================================================================== --- slashjp/trunk/debian/changelog 2009-02-23 06:13:31 UTC (rev 1028) +++ slashjp/trunk/debian/changelog 2009-02-23 06:26:14 UTC (rev 1029) @@ -17,7 +17,7 @@ plugins/Journal/Journal.pm * Fix to return with uid on getJournalByTime() on plugins/Journal/Journal.pm - -- Taku YASUI <tach****@osdn*****> Fri, 20 Feb 2009 11:26:39 +0000 + -- Taku YASUI <tach****@osdn*****> Mon, 23 Feb 2009 06:25:30 +0000 slash (2.5.0.233-4) unstable; urgency=low