mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-26 08:39:07 +01:00
Add browser popup blocker checker for open_link method.
-Fix not poping up the emailadminWizard popup when an IMAP error occurrs, because of the browser blocks the popup.
This commit is contained in:
parent
7967387e3a
commit
22d6d80aae
@ -169,7 +169,7 @@ class mail_ui
|
||||
{
|
||||
$response = egw_json_response::get();
|
||||
$windowName = "editMailAccount".self::$icServerID;
|
||||
$response->call("egw.open_link", egw::link('/index.php', $linkData), $windowName, "600x480");
|
||||
$response->call("egw.open_link", egw::link('/index.php', $linkData), $windowName, "600x480",null,true);
|
||||
egw_framework::message($message, 'error');
|
||||
if ($_GET['menuaction'] == 'mail.mail_ui.index')
|
||||
{
|
||||
|
@ -238,8 +238,10 @@ egw.extend('open', egw.MODULE_WND_LOCAL, function(_egw, _wnd) {
|
||||
* @param string _target optional target / window name
|
||||
* @param string _popup widthxheight, if a popup should be used
|
||||
* @param string _target_app app-name for opener
|
||||
* @param boolean _check_popup_blocker TRUE check if browser pop-up blocker is on/off, FALSE no check
|
||||
* - This option only makes sense to be enabled when the open_link requested without user interaction
|
||||
*/
|
||||
open_link: function(_link, _target, _popup, _target_app)
|
||||
open_link: function(_link, _target, _popup, _target_app, _check_popup_blocker)
|
||||
{
|
||||
// Log for debugging purposes - don't use navigation here to avoid
|
||||
// flooding log with details already captured by egw.open()
|
||||
@ -247,7 +249,11 @@ egw.extend('open', egw.MODULE_WND_LOCAL, function(_egw, _wnd) {
|
||||
"egw.open_link(_link=%s, _target=%s, _popup=%s, _target_app=%s)",
|
||||
_link,_target,_popup,_target_app
|
||||
);
|
||||
|
||||
//Check browser pop-up blocker
|
||||
if (_check_popup_blocker)
|
||||
{
|
||||
if (this._check_popupBlocker(_link, _target, _popup, _target_app)) return;
|
||||
}
|
||||
var url = _link;
|
||||
if (url.indexOf('javascript:') == 0)
|
||||
{
|
||||
@ -312,6 +318,37 @@ egw.extend('open', egw.MODULE_WND_LOCAL, function(_egw, _wnd) {
|
||||
{
|
||||
_wnd.location.href = _url;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Check if browser pop-up blocker is on/off
|
||||
*
|
||||
* @param string _link menuaction, EGroupware relative url or a full url (incl. "mailto:" or "javascript:")
|
||||
* @param string _target optional target / window name
|
||||
* @param string _popup widthxheight, if a popup should be used
|
||||
* @param string _target_app app-name for opener
|
||||
*
|
||||
* @return boolean returns false if pop-up blocker is off
|
||||
* - returns true if pop-up blocker is on,
|
||||
* - and re-call the open_link with provided parameters, after user interaction.
|
||||
*/
|
||||
_check_popupBlocker: function(_link, _target, _popup, _target_app)
|
||||
{
|
||||
var popup = window.open("","",'top='+(screen.height/2)+',left='+(screen.width/2)+',width=1,height=1,menubar=no,resizable=yes,scrollbars=yes,status=no,toolbar=no,dependent=yes');
|
||||
|
||||
if (!popup||popup == 'undefined'||popup == null)
|
||||
{
|
||||
et2_dialog.show_dialog(function(){
|
||||
window.egw.open_link(_link, _target, _popup, _target_app);
|
||||
},egw.lang("The browser popup blocker is on. Please click on OK button to see the pop-up.\n\nIf you would like to not see this message for the next time, allow your browser pop-up blocker to open popups from %1",window.location.hostname) ,
|
||||
"Popup Blocker Warning",{},et2_dialog.BUTTONS_OK,et2_dialog.WARNING_MESSAGE);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
popup.close();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
146
phpgwapi/js/webrtc/et2_widget_iframe.js
Normal file
146
phpgwapi/js/webrtc/et2_widget_iframe.js
Normal file
@ -0,0 +1,146 @@
|
||||
/**
|
||||
* EGroupware eTemplate2 - JS widget class for an iframe
|
||||
*
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @package etemplate
|
||||
* @subpackage api
|
||||
* @link http://www.egroupware.org
|
||||
* @author Nathan Gray
|
||||
* @copyright Nathan Gray 2013
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
/*egw:uses
|
||||
et2_core_valueWidget;
|
||||
*/
|
||||
|
||||
/**
|
||||
* @augments et2_valueWidget
|
||||
*/
|
||||
var et2_iframe = et2_valueWidget.extend(
|
||||
{
|
||||
attributes: {
|
||||
'label': {
|
||||
'default': "",
|
||||
description: "The label is displayed by default in front (for radiobuttons behind) each widget (if not empty). If you want to specify a different position, use a '%s' in the label, which gets replaced by the widget itself. Eg. '%s Name' to have the label Name behind a checkbox. The label can contain variables, as descript for name. If the label starts with a '@' it is replaced by the value of the content-array at this index (with the '@'-removed and after expanding the variables).",
|
||||
ignore: false,
|
||||
name: "Label",
|
||||
translate: true,
|
||||
type: "string",
|
||||
},
|
||||
"needed": {
|
||||
"ignore": true
|
||||
},
|
||||
"seamless": {
|
||||
name: "Seamless",
|
||||
'default': true,
|
||||
description: "Specifies that the iframe should be rendered in a manner that makes it appear to be part of the containing document",
|
||||
translate: false,
|
||||
type: "boolean"
|
||||
},
|
||||
"name": {
|
||||
name: "Name",
|
||||
"default": "",
|
||||
description: "Specifies name of frame, to be used as target for links",
|
||||
type: "string"
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @memberOf et2_iframe
|
||||
*/
|
||||
init: function() {
|
||||
this._super.apply(this, arguments);
|
||||
|
||||
// Allow no child widgets
|
||||
this.supportedWidgetClasses = [];
|
||||
|
||||
this.htmlNode = $j(document.createElement("iframe"));
|
||||
if(this.options.label)
|
||||
{
|
||||
this.htmlNode.append('<span class="et2_label">'+this.options.label+'</span>');
|
||||
}
|
||||
this.setDOMNode(this.htmlNode[0]);
|
||||
},
|
||||
|
||||
/**
|
||||
* Set name of iframe (to be used as target for links)
|
||||
*
|
||||
* @param _name
|
||||
*/
|
||||
set_name: function(_name) {
|
||||
this.htmlNode.attr('name', this.htmlNode.name = _name);
|
||||
},
|
||||
|
||||
/**
|
||||
* Make it look like part of the containing document
|
||||
*
|
||||
* @param _seamless boolean
|
||||
*/
|
||||
set_seamless: function(_seamless) {
|
||||
this.options.seamless = _seamless;
|
||||
this.htmlNode.attr("seamless", _seamless);
|
||||
},
|
||||
|
||||
set_value: function(_value) {
|
||||
if(typeof _value == "undefined") _value = "";
|
||||
|
||||
if(_value.trim().indexOf("http") == 0 || _value.indexOf('about:') == 0 || _value[0] == '/')
|
||||
{
|
||||
// Value is a URL
|
||||
this.set_src(_value);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Value is content
|
||||
this.set_srcdoc(_value);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Set the URL for the iframe
|
||||
*
|
||||
* Sets the src attribute to the given value
|
||||
*
|
||||
* @param _value String URL
|
||||
*/
|
||||
set_src: function(_value) {
|
||||
if(_value.trim() != "")
|
||||
{
|
||||
if(_value.trim() == 'about:blank')
|
||||
{
|
||||
this.htmlNode.attr("src", _value);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Load the new page, but display a loader
|
||||
var loader = $j('<div class="et2_iframe loading"/>');
|
||||
this.htmlNode
|
||||
.before(loader);
|
||||
window.setTimeout(jQuery.proxy(function() {
|
||||
this.htmlNode.attr("src", _value)
|
||||
.one('load',function() {
|
||||
loader.remove();
|
||||
});
|
||||
},this),0);
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets the content of the iframe
|
||||
*
|
||||
* Sets the srcdoc attribute to the given value
|
||||
*
|
||||
* @param _value String Content of a document
|
||||
*/
|
||||
set_srcdoc: function(_value) {
|
||||
this.htmlNode.attr("srcdoc", _value);
|
||||
}
|
||||
});
|
||||
et2_register_widget(et2_iframe, ["iframe"]);
|
@ -790,6 +790,7 @@ text color: common de Textfarbe:
|
||||
thailand common de THAILAND
|
||||
the api is current common de Die API ist aktuell
|
||||
the api requires an upgrade common de Die API benötigt eine Aktualisierung
|
||||
the browser popup blocker is on. please click on ok button to see the pop-up.\n\nif you would like to not see this message for the next time, allow your browser pop-up blocker to open popups from %1 common de Ihr Browser hat das Öffnen eines Popup-Dialogs blockiert. Bitte klicken Sie OK, um das Popup angezeigt zu bekommen.\n\nWenn Sie die Meldung nicht nochmals erhalten wollen, erlauben Sie bitte in den Einstellungen vom Browser für %1 das Öffnen von Popups.
|
||||
the following applications require upgrades common de Die folgenden Anwendungen benötigen eine Aktualisierung
|
||||
the mail server returned common de Der E-Mail-Server liefert zurück
|
||||
there already is a system-user with this name. user's should not have the same name as a systemuser common de Es gibt schon einen System Benutzer mit dem selben Namen. Die Benutzer sollten nicht die gleichen Namen haben, wie die Systembenutzer.
|
||||
|
Loading…
Reference in New Issue
Block a user