[Slashdotjp-dev 1166] [693] * add tid for journal top RSS item

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2008年 7月 10日 (木) 02:00:52 JST


Revision: 693
          http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=slashdotjp&view=rev&rev=693
Author:   tach
Date:     2008-07-10 02:00:52 +0900 (Thu, 10 Jul 2008)

Log Message:
-----------
 * add tid for journal top RSS item
 * fix topCount data for journal top

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-07-09 16:43:48 UTC (rev 692)
+++ slashjp/branches/2.5.0.192/plugins/Journal/Journal.pm	2008-07-09 17:00:52 UTC (rev 693)
@@ -301,25 +301,17 @@
 	$self->sqlConnect;
 
 	my $sql = <<EOT;
-SELECT count AS c,nickname,users_journal.uid,date,jid AS id
+SELECT count AS c,nickname,users_journal.uid,users_journal.date,jid AS id,description,journals_text.article,posttype,tid
 FROM users_journal JOIN users USING (uid)
+JOIN journals ON jid=journals.id
+JOIN journals_text ON jid=journals_text.id
 ORDER BY count DESC
 LIMIT $start, $limit
 EOT
 
 	my $losers = $self->{_dbh}->selectall_arrayref($sql);
+	return [ ] if !$losers || !@$losers;
 
-	my $sql2 = sprintf <<EOT, join (',', map { $_->[4] } @$losers);
-SELECT id, description
-FROM journals
-WHERE id IN (%s)
-EOT
-	my $losers2 = $self->{_dbh}->selectall_hashref($sql2, 'id');
-
-	for (@$losers) {
-		$_->[5] = $losers2->{$_->[4]}{description};
-	}
-
 	return $losers;
 }
 
@@ -330,7 +322,7 @@
 	$self->sqlConnect;
 
 	my $sql = <<EOT;
-SELECT count AS c,nickname,users_journal.uid,users_journal.date,jid AS id,description,journals_text.article,posttype
+SELECT count AS c,nickname,users_journal.uid,users_journal.date,jid AS id,description,journals_text.article,posttype,tid
 FROM users_journal JOIN users USING (uid)
 JOIN journals ON jid=journals.id
 JOIN journals_text ON jid=journals_text.id

Modified: slashjp/branches/2.5.0.192/plugins/Journal/journal.pl
===================================================================
--- slashjp/branches/2.5.0.192/plugins/Journal/journal.pl	2008-07-09 16:43:48 UTC (rev 692)
+++ slashjp/branches/2.5.0.192/plugins/Journal/journal.pl	2008-07-09 17:00:52 UTC (rev 693)
@@ -329,6 +329,7 @@
 			story	=> {
 				'time'	=> $entry->[3],
 				uid	=> $entry->[2],
+				tid	=> $entry->[8],
 			},
 			title	=> $title,
 			link	=> "$gSkin->{absolutedir}/~" . fixparam($entry->[1]) . "/journal/$entry->[4]",


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