Active Calls: Update refresh/pause button.

This commit is contained in:
Nate 2019-10-30 01:05:43 -06:00
parent bc3f71b911
commit 7b1356310b
4 changed files with 33 additions and 15 deletions

View File

@ -62,7 +62,7 @@
?>
<script type="text/javascript">
//define refresh function, initial start
var refresh = 1500;
var refresh = 1980;
var source_url = 'calls_active_inc.php?';
var timer_id;
<?php
@ -87,11 +87,13 @@
//refresh controls
function refresh_stop() {
clearTimeout(timer_id);
document.getElementById('refresh_state').innerHTML = "<img src='resources/images/refresh_paused.png' style='width: 16px; height: 16px; border: none; margin-top: 1px; margin-right: 20px; cursor: pointer;' onclick='refresh_start();' alt=\"<?php echo $text['label-refresh_enable']?>\" title=\"<?php echo $text['label-refresh_enable']?>\">";
//document.getElementById('refresh_state').innerHTML = "<img src='resources/images/refresh_paused.png' style='width: 16px; height: 16px; border: none; margin-top: 1px; margin-right: 20px; cursor: pointer;' onclick='refresh_start();' alt=\"<?php echo $text['label-refresh_enable']?>\" title=\"<?php echo $text['label-refresh_enable']?>\">";
document.getElementById('refresh_state').innerHTML = "<?php echo button::create(['type'=>'button','title'=>$text['label-refresh_pause'],'icon'=>'pause','onclick'=>'refresh_start()']); ?>";
}
function refresh_start() {
if (document.getElementById('refresh_state')) { document.getElementById('refresh_state').innerHTML = "<img src='resources/images/refresh_active.gif' style='width: 16px; height: 16px; border: none; margin-top: 2px; margin-right: 20px; cursor: pointer;' alt=\"<?php echo $text['label-refresh_pause']?>\" title=\"<?php echo $text['label-refresh_pause']?>\">"; }
//if (document.getElementById('refresh_state')) { document.getElementById('refresh_state').innerHTML = "<img src='resources/images/refresh_active.gif' style='width: 16px; height: 16px; border: none; margin-top: 2px; margin-right: 20px; cursor: pointer;' alt=\"<?php echo $text['label-refresh_pause']?>\" title=\"<?php echo $text['label-refresh_pause']?>\">"; }
if (document.getElementById('refresh_state')) { document.getElementById('refresh_state').innerHTML = "<?php echo button::create(['type'=>'button','title'=>$text['label-refresh_pause'],'icon'=>'sync-alt fa-spin','onclick'=>'refresh_stop()']); ?>"; }
ajax_get();
}

View File

@ -120,7 +120,8 @@
echo "<div class='action_bar' id='action_bar'>\n";
echo " <div class='heading'><b>".$text['title']." (".$num_rows.")</b></div>\n";
echo " <div class='actions'>\n";
echo " <span id='refresh_state'><img src='resources/images/refresh_active.gif' style='width: 16px; height: 16px; border: none; margin-top: 2px; margin-right: 20px; cursor: pointer;' onclick='refresh_stop();' alt=\"".$text['label-refresh_pause']."\" title=\"".$text['label-refresh_pause']."\"></span>";
// echo " <span id='refresh_state'><img src='resources/images/refresh_active.gif' style='width: 16px; height: 16px; border: none; margin-top: 2px; margin-right: 20px; cursor: pointer;' onclick='refresh_stop();' alt=\"".$text['label-refresh_pause']."\" title=\"".$text['label-refresh_pause']."\"></span>";
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_hangup') && $rows) {
echo button::create(['type'=>'button','label'=>$text['label-hangup'],'icon'=>'phone-slash','onclick'=>"if (confirm('".$text['confirm-hangups']."')) { list_action_set('hangup'); list_form_submit('form_list'); } else { this.blur(); return false; }"]);
}

View File

@ -35,18 +35,20 @@ if (!class_exists('button')) {
//button: open
$button = "<button ";
$button .= "type='".($array['type'] ? $array['type'] : 'button')."' ";
$button .= $array['name'] ? "name=\"".$array['name']."\" " : null;
$button .= $array['value'] ? "value=\"".$array['value']."\" " : null;
$button .= $array['id'] ? "id=\"".$array['id']."\" " : null;
$button .= $array['label'] ? "alt=\"".$array['label']."\" " : ($array['title'] ? "alt=\"".$array['title']."\" " : null);
$button .= $array['name'] ? "name=".self::quote($array['name'])." " : null;
$button .= $array['value'] ? "value=".self::quote($array['value'])." " : null;
$button .= $array['id'] ? "id='".$array['id']."' " : null;
$button .= $array['label'] ? "alt=".self::quote($array['label'])." " : ($array['title'] ? "alt=".self::quote($array['title'])." " : null);
if ($button_icons == 'only' || $button_icons == 'auto' || $array['title']) {
$button .= "title=\"".($array['title'] ? $array['title'] : $array['label'])."\" ";
if ($array['title'] || $array['label']) {
$button .= "title=".($array['title'] ? self::quote($array['title']) : self::quote($array['label']))." ";
}
}
$button .= $array['onclick'] ? "onclick=\"".$array['onclick']."\" " : null;
$button .= $array['onmouseover'] ? "onmouseenter=\"".$array['onmouseover']."\" " : null;
$button .= $array['onmouseout'] ? "onmouseleave=\"".$array['onmouseout']."\" " : null;
$button .= $array['onclick'] ? "onclick=".self::quote($array['onclick'])." " : null;
$button .= $array['onmouseover'] ? "onmouseenter=".self::quote($array['onmouseover'])." " : null;
$button .= $array['onmouseout'] ? "onmouseleave=".self::quote($array['onmouseout'])." " : null;
$button .= "class='btn btn-".($array['class'] ? $array['class'] : 'default')." ".($array['disabled'] ? 'disabled' : null)."' ";
$button .= "style='margin-left: 2px; margin-right: 2px; ".($array['style'] ? $array['style'] : null)."' ";
$button .= $array['style'] ? "style=".self::quote($array['style'])." " : null;
$button .= $array['disabled'] ? "disabled='disabled' " : null;
$button .= ">";
//icon
@ -82,8 +84,8 @@ if (!class_exists('button')) {
if ($array['link']) {
$anchor = "<a ";
$anchor .= "href='".$array['link']."' ";
$anchor .= "target=\"".($array['target'] ? $array['target'] : '_self')."\" ";
$anchor .= ($array['disabled'] ? "class='disabled' onclick='return false;'" : null)." ";
$anchor .= "target='".($array['target'] ? $array['target'] : '_self')."' ";
$anchor .= $array['disabled'] ? "class='disabled' onclick='return false;' " : null;
$anchor .= ">";
$button = $anchor.$button."</a>";
}
@ -91,6 +93,10 @@ if (!class_exists('button')) {
unset($button);
}
private static function quote($value) {
return substr_count($value, "'") ? '"'.$value.'"' : "'".$value."'";
}
}
}

View File

@ -1026,6 +1026,11 @@ $default_login = ($_REQUEST['login'] == 'default') ? true : false;
text-decoration: underline;
}
button.btn {
margin-left: 2px;
margin-right: 2px;
}
button.btn.btn-link {
margin: 0;
margin-top: -2px;
@ -1035,6 +1040,10 @@ $default_login = ($_REQUEST['login'] == 'default') ? true : false;
font-family: inherit;
}
button.btn > span.fas.fa-spin {
display: inline-block;
}
form {
margin: 0;
}