[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r14496 - gauger
From: |
gnunet |
Subject: |
[GNUnet-SVN] r14496 - gauger |
Date: |
Wed, 23 Feb 2011 11:58:43 +0100 |
Author: bartpolot
Date: 2011-02-23 11:58:43 +0100 (Wed, 23 Feb 2011)
New Revision: 14496
Modified:
gauger/plot.php
gauger/style.css
gauger/template.php
gauger/template_graph.php
gauger/template_host.php
Log:
Added gnuplot source file creation from any plot, changed table formatting
Modified: gauger/plot.php
===================================================================
--- gauger/plot.php 2011-02-23 10:52:16 UTC (rev 14495)
+++ gauger/plot.php 2011-02-23 10:58:43 UTC (rev 14496)
@@ -7,19 +7,24 @@
* @return: gnuplot file with inline data
*/
function build_gnuplot_file($cmd, $rangecmd, $plotcmd) {
- // TODO: get all files used in plot
+ $header = file_get_contents("header.gp");
+ $cmd = preg_replace('/[^;]+; (.*)/', '\1', $cmd);
$files = explode(",", $plotcmd);
foreach ($files as $i => $file) {
- //$files[$i] = preg_replace('/[^"]*"\([^"]*\).*/', "\1", $file);
- echo "$file -> " . preg_replace('/[^"]+"([^"]+).*/', '\1#', $file) .
"\n";
+ $path = preg_replace('/[^"]+"([^"]+).*/', '\1', $file);
+ $pathr = preg_replace('/\//', '\/', $path); //str_replace?
+ $plotcmd = preg_replace('/'.$pathr.'/', "-", $plotcmd);
+ $files[$i] = file_get_contents($path);
}
- print_r($files);
- die();
+ header('Content-Type: text/plain');
+ header('Content-Disposition: attachment; filename=source.gp');
+ echo $header;
+ echo str_replace("; ", ";\n", $cmd) . "\n";
+ echo "$plotcmd;\n";
foreach($files as $file) {
- //include data inline
- //substitute dataname with index
+ echo "${file}e\n";
}
- return "";
+ die();
}
/** Function build_gnuplot_command
@@ -129,8 +134,7 @@
}
if(get_param('raw_cmd') == 'true') {
- $cmd = build_gnuplot_file($cmd, $rangecmd, $plotcmd);
- die($cmd);
+ build_gnuplot_file($cmd, $rangecmd, $plotcmd);
} else {
$cmd = build_gnuplot_command($cmd, $rangecmd, $plotcmd);
$out = shell_exec($cmd);
Modified: gauger/style.css
===================================================================
--- gauger/style.css 2011-02-23 10:52:16 UTC (rev 14495)
+++ gauger/style.css 2011-02-23 10:58:43 UTC (rev 14496)
@@ -34,6 +34,10 @@
font-weight: normal;
}
+th.control-column {
+ width: 100px;
+}
+
td {
background-color: white;
border: 1px;
Modified: gauger/template.php
===================================================================
--- gauger/template.php 2011-02-23 10:52:16 UTC (rev 14495)
+++ gauger/template.php 2011-02-23 10:58:43 UTC (rev 14496)
@@ -180,9 +180,7 @@
function get_command(element) {
var url = $(element).parents("tr").find("img").attr("src");
- $.get(url + "&raw_cmd=true", function(data) {
- alert(data)
- });
+ document.location = url + "&raw_cmd=true";
}
function debug(param) {
Modified: gauger/template_graph.php
===================================================================
--- gauger/template_graph.php 2011-02-23 10:52:16 UTC (rev 14495)
+++ gauger/template_graph.php 2011-02-23 10:58:43 UTC (rev 14496)
@@ -2,7 +2,7 @@
<?php if (array_key_exists($currentg, $metrics)): ?>
<table>
<tr>
- <th>Controls</th>
+ <th class="control-column">Controls</th>
<th>Graph</th>
</tr>
<tr>
@@ -26,7 +26,7 @@
<?php endif; ?>
<?php endforeach; ?>
<br/><br/>
- <a href="#" onclick="get_command(this); return false;" >Get
Command</a>
+ <a href="#" onclick="get_command(this); return false;" >Get
Source</a>
</th>
<td height="<?php echo get_session('png_y_size')+2 ?>" width="<?php
echo get_session('png_x_size')+2 ?>"><img class="plot" src="plot.php?g=<?php
echo $currentg ?>" alt="loading..."/></td>
</tr>
Modified: gauger/template_host.php
===================================================================
--- gauger/template_host.php 2011-02-23 10:52:16 UTC (rev 14495)
+++ gauger/template_host.php 2011-02-23 10:58:43 UTC (rev 14496)
@@ -3,7 +3,7 @@
<?php if (!empty($hosts[$current])): ?>
<table>
<tr>
- <th>Controls</th>
+ <th class="control-column">Controls</th>
<th>Graph</th>
</tr>
<?php foreach ($hosts[$current] as $counter): ?>
@@ -24,7 +24,7 @@
<br/>
<a href="?graph=<?php echo $counter ?>">Compare</a>
<br/><br/>
- <a href="#" onclick="get_command(this); return false;" >Get
Command</a>
+ <a href="#" onclick="get_command(this); return false;" >Get
Source</a>
</th>
<td height="<?php echo get_session('png_y_size')+2 ?>"
width="<?php echo get_session('png_x_size')+2 ?>"><img class="plot"
src="plot.php?h=<?php echo "$current&g=$counter" ?>" alt="loading..."/></td>
</tr>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r14496 - gauger,
gnunet <=