Index: branches/0.4/web/addons/job_monarch/search.php
===================================================================
--- branches/0.4/web/addons/job_monarch/search.php	(revision 711)
+++ branches/0.4/web/addons/job_monarch/search.php	(revision 712)
@@ -167,20 +167,17 @@
         foreach( $jobs as $jobid => $jobattrs ) {
 
-                        $state = $jobattrs[status];
-                        $owner = $jobattrs[owner];
-                        $queue = $jobattrs[queue];
-                        $name = $jobattrs[name];
-                        $req_cpu = $jobattrs[requested_time];
-                        $req_memory = $jobattrs[requested_memory];
-
-                        //if( $state == 'R' )
-			$mynodes = count( $nodes[$jobid] );
-                        //else
-                        //        $nodes = $jobattrs[nodes];
-
-                        $ppn = (int) $jobattrs[ppn] ? $jobattrs[ppn] : 1;
+                        $state = $jobattrs['status'];
+                        $owner = $jobattrs['owner'];
+                        $queue = $jobattrs['queue'];
+                        $name = $jobattrs['name'];
+                        $req_cpu = $jobattrs['requested_time'];
+                        $req_memory = $jobattrs['requested_memory'];
+
+                        $mynodes = count( $nodes[$jobid] );
+
+                        $ppn = (int) $jobattrs['ppn'] ? $jobattrs['ppn'] : 1;
                         $cpus = $mynodes * $ppn;
-                        $start_time = (int) $jobattrs[start_timestamp];
-                        $stop_time = (int) $jobattrs[stop_timestamp];
+                        $start_time = (int) $jobattrs['start_timestamp'];
+                        $stop_time = (int) $jobattrs['stop_timestamp'];
                         $runningtime = $stop_time - $start_time;
 
@@ -325,5 +322,5 @@
 			$job = $jobs[$sortid];
 			//print_r( $job );
-			$foundid = $job[id];
+			$foundid = $job['id'];
 			//printf( "foundid %s\n", $foundid );
 
@@ -332,15 +329,14 @@
 
 			$tpl->newBlock( "node" );
-			$tpl->assign( "id", $job[id] );
-			$tpl->assign( "state", $job[status] );
-			$tpl->assign( "owner", $job[owner] );
-			$tpl->assign( "queue", $job[queue] );
-			$tpl->assign( "name", $job[name] );
-			$tpl->assign( "req_cpu", makeTime( TimeToEpoch( $job[requested_time] ) ) );
+			$tpl->assign( "id", $job['id'] );
+			$tpl->assign( "state", $job['status'] );
+			$tpl->assign( "owner", $job['owner'] );
+			$tpl->assign( "queue", $job['queue'] );
+			$tpl->assign( "name", $job['name'] );
+			$tpl->assign( "req_cpu", makeTime( TimeToEpoch( $job['requested_time'] ) ) );
 
 			if( $COLUMN_REQUESTED_MEMORY ) {
 				$tpl->newBlock( "column_req_mem" );
-				//$tpl->assign( "req_memory", $jobs[$jobid][requested_memory] );
-				$tpl->assign( "req_memory", $job[requested_memory] );
+				$tpl->assign( "req_memory", $job['requested_memory'] );
 				$tpl->gotoBlock( "node" );
 			}
@@ -350,5 +346,5 @@
 
 				foreach( $nodes[$foundid] as $mynode )
-					$job_nodes[] = $mynode[hostname];
+					$job_nodes[] = $mynode['hostname'];
 
 				$tpl->newBlock( "column_nodes" );
@@ -370,19 +366,5 @@
 			}
 
-
-			// need to replace later with domain stored from dbase
-			//
-			//$job_domain = $job[domain];
-
-			//$myhost = $_SERVER[HTTP_HOST];
-			//$myhf = explode( '.', $myhost );
-			//$myhf = array_reverse( $myhf );
-			//array_pop( $myhf );
-			//$myhf = array_reverse( $myhf );
-			//$job_domain = implode( '.', $myhf );
-			
-			//print_r( $job );
-			//printf( "job domain = %s\n", $job_domain);
-			$ppn = (int) $job[ppn] ? $job[ppn] : 1;
+			$ppn = (int) $job['ppn'] ? $job['ppn'] : 1;
 			$cpus = $nodes_nr * $ppn;
 
@@ -390,6 +372,6 @@
 			$tpl->assign( "cpus", $cpus );
 
-			$job_start = $job[start_timestamp];
-			$job_stop = $job[stop_timestamp];
+			$job_start = $job['start_timestamp'];
+			$job_stop = $job['stop_timestamp'];
 			$runningtime = intval( $job_stop - $job_start );
 			$tpl->assign( "started", makeDate( $job_start ) );
@@ -455,21 +437,20 @@
 
 				foreach( $nodes[$id] as $mynode )
-					$hosts_up[] = $mynode[hostname];
+					$hosts_up[] = $mynode['hostname'];
 
 				$sorted_hosts = array();
-				//$hosts_up = $jobs[$filter[id]][nodes];
 
 				foreach ($hosts_up as $host ) {
 					//$host = $host. '.'.$job_domain;
-					$cpus = $metrics[$host]["cpu_num"][VAL];
+					$cpus = $metrics[$host]["cpu_num"]['VAL'];
 					if (!$cpus) $cpus=1;
-					$load_one  = $metrics[$host]["load_one"][VAL];
+					$load_one  = $metrics[$host]["load_one"]['VAL'];
 					$load = ((float) $load_one)/$cpus;
 					$host_load[$host] = $load;
-					$percent_hosts[load_color($load)] += 1;
+					$percent_hosts['load_color'.($load)] += 1;
 					if ($metricname=="load_one")
 						$sorted_hosts[$host] = $load;
 					else
-						$sorted_hosts[$host] = $metrics[$host][$metricname][VAL];
+						$sorted_hosts[$host] = $metrics[$host][$metricname]['VAL'];
 				}
 				switch ($sort) {
@@ -508,10 +489,10 @@
 					$host_link="\"?j_view=host&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]) {
-						$textval = date("r", $val[VAL]);
-					} elseif ($val[TYPE]=="string" or $val[SLOPE]=="zero" or $always_constant[$metricname] or ($max_graphs > 0 and $i > $max_graphs )) {
-						$textval = "$val[VAL] $val[UNITS]";
+					if ($val['TYPE']=="timestamp" or $always_timestamp[$metricname]) {
+						$textval = date("r", $val['VAL']);
+					} elseif ($val['TYPE']=="string" or $val['SLOPE']=="zero" or $always_constant[$metricname] or ($max_graphs > 0 and $i > $max_graphs )) {
+						$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&period_start=$period_start&period_stop=$period_stop&min=$min&max=$max";
+						$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&min=$min&max=$max";
 					}
 					if ($textval) {
