Index: /trunk/web/addons/toga/graph.php
===================================================================
--- /trunk/web/addons/toga/graph.php	(revision 148)
+++ /trunk/web/addons/toga/graph.php	(revision 149)
@@ -48,5 +48,5 @@
 
 if (isset($graph)) {
-	$rrd_dirs = $trd->getRrdDirs( $start, $stop );
+	$rrd_dirs = $trd->getRrdDirs( $period_start, $period_stop );
 	$series = '';
 
@@ -332,5 +332,5 @@
 # Generate the rrdtool graph command.
 #
-$command = RRDTOOL . " graph - --start $start --end $stop ".
+$command = RRDTOOL . " graph - --start $period_start --end $period_stop ".
 	"--width $width --height $height $upper_limit $lower_limit ".
 	"--title '$title' $vertical_label $extras $background ".
Index: /trunk/web/addons/toga/host_view.php
===================================================================
--- /trunk/web/addons/toga/host_view.php	(revision 149)
+++ /trunk/web/addons/toga/host_view.php	(revision 149)
@@ -0,0 +1,134 @@
+<?php
+include_once "./libtoga.php";
+
+//$tpl = new TemplatePower( "templates/host_view.tpl" );
+//$tpl->assignInclude("extra", "templates/host_extra.tpl");
+//$tpl->prepare();
+
+
+function makeHostView() {
+
+	global $tpl, $metrics, $clustername, $hostname;
+	global $cluster_ul, $hosts_up, $get_metric_string;
+	global $cluster, $period_start, $period_stop;
+	global $job_start, $job_stop;
+
+	$metrics = $metrics[$hostname];
+	//print_r( $metrics );
+	$hosts_up = $hosts_up[$hostname];
+	//print_r( $hosts_up );
+
+	$tpl->assign("cluster", $clustername);
+	$tpl->assign("host", $hostname);
+	$tpl->assign("node_image", "../../".node_image($metrics));
+	$tpl->assign("sort",$sort);
+	$tpl->assign("range",$range);
+
+	if($hosts_up)
+	      $tpl->assign("node_msg", "This host is up and running."); 
+	else
+	      $tpl->assign("node_msg", "This host is down."); 
+
+	$cluster_url=rawurlencode($clustername);
+	$tpl->assign("cluster_url", $cluster_url);
+	$tpl->assign("graphargs", "h=$hostname&$get_metric_string&st=$cluster[LOCALTIME]&job_start=$job_start&job_stop=$job_stop&period_start=$period_start&period_stop=$period_stop");
+
+	# For the node view link.
+	$tpl->assign("node_view","./?p=2&c=$cluster_url&h=$hostname");
+
+	//# No reason to go on if this node is down.
+	//if ($hosts_down)
+	//   {
+	//      $tpl->printToScreen();
+	//      return;
+	//   }
+
+	$tpl->assign("ip", $hosts_up[IP]);
+
+	foreach ($metrics as $name => $v)
+	   {
+	       if ($v[TYPE] == "string" or $v[TYPE]=="timestamp" or $always_timestamp[$name])
+		  {
+		     # Long gmetric name/values will disrupt the display here.
+		     if ($v[SOURCE] == "gmond") $s_metrics[$name] = $v;
+		  }
+	       elseif ($v[SLOPE] == "zero" or $always_constant[$name])
+		  {
+		     $c_metrics[$name] = $v;
+		  }
+	       else if ($reports[$metric])
+		  continue;
+	       else
+		  {
+		     $graphargs = "c=$cluster_url&h=$hostname&v=$v[VAL]&m=$name"
+		       ."&z=medium&st=$cluster[LOCALTIME]&job_start=$job_start&job_stop=$job_stop&period_start=$period_start&period_stop=$period_stop";
+		     # Adding units to graph 2003 by Jason Smith <smithj4@bnl.gov>.
+		     if ($v[UNITS]) {
+			$encodeUnits = rawurlencode($v[UNITS]);
+			$graphargs .= "&vl=$encodeUnits";
+		     }
+		     $g_metrics[$name][graph] = $graphargs;
+          }
+	   }
+	# Add the uptime metric for this host. Cannot be done in ganglia.php,
+	# since it requires a fully-parsed XML tree. The classic contructor problem.
+	$s_metrics[uptime][TYPE] = "string";
+	$s_metrics[uptime][VAL] = uptime($cluster[LOCALTIME] - $metrics[boottime][VAL]);
+
+	# Add the gmond started timestamps & last reported time (in uptime format) from
+	# the HOST tag:
+	$s_metrics[gmond_started][TYPE] = "timestamp";
+	$s_metrics[gmond_started][VAL] = $hosts_up[GMOND_STARTED];
+	$s_metrics[last_reported][TYPE] = "string";
+	$s_metrics[last_reported][VAL] = uptime($cluster[LOCALTIME] - $hosts_up[REPORTED]);
+
+	# Show string metrics
+	if (is_array($s_metrics))
+	   {
+	      ksort($s_metrics);
+	      foreach ($s_metrics as $name => $v )
+	     {
+		$tpl->newBlock("string_metric_info");
+		$tpl->assign("name", $name);
+		if( $v[TYPE]=="timestamp" or $always_timestamp[$name])
+		   {
+		      $tpl->assign("value", date("r", $v[VAL]));
+		   }
+		else
+		   {
+		      $tpl->assign("value", "$v[VAL] $v[UNITS]");
+		   }
+	     }
+	   }
+
+	# Show constant metrics.
+	if (is_array($c_metrics))
+	   {
+	      ksort($c_metrics);
+	      foreach ($c_metrics as $name => $v )
+	     {
+		$tpl->newBlock("const_metric_info");
+		$tpl->assign("name", $name);
+		$tpl->assign("value", "$v[VAL] $v[UNITS]");
+	     }
+	   }
+
+	# Show graphs.
+	if (is_array($g_metrics))
+	   {
+	      ksort($g_metrics);
+
+	      $i = 0;
+	      foreach ( $g_metrics as $name => $v )
+		 {
+		    $tpl->newBlock("vol_metric_info");
+		    $tpl->assign("graphargs", $v[graph]);
+		    $tpl->assign("alt", "$hostname $name");
+		    if($i++ %2)
+		       $tpl->assign("br", "<BR>");
+		 }
+	   }
+}
+
+	//$tpl->printToScreen();
+?>
Index: /trunk/web/addons/toga/index.php
===================================================================
--- /trunk/web/addons/toga/index.php	(revision 148)
+++ /trunk/web/addons/toga/index.php	(revision 149)
@@ -38,5 +38,5 @@
 	global $metrics, $reports, $m, $default_metric;
 	global $default_refresh, $filterorder, $view;
-	global $TARCHD;
+	global $TARCHD, $period_start, $period_stop, $h, $id;
 	
 	if( isset($default_metric) and !isset($m) )
@@ -189,12 +189,14 @@
 
 	if( $view == "search" ) {
+
 		$node_menu .= "<B>&gt;</B>\n";
 		$node_menu .= "<B>Jobarchive</B> ";
 		$tpl->assign("view", "search" );
 		$form_name = "archive_search_form";
-		$tpl->assign("form_name", $form_name );
+		$tpl->assignGlobal("form_name", $form_name );
+
 	} else {
 		$form_name = "toga_form";
-		$tpl->assign("form_name", $form_name );
+		$tpl->assignGlobal("form_name", $form_name );
 		$tpl->assign("view", "overview" );
 	}
@@ -218,6 +220,7 @@
 			$metric_menu .= "</SELECT>\n";
 
-			$tpl->assign("metric_menu", $metric_menu );
 		}
+
+		$tpl->assign("metric_menu", $metric_menu );
 	}
 	$m = $metricname;
@@ -269,8 +272,20 @@
 }
 
+function includeHostPage() {
+
+	global $tpl;
+
+	$tpl->assignInclude( "main", "templates/host_view.tpl" );
+}
+
 $tpl = new TemplatePower( "templates/index.tpl" );
 
 $tpl->assignInclude( "header", "templates/header.tpl" );
 
+if( isset( $h ) and $h != '' ) {
+	$hostname = $h;
+	$view = "host";
+}
+
 switch( $view ) {
 
@@ -283,4 +298,9 @@
 
 		includeSearchPage();
+		break;
+
+	case "host":
+
+		includeHostPage();
 		break;
 
@@ -313,4 +333,10 @@
 		break;
 
+	case "host":
+
+		include "./host_view.php";
+		makeHostView();
+		break;
+
 	default:
 
Index: /trunk/web/addons/toga/search.php
===================================================================
--- /trunk/web/addons/toga/search.php	(revision 148)
+++ /trunk/web/addons/toga/search.php	(revision 149)
@@ -164,5 +164,5 @@
 	global $clustername, $tpl, $id, $user, $name, $start_from_time, $start_to_time, $queue;
 	global $end_from_time, $end_to_time, $filter, $default_showhosts, $m, $hosts_up;
-	global $start, $stop;
+	global $period_start, $period_stop;
 
 	$metricname = $m;
@@ -269,18 +269,18 @@
 				//printf("start = %s stop = %s\n", $start, $stop );
 
-				if( !$start ) // Add an additional 5 minutes before
-					$start = intval( $job_start - 600 );
+				if( !$period_start ) // Add an additional 5 minutes before
+					$period_start = intval( $job_start - (intval( $runningtime * 0.10 ) ) );
 				else
-					$start = datetimeToEpoch( $start );
-
-				if( !$stop ) // Add an additional 5 minutes after
-					$stop = intval( $job_stop + 600 );
+					$period_start = datetimeToEpoch( $period_start );
+
+				if( !$period_stop ) // Add an additional 5 minutes after
+					$period_stop = intval( $job_stop + (intval( $runningtime * 0.10 ) ) );
 				else
-					$stop = datetimeToEpoch( $stop );
+					$period_stop = datetimeToEpoch( $period_stop );
 
 				//printf("start = %s stop = %s\n", $start, $stop );
 
-				$tpl->assign("j_start", epochToDatetime( $start ) );
-				$tpl->assign("j_stop", epochToDatetime( $stop ) );
+				$tpl->assign("period_start", epochToDatetime( $period_start ) );
+				$tpl->assign("period_stop", epochToDatetime( $period_stop ) );
 
 				$hosts_up = array();
@@ -340,5 +340,5 @@
 					$val = $metrics[$host][$metricname];
 					$class = "metric";
-					$host_link="\"?c=$cluster_url&h=$host_url&job_start=$job_start&job_stop=$job_stop&start=$start&stop=$stop\"";
+					$host_link="\"?c=$cluster_url&h=$host_url&job_start=$job_start&job_stop=$job_stop&period_start=$period_start&period_stop=$period_stop\"";
 
 					if ($val[TYPE]=="timestamp" or $always_timestamp[$metricname]) {
@@ -347,5 +347,5 @@
 						$textval = "$val[VAL] $val[UNITS]";
 					} else {
-						$graphargs = "z=small&c=$cluster_url&m=$metricname&h=$host_url&v=$val[VAL]&x=$max&n=$min&job_start=$job_start&job_stop=$job_stop&start=$start&stop=$stop";
+						$graphargs = "z=small&c=$cluster_url&m=$metricname&h=$host_url&v=$val[VAL]&x=$max&n=$min&job_start=$job_start&job_stop=$job_stop&period_start=$period_start&period_stop=$period_stop";
 					}
 					if ($textval) {
Index: /trunk/web/addons/toga/templates/host_view.tpl
===================================================================
--- /trunk/web/addons/toga/templates/host_view.tpl	(revision 149)
+++ /trunk/web/addons/toga/templates/host_view.tpl	(revision 149)
@@ -0,0 +1,91 @@
+<TABLE BORDER="0" WIDTH="100%">
+<TR>
+  <TD COLSPAN="2" BGCOLOR="#EEEEEE" ALIGN="CENTER">
+  <FONT SIZE="+2">{host} Overview</FONT>
+  </TD>
+</TR>
+
+<TR>
+ <TD ALIGN="LEFT" VALIGN="TOP">
+
+<IMG SRC="{node_image}" HEIGHT="60" WIDTH="30" ALT="{host}" BORDER="0">
+{node_msg}
+<P>
+
+<TABLE BORDER="0" WIDTH="100%">
+<TR>
+  <TD COLSPAN="2" CLASS=title>Time and String Metrics</TD>
+</TR>
+
+<!-- START BLOCK : string_metric_info -->
+<TR>
+ <TD CLASS=footer WIDTH=30%>{name}</TD><TD>{value}</TD>
+</TR>
+<!-- END BLOCK : string_metric_info -->
+
+<TR><TD>&nbsp;</TD></TR>
+
+<TR>
+  <TD COLSPAN=2 CLASS=title>Constant Metrics</TD>
+</TR>
+
+<!-- START BLOCK : const_metric_info -->
+<TR>
+ <TD CLASS=footer WIDTH=30%>{name}</TD><TD>{value}</TD>
+</TR>
+<!-- END BLOCK : const_metric_info -->
+
+<TR><TD>&nbsp;</TD></TR>
+
+<TR>
+ <TD COLSPAN=2 CLASS=title>
+ <a href="../../host_gmetrics.php?c={cluster_url}&h={host}">Gmetrics</a>
+ </TD>
+</TR>
+</TABLE>
+
+ <HR>
+<!-- INCLUDE BLOCK : extra -->
+
+</TD>
+
+<TD ALIGN="CENTER" VALIGN="TOP" WIDTH="395">
+<IMG HEIGHT="147" WIDTH="395" ALT="{cluster_url} LOAD"
+   SRC="./graph.php?g=load_report&z=medium&c={cluster_url}&{graphargs}">
+<IMG HEIGHT="160" WIDTH="395" ALT="{cluster_url} MEM"
+   SRC="./graph.php?g=mem_report&z=medium&c={cluster_url}&{graphargs}">
+<IMG HEIGHT="147" WIDTH="395" ALT="{cluster_url} CPU"
+   SRC="./graph.php?g=cpu_report&z=medium&c={cluster_url}&{graphargs}">
+<IMG HEIGHT="147" WIDTH="395" ALT="{cluster_url} NETWORK"
+   SRC="./graph.php?g=network_report&z=medium&c={cluster_url}&{graphargs}">
+<IMG HEIGHT="147" WIDTH="395" ALT="{cluster_url} PACKETS"
+   SRC="./graph.php?g=packet_report&z=medium&c={cluster_url}&{graphargs}">
+
+</TD>
+</TR>
+</TABLE>
+<BR>
+<BR>
+<TABLE BORDER="0" WIDTH="100%">
+<TR>
+  <TD CLASS=title>
+  {host} <strong>graphs</strong>
+  last <strong>{range}</strong>
+  sorted <strong>{sort}</strong>
+  </TD>
+</TR>
+</TABLE>
+
+<CENTER>
+<TABLE>
+<TR>
+ <TD>
+
+<!-- START BLOCK : vol_metric_info -->
+<IMG HEIGHT="147" WIDTH="395" ALT="{alt}" SRC="./graph.php?{graphargs}">{br}
+<!-- END BLOCK : vol_metric_info -->
+
+ </TD>
+</TR>
+</TABLE>
+</CENTER>
Index: /trunk/web/addons/toga/templates/search.tpl
===================================================================
--- /trunk/web/addons/toga/templates/search.tpl	(revision 148)
+++ /trunk/web/addons/toga/templates/search.tpl	(revision 149)
@@ -52,6 +52,6 @@
 	function setPeriodTimestamps() {
 
-		document.archive_search_form.start.value = document.archive_search_form.period_start_pick.value; 
-		document.archive_search_form.stop.value = document.archive_search_form.period_stop_pick.value;
+		document.archive_search_form.period_start.value = document.archive_search_form.period_start_pick.value; 
+		document.archive_search_form.period_stop.value = document.archive_search_form.period_stop_pick.value;
 	}
 
@@ -258,14 +258,14 @@
    Columns&nbsp;&nbsp;{cols_menu}
    </FONT><BR>
-   <FONT SIZE="-1">
-    <INPUT TYPE="HIDDEN" NAME="start" VALUE="{j_start}">
-    <INPUT TYPE="HIDDEN" NAME="stop" VALUE="{j_stop}">
+<FONT SIZE="-1">
+    <INPUT TYPE="HIDDEN" NAME="period_start" VALUE="{period_start}">
+    <INPUT TYPE="HIDDEN" NAME="period_stop" VALUE="{period_stop}">
     Graph timeperiod from 
-    <INPUT TYPE="text" NAME="period_start_pick" VALUE="{j_start}" ALT="Start time" DISABLED="TRUE">
+    <INPUT TYPE="text" NAME="period_start_pick" VALUE="{period_start}" ALT="Start time" DISABLED="TRUE">
     <a href="javascript:show_calendar('document.archive_search_form.period_start_pick', document.archive_search_form.period_start_pick.value);" alt="Click to select a date/time" title="Click to select a date/time">
     <img src="cal.gif" width="16" height="16" border="0"></a> 
     <a href="#" onClick="javascript: document.archive_search_form.period_start_pick.value=''" alt="Click here to clear field" title="Click here to clear field">
     <IMG SRC="redcross.jpg" BORDER=0></A>
-    to <INPUT TYPE="text" NAME="period_stop_pick" VALUE="{j_stop}" ALT="Stop time" DISABLED="TRUE">
+    to <INPUT TYPE="text" NAME="period_stop_pick" VALUE="{period_stop}" ALT="Stop time" DISABLED="TRUE">
     <a href="javascript:show_calendar('document.archive_search_form.period_stop_pick', document.archive_search_form.period_stop_pick.value);" alt="Click to select a date/time" title="Click to select a date/time">
     <img src="cal.gif" width="16" height="16" border="0"></a> 
