Change "seconds:" to "Duration:" and format time in HH:MM:SS

Discussions about new features or changes in existing features

Moderators: gerski, enjay, williamconley, Op3r, Staydog, gardo, mflorell, MJCoate, mcargile, Kumba, Michael_N

Change "seconds:" to "Duration:" and format time in HH:MM:SS

Postby jxk7581 » Mon Oct 01, 2018 11:32 am

We made a change to our instance to display the "seconds:" value in the upper right corner of the agent screen as "Duration:", and format it in HH:MM:SS. This makes call duration tracking much cleaner.

Add the following function to the HEAD of the Vicidial.php:
Code: Select all
<script type="text/javascript">
function LiveCallSeconds(totalSeconds) {
     var hours   = Math.floor(totalSeconds / 3600);
     var minutes = Math.floor((totalSeconds - (hours * 3600)) / 60);
     var seconds = totalSeconds - (hours * 3600) - (minutes * 60);
 
     // round seconds
     seconds = Math.round(seconds * 100) / 100
 
     var result = (hours < 10 ? "0" + hours : hours);
         result += ":" + (minutes < 10 ? "0" + minutes : minutes);
         result += ":" + (seconds  < 10 ? "0" + seconds : seconds);
     return result;
   }
</script>


Change innerHTML to:
Code: Select all
document.getElementById("SecondSDISP").innerHTML = LiveCallSeconds(VD_live_call_secondS);


Modify $SCwidth to $SCwidth-30 and change “seconds:” to “Duration:”
Code: Select all
<span style="position:absolute;left:<?php echo $SCwidth-30 ?>px;top:<?php echo $SCheight ?>px;z-index:<?php $zi++; echo $zi ?>;" id="SecondSspan"><font class="body_text"> <?php echo _QXZ("Duration:"); ?>


I hope this helps others who may find this useful, and would be good to add as the default in future releases.
OS: CentOS release 6.9 (Final)
KERNEL VERSION: Linux version 2.6.32-696.20.1.el6.x86_64
INSTALL METHOD: https://swanand18.blogspot.com/2017/06/vicidial-scratch-installation-centos-
VERSION: 2.14-644a
BUILD: 180310-2321
ASTERISK: 13.17.2-vici
DAHDI: 2.11.1
jxk7581
 
Posts: 12
Joined: Fri Sep 16, 2016 2:51 pm
Location: Boston, MA

Re: Change "seconds:" to "Duration:" and format time in HH:M

Postby williamconley » Mon Oct 01, 2018 12:06 pm

1) Good job posting your specs ... But: You should list a link to the instruction you used for your installation. "Scratch Install" could be from many different instruction sets. It helps bring those with similar causes together.

2) Good post. To complete the process ...: Create a DIFF/PATCH against the latest SVN and post it along with the above description in the Vicidial Mantis Issue Tracker. Then post a link to that Issue here in the Forum. That gives better odds of having your upgrade included in the base project code (so you don't have to patch it with each new upgrade, and so others may benefit as well).

For the BEST odds of inclusion: You could also create a "preference" in the campaign settings (or admin system settings, or both) for the original (default) method and your new method. This way no one already using the system will be affected unexpectedly during an upgrade, but after the next upgrade anyone who wants it can have it (and if they set the system settings to your version, all campaigns would be expected to follow the system setting all at once unless they've been overridden ...?).

Happy Hunting 8-)

http://www.vicidial.org/VICIDIALmantis/login_page.php
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20258
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)


Return to Features

Who is online

Users browsing this forum: No registered users and 9 guests