aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorPeter Wu2014-12-14 01:07:14 +0100
committerPim van den Berg2014-12-14 15:58:35 +0100
commitab2bcff2d4bba317317e9e8fae071c840add63c7 (patch)
tree1c1d2bbc833c450f1e852a15f44b575253fbd2c1
parentinc/html: include jquery from local source (diff)
downloadapt-panopticon_cgp-ab2bcff2d4bba317317e9e8fae071c840add63c7.zip
apt-panopticon_cgp-ab2bcff2d4bba317317e9e8fae071c840add63c7.tar.gz
apt-panopticon_cgp-ab2bcff2d4bba317317e9e8fae071c840add63c7.tar.bz2
apt-panopticon_cgp-ab2bcff2d4bba317317e9e8fae071c840add63c7.tar.xz
Revert "make detail page accessible when using "canvas" graph_type"
This reverts commit 82d88098f4203cf7402d4faf5ad100cada70efaf. Breaks async rendering, see https://github.com/pommi/CGP/issues/106#issuecomment-66896905
-rw-r--r--detail.php2
-rw-r--r--inc/functions.inc.php10
-rw-r--r--inc/html.inc.php8
-rw-r--r--js/CGP.js6
-rw-r--r--type/Base.class.php2
5 files changed, 2 insertions, 26 deletions
diff --git a/detail.php b/detail.php
index 270a935..777294b 100644
--- a/detail.php
+++ b/detail.php
@@ -55,9 +55,7 @@ print "</ul>\n";
55 55
56if ($CONFIG['graph_type'] == 'canvas') { 56if ($CONFIG['graph_type'] == 'canvas') {
57 chdir($CONFIG['webdir']); 57 chdir($CONFIG['webdir']);
58 printf('<canvas id="%s" class="rrd">', generate_uuid());
59 include $CONFIG['webdir'].'/graph.php'; 58 include $CONFIG['webdir'].'/graph.php';
60 print '</canvas>';
61} else { 59} else {
62 printf("<img src=\"%s%s\">\n", 60 printf("<img src=\"%s%s\">\n",
63 htmlentities($CONFIG['weburl']), 61 htmlentities($CONFIG['weburl']),
diff --git a/inc/functions.inc.php b/inc/functions.inc.php
index df02d20..abe0763 100644
--- a/inc/functions.inc.php
+++ b/inc/functions.inc.php
@@ -59,13 +59,3 @@ function error_image() {
59 readfile('layout/error.png'); 59 readfile('layout/error.png');
60 exit; 60 exit;
61} 61}
62
63function generate_uuid() {
64 return sprintf( '%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
65 mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ),
66 mt_rand( 0, 0xffff ),
67 mt_rand( 0, 0x0fff ) | 0x4000,
68 mt_rand( 0, 0x3fff ) | 0x8000,
69 mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff )
70 );
71}
diff --git a/inc/html.inc.php b/inc/html.inc.php
index 7bc1852..2d745ec 100644
--- a/inc/html.inc.php
+++ b/inc/html.inc.php
@@ -360,15 +360,7 @@ function graphs_from_plugin($host, $plugin, $overview=false) {
360 isset($items['t']) ? $_GET['t'] = $items['t'] : $_GET['t'] = ''; 360 isset($items['t']) ? $_GET['t'] = $items['t'] : $_GET['t'] = '';
361 isset($items['ti']) ? $_GET['ti'] = $items['ti'] : $_GET['ti'] = ''; 361 isset($items['ti']) ? $_GET['ti'] = $items['ti'] : $_GET['ti'] = '';
362 $_GET['s'] = $time; 362 $_GET['s'] = $time;
363 $uuid = generate_uuid();
364 printf('<canvas id="%s" class="rrd">', $uuid);
365 include $CONFIG['webdir'].'/graph.php'; 363 include $CONFIG['webdir'].'/graph.php';
366 print '</canvas>';
367 printf('<a href="%s%s"><img id="%s-img" alt="graph"></a>'."\n",
368 htmlentities($CONFIG['weburl']),
369 htmlentities(build_url('detail.php', $items, $time)),
370 $uuid
371 );
372 } else { 364 } else {
373 printf('<a href="%1$s%2$s"><img src="%1$s%3$s"></a>'."\n", 365 printf('<a href="%1$s%2$s"><img src="%1$s%3$s"></a>'."\n",
374 htmlentities($CONFIG['weburl']), 366 htmlentities($CONFIG['weburl']),
diff --git a/js/CGP.js b/js/CGP.js
index 5ed729b..d726533 100644
--- a/js/CGP.js
+++ b/js/CGP.js
@@ -132,12 +132,6 @@ var CGP = (function() {
132 var canvases = document.getElementsByClassName('rrd'); 132 var canvases = document.getElementsByClassName('rrd');
133 for (var i = 0; i < canvases.length; i++) { 133 for (var i = 0; i < canvases.length; i++) {
134 draw(canvases[i].id, async); 134 draw(canvases[i].id, async);
135
136 if (document.getElementById(canvases[i].id + '-img')) {
137 document.getElementById(canvases[i].id).style.display = 'none';
138 var dataURL = canvases[i].toDataURL();
139 document.getElementById(canvases[i].id + '-img').src = dataURL;
140 }
141 } 135 }
142 } 136 }
143 137
diff --git a/type/Base.class.php b/type/Base.class.php
index ee5050b..8d51121 100644
--- a/type/Base.class.php
+++ b/type/Base.class.php
@@ -225,9 +225,11 @@ class Type_Base {
225 print '</pre>'; 225 print '</pre>';
226 break; 226 break;
227 case 'canvas': 227 case 'canvas':
228 printf('<canvas id="%s" class="rrd">', sha1(serialize($graphoptions)));
228 foreach ($graphoptions as $d) { 229 foreach ($graphoptions as $d) {
229 printf("\"%s\"\n", htmlentities($d)); 230 printf("\"%s\"\n", htmlentities($d));
230 } 231 }
232 print '</canvas>';
231 break; 233 break;
232 case 'debug': 234 case 'debug':
233 case 1: 235 case 1: