[Affelio-cvs 1348] CVS update: affelio/lib/Affelio/Managing

Back to archive index

Tadashi Okoshi slash****@users*****
2006年 6月 6日 (火) 10:34:31 JST


Index: affelio/lib/Affelio/Managing/NewsAggregator.pm
diff -u affelio/lib/Affelio/Managing/NewsAggregator.pm:1.20 affelio/lib/Affelio/Managing/NewsAggregator.pm:1.21
--- affelio/lib/Affelio/Managing/NewsAggregator.pm:1.20	Sat Jun  3 13:00:35 2006
+++ affelio/lib/Affelio/Managing/NewsAggregator.pm	Tue Jun  6 10:34:31 2006
@@ -14,7 +14,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #
-# $Id: NewsAggregator.pm,v 1.20 2006/06/03 04:00:35 higefuku Exp $
+# $Id: NewsAggregator.pm,v 1.21 2006/06/06 01:34:31 slash5234 Exp $
 
 package Affelio::Managing::NewsAggregator;
 {
@@ -61,7 +61,7 @@
 
 	##############################
 	#Insert a new record
-	my $sth = "insert into $af->{site__dbtbl_prefix}_CORE_nghr_news(datetime, af_id, nickname, app_install_name, title, description, creator, URL) values ('$arg{datetime}', '$arg{af_id}', '$arg{nickname}', '$arg{app}', '$arg{title}', '$arg{desc}', '$arg{creator}', '$arg{URL}')";
+	my $sth = "insert into $af->{site__dbtbl_prefix}_CORE_nghr_news(datetime, af_id, nickname, app_install_name, title, description, creator, URL, af_type) values ('$arg{datetime}', '$arg{af_id}', '$arg{nickname}', '$arg{app}', '$arg{title}', '$arg{desc}', '$arg{creator}', '$arg{URL}', '$arg{af_type}')";
 	eval{
 	    $sth = $af->getDB->prepare($sth);
 	    $sth->execute;
@@ -77,15 +77,15 @@
     #retrieve_news
     #######################################################################
     sub retrieve_news{
-	my $self = shift;
+	my $self = shift;    
 	my $af = $self->{af}; 
-	my $num = shift;
-
+	my $num = shift;        #arg(1) number
+	my $type = shift;       #arg(2) type
 	debug_print("NewsAggregator::retrieve_news: start.");
 
 	##############################
 	#retrieve all friend records from DB
-	my $query = "SELECT datetime, af_id, nickname, app_install_name, title, description, creator, URL FROM $af->{site__dbtbl_prefix}_CORE_nghr_news order by datetime desc";
+	my $query = "SELECT datetime, af_id, nickname, app_install_name, title, description, creator, URL FROM $af->{site__dbtbl_prefix}_CORE_nghr_news order by datetime desc WHERE af_type='$type'";
 	my $sth;
 	eval{
 	    $sth = $af->getDB->prepare($query);
@@ -104,9 +104,10 @@
     #######################################################################
     sub retrieve_ajax_news{
 	my $self = shift;
-	my $sort = shift;
-	my $num = shift;
 	my $af = $self->{af}; 
+	my $sort = shift;       #arg(1) sort
+	my $num = shift;        #arg(2) number
+	my $type = shift;       #arg(3) type
 
 	debug_print("NewsAggregator::retrieve_ajax_news: start.");
 
@@ -119,6 +120,7 @@
 	    $query .= " title,";
 	}
 	$query.= " datetime desc limit $num , 10";
+	$query.= " WHERE af_type='$type' ";
 	my $sth;
 	eval{
 	    $sth = $af->getDB->prepare($query);
@@ -132,7 +134,6 @@
 	return($sth);
     }
 
-
     #######################################################################
     #get_one
     #######################################################################
@@ -176,14 +177,18 @@
 	debug_print("NewsAggregator::get_one: updated_last_news_in");
 
 	#########################################################
+	#get af_type of the peer
+	my $af_type = $af->getFM->get_attribute_by_id($uid, "af_type");
+
+	#########################################################
 	#Invoke SNS/Handshaker_c
 	my $ret="";
 	try{
 	    require Affelio::SNS::Handshaker_c;
 
 	    $ret = Affelio::SNS::Handshaker_c::get_news(
-                   dest_uri =>  $af_id,
-		xwsse_mesg => $xwsse_mesg);
+			dest_uri =>  $af_id,
+			xwsse_mesg => $xwsse_mesg);
 
 	}catch Error with{
 	    my $e = shift;
@@ -238,7 +243,8 @@
 		      title => $title,
 		      desc => $desc,
 		      creator => $creator,
-		      URL => $URL);
+		      URL => $URL,
+		      af_type => $af_type);
 	}
 
 


Affelio-cvs メーリングリストの案内
Back to archive index