fixed after new shutdown handling broken autoloading of tree nodes: json.php is used to send arbitrary JSON data, instead using egw_json_response methods (egw_json_request::isJSONRequest(false) turns that off now)

This commit is contained in:
Ralf Becker 2014-02-22 15:51:14 +00:00
parent 2f3add4ce9
commit 4ff1a4efd1
2 changed files with 22 additions and 3 deletions

View File

@ -76,8 +76,12 @@ class etemplate_widget_tree extends etemplate_widget
*/
public static function send_quote_json(array $data)
{
// switch regular JSON response handling off
egw_json_request::isJSONRequest(false);
header('Content-Type: application/json; charset=utf-8');
echo json_encode(self::htmlencode_node($data));
common::egw_exit();
}

View File

@ -18,9 +18,24 @@ class egw_json_request
private static $_hadJSONRequest = false;
public static function isJSONRequest()
/**
* Check if JSON request running or (re)set JSON request flag
*
* Can be used to:
* - detect regular JSON request:
* egw_json_request::isJSONRequest()
* - switch regular JSON response handling off, which would send arbitrary output via response method "html".
* Neccessary if json.php is used to send arbitrary JSON data eg. nodes for foldertree!
* egw_json_request::isJSONRequest(false)
*
* @param boolean $set=null
* @return boolean
*/
public static function isJSONRequest($set=null)
{
return self::$_hadJSONRequest;
$ret = self::$_hadJSONRequest;
if (isset($set)) self::$_hadJSONRequest = $set;
return $ret;
}
/**
@ -249,7 +264,7 @@ class egw_json_response
{
if (!$inst->haveJSONResponse())
{
error_log(__METHOD__."() adding output with inst->addGeneric('output', '$output')");
error_log(__METHOD__."() adding output with inst->addGeneric('html', '$output')");
$inst->addGeneric('html', $output);
}
else