• R/O
  • SSH
  • HTTPS

jeanscms: コミット


コミットメタ情報

リビジョン249 (tree)
日時2010-08-23 11:12:53
作者kmorimatsu

ログメッセージ

'aname','alink','comments' data by <%blog%> tag.

変更サマリ

差分

--- jeanscms/trunk/jeans/libs/blog.php (revision 248)
+++ jeanscms/trunk/jeans/libs/blog.php (revision 249)
@@ -105,9 +105,15 @@
105105 i.keywords as keywords,
106106 i.xml as xml,
107107 "item" as xtable,
108+ m.name as aname,
108109 c.name as cname,
109- c.desc as cdesc
110- FROM jeans_item as i, jeans_group as c '.$where;
110+ c.desc as cdesc,
111+ count(o.id) as comments
112+ FROM jeans_item as i, jeans_group as c, jeans_member as m
113+ LEFT JOIN jeans_comment as o ON o.itemid=i.id
114+ WHERE i.sgid=c.id
115+ AND i.author=m.id
116+ AND '.$where;
111117 }
112118 static private $narrowby=array('category'=>false,'archive'=>false,'search'=>false,'showhidden'=>false);
113119 static public function tag_narrowby() {
@@ -149,8 +155,7 @@
149155 $hide=!$narrowby['showhidden'];
150156 // Prepare query and array-data
151157 $query=self::query_select(
152- 'WHERE i.gid=<%blogid%>
153- AND i.sgid=c.id
158+ 'i.gid=<%blogid%>
154159 AND i.time <= <%now%> '.
155160 ($subgroup ? 'AND i.sgid IN (<%subgroups%>) ':'').
156161 ($archivestart ? 'AND <%archivestart%> <= i.time ':'').
@@ -157,7 +162,8 @@
157162 ($archiveend ? 'AND i.time < <%archiveend%> ':'').
158163 ($search ? 'AND libs_blog_search(i.title,i.body,i.more,i.keywords) ':'').
159164 ($hide ? 'AND NOT (i.flags & <%const:sql::FLAG_HIDDEN%>) AND NOT (c.flags & <%const:sql::FLAG_HIDDEN%>) ':'').
160- 'ORDER by time DESC
165+ 'GROUP BY i.id
166+ ORDER BY time DESC
161167 LIMIT <%limit%> OFFSET <%offset%>');
162168 $array=array(
163169 'blogid'=>$blogid,
@@ -177,6 +183,7 @@
177183 if (self::category('id')) $item_array=array_merge($item_array,$cat_array);
178184 $row['link']=view::create_link($item_array);
179185 $row['clink']=view::create_link($cat_array);
186+ $row['alink']=view::create_link(array('memberid'=>(int)$row['author']));
180187 core::event('pre_item',array('row'=>&$row),'view');
181188 }
182189 static public function _blog_cb2(&$row){
旧リポジトリブラウザで表示