From 467644cee91fee5a8b44133de132b0a4a1e85076 Mon Sep 17 00:00:00 2001 From: Shawn Parker Date: Tue, 2 Aug 2011 08:10:19 -0700 Subject: [PATCH] Fixing "regular" outbound dial dialog; recompiled assets; fixing upgrade for default user-online state; --- assets/j/compiled/1009/site.js | 4 ++-- assets/j/plugins/call-and-sms-dialogs.js | 8 ++++---- updates/49.php | 3 ++- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/assets/j/compiled/1009/site.js b/assets/j/compiled/1009/site.js index 8558700c..2f6d1668 100644 --- a/assets/j/compiled/1009/site.js +++ b/assets/j/compiled/1009/site.js @@ -713,8 +713,8 @@ f,g){return this.bind(f,function(i){var j=b(i.target);if(j.is(d))return g.apply( $(function(){var b=false,d=null,f=$(".call-dialog").css("opacity",0);$("form",f).live("submit",function(n){n.preventDefault()});var g=function(n,c){d&&clearTimeout(d);c.shown=false;$(".call-button").data("link",c);d=setTimeout(function(){d=null;f.animate({top:"-=35px",opacity:0},250,"swing",function(){b=false;f.css("display","none")})},100);$(".screen").hide();$(".invoke-call-button span").text("Call");$(".call-dialing").hide();currentDialogType=currentDialogHideFunction=null;return false};$(".twilio-call").each(function(){var n= false,c=this;c.shown=false;var k=$(this),q=function(w,B){currentDialogType=="sms"&¤tDialogHideFunction();d&&clearTimeout(d);if(n||B.shown)return false;if(b){b=false;$(".call-button").data("link").shown=false;$(".call-dialog").hide()}w="";if(B){w=$(B).text()!="Call"?$(B).text():"";target=$(B).attr("href")}b=n=true;f.css({position:"absolute",left:k.get(0).offsetLeft,top:k.get(0).offsetTop,display:"block"}).animate({top:"+=35px",opacity:1},250,"swing",function(){n=false;B.shown=true});$(".call-button").data("link", B);$('input[name="to"]',f).val(w);$('input[name="target"]',f).val(target);$(".screen").show();currentDialogType="call";currentDialogHideFunction=function(){g(null,B)};return true};$(window).keypress(function(w){w.keyCode==27&&g(w,c)});$(this).hasClass("hover")?$([k.get(0),f.get(0)]).mouseover(function(w){q(w,c)}).mouseout(function(w){g(w,c)}):$(k).click(function(w){return q(w,c)?false:g(w,c)});$(".close",f).live("click",function(w){g(w,c);w.preventDefault()})});var i=function(){window.parent.Client.call({to:$("#dial-number", -f).val(),callerid:$(':input[name="callerid"]',f).val(),Digits:1});$(".close",f).click()},j=function(n){$(".invoke-call-button span").text("Calling...");$(".call-dialing").show();var c=$(this).data("link");$(this).prop("disabled",true);var k=$(this);$.ajax({url:OpenVBX.home+"/messages/call",data:$("form input, form select",f),dataType:"json",type:"POST",success:function(q){k.prop("disabled",false);g(n,c);if(q.error){$(".error-dialog").dialog("option","buttons",{Ok:function(){$(this).dialog("close")}}); -$(".error-dialog .error-code").text("");$(".error-dialog .error-message").text("Unable to complete call. Message from server: "+q.message);$(".error-dialog").dialog("open")}else $.notify("You are now being connected to "+$('input[name="to"]',f).val())}})};$(".call-button",f).click(function(n){n.preventDefault();$('select[name="device"]',f).val()=="client"?i():j(n)});$(".screen").live("click",function(n){n.preventDefault();b&&$(".close",f).click()});$("#vbx-client-status .client-button").live("click", +f).val(),callerid:$(':input[name="callerid"]',f).val(),Digits:1});$(".close",f).click()},j=function(n,c){$(".invoke-call-button span").text("Calling...");$(".call-dialing").show();var k=$(c).data("link");$(this).prop("disabled",true);var q=$(c);$.ajax({url:OpenVBX.home+"/messages/call",data:$("form input, form select",f),dataType:"json",type:"POST",success:function(w){q.prop("disabled",false);g(n,k);if(w.error){$(".error-dialog").dialog("option","buttons",{Ok:function(){$(this).dialog("close")}}); +$(".error-dialog .error-code").text("");$(".error-dialog .error-message").text("Unable to complete call. Message from server: "+w.message);$(".error-dialog").dialog("open")}else $.notify("You are now being connected to "+$('input[name="to"]',f).val())}})};$(".call-button",f).click(function(n){n.preventDefault();$('select[name="device"]',f).val()=="client"?i():j(n,this)});$(".screen").live("click",function(n){n.preventDefault();b&&$(".close",f).click()});$("#vbx-client-status .client-button").live("click", function(n){n.preventDefault();n.stopPropagation();n=$(this).closest("#vbx-client-status");var c=null;if(n.hasClass("online")){c=false;n.removeClass("online")}else{c=true;n.addClass("online")}window.parent.Client.status.setWindowStatus(c)})}); $(function(){var b=false,d=null,f=$(".sms-dialog").css("opacity",0);$("form",f).live("submit",function(j){j.preventDefault()});var g=function(j,n){$(".send-sms-button").prop("disabled",false);d&&clearTimeout(d);n||(n=$(".sms-button").data("link"));n.shown=false;$(".sms-button").data("link",n);d=setTimeout(function(){d=null;f.animate({top:"-=35px",opacity:0},250,"swing",function(){b=false;f.css("display","none")})},100);$(".screen").hide();$(".send-sms-button span").text("Send SMS");$(".sms-sending").hide(); currentDialogType=currentDialogHideFunction=null;return false};$(".twilio-sms").each(function(){var j=false,n=this;n.shown=false;var c=$(this),k=function(q,w){$(".send-sms-button").attr("rel",$(w).attr("rel"));$(".send-sms-button").prop("disabled",false);currentDialogType=="call"&¤tDialogHideFunction();d&&clearTimeout(d);if(j||w.shown)return false;if(b){b=false;$(".sms-button").data("link").shown=false;$(".sms-dialog").hide()}q="";if(w){q=$(w).text().match(/sms/i)?"":$(w).text();target=$(w).attr("href")}b= diff --git a/assets/j/plugins/call-and-sms-dialogs.js b/assets/j/plugins/call-and-sms-dialogs.js index 6cc1c22b..1d173a43 100644 --- a/assets/j/plugins/call-and-sms-dialogs.js +++ b/assets/j/plugins/call-and-sms-dialogs.js @@ -223,7 +223,7 @@ $(function () { clientDialNumber(); } else { - deviceDialNumber(event); + deviceDialNumber(event, this); } }; @@ -236,13 +236,13 @@ $(function () { $('.close', dialog).click(); }; - var deviceDialNumber = function(event) { + var deviceDialNumber = function(event, clicked) { $('.invoke-call-button span').text('Calling...'); $('.call-dialing').show(); - var link = $(this).data('link'); + var link = $(clicked).data('link'); $(this).prop('disabled', true); - var button = $(this); + var button = $(clicked); $.ajax({ url : OpenVBX.home + '/messages/call', data : $('form input, form select', dialog), diff --git a/updates/49.php b/updates/49.php index 94120557..552e52c7 100644 --- a/updates/49.php +++ b/updates/49.php @@ -10,7 +10,8 @@ function runUpdate_49() { $ci->load->dbforge(); $ci->dbforge->add_column('users', array( 'online' => array( - 'type' => 'TINYINT(1)', + 'type' => 'TINYINT', + 'constraint' => '1', 'default' => '9' ) ));