Skip to content

Commit

Permalink
IE8 Fixes for DropDown, merged some of the testui fixes from Leads br…
Browse files Browse the repository at this point in the history
…anch in.
  • Loading branch information
blak3r committed Jun 10, 2013
1 parent d7447f5 commit bdf5d44
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 42 deletions.
16 changes: 10 additions & 6 deletions SugarModules/modules/Asterisk/asteriskLogger.php
Expand Up @@ -41,7 +41,7 @@
//
// Debug flags
//
$dial_events_log = '/Applications/MAMP/htdocs/dial_events.html';
$dial_events_log = 'c:/sugarcrm/htdocs/dial_events_log_ast1.html';
$mysql_loq_queries = 0;
$mysql_log_results = 0;
$verbose_log = 0;
Expand Down Expand Up @@ -622,14 +622,22 @@ function call($method, $params) {
mysql_checked_query($query);
}


// Had to switch to using Dial End commands because when using hangups I couldn't do calls to cell phones properly... (basically there are so many
// hangup events it killed me...
// Queues have the opposite issue... I can't detect the end of a Queue call unfortuntely...
// Queues -- Could not use Dial End, only Hangup would work.


//
// Process "Hangup" events
// Yup, we really get TWO hangup events from Asterisk! (Even more with Ringgroups)
// Obviously, we need to take only one of them....
//
// Asterisk Manager 1.1
/*$e['Event'] == 'Hangup'*/
if (($e['Event'] == 'Dial' && $e['SubEvent'] == 'End') ) {
if (($e['Event'] == 'Dial' && $e['SubEvent'] == 'End') ||
($e['Event'] == 'Hangup' /*&& preg_match( '/from-queue/', $e['Channel'])*/ )) {
$id = AMI_getUniqueIdFromEvent($e);
logLine(" In DialEnd... $id");
$query = "SELECT call_record_id,direction,bean_module,bean_id,user_extension,inbound_extension FROM asterisk_log WHERE asterisk_dest_id = '$id' OR asterisk_id = '$id'";
Expand Down Expand Up @@ -1081,7 +1089,6 @@ function call($method, $params) {
$result = mysql_checked_query($query);
while ($call_rec_id = mysql_fetch_array($result)) {
logLine("Deleting Call Record: " . $call_rec_id['call_record_id']);
//pause(30000);
deleteCall($call_rec_id['call_record_id']);
}
} else if($direction['direction'] == "O") {
Expand All @@ -1094,7 +1101,6 @@ function call($method, $params) {
// Here we add support for complicated Ring Groups such as x1 ---> 615 ---> 710,722,735
// \--> 620 ---> 810,811,812
// Check if both channels are internal... Then, check the asterisk_log table to see if an entry exists where Channel matches one of them... if so then change it out.
// TBD: does answering on a cell phone and not pressing 1 to accept cause a bridge event that messes this up?
if (isCallInternal($e['Channel1'], $e['Channel2'])) {
logLine("Internal Bridge Event Detected\n");
if (preg_match('/(.*);(.*)/', $e['Channel1'], $matches)) {
Expand Down Expand Up @@ -1478,7 +1484,6 @@ function dev_clearDialEventsLog() {

function dev_GenericEventPrinter($arg1, $arg2, $arg3, $arg4, $arg5, $arg6, $arg7, $arg8) {
global $dial_events_log;
logLine("In printer generic");
if( !empty($dial_events_log) ) {
$s = getTimeStamp() . " ";
$s .= str_pad($arg1, 8, " ", STR_PAD_BOTH);
Expand Down Expand Up @@ -1840,7 +1845,6 @@ function findSugarObjectByPhoneNumber($aPhoneNumber) {
$resultDecoded = $matchingContacts[0];

if(count($matchingContacts) > 1) {
$foundMultipleAccounts = FALSE;
$matchingAccounts = array();
//logLine(print_r($resultDecoded,true));
for ($i = 0; $i < count($matchingContacts); $i++) {
Expand Down
19 changes: 9 additions & 10 deletions SugarModules/modules/Asterisk/include/javascript/callPopups.js
Expand Up @@ -274,20 +274,19 @@ var YAAI = {
})
.on("mouseenter",function() {
$(dropdownDiv).css( "margin-left", "50px"); // Needed in ie8 only...
clearTimeout($(dropdownDiv).data('timeoutId1'));
clearTimeout($(dropdownDiv).data('timeoutId2'));
console.log("clearing timeouts... button");
})
.on("mouseleave", function () {
setTimeout(hidepanel, 600);
var timeoutId1 = setTimeout(hidepanel, 600);
$(dropdownDiv).data('timeoutId1', timeoutId1);
console.log("set timeouts... button");
});


$(dropdownDiv).mouseleave(function() { setTimeout(hidepanel, 600); });

function hidepanel() {
// 2013-05-21: Code commented below caused issues with IE8, Safe to delete if no issues crop up with other browsers
//if ($(dropdownDiv).is(':hover') === false) {
$(dropdownDiv).slideUp();
//}
}
// This is for mouse events over the actual dropdowns...
$(dropdownDiv).mouseleave(function() { var timeoutId2 = setTimeout(hidepanel, 600); $(dropdownDiv).data('timeoutId2', timeoutId2); console.log("set timeouts... div"); });
$(dropdownDiv).mouseenter(function() { clearTimeout($(dropdownDiv).data('timeoutId1')); clearTimeout($(dropdownDiv).data('timeoutId2')); console.log("clearing timeouts... div"); } );


// Here we show them all...
Expand Down
54 changes: 28 additions & 26 deletions SugarModules/modules/Asterisk/include/tests/fake_dialer/test_ui.php
Expand Up @@ -2,12 +2,14 @@
<head>
<meta charset="utf-8" />
<title>YAAI Fake Dialer</title>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.0/themes/base/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script src="http://code.jquery.com/ui/1.9.0/jquery-ui.js"></script>
<!-- <link rel="stylesheet" href="http://code.jquery.com/ui/1.9.0/themes/base/jquery-ui.css" />-->
<link rel="stylesheet" href="custom/modules/Asterisk/include/javascript/offlineMode/jquery-ui.css" />
<script src="custom/modules/Asterisk/include/javascript/offlineMode/jquery-1.8.2.min.js"></script>
<!-- <script src="http://code.jquery.com/ui/1.9.0/jquery-ui.js"></script>-->
<script src="custom/modules/Asterisk/include/javascript/offlineMode/jquery-ui.js"></script>
<style>
.draggable { width: 100px; height: 100px; padding: 0.5em; float: left; margin: 10px 10px 10px 0; }
.droppable { width: 150px; height: 150px; padding: 0.5em; float: left; margin: 10px; }
.draggable { width: 100px; height: 100px; padding: 0.5em; float: left; margin: 10px 10px 10px 0; }
.droppable { width: 150px; height: 150px; padding: 0.5em; float: left; margin: 10px; }
</style>
</head>
Expand All @@ -18,16 +20,16 @@
This tool can be helpful to see what happens when a call would come in. If this tool works, but real calls don't, then this typically means asteriskLogger
isn't generating events. This tool was created by the developers to simulate call cases easier without having to make real calls.
<P>
Instructions: click the add call button. Enter the extension it should go to and the inbound phone number it should be coming from. Then, when the box
shows up allowing you to drag the icon. You must go from ringing -> connected --> Hangup --> Closed (Don't skip steps).
Instructions: click the add call button. Enter the extension it should go to and the inbound phone number it should be coming from. Then, when the box
shows up allowing you to drag the icon. You must go from ringing -> connected --> Hangup --> Closed (Don't skip steps).
<P>
The matching contacts setting create the number of contacts specified. A temporary contact will be created named John Doe and Jane Doe (if 2 is selected).
These contacts will be deleted once you get to the "Closed" stage.
The matching contacts setting create the number of contacts specified. A temporary contact will be created named John Doe and Jane Doe (if 2 is selected).
These contacts will be deleted once you get to the "Closed" stage.
<P>
To simply see what will happen when someone calls you from a given number, leave it at 0.
<BR>
To simply see what will happen when someone calls you from a given number, leave it at 0.
<BR>
<P>
<button id="add_call">Add Call</button>
<button id="add_call">Add Call</button>
<div id="main">
</div>
Expand All @@ -37,7 +39,7 @@
<div id="call" class="draggable ui-widget-content">
<img src="custom/modules/Asterisk/include/tests/fake_dialer/call_green.jpg" alt="Call" />
</div>
<div id="ringing" class="droppable ui-widget-header">
<p>Ringing</p>
</div>
Expand All @@ -58,19 +60,19 @@
<div id="extension-input" title="Extension to call or call from">
<form>
<fieldset>
<label for="extension">Extension</label>
<input type="text" name="extension" id="extension" class="text ui-widget-content ui-corner-all" />
<label for="phone_number">Phone#</label>
<input type="text" name="phone_number" id="phone_number" class="text ui-widget-content ui-corner-all" />
<div id="radio" style="text-align:center;">
<p>Matching Contacts (if 1 or 2 is selected temporary Contacts will be added)</p>
<input type="radio" id="radio1" name="radio" value="0" checked="checked" /><label for="radio1">0</label>
<input type="radio" id="radio2" name="radio" value="1"/><label for="radio2">1</label>
<input type="radio" id="radio3" name="radio" value="2" /><label for="radio3">>=2</label>
</div>
</fieldset>
<fieldset>
<label for="extension">Extension</label>
<input type="text" name="extension" id="extension" class="text ui-widget-content ui-corner-all" />
<label for="phone_number">Phone#</label>
<input type="text" name="phone_number" id="phone_number" class="text ui-widget-content ui-corner-all" />
<div id="radio" style="text-align:center;">
<p>Matching Contacts (if 1 or 2 is selected temporary Contacts will be added)</p>
<input type="radio" id="radio1" name="radio" value="0" checked="checked" /><label for="radio1">0</label>
<input type="radio" id="radio2" name="radio" value="1"/><label for="radio2">1</label>
<input type="radio" id="radio3" name="radio" value="2" /><label for="radio3">>=2</label>
</div>
</fieldset>
</form>
</div>
Expand Down

0 comments on commit bdf5d44

Please sign in to comment.