Tadashi Okoshi
slash****@users*****
2005年 6月 30日 (木) 07:54:06 JST
Index: affelio/lib/Affelio/App/FriendRoutines.pm diff -u affelio/lib/Affelio/App/FriendRoutines.pm:1.2 affelio/lib/Affelio/App/FriendRoutines.pm:1.3 --- affelio/lib/Affelio/App/FriendRoutines.pm:1.2 Sat Jun 25 21:14:05 2005 +++ affelio/lib/Affelio/App/FriendRoutines.pm Thu Jun 30 07:54:06 2005 @@ -4,7 +4,7 @@ # http://affelio.jp/ (Japan) # http://affelio.jp/ (USA and other area) # -# $Id: FriendRoutines.pm,v 1.2 2005/06/25 12:14:05 slash5234 Exp $ +# $Id: FriendRoutines.pm,v 1.3 2005/06/29 22:54:06 slash5234 Exp $ package Affelio::App::FriendRoutines; { @@ -20,7 +20,7 @@ use Exporter; @Affelio::App::FriendRoutines::ISA = "Exporter"; - @Affelio::App::FriendRoutines::EXPORT = qw (get_friends_list generate_getcontentURL get_summed_permission_list); + @Affelio::App::FriendRoutines::EXPORT = qw (get_friends_list_IF get_friends_list generate_getcontentURL get_summed_permission_list); ##################################################################### #get_summed_permission_list @@ -205,6 +205,88 @@ } + + ##################################################################### + #get_friends_list_IF + ##################################################################### + sub get_friends_list_IF{ + my $af = shift; #arg(1) AF + my $visitor_id = shift; #arg(2) visitor_ID + my $visitor_type = shift; #arg(3) visitor_ID + my $max_friend_num = shift; #arg(4) max num + my @ret_list; + + if ($visitor_id eq ""){ + $visitor_id = "anonymous"; + } + + ###################################### + #Get all friends' table from FriendManager + ###################################### + my $sth = $af->{fm}->get_all_friend_list(); + + ###################################### + #Build up a return array + ###################################### + my @person=(); + my $count = $max_friend_num; + + while((@person = $sth->fetchrow_array) + && (($count > 0) || ($count == -1)) + ) { + debug_print("FriendRoutines: friend=(@person)"); + #$person[0] uid + #$person[1] af_id + #$person[2] nickname + #$person[3] timestamp + #$person[4] password + #$person[5] intro + #$person[6] option_pid + #$person[7] lastupdated + #$person[8] f2list + + my $image_URL = generate_getcontentURL($af, + $visitor_id, + $visitor_type, + $person[1], + $person[4], + "core", + "/profile/profile_face.jpg"); + debug_print("FriendRoutines: image_URL= $image_URL\n"); + + my $mystatus_URL = generate_getcontentURL($af, + $visitor_id, + $visitor_type, + $person[1], + $person[4], + "core", + "/profile/mystatus_iframe"); + debug_print("FriendRoutines: mystatus_URL= $mystatus_URL\n"); + + #Generate Hyperlink target URL + my $dest_URL = $af->{site__web_root} . "/outgoing.cgi?dest_url=" . $person[1]; + + my $editurl = $af->{site__web_root} . "/admin.cgi?mode=manage_friends&mode2=show_member&uid=" . $person[0]; + + push(@ret_list, {nickname => $person[2], + URL => $dest_URL, + image_URL => $image_URL, + editurl => $editurl, + intro => $person[5], + mystatus_URL => $mystatus_URL + } + ); + + if($max_friend_num > 0){ + $count--; + } + }#while + + return(@ret_list); + + } + + ###################################################################### #generate_contentURL # returns image_URL