'+item.m+'');
+ $("#chatbox_"+my_user_id+" .chatboxcontent").append(''+item.m+'
');
} else {
- newMessages[chatboxtitle] = true;
- newMessagesWin[chatboxtitle] = true;
+ newMessages[my_user_id] = true;
+ newMessagesWin[my_user_id] = true;
$("#chatbox_"+chatboxtitle+" .chatboxcontent").append(''+item.f+': '+item.m+'
');
}
- $("#chatbox_"+chatboxtitle+" .chatboxcontent").scrollTop($("#chatbox_"+chatboxtitle+" .chatboxcontent")[0].scrollHeight);
+ $("#chatbox_"+my_user_id+" .chatboxcontent").scrollTop($("#chatbox_"+my_user_id+" .chatboxcontent")[0].scrollHeight);
itemsfound += 1;
}
});
@@ -238,7 +289,7 @@ function closeChatBox(chatboxtitle) {
$('#chatbox_'+chatboxtitle).css('display','none');
restructureChatBoxes();
- $.post("chat.php?action=closechat", { chatbox: chatboxtitle} , function(data){
+ $.post(ajax_url+"?action=closechat", { chatbox: chatboxtitle} , function(data){
});
}
@@ -283,7 +334,7 @@ function toggleChatBoxGrowth(chatboxtitle) {
}
-function checkChatBoxInputKey(event,chatboxtextarea,chatboxtitle) {
+function checkChatBoxInputKey(event,chatboxtextarea, user_id) {
if(event.keyCode == 13 && event.shiftKey == 0) {
message = $(chatboxtextarea).val();
@@ -292,11 +343,14 @@ function checkChatBoxInputKey(event,chatboxtextarea,chatboxtitle) {
$(chatboxtextarea).val('');
$(chatboxtextarea).focus();
$(chatboxtextarea).css('height','44px');
+
if (message != '') {
- $.post("chat.php?action=sendchat", {to: chatboxtitle, message: message} , function(data){
+ $.post(ajax_url + "?action=sendchat", {to: user_id, message: message} , function(data){
message = message.replace(//g,">").replace(/\"/g,""");
- $("#chatbox_"+chatboxtitle+" .chatboxcontent").append(''+username+': '+message+'
');
- $("#chatbox_"+chatboxtitle+" .chatboxcontent").scrollTop($("#chatbox_"+chatboxtitle+" .chatboxcontent")[0].scrollHeight);
+ $("#chatbox_"+user_id+" .chatboxcontent").append('\n\
+ '+username+': \n\
+ '+message+'
');
+ $("#chatbox_"+user_id+" .chatboxcontent").scrollTop($("#chatbox_"+user_id+" .chatboxcontent")[0].scrollHeight);
});
}
chatHeartbeatTime = minChatHeartbeat;
@@ -320,46 +374,6 @@ function checkChatBoxInputKey(event,chatboxtextarea,chatboxtitle) {
}
-function startChatSession(){
- $.ajax({
- url: "chat.php?action=startchatsession",
- cache: false,
- dataType: "json",
- success: function(data) {
-
- username = data.username;
-
- $.each(data.items, function(i,item){
- if (item) { // fix strange ie bug
-
- chatboxtitle = item.f;
-
- if ($("#chatbox_"+chatboxtitle).length <= 0) {
- createChatBox(chatboxtitle,1);
- }
-
- if (item.s == 1) {
- item.f = username;
- }
-
- if (item.s == 2) {
- $("#chatbox_"+chatboxtitle+" .chatboxcontent").append(''+item.m+'
');
- } else {
- $("#chatbox_"+chatboxtitle+" .chatboxcontent").append(''+item.f+': '+item.m+'
');
- }
- }
- });
-
- for (i=0;i';
} else {
- $img_array = UserManager::get_user_picture_path_by_id($user_id,'web',true,true);
-
+ $img_array = UserManager::get_user_picture_path_by_id($user_id,'web',true,true);
$big_image = UserManager::get_picture_user($user_id, $img_array['file'],'', USER_IMAGE_SIZE_BIG);
$big_image = $big_image['file'].'?'.uniqid();
$normal_image = $img_array['dir'].$img_array['file'].'?'.uniqid();
@@ -684,7 +683,11 @@ class SocialManager extends UserManager {
if ($user_id != api_get_user_id()) {
echo '';
- echo Display::return_icon('compose_message.png',get_lang('SendMessage')).' '.get_lang('SendMessage').'';
+ echo Display::return_icon('compose_message.png',get_lang('SendMessage')).' '.get_lang('SendMessage').'';
+
+ $user_info = api_get_user_info($user_id);
+ $user_name =$user_info['complete_name'];
+ echo Display::tag('li', Display::url(Display::return_icon('chat.gif').get_lang('chat'), 'javascript:void(0);', array('onclick' => "javascript:chatWith('".$user_id."', '".$user_name."')")));
}
//check if I already sent an invitation message