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;
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
$('document').ready(function () {
|
||||
setTimeout(function () {
|
||||
if (typeof window.callPhantom === 'function') {
|
||||
window.callPhantom("loaded");
|
||||
}
|
||||
}, 10);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
|
@ -3320,12 +3320,13 @@ function generator_chart_to_pdf($type_graph_pdf, $params, $params_combined = fal
|
|||
. ' "' . $session_id . '"'
|
||||
. ' "' . $params['return_img_base_64'] . '"';
|
||||
|
||||
$result = exec($cmd);
|
||||
exec($cmd, $result);
|
||||
$img_content = join("\n", $result);
|
||||
|
||||
if($params['return_img_base_64']){
|
||||
// To be used in alerts
|
||||
$width_img = 500;
|
||||
return $result;
|
||||
return $img_content;
|
||||
}
|
||||
else{
|
||||
// to be used in PDF files
|
||||
|
|
|
@ -4,8 +4,6 @@ if (system.args.length < 3 || system.args.length > 11) {
|
|||
phantom.exit(1);
|
||||
}
|
||||
|
||||
var webPage = require('webpage');
|
||||
var page = webPage.create();
|
||||
var url = system.args[1];
|
||||
var type_graph_pdf = system.args[2];
|
||||
var url_params = system.args[3];
|
||||
|
@ -39,30 +37,32 @@ else{
|
|||
"&session_id=" + session_id;
|
||||
}
|
||||
|
||||
|
||||
|
||||
var page = require('webpage').create();
|
||||
|
||||
|
||||
page.viewportSize = {
|
||||
width: viewport_width,
|
||||
height: viewport_height
|
||||
};
|
||||
|
||||
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…
Reference in New Issue