Index: plugins/Live/API.php
===================================================================
--- plugins/Live/API.php	(revision 1795)
+++ plugins/Live/API.php	(working copy)
@@ -18,17 +18,17 @@
  */
 require_once PIWIK_INCLUDE_PATH . '/plugins/Live/Visitor.php';
 
-class Piwik_Live_API 
+class Piwik_Live_API
 {
 	static private $instance = null;
-	
+
 	/*
 	 * @return Piwik_Live_API
 	 */
 	static public function getInstance()
 	{
 		if (self::$instance == null)
-		{            
+		{
 			$c = __CLASS__;
 			self::$instance = new $c();
 		}
@@ -42,7 +42,7 @@
 	{
 		return $this->getLastVisitsForVisitor($visitorId, $idSite, 1);
 	}
-	
+
 	/*
 	 * @return Piwik_DataTable
 	 */
@@ -56,8 +56,10 @@
 		{
 			Piwik::checkUserHasViewAccess($idSite);
 		}
+
 		$visitorDetails = self::loadLastVisitorDetailsFromDatabase($visitorId, $idSite, $limit);
 		$table = self::getCleanedVisitorsFromDetails($visitorDetails);
+
 		return $table;
 	}
 
@@ -78,7 +80,7 @@
 		}
 		$visitorDetails = self::loadLastVisitorDetailsFromDatabase(null, $idSite, $limit, $minIdVisit);
 		$table = self::getCleanedVisitorsFromDetails($visitorDetails);
-//		var_dump($table);
+
 		return $table;
 	}
 
@@ -88,7 +90,6 @@
 	public function getLastVisitsDetails( $idSite = false, $limit = 1000, $minIdVisit = false )
 	{
 		// for checking given vars
-		// echo $idSite.'|'.$limit.'|'.$minIdVisit.'<br>';
 		if(is_null($idSite))
 		{
 			Piwik::checkUserIsSuperUser();
@@ -99,89 +100,101 @@
 		}
 		$visitorDetails = self::loadLastVisitorDetailsFromDatabase(null, $idSite, $limit, $minIdVisit);
 		$dataTable = self::getCleanedVisitorsFromDetails($visitorDetails);
-//echo "hallo";
-//
 //		$dataTable->queueFilter('ColumnCallbackAddMetadata', array('operatingSystem', 'icon', 'Piwik_Live_Visitor::getVisitLength()'));
-		
-// echo "<pre>";
-// var_dump($dataTable[0]);
-// echo "</pre>";		
-		
+
 		return $dataTable;
 	}
 
-	
+
 	/*
 	 * @return Piwik_DataTable
 	 */
 	static private function getCleanedVisitorsFromDetails($visitorDetails)
 	{
 		$table = new Piwik_DataTable();
+
 		foreach($visitorDetails as $visitorDetail)
 		{
 			self::cleanVisitorDetails($visitorDetail);
 			$visitor = new Piwik_Live_Visitor($visitorDetail);
+
+			// $visitorDetail must contain the match_atribute
 			$visitorDetailsArray = $visitor->getAllVisitorDetails();
+
+//			$visitorDetailsArray['goalIcon'] = "themes/default/images/goal.png";
+
 			$dateTimeVisit = Piwik_Date::factory($visitorDetailsArray['firstActionTimestamp']);
 			//TODO TO FIX
 			$visitorDetailsArray['serverDatePretty'] = $dateTimeVisit->getLocalized('%shortDay% %day% %shortMonth%');
 			$visitorDetailsArray['serverTimePretty'] = $dateTimeVisit->getLocalized('%time%');
-			
-			// get Detail
+
+			// get Detail - 100 single SQL Statements - Performance Issue
 			$idvisit = $visitorDetailsArray['idVisit'];
-			$sql = "SELECT DISTINCT`" .Piwik::prefixTable('log_action')."`.`name` AS pageUrl
-				FROM `" .Piwik::prefixTable('log_visit')."`
-					INNER JOIN `" .Piwik::prefixTable('log_link_visit_action')."` ON `" .Piwik::prefixTable('log_visit')."`.`idvisit` =  `" .Piwik::prefixTable('log_link_visit_action')."`.`idvisit`
+
+			$sql = "SELECT DISTINCT `" .Piwik::prefixTable('log_action')."`.`name` AS pageUrl
+				FROM `" .Piwik::prefixTable('log_link_visit_action')."`
 					INNER JOIN `" .Piwik::prefixTable('log_action')."` ON  `" .Piwik::prefixTable('log_link_visit_action')."`.`idaction_url` = `" .Piwik::prefixTable('log_action')."`.`idaction`
-				WHERE `" .Piwik::prefixTable('log_visit')."`.`idvisit` = $idvisit;
+				WHERE `" .Piwik::prefixTable('log_link_visit_action')."`.`idvisit` = $idvisit;
 				 ";
-			
+
 			$visitorDetailsArray['actionDetails'] = Piwik_FetchAll($sql);
-			
+
+			$sql = "SELECT DISTINCT `" .Piwik::prefixTable('log_action')."`.`name` AS pageUrl
+				FROM `" .Piwik::prefixTable('log_link_visit_action')."`
+					INNER JOIN `" .Piwik::prefixTable('log_action')."` ON  `" .Piwik::prefixTable('log_link_visit_action')."`.`idaction_name` = `" .Piwik::prefixTable('log_action')."`.`idaction`
+				WHERE `" .Piwik::prefixTable('log_link_visit_action')."`.`idvisit` = $idvisit;
+				 ";
+
+			$visitorDetailsArray['actionDetailsTitle'] = Piwik_FetchAll($sql);
+
 			$table->addRowFromArray( array(Piwik_DataTable_Row::COLUMNS => $visitorDetailsArray));
 		}
+
 		return $table;
 	}
-	
+
 	/*
 	 * @return array
 	 */
 	private function loadLastVisitorDetailsFromDatabase($visitorId = null, $idSite = null, $limit = null, $minIdVisit = false )
 	{
 		// for checking given vars
-		// echo $visitorId.'|'.$idSite.'|'.$limit.'|'.$minIdVisit.'<br>';		
+		// echo $visitorId.'|'.$idSite.'|'.$limit.'|'.$minIdVisit.'<br>';
 		$where = $whereBind = array();
-		
+
 		if(!is_null($idSite))
 		{
-			$where[] = " idsite = ? ";
+			$where[] = Piwik::prefixTable('log_visit') . ".idsite = ? ";
 			$whereBind[] = $idSite;
 		}
-		
+
 		if(!is_null($visitorId))
 		{
-			$where[] = " visitor_idcookie = ? ";
+			$where[] = Piwik::prefixTable('log_visit') . ".visitor_idcookie = ? ";
 			$whereBind[] = $visitorId;
 		}
-		
+
 		if(!is_null($minIdVisit))
 		{
-			$where[] = " idvisit > ? ";
+			$where[] = Piwik::prefixTable('log_visit') . ".idvisit > ? ";
 			$whereBind[] = $minIdVisit;
 		}
-		
+
 		$sqlWhere = "";
 		if(count($where) > 0)
 		{
 			$sqlWhere = " WHERE " . join(' AND ', $where);
 		}
-		
-		$sql = "SELECT *
+
+		$sql = "SELECT 	" . Piwik::prefixTable('log_visit') . ".* , " . Piwik::prefixTable ( 'goal' ) . ".`match_attribute`
 				FROM " . Piwik::prefixTable('log_visit') . "
-				$sqlWhere 
+				LEFT JOIN ".Piwik::prefixTable('log_conversion')." ON " . Piwik::prefixTable('log_visit') . ".`idvisit` = " . Piwik::prefixTable('log_conversion') . ".`idvisit`
+				LEFT JOIN ".Piwik::prefixTable('goal')." ON " . Piwik::prefixTable('goal') . ".`idgoal` = " . Piwik::prefixTable('log_conversion') . ".`idgoal` AND " . Piwik::prefixTable('goal') . ".`deleted` = 0
+				$sqlWhere
 				ORDER BY idvisit DESC
 				LIMIT $limit";
-				
+
+
 		return Piwik_FetchAll($sql, $whereBind);
 	}
 
@@ -190,7 +203,7 @@
 	 */
 	static private function cleanVisitorDetails( &$visitorDetails )
 	{
-		$toUnset = array('config_md5config');		
+		$toUnset = array('config_md5config');
 		if(!Piwik::isUserIsSuperUser())
 		{
 			$toUnset[] = 'visitor_idcookie';
@@ -204,9 +217,9 @@
 			}
 		}
 	}
-	
-	
-	
+
+
+
 	/*
 	 * @return Piwik_DataTable
 	 */
@@ -220,9 +233,10 @@
 		{
 			Piwik::checkUserHasViewAccess($idSite);
 		}
-		$visitorDetails = self::loadLastVisitorDetailsInLastXMinFromDatabase(null, $idSite, $limit, $minIdVisit, $minutes);
-		
+//		$visitorDetails = self::loadLastVisitorDetailsInLastXMinFromDatabase(null, $idSite, $limit, $minIdVisit, $minutes);
+		$visitorDetails = self::loadLastVisitorInLastXTimeFromDatabase(null, $idSite, $limit, $minIdVisit, $minutes, 0, 1);
 		$table = self::getCleanedVisitorsFromDetails($visitorDetails);
+
 		return $table;
 	}
 
@@ -231,7 +245,7 @@
 	 */
 	public function getUsersInLastXDays( $idSite = false, $limit = 10, $minIdVisit = false, $days = 10 )
 	{
-	
+
 		if(is_null($idSite))
 		{
 			Piwik::checkUserIsSuperUser();
@@ -240,20 +254,21 @@
 		{
 			Piwik::checkUserHasViewAccess($idSite);
 		}
-		$visitorDetails = self::loadLastVisitorDetailsInLastXDaysFromDatabase(null, $idSite, $limit, $minIdVisit, $days);
-		
+//		$visitorDetails = self::loadLastVisitorDetailsInLastXDaysFromDatabase(null, $idSite, $limit, $minIdVisit, $days);
+		$visitorDetails = self::loadLastVisitorInLastXTimeFromDatabase(null, $idSite, $limit, $minIdVisit, 0, $days, 1);
+
 		$table = self::getCleanedVisitorsFromDetails($visitorDetails);
 
 		return $table;
 	}
-	
+
 	/*
 	 * @return array
-	 */	
+	 */
 	public function getPageImpressionsInLastXDays($idSite = false, $limit = 10, $minIdVisit = false, $days = 10){
 		// for checking given vars
 		#echo $idSite.'|'.$limit.'|'.$minIdVisit.'|'.$days.'<br>';
-			
+
 		if(is_null($idSite))
 		{
 			Piwik::checkUserIsSuperUser();
@@ -262,8 +277,9 @@
 		{
 			Piwik::checkUserHasViewAccess($idSite);
 		}
-		$pageDetails = self::loadLastVisitedPagesInLastXDaysFromDatabase(null, $idSite, $limit, $minIdVisit, $days);
-		
+//		$pageDetails = self::loadLastVisitedPagesInLastXDaysFromDatabase(null, $idSite, $limit, $minIdVisit, $days);
+		$pageDetails = self::loadLastVisitorInLastXTimeFromDatabase(null, $idSite, $limit, $minIdVisit, 0, $days, 2);
+
 		$i = -1;
 		foreach ($pageDetails as $detail) {
 			$i++;
@@ -272,12 +288,12 @@
 			}
 		}
 
-		return $pageDetails;		
+		return $pageDetails;
 	}
 
 	/*
 	 * @return array
-	 */	
+	 */
 	public function getPageImpressionsInLastXMin($idSite = false, $limit = 10, $minIdVisit = false, $minutes = 30){
 
 		if(is_null($idSite))
@@ -288,8 +304,9 @@
 		{
 			Piwik::checkUserHasViewAccess($idSite);
 		}
-		$pageDetails = self::loadLastVisitedPagesInLastXMinFromDatabase(null, $idSite, $limit, $minIdVisit, $minutes);
-		
+//		$pageDetails = self::loadLastVisitedPagesInLastXMinFromDatabase(null, $idSite, $limit, $minIdVisit, $minutes);
+		$pageDetails = self::loadLastVisitorInLastXTimeFromDatabase(null, $idSite, $limit, $minIdVisit, $minutes, 0, 2);
+
 		$i = -1;
 		foreach ($pageDetails as $detail) {
 			$i++;
@@ -297,193 +314,104 @@
 				$pageDetails[$i]['name']  = substr($pageDetails[$i]['name'] , 0, 30 - 3).'...';
 			}
 		}
-		return $pageDetails;		
+		return $pageDetails;
 	}
-		
 
-	
 
-	/*
-	 * TODO should be refactored with function below
-	 * @return array
+	/**
+	 * Load last Visitors PAGES or DETAILS in MINUTES or DAYS from database
+	 *
+	 * @param boolen $visitorId
+	 * @param boolen $idSite
+	 * @param int $limit int
+	 * @param int $minIdVisit
+	 * @param int $minutes
+	 * @param int $days
+	 * @param int $type 1 = DETAILS; 2 = PAGES
+	 *
+	 * @return mixed
 	 */
-	private function loadLastVisitorDetailsInLastXMinFromDatabase($visitorId = null, $idSite = null, $limit = 1000, $minIdVisit = false, $minutes = 0 )
+	private function loadLastVisitorInLastXTimeFromDatabase($visitorId = null, $idSite = null, $limit = 1000, $minIdVisit = false, $minutes = 0, $days = 0, $type = 0 )
 	{
 		$where = $whereBind = array();
-		
+
 		if(!is_null($idSite))
 		{
-			$where[] = " idsite = ? ";
+			$where[] = " " . Piwik::prefixTable('log_visit') . ".`idsite` = ? ";
 			$whereBind[] = $idSite;
 		}
-		
+
 		if(!is_null($visitorId))
 		{
-			$where[] = " visitor_idcookie = ? ";
+			$where[] = " `visitor_idcookie` = ? ";
 			$whereBind[] = $visitorId;
 		}
-		
+
 		if(!is_null($minIdVisit))
 		{
-			$where[] = " idvisit > ? ";
+			$where[] = " " . Piwik::prefixTable('log_visit') . ".`idvisit` > ? ";
 			$whereBind[] = $minIdVisit;
 		}
-		
+
 		if($minutes != 0)
 		{
 			$timeLimit = mktime(date("H"), date("i") - $minutes, 0, date("m"),   date("d"),   date("Y"));
-
-			$where[] = " visit_last_action_time > '".date('Y-m-d H:i:s',$timeLimit)."'";
-		}
-		
-		$sqlWhere = "";
-		if(count($where) > 0)
-		{
-			$sqlWhere = " WHERE " . join(' AND ', $where);
-		}
-		
-		$sql = "SELECT 	*
-				FROM " . Piwik::prefixTable('log_visit') . "
-				$sqlWhere 
-				ORDER BY idvisit DESC
-				LIMIT " . (int)$limit;
-		return Piwik_FetchAll($sql, $whereBind);
-	}
-	
-	/*
-	 * TODO should be refactored with function above
-	 * @return array
-	 */
-	private function loadLastVisitorDetailsInLastXDaysFromDatabase($visitorId = null, $idSite = null, $limit = 1000, $minIdVisit = false, $days = 0 )
-	{
-		$where = $whereBind = array();
-		
-		if(!is_null($idSite))
-		{
-			$where[] = " idsite = ? ";
-			$whereBind[] = $idSite;
+			$where[] = " `visit_last_action_time` > '".date('Y-m-d H:i:s',$timeLimit)."'";
 		}
-		
-		if(!is_null($visitorId))
-		{
-			$where[] = " visitor_idcookie = ? ";
-			$whereBind[] = $visitorId;
-		}
-		
-		if(!is_null($minIdVisit))
-		{
-			$where[] = " idvisit > ? ";
-			$whereBind[] = $minIdVisit;
-		}
-		
+
 		if($days != 0)
 		{
 			$timeLimit = mktime(0, 0, 0, date("m"),   date("d") - $days + 1,   date("Y"));
-
-			$where[] = " visit_last_action_time > '".date('Y-m-d H:i:s',$timeLimit)."'";
+			$where[] = " `visit_last_action_time` > '".date('Y-m-d H:i:s',$timeLimit)."'";
 		}
-		
+
 		$sqlWhere = "";
 		if(count($where) > 0)
 		{
 			$sqlWhere = " WHERE " . join(' AND ', $where);
 		}
-		
-		$sql = "SELECT 	*
+
+		// Details
+		if($type == 1)
+		{
+			$sql = "SELECT 	" . Piwik::prefixTable('log_visit') . ".*
 				FROM " . Piwik::prefixTable('log_visit') . "
-				$sqlWhere 
+				$sqlWhere
 				ORDER BY idvisit DESC
 				LIMIT " . (int)$limit;
-		return Piwik_FetchAll($sql, $whereBind);
-	}
-	
-	/*
-	 * TODO should be refactored with function above
-	 * @return array
-	 */
-	private function loadLastVisitedPagesInLastXMinFromDatabase($visitorId = null, $idSite = null, $limit = null, $minIdVisit = false, $minutes = 0 )
-	{
-		$where = $whereBind = array();
-		
-		if(!is_null($idSite))
-		{
-			$where[] = " idsite = ? ";
-			$whereBind[] = $idSite;
-		}
-		
-		if(!is_null($visitorId))
-		{
-			$where[] = " visitor_idcookie = ? ";
-			$whereBind[] = $visitorId;
-		}
-		
-		if(!is_null($minIdVisit))
-		{
-			$where[] = Piwik::prefixTable('log_visit') .".idvisit > ? ";
-			$whereBind[] = $minIdVisit;
-		}
-
-		if($minutes != 0)
-		{
-			$timeLimit = mktime(date("H"), date("i") - $minutes, 0, date("m"),   date("d"),   date("Y"));
+		 }
+		 // Pages
+		 elseif($type == 2)
+		 {
+		 	// different SELECT between $minutes & $days
+		 	if($minutes != 0)
+		 	{
+		 		$sql_select = "SELECT " . Piwik::prefixTable('log_link_visit_action') . ".`idaction_url`, " . Piwik::prefixTable('log_action') . ".`idaction`, " . Piwik::prefixTable('log_action') . ".`name` , " . Piwik::prefixTable('log_visit') . ".*";
+			}
+			elseif($days != 0)
+			{
+			    $sql_select = "SELECT " . Piwik::prefixTable('log_link_visit_action') . ".`idaction_url`, " . Piwik::prefixTable('log_action') . ".`idaction`, " . Piwik::prefixTable('log_action') . ".`name` , " . Piwik::prefixTable('log_link_visit_action') . ".*";
+			}
+			else
+			{
+				// neither $minutes nor $days --> ERROR
+				return false;
+			}
 
-			$where[] = " visit_last_action_time > '".date('Y-m-d H:i:s',$timeLimit)."'";
-		}
-		
-		$sqlWhere = "";
-		if(count($where) > 0)
-		{
-			$sqlWhere = " WHERE " . join(' AND ', $where);
-		}
-		
-		$sql = "SELECT " . Piwik::prefixTable('log_link_visit_action') . ".`idaction_url`," . Piwik::prefixTable('log_action') . ".`idaction`, " . Piwik::prefixTable('log_action') . ".`name` , " . Piwik::prefixTable('log_visit') . ".*
+			$sql = $sql_select."
 				FROM " . Piwik::prefixTable('log_link_visit_action') . "
-				INNER JOIN " . Piwik::prefixTable('log_action') . " ON " . Piwik::prefixTable('log_link_visit_action') . ".`idaction_url`= " . Piwik::prefixTable('log_action') . ".`idaction` 
+				INNER JOIN " . Piwik::prefixTable('log_action') . " ON " . Piwik::prefixTable('log_link_visit_action') . ".`idaction_url`= " . Piwik::prefixTable('log_action') . ".`idaction`
 				INNER JOIN " . Piwik::prefixTable('log_visit') . " ON " . Piwik::prefixTable('log_visit') . ".`idvisit` = " . Piwik::prefixTable('log_link_visit_action') . ".`idvisit`
 				$sqlWhere";
-		return Piwik_FetchAll($sql, $whereBind);
-	}	
-		
-	/*
-	 * TODO should be refactored with function above
-	 * @return array
-	 */
-	private function loadLastVisitedPagesInLastXDaysFromDatabase($visitorId = null, $idSite = null, $limit = null, $minIdVisit = false, $days = 0 )
-	{
-		$where = $whereBind = array();
-		
-		if(!is_null($idSite))
-		{
-			$where[] = " idsite = ? ";
-			$whereBind[] = $idSite;
-		}
-		
-		if(!is_null($visitorId))
-		{
-			$where[] = " visitor_idcookie = ? ";
-			$whereBind[] = $visitorId;
-		}
-		
-		if($days != 0)
-		{
-			$timeLimit = mktime(0, 0, 0, date("m"),   date("d") - $days + 1,   date("Y"));
+		 }
+		 else
+		 {
+		 	// no $type is set --> ERROR
+		 	return false;
+		 }
 
-			$where[] = " visit_last_action_time > '".date('Y-m-d H:i:s',$timeLimit)."'";
-		}
-		
-		$sqlWhere = "";
-		if(count($where) > 0)
-		{
-			$sqlWhere = " WHERE " . join(' AND ', $where);
-		}
-		
-		$sql = "SELECT " . Piwik::prefixTable('log_link_visit_action') . ".`idaction_url`, " . Piwik::prefixTable('log_action') . ".`idaction`, " . Piwik::prefixTable('log_action') . ".`name` , " . Piwik::prefixTable('log_link_visit_action') . ".*
-				FROM " . Piwik::prefixTable('log_link_visit_action') . "
-				INNER JOIN " . Piwik::prefixTable('log_action') . " ON " . Piwik::prefixTable('log_link_visit_action') . ".`idaction_url`= " . Piwik::prefixTable('log_action') . ".`idaction` 
-				INNER JOIN " . Piwik::prefixTable('log_visit') . " ON " . Piwik::prefixTable('log_visit') . ".idvisit=" . Piwik::prefixTable('log_link_visit_action') . ".idvisit
-				$sqlWhere";
-
+		// return $sql by fetching
 		return Piwik_FetchAll($sql, $whereBind);
 	}
-	
+
 }
Index: plugins/Live/Visitor.php
===================================================================
--- plugins/Live/Visitor.php	(revision 1795)
+++ plugins/Live/Visitor.php	(working copy)
@@ -75,6 +75,9 @@
 			'screenIcon' => $this->getScreenTypeIcon(),
 			'plugins' => $this->getPlugins(),
 			'lastActionDateTime' => $this->getDateTimeLastAction(),
+			'isVisitorGoalConverted' => $this->isVisitorGoalConverted(),
+			'goalIcon' => $this->getGoalIcon(),
+   			'goalType' => $this->getGoalType(),		
 		);
 	}
 	
@@ -121,7 +124,7 @@
 	{
 		return $this->details['visitor_returning'];
 	}
-	
+
 	function getTimestampFirstAction()
 	{
 		return strtotime($this->details['visit_first_action_time']);
@@ -291,4 +294,42 @@
 	{
 		return date('Y-m-d H:i:s', strtotime($this->details['visit_last_action_time']));
 	}
-}
+
+	function isVisitorGoalConverted()
+	{
+		return $this->details['visit_goal_converted'];
+	}
+	
+	function getGoalType()
+	{
+		if(isset($this->details['match_attribute'])){
+			return $this->details['match_attribute'];
+		}
+		else {
+			return false;
+		}	
+	}
+	
+	function getGoalIcon()
+	{	
+		$goalicon = "";
+		if(isset($this->details['match_attribute'])){
+			switch ($this->details['match_attribute']) {
+	    		case "url":
+			    	$goalicon = "plugins/Live/templates/images/goal.png";
+	    			break;
+			    case "file":
+	        		$goalicon = "plugins/Live/templates/images/download.png";
+		        	break;
+			    case "external_website":
+	        		$goalicon = "plugins/Live/templates/images/outboundlink.png";
+		        	break;	
+			}
+			return $goalicon;
+		}
+		else {
+			return false;
+		}				
+	}
+		
+}
\ No newline at end of file
Index: plugins/Live/templates/lastVisits.tpl
===================================================================
--- plugins/Live/templates/lastVisits.tpl	(revision 1795)
+++ plugins/Live/templates/lastVisits.tpl	(working copy)
@@ -2,34 +2,34 @@
 	<div class="visit{if $visitor.idVisit % 2} alt{/if}">
 		<!--<div class="idvisit">{$visitor.idVisit}</div>-->
 		<div style="display:none" class="idvisit">{$visitor.idVisit}</div>
-	
+
 			<div class="datetime">
 				{$visitor.serverDatePretty} - {$visitor.serverTimePretty}
 				&nbsp;<img src="{$visitor.countryFlag}" title="{$visitor.country}, Provider {$visitor.provider}">
 				&nbsp;<img src="{$visitor.browserIcon}" title="{$visitor.browser} with plugins {$visitor.plugins} enabled">
-				&nbsp;<img src="{$visitor.operatingSystemIcon}" title="{$visitor.operatingSystem}, {$visitor.resolution}">		
+				&nbsp;<img src="{$visitor.operatingSystemIcon}" title="{$visitor.operatingSystem}, {$visitor.resolution}">
+				&nbsp;{if $visitor.isVisitorGoalConverted}<img src="{$visitor.goalIcon}" title="{$visitor.goalType}">{/if}
+				{if $visitor.isVisitorReturning}&nbsp;<img src="plugins/Live/templates/images/returningVisitor.gif" title="Returning Visitor">{/if}
+				&nbsp;<label id="" title="IP: {$visitor.ip} - Duration: {$visitor.visitLengthPretty}">more...</label>
 			</div>
-			<div class="settings">
-				{$visitor.ip} 
-				{if $visitor.isVisitorReturning}<img src="plugins/Live/templates/images/returningVisitor.gif" title="Returning Visitor">{/if}
-			</div>
+			<!--<div class="settings"></div>-->
 			<div class="referer">
-				{if $visitor.refererType != 'directEntry'}from <a href="{$visitor.refererUrl}"><img src="{$visitor.searchEngineIcon}"> {$visitor.refererName}</a> 
+				{if $visitor.refererType != 'directEntry'}from <a href="{$visitor.refererUrl}"><img src="{$visitor.searchEngineIcon}"> {$visitor.refererName}</a>
 					{if !empty($visitor.keywords)}"{$visitor.keywords}"{/if}
 				{/if}
 				{if $visitor.refererType == 'directEntry'}Direct entry{/if}
 			</div>
-		<div id="{$visitor.idVisit}_actions" class="actions">
+		<div id="{$visitor.idVisit}_actions" class="settings">
 			<span class="pagesTitle">Pages:</span>&nbsp;
 			{php} $col = 0;	{/php}
 			{foreach from=$visitor.actionDetails item=action}
-			  {php} 
-			  	$col++; 
+			  {php}
+			  	$col++;
 		  		if ($col>=9)
 		  		{
 				  $col=0;
 		  		}
-				{/php}	
+				{/php}
 				<a href="{$action.pageUrl}" target="_blank"><img align="middle" src="plugins/Live/templates/images/file{php} echo $col; {/php}.png" title="{$action.pageUrl}"></a>
 			{/foreach}
 		</div>
Index: plugins/Live/templates/index.tpl
===================================================================
--- plugins/Live/templates/index.tpl	(revision 1795)
+++ plugins/Live/templates/index.tpl	(working copy)
@@ -3,36 +3,36 @@
 
 <script type="text/javascript" charset="utf-8">
 
- 
-	$(document).ready(function() { 
+
+	$(document).ready(function() {
 		if($('#_spyTmp').size() == 0) {
 			$('#visitsLive > div:gt(2)').fadeEachDown(); // initial fade
-			$('#visitsLive').spy({ 
-				limit: 10, 
-				ajax: 'index.php?module=Live&idSite={/literal}{$idSite}{literal}&action=getLastVisitsStart', 
-				fadeLast: 2, 
+			$('#visitsLive').spy({
+				limit: 10,
+				ajax: 'index.php?module=Live&idSite={/literal}{$idSite}{literal}&action=getLastVisitsStart',
+				fadeLast: 2,
 				isDupes : check_for_dupe,
 				timeout: 20000,
-				customParameterName: 'minIdVisit', 
+				customParameterName: 'minIdVisit',
 				customParameterValueCallback: lastIdVisit,
 				fadeInSpeed: 1400
-			});
+			});	
 		}
 	});
-		
+
 	// first I'm ensuring that 'last' has been initialised (with last.constructor == Object),
 	// then prev.html() == last.html() will return true if the HTML is the same, or false,
 	// if I have a different entry.
 	function check_for_dupe(prev, last)
 	{
-		
+
 		if (last.constructor == Object)	{
 			return (prev.html() == last.html());
-		}	
+		}
 		else {
 			return 0;
-			
-		}	
+
+		}
 	}
 
 	function lastIdVisit()
@@ -46,7 +46,7 @@
 	var pauseDisabledImage = "plugins/Live/templates/images/pause_disabled.gif";
 	var playImage = "plugins/Live/templates/images/play.gif";
 	var playDisabledImage = "plugins/Live/templates/images/play_disabled.gif";
-	
+
 	function onClickPause()
 	{
 		$('#pauseImage').attr('src', pauseImage);
@@ -59,19 +59,28 @@
 		$('#pauseImage').attr('src', pauseDisabledImage);
 		return playSpy();
 	}
-	
+
 	// updates the numbers of total visits in startbox
 	function updateTotalVisits()
 	{
 		$("#visitsTotal").load("index.php?module=Live&idSite={/literal}{$idSite}{literal}&action=ajaxTotalVisitors");
 	}
-	
+
 	// updates the visit table, to refresh the already presented visotors pages
 	function updateVisitBox()
 	{
 		$("#visitsLive").load("index.php?module=Live&idSite={/literal}{$idSite}{literal}&action=getLastVisitsStart");
 	}
 
+	/* TOOLTIP */
+		$('#visitsLive label').tooltip({
+		    track: true,
+		    delay: 0,
+		    showURL: false,
+		    showBody: " - ",
+		    fade: 250
+		});
+
 </script>
 
 <style>
@@ -82,7 +91,7 @@
 #visitsLive .datetime, #visitsLive .country, #visitsLive .referer, #visitsLive .settings, #visitsLive .returning , #visitsLive .countActions{
 	border-bottom:1px solid #C1DAD7;
 	border-right:1px solid #C1DAD7;
-	padding:5px 5px 5px 12px;	
+	padding:5px 5px 5px 12px;
 }
 
 #visitsLive .datetime {
@@ -169,6 +178,6 @@
 </div>
 
 <div>
-	<a href="javascript:void(0);" onclick="onClickPause();"><img id="pauseImage" border="0" src="plugins/Live/templates/images/pause_disabled.gif"></a> 
+	<a href="javascript:void(0);" onclick="onClickPause();"><img id="pauseImage" border="0" src="plugins/Live/templates/images/pause_disabled.gif"></a>
 	<a href="javascript:void(0);" onclick="onClickPlay();"><img id="playImage" border="0" src="plugins/Live/templates/images/play.gif"></a>
 </div>
Index: plugins/Live/Controller.php
===================================================================
--- plugins/Live/Controller.php	(revision 1795)
+++ plugins/Live/Controller.php	(working copy)
@@ -1,11 +1,11 @@
 <?php
 /**
  * Piwik - Open source web analytics
- * 
+ *
  * @link http://piwik.org
  * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later
  * @version $Id$
- * 
+ *
  * @category Piwik_Plugins
  * @package Piwik_Live
  */
@@ -16,22 +16,22 @@
  */
 class Piwik_Live_Controller extends Piwik_Controller
 {
-	
+
 	function __construct()
 	{
 		parent::__construct();
 		$this->idSite = Piwik_Common::getRequestVar('idSite');
 		$this->minIdVisit = Piwik_Common::getRequestVar('minIdVisit', 0, 'int');
 	}
-		
+
 	function index()
 	{
 		$this->widget(true);
-	}	
-	
+	}
+
 	public function widget($fetch = false)
 	{
-		$view = Piwik_View::factory('index');		
+		$view = Piwik_View::factory('index');
 		$this->setGeneralVariablesView($view);
 		$view->visitorsCountHalfHour = $this->getUsersInLastXMin(30);
 		$view->visitorsCountToday = $this->getUsersInLastXDays(1);
@@ -39,23 +39,23 @@
 		$view->pisToday = $this->getPageImpressionsInLastXDays(1);
 		$view->visitors = $this->getLastVisitsStart($fetch = true);
 
-		echo $view->render();		
+		echo $view->render();
 	}
-	
+
 	public function getLastVisitsDetails($fetch = false)
 	{
 		$view = Piwik_ViewDataTable::factory('');
 		$view->init( $this->pluginName,
-							__FUNCTION__, 
+							__FUNCTION__,
 						'Live.getLastVisitsDetails',
-						'getPagesFromVisitId');											
+						'getPagesFromVisitId');
 // All colomns in DB which could be shown
-//'ip', 'idVisit', 'countActions', 'isVisitorReturning', 'country', 'countryFlag', 'continent', 'provider', 'providerUrl', 'idSite', 
-//'serverDate', 'visitLength', 'visitLengthPretty', 'firstActionTimestamp', 'lastActionTimestamp', 'refererType', 'refererName', 	
+//'ip', 'idVisit', 'countActions', 'isVisitorReturning', 'country', 'countryFlag', 'continent', 'provider', 'providerUrl', 'idSite',
+//'serverDate', 'visitLength', 'visitLengthPretty', 'firstActionTimestamp', 'lastActionTimestamp', 'refererType', 'refererName',
 //'keywords', 'refererUrl', 'searchEngineUrl', 'searchEngineIcon', 'operatingSystem', 'operatingSystemShortName', 'operatingSystemIcon',
 //'browserFamily', 'browserFamilyDescription', 'browser', 'browserIcon', 'screen', 'resolution', 'screenIcon', 'plugins', 'lastActionDateTime',
 //'serverDatePretty', 'serverTimePretty', 'actionDetails'
-		
+
 		$view->setColumnsToDisplay(array(
 //			'label',
 			'idVisit',
@@ -78,7 +78,7 @@
 			'idVisit' => Piwik_Translate(''),
 			'serverDatePretty' => Piwik_Translate('Live_Date'),
 			'serverTimePretty' => Piwik_Translate('Live_Time'),
-			'ip' => 'IP', 
+			'ip' => 'IP',
 			'countActions' => Piwik_Translate('VisitorInterest_ColumnPagesPerVisit'),
 			'visitLengthPretty' => Piwik_Translate('VisitorInterest_ColumnVisitDuration'),
 			'keywords' => Piwik_Translate('Referers_ColumnKeyword'),
@@ -92,9 +92,16 @@
 
 		$view->disableSort();
 		$view->setLimit(10);
-		$view->disableExcludeLowPopulation();		
+		$view->disableExcludeLowPopulation();
 		$view->setSortedColumn('idVisit', 'ASC');
-		
+		$view->disableSearchBox();
+		// "Include low population" link won't be displayed under this table
+		$view->disableExcludeLowPopulation();
+		// disable the tag cloud,  pie charts, bar chart icons
+		$view->disableShowAllViewsIcons();
+		// disable the button "show more datas"
+		$view->disableShowAllColumns();
+
 		return $this->renderView($view, $fetch);
 	}
 
@@ -102,9 +109,9 @@
 	{
 		$view = Piwik_ViewDataTable::factory('');
 		$view->init( $this->pluginName,
-							__FUNCTION__, 
+							__FUNCTION__,
 						'Live.getLastVisitsForVisitor',
-						'getPagesFromVisitId');	
+						'getPagesFromVisitId');
 
 		#$view->disableSearchBox();
 		#$view->disableExcludeLowPopulation();
@@ -112,22 +119,22 @@
 		#$view->setColumnTranslation('label', Piwik_Translate('Referers_ColumnKeyword'));
 
 		return $this->renderView($view, $fetch);
-	}	
+	}
 
-	public function getLastVisitsStart($fetch = false) 
+	public function getLastVisitsStart($fetch = false)
 	{
 		$view = Piwik_View::factory('lastVisits');
 		$view->visitors = $this->getLastVisits(10);
-		
+
 		$rendered = $view->render($fetch);
-		
+
 		if($fetch)
 		{
 			return $rendered;
 		}
-		echo $rendered;		
+		echo $rendered;
 	}
-		
+
 	public function getLastVisits($limit = 10)
 	{
 		$api = new Piwik_API_Request("method=Live.getLastVisits&idSite=$this->idSite&limit=$limit&minIdVisit=$this->minIdVisit&format=php&serialize=0&disable_generic_filters=1");
@@ -135,44 +142,44 @@
 
 		return $visitors;
 	}
-	
+
 	public function getUsersInLastXMin($minutes = 30) {
 		$api = new Piwik_API_Request("method=Live.getUsersInLastXMin&idSite=".$this->idSite."&limit=10000&minIdVisit=".$this->minIdVisit."&minutes=".$minutes."&format=php&serialize=0&disable_generic_filters=1");
 		$visitors_halfhour = $api->process();
-		
+
 		return count($visitors_halfhour);
 	}
-	
+
 	public function getUsersInLastXDays($days = 1) {
 		$api = new Piwik_API_Request("method=Live.getUsersInLastXDays&idSite=$this->idSite&limit=50000&minIdVisit=$this->minIdVisit&days=$days&format=php&serialize=0&disable_generic_filters=1");
 		$visitors_today = $api->process();
-		
+
 		return count($visitors_today);
 	}
-	
+
 	public function getPageImpressionsInLastXMin($minutes = 30) {
 		$api = new Piwik_API_Request("method=Live.getPageImpressionsInLastXMin&idSite=$this->idSite&limit=10000&minIdVisit=$this->minIdVisit&minutes=$minutes&format=php&serialize=0&disable_generic_filters=1");
 		$pis_halfhour = $api->process();
-		
+
 		return count($pis_halfhour);
 	}
-	
+
 	public function getPageImpressionsInLastXDays($days = 1) {
 		$api = new Piwik_API_Request("method=Live.getPageImpressionsInLastXDays&idSite=$this->idSite&limit=50000&minIdVisit=$this->minIdVisit&days=$days&format=php&serialize=0&disable_generic_filters=1");
 		$pis_today = $api->process();
-		
+
 		return count($pis_today);
 	}
-	
+
 	public function ajaxTotalVisitors($fetch = false)
 	{
-		$view = Piwik_View::factory('totalVisits');		
+		$view = Piwik_View::factory('totalVisits');
 		$this->setGeneralVariablesView($view);
 		$view->visitorsCountHalfHour = $this->getUsersInLastXMin(30);
 		$view->visitorsCountToday = $this->getUsersInLastXDays(1);
 		$view->pisHalfhour = $this->getPageImpressionsInLastXMin(30);
 		$view->pisToday = $this->getPageImpressionsInLastXDays(1);
-		
-		echo $view->render();		
-	}	
+
+		echo $view->render();
+	}
 }

