mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-30 01:05:39 +02:00
Merge branch 'fix/graphs_in_alerts' into 'develop'
fixed related changes in phantomjs interface See merge request artica/pandorafms!2029
This commit is contained in:
commit
dcacd53d5b
@ -213,6 +213,16 @@ if (file_exists ('languages/'.$user_language.'.mo')) {
|
|||||||
|
|
||||||
$config['font_size'] = $aux_font_size;
|
$config['font_size'] = $aux_font_size;
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
$('document').ready(function () {
|
||||||
|
setTimeout(function () {
|
||||||
|
if (typeof window.callPhantom === 'function') {
|
||||||
|
window.callPhantom("loaded");
|
||||||
|
}
|
||||||
|
}, 10);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
@ -3320,12 +3320,13 @@ function generator_chart_to_pdf($type_graph_pdf, $params, $params_combined = fal
|
|||||||
. ' "' . $session_id . '"'
|
. ' "' . $session_id . '"'
|
||||||
. ' "' . $params['return_img_base_64'] . '"';
|
. ' "' . $params['return_img_base_64'] . '"';
|
||||||
|
|
||||||
$result = exec($cmd);
|
exec($cmd, $result);
|
||||||
|
$img_content = join("\n", $result);
|
||||||
|
|
||||||
if($params['return_img_base_64']){
|
if($params['return_img_base_64']){
|
||||||
// To be used in alerts
|
// To be used in alerts
|
||||||
$width_img = 500;
|
$width_img = 500;
|
||||||
return $result;
|
return $img_content;
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
// to be used in PDF files
|
// to be used in PDF files
|
||||||
|
@ -4,8 +4,6 @@ if (system.args.length < 3 || system.args.length > 11) {
|
|||||||
phantom.exit(1);
|
phantom.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
var webPage = require('webpage');
|
|
||||||
var page = webPage.create();
|
|
||||||
var url = system.args[1];
|
var url = system.args[1];
|
||||||
var type_graph_pdf = system.args[2];
|
var type_graph_pdf = system.args[2];
|
||||||
var url_params = system.args[3];
|
var url_params = system.args[3];
|
||||||
@ -39,30 +37,32 @@ else{
|
|||||||
"&session_id=" + session_id;
|
"&session_id=" + session_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var page = require('webpage').create();
|
||||||
|
|
||||||
|
|
||||||
page.viewportSize = {
|
page.viewportSize = {
|
||||||
width: viewport_width,
|
width: viewport_width,
|
||||||
height: viewport_height
|
height: viewport_height
|
||||||
};
|
};
|
||||||
|
|
||||||
page.zoomFactor = 1;
|
page.zoomFactor = 1;
|
||||||
|
|
||||||
page.open(url, 'POST', post_data, function start(status) {
|
|
||||||
|
|
||||||
|
page.onCallback = function (st){
|
||||||
|
if(!base_64){
|
||||||
|
page.render(output_filename, {format: 'png'});
|
||||||
|
} else{
|
||||||
|
var base64 = page.renderBase64('png');
|
||||||
|
// do not remove this console.output
|
||||||
|
console.log(base64);
|
||||||
|
}
|
||||||
|
phantom.exit();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
page.open(url, 'POST', post_data, function (status) {
|
||||||
});
|
});
|
||||||
|
|
||||||
page.onLoadFinished = function (status) {
|
|
||||||
if(!base_64){
|
|
||||||
setTimeout(function() {
|
|
||||||
page.render(output_filename, {format: 'png'});
|
|
||||||
phantom.exit();
|
|
||||||
}, 200);
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
var base64 = page.renderBase64('png');
|
|
||||||
//XXXX
|
|
||||||
console.log(base64);
|
|
||||||
phantom.exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user