Send any accumulated json responses after flushing etemplate - allows apps to use egw_json_response even when call is not an ajax call

This commit is contained in:
Nathan Gray 2013-06-12 21:06:40 +00:00
parent 22f2b5599b
commit ea104a9af5

View File

@ -233,6 +233,18 @@ class etemplate_new extends etemplate_widget_template
</script>
';
}
ob_flush();
// Send any accumulated json responses - after flush to avoid sending the buffer as a response
if(egw_json_response::isJSONResponse())
{
$response = egw_json_response::get();
echo '<script>egw.LAB.wait(function() {egw_json_request.prototype.handleResponse(';
ob_flush();
$response->sendResult();
unset($response);
echo ')});</script>';
}
common::egw_footer();
}
}