* Mail/IE: fixed compose popup did not open again after it was closed eg. mail was send

r51526: fix wrong parameter order in call to egw.config() by removing it completly, as session is anway instance specific (and due to wrong order returned key was always empty)
r51527: garding againts data set in egw object by reference from an other window, causing data to be inaccessible in IE after window closes
r51528: removing an other unnecessary egw_info[flags][js_link_registry]=true
This commit is contained in:
Ralf Becker 2015-02-02 19:54:53 +00:00
parent 1e5232d441
commit 7f8b201330
13 changed files with 55 additions and 52 deletions

View File

@ -61,11 +61,6 @@ class mail_compose
function __construct()
{
if (!isset($GLOBALS['egw_info']['flags']['js_link_registry']))
{
//error_log(__METHOD__.__LINE__.' js_link_registry not set, force it:'.array2string($GLOBALS['egw_info']['flags']['js_link_registry']));
$GLOBALS['egw_info']['flags']['js_link_registry']=true;
}
$this->displayCharset = translation::charset();
$profileID = (int)$GLOBALS['egw_info']['user']['preferences']['mail']['ActiveProfileID'];

View File

@ -114,11 +114,6 @@ class mail_ui
if (!$run_constructor) return;
if (mail_bo::$debugTimes) $starttime = microtime (true);
if (!isset($GLOBALS['egw_info']['flags']['js_link_registry']))
{
//error_log(__METHOD__.__LINE__.' js_link_registry not set, force it:'.array2string($GLOBALS['egw_info']['flags']['js_link_registry']));
$GLOBALS['egw_info']['flags']['js_link_registry']=true;
}
// no autohide of the sidebox, as we use it for folderlist now.
unset($GLOBALS['egw_info']['user']['preferences']['common']['auto_hide_sidebox']);

View File

@ -41,8 +41,8 @@ if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && $_SERVER['HTTP_IF_NONE_MATCH'] == $
common::egw_exit();
}
$content = 'egw.set_configs('.$config.");\n";
$content .= 'egw.set_link_registry('.$link_registry.");\n";
$content = 'egw.set_configs('.$config.", egw && egw.window !== window);\n";
$content .= 'egw.set_link_registry('.$link_registry.", undefined, egw && egw.window !== window);\n";
// we run our own gzip compression, to set a correct Content-Length of the encoded content
if (in_array('gzip', explode(',',$_SERVER['HTTP_ACCEPT_ENCODING'])) && function_exists('gzencode'))

View File

@ -41,7 +41,7 @@ if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && $_SERVER['HTTP_IF_NONE_MATCH'] == $
common::egw_exit();
}
$content = 'egw.set_images('.$content.");\n";
$content = 'egw.set_images('.$content.", egw && egw.window !== window);\n";
// we run our own gzip compression, to set a correct Content-Length of the encoded content
if (in_array('gzip', explode(',',$_SERVER['HTTP_ACCEPT_ENCODING'])) && function_exists('gzencode'))

View File

@ -29,8 +29,8 @@ egw.extend('config', egw.MODULE_GLOBAL, function() {
/**
* Query clientside config
*
* @param string _name name of config variable
* @param string _app default "phpgwapi"
* @param {string} _name name of config variable
* @param {string} _app default "phpgwapi"
* @return mixed
*/
config: function (_name, _app)
@ -45,11 +45,13 @@ egw.extend('config', egw.MODULE_GLOBAL, function() {
/**
* Set clientside configuration for all apps
*
* @param array/object
* @param {object} _configs
* @param {boolean} _need_clone _configs need to be cloned, as it is from different window context
* and therefore will be inaccessible in IE, after that window is closed
*/
set_configs: function(_configs)
set_configs: function(_configs, _need_clone)
{
configs = _configs;
configs = _need_clone ? jQuery.extend(true, {}, _configs) : _configs;
}
};
});

View File

@ -47,10 +47,12 @@ egw.extend('images', egw.MODULE_GLOBAL, function() {
* Set imagemap, called from /phpgwapi/images.php
*
* @param {array|object} _images
* @param {boolean} _need_clone _images need to be cloned, as it is from different window context
* and therefore will be inaccessible in IE, after that window is closed
*/
set_images: function (_images)
set_images: function (_images, _need_clone)
{
images = _images;
images = _need_clone ? jQuery.extend(true, {}, _images) : _images;
},
/**

View File

@ -37,13 +37,16 @@ egw.extend('lang', egw.MODULE_GLOBAL, function() {
*
* @param {string} _app
* @param {object} _messages message => translation pairs
* @param {boolean} _need_clone _messages need to be cloned, as it is from different window context
* and therefore will be inaccessible in IE, after that window is closed
* @memberOf egw
*/
set_lang_arr: function(_app, _messages)
set_lang_arr: function(_app, _messages, _need_clone)
{
if(!jQuery.isArray(_messages))
{
lang_arr[_app] = _messages;
// no deep clone jQuery.extend(true,...) neccessary, as _messages contains only string values
lang_arr[_app] = _need_clone ? jQuery.extend({}, _messages) : _messages;
}
},

View File

@ -220,16 +220,18 @@ egw.extend('links', egw.MODULE_GLOBAL, function()
*
* @param {object} _registry whole registry or entries for just one app
* @param {string} _app
* @param {boolean} _need_clone _images need to be cloned, as it is from different window context
* and therefore will be inaccessible in IE, after that window is closed
*/
set_link_registry: function (_registry, _app)
set_link_registry: function (_registry, _app, _need_clone)
{
if (typeof _app == 'undefined')
{
link_registry = _registry;
link_registry = _need_clone ? jQuery.extend(true, {}, _registry) : _registry;
}
else
{
link_registry[_app] = _registry;
link_registry[_app] = _need_clone ? jQuery.extend(true, {}, _registry) : _registry;
}
},

View File

@ -33,16 +33,18 @@ egw.extend('preferences', egw.MODULE_GLOBAL, function() {
*
* @param {object} _data object with name: value pairs to set
* @param {string} _app application name, 'common' or undefined to prefes of all apps at once
* @param {boolean} _need_clone _data need to be cloned, as it is from different window context
* and therefore will be inaccessible in IE, after that window is closed
*/
set_preferences: function(_data, _app)
set_preferences: function(_data, _app, _need_clone)
{
if (typeof _app == 'undefined')
{
prefs = _data;
prefs = _need_clone ? jQuery.extend(true, {}, _data) : _data;
}
else
{
prefs[_app] = jQuery.extend({}, _data);
prefs[_app] = jQuery.extend(true, {}, _data); // we always clone here, as call can come from this.preferences!
}
},

View File

@ -21,34 +21,34 @@
/**
* Store is a wrapper around browser based, persistant storage.
*
*
*
*
* @see http://www.w3.org/TR/webstorage/#storage
*
* @param {type} param1
* @param {type} param2
* @param {type} param3
*
* @param {string} _app
* @param {DOMWindow} _wnd
*/
egw.extend('store', egw.MODULE_GLOBAL, function(_app, _wnd) {
var egw = this;
/**
* Since the storage is shared across at least all applications, make
* the key include some extra info.
*
*
* @param {string} application
* @param {string} key
* @returns {undefined}
*/
function mapKey(application, key)
{
return egw.config('phpgwapi', 'instance_id') + '-' + application + '-' + key;
return application + '-' + key;
}
return {
/**
* Retrieve a value from session storage
*
*
* @param {string} application Name of application, or common
* @param {string} key
* @returns {string}
@ -60,7 +60,7 @@ egw.extend('store', egw.MODULE_GLOBAL, function(_app, _wnd) {
/**
* Set a value in session storage
*
*
* @param {string} application Name of application, or common
* @param {string} key
* @param {string} value
@ -70,7 +70,7 @@ egw.extend('store', egw.MODULE_GLOBAL, function(_app, _wnd) {
key = mapKey(application, key);
return _wnd.sessionStorage.setItem(key, value);
},
/**
* Remove a value from session storage
* @param {string} application
@ -80,8 +80,6 @@ egw.extend('store', egw.MODULE_GLOBAL, function(_app, _wnd) {
removeSessionItem: function(application, key) {
key = uniqueKey(application, key);
return _wnd.sessionStorage.removeItem(key);
},
}
}
};
});

View File

@ -41,10 +41,12 @@ egw.extend('user', egw.MODULE_GLOBAL, function()
* Set data of current user
*
* @param {object} _data
* @param {boolean} _need_clone _data need to be cloned, as it is from different window context
* and therefore will be inaccessible in IE, after that window is closed
*/
set_user: function(_data)
set_user: function(_data, _need_clone)
{
userData = _data;
userData = _need_clone ? jQuery.extend(true, {}, _data) : _data;
},
/**
@ -92,7 +94,9 @@ egw.extend('user', egw.MODULE_GLOBAL, function()
{
// Synchronous
egw.json('home.egw_framework.ajax_user_list.template',[],
function(data) {accountStore = data||{};}
function(data) {
accountStore = jQuery.extend(true, {}, data||{});
}
).sendRequest();
}
if(type == 'both')

View File

@ -59,7 +59,7 @@ if (!count(translation::$lang_arr))
}
// fix for phrases containing \n
$content = 'egw.set_lang_arr("'.$_GET['app'].'", '.str_replace('\\\\n', '\\n', json_encode(translation::$lang_arr)).');';
$content = 'egw.set_lang_arr("'.$_GET['app'].'", '.str_replace('\\\\n', '\\n', json_encode(translation::$lang_arr)).', egw && egw.window !== window);';
// we run our own gzip compression, to set a correct Content-Length of the encoded content
if (in_array('gzip', explode(',',$_SERVER['HTTP_ACCEPT_ENCODING'])) && function_exists('gzencode'))

View File

@ -42,9 +42,9 @@ if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && $_SERVER['HTTP_IF_NONE_MATCH'] == $
common::egw_exit();
}
$content = 'egw.set_preferences('.$preferences.", 'common');\n";
$content .= 'egw.set_preferences('.$ab_preferences.", 'addressbook');\n";
$content .= 'egw.set_user('.$user.");\n";
$content = 'egw.set_preferences('.$preferences.", 'common', egw && egw.window !== window);\n";
$content .= 'egw.set_preferences('.$ab_preferences.", 'addressbook', egw && egw.window !== window);\n";
$content .= 'egw.set_user('.$user.", egw && egw.window !== window);\n";
// we run our own gzip compression, to set a correct Content-Length of the encoded content
if (in_array('gzip', explode(',',$_SERVER['HTTP_ACCEPT_ENCODING'])) && function_exists('gzencode'))