From 7f8b201330b6d8a37236e75e9d79064481e05349 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Mon, 2 Feb 2015 19:54:53 +0000 Subject: [PATCH] * 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 --- mail/inc/class.mail_compose.inc.php | 5 ----- mail/inc/class.mail_ui.inc.php | 5 ----- phpgwapi/config.php | 4 ++-- phpgwapi/images.php | 2 +- phpgwapi/js/jsapi/egw_config.js | 12 ++++++----- phpgwapi/js/jsapi/egw_images.js | 6 ++++-- phpgwapi/js/jsapi/egw_lang.js | 7 ++++-- phpgwapi/js/jsapi/egw_links.js | 8 ++++--- phpgwapi/js/jsapi/egw_preferences.js | 8 ++++--- phpgwapi/js/jsapi/egw_store.js | 32 +++++++++++++--------------- phpgwapi/js/jsapi/egw_user.js | 10 ++++++--- phpgwapi/lang.php | 2 +- phpgwapi/user.php | 6 +++--- 13 files changed, 55 insertions(+), 52 deletions(-) diff --git a/mail/inc/class.mail_compose.inc.php b/mail/inc/class.mail_compose.inc.php index 31fe317548..79f6af32cc 100644 --- a/mail/inc/class.mail_compose.inc.php +++ b/mail/inc/class.mail_compose.inc.php @@ -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']; diff --git a/mail/inc/class.mail_ui.inc.php b/mail/inc/class.mail_ui.inc.php index f5989739b6..a235c3aca2 100644 --- a/mail/inc/class.mail_ui.inc.php +++ b/mail/inc/class.mail_ui.inc.php @@ -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']); diff --git a/phpgwapi/config.php b/phpgwapi/config.php index c0b4782a07..c9a7e52046 100644 --- a/phpgwapi/config.php +++ b/phpgwapi/config.php @@ -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')) diff --git a/phpgwapi/images.php b/phpgwapi/images.php index e158f34870..c2ac8b567a 100644 --- a/phpgwapi/images.php +++ b/phpgwapi/images.php @@ -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')) diff --git a/phpgwapi/js/jsapi/egw_config.js b/phpgwapi/js/jsapi/egw_config.js index 89cd0dd36c..af8a90d833 100644 --- a/phpgwapi/js/jsapi/egw_config.js +++ b/phpgwapi/js/jsapi/egw_config.js @@ -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; } }; }); diff --git a/phpgwapi/js/jsapi/egw_images.js b/phpgwapi/js/jsapi/egw_images.js index 53ddb22d14..07402286f3 100644 --- a/phpgwapi/js/jsapi/egw_images.js +++ b/phpgwapi/js/jsapi/egw_images.js @@ -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; }, /** diff --git a/phpgwapi/js/jsapi/egw_lang.js b/phpgwapi/js/jsapi/egw_lang.js index 05ceffb6bb..80ff98c660 100644 --- a/phpgwapi/js/jsapi/egw_lang.js +++ b/phpgwapi/js/jsapi/egw_lang.js @@ -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; } }, diff --git a/phpgwapi/js/jsapi/egw_links.js b/phpgwapi/js/jsapi/egw_links.js index a4f906e733..909bb26fd1 100644 --- a/phpgwapi/js/jsapi/egw_links.js +++ b/phpgwapi/js/jsapi/egw_links.js @@ -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; } }, diff --git a/phpgwapi/js/jsapi/egw_preferences.js b/phpgwapi/js/jsapi/egw_preferences.js index 2827555580..f3d16e1251 100644 --- a/phpgwapi/js/jsapi/egw_preferences.js +++ b/phpgwapi/js/jsapi/egw_preferences.js @@ -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! } }, diff --git a/phpgwapi/js/jsapi/egw_store.js b/phpgwapi/js/jsapi/egw_store.js index 7403747d56..b704db786d 100644 --- a/phpgwapi/js/jsapi/egw_store.js +++ b/phpgwapi/js/jsapi/egw_store.js @@ -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); - }, - - - } + } + }; }); \ No newline at end of file diff --git a/phpgwapi/js/jsapi/egw_user.js b/phpgwapi/js/jsapi/egw_user.js index 1d0fa9e0fc..5a1ae6c21c 100644 --- a/phpgwapi/js/jsapi/egw_user.js +++ b/phpgwapi/js/jsapi/egw_user.js @@ -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') diff --git a/phpgwapi/lang.php b/phpgwapi/lang.php index da1218a847..6db7b8e7da 100644 --- a/phpgwapi/lang.php +++ b/phpgwapi/lang.php @@ -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')) diff --git a/phpgwapi/user.php b/phpgwapi/user.php index 18e7dec15a..a7fdd61769 100644 --- a/phpgwapi/user.php +++ b/phpgwapi/user.php @@ -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'))