From 0078bf09975c2f80cd578b5b52709739c56e5fe0 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Thu, 27 Oct 2016 11:07:44 +0200 Subject: [PATCH] Open phonecall window target as _self instead of new tab --- api/js/etemplate/et2_widget_url.js | 2 +- api/js/jsapi/egw_open.js | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/api/js/etemplate/et2_widget_url.js b/api/js/etemplate/et2_widget_url.js index ffa5d6dd51..d4efe578d9 100644 --- a/api/js/etemplate/et2_widget_url.js +++ b/api/js/etemplate/et2_widget_url.js @@ -171,7 +171,7 @@ var et2_url = (function(){ "use strict"; return et2_textbox.extend( .replace("%u",this.egw().user('account_lid')) .replace("%t",this.egw().user('account_phone')); var popup = this.egw().config("call_popup"); - value = function() { egw.open_link(link, 'phonecall', popup); }; + value = function() { egw.open_link(link, '_phonecall', popup); }; } else { // Can't make a good handler diff --git a/api/js/jsapi/egw_open.js b/api/js/jsapi/egw_open.js index 6700bdd36e..aee95865e3 100644 --- a/api/js/jsapi/egw_open.js +++ b/api/js/jsapi/egw_open.js @@ -55,25 +55,25 @@ egw.extend('open', egw.MODULE_WND_LOCAL, function(_egw, _wnd) cc: match['cc'] || [], bcc: match['bcc'] || [] }; - var popup; + var popup; // Get open compose windows var compose = egw.getOpenWindows("mail", /(^compose_)||(^mail.compose)/); - + // Encode html entities in the URI, otheerwise server XSS protection wont // allow it to pass, because it may get mistaken for some forbiden tags, // e.g., "Mathias " the first part of email " tag, and server will cut it off. uri = uri.replace(//g,'>'); - + if(compose.length == 0) { // No compose windows, might be no mail app.js // We really want to use mail_compose() here - + // Accoring to microsoft, IE 10/11 can only accept a url with 2083 caharacters // therefore we need to send request to compose window with POST method // instead of GET. We create a temporary
and will post emails. - // ** WebServers and other browsers also have url length limit: + // ** WebServers and other browsers also have url length limit: // Firefox:~ 65k, Safari:80k, Chrome: 2MB, Apache: 4k, Nginx: 4k if (uri.length > 2083) { @@ -351,7 +351,7 @@ egw.extend('open', egw.MODULE_WND_LOCAL, function(_egw, _wnd) if (mime_info.mime_popup) _popup = mime_info.mime_popup; if (mime_info.mime_target) _target = mime_info.mime_target; } - + if (_popup) { var w_h = _popup.split('x'); @@ -379,6 +379,7 @@ egw.extend('open', egw.MODULE_WND_LOCAL, function(_egw, _wnd) { _target = egwIsMobile()?'_self':'_blank'; } + _target = _target == '_phonecall'? '_self':_target; return _wnd.open(url, _target); } }, @@ -435,7 +436,7 @@ egw.extend('open', egw.MODULE_WND_LOCAL, function(_egw, _wnd) */ availHeight: function() { - return screen.availHeight < screen.height ? + return screen.availHeight < screen.height ? (navigator.userAgent.match(/windows/ig)? screen.availHeight -100:screen.availHeight) // Seems chrome not counting taskbar in available height : screen.height - 100; },