gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r14578 - in gauger: . css


From: gnunet
Subject: [GNUnet-SVN] r14578 - in gauger: . css
Date: Fri, 4 Mar 2011 02:40:04 +0100

Author: bartpolot
Date: 2011-03-04 02:40:03 +0100 (Fri, 04 Mar 2011)
New Revision: 14578

Modified:
   gauger/css/style.css
   gauger/explore.php
   gauger/template.php
   gauger/template_host.php
Log:
Added pager in host view, changed default item display mode to avoid flicker on 
load


Modified: gauger/css/style.css
===================================================================
--- gauger/css/style.css        2011-03-03 20:45:20 UTC (rev 14577)
+++ gauger/css/style.css        2011-03-04 01:40:03 UTC (rev 14578)
@@ -156,6 +156,10 @@
     margin-top:         -31px;
 }
 
+.search_item {
+    display:            none;
+}
+
 .metric_category_header {
     background:         #D3D3D3;
     padding:            1px 1px 1px 5px;

Modified: gauger/explore.php
===================================================================
--- gauger/explore.php  2011-03-03 20:45:20 UTC (rev 14577)
+++ gauger/explore.php  2011-03-04 01:40:03 UTC (rev 14578)
@@ -18,8 +18,9 @@
     along with gauger.  If not, see <http://www.gnu.org/licenses/>.
 
 */
-$CONF = parse_ini_file("gauger.conf");
-$DATADIR = $CONF["data"] ? $CONF["data"] : "data/";
+$CONF = parse_ini_file('gauger.conf');
+$DATADIR = array_key_exists('data', $CONF) && $CONF["data"] ? $CONF['data'] : 
'data/';
+$PAGELENGTH = array_key_exists('page_length', $CONF) && $CONF['page_lenght'] ? 
$CONF['page_lenght'] : 5;
 if ($DATADIR[strlen($DATADIR)-1] != '/') $DATADIR .= '/';
 
 function get_counter_name($s) {
@@ -108,6 +109,9 @@
 }
 
 ksort($hosts);
+foreach($hosts as $host => $a) {
+    sort(&$hosts[$host]);
+}
 foreach($metrics_c as $id => $a) {
     ksort(&$metrics_c[$id]);
 }
@@ -116,5 +120,5 @@
 $metrics_c[""] = $others;
 $d->close();
 // echo '<pre>';
-// print_r($metrics_c);
+// print_r($hosts);
 // die();

Modified: gauger/template.php
===================================================================
--- gauger/template.php 2011-03-03 20:45:20 UTC (rev 14577)
+++ gauger/template.php 2011-03-04 01:40:03 UTC (rev 14578)
@@ -239,6 +239,9 @@
                         field_search = this;
                         monitor_search();
                     } else {
+                        last_search = " ";
+                        field_search = this;
+                        monitor_search();
                         this.value = "Search...";
                     }
                 });

Modified: gauger/template_host.php
===================================================================
--- gauger/template_host.php    2011-03-03 20:45:20 UTC (rev 14577)
+++ gauger/template_host.php    2011-03-04 01:40:03 UTC (rev 14578)
@@ -22,12 +22,29 @@
     <div class="search_realm">
     <div class="title"><h1>SHOWING HOST: <?php echo $current ?></h1><input 
id="instant_search_main" class="instant_search"/></div>
     <?php if (!empty($hosts[$current])): ?>
+    <?php $p = get_param('page', 1); $maxp = 
ceil(count($hosts[$current])/$PAGELENGTH) ?>
+    <p class="pager">
+        <?php if ($p >= 4): ?>
+        <a href="index.php?host=<?php echo $current 
?>&amp;q=searchterm&amp;page=1">1</a><?php if ($p > 4) echo ".." ?>
+        <?php endif; ?>
+        <?php for ($l = $p - 2; $l <= $p+2; $l++): ?>
+            <?php if($l >= 1 && $l <= $maxp): ?>
+            <?php if($l == $p) echo "[" ?>
+            <a href="index.php?host=<?php echo $current 
?>&amp;q=searchterm&amp;page=<?php echo $l ?>"><?php echo $l ?></a>
+            <?php if($l == $p) echo "]" ?>
+            <?php endif; ?>
+        <?php endfor; ?>
+        <?php if ($p <= $maxp - 3): ?>
+        <?php if ($p < $maxp - 3) echo ".." ?><a href="index.php?host=<?php 
echo $current ?>&amp;q=searchterm&amp;page=<?php echo $maxp ?>"><?php echo 
$maxp ?></a>
+        <?php endif; ?>
+    </p>
     <table>
         <tr>
             <th class="control-column">Controls</th>
             <th>Graph</th>
         </tr>
-        <?php foreach ($hosts[$current] as $counter): ?>
+        <?php for ($i = 0; $i < $PAGELENGTH && ($p-1)*$PAGELENGTH+$i < 
count($hosts[$current]); $i++): ?>
+        <?php $counter = $hosts[$current][($p-1)*$PAGELENGTH+$i] ?> 
         <tr class="search_item" id="<?php echo $counter ?>">
             <th>
                 Range
@@ -49,8 +66,23 @@
             </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>
-        <?php endforeach; ?>
+        <?php endfor; ?>
     </table>
+    <p class="pager">
+        <?php if ($p >= 4): ?>
+        <a href="index.php?host=<?php echo $current 
?>&amp;q=searchterm&amp;page=1">1</a><?php if ($p > 4) echo ".." ?>
+        <?php endif; ?>
+        <?php for ($l = $p - 2; $l <= $p+2; $l++): ?>
+            <?php if($l >= 1 && $l <= $maxp): ?>
+            <?php if($l == $p) echo "[" ?>
+            <a href="index.php?host=<?php echo $current 
?>&amp;q=searchterm&amp;page=<?php echo $l ?>"><?php echo $l ?></a>
+            <?php if($l == $p) echo "]" ?>
+            <?php endif; ?>
+        <?php endfor; ?>
+        <?php if ($p <= $maxp - 3): ?>
+        <?php if ($p < $maxp - 3) echo ".." ?><a href="index.php?host=<?php 
echo $current ?>&amp;q=searchterm&amp;page=<?php echo $maxp ?>"><?php echo 
$maxp ?></a>
+        <?php endif; ?>
+    </p>
     <?php else: ?>
     <h1>The host "<?php echo $current ?>" has no counters</h1>
     <?php endif; ?>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]