Tadashi Okoshi
slash****@users*****
2005年 12月 26日 (月) 01:50:28 JST
Index: affelio/lib/Affelio/App/FriendRoutines.pm
diff -u affelio/lib/Affelio/App/FriendRoutines.pm:1.9 affelio/lib/Affelio/App/FriendRoutines.pm:1.10
--- affelio/lib/Affelio/App/FriendRoutines.pm:1.9 Sat Dec 17 02:43:56 2005
+++ affelio/lib/Affelio/App/FriendRoutines.pm Mon Dec 26 01:50:28 2005
@@ -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: FriendRoutines.pm,v 1.9 2005/12/16 17:43:56 slash5234 Exp $
+# $Id: FriendRoutines.pm,v 1.10 2005/12/25 16:50:28 slash5234 Exp $
package Affelio::App::FriendRoutines;
{
@@ -142,6 +142,8 @@
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 $sort = shift; #arg(5) sort
+ my $mode = shift; #arg(6) mode
my @ret_list;
if ($visitor_id eq ""){
@@ -154,7 +156,37 @@
######################################
#Get all friends' table from FriendManager
######################################
- my $sth = $af->getFM->get_all_friend_list();
+ my $do_sort="";
+ my $do_order="asc";
+
+ debug_print("FriendRoutines: sort = [$sort]\n");
+ if($sort eq "link_old"){
+ $do_sort = "timestamp";
+ $do_order = "asc";
+ }
+ if($sort eq "link_new"){
+ $do_sort = "timestamp";
+ $do_order = "desc";
+ }
+ if($sort eq "access_latest"){
+ $do_sort = "last_access";
+ $do_order = "desc";
+ }
+ if($sort eq "access_freq"){
+ $do_sort = "count_access";
+ $do_order = "desc";
+ }
+ if($sort eq "incoming"){
+ $do_sort = "count_incoming";
+ $do_order = "desc";
+ }
+ if($sort eq "outgoing"){
+ $do_sort = "count_outgoing";
+ $do_order = "desc";
+ }
+
+ my $sth = $af->getFM->get_all_friend_list(sort => $do_sort,
+ order => $do_order);
######################################
#Build up a return array
@@ -185,13 +217,25 @@
"/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");
+ my $mystatus_URL = "";
+
+ if($mode eq "iframe"){
+ $mystatus_URL = generate_getcontentURL($af,
+ $visitor_id,
+ $visitor_type,
+ $person[1],
+ $person[4],
+ "core",
+ "/profile/mystatus_iframe");
+ }else{
+ $mystatus_URL = generate_getcontentURL($af,
+ $visitor_id,
+ $visitor_type,
+ $person[1],
+ $person[4],
+ "core",
+ "/profile/mystatus");
+ }
debug_print("FriendRoutines: mystatus_URL= $mystatus_URL\n");
#Generate Hyperlink target URL
@@ -227,94 +271,9 @@
- #####################################################################
- #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->getFM->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="";
- if($visitor_type eq "self"){
- $editurl = $af->{site__web_root} . "/admin.cgi?mode=manage_friends&mode2=show_member&uid=" . $person[0];
- }
-
- my $mailurl="";
- if($visitor_type eq "self"){
- $mailurl = $af->{site__web_root} . "/admin.cgi?mode=messages&action=compose&reply_to=" . $person[1];
- }
- push(@ret_list, {nickname => $person[2],
- URL => $dest_URL,
- image_URL => $image_URL,
- editurl => $editurl,
- mailurl => $mailurl,
- intro => $person[5],
- mystatus_URL => $mystatus_URL
- }
- );
-
- if($max_friend_num > 0){
- $count--;
- }
- }#while
-
- return(@ret_list);
-
- }
######################################################################