Index: /trunk/web/addons/job_monarch/image.php
===================================================================
--- /trunk/web/addons/job_monarch/image.php	(revision 325)
+++ /trunk/web/addons/job_monarch/image.php	(revision 326)
@@ -29,4 +29,26 @@
 }
 
+function checkSessionData() {
+
+	global $_SESSION;
+
+	session_start();
+
+	if( isset( $_SESSION["data"] ) ) {
+		$myxml_data	= &$_SESSION["data"];
+	} else {
+		$myxml_data	= 0;
+	}
+
+	if( !$myxml_data ) {
+		$ds             = new DataSource();
+		$myxml_data     = $ds->getData();
+
+		print_f( "%s\n", $myxml_data );
+	}
+	return $myxml_data;
+}
+
+
 $httpvars = new HTTPVariables( $HTTP_GET_VARS, $_GET );
 $view = $httpvars->getHttpVar( "view" );
@@ -41,8 +63,12 @@
 function drawHostImage() {
 
-	global $clustername, $hostname;
+	global $clustername, $hostname, $data_gatherer;
 
-	$data_gatherer = new DataGatherer( $clustername );
-	$data_gatherer->parseXML();
+	$ds             = new DataSource();
+	$myxml_data     = $ds->getData();
+
+	$data_gatherer	= new DataGatherer( $clustername );
+
+	$data_gatherer->parseXML( $myxml_data );
 
 	if( $data_gatherer->isJobmonRunning() )
@@ -56,11 +82,15 @@
 function drawSmallClusterImage() {
 
-	global $clustername;
+	global $clustername, $data_gatherer;
 
-	$data_gatherer = new DataGatherer( $clustername );
-	$data_gatherer->parseXML();
+	$ds             = new DataSource();
+	$myxml_data     = $ds->getData();
+
+	$data_gatherer	= new DataGatherer( $clustername );
+
+	$data_gatherer->parseXML( $myxml_data );
 
 	if( $data_gatherer->isJobmonRunning() ) {
-		$ic = new ClusterImage( $clustername );
+		$ic = new ClusterImage( $myxml_data, $clustername );
 		$ic->setSmall();
 	} else {
@@ -75,5 +105,7 @@
 	global $filter, $clustername;
 
-	$ic = new ClusterImage( $clustername );
+	$myxml_data	= checkSessionData();
+
+	$ic = new ClusterImage( $myxml_data, $clustername );
 	$ic->setBig();
 
Index: /trunk/web/addons/job_monarch/libtoga.php
===================================================================
--- /trunk/web/addons/job_monarch/libtoga.php	(revision 325)
+++ /trunk/web/addons/job_monarch/libtoga.php	(revision 326)
@@ -417,7 +417,17 @@
 	var $data, $ip, $port;
 
-	function DataSource( $ip = '127.0.0.1', $port = 8649 ) {
-		$this->ip = $ip;
-		$this->port = $port;
+	//function DataSource( $ip = '127.0.0.1', $port = 8649 ) {
+	function DataSource() {
+
+		global $DATA_SOURCE;
+
+		$ds_fields 	= explode( ':', $DATA_SOURCE );
+
+		$ds_ip 		= $ds_fields[0];
+		$ds_port 	= $ds_fields[1];
+
+		$this->ip 	= $ds_ip;
+		$this->port 	= $ds_port;
+
 	}
 
@@ -454,25 +464,28 @@
 	function DataGatherer( $cluster ) {
 
-		global $DATA_SOURCE;
+		//global $DATA_SOURCE;
 	
 		//printf("dg cluster = %s\n", $cluster );
-		$ds_fields = explode( ':', $DATA_SOURCE );
-		$ds_ip = $ds_fields[0];
-		$ds_port = $ds_fields[1];
-
-		$this->source = new DataSource( $ds_ip, $ds_port );
-
-		$this->parser = xml_parser_create();
+		//$ds_fields = explode( ':', $DATA_SOURCE );
+		//$ds_ip = $ds_fields[0];
+		//$ds_port = $ds_fields[1];
+
+		//$this->source = new DataSource( $ds_ip, $ds_port );
+
+		$this->cluster	= $cluster;
 		$this->httpvars = $httpvars;
-		$this->xmlhandler = new TorqueXMLHandler( $cluster );
+	}
+
+	function parseXML( $data ) {
+
+		//$src = &$this->source;
+		//$this->data = $src->getData();
+
+		$this->parser 		= xml_parser_create();
+		$this->xmlhandler 	= new TorqueXMLHandler( $this->cluster );
+
 		xml_set_element_handler( $this->parser, array( &$this->xmlhandler, 'startElement' ), array( &$this->xmlhandler, 'stopElement' ) );
-	}
-
-	function parseXML() {
-
-		$src = &$this->source;
-		$this->data = $src->getData();
-
-		if ( !xml_parse( $this->parser, $this->data ) )
+		//if ( !xml_parse( $this->parser, $this->data ) )
+		if ( !xml_parse( $this->parser, $data ) )
 			$error = sprintf( 'XML error: %s at %d', xml_error_string( xml_get_error_code( $this->parser ) ), xml_get_current_line_number( $this->parser ) );
 	}
@@ -591,5 +604,5 @@
 
 			if( !isset( $nodes[$hostname] ) )
-				$nodes[$hostname] = new NodeImage( $hostname );
+				$nodes[$hostname] = new NodeImage( $this->proc_cluster, $hostname );
 
 		} else if( $name == 'METRIC' and strstr( $attrs[NAME], 'MONARCH' ) and $this->proc_cluster == $this->clustername ) {
@@ -668,5 +681,5 @@
 				
 							if( !isset( $nodes[$host] ) )
-								$my_node = new NodeImage( $host );
+								$my_node = new NodeImage( $this->proc_cluster, $host );
 							else
 								$my_node = $nodes[$host];
@@ -767,5 +780,5 @@
 	var $image, $x, $y, $hostname, $jobs, $tasks, $showinfo;
 
-	function NodeImage( $hostname ) {
+	function NodeImage( $cluster, $hostname ) {
 
 		global $SMALL_CLUSTERIMAGE_NODEWIDTH;
@@ -778,4 +791,5 @@
 		$this->hostname = $hostname;
 		$this->cpus = $this->determineCpus();
+		$this->clustername = $cluster;
 		$this->showinfo = 1;
 		$this->size = $SMALL_CLUSTERIMAGE_NODEWIDTH;
@@ -818,4 +832,21 @@
 		$this->x = $x;
 		$this->y = $y;
+	}
+
+	function getImagemapArea() {
+
+		$area_topleft		= $this->x . "," . $this->y;
+		$area_bottomright	= ($this->x + $this->size) . "," . ($this->y + $this->size);
+		$area_coords		= $area_topleft . "," . $area_bottomright;
+
+		$area_href		= "./?c=" . $this->clustername . "&h=" . $this->hostname;
+		$area_tooltip		= $this->hostname . ": " . implode( " ", $this->jobs );
+
+		$tag_href		= "HREF=\"" . $area_href . "\"";
+		$tag_coords		= "COORDS=\"" . $area_coords . "\"";
+		$tag_tooltip1		= "ALT=\"" . $area_tooltip . "\"";
+		$tag_tooltip2		= "TITLE=\"" . $area_tooltip . "\"";
+
+		return ("<AREA SHAPE=\"RECT\" " . $tag_coords . " " . $tag_href . " " . $tag_tooltip1 . " " . $tag_tooltip2 . ">");
 	}
 
@@ -929,10 +960,23 @@
 	var $filtername, $filters;
 
-	function ClusterImage( $clustername ) {
-
+	//function ClusterImage( $clustername ) {
+	function ClusterImage( $data, $clustername ) {
+
+		//$this->dataget		= $dataget;
 		$this->dataget		= new DataGatherer( $clustername );
+		$this->data		= $data;
 		$this->clustername	= $clustername;
 		$this->filters		= array();
 		$this->size		= 's';
+		$this->width		= 0;
+		$this->height		= 0;
+		$this->output		= 1;
+	}
+
+	function getWidth() {
+		return $this->width;
+	}
+	function getHeight() {
+		return $this->height;
 	}
 
@@ -943,4 +987,8 @@
 	function setBig() {
 		$this->size	= 'b';
+	}
+
+	function setNoimage() {
+		$this->output	= 0;
 	}
 
@@ -1007,5 +1055,5 @@
 	
 		$mydatag = $this->dataget;
-		$mydatag->parseXML();
+		$mydatag->parseXML( $this->data );
 
 		if( $this->isSmall() ) {
@@ -1048,4 +1096,7 @@
 		$y_offset	= $fontheight + (2 * $fontspaceing);
 
+		$this->width	= $max_width;
+		$this->height	= ($y_offset + (($node_rows*$node_width)+1) );
+
 		$image = imageCreateTrueColor( $max_width, ($y_offset + (($node_rows*$node_width)+1) ) );
 		$colorwhite = imageColorAllocate( $image, 255, 255, 255 );
@@ -1090,8 +1141,25 @@
 			}
 		}
-		
-		header( 'Content-type: image/png' );
-		imagePNG( $image );
-		imageDestroy( $image );
+	
+		$this->nodes	= &$nodes;
+
+		if ($this->output) {
+			header( 'Content-type: image/png' );
+			imagePNG( $image );
+			imageDestroy( $image );
+		}
+	}
+
+	function getImagemapArea() {
+
+		$clusterimage_map	= "";
+
+		foreach( $this->nodes as $hostname => $node ) {
+
+			$node_map		= $node->getImagemapArea();
+			$clusterimage_map	.= $node_map;
+		}
+
+		return $clusterimage_map;
 	}
 }
Index: /trunk/web/addons/job_monarch/overview.php
===================================================================
--- /trunk/web/addons/job_monarch/overview.php	(revision 325)
+++ /trunk/web/addons/job_monarch/overview.php	(revision 326)
@@ -26,4 +26,7 @@
 global $hosts_up, $m, $start, $end, $filterorder, $COLUMN_REQUESTED_MEMORY, $COLUMN_QUEUED, $COLUMN_NODES, $hostname, $piefilter;
 
+$ds		= new DataSource();
+$myxml_data	= $ds->getData();
+
 $data_gatherer = new DataGatherer( $clustername );
 
@@ -33,5 +36,5 @@
 	$tpl->assign( "cluster_url", rawurlencode($clustername) );
 
-$data_gatherer->parseXML();
+$data_gatherer->parseXML( $myxml_data );
 
 $heartbeat = $data_gatherer->getHeartbeat();
@@ -41,5 +44,5 @@
 
 function setupFilterSettings() {
-	global $tpl, $filter, $clustername, $piefilter;
+	global $tpl, $filter, $clustername, $piefilter, $data_gatherer, $myxml_data;
 
 	$filter_image_url = "";
@@ -52,5 +55,24 @@
 	}
 
-	$tpl->assign( "clusterimage", "./image.php?c=".rawurlencode($clustername)."&view=big-clusterimage".$filter_image_url );
+	//include( "./ci_test.php" );
+	session_start();
+	//printf("data %s\n", strval( $myxml_data ) );
+	$_SESSION["data"] = &$myxml_data;
+
+	$ic = new ClusterImage( $myxml_data, $clustername );
+	$ic->setBig();
+	$ic->setNoimage();
+	$ic->draw();
+
+	//$tpl->assign( "clusterimage", "./image.php?c=".rawurlencode($clustername)."&view=big-clusterimage".$filter_image_url );
+	$tpl->assign( "clusterimage", "./image.php?". session_name() . "=" . session_id() ."&c=".rawurlencode($clustername)."&view=big-clusterimage".$filter_image_url );
+
+	$tpl->assign( "clusterimage_width", $ic->getWidth() );
+	$tpl->assign( "clusterimage_height", $ic->getHeight() );
+
+	$tpl->newBlock( "node_clustermap" );
+	$tpl->assign( "node_area_map", $ic->getImagemapArea() );
+	$tpl->gotoBlock( "_ROOT" );
+
 	$tpl->assign( "f_order", $filterorder );
 
Index: /trunk/web/addons/job_monarch/templates/overview.tpl
===================================================================
--- /trunk/web/addons/job_monarch/templates/overview.tpl	(revision 325)
+++ /trunk/web/addons/job_monarch/templates/overview.tpl	(revision 326)
@@ -113,5 +113,12 @@
 
   <TD ALIGN="CENTER"><CENTER>
-    <IMG SRC="{clusterimage}"><BR>
+<!-- INCLUDESCRIPT BLOCK : ci_script -->
+    <IMG SRC="{clusterimage}" USEMAP="#MONARCH_CLUSTER_BIG" WIDTH="{clusterimage_width}" HEIGHT="{clusterimage_height}" BORDER="0">
+    <MAP NAME="MONARCH_CLUSTER_BIG">
+<!-- START BLOCK : node_clustermap -->
+{node_area_map}
+<!-- END BLOCK : node_clustermap -->
+    </MAP>
+    <BR>
 <FONT class="footer">Last updated: {report_time}</FONT></CENTER>
   </TD>
