[Affelio-cvs 1406] CVS update: affelio/lib/Affelio/App/Standalone/Admin

Back to archive index

Tadashi Okoshi slash****@users*****
2006年 8月 9日 (水) 14:12:16 JST


Index: affelio/lib/Affelio/App/Standalone/Admin/EditProfile.pm
diff -u affelio/lib/Affelio/App/Standalone/Admin/EditProfile.pm:1.2 affelio/lib/Affelio/App/Standalone/Admin/EditProfile.pm:1.3
--- affelio/lib/Affelio/App/Standalone/Admin/EditProfile.pm:1.2	Tue Mar 28 18:15:22 2006
+++ affelio/lib/Affelio/App/Standalone/Admin/EditProfile.pm	Wed Aug  9 14:12:16 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: EditProfile.pm,v 1.2 2006/03/28 09:15:22 slash5234 Exp $
+# $Id: EditProfile.pm,v 1.3 2006/08/09 05:12:16 slash5234 Exp $
 
 package Affelio::App::Standalone::Admin::EditProfile;
 {
@@ -158,6 +158,32 @@
 		debug_print("StandAlone::af($key2) = $af->{$key}");
 	    }
 	} 
+
+	#Birthday
+	$af->{user__bday} =~ /([0-9]{4})([0-9]{2})([0-9]{2})/;
+	$$output_data_ref{"bday_y_$1"} = "true";
+	$$output_data_ref{"bday_m_$2"} = "true";
+	$$output_data_ref{"bday_d_$3"} = "true";
+
+	#Telephone type
+	for(my $i=1; $i<5; $i++){
+	    my @array = split(',', $af->{"user__tel".$i."_type"});
+	    foreach my $tmp_a (@array){
+		my $key = "tel" . $i . "_type_" . $tmp_a;
+		$$output_data_ref{$key} = "true";
+		debug_print("Personal::af($key) = true");
+	    }	
+	}
+
+	#Address type
+	for(my $i=1; $i<3; $i++){
+	    my $val = $af->{"user__adr".$i."_type"};
+	    my $key = "adr" . $i . "_type_" . $val;
+	    $$output_data_ref{$key} = "true";
+	    debug_print("Personal::af($key) = true");
+	}
+
+	debug_print("Standalone::EditProfile::show_profile: end."); 
     }
 
     #######################################################################
@@ -173,8 +199,7 @@
 	foreach my $param_key (@param_names){
 	    if($param_key ne "submit"){
 		$af->{"user__$param_key"} 
-		= $cgi->param($param_key);
-#		= Jcode->new($cgi->param($param_key), 
+		= sanitize($cgi->param($param_key));
 
 		debug_print("StandAlone::EditProfile::save_profile: $param_key= " . Jcode::getcode($cgi->param($param_key)) . "\n");
 		debug_print("StandAlone::EditProfile::save_profile: $param_key= [". $af->{"user__$param_key"} . "]");
@@ -182,6 +207,19 @@
 	    }
 	} 
 	
+	#Birthday
+	$af->{user__bday} = $cgi->param("bday_y") . $cgi->param("bday_m") . $cgi->param("bday_d");
+
+	#Telephone type
+	for(my $i=1; $i<5; $i++){
+	    my $tmp_a="";
+	    my @array =  $cgi->param("tel" . $i . "_type");
+	    foreach my $tmp_b (@array){
+		$tmp_a .= $tmp_b . ",";
+	    }	
+	    $af->{"user__tel" . $i . "_type"} = $tmp_a;
+	}
+
 	#XXX 
 	#Sanitize inputs
 	
@@ -211,5 +249,17 @@
 	}
     }
 
+    sub sanitize{
+	my $input = shift;
+
+	$input =~ s/&/&amp;/g;
+	$input =~ s/'/&#39;/g;
+	$input =~ s/"/&quot;/g;
+	$input =~ s/</&lt;/g;
+	$input =~ s/>/&gt;/g;
+
+	return $input;
+    }
+
 }
 1;
Index: affelio/lib/Affelio/App/Standalone/Admin/MakeAffelioLink.pm
diff -u affelio/lib/Affelio/App/Standalone/Admin/MakeAffelioLink.pm:1.4 affelio/lib/Affelio/App/Standalone/Admin/MakeAffelioLink.pm:1.5
--- affelio/lib/Affelio/App/Standalone/Admin/MakeAffelioLink.pm:1.4	Thu Jun 29 03:12:48 2006
+++ affelio/lib/Affelio/App/Standalone/Admin/MakeAffelioLink.pm	Wed Aug  9 14:12:16 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: MakeAffelioLink.pm,v 1.4 2006/06/28 18:12:48 slash5234 Exp $
+# $Id: MakeAffelioLink.pm,v 1.5 2006/08/09 05:12:16 slash5234 Exp $
 
 package Affelio::App::Standalone::Admin::MakeAffelioLink;
 {
@@ -113,31 +113,13 @@
 	if($output_ref->{err_title}){ return; }
 
 	debug_print("StandAlone::MakeAffelioLink::send: send_HandShake returned success.");
-        ###########################################
-        # Save peer's info into pending_DB
-        ###########################################
-#	my $tmpdb= new Affelio::SNS::Handshaker_tmpDB($af);
-#	try{
-#	    $tmpdb->add_sent_Handshake($cur_time,
-#				       $dest_uri,
-#				       "",
-#				       $cur_time,
-#				       $my_DH_pri_key_str,
-#				       "Personal");
-#	}catch Error with{
-#	    my $E = shift;
-#	    $output_ref->{err_title} = "<AF_M text='Access to local DB failed. System error occured.'>";
-#	    $output_ref->{err_msg} = "01-01-04: " . $E;
-#	};
-	if($output_ref->{err_title}){ return; }
 
 	$output_ref->{ret_msg} = "<AF_M text='AffelioLink request has been sent to ' param='$dest_uri'>";
-	debug_print("StandAlone::MakeAffelioLink::send: wroteDB $dest_uri=>[$cur_time]\n");
-	debug_print("StandAlone::MakeAffelioLink::send: end.");
+	debug_print("Personal::MakeAffelioLink::send: wroteDB $dest_uri=>[$cur_time]\n");
+	debug_print("Personal::MakeAffelioLink::send: end.");
 	return;
     }
 
-
     #######################################################################
     #show
     #######################################################################    
Index: affelio/lib/Affelio/App/Standalone/Admin/Messaging.pm
diff -u affelio/lib/Affelio/App/Standalone/Admin/Messaging.pm:1.6 affelio/lib/Affelio/App/Standalone/Admin/Messaging.pm:1.7
--- affelio/lib/Affelio/App/Standalone/Admin/Messaging.pm:1.6	Thu Jun 29 03:12:48 2006
+++ affelio/lib/Affelio/App/Standalone/Admin/Messaging.pm	Wed Aug  9 14:12:16 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: Messaging.pm,v 1.6 2006/06/28 18:12:48 slash5234 Exp $
+# $Id: Messaging.pm,v 1.7 2006/08/09 05:12:16 slash5234 Exp $
 
 package Affelio::App::Standalone::Admin::Messaging;
 {
@@ -159,29 +159,37 @@
 	my $mode = shift;
 	my $out_ref = shift;
 
-	debug_print("StandAlone::Mesg::send: start.");
+	debug_print("Standalone::Mesg::send: start.");
 
     	my $wi = new Affelio::misc::WebInput;
-	my $msg_to = $wi->PTN_URL( $cgi->param("msg_to") );
+	my @msg_tos =  $cgi->param("msg_to") ;
 	my $msg_title = $cgi->param("msg_title");
 	my $msg_body = $cgi->param("msg_body");
-	debug_print("StandAlone::Mesg::send: $msg_to $msg_title $msg_body");
+	debug_print("Standalone::Mesg::send: title=[$msg_title]");
+	debug_print("Standalone::Mesg::send: to(s)=[@msg_tos]");
+	debug_print("Standalone::Mesg::send: body =[$msg_body]");
+	my $msg_to_url = "";
 
 	###################################################################
-	#Save the message to draft folder
+	#Process input args
 	###################################################################
-	if($msg_to =~ /(.*)\/$/){
-	    $msg_to = $1;
+	my $len = @msg_tos;
+	for(my $i = 0; $i < $len; $i++){
+	    #Prune / at the end
+	    $msg_tos[$i] =~ s|/$||;
+	    #Get nickname
+	    my $nick = $af->getFM->get_attribute_by_afid($msg_tos[$i], 
+							 "nickname");
+	    #append to $msg_to_url
+	    $msg_to_url .= "<A HREF=\"@msg_tos[$i]\">$nick</A>";
 	}
-	my $msg_to_nickname ="";
-	my $msg_to_url = "";
-	my $mid ="";
+	debug_print("Standalone::Mesg::send: msg_to_url =[$msg_to_url]");
 
+	###################################################################
+	#Save the message to draft folder
+	###################################################################
+	my $mid ="";
 	try{
-	    if($msg_to){
-		$msg_to_nickname = $af->getFM->get_attribute_by_afid($msg_to, "nickname");
-		$msg_to_url = "<A HREF=\"$msg_to\">$msg_to_nickname</A>";
-	    }
 	    $mid = $af->getMESGM->post_message(from => $msg_to_url,
 					       title => $msg_title,
 					       type => "UserToUser/OneToOne",
@@ -193,8 +201,9 @@
 	    $out_ref->{err_title} .= "<AF_M text='Access to local DB failed. System error occured.'>";
 	    $out_ref->{err_msg} .= "01-01-04: " . $e;
 	};
-	if ($out_ref->{err_title}){ return; }
-
+	if ($out_ref->{err_title}){ 
+	    return; 
+	}
 	$out_ref->{ret_msg} .= '<AF_M text="Your message has been saved in draft folder.">';
 	if($mode eq "justsave"){
 	    return();
@@ -203,70 +212,87 @@
 	###################################################################
 	#Sending message to the peer (through SNS layer)
 	###################################################################
-	my $passAB = "";
-	try{
-	    $passAB = $af->getFM->get_attribute_by_afid($msg_to, "password");
-	}catch Affelio::exception::DBException with{
-	    my $e = shift;
-	    $out_ref->{err_title}.='<AF_M text="Could not send message.">';
-	    $out_ref->{err_title} .= "<AF_M text='Access to local DB failed. System error occured.'>";
-	    $out_ref->{err_msg} .= "01-01-04: " . $e;
-	};
-	if ($out_ref->{err_title}){ return; }
-
-	debug_print("StandAlone::Mesg::send: passAB=[$passAB]");
-	if(!defined($passAB) || $passAB eq ""){
-	    my $e = shift;
-	    $out_ref->{err_title} .= '<AF_M text="Could not send message.">';
-	    $out_ref->{err_title} .= '<AF_M text="Shared key not found in DB. System error occured.">';
-	    $out_ref->{err_msg} .= "01-02-01: Could not found shared key with peer Affelio.";
-	    return;
-	}
-
-	my $ret="";
-	try{
-	    $ret = post_Message(dest_uri =>  $msg_to,
-				src => $af->{site__user_afid},
-				password => $passAB,
-				msg_from => $af->{site__user_afid},
-				msg_from_nickname => $af->{user__nickname},
-				msg_to => $msg_to,
-				msg_timestamp => get_timestamp(),
-				msg_title => $msg_title,
-				msg_body => $msg_body);
+	my $msg_to_rest = $msg_to_url;
+	foreach my $msg_to (@msg_tos){
 
-	}catch Affelio::exception::NetworkException with{
-	    my $e = shift;
-	    $out_ref->{err_title} .= '<AF_M text="Could not send message.">';
-	    $out_ref->{err_title} .= '<AF_M text="Network error occured.">';
-	    $out_ref->{err_msg} .= "01-02-02: " . $e;
-	}catch Affelio::exception::CommunicationException with{
-	    my $e = shift;
-	    $out_ref->{err_title} .= '<AF_M text="Could not send message.">';
-	    $out_ref->{err_title} .= '<AF_M text="Communication error occured with peer Affelio">';
-	    $out_ref->{err_msg} .= "01-02-03: " . $e;
-	}catch Affelio::exception::InvalidInputException with{
-	    my $e = shift;
-	    $out_ref->{err_title} .= '<AF_M text="Could not send message.">';
-	    $out_ref->{err_title} .= '<AF_M text="Invalid Input after input check. System error occured.">';
-	    $out_ref->{err_msg} .= "01-02-04: " . $e;
-	};
-	if ($out_ref->{err_title}){ return; }
+	    my $passAB = "";
+	    try{
+		$passAB = $af->getFM->get_attribute_by_afid($msg_to, "password");
+	    }catch Affelio::exception::DBException with{
+		my $e = shift;
+		$out_ref->{err_title}.='<AF_M text="Could not send message.">';
+		$out_ref->{err_title} .= "<AF_M text='Access to local DB failed. System error occured.'>";
+		$out_ref->{err_msg} .= "01-01-04: " . $e;
+	    };
+	    if ($out_ref->{err_title}){ return; }
+	    
+	    debug_print("Standalone::Mesg::send: passAB=[$passAB]");
+	    if(!defined($passAB) || $passAB eq ""){
+		my $e = shift;
+		$out_ref->{err_title} .= '<AF_M text="Could not send message.">';
+		$out_ref->{err_title} .= '<AF_M text="Shared key not found in DB. System error occured.">';
+		$out_ref->{err_msg} .= "01-02-01: Could not found shared key with peer Affelio.";
+		return;
+	    }
+	    
+	    my $ret="";
+	    try{
+		$ret = post_Message(dest_uri =>  $msg_to,
+				    src => $af->{site__user_afid},
+				    password => $passAB,
+				    msg_from => $af->{site__user_afid},
+				    msg_from_nickname => $af->{user__nickname},
+				    msg_to => $msg_to_url,
+				    msg_timestamp => get_timestamp(),
+				    msg_title => $msg_title,
+				    msg_body => $msg_body);
+		
+	    }catch Affelio::exception::NetworkException with{
+		my $e = shift;
+		$out_ref->{err_title} .= '<AF_M text="Could not send message.">';
+		$out_ref->{err_title} .= '<AF_M text="Network error occured.">';
+		$out_ref->{err_msg} .= "01-02-02: " . $e;
+	    }catch Affelio::exception::CommunicationException with{
+		my $e = shift;
+		$out_ref->{err_title} .= '<AF_M text="Could not send message.">';
+		$out_ref->{err_title} .= '<AF_M text="Communication error occured with peer Affelio">';
+		$out_ref->{err_msg} .= "01-02-03: " . $e;
+	    }catch Affelio::exception::InvalidInputException with{
+		my $e = shift;
+		$out_ref->{err_title} .= '<AF_M text="Could not send message.">';
+		$out_ref->{err_title} .= '<AF_M text="Invalid Input after input check. System error occured.">';
+		$out_ref->{err_msg} .= "01-02-04: " . $e;
+	    };
+	    if ($out_ref->{err_title}){ return; }
+	    
+	    ###############################################################
+	    #get rid of 1 dest. user from $msg_to_rest
+	    ###############################################################
+	    $msg_to_rest =~ s|<A HREF="$msg_to">([A-Za-z0-9_]*)</A>||;
+	    debug_print("Standalone::Mesg::send: remaining destination=[$msg_to_rest]");	    
+	    try{
+		if($msg_to_rest eq ""){
+		    #If we already sent the message to all destination,
+		    #we will move the message to "sent" folder
+		    $af->getMESGM->move_message(mid => $mid, folder => "sent");
+		    $af->getMESGM->update_message(mid => $mid, 
+						  attribute => "msgfrom",
+						  value => "$msg_to_url");
+		}else{
+		    $af->getMESGM->update_message(mid => $mid, 
+						  attribute => "msgfrom",
+						  value => "$msg_to_rest");
+		}
+	    }catch Affelio::exception::DBException with{
+		my $e = shift;
+		$out_ref->{err_title} .= "<AF_M text='Access to local DB failed. System error occured.'>";
+		$out_ref->{err_msg} .= "01-01-04: " . $e;
+	    };
+	    if ($out_ref->{err_title}){ return; }
 
+	}
+	#foreach
 	$out_ref->{ret_msg} = '<AF_M text="Your message has been sent successfuly.">';
-
-	###################################################################
-	#Move the message from "draft" to "sent"
-	###################################################################
-	try{
-	    $af->getMESGM->move_message(mid => $mid, folder => "sent");
-	}catch Affelio::exception::DBException with{
-	    my $e = shift;
-	    $out_ref->{err_title} .= "<AF_M text='Access to local DB failed. System error occured.'>";
-	    $out_ref->{err_msg} .= "01-01-04: " . $e;
-	};
-	if ($out_ref->{err_title}){ return; }
-
     }
 
 
@@ -291,6 +317,7 @@
 	$title = url_decode($cgi->url_param("title"));
 
 	$reply_to = $cgi->param("reply_to");
+	my @reply_to_array = split(',', $reply_to);
 	$reply_title = $cgi->param("reply_title");
 	$reply_body = $cgi->param("reply_body");
 	if($to_url ne ""){
@@ -299,9 +326,9 @@
 	    $mode="POST__reply";
 	}
 
-	debug_print("StandAlone::Messaging::compose: start.");
-	debug_print("StandAlone::Messaging::compose: Reply-To: [$reply_to]");
-	debug_print("StandAlone::Messaging::compose: To_URL: [$to_url]");
+	debug_print("Standalone::Messaging::compose: start.");
+	debug_print("Standalone::Messaging::compose: Reply-To: [$reply_to]");
+	debug_print("Standalone::Messaging::compose: To_URL: [$to_url]");
 
 	############################
 	#To:
@@ -321,19 +348,21 @@
 	    if($row[1] !~ /\/$/){
 		$row[1] .= "/";
 	    }
-	    if($reply_to !~ /\/$/){
-		$reply_to .= "/";
-	    }
 	    if($to_url !~ /\/$/){
 		$to_url .= "/";
 	    }
 
 	    my $selected = "";
-	    if(($mode eq "POST__reply") && ($row[1] eq $reply_to)){
-		$selected ="selected";
+	    if($mode eq "POST__reply"){
+		foreach my $to (@reply_to_array){
+		    if($row[1] =~ /($to)(\/?)$/){
+			$selected ="selected";
+		    }
+		}
 	    }elsif(($mode eq "GET__specified_dest_url") && ($row[1] eq $to_url)){
 		$selected ="selected";
 	    } 
+
 	    my $t= sprintf("%-20s %s",$row[2],$row[1]);
 	    $t=~ s/\s/&nbsp;/g;
 
@@ -358,7 +387,7 @@
 	$output_ref->{"msg_body"} = $reply_body;
 
 
-	debug_print("StandAlone::Messaging::compose: end.");
+	debug_print("Standalone::Messaging::compose: end.");
     }
 
     #######################################################################
@@ -371,11 +400,11 @@
 	my $mid = shift;
 	$mid = $wi->PTN_num($mid);
 
-	debug_print("StandAlone::marK_as_read: start");
+	debug_print("Standalone::marK_as_read: start");
 
 	my $ret= $af->getMESGM->mark_as_read(mid => $mid);
 
-	debug_print("StandAlone::marK_as_read: end");
+	debug_print("Standalone::marK_as_read: end");
     }
 
     #######################################################################
@@ -383,11 +412,11 @@
     #######################################################################    
     sub get_new{
 	my $af = shift;
-	debug_print("StandAlone::get_new: start");
+	debug_print("Standalone::get_new: start");
 
 	my $ret= $af->getMESGM->get_unread_message_num();
 
-	debug_print("StandAlone::get_new: end");
+	debug_print("Standalone::get_new: end");
 	return($ret);
     }
 
@@ -396,7 +425,7 @@
     #show_message
     #######################################################################    
     sub show_message{
-	debug_print("StandAlone::show_message: start.");
+	debug_print("Standalone::show_message: start.");
 
 	###################################################################
 	#Check input values
@@ -405,6 +434,7 @@
 	my $mid = shift;
 	$mid = $wi->PTN_num($mid);
 	my $output_ref = shift;
+	my $http_regex = $Affelio::misc::WebInput::http_URL_regex;
 
 	###################################################################
 	#Retrieve specified message from DB
@@ -417,7 +447,10 @@
 	if($msg_type=~ /Encode\-Base64/){
 	    $msg_body = decode_base64($msg_body);
 	}
-	debug_print("StandAlone::show_message: $msg_from $msg_title $msg_type $msg_body");
+	debug_print("Standalone::show_message: [$msg_from]");
+	debug_print("Standalone::show_message: [$msg_title]");
+	debug_print("Standalone::show_message: [$msg_type]");
+	debug_print("Standalone::show_message: [$msg_body]");
 
 	$msg_timestamp = timestamp2string($msg_timestamp);
 
@@ -427,7 +460,9 @@
 	    my $reply_to="";
 	    my $reply_HTML =""; 
 
-	    if($msg_from =~ /HREF="(.+)">/){ $reply_to = $1; }
+	    $reply_to = $msg_from;
+	    $reply_to =~ s|<A HREF="($http_regex)">([A-Za-z0-9_]*)</A>|$1,|g;
+	    chop($reply_to);  #Prune "," at the end.
 
 	    if($msg_folder eq "draft" || $msg_folder eq "sent"){
 		#mesg in draft box
@@ -483,12 +518,18 @@
 	# like '<A HREF="url">nickname</A>' due to a weird DB problem,
 	# We have to change the URL to the one through outgoing.cgi
 	# by using ad-hoc regexes....
+	my $final_msg_from="";
 	if($msg_type =~ /UserToUser/){
-	    $msg_from =~ /<A HREF="(.*)">(.+)<\/A>/;
-	    debug_print("StandAlone::show_message: \t[$1]");
-	    debug_print("StandAlone::show_message: \t[$2]");
-	    
-	    $msg_from = '<A HREF="' . $af->{site__user_afid} . '/outgoing.cgi?dest_url=' . $1 . '" target="_blank">' . $2 . '</A>';
+
+	    my @dest_array = split("</A>", $msg_from);
+	    foreach my $dest (@dest_array){
+		debug_print("Standalone::show_message: \tdest = [$dest]");
+
+		#Distill URL and nickname and set final output
+		$dest =~ /<A HREF="($http_regex)">([A-Za-z0-9_]+)/;
+		debug_print("Standalone::show_message: \tdest = [$1] [$2]");
+		$final_msg_from .= '<A HREF="' . $af->{site__user_afid} . '/outgoing.cgi?dest_url=' . $1 . '" target="_blank" title="<AF_M text=\'Click here to go to Affelio page\'>">' . $2 . '</A> ';
+	    }
 	}
 
 	###################################################################
@@ -498,28 +539,28 @@
 	#Set output data
 	$$output_ref{"msg_timestamp"} = $msg_timestamp;
 	$$output_ref{"msg_title"} = $msg_title;
-	$$output_ref{"msg_from"} = $msg_from;
+	$$output_ref{"msg_from"} = $final_msg_from;
 	$$output_ref{"msg_body"} = $msg_body;
 	$$output_ref{"url2list"} 
 	= "$af->{site__user_afid}/admin.cgi?mode=messages&folder=$msg_folder";
 
-	debug_print("StandAlone::show_message: end.");
+	debug_print("Standalone::show_message: end.");
     }
 
     #######################################################################
     #delete_messages
     #######################################################################    
     sub delete_messages{
-	debug_print("StandAlone::delete_messages: start.");
+	debug_print("Standalone::delete_messages: start.");
 	my $af = shift;
 	my $cgi = shift;
 
 	foreach my  $value ( $cgi->param("operate_msg") ){
-	    debug_print("StandAlone::delete_messages: [$value]");
+	    debug_print("Standalone::delete_messages: [$value]");
 	    $af->getMESGM->delete_message(mid => $value);
 	}
 
-	debug_print("StandAlone::delete_messages: end.");
+	debug_print("Standalone::delete_messages: end.");
     }
 
 
@@ -531,7 +572,9 @@
 	my $folder = shift;
 	my $output_ref = shift;
 
-	debug_print("StandAlone::show_message_list: start. [$folder]");
+	my $http_regex = $Affelio::misc::WebInput::http_URL_regex;
+
+	debug_print("Standalone::show_message_list: start. [$folder]");
 
 	my @ret_messages=();
 	$output_ref->{'messages'} = \@ret_messages;
@@ -552,10 +595,10 @@
 		$msg_from, $msg_body, $msg_readflag) = @message;
 
 	    $msg_timestamp = timestamp2string($msg_timestamp);
-	    #debug_print("StandAlone::show_message_list: [$msg_title]");
-	    #debug_print("StandAlone::show_message_list: [$msg_from]");
-	    #debug_print("StandAlone::show_message_list: [$msg_body]");
-	    #debug_print("StandAlone::show_message_list: [$msg_timestamp]");
+	    #debug_print("Standalone::show_message_list: [$msg_title]");
+	    #debug_print("Standalone::show_message_list: [$msg_from]");
+	    #debug_print("Standalone::show_message_list: [$msg_body]");
+	    #debug_print("Standalone::show_message_list: [$msg_timestamp]");
 
 	    if($msg_title eq ""){  $msg_title = "No title"; }
 
@@ -568,11 +611,18 @@
 	    # We have to change the URL to the one through outgoing.cgi
 	    # by using ad-hoc regexes....
 	    if($msg_type =~ /UserToUser/){
-		$msg_from =~ /<A HREF="(.*)">(.+)<\/A>/;
-		debug_print("StandAlone::show_message_list: \t[$1]");
-		debug_print("StandAlone::show_message_list: \t[$2]");
+		#If $msg_from contains multiple users, set $postfix "etc."
+		my $postfix = "";
+		$msg_from =~ /(.*<\/A>.*){2,}/;
+		if($1 ne ""){
+		    $postfix = " etc.";
+		}
+
+		#Distill URL and nickname and set final output
+		$msg_from =~ /<A HREF="($http_regex)">([A-Za-z0-9_]+)<\/A>/;
+		debug_print("Standalone::show_message_list: \t[$1] [$2]");
+		$msg_from = '<A HREF="' . $af->{site__user_afid} . '/outgoing.cgi?dest_url=' . $1 . '" target="_blank" title="<AF_M text=\'Click here to go to Affelio page\'>">' . $2 . '</A>' . $postfix;
 
-		$msg_from = '<A HREF="' . $af->{site__user_afid} . '/outgoing.cgi?dest_url=' . $1 . '" target="_blank" title="<AF_M text=\'Click here to go to Affelio page\'>">' . $2 . '</A>';
 	    }
 	    ###########
 
@@ -588,7 +638,7 @@
 		     }
 		 );
 	}
-	debug_print("StandAlone::show_message_list: end.");
+	debug_print("Standalone::show_message_list: end.");
     }
 
 
Index: affelio/lib/Affelio/App/Standalone/Admin/Top.pm
diff -u affelio/lib/Affelio/App/Standalone/Admin/Top.pm:1.1 affelio/lib/Affelio/App/Standalone/Admin/Top.pm:1.2
--- affelio/lib/Affelio/App/Standalone/Admin/Top.pm:1.1	Tue Mar  7 23:39:09 2006
+++ affelio/lib/Affelio/App/Standalone/Admin/Top.pm	Wed Aug  9 14:12:16 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: Top.pm,v 1.1 2006/03/07 14:39:09 slash5234 Exp $
+# $Id: Top.pm,v 1.2 2006/08/09 05:12:16 slash5234 Exp $
 
 package Affelio::App::Standalone::Admin::Top;
 {
@@ -43,7 +43,7 @@
 	my $af = shift;
 	my $out_ref = shift;
 	
-	debug_print("StandAlone::Top::handler: start.");
+	debug_print("Standalone::Top::handler: start.");
 
 	my $wi = new Affelio::misc::WebInput();
 	my $sub_mode = $wi->PTN_mode($cgi->url_param("action"));
@@ -53,9 +53,9 @@
 	###############################
 	try{
 	    if( $sub_mode eq "post_mystatus" ){
-		debug_print("StandAlone::Top::handler: before post_mystatus...");
+		debug_print("Standalone::Top::handler: before post_mystatus...");
 		post_mystatus($af, $cgi->param("my_currentstatus"));
-		debug_print("StandAlone::Top::handler: after post_mystatus...");
+		debug_print("Standalone::Top::handler: after post_mystatus...");
 	    }
 	}catch Error with{
 	    my $e = shift;
@@ -69,7 +69,7 @@
 	= "$af->{site__tmpl_dir}/owner_side/admin_top.tmpl";
 	
 	show($af, $cgi, $out_ref);
-	debug_print("StandAlone::Top::handler: end.");
+	debug_print("Standalone::Top::handler: end.");
     }
 
     #######################################################################
@@ -79,13 +79,13 @@
 	my $af = shift;
 	my $currentstatus = shift;
 
-	debug_print("StandAlone::Top::post_mystatus: start [$currentstatus]");
+	debug_print("Standalone::Top::post_mystatus: start [$currentstatus]");
 
 	$af->{user__currentstatus} = $currentstatus;
 
 	$af->getPM->save_profile();
 
-	debug_print("StandAlone::MyStatus::post end");
+	debug_print("Standalone::MyStatus::post end");
     }
 
     #######################################################################
@@ -95,7 +95,7 @@
 	my $af= shift;
 	my $q=shift;
 	my $out_ref = shift;
-	debug_print("StandAlone::Top::show start.");
+	debug_print("Standalone::Top::show start.");
 
 	use Affelio::App::Standalone::Admin::NeighborNews;
 	Affelio::App::Standalone::Admin::NeighborNews::show_news($af, $out_ref);
@@ -104,11 +104,11 @@
 	Affelio::App::Standalone::Admin::AffelioNews::getnews($af, $out_ref);
 
 	$out_ref->{my_currentstatus}= $af->{user__currentstatus};
+	$out_ref->{html__head_area} = '<script src="'.$out_ref->{tmpl_path}.'/admin-ajax.js"></script>';
+	$out_ref->{html__body_attr} = 'onLoad="javaScript:getNews()"';
 
-	debug_print("StandAlone::Top::show end.");
+	debug_print("Standalone::Top::show end.");
     }
-
-
 }
 1;
 


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