Index: /trunk/web/addons/toga/index.php
===================================================================
--- /trunk/web/addons/toga/index.php	(revision 139)
+++ /trunk/web/addons/toga/index.php	(revision 140)
@@ -38,4 +38,5 @@
 	global $metrics, $reports, $m, $default_metric;
 	global $default_refresh, $filterorder, $view;
+	global $TARCHD;
 
 	if( isset($default_metric) and !isset($m) )
@@ -209,4 +210,11 @@
 	$m = $metricname;
 
+	if( $TARCHD ) {
+		$tpl->newBlock( "search" );
+		$tpl->assignGlobal( "cluster_url", rawurlencode($clustername) );
+		$tpl->assignGlobal( "cluster", $clustername );
+		$tpl->gotoBlock( "_ROOT" );
+	}
+
 	# Make sure that no data is cached..
 	header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");    # Date in the past
@@ -242,11 +250,4 @@
 }
 
-function includeSearchThumb() {
-	global $tpl;
-
-	$tpl->assignInclude( "archive", "templates/inc_search.tpl" );
-
-}
-
 function includeOverview() {
 	global $tpl;
@@ -264,6 +265,4 @@
 
 		includeOverview();
-		if( $TARCHD )
-			includeSearchThumb();
 		break;
 
Index: /trunk/web/addons/toga/libtoga.php
===================================================================
--- /trunk/web/addons/toga/libtoga.php	(revision 139)
+++ /trunk/web/addons/toga/libtoga.php	(revision 140)
@@ -141,5 +141,11 @@
 
 		$ids = $this->queryDbase( $query );
-		print_r($ids);
+
+		$ret = array();
+
+		foreach( $ids as $crow)
+			$ret[] = $crow[job_id];
+
+		return $ret;
 	}
 
Index: /trunk/web/addons/toga/overview.php
===================================================================
--- /trunk/web/addons/toga/overview.php	(revision 139)
+++ /trunk/web/addons/toga/overview.php	(revision 140)
@@ -2,4 +2,6 @@
 global $GANGLIA_PATH, $clustername, $tpl, $filter, $cluster, $get_metric_string, $cluster_url, $sh;
 global $hosts_up, $m, $start, $end, $filterorder;
+
+//$tpl->assign("_ROOT.summary", "" );
 
 $data_gatherer = new DataGatherer();
Index: /trunk/web/addons/toga/search.php
===================================================================
--- /trunk/web/addons/toga/search.php	(revision 139)
+++ /trunk/web/addons/toga/search.php	(revision 140)
@@ -32,5 +32,5 @@
 function makeSearchPage() {
 	global $clustername, $tpl, $id, $user, $name, $start_from_time, $start_to_time, $queue;
-	global $end_from_time, $end_to_time;
+	global $end_from_time, $end_to_time, $filter;
 
 	$tpl->assign( "cluster", $clustername );
@@ -46,7 +46,19 @@
 	if( validateFormInput() ) {
 
+		$tpl->newBlock( "search_results" );
 		$tdb = new TarchDbase();
-		$tdb->searchDbase( $id, $queue, $user, $name, $start_from_time, $start_to_time, $end_from_time, $end_to_time );
-		$tpl->assign( "search_results", "templates/search_results.tpl" );
+		$search_ids = $tdb->searchDbase( $id, $queue, $user, $name, $start_from_time, $start_to_time, $end_from_time, $end_to_time );
+
+		foreach( $search_ids as $foundid ) {
+
+			printf("found job %s\n", $foundid );
+			//output jobzooi
+
+		}
+		
+		if( count( $search_ids ) == 1 ) {
+
+			$tpl->newBlock( "showhosts" );
+		}
 
 		// show search results
Index: /trunk/web/addons/toga/templates/header.tpl
===================================================================
--- /trunk/web/addons/toga/templates/header.tpl	(revision 139)
+++ /trunk/web/addons/toga/templates/header.tpl	(revision 140)
@@ -40,5 +40,13 @@
       <B>{alt_view}</B>
      </TD>
-<!-- INCLUDE BLOCK : archive -->
+
+<!-- START BLOCK : search -->
+     <TD><CENTER>
+       <A HREF="./?c={cluster_url}&view=search">
+       Jobarchive<BR>
+       <IMG SRC="./bricks.jpg" HEIGHT=50 WIDTH=50 ALT="Search the archive for {cluster}" TITLE="Search the archive for {cluster}" BORDER=0></A></CENTER>
+     </TD>
+<!-- END BLOCK : search -->
+
   </TR>
   </TABLE>
Index: /trunk/web/addons/toga/templates/overview.tpl
===================================================================
--- /trunk/web/addons/toga/templates/overview.tpl	(revision 139)
+++ /trunk/web/addons/toga/templates/overview.tpl	(revision 140)
@@ -29,81 +29,5 @@
 <BR>
 
-<SCRIPT TYPE="text/javascript" SRC="ts_picker.js"></SCRIPT>
-<SCRIPT TYPE="text/javascript">
-	function setSort( sortbyval ) {
-
-		if( sortbyval != document.toga_form.sortby.value ) {
-
-			document.toga_form.sortby.value = sortbyval;
-			document.toga_form.sortorder.value = "asc";
-
-		} else {
-
-			if( document.toga_form.sortorder.value == "desc" )
-				document.toga_form.sortorder.value = "asc";
-			else if( document.toga_form.sortorder.value == "asc" )
-				document.toga_form.sortorder.value = "desc";
-		}
-
-		document.forms['toga_form'].submit();
-	}
-
-	function setFilter( filtername, filterval ) {
-
-		//document.toga_form.id.value = '';
-		//document.toga_form.queue.value = '';
-		//document.toga_form.state.value = '';
-		//document.toga_form.user.value = '';
-		var myfilterorder = document.toga_form.elements['filterorder'].value;
-
-		if( document.toga_form.elements[filtername] ) {
-			document.toga_form.elements[filtername].value = filterval;
-			if( myfilterorder != '')
-				myfilterorder = myfilterorder + "," + filtername;
-			else
-				myfilterorder = filtername;
-				
-		}
-		document.toga_form.elements['filterorder'].value = myfilterorder;
-
-		//setTimeout( "document.forms['toga_form'].submit();", 1000 );
-
-		document.forms['toga_form'].submit();
-	}
-
-	//function removeFilters( filters ) {
-
-		//var myfilter_fields = filters.split( " " );
-		//for( var i=0; i<myfilter_fields.length; i++ ) {
-			//removeFilter( myfilter_fields[i] );
-			//setTimeout( "removeFilter( "+myfilter_fields[i]+" );", 50 );
-		//}
-		// delay 100 ms before submit or fields might not be set
-		//document.forms['toga_form'].submit();", 100 );
-
-		//setTimeout( "document.forms['toga_form'].submit();", 1000 );
-	//}
-
-	//function removeFilter( filtername ) {
-
-	//	var filterorder_fields = document.toga_form.elements['filterorder'].value.split( "," );
-	//	var myfilterorder = '';
-
-	//	for( var i=0; i<filterorder_fields.length; i++ ) {
-	//		if( filterorder_fields[i] != filtername ) {
-	//			if( myfilterorder != '') {
-	//				myfilterorder = myfilterorder + "," + filterorder_fields[i];
-	//				//alert('myfilterorder = '+myfilterorder);
-	//			} else {
-	//				myfilterorder = filterorder_fields[i];
-	//				//alert('emyfilterorder = '+myfilterorder);
-	//			}
-	//		}
-	//	}
-	//	document.toga_form.elements[filtername].value = '';
-	//	document.toga_form.elements['filterorder'].value = myfilterorder;
-	//}
-
-</SCRIPT>
+<SCRIPT TYPE="text/javascript" SRC="libtoga.js"></SCRIPT>
 
 <INPUT TYPE="HIDDEN" NAME="sortby" VALUE="{sortby}">
@@ -161,8 +85,5 @@
    <FONT SIZE="-1">
    Columns&nbsp;&nbsp;{cols_menu}
-   </FONT><!-- <BR>
-   <FONT SIZE="-1">
-    Set graph timeperiod from <INPUT TYPE="text" NAME="start" VALUE="{start}" SIZE=12 ALT="Start time"><a href="javascript:show_calendar('document.toga_form.start', document.toga_form.start.value);"><img src="cal.gif" width="16" height="16" border="0"></a> to <INPUT TYPE="text" NAME="stop" VALUE="{stop}" SIZE=12 ALT="Stop time"><a href="javascript:show_calendar('document.toga_form.stop', document.toga_form.stop.value);"><img src="cal.gif" width="16" height="16" border="0"></a><INPUT TYPE="submit" VALUE="Refresh graphs">
-   </FONT> -->
+   </FONT>
   </TD>
 </TR>
Index: /trunk/web/addons/toga/templates/search.tpl
===================================================================
--- /trunk/web/addons/toga/templates/search.tpl	(revision 139)
+++ /trunk/web/addons/toga/templates/search.tpl	(revision 140)
@@ -2,7 +2,8 @@
 </FORM>
 <SCRIPT LANGUAGE="javascript" SRC="ts_picker.js"></SCRIPT>
+<SCRIPT TYPE="text/javascript" SRC="libtoga.js"></SCRIPT>
 <SCRIPT LANGUAGE="javascript">
 
-	function setHiddenTimestamps() {
+	function setSearchTimestamps() {
 
 		document.archive_search_form.start_from_time.value = document.archive_search_form.start_from_pick.value; 
@@ -10,5 +11,10 @@
 		document.archive_search_form.end_from_time.value = document.archive_search_form.end_from_pick.value; 
 		document.archive_search_form.end_to_time.value = document.archive_search_form.end_to_pick.value;
-		alert( "poep gezet" );
+	}
+
+	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;
 	}
 
@@ -139,5 +145,5 @@
   <TD>{form_error_msg}</TD>
   <TD>
-  <INPUT TYPE="submit" VALUE="Search archive" onClick="setHiddenTimestamps();">
+  <INPUT TYPE="submit" VALUE="Search archive" onClick="setSearchTimestamps();">
   </TD>
 
@@ -147,6 +153,90 @@
 </FORM>
 <BR><BR>
-<!-- INCLUDE BLOCK : search_results -->
-<BR><BR>
-<!-- INCLUDE BLOCK : job_details -->
+<!-- START BLOCK : search_results -->
+<SCRIPT TYPE="text/javascript" SRC="libtoga.js"></SCRIPT>
+
+<INPUT TYPE="HIDDEN" NAME="sortby" VALUE="{sortby}">
+<INPUT TYPE="HIDDEN" NAME="sortorder" VALUE="{sortorder}">
+<INPUT TYPE="HIDDEN" NAME="c" VALUE="{clustername}">
+<INPUT TYPE="HIDDEN" NAME="queue" VALUE="{f_queue}">
+<INPUT TYPE="HIDDEN" NAME="state" VALUE="{f_state}">
+<INPUT TYPE="HIDDEN" NAME="user" VALUE="{f_user}">
+<INPUT TYPE="HIDDEN" NAME="id" VALUE="{f_id}">
+<INPUT TYPE="HIDDEN" NAME="filterorder" VALUE="{f_order}">
+
+<TABLE WIDTH="90%" CELLPADDING="8" CELLSPACING="3" BORDER=0>
+<TR CLASS="toga">
+<TH><B><A HREF="#" onClick="setSort( 'id' )">Id</A></B></TH>
+<TH><B><A HREF="#" onClick="setSort( 'state' )">State</A></B></TH>
+<TH><B><A HREF="#" onClick="setSort( 'user' )">User</A></B></TH>
+<TH><B><A HREF="#" onClick="setSort( 'queue' )">Queue</A></B></TH>
+<TH><B><A HREF="#" onClick="setSort( 'name' )">Name</A></B></TH>
+<TH><B><A HREF="#" onClick="setSort( 'req_cpu' )">Req. CPU time</A></B></TH>
+<TH><B><A HREF="#" onClick="setSort( 'req_mem' )">Req. Memory</A></B></TH>
+<TH><B><A HREF="#" onClick="setSort( 'nodes' )">Nodes</A>/<A HREF="#" onClick="setSort( 'cpus' )">Cpus</A></
+B></TH>
+<TH><B><A HREF="#" onClick="setSort( 'start' )">Started</A></B></TH>
+<TH><B><A HREF="#" onClick="setSort( 'finished' )">Finished</A></B></TH>
+<TH><B><A HREF="#" onClick="setSort( 'runningtime' )">Runningtime</A></B></TH>
+</TR>
+
+<!-- START BLOCK : node -->
+  <TR CLASS="{nodeclass}">
+    <TD><A HREF="#" onClick="setFilter( 'id', '{id}' )">{id}</A></TD>
+    <TD><A HREF="#" onClick="setFilter( 'state', '{state}' )">{state}</A></TD>
+    <TD><A HREF="#" onClick="setFilter( 'user', '{user}' )">{user}</A></TD>
+    <TD><A HREF="#" onClick="setFilter( 'queue', '{queue}' )">{queue}</A></TD>
+    <TD>{name}</TD>
+    <TD>{req_cpu}</TD>
+    <TD>{req_memory}</TD>
+    <TD>{nodes}/{cpus}</TD>
+    <TD>{started}</TD>
+    <TD>{finished}</TD>
+    <TD>{runningtime}</TD>
+  </TR>
+<!-- END BLOCK : node -->
+</TABLE>
 </CENTER>
+
+<!-- START BLOCK : showhosts -->
+<TABLE BORDER="0" WIDTH="100%">
+<TR>
+  <TD CLASS=title COLSPAN="2">
+  <FONT SIZE="-1">
+  Show Hosts:
+  yes<INPUT type=radio name="sh" value="1" OnClick="toga_form.submit();" {checked1}>
+  no<INPUT type=radio name="sh" value="0" OnClick="toga_form.submit();" {checked0}>
+  </FONT>
+  |
+  job <strong>{id}</strong> metric <strong>{metric}</strong>
+  |
+   <FONT SIZE="-1">
+   Columns&nbsp;&nbsp;{cols_menu}
+   </FONT><BR>
+   <FONT SIZE="-1">
+    <INPUT TYPE="HIDDEN" NAME="start" VALUE="{start}">
+    <INPUT TYPE="HIDDEN" NAME="stop" VALUE="{stop}">
+    Set graph timeperiod from <INPUT TYPE="text" NAME="period_start_pick" VALUE="{start}" SIZE=12 ALT="Start time"><a href="javascript:show_calendar('document.search_form.period_start_pick', document.search_form.period_start_pick.value);"><img src="cal.gif" width="16" height="16" border="0"></a> to <INPUT TYPE="text" NAME="period_stop_pick" VALUE="{stop}" SIZE=12 ALT="Stop time"><a href="javascript:show_calendar('document.toga_form.period_stop_pick', document.search_form.period_stop_pick.value);"><img src="cal.gif" width="16" height="16" border="0"></a><INPUT TYPE="submit" onClick="setPeriodTimestamps();" VALUE="Refresh graphs">
+   </FONT>
+  </TD>
+</TR>
+
+</TABLE>
+
+<CENTER>
+<TABLE>
+<TR>
+<!-- START BLOCK : sorted_list -->
+{metric_image}{br}
+<!-- END BLOCK : sorted_list -->
+</TR>
+</TABLE>
+
+<p>
+(Nodes colored by 1-minute load) | <A HREF="../../node_legend.html" ALT="Node Image egend">Legend</A>
+
+</CENTER>
+
+<!-- END BLOCK : showhosts -->
+<!-- END BLOCK : search_results -->
+</CENTER>
