Messages: Misc improvements. Ability to set usage type(s) on Destinations for From field.
This commit is contained in:
+25
-11
@@ -42,6 +42,7 @@
|
||||
//get (from) destinations
|
||||
$sql = "select destination_number from v_destinations ";
|
||||
$sql .= "where domain_uuid = '".$domain_uuid."' ";
|
||||
$sql .= "and destination_type_text = 1 ";
|
||||
$sql .= "and destination_enabled = 'true' ";
|
||||
$sql .= "order by destination_number asc ";
|
||||
$prep_statement = $db->prepare(check_sql($sql));
|
||||
@@ -99,6 +100,10 @@
|
||||
echo " vertical-align: middle;\n";
|
||||
echo " }\n";
|
||||
|
||||
echo " td.contact_selected {\n";
|
||||
echo " border-right: 5px solid ".($SESSION['theme']['table_row_border_color']['text'] != '' ? $SESSION['theme']['table_row_border_color']['text'] : '#c5d1e5').";\n";
|
||||
echo " }\n";
|
||||
|
||||
echo "</style>\n";
|
||||
|
||||
//new message layer
|
||||
@@ -175,16 +180,17 @@
|
||||
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <th width='25%'>".$text['label-contacts']."</th>\n";
|
||||
echo " <th width='75%'>".$text['label-messages']."</th>\n";
|
||||
echo " <th style='white-space: nowrap;'><nobr>".$text['label-messages']."<nobr></th>\n";
|
||||
echo " <th width='75%' style='text-align: right; font-weight: normal;' id='contact_current_name'></th>\n";
|
||||
echo " </tr>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td id='contacts' valign='top'>...</td>\n";
|
||||
echo " <td id='thread' valign='top' style='border-color: #c5d1e5; border-style: solid; border-width: 0 1px 1px 1px; padding: 15px;'>...</td>\n";
|
||||
echo " <td id='contacts' valign='top'><center>···</center></td>\n";
|
||||
echo " <td id='thread' colspan='2' valign='top' style='border-left: 1px solid #c5d1e5; padding: 15px;'><center>···</center></td>\n";
|
||||
echo " </tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "<br /><br />";
|
||||
echo "<input type='hidden' id='contact_current_number' value=''>\n";
|
||||
|
||||
//js to load messages for clicked number
|
||||
//js to load messages for clicked number
|
||||
echo "<script>\n";
|
||||
|
||||
$refresh_contacts = is_numeric($_SESSION['message']['refresh_contacts']['numeric']) && $_SESSION['message']['refresh_contacts']['numeric'] > 0 ? $_SESSION['message']['refresh_contacts']['numeric'] : 10; //default (seconds)
|
||||
@@ -196,7 +202,7 @@
|
||||
|
||||
echo " function refresh_contacts() {\n";
|
||||
echo " clearTimeout(timer_contacts);\n";
|
||||
echo " $('#contacts').load('messages_contacts.php', function(){\n";
|
||||
echo " $('#contacts').load('messages_contacts.php?sel=' + $('#contact_current_number').val(), function(){\n";
|
||||
echo " timer_contacts = setTimeout(refresh_contacts, contacts_refresh);\n";
|
||||
echo " });\n";
|
||||
echo " }\n";
|
||||
@@ -212,13 +218,17 @@
|
||||
echo " $('#message_text').focus();\n";
|
||||
echo " }\n";
|
||||
}
|
||||
echo " refresh_contacts();\n";
|
||||
echo " timer_thread = setTimeout(refresh_thread_start, thread_refresh, number);\n";
|
||||
echo " });\n";
|
||||
echo " }\n";
|
||||
|
||||
echo " function unload_thread() {\n";
|
||||
echo " clearTimeout(timer_thread);\n";
|
||||
echo " $('#thread').html('...');\n";
|
||||
echo " $('#thread').html('<center>···</center>');\n";
|
||||
echo " $('#contact_current_number').val('');\n";
|
||||
echo " $('#contact_current_name').html('');\n";
|
||||
echo " refresh_contacts();\n";
|
||||
echo " }\n";
|
||||
|
||||
echo " function refresh_thread(number, onsent) {\n";
|
||||
@@ -237,7 +247,7 @@
|
||||
echo " });\n";
|
||||
echo " }\n";
|
||||
|
||||
//refresh controls
|
||||
//refresh controls
|
||||
echo " function refresh_contacts_stop() {\n";
|
||||
echo " clearTimeout(timer_contacts);\n";
|
||||
echo " document.getElementById('contacts_refresh_state').innerHTML = \"<img src='resources/images/refresh_paused.png' style='width: 16px; height: 16px; border: none; margin-top: 1px; cursor: pointer;' onclick='refresh_contacts_start();' alt='".$text['label-refresh_enable']."' title='".$text['label-refresh_enable']."'>\";\n";
|
||||
@@ -262,7 +272,7 @@
|
||||
echo " }\n";
|
||||
echo " }\n";
|
||||
|
||||
//define form submit function
|
||||
//define form submit function
|
||||
echo " $('#message_new').submit(function(event) {\n";
|
||||
echo " event.preventDefault();\n";
|
||||
echo " $.ajax({\n";
|
||||
@@ -273,14 +283,18 @@
|
||||
echo " contentType: false,\n";
|
||||
echo " cache: false,\n";
|
||||
echo " success: function(){\n";
|
||||
echo " document.getElementById('message_new').reset();\n";
|
||||
echo " if ($.isNumeric($('#message_new_to').val())) {\n";
|
||||
echo " $('#contact_current_number').val($('#message_new_to').val());\n";
|
||||
echo " load_thread($('#message_new_to').val());\n";
|
||||
echo " }\n";
|
||||
echo " $('#message_new_layer').fadeOut(400);\n";
|
||||
echo " document.getElementById('message_new').reset();\n";
|
||||
echo " refresh_contacts();\n";
|
||||
echo " }\n";
|
||||
echo " });\n";
|
||||
echo " });\n";
|
||||
|
||||
//open message media in layer
|
||||
//open message media in layer
|
||||
echo " function display_media(id, src) {\n";
|
||||
echo " $('#message_media_layer').load('message_media.php?id=' + id + '&src=' + src + '&action=display', function(){\n";
|
||||
echo " $('#message_media_layer').fadeIn(200);\n";
|
||||
|
||||
@@ -39,6 +39,9 @@
|
||||
$language = new text;
|
||||
$text = $language->get();
|
||||
|
||||
//get selected number/contact
|
||||
$current_contact = $_GET['sel'];
|
||||
|
||||
//get the list
|
||||
if (isset($_SESSION['message']['display_last']['text']) && $_SESSION['message']['display_last']['text'] != '') {
|
||||
$array = explode(' ',$_SESSION['message']['display_last']['text']);
|
||||
@@ -94,6 +97,7 @@
|
||||
$prep_statement->execute();
|
||||
$row = $prep_statement->fetch(PDO::FETCH_NAMED);
|
||||
if (is_array($row) && sizeof($row) != 0) {
|
||||
$contact[$number]['contact_uuid'] = $field['contact_uuid'];
|
||||
$contact[$number]['contact_name_given'] = $row['contact_name_given'];
|
||||
$contact[$number]['contact_name_family'] = $row['contact_name_family'];
|
||||
}
|
||||
@@ -131,13 +135,28 @@
|
||||
if (is_array($numbers) && sizeof($numbers) != 0) {
|
||||
echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
|
||||
foreach($numbers as $number) {
|
||||
echo " <tr><td valign='top' class='".$row_style[$c]."' onclick=\"load_thread('".urlencode($number)."');\">";
|
||||
if ($contact[$number]['contact_name_given'] != '' || $contact[$number]['contact_name_family'] != '') {
|
||||
echo " <i>".escape($contact[$number]['contact_name_given'].' '.$contact[$number]['contact_name_family']).'</i>';
|
||||
echo "<span style='float: right; font-size: 65%; line-height: 60%; margin-top: 5px; margin-left: 5px;'>".escape(format_phone($number)).'</span>';
|
||||
if ($current_contact != '' && $number == $current_contact) {
|
||||
echo "<tr><td valign='top' class='".$row_style[$c]." contact_selected' style='cursor: default;'>\n";
|
||||
$selected = true;
|
||||
}
|
||||
else {
|
||||
echo " ".escape(format_phone($number));
|
||||
echo "<tr><td valign='top' class='".$row_style[$c]."' onclick=\"load_thread('".urlencode($number)."');\">\n";
|
||||
$selected = false;
|
||||
}
|
||||
if ($contact[$number]['contact_name_given'] != '' || $contact[$number]['contact_name_family'] != '') {
|
||||
echo "<i>".escape($contact[$number]['contact_name_given'].' '.$contact[$number]['contact_name_family']).'</i>';
|
||||
echo "<span style='float: right; font-size: 65%; line-height: 60%; margin-top: 5px; margin-left: 5px; margin-right: ".($selected ? '-4px' : '0').";'>".escape(format_phone($number)).'</span>';
|
||||
if ($selected) {
|
||||
$contact_name = escape($contact[$number]['contact_name_given'].' '.$contact[$number]['contact_name_family']);
|
||||
$contact_html = (permission_exists('contact_view') ? "<a href='".PROJECT_PATH."/app/contacts/contact_edit.php?id=".$contact[$number]['contact_uuid']."' target='_blank'>".$contact_name."</a>" : $contact_name)." : <a href='callto:".escape($number)."'>".escape(format_phone($number))."</a>";
|
||||
echo "<script>$('#contact_current_name').html(\"".$contact_html."\");</script>\n";
|
||||
}
|
||||
}
|
||||
else {
|
||||
echo escape(format_phone($number));
|
||||
if ($selected) {
|
||||
echo "<script>$('#contact_current_name').html(\"<a href='callto:".escape($number)."'>".escape(format_phone($number))."</a>\");</script>\n";
|
||||
}
|
||||
}
|
||||
echo "</td></tr>\n";
|
||||
$c = $c == 0 ? 1 : 0;
|
||||
|
||||
@@ -149,7 +149,7 @@
|
||||
echo "</style>\n";
|
||||
|
||||
if (!$refresh) {
|
||||
echo "<div id='thread_messages' style='max-height: 400px; overflow: auto;'>\n";
|
||||
echo "<div id='thread_messages' style='max-height: 300px; overflow: auto;'>\n";
|
||||
}
|
||||
|
||||
//output messages
|
||||
@@ -191,6 +191,9 @@
|
||||
echo "<span id='thread_bottom'></span>\n";
|
||||
}
|
||||
|
||||
//set current contact
|
||||
echo "<script>$('#contact_current_number').val('".$number."');</script>\n";
|
||||
|
||||
if (!$refresh) {
|
||||
echo "</div>\n";
|
||||
|
||||
@@ -208,9 +211,9 @@
|
||||
echo "</table>\n";
|
||||
echo "<table cellpadding='0' cellspacing='0' border='0' width='100%' style='margin-top: 15px;'>\n";
|
||||
echo " <tr>\n";
|
||||
echo " <td align='left'><input type='reset' class='btn' value='".$text['button-clear']."' onclick=\"$('#message_text').focus();\"></td>\n";
|
||||
echo " <td align='left' width='50%'><input type='reset' class='btn' value='".$text['button-clear']."' onclick=\"$('#message_text').focus();\"></td>\n";
|
||||
echo " <td align='center'><span id='thread_refresh_state'><img src='resources/images/refresh_active.gif' style='width: 16px; height: 16px; border: none; cursor: pointer;' onclick=\"refresh_thread_stop('".$number."');\" alt=\"".$text['label-refresh_pause']."\" title=\"".$text['label-refresh_pause']."\"></span></td>\n";
|
||||
echo " <td align='right'><input type='submit' class='btn' value='".$text['button-send']."' title=\"".$text['label-ctrl_enter']."\"></td>\n";
|
||||
echo " <td align='right' width='50%'><input type='submit' class='btn' value='".$text['button-send']."' title=\"".$text['label-ctrl_enter']."\"></td>\n";
|
||||
echo " </td>\n";
|
||||
echo "</table>\n";
|
||||
echo "</form>\n";
|
||||
|
||||
Reference in New Issue
Block a user