mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-26 16:48:49 +01:00
IE JSON-serializes arrays passed in from different window contextx (eg. popups) as objects (it looses object-type of array), causing them to be JSON serialized as objects and loosing parameters which are undefined
JSON.strigify([123,undefined]) --> "{0:123}" instead of "[123,null]"
This commit is contained in:
parent
a96d7d50be
commit
284ffa7f13
@ -68,7 +68,7 @@ class egw_json_request
|
||||
{
|
||||
$responses = array();
|
||||
$response = egw_json_response::get();
|
||||
foreach($parameters as $uid => $data)
|
||||
foreach($parameters[0] as $uid => $data)
|
||||
{
|
||||
//error_log("$uid: menuaction=$data[menuaction], parameters=".array2string($data['parameters']));
|
||||
$this->handleRequest($data['menuaction'], (array)$data['parameters']);
|
||||
@ -158,9 +158,8 @@ class egw_json_request
|
||||
// they are already loaded, in fact jquery has a problem if loaded twice
|
||||
egw_framework::js_files(array());
|
||||
|
||||
$parameters = translation::convert($parameters, 'utf-8');
|
||||
|
||||
call_user_func_array(array($ajaxClass, $functionName), $parameters);
|
||||
call_user_func_array(array($ajaxClass, $functionName),
|
||||
translation::convert($parameters, 'utf-8'));
|
||||
|
||||
// check if we have push notifications, if notifications app available
|
||||
if (class_exists('notifications_push')) notifications_push::get();
|
||||
@ -688,7 +687,7 @@ class xajaxResponse
|
||||
return call_user_func_array(array(egw_json_response::get(), $name), $args);
|
||||
}
|
||||
|
||||
public function addScriptCall($func)
|
||||
public function addScriptCall()
|
||||
{
|
||||
$args = func_get_args();
|
||||
$func = array_shift($args);
|
||||
|
@ -47,7 +47,11 @@ egw.extend('json', egw.MODULE_WND_LOCAL, function(_app, _wnd) {
|
||||
{
|
||||
// Copy the parameters
|
||||
this.url = _egw.ajaxUrl(_menuaction);
|
||||
this.parameters = _parameters ? _parameters : [];
|
||||
// IE JSON-serializes arrays passed in from different window contextx (eg. popups)
|
||||
// as objects (it looses object-type of array), causing them to be JSON serialized
|
||||
// as objects and loosing parameters which are undefined
|
||||
// JSON.strigify([123,undefined]) --> '{"0":123}' instead of '[123,null]'
|
||||
this.parameters = _parameters ? [].concat(_parameters) : [];
|
||||
this.async = _async ? _async : false;
|
||||
this.callback = _callback ? _callback : null;
|
||||
this.context = _context ? _context : null;
|
||||
|
@ -17,8 +17,8 @@
|
||||
egw_debug;
|
||||
*/
|
||||
|
||||
egw.extend('jsonq', egw.MODULE_GLOBAL, function() {
|
||||
|
||||
egw.extend('jsonq', egw.MODULE_GLOBAL, function()
|
||||
{
|
||||
/**
|
||||
* Queued json requests (objects with attributes menuaction, parameters, context, callback, sender and callbeforesend)
|
||||
*
|
||||
@ -39,7 +39,7 @@ egw.extend('jsonq', egw.MODULE_GLOBAL, function() {
|
||||
/**
|
||||
* Dispatch responses received
|
||||
*
|
||||
* @param object _data uid => response pairs
|
||||
* @param {object} _data uid => response pairs
|
||||
*/
|
||||
function jsonq_callback(_data)
|
||||
{
|
||||
@ -106,7 +106,7 @@ egw.extend('jsonq', egw.MODULE_GLOBAL, function() {
|
||||
if (something_to_send)
|
||||
{
|
||||
// TODO: Passing this to the "home" application looks quite ugly
|
||||
var request = egw.json('home.queue', jobs_to_send, jsonq_callback, this)
|
||||
var request = egw.json('home.queue', jobs_to_send, jsonq_callback, this);
|
||||
request.sendRequest(true);
|
||||
}
|
||||
}
|
||||
@ -116,13 +116,13 @@ egw.extend('jsonq', egw.MODULE_GLOBAL, function() {
|
||||
/**
|
||||
* Send a queued JSON call to the server
|
||||
*
|
||||
* @param string _menuaction the menuaction function which should be called and
|
||||
* @param {string} _menuaction the menuaction function which should be called and
|
||||
* which handles the actual request. If the menuaction is a full featured
|
||||
* url, this one will be used instead.
|
||||
* @param array _parameters which should be passed to the menuaction function.
|
||||
* @param function _callback callback function which should be called upon a "data" response is received
|
||||
* @param object _sender is the reference object the callback function should get
|
||||
* @param function _callbeforesend optional callback function which can modify the parameters, eg. to do some own queuing
|
||||
* @param {array} _parameters which should be passed to the menuaction function.
|
||||
* @param {function} _callback callback function which should be called upon a "data" response is received
|
||||
* @param {object} _sender is the reference object the callback function should get
|
||||
* @param {function} _callbeforesend optional callback function which can modify the parameters, eg. to do some own queuing
|
||||
* @return string uid of the queued request
|
||||
*/
|
||||
jsonq: function(_menuaction, _parameters, _callback, _sender, _callbeforesend)
|
||||
@ -130,7 +130,11 @@ egw.extend('jsonq', egw.MODULE_GLOBAL, function() {
|
||||
var uid = 'u'+(jsonq_uid++);
|
||||
jsonq_queue[uid] = {
|
||||
menuaction: _menuaction,
|
||||
parameters: _parameters,
|
||||
// IE JSON-serializes arrays passed in from different window contextx (eg. popups)
|
||||
// as objects (it looses object-type of array), causing them to be JSON serialized
|
||||
// as objects and loosing parameters which are undefined
|
||||
// JSON.strigify([123,undefined]) --> '{"0":123}' instead of '[123,null]'
|
||||
parameters: _parameters ? [].concat(_parameters) : [],
|
||||
callback: _callback,
|
||||
sender: _sender,
|
||||
callbeforesend: _callbeforesend
|
||||
@ -148,7 +152,4 @@ egw.extend('jsonq', egw.MODULE_GLOBAL, function() {
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user