Add links to network iterator

Chris Pollett [2013-01-06 18:Jan:th]
Add links to network iterator
Filename
lib/index_bundle_iterators/network_iterator.php
diff --git a/lib/index_bundle_iterators/network_iterator.php b/lib/index_bundle_iterators/network_iterator.php
index 13b2abefc..d29d7538f 100644
--- a/lib/index_bundle_iterators/network_iterator.php
+++ b/lib/index_bundle_iterators/network_iterator.php
@@ -269,8 +269,8 @@ class NetworkIterator extends IndexBundleIterator
                     }
                 }
                 $max_time = max($max_time, $pre_result['ELAPSED_TIME']);
-
-                $machine_times .= $indent. "ID_".$lookup[$j].": ".
+                $lookup_link = $this->makeLookupLink($sites, $lookup[$j]);
+                $machine_times .= $indent . $lookup_link .
                     $pre_result['ELAPSED_TIME']."  ";
                 $indent = "";
             }
@@ -298,6 +298,29 @@ class NetworkIterator extends IndexBundleIterator
         return $results;
      }

+    /**
+     *
+     */
+    function makeLookupLink($sites, $index)
+    {
+        if(isset($sites[$index][self::URL])) {
+            $url = $sites[$index][self::URL];
+            $title = $url;
+        } else {
+            $tmp = urlencode(print_r($sites[$index],
+                true));
+            $title = 'URL not set';
+            if(trim($tmp) == "") {
+                $tmp = 'Site null';
+            }
+            $url = 'javascript:alert("'.$tmp.'")';
+
+        }
+        $link = "<a class='gray-link' href='$url'".
+             " title='$title' >ID_$index</a>:";
+        return $link;
+    }
+
     /**
      * Gets the summaries associated with the keys provided the keys
      * can be found in the current block of docs returned by this iterator
@@ -320,4 +343,4 @@ class NetworkIterator extends IndexBundleIterator
     }

 }
- ?>
\ No newline at end of file
+ ?>
ViewGit