mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-22 16:03:47 +01:00
egw_json plugin "html" replacing document content with send html
This commit is contained in:
parent
130dc87e83
commit
4a88a9558c
@ -248,7 +248,7 @@ class egw_json_response
|
|||||||
if (!$inst->haveJSONResponse())
|
if (!$inst->haveJSONResponse())
|
||||||
{
|
{
|
||||||
error_log(__METHOD__."() adding output with inst->addGeneric('output', '$output')");
|
error_log(__METHOD__."() adding output with inst->addGeneric('output', '$output')");
|
||||||
$inst->addGeneric('output', $output);
|
$inst->addGeneric('html', $output);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -360,6 +360,25 @@ egw.extend('json', egw.MODULE_WND_LOCAL, function(_egw, _wnd) {
|
|||||||
throw 'Invalid parameters';
|
throw 'Invalid parameters';
|
||||||
}, null, 'js');
|
}, null, 'js');
|
||||||
|
|
||||||
|
// Register the 'html' plugin, replacing document content with send html
|
||||||
|
json.registerJSONPlugin(function(type, res, req) {
|
||||||
|
if (typeof res.data == 'string')
|
||||||
|
{
|
||||||
|
// Empty the document tree
|
||||||
|
while (_wnd.document.childNodes.length > 0)
|
||||||
|
{
|
||||||
|
_wnd.document.removeChild(document.childNodes[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Write the given content
|
||||||
|
_wnd.document.write(res.data);
|
||||||
|
|
||||||
|
// Close the document
|
||||||
|
_wnd.document.close();
|
||||||
|
}
|
||||||
|
throw 'Invalid parameters';
|
||||||
|
}, null, 'html');
|
||||||
|
|
||||||
// Return the extension
|
// Return the extension
|
||||||
return json;
|
return json;
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user