gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r14568 - in gauger: . css
Date: Wed, 2 Mar 2011 20:45:09 +0100

Author: bartpolot
Date: 2011-03-02 20:45:09 +0100 (Wed, 02 Mar 2011)
New Revision: 14568

Modified:
   gauger/css/style.css
   gauger/template.php
   gauger/template_host.php
Log:
Refactored instant search, added instant search to host view


Modified: gauger/css/style.css
===================================================================
--- gauger/css/style.css        2011-03-02 18:10:00 UTC (rev 14567)
+++ gauger/css/style.css        2011-03-02 19:45:09 UTC (rev 14568)
@@ -146,6 +146,16 @@
     margin-bottom:      5px;
 }
 
+#instant_search_main {
+    width:              133px;
+    height:             14px;
+    border:             solid 1px #D3D3D3;
+    font-size:          90%;
+    float:              right;
+    position:           relative;
+    margin-top:         -31px;
+}
+
 .metric_category_header {
     background:         #D3D3D3;
     padding:            1px 1px 1px 5px;

Modified: gauger/template.php
===================================================================
--- gauger/template.php 2011-03-02 18:10:00 UTC (rev 14567)
+++ gauger/template.php 2011-03-02 19:45:09 UTC (rev 14568)
@@ -38,6 +38,7 @@
 
         var inst_search;
         var last_search = "";
+        var field_search;
 
         $(function() {
                 $( ".slider-range" ).slider({
@@ -218,32 +219,29 @@
                         $.cookie(":::"+ul.attr("id"), "hidden");
                     }
                 });
-                
-                $( "#instant_search_metrics" ).focus(function(){
+                $( ".instant_search" ).focus(function(){
                     if(this.value=="Search..."){
                         this.value="";
                     }
+                    field_search = this;
                     inst_search = setInterval(monitor_search, 200);
                     monitor_search();
                 });
-                $( "#instant_search_metrics" ).blur(function(){
+                $( ".instant_search" ).blur(function(){
                     if(this.value==""){
                         this.value="Search...";
                     }
                     clearInterval(inst_search);
                 });
-                $("ul").each(function(){
-                    if($.cookie(":::"+this.id) == "hidden") {
-                        $(this).toggle()
-                        $(this).parents(".metric").find("img").attr("src", 
"images/expand.png");
+                $( ".instant_search" ).each(function(){
+                    if($.cookie(this.id)){
+                        this.value = $.cookie(this.id);
+                        field_search = this;
+                        monitor_search();
+                    } else {
+                        this.value = "Search...";
                     }
                 });
-                if($.cookie("instant_search_metrics")){
-                    $( "#instant_search_metrics" 
).val($.cookie("instant_search_metrics"));
-                    monitor_search();
-                } else {
-                    $( "#instant_search_metrics" ).val("Search...");
-                }
         });
 
         function get_command(element) {
@@ -252,12 +250,12 @@
         }
 
         function monitor_search() {
-            text = $( "#instant_search_metrics" ).val();
+            text = $( field_search ).val();
             if(text == last_search) return;
             last_search = text;
-            $.cookie("instant_search_metrics", text);
-            $( "#metrics li" ).each(function(){
-               if($(this).text().indexOf(text) == -1){
+            $.cookie(field_search.id, text);
+            $( field_search 
).parents(".search_realm").find(".search_item").each(function(){
+               if($(this).attr('id').indexOf(text) == -1){
                      $(this).hide();
                } else {
                      $(this).show();
@@ -268,6 +266,7 @@
         function debug(param) {
             $( "#debug" ).html($( "#debug" ).html() + param + ' ');
         }
+
         </script>
 
     </head>
@@ -287,9 +286,9 @@
                     <li><a href="?host=<?php echo $host ?>"><?php echo $host 
?></a></li>
             <?php endforeach; ?>
             </ul>
-            <div id="metrics">
+            <div id="metrics" class="search_realm">
             <h2>Metrics</h2>
-            <input id="instant_search_metrics"></input>
+            <input id="instant_search_metrics" class="instant_search"></input>
             <?php foreach ($metrics_c as $category => $counters): ?>
                 <div class="metric">
                 <div class="metric_category_header">
@@ -298,7 +297,7 @@
                 </div>
                 <ul id="<?php echo $category ? $category : 'Others' ?>">
                 <?php foreach ($counters as $link => $name): ?>
-                    <li><a href="?graph=<?php echo $link ?>">
+                    <li id="<?php echo $name ?>" class="search_item"><a 
href="?graph=<?php echo $link ?>">
                         <?php echo $name . (get_counter_unit($link) ? ' (' . 
get_counter_unit($link) . ')' : '') ?>
                     </a></li>
                 <?php endforeach; ?>
@@ -327,10 +326,5 @@
                 <a target="_blank" href="https://gnunet.org/svn/gauger";>SVN 
repository</a> |
             </p>
         </div>
-        <script type="text/javascript">
-            <?php if(get_param('category')): ?>
-            $(" #metrics ul ").not("#<?php echo get_param('category') 
?>").hide();
-            <?php endif; ?>
-        </script>
     </body>
 </html>

Modified: gauger/template_host.php
===================================================================
--- gauger/template_host.php    2011-03-02 18:10:00 UTC (rev 14567)
+++ gauger/template_host.php    2011-03-02 19:45:09 UTC (rev 14568)
@@ -19,7 +19,8 @@
 
 */?>
 <?php if (isset($hosts[$current])): ?>
-    <h1>SHOWING HOST: <?php echo $current ?></h1>
+    <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])): ?>
     <table>
         <tr>
@@ -27,7 +28,7 @@
             <th>Graph</th>
         </tr>
         <?php foreach ($hosts[$current] as $counter): ?>
-        <tr>
+        <tr class="search_item" id="<?php echo $counter ?>">
             <th>
                 Range
                 <br/>
@@ -53,6 +54,7 @@
     <?php else: ?>
     <h1>The host "<?php echo $current ?>" has no counters</h1>
     <?php endif; ?>
+    </div>
 <?php else: ?>
     <h1>Oops!</h1>
     <p>The host you are looking for doesn't seem to exist. Please select a 
host from the menu on the left.</p>




reply via email to

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