Fixed handling of json requests using etemplate.process_exec and fixes in the json encoding of hierarchical values

This commit is contained in:
Andreas Stöckel 2010-06-10 10:33:00 +00:00
parent d4549782e5
commit bd023081e6
2 changed files with 12 additions and 8 deletions

View File

@ -51,7 +51,6 @@ class egw_json_request
$parameters = $request['parameters']; $parameters = $request['parameters'];
/*$parameters = array_stripslashes($request['parameters']);*/ /*$parameters = array_stripslashes($request['parameters']);*/
} }
//Call the supplied callback function along with the menuaction and the passed parameters //Call the supplied callback function along with the menuaction and the passed parameters
$this->handleRequest($menuaction, $parameters); $this->handleRequest($menuaction, $parameters);
} }
@ -82,15 +81,15 @@ class egw_json_request
switch($handler) switch($handler)
{ {
case '/etemplate/process_exec': case '/etemplate/process_exec':
$menuaction = $appName.'.'.$className.'.'.$functionName; $_GET['menuaction'] = $appName.'.'.$className.'.'.$functionName;
$appName = $className = 'etemplate'; $appName = $className = 'etemplate';
$functionName = 'process_exec'; $functionName = 'process_exec';
$menuaction = 'etemplate.etemplate.process_exec'; $menuaction = 'etemplate.etemplate.process_exec';
$parameters = array( $parameters = array(
$argList[0]['etemplate_exec_id'], $parameters[0]['etemplate_exec_id'],
$argList[0]['submit_button'], $parameters[0]['submit_button'],
$argList[0], $parameters[0],
'xajaxResponse', 'xajaxResponse',
); );
//error_log("xajax_doXMLHTTP() /etemplate/process_exec handler: arg0='$menuaction', menuaction='$_GET[menuaction]'"); //error_log("xajax_doXMLHTTP() /etemplate/process_exec handler: arg0='$menuaction', menuaction='$_GET[menuaction]'");
@ -127,6 +126,10 @@ class egw_json_request
$parameters = translation::convert($parameters, 'utf-8'); $parameters = translation::convert($parameters, 'utf-8');
// error_log(print_r($parameters, true));
// _debug_array($parameters);
call_user_func_array(array($ajaxClass, $functionName), $parameters); call_user_func_array(array($ajaxClass, $functionName), $parameters);
} }
} }

View File

@ -320,10 +320,11 @@ function _egw_json_getFormValue(serialized, child)
} }
var name = child.name; var name = child.name;
var values = new Array; var values = null;
if ('select-multiple' == child.type) if ('select-multiple' == child.type)
{ {
values = new Array;
for (var j = 0; j < child.length; ++j) for (var j = 0; j < child.length; ++j)
{ {
var option = child.options[j]; var option = child.options[j];
@ -344,7 +345,7 @@ function _egw_json_getFormValue(serialized, child)
var k = n.substr(0, n.indexOf('[')); var k = n.substr(0, n.indexOf('['));
var a = n.substr(n.indexOf('[')); var a = n.substr(n.indexOf('['));
if (typeof serialized[k] == 'undefined') if (typeof serialized[k] == 'undefined')
serialized[k] = []; serialized[k] = new Object;
var p = serialized; // pointer reset var p = serialized; // pointer reset
while (a.length != 0) { while (a.length != 0) {
var sa = a.substr(0, a.indexOf(']')+1); var sa = a.substr(0, a.indexOf(']')+1);
@ -364,7 +365,7 @@ function _egw_json_getFormValue(serialized, child)
} }
} }
if (typeof p[k] == 'undefined') if (typeof p[k] == 'undefined')
p[k] = []; p[k] = new Object;
} }
p[k] = values; p[k] = values;
} else { } else {