Tadashi Okoshi
slash****@users*****
2005年 6月 28日 (火) 01:15:09 JST
Index: affelio/lib/Affelio/App/Admin/Messaging.pm diff -u affelio/lib/Affelio/App/Admin/Messaging.pm:1.4 affelio/lib/Affelio/App/Admin/Messaging.pm:1.5 --- affelio/lib/Affelio/App/Admin/Messaging.pm:1.4 Tue Jun 28 00:29:19 2005 +++ affelio/lib/Affelio/App/Admin/Messaging.pm Tue Jun 28 01:15:09 2005 @@ -4,7 +4,7 @@ # http://affelio.jp/ (Japan) # http://affelio.jp/ (USA and other area) # -# $Id: Messaging.pm,v 1.4 2005/06/27 15:29:19 slash5234 Exp $ +# $Id: Messaging.pm,v 1.5 2005/06/27 16:15:09 slash5234 Exp $ package Affelio::App::Admin::Messaging; { @@ -38,7 +38,7 @@ my $msg_to = $cgi->param("msg_to"); my $msg_title = $cgi->param("msg_title"); my $msg_body = $cgi->param("msg_body"); - + debug_print("Mesg::send: $msg_to $msg_title $msg_body"); my $passAB = $af->{fm}->get_attribute_by_afid($msg_to, "password"); @@ -81,22 +81,47 @@ ####################################################################### sub compose{ my $af = shift; + my $cgi = shift; my $output_ref = shift; my $wi = new Affelio::misc::WebInput; + my $reply_to = $cgi->param("reply_to"); + my $reply_title = $cgi->param("reply_title"); + my $reply_body = $cgi->param("reply_body"); + debug_print("Messaging::compose: start."); + debug_print("Messaging::compose: Reply-To: [$reply_to]"); + + ############################ + #To: + ############################ my @friends_list=(); my $result = $af->{fm}->get_all_friend_list(); - while( my @row = $result->fetchrow_array ){ + + my $selected = ""; + if($row[1] eq $reply_to){ + $selected ="selected"; + } push(@friends_list, {nickname => $row[2], - afid => $row[1]}); + afid => $row[1], + selected => $selected}); debug_print("Messaging::\t$row[2]"); - } - $output_ref->{"friends"} = \@friends_list; + + ############################ + #Title: + ############################ + $output_ref->{"msg_title"} = $reply_title; + + ############################ + #Body: + ############################ + $output_ref->{"msg_body"} = $reply_body; + + debug_print("Messaging::compose: end."); } @@ -148,9 +173,41 @@ my ($msg_mid, $msg_timestamp, $msg_title, $msg_type, $msg_from, $msg_body, $msg_readflag) = @message; + debug_print("show_message: $msg_from $msg_title $msg_type"); + $msg_timestamp = timestamp2string($msg_timestamp); - $msg_body =~s/<A /<A target="_blank" /g; + if($msg_type=~ /UserToUser/){ + my $reply_title = "Re: $msg_title"; + my $reply_body = $msg_body; + $reply_body =~ s/\r\n/\n/g; + $reply_body =~ s/\r/\n/g; + $reply_body =~ s/\n/>>\n/g; + $reply_body = "\r\n\r\n>>" . $reply_body; + + my $reply_to=""; + if($msg_from =~ /HREF="(.+)">/){ + $reply_to = $1; + } + + my $reply_HTML = <<EOT; +<FORM METHOD="POST" ACTION="admin.cgi?mode=messages&action=compose"> +<INPUT TYPE="hidden" NAME="reply_to" VALUE="$reply_to"> +<INPUT TYPE="hidden" NAME="reply_title" VALUE="$reply_title"> +<INPUT TYPE="hidden" NAME="reply_body" VALUE="$reply_body"> +<INPUT TYPE="submit" VALUE="<AF_M text="Reply">"> +</FORM> +EOT + $$output_ref{"reply_HTML"} = $reply_HTML; + + } + + #URL ---> <A HREF="URL">URL</A> + $msg_body = $wi->translate_URL_to_HTML($msg_body); + #\n ----> <BR> + $msg_body =~ s/\r\n/\n/g; + $msg_body =~ s/\r/\n/g; + $msg_body =~ s/\n/<BR>/g; $$output_ref{"msg_timestamp"} = $msg_timestamp; $$output_ref{"msg_title"} = $msg_title;