diff --git a/main/inc/lib/message.lib.php b/main/inc/lib/message.lib.php
index a6155c0061..372627e356 100755
--- a/main/inc/lib/message.lib.php
+++ b/main/inc/lib/message.lib.php
@@ -1389,8 +1389,8 @@ class MessageManager
$form = new FormValidator('send_message', null, 'post', null, array('id' => $id.'_form', 'class' => 'form-vertical'));
$form->addElement('text', 'subject', get_lang('Subject'), array('id' => 'subject_id', 'class' => 'span5'));
$form->addElement('textarea', 'content', get_lang('Message'), array('id' => 'content_id', 'rows' => '5', 'class' => 'span5'));
- $div = Display::div($form->return_form(), array('id' => $id.'_div', 'style' => 'display:none'));
- return $div;
+
+ return $form->return_form();
}
public static function generate_invitation_form($id, $params = array())
diff --git a/main/inc/lib/social.lib.php b/main/inc/lib/social.lib.php
index d30b3c25fa..c1898252de 100755
--- a/main/inc/lib/social.lib.php
+++ b/main/inc/lib/social.lib.php
@@ -760,7 +760,7 @@ class SocialManager extends UserManager
// My friend profile.
if ($user_id != api_get_user_id()) {
- $html .= '
';
+ $html .= '';
$html .= Display::return_icon('compose_message.png', get_lang('SendMessage')).' '.get_lang('SendMessage').'';
}
diff --git a/main/social/profile.php b/main/social/profile.php
index 360a19376a..2d3e8a2cd7 100755
--- a/main/social/profile.php
+++ b/main/social/profile.php
@@ -144,47 +144,6 @@ function checkLength( o, n, min, max ) {
}
}
-function send_message_to_user(user_id) {
- var subject = $( "#subject_id" );
- var content = $( "#content_id" );
-
- $("#send_message_form").show();
- $("#send_message_div").dialog({
- modal:true,
- height:350,
- buttons: {
- "'. addslashes(get_lang('Send')).'": function() {
- var bValid = true;
- bValid = bValid && checkLength( subject, "subject", 1, 255 );
- bValid = bValid && checkLength( content, "content", 1, 255 );
-
- if ( bValid ) {
- var url = "'.$ajax_url.'?a=send_message&user_id="+user_id;
- var params = $("#send_message_form").serialize();
- $.ajax({
- url: url+"&"+params,
- success:function(data) {
- $("#message_ajax_reponse").attr("class", "");
- $("#message_ajax_reponse").html(data);
- $("#message_ajax_reponse").show();
- $("#send_message_div").dialog({ buttons:{}});
- $("#send_message_form").hide();
- $("#send_message_div").dialog("close");
-
- $("#subject_id").val("");
- $("#content_id").val("");
- }
- });
- }
- }
- },
- close: function() {
- }
- });
- $("#send_message_div").dialog("open");
- //prevent the browser to follow the link
-}
-
function send_invitation_to_user(user_id) {
var content = $( "#content_invitation_id" );
$("#send_invitation_form").show();
@@ -878,7 +837,7 @@ if ($show_full_profile) {
$socialRightInformation .= SocialManager::social_wrapper_div($more_info, 4);
}
}
-$social_right_content .= MessageManager::generate_message_form('send_message');
+
$social_right_content .= MessageManager::generate_invitation_form('send_invitation');
@@ -895,6 +854,13 @@ $tpl->assign('social_skill_block', $social_skill_block);
$tpl->assign('social_session_block', $social_session_block);
$tpl->assign('socialRightInformation', $socialRightInformation);
$tpl->assign('socialAutoExtendLink', $socialAutoExtendLink);
+
+$formModalTpl = new Template();
+$formModalTpl->assign('friendId', $friendId);
+$formModalTpl->assign('messageForm', MessageManager::generate_message_form('send_message'));
+$formModals = $formModalTpl->fetch('default/social/form_modals.tpl');
+
+$tpl->assign('formModals', $formModals);
$social_layout = $tpl->get_template('social/profile.tpl');
$tpl->display($social_layout);
diff --git a/main/template/default/social/form_modals.tpl b/main/template/default/social/form_modals.tpl
new file mode 100644
index 0000000000..3ed7160fcc
--- /dev/null
+++ b/main/template/default/social/form_modals.tpl
@@ -0,0 +1,44 @@
+
+
+
diff --git a/main/template/default/social/profile.tpl b/main/template/default/social/profile.tpl
index 4a08a53379..c94b46eb5a 100644
--- a/main/template/default/social/profile.tpl
+++ b/main/template/default/social/profile.tpl
@@ -33,4 +33,7 @@
+ {% if formModals is defined %}
+ {{ formModals }}
+ {% endif %}
{% endblock %}
\ No newline at end of file