[Slashdotjp-dev 1507] [1038] Add poll discussion prev/next link

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2009年 2月 23日 (月) 21:16:37 JST


Revision: 1038
          http://svn.sourceforge.jp/view?root=slashdotjp&view=rev&rev=1038
Author:   tach
Date:     2009-02-23 21:16:37 +0900 (Mon, 23 Feb 2009)

Log Message:
-----------
Add poll discussion prev/next link

Modified Paths:
--------------
    slashjp/trunk/Slash/Utility/Comments/Comments.pm


-------------- next part --------------
Modified: slashjp/trunk/Slash/Utility/Comments/Comments.pm
===================================================================
--- slashjp/trunk/Slash/Utility/Comments/Comments.pm	2009-02-23 11:02:26 UTC (rev 1037)
+++ slashjp/trunk/Slash/Utility/Comments/Comments.pm	2009-02-23 12:16:37 UTC (rev 1038)
@@ -2700,6 +2700,20 @@
 		push(@$stories, $item);
 	}
 
+	# poll
+	if ($kind eq "poll") {
+		my $item = { 'prev' => {}, 'next' => {}, 'up' => {} };
+		if (my $prev = $reader->getDiscussionByTime('<', $discussion, { dkid => $discussion->{dkid} })) {
+			$item->{prev} = { url => $prev->{url}, title => $prev->{title} };
+		}
+		if (my $next = $reader->getDiscussionByTime('>', $discussion, { dkid => $discussion->{dkid} })) {
+			$item->{next} = { url => $next->{url}, title => $next->{title} };
+		}
+		$item->{up}->{title} = Slash::getData('polls', {}, 'misc');
+		$item->{up}->{url} = "$constants->{rootdir}/polls/";
+		push(@$stories, $item);
+	}
+
 #use Data::Dumper; print STDERR Dumper($stories);
 
 	# poll



Slashdotjp-dev メーリングリストの案内
Back to archive index