Active Calls responsive design update

This commit is contained in:
FusionPBX 2024-12-07 13:28:27 -07:00 committed by GitHub
parent f0bc1cfe33
commit e1cfb7931e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 192 additions and 182 deletions

View File

@ -468,8 +468,8 @@ $text['label-domain']['zh-cn'] = "领域";
$text['label-domain']['ja-jp'] = "ドメイン"; $text['label-domain']['ja-jp'] = "ドメイン";
$text['label-domain']['ko-kr'] = "도메인"; $text['label-domain']['ko-kr'] = "도메인";
$text['label-destination']['en-us'] = "Dest"; $text['label-destination']['en-us'] = "Destination";
$text['label-destination']['en-gb'] = "Dest"; $text['label-destination']['en-gb'] = "Destination";
$text['label-destination']['ar-eg'] = "الوجهة"; $text['label-destination']['ar-eg'] = "الوجهة";
$text['label-destination']['de-at'] = "Ziel"; $text['label-destination']['de-at'] = "Ziel";
$text['label-destination']['de-ch'] = "Ziel"; $text['label-destination']['de-ch'] = "Ziel";
@ -546,8 +546,8 @@ $text['label-codec']['zh-cn'] = "读/写编解码器";
$text['label-codec']['ja-jp'] = "読み取り/書き込みコーデック"; $text['label-codec']['ja-jp'] = "読み取り/書き込みコーデック";
$text['label-codec']['ko-kr'] = "읽기/쓰기 코덱"; $text['label-codec']['ko-kr'] = "읽기/쓰기 코덱";
$text['label-cid-number']['en-us'] = "CID Number"; $text['label-cid-number']['en-us'] = "Caller Number";
$text['label-cid-number']['en-gb'] = "CID Number"; $text['label-cid-number']['en-gb'] = "Caller Number";
$text['label-cid-number']['ar-eg'] = "رقم CID"; $text['label-cid-number']['ar-eg'] = "رقم CID";
$text['label-cid-number']['de-at'] = "Anrufer Nummer"; $text['label-cid-number']['de-at'] = "Anrufer Nummer";
$text['label-cid-number']['de-ch'] = "Anrufer Nummer"; $text['label-cid-number']['de-ch'] = "Anrufer Nummer";
@ -572,8 +572,8 @@ $text['label-cid-number']['zh-cn'] = "来电号码";
$text['label-cid-number']['ja-jp'] = "CID番号"; $text['label-cid-number']['ja-jp'] = "CID番号";
$text['label-cid-number']['ko-kr'] = "CID 번호"; $text['label-cid-number']['ko-kr'] = "CID 번호";
$text['label-cid-name']['en-us'] = "CID Name"; $text['label-cid-name']['en-us'] = "Caller Name";
$text['label-cid-name']['en-gb'] = "CID Name"; $text['label-cid-name']['en-gb'] = "Caller Name";
$text['label-cid-name']['ar-eg'] = "اسم CID"; $text['label-cid-name']['ar-eg'] = "اسم CID";
$text['label-cid-name']['de-at'] = "Anrufer Name"; $text['label-cid-name']['de-at'] = "Anrufer Name";
$text['label-cid-name']['de-ch'] = "Anrufer Name"; $text['label-cid-name']['de-ch'] = "Anrufer Name";

View File

@ -88,10 +88,8 @@
} }
$num_rows = @sizeof($rows); $num_rows = @sizeof($rows);
//if the connnection is available then run it and return the results //if the connnection is available then run it and return the results
if (!$event_socket) { if (!$event_socket) {
$msg = "<div align='center'>".$text['confirm-socket']."<br /></div>"; $msg = "<div align='center'>".$text['confirm-socket']."<br /></div>";
echo "<div align='center'>\n"; echo "<div align='center'>\n";
echo "<table width='40%'>\n"; echo "<table width='40%'>\n";
@ -103,191 +101,203 @@
echo "</tr>\n"; echo "</tr>\n";
echo "</table>\n"; echo "</table>\n";
echo "</div>\n"; echo "</div>\n";
return;
} }
else {
//create token //create token
$object = new token; $object = new token;
$token = $object->create('/app/calls_active/calls_active_inc.php'); $token = $object->create('/app/calls_active/calls_active_inc.php');
//show content //add the style
echo "<div class='action_bar' id='action_bar'>\n"; echo "<style>\n";
echo " <div class='heading'><b>".$text['title']."</b><div class='count'>".number_format($num_rows)."</div></div>\n"; echo " /* Small screens: Hide columns with class 'hide-small' */\n";
echo " <div class='actions'>\n"; echo " @media (max-width: 600px) {\n";
echo " <span id='refresh_state'>".button::create(['type'=>'button','title'=>$text['label-refresh_pause'],'icon'=>'sync-alt fa-spin','onclick'=>'refresh_stop()'])."</span>"; echo " .hide-small {\n";
if (permission_exists('call_active_eavesdrop') && !empty($_SESSION['user']['extensions'])) { echo " display: none;\n";
if (sizeof($_SESSION['user']['extensions']) > 1) { echo " }\n";
echo " <input type='hidden' id='eavesdrop_dest' value=\"".(($_REQUEST['eavesdrop_dest'] == '') ? $_SESSION['user']['extension'][0]['destination'] : escape($_REQUEST['eavesdrop_dest']))."\">\n"; echo " }\n";
echo " <i class='fas fa-headphones' style='margin-left: 15px; cursor: help;' title='".$text['description-eavesdrop_destination']."' align='absmiddle'></i>\n"; echo "\n";
echo " <select class='formfld' style='margin-right: 5px;' align='absmiddle' onchange=\"document.getElementById('eavesdrop_dest').value = this.options[this.selectedIndex].value; refresh_start();\" onfocus='refresh_stop();'>\n"; echo " /* Medium screens: Hide columns with class 'hide-medium' */\n";
if (is_array($_SESSION['user']['extensions'])) { echo "@media (max-width: 1023px) and (min-width: 601px) {\n";
foreach ($_SESSION['user']['extensions'] as $user_extension) { echo " .hide-medium {\n";
echo " <option value='".escape($user_extension)."' ".(($_REQUEST['eavesdrop_dest'] == $user_extension) ? "selected" : null).">".escape($user_extension)."</option>\n"; echo " display: none;\n";
} echo " }\n";
echo " }\n";
echo "\n";
echo "</style>\n";
//show the content
echo "<div class='action_bar' id='action_bar'>\n";
echo " <div class='heading'><b>".$text['title']."</b><div class='count'>".number_format($num_rows)."</div></div>\n";
echo " <div class='actions'>\n";
echo " <span id='refresh_state'>".button::create(['type'=>'button','title'=>$text['label-refresh_pause'],'icon'=>'sync-alt fa-spin','onclick'=>'refresh_stop()'])."</span>";
if (permission_exists('call_active_eavesdrop') && !empty($_SESSION['user']['extensions'])) {
if (sizeof($_SESSION['user']['extensions']) > 1) {
echo " <input type='hidden' id='eavesdrop_dest' value=\"".(($_REQUEST['eavesdrop_dest'] == '') ? $_SESSION['user']['extension'][0]['destination'] : escape($_REQUEST['eavesdrop_dest']))."\">\n";
echo " <i class='fas fa-headphones' style='margin-left: 15px; cursor: help;' title='".$text['description-eavesdrop_destination']."' align='absmiddle'></i>\n";
echo " <select class='formfld' style='margin-right: 5px;' align='absmiddle' onchange=\"document.getElementById('eavesdrop_dest').value = this.options[this.selectedIndex].value; refresh_start();\" onfocus='refresh_stop();'>\n";
if (is_array($_SESSION['user']['extensions'])) {
foreach ($_SESSION['user']['extensions'] as $user_extension) {
echo " <option value='".escape($user_extension)."' ".(($_REQUEST['eavesdrop_dest'] == $user_extension) ? "selected" : null).">".escape($user_extension)."</option>\n";
}
}
echo " </select>\n";
}
else if (sizeof($_SESSION['user']['extensions']) == 1) {
echo " <input type='hidden' id='eavesdrop_dest' value=\"".escape($_SESSION['user']['extension'][0]['destination'])."\">\n";
}
}
if (permission_exists('call_active_hangup') && $rows) {
echo button::create(['type'=>'button','label'=>$text['label-hangup'],'icon'=>'phone-slash','id'=>'btn_delete','onclick'=>"refresh_stop(); modal_open('modal-hangup','btn_hangup');"]);
}
if (permission_exists('call_active_all')) {
if ($show == "all") {
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'link'=>'calls_active.php','onmouseover'=>'refresh_stop()','onmouseout'=>'refresh_start()']);
}
else {
echo button::create(['type'=>'button','label'=>$text['button-show_all'],'icon'=>$_SESSION['theme']['button_icon_all'],'link'=>'calls_active.php?show=all','onmouseover'=>'refresh_stop()','onmouseout'=>'refresh_start()']);
}
}
echo " </div>\n";
echo " <div style='clear: both;'></div>\n";
echo "</div>\n";
if (permission_exists('call_active_hangup') && $rows) {
echo modal::create(['id'=>'modal-hangup','type'=>'general','message'=>$text['confirm-hangups'],'actions'=>button::create(['type'=>'button','label'=>$text['label-hangup'],'icon'=>'check','id'=>'btn_hangup','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('hangup'); list_form_submit('form_list');"])]);
}
echo $text['description']."\n";
echo "<br /><br />\n";
//show the results
echo "<div id='cmd_reponse'></div>\n";
echo "<form id='form_list' method='post' action='calls_exec.php'>\n";
echo "<input type='hidden' id='action' name='action' value=''>\n";
echo "<div class='card'>\n";
echo " <table class='list'>\n";
echo " <tr class='list-header'>\n";
if (permission_exists('call_active_hangup')) {
echo " <th class='checkbox'>\n";
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='if (this.checked) { refresh_stop(); } else { refresh_start(); } list_all_toggle();' ".(empty($rows) ? "style='visibility: hidden;'" : null).">\n";
echo " </th>\n";
}
echo " <th class='hide-small'>".$text['label-profile']."</th>\n";
//echo" <th>".$text['label-created']."</th>\n";
echo " <th>".$text['label-duration']."</th>\n";
if ($show == 'all') {
echo " <th>".$text['label-domain']."</th>\n";
}
//echo " <th>".$text['label-number']."</th>\n";
echo " <th class='hide-small'>".$text['label-cid-name']."</th>\n";
echo " <th>".$text['label-cid-number']."</th>\n";
echo " <th>".$text['label-destination']."</th>\n";
echo " <th class='hide-small hide-medium'>".$text['label-app']."</th>\n";
echo " <th class='hide-small hide-medium'>".$text['label-codec']."</th>\n";
echo " <th class='hide-small hide-medium'>".$text['label-secure']."</th>\n";
if (permission_exists('call_active_eavesdrop') || permission_exists('call_active_hangup')) {
echo " <th>&nbsp;</th>\n";
}
echo " </tr>\n";
if (is_array($rows)) {
$x = 0;
foreach ($rows as $row) {
//set the php variables
foreach ($row as $key => $value) {
$$key = $value;
}
//get the sip profile
$name_array = explode("/", $name);
$sip_profile = $name_array[1];
$sip_uri = $name_array[2];
//get the number
//$temp_array = explode("@", $sip_uri);
//$tmp_number = $temp_array[0];
//$tmp_number = str_replace("sip:", "", $tmp_number);
//remove the '+' because it breaks the call recording
$cid_num = str_replace("+", "", $cid_num);
//replace gateway uuid with name
if (is_array($_SESSION['gateways']) && sizeof($_SESSION['gateways']) > 0) {
foreach ($_SESSION['gateways'] as $gateway_uuid => $gateway_name) {
$application_data = str_replace($gateway_uuid, $gateway_name, $application_data);
} }
echo " </select>\n";
} }
else if (sizeof($_SESSION['user']['extensions']) == 1) {
echo " <input type='hidden' id='eavesdrop_dest' value=\"".escape($_SESSION['user']['extension'][0]['destination'])."\">\n"; //convert $created to a UNIX timestamp
$created_timestamp = strtotime($created);
//get the current timestamp
$now = time();
//calculate elapsed seconds
$elapsed_seconds = $now - $created_timestamp;
//convert seconds to hours, minutes, and seconds
$hours = floor($elapsed_seconds / 3600);
$minutes = floor(($elapsed_seconds % 3600) / 60);
$seconds = $elapsed_seconds % 60;
//format the elapsed time as HH:MM:SS
$elapsed_time = sprintf('%02d:%02d:%02d', $hours, $minutes, $seconds);
//reduce too long app data
if(strlen($application_data) > 80) {
$application_data = substr($application_data, 0, 80) . '...';
} }
}
if (permission_exists('call_active_hangup') && $rows) { //send the html
echo button::create(['type'=>'button','label'=>$text['label-hangup'],'icon'=>'phone-slash','id'=>'btn_delete','onclick'=>"refresh_stop(); modal_open('modal-hangup','btn_hangup');"]); echo " <tr class='list-row'>\n";
} if (permission_exists('call_active_hangup')) {
if (permission_exists('call_active_all')) { echo " <td class='checkbox'>\n";
if ($show == "all") { echo " <input type='checkbox' name='calls[$x][checked]' id='checkbox_".$x."' value='true' onclick=\"if (this.checked) { refresh_stop(); } else { document.getElementById('checkbox_all').checked = false; }\">\n";
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'link'=>'calls_active.php','onmouseover'=>'refresh_stop()','onmouseout'=>'refresh_start()']); echo " <input type='hidden' name='calls[$x][uuid]' value='".escape($uuid)."' />\n";
echo " </td>\n";
} }
else { echo " <td class='hide-small'>".escape($sip_profile)."&nbsp;</td>\n";
echo button::create(['type'=>'button','label'=>$text['button-show_all'],'icon'=>$_SESSION['theme']['button_icon_all'],'link'=>'calls_active.php?show=all','onmouseover'=>'refresh_stop()','onmouseout'=>'refresh_start()']); //echo " <td>".escape($created)."&nbsp;</td>\n";
echo " <td>".escape($elapsed_time)."</td>\n";
if ($show == 'all') {
echo " <td>".escape($domain_name)."&nbsp;</td>\n";
} }
} //echo " <td>".escape($tmp_number)."&nbsp;</td>\n";
echo " </div>\n"; echo " <td class='hide-small'>".escape($cid_name)."&nbsp;</td>\n";
echo " <div style='clear: both;'></div>\n"; echo " <td>".escape($cid_num)."&nbsp;</td>\n";
echo "</div>\n"; echo " <td>".escape($dest)."&nbsp;</td>\n";
echo " <td class='hide-small hide-medium' style='max-width: 200px; word-wrap: break-word;'>".(!empty($application) ? escape($application).":".escape($application_data) : null)."&nbsp;</td>\n";
if (permission_exists('call_active_hangup') && $rows) { echo " <td class='hide-small hide-medium'>".escape($read_codec).":".escape($read_rate)." / ".escape($write_codec).":".escape($write_rate)."&nbsp;</td>\n";
echo modal::create(['id'=>'modal-hangup','type'=>'general','message'=>$text['confirm-hangups'],'actions'=>button::create(['type'=>'button','label'=>$text['label-hangup'],'icon'=>'check','id'=>'btn_hangup','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('hangup'); list_form_submit('form_list');"])]); echo " <td class='hide-small hide-medium'>".escape($secure)."&nbsp;</td>\n";
} if (permission_exists('call_active_eavesdrop') || permission_exists('call_active_hangup')) {
echo " <td class='button right' style='padding-right: 0;'>\n";
echo $text['description']."\n"; //eavesdrop
echo "<br /><br />\n"; if (permission_exists('call_active_eavesdrop') && $callstate == 'ACTIVE' && !empty($_SESSION['user']['extensions']) && !in_array($cid_num, $_SESSION['user']['extensions'])) {
echo button::create(['type'=>'button','label'=>$text['label-eavesdrop'],'icon'=>'headphones','collapse'=>'hide-lg-dn','onclick'=>"if (confirm('".$text['confirm-eavesdrop']."')) { eavesdrop_call('".escape($cid_num)."','".escape($uuid)."'); } else { this.blur(); return false; }",'onmouseover'=>'refresh_stop()','onmouseout'=>'refresh_start()']);
//show the results }
echo "<div id='cmd_reponse'></div>\n"; //hangup
if (permission_exists('call_active_hangup')) {
echo "<form id='form_list' method='post' action='calls_exec.php'>\n"; echo button::create(['type'=>'button','label'=>$text['label-hangup'],'icon'=>'phone-slash','collapse'=>'hide-lg-dn','onclick'=>"if (confirm('".$text['confirm-hangup']."')) { list_self_check('checkbox_".$x."'); list_action_set('hangup'); list_form_submit('form_list'); } else { this.blur(); return false; }",'onmouseover'=>'refresh_stop()','onmouseout'=>'refresh_start()']);
echo "<input type='hidden' id='action' name='action' value=''>\n"; }
echo " </td>\n";
echo "<div class='card'>\n";
echo "<table class='list'>\n";
echo "<tr class='list-header'>\n";
if (permission_exists('call_active_hangup')) {
echo " <th class='checkbox'>\n";
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='if (this.checked) { refresh_stop(); } else { refresh_start(); } list_all_toggle();' ".(empty($rows) ? "style='visibility: hidden;'" : null).">\n";
echo " </th>\n";
}
echo " <th>".$text['label-profile']."</th>\n";
echo " <th>".$text['label-created']."</th>\n";
echo " <th>".$text['label-duration']."</th>\n";
if ($show == 'all') {
echo " <th>".$text['label-domain']."</th>\n";
}
echo " <th>".$text['label-number']."</th>\n";
echo " <th>".$text['label-cid-name']."</th>\n";
echo " <th>".$text['label-cid-number']."</th>\n";
echo " <th>".$text['label-destination']."</th>\n";
echo " <th>".$text['label-app']."</th>\n";
echo " <th>".$text['label-codec']."</th>\n";
echo " <th>".$text['label-secure']."</th>\n";
if (permission_exists('call_active_eavesdrop') || permission_exists('call_active_hangup')) {
echo " <th>&nbsp;</th>\n";
}
echo "</tr>\n";
if (is_array($rows)) {
$x = 0;
foreach ($rows as $row) {
//set the php variables
foreach ($row as $key => $value) {
$$key = $value;
}
//get the sip profile
$name_array = explode("/", $name);
$sip_profile = $name_array[1];
$sip_uri = $name_array[2];
//get the number
$temp_array = explode("@", $sip_uri);
$tmp_number = $temp_array[0];
$tmp_number = str_replace("sip:", "", $tmp_number);
//remove the '+' because it breaks the call recording
$cid_num = str_replace("+", "", $cid_num);
//replace gateway uuid with name
if (is_array($_SESSION['gateways']) && sizeof($_SESSION['gateways']) > 0) {
foreach ($_SESSION['gateways'] as $gateway_uuid => $gateway_name) {
$application_data = str_replace($gateway_uuid, $gateway_name, $application_data);
}
}
// reduce too long app data
if(strlen($application_data) > 512) {
$application_data = substr($application_data, 0, 512) . '...';
}
//send the html
echo "<tr class='list-row'>\n";
if (permission_exists('call_active_hangup')) {
echo " <td class='checkbox'>\n";
echo " <input type='checkbox' name='calls[$x][checked]' id='checkbox_".$x."' value='true' onclick=\"if (this.checked) { refresh_stop(); } else { document.getElementById('checkbox_all').checked = false; }\">\n";
echo " <input type='hidden' name='calls[$x][uuid]' value='".escape($uuid)."' />\n";
echo " </td>\n";
}
echo " <td>".escape($sip_profile)."&nbsp;</td>\n";
echo " <td>".escape($created)."&nbsp;</td>\n";
// Convert $created to a UNIX timestamp
$created_timestamp = strtotime($created);
// Get the current timestamp
$now = time();
// Calculate elapsed seconds
$elapsed_seconds = $now - $created_timestamp;
// Convert seconds to hours, minutes, and seconds
$hours = floor($elapsed_seconds / 3600);
$minutes = floor(($elapsed_seconds % 3600) / 60);
$seconds = $elapsed_seconds % 60;
// Format the elapsed time as HH:MM:SS
$elapsed_time = sprintf('%02d:%02d:%02d', $hours, $minutes, $seconds);
echo " <td>".escape($elapsed_time)."</td>\n";
if ($show == 'all') {
echo " <td>".escape($domain_name)."&nbsp;</td>\n";
}
echo " <td>".escape($tmp_number)."&nbsp;</td>\n";
echo " <td>".escape($cid_name)."&nbsp;</td>\n";
echo " <td>".escape($cid_num)."&nbsp;</td>\n";
echo " <td>".escape($dest)."&nbsp;</td>\n";
echo " <td>".(!empty($application) ? escape($application).":".escape($application_data) : null)."&nbsp;</td>\n";
echo " <td>".escape($read_codec).":".escape($read_rate)." / ".escape($write_codec).":".escape($write_rate)."&nbsp;</td>\n";
echo " <td>".escape($secure)."&nbsp;</td>\n";
if (permission_exists('call_active_eavesdrop') || permission_exists('call_active_hangup')) {
echo " <td class='button right' style='padding-right: 0;'>\n";
//eavesdrop
if (permission_exists('call_active_eavesdrop') && $callstate == 'ACTIVE' && !empty($_SESSION['user']['extensions']) && !in_array($cid_num, $_SESSION['user']['extensions'])) {
echo button::create(['type'=>'button','label'=>$text['label-eavesdrop'],'icon'=>'headphones','collapse'=>'hide-lg-dn','onclick'=>"if (confirm('".$text['confirm-eavesdrop']."')) { eavesdrop_call('".escape($cid_num)."','".escape($uuid)."'); } else { this.blur(); return false; }",'onmouseover'=>'refresh_stop()','onmouseout'=>'refresh_start()']);
}
//hangup
if (permission_exists('call_active_hangup')) {
echo button::create(['type'=>'button','label'=>$text['label-hangup'],'icon'=>'phone-slash','collapse'=>'hide-lg-dn','onclick'=>"if (confirm('".$text['confirm-hangup']."')) { list_self_check('checkbox_".$x."'); list_action_set('hangup'); list_form_submit('form_list'); } else { this.blur(); return false; }",'onmouseover'=>'refresh_stop()','onmouseout'=>'refresh_start()']);
}
echo "</td>\n";
}
echo "</tr>\n";
//unset the domain name
unset($domain_name);
//increment counter
$x++;
} }
unset($rows); echo " </tr>\n";
}
echo "</table>\n"; //unset the domain name
echo "</div>\n"; unset($domain_name);
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
echo "</form>\n";
//increment counter
$x++;
}
} }
echo " </table>\n";
echo "</div>\n";
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
echo "</form>\n";
?> ?>