Index: trunk/web/addons/toga/index.php
===================================================================
--- trunk/web/addons/toga/index.php	(revision 137)
+++ trunk/web/addons/toga/index.php	(revision 138)
@@ -37,5 +37,5 @@
 	global $self, $filter, $cluster_url, $get_metric_string;
 	global $metrics, $reports, $m, $default_metric;
-	global $default_refresh;
+	global $default_refresh, $filterorder, $view;
 
 	if( isset($default_metric) and !isset($m) )
@@ -150,11 +150,38 @@
 	$node_menu .= "<B><A HREF=\"./?c=".rawurlencode($clustername)."\">Joblist</A></B> ";
 
-	if( count( $filter ) > 0 ) {
-
-		foreach( $filter as $filtername => $filterval ) {
-
-			$node_menu .= "<B>&gt;</B>\n";
-			$node_menu .= "<B>$filtername- $filterval</B> ";
+	if( count( $filter ) > 0 && $view != "search" ) {
+
+		$filter_fields = explode( ",", $filterorder );
+		$onclick_href = array();
+
+		if( count( $filter_fields ) > 1 ) {
+			//for( $i = (count( $filter_fields )-2); $i >= 0; $i-- ) {
+				
+			//	for( $l = intval($i+1); $l <=(count($filter_fields)-1); $l++ ) {
+					//$onclick_href[$filter_fields[$i]] = $onclick_href[$filter_fields[$i]] . "removeFilter( '" . $filter_fields[$l] . "' );";
+			//		if( !isset( $onclick_href[$filter_fields[$i]] ) )
+			//			$onclick_href[$filter_fields[$i]] = "removeFilters( '".$filter_fields[$l];
+			//		else
+			//			$onclick_href[$filter_fields[$i]] = $onclick_href[$filter_fields[$i]] . " ". $filter_fields[$l];
+						
+			//	}
+			//	$onclick_href[$filter_fields[$i]] = $onclick_href[$filter_fields[$i]] . "' )";
+			//}
+			foreach( $filter_fields as $filtername ) {
+
+				$node_menu .= "<B>&gt;</B>\n";
+				if( isset( $onclick_href[$filtername] ) )
+					$node_menu .= "<B><A HREF =\"#\" onClick=\"".$onclick_href[$filtername]."\">$filtername: $filter[$filtername]</A></B> ";
+				else
+					$node_menu .= "<B>$filtername: $filter[$filtername]</B> ";
+			}
+		} else {
+
+			foreach( $filter as $filtername=>$filterval ) {
+				$node_menu .= "<B>&gt;</B>\n";
+				$node_menu .= "<B>$filtername: $filterval</B> ";
+			}
 		}
+
 	}
 
Index: trunk/web/addons/toga/libtoga.php
===================================================================
--- trunk/web/addons/toga/libtoga.php	(revision 137)
+++ trunk/web/addons/toga/libtoga.php	(revision 138)
@@ -87,12 +87,12 @@
 global $metrics, $hosts_up;
 
-
 class TarchDbase {
 
-	var $ip, $dbase;
+	var $ip, $dbase, $conn;
 
 	function TarchDbase( $ip = null, $dbase = 'toga' ) {
 		$this->ip = $ip;
 		$this->dbase = $dbase;
+		$this->conn = null;
 	}
 
@@ -100,19 +100,126 @@
 
 		if( $this->ip == null and $this->dbase == 'toga' )
-			$this->conn = pg_connect( "dbase=".$this->dbase );
+			$this->conn = pg_connect( "dbname=".$this->dbase );
 		else
 			$this->conn = pg_connect( "host=".$this->ip." dbase=".$this->dbase );
 	}
+
+	function searchDbase( $id = null, $queue = null, $user = null, $name = null, $start_from_time = null, $start_to_time = null, $end_from_time = null, $end_to_time = null ) {
+
+		if( $id ) 
+			$query = "SELECT job_id FROM jobs WHERE job_id = '$id'";
+		else {
+			$query_args = array();
+			
+			if( $queue )
+				$query_args[] = "job_queue ='$queue'";
+			if( $user )
+				$query_args[] = "job_owner ='$user'";
+			if( $name )
+				$query_args[] = "job_name = '$name'";
+			if( $start_from_time )
+				$query_args[] = "job_start_timestamp >= $start_from_time";
+			if( $start_end_time )
+				$query_args[] = "job_start_timestamp <= $start_to_time";
+			if( $end_from_time )
+				$query_args[] = "job_stop_timestamp >= $end_from_time";
+			if( $end_to_time )
+				$query_args[] = "job_stop_timestamp <= $end_to_time";
+
+			$query = "SELECT job_id FROM jobs WHERE ";
+			$extra_query_args = '';
+
+			foreach( $query_args as $myquery ) {
+
+				if( $extra_query_args == '' )
+					$extra_query_args = $myquery;
+				else
+					$extra_query_args .= " AND ".$myquery;
+			}
+			$query .= $extra_query_args;
+		}
+
+		$ids = $this->queryDbase( $query );
+		print_r($ids);
+	}
+
+	function getNodesForJob( $jobid ) {
+
+		$result = $this->queryDbase( "SELECT node_id FROM job_nodes WHERE job_id = '$jobid'" );
+
+		$nodes = array();
+
+		foreach( $result as $result_row ) 
+
+			$nodes[] = $this->getNodeArray( $result_row['id'] );
+
+		return $nodes;
+	}
+
+	function getJobsForNode( $nodeid ) {
+
+		$result = $this->queryDbase( "SELECT job_id FROM job_nodes WHERE node_id = '$nodeid'" );
+
+		$jobs = array();
+
+		foreach( $result as $result_row )
+
+			$jobs[] = $this->getJobArray( $result_row['id'] );
+
+		return $jobs;
+	}
+
+	function getJobArray( $id ) {
+		$result = $this->queryDbase( "SELECT * FROM jobs WHERE job_id = '$id'" );
+
+		return ( $this->makeArray( $result[0] ) );
+	}
+
+	function getNodeArray( $id ) {
+
+		$result = $this->queryDbase( "SELECT * FROM nodes WHERE node_id = '$id'" );
+
+		return ( $this->makeArray( $result[0] ) );
+	}
+
+	function makeArray( $result_row ) {
+
+		$myar = array();
+
+		foreach( $result_row as $mykey => $myval ) {
+
+			$map_key = explode( '_', $mykey );
+
+			$newkey = $map_key[1];
+			
+			$myar[$newkey] = $result_row[$mykey];
+		}
+
+		return $myar;
+	}
+
+	function queryDbase( $query ) {
+
+		$result_rows = array();
+	
+		if( !$this->conn )
+			$this->connect();
+
+		$result = pg_query( $this->conn, $query );
+
+		while ($row = pg_fetch_assoc($result))
+			$result_rows[] = $row;
+
+		return $result_rows;
+	}
 }
 
-class TarchRrd {
+class TarchRrdGraph {
 	var $rrdbin, $rrdvalues, $clustername, $hostname, $tempdir, $tarchdir, $metrics;
 
-	function TarchRrd( $rrdbin = '/usr/bin/rrdtool', $tarchdir = '/data/toga/rrds' ) {
+	function TarchRrd( $clustername, $rrdbin = '/usr/bin/rrdtool', $tarchdir = '/data/toga/rrds' ) {
 		$this->rrdbin = $rrdbin;
 		$this->rrdvalues = array();
 		$this->tarchdir = $tarchdir;
-		$this->tempdir = '/tmp/toga-web-temp';
-		$this->metrics = array();
 	}
 
@@ -158,12 +265,8 @@
 		$times = array();
 		$dirlist = $this->dirList( $this->tarchdir . '/' . $this->clustername . '/' . $this->hostname );
-		//print_r( $dirlist );
-
 		$first = 0;
 		$last = 9999999999999;
 
 		foreach( $dirlist as $dir ) {
-
-			//printf("dir = %s\n", $dir );
 
 			if( $dir > $first and $dir <= $start )
@@ -173,7 +276,4 @@
 		}
 
-		//if( $first != 0 and !array_key_exists( $first, $times ) )
-		//	$times[] = $first;
-
 		foreach( $dirlist as $dir ) {
 
@@ -182,178 +282,7 @@
 		}
 
-		//if( $last != 9999999999 and !array_key_exists( $last, $times ) )
-		//	$times[] = $last;
-
 		sort( $times );
 
-		//print_r( $times );
-
 		return $times;
-	}
-
-	function getIntervalStep( $file ) {
-
-		$ret = $this->doCmd( $this->rrdbin .' info '. $file );
-
-		foreach( $ret as $r ) {
-
-			$fields = explode( ' = ', $r );
-
-			if( $fields[0] == 'step' )
-				return $fields[1];
-		}
-
-		return null;
-	}
-
-	function makeJobRrd( $clustername, $hostname, $metric, $descr, $start, $end) {
-		$this->clustername = $clustername;
-		$this->hostname = $hostname;
-
-		$myvalues = array();
-
-		$times = $this->getTimePeriods( $start, $end );
-
-		if( count( $times ) > 0 ) {
-
-			$time_size = count( $times );
-			$curtime = 1;
-			//print_r( $this->metrics );
-
-			$firstold = $this->tarchdir . '/' . $this->clustername . '/' . $this->hostname .'/'. $times[0]. '/'.$metric;
-
-			if( !file_exists( $firstold ) )
-				return 0;
-
-			$hostdir = $this->tempdir .'/'. $hostname;		
-			$newdir = $hostdir .'/'.$descr;
-			$newfile = $newdir .'/'.$metric;
-
-			//if( file_exists( $newfile ) )
-			//	return 0;
-
-			if( !file_exists( $hostdir ) )
-				mkdir( $hostdir );
-
-			if( !file_exists( $newdir ) )
-				mkdir( $newdir );
-
-			//$this->metrics = $this->dirList( $this->tarchdir . '/' . $this->clustername . '/' . $this->hostname .'/'. $times[0] );
-			$intv = $this->getIntervalStep( '"'.$firstold.'"' );
-
-			foreach( $times as $timep ) {
-
-				$r_start = null;
-				$r_end = null;
-
-				if( $curtime == 1 )
-					$r_start = $start;
-
-				if( $curtime == $time_size )
-					$r_end = $end;
-
-				$file = $this->tarchdir . '/' . $this->clustername . '/' . $this->hostname .'/'. $timep .'/'. $metric;
-
-				$r_values = $this->getValues( $file, $r_start, $r_end );
-				//print_r($r_values);
-
-				$myvalues = $myvalues + $r_values;
-				
-				$curtime++;	
-			}
-			//printf( "----myvalues----\n" );
-			//print_r($myvalues);
-			//printf( "----myvalues----\n" );
-
-			$heartbeat = intval( 8 * $intv );
-			$ret = $this->doCmd( $this->rrdbin .' create "'.$newfile.'" --step '. $intv .' --start '. $start .' DS:sum:GAUGE:'.$heartbeat.':U:U RRA:AVERAGE:0.5:1:'. count( $myvalues ) );
-
-			$update_args = array();
-			$arglist_nr = 0;
-
-			ksort( $myvalues );
-			reset( $myvalues );
-			$myvalues = array_unique( $myvalues );
-			reset( $myvalues );
-
-			foreach( $myvalues as $mytime=>$myvalue ) {
-				$myupdateval = ' '.trim($mytime).':'.trim($myvalue);
-
-				if( !isset($update_args[$arglist_nr]) )
-					$update_args[$arglist_nr] = '';
-
-				// Max_Args for Linux kernel is normally about 130k
-				//
-				if( intval( strlen($update_args[$arglist_nr]) + strlen($myupdateval) ) > 100000 )
-					$arglist_nr++;
-
-				$update_args[$arglist_nr] .= $myupdateval;
-			}
-
-			//printf( "grootte args = %s\n", strlen( $update_args ) );
-
-			foreach( $update_args as $update_arg )
-				$ret = $this->doCmd( $this->rrdbin .' update "'. $newfile . '"'.$update_arg );
-
-			printf( "generated %s\n", $newfile );
-		} else
-			return 0;
-	}
-
-	function getValues( $file, $start = null, $end = null ) {
-
-		$rrdargs = 'AVERAGE -r 15';
-
-		if( $start )
-			$rrdargs .= ' -s '. $start;
-		if( $end )
-			$rrdargs .= ' -e '. $end;
-
-		$values = $this->doCmd( $this->rrdbin .' fetch "'.$file.'" '. $rrdargs );
-
-		//print_r( $values );
-		$arvalues = array();
-
-		foreach( $values as $value ) {
-			//printf( "value = %s\n", $value );
-
-			$fields = explode( ':', $value );
-
-			if( count( $fields ) == 2 ) {
-
-				$timestamp = trim($fields[0]);
-				$keepval = 1;
-
-				if( $start ) {
-
-					if( intval($timestamp) >= intval($start) )
-						$keepval = 1;
-					else
-						$keepval = 0;
-				} else if( $end ) {
-
-					if( intval($timestamp) <= intval($end) )
-						$keepval = 1;
-					else
-						$keepval = 0;
-				}
-
-				$value = $fields[1];
-				//printf("timestamp = %s, value = %s\n", $timestamp, $value );
-
-				if( $keepval and !isset($arvalues[$timestamp] ) )
-					$arvalues[$timestamp] = $value;
-			}
-		}
-		//printf( "----arvalues----\n" );
-		//print_r( $arvalues);
-		//printf( "----arvalues----\n" );
-
-		//ksort( $arvalues );
-		//printf( "----arsortvalues----\n" );
-		//print_r( $arvalues);
-		//printf( "----arsortvalues----\n" );
-
-		return $arvalues;
 	}
 
Index: trunk/web/addons/toga/overview.php
===================================================================
--- trunk/web/addons/toga/overview.php	(revision 137)
+++ trunk/web/addons/toga/overview.php	(revision 138)
@@ -1,5 +1,5 @@
 <?php
 global $GANGLIA_PATH, $clustername, $tpl, $filter, $cluster, $get_metric_string, $cluster_url, $sh;
-global $hosts_up, $m, $start, $end;
+global $hosts_up, $m, $start, $end, $filterorder;
 
 $data_gatherer = new DataGatherer();
@@ -26,4 +26,5 @@
 
 $tpl->assign( "clusterimage", "./image.php?c=".rawurlencode($clustername)."&view=big-clusterimage".$filter_image_url );
+$tpl->assign( "f_order", $filterorder );
 
 if( array_key_exists( "id", $filter ) )
Index: trunk/web/addons/toga/search.php
===================================================================
--- trunk/web/addons/toga/search.php	(revision 137)
+++ trunk/web/addons/toga/search.php	(revision 138)
@@ -3,11 +3,54 @@
 global $clustername, $tpl;
 
-function makeSearchPage() {
-	global $clustername;
+function validateFormInput() {
+	global $clustername, $tpl, $id, $user, $name, $start_from_time, $start_to_time, $queue;
+	global $end_from_time, $end_to_time;
 
-	$tr = new TarchRrd();
-	$tr->makeJobRrds( $clustername, 'gb-r1n1.irc.sara.nl', 'testje', 1114936341, 1115015563 );
-	// bla!
+	$error = 0;
+
+	$none_set = 0;
+
+	//if( $id == '' or $user == '' or $name == '' or $start_from_time == '' or $start_to_time == '' or $queue == '' or $end_from_time == '' or $end_to_time == '') $none_set = 1;
+
+	//if (!isset($id) and !isset($user) and !isset($start_from_time) and !isset($start_to_time) and !isset($end_from_time) and !isset($end_to_time) and !isset($queue) ) $none_set = 0;
+
+	if( $none_set ) {
+		$error = 1;
+		$error_msg = "<FONT COLOR=\"red\"><B>No search criteria set!</B></FONT>";
+	}
+
+	// doe checks en set error en error_msg in case shit
+
+	if( $error) {
+		$tpl->assign( "form_error_msg", $error_msg );
+		return 0;
+	} else {
+		return 1;
+	}
 }
 
+function makeSearchPage() {
+	global $clustername, $tpl, $id, $user, $name, $start_from_time, $start_to_time, $queue;
+	global $end_from_time, $end_to_time;
+
+	$tpl->assign( "cluster", $clustername );
+	$tpl->assign( "id_value", $id );
+	$tpl->assign( "user_value", $user );
+	$tpl->assign( "queue_value", $queue );
+	$tpl->assign( "name_value", $name );
+	$tpl->assign( "start_from_value", rawurldecode( $start_from_time ) );
+	$tpl->assign( "start_to_value", rawurldecode( $start_to_time ) );
+	$tpl->assign( "end_from_value", rawurldecode( $end_from_time ) );
+	$tpl->assign( "end_to_value", rawurldecode( $end_to_time ) );
+
+	if( validateFormInput() ) {
+
+		$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" );
+
+		// show search results
+
+	}
+}
 ?>
Index: trunk/web/addons/toga/templates/overview.tpl
===================================================================
--- trunk/web/addons/toga/templates/overview.tpl	(revision 137)
+++ trunk/web/addons/toga/templates/overview.tpl	(revision 138)
@@ -55,11 +55,54 @@
 		//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>
 
@@ -71,4 +114,5 @@
 <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>
Index: trunk/web/addons/toga/templates/search.tpl
===================================================================
--- trunk/web/addons/toga/templates/search.tpl	(revision 138)
+++ trunk/web/addons/toga/templates/search.tpl	(revision 138)
@@ -0,0 +1,152 @@
+<CENTER>
+</FORM>
+<SCRIPT LANGUAGE="javascript" SRC="ts_picker.js"></SCRIPT>
+<SCRIPT LANGUAGE="javascript">
+
+	function setHiddenTimestamps() {
+
+		document.archive_search_form.start_from_time.value = document.archive_search_form.start_from_pick.value; 
+		document.archive_search_form.start_to_time.value = document.archive_search_form.start_to_pick.value;
+		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" );
+	}
+
+</SCRIPT>
+
+<FORM NAME="archive_search_form" ACTION="./">
+
+<INPUT TYPE="hidden" NAME="c" VALUE="{cluster}">
+<INPUT TYPE="hidden" NAME="view" VALUE="search">
+
+<BR><BR>
+
+<TABLE WIDTH="90%">
+
+<TR>
+  <TD CLASS=title COLSPAN="2">
+  <B>Search job archive</B>
+  </TD>
+</TR>
+
+</TABLE>
+
+<BR><BR>
+
+<TABLE WIDTH="90%">
+
+<TR>
+  <TD></TD>
+  <TD></TD>
+  <TD></TD>
+  <TD></TD>
+  <TD></TD>
+  <TD></TD>
+</TR>
+
+<TR>
+
+  <TD>
+  Id:
+  </TD>
+  <TD>
+  <INPUT TYPE="TEXT" NAME="id" VALUE="{id_value}">
+  </TD>
+
+</TR>
+
+<TR>
+
+  <TD>
+  User:
+  </TD>
+  <TD>
+  <INPUT TYPE="TEXT" NAME="user" VALUE="{user_value}">
+  </TD>
+
+  <TD>
+  Queue:
+  </TD>
+  <TD>
+  <INPUT TYPE="TEXT" NAME="queue" VALUE="{queue_value}">
+  </TD>
+
+  <TD>
+  Name:
+  </TD>
+  <TD>
+  <INPUT TYPE="TEXT" NAME="name" VALUE="{name_value}">
+  </TD>
+
+</TR>
+
+<TR>
+
+  <TD></TD>
+  <TD>
+  Job <B>start</B> between
+  </TD>
+
+  <TD>
+  From:
+  </TD>
+  <TD>
+  <INPUT TYPE="HIDDEN" NAME="start_from_time" VALUE="{start_from_value}">
+  <INPUT TYPE="TEXT" NAME="start_from_pick" VALUE="{start_from_value}" DISABLED="TRUE"> <A HREF="javascript:show_calendar('document.archive_search_form.start_from_pick', document.archive_search_form.start_from_pick.value );"><IMG SRC="cal.gif" width="16" height="16" border="0" alt="Click Here to Pick up the timestamp"></a>
+  </TD>
+  
+  <TD>
+  To:
+  </TD>
+  <TD>
+  <INPUT TYPE="HIDDEN" NAME="start_to_time" VALUE="{start_to_value}">
+  <INPUT TYPE="TEXT" NAME="start_to_pick" VALUE="{start_to_value}" DISABLED="TRUE"><a href="javascript:show_calendar('document.archive_search_form.start_to_pick', document.archive_search_form.start_to_pick.value );"> <img src="cal.gif" width="16" height="16" border="0" alt="Click Here to Pick up the timestamp"></a>
+  </TD>
+  
+</TR>
+
+<TR>
+
+  <TD></TD>
+  <TD>
+  Job <B>end</B> between
+  </TD>
+
+  <TD>
+  From:
+  </TD>
+  <TD>
+  <INPUT TYPE="HIDDEN" NAME="end_from_time" VALUE="{end_from_value}">
+  <INPUT TYPE="TEXT" NAME="end_from_pick" VALUE="{end_from_value}" DISABLED="TRUE"> <A HREF="javascript:show_calendar('document.archive_search_form.end_from_pick', document.archive_search_form.end_from_pick.value );"><IMG SRC="cal.gif" width="16" height="16" border="0" alt="Click Here to Pick up the timestamp"></a>
+  </TD>
+  
+  <TD>
+  To:
+  </TD>
+  <TD>
+  <INPUT TYPE="HIDDEN" NAME="end_to_time" VALUE="{end_to_value}">
+  <INPUT TYPE="TEXT" NAME="end_to_pick" VALUE="{end_to_value}" DISABLED="TRUE"><a href="javascript:show_calendar('document.archive_search_form.end_to_pick', document.archive_search_form.end_to_pick.value );"> <img src="cal.gif" width="16" height="16" border="0" alt="Click Here to Pick up the timestamp"></a>
+  </TD>
+  
+</TR>
+
+<TR>
+
+  <TD></TD>
+  <TD></TD>
+  <TD></TD>
+  <TD></TD>
+  <TD>{form_error_msg}</TD>
+  <TD>
+  <INPUT TYPE="submit" VALUE="Search archive" onClick="setHiddenTimestamps();">
+  </TD>
+
+</TR>
+
+</TABLE>
+</FORM>
+<BR><BR>
+<!-- INCLUDE BLOCK : search_results -->
+<BR><BR>
+<!-- INCLUDE BLOCK : job_details -->
+</CENTER>
Index: trunk/web/addons/toga/templates/search_results.tpl
===================================================================
--- trunk/web/addons/toga/templates/search_results.tpl	(revision 138)
+++ trunk/web/addons/toga/templates/search_results.tpl	(revision 138)
@@ -0,0 +1,131 @@
+<BR><BR>
+
+<CENTER>
+
+<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();
+	}
+
+</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">
+    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> -->
+  </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 -->
