Fix contact image bug in Messages.

This commit is contained in:
Nate
2019-09-23 08:38:25 -06:00
parent 57e60d0674
commit cdf9d82d7c
3 changed files with 27 additions and 30 deletions

View File

@@ -17,7 +17,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2016-2018 Portions created by the Initial Developer are Copyright (C) 2016-2019
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@@ -88,10 +88,10 @@
echo " #message_new_layer {\n"; echo " #message_new_layer {\n";
echo " z-index: 999999;\n"; echo " z-index: 999999;\n";
echo " position: absolute;\n"; echo " position: absolute;\n";
echo " left: 0px;\n"; echo " left: 0;\n";
echo " top: 0px;\n"; echo " top: 0;\n";
echo " right: 0px;\n"; echo " right: 0;\n";
echo " bottom: 0px;\n"; echo " bottom: 0;\n";
echo " text-align: center;\n"; echo " text-align: center;\n";
echo " vertical-align: middle;\n"; echo " vertical-align: middle;\n";
echo " }\n"; echo " }\n";
@@ -115,10 +115,10 @@
echo " #message_media_layer {\n"; echo " #message_media_layer {\n";
echo " z-index: 999999;\n"; echo " z-index: 999999;\n";
echo " position: absolute;\n"; echo " position: absolute;\n";
echo " left: 0px;\n"; echo " left: 0;\n";
echo " top: 0px;\n"; echo " top: 0;\n";
echo " right: 0px;\n"; echo " right: 0;\n";
echo " bottom: 0px;\n"; echo " bottom: 0;\n";
echo " text-align: center;\n"; echo " text-align: center;\n";
echo " vertical-align: middle;\n"; echo " vertical-align: middle;\n";
echo " }\n"; echo " }\n";
@@ -255,7 +255,7 @@
echo " function load_thread(number, contact_uuid) {\n"; echo " function load_thread(number, contact_uuid) {\n";
echo " clearTimeout(timer_thread);\n"; echo " clearTimeout(timer_thread);\n";
echo " $('#thread').load('messages_thread.php?number=' + encodeURIComponent(number) + '&contact_uuid=' + encodeURIComponent(contact_uuid), function(){\n"; echo " $('#thread').load('messages_thread.php?number=' + encodeURIComponent(number) + '&contact_uuid=' + encodeURIComponent(contact_uuid), function(){\n";
echo " $('div#thread_messages').animate({ 'max-height': $(window).height() - 450 }, 200, function() {\n"; echo " $('div#thread_messages').animate({ 'max-height': $(window).height() - 470 }, 200, function() {\n";
echo " $('#thread_messages').scrollTop(Number.MAX_SAFE_INTEGER);\n"; //chrome echo " $('#thread_messages').scrollTop(Number.MAX_SAFE_INTEGER);\n"; //chrome
echo " $('span#thread_bottom')[0].scrollIntoView(true);\n"; //others echo " $('span#thread_bottom')[0].scrollIntoView(true);\n"; //others
//note: the order of the above two lines matters! //note: the order of the above two lines matters!
@@ -280,7 +280,7 @@
echo " function refresh_thread(number, contact_uuid, onsent) {\n"; echo " function refresh_thread(number, contact_uuid, onsent) {\n";
echo " $('#thread_messages').load('messages_thread.php?refresh=true&number=' + encodeURIComponent(number) + '&contact_uuid=' + encodeURIComponent(contact_uuid), function(){\n"; echo " $('#thread_messages').load('messages_thread.php?refresh=true&number=' + encodeURIComponent(number) + '&contact_uuid=' + encodeURIComponent(contact_uuid), function(){\n";
echo " $('div#thread_messages').animate({ 'max-height': $(window).height() - 450 }, 200, function() {\n"; echo " $('div#thread_messages').animate({ 'max-height': $(window).height() - 470 }, 200, function() {\n";
echo " $('#thread_messages').scrollTop(Number.MAX_SAFE_INTEGER);\n"; //chrome echo " $('#thread_messages').scrollTop(Number.MAX_SAFE_INTEGER);\n"; //chrome
echo " $('span#thread_bottom')[0].scrollIntoView(true);\n"; //others echo " $('span#thread_bottom')[0].scrollIntoView(true);\n"; //others
//note: the order of the above two lines matters! //note: the order of the above two lines matters!

View File

@@ -133,7 +133,7 @@
unset($sql, $parameters, $rows, $row); unset($sql, $parameters, $rows, $row);
if (!is_null(array_diff($numbers, $destinations))) { if (!is_null(array_diff($numbers, $destinations))) {
$numbers = array_diff($numbers, $destinations); $numbers = array_diff($numbers, $destinations);
} }
//get contact (primary attachment) images and cache them //get contact (primary attachment) images and cache them
@@ -222,4 +222,4 @@
echo "</script>\n"; echo "</script>\n";
} }
?> ?>

View File

@@ -17,7 +17,7 @@
The Initial Developer of the Original Code is The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com> Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2016-2018 Portions created by the Initial Developer are Copyright (C) 2016-2019
the Initial Developer. All Rights Reserved. the Initial Developer. All Rights Reserved.
Contributor(s): Contributor(s):
@@ -220,23 +220,20 @@
//message bubble //message bubble
echo "<span class='message-bubble message-bubble-".($message['message_direction'] == 'inbound' ? 'em' : 'me')."'>"; echo "<span class='message-bubble message-bubble-".($message['message_direction'] == 'inbound' ? 'em' : 'me')."'>";
//contact image em //contact image em
if ( if ($message['message_direction'] == 'inbound') {
$message['message_direction'] == 'inbound' && if (is_array($_SESSION['tmp']['messages']['contact_em'][$contact_uuid]) && @sizeof($_SESSION['tmp']['messages']['contact_em'][$contact_uuid]) != 0) {
is_array($_SESSION['tmp']['messages']['contact_em'][$contact_uuid]) && echo "<div class='message-bubble-image-em'>\n";
@sizeof($_SESSION['tmp']['messages']['contact_em'][$contact_uuid]) != 0 echo " <img class='message-bubble-image-em'><br />\n";
) { echo "</div>\n";
echo "<div class='message-bubble-image-em'>\n"; }
echo " <img class='message-bubble-image-em'><br />\n";
echo "</div>\n";
} }
//contact image me //contact image me
else if ( else {
is_array($_SESSION['tmp']['messages']['contact_me']) && if (is_array($_SESSION['tmp']['messages']['contact_me']) && @sizeof($_SESSION['tmp']['messages']['contact_me']) != 0) {
@sizeof($_SESSION['tmp']['messages']['contact_me']) != 0 echo "<div class='message-bubble-image-me'>\n";
) { echo " <img class='message-bubble-image-me'><br />\n";
echo "<div class='message-bubble-image-me'>\n"; echo "</div>\n";
echo " <img class='message-bubble-image-me'><br />\n"; }
echo "</div>\n";
} }
echo "<div style='display: table;'>\n"; echo "<div style='display: table;'>\n";
//message //message
@@ -335,4 +332,4 @@
} }
} }
?> ?>