Open phonecall window target as _self instead of new tab

This commit is contained in:
Hadi Nategh 2016-10-27 11:07:44 +02:00
parent 677c862d9b
commit 0078bf0997
2 changed files with 9 additions and 8 deletions

View File

@ -171,7 +171,7 @@ var et2_url = (function(){ "use strict"; return et2_textbox.extend(
.replace("%u",this.egw().user('account_lid')) .replace("%u",this.egw().user('account_lid'))
.replace("%t",this.egw().user('account_phone')); .replace("%t",this.egw().user('account_phone'));
var popup = this.egw().config("call_popup"); var popup = this.egw().config("call_popup");
value = function() { egw.open_link(link, 'phonecall', popup); }; value = function() { egw.open_link(link, '_phonecall', popup); };
} }
else { else {
// Can't make a good handler // Can't make a good handler

View File

@ -55,25 +55,25 @@ egw.extend('open', egw.MODULE_WND_LOCAL, function(_egw, _wnd)
cc: match['cc'] || [], cc: match['cc'] || [],
bcc: match['bcc'] || [] bcc: match['bcc'] || []
}; };
var popup; var popup;
// Get open compose windows // Get open compose windows
var compose = egw.getOpenWindows("mail", /(^compose_)||(^mail.compose)/); var compose = egw.getOpenWindows("mail", /(^compose_)||(^mail.compose)/);
// Encode html entities in the URI, otheerwise server XSS protection wont // Encode html entities in the URI, otheerwise server XSS protection wont
// allow it to pass, because it may get mistaken for some forbiden tags, // allow it to pass, because it may get mistaken for some forbiden tags,
// e.g., "Mathias <mathias@example.com>" the first part of email "<mathias" // e.g., "Mathias <mathias@example.com>" the first part of email "<mathias"
// including "<" would get mistaken for <math> tag, and server will cut it off. // including "<" would get mistaken for <math> tag, and server will cut it off.
uri = uri.replace(/</g,'&lt;').replace(/>/g,'&gt;'); uri = uri.replace(/</g,'&lt;').replace(/>/g,'&gt;');
if(compose.length == 0) if(compose.length == 0)
{ {
// No compose windows, might be no mail app.js // No compose windows, might be no mail app.js
// We really want to use mail_compose() here // We really want to use mail_compose() here
// Accoring to microsoft, IE 10/11 can only accept a url with 2083 caharacters // 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 // therefore we need to send request to compose window with POST method
// instead of GET. We create a temporary <Form> and will post emails. // instead of GET. We create a temporary <Form> 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 // Firefox:~ 65k, Safari:80k, Chrome: 2MB, Apache: 4k, Nginx: 4k
if (uri.length > 2083) 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_popup) _popup = mime_info.mime_popup;
if (mime_info.mime_target) _target = mime_info.mime_target; if (mime_info.mime_target) _target = mime_info.mime_target;
} }
if (_popup) if (_popup)
{ {
var w_h = _popup.split('x'); 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 = egwIsMobile()?'_self':'_blank';
} }
_target = _target == '_phonecall'? '_self':_target;
return _wnd.open(url, _target); return _wnd.open(url, _target);
} }
}, },
@ -435,7 +436,7 @@ egw.extend('open', egw.MODULE_WND_LOCAL, function(_egw, _wnd)
*/ */
availHeight: function() 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 (navigator.userAgent.match(/windows/ig)? screen.availHeight -100:screen.availHeight) // Seems chrome not counting taskbar in available height
: screen.height - 100; : screen.height - 100;
}, },