[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r14417 - gauger
From: |
gnunet |
Subject: |
[GNUnet-SVN] r14417 - gauger |
Date: |
Wed, 16 Feb 2011 02:49:23 +0100 |
Author: bartpolot
Date: 2011-02-16 02:49:23 +0100 (Wed, 16 Feb 2011)
New Revision: 14417
Modified:
gauger/ajax.php
gauger/explore.php
gauger/index.php
gauger/params.php
gauger/template.php
gauger/template_host.php
Log:
Added smart range handling
Modified: gauger/ajax.php
===================================================================
--- gauger/ajax.php 2011-02-15 17:51:30 UTC (rev 14416)
+++ gauger/ajax.php 2011-02-16 01:49:23 UTC (rev 14417)
@@ -1,5 +1,6 @@
<?php
+include "explore.php";
include "params.php";
foreach (Array('x_max', 'x_min', 'y_max', 'y_min') as $param_name) {
Modified: gauger/explore.php
===================================================================
--- gauger/explore.php 2011-02-15 17:51:30 UTC (rev 14416)
+++ gauger/explore.php 2011-02-16 01:49:23 UTC (rev 14417)
@@ -11,6 +11,27 @@
return "";
}
+function get_range_global() {
+ $f = fopen("global_range.dat", 'r');
+ $buffer = fgets($f, 512);
+ fclose($f);
+ return explode(' ', $buffer);
+}
+
+function get_range($host, $counter) {
+ if(empty($host) || empty($counter)) return get_range_global();
+ $f = fopen("$host/$counter.dat", 'r');
+ $b = false;
+ while (($buffer = fgets($f, 512)) !== false) {
+ if($b === false) {$b = explode(' ', $buffer); $b = $b[0]; }
+ $e = $buffer;
+ }
+ fclose($f);
+ $e = explode(' ', $e);
+ $e = $e[0];
+ return Array($b, $e);
+}
+
$d = dir(".");
$hosts = array();
while (false !== ($entry = $d->read())) {
@@ -25,6 +46,7 @@
}
}
$d->close();
-// echo '<pre>';
-// print_r($hosts);
-// die('end');
\ No newline at end of file
+//echo '<pre>';
+//print_r(get_range("testhost", "c1_kbps"));
+//print_r(get_range('', ''));
+//die();
Modified: gauger/index.php
===================================================================
--- gauger/index.php 2011-02-15 17:51:30 UTC (rev 14416)
+++ gauger/index.php 2011-02-16 01:49:23 UTC (rev 14417)
@@ -1,6 +1,5 @@
<?php
-//include "plot.php"; // Aux function to generate a plot in real time
-include "params.php"; // Manage all parameters given by the user
include "explore.php"; // Gather all existing hosts and counters
+include "params.php"; // Manage all parameters given by the user
include "template.php"; // Display info
\ No newline at end of file
Modified: gauger/params.php
===================================================================
--- gauger/params.php 2011-02-15 17:51:30 UTC (rev 14416)
+++ gauger/params.php 2011-02-16 01:49:23 UTC (rev 14417)
@@ -39,4 +39,12 @@
if ($currentg = get_param('graph')) {
$mode_graph = TRUE;
-}
\ No newline at end of file
+}
+
+if (!get_session('xrange_min')) {
+ $r = get_range('','');
+ $_SESSION['xrange_min'] = $r[0];
+ $_SESSION['xrange_max'] = $r[1];
+}
+
+// die("#".get_session("xrange_min", "default") ."#");
Modified: gauger/template.php
===================================================================
--- gauger/template.php 2011-02-15 17:51:30 UTC (rev 14416)
+++ gauger/template.php 2011-02-16 01:49:23 UTC (rev 14417)
@@ -4,10 +4,16 @@
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Gauger [<?php echo isset($current) ? $current : $currentg
?>]</title>
+
<link
href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css"
rel="stylesheet" type="text/css"/>
<script type="text/javascript"
src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>
<script type="text/javascript"
src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.min.js"></script>
+<!-- <link href="jquery-ui.css" rel="stylesheet" type="text/css"/>
+ <script type="text/javascript" src="jquery.min.js"></script>
+ <script type="text/javascript" src="jquery-ui.min.js"></script>-->
+
+
<link rel="shortcut icon" href="favicon.png" />
<link href="style.css" type="text/css" rel="stylesheet">
@@ -18,15 +24,18 @@
range: true,
min: <?php echo get_session('xrange_min', '0') ?>,
max: <?php echo get_session('xrange_max', '100') ?>,
- values: [ <?php echo get_session('x_min', '0') ?> ,
<?php echo get_session('x_max', '100') ?> ],
+ values: [ <?php echo get_session('x_min',
get_session('xrange_min', '0')) ?> , <?php echo get_session('x_max',
get_session('xrange_max', '100')) ?> ],
slide: function( event, ui ) {
if(this.id == "default_range_slider") {
$(".left-range").html(ui.values[0]);
$(".right-range").html(ui.values[1]);
- $( ".slider-range" ).slider('option',
'values', ui.values);
+ $( ".slider-range" ).each(function(){
+ $(this).slider('values', 0,
ui.values[0]);
+ $(this).slider('values', 1,
ui.values[1]);
+ });
} else {
-
$(this).parent().find(".left-range").html(ui.values[0]);
-
$(this).parent().find(".right-range").html(ui.values[1]);
+
$(this).parents("tr").find(".left-range").html(ui.values[0]);
+
$(this).parents("tr").find(".right-range").html(ui.values[1]);
}
},
stop: function( event, ui ) {
@@ -36,14 +45,14 @@
x_max: ui.values[1],
persist: "true"
}, function(data) {
- $( ".plot" ).each(function(){
+ $( ".plot" ).each(function() {
this.src =
this.src.replace(/&x_m(ax|in)=[^&]+/g, '')+"&reload=1";
});
}
);
} else {
-
$(this).parents("tr").find("img").each(function(){
- this.src =
this.src+"&x_min="+ui.values[0]+"&x_max="+ui.values[1];
+
$(this).parents("tr").find(".plot").each(function(){
+ this.src =
this.src.replace(/&x_m(ax|in)=[^&]+/g,
'')+"&x_min="+ui.values[0]+"&x_max="+ui.values[1];
});
}
}
@@ -92,22 +101,21 @@
}
- function debug() {
- s = "a.php?a=1&b=2&x_max=100&x_min=0&bo=que";
- s = s.replace(/&x_m(ax|in)=[^&]+/g, '')+"&reload=1"
- alert(s);
+ function debug(param) {
+ $( "#debug" ).html($( "#debug" ).html() + param + ' ');
}
</script>
</head>
<body>
+ <div Id="debug"></div>
<div class="header">
<div class="advanced_menu">
<a href="#" id="default_range" >Default Range</a>
<div class="slider_control" id="default_range_control">
<div class="slider-range" id="default_range_slider"></div>
- <div class="left-range"><?php echo get_session('x_min',
'0') ?></div>
- <div class="right-range"><?php echo get_session('x_max',
'100') ?></div>
+ <div class="left-range"><?php echo get_session('x_min',
get_session('xrange_min', '0')) ?></div>
+ <div class="right-range"><?php echo get_session('x_max',
get_session('xrange_max', '0')) ?></div>
<div class="auto_range"><input style="float:left"
type="checkbox"/>Auto<input style="float:right;" type="checkbox"/></div>
</div> |
<a href="#" id="change_origin" >Change Origin</a>
Modified: gauger/template_host.php
===================================================================
--- gauger/template_host.php 2011-02-15 17:51:30 UTC (rev 14416)
+++ gauger/template_host.php 2011-02-16 01:49:23 UTC (rev 14417)
@@ -15,7 +15,7 @@
<br/>Range
<br/>
<div>
- <div class="slider-range"></div>
+ <div class="slider-range" id="other_slider" ></div>
<div class="left-range"><?php echo get_session('x_min',
'0') ?></div>
<div class="right-range"><?php echo get_session('x_max',
'100') ?></div>
</div>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r14417 - gauger,
gnunet <=